Module: Legion::Extensions::Agentic::Social::Attachment::Runners::Attachment
- Includes:
- Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/social/attachment/runners/attachment.rb
Instance Method Summary collapse
- #attachment_stats ⇒ Object
- #reflect_on_bonds(_tick_results: {}, _bond_summary: {}) ⇒ Object
- #update_attachment(tick_results: {}, human_observations: []) ⇒ Object
Instance Method Details
#attachment_stats ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/legion/extensions/agentic/social/attachment/runners/attachment.rb', line 56 def (**) partner_id = resolve_partner_id partner_model = .get(partner_id) if partner_id { bonds_tracked: .all_models.size, partner_bond: partner_model&.to_h } end |
#reflect_on_bonds(_tick_results: {}, _bond_summary: {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/legion/extensions/agentic/social/attachment/runners/attachment.rb', line 28 def reflect_on_bonds(_tick_results: {}, _bond_summary: {}, **) store = apollo_local_store return { success: false, error: :no_store } unless store partner_id = resolve_partner_id model = .get(partner_id) if partner_id comm_patterns = read_communication_patterns(store, partner_id) arc_state = read_relationship_arc(store, partner_id) health = compute_relationship_health(model, comm_patterns, arc_state) { bonds_reflected: .all_models.size, partner_bond: if model { stage: model.bond_stage, strength: model., style: model., health: health, milestones_today: arc_state[:milestones_today] || [], narrative: build_narrative(model, health, arc_state), absence_exceeds_pattern: absence_exceeds_pattern?(partner_id) } end } rescue StandardError => e { success: false, error: e. } end |
#update_attachment(tick_results: {}, human_observations: []) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/legion/extensions/agentic/social/attachment/runners/attachment.rb', line 13 def (tick_results: {}, human_observations: [], **) agents = collect_agent_ids(tick_results, human_observations) return { agents_updated: 0 } if agents.empty? agents.each do |agent_id| model = .get_or_create(agent_id) signals = extract_signals(agent_id, tick_results, human_observations) model.update_from_signals(signals) model.update_stage! model.derive_style!(extract_style_signals(agent_id, human_observations)) end { agents_updated: agents.size, models: agents.map { |id| .get(id)&.to_h } } end |