samagotchi 0.168.0 → 0.170.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 +53 -1
- data/docs/architecture.md +1 -1
- data/docs/configuration.md +1 -1
- data/docs/guardrails.md +2 -2
- data/docs/hooks.md +2 -2
- data/docs/internals/block-renderers.md +1 -1
- data/docs/internals/bridge.md +19 -4
- data/docs/internals/inline-widgets.md +1 -1
- data/docs/internals/objectives.md +2 -1
- data/docs/internals/remote-sessions.md +1 -1
- data/docs/internals/web-frontend.md +72 -29
- data/docs/internals/working-set.md +2 -1
- data/docs/plugins.md +1 -1
- data/docs/releasing.md +13 -7
- data/docs/testing.md +22 -5
- data/lib/samagotchi/bridge.rb +25 -2
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/client_id.rb +3 -0
- data/lib/samagotchi/command_intake.rb +7 -7
- data/lib/samagotchi/compat.rb +14 -5
- data/lib/samagotchi/engine/events.rb +9 -0
- data/lib/samagotchi/engine/objectives.rb +10 -1
- data/lib/samagotchi/engine.rb +1 -1
- data/lib/samagotchi/event_fanout.rb +4 -7
- data/lib/samagotchi/guardrails/approvals.rb +8 -3
- data/lib/samagotchi/session_continue.rb +8 -11
- data/lib/samagotchi/session_manager/removal.rb +3 -3
- data/lib/samagotchi/session_stores.rb +79 -0
- data/lib/samagotchi/turn_stages/objectives.rb +6 -8
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +17 -2
- data/lib/samagotchi/web/public/app.js +4 -1
- data/lib/samagotchi/web/public/block_watch.js +1 -1
- data/lib/samagotchi/web/public/cards_place.js +5 -1
- data/lib/samagotchi/web/public/index.html +67 -39
- data/lib/samagotchi/web/public/live_timing.js +5 -3
- data/lib/samagotchi/web/public/markdown_place.js +1 -1
- data/lib/samagotchi/web/public/question_cards.js +30 -7
- data/lib/samagotchi/web/public/stage_asking.js +283 -0
- data/lib/samagotchi/web/public/stage_frame.js +8 -12
- data/lib/samagotchi/web/public/stage_model.js +47 -14
- data/lib/samagotchi/web/public/stage_opened.js +33 -20
- data/lib/samagotchi/web/public/stage_slots.js +13 -89
- data/lib/samagotchi/web/public/stage_view.js +235 -170
- data/lib/samagotchi/web/public/stage_waiting.js +180 -0
- data/lib/samagotchi/web/public/stream_handlers.js +1 -1
- data/lib/samagotchi/web/public/turn_model.js +1 -1
- data/lib/samagotchi/web/session_control.rb +3 -1
- data/lib/samagotchi/web/session_hub.rb +16 -0
- data/lib/samagotchi/web/session_show.rb +14 -4
- data/lib/samagotchi/worker.rb +3 -4
- metadata +4 -1
|
@@ -49,10 +49,10 @@ body{font-family: ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetic
|
|
|
49
49
|
/* A session that waits on the user (a question, an approval, a card with actions): the warning colour of its question card, also when active or hovered. */
|
|
50
50
|
#topStrip .card.waiting,#allList .card.waiting{border-color:color-mix(in srgb,var(--warn) 75%,transparent)}
|
|
51
51
|
@media(hover:hover){#topStrip .card.waiting:hover,#allList .card.waiting:hover{border-color:var(--warn)}}
|
|
52
|
-
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.turn-stage,#topStrip .card,#allList .card,#allHead input{background:var(--bg-panel)}.bubble.question{background:
|
|
53
|
-
@media (prefers-reduced-transparency:reduce){.turn-stage,#topStrip .card,#allList .card,#allHead input{background:var(--bg-panel);-webkit-backdrop-filter:none;backdrop-filter:none}.bubble.question{background:
|
|
52
|
+
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.turn-stage,#topStrip .card,#allList .card,#allHead input{background:var(--bg-panel)}.bubble.question{background:var(--bg-panel)}.bubble.plugin-card{background:color-mix(in srgb,var(--accent) 6%,var(--bg-panel))}}
|
|
53
|
+
@media (prefers-reduced-transparency:reduce){.turn-stage,#topStrip .card,#allList .card,#allHead input{background:var(--bg-panel);-webkit-backdrop-filter:none;backdrop-filter:none}.bubble.question{background:var(--bg-panel);-webkit-backdrop-filter:none;backdrop-filter:none}.bubble.plugin-card{background:color-mix(in srgb,var(--accent) 6%,var(--bg-panel));-webkit-backdrop-filter:none;backdrop-filter:none}}
|
|
54
54
|
body.no-glass .turn-stage,body.no-glass #topStrip .card,body.no-glass #allList .card,body.no-glass #allHead input{background:var(--bg-panel);-webkit-backdrop-filter:none;backdrop-filter:none}
|
|
55
|
-
body.no-glass .bubble.question{background:
|
|
55
|
+
body.no-glass .bubble.question{background:var(--bg-panel);-webkit-backdrop-filter:none;backdrop-filter:none}
|
|
56
56
|
body.no-glass .bubble.plugin-card{background:color-mix(in srgb,var(--accent) 6%,var(--bg-panel));-webkit-backdrop-filter:none;backdrop-filter:none}
|
|
57
57
|
button,input,textarea,select{font:inherit}
|
|
58
58
|
button{background:var(--primary);border:0;color:var(--on-solid);padding:8px 12px;border-radius:8px;cursor:pointer;transition:filter .12s ease,background .12s ease}
|
|
@@ -426,36 +426,44 @@ button.system-one-wrong,.system-one-wrong.marked{flex:none;padding:1px 6px;borde
|
|
|
426
426
|
.gen:not(.live) .gen-text{font-size:14px;color:var(--text-2)}
|
|
427
427
|
.gen-text:empty{display:none}
|
|
428
428
|
.gen .activity-body{margin-top:6px}
|
|
429
|
-
/* One gen, no thinking, no tool rows: nothing to stack yet, so the narration streams like a plain answer bubble. A step that closed with text (a line steered in after it, its answer gone from the block) is a row: its summary is the way to its text.
|
|
430
|
-
|
|
431
|
-
.turn-work:not(
|
|
432
|
-
.turn-work:not(:has(.gen~.gen,.thinking-body,.activity-body,.gen:not(.live)>.gen-text)) .gen{
|
|
433
|
-
.turn-work:not(:has(.gen~.gen,.thinking-body,.activity-body,.gen:not(.live)>.gen-text)) .gen
|
|
429
|
+
/* One gen, no thinking, no tool rows: nothing to stack yet, so the narration streams like a plain answer bubble. A step that closed with text (a line steered in after it, its answer gone from the block) is a row: its summary is the way to its text. So is a running turn's block opened in the
|
|
430
|
+
history (data-opened-turn, stage_asking.js openTurn): the step's text is in it while a card without a lead-in waits. */
|
|
431
|
+
.turn-work:not([data-opened-turn]):not(:has(.gen~.gen,.thinking-body,.activity-body,.gen:not(.live)>.gen-text)){border:0;padding:0;background:transparent}
|
|
432
|
+
.turn-work:not([data-opened-turn]):not(:has(.gen~.gen,.thinking-body,.activity-body,.gen:not(.live)>.gen-text))>summary,.turn-work:not([data-opened-turn]):not(:has(.gen~.gen,.thinking-body,.activity-body,.gen:not(.live)>.gen-text)) .gen>summary{display:none}
|
|
433
|
+
.turn-work:not([data-opened-turn]):not(:has(.gen~.gen,.thinking-body,.activity-body,.gen:not(.live)>.gen-text)) .gen{margin:0;padding:0;border:0;background:transparent}
|
|
434
|
+
.turn-work:not([data-opened-turn]):not(:has(.gen~.gen,.thinking-body,.activity-body,.gen:not(.live)>.gen-text)) .gen-text{margin:0;background:var(--bg-panel);border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:12px;padding:12px 14px;opacity:.95}
|
|
434
435
|
@media(max-width:600px){.gen{--step-indent:8px}}
|
|
435
|
-
/* A question card asks for input like the composer card, so it wears the same glass (the recipe above)
|
|
436
|
-
|
|
436
|
+
/* A question card asks for input like the composer card, so it wears the same glass (the recipe above), no amber: what
|
|
437
|
+
waits says so in the stage's status row ("waiting for you", its dot) and on a waiting lead-in bubble. */
|
|
438
|
+
.bubble.question{border-left:3px solid var(--border-strong);padding:10px 12px}
|
|
437
439
|
/* Collapsed (resolved) question: one line, like the thinking and activity blocks.
|
|
438
|
-
The left bar
|
|
440
|
+
The left bar is neutral here; the existing answered/cancelled/denied classes
|
|
439
441
|
(which apply whether open or not) recolour it once resolved. */
|
|
440
442
|
.bubble.question:not([open]){padding:3px 10px;background:transparent;border-color:transparent;box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none;align-self:flex-start;border-radius:6px;transition:background .12s ease}
|
|
441
|
-
.bubble.question:not([open]){border-left-color:var(--
|
|
443
|
+
.bubble.question:not([open]){border-left-color:var(--border-strong)}
|
|
442
444
|
@media(hover:hover){.bubble.question:not([open]):hover{background:var(--bg-panel)}}
|
|
443
445
|
.bubble.question:not([open])>summary{font-size:12px;font-weight:500}
|
|
444
446
|
.bubble.question>summary{cursor:pointer;color:var(--text-muted);font-size:13px;font-weight:600;user-select:none;list-style:none}
|
|
445
447
|
.bubble.question>summary::-webkit-details-marker{display:none}
|
|
446
|
-
.bubble.question>summary::before{content:"▸ ";color:var(--
|
|
448
|
+
.bubble.question>summary::before{content:"▸ ";color:var(--text-faint)}
|
|
447
449
|
.bubble.question[open]>summary::before{content:"▾ "}
|
|
448
450
|
/* An answered card keeps the reply that asked it (question_cards.js): muted under its "Q → A" line, two lines while
|
|
449
451
|
closed (newlines as spaces); open, the summary's copy goes and the body's starts the card, whole, as written and
|
|
450
452
|
selectable. */
|
|
451
453
|
.bubble.question>summary .question-said{max-width:72ch;margin:2px 0 1px 1.05em;font-size:12.5px;font-weight:400;line-height:1.5;color:var(--text-muted);white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden}
|
|
452
454
|
.bubble.question[open]>summary .question-said{display:none}
|
|
455
|
+
.bubble.question.approval>summary.approval-said{display:grid;grid-template-columns:1.05em minmax(0,1fr)}
|
|
456
|
+
.bubble.question.approval>summary.approval-said .question-said{grid-column:2;grid-row:1;max-width:none;margin:0}
|
|
457
|
+
.bubble.question.approval>summary.approval-said .question-summary-text{grid-column:2;grid-row:2}
|
|
453
458
|
/* A turn opened in the history (stage_opened.js): while the turn runs, a card answered under its reason doesn't repeat it;
|
|
454
459
|
the reason goes at the hand-off and the card's clamp says it then. The card's way back to its reason sits at the right of its
|
|
455
460
|
title line while it waits. */
|
|
456
461
|
.bubble.said+.bubble.question :is(.question-said,.question-said-full){display:none}
|
|
457
462
|
/* Its asking step in the steps block doesn't repeat the reason either (stage_opened.js data-said, until the hand-off). */
|
|
458
463
|
.turn-work>details.gen[data-said]>.gen-text{display:none}
|
|
464
|
+
/* A card that waits in the stage has no toggle of its own (stage_view.js): the stage's fold is the one. */
|
|
465
|
+
.turn-stage .bubble.question:not(.answered):not(.cancelled)>summary{cursor:default}
|
|
466
|
+
.turn-stage .bubble.question:not(.answered):not(.cancelled)>summary::before{content:none}
|
|
459
467
|
.question-reason-link{float:right;margin-left:12px;padding:0;border:0;background:none;color:var(--accent);font-size:12.5px;font-weight:500;line-height:inherit}
|
|
460
468
|
@media(hover:hover){.question-reason-link:hover:not(:disabled){filter:none;text-decoration:underline}}
|
|
461
469
|
/* The reply that asked the model's own question, a conversation bubble while its turn runs (live only): a label line ("chi ·
|
|
@@ -479,19 +487,13 @@ button.system-one-wrong,.system-one-wrong.marked{flex:none;padding:1px 6px;borde
|
|
|
479
487
|
--md-strong-color:currentColor;--md-blockquote-color:currentColor;--md-code-color:currentColor;
|
|
480
488
|
--md-pre-size:12px;--md-cell-size:12.5px
|
|
481
489
|
}
|
|
482
|
-
.ts-asking.md-compact{
|
|
483
|
-
--md-heading-size:14.5px;--md-heading-color:var(--text-bright);
|
|
484
|
-
--md-subheading-size:14px;--md-subheading-color:var(--text-2);
|
|
485
|
-
--md-strong-color:var(--text-bright);--md-blockquote-color:var(--text-muted);--md-code-color:var(--text);
|
|
486
|
-
--md-pre-size:12.5px;--md-cell-size:13px
|
|
487
|
-
}
|
|
488
490
|
.gen-text.md-compact{
|
|
489
491
|
--md-heading-size:14.5px;--md-heading-color:var(--text);
|
|
490
492
|
--md-subheading-size:14px;--md-subheading-color:var(--text-2);
|
|
491
493
|
--md-strong-color:var(--text);--md-blockquote-color:var(--text-muted);--md-code-color:var(--text);
|
|
492
494
|
--md-pre-size:12.5px;--md-cell-size:13px
|
|
493
495
|
}
|
|
494
|
-
.md-compact:is(.
|
|
496
|
+
.md-compact:is(.question-said-full,.gen-text,.said-text){white-space:normal}
|
|
495
497
|
.md-compact :is(h1,h2,h3,h4,h5,h6){font-size:var(--md-heading-size);font-weight:600;line-height:1.4;margin:8px 0 2px;color:var(--md-heading-color)}
|
|
496
498
|
.md-compact :is(h4,h5,h6){font-size:var(--md-subheading-size);color:var(--md-subheading-color)}
|
|
497
499
|
.md-compact :is(p,ul,ol,blockquote,table,pre){margin:0 0 6px}
|
|
@@ -541,7 +543,7 @@ button.system-one-wrong,.system-one-wrong.marked{flex:none;padding:1px 6px;borde
|
|
|
541
543
|
.question-option{display:flex;gap:8px;align-items:center;font-size:13px;color:var(--text-2);padding:6px 8px;border:1px solid var(--border);border-radius:8px;cursor:pointer}
|
|
542
544
|
@media(hover:hover){.question-option:hover{background:var(--bg-hover)}}
|
|
543
545
|
.question-option.selected{border-color:var(--ok);color:var(--text)}
|
|
544
|
-
.question-option input{margin:0;accent-color:var(--
|
|
546
|
+
.question-option input{margin:0;accent-color:var(--accent)}
|
|
545
547
|
/* The model's recommended option (a label ending in "(Recommended)"): an accent row and a small tag. */
|
|
546
548
|
.question-option.recommended{border-color:var(--accent-border);background:var(--accent-bg);color:var(--text)}
|
|
547
549
|
.question-option.recommended.selected{border-color:var(--ok)}
|
|
@@ -558,7 +560,7 @@ button.system-one-wrong,.system-one-wrong.marked{flex:none;padding:1px 6px;borde
|
|
|
558
560
|
.bubble.question.cancelled .question-result{color:var(--text-muted)}
|
|
559
561
|
.question-submit{align-self:flex-end;font-size:13px}
|
|
560
562
|
.question-dismiss{font-size:13px;margin-left:8px}
|
|
561
|
-
.bubble.question.approval{border-left-color:var(--
|
|
563
|
+
.bubble.question.approval{border-left-color:var(--border-strong)}
|
|
562
564
|
.bubble.question.approval.answered:not(.denied){border-left-color:var(--ok)}
|
|
563
565
|
.bubble.question.approval:not([open]){background:transparent}
|
|
564
566
|
@media(hover:hover){.bubble.question.approval:not([open]):hover{background:var(--bg-panel)}}
|
|
@@ -575,9 +577,9 @@ button.system-one-wrong,.system-one-wrong.marked{flex:none;padding:1px 6px;borde
|
|
|
575
577
|
.question-relayed.hidden{display:none}
|
|
576
578
|
.question-relayed a{color:var(--text);font-weight:600}
|
|
577
579
|
.approval-tool{font-weight:700;color:var(--text);margin-bottom:4px}
|
|
578
|
-
|
|
580
|
+
/* What it approves, neutral like the card (no amber on question cards): the command in the code's own box. */
|
|
581
|
+
.approval-what{margin:0 0 6px;padding:8px 10px;background:var(--bg-inset);border:1px solid var(--border);border-radius:6px;white-space:pre-wrap;word-break:break-all;color:var(--text-2);font-size:12.5px}
|
|
579
582
|
.approval-where,.approval-why{font-size:12px;color:var(--text-muted);overflow-wrap:anywhere}
|
|
580
|
-
.approval-why{color:var(--warn-text)}
|
|
581
583
|
.approval-label{color:var(--text-faint)}
|
|
582
584
|
/* A diff (diff_view.js): the approval card's dry run and a tool row's change. */
|
|
583
585
|
.approval-diff{margin:0 0 6px}
|
|
@@ -841,7 +843,9 @@ body.stage-view .turn-stage{position:absolute;left:0;right:0;bottom:100%;margin-
|
|
|
841
843
|
.turn-stage[hidden]{display:none}
|
|
842
844
|
.turn-stage.ended{border-left-color:var(--border-strong)}
|
|
843
845
|
.turn-stage[data-phase="answered"]{border-left-color:var(--ok)}
|
|
844
|
-
.turn-stage[data-phase="canceled"]
|
|
846
|
+
.turn-stage[data-phase="canceled"]{border-left-color:var(--warn)}
|
|
847
|
+
/* A card waits: the box has no amber edge (the status row's word and dot say it). */
|
|
848
|
+
.turn-stage[data-phase="waiting for you"]{border-left-color:var(--border-strong)}
|
|
845
849
|
.turn-stage[data-phase="failed"]{border-left-color:var(--danger)}
|
|
846
850
|
.turn-stage[data-phase="no answer"]{border-left-color:var(--warn)}
|
|
847
851
|
.turn-stage.enter{animation:ts-rise .35s cubic-bezier(.3,.7,.2,1)}
|
|
@@ -866,6 +870,9 @@ body.stage-view .turn-stage{position:absolute;left:0;right:0;bottom:100%;margin-
|
|
|
866
870
|
.ts-timing{min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
867
871
|
.ts-timing .turn-timing{margin:0;font-size:12px;color:var(--text-muted);display:inline}
|
|
868
872
|
.ts-mini{min-width:0;overflow:hidden;text-overflow:ellipsis;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--text-2)}
|
|
873
|
+
.ts-mini.ts-mini-timed{display:flex}
|
|
874
|
+
.ts-mini-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
875
|
+
.ts-mini-clock{flex:none}
|
|
869
876
|
.ts-defer{color:var(--text-faint);font-style:italic;opacity:0;transition:opacity .2s}
|
|
870
877
|
.turn-stage.ended.in-use .ts-defer{opacity:1}
|
|
871
878
|
/* Stop turn (stage_view.js): a ghost in the danger colour at the row's right edge, beside the fold; the fold keeps the edge when it is hidden. */
|
|
@@ -900,21 +907,36 @@ body.stage-view .turn-stage{position:absolute;left:0;right:0;bottom:100%;margin-
|
|
|
900
907
|
.ts-headline.thinking{font-size:13.5px;font-style:italic;color:var(--text-muted)}
|
|
901
908
|
.ts-think-tag{font-style:normal;font-size:12.5px;color:var(--think-text);margin-right:6px}
|
|
902
909
|
.ts-headline.fresh{animation:ts-fade .3s ease}
|
|
903
|
-
/*
|
|
904
|
-
|
|
905
|
-
its room, read from the top. */
|
|
906
|
-
.ts-asking{max-height:calc(var(--stage-max,60vh) * .35);overflow:auto;scrollbar-width:thin;white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.55;color:var(--narr);border-left:2px solid var(--border-strong);padding-left:10px}
|
|
907
|
-
/* The asking form (stage_view.js, a turn opened in the history while the model's own question waits): its reply is a
|
|
908
|
-
bubble in the conversation (.bubble.said), the stage shows the status row and the card alone; the prompt, the live
|
|
910
|
+
/* The asking form (stage_view.js, a card docked: its turn opened in the history, a reply before chi's own question or
|
|
911
|
+
approval a bubble there, .bubble.said): the stage shows the status row and the card alone; the prompt, the live
|
|
909
912
|
slots (the working set's rail with them) and the steps chip come back with the working form after the answer. */
|
|
910
913
|
.turn-stage.asking-form :is(.ts-prompt,.ts-live,.ts-foot){display:none}
|
|
911
|
-
/* It is one box (the mock-up's option A): the stage's frame takes the card's look (
|
|
912
|
-
|
|
913
|
-
box
|
|
914
|
-
.turn-stage.asking-form{background:
|
|
914
|
+
/* It is one box (the mock-up's option A): the stage's frame takes the card's look (opaque, no glass, no amber: the status
|
|
915
|
+
row's "waiting for you" and its dot say it waits), the status row is the box's first line, and the card inside drops
|
|
916
|
+
its own box, so there is no box in a box. */
|
|
917
|
+
.turn-stage.asking-form{background:var(--bg-panel);-webkit-backdrop-filter:none;backdrop-filter:none;border-radius:12px}
|
|
915
918
|
.turn-stage.asking-form .ts-scroll{padding-top:6px}
|
|
916
|
-
.turn-stage.asking-form .ts-extras
|
|
917
|
-
|
|
919
|
+
.turn-stage.asking-form .ts-extras>:is(.bubble.question,.bubble.plugin-card:not(.warn)){border:0;border-radius:0;background:transparent;padding:0}
|
|
920
|
+
/* The asking form folded (stage_view.js, its fold is that question's only): the status row says "waiting for you" and the
|
|
921
|
+
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
|
+
two leave the row and the question takes a second line under it. */
|
|
923
|
+
.ts-mini.ts-mini-question{order:1;font-family:inherit;font-size:12.5px;color:var(--text)}
|
|
924
|
+
/* Two cards docked (stage_view.js drawDocked): one at a time, the one that stops chi in front; the pager after the phase
|
|
925
|
+
says where it is ("‹ 1 of 2 ›"), the other waits behind it. */
|
|
926
|
+
.turn-stage .ts-extras>.ts-behind{display:none}
|
|
927
|
+
.ts-pager{flex:none;display:inline-flex;align-items:center;gap:2px;color:var(--text-2)}
|
|
928
|
+
.ts-pager[hidden]{display:none}
|
|
929
|
+
.ts-page{flex:none;min-width:22px;height:22px;padding:0 4px;border-radius:6px;background:transparent;color:var(--text-muted);font-size:14px;line-height:1}
|
|
930
|
+
.ts-page:disabled{opacity:.35}
|
|
931
|
+
@media(hover:hover){.ts-page:hover:not(:disabled){filter:none;background:var(--bg-hover);color:var(--text)}}
|
|
932
|
+
.ts-page-label{font-variant-numeric:tabular-nums}
|
|
933
|
+
/* check-in docked while nothing blocks (stage_view.js .asks-live): the row says the running call right after the phase,
|
|
934
|
+
then the turn's time; the step count is the history's steps line. The live step's text streams under the card. */
|
|
935
|
+
.turn-stage.asks-live .ts-status>:not(.ts-mark,.ts-phase,.ts-mini){order:2}
|
|
936
|
+
.turn-stage.asks-live .ts-mini{order:1}
|
|
937
|
+
.turn-stage.asks-live .ts-step{display:none}
|
|
938
|
+
.ts-asks-text{padding-top:8px;border-top:1px dashed var(--border-strong);white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.55;color:var(--text)}
|
|
939
|
+
.turn-stage.asking-form.collapsed .ts-status>:not(.ts-mark,.ts-phase,.ts-mini){order:2}
|
|
918
940
|
@keyframes ts-fade{from{opacity:.35}}
|
|
919
941
|
.ts-now{height:var(--ts-now-h);display:flex;align-items:center;gap:8px;min-width:0;padding:0 9px;border-radius:8px;background:var(--accent-tint);font-size:13px}
|
|
920
942
|
.ts-spin{flex:none;width:11px;height:11px;border:2px solid var(--warn);border-right-color:transparent;border-radius:50%;animation:init-spin .8s steps(16) infinite}
|
|
@@ -974,7 +996,7 @@ body.stage-view .turn-stage{position:absolute;left:0;right:0;bottom:100%;margin-
|
|
|
974
996
|
:is(.ts-extras>.bubble.user,.ts-prompt:not(.full)>.bubble.user)>.user-message.markdown :is(hr,img,.copy-btn){display:none}
|
|
975
997
|
/* Inside the dock's own blur a second backdrop-filter sees nothing: the cards are opaque here (as #commandList is). */
|
|
976
998
|
.turn-stage .bubble.question,.turn-stage .bubble.plugin-card{-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none}
|
|
977
|
-
.turn-stage .bubble.question{background:
|
|
999
|
+
.turn-stage .bubble.question{background:var(--bg-panel)}
|
|
978
1000
|
.turn-stage .bubble.plugin-card{background:color-mix(in srgb,var(--accent) 6%,var(--bg-panel))}
|
|
979
1001
|
.turn-stage .bubble.plugin-card.warn{background:color-mix(in srgb,var(--warn) 7%,var(--bg-panel))}
|
|
980
1002
|
.ts-answer{display:flex;flex-direction:column;gap:8px}
|
|
@@ -1194,7 +1216,13 @@ button.ws-row:hover:not(:disabled){filter:none}@media(hover:hover){button.ws-row
|
|
|
1194
1216
|
/* The quiet signal's short text on a phone; in the status row it takes the step's and the mini tool's room. */
|
|
1195
1217
|
.ts-stall .long{display:none}
|
|
1196
1218
|
.ts-stall .short{display:inline}
|
|
1197
|
-
.turn-stage.stalled:is(.collapsed,.plain) :is(.ts-step,.ts-mini){display:none}
|
|
1219
|
+
.turn-stage.stalled:is(.collapsed,.plain) :is(.ts-step,.ts-mini:not(.ts-mini-question)){display:none}
|
|
1220
|
+
.turn-stage.asking-form.collapsed .ts-status{flex-wrap:wrap;row-gap:4px}
|
|
1221
|
+
.turn-stage.asking-form.collapsed :is(.ts-step,.ts-timing){display:none}
|
|
1222
|
+
.ts-mini.ts-mini-question{order:3;flex-basis:100%}
|
|
1223
|
+
.turn-stage.asks-live .ts-status{flex-wrap:wrap;row-gap:4px}
|
|
1224
|
+
.turn-stage.asks-live .ts-timing{display:none}
|
|
1225
|
+
.turn-stage.asks-live .ts-mini.ts-mini-timed{flex-basis:100%}
|
|
1198
1226
|
/* An approval's Submit in sight on a phone: its folder, reason and rows a little tighter. */
|
|
1199
1227
|
.approval-where,.approval-why{line-height:1.35}
|
|
1200
1228
|
.bubble.question.approval .question-option{padding:5px 8px}
|
|
@@ -10,11 +10,12 @@ import { elapsedSince, liveDurationText, turnTimingText } from "./timing.js";
|
|
|
10
10
|
// the stage's status row already says the turn runs, so the line drops its
|
|
11
11
|
// own "running" there. The duration is the live one (never "0ms": under a
|
|
12
12
|
// second it shows tenths).
|
|
13
|
-
export function liveLineText({ number, startedAt, note = "", inStage = false }, now = Date.now()) {
|
|
13
|
+
export function liveLineText({ number, startedAt, note = "", inStage = false, toolRunning = false }, now = Date.now()) {
|
|
14
14
|
const duration = elapsedSince(startedAt, now);
|
|
15
15
|
if (duration === null) return null;
|
|
16
16
|
const turn = Number.isInteger(number) && number > 0 ? `turn ${number}` : "turn";
|
|
17
|
-
|
|
17
|
+
const elapsed = inStage && toolRunning ? "" : ` · ${liveDurationText(duration)}`;
|
|
18
|
+
return `${turn}${!inStage ? " running" : ""}${elapsed}${note ? ` · ${note}` : ""}`;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
// The live ticker's interval at +elapsedMs+ into the turn: 200 ms during the
|
|
@@ -39,6 +40,7 @@ export function lineRecord(records, turnId) {
|
|
|
39
40
|
export function createLiveTiming({
|
|
40
41
|
timing,
|
|
41
42
|
place,
|
|
43
|
+
stageToolRunning = () => false,
|
|
42
44
|
makeLine = () => document.createElement("div"),
|
|
43
45
|
onTick = () => {},
|
|
44
46
|
now = () => Date.now(),
|
|
@@ -81,7 +83,7 @@ export function createLiveTiming({
|
|
|
81
83
|
|
|
82
84
|
function tick() {
|
|
83
85
|
const startedAt = timing().activeTurn?.started_at;
|
|
84
|
-
const text = liveLineText({ number, startedAt, note, inStage }, now());
|
|
86
|
+
const text = liveLineText({ number, startedAt, note, inStage, toolRunning: stageToolRunning() }, now());
|
|
85
87
|
if (el && text !== null) el.textContent = text;
|
|
86
88
|
onTick();
|
|
87
89
|
// The interval follows the elapsed time: 200 ms while the line counts
|
|
@@ -36,7 +36,7 @@ export function createMarkdownPlace({
|
|
|
36
36
|
pairAnswerRefs(el);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// The refs in one rendered text (
|
|
39
|
+
// The refs in one rendered text (a lead-in bubble, a kept reply),
|
|
40
40
|
// as linkTextRefs links the answers': a plugin's +refs+ first
|
|
41
41
|
// (pairRefsIn), then the `path:line` ones.
|
|
42
42
|
function linkRefsIn(el, refs) {
|
|
@@ -24,6 +24,7 @@ import { clientLabel, isOwn } from "./turn_events.js";
|
|
|
24
24
|
import { continueLine } from "./commands.js";
|
|
25
25
|
import { plainText } from "./plain_line.js";
|
|
26
26
|
import { noContactFill } from "./no_contact_fill.js";
|
|
27
|
+
import { CONTINUE_KEY, questionKey } from "./stage_waiting.js";
|
|
27
28
|
|
|
28
29
|
// A card's text fields' name: not a contact field (no_contact_fill.js).
|
|
29
30
|
const CARD_NOTE = "chi-card-note";
|
|
@@ -35,8 +36,9 @@ const CARD_NOTE = "chi-card-note";
|
|
|
35
36
|
// @param isNearBottom () => whether the history follows its end
|
|
36
37
|
// @param scrollToEnd () scrolls the history to its end
|
|
37
38
|
// @param removeHintIfEmpty () drops the history's placeholder hint
|
|
38
|
-
// @param askingText () => the running turn's
|
|
39
|
-
//
|
|
39
|
+
// @param askingText (pq) => the running turn's reply that asked +pq+
|
|
40
|
+
// (stage_asking.js askedText via the page's view), kept by a question or
|
|
41
|
+
// own approval card
|
|
40
42
|
// @param renderMarkdown (text) => Promise<html|null>: the kept reply's
|
|
41
43
|
// markdown (the page's POST /api/render; null keeps the raw text)
|
|
42
44
|
// @param linkRefs (el, refs) the page's ref pass on it: a plugin's +refs+
|
|
@@ -48,6 +50,9 @@ const CARD_NOTE = "chi-card-note";
|
|
|
48
50
|
// @param onPending (pending|null) called whenever the open question changes:
|
|
49
51
|
// the page touches the redraws that read pendingQuestion() (the session
|
|
50
52
|
// bar's waiting chip, docs/internals/web-frontend.md write -> redraw)
|
|
53
|
+
// @param onSettled (key) a card stopped waiting (answered, cancelled,
|
|
54
|
+
// replaced or removed; the continue card resolved or dropped), by its
|
|
55
|
+
// stage_waiting.js key: the stage's waiting cards as data
|
|
51
56
|
// @return {renderQuestion(pq, {said}), resolveQuestion(id, opts), removeQuestion(),
|
|
52
57
|
// questionCard() (the live card or null), pendingQuestion() (or null),
|
|
53
58
|
// isResolved(id) (this page already saw that question answered),
|
|
@@ -56,7 +61,7 @@ export function createQuestionCards({
|
|
|
56
61
|
sessionId, clientId, place, isNearBottom, scrollToEnd, removeHintIfEmpty, askingText = () => "",
|
|
57
62
|
renderMarkdown = () => Promise.resolve(null), linkRefs = () => {}, pairRefs = () => {},
|
|
58
63
|
api = { sendAnswer, dismissQuestion, sendCommand }, doc = globalThis.document,
|
|
59
|
-
onPending = () => {},
|
|
64
|
+
onPending = () => {}, onSettled = () => {},
|
|
60
65
|
}) {
|
|
61
66
|
// Live ask_user_question card, keyed by pending question id. Re-rendered from
|
|
62
67
|
// pending_question on session select so a reload mid-question restores it.
|
|
@@ -99,7 +104,9 @@ export function createQuestionCards({
|
|
|
99
104
|
// stage_view.js): the kind, and a delegate's question relayed here.
|
|
100
105
|
card.dataset.kind = pq.kind || "question";
|
|
101
106
|
if (relayView(pq)) card.dataset.relay = "1";
|
|
102
|
-
|
|
107
|
+
// An approval says the tool it approves (the stage's replay rule for its lead-in).
|
|
108
|
+
if (approval && pq.approval?.tool) card.dataset.tool = String(pq.approval.tool);
|
|
109
|
+
const asked = keepsAskingText(pq) ? String(said ?? askingText(pq) ?? "").trim() : "";
|
|
103
110
|
if (asked) saidOf.set(card, asked);
|
|
104
111
|
// Open while pending: the question must be actionable.
|
|
105
112
|
card.open = true;
|
|
@@ -110,8 +117,10 @@ export function createQuestionCards({
|
|
|
110
117
|
summary.textContent = summaryText(pq);
|
|
111
118
|
card.appendChild(summary);
|
|
112
119
|
// A hand toggle: the resolve's auto-collapse then leaves it as the user
|
|
113
|
-
// left it (rememberToggle-style, as turn_block.js does).
|
|
114
|
-
|
|
120
|
+
// left it (rememberToggle-style, as turn_block.js does). Not a click whose
|
|
121
|
+
// toggle was refused: a card that waits in the stage has none of its own
|
|
122
|
+
// (stage_view.js).
|
|
123
|
+
summary.addEventListener("click", (e) => { if (!e.defaultPrevented) card.dataset.toggled = "1"; });
|
|
115
124
|
|
|
116
125
|
// Relayed to the parent: say where else it waits (QuestionDesk#annotate).
|
|
117
126
|
card.appendChild(renderRelayedTo(pq));
|
|
@@ -481,11 +490,20 @@ export function createQuestionCards({
|
|
|
481
490
|
const refs = questionRefsOf(pending);
|
|
482
491
|
let full = null;
|
|
483
492
|
if (summary && asked) {
|
|
493
|
+
if (allowed !== null) {
|
|
494
|
+
const answerLine = doc.createElement("span");
|
|
495
|
+
answerLine.className = "question-summary-text";
|
|
496
|
+
answerLine.textContent = summary.textContent;
|
|
497
|
+
summary.textContent = "";
|
|
498
|
+
summary.appendChild(answerLine);
|
|
499
|
+
summary.classList.add("approval-said");
|
|
500
|
+
}
|
|
484
501
|
const line = doc.createElement("div");
|
|
485
502
|
line.className = "question-said";
|
|
486
503
|
line.setAttribute("aria-hidden", "true");
|
|
487
504
|
line.textContent = plainText(asked);
|
|
488
|
-
summary.
|
|
505
|
+
if (allowed !== null) summary.insertBefore(line, summary.children[0] || null);
|
|
506
|
+
else summary.appendChild(line);
|
|
489
507
|
full = doc.createElement("div");
|
|
490
508
|
full.className = "question-said-full";
|
|
491
509
|
full.textContent = asked;
|
|
@@ -502,6 +520,7 @@ export function createQuestionCards({
|
|
|
502
520
|
// After the collapse: a card left open by hand renders at once.
|
|
503
521
|
if (full) renderSaidOnOpen(questionEl, full, asked, refs);
|
|
504
522
|
resolvedId = pending.id;
|
|
523
|
+
onSettled(questionKey(questionEl.dataset.qid));
|
|
505
524
|
setPending(null);
|
|
506
525
|
}
|
|
507
526
|
|
|
@@ -567,8 +586,10 @@ export function createQuestionCards({
|
|
|
567
586
|
function replaceQuestionCard() {
|
|
568
587
|
if (!questionEl) return;
|
|
569
588
|
|
|
589
|
+
const key = questionKey(questionEl.dataset.qid);
|
|
570
590
|
questionEl.remove();
|
|
571
591
|
questionEl = null;
|
|
592
|
+
onSettled(key);
|
|
572
593
|
}
|
|
573
594
|
|
|
574
595
|
// ── continue card ──────────────────────────────────────────────────────────
|
|
@@ -587,6 +608,7 @@ export function createQuestionCards({
|
|
|
587
608
|
// The old card goes: the step-limit question asks the same (a worker that
|
|
588
609
|
// posts it announces continue_offered too, for older pages).
|
|
589
610
|
function dropContinueCard() {
|
|
611
|
+
if (continueEl) onSettled(CONTINUE_KEY);
|
|
590
612
|
continueEl?.remove();
|
|
591
613
|
continueEl = null;
|
|
592
614
|
}
|
|
@@ -656,6 +678,7 @@ export function createQuestionCards({
|
|
|
656
678
|
continueEl = null;
|
|
657
679
|
if (!card) return;
|
|
658
680
|
card.classList.add("resolved");
|
|
681
|
+
onSettled(CONTINUE_KEY);
|
|
659
682
|
card.querySelectorAll("button, input").forEach((el) => { el.disabled = true; });
|
|
660
683
|
const note = doc.createElement("div");
|
|
661
684
|
note.className = "question-result";
|