Class: OllamaAgent::Runtime::KernelPipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/ollama_agent/runtime/kernel_pipeline.rb

Overview

End-to-end kernel route: saga, locks, atomic write, verify, integration queue, commit/compensate. rubocop:disable Metrics/ClassLength – FSM orchestration; assembly holds wiring

Constant Summary collapse

SUPPORTED_KINDS =
%w[atomic_write edit_file apply_patch delete_file rename_file].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workspace_root:, database_registry:, ownership_index:, fencing_allocator:, lock_manager:, intent_reservation:, atomic_mutator:, saga_coordinator:, isolated_validator:, post_condition_verifier:, blob_store:, compensation_manifest:, compensation_engine:, saga_recovery_daemon:, integration_queue:, wal:, clock_epoch_provider:, hooks: nil) ⇒ KernelPipeline

rubocop:disable Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize – explicit runtime wiring per E13



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ollama_agent/runtime/kernel_pipeline.rb', line 26

def initialize(workspace_root:, database_registry:, ownership_index:, fencing_allocator:, lock_manager:,
               intent_reservation:, atomic_mutator:, saga_coordinator:, isolated_validator:,
               post_condition_verifier:, blob_store:, compensation_manifest:, compensation_engine:,
               saga_recovery_daemon:, integration_queue:, wal:, clock_epoch_provider:, hooks: nil)
  @workspace_root = workspace_root
  @database_registry = database_registry
  @ownership_index = ownership_index
  @fencing_allocator = fencing_allocator
  @lock_manager = lock_manager
  @intent_reservation = intent_reservation
  @atomic_mutator = atomic_mutator
  @saga_coordinator = saga_coordinator
  @isolated_validator = isolated_validator
  @post_condition_verifier = post_condition_verifier
  @blob_store = blob_store
  @compensation_manifest = compensation_manifest
  @compensation_engine = compensation_engine
  @saga_recovery_daemon = saga_recovery_daemon
  @integration_queue = integration_queue
  @wal = wal
  @clock_epoch_provider = clock_epoch_provider
  @hooks = hooks
end

Instance Attribute Details

#workspace_rootObject (readonly)

rubocop:enable Metrics/ParameterLists, Metrics/MethodLength, Metrics/AbcSize



51
52
53
# File 'lib/ollama_agent/runtime/kernel_pipeline.rb', line 51

def workspace_root
  @workspace_root
end

Class Method Details

.build_for_workspaceObject



21
22
23
# File 'lib/ollama_agent/runtime/kernel_pipeline.rb', line 21

def self.build_for_workspace(...)
  KernelPipelineAssembly.build_for_workspace(...)
end

Instance Method Details

#execute(intent:, manifest_id:, mode: "normal") ⇒ Hash

rubocop:disable Metrics/MethodLength – guard + single orchestration entry

Returns:

  • (Hash)

    :result, :state, :manifest_id, optional :error



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/ollama_agent/runtime/kernel_pipeline.rb', line 55

def execute(intent:, manifest_id:, mode: "normal")
  intent = normalize_intent(intent)
  kind = intent[:kind].to_s
  return emit_pipeline_complete(manifest_id, unknown_kind_reply(manifest_id, kind)) unless SUPPORTED_KINDS.include?(kind)

  ge = guard_delete_rename_paths_if_applicable(intent, kind)
  if ge
    payload = { result: :precondition_failed, state: nil, manifest_id: manifest_id, error: ge }
    return emit_pipeline_complete(manifest_id, payload)
  end

  emit_pipeline_complete(manifest_id, run_after_path_guard(kind, intent, manifest_id, mode))
end