samagotchi 0.182.0 → 0.183.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -1
  3. data/bin/chi +3 -1
  4. data/docs/architecture.md +16 -6
  5. data/docs/bundle-authoring.md +1 -1
  6. data/docs/bundles.md +103 -4
  7. data/docs/cli.md +28 -6
  8. data/docs/configuration.md +2 -1
  9. data/docs/guardrails.md +16 -1
  10. data/docs/internals/block-renderers.md +58 -3
  11. data/docs/internals/bridge.md +13 -5
  12. data/docs/internals/bundles.md +21 -4
  13. data/docs/internals/engine.md +18 -8
  14. data/docs/internals/remote-sessions.md +24 -5
  15. data/docs/internals/web-frontend.md +88 -28
  16. data/docs/internals/working-set.md +1 -1
  17. data/docs/mcp-server.md +80 -0
  18. data/docs/plugins.md +308 -21
  19. data/docs/sessions.md +3 -3
  20. data/docs/sub-agent.md +9 -0
  21. data/docs/testing.md +3 -1
  22. data/docs/thin-clients.md +146 -0
  23. data/lib/samagotchi/bridge/pending_card.rb +4 -3
  24. data/lib/samagotchi/bridge/sse_writer.rb +16 -15
  25. data/lib/samagotchi/bridge.rb +59 -68
  26. data/lib/samagotchi/bundle_command/api_calls.rb +1 -1
  27. data/lib/samagotchi/bundle_command/check.rb +36 -19
  28. data/lib/samagotchi/bundle_command.rb +50 -21
  29. data/lib/samagotchi/bundle_manifest.rb +101 -4
  30. data/lib/samagotchi/bundles/dev/manifest.yml +2 -2
  31. data/lib/samagotchi/bundles/mcp/client.rb +260 -0
  32. data/lib/samagotchi/bundles/mcp/content.rb +107 -0
  33. data/lib/samagotchi/bundles/mcp/http_client.rb +407 -0
  34. data/lib/samagotchi/bundles/mcp/manifest.yml +13 -5
  35. data/lib/samagotchi/bundles/mcp/oauth.rb +814 -0
  36. data/lib/samagotchi/bundles/mcp/plugin.rb +556 -574
  37. data/lib/samagotchi/bundles/mcp/tools.rb +232 -0
  38. data/lib/samagotchi/bundles/system/config_modification_protocol.md +10 -2
  39. data/lib/samagotchi/bundles/system/manifest.yml +2 -2
  40. data/lib/samagotchi/cli/parent_wait.rb +5 -3
  41. data/lib/samagotchi/command_intake.rb +7 -0
  42. data/lib/samagotchi/commands/registry.rb +8 -3
  43. data/lib/samagotchi/continue_offer.rb +24 -15
  44. data/lib/samagotchi/engine/block_fix.rb +4 -4
  45. data/lib/samagotchi/engine/cards.rb +14 -5
  46. data/lib/samagotchi/engine/events.rb +10 -15
  47. data/lib/samagotchi/engine/models.rb +1 -1
  48. data/lib/samagotchi/engine/plugins.rb +3 -0
  49. data/lib/samagotchi/engine/recap.rb +1 -1
  50. data/lib/samagotchi/engine/side_requests.rb +1 -1
  51. data/lib/samagotchi/engine/sign_in.rb +142 -0
  52. data/lib/samagotchi/engine/turn_end.rb +3 -3
  53. data/lib/samagotchi/engine.rb +43 -27
  54. data/lib/samagotchi/engine_snapshots.rb +1 -1
  55. data/lib/samagotchi/guardrail_wiring.rb +3 -1
  56. data/lib/samagotchi/guardrails/protected_paths.rb +51 -2
  57. data/lib/samagotchi/guardrails/verdict.rb +3 -2
  58. data/lib/samagotchi/hold_stop.rb +4 -4
  59. data/lib/samagotchi/idle_recap.rb +19 -11
  60. data/lib/samagotchi/idle_reminders.rb +7 -5
  61. data/lib/samagotchi/idle_scheduler.rb +7 -10
  62. data/lib/samagotchi/installed_bundles/dir.rb +37 -0
  63. data/lib/samagotchi/installed_bundles/manifest.rb +7 -1
  64. data/lib/samagotchi/installed_bundles/plugin_ref.rb +9 -5
  65. data/lib/samagotchi/installed_bundles/record.rb +3 -2
  66. data/lib/samagotchi/installed_bundles/standing.rb +3 -1
  67. data/lib/samagotchi/llm/http.rb +96 -5
  68. data/lib/samagotchi/mcp_command.rb +110 -0
  69. data/lib/samagotchi/mcp_server/http.rb +112 -0
  70. data/lib/samagotchi/mcp_server/protocol.rb +244 -0
  71. data/lib/samagotchi/mcp_server/stdio.rb +92 -0
  72. data/lib/samagotchi/mcp_server/text.rb +155 -0
  73. data/lib/samagotchi/mcp_server/tools.rb +245 -0
  74. data/lib/samagotchi/memory_bundle/asset_installer.rb +40 -12
  75. data/lib/samagotchi/memory_bundle/builder.rb +20 -2
  76. data/lib/samagotchi/memory_bundle/installed_copy.rb +1 -1
  77. data/lib/samagotchi/memory_bundle/installer.rb +16 -3
  78. data/lib/samagotchi/memory_bundle/provenance.rb +18 -1
  79. data/lib/samagotchi/memory_bundle/shas.rb +6 -4
  80. data/lib/samagotchi/memory_bundle/shipped_update.rb +7 -3
  81. data/lib/samagotchi/memory_bundle/status.rb +15 -6
  82. data/lib/samagotchi/memory_bundle/uninstaller.rb +9 -4
  83. data/lib/samagotchi/plugin/api.rb +6 -1
  84. data/lib/samagotchi/plugin/card.rb +36 -11
  85. data/lib/samagotchi/plugin/context.rb +63 -6
  86. data/lib/samagotchi/plugin/http.rb +40 -15
  87. data/lib/samagotchi/plugin/http_errors.rb +15 -0
  88. data/lib/samagotchi/plugin/http_stream.rb +86 -0
  89. data/lib/samagotchi/plugin/http_transport.rb +58 -16
  90. data/lib/samagotchi/plugin/loader.rb +18 -11
  91. data/lib/samagotchi/plugin/secrets.rb +266 -0
  92. data/lib/samagotchi/plugin/sign_in.rb +392 -0
  93. data/lib/samagotchi/plugin/sse_reader.rb +103 -0
  94. data/lib/samagotchi/queued_command.rb +28 -4
  95. data/lib/samagotchi/recap_setup.rb +13 -4
  96. data/lib/samagotchi/ref.rb +3 -2
  97. data/lib/samagotchi/relay_verifier.rb +8 -7
  98. data/lib/samagotchi/relay_watcher.rb +4 -4
  99. data/lib/samagotchi/run_options.rb +2 -1
  100. data/lib/samagotchi/send_command.rb +54 -41
  101. data/lib/samagotchi/session_access/ask.rb +244 -0
  102. data/lib/samagotchi/session_access/contract.rb +5 -0
  103. data/lib/samagotchi/session_access/exchange/token.rb +101 -0
  104. data/lib/samagotchi/session_access/exchange.rb +173 -0
  105. data/lib/samagotchi/session_access/local.rb +25 -6
  106. data/lib/samagotchi/session_access/remote.rb +4 -1
  107. data/lib/samagotchi/session_command_catalog.rb +10 -0
  108. data/lib/samagotchi/session_commands.rb +17 -0
  109. data/lib/samagotchi/session_config.rb +4 -4
  110. data/lib/samagotchi/session_observer.rb +27 -0
  111. data/lib/samagotchi/steer_cut.rb +4 -3
  112. data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +4 -1
  113. data/lib/samagotchi/terminal_ui/formatting.rb +15 -0
  114. data/lib/samagotchi/testing/boundary.rb +4 -0
  115. data/lib/samagotchi/testing/bundle.rb +48 -2
  116. data/lib/samagotchi/testing/fake_http.rb +60 -15
  117. data/lib/samagotchi/testing/host.rb +4 -1
  118. data/lib/samagotchi/testing/recorder.rb +45 -5
  119. data/lib/samagotchi/tools/tool_index.rb +14 -3
  120. data/lib/samagotchi/version.rb +1 -1
  121. data/lib/samagotchi/web/app.rb +8 -6
  122. data/lib/samagotchi/web/ask_routes.rb +292 -0
  123. data/lib/samagotchi/web/mcp_route.rb +88 -0
  124. data/lib/samagotchi/web/public/app.js +2 -3
  125. data/lib/samagotchi/web/public/block_frame.js +72 -11
  126. data/lib/samagotchi/web/public/block_host.js +44 -8
  127. data/lib/samagotchi/web/public/block_regions.js +126 -0
  128. data/lib/samagotchi/web/public/card.js +22 -9
  129. data/lib/samagotchi/web/public/card_actions.js +21 -0
  130. data/lib/samagotchi/web/public/card_kinds.js +1 -1
  131. data/lib/samagotchi/web/public/card_registry.js +3 -2
  132. data/lib/samagotchi/web/public/data.js +15 -12
  133. data/lib/samagotchi/web/public/delete_sheet.js +222 -162
  134. data/lib/samagotchi/web/public/diagram_wiring.js +28 -0
  135. data/lib/samagotchi/web/public/format.js +3 -0
  136. data/lib/samagotchi/web/public/index.html +52 -7
  137. data/lib/samagotchi/web/public/more_sheet.js +6 -4
  138. data/lib/samagotchi/web/public/picture_regions.js +243 -0
  139. data/lib/samagotchi/web/public/picture_viewer.js +113 -12
  140. data/lib/samagotchi/web/public/refs.js +5 -3
  141. data/lib/samagotchi/web/public/region_hit.js +144 -0
  142. data/lib/samagotchi/web/public/removal_sheet_model.js +275 -0
  143. data/lib/samagotchi/web/public/running_tasks.js +6 -4
  144. data/lib/samagotchi/web/public/session_actions.js +105 -100
  145. data/lib/samagotchi/web/session_access_routes.rb +14 -11
  146. data/lib/samagotchi/web/session_control.rb +31 -9
  147. data/lib/samagotchi/web/session_create.rb +2 -2
  148. data/lib/samagotchi/worker/child_side.rb +3 -2
  149. data/lib/samagotchi/worker/command_queue.rb +13 -13
  150. data/lib/samagotchi/worker/leave.rb +3 -3
  151. data/lib/samagotchi/worker/scratch.rb +6 -6
  152. data/lib/samagotchi/worker/signal_grace.rb +6 -5
  153. data/lib/samagotchi/worker/startup.rb +3 -3
  154. data/lib/samagotchi/worker/wake_turns.rb +4 -4
  155. data/lib/samagotchi/worker.rb +32 -21
  156. data/lib/samagotchi/worker_exit_claim.rb +1 -1
  157. data/lib/samagotchi/worker_idle_exit.rb +18 -9
  158. data/lib/samagotchi/worker_inbound.rb +12 -7
  159. data/lib/samagotchi/worker_participant_gate.rb +9 -7
  160. data/lib/samagotchi/worker_task_wakes.rb +7 -5
  161. metadata +31 -1
@@ -11,7 +11,8 @@ module Samagotchi
11
11
  # (under @signal_mutex). Worker writes the rest it reads: @run_thread
12
12
  # (#run), @loop_started (#run_loop), @left_loop (#run's ensure),
13
13
  # @turn_ending (the turn observer) and the grace ivars and @signal_mutex
14
- # (#initialize). Reads those, @signals, @engine, @waker, @session_id and
14
+ # (#initialize). Reads those, @signals, @turn_state (nil-guarded: a
15
+ # signal may come before #start set it), @waker, @session_id and
15
16
  # @state_dir.
16
17
  module SignalGracePart
17
18
  # How long a signalled worker's turn has to end (it is canceled at once,
@@ -48,7 +49,7 @@ module Samagotchi
48
49
  # for it (the loop's first look leaves). A signal after the loop left
49
50
  # (the teardown, the caller's last steps) only brings the hard exit.
50
51
  def signalled(name, count)
51
- Log.info(:worker, "signal", signal: name, count: count, turn_running: @engine&.turn_running? || false)
52
+ Log.info(:worker, "signal", signal: name, count: count, turn_running: @turn_state&.running? || false)
52
53
  return signal_hard_exit if @left_loop
53
54
 
54
55
  @waker.wake
@@ -58,9 +59,9 @@ module Samagotchi
58
59
  hooks_deadline = deadline + @signal_hard_exit
59
60
  ended = false
60
61
  until @left_loop
61
- running = @engine&.turn_running?
62
+ running = @turn_state&.running?
62
63
  ended ||= running && @turn_ending
63
- @engine.cancel_current_turn!(:signal) if running && !ended
64
+ @turn_state.cancel!(:signal) if running && !ended
64
65
  break if @loop_started && Process.clock_gettime(Process::CLOCK_MONOTONIC) >= (ended ? hooks_deadline : deadline)
65
66
 
66
67
  sleep(SIGNAL_RETRY)
@@ -85,7 +86,7 @@ module Samagotchi
85
86
  expired = @signal_mutex.synchronize { !@grace_expired && !@left_loop && (@grace_expired = true) }
86
87
  return unless expired
87
88
 
88
- Log.warn(:worker, "signal_grace_expired", signal: name, turn_running: @engine&.turn_running? || false)
89
+ Log.warn(:worker, "signal_grace_expired", signal: name, turn_running: @turn_state&.running? || false)
89
90
  save_or_log(:signal) { save_session }
90
91
  # Not once the loop has left (it may have, during the save).
91
92
  @signal_mutex.synchronize { @run_thread&.raise(SignalException.new(name)) unless @left_loop }
@@ -14,7 +14,7 @@ module Samagotchi
14
14
  # #drop_dead_question. Called by #start and #serve only; no state of its
15
15
  # own. Writes @session (the interrupted turn's end, the stale status, a
16
16
  # dead question) and saves it. Reads @session, @session_dir, @session_id,
17
- # @state_dir and @engine.
17
+ # @state_dir, @engine and @event_log.
18
18
  module StartupPart
19
19
  private
20
20
 
@@ -71,8 +71,8 @@ module Samagotchi
71
71
  value = @session.parent_answers
72
72
  return unless Guardrails::ParentPolicy.unknown_level?(value)
73
73
 
74
- @engine.announce({ type: :guardrail_warning, label: "parent_answers",
75
- message: "parent_answers #{value.inspect} in session #{@session_id} isn't hard/standard/soft; hard applies" })
74
+ @event_log.announce({ type: :guardrail_warning, label: "parent_answers",
75
+ message: "parent_answers #{value.inspect} in session #{@session_id} isn't hard/standard/soft; hard applies" })
76
76
  end
77
77
 
78
78
  # A question saved by a worker that died while it waited (an
@@ -17,7 +17,7 @@ module Samagotchi
17
17
  # the idle loop's sleep (#idle_wait). Glue over WorkerWakes, WorkerTaskWakes
18
18
  # and WorkerInbound: it writes no ivar of its own. Reads @child_reports,
19
19
  # @wakes, @turn_flow, @inbound, @continue_offer, @task_wakes, @engine,
20
- # @session_dir and @poll_interval.
20
+ # @event_log, @session_dir and @poll_interval.
21
21
  module WakeTurnsPart
22
22
  # A reminder turn's origin: chi's own (system:reminder). Its run gets
23
23
  # an id of its own (#wake_origin); this constant has none.
@@ -79,9 +79,9 @@ module Samagotchi
79
79
  return unless @wakes.notice_budget!
80
80
 
81
81
  count = SessionInbox.find_ring_files(@session_dir).map { |f| SessionInbox.read_ring(f)&.dig(:child_id) }.uniq.size
82
- @engine.announce(type: :hook_notice, hook: "delegate", level: :info, between_turns: true,
83
- text: "#{count} delegate report#{"s" if count != 1} waiting; #{count == 1 ? "it joins" : "they join"} " \
84
- "your next message (#{@wakes.max} turn#{"s" if @wakes.max != 1} ran for reports in a row, #{ChildRing::MAX_WAKES_KEY})")
82
+ @event_log.announce(type: :hook_notice, hook: "delegate", level: :info, between_turns: true,
83
+ text: "#{count} delegate report#{"s" if count != 1} waiting; #{count == 1 ? "it joins" : "they join"} " \
84
+ "your next message (#{@wakes.max} turn#{"s" if @wakes.max != 1} ran for reports in a row, #{ChildRing::MAX_WAKES_KEY})")
85
85
  end
86
86
 
87
87
  # A wake turn (a delegate report's, an attached context change's, a
@@ -276,9 +276,16 @@ module Samagotchi
276
276
  # runs from the leave) and restored into it after.
277
277
  carried = take_carried_reminders
278
278
  @engine = build_engine
279
+ # The Engine's event log, turn state, question desk and steer cut,
280
+ # handed to the Bridge and the collaborators (read here, not in
281
+ # #start_bridge, whose rescue would hide a missing one).
282
+ @event_log = @engine.event_log
283
+ @turn_state = @engine.turn_state
284
+ @question_desk = @engine.question_desk
285
+ @steer_cut = @engine.steer_cut
279
286
  restore_carried_reminders(carried)
280
287
  @config_restart_unsubscribe = ConfigFile.watch_restart_settings!(process: :worker) do |message|
281
- @engine.announce(type: :hook_notice, hook: "config", text: message, level: :warn, between_turns: true)
288
+ @event_log.announce(type: :hook_notice, hook: "config", text: message, level: :warn, between_turns: true)
282
289
  end
283
290
  prune_tombstones
284
291
  settle_interrupted_turn
@@ -289,7 +296,7 @@ module Samagotchi
289
296
  @engine.session = @session
290
297
  # May this participant act (loop thread only): a turn as it starts,
291
298
  # the drain, the mid-turn stop, the Continue.
292
- @participant_gate = WorkerParticipantGate.new(engine: @engine, session: @session, session_id: @session_id,
299
+ @participant_gate = WorkerParticipantGate.new(engine: @engine, event_log: @event_log, session: @session, session_id: @session_id,
293
300
  state_dir: @state_dir, session_dir: @session_dir,
294
301
  hook: Engine::PARTICIPANTS_HOOK)
295
302
  # Who is in the review as the worker starts: no notice for them
@@ -304,7 +311,8 @@ module Samagotchi
304
311
  @turn_flow = TurnFlow.new(engine: @engine)
305
312
  # Its question's answer is queued as the matching /continue (the
306
313
  # Bridge exists by the time anyone answers).
307
- @continue_offer = ContinueOffer.new(engine: @engine, turn_flow: @turn_flow, run_turn: method(:run_engine_turn),
314
+ @continue_offer = ContinueOffer.new(engine: @engine, event_log: @event_log, turn_state: @turn_state,
315
+ question_desk: @question_desk, turn_flow: @turn_flow, run_turn: method(:run_engine_turn),
308
316
  max_iterations: method(:max_iterations),
309
317
  participant_refused: @participant_gate.method(:refusal),
310
318
  save: -> { save_or_log(:command) { save_session } },
@@ -319,11 +327,11 @@ module Samagotchi
319
327
  @turn_end_seq = 0
320
328
  # The background tasks this session started and hasn't seen finish:
321
329
  # one that finishes unseen wakes the idle session (#run_task_wake).
322
- @task_wakes = WorkerTaskWakes.new(engine: @engine, session: @session, wakes: @wakes,
330
+ @task_wakes = WorkerTaskWakes.new(engine: @engine, event_log: @event_log, session: @session, wakes: @wakes,
323
331
  awaiting_continue: -> { @turn_flow.awaiting_continue? },
324
332
  idle: -> { nothing_queued? && !@exit_claim.taken? },
325
333
  save: -> { save_or_log(:task_notes) { save_session } })
326
- @engine.subscribe(observer: lambda { |event|
334
+ @event_log.subscribe(observer: lambda { |event|
327
335
  if Events::TURN_END.include?(event[:type])
328
336
  @turn_end_seq = event[:event_seq]
329
337
  @turn_end_type = event[:type]
@@ -345,7 +353,7 @@ module Samagotchi
345
353
  peer_sources: @engine.peer_sources, peer_turns: -> { @wakes.peer_turns })
346
354
  # What comes in between turns, and how each kind is saved.
347
355
  @inbound = WorkerInbound.new(session: @session, state_dir: @state_dir, session_dir: @session_dir, engine: @engine,
348
- context_absorber: @context_absorber, wakes: @wakes,
356
+ event_log: @event_log, turn_state: @turn_state, context_absorber: @context_absorber, wakes: @wakes,
349
357
  awaiting_continue: -> { @turn_flow.awaiting_continue? },
350
358
  stopped: -> { stopped_on_disk? },
351
359
  queue_command: lambda { |line, client_id, after_file, enqueued_id, author: nil|
@@ -369,7 +377,8 @@ module Samagotchi
369
377
  # The Bridge (UIs and clients reach the worker from here on), then the
370
378
  # idle-exit policy.
371
379
  def serve
372
- @bridge = start_bridge(engine: @engine, state_dir: @state_dir, session_id: @session_id,
380
+ @bridge = start_bridge(engine: @engine, event_log: @event_log, turn_state: @turn_state, question_desk: @question_desk,
381
+ steer_cut: @steer_cut, state_dir: @state_dir, session_id: @session_id,
373
382
  on_input: -> { @waker.wake },
374
383
  on_command: method(:on_command),
375
384
  on_exit_request: method(:exit_request),
@@ -388,7 +397,7 @@ module Samagotchi
388
397
  @engine.announce_load_events!
389
398
  announce_session_warnings
390
399
  @idle_exit = WorkerIdleExit.new(
391
- engine: @engine, bridge: @bridge,
400
+ engine: @engine, turn_state: @turn_state, question_desk: @question_desk, bridge: @bridge,
392
401
  timeout_minutes: @idle_exit_minutes || config_idle_exit_minutes,
393
402
  input_pending: method(:input_pending?),
394
403
  awaiting_continue: -> { @turn_flow.awaiting_continue? },
@@ -403,8 +412,8 @@ module Samagotchi
403
412
  # them so "stop them and exit" stops them too.
404
413
  delegates: method(:live_delegates)
405
414
  )
406
- @hold_stop = HoldStop.new(engine: @engine, task_watch: @task_wakes.watch, delegates: method(:live_delegates),
407
- state_dir: @state_dir)
415
+ @hold_stop = HoldStop.new(reminder_store: @engine.reminder_store, task_watch: @task_wakes.watch,
416
+ delegates: method(:live_delegates), state_dir: @state_dir)
408
417
  end
409
418
 
410
419
  # Start the in-process Bridge transport for this worker. The bridge is
@@ -417,11 +426,13 @@ module Samagotchi
417
426
  # (the worker degrades: turns still flow through the input-dir loop, but
418
427
  # there is no live SSE or in-process cancel/answer).
419
428
  # @param on_input [#call, nil] called after the Bridge queues a turn
420
- def start_bridge(engine:, state_dir:, session_id:, on_input: nil, on_command: nil, on_exit_request: nil,
421
- exit_discards: nil, exit_stopped: nil, on_holds: nil, on_holds_stop: nil, on_activity: nil)
429
+ def start_bridge(engine:, event_log:, turn_state:, question_desk:, steer_cut:, state_dir:, session_id:, on_input: nil,
430
+ on_command: nil, on_exit_request: nil, exit_discards: nil, exit_stopped: nil, on_holds: nil,
431
+ on_holds_stop: nil, on_activity: nil)
422
432
  require_relative "bridge"
423
433
  Samagotchi::Bridge.new(
424
- engine: engine, state_dir: state_dir, session_id: session_id, input_format: SessionInbox::INPUT_FORMAT,
434
+ engine: engine, event_log: event_log, turn_state: turn_state, question_desk: question_desk, steer_cut: steer_cut,
435
+ state_dir: state_dir, session_id: session_id, input_format: SessionInbox::INPUT_FORMAT,
425
436
  on_input: on_input, on_command: on_command, on_exit_request: on_exit_request, exit_discards: exit_discards,
426
437
  exit_stopped: exit_stopped, on_holds: on_holds, on_holds_stop: on_holds_stop, on_activity: on_activity
427
438
  ).start
@@ -441,7 +452,7 @@ module Samagotchi
441
452
  # @return [Hash]
442
453
  def activity_snapshot
443
454
  {
444
- turn_running: @engine.turn_running?,
455
+ turn_running: @turn_state.running?,
445
456
  input_pending: input_pending?,
446
457
  awaiting_continue: @turn_flow.awaiting_continue?,
447
458
  open_streams: @bridge&.open_streams.to_i,
@@ -518,7 +529,7 @@ module Samagotchi
518
529
  return if run_wake_turn
519
530
  return if run_task_wake
520
531
  return if run_due_reminders
521
- return left(:scratch_left) if scratch_unattended? && !@engine.turn_running? && leave_scratch
532
+ return left(:scratch_left) if scratch_unattended? && !@turn_state.running? && leave_scratch
522
533
  return left(:idle_exit) if @idle_exit.due? && leave_idle
523
534
 
524
535
  leaving = @exit_claim.taken? && leave_on_request
@@ -799,14 +810,14 @@ module Samagotchi
799
810
  # conversation as a turn note
800
811
  # Not saved here: run_engine_turn saves after its block.
801
812
  def restore_failed_turn(prompts, error: nil)
802
- @engine.synchronize_events do
813
+ @event_log.synchronize do
803
814
  next if @turn_flow.prompt_turn_failed(error: error) == :kept
804
815
 
805
816
  prompts.each do |prompt, origin, images, anchors|
806
817
  restored = { type: :prompt_restored, prompt: prompt, origin: origin.wire }
807
818
  restored[:images] = images unless Array(images).empty?
808
819
  restored.merge!(anchors.to_h) if anchors
809
- @engine.announce(restored)
820
+ @event_log.announce(restored)
810
821
  end
811
822
  end
812
823
  end
@@ -841,7 +852,7 @@ module Samagotchi
841
852
  begin
842
853
  input = SessionInbox.read_input(claimed_file)
843
854
  enqueued_id = input.origin.enqueued_id
844
- if SessionInbox.input_taken?(@session_dir, @session, enqueued_id) || !@engine.claim_enqueued_id(enqueued_id)
855
+ if SessionInbox.input_taken?(@session_dir, @session, enqueued_id) || !@turn_state.claim_enqueued_id(enqueued_id)
845
856
  Log.info(:worker, "duplicate_input_dropped", enqueued_id: enqueued_id)
846
857
  next
847
858
  end
@@ -859,7 +870,7 @@ module Samagotchi
859
870
  SessionInbox.mark_merged(@session_dir, enqueued_id, into: @turn_enqueued_id) unless prompt.empty?
860
871
  prompt.empty? ? nil : [prompt, input.origin]
861
872
  ensure
862
- @engine.finish_enqueued_id(enqueued_id)
873
+ @turn_state.finish_enqueued_id(enqueued_id)
863
874
  end
864
875
  ensure
865
876
  FileUtils.rm_f(claimed_file)
@@ -870,8 +881,8 @@ module Samagotchi
870
881
  # (their rings stay for the next turn), so not in @merged_this_turn.
871
882
  reports, mark = take_child_reports
872
883
  unless merged.empty? && reports.empty?
873
- @engine.announce(type: :input_merged, count: merged.size + reports.size,
874
- origins: (merged.map(&:last) + reports.map(&:origin)).filter_map(&:wire))
884
+ @event_log.announce(type: :input_merged, count: merged.size + reports.size,
885
+ origins: (merged.map(&:last) + reports.map(&:origin)).filter_map(&:wire))
875
886
  @merged_this_turn.concat(merged)
876
887
  end
877
888
  # Each line keeps its sender (Steer.source_for_client): a chi send or
@@ -12,7 +12,7 @@ module Samagotchi
12
12
  # Threads: safe from any thread. Its fields change only under its own
13
13
  # mutex, and the taken exit is one value replaced whole (#taken), so a
14
14
  # reader never sees a kind with another request's flags. Today every
15
- # writer also holds the event lock (Engine#synchronize_events: the Bridge's
15
+ # writer also holds the event lock (SessionObserver#synchronize: the Bridge's
16
16
  # /exit, the loop's leave); nothing here depends on it. Lock order: the
17
17
  # event lock, then this one.
18
18
  class WorkerExitClaim
@@ -66,7 +66,12 @@ module Samagotchi
66
66
  # "2m", "running a turn").
67
67
  HoldItem = Data.define(:id, :label, :detail)
68
68
 
69
- # @param engine [Engine] #turn_running?, #last_activity_at, #reminder_store
69
+ # @param engine [Engine] #reminder_store, #sign_in_waiting?,
70
+ # #anytime_running?, #relay_desk
71
+ # @param turn_state [TurnState] the Engine's (Engine#turn_state):
72
+ # #running?, #last_activity_at
73
+ # @param question_desk [QuestionDesk] the Engine's
74
+ # (Engine#question_desk): #pending
70
75
  # @param bridge [Bridge, nil] #open_streams, #last_client_activity_at; nil
71
76
  # when the worker's Bridge failed to start
72
77
  # @param timeout_minutes [Numeric, nil] 0 or nil: never exit
@@ -83,10 +88,12 @@ module Samagotchi
83
88
  # or with a live worker (ChildrenStatus::Child): they never hold the
84
89
  # exit, but the exit ask lists them so "stop them" stops them too
85
90
  # @param clock [#call] monotonic seconds, the Engine's and Bridge's clock
86
- def initialize(engine:, bridge:, timeout_minutes:, input_pending:, awaiting_continue: -> { false },
91
+ def initialize(engine:, turn_state:, question_desk:, bridge:, timeout_minutes:, input_pending:, awaiting_continue: -> { false },
87
92
  running_tasks: -> { [] }, watched_tasks: -> { [] }, watched_running: -> { [] },
88
93
  delegates: -> { [] }, clock: -> { Process.clock_gettime(Process::CLOCK_MONOTONIC) })
89
94
  @engine = engine
95
+ @turn_state = turn_state
96
+ @question_desk = question_desk
90
97
  @bridge = bridge
91
98
  @timeout = timeout_minutes.to_f * 60
92
99
  @input_pending = input_pending
@@ -106,16 +113,18 @@ module Samagotchi
106
113
 
107
114
  # What keeps the worker up, or nil when nothing does.
108
115
  # @return [Symbol, nil] :disabled, :turn_running, :input_queued,
109
- # :continue_offered, :client_connected, :reminders, :background_tasks
110
- # or :recent_activity
116
+ # :continue_offered, :client_connected, :reminders, :background_tasks,
117
+ # :sign_in_waiting (ctx.sign_in's flow, until its own timeout) or
118
+ # :recent_activity
111
119
  def hold
112
120
  return :disabled unless @timeout.positive?
113
- return :turn_running if @engine.turn_running?
121
+ return :turn_running if @turn_state.running?
114
122
  return :input_queued if @input_pending.call
115
123
  return :continue_offered if @awaiting_continue.call
116
124
  return :client_connected if @bridge && @bridge.open_streams.positive?
117
125
  return :reminders if @engine.reminder_store&.any?
118
126
  return :background_tasks if @watched_tasks.call.any?
127
+ return :sign_in_waiting if @engine.sign_in_waiting?
119
128
  return :recent_activity if idle_seconds < @timeout
120
129
 
121
130
  nil
@@ -165,7 +174,7 @@ module Samagotchi
165
174
  # leaving) ignores them.
166
175
  # @return [Hold, nil]
167
176
  def request_hold(requester:, streams: true, hint: nil, ask: false)
168
- reason = if @engine.turn_running? then :turn_running
177
+ reason = if @turn_state.running? then :turn_running
169
178
  elsif @input_pending.call then :input_queued
170
179
  elsif @awaiting_continue.call then :continue_offered
171
180
  elsif streams && @bridge && @bridge.open_streams_except(requester).positive? then :client_connected
@@ -193,10 +202,10 @@ module Samagotchi
193
202
  # :question_pending, :command_running, :relays_open or
194
203
  # :background_tasks
195
204
  def hold_for_restart
196
- return :turn_running if @engine.turn_running?
205
+ return :turn_running if @turn_state.running?
197
206
  return :input_queued if @input_pending.call
198
207
  return :continue_offered if @awaiting_continue.call
199
- return :question_pending if @engine.pending_question
208
+ return :question_pending if @question_desk.pending
200
209
  return :command_running if @engine.anytime_running?
201
210
  return :relays_open if @engine.relay_desk.active?
202
211
  return :background_tasks if @running_tasks.call.any?
@@ -206,7 +215,7 @@ module Samagotchi
206
215
 
207
216
  # @return [Float] seconds since the latest activity of any kind
208
217
  def idle_seconds
209
- last = [@started_at, @engine.last_activity_at, @bridge&.last_client_activity_at].compact.max
218
+ last = [@started_at, @turn_state.last_activity_at, @bridge&.last_client_activity_at].compact.max
210
219
  @clock.call - last
211
220
  end
212
221
 
@@ -90,18 +90,23 @@ module Samagotchi
90
90
  false
91
91
  end
92
92
 
93
+ # @param event_log [SessionObserver] the Engine's event log (the context notice)
94
+ # @param turn_state [TurnState] the Engine's turn state (Engine#turn_state):
95
+ # the enqueued-id ledger a taken input claims and finishes on
93
96
  # @param wakes [WorkerWakes] the wake budget a context wake asks
94
97
  # @param awaiting_continue [#call] whether a continue offer waits
95
98
  # @param stopped [#call] whether the session was stopped on disk
96
99
  # @param queue_command [#call] (line, client_id, after_file, enqueued_id)
97
100
  # queues a session command for the loop's next pass; after_file is the
98
101
  # input file it came in, or nil
99
- def initialize(session:, state_dir:, session_dir:, engine:, context_absorber:, wakes:, awaiting_continue:,
100
- stopped:, queue_command:)
102
+ def initialize(session:, state_dir:, session_dir:, engine:, event_log:, turn_state:, context_absorber:, wakes:,
103
+ awaiting_continue:, stopped:, queue_command:)
101
104
  @session = session
102
105
  @state_dir = state_dir
103
106
  @session_dir = session_dir
104
107
  @engine = engine
108
+ @event_log = event_log
109
+ @turn_state = turn_state
105
110
  @context_absorber = context_absorber
106
111
  @wakes = wakes
107
112
  @awaiting_continue = awaiting_continue
@@ -271,7 +276,7 @@ module Samagotchi
271
276
  begin
272
277
  input = SessionInbox.read_input(claimed_file)
273
278
  enqueued_id = input.origin.enqueued_id
274
- if SessionInbox.input_taken?(@session_dir, @session, enqueued_id) || !@engine.claim_enqueued_id(enqueued_id)
279
+ if SessionInbox.input_taken?(@session_dir, @session, enqueued_id) || !@turn_state.claim_enqueued_id(enqueued_id)
275
280
  Log.info(:worker, "duplicate_input_dropped", enqueued_id: enqueued_id)
276
281
  return
277
282
  end
@@ -282,7 +287,7 @@ module Samagotchi
282
287
  yield Prompt.new(text: input.prompt, origin: input.origin, no_interrupt: input.no_interrupt, images: input.images,
283
288
  delivery: input.delivery, anchors: input.anchors)
284
289
  ensure
285
- @engine.finish_enqueued_id(enqueued_id)
290
+ @turn_state.finish_enqueued_id(enqueued_id)
286
291
  end
287
292
  ensure
288
293
  FileUtils.rm_f(claimed_file)
@@ -383,9 +388,9 @@ module Samagotchi
383
388
  return unless delivery && @wakes.notice_peer_budget!
384
389
 
385
390
  turns = key == ChildRing::MAX_WAKES_KEY ? @wakes.max : @wakes.peer_turns
386
- @engine.announce(type: :hook_notice, hook: "context", level: :info, between_turns: true,
387
- text: "#{delivery.peer} answered again; it waits as a note for your next message " \
388
- "(#{turns} wake turn#{"s" if turns != 1} in a row, #{key})")
391
+ @event_log.announce(type: :hook_notice, hook: "context", level: :info, between_turns: true,
392
+ text: "#{delivery.peer} answered again; it waits as a note for your next message " \
393
+ "(#{turns} wake turn#{"s" if turns != 1} in a row, #{key})")
389
394
  end
390
395
 
391
396
  def context_wakes_on? = Config.get("context.wake") != false
@@ -34,13 +34,15 @@ module Samagotchi
34
34
  # (revoked, expired, or the session archived).
35
35
  REVOKED_STOP = "%<name>s's link was revoked or expired"
36
36
 
37
- # @param engine [Engine] announces (the cap notice, :turn_dequeued,
38
- # #watch's :participants_changed) and its metrics' spend
37
+ # @param engine [Engine] #watch's :participants_changed and its metrics' spend
38
+ # @param event_log [SessionObserver] the Engine's event log: announces the
39
+ # cap notice and :turn_dequeued
39
40
  # @param session [Session] the worker's (its participants source, its
40
41
  # Verify fresh)
41
42
  # @param hook [String] the cap notice's hook name (Engine::PARTICIPANTS_HOOK)
42
- def initialize(engine:, session:, session_id:, state_dir:, session_dir:, hook:)
43
+ def initialize(engine:, event_log:, session:, session_id:, state_dir:, session_dir:, hook:)
43
44
  @engine = engine
45
+ @event_log = event_log
44
46
  @session = session
45
47
  @session_id = session_id
46
48
  @state_dir = state_dir
@@ -99,7 +101,7 @@ module Samagotchi
99
101
  TurnCheckpoint.record_refused(@session_dir, origin.enqueued_id, reason: reason, author: origin.participant_author)
100
102
  Participants.log(source_id, :turn, state_dir: @state_dir, participant: origin.participant_id,
101
103
  enqueued_id: origin.enqueued_id, status: "refused", reason: reason)
102
- @engine.announce(type: :turn_dequeued, enqueued_id: origin.enqueued_id, client_id: origin.client_id)
104
+ @event_log.announce(type: :turn_dequeued, enqueued_id: origin.enqueued_id, client_id: origin.client_id)
103
105
  nil
104
106
  end
105
107
 
@@ -148,9 +150,9 @@ module Samagotchi
148
150
 
149
151
  @cap_noticed << key
150
152
  id = Steer.participant_id(author)
151
- @engine.announce(type: :hook_notice, hook: @hook, level: :warn, between_turns: true,
152
- text: format(CAP_NOTICE, name: label(author, entry.name), cap: cap,
153
- session: source_id[0, 8], id: id))
153
+ @event_log.announce(type: :hook_notice, hook: @hook, level: :warn, between_turns: true,
154
+ text: format(CAP_NOTICE, name: label(author, entry.name), cap: cap,
155
+ session: source_id[0, 8], id: id))
154
156
  end
155
157
  end
156
158
  end
@@ -22,13 +22,15 @@ module Samagotchi
22
22
  # @return [TaskWatch]
23
23
  attr_reader :watch
24
24
 
25
+ # @param event_log [SessionObserver] the Engine's event log (the task notice)
25
26
  # @param wakes [WorkerWakes] the wake budget a task's wake asks
26
27
  # @param awaiting_continue [#call] whether a continue offer waits
27
28
  # @param idle [#call] nothing queued and no exit asked for: a finish
28
29
  # may start a turn
29
30
  # @param save [#call] saves the session (a failure is the callee's to log)
30
- def initialize(engine:, session:, wakes:, awaiting_continue:, idle:, save:)
31
+ def initialize(engine:, event_log:, session:, wakes:, awaiting_continue:, idle:, save:)
31
32
  @engine = engine
33
+ @event_log = event_log
32
34
  @session = session
33
35
  @wakes = wakes
34
36
  @awaiting_continue = awaiting_continue
@@ -151,10 +153,10 @@ module Samagotchi
151
153
  def budget_notice(count)
152
154
  return unless count.positive? && @wakes.notice_budget!
153
155
 
154
- @engine.announce(type: :hook_notice, hook: "task", level: :info, between_turns: true,
155
- text: "#{count} finished background task#{"s" if count != 1} noted; the model reads " \
156
- "#{count == 1 ? "it" : "them"} with your next message " \
157
- "(#{@wakes.max} wake turn#{"s" if @wakes.max != 1} in a row, #{ChildRing::MAX_WAKES_KEY})")
156
+ @event_log.announce(type: :hook_notice, hook: "task", level: :info, between_turns: true,
157
+ text: "#{count} finished background task#{"s" if count != 1} noted; the model reads " \
158
+ "#{count == 1 ? "it" : "them"} with your next message " \
159
+ "(#{@wakes.max} wake turn#{"s" if @wakes.max != 1} in a row, #{ChildRing::MAX_WAKES_KEY})")
158
160
  end
159
161
  end
160
162
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samagotchi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.182.0
4
+ version: 0.183.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Dedov
@@ -174,6 +174,7 @@ files:
174
174
  - docs/internals/web-frontend.md
175
175
  - docs/internals/web-push.md
176
176
  - docs/internals/working-set.md
177
+ - docs/mcp-server.md
177
178
  - docs/memory.md
178
179
  - docs/plugins.md
179
180
  - docs/releasing.md
@@ -182,6 +183,7 @@ files:
182
183
  - docs/sub-agent.md
183
184
  - docs/system-one.md
184
185
  - docs/testing.md
186
+ - docs/thin-clients.md
185
187
  - lib/samagotchi.rb
186
188
  - lib/samagotchi/analytics_file.rb
187
189
  - lib/samagotchi/answer_command.rb
@@ -282,8 +284,13 @@ files:
282
284
  - lib/samagotchi/bundles/known-names/plugin.rb
283
285
  - lib/samagotchi/bundles/loop-guard/manifest.yml
284
286
  - lib/samagotchi/bundles/loop-guard/plugin.rb
287
+ - lib/samagotchi/bundles/mcp/client.rb
288
+ - lib/samagotchi/bundles/mcp/content.rb
289
+ - lib/samagotchi/bundles/mcp/http_client.rb
285
290
  - lib/samagotchi/bundles/mcp/manifest.yml
291
+ - lib/samagotchi/bundles/mcp/oauth.rb
286
292
  - lib/samagotchi/bundles/mcp/plugin.rb
293
+ - lib/samagotchi/bundles/mcp/tools.rb
287
294
  - lib/samagotchi/bundles/model-notes/manifest.yml
288
295
  - lib/samagotchi/bundles/model-notes/model_notes_deepseek.md
289
296
  - lib/samagotchi/bundles/model-notes/model_notes_tone.md
@@ -393,6 +400,7 @@ files:
393
400
  - lib/samagotchi/engine/recap.rb
394
401
  - lib/samagotchi/engine/session.rb
395
402
  - lib/samagotchi/engine/side_requests.rb
403
+ - lib/samagotchi/engine/sign_in.rb
396
404
  - lib/samagotchi/engine/steering.rb
397
405
  - lib/samagotchi/engine/toolkit.rb
398
406
  - lib/samagotchi/engine/turn_end.rb
@@ -526,6 +534,12 @@ files:
526
534
  - lib/samagotchi/log_path.rb
527
535
  - lib/samagotchi/log_subscriber.rb
528
536
  - lib/samagotchi/markdown_parser.rb
537
+ - lib/samagotchi/mcp_command.rb
538
+ - lib/samagotchi/mcp_server/http.rb
539
+ - lib/samagotchi/mcp_server/protocol.rb
540
+ - lib/samagotchi/mcp_server/stdio.rb
541
+ - lib/samagotchi/mcp_server/text.rb
542
+ - lib/samagotchi/mcp_server/tools.rb
529
543
  - lib/samagotchi/memory_bundle.rb
530
544
  - lib/samagotchi/memory_bundle/asset_installer.rb
531
545
  - lib/samagotchi/memory_bundle/asset_state.rb
@@ -609,14 +623,19 @@ files:
609
623
  - lib/samagotchi/plugin/card.rb
610
624
  - lib/samagotchi/plugin/context.rb
611
625
  - lib/samagotchi/plugin/http.rb
626
+ - lib/samagotchi/plugin/http_errors.rb
627
+ - lib/samagotchi/plugin/http_stream.rb
612
628
  - lib/samagotchi/plugin/http_transport.rb
613
629
  - lib/samagotchi/plugin/judgments.rb
614
630
  - lib/samagotchi/plugin/loader.rb
615
631
  - lib/samagotchi/plugin/peer.rb
616
632
  - lib/samagotchi/plugin/prompt_sections.rb
633
+ - lib/samagotchi/plugin/secrets.rb
617
634
  - lib/samagotchi/plugin/service.rb
618
635
  - lib/samagotchi/plugin/sessions.rb
619
636
  - lib/samagotchi/plugin/side_question.rb
637
+ - lib/samagotchi/plugin/sign_in.rb
638
+ - lib/samagotchi/plugin/sse_reader.rb
620
639
  - lib/samagotchi/plugin/tool_result.rb
621
640
  - lib/samagotchi/plugin/tool_spec.rb
622
641
  - lib/samagotchi/plugin_session_state.rb
@@ -682,9 +701,12 @@ files:
682
701
  - lib/samagotchi/served_model.rb
683
702
  - lib/samagotchi/session.rb
684
703
  - lib/samagotchi/session_access.rb
704
+ - lib/samagotchi/session_access/ask.rb
685
705
  - lib/samagotchi/session_access/contract.rb
686
706
  - lib/samagotchi/session_access/delete_plan.rb
687
707
  - lib/samagotchi/session_access/dispatch.rb
708
+ - lib/samagotchi/session_access/exchange.rb
709
+ - lib/samagotchi/session_access/exchange/token.rb
688
710
  - lib/samagotchi/session_access/http_transport.rb
689
711
  - lib/samagotchi/session_access/local.rb
690
712
  - lib/samagotchi/session_access/remote.rb
@@ -922,6 +944,7 @@ files:
922
944
  - lib/samagotchi/vision_support.rb
923
945
  - lib/samagotchi/waiting_steer.rb
924
946
  - lib/samagotchi/web/app.rb
947
+ - lib/samagotchi/web/ask_routes.rb
925
948
  - lib/samagotchi/web/auto_update.rb
926
949
  - lib/samagotchi/web/auto_update_record.rb
927
950
  - lib/samagotchi/web/block_fix_routes.rb
@@ -932,6 +955,7 @@ files:
932
955
  - lib/samagotchi/web/lan.rb
933
956
  - lib/samagotchi/web/link_codes.rb
934
957
  - lib/samagotchi/web/markdown_renderer.rb
958
+ - lib/samagotchi/web/mcp_route.rb
935
959
  - lib/samagotchi/web/message_display.rb
936
960
  - lib/samagotchi/web/participant_access.rb
937
961
  - lib/samagotchi/web/participant_history.rb
@@ -961,11 +985,13 @@ files:
961
985
  - lib/samagotchi/web/public/block_frame.js
962
986
  - lib/samagotchi/web/public/block_host.js
963
987
  - lib/samagotchi/web/public/block_open.js
988
+ - lib/samagotchi/web/public/block_regions.js
964
989
  - lib/samagotchi/web/public/block_renderers.css
965
990
  - lib/samagotchi/web/public/block_source.js
966
991
  - lib/samagotchi/web/public/block_watch.js
967
992
  - lib/samagotchi/web/public/bubbles.js
968
993
  - lib/samagotchi/web/public/card.js
994
+ - lib/samagotchi/web/public/card_actions.js
969
995
  - lib/samagotchi/web/public/card_kinds.js
970
996
  - lib/samagotchi/web/public/card_registry.js
971
997
  - lib/samagotchi/web/public/card_stamps.js
@@ -993,6 +1019,7 @@ files:
993
1019
  - lib/samagotchi/web/public/delete_sheet.js
994
1020
  - lib/samagotchi/web/public/delivery_line.js
995
1021
  - lib/samagotchi/web/public/details_motion.js
1022
+ - lib/samagotchi/web/public/diagram_wiring.js
996
1023
  - lib/samagotchi/web/public/diff_view.js
997
1024
  - lib/samagotchi/web/public/dock_reserve.js
998
1025
  - lib/samagotchi/web/public/families_view.js
@@ -1055,6 +1082,7 @@ files:
1055
1082
  - lib/samagotchi/web/public/peer_exchange.js
1056
1083
  - lib/samagotchi/web/public/peer_links.js
1057
1084
  - lib/samagotchi/web/public/peer_note.js
1085
+ - lib/samagotchi/web/public/picture_regions.js
1058
1086
  - lib/samagotchi/web/public/picture_viewer.js
1059
1087
  - lib/samagotchi/web/public/plain_line.js
1060
1088
  - lib/samagotchi/web/public/popover_modal.js
@@ -1070,7 +1098,9 @@ files:
1070
1098
  - lib/samagotchi/web/public/ref_menu.js
1071
1099
  - lib/samagotchi/web/public/ref_scan.js
1072
1100
  - lib/samagotchi/web/public/refs.js
1101
+ - lib/samagotchi/web/public/region_hit.js
1073
1102
  - lib/samagotchi/web/public/reload_check.js
1103
+ - lib/samagotchi/web/public/removal_sheet_model.js
1074
1104
  - lib/samagotchi/web/public/restore.js
1075
1105
  - lib/samagotchi/web/public/resync_reach.js
1076
1106
  - lib/samagotchi/web/public/revise_stack.js