samagotchi 0.171.0 → 0.172.1

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 (209) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -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 +70 -27
  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 +81 -8
  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 +126 -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 +7 -48
  154. data/lib/samagotchi/web/public/card_kinds.js +51 -0
  155. data/lib/samagotchi/web/public/cards_place.js +13 -2
  156. data/lib/samagotchi/web/public/data.js +2 -10
  157. data/lib/samagotchi/web/public/delivery_line.js +17 -60
  158. data/lib/samagotchi/web/public/index.html +10 -30
  159. data/lib/samagotchi/web/public/live_turn.js +1 -1
  160. data/lib/samagotchi/web/public/owner_claim.js +2 -2
  161. data/lib/samagotchi/web/public/participant_bar.js +4 -5
  162. data/lib/samagotchi/web/public/participant_names.js +14 -10
  163. data/lib/samagotchi/web/public/participants_panel.js +29 -62
  164. data/lib/samagotchi/web/public/question_cards.js +29 -14
  165. data/lib/samagotchi/web/public/reload_check.js +2 -3
  166. data/lib/samagotchi/web/public/send_turn.js +4 -23
  167. data/lib/samagotchi/web/public/session_actions.js +4 -45
  168. data/lib/samagotchi/web/public/session_fields.js +0 -1
  169. data/lib/samagotchi/web/public/session_state.js +0 -3
  170. data/lib/samagotchi/web/public/session_sync.js +4 -2
  171. data/lib/samagotchi/web/public/session_view.js +2 -3
  172. data/lib/samagotchi/web/public/settings_panel.js +4 -18
  173. data/lib/samagotchi/web/public/stage_answer.js +56 -0
  174. data/lib/samagotchi/web/public/stage_asking.js +30 -11
  175. data/lib/samagotchi/web/public/stage_cloud.js +93 -0
  176. data/lib/samagotchi/web/public/stage_dom.js +100 -0
  177. data/lib/samagotchi/web/public/stage_handoff.js +154 -0
  178. data/lib/samagotchi/web/public/stage_pager.js +59 -0
  179. data/lib/samagotchi/web/public/stage_place.js +144 -0
  180. data/lib/samagotchi/web/public/stage_probe.js +64 -0
  181. data/lib/samagotchi/web/public/stage_quiet_clock.js +52 -0
  182. data/lib/samagotchi/web/public/stage_view.js +133 -506
  183. data/lib/samagotchi/web/public/stage_waiting.js +30 -13
  184. data/lib/samagotchi/web/public/start_page.js +12 -33
  185. data/lib/samagotchi/web/public/start_settings.js +24 -78
  186. data/lib/samagotchi/web/public/start_toolkit.js +6 -10
  187. data/lib/samagotchi/web/public/stream_handlers.js +1 -9
  188. data/lib/samagotchi/web/public/turn_block.js +3 -7
  189. data/lib/samagotchi/web/public/turn_events.js +15 -6
  190. data/lib/samagotchi/web/public/turn_pieces.js +3 -4
  191. data/lib/samagotchi/web/public/viewer_self.js +8 -2
  192. data/lib/samagotchi/web/qr.rb +1 -1
  193. data/lib/samagotchi/web/session_control.rb +3 -1
  194. data/lib/samagotchi/web/session_create.rb +5 -71
  195. data/lib/samagotchi/web/session_summary.rb +1 -4
  196. data/lib/samagotchi/web/verify_fresh_routes.rb +8 -7
  197. data/lib/samagotchi/web/viewer.rb +3 -3
  198. data/lib/samagotchi/worker.rb +16 -14
  199. data/lib/samagotchi/worker_inbound.rb +4 -3
  200. data/lib/samagotchi/worker_link.rb +17 -0
  201. data/lib/samagotchi/working_set.rb +87 -28
  202. metadata +16 -8
  203. data/lib/samagotchi/guardrails/review_boundary.rb +0 -99
  204. data/lib/samagotchi/participant_mode.rb +0 -86
  205. data/lib/samagotchi/review_apply.rb +0 -131
  206. data/lib/samagotchi/review_command.rb +0 -123
  207. data/lib/samagotchi/review_start.rb +0 -196
  208. data/lib/samagotchi/web/public/review_apply.js +0 -34
  209. data/lib/samagotchi/web/public/review_start.js +0 -55
@@ -5,8 +5,8 @@
5
5
  // and offers the other two deliveries as links (a phone has no row: idle
6
6
  // the line is gone; running it lies over the session bar's left, where
7
7
  // status, ctx and speed are, only while it matters: the text field focused
8
- // or holding text or images, a choice armed or an Apply turn held, the last
9
- // two written here as data-armed and data-held; index.html):
8
+ // or holding text or images, or a choice armed, the last written here as
9
+ // data-armed; index.html):
10
10
  //
11
11
  // ↳ goes in after this thinking step · 2:31 · 31k chars cut in now · queue for after the turn
12
12
  // ↳ goes in after this tool call (execute · 0:12) queue for after the turn
@@ -19,13 +19,7 @@
19
19
  // composer arms its choice for the next Enter; Esc or a second click
20
20
  // disarms it.
21
21
  //
22
- // An Apply turn (review_apply.js) in the composer is the owner's own turn,
23
- // never a steer into the running one (that may be a participant's
24
- // read-only review turn): while the composer holds it (hold(), till it is
25
- // sent, emptied or Esc'd) Enter queues it, and the line says so.
26
- //
27
- // While a participant's turn runs (a review turn, or a working session's
28
- // pair turn), the worker queues the owner's input behind it whatever it
22
+ // While a participant's turn runs, the worker queues the owner's input behind it whatever it
29
23
  // asks (never a steer or a cut into their turn): Enter queues, no cut is
30
24
  // offered, and the line says so.
31
25
  //
@@ -46,13 +40,7 @@ const CUT_SHORT = "cut in";
46
40
  // would steer it), the text kept, this said.
47
41
  export const QUEUE_NEEDS_WORKER = "Not sent: queueing needs a newer worker (it would steer the running turn). "
48
42
  + "Restart it (chi sessions restart ID, or the update badge), then send again.";
49
- // The line while the composer holds an Apply turn (Enter queues it).
50
- export const APPLY_QUEUES = "your Apply turn queues for after this turn · Esc to steer it in instead";
51
- export const APPLY_QUEUES_SHORT = "Apply: queued after the turn";
52
- // The same to a worker without the delivery feature: Enter refuses it.
53
- export const APPLY_CANT_QUEUE = "your Apply turn can't queue on this worker (restart it) · Esc to steer it in instead";
54
- // The line while a participant's turn runs (the worker queues), whichever
55
- // mode: review or pair.
43
+ // The line while a participant's turn runs (the worker queues).
56
44
  export const PARTICIPANT_TURN_QUEUES = "goes in as your own turn after this participant's turn";
57
45
  export const PARTICIPANT_TURN_QUEUES_SHORT = "after their turn";
58
46
  // A participant's line: their own turn, the owner's, another participant's.
@@ -116,8 +104,6 @@ function thinkingOnly(gen, serverGen) {
116
104
  // armed "cut" | "queue" | null: the choice the next Enter sends
117
105
  // canQueue the worker takes delivery: queue (its "delivery" feature)
118
106
  // model the session's model, for the cut-off reason
119
- // held the composer holds an Apply turn: Enter queues it (an armed
120
- // cut still wins)
121
107
  // participantTurn the running turn is a participant's: Enter queues,
122
108
  // no cut (the worker queues the owner's input behind it)
123
109
  // viewerTurn a participant looks: {own, steer, by} (their own turn, it
@@ -130,7 +116,7 @@ function thinkingOnly(gen, serverGen) {
130
116
  // cutting off the cut link goes (the text says why); without the
131
117
  // feature the queue link goes.
132
118
  export function deliveryLine({ phase = "thinking", gen = null, tool = null, cutAfter = null, serverGen = null, now = Date.now(),
133
- armed = null, canQueue = true, model = "", held = false, participantTurn = false, viewerTurn = null } = {}) {
119
+ armed = null, canQueue = true, model = "", participantTurn = false, viewerTurn = null } = {}) {
134
120
  if (viewerTurn) return viewerLine(viewerTurn);
135
121
  const cutOff = cutAfter === 0 || (cutAfter != null && cutAfter < 0);
136
122
  const thinking = phase === "thinking" && thinkingOnly(gen, serverGen);
@@ -164,16 +150,10 @@ export function deliveryLine({ phase = "thinking", gen = null, tool = null, cutA
164
150
  let wait = "";
165
151
  if (cutEnabled && cutAfter > 0 && age != null && age < cutAfter) wait = `cuts at about ${clockText(cutAfter)} if you choose ${CUT_LABEL}`;
166
152
  const effective = (armed === "cut" && cutEnabled) || (armed === "queue" && canQueue) ? armed : null;
167
- // An Apply turn queues unless a cut was armed for it.
168
- const applies = held && effective !== "cut";
169
- const enter = effective || (applies && canQueue ? "queue" : null);
170
- let parts = [cutOff ? reason : "", where, wait].filter(Boolean);
153
+ const enter = effective;
154
+ const parts = [cutOff ? reason : "", where, wait].filter(Boolean);
171
155
  // A phone's short row leaves it out: its ticked chip says it.
172
156
  if (effective) parts.push("Enter sends");
173
- if (applies) {
174
- parts = [canQueue ? APPLY_QUEUES : APPLY_CANT_QUEUE];
175
- if (canQueue) short = APPLY_QUEUES_SHORT;
176
- }
177
157
  if (participantTurn) {
178
158
  return {
179
159
  text: `\u21B3 ${PARTICIPANT_TURN_QUEUES}`,
@@ -230,17 +210,14 @@ function idleTemplate(hint = IDLE_HINT) {
230
210
  // phase, gen, tool, cutAfter, serverGen, canQueue, model)
231
211
  // composerEmpty() nothing typed and no image chips: a link arms
232
212
  // send(delivery) send the composer's line with +delivery+ ("cut", "queue")
233
- // session() the open session's id: an Apply hold is that session's
234
213
  const TICK_MS = 500;
235
214
 
236
215
  // +history+: the viewer walks a prompt history with ↑ (the idle hint says so).
237
- export function createDeliveryControl({ el, read, composerEmpty, send, session = () => null, now = () => Date.now(), history = true,
216
+ export function createDeliveryControl({ el, read, composerEmpty, send, now = () => Date.now(), history = true,
238
217
  setTimer = (fn, ms) => setInterval(fn, ms), clearTimer = (t) => clearInterval(t) }) {
239
218
  // "off" (no session: the row is gone), "idle" or "running".
240
219
  let mode = "off";
241
220
  let armed = null;
242
- // The session whose Apply turn the composer holds, or null.
243
- let heldFor = null;
244
221
  let timer = null;
245
222
  let line = null;
246
223
 
@@ -256,13 +233,11 @@ export function createDeliveryControl({ el, read, composerEmpty, send, session =
256
233
  refresh();
257
234
  };
258
235
 
259
- // For a phone's CSS (index.html): whether a choice is armed or an Apply
260
- // turn held while the turn runs ("1" or ""): the line shows then. Not the
261
- // queue chip's pressed look: a participant's turn draws it with nothing
262
- // armed.
236
+ // For a phone's CSS (index.html): whether a choice is armed while the
237
+ // turn runs ("1" or ""): the line shows then. Not the queue chip's
238
+ // pressed look: a participant's turn draws it with nothing armed.
263
239
  const mark = () => {
264
240
  el.dataset.armed = mode === "running" && armed ? "1" : "";
265
- el.dataset.held = mode === "running" && held() ? "1" : "";
266
241
  };
267
242
 
268
243
  function refresh() {
@@ -271,15 +246,13 @@ export function createDeliveryControl({ el, read, composerEmpty, send, session =
271
246
  if (mode === "idle") render(idleTemplate(history ? IDLE_HINT : IDLE_HINT_NO_HISTORY), el);
272
247
  return;
273
248
  }
274
- line = deliveryLine({ ...read(), now: now(), armed, held: held() });
249
+ line = deliveryLine({ ...read(), now: now(), armed });
275
250
  // A choice no longer possible (a tool started) disarms.
276
251
  armed = line.armed;
277
252
  mark();
278
253
  render(deliveryLineTemplate(line, { onCut: () => click("cut"), onQueue: () => click("queue") }), el);
279
254
  }
280
255
 
281
- const held = () => heldFor != null && heldFor === session();
282
-
283
256
  return {
284
257
  // +next+: "off", "idle" or "running".
285
258
  show(next) {
@@ -300,36 +273,20 @@ export function createDeliveryControl({ el, read, composerEmpty, send, session =
300
273
  refresh,
301
274
  click,
302
275
  armed: () => armed,
303
- // The composer holds an Apply turn (of the open session): Enter queues it.
304
- hold() {
305
- heldFor = session();
306
- refresh();
307
- },
308
- held,
309
- // The composer let it go (emptied).
310
- release() {
311
- if (heldFor == null) return;
312
- heldFor = null;
313
- refresh();
314
- },
315
276
  // What this send goes in as while the turn runs ("cut", "queue" or
316
- // null), the armed choice and the Apply hold let go. The hold is the
317
- // line's word on it (it knows the worker can queue); idle, none.
277
+ // null), the armed choice let go; idle, none.
318
278
  take() {
319
279
  const was = mode === "running" && line ? line.enter : armed;
320
- if (armed || heldFor != null) {
280
+ if (armed) {
321
281
  armed = null;
322
- heldFor = null;
323
282
  refresh();
324
283
  }
325
284
  return was || null;
326
285
  },
327
- // Esc: the armed choice goes; else, while the turn runs, the Apply hold
328
- // (Enter then steers it in).
286
+ // Esc: the armed choice goes.
329
287
  disarm() {
330
- if (armed) armed = null;
331
- else if (mode === "running" && held()) heldFor = null;
332
- else return false;
288
+ if (!armed) return false;
289
+ armed = null;
333
290
  refresh();
334
291
  return true;
335
292
  },
@@ -223,17 +223,6 @@ main{flex:1;display:flex;flex-direction:column;gap:16px;padding:max(16px,var(--s
223
223
  /* A participant's prompt: their name in their colour (tokens.css --author-N), and a rule of it on the bubble. */
224
224
  .bubble.user .origin-label.author-badge{color:var(--author-color);text-transform:none;letter-spacing:0;font-weight:600}
225
225
  .bubble.user.by-participant{border-left:3px solid var(--author-color)}
226
- /* Apply (review_apply.js) under a participant's review turn's reply. */
227
- .review-apply{display:flex;align-items:center;gap:10px;margin:6px 0 4px}
228
- .review-apply-btn{font:inherit;font-size:13px;font-weight:600;padding:5px 16px;border-radius:8px;cursor:pointer;background:var(--accent-bg);color:var(--accent);border:1px solid var(--accent-border)}
229
- @media(hover:hover){.review-apply-btn:hover{border-color:var(--accent)}}
230
- .review-apply-btn:disabled{opacity:.6;cursor:default}
231
- .review-apply-note{font-size:12px;color:var(--text-muted);border-left:3px solid var(--author-color);padding-left:8px}
232
- @media (max-width:600px){
233
- .review-apply{flex-direction:column;align-items:stretch;gap:4px}
234
- .review-apply-btn{width:100%;padding:10px 16px;font-size:15px}
235
- .review-apply-note{border-left:0;padding-left:0;text-align:center}
236
- }
237
226
  .bubble.user .user-message{flex:1;min-width:0}
238
227
  /* A delegate report in the history (long, markdown): its label and badge on a row of their own above it at any width,
239
228
  not centred beside a tall body. */
@@ -753,13 +742,13 @@ body.has-session #history{padding-bottom:calc(var(--dock-h,160px) + 16px + var(-
753
742
  (32px) and ⋯ (38px) with their gaps. The chips the line covers are hidden, unless the composer is folded away.
754
743
  Running, it shows only while it matters, the bar's status, ctx and speed otherwise (a card waiting, a sent steer, a
755
744
  message queued after the turn): the text field focused (the keyboard up) or holding text or images, or a choice
756
- armed or an Apply turn held (delivery_line.js data-armed, data-held; not the queue chip's pressed look, which a
745
+ armed (delivery_line.js data-armed; not the queue chip's pressed look, which a
757
746
  participant's turn draws with nothing armed). The two rules below share that list: change both. A chip's
758
747
  mousedown keeps the focus in the text field, so tapping one doesn't hide the line under the finger. On a bare
759
748
  stage an after-turn queued message isn't drawn and the line is hidden too: accepted. */
760
749
  body.has-session #deliveryLine{display:none}
761
- body.has-session #composer:has(:is(#prompt:focus,#prompt:not(:placeholder-shown),#chips:not([hidden]),#deliveryLine[data-armed="1"],#deliveryLine[data-held="1"])) #deliveryLine.running:not([hidden]){display:flex;position:absolute;left:10px;right:96px;top:100%;height:41px;padding:6px 0 8px;box-sizing:border-box;z-index:1}
762
- body.has-session:not(.composer-folded) #dock:has(#deliveryLine.running:not([hidden])):has(:is(#prompt:focus,#prompt:not(:placeholder-shown),#chips:not([hidden]),#deliveryLine[data-armed="1"],#deliveryLine[data-held="1"])) #infoBar .meta :is(.status,.ctx,.speed){visibility:hidden}
750
+ body.has-session #composer:has(:is(#prompt:focus,#prompt:not(:placeholder-shown),#chips:not([hidden]),#deliveryLine[data-armed="1"])) #deliveryLine.running:not([hidden]){display:flex;position:absolute;left:10px;right:96px;top:100%;height:41px;padding:6px 0 8px;box-sizing:border-box;z-index:1}
751
+ body.has-session:not(.composer-folded) #dock:has(#deliveryLine.running:not([hidden])):has(:is(#prompt:focus,#prompt:not(:placeholder-shown),#chips:not([hidden]),#deliveryLine[data-armed="1"])) #infoBar .meta :is(.status,.ctx,.speed){visibility:hidden}
763
752
  }
764
753
  /* A line queued for after the running turn: a dashed bubble, a turn of its own to come. */
765
754
  .bubble.user.queued[data-delivery="queue"]{border:1px dashed var(--accent-border);border-left:3px dashed var(--accent);background:transparent}
@@ -927,7 +916,7 @@ body.stage-view .turn-stage{position:absolute;left:0;right:0;bottom:100%;margin-
927
916
  question (the mini tool's slot, in the UI font, right after the phase), then the step and the timing. On a phone those
928
917
  two leave the row and the question takes a second line under it. */
929
918
  .ts-mini.ts-mini-question{order:1;font-family:inherit;font-size:12.5px;color:var(--text)}
930
- /* Two cards docked (stage_view.js drawDocked): one at a time, the one that stops chi in front; the pager after the phase
919
+ /* Two cards docked (stage_pager.js drawDocked): one at a time, the one that stops chi in front; the pager after the phase
931
920
  says where it is ("‹ 1 of 2 ›"), the other waits behind it. */
932
921
  .turn-stage .ts-extras>.ts-behind{display:none}
933
922
  .ts-pager{flex:none;display:inline-flex;align-items:center;gap:2px;color:var(--text-2)}
@@ -1363,9 +1352,9 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
1363
1352
  .pp-row.ended{opacity:.7}
1364
1353
  .pb-who{display:flex;align-items:center;gap:6px;min-width:0;color:var(--text)}
1365
1354
  .pb-who b{color:var(--author-color);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1355
+ .pp-who{display:flex;align-items:center;gap:6px;min-width:0}
1366
1356
  .pp-dot{width:7px;height:7px;border-radius:50%;background:var(--text-faint);flex-shrink:0}
1367
1357
  .pp-dot.present{background:var(--ok)}
1368
- .pp-tag{font-size:10.5px;padding:0 6px;border-radius:999px;background:var(--bg-raised);color:var(--text-3)}
1369
1358
  .pp-state{font-size:11px;color:var(--text-muted);white-space:nowrap}
1370
1359
  .pp-meta{grid-column:1;font-size:11.5px;color:var(--text-muted);font-variant-numeric:tabular-nums}
1371
1360
  .pp-capped{color:var(--warn-text);font-weight:600}
@@ -1391,7 +1380,7 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
1391
1380
  .pp-working button{font:inherit;font-size:12px;padding:3px 10px;border-radius:6px;cursor:pointer;background:var(--accent-bg);color:var(--accent);border:1px solid var(--accent-border)}
1392
1381
  .pp-working button:disabled{opacity:.7;cursor:progress}
1393
1382
  .pp-link{display:flex;gap:4px}
1394
- /* The start page's ⚙ panel (start_settings.js): rows of segments (a label, then pill buttons with aria-pressed), the context's Apply and budget disclosure, the review row; a bottom sheet on a phone. Its classes are sset- (the Stop sheet's are ss-). */
1383
+ /* The start page's ⚙ panel (start_settings.js): rows of segments (a label, then pill buttons with aria-pressed), the context's Apply and budget disclosure; a bottom sheet on a phone. Its classes are sset- (the Stop sheet's are ss-). */
1395
1384
  .start-settings{gap:10px}
1396
1385
  .start-settings .ctx-pop-head strong{font-family:inherit}
1397
1386
  .sset-row{display:flex;align-items:flex-start;gap:10px}
@@ -1400,24 +1389,19 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
1400
1389
  .sset-seg button{height:26px;min-height:26px;padding:0 9px;border:1px solid var(--border-strong);border-radius:7px;background:transparent;color:var(--text-2);font-size:12px;line-height:24px;white-space:nowrap}
1401
1390
  .sset-seg button:hover{filter:none}
1402
1391
  .sset-seg button[aria-pressed="true"]{background:var(--accent-bg);color:var(--accent);border-color:var(--accent-border)}
1403
- .sset-seg button:focus-visible,.sset-link:focus-visible,.sset-back:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
1392
+ .sset-seg button:focus-visible,.sset-link:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
1404
1393
  .sset-ctx-more{margin:-4px 0 0 74px}
1405
1394
  .sset-link{padding:2px 4px;border:0;border-radius:5px;background:transparent;color:var(--accent);font-size:12px}
1406
1395
  .sset-link:hover{filter:none}
1407
1396
  .sset-ctx-form{display:flex;flex-direction:column;gap:8px;margin:0 0 0 74px}
1408
1397
  .sset-anyway{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px}
1409
1398
  .sset-rule{width:100%;margin:0;border:0;border-top:1px solid var(--border)}
1410
- .sset-review{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px}
1411
- .sset-review>.sset-link:first-child{margin-left:-4px}
1412
- .sset-review-set{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text);font-size:12.5px}
1413
- .sset-back{margin:0 2px 0 -6px;padding:0 6px;border:0;border-radius:5px;background:transparent;color:var(--text-muted);font-size:18px;line-height:1}
1414
- .sset-back:hover{filter:none}
1415
1399
  .start-settings.sheet{border-radius:14px;padding:14px 16px}
1416
1400
  /* Tints only where a pointer hovers: on a touch screen a tapped control would keep it. Every popover's (chip_popover.js)
1417
1401
  controls and its opener's :hover tint sit in @media(hover:hover); an open opener shows it by aria-expanded instead. */
1418
- @media(hover:hover){.sset-seg button:hover{color:var(--text);border-color:var(--accent-border)}.sset-link:hover{background:var(--accent-bg)}.sset-back:hover{color:var(--text);background:var(--bg-hover)}.st-row:hover{color:var(--text);background:var(--bg-hover)}}
1402
+ @media(hover:hover){.sset-seg button:hover{color:var(--text);border-color:var(--accent-border)}.sset-link:hover{background:var(--accent-bg)}.st-row:hover{color:var(--text);background:var(--bg-hover)}}
1419
1403
  @media(max-width:400px){.sset-row{flex-direction:column;gap:4px}.sset-label{flex:none;line-height:1.4}.sset-ctx-more,.sset-ctx-form{margin-left:0}}
1420
- @media(pointer:coarse){.sset-seg button{height:36px;min-height:36px;line-height:34px;padding:0 12px;font-size:13px}.sset-link,.sset-back{min-height:36px}.sset-label{line-height:36px}}
1404
+ @media(pointer:coarse){.sset-seg button{height:36px;min-height:36px;line-height:34px;padding:0 12px;font-size:13px}.sset-link{min-height:36px}.sset-label{line-height:36px}}
1421
1405
  /* The start page's 🧰 list (start_toolkit.js): a row per kit (a check, its name, a muted detail), the checked one accent; a bottom sheet on a phone. */
1422
1406
  .start-toolkit{gap:8px}
1423
1407
  .start-toolkit .ctx-pop-head strong{font-family:inherit}
@@ -1432,9 +1416,6 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
1432
1416
  .start-toolkit.sheet{border-radius:14px;padding:14px 16px}
1433
1417
  .start-toolkit.sheet .st-detail{white-space:normal}
1434
1418
  @media(pointer:coarse){.st-row{min-height:40px;align-items:center}}
1435
- .rs-form{display:flex;flex-direction:column;gap:6px;margin-top:6px}
1436
- .rs-form textarea{width:100%;resize:vertical;min-height:52px;font-family:ui-monospace,monospace;font-size:12px;color:var(--text);background:var(--bg-inset);border:1px solid var(--border-strong);border-radius:6px;padding:6px 8px}
1437
- .rs-form textarea:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-ring)}
1438
1419
  .pp-link input{flex:1;min-width:0;font-family:ui-monospace,monospace;font-size:11.5px}
1439
1420
  .pp-qr{align-self:center;width:164px;height:164px;padding:6px;border-radius:8px;background:var(--on-solid)}
1440
1421
  .pp-qr svg{display:block;width:100%;height:100%}
@@ -2019,7 +2000,7 @@ a{color:var(--accent)}
2019
2000
  fields in this list (stage.spec.js's phone step checks the visible ones). */
2020
2001
  @media (max-width:600px),(pointer:coarse){
2021
2002
  #composer textarea,.question-freeform,.continue-reason,.participants-popover input,.participants-popover select,
2022
- .rs-form textarea,.pp-link input,.llmctx-field select,.llmctx-field input,.ws-add-in,.rename-input,
2003
+ .pp-link input,.llmctx-field select,.llmctx-field input,.ws-add-in,.rename-input,
2023
2004
  #modelSearch,.project-create input{font-size:16px}
2024
2005
  }
2025
2006
  /* A participant's page (participant_main.js): a plain logo, their name and the link's end in the top row; the bottom row in
@@ -2110,7 +2091,6 @@ body.participant-view .bubble.user:not(.by-participant)>.origin-label{color:var(
2110
2091
  <button type="button" id="modelPick" class="model-pick" title="The model the new session starts on" aria-label="Model for the new session" aria-haspopup="listbox" aria-expanded="false" hidden><span class="model-pick-name"></span></button>
2111
2092
  <button type="button" id="thinkingNew" class="llmctx-new think-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
2112
2093
  <button type="button" id="llmContextNew" class="llmctx-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
2113
- <button type="button" id="reviewNew" class="llmctx-new review-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
2114
2094
  <button type="button" id="toolkitNew" class="llmctx-new toolkit-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
2115
2095
  <button type="button" id="settingsNew" class="icon-btn settings-btn" title="Session settings" aria-label="Session settings" aria-haspopup="dialog" aria-expanded="false" hidden></button>
2116
2096
  <button type="button" id="toolkitBtn" class="icon-btn toolkit-btn" title="Toolkit" aria-label="Toolkit" aria-haspopup="dialog" aria-expanded="false" hidden></button>
@@ -32,7 +32,7 @@ export function createLiveTurn(timingDeps) {
32
32
  // until the next generation starts: the composer's delivery line.
33
33
  cutAfter: null,
34
34
  serverGen: null,
35
- // The running turn is a participant's review turn (turn_started's
35
+ // The running turn is a participant's (turn_started's
36
36
  // author): the delivery line says the owner's input queues behind it.
37
37
  participantTurn: false,
38
38
 
@@ -51,7 +51,7 @@ export function createOwnerClaim({
51
51
 
52
52
  // Annotate's "Copy link" for a selection in a turn's answer, step or own
53
53
  // message: a participant's page's link when the session has a person
54
- // active (it opens in the browser their review link was opened in: one
54
+ // active (it opens in the browser their invite link was opened in: one
55
55
  // link per browser, the cookie), else this page's own.
56
56
  function linkFor(source, range) {
57
57
  // Not in a Revise stack's switched copy (revise_switch.js: view only, no claim key; Verify isn't offered there either).
@@ -69,7 +69,7 @@ export function createOwnerClaim({
69
69
  }
70
70
  const whose = target.names.map((name) => `${name}'s`).join(" or ");
71
71
  return { url: participantClaimLink(target.base, store.selected, claim),
72
- title: `A link to this for ${whose} browser: it opens where their review link was opened (one link per browser). Opened here, it shows your page.` };
72
+ title: `A link to this for ${whose} browser: it opens where their invite link was opened (one link per browser). Opened here, it shows your page.` };
73
73
  }
74
74
 
75
75
  async function copyLink({ url }) {
@@ -39,9 +39,8 @@ export function spentText(usage) {
39
39
 
40
40
  const money = (value) => `$${Number(value).toFixed(2)}`;
41
41
 
42
- // What their turns may do, by the grant's mode (pair: they act; review:
43
- // they only read).
44
- export const RULES_TEXT = { pair: "chi acts under the owner's rules", review: "your turns only read" };
42
+ // What their turns may do, by the grant's mode (pair: they act).
43
+ export const RULES_TEXT = { pair: "chi acts under the owner's rules" };
45
44
 
46
45
  // The bottom row's items: [{key, text, tip}].
47
46
  // status "idle" | "running" | "waiting"
@@ -86,7 +85,7 @@ export function whoTemplate({ name, endsAt, color = null }) {
86
85
  // usage the show's viewer.usage (the cap's amount)
87
86
  // refusal {code, text}: the server's words for a send refused as
88
87
  // session_stopped, or the link that ended (token_revoked,
89
- // token_expired): shown as they are
88
+ // token_expired, token_outdated): shown as they are
90
89
  // → {kind, title, text}
91
90
  export function closedLine({ capReached = false, usage = null, refusal = null } = {}) {
92
91
  if (refusal?.text) {
@@ -105,4 +104,4 @@ export function closedTemplate(line) {
105
104
 
106
105
  // The codes of a refused send that close the composer (the rest are a
107
106
  // toast with the server's words): their state, not this message's.
108
- export const CLOSING_CODES = Object.freeze(["cap_reached", "session_stopped", "token_revoked", "token_expired"]);
107
+ export const CLOSING_CODES = Object.freeze(["cap_reached", "session_stopped", "token_revoked", "token_expired", "token_outdated"]);
@@ -35,18 +35,22 @@ export function authorBadge(author, name = null, mode = null) {
35
35
  }
36
36
 
37
37
  // A badge's text and tooltip (turn_html.js userBubbleTemplate), by the
38
- // turn's mode: a pair turn (a working session's) acted with the session's
39
- // tools; a review turn, or one whose mode isn't known (a queued prompt, a
40
- // message from before the stamp), could only read.
38
+ // turn's mode: a participant's turn acts with the session's tools (pair,
39
+ // and a live prompt whose mode isn't known yet: a queued one, until
40
+ // setBadgeMode); a saved turn stamped "review", or saved with no stamp (an
41
+ // older chi's, as Steer reads it), could only read: the history render
42
+ // passes READ_ONLY for an unstamped one (turn_block.js). PAIR is the stamp
43
+ // ParticipantTurnMode::PAIR_MODE writes; the page only reads it.
41
44
  export const PAIR = "pair";
42
- // A participant looking (viewer_self.js) reads a pair turn by its name alone.
45
+ export const READ_ONLY = "review";
46
+ // A participant looking (viewer_self.js) reads their turn by its name alone.
43
47
  export const authorBadgeText = (name, mode = null) => {
44
- if (mode === PAIR) return viewerSelf() ? name : `${name} · pair`;
45
- return `${name} · review`;
48
+ if (mode === READ_ONLY) return `${name} · read-only`;
49
+ return viewerSelf() ? name : `${name} · pair`;
46
50
  };
47
- export const authorBadgeTitle = (name, mode = null) => (mode === PAIR
48
- ? `A turn from ${name}, a participant: it acted with this session's tools, its asks came to you`
49
- : `A review comment from ${name}, a participant: its turn could only read`);
51
+ export const authorBadgeTitle = (name, mode = null) => (mode === READ_ONLY
52
+ ? `A turn from ${name}, a participant, under an older chi: it could only read`
53
+ : `A turn from ${name}, a participant: it acted with this session's tools, its asks came to you`);
50
54
 
51
55
  // The badge on +bubble+ (a prompt drawn before its turn started) takes the
52
56
  // turn's +mode+ once turn_started names it.
@@ -55,7 +59,7 @@ export function setBadgeMode(bubble, mode) {
55
59
  if (!badge || !mode) return;
56
60
  bubble.dataset.participantMode = mode;
57
61
  if (badge.dataset.unnamed) return;
58
- const name = participantName(bubble.dataset.author) || badge.textContent.replace(/ · (review|pair)$/, "");
62
+ const name = participantName(bubble.dataset.author) || badge.textContent.replace(/ · (read-only|pair)$/, "");
59
63
  badge.textContent = authorBadgeText(name, mode);
60
64
  badge.title = authorBadgeTitle(name, mode);
61
65
  }