samagotchi 0.170.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 (267) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +61 -1
  3. data/bin/chi +6 -4
  4. data/docs/architecture.md +26 -9
  5. data/docs/bundles.md +4 -21
  6. data/docs/cli.md +81 -97
  7. data/docs/configuration.md +12 -14
  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/block-renderers.md +2 -2
  14. data/docs/internals/bridge.md +34 -7
  15. data/docs/internals/context-telemetry.md +13 -1
  16. data/docs/internals/engine.md +25 -13
  17. data/docs/internals/inline-widgets.md +1 -1
  18. data/docs/internals/objectives.md +4 -6
  19. data/docs/internals/participants.md +340 -249
  20. data/docs/internals/prompt-caching.md +4 -5
  21. data/docs/internals/web-frontend.md +185 -35
  22. data/docs/internals/working-set.md +71 -5
  23. data/docs/memory.md +1 -1
  24. data/docs/plugins.md +2 -16
  25. data/docs/releasing.md +2 -1
  26. data/docs/scheduling.md +1 -1
  27. data/docs/sessions.md +17 -48
  28. data/docs/sub-agent.md +2 -2
  29. data/docs/system-one.md +2 -2
  30. data/docs/testing.md +56 -7
  31. data/lib/samagotchi/bridge/card_store.rb +1 -0
  32. data/lib/samagotchi/bridge/sse_writer.rb +1 -0
  33. data/lib/samagotchi/bridge/turn_accumulator.rb +8 -5
  34. data/lib/samagotchi/bridge.rb +64 -20
  35. data/lib/samagotchi/bridge_client/event_stream.rb +2 -0
  36. data/lib/samagotchi/bundle_command/test_run.rb +1 -0
  37. data/lib/samagotchi/bundle_command/try/run.rb +1 -0
  38. data/lib/samagotchi/bundles/coordinator/manifest.yml +4 -5
  39. data/lib/samagotchi/bundles/coordinator/plugin.rb +6 -79
  40. data/lib/samagotchi/bundles/coordinator/skill_coordinator.md +1 -16
  41. data/lib/samagotchi/bundles/github-pr/manifest.yml +2 -2
  42. data/lib/samagotchi/bundles/github-pr/plugin.rb +0 -1
  43. data/lib/samagotchi/bundles/inline-widgets/manifest.yml +2 -2
  44. data/lib/samagotchi/bundles/inline-widgets/plugin.rb +4 -5
  45. data/lib/samagotchi/bundles/system/manifest.yml +1 -1
  46. data/lib/samagotchi/client_id.rb +126 -67
  47. data/lib/samagotchi/command_intake.rb +15 -3
  48. data/lib/samagotchi/compat.rb +6 -1
  49. data/lib/samagotchi/context_candidate_choice.rb +1 -3
  50. data/lib/samagotchi/context_candidates.rb +3 -4
  51. data/lib/samagotchi/continue_offer.rb +9 -2
  52. data/lib/samagotchi/delivery.rb +36 -12
  53. data/lib/samagotchi/empty_answer_error.rb +5 -0
  54. data/lib/samagotchi/engine/cards.rb +3 -0
  55. data/lib/samagotchi/engine/context_judge.rb +5 -3
  56. data/lib/samagotchi/engine/events.rb +4 -0
  57. data/lib/samagotchi/engine/hooks.rb +3 -0
  58. data/lib/samagotchi/engine/messages.rb +5 -0
  59. data/lib/samagotchi/engine/model_settings.rb +2 -0
  60. data/lib/samagotchi/engine/models.rb +10 -0
  61. data/lib/samagotchi/engine/objectives.rb +6 -0
  62. data/lib/samagotchi/engine/participants.rb +18 -14
  63. data/lib/samagotchi/engine/plugins.rb +8 -0
  64. data/lib/samagotchi/engine/questions.rb +3 -0
  65. data/lib/samagotchi/engine/recap.rb +1 -0
  66. data/lib/samagotchi/engine/session.rb +4 -0
  67. data/lib/samagotchi/engine/side_requests.rb +9 -0
  68. data/lib/samagotchi/engine/steering.rb +2 -0
  69. data/lib/samagotchi/engine/toolkit.rb +5 -0
  70. data/lib/samagotchi/engine/turn_end.rb +7 -0
  71. data/lib/samagotchi/engine/turn_helpers.rb +8 -0
  72. data/lib/samagotchi/engine/verify.rb +2 -0
  73. data/lib/samagotchi/engine.rb +8 -3
  74. data/lib/samagotchi/event_fanout.rb +22 -1
  75. data/lib/samagotchi/grants.rb +33 -22
  76. data/lib/samagotchi/guardrail_wiring.rb +23 -18
  77. data/lib/samagotchi/guardrails/approval_use.rb +59 -0
  78. data/lib/samagotchi/guardrails/approvals.rb +9 -11
  79. data/lib/samagotchi/guardrails/child_boundary.rb +1 -0
  80. data/lib/samagotchi/guardrails/gate.rb +10 -5
  81. data/lib/samagotchi/guardrails/implicit_writers.rb +1 -0
  82. data/lib/samagotchi/guardrails/pair_boundary.rb +6 -6
  83. data/lib/samagotchi/guardrails/participant_refusal.rb +33 -0
  84. data/lib/samagotchi/guardrails/review_paths.rb +2 -3
  85. data/lib/samagotchi/guardrails.rb +1 -1
  86. data/lib/samagotchi/image_store.rb +51 -12
  87. data/lib/samagotchi/kernel_loop.rb +7 -1
  88. data/lib/samagotchi/llm/stray_tool_call.rb +7 -4
  89. data/lib/samagotchi/llm_context_stale.rb +4 -1
  90. data/lib/samagotchi/llm_context_strategy.rb +2 -0
  91. data/lib/samagotchi/objectives.rb +1 -4
  92. data/lib/samagotchi/objectives_audit.rb +1 -1
  93. data/lib/samagotchi/objectives_track.rb +1 -1
  94. data/lib/samagotchi/owner_prompt.rb +3 -6
  95. data/lib/samagotchi/parent_report.rb +1 -0
  96. data/lib/samagotchi/participant_messages.rb +48 -4
  97. data/lib/samagotchi/participant_revise.rb +61 -0
  98. data/lib/samagotchi/participant_turn_mode.rb +50 -0
  99. data/lib/samagotchi/participant_uploads.rb +98 -0
  100. data/lib/samagotchi/participants.rb +21 -12
  101. data/lib/samagotchi/participants_watch.rb +2 -2
  102. data/lib/samagotchi/plugin/api.rb +2 -2
  103. data/lib/samagotchi/plugin/attached_context.rb +1 -1
  104. data/lib/samagotchi/plugin/context.rb +0 -4
  105. data/lib/samagotchi/plugin/sessions.rb +1 -25
  106. data/lib/samagotchi/reply_wait/poll.rb +5 -1
  107. data/lib/samagotchi/revise_anchor.rb +9 -0
  108. data/lib/samagotchi/run_options.rb +2 -3
  109. data/lib/samagotchi/send_command.rb +15 -10
  110. data/lib/samagotchi/session.rb +0 -3
  111. data/lib/samagotchi/session_access/contract.rb +1 -10
  112. data/lib/samagotchi/session_access/local.rb +10 -23
  113. data/lib/samagotchi/session_access/remote.rb +9 -20
  114. data/lib/samagotchi/session_access.rb +12 -16
  115. data/lib/samagotchi/session_chain.rb +4 -6
  116. data/lib/samagotchi/session_commands.rb +6 -3
  117. data/lib/samagotchi/session_continue.rb +1 -2
  118. data/lib/samagotchi/session_inbox.rb +20 -12
  119. data/lib/samagotchi/session_manager/delivery.rb +32 -5
  120. data/lib/samagotchi/session_manager/lifecycle.rb +12 -0
  121. data/lib/samagotchi/session_manager/listing.rb +5 -0
  122. data/lib/samagotchi/session_manager/spawn.rb +2 -2
  123. data/lib/samagotchi/session_manager/worker_command.rb +9 -0
  124. data/lib/samagotchi/session_participants.rb +12 -8
  125. data/lib/samagotchi/session_review.rb +5 -7
  126. data/lib/samagotchi/session_stores.rb +3 -1
  127. data/lib/samagotchi/share_command.rb +10 -12
  128. data/lib/samagotchi/share_terms.rb +41 -0
  129. data/lib/samagotchi/steer.rb +8 -14
  130. data/lib/samagotchi/system_prompt.rb +16 -25
  131. data/lib/samagotchi/terminal_ui/attach_launcher.rb +2 -1
  132. data/lib/samagotchi/terminal_ui/attached_loop/exit_commands.rb +1 -0
  133. data/lib/samagotchi/terminal_ui/attached_loop/queueing.rb +1 -0
  134. data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +2 -0
  135. data/lib/samagotchi/terminal_ui/formatting.rb +15 -17
  136. data/lib/samagotchi/terminal_ui/participant_commands.rb +2 -2
  137. data/lib/samagotchi/terminal_ui/status_row.rb +2 -2
  138. data/lib/samagotchi/terminal_ui.rb +1 -2
  139. data/lib/samagotchi/testing/sessions.rb +2 -10
  140. data/lib/samagotchi/tool_runner.rb +42 -9
  141. data/lib/samagotchi/toolkit.rb +4 -22
  142. data/lib/samagotchi/toolkit_suggest.rb +3 -3
  143. data/lib/samagotchi/tools/deferred_tools.rb +1 -0
  144. data/lib/samagotchi/tools/execute.rb +11 -45
  145. data/lib/samagotchi/tools/leftovers.rb +122 -0
  146. data/lib/samagotchi/tools/memory.rb +88 -25
  147. data/lib/samagotchi/tools/task_get.rb +1 -0
  148. data/lib/samagotchi/tools/task_list.rb +3 -2
  149. data/lib/samagotchi/tools/task_record.rb +6 -4
  150. data/lib/samagotchi/tools/task_runtime.rb +199 -20
  151. data/lib/samagotchi/tools/task_wait.rb +4 -3
  152. data/lib/samagotchi/turn_anchors.rb +0 -3
  153. data/lib/samagotchi/turn_context.rb +1 -1
  154. data/lib/samagotchi/turn_origin.rb +1 -1
  155. data/lib/samagotchi/turn_stages/context_judge.rb +4 -4
  156. data/lib/samagotchi/turn_stages/objectives.rb +2 -2
  157. data/lib/samagotchi/turn_stages/toolkit_suggestion.rb +2 -2
  158. data/lib/samagotchi/turn_stages/verify_anchors.rb +13 -1
  159. data/lib/samagotchi/update_hint.rb +3 -1
  160. data/lib/samagotchi/verify_anchor.rb +6 -0
  161. data/lib/samagotchi/verify_fresh.rb +1 -1
  162. data/lib/samagotchi/verify_fresh_origin.rb +13 -11
  163. data/lib/samagotchi/version.rb +1 -1
  164. data/lib/samagotchi/web/app.rb +45 -82
  165. data/lib/samagotchi/web/participant_access.rb +139 -40
  166. data/lib/samagotchi/web/participant_images.rb +185 -0
  167. data/lib/samagotchi/web/participant_review.rb +22 -142
  168. data/lib/samagotchi/web/participant_show.rb +241 -0
  169. data/lib/samagotchi/web/participant_stream_filter.rb +25 -2
  170. data/lib/samagotchi/web/participant_view.rb +334 -27
  171. data/lib/samagotchi/web/participants_admin.rb +21 -40
  172. data/lib/samagotchi/web/public/annotate_bar.css +1 -2
  173. data/lib/samagotchi/web/public/annotate_bar.js +1 -2
  174. data/lib/samagotchi/web/public/app.js +126 -132
  175. data/lib/samagotchi/web/public/block_host.js +7 -4
  176. data/lib/samagotchi/web/public/bubbles.js +9 -1
  177. data/lib/samagotchi/web/public/cards_offscreen.js +69 -0
  178. data/lib/samagotchi/web/public/chip_popover.js +5 -4
  179. data/lib/samagotchi/web/public/claim_link.js +4 -4
  180. data/lib/samagotchi/web/public/composer.css +4 -6
  181. data/lib/samagotchi/web/public/composer_mode.js +11 -6
  182. data/lib/samagotchi/web/public/composer_mount.js +4 -4
  183. data/lib/samagotchi/web/public/ctx.js +12 -3
  184. data/lib/samagotchi/web/public/data.js +2 -10
  185. data/lib/samagotchi/web/public/delivery_line.js +49 -63
  186. data/lib/samagotchi/web/public/history_shape.js +5 -1
  187. data/lib/samagotchi/web/public/images.js +7 -1
  188. data/lib/samagotchi/web/public/index.html +50 -34
  189. data/lib/samagotchi/web/public/info_bar_model.js +2 -1
  190. data/lib/samagotchi/web/public/live_turn.js +1 -1
  191. data/lib/samagotchi/web/public/markdown_place.js +5 -4
  192. data/lib/samagotchi/web/public/owner_claim.js +5 -5
  193. data/lib/samagotchi/web/public/owner_verify.js +0 -2
  194. data/lib/samagotchi/web/public/participant_bar.js +107 -0
  195. data/lib/samagotchi/web/public/participant_main.js +289 -0
  196. data/lib/samagotchi/web/public/participant_model.js +5 -292
  197. data/lib/samagotchi/web/public/participant_names.js +17 -8
  198. data/lib/samagotchi/web/public/participant_revise.js +66 -0
  199. data/lib/samagotchi/web/public/participants_panel.js +32 -74
  200. data/lib/samagotchi/web/public/question_cards.js +14 -3
  201. data/lib/samagotchi/web/public/refs.js +53 -36
  202. data/lib/samagotchi/web/public/reload_check.js +70 -14
  203. data/lib/samagotchi/web/public/revise_stack.js +21 -10
  204. data/lib/samagotchi/web/public/send_turn.js +28 -29
  205. data/lib/samagotchi/web/public/session_actions.js +4 -45
  206. data/lib/samagotchi/web/public/session_fields.js +1 -2
  207. data/lib/samagotchi/web/public/session_state.js +12 -7
  208. data/lib/samagotchi/web/public/session_sync.js +9 -2
  209. data/lib/samagotchi/web/public/session_view.js +14 -5
  210. data/lib/samagotchi/web/public/settings_panel.js +4 -18
  211. data/lib/samagotchi/web/public/stage_answer.js +56 -0
  212. data/lib/samagotchi/web/public/stage_asking.js +7 -5
  213. data/lib/samagotchi/web/public/stage_cloud.js +93 -0
  214. data/lib/samagotchi/web/public/stage_dom.js +100 -0
  215. data/lib/samagotchi/web/public/stage_handoff.js +154 -0
  216. data/lib/samagotchi/web/public/stage_owner_wait.js +35 -0
  217. data/lib/samagotchi/web/public/stage_pager.js +59 -0
  218. data/lib/samagotchi/web/public/stage_quiet_clock.js +52 -0
  219. data/lib/samagotchi/web/public/stage_view.js +103 -410
  220. data/lib/samagotchi/web/public/stage_waiting.js +74 -6
  221. data/lib/samagotchi/web/public/start_page.js +12 -33
  222. data/lib/samagotchi/web/public/start_settings.js +24 -78
  223. data/lib/samagotchi/web/public/start_toolkit.js +6 -10
  224. data/lib/samagotchi/web/public/storage.js +22 -0
  225. data/lib/samagotchi/web/public/stream_handlers.js +3 -10
  226. data/lib/samagotchi/web/public/tokens.css +1 -1
  227. data/lib/samagotchi/web/public/turn_block.js +2 -5
  228. data/lib/samagotchi/web/public/turn_events.js +30 -12
  229. data/lib/samagotchi/web/public/turn_html.js +9 -2
  230. data/lib/samagotchi/web/public/turn_pieces.js +3 -4
  231. data/lib/samagotchi/web/public/turn_range.js +1 -2
  232. data/lib/samagotchi/web/public/verify_target.js +2 -4
  233. data/lib/samagotchi/web/public/viewer.js +59 -0
  234. data/lib/samagotchi/web/public/viewer_self.js +59 -0
  235. data/lib/samagotchi/web/public/working_set.js +11 -5
  236. data/lib/samagotchi/web/public/working_set_view.js +53 -8
  237. data/lib/samagotchi/web/public/ws_cards.js +89 -0
  238. data/lib/samagotchi/web/public/ws_peek.js +106 -0
  239. data/lib/samagotchi/web/public/ws_preview.css +126 -0
  240. data/lib/samagotchi/web/public/ws_reader.js +319 -0
  241. data/lib/samagotchi/web/public/ws_timeline.js +200 -0
  242. data/lib/samagotchi/web/public/ws_way_in.js +25 -0
  243. data/lib/samagotchi/web/qr.rb +1 -1
  244. data/lib/samagotchi/web/session_control.rb +42 -15
  245. data/lib/samagotchi/web/session_create.rb +6 -72
  246. data/lib/samagotchi/web/session_show.rb +75 -28
  247. data/lib/samagotchi/web/session_summary.rb +1 -4
  248. data/lib/samagotchi/web/verify_fresh_routes.rb +8 -7
  249. data/lib/samagotchi/web/viewer.rb +70 -0
  250. data/lib/samagotchi/web/working_set_routes.rb +132 -0
  251. data/lib/samagotchi/worker.rb +35 -28
  252. data/lib/samagotchi/worker_inbound.rb +4 -3
  253. data/lib/samagotchi/worker_link.rb +17 -0
  254. data/lib/samagotchi/working_set.rb +322 -11
  255. metadata +32 -13
  256. data/lib/samagotchi/guardrails/review_boundary.rb +0 -99
  257. data/lib/samagotchi/participant_mode.rb +0 -86
  258. data/lib/samagotchi/review_apply.rb +0 -131
  259. data/lib/samagotchi/review_command.rb +0 -123
  260. data/lib/samagotchi/review_start.rb +0 -196
  261. data/lib/samagotchi/web/public/participant.html +0 -218
  262. data/lib/samagotchi/web/public/participant.js +0 -719
  263. data/lib/samagotchi/web/public/participant_annotate.js +0 -76
  264. data/lib/samagotchi/web/public/review_apply.js +0 -34
  265. data/lib/samagotchi/web/public/review_history.js +0 -72
  266. data/lib/samagotchi/web/public/review_start.js +0 -55
  267. data/lib/samagotchi/web/public/tools_overview.js +0 -42
@@ -25,8 +25,12 @@
25
25
  // a reload agree whatever order the replay brings them in. One docked card
26
26
  // shows at a time (+shown+: the one the pager is on, else the first). The
27
27
  // fold (the docked card's own, stage_asking.js) is the folded card's key and
28
- // how many cards waited when it was folded.
28
+ // how many cards waited when it was folded. That fold is this tab's own: it
29
+ // 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.
29
32
  import { ASKS, PENDING, WARN_CARD } from "./stage_cards.js";
33
+ import { readSession, removeSession, writeSession } from "./storage.js";
30
34
 
31
35
  // The kinds: what blocks the turn (BLOCKING), a running turn's card with
32
36
  // actions (check-in: "asks"), a plugin's warning ("warn": stays in sight,
@@ -46,6 +50,20 @@ export const CONTINUE_KEY = "continue";
46
50
  export const questionKey = (qid) => (qid == null ? null : `q:${qid}`);
47
51
  export const pluginCardKey = (id) => (id == null || id === "" ? null : `c:${id}`);
48
52
 
53
+ // The asking card's fold, kept for this tab (docs/internals/web-frontend.md
54
+ // Storage keys): one entry per session, JSON {key, with}.
55
+ export const FOLD_PREFIX = "chi_asking_fold:";
56
+ export const foldKey = (sessionId) => (sessionId ? `${FOLD_PREFIX}${sessionId}` : null);
57
+
58
+ // The fold's storage: the guarded sessionStorage (storage.js); the specs
59
+ // inject their own, so one test's fold is not another's (they all use session
60
+ // s1 and the same question ids).
61
+ const tabStorage = {
62
+ read: (key) => readSession(key),
63
+ write: (key, value) => writeSession(key, value),
64
+ remove: (key) => removeSession(key),
65
+ };
66
+
49
67
  // +el+'s key, null: not a card the stage keeps.
50
68
  export function waitingKey(el) {
51
69
  if (!el?.matches) return null;
@@ -79,13 +97,19 @@ export function cardIn(root, key) {
79
97
  // +kind+'s rank in the stage's order: blocking cards before the rest.
80
98
  const rank = (kind) => (BLOCKING.has(kind) ? 0 : 1);
81
99
 
82
- export function createStageWaiting() {
100
+ // +sessionId+: the open session (a getter, as app.js and the harnesses pass
101
+ // it); +storage+: the fold's read/write/remove, guarded (the specs inject
102
+ // their own).
103
+ export function createStageWaiting({ sessionId = null, storage = tabStorage } = {}) {
83
104
  const cards = new Map();
84
105
  let seq = 0;
85
106
  let folded = null;
86
107
  let foldedWith = 0;
87
108
  // The docked card the pager is on (null: the first).
88
109
  let paged = null;
110
+ // The key this session's fold is stored under (null: no session, nothing
111
+ // to keep).
112
+ const at = () => foldKey(typeof sessionId === "function" ? sessionId() : sessionId);
89
113
 
90
114
  const entries = () => [...cards.entries()].sort((a, b) => rank(a[1].kind) - rank(b[1].kind) || a[1].order - b[1].order);
91
115
  const dockedKeys = () => entries().filter(([, e]) => e.docked).map(([key]) => key);
@@ -98,6 +122,28 @@ export function createStageWaiting() {
98
122
  return n;
99
123
  }
100
124
 
125
+ // The fold this tab kept for the open session: {key, with}, or null (no
126
+ // fold, nothing stored, or storage that can't be read).
127
+ function storedFold() {
128
+ const key = at();
129
+ if (!key) return null;
130
+ try {
131
+ const value = JSON.parse(storage.read(key) || "null");
132
+ return typeof value?.key === "string" ? { key: value.key, with: Number(value.with) || 0 } : null;
133
+ } catch (_) {
134
+ return null;
135
+ }
136
+ }
137
+
138
+ // The stored fold says what the fold is: written with the count it was
139
+ // made at, removed when there is no fold.
140
+ function keepFold() {
141
+ const key = at();
142
+ if (!key) return;
143
+ if (folded) storage.write(key, JSON.stringify({ key: folded, with: foldedWith }));
144
+ else storage.remove(key);
145
+ }
146
+
101
147
  return {
102
148
  // +key+ came to the stage (again: its kind and flags change, its place in
103
149
  // the order stays).
@@ -117,7 +163,9 @@ export function createStageWaiting() {
117
163
  cards.delete(key);
118
164
  return true;
119
165
  },
120
- // The stage let its turn go: nothing waits, nothing is folded.
166
+ // The stage let its turn go: nothing waits, nothing is folded — the
167
+ // stored fold stays: a resync replays the same turn, and the fold is the
168
+ // user's.
121
169
  reset() {
122
170
  cards.clear();
123
171
  seq = 0;
@@ -161,20 +209,40 @@ export function createStageWaiting() {
161
209
  // Every entry in the stage's order (the tests' and the harness's read).
162
210
  list: () => entries().map(([key, e]) => ({ key, ...e })),
163
211
  // The asking form's fold: +key+ folded by hand (null: unfolded), with
164
- // the blocking cards that wait now.
212
+ // the blocking cards that wait now. Kept for this tab, so the same card
213
+ // is folded again after a reload or a resync.
165
214
  fold(key) {
166
215
  folded = key ?? null;
167
216
  foldedWith = count();
217
+ keepFold();
168
218
  },
169
219
  // The fold as it stands with +asking+ (the asking form's card key) now:
170
220
  // a card answered meanwhile lowers the mark, one more waiting than at
171
- // the fold drops it, and so does another form. The folded key, or null.
221
+ // the fold drops it, and so does another form. The replay drew the card
222
+ // the tab folded: with nothing folded in memory, that fold comes back.
223
+ // The folded key, or null.
172
224
  trackFold(asking) {
173
225
  const now = count();
226
+ // Nothing folded in memory and the replay drew the card this tab
227
+ // folded (a reload, or a resync mid-turn): take that fold back.
228
+ if (!folded) {
229
+ const stored = storedFold();
230
+ if (stored?.key === asking) { folded = stored.key; foldedWith = stored.with; }
231
+ }
174
232
  foldedWith = Math.min(foldedWith, now);
175
- if (folded && (folded !== asking || now > foldedWith)) folded = null;
233
+ if (folded && (folded !== asking || now > foldedWith)) {
234
+ folded = null;
235
+ // Live unfolded it: a reload must not fold it again.
236
+ keepFold();
237
+ }
176
238
  return folded;
177
239
  },
240
+ // The folded card is done for good (answered, cancelled, the turn handed
241
+ // off): there is no fold to bring back.
242
+ clearFold() {
243
+ const key = at();
244
+ if (key) storage.remove(key);
245
+ },
178
246
  folded: () => folded,
179
247
  };
180
248
  }
@@ -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
 
@@ -4,6 +4,28 @@
4
4
  // globalThis.localStorage at each call, never at import (the specs install
5
5
  // their own).
6
6
 
7
+ // The same guards on sessionStorage: this tab only, so a reload or a resync
8
+ // of it keeps what is written, and another tab or device never sees it.
9
+ // Reads globalThis.sessionStorage at each call (the specs install their own).
10
+
11
+ // The stored string, or +fallback+ when there is none or it can't be read.
12
+ export function readSession(key, fallback = null) {
13
+ try {
14
+ const value = globalThis.sessionStorage?.getItem(key);
15
+ return value == null ? fallback : value;
16
+ } catch (_) {
17
+ return fallback;
18
+ }
19
+ }
20
+
21
+ export function writeSession(key, value) {
22
+ try { globalThis.sessionStorage?.setItem(key, value); } catch (_) {}
23
+ }
24
+
25
+ export function removeSession(key) {
26
+ try { globalThis.sessionStorage?.removeItem(key); } catch (_) {}
27
+ }
28
+
7
29
  // The stored string, or +fallback+ when there is none or it can't be read.
8
30
  export function readStored(key, fallback = null) {
9
31
  try {
@@ -19,6 +19,7 @@
19
19
  // capabilities() the page's capabilities (card.js shownElsewhere)
20
20
  // historyEl the history element (keepFollowing, the failed-turn redraw)
21
21
  // liveTurn, turnDom, shownTexts, questionCards, contextChips the page's views
22
+ // (contextChips null for a viewer without them, viewer.js)
22
23
  // workingSet the stage view's working set (web.working_set),
23
24
  // null when off
24
25
  // participantsControl the owner's participants panel (participants_panel.js),
@@ -57,7 +58,7 @@ import {
57
58
  } from "./turn_events.js";
58
59
  import { commandView, drawCommandBubble, historyHasCommandBubble } from "./commands.js";
59
60
  import { keepEarlyRestore, restoreAction } from "./restore.js";
60
- import { PAIR, setBadgeMode } from "./participant_names.js";
61
+ import { setBadgeMode } from "./participant_names.js";
61
62
  import { isParticipantAuthor } from "./participant_model.js";
62
63
  import { stillOn } from "./latest.js";
63
64
 
@@ -164,12 +165,8 @@ export function createStreamHandlers(deps) {
164
165
  if (when && promptBubble?.setAttribute && !promptBubble.title) promptBubble.title = when;
165
166
  liveTurn.cutAfter = data.cut_after ?? null;
166
167
  liveTurn.serverGen = null;
167
- // A participant's review turn: its id and author, for Apply at its end
168
- // (turn_completed names neither). A pair turn acted itself: no Apply.
169
168
  const author = data.author || data.origin?.author;
170
169
  const participant = isParticipantAuthor(author);
171
- const pair = data.participant_mode === PAIR;
172
- liveTurn.review = participant && data.turn_id && !pair ? { turn_id: data.turn_id, author, author_name: data.author_name } : null;
173
170
  // Its prompt drawn while queued takes the turn's mode now.
174
171
  if (data.participant_mode) setBadgeMode(promptBubble, data.participant_mode);
175
172
  // The owner's input queues behind it (the composer's delivery line).
@@ -219,10 +216,6 @@ export function createStreamHandlers(deps) {
219
216
  // the hand-off never moves it before its links swap in.
220
217
  if (display) await display.promise;
221
218
  turnDom.answerReady();
222
- // A participant's review turn: Apply under its reply, as a reload shows it.
223
- const review = liveTurn.review;
224
- liveTurn.review = null;
225
- if (review && !data.turn_summary?.empty_answer) deps.placeApply?.(review);
226
219
  },
227
220
  // An after_turn hook presented the answer (AnswerDisplay) or attached
228
221
  // refs to it (AnswerRefs: refs, a count; display null when only refs):
@@ -370,7 +363,7 @@ export function createStreamHandlers(deps) {
370
363
  gapBefore(at);
371
364
  addNoteBubble({ label: data.label, content: data.text || "", at, objectives: data.objectives });
372
365
  // An attached context source's note: its chip changed.
373
- if (data.context_source) contextChips.refresh();
366
+ if (data.context_source) contextChips?.refresh();
374
367
  },
375
368
  // The session's list changed (objectives_strip.js): an edit waiting, a
376
369
  // list note in, a turn's moves.
@@ -1,4 +1,4 @@
1
- /* The web UI's colour tokens, shared by the owner's page (index.html) and the participant page (participant.html): the dark :root (the default) and the light set under prefers-color-scheme: light. Everything else reads them through var(). */
1
+ /* The web UI's colour tokens, read by the page (index.html, every viewer's): the dark :root (the default) and the light set under prefers-color-scheme: light. Everything else reads them through var(). */
2
2
  :root{color-scheme:dark;--bg:#0b0d11;--bg-top:#131d29;--bg-panel:#151821;--bg-inset:#0f1115;--bg-raised:#22262f;--bg-hover:#1b1f27;--border:#1f232b;--border-strong:#2d333f;--text:#e6e8eb;--text-bright:#f0f3f6;--text-2:#c9d1d9;--text-3:#9aa4b2;--text-muted:#8b949e;--text-faint:#6e7681;--accent:#5aa9ff;--accent-strong:#0071e3;--accent-bg:#0f2340;--accent-ring:rgba(90,169,255,.18);--primary:#0071e3;--ok:#3fb950;--ok-text:#7ee787;--ok-bg:#1a2e1a;--warn:#d29922;--warn-text:#e3b341;--warn-bright:#f2cc60;--warn-bg:#2b2108;--warn-border:#6b5416;--danger:#f85149;--danger-bg:#da3633;--danger-text:#ff7b72;--danger-bg-dim:#3d1f1f;--think:#8957e5;--think-text:#d2a8ff;--accent-border:#1a3458;--pick-border:#79c0ff;--accent-tint:color-mix(in srgb,var(--accent) 7%,transparent);--narr:color-mix(in srgb,var(--accent) 38%,var(--text-muted));
3
3
  --glass-bg:color-mix(in srgb,var(--bg-panel) 70%,transparent);--glass-border:rgba(255,255,255,.08);--glass-highlight:rgba(255,255,255,.05);--glass-shadow:0 8px 30px rgba(0,0,0,.35);
4
4
  --diff-add-bg:rgba(63,185,80,.14);--diff-add-text:#aff5b4;--diff-del-bg:rgba(248,81,73,.14);--diff-del-text:#ffc1bc;
@@ -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";
@@ -1000,7 +999,7 @@ export function turnHistoryNodes(items, timing, { thumbs, workingSet = false, no
1000
999
  const userTemplate = (m, opts = {}) => {
1001
1000
  const shell = shellCommandMessage(m?.content);
1002
1001
  if (shell) return commandBubbleTemplate({ ...shell, at: m?.at });
1003
- 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 });
1004
1003
  };
1005
1004
  // The first text after a delegate report merged mid-turn, unless it is
1006
1005
  // the turn's answer (shown anyway). Its key (answer_fold.js): the turn's
@@ -1026,7 +1025,6 @@ export function turnHistoryNodes(items, timing, { thumbs, workingSet = false, no
1026
1025
  blockTurns.push(ordinal);
1027
1026
  }
1028
1027
  const lineKey = (i) => (items[i]?.source === "delegate_report" ? `${group.turnId}:input:${i - (group.user ?? i)}` : null);
1029
- const reviewer = group.answer !== null && prompt?.turn_id && prompt.participant_mode !== PAIR ? authorBadge(prompt.author, prompt.author_name) : null;
1030
1028
  const pieces = turnPieces({
1031
1029
  prompt: prompt ? (prompt.role === "note" ? noteBubbleTemplate(prompt) : userTemplate(prompt)) : null,
1032
1030
  block: drawn.block,
@@ -1035,7 +1033,6 @@ export function turnHistoryNodes(items, timing, { thumbs, workingSet = false, no
1035
1033
  : null)),
1036
1034
  answer: drawn.answer,
1037
1035
  timing: timingTemplate(group),
1038
- apply: reviewer ? applyRowTemplate(prompt.turn_id, reviewer) : null,
1039
1036
  end: drawn.end,
1040
1037
  kept: drawn.kept,
1041
1038
  });