samagotchi 0.171.0 → 0.172.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 (202) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -1
  3. data/bin/chi +6 -4
  4. data/docs/architecture.md +24 -7
  5. data/docs/bundles.md +4 -21
  6. data/docs/cli.md +50 -80
  7. data/docs/configuration.md +11 -13
  8. data/docs/context.md +5 -6
  9. data/docs/guardrails.md +57 -96
  10. data/docs/hooks.md +3 -4
  11. data/docs/internals/attached-context.md +6 -7
  12. data/docs/internals/background-tasks.md +4 -3
  13. data/docs/internals/bridge.md +29 -3
  14. data/docs/internals/engine.md +21 -9
  15. data/docs/internals/objectives.md +3 -5
  16. data/docs/internals/participants.md +118 -143
  17. data/docs/internals/prompt-caching.md +4 -5
  18. data/docs/internals/web-frontend.md +33 -14
  19. data/docs/internals/working-set.md +7 -5
  20. data/docs/memory.md +1 -1
  21. data/docs/plugins.md +2 -16
  22. data/docs/scheduling.md +1 -1
  23. data/docs/sessions.md +15 -49
  24. data/docs/sub-agent.md +2 -2
  25. data/docs/system-one.md +2 -2
  26. data/docs/testing.md +56 -7
  27. data/lib/samagotchi/bridge/card_store.rb +1 -0
  28. data/lib/samagotchi/bridge/sse_writer.rb +1 -0
  29. data/lib/samagotchi/bridge/turn_accumulator.rb +0 -1
  30. data/lib/samagotchi/bridge.rb +26 -9
  31. data/lib/samagotchi/bridge_client/event_stream.rb +2 -0
  32. data/lib/samagotchi/bundle_command/test_run.rb +1 -0
  33. data/lib/samagotchi/bundle_command/try/run.rb +1 -0
  34. data/lib/samagotchi/bundles/coordinator/manifest.yml +4 -5
  35. data/lib/samagotchi/bundles/coordinator/plugin.rb +6 -79
  36. data/lib/samagotchi/bundles/coordinator/skill_coordinator.md +1 -16
  37. data/lib/samagotchi/bundles/github-pr/manifest.yml +2 -2
  38. data/lib/samagotchi/bundles/github-pr/plugin.rb +0 -1
  39. data/lib/samagotchi/bundles/inline-widgets/manifest.yml +2 -2
  40. data/lib/samagotchi/bundles/inline-widgets/plugin.rb +4 -5
  41. data/lib/samagotchi/bundles/system/manifest.yml +1 -1
  42. data/lib/samagotchi/client_id.rb +126 -67
  43. data/lib/samagotchi/command_intake.rb +15 -3
  44. data/lib/samagotchi/compat.rb +6 -1
  45. data/lib/samagotchi/context_candidate_choice.rb +1 -3
  46. data/lib/samagotchi/context_candidates.rb +3 -4
  47. data/lib/samagotchi/continue_offer.rb +9 -2
  48. data/lib/samagotchi/delivery.rb +23 -12
  49. data/lib/samagotchi/empty_answer_error.rb +5 -0
  50. data/lib/samagotchi/engine/cards.rb +3 -0
  51. data/lib/samagotchi/engine/context_judge.rb +5 -3
  52. data/lib/samagotchi/engine/events.rb +4 -0
  53. data/lib/samagotchi/engine/hooks.rb +3 -0
  54. data/lib/samagotchi/engine/messages.rb +5 -0
  55. data/lib/samagotchi/engine/model_settings.rb +2 -0
  56. data/lib/samagotchi/engine/models.rb +10 -0
  57. data/lib/samagotchi/engine/objectives.rb +6 -0
  58. data/lib/samagotchi/engine/participants.rb +18 -14
  59. data/lib/samagotchi/engine/plugins.rb +8 -0
  60. data/lib/samagotchi/engine/questions.rb +3 -0
  61. data/lib/samagotchi/engine/recap.rb +1 -0
  62. data/lib/samagotchi/engine/session.rb +4 -0
  63. data/lib/samagotchi/engine/side_requests.rb +9 -0
  64. data/lib/samagotchi/engine/steering.rb +2 -0
  65. data/lib/samagotchi/engine/toolkit.rb +5 -0
  66. data/lib/samagotchi/engine/turn_end.rb +7 -0
  67. data/lib/samagotchi/engine/turn_helpers.rb +8 -0
  68. data/lib/samagotchi/engine/verify.rb +2 -0
  69. data/lib/samagotchi/engine.rb +3 -2
  70. data/lib/samagotchi/grants.rb +28 -22
  71. data/lib/samagotchi/guardrail_wiring.rb +23 -18
  72. data/lib/samagotchi/guardrails/approval_use.rb +59 -0
  73. data/lib/samagotchi/guardrails/approvals.rb +9 -11
  74. data/lib/samagotchi/guardrails/child_boundary.rb +1 -0
  75. data/lib/samagotchi/guardrails/gate.rb +10 -5
  76. data/lib/samagotchi/guardrails/implicit_writers.rb +1 -0
  77. data/lib/samagotchi/guardrails/pair_boundary.rb +6 -6
  78. data/lib/samagotchi/guardrails/participant_refusal.rb +33 -0
  79. data/lib/samagotchi/guardrails/review_paths.rb +2 -3
  80. data/lib/samagotchi/guardrails.rb +1 -1
  81. data/lib/samagotchi/llm_context_strategy.rb +2 -0
  82. data/lib/samagotchi/objectives.rb +1 -4
  83. data/lib/samagotchi/objectives_audit.rb +1 -1
  84. data/lib/samagotchi/objectives_track.rb +1 -1
  85. data/lib/samagotchi/owner_prompt.rb +3 -6
  86. data/lib/samagotchi/parent_report.rb +1 -0
  87. data/lib/samagotchi/participant_messages.rb +9 -4
  88. data/lib/samagotchi/participant_turn_mode.rb +50 -0
  89. data/lib/samagotchi/participants.rb +21 -12
  90. data/lib/samagotchi/participants_watch.rb +2 -2
  91. data/lib/samagotchi/plugin/api.rb +2 -2
  92. data/lib/samagotchi/plugin/attached_context.rb +1 -1
  93. data/lib/samagotchi/plugin/context.rb +0 -4
  94. data/lib/samagotchi/plugin/sessions.rb +1 -25
  95. data/lib/samagotchi/run_options.rb +2 -3
  96. data/lib/samagotchi/send_command.rb +10 -10
  97. data/lib/samagotchi/session.rb +0 -3
  98. data/lib/samagotchi/session_access/contract.rb +1 -10
  99. data/lib/samagotchi/session_access/local.rb +10 -23
  100. data/lib/samagotchi/session_access/remote.rb +9 -20
  101. data/lib/samagotchi/session_access.rb +12 -16
  102. data/lib/samagotchi/session_chain.rb +4 -6
  103. data/lib/samagotchi/session_commands.rb +6 -3
  104. data/lib/samagotchi/session_continue.rb +1 -2
  105. data/lib/samagotchi/session_manager/delivery.rb +25 -5
  106. data/lib/samagotchi/session_manager/lifecycle.rb +12 -0
  107. data/lib/samagotchi/session_manager/listing.rb +5 -0
  108. data/lib/samagotchi/session_manager/spawn.rb +2 -2
  109. data/lib/samagotchi/session_manager/worker_command.rb +9 -0
  110. data/lib/samagotchi/session_participants.rb +12 -8
  111. data/lib/samagotchi/session_review.rb +5 -7
  112. data/lib/samagotchi/session_stores.rb +3 -3
  113. data/lib/samagotchi/share_command.rb +10 -12
  114. data/lib/samagotchi/share_terms.rb +41 -0
  115. data/lib/samagotchi/steer.rb +8 -14
  116. data/lib/samagotchi/system_prompt.rb +16 -25
  117. data/lib/samagotchi/terminal_ui/attach_launcher.rb +2 -1
  118. data/lib/samagotchi/terminal_ui/attached_loop/exit_commands.rb +1 -0
  119. data/lib/samagotchi/terminal_ui/attached_loop/queueing.rb +1 -0
  120. data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +2 -0
  121. data/lib/samagotchi/terminal_ui/formatting.rb +15 -17
  122. data/lib/samagotchi/terminal_ui/participant_commands.rb +2 -2
  123. data/lib/samagotchi/terminal_ui/status_row.rb +2 -2
  124. data/lib/samagotchi/terminal_ui.rb +1 -2
  125. data/lib/samagotchi/testing/sessions.rb +2 -10
  126. data/lib/samagotchi/tool_runner.rb +8 -9
  127. data/lib/samagotchi/toolkit.rb +4 -22
  128. data/lib/samagotchi/toolkit_suggest.rb +3 -3
  129. data/lib/samagotchi/tools/deferred_tools.rb +1 -0
  130. data/lib/samagotchi/tools/execute.rb +11 -45
  131. data/lib/samagotchi/tools/leftovers.rb +122 -0
  132. data/lib/samagotchi/tools/memory.rb +70 -26
  133. data/lib/samagotchi/tools/task_get.rb +1 -0
  134. data/lib/samagotchi/tools/task_list.rb +3 -2
  135. data/lib/samagotchi/tools/task_record.rb +6 -4
  136. data/lib/samagotchi/tools/task_runtime.rb +199 -20
  137. data/lib/samagotchi/tools/task_wait.rb +4 -3
  138. data/lib/samagotchi/turn_context.rb +1 -1
  139. data/lib/samagotchi/turn_origin.rb +1 -1
  140. data/lib/samagotchi/turn_stages/context_judge.rb +4 -4
  141. data/lib/samagotchi/turn_stages/objectives.rb +2 -2
  142. data/lib/samagotchi/turn_stages/toolkit_suggestion.rb +2 -2
  143. data/lib/samagotchi/update_hint.rb +3 -1
  144. data/lib/samagotchi/verify_fresh.rb +1 -1
  145. data/lib/samagotchi/verify_fresh_origin.rb +13 -11
  146. data/lib/samagotchi/version.rb +1 -1
  147. data/lib/samagotchi/web/app.rb +3 -5
  148. data/lib/samagotchi/web/participant_access.rb +14 -18
  149. data/lib/samagotchi/web/participant_review.rb +3 -4
  150. data/lib/samagotchi/web/participant_show.rb +4 -3
  151. data/lib/samagotchi/web/participant_view.rb +3 -3
  152. data/lib/samagotchi/web/participants_admin.rb +21 -40
  153. data/lib/samagotchi/web/public/app.js +5 -47
  154. data/lib/samagotchi/web/public/data.js +2 -10
  155. data/lib/samagotchi/web/public/delivery_line.js +17 -60
  156. data/lib/samagotchi/web/public/index.html +10 -30
  157. data/lib/samagotchi/web/public/live_turn.js +1 -1
  158. data/lib/samagotchi/web/public/owner_claim.js +2 -2
  159. data/lib/samagotchi/web/public/participant_bar.js +4 -5
  160. data/lib/samagotchi/web/public/participant_names.js +14 -10
  161. data/lib/samagotchi/web/public/participants_panel.js +29 -62
  162. data/lib/samagotchi/web/public/reload_check.js +2 -3
  163. data/lib/samagotchi/web/public/send_turn.js +4 -23
  164. data/lib/samagotchi/web/public/session_actions.js +4 -45
  165. data/lib/samagotchi/web/public/session_fields.js +0 -1
  166. data/lib/samagotchi/web/public/session_state.js +0 -3
  167. data/lib/samagotchi/web/public/session_view.js +2 -3
  168. data/lib/samagotchi/web/public/settings_panel.js +4 -18
  169. data/lib/samagotchi/web/public/stage_answer.js +56 -0
  170. data/lib/samagotchi/web/public/stage_asking.js +1 -1
  171. data/lib/samagotchi/web/public/stage_cloud.js +93 -0
  172. data/lib/samagotchi/web/public/stage_dom.js +100 -0
  173. data/lib/samagotchi/web/public/stage_handoff.js +154 -0
  174. data/lib/samagotchi/web/public/stage_pager.js +59 -0
  175. data/lib/samagotchi/web/public/stage_quiet_clock.js +52 -0
  176. data/lib/samagotchi/web/public/stage_view.js +90 -411
  177. data/lib/samagotchi/web/public/start_page.js +12 -33
  178. data/lib/samagotchi/web/public/start_settings.js +24 -78
  179. data/lib/samagotchi/web/public/start_toolkit.js +6 -10
  180. data/lib/samagotchi/web/public/stream_handlers.js +1 -9
  181. data/lib/samagotchi/web/public/turn_block.js +3 -7
  182. data/lib/samagotchi/web/public/turn_events.js +15 -6
  183. data/lib/samagotchi/web/public/turn_pieces.js +3 -4
  184. data/lib/samagotchi/web/public/viewer_self.js +8 -2
  185. data/lib/samagotchi/web/qr.rb +1 -1
  186. data/lib/samagotchi/web/session_control.rb +3 -1
  187. data/lib/samagotchi/web/session_create.rb +5 -71
  188. data/lib/samagotchi/web/session_summary.rb +1 -4
  189. data/lib/samagotchi/web/verify_fresh_routes.rb +8 -7
  190. data/lib/samagotchi/web/viewer.rb +3 -3
  191. data/lib/samagotchi/worker.rb +16 -14
  192. data/lib/samagotchi/worker_inbound.rb +4 -3
  193. data/lib/samagotchi/worker_link.rb +17 -0
  194. data/lib/samagotchi/working_set.rb +87 -28
  195. metadata +13 -8
  196. data/lib/samagotchi/guardrails/review_boundary.rb +0 -99
  197. data/lib/samagotchi/participant_mode.rb +0 -86
  198. data/lib/samagotchi/review_apply.rb +0 -131
  199. data/lib/samagotchi/review_command.rb +0 -123
  200. data/lib/samagotchi/review_start.rb +0 -196
  201. data/lib/samagotchi/web/public/review_apply.js +0 -34
  202. data/lib/samagotchi/web/public/review_start.js +0 -55
@@ -78,6 +78,7 @@ module Samagotchi
78
78
  # The reasons a worker refuses a participant's queued turn
79
79
  # (Worker#participant_refusal), as its settled record's cancel_reason.
80
80
  REFUSED_LINES = { "revoked" => ParticipantMessages::TOKEN_ENDED,
81
+ "outdated" => ParticipantMessages::TOKEN_OUTDATED,
81
82
  "cap_reached" => ParticipantMessages::CAP_REACHED }.freeze
82
83
 
83
84
  # A participant's turn the worker refused before it ran: by its
@@ -7,18 +7,23 @@ module Samagotchi
7
7
  # No requires, so any file can use it.
8
8
  module ParticipantMessages
9
9
  # 401 token_revoked: the owner revoked the grant, or archived or deleted its session.
10
- TOKEN_REVOKED = "this review link was revoked by the session's owner"
10
+ TOKEN_REVOKED = "this link was revoked by the session's owner"
11
11
  # 401 token_expired: the grant's time ran out.
12
- TOKEN_EXPIRED = "this review link expired: ask the session's owner for a new one"
12
+ TOKEN_EXPIRED = "this link expired: ask the session's owner for a new one"
13
13
  # 401 token_bound: a link bound to one account (chi share --identity)
14
14
  # opened by another, or not through the auth proxy (the LAN, this
15
15
  # machine). Never names either identity.
16
- TOKEN_BOUND = "this review link is for another account: open it through the proxy, signed in as the person " \
16
+ TOKEN_BOUND = "this link is for another account: open it through the proxy, signed in as the person " \
17
17
  "it was sent to"
18
18
  # Either of those, where only that the link ended is known: the
19
19
  # worker's cancel_reason "revoked" (participants.json reads them
20
20
  # removed or past expires_at), as their chi send --wait reports it.
21
- TOKEN_ENDED = "this review link was revoked or expired"
21
+ TOKEN_ENDED = "this link was revoked or expired"
22
+ # 401 token_outdated: a link an older chi issued for read-only turns
23
+ # (a grant without the pair mode: Grants::Grant#state :outdated), and
24
+ # the worker's cancel_reason "outdated" for their queued turn. This chi
25
+ # runs no read-only turn; the owner invites them again.
26
+ TOKEN_OUTDATED = "this link is from an older chi: ask the session's owner for a new one"
22
27
  # 403 not_permitted: a route, a command or a shell line only the owner may use.
23
28
  NOT_PERMITTED = "a participant can't do that: only the session's owner can"
24
29
  # 429 too_many_turns: their running turn and its queue are full.
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Samagotchi
4
+ # Whether a participant's turn runs here, and why not: the one decision
5
+ # the worker (Worker#participant_refusal, before the turn starts and
6
+ # before each of its generations) and the guardrails
7
+ # (GuardrailWiring#participant_turn_mode, the turn's mode) both take.
8
+ # :pair — it runs, under the owner's guardrails (PairBoundary);
9
+ # :revoked — no invite at +now+: none, revoked, expired, or anything
10
+ # that isn't a participants.json entry;
11
+ # :outdated — an older chi's read-only invite (no PAIR_MODE), or a
12
+ # participant's Verify fresh child saved for a read-only
13
+ # turn: this chi runs no read-only turn;
14
+ # :not_invited — invited, but not to this: no session, or the owner's
15
+ # own Verify fresh child (its parent's participants are
16
+ # the parent's; only a participant's own child runs
17
+ # their turns).
18
+ # Fail closed: only :pair runs. See docs/guardrails.md ("A participant's
19
+ # turn without a current invite").
20
+ module ParticipantTurnMode
21
+ # The mode every invite this chi issues is stamped with (Grants'
22
+ # grants, participants.json entries, a participant's Verify fresh
23
+ # child) and a pair turn's opening message keeps (participant_mode).
24
+ # The web's participant_names.js PAIR reads the same stamp.
25
+ PAIR_MODE = "pair"
26
+ MODES = %i[pair outdated revoked not_invited].freeze
27
+
28
+ module_function
29
+
30
+ # @param entry [Participants::Entry, nil] the participant's entry
31
+ # (participants.json of Session#participants_source_id)
32
+ # @param session [Session, nil] the session the turn would run in
33
+ # @param now [Time]
34
+ # @return [Symbol] one of MODES
35
+ def of(entry:, session:, now:)
36
+ return :revoked unless entry.respond_to?(:mode) && entry.respond_to?(:current?) && entry.current?(now)
37
+ return :outdated unless invite_mode?(entry.mode)
38
+ return :not_invited if session.nil?
39
+
40
+ fresh = session.respond_to?(:verify_fresh) ? session.verify_fresh : nil
41
+ return :pair unless fresh
42
+ return :not_invited unless fresh.participant?
43
+
44
+ fresh.pair? ? :pair : :outdated
45
+ end
46
+
47
+ # Whether +mode+ (a grant's, an entry's) is this chi's invite mode.
48
+ def invite_mode?(mode) = mode.to_s == PAIR_MODE
49
+ end
50
+ end
@@ -8,6 +8,7 @@ require_relative "participant_messages"
8
8
  require_relative "archive_store"
9
9
  require_relative "session"
10
10
  require_relative "grants"
11
+ require_relative "participant_turn_mode"
11
12
 
12
13
  module Samagotchi
13
14
  # A session's participants: the people (or agents) its owner invited to
@@ -36,17 +37,25 @@ module Samagotchi
36
37
  # +expires_at+ says when). +cap+: their spending cap in dollars (the
37
38
  # worker's check before their queued turn starts), nil in a sidecar
38
39
  # from before caps.
39
- # +mode+: "pair" when the owner invited them to act (Grant#mode); nil
40
- # for a review participant and for a sidecar from before it.
41
- Entry = Data.define(:id, :kind, :name, :role, :added_at, :expires_at, :removed_at, :cap, :mode) do
40
+ # +mode+: "pair" (Grant#mode); nil for an older chi's read-only
41
+ # participant, who is not active (their turns are refused).
42
+ Entry = Data.define(:id, :name, :role, :added_at, :expires_at, :removed_at, :cap, :mode) do
42
43
  def self.from_h(hash) = new(**members.to_h { |key| [key, hash[key.to_s]] })
43
44
 
44
- # Still in the review at +now+.
45
- def active?(now)
45
+ # Still invited at +now+: not removed, not expired, and invited by
46
+ # this chi (an older chi's read-only invite has no "pair": #outdated?).
47
+ def active?(now) = current?(now) && !outdated?
48
+
49
+ # Not removed and not expired at +now+, whoever invited them.
50
+ def current?(now)
46
51
  removed_at.nil? && Time.iso8601(expires_at.to_s) > now
47
52
  rescue ArgumentError
48
53
  false
49
54
  end
55
+
56
+ # An older chi's invite for read-only turns (no "pair" mode), which
57
+ # this chi doesn't run.
58
+ def outdated? = !ParticipantTurnMode.invite_mode?(mode)
50
59
  end
51
60
 
52
61
  module_function
@@ -72,7 +81,7 @@ module Samagotchi
72
81
  return unless File.directory?(dir)
73
82
 
74
83
  entries = grants.map do |grant|
75
- { "id" => grant.id, "kind" => grant.kind, "name" => grant.name, "role" => grant.role,
84
+ { "id" => grant.id, "name" => grant.name, "role" => grant.role,
76
85
  "added_at" => grant.created_at, "expires_at" => grant.expires_at, "removed_at" => grant.revoked_at,
77
86
  "cap" => grant.spend_cap, **(grant.mode ? { "mode" => grant.mode } : {}) }
78
87
  end
@@ -107,8 +116,8 @@ module Samagotchi
107
116
  # @raise [Grants::Invalid] an archived session, or bad values
108
117
  # (Unbindable: an identity without such a public_url)
109
118
  # @raise [Session::NotFound] no such session
110
- def invite(grants, session_id:, name:, kind: "human", ttl: nil, cap: nil, identity: nil, public_url: nil,
111
- mode: nil, state_dir: Session.default_state_dir)
119
+ def invite(grants, session_id:, name:, ttl: nil, cap: nil, identity: nil, public_url: nil,
120
+ state_dir: Session.default_state_dir)
112
121
  raise Session::NotFound, session_id unless File.exist?(Session.session_file(session_id, state_dir: state_dir))
113
122
 
114
123
  identity = Grants.clean_identity(identity) unless identity.nil?
@@ -117,12 +126,12 @@ module Samagotchi
117
126
  raise Grants::Invalid, "session #{session_id[0, 8]} is archived: unarchive it to invite anyone"
118
127
  end
119
128
 
120
- issued = grants.issue(session_id: session_id, name: name, kind: kind, ttl: ttl, cap: cap, identity: identity,
121
- mode: mode, on_write: sidecar_writer(state_dir, [session_id]))
129
+ issued = grants.issue(session_id: session_id, name: name, ttl: ttl, cap: cap, identity: identity,
130
+ on_write: sidecar_writer(state_dir, [session_id]))
122
131
  grant = issued.grant
123
- log(session_id, :issued, state_dir: state_dir, participant: grant.id, name: grant.name, kind: grant.kind,
132
+ log(session_id, :issued, state_dir: state_dir, participant: grant.id, name: grant.name,
124
133
  role: grant.role, expires_at: grant.expires_at, cap: grant.spend_cap,
125
- **(grant.identity ? { identity: grant.identity } : {}), **(mode ? { mode: mode } : {}))
134
+ **(grant.identity ? { identity: grant.identity } : {}), mode: grant.mode)
126
135
  issued
127
136
  end
128
137
 
@@ -36,7 +36,7 @@ module Samagotchi
36
36
  @known = nil
37
37
  end
38
38
 
39
- # The participants in the review now: [{id:, name:, kind:}], [] for none.
39
+ # The participants in the session now: [{id:, name:}], [] for none.
40
40
  # @return [Array<Hash>]
41
41
  def active
42
42
  @mutex.synchronize { active_rows(read_entries) }
@@ -68,7 +68,7 @@ module Samagotchi
68
68
 
69
69
  def active_rows(entries)
70
70
  now = @clock.call
71
- entries.select { |entry| entry.active?(now) }.map { |entry| { id: entry.id, name: entry.name, kind: entry.kind } }
71
+ entries.select { |entry| entry.active?(now) }.map { |entry| { id: entry.id, name: entry.name } }
72
72
  end
73
73
 
74
74
  # The sidecar's entries, read again only when its mtime moved.
@@ -43,13 +43,13 @@ module Samagotchi
43
43
  "chi.tool_source" => "0.67.0", "chi.peer_source" => "0.67.0", "ctx.http" => "0.80.0",
44
44
  "ctx.cost" => "0.83.0", "ctx.sessions.children" => "0.34.0", "ctx.load_tools" => "0.99.0",
45
45
  "ctx.usage" => "0.100.0", "ctx.sessions.stop" => "0.34.0", "ctx.turn_author" => "0.106.0",
46
- "ctx.sessions.review" => "0.107.0", "ctx.sessions.send(delivery:)" => "0.64.0",
46
+ "ctx.sessions.send(delivery:)" => "0.64.0",
47
47
  "chi.toolkit(prompt:)" => "0.72.0", "ctx.ask_model(model:)" => "0.80.0", "chi.toolkit(groups:)" => "0.121.0",
48
48
  "chi.prompt_section" => "0.132.0", "chi.prompt_changed" => "0.132.0", "ctx.cache_confirm" => "0.132.0",
49
49
  "ctx.model_names" => "0.132.0", "chi.judgment" => "0.142.0", "ctx.judge" => "0.142.0",
50
50
  "ctx.judge_later" => "0.142.0", "ctx.judgments" => "0.142.0",
51
51
  "ctx.context.decline" => "0.43.0", "ctx.context.declined(url:)" => "0.43.0", "ctx.context.attach(force:)" => "0.43.0",
52
- "ctx.ask_user(effects:)" => "0.86.0", "chi.toolkit(description:)" => "0.122.0", "ctx.review" => "0.140.0",
52
+ "ctx.ask_user(effects:)" => "0.86.0", "chi.toolkit(description:)" => "0.122.0",
53
53
  "ctx.context.propose" => "0.140.0", "ctx.context.candidates" => "0.140.0", "ctx.context.withdraw" => "0.140.0",
54
54
  "ctx.continues" => "0.141.0", "ctx.context.left_behind" => "0.141.0", "ctx.context.attach(movable:)" => "0.141.0",
55
55
  "ctx.session_dir" => "0.143.0", "ctx.session_dir(create:)" => "0.144.0",
@@ -100,7 +100,7 @@ module Samagotchi
100
100
  return nil if own.declined?(candidate.name) || (url && own.declined_hints.include?(candidate.url))
101
101
 
102
102
  session = saved_session
103
- return nil if session&.review? || attached?(candidate, session)
103
+ return nil if attached?(candidate, session)
104
104
 
105
105
  recorded = own.add_candidate(candidate)
106
106
  if recorded.equal?(candidate)
@@ -276,10 +276,6 @@ module Samagotchi
276
276
  # another session handed over, not the user's own.
277
277
  def delegate? = !!saved_session&.delegate?
278
278
 
279
- # Whether the session is a review session (`chi review`, Session#review?):
280
- # one its participants read, not the owner's working session.
281
- def review? = !!saved_session&.review?
282
-
283
279
  # The id of the session this one continues (a continue's new link,
284
280
  # Session#continues), else nil.
285
281
  # @return [String, nil]
@@ -10,7 +10,6 @@ require_relative "../degrade"
10
10
  require_relative "../tools/delegate"
11
11
  require_relative "../children_status"
12
12
  require_relative "../context_move"
13
- require_relative "../review_start"
14
13
  require_relative "../model_profile"
15
14
 
16
15
  module Samagotchi
@@ -32,7 +31,7 @@ module Samagotchi
32
31
 
33
32
  # What starting a session can be refused by, answered as Error with
34
33
  # chi's own message: a model that is gone, a toolkit the config refuses,
35
- # a bad argument. #review adds its own: a subject it won't take.
34
+ # a bad argument.
36
35
  REFUSED = [ModelProfile::MissingModel, Toolkit::Refused, ArgumentError].freeze
37
36
 
38
37
  # @param host [Host] session_id, cwd, model_name and state_dir
@@ -88,29 +87,6 @@ module Samagotchi
88
87
  raise Error, e.message
89
88
  end
90
89
 
91
- # A review of this session (ReviewStart.fork, chi review --from): a new
92
- # session in its folder, on its model and setup, seeded with its recap
93
- # (never its transcript) and +seed+ (more context: the coordinator's
94
- # handoff, say), idle, to share with participants (chi share). This
95
- # session keeps running, unarchived. Not a child: it has no parent.
96
- # The recap is the one saved (the worker is asked for a fresh one, not
97
- # waited on unless +recap_wait+ seconds are given: this runs in this
98
- # session's own worker).
99
- # @param subjects [Array<String>] files under review, relative to its
100
- # folder (ReviewStart.check_subjects)
101
- # @return [String] the review session's id
102
- # @raise [Error] no session yet, a scratch session, a subject refused
103
- # (its one message), or it could not start
104
- def review(subjects: [], seed: nil, recap_wait: 0)
105
- source = @host.session_id.call or raise Error, "this session has no id yet"
106
- raise Error, "a scratch session starts no other sessions: they would outlive it" if @host.scratch&.call
107
-
108
- ReviewStart.fork(from: source, subjects: Array(subjects), seed: seed, state_dir: state_dir,
109
- recap_wait: recap_wait).id
110
- rescue *REFUSED, ReviewStart::Refused => e
111
- raise Error, e.message
112
- end
113
-
114
90
  # Send +text+ to session +id+ as a user message (it runs as a turn;
115
91
  # an idle session is woken, but one its owner stopped or archived is
116
92
  # not: refused). Waits up to 5 s for its worker, so call
@@ -202,8 +202,7 @@ module Samagotchi
202
202
  chi context <add|push|ls|show|refresh|rm|mute|unmute> live external text attached to sessions
203
203
  chi send [-m TEXT] ID...|--new a message into sessions, as if typed there
204
204
  chi answer ID --question QID --option N answer a question a session waits on
205
- chi share ID --name NAME | ls [ID] | cap ID P D | revoke ID [P]|--all participants who review a session
206
- chi review FILE... [--dir DIR] | --from ID a review session to share (chi share)
205
+ chi share ID --name NAME | ls [ID] | cap ID P D | revoke ID [P]|--all invite people into a session
207
206
  chi memory <ls|rm> [--scope project|system] the memories; rm moves one to the bundle trash
208
207
  chi bundle <install|upgrade|uninstall|status|diff|list|build|trash|new|test|check|try>
209
208
  chi guardrails replay [--dry-run] [--threshold T] [--model M] seed System 1's record from answered approvals
@@ -216,7 +215,7 @@ module Samagotchi
216
215
  chi project [init [DIR]] this folder's project; init makes a folder in no git repository one
217
216
  chi schedule <add|list|show|tick|run-now|enable|disable|cancel> durable schedules that outlive every worker
218
217
  chi remote <add|ls|rm> other machines' chi web, for chi --remote NAME
219
- chi --remote NAME <send|answer|note|context|sessions|share|review> … those commands on that machine (or CHI_REMOTE=NAME)
218
+ chi --remote NAME <send|answer|note|context|sessions|share> … those commands on that machine (or CHI_REMOTE=NAME)
220
219
  chi --remote NAME --attach ID | --resume ID | --dir DIR [-p TEXT] a session on that machine, in this terminal
221
220
  chi self version, paths, model and bundles
222
221
  chi update [--dry-run] update this chi, its bundles and the desktop helper
@@ -635,9 +635,9 @@ module Samagotchi
635
635
  wait_for_reply(id, target: target, timeout: options[:timeout])
636
636
  end
637
637
 
638
- # A participant's --wait -m (a review turn through chi --remote with
639
- # their token): their message always runs as a queued turn of its own
640
- # (chi web's review turns), so a running turn doesn't refuse it and
638
+ # A participant's --wait -m (a participant turn through chi --remote
639
+ # with their token): their message always runs as a queued turn of its
640
+ # own, so a running turn doesn't refuse it and
641
641
  # there is no busy check (the owner's route, refused to them). Their
642
642
  # wait routes take only a turn of theirs: the wait is on the one just
643
643
  # queued, as --wait --turn T.
@@ -648,7 +648,7 @@ module Samagotchi
648
648
 
649
649
  turn = @delivered.enqueued_id.to_s
650
650
  if turn.empty?
651
- error_line("chi send: #{target.label}: the review turn's id didn't come back; chi --remote … send --wait --turn T waits once you have it")
651
+ error_line("chi send: #{target.label}: the turn's id didn't come back; chi --remote … send --wait --turn T waits once you have it")
652
652
  return 1
653
653
  end
654
654
  start = @access.prepare_wait(id, turn: turn)
@@ -868,7 +868,7 @@ module Samagotchi
868
868
  return " (started its worker)" if owner.nil? && !@continued_here&.key?(id)
869
869
  return queue_note(result, running: running) if Delivery.queue?(delivery)
870
870
  return "" unless running
871
- # A participant's review turn was running: the worker queued it.
871
+ # A participant's turn was running: the worker queued it.
872
872
  return queue_note(result, running: running) if result.delivery == Delivery::QUEUE
873
873
 
874
874
  # A busy worker runs a message with images as its own next turn
@@ -884,14 +884,14 @@ module Samagotchi
884
884
  " #{TerminalUI::Formatting.steer_cut_note(outcome.to_sym, result.cut_after)}"
885
885
  end
886
886
 
887
- # A participant's message: queued as a review turn of its own (chi
888
- # web's), its id the one their wait takes.
887
+ # A participant's message: queued as a turn of its own, its id the one
888
+ # their wait takes.
889
889
  def participant_note(id, result)
890
890
  turn = result.enqueued_id.to_s
891
- return " (queued as a review turn)" if turn.empty?
892
- return " (queued as review turn #{turn})" if @waiting
891
+ return " (queued as their own turn)" if turn.empty?
892
+ return " (queued as turn #{turn})" if @waiting
893
893
 
894
- " (queued as review turn #{turn}; #{@access.invocation.command("send --wait --turn #{turn} #{id}")} waits for its reply)"
894
+ " (queued as turn #{turn}; #{@access.invocation.command("send --wait --turn #{turn} #{id}")} waits for its reply)"
895
895
  end
896
896
 
897
897
  # A --queue, worded from the Bridge's ack: queue when a turn ran as it
@@ -418,9 +418,6 @@ module Samagotchi
418
418
  @settings = SessionConfig::Settings.of(value)
419
419
  end
420
420
 
421
- # Whether this is a review session (chi review, the web's Start review).
422
- def review? = !@review.nil?
423
-
424
421
  # The session whose participants.json names this session's
425
422
  # participants: a Verify fresh child's parent (its requester's grant is
426
423
  # the parent's), else the session itself.
@@ -10,7 +10,7 @@ module Samagotchi
10
10
  # "chi <cmd> runs on this machine only: run it on <remote>"). The v1 scope is the remote-sessions plan's
11
11
  # D3: send, answer, note, a session's context (add, push, ls, show, rm)
12
12
  # and sessions list/stop/restart/archive/unarchive/delete, chi share
13
- # (the shared-sessions plan's P2) and chi review (P5); the rest
13
+ # (the shared-sessions plan's P2); the rest
14
14
  # stays local. bin/chi's subcommands that act on the machine, not on
15
15
  # sessions, are MACHINE. The run flags (chi --attach, -p, --resume: a
16
16
  # session in this terminal, a remote attach there) are RUN's.
@@ -124,7 +124,6 @@ module Samagotchi
124
124
  # through its chi web's participants routes.
125
125
  "share" => SUPPORTED,
126
126
  "share --name" => SUPPORTED,
127
- "share --agent" => SUPPORTED,
128
127
  "share --expires" => SUPPORTED,
129
128
  "share --cap" => SUPPORTED,
130
129
  # A chi web without bound grants (Remote#invite checks its
@@ -136,14 +135,6 @@ module Samagotchi
136
135
  "share revoke" => SUPPORTED,
137
136
  "share revoke --all" => SUPPORTED,
138
137
 
139
- # A review session (docs/sessions.md): the remote's chi web checks
140
- # the files against its own project; --dir is required there
141
- # unless --from (D4).
142
- "review" => SUPPORTED,
143
- "review --dir" => SUPPORTED,
144
- "review --model" => SUPPORTED,
145
- "review --from" => SUPPORTED,
146
-
147
138
  "broadcast" => LOCAL_ONLY
148
139
  }.freeze
149
140
 
@@ -21,7 +21,7 @@ require_relative "../chi_invocation"
21
21
  require_relative "../worker_sidecar"
22
22
  require_relative "../worker_link"
23
23
  require_relative "../worker_presence"
24
- require_relative "../review_start"
24
+ require_relative "../share_terms"
25
25
  require_relative "../launch_mode"
26
26
  require_relative "../participants"
27
27
  require_relative "../config"
@@ -144,11 +144,9 @@ module Samagotchi
144
144
  # @return [Session] the session created (its id, model_warning,
145
145
  # continues, moved_children)
146
146
  # @raise [SessionContinue::Refused, SessionManager::ArchiveRefused,
147
- # SessionManager::OwnedByTUI, ReviewStart::Refused] refused;
147
+ # SessionManager::OwnedByTUI] refused;
148
148
  # StandardError: could not start
149
149
  def create(spec)
150
- return create_review(spec) if spec.review
151
-
152
150
  start = spec.preview ? { prompt: spec.prompt, preview: spec.preview } : { prompt: spec.prompt }
153
151
  if spec.continues
154
152
  return SessionContinue.run(spec.continues, **start, model: spec.model_name, client_id: spec.client_id, **dir)
@@ -158,18 +156,6 @@ module Samagotchi
158
156
  setup: spec.setup, client_id: spec.client_id, **dir)
159
157
  end
160
158
 
161
- # A review session (ReviewStart): a fork of review.from, or a fresh
162
- # one in the spec's folder.
163
- def create_review(spec)
164
- review = spec.review
165
- if review.from
166
- return ReviewStart.fork(from: review.from, subjects: review.subjects, model: spec.model_name, state_dir: state_dir!)
167
- end
168
-
169
- ReviewStart.start(subjects: review.subjects, dir: spec.working_directory || Dir.pwd, model: spec.model_name,
170
- setup: spec.setup || SessionSetup.new, state_dir: state_dir!)
171
- end
172
-
173
159
  # Whether a just-created session's worker came up (its Bridge
174
160
  # answers) within +timeout+ seconds.
175
161
  def await_worker(id, timeout:)
@@ -443,15 +429,16 @@ module Samagotchi
443
429
  # header (Participants.invite).
444
430
  # @return [Invitation]
445
431
  # @raise [ArgumentError] no such session
446
- # @raise [BadRequest] a bad name, kind, ttl or identity, an archived
432
+ # @raise [BadRequest] a bad name, ttl or identity, an archived
447
433
  # session, an identity with no proxy to check it
448
- def invite(id, name:, kind:, ttl: nil, cap: nil, identity: nil)
434
+ def invite(id, name:, ttl: nil, cap: nil, identity: nil)
449
435
  public_url = configured_public_url
450
- # Stamped pair only when the warning chi share prints says their turns act.
451
- terms = ReviewStart.share_terms(Session.load(id, **dir), state_dir: state_dir!)
452
- issued = Participants.invite(grants, session_id: id, name: name, kind: kind, ttl: ttl, cap: cap,
453
- identity: identity, public_url: public_url, mode: terms.grant_mode,
454
- state_dir: state_dir!)
436
+ # No link while the live worker would refuse every turn of theirs.
437
+ terms = ShareTerms.of(Session.load(id, **dir), state_dir: state_dir!)
438
+ raise BadRequest.new(terms.refusal, code: "worker_too_old") if terms.refusal
439
+
440
+ issued = Participants.invite(grants, session_id: id, name: name, ttl: ttl, cap: cap,
441
+ identity: identity, public_url: public_url, state_dir: state_dir!)
455
442
  web = public_url ? nil : local_web
456
443
  link = if public_url then public_url.link(link_code(issued), "s=#{id}")
457
444
  else "http://#{web.ip || "127.0.0.1"}:#{web.port}/?token=#{issued.token}#s=#{id}"
@@ -104,7 +104,7 @@ module Samagotchi
104
104
 
105
105
  # The errors any route of +entry+'s chi web can answer, each its one
106
106
  # message: the token refused (401 unauthorized) or ended (401
107
- # token_revoked / token_expired), the LAN IP only (403 forbidden), a
107
+ # token_revoked / token_expired / token_outdated), the LAN IP only (403 forbidden), a
108
108
  # participant's token on an owner's route (403 not_permitted) or over
109
109
  # its limits (429 too_many_turns / cap_reached). nil for any other
110
110
  # answer (chi remote add says the same).
@@ -125,7 +125,7 @@ module Samagotchi
125
125
  end
126
126
  end
127
127
 
128
- ACCESS_ERRORS = [TokenRevoked, TokenExpired, TokenBound, NotPermitted, TooManyTurns, CapReached].freeze
128
+ ACCESS_ERRORS = [TokenRevoked, TokenExpired, TokenOutdated, TokenBound, NotPermitted, TooManyTurns, CapReached].freeze
129
129
 
130
130
  # --- ids and sessions
131
131
 
@@ -298,12 +298,12 @@ module Samagotchi
298
298
  # chi web with bound grants (BOUND_FEATURE) is asked; an older one
299
299
  # would ignore it and issue a grant anyone could open
300
300
  # @return [Invitation]
301
- # @raise [BadRequest] a bad name, kind, ttl or identity, an archived
301
+ # @raise [BadRequest] a bad name, ttl or identity, an archived
302
302
  # session, an identity that chi web has no proxy to check
303
303
  # @raise [RemoteTooOld] an identity, and a chi web without bound grants
304
- def invite(id, name:, kind:, ttl: nil, cap: nil, identity: nil)
304
+ def invite(id, name:, ttl: nil, cap: nil, identity: nil)
305
305
  require_feature!(BOUND_FEATURE) unless identity.nil?
306
- body = { name: name, kind: kind, ttl: ttl, cap: cap, identity: identity }.compact
306
+ body = { name: name, ttl: ttl, cap: cap, identity: identity }.compact
307
307
  reply = request(:post, "#{session_path(id)}/participants", body: body)
308
308
  raise_refusal(reply) unless reply.status == 201
309
309
 
@@ -781,8 +781,10 @@ module Samagotchi
781
781
  when "toolkit_refused" then raise Toolkit::Refused, message.to_s
782
782
  # The grants store doesn't read there: chi share says what it says here.
783
783
  when "grants_unwritable" then raise Grants::Unwritable, message.to_s
784
- when /\Ainvalid_/, "missing_fields", "bad_images"
785
- # invalid_participant: chi share's name, kind or ttl, an archived session
784
+ when /\Ainvalid_/, "missing_fields", "bad_images", "worker_too_old"
785
+ # invalid_participant: chi share's name or ttl, an archived
786
+ # session; worker_too_old: an invite to a session whose worker
787
+ # must restart first
786
788
  raise BadRequest.new(message.to_s, code: error)
787
789
  end
788
790
  raise RemoteFailed, "#{@entry.label} answered #{reply.status}#{" #{error}" unless error.empty?}" \
@@ -790,8 +792,6 @@ module Samagotchi
790
792
  end
791
793
 
792
794
  def create_body(spec)
793
- return review_body(spec) if spec.review
794
-
795
795
  body = { model: spec.model_name, client_id: spec.client_id, history: false }
796
796
  if spec.preview || spec.idle
797
797
  body.merge!(idle: true, preview: spec.preview)
@@ -808,17 +808,6 @@ module Samagotchi
808
808
  body.compact
809
809
  end
810
810
 
811
- # A review session's create (chi review): its subjects as typed,
812
- # checked by the server against its own files; a fork names its
813
- # source and takes its folder.
814
- def review_body(spec)
815
- review = { subjects: spec.review.subjects, from: spec.review.from }.compact
816
- body = { review: review, model: spec.model_name }
817
- body[:dir] = spec.working_directory unless spec.review.from
818
- body.merge!(setup_body(spec.setup)) if spec.setup && !spec.review.from
819
- body.compact
820
- end
821
-
822
811
  def setup_body(words)
823
812
  llm = words.llm_context&.to_h { |field, word| [LLM_CONTEXT_KEYS.fetch(field), word] }
824
813
  { llm_context: llm, thinking: words.thinking, toolkit: words.toolkit,
@@ -51,6 +51,12 @@ module Samagotchi
51
51
  def initialize(label) = super("#{label}: #{ParticipantMessages::TOKEN_EXPIRED}")
52
52
  end
53
53
 
54
+ # 401 token_outdated: a link an older chi issued for read-only turns.
55
+ class TokenOutdated < AuthRefused
56
+ CODE = "token_outdated"
57
+ def initialize(label) = super("#{label}: #{ParticipantMessages::TOKEN_OUTDATED}")
58
+ end
59
+
54
60
  # 401 token_bound: a link bound to one account, used without that
55
61
  # account's sign-in (chi --remote doesn't go through the proxy).
56
62
  class TokenBound < AuthRefused
@@ -102,7 +108,7 @@ module Samagotchi
102
108
  # "active", "revoked" or "expired".
103
109
  # +cap+ dollars and +queue+ turns (nil from a chi web before them).
104
110
  # +identity+ the email the grant is bound to, nil for any.
105
- ParticipantView = Data.define(:id, :session_id, :kind, :name, :role, :created_at, :expires_at, :revoked_at,
111
+ ParticipantView = Data.define(:id, :session_id, :name, :role, :created_at, :expires_at, :revoked_at,
106
112
  :revoked_by, :last_used_at, :state, :cap, :queue, :identity) do
107
113
  def initialize(identity: nil, **) = super
108
114
 
@@ -112,8 +118,8 @@ module Samagotchi
112
118
  # What chi share made: the participant, their token and the link that
113
119
  # carries it (both shown this once: chi keeps only a digest), and
114
120
  # whether that chi web listens on the LAN (+lan+ false: the link works
115
- # on that machine only), and the warning for sharing a working session
116
- # (ReviewStart.share_warning; nil for a review session).
121
+ # on that machine only), and the warning that a participant's turns act
122
+ # in the session (ShareTerms#warning).
117
123
  Invitation = Data.define(:participant, :token, :link, :lan, :warning) do
118
124
  def initialize(participant:, token:, link:, lan:, warning: nil) = super
119
125
 
@@ -133,21 +139,11 @@ module Samagotchi
133
139
  # bundles). +client_id+ (chi send's, or chi answer's for a parent's
134
140
  # /continue yes) and +images+ (images follow) are for a Remote's server,
135
141
  # which checks the first line and the model as chi send checks them
136
- # here (Local checks before it creates). +review+ (a Review) makes it a
137
- # review session (chi review): idle, no prompt, and with +review.from+
138
- # a review fork of that session (its folder and setup: the rest is nil).
142
+ # here (Local checks before it creates).
139
143
  NewSession = Data.define(:prompt, :preview, :continues, :working_directory, :model_name, :setup, :client_id,
140
- :images, :idle, :review) do
144
+ :images, :idle) do
141
145
  def initialize(prompt:, preview: nil, continues: nil, working_directory: nil, model_name: nil, setup: nil,
142
- client_id: nil, images: false, idle: false, review: nil) = super
143
- end
144
-
145
- # A review session to create (NewSession#review): +subjects+ as typed
146
- # (relative to the session's folder; the side that has the files checks
147
- # them, ReviewStart.check_subjects), +from+ the session a review fork
148
- # starts from (an id, a prefix or last:<id>), or nil.
149
- Review = Data.define(:subjects, :from) do
150
- def initialize(subjects: [], from: nil) = super(subjects: Array(subjects).map(&:to_s), from: from)
146
+ client_id: nil, images: false, idle: false) = super
151
147
  end
152
148
 
153
149
  # chi send --new's setup flags as typed, for a Remote: +llm_context+
@@ -82,14 +82,12 @@ module Samagotchi
82
82
  end
83
83
 
84
84
  # The last answer as the carry note takes it, in at most +room+ bytes;
85
- # nil with session.carry_last_answer off, when there is none, when a
86
- # review link has it (a continue copies review: but not the grants, so
87
- # the next link's participants could differ) or when the session can't
88
- # be read: this runs inside a continue's rollback, and a note without it
89
- # is still a good note.
85
+ # nil with session.carry_last_answer off, when there is none, or when
86
+ # the session can't be read: this runs inside a continue's rollback, and
87
+ # a note without it is still a good note.
90
88
  # @return [String, nil]
91
89
  def carried_answer(previous, room:, state_dir:)
92
- return nil if previous.review? || !Config.get("session.carry_last_answer")
90
+ return nil unless Config.get("session.carry_last_answer")
93
91
 
94
92
  text = last_answer(Session.load(previous.id, state_dir: state_dir).messages)
95
93
  text && keep_end(text, room)
@@ -178,7 +178,7 @@ module Samagotchi
178
178
  match: ->(text) { text.casecmp?("/unqueue") })
179
179
  # chi share for the attached session (TerminalUI::ParticipantCommands):
180
180
  # a participant's turns run on its worker.
181
- registry.register("/share", "invite someone to review this session (/share NAME [--agent] [--expires 3d] [--cap 2])",
181
+ registry.register("/share", "invite someone into this session (/share NAME [--expires 3d] [--cap 2])",
182
182
  local: true, uis: [:attached], match: ->(text) { text.match?(%r{\A/share(?:\s.*)?\z}i) })
183
183
  registry.register("/participants", "list this session's participants (revoke [P], cap P DOLLARS)",
184
184
  local: true, uis: [:attached], match: ->(text) { text.match?(%r{\A/participants(?:\s.*)?\z}i) })
@@ -450,8 +450,8 @@ module Samagotchi
450
450
  # /guardrails: the rules (by source), what failed to load, the stored
451
451
  # approvals, numbered; /guardrails revoke N removes approval N.
452
452
  # /context, /context attach NAME, /context decline NAME
453
- # (ContextCandidateChoice.choose: the owner's own; a participant can't
454
- # send a / line, and a review session refuses them).
453
+ # (ContextCandidateChoice.choose is the owner's only; a participant
454
+ # cannot send a / line).
455
455
  def context_command(args)
456
456
  return reply(context_listing) if args.empty?
457
457
 
@@ -529,6 +529,9 @@ module Samagotchi
529
529
  mode = Config.get("guardrails.system_one.mode").to_s
530
530
  return if mode == "off" && entries.empty?
531
531
 
532
+ # The worker's (an Engine's) listing: the attached TUI and chi send load
533
+ # this file too and never need the judgment client.
534
+ require_relative "system_one/client"
532
535
  no_judgment = SystemOne::Client.no_judgment_reason(host_registry: @engine.host_registry, mode: mode)
533
536
  lines << (no_judgment ? "System 1 (#{mode}, but nothing is judged: #{no_judgment}):" : "System 1 (#{mode}):")
534
537
  auto_allows = system_one_auto_allows(entries)