samagotchi 0.171.0 → 0.172.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -1
- data/bin/chi +6 -4
- data/docs/architecture.md +24 -7
- data/docs/bundles.md +4 -21
- data/docs/cli.md +50 -80
- data/docs/configuration.md +11 -13
- data/docs/context.md +5 -6
- data/docs/guardrails.md +57 -96
- data/docs/hooks.md +3 -4
- data/docs/internals/attached-context.md +6 -7
- data/docs/internals/background-tasks.md +4 -3
- data/docs/internals/bridge.md +29 -3
- data/docs/internals/engine.md +21 -9
- data/docs/internals/objectives.md +3 -5
- data/docs/internals/participants.md +118 -143
- data/docs/internals/prompt-caching.md +4 -5
- data/docs/internals/web-frontend.md +33 -14
- data/docs/internals/working-set.md +7 -5
- data/docs/memory.md +1 -1
- data/docs/plugins.md +2 -16
- data/docs/scheduling.md +1 -1
- data/docs/sessions.md +15 -49
- data/docs/sub-agent.md +2 -2
- data/docs/system-one.md +2 -2
- data/docs/testing.md +56 -7
- data/lib/samagotchi/bridge/card_store.rb +1 -0
- data/lib/samagotchi/bridge/sse_writer.rb +1 -0
- data/lib/samagotchi/bridge/turn_accumulator.rb +0 -1
- data/lib/samagotchi/bridge.rb +26 -9
- data/lib/samagotchi/bridge_client/event_stream.rb +2 -0
- data/lib/samagotchi/bundle_command/test_run.rb +1 -0
- data/lib/samagotchi/bundle_command/try/run.rb +1 -0
- data/lib/samagotchi/bundles/coordinator/manifest.yml +4 -5
- data/lib/samagotchi/bundles/coordinator/plugin.rb +6 -79
- data/lib/samagotchi/bundles/coordinator/skill_coordinator.md +1 -16
- data/lib/samagotchi/bundles/github-pr/manifest.yml +2 -2
- data/lib/samagotchi/bundles/github-pr/plugin.rb +0 -1
- data/lib/samagotchi/bundles/inline-widgets/manifest.yml +2 -2
- data/lib/samagotchi/bundles/inline-widgets/plugin.rb +4 -5
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/client_id.rb +126 -67
- data/lib/samagotchi/command_intake.rb +15 -3
- data/lib/samagotchi/compat.rb +6 -1
- data/lib/samagotchi/context_candidate_choice.rb +1 -3
- data/lib/samagotchi/context_candidates.rb +3 -4
- data/lib/samagotchi/continue_offer.rb +9 -2
- data/lib/samagotchi/delivery.rb +23 -12
- data/lib/samagotchi/empty_answer_error.rb +5 -0
- data/lib/samagotchi/engine/cards.rb +3 -0
- data/lib/samagotchi/engine/context_judge.rb +5 -3
- data/lib/samagotchi/engine/events.rb +4 -0
- data/lib/samagotchi/engine/hooks.rb +3 -0
- data/lib/samagotchi/engine/messages.rb +5 -0
- data/lib/samagotchi/engine/model_settings.rb +2 -0
- data/lib/samagotchi/engine/models.rb +10 -0
- data/lib/samagotchi/engine/objectives.rb +6 -0
- data/lib/samagotchi/engine/participants.rb +18 -14
- data/lib/samagotchi/engine/plugins.rb +8 -0
- data/lib/samagotchi/engine/questions.rb +3 -0
- data/lib/samagotchi/engine/recap.rb +1 -0
- data/lib/samagotchi/engine/session.rb +4 -0
- data/lib/samagotchi/engine/side_requests.rb +9 -0
- data/lib/samagotchi/engine/steering.rb +2 -0
- data/lib/samagotchi/engine/toolkit.rb +5 -0
- data/lib/samagotchi/engine/turn_end.rb +7 -0
- data/lib/samagotchi/engine/turn_helpers.rb +8 -0
- data/lib/samagotchi/engine/verify.rb +2 -0
- data/lib/samagotchi/engine.rb +3 -2
- data/lib/samagotchi/grants.rb +28 -22
- data/lib/samagotchi/guardrail_wiring.rb +23 -18
- data/lib/samagotchi/guardrails/approval_use.rb +59 -0
- data/lib/samagotchi/guardrails/approvals.rb +9 -11
- data/lib/samagotchi/guardrails/child_boundary.rb +1 -0
- data/lib/samagotchi/guardrails/gate.rb +10 -5
- data/lib/samagotchi/guardrails/implicit_writers.rb +1 -0
- data/lib/samagotchi/guardrails/pair_boundary.rb +6 -6
- data/lib/samagotchi/guardrails/participant_refusal.rb +33 -0
- data/lib/samagotchi/guardrails/review_paths.rb +2 -3
- data/lib/samagotchi/guardrails.rb +1 -1
- data/lib/samagotchi/llm_context_strategy.rb +2 -0
- data/lib/samagotchi/objectives.rb +1 -4
- data/lib/samagotchi/objectives_audit.rb +1 -1
- data/lib/samagotchi/objectives_track.rb +1 -1
- data/lib/samagotchi/owner_prompt.rb +3 -6
- data/lib/samagotchi/parent_report.rb +1 -0
- data/lib/samagotchi/participant_messages.rb +9 -4
- data/lib/samagotchi/participant_turn_mode.rb +50 -0
- data/lib/samagotchi/participants.rb +21 -12
- data/lib/samagotchi/participants_watch.rb +2 -2
- data/lib/samagotchi/plugin/api.rb +2 -2
- data/lib/samagotchi/plugin/attached_context.rb +1 -1
- data/lib/samagotchi/plugin/context.rb +0 -4
- data/lib/samagotchi/plugin/sessions.rb +1 -25
- data/lib/samagotchi/run_options.rb +2 -3
- data/lib/samagotchi/send_command.rb +10 -10
- data/lib/samagotchi/session.rb +0 -3
- data/lib/samagotchi/session_access/contract.rb +1 -10
- data/lib/samagotchi/session_access/local.rb +10 -23
- data/lib/samagotchi/session_access/remote.rb +9 -20
- data/lib/samagotchi/session_access.rb +12 -16
- data/lib/samagotchi/session_chain.rb +4 -6
- data/lib/samagotchi/session_commands.rb +6 -3
- data/lib/samagotchi/session_continue.rb +1 -2
- data/lib/samagotchi/session_manager/delivery.rb +25 -5
- data/lib/samagotchi/session_manager/lifecycle.rb +12 -0
- data/lib/samagotchi/session_manager/listing.rb +5 -0
- data/lib/samagotchi/session_manager/spawn.rb +2 -2
- data/lib/samagotchi/session_manager/worker_command.rb +9 -0
- data/lib/samagotchi/session_participants.rb +12 -8
- data/lib/samagotchi/session_review.rb +5 -7
- data/lib/samagotchi/session_stores.rb +3 -3
- data/lib/samagotchi/share_command.rb +10 -12
- data/lib/samagotchi/share_terms.rb +41 -0
- data/lib/samagotchi/steer.rb +8 -14
- data/lib/samagotchi/system_prompt.rb +16 -25
- data/lib/samagotchi/terminal_ui/attach_launcher.rb +2 -1
- data/lib/samagotchi/terminal_ui/attached_loop/exit_commands.rb +1 -0
- data/lib/samagotchi/terminal_ui/attached_loop/queueing.rb +1 -0
- data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +2 -0
- data/lib/samagotchi/terminal_ui/formatting.rb +15 -17
- data/lib/samagotchi/terminal_ui/participant_commands.rb +2 -2
- data/lib/samagotchi/terminal_ui/status_row.rb +2 -2
- data/lib/samagotchi/terminal_ui.rb +1 -2
- data/lib/samagotchi/testing/sessions.rb +2 -10
- data/lib/samagotchi/tool_runner.rb +8 -9
- data/lib/samagotchi/toolkit.rb +4 -22
- data/lib/samagotchi/toolkit_suggest.rb +3 -3
- data/lib/samagotchi/tools/deferred_tools.rb +1 -0
- data/lib/samagotchi/tools/execute.rb +11 -45
- data/lib/samagotchi/tools/leftovers.rb +122 -0
- data/lib/samagotchi/tools/memory.rb +70 -26
- data/lib/samagotchi/tools/task_get.rb +1 -0
- data/lib/samagotchi/tools/task_list.rb +3 -2
- data/lib/samagotchi/tools/task_record.rb +6 -4
- data/lib/samagotchi/tools/task_runtime.rb +199 -20
- data/lib/samagotchi/tools/task_wait.rb +4 -3
- data/lib/samagotchi/turn_context.rb +1 -1
- data/lib/samagotchi/turn_origin.rb +1 -1
- data/lib/samagotchi/turn_stages/context_judge.rb +4 -4
- data/lib/samagotchi/turn_stages/objectives.rb +2 -2
- data/lib/samagotchi/turn_stages/toolkit_suggestion.rb +2 -2
- data/lib/samagotchi/update_hint.rb +3 -1
- data/lib/samagotchi/verify_fresh.rb +1 -1
- data/lib/samagotchi/verify_fresh_origin.rb +13 -11
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +3 -5
- data/lib/samagotchi/web/participant_access.rb +14 -18
- data/lib/samagotchi/web/participant_review.rb +3 -4
- data/lib/samagotchi/web/participant_show.rb +4 -3
- data/lib/samagotchi/web/participant_view.rb +3 -3
- data/lib/samagotchi/web/participants_admin.rb +21 -40
- data/lib/samagotchi/web/public/app.js +5 -47
- data/lib/samagotchi/web/public/data.js +2 -10
- data/lib/samagotchi/web/public/delivery_line.js +17 -60
- data/lib/samagotchi/web/public/index.html +10 -30
- data/lib/samagotchi/web/public/live_turn.js +1 -1
- data/lib/samagotchi/web/public/owner_claim.js +2 -2
- data/lib/samagotchi/web/public/participant_bar.js +4 -5
- data/lib/samagotchi/web/public/participant_names.js +14 -10
- data/lib/samagotchi/web/public/participants_panel.js +29 -62
- data/lib/samagotchi/web/public/reload_check.js +2 -3
- data/lib/samagotchi/web/public/send_turn.js +4 -23
- data/lib/samagotchi/web/public/session_actions.js +4 -45
- data/lib/samagotchi/web/public/session_fields.js +0 -1
- data/lib/samagotchi/web/public/session_state.js +0 -3
- data/lib/samagotchi/web/public/session_view.js +2 -3
- data/lib/samagotchi/web/public/settings_panel.js +4 -18
- data/lib/samagotchi/web/public/stage_answer.js +56 -0
- data/lib/samagotchi/web/public/stage_asking.js +1 -1
- data/lib/samagotchi/web/public/stage_cloud.js +93 -0
- data/lib/samagotchi/web/public/stage_dom.js +100 -0
- data/lib/samagotchi/web/public/stage_handoff.js +154 -0
- data/lib/samagotchi/web/public/stage_pager.js +59 -0
- data/lib/samagotchi/web/public/stage_quiet_clock.js +52 -0
- data/lib/samagotchi/web/public/stage_view.js +90 -411
- data/lib/samagotchi/web/public/start_page.js +12 -33
- data/lib/samagotchi/web/public/start_settings.js +24 -78
- data/lib/samagotchi/web/public/start_toolkit.js +6 -10
- data/lib/samagotchi/web/public/stream_handlers.js +1 -9
- data/lib/samagotchi/web/public/turn_block.js +3 -7
- data/lib/samagotchi/web/public/turn_events.js +15 -6
- data/lib/samagotchi/web/public/turn_pieces.js +3 -4
- data/lib/samagotchi/web/public/viewer_self.js +8 -2
- data/lib/samagotchi/web/qr.rb +1 -1
- data/lib/samagotchi/web/session_control.rb +3 -1
- data/lib/samagotchi/web/session_create.rb +5 -71
- data/lib/samagotchi/web/session_summary.rb +1 -4
- data/lib/samagotchi/web/verify_fresh_routes.rb +8 -7
- data/lib/samagotchi/web/viewer.rb +3 -3
- data/lib/samagotchi/worker.rb +16 -14
- data/lib/samagotchi/worker_inbound.rb +4 -3
- data/lib/samagotchi/worker_link.rb +17 -0
- data/lib/samagotchi/working_set.rb +87 -28
- metadata +13 -8
- data/lib/samagotchi/guardrails/review_boundary.rb +0 -99
- data/lib/samagotchi/participant_mode.rb +0 -86
- data/lib/samagotchi/review_apply.rb +0 -131
- data/lib/samagotchi/review_command.rb +0 -123
- data/lib/samagotchi/review_start.rb +0 -196
- data/lib/samagotchi/web/public/review_apply.js +0 -34
- data/lib/samagotchi/web/public/review_start.js +0 -55
|
@@ -223,17 +223,6 @@ main{flex:1;display:flex;flex-direction:column;gap:16px;padding:max(16px,var(--s
|
|
|
223
223
|
/* A participant's prompt: their name in their colour (tokens.css --author-N), and a rule of it on the bubble. */
|
|
224
224
|
.bubble.user .origin-label.author-badge{color:var(--author-color);text-transform:none;letter-spacing:0;font-weight:600}
|
|
225
225
|
.bubble.user.by-participant{border-left:3px solid var(--author-color)}
|
|
226
|
-
/* Apply (review_apply.js) under a participant's review turn's reply. */
|
|
227
|
-
.review-apply{display:flex;align-items:center;gap:10px;margin:6px 0 4px}
|
|
228
|
-
.review-apply-btn{font:inherit;font-size:13px;font-weight:600;padding:5px 16px;border-radius:8px;cursor:pointer;background:var(--accent-bg);color:var(--accent);border:1px solid var(--accent-border)}
|
|
229
|
-
@media(hover:hover){.review-apply-btn:hover{border-color:var(--accent)}}
|
|
230
|
-
.review-apply-btn:disabled{opacity:.6;cursor:default}
|
|
231
|
-
.review-apply-note{font-size:12px;color:var(--text-muted);border-left:3px solid var(--author-color);padding-left:8px}
|
|
232
|
-
@media (max-width:600px){
|
|
233
|
-
.review-apply{flex-direction:column;align-items:stretch;gap:4px}
|
|
234
|
-
.review-apply-btn{width:100%;padding:10px 16px;font-size:15px}
|
|
235
|
-
.review-apply-note{border-left:0;padding-left:0;text-align:center}
|
|
236
|
-
}
|
|
237
226
|
.bubble.user .user-message{flex:1;min-width:0}
|
|
238
227
|
/* A delegate report in the history (long, markdown): its label and badge on a row of their own above it at any width,
|
|
239
228
|
not centred beside a tall body. */
|
|
@@ -753,13 +742,13 @@ body.has-session #history{padding-bottom:calc(var(--dock-h,160px) + 16px + var(-
|
|
|
753
742
|
(32px) and ⋯ (38px) with their gaps. The chips the line covers are hidden, unless the composer is folded away.
|
|
754
743
|
Running, it shows only while it matters, the bar's status, ctx and speed otherwise (a card waiting, a sent steer, a
|
|
755
744
|
message queued after the turn): the text field focused (the keyboard up) or holding text or images, or a choice
|
|
756
|
-
armed
|
|
745
|
+
armed (delivery_line.js data-armed; not the queue chip's pressed look, which a
|
|
757
746
|
participant's turn draws with nothing armed). The two rules below share that list: change both. A chip's
|
|
758
747
|
mousedown keeps the focus in the text field, so tapping one doesn't hide the line under the finger. On a bare
|
|
759
748
|
stage an after-turn queued message isn't drawn and the line is hidden too: accepted. */
|
|
760
749
|
body.has-session #deliveryLine{display:none}
|
|
761
|
-
body.has-session #composer:has(:is(#prompt:focus,#prompt:not(:placeholder-shown),#chips:not([hidden]),#deliveryLine[data-armed="1"]
|
|
762
|
-
body.has-session:not(.composer-folded) #dock:has(#deliveryLine.running:not([hidden])):has(:is(#prompt:focus,#prompt:not(:placeholder-shown),#chips:not([hidden]),#deliveryLine[data-armed="1"]
|
|
750
|
+
body.has-session #composer:has(:is(#prompt:focus,#prompt:not(:placeholder-shown),#chips:not([hidden]),#deliveryLine[data-armed="1"])) #deliveryLine.running:not([hidden]){display:flex;position:absolute;left:10px;right:96px;top:100%;height:41px;padding:6px 0 8px;box-sizing:border-box;z-index:1}
|
|
751
|
+
body.has-session:not(.composer-folded) #dock:has(#deliveryLine.running:not([hidden])):has(:is(#prompt:focus,#prompt:not(:placeholder-shown),#chips:not([hidden]),#deliveryLine[data-armed="1"])) #infoBar .meta :is(.status,.ctx,.speed){visibility:hidden}
|
|
763
752
|
}
|
|
764
753
|
/* A line queued for after the running turn: a dashed bubble, a turn of its own to come. */
|
|
765
754
|
.bubble.user.queued[data-delivery="queue"]{border:1px dashed var(--accent-border);border-left:3px dashed var(--accent);background:transparent}
|
|
@@ -927,7 +916,7 @@ body.stage-view .turn-stage{position:absolute;left:0;right:0;bottom:100%;margin-
|
|
|
927
916
|
question (the mini tool's slot, in the UI font, right after the phase), then the step and the timing. On a phone those
|
|
928
917
|
two leave the row and the question takes a second line under it. */
|
|
929
918
|
.ts-mini.ts-mini-question{order:1;font-family:inherit;font-size:12.5px;color:var(--text)}
|
|
930
|
-
/* Two cards docked (
|
|
919
|
+
/* Two cards docked (stage_pager.js drawDocked): one at a time, the one that stops chi in front; the pager after the phase
|
|
931
920
|
says where it is ("‹ 1 of 2 ›"), the other waits behind it. */
|
|
932
921
|
.turn-stage .ts-extras>.ts-behind{display:none}
|
|
933
922
|
.ts-pager{flex:none;display:inline-flex;align-items:center;gap:2px;color:var(--text-2)}
|
|
@@ -1363,9 +1352,9 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1363
1352
|
.pp-row.ended{opacity:.7}
|
|
1364
1353
|
.pb-who{display:flex;align-items:center;gap:6px;min-width:0;color:var(--text)}
|
|
1365
1354
|
.pb-who b{color:var(--author-color);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1355
|
+
.pp-who{display:flex;align-items:center;gap:6px;min-width:0}
|
|
1366
1356
|
.pp-dot{width:7px;height:7px;border-radius:50%;background:var(--text-faint);flex-shrink:0}
|
|
1367
1357
|
.pp-dot.present{background:var(--ok)}
|
|
1368
|
-
.pp-tag{font-size:10.5px;padding:0 6px;border-radius:999px;background:var(--bg-raised);color:var(--text-3)}
|
|
1369
1358
|
.pp-state{font-size:11px;color:var(--text-muted);white-space:nowrap}
|
|
1370
1359
|
.pp-meta{grid-column:1;font-size:11.5px;color:var(--text-muted);font-variant-numeric:tabular-nums}
|
|
1371
1360
|
.pp-capped{color:var(--warn-text);font-weight:600}
|
|
@@ -1391,7 +1380,7 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1391
1380
|
.pp-working button{font:inherit;font-size:12px;padding:3px 10px;border-radius:6px;cursor:pointer;background:var(--accent-bg);color:var(--accent);border:1px solid var(--accent-border)}
|
|
1392
1381
|
.pp-working button:disabled{opacity:.7;cursor:progress}
|
|
1393
1382
|
.pp-link{display:flex;gap:4px}
|
|
1394
|
-
/* The start page's ⚙ panel (start_settings.js): rows of segments (a label, then pill buttons with aria-pressed), the context's Apply and budget disclosure
|
|
1383
|
+
/* The start page's ⚙ panel (start_settings.js): rows of segments (a label, then pill buttons with aria-pressed), the context's Apply and budget disclosure; a bottom sheet on a phone. Its classes are sset- (the Stop sheet's are ss-). */
|
|
1395
1384
|
.start-settings{gap:10px}
|
|
1396
1385
|
.start-settings .ctx-pop-head strong{font-family:inherit}
|
|
1397
1386
|
.sset-row{display:flex;align-items:flex-start;gap:10px}
|
|
@@ -1400,24 +1389,19 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1400
1389
|
.sset-seg button{height:26px;min-height:26px;padding:0 9px;border:1px solid var(--border-strong);border-radius:7px;background:transparent;color:var(--text-2);font-size:12px;line-height:24px;white-space:nowrap}
|
|
1401
1390
|
.sset-seg button:hover{filter:none}
|
|
1402
1391
|
.sset-seg button[aria-pressed="true"]{background:var(--accent-bg);color:var(--accent);border-color:var(--accent-border)}
|
|
1403
|
-
.sset-seg button:focus-visible,.sset-link:focus-visible
|
|
1392
|
+
.sset-seg button:focus-visible,.sset-link:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
|
|
1404
1393
|
.sset-ctx-more{margin:-4px 0 0 74px}
|
|
1405
1394
|
.sset-link{padding:2px 4px;border:0;border-radius:5px;background:transparent;color:var(--accent);font-size:12px}
|
|
1406
1395
|
.sset-link:hover{filter:none}
|
|
1407
1396
|
.sset-ctx-form{display:flex;flex-direction:column;gap:8px;margin:0 0 0 74px}
|
|
1408
1397
|
.sset-anyway{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px}
|
|
1409
1398
|
.sset-rule{width:100%;margin:0;border:0;border-top:1px solid var(--border)}
|
|
1410
|
-
.sset-review{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px}
|
|
1411
|
-
.sset-review>.sset-link:first-child{margin-left:-4px}
|
|
1412
|
-
.sset-review-set{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text);font-size:12.5px}
|
|
1413
|
-
.sset-back{margin:0 2px 0 -6px;padding:0 6px;border:0;border-radius:5px;background:transparent;color:var(--text-muted);font-size:18px;line-height:1}
|
|
1414
|
-
.sset-back:hover{filter:none}
|
|
1415
1399
|
.start-settings.sheet{border-radius:14px;padding:14px 16px}
|
|
1416
1400
|
/* Tints only where a pointer hovers: on a touch screen a tapped control would keep it. Every popover's (chip_popover.js)
|
|
1417
1401
|
controls and its opener's :hover tint sit in @media(hover:hover); an open opener shows it by aria-expanded instead. */
|
|
1418
|
-
@media(hover:hover){.sset-seg button:hover{color:var(--text);border-color:var(--accent-border)}.sset-link:hover{background:var(--accent-bg)}.
|
|
1402
|
+
@media(hover:hover){.sset-seg button:hover{color:var(--text);border-color:var(--accent-border)}.sset-link:hover{background:var(--accent-bg)}.st-row:hover{color:var(--text);background:var(--bg-hover)}}
|
|
1419
1403
|
@media(max-width:400px){.sset-row{flex-direction:column;gap:4px}.sset-label{flex:none;line-height:1.4}.sset-ctx-more,.sset-ctx-form{margin-left:0}}
|
|
1420
|
-
@media(pointer:coarse){.sset-seg button{height:36px;min-height:36px;line-height:34px;padding:0 12px;font-size:13px}.sset-link
|
|
1404
|
+
@media(pointer:coarse){.sset-seg button{height:36px;min-height:36px;line-height:34px;padding:0 12px;font-size:13px}.sset-link{min-height:36px}.sset-label{line-height:36px}}
|
|
1421
1405
|
/* The start page's 🧰 list (start_toolkit.js): a row per kit (a check, its name, a muted detail), the checked one accent; a bottom sheet on a phone. */
|
|
1422
1406
|
.start-toolkit{gap:8px}
|
|
1423
1407
|
.start-toolkit .ctx-pop-head strong{font-family:inherit}
|
|
@@ -1432,9 +1416,6 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1432
1416
|
.start-toolkit.sheet{border-radius:14px;padding:14px 16px}
|
|
1433
1417
|
.start-toolkit.sheet .st-detail{white-space:normal}
|
|
1434
1418
|
@media(pointer:coarse){.st-row{min-height:40px;align-items:center}}
|
|
1435
|
-
.rs-form{display:flex;flex-direction:column;gap:6px;margin-top:6px}
|
|
1436
|
-
.rs-form textarea{width:100%;resize:vertical;min-height:52px;font-family:ui-monospace,monospace;font-size:12px;color:var(--text);background:var(--bg-inset);border:1px solid var(--border-strong);border-radius:6px;padding:6px 8px}
|
|
1437
|
-
.rs-form textarea:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-ring)}
|
|
1438
1419
|
.pp-link input{flex:1;min-width:0;font-family:ui-monospace,monospace;font-size:11.5px}
|
|
1439
1420
|
.pp-qr{align-self:center;width:164px;height:164px;padding:6px;border-radius:8px;background:var(--on-solid)}
|
|
1440
1421
|
.pp-qr svg{display:block;width:100%;height:100%}
|
|
@@ -2019,7 +2000,7 @@ a{color:var(--accent)}
|
|
|
2019
2000
|
fields in this list (stage.spec.js's phone step checks the visible ones). */
|
|
2020
2001
|
@media (max-width:600px),(pointer:coarse){
|
|
2021
2002
|
#composer textarea,.question-freeform,.continue-reason,.participants-popover input,.participants-popover select,
|
|
2022
|
-
.
|
|
2003
|
+
.pp-link input,.llmctx-field select,.llmctx-field input,.ws-add-in,.rename-input,
|
|
2023
2004
|
#modelSearch,.project-create input{font-size:16px}
|
|
2024
2005
|
}
|
|
2025
2006
|
/* A participant's page (participant_main.js): a plain logo, their name and the link's end in the top row; the bottom row in
|
|
@@ -2110,7 +2091,6 @@ body.participant-view .bubble.user:not(.by-participant)>.origin-label{color:var(
|
|
|
2110
2091
|
<button type="button" id="modelPick" class="model-pick" title="The model the new session starts on" aria-label="Model for the new session" aria-haspopup="listbox" aria-expanded="false" hidden><span class="model-pick-name"></span></button>
|
|
2111
2092
|
<button type="button" id="thinkingNew" class="llmctx-new think-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
2112
2093
|
<button type="button" id="llmContextNew" class="llmctx-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
2113
|
-
<button type="button" id="reviewNew" class="llmctx-new review-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
2114
2094
|
<button type="button" id="toolkitNew" class="llmctx-new toolkit-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
2115
2095
|
<button type="button" id="settingsNew" class="icon-btn settings-btn" title="Session settings" aria-label="Session settings" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
2116
2096
|
<button type="button" id="toolkitBtn" class="icon-btn toolkit-btn" title="Toolkit" aria-label="Toolkit" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
@@ -32,7 +32,7 @@ export function createLiveTurn(timingDeps) {
|
|
|
32
32
|
// until the next generation starts: the composer's delivery line.
|
|
33
33
|
cutAfter: null,
|
|
34
34
|
serverGen: null,
|
|
35
|
-
// The running turn is a participant's
|
|
35
|
+
// The running turn is a participant's (turn_started's
|
|
36
36
|
// author): the delivery line says the owner's input queues behind it.
|
|
37
37
|
participantTurn: false,
|
|
38
38
|
|
|
@@ -51,7 +51,7 @@ export function createOwnerClaim({
|
|
|
51
51
|
|
|
52
52
|
// Annotate's "Copy link" for a selection in a turn's answer, step or own
|
|
53
53
|
// message: a participant's page's link when the session has a person
|
|
54
|
-
// active (it opens in the browser their
|
|
54
|
+
// active (it opens in the browser their invite link was opened in: one
|
|
55
55
|
// link per browser, the cookie), else this page's own.
|
|
56
56
|
function linkFor(source, range) {
|
|
57
57
|
// Not in a Revise stack's switched copy (revise_switch.js: view only, no claim key; Verify isn't offered there either).
|
|
@@ -69,7 +69,7 @@ export function createOwnerClaim({
|
|
|
69
69
|
}
|
|
70
70
|
const whose = target.names.map((name) => `${name}'s`).join(" or ");
|
|
71
71
|
return { url: participantClaimLink(target.base, store.selected, claim),
|
|
72
|
-
title: `A link to this for ${whose} browser: it opens where their
|
|
72
|
+
title: `A link to this for ${whose} browser: it opens where their invite link was opened (one link per browser). Opened here, it shows your page.` };
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
async function copyLink({ url }) {
|
|
@@ -39,9 +39,8 @@ export function spentText(usage) {
|
|
|
39
39
|
|
|
40
40
|
const money = (value) => `$${Number(value).toFixed(2)}`;
|
|
41
41
|
|
|
42
|
-
// What their turns may do, by the grant's mode (pair: they act
|
|
43
|
-
|
|
44
|
-
export const RULES_TEXT = { pair: "chi acts under the owner's rules", review: "your turns only read" };
|
|
42
|
+
// What their turns may do, by the grant's mode (pair: they act).
|
|
43
|
+
export const RULES_TEXT = { pair: "chi acts under the owner's rules" };
|
|
45
44
|
|
|
46
45
|
// The bottom row's items: [{key, text, tip}].
|
|
47
46
|
// status "idle" | "running" | "waiting"
|
|
@@ -86,7 +85,7 @@ export function whoTemplate({ name, endsAt, color = null }) {
|
|
|
86
85
|
// usage the show's viewer.usage (the cap's amount)
|
|
87
86
|
// refusal {code, text}: the server's words for a send refused as
|
|
88
87
|
// session_stopped, or the link that ended (token_revoked,
|
|
89
|
-
// token_expired): shown as they are
|
|
88
|
+
// token_expired, token_outdated): shown as they are
|
|
90
89
|
// → {kind, title, text}
|
|
91
90
|
export function closedLine({ capReached = false, usage = null, refusal = null } = {}) {
|
|
92
91
|
if (refusal?.text) {
|
|
@@ -105,4 +104,4 @@ export function closedTemplate(line) {
|
|
|
105
104
|
|
|
106
105
|
// The codes of a refused send that close the composer (the rest are a
|
|
107
106
|
// toast with the server's words): their state, not this message's.
|
|
108
|
-
export const CLOSING_CODES = Object.freeze(["cap_reached", "session_stopped", "token_revoked", "token_expired"]);
|
|
107
|
+
export const CLOSING_CODES = Object.freeze(["cap_reached", "session_stopped", "token_revoked", "token_expired", "token_outdated"]);
|
|
@@ -35,18 +35,22 @@ export function authorBadge(author, name = null, mode = null) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// A badge's text and tooltip (turn_html.js userBubbleTemplate), by the
|
|
38
|
-
// turn's mode: a
|
|
39
|
-
//
|
|
40
|
-
//
|
|
38
|
+
// turn's mode: a participant's turn acts with the session's tools (pair,
|
|
39
|
+
// and a live prompt whose mode isn't known yet: a queued one, until
|
|
40
|
+
// setBadgeMode); a saved turn stamped "review", or saved with no stamp (an
|
|
41
|
+
// older chi's, as Steer reads it), could only read: the history render
|
|
42
|
+
// passes READ_ONLY for an unstamped one (turn_block.js). PAIR is the stamp
|
|
43
|
+
// ParticipantTurnMode::PAIR_MODE writes; the page only reads it.
|
|
41
44
|
export const PAIR = "pair";
|
|
42
|
-
|
|
45
|
+
export const READ_ONLY = "review";
|
|
46
|
+
// A participant looking (viewer_self.js) reads their turn by its name alone.
|
|
43
47
|
export const authorBadgeText = (name, mode = null) => {
|
|
44
|
-
if (mode ===
|
|
45
|
-
return `${name} ·
|
|
48
|
+
if (mode === READ_ONLY) return `${name} · read-only`;
|
|
49
|
+
return viewerSelf() ? name : `${name} · pair`;
|
|
46
50
|
};
|
|
47
|
-
export const authorBadgeTitle = (name, mode = null) => (mode ===
|
|
48
|
-
? `A turn from ${name}, a participant
|
|
49
|
-
: `A
|
|
51
|
+
export const authorBadgeTitle = (name, mode = null) => (mode === READ_ONLY
|
|
52
|
+
? `A turn from ${name}, a participant, under an older chi: it could only read`
|
|
53
|
+
: `A turn from ${name}, a participant: it acted with this session's tools, its asks came to you`);
|
|
50
54
|
|
|
51
55
|
// The badge on +bubble+ (a prompt drawn before its turn started) takes the
|
|
52
56
|
// turn's +mode+ once turn_started names it.
|
|
@@ -55,7 +59,7 @@ export function setBadgeMode(bubble, mode) {
|
|
|
55
59
|
if (!badge || !mode) return;
|
|
56
60
|
bubble.dataset.participantMode = mode;
|
|
57
61
|
if (badge.dataset.unnamed) return;
|
|
58
|
-
const name = participantName(bubble.dataset.author) || badge.textContent.replace(/ · (
|
|
62
|
+
const name = participantName(bubble.dataset.author) || badge.textContent.replace(/ · (read-only|pair)$/, "");
|
|
59
63
|
badge.textContent = authorBadgeText(name, mode);
|
|
60
64
|
badge.title = authorBadgeTitle(name, mode);
|
|
61
65
|
}
|
|
@@ -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"
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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",
|
|
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
|
|
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
|
|
185
|
-
export const
|
|
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
|
|
191
|
-
//
|
|
192
|
-
//
|
|
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,
|
|
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">${
|
|
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}
|
|
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
|
-
|
|
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
|
-
|
|
234
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
346
|
+
toast(`${name}'s link copied`);
|
|
364
347
|
} catch {
|
|
365
|
-
toast(`${name}'s
|
|
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
|
|
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
|
|
457
|
-
//
|
|
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"
|
|
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(),
|
|
@@ -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
|
-
|
|
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
|
-
//
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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: [],
|