samagotchi 0.170.0 → 0.172.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +61 -1
- data/bin/chi +6 -4
- data/docs/architecture.md +26 -9
- data/docs/bundles.md +4 -21
- data/docs/cli.md +81 -97
- data/docs/configuration.md +12 -14
- 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/block-renderers.md +2 -2
- data/docs/internals/bridge.md +34 -7
- data/docs/internals/context-telemetry.md +13 -1
- data/docs/internals/engine.md +25 -13
- data/docs/internals/inline-widgets.md +1 -1
- data/docs/internals/objectives.md +4 -6
- data/docs/internals/participants.md +340 -249
- data/docs/internals/prompt-caching.md +4 -5
- data/docs/internals/web-frontend.md +185 -35
- data/docs/internals/working-set.md +71 -5
- data/docs/memory.md +1 -1
- data/docs/plugins.md +2 -16
- data/docs/releasing.md +2 -1
- data/docs/scheduling.md +1 -1
- data/docs/sessions.md +17 -48
- 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 +8 -5
- data/lib/samagotchi/bridge.rb +64 -20
- 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 +36 -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 +8 -3
- data/lib/samagotchi/event_fanout.rb +22 -1
- data/lib/samagotchi/grants.rb +33 -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/image_store.rb +51 -12
- data/lib/samagotchi/kernel_loop.rb +7 -1
- data/lib/samagotchi/llm/stray_tool_call.rb +7 -4
- data/lib/samagotchi/llm_context_stale.rb +4 -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 +48 -4
- data/lib/samagotchi/participant_revise.rb +61 -0
- data/lib/samagotchi/participant_turn_mode.rb +50 -0
- data/lib/samagotchi/participant_uploads.rb +98 -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/reply_wait/poll.rb +5 -1
- data/lib/samagotchi/revise_anchor.rb +9 -0
- data/lib/samagotchi/run_options.rb +2 -3
- data/lib/samagotchi/send_command.rb +15 -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_inbox.rb +20 -12
- data/lib/samagotchi/session_manager/delivery.rb +32 -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 -1
- 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 +42 -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 +88 -25
- 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_anchors.rb +0 -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/turn_stages/verify_anchors.rb +13 -1
- data/lib/samagotchi/update_hint.rb +3 -1
- data/lib/samagotchi/verify_anchor.rb +6 -0
- 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 +45 -82
- data/lib/samagotchi/web/participant_access.rb +139 -40
- data/lib/samagotchi/web/participant_images.rb +185 -0
- data/lib/samagotchi/web/participant_review.rb +22 -142
- data/lib/samagotchi/web/participant_show.rb +241 -0
- data/lib/samagotchi/web/participant_stream_filter.rb +25 -2
- data/lib/samagotchi/web/participant_view.rb +334 -27
- data/lib/samagotchi/web/participants_admin.rb +21 -40
- data/lib/samagotchi/web/public/annotate_bar.css +1 -2
- data/lib/samagotchi/web/public/annotate_bar.js +1 -2
- data/lib/samagotchi/web/public/app.js +126 -132
- data/lib/samagotchi/web/public/block_host.js +7 -4
- data/lib/samagotchi/web/public/bubbles.js +9 -1
- data/lib/samagotchi/web/public/cards_offscreen.js +69 -0
- data/lib/samagotchi/web/public/chip_popover.js +5 -4
- data/lib/samagotchi/web/public/claim_link.js +4 -4
- data/lib/samagotchi/web/public/composer.css +4 -6
- data/lib/samagotchi/web/public/composer_mode.js +11 -6
- data/lib/samagotchi/web/public/composer_mount.js +4 -4
- data/lib/samagotchi/web/public/ctx.js +12 -3
- data/lib/samagotchi/web/public/data.js +2 -10
- data/lib/samagotchi/web/public/delivery_line.js +49 -63
- data/lib/samagotchi/web/public/history_shape.js +5 -1
- data/lib/samagotchi/web/public/images.js +7 -1
- data/lib/samagotchi/web/public/index.html +50 -34
- data/lib/samagotchi/web/public/info_bar_model.js +2 -1
- data/lib/samagotchi/web/public/live_turn.js +1 -1
- data/lib/samagotchi/web/public/markdown_place.js +5 -4
- data/lib/samagotchi/web/public/owner_claim.js +5 -5
- data/lib/samagotchi/web/public/owner_verify.js +0 -2
- data/lib/samagotchi/web/public/participant_bar.js +107 -0
- data/lib/samagotchi/web/public/participant_main.js +289 -0
- data/lib/samagotchi/web/public/participant_model.js +5 -292
- data/lib/samagotchi/web/public/participant_names.js +17 -8
- data/lib/samagotchi/web/public/participant_revise.js +66 -0
- data/lib/samagotchi/web/public/participants_panel.js +32 -74
- data/lib/samagotchi/web/public/question_cards.js +14 -3
- data/lib/samagotchi/web/public/refs.js +53 -36
- data/lib/samagotchi/web/public/reload_check.js +70 -14
- data/lib/samagotchi/web/public/revise_stack.js +21 -10
- data/lib/samagotchi/web/public/send_turn.js +28 -29
- data/lib/samagotchi/web/public/session_actions.js +4 -45
- data/lib/samagotchi/web/public/session_fields.js +1 -2
- data/lib/samagotchi/web/public/session_state.js +12 -7
- data/lib/samagotchi/web/public/session_sync.js +9 -2
- data/lib/samagotchi/web/public/session_view.js +14 -5
- 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 +7 -5
- 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_owner_wait.js +35 -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 +103 -410
- data/lib/samagotchi/web/public/stage_waiting.js +74 -6
- 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/storage.js +22 -0
- data/lib/samagotchi/web/public/stream_handlers.js +3 -10
- data/lib/samagotchi/web/public/tokens.css +1 -1
- data/lib/samagotchi/web/public/turn_block.js +2 -5
- data/lib/samagotchi/web/public/turn_events.js +30 -12
- data/lib/samagotchi/web/public/turn_html.js +9 -2
- data/lib/samagotchi/web/public/turn_pieces.js +3 -4
- data/lib/samagotchi/web/public/turn_range.js +1 -2
- data/lib/samagotchi/web/public/verify_target.js +2 -4
- data/lib/samagotchi/web/public/viewer.js +59 -0
- data/lib/samagotchi/web/public/viewer_self.js +59 -0
- data/lib/samagotchi/web/public/working_set.js +11 -5
- data/lib/samagotchi/web/public/working_set_view.js +53 -8
- data/lib/samagotchi/web/public/ws_cards.js +89 -0
- data/lib/samagotchi/web/public/ws_peek.js +106 -0
- data/lib/samagotchi/web/public/ws_preview.css +126 -0
- data/lib/samagotchi/web/public/ws_reader.js +319 -0
- data/lib/samagotchi/web/public/ws_timeline.js +200 -0
- data/lib/samagotchi/web/public/ws_way_in.js +25 -0
- data/lib/samagotchi/web/qr.rb +1 -1
- data/lib/samagotchi/web/session_control.rb +42 -15
- data/lib/samagotchi/web/session_create.rb +6 -72
- data/lib/samagotchi/web/session_show.rb +75 -28
- 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 +70 -0
- data/lib/samagotchi/web/working_set_routes.rb +132 -0
- data/lib/samagotchi/worker.rb +35 -28
- data/lib/samagotchi/worker_inbound.rb +4 -3
- data/lib/samagotchi/worker_link.rb +17 -0
- data/lib/samagotchi/working_set.rb +322 -11
- metadata +32 -13
- 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/participant.html +0 -218
- data/lib/samagotchi/web/public/participant.js +0 -719
- data/lib/samagotchi/web/public/participant_annotate.js +0 -76
- data/lib/samagotchi/web/public/review_apply.js +0 -34
- data/lib/samagotchi/web/public/review_history.js +0 -72
- data/lib/samagotchi/web/public/review_start.js +0 -55
- data/lib/samagotchi/web/public/tools_overview.js +0 -42
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
<link rel="stylesheet" href="/assets/forms.css">
|
|
25
25
|
<link rel="stylesheet" href="/assets/objectives.css">
|
|
26
26
|
<link rel="stylesheet" href="/assets/block_renderers.css">
|
|
27
|
+
<link rel="stylesheet" href="/assets/ws_preview.css">
|
|
27
28
|
<style>
|
|
28
29
|
/* Icon masks shared by the phone info bar and the all view's cards (the stroke only shapes the mask; the icon takes currentColor); the image icon is composer.css's. */
|
|
29
30
|
:root{--icon-archive:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2.75' width='12' height='3.5' rx='1'/%3E%3Cpath d='M3.25 6.25v6a1 1 0 0 0 1 1h7.5a1 1 0 0 0 1-1v-6M6.5 9h3'/%3E%3C/svg%3E");--icon-unarchive:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2.75' width='12' height='3.5' rx='1'/%3E%3Cpath d='M3.25 6.25v6a1 1 0 0 0 1 1h7.5a1 1 0 0 0 1-1v-6M8 11.5V8.25M6.5 9.75 8 8.25l1.5 1.5'/%3E%3C/svg%3E")}
|
|
@@ -40,6 +41,8 @@ body{font-family: ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetic
|
|
|
40
41
|
(the gradient covers the body): it is the body's background-color, which is what iOS 26's Home Screen app paints
|
|
41
42
|
the status bar strip in (not theme-color, not html's background; with no colour the strip is black). */
|
|
42
43
|
@media(max-width:600px){body{background:linear-gradient(var(--bg-top),var(--bg) 420px),var(--bg-top)}}
|
|
44
|
+
/* iOS 26 blurs the Home Screen app's top band under the clock; measured 28px total is needed, and a fixed element does not help. */
|
|
45
|
+
@media (display-mode:standalone) and (max-width:600px){body{padding-top:12px}}
|
|
43
46
|
/* Glass: the composer card, the strip cards, the all-sessions cards and the question cards (by selector, so app.js is untouched). */
|
|
44
47
|
.turn-stage,#topStrip .card,#allList .card,.bubble.question,.bubble.plugin-card{background:var(--glass-bg);-webkit-backdrop-filter:blur(18px) saturate(1.35);backdrop-filter:blur(18px) saturate(1.35);border:1px solid var(--glass-border);box-shadow:inset 0 1px 0 var(--glass-highlight),var(--glass-shadow)}
|
|
45
48
|
@media(hover:hover){#topStrip .card:hover,#allList .card:hover{background:color-mix(in srgb,var(--bg-hover) 75%,transparent);border-color:var(--card-hover-border)}}
|
|
@@ -184,6 +187,8 @@ main{flex:1;display:flex;flex-direction:column;gap:16px;padding:max(16px,var(--s
|
|
|
184
187
|
/* Plugins' slow setup (chi.init, init_row.js): a quiet line per task over the composer. */
|
|
185
188
|
#initRow{display:flex;flex-direction:column;gap:2px;padding:6px 12px 2px;font-size:12px;line-height:1.4;color:var(--text-3)}
|
|
186
189
|
#initRow[hidden]{display:none}
|
|
190
|
+
/* A control the viewer may not use (viewer.js control): hidden whatever its own display rule says. */
|
|
191
|
+
[data-withheld]{display:none!important}
|
|
187
192
|
.init-task{display:flex;align-items:center;gap:7px;min-width:0;transition:opacity .4s ease}
|
|
188
193
|
.init-task.fading{opacity:0}
|
|
189
194
|
.init-bundle{flex:none;padding:0 5px;border:1px solid var(--border-strong);border-radius:4px;font-size:11px;color:var(--text-muted)}
|
|
@@ -218,17 +223,6 @@ main{flex:1;display:flex;flex-direction:column;gap:16px;padding:max(16px,var(--s
|
|
|
218
223
|
/* A participant's prompt: their name in their colour (tokens.css --author-N), and a rule of it on the bubble. */
|
|
219
224
|
.bubble.user .origin-label.author-badge{color:var(--author-color);text-transform:none;letter-spacing:0;font-weight:600}
|
|
220
225
|
.bubble.user.by-participant{border-left:3px solid var(--author-color)}
|
|
221
|
-
/* Apply (review_apply.js) under a participant's review turn's reply. */
|
|
222
|
-
.review-apply{display:flex;align-items:center;gap:10px;margin:6px 0 4px}
|
|
223
|
-
.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)}
|
|
224
|
-
@media(hover:hover){.review-apply-btn:hover{border-color:var(--accent)}}
|
|
225
|
-
.review-apply-btn:disabled{opacity:.6;cursor:default}
|
|
226
|
-
.review-apply-note{font-size:12px;color:var(--text-muted);border-left:3px solid var(--author-color);padding-left:8px}
|
|
227
|
-
@media (max-width:600px){
|
|
228
|
-
.review-apply{flex-direction:column;align-items:stretch;gap:4px}
|
|
229
|
-
.review-apply-btn{width:100%;padding:10px 16px;font-size:15px}
|
|
230
|
-
.review-apply-note{border-left:0;padding-left:0;text-align:center}
|
|
231
|
-
}
|
|
232
226
|
.bubble.user .user-message{flex:1;min-width:0}
|
|
233
227
|
/* A delegate report in the history (long, markdown): its label and badge on a row of their own above it at any width,
|
|
234
228
|
not centred beside a tall body. */
|
|
@@ -748,17 +742,18 @@ body.has-session #history{padding-bottom:calc(var(--dock-h,160px) + 16px + var(-
|
|
|
748
742
|
(32px) and ⋯ (38px) with their gaps. The chips the line covers are hidden, unless the composer is folded away.
|
|
749
743
|
Running, it shows only while it matters, the bar's status, ctx and speed otherwise (a card waiting, a sent steer, a
|
|
750
744
|
message queued after the turn): the text field focused (the keyboard up) or holding text or images, or a choice
|
|
751
|
-
armed
|
|
745
|
+
armed (delivery_line.js data-armed; not the queue chip's pressed look, which a
|
|
752
746
|
participant's turn draws with nothing armed). The two rules below share that list: change both. A chip's
|
|
753
747
|
mousedown keeps the focus in the text field, so tapping one doesn't hide the line under the finger. On a bare
|
|
754
748
|
stage an after-turn queued message isn't drawn and the line is hidden too: accepted. */
|
|
755
749
|
body.has-session #deliveryLine{display:none}
|
|
756
|
-
body.has-session #composer:has(:is(#prompt:focus,#prompt:not(:placeholder-shown),#chips:not([hidden]),#deliveryLine[data-armed="1"]
|
|
757
|
-
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}
|
|
758
752
|
}
|
|
759
753
|
/* A line queued for after the running turn: a dashed bubble, a turn of its own to come. */
|
|
760
754
|
.bubble.user.queued[data-delivery="queue"]{border:1px dashed var(--accent-border);border-left:3px dashed var(--accent);background:transparent}
|
|
761
755
|
.thumbs{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
|
|
756
|
+
.thumbs-hidden{margin-top:6px;font-size:12px;color:var(--text-muted)}
|
|
762
757
|
.thumb{max-height:120px;max-width:200px;border-radius:6px;border:1px solid var(--border-strong);cursor:zoom-in;object-fit:contain;background:var(--bg)}
|
|
763
758
|
.activity-row .thumbs{flex-basis:100%;margin-left:var(--row-gutter)}
|
|
764
759
|
@media(max-width:600px){.activity-row .thumbs{margin-left:0}}
|
|
@@ -921,7 +916,7 @@ body.stage-view .turn-stage{position:absolute;left:0;right:0;bottom:100%;margin-
|
|
|
921
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
|
|
922
917
|
two leave the row and the question takes a second line under it. */
|
|
923
918
|
.ts-mini.ts-mini-question{order:1;font-family:inherit;font-size:12.5px;color:var(--text)}
|
|
924
|
-
/* 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
|
|
925
920
|
says where it is ("‹ 1 of 2 ›"), the other waits behind it. */
|
|
926
921
|
.turn-stage .ts-extras>.ts-behind{display:none}
|
|
927
922
|
.ts-pager{flex:none;display:inline-flex;align-items:center;gap:2px;color:var(--text-2)}
|
|
@@ -1355,11 +1350,11 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1355
1350
|
.pp-list{list-style:none;display:flex;flex-direction:column;gap:8px;margin:2px 0}
|
|
1356
1351
|
.pp-row{display:grid;grid-template-columns:1fr auto;gap:2px 8px;padding:6px 8px;border-radius:8px;background:var(--bg-inset);border-left:3px solid var(--author-color)}
|
|
1357
1352
|
.pp-row.ended{opacity:.7}
|
|
1358
|
-
.
|
|
1359
|
-
.
|
|
1353
|
+
.pb-who{display:flex;align-items:center;gap:6px;min-width:0;color:var(--text)}
|
|
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}
|
|
1360
1356
|
.pp-dot{width:7px;height:7px;border-radius:50%;background:var(--text-faint);flex-shrink:0}
|
|
1361
1357
|
.pp-dot.present{background:var(--ok)}
|
|
1362
|
-
.pp-tag{font-size:10.5px;padding:0 6px;border-radius:999px;background:var(--bg-raised);color:var(--text-3)}
|
|
1363
1358
|
.pp-state{font-size:11px;color:var(--text-muted);white-space:nowrap}
|
|
1364
1359
|
.pp-meta{grid-column:1;font-size:11.5px;color:var(--text-muted);font-variant-numeric:tabular-nums}
|
|
1365
1360
|
.pp-capped{color:var(--warn-text);font-weight:600}
|
|
@@ -1385,7 +1380,7 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1385
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)}
|
|
1386
1381
|
.pp-working button:disabled{opacity:.7;cursor:progress}
|
|
1387
1382
|
.pp-link{display:flex;gap:4px}
|
|
1388
|
-
/* 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-). */
|
|
1389
1384
|
.start-settings{gap:10px}
|
|
1390
1385
|
.start-settings .ctx-pop-head strong{font-family:inherit}
|
|
1391
1386
|
.sset-row{display:flex;align-items:flex-start;gap:10px}
|
|
@@ -1394,24 +1389,19 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1394
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}
|
|
1395
1390
|
.sset-seg button:hover{filter:none}
|
|
1396
1391
|
.sset-seg button[aria-pressed="true"]{background:var(--accent-bg);color:var(--accent);border-color:var(--accent-border)}
|
|
1397
|
-
.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}
|
|
1398
1393
|
.sset-ctx-more{margin:-4px 0 0 74px}
|
|
1399
1394
|
.sset-link{padding:2px 4px;border:0;border-radius:5px;background:transparent;color:var(--accent);font-size:12px}
|
|
1400
1395
|
.sset-link:hover{filter:none}
|
|
1401
1396
|
.sset-ctx-form{display:flex;flex-direction:column;gap:8px;margin:0 0 0 74px}
|
|
1402
1397
|
.sset-anyway{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px}
|
|
1403
1398
|
.sset-rule{width:100%;margin:0;border:0;border-top:1px solid var(--border)}
|
|
1404
|
-
.sset-review{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px}
|
|
1405
|
-
.sset-review>.sset-link:first-child{margin-left:-4px}
|
|
1406
|
-
.sset-review-set{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text);font-size:12.5px}
|
|
1407
|
-
.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}
|
|
1408
|
-
.sset-back:hover{filter:none}
|
|
1409
1399
|
.start-settings.sheet{border-radius:14px;padding:14px 16px}
|
|
1410
1400
|
/* Tints only where a pointer hovers: on a touch screen a tapped control would keep it. Every popover's (chip_popover.js)
|
|
1411
1401
|
controls and its opener's :hover tint sit in @media(hover:hover); an open opener shows it by aria-expanded instead. */
|
|
1412
|
-
@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)}}
|
|
1413
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}}
|
|
1414
|
-
@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}}
|
|
1415
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. */
|
|
1416
1406
|
.start-toolkit{gap:8px}
|
|
1417
1407
|
.start-toolkit .ctx-pop-head strong{font-family:inherit}
|
|
@@ -1426,17 +1416,12 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1426
1416
|
.start-toolkit.sheet{border-radius:14px;padding:14px 16px}
|
|
1427
1417
|
.start-toolkit.sheet .st-detail{white-space:normal}
|
|
1428
1418
|
@media(pointer:coarse){.st-row{min-height:40px;align-items:center}}
|
|
1429
|
-
.rs-form{display:flex;flex-direction:column;gap:6px;margin-top:6px}
|
|
1430
|
-
.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}
|
|
1431
|
-
.rs-form textarea:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-ring)}
|
|
1432
1419
|
.pp-link input{flex:1;min-width:0;font-family:ui-monospace,monospace;font-size:11.5px}
|
|
1433
1420
|
.pp-qr{align-self:center;width:164px;height:164px;padding:6px;border-radius:8px;background:var(--on-solid)}
|
|
1434
1421
|
.pp-qr svg{display:block;width:100%;height:100%}
|
|
1435
1422
|
/* On a phone the panel is a sheet: the link goes out by Share or Copy, not by scanning this screen. */
|
|
1436
1423
|
.participants-popover.sheet .pp-qr{display:none}
|
|
1437
1424
|
.pp-foot{display:flex;align-items:center;gap:8px;justify-content:flex-end;padding-top:4px}
|
|
1438
|
-
.pp-view{font-size:12px;color:var(--accent);text-decoration:none}
|
|
1439
|
-
@media(hover:hover){.pp-view:hover{text-decoration:underline}}
|
|
1440
1425
|
/* The Home Screen app's notifications sheet (push_devices.js): the bell opens it; a bottom sheet on a phone. */
|
|
1441
1426
|
.push-devices .ctx-pop-head strong{font-family:inherit}
|
|
1442
1427
|
.push-devices.sheet{border-radius:14px;padding:14px 16px;font-size:14px}
|
|
@@ -2015,9 +2000,41 @@ a{color:var(--accent)}
|
|
|
2015
2000
|
fields in this list (stage.spec.js's phone step checks the visible ones). */
|
|
2016
2001
|
@media (max-width:600px),(pointer:coarse){
|
|
2017
2002
|
#composer textarea,.question-freeform,.continue-reason,.participants-popover input,.participants-popover select,
|
|
2018
|
-
.
|
|
2003
|
+
.pp-link input,.llmctx-field select,.llmctx-field input,.ws-add-in,.rename-input,
|
|
2019
2004
|
#modelSearch,.project-create input{font-size:16px}
|
|
2020
2005
|
}
|
|
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
|
|
2007
|
+
the info line's place; the composer given way to one line (their limit, a stopped session, an ended link); the stage's
|
|
2008
|
+
look while their turn waits for the owner (stage_owner_wait.js). */
|
|
2009
|
+
.plain-brand{font-size:18px;font-weight:700;letter-spacing:.02em;color:var(--accent);padding:1px 4px 2px}
|
|
2010
|
+
#participantWho{display:flex;align-items:baseline;gap:12px;flex:1 1 auto;min-width:0;white-space:nowrap}
|
|
2011
|
+
body.participant-view #sessionTitleRow{flex:0 1 auto}
|
|
2012
|
+
#participantWho .pb-ends{margin-left:auto}
|
|
2013
|
+
.pb-who{display:inline-flex;align-items:center;gap:5px;padding:1px 9px;border-radius:999px;border:1px solid var(--border-strong);background:var(--bg-panel);font-size:12px;color:var(--text-2)}
|
|
2014
|
+
.pb-who b{color:var(--who-color,var(--author-5));font-weight:600}
|
|
2015
|
+
.pb-ends{color:var(--text-faint);font-size:12px}
|
|
2016
|
+
#participantBar{flex:1 1 100%;min-width:0;display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px;color:var(--text-3);padding:2px 0}
|
|
2017
|
+
.pb-pill{display:inline-flex;align-items:center;padding:1px 8px;border-radius:999px;background:var(--bg-raised);color:var(--text-3);white-space:nowrap}
|
|
2018
|
+
.pb-status[data-key]{color:var(--text-2)}
|
|
2019
|
+
.pb-gap{flex:1}
|
|
2020
|
+
.pb-rules{color:var(--text-faint);white-space:nowrap}
|
|
2021
|
+
#participantClosed{padding:12px 14px;color:var(--text-2);font-size:13px;line-height:1.45}
|
|
2022
|
+
#participantClosed b{display:block;color:var(--text);font-weight:600}
|
|
2023
|
+
body.participant-closed :is(#composeGrip,#deliveryLine,#composer,#infoBar){display:none!important}
|
|
2024
|
+
body.participant-view .bubble.user:not(.by-participant)>.origin-label{color:var(--author-owner);text-transform:none;letter-spacing:0;font-weight:600}
|
|
2025
|
+
.ts-owner-wait{margin:4px 0 6px;padding:6px 9px;border-radius:6px;background:var(--warn-bg);border:1px solid var(--warn-border);color:var(--warn-text);font-size:12.5px;line-height:1.4}
|
|
2026
|
+
.ts-owner-wait[hidden]{display:none}
|
|
2027
|
+
.turn-stage.owner-wait{border-left-color:var(--warn)}
|
|
2028
|
+
.turn-stage.owner-wait :is(.ts-now,.ts-trail){display:none}
|
|
2029
|
+
.turn-stage.owner-wait .ts-phase{color:var(--warn-text)}
|
|
2030
|
+
.turn-stage.owner-wait .ts-mark{background:var(--warn);animation:none}
|
|
2031
|
+
@media(max-width:600px){
|
|
2032
|
+
body.participant-view .plain-brand,body.participant-view .pb-ends,body.participant-view .pb-rules{display:none}
|
|
2033
|
+
body.participant-view #sessionTitleRow{flex-basis:auto;order:0}
|
|
2034
|
+
body.participant-view #topBar{flex-wrap:nowrap;align-items:center}
|
|
2035
|
+
/* Their delivery line is its own row over the text field (no session bar's left to lie over). */
|
|
2036
|
+
body.participant-view #deliveryLine.running:not([hidden]){display:flex!important;position:static!important;height:auto!important;padding:6px 2px 0!important}
|
|
2037
|
+
}
|
|
2021
2038
|
</style>
|
|
2022
2039
|
</head>
|
|
2023
2040
|
<body>
|
|
@@ -2074,7 +2091,6 @@ a{color:var(--accent)}
|
|
|
2074
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>
|
|
2075
2092
|
<button type="button" id="thinkingNew" class="llmctx-new think-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
2076
2093
|
<button type="button" id="llmContextNew" class="llmctx-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
2077
|
-
<button type="button" id="reviewNew" class="llmctx-new review-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
2078
2094
|
<button type="button" id="toolkitNew" class="llmctx-new toolkit-new" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
2079
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>
|
|
2080
2096
|
<button type="button" id="toolkitBtn" class="icon-btn toolkit-btn" title="Toolkit" aria-label="Toolkit" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
@@ -142,7 +142,8 @@ export function infoBarModel({ id, state, sessions, chain, cardTitle, badge, res
|
|
|
142
142
|
const tokens = state.timing.tokens;
|
|
143
143
|
const ctxTip = ctxBarTip(tokens, state.timing.memoryIndex,
|
|
144
144
|
{ tokens: state.ctxWindow, source: state.ctxWindowSource, pct: state.ctxPct,
|
|
145
|
-
budget: state.llmContext?.budget_tokens, afterSwitch: state.ctxUnknownAfterSwitch
|
|
145
|
+
budget: state.llmContext?.budget_tokens, afterSwitch: state.ctxUnknownAfterSwitch,
|
|
146
|
+
running },
|
|
146
147
|
state.timing.modelSegments, state.timing.side);
|
|
147
148
|
const speedTextNow = lastSpeedText(tokens);
|
|
148
149
|
const avgSpeed = speedText(tokens?.avg_decode_tps, tokens?.tps_source);
|
|
@@ -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
|
|
|
@@ -18,10 +18,11 @@ export function createMarkdownPlace({
|
|
|
18
18
|
const waiting = new WeakSet();
|
|
19
19
|
|
|
20
20
|
// A text the page already shows as its markdown HTML (POST /api/render,
|
|
21
|
-
// sanitised there), or null: markdown off here
|
|
22
|
-
//
|
|
21
|
+
// sanitised there), or null: markdown off here or no +renderText+ (a
|
|
22
|
+
// viewer without render, viewer.js: no request), or a failed read (the
|
|
23
|
+
// raw text stays).
|
|
23
24
|
function renderMarkdown(text) {
|
|
24
|
-
if (capabilities().display !== true) return Promise.resolve(null);
|
|
25
|
+
if (!renderText || capabilities().display !== true) return Promise.resolve(null);
|
|
25
26
|
return renderText(text)
|
|
26
27
|
.then((d) => (typeof d?.html === "string" && d.html ? d.html : null))
|
|
27
28
|
.catch(() => null);
|
|
@@ -79,7 +80,7 @@ export function createMarkdownPlace({
|
|
|
79
80
|
// on the swap, then the `path:line` ones (linkRefsIn). A null render
|
|
80
81
|
// keeps the text, and the next open asks again.
|
|
81
82
|
function renderStepTexts() {
|
|
82
|
-
if (capabilities().display !== true) return;
|
|
83
|
+
if (!renderText || capabilities().display !== true) return;
|
|
83
84
|
for (const root of roots()) {
|
|
84
85
|
for (const el of root.querySelectorAll(RAW_STEPS)) {
|
|
85
86
|
const step = el.parentElement;
|
|
@@ -7,7 +7,7 @@ export const CLAIM_ROOTS = ".bubble.output, .bubble.user .user-message, .gen-tex
|
|
|
7
7
|
// The owner page's claim links (used by app.js; claim_link.js does the text
|
|
8
8
|
// and DOM work): a claim link opened on this page (#/s/<id>?t=…&q=…, or the
|
|
9
9
|
// participant's #s=<id>&t=… opened in this browser) shown once its session is
|
|
10
|
-
// drawn, and annotate's "Copy link" for a selection.
|
|
10
|
+
// drawn, and annotate's "Copy link" for a selection. A participant's page has
|
|
11
11
|
// its own copies on purpose (docs/internals/web-frontend.md, Two pages).
|
|
12
12
|
//
|
|
13
13
|
// +historyEl+: #history. +store+: the page's session store (selected,
|
|
@@ -22,7 +22,7 @@ export function createOwnerClaim({
|
|
|
22
22
|
// A claim link waiting for its session to be drawn (selectFromHash sets it).
|
|
23
23
|
let pendingClaim = null;
|
|
24
24
|
|
|
25
|
-
// How
|
|
25
|
+
// How a participant's page shows this page's text (claim_link.js).
|
|
26
26
|
function opts() {
|
|
27
27
|
return { home, cwd: store.current.dir || "" };
|
|
28
28
|
}
|
|
@@ -50,8 +50,8 @@ export function createOwnerClaim({
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// Annotate's "Copy link" for a selection in a turn's answer, step or own
|
|
53
|
-
// message:
|
|
54
|
-
// active (it opens in the browser their
|
|
53
|
+
// message: a participant's page's link when the session has a person
|
|
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 }) {
|
|
@@ -12,8 +12,6 @@ import { OWNER_FINAL, verifyTurnOf } from "./verify_target.js";
|
|
|
12
12
|
// verdict's card (verdict_fresh.js), Verify's claim from a selection, and
|
|
13
13
|
// the composer's armed claim (anchor/set/clear: the one holder; the next
|
|
14
14
|
// send makes it a Verify turn).
|
|
15
|
-
// The participant page has its own copies on purpose
|
|
16
|
-
// (docs/internals/web-frontend.md, Two pages).
|
|
17
15
|
//
|
|
18
16
|
// +historyEl+: #history. +store+: the page's session store (it writes
|
|
19
17
|
// current.verdicts and current.verifyFresh through store.update; reads
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// What the main page shows a participant in the owner's bar's places
|
|
2
|
+
// (the participant main page, scenes 1-5), as data and lit views, no page
|
|
3
|
+
// state: participant_main.js feeds it.
|
|
4
|
+
//
|
|
5
|
+
// the top row their name ("Alex · invited") and, on a desktop, when the
|
|
6
|
+
// link ends ("link ends 20 Nov")
|
|
7
|
+
// the bottom the composer card's footer: the status, context %, the
|
|
8
|
+
// row speed (the turn's time while one runs), their spending
|
|
9
|
+
// ("$0.42 of $2.00 used"), and on a desktop what their
|
|
10
|
+
// turns may do ("chi acts under the owner's rules")
|
|
11
|
+
// the closed the composer given way to one line: their limit reached,
|
|
12
|
+
// line the session stopped, the link ended
|
|
13
|
+
//
|
|
14
|
+
// Never the owner's cost, memories, the model or a path: only what the
|
|
15
|
+
// show's viewer (ParticipantShow#participant_main_viewer) and the
|
|
16
|
+
// session's numbers carry. See docs/internals/web-frontend.md (The
|
|
17
|
+
// participant's page).
|
|
18
|
+
import { html, nothing } from "./vendor/lit-html.js";
|
|
19
|
+
import { ctxBarText, speedText, costText } from "./ctx.js";
|
|
20
|
+
import { formatDuration } from "./timing.js";
|
|
21
|
+
|
|
22
|
+
// "20 Nov" (the viewer's locale's day and month) of an ISO time; "" when
|
|
23
|
+
// it doesn't parse.
|
|
24
|
+
export function endsText(iso) {
|
|
25
|
+
const at = Date.parse(iso || "");
|
|
26
|
+
if (!Number.isFinite(at)) return "";
|
|
27
|
+
return new Date(at).toLocaleDateString(undefined, { day: "numeric", month: "short" });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// "$0.42 of $2.00 used", "$0.42 used" without a cap; "" when their grant's
|
|
31
|
+
// exposure doesn't show the spend.
|
|
32
|
+
export function spentText(usage) {
|
|
33
|
+
const spent = Number(usage?.spent);
|
|
34
|
+
if (usage?.spent == null || !Number.isFinite(spent)) return "";
|
|
35
|
+
const shown = spent > 0 ? costText(spent) : "$0.00";
|
|
36
|
+
const cap = Number(usage?.cap);
|
|
37
|
+
return usage?.cap != null && Number.isFinite(cap) ? `${shown} of ${money(cap)} used` : `${shown} used`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const money = (value) => `$${Number(value).toFixed(2)}`;
|
|
41
|
+
|
|
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" };
|
|
44
|
+
|
|
45
|
+
// The bottom row's items: [{key, text, tip}].
|
|
46
|
+
// status "idle" | "running" | "waiting"
|
|
47
|
+
// ctxPct the context's fill (store.current.ctxPct), windowSource its window's source
|
|
48
|
+
// speed {decode_tps, source} of the last generation, or null
|
|
49
|
+
// turnMs the running turn's time so far, or null
|
|
50
|
+
// usage the show's viewer.usage
|
|
51
|
+
// mode the show's viewer.mode
|
|
52
|
+
export function barItems({ status, ctxPct = null, windowSource = null, speed = null, turnMs = null, usage = null, mode = null }) {
|
|
53
|
+
const items = [{ key: "status", text: status, tip: STATUS_TIPS[status] || "" }];
|
|
54
|
+
items.push({ key: "ctx", text: ctxBarText(ctxPct, windowSource), tip: "How full the session's context is" });
|
|
55
|
+
if (turnMs != null) items.push({ key: "time", text: formatDuration(turnMs), tip: "This turn's time so far" });
|
|
56
|
+
else {
|
|
57
|
+
const tps = speedText(speed?.decode_tps, speed?.source);
|
|
58
|
+
if (tps) items.push({ key: "speed", text: tps, tip: "Decode speed of the last generation" });
|
|
59
|
+
}
|
|
60
|
+
const spent = spentText(usage);
|
|
61
|
+
if (spent) items.push({ key: "spent", text: spent, tip: "What your turns have cost, of the limit the owner set for you" });
|
|
62
|
+
const rules = RULES_TEXT[mode] || "";
|
|
63
|
+
return { items, rules };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const STATUS_TIPS = {
|
|
67
|
+
idle: "No turn runs now",
|
|
68
|
+
running: "A turn runs now",
|
|
69
|
+
waiting: "The running turn waits for the owner",
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export function barTemplate({ items, rules }) {
|
|
73
|
+
return html`${items.map((item) => html`<span class=${`pb-pill pp-${item.key}`} data-key=${item.key} title=${item.tip || nothing}>${item.text}</span>`)}<span class="pb-gap"></span>${rules ? html`<span class="pb-rules">${rules}</span>` : nothing}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// The top row's chip and the link's end.
|
|
77
|
+
// +color+: their author colour (participant_model.js authorColor), as their badges.
|
|
78
|
+
export function whoTemplate({ name, endsAt, color = null }) {
|
|
79
|
+
const ends = endsText(endsAt);
|
|
80
|
+
return html`<span class="pb-who" title="You were invited to this session by its owner" style=${color ? `--who-color:${color}` : nothing}><b>${name || "you"}</b> · invited</span>${ends ? html`<span class="pb-ends" title=${`This link stops working on ${ends}`}>link ends ${ends}</span>` : nothing}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// The closed composer's line, or null when the composer stays:
|
|
84
|
+
// capReached the show's viewer.cap_reached (or a send refused for it)
|
|
85
|
+
// usage the show's viewer.usage (the cap's amount)
|
|
86
|
+
// refusal {code, text}: the server's words for a send refused as
|
|
87
|
+
// session_stopped, or the link that ended (token_revoked,
|
|
88
|
+
// token_expired, token_outdated): shown as they are
|
|
89
|
+
// → {kind, title, text}
|
|
90
|
+
export function closedLine({ capReached = false, usage = null, refusal = null } = {}) {
|
|
91
|
+
if (refusal?.text) {
|
|
92
|
+
const text = String(refusal.text);
|
|
93
|
+
return { kind: refusal.code || "refused", title: `${text[0].toUpperCase()}${text.slice(1)}${/[.!?]$/.test(text) ? "" : "."}`, text: "You can keep reading." };
|
|
94
|
+
}
|
|
95
|
+
if (!capReached) return null;
|
|
96
|
+
const cap = Number(usage?.cap);
|
|
97
|
+
const amount = usage?.cap != null && Number.isFinite(cap) ? `the ${money(cap)}` : "the limit";
|
|
98
|
+
return { kind: "cap_reached", title: `You have used ${amount} the owner set for you.`, text: "You can keep reading. Ask the owner to raise the limit to send more." };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function closedTemplate(line) {
|
|
102
|
+
return html`<b>${line.title}</b>${line.text}`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// The codes of a refused send that close the composer (the rest are a
|
|
106
|
+
// toast with the server's words): their state, not this message's.
|
|
107
|
+
export const CLOSING_CODES = Object.freeze(["cap_reached", "session_stopped", "token_revoked", "token_expired", "token_outdated"]);
|