Class: OllamaAgent::State::ReentryPacket

Inherits:
Object
  • Object
show all
Defined in:
lib/ollama_agent/state/reentry_packet.rb

Overview

Bounded post-escalation handoff packet for local planner re-entry.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason:, workspace_fingerprint:, changed_files:, summary:) ⇒ ReentryPacket

Returns a new instance of ReentryPacket.



13
14
15
16
17
18
# File 'lib/ollama_agent/state/reentry_packet.rb', line 13

def initialize(reason:, workspace_fingerprint:, changed_files:, summary:)
  @reason = reason
  @workspace_fingerprint = workspace_fingerprint
  @changed_files = Array(changed_files).sort.freeze
  @summary = summary
end

Instance Attribute Details

#changed_filesObject (readonly)

Returns the value of attribute changed_files.



11
12
13
# File 'lib/ollama_agent/state/reentry_packet.rb', line 11

def changed_files
  @changed_files
end

#reasonObject (readonly)

Returns the value of attribute reason.



11
12
13
# File 'lib/ollama_agent/state/reentry_packet.rb', line 11

def reason
  @reason
end

#summaryObject (readonly)

Returns the value of attribute summary.



11
12
13
# File 'lib/ollama_agent/state/reentry_packet.rb', line 11

def summary
  @summary
end

#workspace_fingerprintObject (readonly)

Returns the value of attribute workspace_fingerprint.



11
12
13
# File 'lib/ollama_agent/state/reentry_packet.rb', line 11

def workspace_fingerprint
  @workspace_fingerprint
end

Class Method Details

.build(reason:, workspace_root:, ast_summarizer:, fingerprint_calculator:, touched_methods: []) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ollama_agent/state/reentry_packet.rb', line 21

def build(reason:, workspace_root:, ast_summarizer:, fingerprint_calculator:, touched_methods: [])
  fingerprint = fingerprint_calculator.compute.to_s
  changed = GitChangedPaths.list(workspace_root)
  summary = summary_json(ast_summarizer, changed, touched_methods)
  new(
    reason: reason,
    workspace_fingerprint: fingerprint,
    changed_files: changed,
    summary: summary
  )
end

Instance Method Details

#to_hObject



43
44
45
46
47
48
49
50
# File 'lib/ollama_agent/state/reentry_packet.rb', line 43

def to_h
  {
    "reason" => reason,
    "workspace_fingerprint" => workspace_fingerprint,
    "changed_files" => changed_files,
    "summary" => summary
  }
end