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
@@ -61,13 +61,13 @@ export function rowModel(grant, now) {
61
61
  return {
62
62
  id: grant.id,
63
63
  name: grant.name,
64
- kind: grant.kind,
65
64
  identity: typeof grant.identity === "string" ? grant.identity : null,
66
65
  active,
67
66
  present,
68
67
  color: authorColor(participantAuthor(grant.id)),
69
68
  state: active ? (present ? "here now" : `seen ${agoText(grant.last_used_at, now)}`)
70
- : grant.state === "expired" ? "expired" : `revoked${grant.revoked_by ? ` (${grant.revoked_by})` : ""}`,
69
+ : grant.state === "expired" ? "expired"
70
+ : grant.state === "outdated" ? "ended (older link)" : `revoked${grant.revoked_by ? ` (${grant.revoked_by})` : ""}`,
71
71
  expires: active ? `expires ${untilText(grant.expires_at, now)}` : "",
72
72
  spend: `${money(spend)} of ${money(cap)}`,
73
73
  capReached: active && cap > 0 && spend >= cap,
@@ -82,7 +82,7 @@ export function chipModel(grants, now) {
82
82
  if (!Array.isArray(grants)) return null;
83
83
  const active = grants.map((g) => rowModel(g, now)).filter((row) => row.active);
84
84
  if (active.length === 0) {
85
- return { text: "participants · invite", count: 0, present: false, title: "Invite a participant to review this session" };
85
+ return { text: "participants · invite", count: 0, present: false, title: "Invite someone into this session" };
86
86
  }
87
87
  const present = active.filter((row) => row.present).map((row) => row.name);
88
88
  const names = active.map((row) => row.name).join(", ");
@@ -121,12 +121,12 @@ const EMAIL_RE = /^[^@\s,<>"\\]+@[^@\s,<>"\\]+$/;
121
121
  // (behind a proxy that names the user): their email, which binds the link;
122
122
  // the name defaults to its local part.
123
123
  // @return {{body}|{error}}
124
- export function inviteBody({ name, kind, days, cap, identity }) {
124
+ export function inviteBody({ name, days, cap, identity }) {
125
125
  const email = String(identity || "").trim().toLowerCase();
126
126
  if (email && !EMAIL_RE.test(email)) return { error: "An email is one address: name@domain." };
127
127
  const clean = String(name || "").trim() || email.split("@")[0];
128
128
  if (!clean) return { error: "Give them a name: it is what the model and the thread show." };
129
- const body = { name: clean, kind: kind === "agent" ? "agent" : "human" };
129
+ const body = { name: clean };
130
130
  if (email) body.identity = email;
131
131
  const d = Number(days);
132
132
  body.ttl = Math.round((EXPIRY_DAYS.includes(d) ? d : DEFAULT_EXPIRY_DAYS) * 24 * 60 * 60);
@@ -138,7 +138,7 @@ export function inviteBody({ name, kind, days, cap, identity }) {
138
138
 
139
139
  // The toast for an invite whose panel closed before its answer came.
140
140
  export function lateInviteText(name, sessionId) {
141
- return `${name}'s review link for ${String(sessionId).slice(0, 8)} is ready (the panel closed before it came); it shows only once.`;
141
+ return `${name}'s link for ${String(sessionId).slice(0, 8)} is ready (the panel closed before it came); it shows only once.`;
142
142
  }
143
143
 
144
144
  // What Revoke asks first: it can't be undone (chi keeps only the link's
@@ -156,8 +156,7 @@ function rowTemplate(row, { capFor }) {
156
156
  title=${`End ${row.name}'s link: their page and stream stop, their queued comments are dropped`}>Revoke</button></span>`
157
157
  : nothing;
158
158
  return html`<li class=${`pp-row${row.active ? "" : " ended"}`} style=${`--author-color:${row.color}`}>
159
- <div class="pp-who"><span class=${`pp-dot${row.present ? " present" : ""}`} aria-hidden="true"></span><b>${row.name}</b>${
160
- row.kind === "agent" ? html`<span class="pp-tag">agent</span>` : nothing}<span class="pp-state">${row.state}</span></div>
159
+ <div class="pp-who"><span class=${`pp-dot${row.present ? " present" : ""}`} aria-hidden="true"></span><b>${row.name}</b><span class="pp-state">${row.state}</span></div>
161
160
  <div class="pp-meta"><span class=${row.capReached ? "pp-capped" : ""}>${row.spend}</span> · ${row.turns}${
162
161
  row.expires ? html` · ${row.expires}` : nothing}${row.identity ? html` · <span class="pp-bound">bound to ${row.identity}</span>` : nothing}</div>${actions}</li>`;
163
162
  }
@@ -166,7 +165,7 @@ function rowTemplate(row, { capFor }) {
166
165
  // have no contact word in them (no_contact_fill.js): iOS Safari's AutoFill
167
166
  // Contact bar, offered on a "name" or an email field, then stays on the
168
167
  // page's later fields, the composer's too.
169
- export const INVITE_FIELDS = { name: "chi-invitee", kind: "kind", days: "days", cap: "cap", identity: "chi-invitee-account" };
168
+ export const INVITE_FIELDS = { name: "chi-invitee", days: "days", cap: "cap", identity: "chi-invitee-account" };
170
169
 
171
170
  function inviteTemplate(invite, { canShare }) {
172
171
  if (!invite) return nothing;
@@ -175,44 +174,39 @@ function inviteTemplate(invite, { canShare }) {
175
174
  invite.identity ? `, for ${invite.identity} only` : ""}.${
176
175
  invite.lan ? nothing : " This chi web has no LAN address: the link opens on this machine only."}</div>
177
176
  ${invite.warning ? html`<div class="pp-warning" role="note">${invite.warning}</div>` : nothing}
178
- <div class="pp-link"><input readonly .value=${invite.link} aria-label="The review link" @focus=${(e) => e.target.select()}><button
177
+ <div class="pp-link"><input readonly .value=${invite.link} aria-label="The invite link" @focus=${(e) => e.target.select()}><button
179
178
  type="button" data-act="copy">${invite.copied ? "Copied ✓" : "Copy"}</button>${canShare
180
179
  ? html`<button type="button" data-act="share">Share…</button>` : nothing}</div>
181
180
  ${invite.qr_svg ? html`<div class="pp-qr" .innerHTML=${invite.qr_svg}></div>` : nothing}</div>`;
182
181
  }
183
182
 
184
- // The empty list's line, by the session's mode.
185
- export const EMPTY_REVIEW = "Nobody yet. Invite a person (or an agent) to review: their comments become read-only review turns; you see and approve everything.";
186
- export const EMPTY_PAIR = "Nobody yet. Invite a person (or an agent) to work with you here: their turns act with this session's tools under your guardrails, and their asks come to you.";
183
+ // The empty list's line.
184
+ export const EMPTY = "Nobody yet. Invite someone to work with you here: their turns act with this session's tools under your guardrails, and their asks come to you.";
187
185
 
188
186
  // The popover's content: the participants, the Invite form (or the link it
189
187
  // gave).
190
- // +working+: the server's warning for a session that isn't a review session
191
- // (shown before the Invite, with Start a review of it), null for one.
192
- // +pair+: a participant invited now gets pair turns (the list's mode: a
193
- // working session on a worker with pair turns): the empty list says their
194
- // turns act; otherwise (a review session, an older worker) that they read.
188
+ // +working+: the server's warning (GET …/participants: what a participant's
189
+ // turns do here, or why nobody can be invited until the session restarts),
190
+ // shown before the Invite.
195
191
  // +identityHeader+: the header chi web's auth proxy names the signed-in
196
192
  // user in (the list's identity_header), null without one: then the Invite
197
193
  // has no account field (a bound link could never open).
198
194
  export function panelTemplate(grants, { now, sessionId, invite = null, error = null, capFor = null, canShare = false,
199
- busy = false, working = null, reviewing = false, identityHeader = null,
200
- pair = false } = {}) {
195
+ busy = false, working = null, identityHeader = null } = {}) {
201
196
  const rows = (grants || []).map((g) => rowModel(g, now));
202
197
  const active = rows.filter((row) => row.active);
203
198
  const ended = rows.filter((row) => !row.active);
204
199
  return html`<div class="ctx-pop-head"><strong>Participants</strong><span class="ctx-pop-kind">this session</span
205
200
  ><button type="button" class="ctx-pop-close" data-act="close" aria-label="Close">×</button></div>
206
201
  ${active.length ? html`<ul class="pp-list">${active.map((row) => rowTemplate(row, { capFor }))}</ul>`
207
- : html`<div class="ctx-pop-meta">${pair ? EMPTY_PAIR : EMPTY_REVIEW}</div>`}
202
+ : html`<div class="ctx-pop-meta">${EMPTY}</div>`}
208
203
  ${ended.length ? html`<details class="pp-ended"><summary>Ended (${ended.length})</summary><ul class="pp-list">${
209
204
  ended.map((row) => rowTemplate(row, { capFor }))}</ul></details>` : nothing}
210
205
  <div class="ctx-pop-error" role="alert" ?hidden=${!error}>${error || ""}</div>
211
- ${working && !invite ? html`<div class="pp-warning pp-working" role="note">${working}<button type="button"
212
- data-act="start-review" ?disabled=${reviewing}>${reviewing ? "Starting…" : "Start a review of it"}</button></div>` : nothing}
206
+ ${working && !invite ? html`<div class="pp-warning pp-working" role="note">${working}</div>` : nothing}
213
207
  ${invite ? inviteTemplate(invite, { canShare }) : html`<form class="pp-invite">
214
208
  <div class="pp-invite-row"><input name="chi-invitee" type="text" placeholder="Who (Alex)" autocomplete="off" aria-label="Who the link is for" maxlength="64"
215
- ><span class="select-wrap"><select name="kind" aria-label="A person or an agent"><option value="human">person</option><option value="agent">agent</option></select></span></div>
209
+ ></div>
216
210
  ${identityHeader ? html`<div class="pp-invite-row"><input name="chi-invitee-account" type="text" inputmode="email"
217
211
  placeholder="Their account (alex@example.com)" autocomplete="off" autocapitalize="off" spellcheck="false"
218
212
  aria-label="Their sign-in account: the link opens only for it"></div>
@@ -230,19 +224,11 @@ export function panelTemplate(grants, { now, sessionId, invite = null, error = n
230
224
  // pid, cap)}, onChange() (the chip's count or presence changed: redraw the
231
225
  // bar), toast(text, action, {sticky}) (app.js showToast), onNames() (the participants' names changed: name the
232
226
  // badges drawn before them, participant_names.js nameUnnamedBadges).
233
- // startReview({onError}): Start a review of it (a review fork of the open
234
- // session): the created session, or null (its refusal to onError(text), true
235
- // when the panel showed it); reviewing(): one is under way for the open
236
- // session (session_actions.js keeps the one-per-session guard).
237
- export function createParticipantsControl({ el, session, api, onChange = () => {}, toast = () => {}, startReview = null,
238
- reviewing = () => false, onNames = () => {}, clock = () => Date.now(), doc = document, win = window }) {
227
+ export function createParticipantsControl({ el, session, api, onChange = () => {}, toast = () => {},
228
+ onNames = () => {}, clock = () => Date.now(), doc = document, win = window }) {
239
229
  let grants = null;
240
- // The open session's share warning (GET …/participants), null for a
241
- // review session.
230
+ // The open session's share warning (GET …/participants), null until read.
242
231
  let working = null;
243
- // What a participant invited now gets (GET …/participants mode: "pair" or
244
- // "review", the server's ReviewStart.share_terms), never guessed from the warning.
245
- let inviteMode = null;
246
232
  // The header chi web's proxy names the user in (GET …/participants), null
247
233
  // without one: the Invite's account field.
248
234
  let identityHeader = null;
@@ -281,7 +267,7 @@ export function createParticipantsControl({ el, session, api, onChange = () => {
281
267
 
282
268
  function draw() {
283
269
  render(panelTemplate(grants, { now: clock(), sessionId: session(), invite, error, capFor, busy,
284
- working: startReview ? working : null, pair: inviteMode === "pair", reviewing: reviewing(), identityHeader,
270
+ working, identityHeader,
285
271
  canShare: typeof win.navigator?.share === "function" }), shell.pop);
286
272
  shell.replace();
287
273
  }
@@ -290,7 +276,6 @@ export function createParticipantsControl({ el, session, api, onChange = () => {
290
276
  if (!id) {
291
277
  grants = null;
292
278
  working = null;
293
- inviteMode = null;
294
279
  linkBase = null;
295
280
  loadedFor = null;
296
281
  setParticipantNames([]);
@@ -303,7 +288,6 @@ export function createParticipantsControl({ el, session, api, onChange = () => {
303
288
  if (!still()) return;
304
289
  grants = Array.isArray(body.participants) ? body.participants : [];
305
290
  working = typeof body.warning === "string" ? body.warning : null;
306
- inviteMode = typeof body.mode === "string" ? body.mode : null;
307
291
  identityHeader = typeof body.identity_header === "string" && body.identity_header ? body.identity_header : null;
308
292
  linkBase = typeof body.link_base === "string" && body.link_base ? body.link_base : null;
309
293
  loadedFor = id;
@@ -314,8 +298,7 @@ export function createParticipantsControl({ el, session, api, onChange = () => {
314
298
  if (loadedFor !== id) {
315
299
  grants = [];
316
300
  working = null;
317
- inviteMode = null;
318
- linkBase = null;
301
+ linkBase = null;
319
302
  setParticipantNames([]);
320
303
  }
321
304
  }
@@ -360,9 +343,9 @@ export function createParticipantsControl({ el, session, api, onChange = () => {
360
343
  const copy = async () => {
361
344
  try {
362
345
  await win.navigator.clipboard.writeText(link);
363
- toast(`${name}'s review link copied`);
346
+ toast(`${name}'s link copied`);
364
347
  } catch {
365
- toast(`${name}'s review link: ${link}`, null, { sticky: true });
348
+ toast(`${name}'s link: ${link}`, null, { sticky: true });
366
349
  }
367
350
  };
368
351
  toast(lateInviteText(name, asked.id), { label: "Copy link", run: copy }, { sticky: true });
@@ -410,21 +393,6 @@ export function createParticipantsControl({ el, session, api, onChange = () => {
410
393
  }
411
394
  return load();
412
395
  }
413
- // Closed once the review is made; a refusal stays in the panel.
414
- if (name === "start-review" && startReview) {
415
- const asked = ask();
416
- const showError = (text) => {
417
- if (!stillOpen(asked) || !shell.isOpen()) return false;
418
- error = text;
419
- return true;
420
- };
421
- const started = startReview({ onError: showError });
422
- draw();
423
- const created = await started;
424
- if (created) shell.close();
425
- else if (stillOpen(asked) && shell.isOpen()) draw();
426
- return;
427
- }
428
396
  if (name === "another") {
429
397
  invite = null;
430
398
  return draw();
@@ -440,7 +408,7 @@ export function createParticipantsControl({ el, session, api, onChange = () => {
440
408
  }
441
409
  if (name === "share" && invite) {
442
410
  try {
443
- await win.navigator.share({ title: "chi review", text: `${invite.name}'s review link`, url: invite.link });
411
+ await win.navigator.share({ title: "chi invite", text: `${invite.name}'s link`, url: invite.link });
444
412
  } catch {
445
413
  // dismissed
446
414
  }
@@ -453,12 +421,11 @@ export function createParticipantsControl({ el, session, api, onChange = () => {
453
421
  reload: () => load(),
454
422
  chip: () => (session() && loadedFor === session() ? chipModel(grants, clock()) : null),
455
423
  // A claim link's target (claim_link.js): {base, names} the open
456
- // session's participant link base and its active people's names (an
457
- // agent has no browser to open it in); null without either (an older
458
- // chi web, no person invited).
424
+ // session's participant link base and its active participants' names;
425
+ // null without either (an older chi web, nobody invited).
459
426
  claimTarget: () => {
460
427
  if (!session() || loadedFor !== session() || !linkBase) return null;
461
- const names = (grants || []).filter((g) => g.state === "active" && g.kind === "human").map((g) => g.name);
428
+ const names = (grants || []).filter((g) => g.state === "active").map((g) => g.name);
462
429
  return names.length ? { base: linkBase, names } : null;
463
430
  },
464
431
  close: () => shell.close(),
@@ -24,8 +24,9 @@ import { clientLabel, isOwn } from "./turn_events.js";
24
24
  import { continueLine } from "./commands.js";
25
25
  import { plainText } from "./plain_line.js";
26
26
  import { noContactFill } from "./no_contact_fill.js";
27
- import { removeSession } from "./storage.js";
28
27
  import { CONTINUE_KEY, foldKey, questionKey } from "./stage_waiting.js";
28
+ import { readSession, removeSession } from "./storage.js";
29
+ import { continueWait, questionText, questionWait } from "./card_kinds.js";
29
30
 
30
31
  // A card's text fields' name: not a contact field (no_contact_fill.js).
31
32
  const CARD_NOTE = "chi-card-note";
@@ -53,9 +54,12 @@ const CARD_NOTE = "chi-card-note";
53
54
  // bar's waiting chip, docs/internals/web-frontend.md write -> redraw)
54
55
  // @param answers false for a viewer who may not answer (viewer.js
55
56
  // answer_cards): no question or continue card is drawn at all
56
- // @param onSettled (key) a card stopped waiting (answered, cancelled,
57
+ // @param onArrive (key, info) a card that waits is about to be placed: its
58
+ // stage_waiting.js key and what it waits as (card_kinds.js)
59
+ // @param onSettled (key, opts) a card stopped waiting (answered, cancelled,
57
60
  // replaced or removed; the continue card resolved or dropped), by its
58
- // stage_waiting.js key: the stage's waiting cards as data
61
+ // stage_waiting.js key: the stage's waiting cards as data; {done: true}
62
+ // when answered, cancelled or resolved for good (its kept fold goes)
59
63
  // @return {renderQuestion(pq, {said}), resolveQuestion(id, opts), removeQuestion(),
60
64
  // questionCard() (the live card or null), pendingQuestion() (or null),
61
65
  // isResolved(id) (this page already saw that question answered),
@@ -64,7 +68,7 @@ export function createQuestionCards({
64
68
  sessionId, clientId, place, isNearBottom, scrollToEnd, removeHintIfEmpty, askingText = () => "",
65
69
  renderMarkdown = () => Promise.resolve(null), linkRefs = () => {}, pairRefs = () => {},
66
70
  api = { sendAnswer, dismissQuestion, sendCommand }, doc = globalThis.document,
67
- onPending = () => {}, onSettled = () => {}, answers = true,
71
+ onPending = () => {}, onArrive = () => {}, onSettled = () => {}, answers = true,
68
72
  }) {
69
73
  // Live ask_user_question card, keyed by pending question id. Re-rendered from
70
74
  // pending_question on session select so a reload mid-question restores it.
@@ -136,7 +140,7 @@ export function createQuestionCards({
136
140
  if (relay) card.appendChild(renderDelegateLine(relay));
137
141
  const q = doc.createElement("div");
138
142
  q.className = "question-text";
139
- q.textContent = (relay && pq.relay.asked) || pq.question || "";
143
+ q.textContent = questionText(pq);
140
144
  // A plugin's refs on the question (its step's: one may name a ticket here too).
141
145
  if (!relay) pairRefs(q, questionRefsOf(pq));
142
146
  card.appendChild(q);
@@ -182,6 +186,7 @@ export function createQuestionCards({
182
186
 
183
187
  if (stepLimit) {
184
188
  const follow = isNearBottom();
189
+ onArrive(questionKey(pq.id), questionWait(pq));
185
190
  place(card);
186
191
  questionEl = card;
187
192
  if (follow) scrollToEnd();
@@ -266,6 +271,7 @@ export function createQuestionCards({
266
271
 
267
272
  // Read before the card makes the history taller.
268
273
  const follow = isNearBottom();
274
+ onArrive(questionKey(pq.id), questionWait(pq));
269
275
  const staged = place(card) === true;
270
276
  questionEl = card;
271
277
  if (follow) scrollToEnd();
@@ -524,12 +530,9 @@ export function createQuestionCards({
524
530
  // After the collapse: a card left open by hand renders at once.
525
531
  if (full) renderSaidOnOpen(questionEl, full, asked, refs);
526
532
  resolvedId = pending.id;
527
- // Answered or cancelled for good: the fold this tab kept for it is gone
528
- // (stage_waiting.js). No session id, no key: foldKey(null) is null, and a
529
- // removeItem(null) would delete the key "null".
530
- const fold = foldKey(sessionId());
531
- if (fold) removeSession(fold);
532
- onSettled(questionKey(questionEl.dataset.qid));
533
+ // Answered or cancelled for good: the stage drops the fold this tab kept
534
+ // for it (stage_waiting.js settle).
535
+ onSettled(questionKey(questionEl.dataset.qid), { done: true });
533
536
  setPending(null);
534
537
  }
535
538
 
@@ -622,6 +625,18 @@ export function createQuestionCards({
622
625
  continueEl = null;
623
626
  }
624
627
 
628
+ // Mixed cache, for one release (remove in A1 phase 5): the fold kept for the
629
+ // old continue card goes here too, so a stale app.js or stage_waiting.js
630
+ // (no done) can't leave it behind. Only that card's: a question's fold is
631
+ // the stage's (stage_waiting.js settle). No session, no key ("null").
632
+ function dropContinueFold() {
633
+ const fold = foldKey(sessionId());
634
+ if (!fold) return;
635
+ try {
636
+ if (JSON.parse(readSession(fold) || "null")?.key === CONTINUE_KEY) removeSession(fold);
637
+ } catch (_) { /* unreadable: left as it is */ }
638
+ }
639
+
625
640
  function renderContinueCard(offer) {
626
641
  if (!answers || continueEl?.isConnected) return;
627
642
  // A step-limit question is up: it is the card (an older worker has none).
@@ -677,6 +692,7 @@ export function createQuestionCards({
677
692
  card.appendChild(row);
678
693
  card.appendChild(err);
679
694
  const follow = isNearBottom();
695
+ onArrive(CONTINUE_KEY, continueWait(offer));
680
696
  place(card);
681
697
  continueEl = card;
682
698
  if (follow) scrollToEnd();
@@ -687,9 +703,8 @@ export function createQuestionCards({
687
703
  continueEl = null;
688
704
  if (!card) return;
689
705
  card.classList.add("resolved");
690
- const fold = foldKey(sessionId());
691
- if (fold) removeSession(fold);
692
- onSettled(CONTINUE_KEY);
706
+ dropContinueFold();
707
+ onSettled(CONTINUE_KEY, { done: true });
693
708
  card.querySelectorAll("button, input").forEach((el) => { el.disabled = true; });
694
709
  const note = doc.createElement("div");
695
710
  note.className = "question-result";
@@ -28,9 +28,8 @@
28
28
  import { compareShapes, historyShape } from "./history_shape.js";
29
29
  import { isCard, splitSnapshotCards } from "./card.js";
30
30
  import { turnElements } from "./turn_range.js";
31
-
32
- // The opening of a turn: its prompt, a wake's note, /continue no's line.
33
- const OPENING = "[data-turn-id], [data-opening-id]";
31
+ // The opening of a turn (the stage's hand-off reads it too).
32
+ import { OPENING } from "./stage_handoff.js";
34
33
  // Not the turn's: the lines queued for after it (they open the next turns).
35
34
  const NOT_THE_TURNS = ".bubble.user.queued, .bubble.command.queued";
36
35
 
@@ -46,27 +46,8 @@ export function createSendTurn({
46
46
  const promptEl = composer.el;
47
47
  const actionBtn = composer.button;
48
48
 
49
- // +delivery+: the composer's choice for a running turn (Alt+Enter: queue;
50
- // a delivery-line link: cut or queue); else the armed one; a typed /cut or
51
- // /queue wins over both.
52
- async function createReviewOnly() {
53
- actionBtn.disabled = true;
54
- try {
55
- const s = await api.createIdleSession({ dir, model: startPage.chosenModel(), ...startPage.newChoices() });
56
- startPage.clearChoices();
57
- addCreatedSession(s);
58
- await select(s.id);
59
- } catch (e) {
60
- refused(e);
61
- } finally {
62
- actionBtn.disabled = false;
63
- }
64
- }
65
-
66
- // A create's refusal: the review files' in the ⚙ panel's review view, a
67
- // picked kit's in the 🧰 list, else an alert.
49
+ // A create's refusal: a picked kit's in the 🧰 list, else an alert.
68
50
  function refused(e) {
69
- if (e?.code === "invalid_review" && startPage.reviewRefused?.(e.message)) return;
70
51
  if (e?.code === "toolkit_refused" && startPage.toolkitRefused?.(e.message)) return;
71
52
  alert(e.message);
72
53
  }
@@ -75,6 +56,9 @@ export function createSendTurn({
75
56
  // Enter on a slow link (the text still in the box) doesn't send it again.
76
57
  let inFlight = null;
77
58
 
59
+ // +delivery+: the composer's choice for a running turn (Alt+Enter: queue;
60
+ // a delivery-line link: cut or queue); else the armed one; a typed /cut or
61
+ // /queue wins over both.
78
62
  async function send({ delivery: chosen = null } = {}) {
79
63
  if (store.current.owner === "tui") return;
80
64
  // A fresh link's pick first: its /model is queued in the worker once
@@ -82,9 +66,6 @@ export function createSendTurn({
82
66
  const pick = startPage.pendingPick();
83
67
  if (pick) await pick;
84
68
  let prompt = turnText(promptEl.value, composer.chips());
85
- // The start page's review files with nothing typed: the review session
86
- // alone, idle.
87
- if (!prompt && !session() && startPage.reviewSubjects?.().length) return createReviewOnly();
88
69
  if (!prompt) return;
89
70
  const armed = takeDelivery();
90
71
  // An image-only send's text is its placeholders: not for ↑.
@@ -9,10 +9,10 @@ import { inTree } from "./sessions_list.js";
9
9
  //
10
10
  // Hooks: +selected()+ the open session's id or null; +store+ the page's
11
11
  // session store (session_store.js: Stop's status; touch("infoBar") for the
12
- // continue and review in-flight sets, which it doesn't hold); +sessions()+ /
12
+ // continue in-flight set, which it doesn't hold); +sessions()+ /
13
13
  // +setSessions(list)+ the page's list (the store's: a new list redraws the
14
14
  // lists and the bar);
15
- // +api+: {continueSession, startReview, archiveSession, unarchiveSession,
15
+ // +api+: {continueSession, archiveSession, unarchiveSession,
16
16
  // deleteSession, stopSession, sessionHolds, stopSessionHolds} (data.js);
17
17
  // +eventsLive()+ the hub's stream is open (else
18
18
  // +refresh()+ fetches the list);
@@ -23,13 +23,6 @@ import { inTree } from "./sessions_list.js";
23
23
  // (that draft back, never over newer text), +closeLiveStream()+ (the live
24
24
  // stream's close, the stream left as it is) and +workerGone(id)+ the page's.
25
25
  // +alert+ / +confirm+: the browser's.
26
- // The toast after Start review: the new session, where it starts from, and
27
- // the model warning when there is one.
28
- export function reviewStartedText(id, created) {
29
- const warning = created.model_warning ? ` (${created.model_warning})` : "";
30
- return `Review ${created.id.slice(0, 8)} started from ${id.slice(0, 8)}'s recap; ${id.slice(0, 8)} keeps running${warning}. Invite someone to it.`;
31
- }
32
-
33
26
  export function createSessionActions({
34
27
  selected, store, sessions, setSessions, api, eventsLive, refresh,
35
28
  select, clearSelection, showNotice, toast, addCreatedSession, fillOpener, restoreDraft, closeLiveStream, workerGone,
@@ -78,7 +71,7 @@ export function createSessionActions({
78
71
  // +stopHolds+ is the sheet's "Stop all": the worker's stop-all step, then
79
72
  // the stop. A delegate or a background task outlives the worker either way
80
73
  // (docs/sessions.md, "Stopping a worker"), which is why the sheet says so.
81
- // One Stop per session at a time (as reviewingIds): a second tap while the
74
+ // One Stop per session at a time (as continuingIds): a second tap while the
82
75
  // holds read (or the stop) is under way would be a second confirm.
83
76
  const stopAsks = new Set();
84
77
 
@@ -182,40 +175,6 @@ export function createSessionActions({
182
175
  }
183
176
  }
184
177
 
185
- // Start review: a review fork of the open session (its recap, not its
186
- // transcript; it keeps running), opened, with Invite in the toast (the new
187
- // session's participants chip). One per session at a time.
188
- // +onError(text)+: says a refusal where it was asked (the participants
189
- // panel), true when it did; else the toast says it.
190
- // @return the created session, or null (none open, one under way, refused)
191
- const reviewingIds = new Set();
192
-
193
- async function reviewSelected({ onError = null } = {}) {
194
- if (!selected() || reviewingIds.has(selected())) return null;
195
- const id = selected();
196
- reviewingIds.add(id);
197
- store.touch("infoBar");
198
- try {
199
- const created = await api.startReview(id);
200
- addCreatedSession(created);
201
- if (selected() === id) await select(created.id);
202
- // After the toast's own click is done: the panel would take it as a
203
- // click outside and close.
204
- const openPanel = () => globalThis.document?.querySelector("#infoText .participants-chip")?.click();
205
- const invite = { label: "Invite", run: () => setTimeout(openPanel, 0) };
206
- toast(reviewStartedText(id, created), selected() === created.id ? invite : { label: "Open", run: () => select(created.id) },
207
- { sticky: !!created.model_warning });
208
- return created;
209
- } catch (e) {
210
- const text = `Can't start a review of ${id.slice(0, 8)}: ${e.message}`;
211
- if (!onError?.(text)) toast(text, null, { sticky: true });
212
- return null;
213
- } finally {
214
- reviewingIds.delete(id);
215
- store.touch("infoBar");
216
- }
217
- }
218
-
219
178
  // ── Archive ───────────────────────────────────────────────────────────────
220
179
  // Archive hides a session (and its delegates) from the strip and the list,
221
180
  // kept for good; "include archived" in all sessions finds it. No confirm:
@@ -286,7 +245,7 @@ export function createSessionActions({
286
245
  }
287
246
 
288
247
  return {
289
- confirmDelete, leaveGoneSession, stopSelected, continueSelected, reviewSelected, reviewing: reviewingIds, archiveOne, setArchived, toggleArchiveSelected,
248
+ confirmDelete, leaveGoneSession, stopSelected, continueSelected, archiveOne, setArchived, toggleArchiveSelected,
290
249
  // The sessions whose Continue is under way (the info bar's button).
291
250
  continuing: continuingIds,
292
251
  // The session this tab is stopping, or null.
@@ -42,7 +42,6 @@ export const FIELDS = {
42
42
  promptNotes: { source: (d) => list(d.session?.prompt_notes), redraws: ["infoBar"], writers: "readTurnEnd" },
43
43
  parentId: { redraws: ["infoBar"], writers: "the payload" },
44
44
  continues: { redraws: ["infoBar"], writers: "the payload" },
45
- review: { redraws: ["infoBar"], writers: "the payload" },
46
45
  verdicts: {
47
46
  source: (d) => list(d.session?.verdicts),
48
47
  redraws: [],
@@ -23,8 +23,6 @@ export function emptySessionState() {
23
23
  parentId: null,
24
24
  // The previous link of its chain (its `continues`), or null.
25
25
  continues: null,
26
- // A review session's {subjects, from} (its `review`), or null.
27
- review: null,
28
26
  verdicts: [],
29
27
  // The Verify fresh checks running ({of, child_id}; the summary's verify_fresh).
30
28
  verifyFresh: [],
@@ -139,7 +137,6 @@ export function sessionStateFrom(data) {
139
137
  state.toolkitDefault = s.toolkit_default || null;
140
138
  state.parentId = s.parent_id || null;
141
139
  state.continues = s.continues || null;
142
- state.review = s.review || null;
143
140
  state.verdicts = Array.isArray(s.verdicts) ? s.verdicts : [];
144
141
  state.verifyFresh = Array.isArray(s.verify_fresh) ? s.verify_fresh : [];
145
142
  state.createdAt = s.created_at || null;
@@ -88,8 +88,10 @@ export function createSessionSync(deps) {
88
88
  const same = store.selected === id;
89
89
  // Leaving for another session: the fold this tab kept for the one left
90
90
  // has no page to come back to (stage_waiting.js). A reselect of the same
91
- // session keeps it: the page is redrawn, not left.
92
- if (!same) removeSession(foldKey(store.selected));
91
+ // session keeps it: the page is redrawn, not left. No session open (the
92
+ // first select): no key, and a removeItem(null) would delete "null".
93
+ const leftFold = same ? null : foldKey(store.selected);
94
+ if (leftFold) removeSession(leftFold);
93
95
  // Its synchronous part in one batch: the active card, the composer and
94
96
  // the bar redraw once, at its end (never across the await).
95
97
  store.batch(() => {
@@ -21,7 +21,6 @@
21
21
  // bubbles, cards bubbles.js, cards_place.js
22
22
  // markdown markdown_place.js (linkTextRefs, applyFinalMarkdown)
23
23
  // capabilities() the page's capabilities (card.js shownElsewhere, the history's cards)
24
- // can(name) the viewer's (viewer.js): the history's Apply row needs apply
25
24
  // page: {setReviseAnchor(anchor), renderInitRow(), setMarkdownWarning(warning),
26
25
  // setCapabilities(capabilities, editorUrl, viewer), findInTurnRoots(selector), appendToHistory(el),
27
26
  // setTurnRunning(running), mergeTurnTiming(id, timing), applySessionPayload(data, opts),
@@ -50,7 +49,7 @@ export function createSessionView(deps) {
50
49
  const {
51
50
  store, historyEl, getSession,
52
51
  liveTurn, turnDom, questionCards, shownTexts, objectives, featureGates, markdownTip, workingSet = null, wsPreview = null, gapClock,
53
- bubbles, cards, markdown, capabilities, can = () => true, page, later,
52
+ bubbles, cards, markdown, capabilities, page, later,
54
53
  } = deps;
55
54
  const { makeUserBubble, addEndBubble, showGuardrailWarning, showRecap } = bubbles;
56
55
  const { placeSnapshotCards, upsertCard } = cards;
@@ -200,7 +199,7 @@ export function createSessionView(deps) {
200
199
  // (its prompt has no drawing yet: a plain row, no miss).
201
200
  const historyOpts = (data = {}) => ({ thumbs: (images) => thumbsTemplate(store.selected, images), workingSet: !!workingSet,
202
201
  drawings: data.turn_drawings || null, cards: data.cards || null, capabilities: capabilities(),
203
- runningTurnId: data.current_turn?.turn_id || null, apply: can("apply") });
202
+ runningTurnId: data.current_turn?.turn_id || null });
204
203
 
205
204
  // A read drawn the way a reload draws it: the turn blocks only, nothing
206
205
  // placed after them (the opt-in reload check, reload_check.js, compares
@@ -2,14 +2,13 @@
2
2
  // (start_settings.js) over a new session's choices and by the session bar's
3
3
  // (settings_chip.js) over the open session's own: rows of segments
4
4
  // (Thinking, Context), the Context row's Apply and budget disclosure, a
5
- // line for a choice whose row is hidden, the review files' line. The caller
5
+ // line for a choice whose row is hidden. The caller
6
6
  // passes the rows it draws (settingsPanelTemplate's +rows+) and applies the
7
7
  // picks itself; the segments' data-act ("think:low", "ctx:stale",
8
8
  // "ctx-more") is the same for every caller.
9
9
 
10
10
  import { APPLIES, choiceWords, ownValues, strategyValue } from "./llm_context_chip.js";
11
11
  import { DEFAULT, followSegment, segments } from "./level_chip.js";
12
- import { reviewChipModel } from "./review_start.js";
13
12
  import { CONFIG as THINKING } from "./thinking_chip.js";
14
13
  import { html, nothing } from "./vendor/lit-html.js";
15
14
 
@@ -99,23 +98,10 @@ function rowTemplate(row) {
99
98
  : nothing}`;
100
99
  }
101
100
 
102
- // The review files' line: the files set (Edit, Remove), else Review files….
103
- function reviewTemplate(review, ruled) {
104
- const chip = review.length ? reviewChipModel(review) : null;
105
- return html`${ruled ? html`<hr class="sset-rule">` : nothing}<div class="sset-review">${chip
106
- ? html`<span class="sset-review-set" title=${chip.title}>Review: ${chip.text.replace(/^review: /, "")}</span
107
- ><button type="button" class="sset-link" data-act="review">Edit</button><button type="button" class="sset-link"
108
- data-act="review-clear">Remove</button>`
109
- : html`<button type="button" class="sset-link" data-act="review" title=${reviewChipModel([]).title}>Review files…</button>`}</div>`;
110
- }
111
-
112
101
  // The panel: its heading (+kind+ beside it, or none) and close button, the
113
- // +rows+ (rowTemplate's), the review files' line when +review+ is a list
114
- // (null: no review line; a rule above it when a row of segments is drawn),
115
- // and the +note+.
116
- export function settingsPanelTemplate({ heading, kind = null, rows = [], review = null, note }) {
117
- const segmented = rows.some((row) => row?.segments);
102
+ // +rows+ (rowTemplate's) and the +note+.
103
+ export function settingsPanelTemplate({ heading, kind = null, rows = [], note }) {
118
104
  return html`<div class="ctx-pop-head"><strong>${heading}</strong>${kind ? html`<span class="ctx-pop-kind">${kind}</span>` : nothing
119
105
  }<button type="button" class="ctx-pop-close" data-act="close" aria-label="Close">×</button></div
120
- >${rows.map(rowTemplate)}${review ? reviewTemplate(review, segmented) : nothing}<div class="ctx-pop-meta">${note}</div>`;
106
+ >${rows.map(rowTemplate)}<div class="ctx-pop-meta">${note}</div>`;
121
107
  }