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
@@ -6,15 +6,16 @@
6
6
  //
7
7
  // Its feed: +arrive+ from stage_view.js place (a card the stage keeps),
8
8
  // +settle+ from question_cards.js's resolve path (onSettled: answered,
9
- // cancelled, replaced, removed; the continue card resolved or dropped), from
9
+ // cancelled, replaced, removed; the continue card resolved or dropped; done:
10
+ // answered, cancelled or resolved for good, which removes its stored fold), from
10
11
  // cards_place.js upsertCard for a plugin card redrawn without its actions,
11
12
  // and from stage_view.js turnEnded for the warn cards leaving with the
12
- // block; +reset+ from stage_view.js emptySlots. A second feed only settles:
13
- // +reconcile+ (stage_asking.js: at each refresh, and before the fold, the
14
- // blocking read and an opened row) drops an entry whose card
15
- // is gone or waits no more, for a card answered outside question_cards.js
16
- // (the stage's unit tests answer a card by its classes alone). It never
17
- // adds or docks: arrive is the one way in.
13
+ // block; +reset+ from stage_view.js emptySlots. Settle is the one way out:
14
+ // +reconcile+ (the old second feed, which dropped an entry whose card was
15
+ // gone or waited no more) is called by nobody now and stays one release
16
+ // for a mixed cache (an older stage_asking.js calls it); stage_asking.js
17
+ // reconcileWaiting only compares and warns (a debug check). Arrive is the
18
+ // one way in.
18
19
  //
19
20
  // A card's entry: its kind (KINDS), docked (it shows alone in the box above
20
21
  // the composer, its turn opened in the history: stage_asking.js docks; its
@@ -27,8 +28,9 @@
27
28
  // fold (the docked card's own, stage_asking.js) is the folded card's key and
28
29
  // how many cards waited when it was folded. That fold is this tab's own: it
29
30
  // is kept in sessionStorage (one entry per session) so a reload or a resync
30
- // mid-turn draws the card as the user left it, and it goes when the card is
31
- // answered or cancelled, when the fold drops, and when the turn hands off.
31
+ // mid-turn draws the card as the user left it, and it goes when that card is
32
+ // answered or cancelled (settle with done: no other card's answer touches
33
+ // it), when the fold drops, and when the turn hands off.
32
34
  import { ASKS, PENDING, WARN_CARD } from "./stage_cards.js";
33
35
  import { readSession, removeSession, writeSession } from "./storage.js";
34
36
 
@@ -147,17 +149,32 @@ export function createStageWaiting({ sessionId = null, storage = tabStorage } =
147
149
  return {
148
150
  // +key+ came to the stage (again: its kind and flags change, its place in
149
151
  // the order stays).
150
- arrive(key, { kind, docked = false, approval = false } = {}) {
152
+ // +summary+: the folded row's text from its data (card_kinds.js), null:
153
+ // none (stage_asking.js foldedText reads the card then).
154
+ arrive(key, { kind, docked = false, approval = false, summary = null } = {}) {
151
155
  if (!key || !KINDS.includes(kind)) return;
152
156
  const was = cards.get(key);
153
157
  // A new card goes in front of what the pager was on.
154
158
  if (!was) paged = null;
155
159
  cards.set(key, {
156
- kind, docked: !!docked, approval: !!approval, order: was ? was.order : seq++,
160
+ kind, docked: !!docked, approval: !!approval, summary: typeof summary === "string" ? summary : null, order: was ? was.order : seq++,
157
161
  });
158
162
  },
159
- // +key+ stopped waiting (+only+: when it is that kind).
160
- settle(key, { only = null } = {}) {
163
+ // +key+'s card was redrawn in place, still waiting (cards_place.js
164
+ // upsertCard): its kind and summary as its data says now, its order and
165
+ // docking as they were. Whether there was an entry to patch.
166
+ update(key, { kind, summary = null } = {}) {
167
+ const was = cards.get(key);
168
+ if (!was) return false;
169
+ cards.set(key, { ...was, kind: KINDS.includes(kind) ? kind : was.kind, summary: typeof summary === "string" ? summary : was.summary });
170
+ return true;
171
+ },
172
+ // +key+ stopped waiting (+only+: when it is that kind). +done+: for
173
+ // good (answered, cancelled, the continue card resolved): the fold this
174
+ // tab kept goes when it names this card, also when the stage holds no
175
+ // entry for it (a replay's earlier card, a history question).
176
+ settle(key, { only = null, done = false } = {}) {
177
+ if (done && key && storedFold()?.key === key) storage.remove(at());
161
178
  const was = cards.get(key);
162
179
  if (!was || (only && was.kind !== only)) return false;
163
180
  cards.delete(key);
@@ -17,8 +17,8 @@ import { createStartToolkit, toolkitLabel, toolkitOverride } from "./start_toolk
17
17
  // default in charge. The search list itself is model_picker.js'; a pick
18
18
  // sends the focus to the message box.
19
19
  //
20
- // Beside it, the start page's ⚙ panel (start_settings.js): thinking, LLM
21
- // context and review files, each a choice for the next new session only
20
+ // Beside it, the start page's ⚙ panel (start_settings.js): thinking and LLM
21
+ // context, each a choice for the next new session only
22
22
  // (sent with its create, then dropped; never remembered: a reload or opening
23
23
  // a session drops it too, a failed create keeps it). What is set shows as
24
24
  // override chips on the row, each opening the panel (a dot on ⚙ on a phone).
@@ -29,8 +29,8 @@ export const START_PICK_TITLE = "The model the new session starts on";
29
29
 
30
30
  // Used by app.js. Elements: +pickEl+ (the picker's button), +panelEl+,
31
31
  // +searchEl+, +listEl+, +composerEl+, +centerEl+ (model_picker.js'),
32
- // +settingsEl+ (⚙), +thinkingEl+ / +llmContextEl+ / +reviewEl+ (the override
33
- // chips; no +reviewEl+: no review files), +toolkitBtnEl+ (🧰) and
32
+ // +settingsEl+ (⚙), +thinkingEl+ / +llmContextEl+ (the override chips),
33
+ // +toolkitBtnEl+ (🧰) and
34
34
  // +toolkitEl+ (its override chip; both optional).
35
35
  // Hooks: +selected()+ the open session's id or null; +state()+ the open
36
36
  // session's fields (session_state.js: model, continues…); +running()+ a turn
@@ -38,7 +38,7 @@ export const START_PICK_TITLE = "The model the new session starts on";
38
38
  // (resolves true once the worker took it); +focusPrompt()+; +toast(text)+;
39
39
  // +listModels()+ GET /api/models (data.js). +win+: the page's unload events.
40
40
  export function createStartPage({
41
- pickEl, panelEl, searchEl, listEl, composerEl, centerEl, settingsEl, llmContextEl, thinkingEl, reviewEl = null,
41
+ pickEl, panelEl, searchEl, listEl, composerEl, centerEl, settingsEl, llmContextEl, thinkingEl,
42
42
  toolkitBtnEl = null, toolkitEl = null,
43
43
  selected, state, running, sessions, run, focusPrompt, toast, listModels,
44
44
  doc = globalThis.document, win = globalThis.window,
@@ -46,8 +46,6 @@ export function createStartPage({
46
46
  // The new session's own choices (null: follow the picked model's).
47
47
  let newChatLlmContext = null;
48
48
  let newChatThinking = null;
49
- // The files that make the new session a review session ([]: an ordinary one).
50
- let newChatReview = [];
51
49
  // The kit the new session starts on (null: Auto, nothing sent), and the
52
50
  // models payload's toolkits (null: no 🧰).
53
51
  let newChatToolkit = null;
@@ -72,7 +70,7 @@ export function createStartPage({
72
70
  const settings = createStartSettings({
73
71
  el: settingsEl,
74
72
  button: settingsEl,
75
- openers: [settingsEl, thinkingEl, llmContextEl, reviewEl].filter(Boolean).map((e) => `#${e.id}`).join(", "),
73
+ openers: [settingsEl, thinkingEl, llmContextEl].map((e) => `#${e.id}`).join(", "),
76
74
  thinking: {
77
75
  summary: newChatThinkingSummary,
78
76
  choice: () => newChatThinking,
@@ -83,16 +81,11 @@ export function createStartPage({
83
81
  choice: () => newChatLlmContext,
84
82
  choose: (next) => { newChatLlmContext = next; renderOverrides(); },
85
83
  },
86
- review: reviewEl ? {
87
- choice: () => newChatReview,
88
- choose: (next) => { newChatReview = next; renderOverrides(); },
89
- } : null,
90
84
  doc,
91
85
  win,
92
86
  });
93
- thinkingEl.addEventListener("click", () => settings.toggle("main", thinkingEl));
94
- llmContextEl.addEventListener("click", () => settings.toggle("main", llmContextEl));
95
- reviewEl?.addEventListener("click", () => settings.toggle("review", reviewEl));
87
+ thinkingEl.addEventListener("click", () => settings.toggle(thinkingEl));
88
+ llmContextEl.addEventListener("click", () => settings.toggle(llmContextEl));
96
89
  const toolkitList = toolkitBtnEl ? createStartToolkit({
97
90
  el: toolkitBtnEl,
98
91
  button: toolkitBtnEl,
@@ -100,18 +93,16 @@ export function createStartPage({
100
93
  toolkits: () => toolkits,
101
94
  choice: () => newChatToolkit,
102
95
  choose: (next) => { newChatToolkit = next; renderOverrides(); },
103
- review: () => newChatReview.length > 0,
104
96
  doc,
105
97
  win,
106
98
  }) : null;
107
99
  toolkitEl?.addEventListener("click", () => toolkitList?.toggle(toolkitEl));
108
100
  // The override chips (only what is set) and ⚙: its dot and label say
109
- // what is set; hidden with nothing to show (no model values, no review).
101
+ // what is set; hidden with nothing to show (no model values).
110
102
  function renderOverrides() {
111
103
  const thinkingSummary = newChatThinkingSummary();
112
104
  const llmContextSummary = newChatLlmSummary();
113
- const over = overrides({ thinking: newChatThinking, llmContext: newChatLlmContext, review: newChatReview,
114
- thinkingSummary, llmContextSummary });
105
+ const over = overrides({ thinking: newChatThinking, llmContext: newChatLlmContext, thinkingSummary, llmContextSummary });
115
106
  const paint = (chipEl, chip) => {
116
107
  if (!chipEl) return;
117
108
  chipEl.hidden = !chip;
@@ -120,9 +111,8 @@ export function createStartPage({
120
111
  };
121
112
  paint(thinkingEl, over.thinking);
122
113
  paint(llmContextEl, over.llmContext);
123
- paint(reviewEl, over.review);
124
114
  const label = settingsLabel(over);
125
- settingsEl.hidden = !(thinkingSummary || llmContextSummary || reviewEl || label.set);
115
+ settingsEl.hidden = !(thinkingSummary || llmContextSummary || label.set);
126
116
  settingsEl.classList.toggle("set", label.set);
127
117
  settingsEl.title = label.label;
128
118
  settingsEl.setAttribute("aria-label", label.label);
@@ -239,7 +229,7 @@ export function createStartPage({
239
229
  } catch (e) {
240
230
  const text = modelsFailedText(e, { startPage: !selected(), asked, leaving: pageLeaving });
241
231
  if (text) toast(text);
242
- // ⚙ without the model's rows (its review files only), no 🧰.
232
+ // ⚙ without the model's rows, no 🧰.
243
233
  toolkits = null;
244
234
  renderOverrides();
245
235
  return;
@@ -261,14 +251,12 @@ export function createStartPage({
261
251
  // The create request's own choices (the ⚙ panel's).
262
252
  function newChoices() {
263
253
  return { llm_context: choiceWords(newChatLlmContext), thinking: newChatThinking || undefined,
264
- review: newChatReview.length ? { subjects: newChatReview } : undefined,
265
254
  toolkit: newChatToolkit || undefined };
266
255
  }
267
256
  // The choices were for that new session only: a create took them.
268
257
  function clearChoices() {
269
258
  newChatLlmContext = null;
270
259
  newChatThinking = null;
271
- newChatReview = [];
272
260
  newChatToolkit = null;
273
261
  renderOverrides();
274
262
  }
@@ -283,15 +271,6 @@ export function createStartPage({
283
271
  syncModelPick, commandRan, restoreStartPick, loadModels, chosenModel, newChoices, clearChoices, dropChoices,
284
272
  // A fresh link's /model still in flight (a send waits for it), or null.
285
273
  pendingPick: () => pendingPick,
286
- // The start page's review files ([]: the new session isn't a review).
287
- reviewSubjects: () => newChatReview,
288
- // Start refused them (400 invalid_review): said in the ⚙ panel's review
289
- // view, opened again. @return whether it was said there
290
- reviewRefused: (message) => {
291
- if (!reviewEl || !newChatReview.length) return false;
292
- settings.refuse(message);
293
- return true;
294
- },
295
274
  // Start refused the picked kit (400 toolkit_refused): said in the 🧰
296
275
  // list, opened again. Without a pick it is config.yml's default that
297
276
  // is broken: @return false (the caller's alert).
@@ -1,18 +1,16 @@
1
1
  // The start page's ⚙ panel: the new session's rarely used settings in one
2
- // place (thinking, LLM context, review files), each a choice for the next
2
+ // place (thinking, LLM context), each a choice for the next
3
3
  // create only (start_page.js keeps them; never remembered). A pick applies
4
4
  // at once and the panel stays open; a typed budget has its own Set. Rows
5
5
  // the picked model has no values for are hidden, but a choice already made
6
- // is still sent: the panel says so and offers to clear it. The review files
7
- // are a view of their own (‹ back to the settings).
6
+ // is still sent: the panel says so and offers to clear it.
8
7
  //
9
8
  // Beside ⚙ on the row, override chips name what is set (overrides(): "think
10
- // high", "ctx stale", "review: README.md"); on a phone ⚙ carries a dot
9
+ // high", "ctx stale"); on a phone ⚙ carries a dot
11
10
  // instead (settingsLabel()).
12
11
 
13
12
  import { createChipPopover, SHEET_TALL } from "./chip_popover.js";
14
13
  import { mergeChoice, ownValues } from "./llm_context_chip.js";
15
- import { readSubjects, reviewChipModel, reviewFormTemplate } from "./review_start.js";
16
14
  import {
17
15
  contextSegments, contextWords, DEFAULT, settingsPanelTemplate, thinkingSegments,
18
16
  } from "./settings_panel.js";
@@ -29,7 +27,7 @@ const NO_LLM_CONTEXT = "the picked model has no LLM context values; it is sent a
29
27
  // The row's override chips: what is set for the new session, each
30
28
  // {text, title} or null. A choice the picked model shows no row for (its
31
29
  // summary is null) stays, its title saying it is sent anyway.
32
- export function overrides({ thinking = null, llmContext = null, review = [], thinkingSummary = null,
30
+ export function overrides({ thinking = null, llmContext = null, thinkingSummary = null,
33
31
  llmContextSummary = null } = {}) {
34
32
  const ctx = contextWords(llmContext);
35
33
  return {
@@ -45,22 +43,20 @@ export function overrides({ thinking = null, llmContext = null, review = [], thi
45
43
  ? `LLM context: ${ctx} for the new session (the model's: ${llmContextSummary.strategy}). Click to change it.`
46
44
  : `LLM context: ${ctx} for the new session: ${NO_LLM_CONTEXT}. Click to change it.`,
47
45
  } : null,
48
- review: review?.length ? reviewChipModel(review) : null,
49
46
  };
50
47
  }
51
48
 
52
49
  // ⚙'s state: whether anything is set (its dot on a phone) and its tooltip
53
50
  // and accessible name, which list what is.
54
51
  export function settingsLabel(over) {
55
- const set = [over.thinking, over.llmContext, over.review].filter(Boolean);
52
+ const set = [over.thinking, over.llmContext].filter(Boolean);
56
53
  return { set: set.length > 0, label: set.length ? `${PANEL_LABEL}: ${set.map((o) => o.text).join(", ")}` : PANEL_LABEL };
57
54
  }
58
55
 
59
56
  // The main view (settings_panel.js settingsPanelTemplate over the new
60
57
  // session's choices). +state+: {thinking: {summary, choice}, llmContext:
61
- // {summary, choice}, review: subjects or null (no review row), more: the
62
- // disclosure open, error: the context Set's}.
63
- export function panelTemplate({ thinking, llmContext, review = null, more = false, error = null }) {
58
+ // {summary, choice}, more: the disclosure open, error: the context Set's}.
59
+ export function panelTemplate({ thinking, llmContext, more = false, error = null }) {
64
60
  const think = thinkingSegments(thinking.summary, thinking.choice);
65
61
  const ctx = contextSegments(llmContext.summary, llmContext.choice);
66
62
  const ctxAnyway = !ctx && contextWords(llmContext.choice);
@@ -73,7 +69,6 @@ export function panelTemplate({ thinking, llmContext, review = null, more = fals
73
69
  more: { open: more, summary: llmContext.summary, choice: llmContext.choice, error } } : null,
74
70
  ctxAnyway ? { anyway: `Context ${ctxAnyway}: ${NO_LLM_CONTEXT}.`, act: "ctx-clear" } : null,
75
71
  ],
76
- review,
77
72
  note: NOTE,
78
73
  });
79
74
  }
@@ -83,49 +78,32 @@ export function panelTemplate({ thinking, llmContext, review = null, more = fals
83
78
  // and focus goes back to it whichever opener was clicked); +openers+: the
84
79
  // selector of every element that opens it (⚙ and the override chips: a click
85
80
  // there is not a click outside). +thinking+ / +llmContext+: {summary(),
86
- // choice(), choose(next)}; +review+: {choice(), choose(subjects)}, or null
87
- // (no review row).
88
- // @return {open(view), toggle(view), close, refresh, refuse(message), isOpen}
89
- export function createStartSettings({ el, button, openers = `#${button.id}`, thinking, llmContext, review = null,
81
+ // choice(), choose(next)}.
82
+ // @return {open(), toggle(), close, refresh, isOpen}
83
+ export function createStartSettings({ el, button, openers = `#${button.id}`, thinking, llmContext,
90
84
  doc = document, win = window }) {
91
- // "main" or "review"; the disclosure; the context Set's error; the review
92
- // form's error and text as typed.
93
- let view = "main";
85
+ // The disclosure; the context Set's error.
94
86
  let more = false;
95
87
  let error = null;
96
- let reviewError = null;
97
- let reviewText = null;
98
88
 
99
89
  function draw() {
100
- if (view === "review") {
101
- render(reviewFormTemplate(review.choice(), { error: reviewError, text: reviewText, back: true }), shell.pop);
102
- } else {
103
- render(panelTemplate({
104
- thinking: { summary: thinking.summary(), choice: thinking.choice() },
105
- llmContext: { summary: llmContext.summary(), choice: llmContext.choice() },
106
- review: review ? review.choice() : null, more, error,
107
- }), shell.pop);
108
- }
90
+ render(panelTemplate({
91
+ thinking: { summary: thinking.summary(), choice: thinking.choice() },
92
+ llmContext: { summary: llmContext.summary(), choice: llmContext.choice() },
93
+ more, error,
94
+ }), shell.pop);
109
95
  shell.replace();
110
96
  }
111
97
 
112
98
  // Focus inside on open (the popover sits at the end of <body>, so Tab
113
99
  // from ⚙ wouldn't reach it): the pressed segment of the first row, else
114
- // the first button; the review view's text field.
100
+ // the first button.
115
101
  function focusInside() {
116
102
  const pop = shell.pop;
117
- const at = view === "review" ? pop.querySelector("textarea")
118
- : pop.querySelector(".sset-seg [aria-pressed=true]") || pop.querySelector(".sset-link, .sset-seg button");
103
+ const at = pop.querySelector(".sset-seg [aria-pressed=true]") || pop.querySelector(".sset-link, .sset-seg button");
119
104
  at?.focus();
120
105
  }
121
106
 
122
- function switchTo(next) {
123
- view = next;
124
- draw();
125
- if (next === "review") focusInside();
126
- else shell.pop.querySelector("[data-act=review]")?.focus();
127
- }
128
-
129
107
  function pickContext(changes) {
130
108
  const initial = ownValues({ own: llmContext.choice() });
131
109
  let next;
@@ -155,17 +133,7 @@ export function createStartSettings({ el, button, openers = `#${button.id}`, thi
155
133
  else if (what === "ctx") return pickContext({ strategy: value });
156
134
  else if (what === "ctx-clear") llmContext.choose(null);
157
135
  else if (what === "ctx-more") more = !more;
158
- else if (what === "review") return switchTo("review");
159
- else if (what === "back") {
160
- reviewError = null;
161
- reviewText = null;
162
- return switchTo("main");
163
- } else if (what === "review-clear" || what === "clear") {
164
- review.choose([]);
165
- reviewError = null;
166
- reviewText = null;
167
- if (view === "review") return switchTo("main");
168
- } else return;
136
+ else return;
169
137
  draw();
170
138
  }
171
139
 
@@ -173,23 +141,12 @@ export function createStartSettings({ el, button, openers = `#${button.id}`, thi
173
141
  if (form.classList.contains("sset-ctx-form")) {
174
142
  return pickContext({ apply: form.elements.apply.value, budget: form.elements.budget.value });
175
143
  }
176
- const typed = form.elements.subjects?.value || "";
177
- const read = readSubjects(typed);
178
- if (read.error) {
179
- reviewError = read.error;
180
- reviewText = typed;
181
- return draw();
182
- }
183
- review.choose(read.subjects);
184
- reviewError = null;
185
- reviewText = null;
186
- switchTo("main");
187
144
  }
188
145
 
189
146
  const shell = createChipPopover({
190
147
  id: "startSettingsPopover", className: "ctx-popover start-settings", width: 440, el, anchor: `#${button.id}`, openers,
191
- // Taller than a plain sheet: the Apply and budget fields or the review
192
- // form would push the note under the edge of a 60 % one.
148
+ // Taller than a plain sheet: the Apply and budget fields would push the
149
+ // note under the edge of a 60 % one.
193
150
  summary: () => ({}), sheet: true, sheetShare: SHEET_TALL, label: PANEL_LABEL, doc, win,
194
151
  show: (_data, opening) => {
195
152
  if (opening) {
@@ -200,10 +157,7 @@ export function createStartSettings({ el, button, openers = `#${button.id}`, thi
200
157
  },
201
158
  onOpen: focusInside,
202
159
  onClose: () => {
203
- view = "main";
204
160
  error = null;
205
- reviewError = null;
206
- reviewText = null;
207
161
  },
208
162
  onSubmit: submit,
209
163
  onAct: act,
@@ -217,8 +171,7 @@ export function createStartSettings({ el, button, openers = `#${button.id}`, thi
217
171
  });
218
172
 
219
173
  // +from+: the opener clicked (focus goes back to it), ⚙ by default.
220
- function open(at = "main", from = button) {
221
- view = review ? at : "main";
174
+ function open(from = button) {
222
175
  if (shell.isOpen()) {
223
176
  draw();
224
177
  focusInside();
@@ -229,18 +182,11 @@ export function createStartSettings({ el, button, openers = `#${button.id}`, thi
229
182
 
230
183
  return {
231
184
  open,
232
- // An override chip's click: opens the panel (on +at+'s view), or closes it.
233
- toggle: (at = "main", from = button) => (shell.isOpen() ? shell.close() : open(at, from)),
185
+ // An override chip's click: opens the panel, or closes it.
186
+ toggle: (from = button) => (shell.isOpen() ? shell.close() : open(from)),
234
187
  close: () => shell.close(),
235
188
  isOpen: () => shell.isOpen(),
236
189
  // The picked model changed (its default labels, which rows show).
237
190
  refresh: () => { if (shell.isOpen()) draw(); },
238
- // Start refused the review files (400 invalid_review): said in the
239
- // review view, opened at the files chosen.
240
- refuse: (message) => {
241
- reviewError = message;
242
- reviewText = null;
243
- open("review");
244
- },
245
191
  };
246
192
  }
@@ -68,9 +68,8 @@ export function toolkitLabel(choice) {
68
68
  return { set: !!choice, label: choice ? `${LIST_LABEL}: ${choice}` : LIST_LABEL };
69
69
  }
70
70
 
71
- // +state+: {toolkits, choice, review: review files set (with Auto checked
72
- // a note says a review gets no suggestion), error: Start's refusal}.
73
- export function listTemplate({ toolkits, choice, review = false, error = null }) {
71
+ // +state+: {toolkits, choice, error: Start's refusal}.
72
+ export function listTemplate({ toolkits, choice, error = null }) {
74
73
  const rows = toolkitRows(toolkits, choice);
75
74
  return html`<div class="ctx-pop-head"><strong>Toolkit · new session</strong
76
75
  ><button type="button" class="ctx-pop-close" data-act="close" aria-label="Close">×</button></div
@@ -78,9 +77,7 @@ export function listTemplate({ toolkits, choice, review = false, error = null })
78
77
  data-act=${`kit:${r.value}`} aria-pressed=${r.pressed ? "true" : "false"} title=${r.title || nothing}
79
78
  ><span class="st-check" aria-hidden="true">${r.pressed ? "✓" : ""}</span><span class="st-name">${r.label}</span
80
79
  ><span class="st-detail">${r.detail}</span></button>`)}</div
81
- >${review && !choice && offersAuto(toolkits) ? html`<div class="ctx-pop-meta">A review session gets no suggestion: it starts on ${
82
- toolkits.default} unless you pick a kit.</div>` : nothing
83
- }<div class="ctx-pop-error" role="alert" ?hidden=${!error}>${error || ""}</div
80
+ ><div class="ctx-pop-error" role="alert" ?hidden=${!error}>${error || ""}</div
84
81
  ><div class="ctx-pop-meta">${NOTE}</div>`;
85
82
  }
86
83
 
@@ -88,16 +85,15 @@ export function listTemplate({ toolkits, choice, review = false, error = null })
88
85
  // where 🧰 is; +button+: 🧰 (the list opens at it; focus goes back to it);
89
86
  // +openers+: the selector of every element that opens it (🧰 and the
90
87
  // override chip). Hooks: +toolkits()+ the payload's toolkits (null: nothing
91
- // opens), +choice()+, +choose(next)+, +review()+ whether review files are
92
- // set.
88
+ // opens), +choice()+, +choose(next)+.
93
89
  // @return {open, toggle, close, refresh, refuse(message), isOpen}
94
90
  export function createStartToolkit({ el, button, openers = `#${button.id}`, toolkits, choice, choose,
95
- review = () => false, doc = document, win = window }) {
91
+ doc = document, win = window }) {
96
92
  // Start's refusal of the picked kit (400 toolkit_refused), until a pick.
97
93
  let error = null;
98
94
 
99
95
  function draw() {
100
- render(listTemplate({ toolkits: toolkits(), choice: choice(), review: review(), error }), shell.pop);
96
+ render(listTemplate({ toolkits: toolkits(), choice: choice(), error }), shell.pop);
101
97
  shell.replace();
102
98
  }
103
99
 
@@ -58,7 +58,7 @@ import {
58
58
  } from "./turn_events.js";
59
59
  import { commandView, drawCommandBubble, historyHasCommandBubble } from "./commands.js";
60
60
  import { keepEarlyRestore, restoreAction } from "./restore.js";
61
- import { PAIR, setBadgeMode } from "./participant_names.js";
61
+ import { setBadgeMode } from "./participant_names.js";
62
62
  import { isParticipantAuthor } from "./participant_model.js";
63
63
  import { stillOn } from "./latest.js";
64
64
 
@@ -165,12 +165,8 @@ export function createStreamHandlers(deps) {
165
165
  if (when && promptBubble?.setAttribute && !promptBubble.title) promptBubble.title = when;
166
166
  liveTurn.cutAfter = data.cut_after ?? null;
167
167
  liveTurn.serverGen = null;
168
- // A participant's review turn: its id and author, for Apply at its end
169
- // (turn_completed names neither). A pair turn acted itself: no Apply.
170
168
  const author = data.author || data.origin?.author;
171
169
  const participant = isParticipantAuthor(author);
172
- const pair = data.participant_mode === PAIR;
173
- liveTurn.review = participant && data.turn_id && !pair ? { turn_id: data.turn_id, author, author_name: data.author_name } : null;
174
170
  // Its prompt drawn while queued takes the turn's mode now.
175
171
  if (data.participant_mode) setBadgeMode(promptBubble, data.participant_mode);
176
172
  // The owner's input queues behind it (the composer's delivery line).
@@ -220,10 +216,6 @@ export function createStreamHandlers(deps) {
220
216
  // the hand-off never moves it before its links swap in.
221
217
  if (display) await display.promise;
222
218
  turnDom.answerReady();
223
- // A participant's review turn: Apply under its reply, as a reload shows it.
224
- const review = liveTurn.review;
225
- liveTurn.review = null;
226
- if (review && !data.turn_summary?.empty_answer) deps.placeApply?.(review);
227
219
  },
228
220
  // An after_turn hook presented the answer (AnswerDisplay) or attached
229
221
  // refs to it (AnswerRefs: refs, a count; display null when only refs):
@@ -22,9 +22,8 @@
22
22
  // removed at the end: the answer bubble takes its place. A lone step that
23
23
  // closed with text keeps its chrome: a line steered in after it left it alone
24
24
  // in the block when the answer went, and its summary is the way to its text.
25
- import { authorBadge, PAIR } from "./participant_names.js";
25
+ import { authorBadge, READ_ONLY } from "./participant_names.js";
26
26
  import { isParticipantAuthor } from "./participant_model.js";
27
- import { applyRowTemplate } from "./review_apply.js";
28
27
  import { html, nothing, render } from "./vendor/lit-html.js";
29
28
  import { answerRefsOf, setAnswerRefs } from "./answer_refs.js";
30
29
  import { bindRowRefs } from "./refs.js";
@@ -978,9 +977,8 @@ function pairStepTexts(els, group, items) {
978
977
  // turn's footprint on its summary line.
979
978
  // +cards+ the snapshot's cards (a drawn card's body), +capabilities+ the
980
979
  // page's (a notice shown elsewhere).
981
- // +apply+: false for a viewer without the owner's Apply (viewer.js): no Apply row.
982
980
  export function turnHistoryNodes(items, timing, { thumbs, workingSet = false, now = Date.now(), drawings = null, cards = null, capabilities = {},
983
- runningTurnId = null, apply = true }) {
981
+ runningTurnId = null }) {
984
982
  const timingTemplate = (group) => {
985
983
  const record = group.record;
986
984
  // Numbered by its place in the turn records, as live (a failed turn
@@ -1001,7 +999,7 @@ export function turnHistoryNodes(items, timing, { thumbs, workingSet = false, no
1001
999
  const userTemplate = (m, opts = {}) => {
1002
1000
  const shell = shellCommandMessage(m?.content);
1003
1001
  if (shell) return commandBubbleTemplate({ ...shell, at: m?.at });
1004
- return userBubbleTemplate(m, { label: sourceLabel(m?.source), thumbs: thumbs(m.images), author: authorBadge(m?.author, m?.author_name, m?.participant_mode), ...opts });
1002
+ return userBubbleTemplate(m, { label: sourceLabel(m?.source), thumbs: thumbs(m.images), author: authorBadge(m?.author, m?.author_name, m?.participant_mode || READ_ONLY), ...opts });
1005
1003
  };
1006
1004
  // The first text after a delegate report merged mid-turn, unless it is
1007
1005
  // the turn's answer (shown anyway). Its key (answer_fold.js): the turn's
@@ -1027,7 +1025,6 @@ export function turnHistoryNodes(items, timing, { thumbs, workingSet = false, no
1027
1025
  blockTurns.push(ordinal);
1028
1026
  }
1029
1027
  const lineKey = (i) => (items[i]?.source === "delegate_report" ? `${group.turnId}:input:${i - (group.user ?? i)}` : null);
1030
- const reviewer = apply && group.answer !== null && prompt?.turn_id && prompt.participant_mode !== PAIR ? authorBadge(prompt.author, prompt.author_name) : null;
1031
1028
  const pieces = turnPieces({
1032
1029
  prompt: prompt ? (prompt.role === "note" ? noteBubbleTemplate(prompt) : userTemplate(prompt)) : null,
1033
1030
  block: drawn.block,
@@ -1036,7 +1033,6 @@ export function turnHistoryNodes(items, timing, { thumbs, workingSet = false, no
1036
1033
  : null)),
1037
1034
  answer: drawn.answer,
1038
1035
  timing: timingTemplate(group),
1039
- apply: reviewer ? applyRowTemplate(prompt.turn_id, reviewer) : null,
1040
1036
  end: drawn.end,
1041
1037
  kept: drawn.kept,
1042
1038
  });
@@ -114,14 +114,21 @@ export function isOwn(clientId, myId) {
114
114
  return clientId != null && (clientId === myId || isViewerClient(clientId));
115
115
  }
116
116
 
117
- // As the TUI labels them (Formatting::CLIENT_LABELS); this file's label
118
- // helpers and the TUI's agree per spec/shared/labels_matrix.json.
119
- // By the whole id or its prefix (up to and with its first ":"); an id
120
- // chi doesn't know is "automatic", not the user (ClientId.human?).
117
+ // As the TUI labels them (ClientId::ROWS' labels, Formatting::CLIENT_LABELS);
118
+ // this file's label helpers and the TUI's agree per
119
+ // spec/shared/labels_matrix.json. By the whole id or its prefix (up to and
120
+ // with its first ":"); an id chi doesn't know is "automatic", not the user
121
+ // (ClientId.human?). null: labelled as no sender is (no label): a worker's
122
+ // own first prompt (ClientId::FIRST_PROMPT) and a person's card answer
123
+ // (ClientId::CARD_ANSWER).
121
124
  const CLIENT_LABELS = Object.freeze({
122
125
  "tui:": "tui", "web:": "web", "system:": "reminder", "delegate:": "delegate", "child:": "delegate report",
123
- "cli:send": "chi send", "cli:answer": "chi answer", plugin: "plugin", "review:": "review",
126
+ "cli:send": "chi send", "cli:answer": "chi answer", plugin: "plugin", "participant:": "invited",
127
+ "spawn:first": null, "card:answer": null,
128
+ // compat shim review_client_id: a participant's id from before participant:.
129
+ "review:": "invited",
124
130
  });
131
+ const labelFor = (key) => (Object.hasOwn(CLIENT_LABELS, key) ? CLIENT_LABELS[key] : undefined);
125
132
  const AUTOMATIC_LABEL = "automatic";
126
133
 
127
134
  // A delegate child's report comes in as client child:<id8> (ChildReports).
@@ -156,7 +163,9 @@ export function clientLabel(clientId) {
156
163
  if (id.startsWith(TASK_CLIENT) && id.length > TASK_CLIENT.length) return `task ${shortTaskId(id.slice(TASK_CLIENT.length))} finished`;
157
164
  if (id.startsWith(SCHEDULE_CLIENT)) return "schedule";
158
165
  const colon = id.indexOf(":");
159
- return CLIENT_LABELS[id] || (colon >= 0 && CLIENT_LABELS[id.slice(0, colon + 1)]) || AUTOMATIC_LABEL;
166
+ let label = labelFor(id);
167
+ if (label === undefined && colon >= 0) label = labelFor(id.slice(0, colon + 1));
168
+ return label === undefined ? AUTOMATIC_LABEL : label;
160
169
  }
161
170
 
162
171
  // The note for reminders a turn got (a reminder turn has no prompt).
@@ -8,12 +8,11 @@
8
8
  // The turn's pieces in order: its prompt (none for a reminder turn), its
9
9
  // block of steps, the steers no step holds, the lines merged into it in
10
10
  // arrival order (live: every extra, cards too), the answer's pieces or the
11
- // notice of a turn with none, the timing line, a participant's review Apply,
12
- // the end line (cancel, failure), the kept cards, then the lines queued for
11
+ // notice of a turn with none, the timing line, the end line (cancel, failure), the kept cards, then the lines queued for
13
12
  // after the turn (they run next).
14
13
  export function turnPieces({ prompt = null, block = null, steers = [], merged = [], answer = [], emptyNote = null, timing = null,
15
- apply = null, end = null, kept = [], queued = [] } = {}) {
16
- return [prompt, block, ...steers, ...merged, ...answer, emptyNote, timing, apply, end, ...kept, ...queued].filter(Boolean);
14
+ end = null, kept = [], queued = [] } = {}) {
15
+ return [prompt, block, ...steers, ...merged, ...answer, emptyNote, timing, end, ...kept, ...queued].filter(Boolean);
17
16
  }
18
17
 
19
18
  // The generation whose text is +turn+'s answer when it ended as +kind+
@@ -33,9 +33,15 @@ export function viewerSelf() {
33
33
  }
34
34
 
35
35
  // Whether +clientId+ is the viewer's own (chi web gives a participant's
36
- // turns review:<grant id>, whichever tab or device sent them).
36
+ // turns participant:<grant id>, whichever tab or device sent them).
37
+ const PARTICIPANT_CLIENT = "participant:";
38
+ // compat shim review_client_id: the same id as an older chi gave it.
39
+ const LEGACY_PARTICIPANT_CLIENT = "review:";
37
40
  export function isViewerClient(clientId) {
38
- return !!self?.clientId && clientId === self.clientId;
41
+ if (!self?.clientId) return false;
42
+ if (clientId === self.clientId) return true;
43
+ const own = String(self.clientId);
44
+ return own.startsWith(PARTICIPANT_CLIENT) && clientId === LEGACY_PARTICIPANT_CLIENT + own.slice(PARTICIPANT_CLIENT.length);
39
45
  }
40
46
 
41
47
  // Whether +author+ ("p:<id>") is the viewer's.
@@ -42,7 +42,7 @@ module Samagotchi
42
42
  row.each_index.select { |x| row[x] }.map { |x| "M#{x} #{y}h1v1h-1z" }
43
43
  end
44
44
  %(<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 #{size} #{size}" shape-rendering="crispEdges" role="img" ) +
45
- %(aria-label="QR code of the review link"><rect width="#{size}" height="#{size}" fill="#fff"/>) +
45
+ %(aria-label="QR code of the invite link"><rect width="#{size}" height="#{size}" fill="#fff"/>) +
46
46
  %(<path d="#{dark.join}" fill="#000"/></svg>)
47
47
  end
48
48