samagotchi 0.166.0 → 0.168.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 +89 -1
- data/docs/architecture.md +1 -0
- data/docs/cli.md +24 -15
- data/docs/configuration.md +1 -0
- data/docs/guardrails.md +5 -5
- data/docs/hooks.md +4 -6
- data/docs/internals/bundles.md +2 -4
- data/docs/internals/engine.md +4 -5
- data/docs/internals/objectives.md +141 -9
- data/docs/internals/remote-sessions.md +5 -6
- data/docs/internals/web-frontend.md +85 -40
- data/docs/memory.md +1 -2
- data/docs/sessions.md +20 -2
- data/docs/testing.md +3 -3
- data/lib/samagotchi/bridge.rb +1 -1
- data/lib/samagotchi/bundle_command/installed_check.rb +2 -14
- data/lib/samagotchi/bundle_command.rb +35 -12
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/cli/command.rb +10 -0
- data/lib/samagotchi/compat.rb +1 -13
- data/lib/samagotchi/config.rb +3 -0
- data/lib/samagotchi/context_command.rb +2 -1
- data/lib/samagotchi/engine/objectives.rb +20 -1
- data/lib/samagotchi/engine/side_requests.rb +3 -2
- data/lib/samagotchi/engine/turn_end.rb +4 -1
- data/lib/samagotchi/engine.rb +3 -0
- data/lib/samagotchi/extension_load.rb +2 -26
- data/lib/samagotchi/guardrails/approvals.rb +15 -16
- data/lib/samagotchi/jsonl_store.rb +61 -0
- data/lib/samagotchi/memory_bundle/status.rb +3 -15
- data/lib/samagotchi/memory_bundle/system_bundle.rb +16 -10
- data/lib/samagotchi/memory_command.rb +4 -2
- data/lib/samagotchi/objectives.rb +43 -14
- data/lib/samagotchi/objectives_backing.rb +124 -0
- data/lib/samagotchi/objectives_check.rb +19 -126
- data/lib/samagotchi/objectives_command.rb +14 -7
- data/lib/samagotchi/objectives_record.rb +104 -0
- data/lib/samagotchi/objectives_track.rb +353 -0
- data/lib/samagotchi/push_command.rb +2 -1
- data/lib/samagotchi/remote_command.rb +2 -1
- data/lib/samagotchi/reply_wait/poll.rb +6 -6
- data/lib/samagotchi/reply_wait.rb +4 -24
- data/lib/samagotchi/schedule_command.rb +6 -0
- data/lib/samagotchi/schedules.rb +1 -1
- data/lib/samagotchi/session_access/remote.rb +3 -5
- data/lib/samagotchi/session_commands.rb +1 -1
- data/lib/samagotchi/sessions_command.rb +12 -6
- data/lib/samagotchi/share_command.rb +2 -1
- data/lib/samagotchi/tool_activity.rb +11 -1
- data/lib/samagotchi/tool_declarations.rb +5 -1
- data/lib/samagotchi/tools/objectives_tool.rb +19 -2
- data/lib/samagotchi/turn_stages/objectives.rb +46 -3
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/participant_access.rb +1 -1
- data/lib/samagotchi/web/public/app.js +52 -424
- data/lib/samagotchi/web/public/copy.js +2 -1
- data/lib/samagotchi/web/public/dock_reserve.js +12 -2
- data/lib/samagotchi/web/public/history_end.js +16 -0
- data/lib/samagotchi/web/public/index.html +74 -22
- data/lib/samagotchi/web/public/info_bar_model.js +3 -1
- data/lib/samagotchi/web/public/no_contact_fill.js +29 -0
- data/lib/samagotchi/web/public/objectives.css +14 -0
- data/lib/samagotchi/web/public/objectives_moves.js +82 -9
- data/lib/samagotchi/web/public/objectives_state.js +42 -0
- data/lib/samagotchi/web/public/objectives_strip.js +33 -9
- data/lib/samagotchi/web/public/objectives_track.js +52 -0
- data/lib/samagotchi/web/public/objectives_wiring.js +16 -1
- data/lib/samagotchi/web/public/participant.html +1 -1
- data/lib/samagotchi/web/public/participants_panel.js +14 -7
- data/lib/samagotchi/web/public/question_cards.js +8 -13
- data/lib/samagotchi/web/public/refs.js +4 -1
- data/lib/samagotchi/web/public/reload_check.js +5 -4
- data/lib/samagotchi/web/public/resync_reach.js +10 -6
- data/lib/samagotchi/web/public/scope.js +3 -3
- data/lib/samagotchi/web/public/session_rename.js +6 -2
- data/lib/samagotchi/web/public/session_state.js +1 -1
- data/lib/samagotchi/web/public/session_sync.js +249 -0
- data/lib/samagotchi/web/public/session_view.js +279 -0
- data/lib/samagotchi/web/public/stage_cards.js +20 -0
- data/lib/samagotchi/web/public/stage_frame.js +14 -16
- data/lib/samagotchi/web/public/stage_model.js +11 -4
- data/lib/samagotchi/web/public/stage_opened.js +229 -0
- data/lib/samagotchi/web/public/stage_slots.js +2 -3
- data/lib/samagotchi/web/public/stage_view.js +219 -147
- data/lib/samagotchi/web/public/stage_watch.js +8 -4
- data/lib/samagotchi/web/public/stream_handlers.js +1 -1
- data/lib/samagotchi/web/public/tokens.css +2 -2
- data/lib/samagotchi/web/public/turn_block.js +22 -2
- data/lib/samagotchi/web/public/turn_html.js +1 -1
- data/lib/samagotchi/web/public/widget_picks.js +3 -0
- data/lib/samagotchi/web/public/working_set_view.js +1 -1
- data/lib/samagotchi/web/session_access_routes.rb +4 -15
- metadata +13 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The one way the stage moves a turn's pieces into the history
|
|
2
|
+
// (stage_view.js): to its end, in the order given (the hand-off's
|
|
3
|
+
// handOffOrder, or what a turn opened in the history sends there as it
|
|
4
|
+
// arrives). The original nodes move (their ref bindings, selection and late
|
|
5
|
+
// updates with them); the empty history's hint goes first. +animate+: each
|
|
6
|
+
// piece arrives with .ts-arrive (gone at its animationend).
|
|
7
|
+
export function moveToHistoryEnd(historyEl, pieces, { animate = false } = {}) {
|
|
8
|
+
historyEl.querySelector(":scope > .hint")?.remove();
|
|
9
|
+
for (const el of pieces) {
|
|
10
|
+
historyEl.appendChild(el);
|
|
11
|
+
if (animate) {
|
|
12
|
+
el.classList.add("ts-arrive");
|
|
13
|
+
el.addEventListener("animationend", () => el.classList.remove("ts-arrive"), { once: true });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
<meta name="apple-mobile-web-app-title" content="Chi">
|
|
11
11
|
<!-- viewport-fit=cover: the page runs under the notch and the home indicator; what must stay clear of them pads by --safe-* (below). -->
|
|
12
12
|
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
|
13
|
-
<!-- The phone's status bar and Safari's toolbar take the page's own background
|
|
13
|
+
<!-- The phone's status bar and Safari's toolbar take the page's own background, per theme: on a phone (600px and less) the
|
|
14
|
+
colour its top edge starts with (tokens.css --bg-top, the top bar's tint), so the status bar and the bar under it are one
|
|
15
|
+
surface; elsewhere --bg. The first meta that matches wins. -->
|
|
16
|
+
<meta name="theme-color" content="#131d29" media="(prefers-color-scheme: dark) and (max-width: 600px)">
|
|
17
|
+
<meta name="theme-color" content="#dde8f4" media="(prefers-color-scheme: light) and (max-width: 600px)">
|
|
14
18
|
<meta name="theme-color" content="#0b0d11" media="(prefers-color-scheme: dark)">
|
|
15
19
|
<meta name="theme-color" content="#f5f6f8" media="(prefers-color-scheme: light)">
|
|
16
20
|
<link rel="stylesheet" href="/assets/tokens.css">
|
|
@@ -30,6 +34,12 @@
|
|
|
30
34
|
/* No iOS text autosizing: it grows text in a box sized for the text as written (it clipped the session cards). */
|
|
31
35
|
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
|
|
32
36
|
body{font-family: ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;background:radial-gradient(1100px 700px at 8% 0%,color-mix(in srgb,var(--accent) 13%,transparent),transparent 70%),var(--bg);background-attachment:fixed;color:var(--text);height:100vh;height:100dvh;display:flex;flex-direction:column}
|
|
37
|
+
/* A phone: the accent's tint runs down from the top edge, flat across it (--bg-top, the status bar's theme-color above),
|
|
38
|
+
not from the top-left corner: the status bar, which iOS paints in theme-color (the Home Screen app) or over the page's
|
|
39
|
+
top (a Safari tab), meets the top bar with no seam. The colour layer under the gradient is never seen in the page
|
|
40
|
+
(the gradient covers the body): it is the body's background-color, which is what iOS 26's Home Screen app paints
|
|
41
|
+
the status bar strip in (not theme-color, not html's background; with no colour the strip is black). */
|
|
42
|
+
@media(max-width:600px){body{background:linear-gradient(var(--bg-top),var(--bg) 420px),var(--bg-top)}}
|
|
33
43
|
/* Glass: the composer card, the strip cards, the all-sessions cards and the question cards (by selector, so app.js is untouched). */
|
|
34
44
|
.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)}
|
|
35
45
|
@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)}}
|
|
@@ -440,6 +450,28 @@ button.system-one-wrong,.system-one-wrong.marked{flex:none;padding:1px 6px;borde
|
|
|
440
450
|
selectable. */
|
|
441
451
|
.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}
|
|
442
452
|
.bubble.question[open]>summary .question-said{display:none}
|
|
453
|
+
/* A turn opened in the history (stage_opened.js): while the turn runs, a card answered under its reason doesn't repeat it;
|
|
454
|
+
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
|
+
title line while it waits. */
|
|
456
|
+
.bubble.said+.bubble.question :is(.question-said,.question-said-full){display:none}
|
|
457
|
+
/* Its asking step in the steps block doesn't repeat the reason either (stage_opened.js data-said, until the hand-off). */
|
|
458
|
+
.turn-work>details.gen[data-said]>.gen-text{display:none}
|
|
459
|
+
.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
|
+
@media(hover:hover){.question-reason-link:hover:not(:disabled){filter:none;text-decoration:underline}}
|
|
461
|
+
/* The reply that asked the model's own question, a conversation bubble while its turn runs (live only): a label line ("chi ·
|
|
462
|
+
step N", "asking you" while its card waits), the text at the answer's size; the edge amber while it waits, neutral after. */
|
|
463
|
+
.bubble.said{border-left:3px solid var(--border-strong);font-size:15px;line-height:1.55;color:var(--text)}
|
|
464
|
+
.bubble.said.pending{border-left-color:var(--warn)}
|
|
465
|
+
.said-label{display:flex;gap:8px;margin-bottom:4px;font-size:12px;line-height:1.4;color:var(--text-faint);white-space:normal}
|
|
466
|
+
.said-asking{color:var(--warn-text);font-weight:600}
|
|
467
|
+
.bubble.said:not(.pending) .said-asking{display:none}
|
|
468
|
+
.said-text{white-space:pre-wrap;overflow-wrap:anywhere}
|
|
469
|
+
.said-text.md-compact{
|
|
470
|
+
--md-heading-size:16px;--md-heading-color:var(--text-bright);
|
|
471
|
+
--md-subheading-size:15px;--md-subheading-color:var(--text-2);
|
|
472
|
+
--md-strong-color:var(--text-bright);--md-blockquote-color:var(--text-muted);--md-code-color:var(--text);
|
|
473
|
+
--md-pre-size:13px;--md-cell-size:13.5px
|
|
474
|
+
}
|
|
443
475
|
.question-said-full{margin:4px 0 6px;font-size:13px;line-height:1.55;color:var(--text-muted);white-space:pre-wrap;overflow-wrap:anywhere}
|
|
444
476
|
.question-said-full.md-compact{
|
|
445
477
|
--md-heading-size:13.5px;--md-heading-color:var(--text-2);
|
|
@@ -459,7 +491,7 @@ button.system-one-wrong,.system-one-wrong.marked{flex:none;padding:1px 6px;borde
|
|
|
459
491
|
--md-strong-color:var(--text);--md-blockquote-color:var(--text-muted);--md-code-color:var(--text);
|
|
460
492
|
--md-pre-size:12.5px;--md-cell-size:13px
|
|
461
493
|
}
|
|
462
|
-
.md-compact:is(.ts-asking,.question-said-full,.gen-text){white-space:normal}
|
|
494
|
+
.md-compact:is(.ts-asking,.question-said-full,.gen-text,.said-text){white-space:normal}
|
|
463
495
|
.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)}
|
|
464
496
|
.md-compact :is(h4,h5,h6){font-size:var(--md-subheading-size);color:var(--md-subheading-color)}
|
|
465
497
|
.md-compact :is(p,ul,ol,blockquote,table,pre){margin:0 0 6px}
|
|
@@ -672,8 +704,11 @@ body.has-session #center{background:color-mix(in srgb,var(--bg) 35%,transparent)
|
|
|
672
704
|
body.has-session #stage,body.has-session #history{background:transparent}
|
|
673
705
|
@media (prefers-reduced-transparency:reduce){body.has-session #center{background:var(--bg);border-color:var(--border)}}
|
|
674
706
|
body.no-glass.has-session #center{background:var(--bg);border-color:var(--border)}
|
|
675
|
-
/* --dock-bottom: the card's offset from the panel's bottom (16px; a phone's is below). stage_frame.js fitCap reads it.
|
|
676
|
-
|
|
707
|
+
/* --dock-bottom: the card's offset from the panel's bottom (16px; a phone's is below). stage_frame.js fitCap reads it.
|
|
708
|
+
Its sides are the history's column (#history's padding, both in #center): the stage and the composer are as wide as
|
|
709
|
+
the conversation, so a text moved from the stage into the history keeps its line breaks. A classic scrollbar on the
|
|
710
|
+
history narrows its column on the right: --history-sb (dock_reserve.js) moves the dock's right edge with it. */
|
|
711
|
+
body.has-session #dock{position:absolute;left:max(16px,calc((100% - 960px)/2));right:calc(max(16px,calc((100% - 960px)/2)) + var(--history-sb,0px));bottom:var(--dock-bottom,16px);margin:0;z-index:3}
|
|
677
712
|
body.has-session #history{padding-bottom:calc(var(--dock-h,160px) + 16px + var(--dock-bottom,16px))}
|
|
678
713
|
/* A phone's session panel runs edge to edge: its sides, corners and bottom line go (main's 16px side padding is taken
|
|
679
714
|
back), so only the message cards are framed and an answer gets the width. The history, the objectives' strip and the
|
|
@@ -685,7 +720,7 @@ body.has-session #history{padding-bottom:calc(var(--dock-h,160px) + 16px + var(-
|
|
|
685
720
|
body.has-session #center{margin:0 -16px;border-width:1px 0 0;border-radius:0}
|
|
686
721
|
body.has-session #history{padding-left:8px;padding-right:8px}
|
|
687
722
|
body.has-session #objectivesStrip{padding-left:8px;padding-right:8px}
|
|
688
|
-
body.has-session #dock{left:8px;right:8px}
|
|
723
|
+
body.has-session #dock{left:8px;right:calc(8px + var(--history-sb,0px))}
|
|
689
724
|
}
|
|
690
725
|
/* The delivery line (delivery_line.js): above a phone's width, a session's row above the text field, always there so the composer never changes height: the key hint while idle; while a turn runs, where a message typed now goes in, then the cut and queue links. One quiet row, ellipsised. A phone has no such row (its composer is shorter, and as steady): while a turn runs the line, its short text and chips, lies over the session bar's left, where status, ctx and speed are (hidden while it shows), up to ⚙, only while you type or have a choice armed (below). */
|
|
691
726
|
#deliveryLine{display:flex;align-items:center;gap:10px}
|
|
@@ -869,10 +904,16 @@ body.stage-view .turn-stage{position:absolute;left:0;right:0;bottom:100%;margin-
|
|
|
869
904
|
text, then its markdown when web.markdown is on (.markdown, stage_slots.js drawAsking); capped so the card keeps
|
|
870
905
|
its room, read from the top. */
|
|
871
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}
|
|
872
|
-
/* The
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
.turn-stage.
|
|
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
|
|
909
|
+
slots (the working set's rail with them) and the steps chip come back with the working form after the answer. */
|
|
910
|
+
.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 (the card's tint, no glass; its amber edge
|
|
912
|
+
is the waiting phase's), the status row is the box's first line, and the card inside drops its own box, so there is no
|
|
913
|
+
box in a box and no second amber edge. */
|
|
914
|
+
.turn-stage.asking-form{background:color-mix(in srgb,var(--warn) 7%,var(--bg-panel));-webkit-backdrop-filter:none;backdrop-filter:none;border-radius:12px}
|
|
915
|
+
.turn-stage.asking-form .ts-scroll{padding-top:6px}
|
|
916
|
+
.turn-stage.asking-form .ts-extras>.bubble.question{border:0;border-radius:0;background:transparent;padding:0}
|
|
876
917
|
.turn-stage.asking .ts-headline{display:none}
|
|
877
918
|
@keyframes ts-fade{from{opacity:.35}}
|
|
878
919
|
.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}
|
|
@@ -942,11 +983,6 @@ body.stage-view .turn-stage{position:absolute;left:0;right:0;bottom:100%;margin-
|
|
|
942
983
|
/* The cloud: one chip (steps, calls, a tick per call), the turn block behind it. */
|
|
943
984
|
/* The footer: the chip at the stage's bottom edge (the cloud's steps open above it, the scroller's last slot). */
|
|
944
985
|
.ts-foot{position:relative;flex:none;padding:0 14px 10px}
|
|
945
|
-
/* The question room's jump pill (stage_view.js drawPill): at the scroller's bottom edge, above the chip, while the waiting
|
|
946
|
-
card is out of the stage's view; absolute, so the frame never counts it. */
|
|
947
|
-
.ts-room-pill{position:absolute;bottom:100%;right:14px;margin-bottom:6px;padding:4px 11px;border:1px solid var(--warn-border);border-radius:999px;background:var(--warn-bg);color:var(--warn-text);font-size:12.5px;font-weight:600;line-height:1.4;white-space:nowrap;box-shadow:0 2px 8px var(--shadow-strong);animation:ts-fade .2s ease}
|
|
948
|
-
@media(hover:hover){.ts-room-pill:hover:not(:disabled){filter:none;color:var(--warn-bright);border-color:var(--warn);background:var(--warn-bg)}}
|
|
949
|
-
.ts-room-pill[hidden]{display:none}
|
|
950
986
|
/* Below the turn's card: the lines queued for after it (each a turn of its own), apart from the turn by a dashed rule. */
|
|
951
987
|
.ts-queued{flex:none;display:flex;flex-direction:column;gap:6px;padding:8px 14px 10px;border-top:1px dashed var(--border-strong);max-height:calc(var(--stage-max,60vh) * .3);overflow:auto;scrollbar-width:thin}
|
|
952
988
|
.ts-queued:empty{display:none}
|
|
@@ -1310,9 +1346,9 @@ body.has-session.composer-folded #infoBar{border-top-color:transparent}
|
|
|
1310
1346
|
.pp-invite-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
|
|
1311
1347
|
.pp-invite-row label{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--text-3)}
|
|
1312
1348
|
.participants-popover input,.participants-popover select{font:inherit;font-size:12.5px;color:var(--text);background:var(--bg-inset);border:1px solid var(--border-strong);border-radius:6px;padding:3px 7px}
|
|
1313
|
-
.pp-invite input[name=
|
|
1349
|
+
.pp-invite input[name=chi-invitee]{flex:1;min-width:120px}
|
|
1314
1350
|
.pp-invite input[name=cap]{width:52px}
|
|
1315
|
-
.pp-invite input[name=
|
|
1351
|
+
.pp-invite input[name=chi-invitee-account]{flex:1;min-width:160px}
|
|
1316
1352
|
.pp-bound{color:var(--text-2)}
|
|
1317
1353
|
.pp-invite .pp-invite-btn{margin-left:auto;background:var(--primary);border-color:var(--primary);color:var(--on-solid);font-weight:600}
|
|
1318
1354
|
.pp-invite-done{display:flex;flex-direction:column;gap:6px;padding-top:6px;border-top:1px solid var(--border)}
|
|
@@ -1543,6 +1579,8 @@ body.has-session #newBtn .brand-new{display:inline}
|
|
|
1543
1579
|
#scope{display:inline-flex;align-items:center;gap:8px;min-width:0;font-size:12px;color:var(--text-muted)}
|
|
1544
1580
|
#scope[hidden]{display:none}
|
|
1545
1581
|
#scope .scope-name{display:inline-flex;align-items:center;flex-shrink:0;min-height:28px;padding:0 9px;border:1px solid var(--border-strong);border-radius:999px;background:transparent;color:var(--text-2);font:inherit;line-height:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:40vw;cursor:pointer;transition:none}
|
|
1582
|
+
/* The chip's words in a span of their own: a flex container's bare text gets no ellipsis, a flex item's does. */
|
|
1583
|
+
#scope .scope-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1546
1584
|
#scope .scope-name:hover:not(:disabled){filter:none}
|
|
1547
1585
|
#scope .scope-name.error{color:var(--warn-text);border-color:var(--warn-border)}
|
|
1548
1586
|
#scope .scope-all{color:var(--text-muted);text-decoration:none}
|
|
@@ -1633,9 +1671,11 @@ body.all-view #scope .scope-where{display:none}
|
|
|
1633
1671
|
/* clip, not hidden: the ellipsis as before, and the touch tap box (its ::after) reaches out above and below. */
|
|
1634
1672
|
#stripStatus{flex-grow:1000;overflow-x:clip;overflow-y:visible;text-overflow:ellipsis}
|
|
1635
1673
|
/* A session page: the chip gives way to the pill. The start page has the "new session in …" path beside the chip:
|
|
1636
|
-
there the chip keeps its words and the path is what cuts.
|
|
1637
|
-
|
|
1638
|
-
|
|
1674
|
+
there the chip keeps its words and the path is what cuts. Where the path is hidden (the strip hidden, the all view)
|
|
1675
|
+
the chip cuts with an ellipsis as on a session page, or "all" would run under the pill (320px). */
|
|
1676
|
+
#scope .scope-name{flex-shrink:1;min-width:0}
|
|
1677
|
+
body:not(.has-session):not(.strip-hidden):not(.all-view) #scope .scope-name,
|
|
1678
|
+
body:not(.has-session):not(.strip-hidden):not(.all-view) #scope .scope-back{flex-shrink:0}
|
|
1639
1679
|
body:not(.has-session) #scope .scope-where{flex:1 1 auto;min-width:0}
|
|
1640
1680
|
#stripStatus:has(.live,.waiting) .pill-count{display:none}
|
|
1641
1681
|
}
|
|
@@ -1777,6 +1817,18 @@ body.all-view #allHead{display:flex}
|
|
|
1777
1817
|
@media(min-width:601px){body.all-view #notifyBtn{margin-left:0}}
|
|
1778
1818
|
/* Nor does the header squeeze the scope chip there: its "all" segment would run under the sessions pill (800px). */
|
|
1779
1819
|
@media(min-width:601px){body.all-view #scope{flex-shrink:0}}
|
|
1820
|
+
/* Where the header doesn't fit beside the chips at its smallest (the search at its min-width), it and the bell after it
|
|
1821
|
+
wrap to a line of their own, right-aligned, rather than run over the sessions pill (~601-760px). The header's basis is
|
|
1822
|
+
that smallest width; it grows into the free space, so where it fits the line looks as before. With the bell shown, the
|
|
1823
|
+
header's box also holds the bell's place (40px: its 28px and the 12px gap) as padding, and the bell's negative margin
|
|
1824
|
+
pulls it into that padding (taking no room of its own): a line breaks before the header and the bell together,
|
|
1825
|
+
never between them. */
|
|
1826
|
+
@media(min-width:601px){
|
|
1827
|
+
body.all-view #topBar{flex-wrap:wrap;row-gap:8px}
|
|
1828
|
+
body.all-view #allHead{flex:1 1 260px}
|
|
1829
|
+
body.all-view:has(#notifyBtn:not([hidden])) #allHead{flex-basis:300px;padding-right:40px}
|
|
1830
|
+
body.all-view #notifyBtn{margin-left:-40px}
|
|
1831
|
+
}
|
|
1780
1832
|
/* The search field is glass too (no shadow: it is a field, not a card); the focus ring below replaces the highlight. */
|
|
1781
1833
|
#allHead input{flex:0 1 240px;width:240px;min-width:90px;box-sizing:border-box;height:24px;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);color:var(--text);padding:2px 11px;border-radius:999px;font-size:12px}
|
|
1782
1834
|
#allHead input::placeholder{color:var(--text-faint)}
|
|
@@ -1948,7 +2000,7 @@ a{color:var(--accent)}
|
|
|
1948
2000
|
<button type="button" class="strip-toggle" id="stripStatus" title="All sessions, with search"><span class="pill-count">sessions</span></button>
|
|
1949
2001
|
<span id="sessionTitleRow" hidden><span id="sessionTitle"></span><button type="button" id="titleRenameBtn" class="title-rename" title="Rename this session" aria-label="Rename this session" hidden>✎</button></span>
|
|
1950
2002
|
<div id="allHead">
|
|
1951
|
-
<input id="filter" type="search" placeholder="Search preview, id or status" aria-label="Search sessions" autocomplete="off">
|
|
2003
|
+
<input id="filter" name="chi-filter" type="search" placeholder="Search preview, id or status" aria-label="Search sessions" autocomplete="off">
|
|
1952
2004
|
<span class="count" id="count"></span>
|
|
1953
2005
|
<button type="button" class="strip-toggle" id="includeArchived" aria-pressed="false" title="Show archived sessions too">archived</button>
|
|
1954
2006
|
<button class="ghost" id="selectBtn" title="Pick sessions to archive several at once">Select</button>
|
|
@@ -1980,14 +2032,14 @@ a{color:var(--accent)}
|
|
|
1980
2032
|
<div id="composer" style="position:relative">
|
|
1981
2033
|
<div id="commandList" role="listbox" aria-label="Commands" hidden></div>
|
|
1982
2034
|
<div id="modelPanel" hidden>
|
|
1983
|
-
<label class="model-search"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5 14 14" stroke-linecap="round"/></svg><input id="modelSearch" type="text" placeholder="Search models" autocomplete="off" spellcheck="false" role="combobox" aria-label="Search models" aria-autocomplete="list" aria-controls="modelList" aria-expanded="false"></label>
|
|
2035
|
+
<label class="model-search"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5 14 14" stroke-linecap="round"/></svg><input id="modelSearch" name="chi-model-search" type="text" placeholder="Search models" autocomplete="off" spellcheck="false" role="combobox" aria-label="Search models" aria-autocomplete="list" aria-controls="modelList" aria-expanded="false"></label>
|
|
1984
2036
|
<div id="modelList" role="listbox" aria-label="Models"></div>
|
|
1985
2037
|
</div>
|
|
1986
2038
|
<div id="deliveryLine" class="composer-line" aria-live="off" hidden></div>
|
|
1987
2039
|
<div class="compose-col">
|
|
1988
2040
|
<div id="reviseChip" hidden></div>
|
|
1989
2041
|
<div id="chips" hidden></div>
|
|
1990
|
-
<textarea id="prompt" placeholder="Ask chi anything…" aria-controls="commandList" aria-autocomplete="list" aria-expanded="false"></textarea>
|
|
2042
|
+
<textarea id="prompt" name="chi-composer" autocomplete="off" placeholder="Ask chi anything…" aria-controls="commandList" aria-autocomplete="list" aria-expanded="false"></textarea>
|
|
1991
2043
|
<div id="composeHint">Enter to start · Shift+Enter for a newline</div>
|
|
1992
2044
|
</div>
|
|
1993
2045
|
<div class="actions-col">
|
|
@@ -152,7 +152,9 @@ export function infoBarModel({ id, state, sessions, chain, cardTitle, badge, res
|
|
|
152
152
|
// link may not be listed yet: then neither, and its links show dates).
|
|
153
153
|
const selfIso = state.createdAt || sessions.find((x) => x.id === id)?.created_at || null;
|
|
154
154
|
const parentChip = delegatedBy(state.parentId, sessions.find((x) => x.id === state.parentId) || null);
|
|
155
|
-
|
|
155
|
+
// Not while its turn runs: the stage says "reconnecting…" then (on a
|
|
156
|
+
// phone too, where the bar can hide its status), and the chip keeps it.
|
|
157
|
+
const reach = running ? null : REACH[state.reach] || null;
|
|
156
158
|
return {
|
|
157
159
|
id,
|
|
158
160
|
// Its turn runs but a card blocks it: the word `chi sessions list` has for it.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// A text field that isn't a contact form. iOS Safari offers its "AutoFill
|
|
2
|
+
// Contact" bar above the keyboard on a field that looks like one (no
|
|
3
|
+
// autocomplete, a name or label with a contact word in it: name, email,
|
|
4
|
+
// title, phone…), and once it has seen one it offers it on the page's later
|
|
5
|
+
// text fields too, the composer among them. What it respects against that:
|
|
6
|
+
// autocomplete="off" and a name with no contact word in it.
|
|
7
|
+
//
|
|
8
|
+
// Fields drawn by a lit-html template can't call this: they carry the same
|
|
9
|
+
// two attributes in the template (autocomplete="off", a chi-… name), and
|
|
10
|
+
// spec/web/public/no_contact_fill.test.js checks the templates for them; it
|
|
11
|
+
// also checks each field made with createElement (or an el/node helper)
|
|
12
|
+
// goes through this.
|
|
13
|
+
//
|
|
14
|
+
// A module of its own: static JS is cached at unversioned URLs.
|
|
15
|
+
|
|
16
|
+
// The words iOS reads as a contact field, in a name, a placeholder or a
|
|
17
|
+
// label. A field's name never has one; its wording avoids them.
|
|
18
|
+
export const CONTACT_WORDS = /\b(name|e-?mail|title|phone|tel|address|street|city|zip|postal|country|company|organi[sz]ation|first|last|given|family|nickname)\b/i;
|
|
19
|
+
|
|
20
|
+
// +input+ an input or textarea; +name+ its form name (no contact word in
|
|
21
|
+
// it: a chi-… name). +prose+: the reader writes prose here, so autocorrect
|
|
22
|
+
// stays on (autocomplete="off" turns it off in some browsers).
|
|
23
|
+
export function noContactFill(input, name, { prose = false } = {}) {
|
|
24
|
+
if (CONTACT_WORDS.test(name)) throw new Error(`noContactFill: "${name}" reads as a contact field`);
|
|
25
|
+
input.setAttribute("autocomplete", "off");
|
|
26
|
+
if (prose) input.setAttribute("autocorrect", "on");
|
|
27
|
+
input.name = name;
|
|
28
|
+
return input;
|
|
29
|
+
}
|
|
@@ -39,6 +39,11 @@ button.obj-chip{cursor:pointer;font:inherit;font-size:13px;line-height:1.4;text-
|
|
|
39
39
|
.obj-row-acts{flex:none;display:flex;gap:4px}
|
|
40
40
|
.obj-check.refuted{color:var(--warn-text)}
|
|
41
41
|
.obj-check.confirmed{color:var(--text-2)}
|
|
42
|
+
/* The tracker's reading (objectives_track.js): words first; one that differs from the agent's last move gets weight, never colour alone; a stale one fades. */
|
|
43
|
+
.obj-track.differs{color:var(--warn-text);font-weight:600}
|
|
44
|
+
.obj-track.stale{opacity:.7}
|
|
45
|
+
.obj-track-at{font-weight:400;color:var(--text-muted)}
|
|
46
|
+
.obj-track-row{display:flex;justify-content:flex-end}
|
|
42
47
|
.obj-act{padding:3px 10px;font-size:12px;border-radius:6px}
|
|
43
48
|
.obj-act.ghost{background:var(--bg-raised);color:var(--text-2)}
|
|
44
49
|
form.obj-row{align-items:center}
|
|
@@ -73,6 +78,15 @@ form.obj-row{align-items:center}
|
|
|
73
78
|
.obj-moves{display:flex;flex-direction:column;gap:2px;margin-bottom:-4px;font-size:13px}
|
|
74
79
|
.obj-move-line{display:flex;align-items:baseline;gap:8px;color:var(--text-2);flex-wrap:wrap}
|
|
75
80
|
.obj-move-note{min-width:0;flex:1 1 200px;overflow-wrap:anywhere}
|
|
81
|
+
/* A move's state beside its id: words, never colour alone (objectives_state.js). */
|
|
82
|
+
.obj-state{font-size:12px;color:var(--text-2);white-space:nowrap}
|
|
83
|
+
.obj-state.done{font-weight:600}
|
|
84
|
+
/* A done move its turn's runs don't back (Objectives::Backing): muted words. */
|
|
85
|
+
.obj-unbacked{font-size:12px;color:var(--text-muted);font-style:italic}
|
|
86
|
+
/* The newest turn did work and recorded no move (objectives_moves.js), muted where a moves line goes. */
|
|
87
|
+
.obj-nomove{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px;color:var(--text-muted);margin-bottom:-4px}
|
|
88
|
+
@media (pointer:coarse){.obj-track-ask{min-height:36px}}
|
|
89
|
+
.obj-panel.sheet .obj-track-row .obj-act{min-width:0;padding:0 12px}
|
|
76
90
|
.obj-concerns .obj-pill{margin-right:4px}
|
|
77
91
|
.obj-notyet{flex:none}
|
|
78
92
|
.obj-moves:not(.newest) .obj-notyet{display:none}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
// short version where the bundle's /short is there (decision-card): the card
|
|
10
10
|
// lands under it, so the button sits there too. A module of its own: static JS is cached at unversioned URLs.
|
|
11
11
|
import { foldable } from "./answer_fold.js";
|
|
12
|
+
import { TURN_PROMPT } from "./bubbles.js";
|
|
13
|
+
import { backingText, stateOfParams, stateWord, WORK_ROWS } from "./objectives_state.js";
|
|
12
14
|
import { keepFollowing } from "./scroll.js";
|
|
13
15
|
import { html, nothing, render } from "./vendor/lit-html.js";
|
|
14
16
|
|
|
@@ -16,12 +18,15 @@ const ROW_TITLE = /^(O\d+)\s+([^]*)$/;
|
|
|
16
18
|
const RECORDED = /Recorded a move on /;
|
|
17
19
|
const CONCERNS = /^Concerns (O\d+)\b/;
|
|
18
20
|
|
|
19
|
-
// A row's move: {id, note
|
|
20
|
-
//
|
|
21
|
+
// A row's move: {id, note, state?} (state only for blocked or done, from the
|
|
22
|
+
// params line), null for any other row, and for a call that recorded nothing (no
|
|
23
|
+
// list, a refusal: Tools::ObjectivesTool).
|
|
21
24
|
export function moveOfRow(row) {
|
|
22
25
|
if (row?.tool !== "objectives" || !RECORDED.test(String(row.output || ""))) return null;
|
|
23
26
|
const found = ROW_TITLE.exec(String(row.title || row.params || ""));
|
|
24
|
-
|
|
27
|
+
if (!found) return null;
|
|
28
|
+
const state = stateOfParams(row.params);
|
|
29
|
+
return state ? { id: found[1], note: found[2], state } : { id: found[1], note: found[2] };
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
// The row's title, its objective a chip, marked for the line above an answer
|
|
@@ -31,12 +36,23 @@ export function moveRowText(row, shown) {
|
|
|
31
36
|
const found = ROW_TITLE.exec(String(shown ?? ""));
|
|
32
37
|
if (!found) return shown;
|
|
33
38
|
const move = moveOfRow(row);
|
|
34
|
-
return html`<span class="obj-pill obj-mark" data-move-id=${move ? move.id : nothing} data-move-note=${move ? move.note : nothing}>${found[1]}</span
|
|
39
|
+
return html`<span class="obj-pill obj-mark" data-move-id=${move ? move.id : nothing} data-move-note=${move ? move.note : nothing} data-move-state=${move?.state || nothing}>${found[1]}</span>${stateTemplate(move?.state)} ${found[2]}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// A move's state as words beside its id, by text and a class (never colour
|
|
43
|
+
// alone); nothing for progress.
|
|
44
|
+
function stateTemplate(state) {
|
|
45
|
+
const word = stateWord(state);
|
|
46
|
+
return word ? html` <span class=${`obj-state ${state}`}>${word}</span>` : nothing;
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
// A finished turn block's moves, in order.
|
|
38
50
|
export function movesInBlock(block) {
|
|
39
|
-
return [...block.querySelectorAll("[data-move-id]")].map((el) =>
|
|
51
|
+
return [...block.querySelectorAll("[data-move-id]")].map((el) => {
|
|
52
|
+
const move = { id: el.dataset.moveId, note: el.dataset.moveNote || "" };
|
|
53
|
+
if (el.dataset.moveState) move.state = el.dataset.moveState;
|
|
54
|
+
return move;
|
|
55
|
+
});
|
|
40
56
|
}
|
|
41
57
|
|
|
42
58
|
// A card body's "Concerns O2 …" paragraph: the id a chip. Idempotent.
|
|
@@ -64,7 +80,12 @@ function lineFor(block) {
|
|
|
64
80
|
// @param notYet (id) the tap on a move's Not yet (the newest turn's only: CSS)
|
|
65
81
|
// @param canShorten () whether the newest long answer offers its short version
|
|
66
82
|
// @param shorten () the tap on it
|
|
67
|
-
|
|
83
|
+
// @param latestMove (id) the view's last move of an objective (its backing), null while it can't be placed
|
|
84
|
+
// @param canMarkNoMove () whether the newest finished block may say it recorded no move (an active objective, no turn running or held)
|
|
85
|
+
// @param canTrack () whether that line offers Where are we? (the worker has the tracker)
|
|
86
|
+
// @param track () the tap on it: a promise, false for a failure (already told)
|
|
87
|
+
export function createObjectivesMoves({ historyEl, notYet = () => {}, canShorten = () => false, shorten = () => {}, latestMove = () => null,
|
|
88
|
+
canMarkNoMove = () => false, canTrack = () => false, track = () => {} }) {
|
|
68
89
|
// Off once tapped; back when +ask+ answers false (a failure, already told).
|
|
69
90
|
const once = (e, ask) => {
|
|
70
91
|
const button = e.currentTarget;
|
|
@@ -74,7 +95,7 @@ export function createObjectivesMoves({ historyEl, notYet = () => {}, canShorten
|
|
|
74
95
|
});
|
|
75
96
|
};
|
|
76
97
|
const drawLine = (line, moves) => render(html`${moves.map((m) => html`<div class="obj-move-line">
|
|
77
|
-
<span class="obj-pill obj-mark">${m.id}</span
|
|
98
|
+
<span class="obj-pill obj-mark">${m.id}</span>${stateTemplate(m.state)}<span class="obj-move-note">${m.note}</span>${m.flag ? html`<span class="obj-unbacked">${m.flag}</span>` : nothing}
|
|
78
99
|
<button type="button" class="obj-act ghost obj-notyet" title=${`Tell the agent: not yet on ${m.id}`} @click=${(e) => once(e, () => notYet(m.id))}>Not yet</button>
|
|
79
100
|
</div>`)}`, line);
|
|
80
101
|
|
|
@@ -113,9 +134,60 @@ export function createObjectivesMoves({ historyEl, notYet = () => {}, canShorten
|
|
|
113
134
|
}
|
|
114
135
|
}
|
|
115
136
|
|
|
137
|
+
// The view's backing is its latest move's: drawn on that objective's last
|
|
138
|
+
// move in the history only (a block may hold two moves on it).
|
|
139
|
+
function flagged(blocks) {
|
|
140
|
+
const newest = new Map();
|
|
141
|
+
blocks.forEach((block, b) => movesInBlock(block).forEach((m, i) => newest.set(m.id, `${b}:${i}`)));
|
|
142
|
+
return (b, moves) => moves.map((m, i) => {
|
|
143
|
+
const flag = newest.get(m.id) === `${b}:${i}` ? backingText(latestMove(m.id)) : null;
|
|
144
|
+
return flag ? { ...m, flag } : m;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// The newest finished turn of the owner's that did work (an edit, write or
|
|
149
|
+
// execute row) and recorded no move says so where its moves line would be.
|
|
150
|
+
// Only the newest: the list of an older turn's time isn't known. Not for a
|
|
151
|
+
// canceled or failed turn, nor a participant's (turn_block.js stamps them),
|
|
152
|
+
// nor one that ran before the list's first note (the model had none to move
|
|
153
|
+
// on), nor once a newer turn's prompt follows it (a plain turn has no block).
|
|
154
|
+
const after = (a, b) => !!(a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
155
|
+
function newerTurn(block) {
|
|
156
|
+
for (let el = block.nextElementSibling; el; el = el.nextElementSibling) if (el.matches(TURN_PROMPT)) return true;
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function placeNoMove(blocks) {
|
|
161
|
+
const newest = blocks[blocks.length - 1];
|
|
162
|
+
const list = historyEl.querySelector(".objectives-entry");
|
|
163
|
+
const wanted = newest && canMarkNoMove() && newest.dataset.end === "completed" && !newest.dataset.participant
|
|
164
|
+
&& !newest.querySelector("[data-move-id]") && newest.querySelector(WORK_ROWS)
|
|
165
|
+
&& list && after(list, newest) && !newerTurn(newest);
|
|
166
|
+
for (const el of historyEl.querySelectorAll(":scope > .obj-nomove")) {
|
|
167
|
+
if (!wanted || el.previousElementSibling !== newest) el.remove();
|
|
168
|
+
}
|
|
169
|
+
if (!wanted) return;
|
|
170
|
+
const offer = canTrack() ? "track" : "";
|
|
171
|
+
const shown = newest.nextElementSibling?.classList.contains("obj-nomove") ? newest.nextElementSibling : null;
|
|
172
|
+
if (shown?.dataset.offer === offer) return;
|
|
173
|
+
keepFollowing(historyEl, () => {
|
|
174
|
+
const el = shown || historyEl.ownerDocument.createElement("div");
|
|
175
|
+
el.className = "obj-nomove";
|
|
176
|
+
el.dataset.offer = offer;
|
|
177
|
+
el.title = "This turn did work and recorded no move on the objectives. Information only.";
|
|
178
|
+
// The tracker on demand, where the worker has it (feature_gates.js).
|
|
179
|
+
render(html`<span>no move recorded</span>${offer ? html` <button type="button" class="obj-act ghost obj-track-ask"
|
|
180
|
+
title="One side request reads the session's record for every active objective. Information only, nothing enters the conversation"
|
|
181
|
+
@click=${(e) => once(e, track)}>Where are we?</button>` : nothing}`, el);
|
|
182
|
+
if (!shown) newest.after(el);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
116
186
|
function decorate() {
|
|
117
|
-
|
|
118
|
-
|
|
187
|
+
const blocks = [...historyEl.querySelectorAll(":scope > .turn-work")];
|
|
188
|
+
const withFlags = flagged(blocks);
|
|
189
|
+
for (const [b, block] of blocks.entries()) {
|
|
190
|
+
const moves = withFlags(b, movesInBlock(block));
|
|
119
191
|
const line = lineFor(block);
|
|
120
192
|
if (!moves.length) {
|
|
121
193
|
line?.remove();
|
|
@@ -132,6 +204,7 @@ export function createObjectivesMoves({ historyEl, notYet = () => {}, canShorten
|
|
|
132
204
|
});
|
|
133
205
|
}
|
|
134
206
|
markNewest();
|
|
207
|
+
placeNoMove(blocks);
|
|
135
208
|
placeShort();
|
|
136
209
|
for (const card of historyEl.querySelectorAll(".plugin-card .card-body")) {
|
|
137
210
|
if (card.closest(".plugin-card").querySelector(".card-source")?.textContent === "decision-card") chipConcerns(card);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Where a move says its objective stands (pure, no DOM): a move's state
|
|
2
|
+
// (Tools::ObjectivesTool: progress, blocked or done; done is the agent's claim,
|
|
3
|
+
// never the item's status) and its words, and its backing's flag. A module of its own, not new exports of
|
|
4
|
+
// objectives_model.js: static JS is cached at unversioned URLs, and an existing
|
|
5
|
+
// module importing a new export of another existing one blanks a page with a
|
|
6
|
+
// mixed cache. See docs/internals/objectives.md.
|
|
7
|
+
|
|
8
|
+
const WORDS = { blocked: "blocked", done: "claims done" };
|
|
9
|
+
|
|
10
|
+
// A tool row's params line carries a blocked or done state before its note
|
|
11
|
+
// (ToolActivity#objectives_state_param); the title doesn't (an older page reads it).
|
|
12
|
+
const PARAMS_STATE = /^id="(?:[^"\\]|\\.)*" state="(blocked|done)" note=/;
|
|
13
|
+
|
|
14
|
+
// The words a state adds: null for progress, none or one this page doesn't know.
|
|
15
|
+
export function stateWord(state) {
|
|
16
|
+
return Object.hasOwn(WORDS, state) ? WORDS[state] : null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// The state a row's params line names: "blocked", "done" or null.
|
|
20
|
+
export function stateOfParams(params) {
|
|
21
|
+
return PARAMS_STATE.exec(String(params ?? ""))?.[1] ?? null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// A move's backing (Objectives::Backing, derived from its turn's runs) as the
|
|
25
|
+
// muted mark's words, only when it is flagged: a done move whose turn's last
|
|
26
|
+
// command failed, or that edited after it. null otherwise.
|
|
27
|
+
export function backingText(move) {
|
|
28
|
+
const backing = move?.backing;
|
|
29
|
+
if (!backing?.unbacked) return null;
|
|
30
|
+
return backing.command === "failed" ? "not backed: the last command failed" : "not backed: edited after the last command ran";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Whether the list has an objective still active: the no-move mark asks for one.
|
|
34
|
+
export function hasActive(list) {
|
|
35
|
+
return Array.isArray(list?.items) && list.items.some((i) => i?.status === "active");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// The rows that make a turn "did work" for the no-move mark: an edit, write or
|
|
39
|
+
// execute that went through (its status mark ok: not failed, denied or
|
|
40
|
+
// stopped). turn_block.js stamps data-tool. An objectives call, a proposal
|
|
41
|
+
// too, is no work.
|
|
42
|
+
export const WORK_ROWS = ["edit", "write", "execute"].map((t) => `.activity-row[data-tool="${t}"] > .activity-status.ok`).join(", ");
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
// static JS is cached at unversioned URLs.
|
|
10
10
|
import { createChipPopover, SHEET_TALL } from "./chip_popover.js";
|
|
11
11
|
import { addLine, checkText, DONE, DROPPED, editableText, expireChecks, headline, markLine, nextExpiry, notYetText, pendingText, progress, rewordLine, stripItems } from "./objectives_model.js";
|
|
12
|
+
import { backingText, hasActive, stateWord } from "./objectives_state.js";
|
|
13
|
+
import { expireTracking, TRACK_LINE, trackDiffers, tracking, trackingUntil, trackText } from "./objectives_track.js";
|
|
14
|
+
import { wallClock } from "./format.js";
|
|
12
15
|
import { html, nothing, render } from "./vendor/lit-html.js";
|
|
13
16
|
|
|
14
17
|
const EXPIRY_SLACK_MS = 50;
|
|
@@ -21,8 +24,10 @@ const EXPIRY_MAX_MS = 140_000;
|
|
|
21
24
|
// @param sendMessage (text) sends it as the user's message: a promise (Not yet)
|
|
22
25
|
// @param failed (error) a refused post, to tell the user
|
|
23
26
|
// @param onChange () the list came or went
|
|
27
|
+
// @param canTrack () the worker has the tracker (its Bridge feature): Where are we? shows only then
|
|
24
28
|
export function createObjectivesStrip({ el, session = () => null, running = () => false, sendLine = async () => {},
|
|
25
|
-
sendMessage = async () => {}, failed = () => {}, onChange = () => {},
|
|
29
|
+
sendMessage = async () => {}, failed = () => {}, onChange = () => {}, canTrack = () => false,
|
|
30
|
+
doc = document, win = window }) {
|
|
26
31
|
let list = null;
|
|
27
32
|
// The item whose text is being edited; while a post is out.
|
|
28
33
|
let editing = null;
|
|
@@ -65,9 +70,20 @@ export function createObjectivesStrip({ el, session = () => null, running = () =
|
|
|
65
70
|
function subline(item) {
|
|
66
71
|
const parts = [];
|
|
67
72
|
if (item.done_when) parts.push(html`<span>done when: ${item.done_when}</span>`);
|
|
68
|
-
if (item.move)
|
|
73
|
+
if (item.move) {
|
|
74
|
+
const word = stateWord(item.move.state);
|
|
75
|
+
parts.push(html`<span>last move: ${word ? html`<span class=${`obj-state ${item.move.state}`}>${word}</span> ` : nothing}${item.move.note}${item.move.evidence ? ` (${item.move.evidence})` : ""}</span>`);
|
|
76
|
+
const flag = backingText(item.move);
|
|
77
|
+
if (flag) parts.push(html`<span class="obj-unbacked" title="From the runs of its turn before the move. Information only.">${flag}</span>`);
|
|
78
|
+
}
|
|
69
79
|
const check = checkText(item.check);
|
|
70
80
|
if (check) parts.push(html`<span class=${`obj-check ${item.check.verdict || "running"}`} title=${item.check.model ? `Read by ${item.check.model}. Information only.` : "Information only."}>${check}</span>`);
|
|
81
|
+
const track = trackText(item.track);
|
|
82
|
+
if (track) {
|
|
83
|
+
const klass = `obj-track${trackDiffers(item) ? " differs" : ""}${item.track.stale ? " stale" : ""}`;
|
|
84
|
+
const title = `${item.track.model ? `Read by ${item.track.model}. ` : ""}${item.track.stale ? "Read before the latest change. " : ""}${trackDiffers(item) ? "Differs from the agent's last move. " : ""}Information only.`;
|
|
85
|
+
parts.push(html`<span class=${klass} title=${title}>${track}<span class="obj-track-at"> · ${wallClock(item.track.at, Date.now())}</span></span>`);
|
|
86
|
+
}
|
|
71
87
|
return parts.length ? html`<div class="obj-row-sub">${parts}</div>` : nothing;
|
|
72
88
|
}
|
|
73
89
|
|
|
@@ -112,7 +128,10 @@ export function createObjectivesStrip({ el, session = () => null, running = () =
|
|
|
112
128
|
<input class="obj-input" name="text" placeholder="Add an objective" aria-label="Add an objective" autocomplete="off">
|
|
113
129
|
<button type="submit" class="obj-act" ?disabled=${busy}>Add</button>
|
|
114
130
|
</form>
|
|
115
|
-
<div class="obj-note" role="status">${waiting || "No message, no turn: the agent reads the change before its next turn."}</div
|
|
131
|
+
<div class="obj-note" role="status">${waiting || "No message, no turn: the agent reads the change before its next turn."}</div>
|
|
132
|
+
${canTrack() && hasActive(list) ? html`<div class="obj-track-row">
|
|
133
|
+
<button type="button" class="obj-act ghost" data-obj-act="track" title="One side request reads the session's record for every active objective. Information only, nothing enters the conversation" ?disabled=${busy || tracking(list)}>${tracking(list) ? "Reading where they stand…" : "Where are we?"}</button>
|
|
134
|
+
</div>` : nothing}`;
|
|
116
135
|
};
|
|
117
136
|
|
|
118
137
|
const shell = createChipPopover({
|
|
@@ -162,6 +181,8 @@ export function createObjectivesStrip({ el, session = () => null, running = () =
|
|
|
162
181
|
drawPanel();
|
|
163
182
|
} else if (act === "notyet") {
|
|
164
183
|
notYet(id);
|
|
184
|
+
} else if (act === "track") {
|
|
185
|
+
post(TRACK_LINE);
|
|
165
186
|
} else {
|
|
166
187
|
post(markLine(act, id));
|
|
167
188
|
}
|
|
@@ -198,21 +219,21 @@ export function createObjectivesStrip({ el, session = () => null, running = () =
|
|
|
198
219
|
// cap keeps a page whose clock is off from holding it for long.
|
|
199
220
|
function armExpiry() {
|
|
200
221
|
win.clearTimeout(expiry);
|
|
201
|
-
const at = nextExpiry(list);
|
|
202
|
-
if (at ===
|
|
222
|
+
const at = [nextExpiry(list), trackingUntil(list)].filter((t) => t !== null).reduce((a, b) => Math.min(a, b), Infinity);
|
|
223
|
+
if (at === Infinity) return;
|
|
203
224
|
expiry = win.setTimeout(() => {
|
|
204
|
-
list = expireChecks(list, Math.max(Date.now(), at));
|
|
225
|
+
list = expireTracking(expireChecks(list, Math.max(Date.now(), at)), Math.max(Date.now(), at));
|
|
205
226
|
draw();
|
|
206
227
|
drawPanel();
|
|
207
228
|
armExpiry();
|
|
208
229
|
}, Math.min(Math.max(at - Date.now(), 0) + EXPIRY_SLACK_MS, EXPIRY_MAX_MS));
|
|
209
230
|
}
|
|
210
231
|
|
|
211
|
-
// The list without what a check adds:
|
|
212
|
-
const listSig = (view) => JSON.stringify(view?.items?.map(({ check: _check, ...item }) => item) ?? null);
|
|
232
|
+
// The list without what a check or a track adds: their start and end aren't a change to it.
|
|
233
|
+
const listSig = (view) => JSON.stringify(view?.items?.map(({ check: _check, track: _track, ...item }) => item) ?? null);
|
|
213
234
|
|
|
214
235
|
const take = (view) => {
|
|
215
|
-
const next = view && Array.isArray(view.items) ? expireChecks(view, Date.now()) : null;
|
|
236
|
+
const next = view && Array.isArray(view.items) ? expireTracking(expireChecks(view, Date.now()), Date.now()) : null;
|
|
216
237
|
if (listSig(next) !== listSig(list)) told.clear();
|
|
217
238
|
list = next;
|
|
218
239
|
armExpiry();
|
|
@@ -233,6 +254,9 @@ export function createObjectivesStrip({ el, session = () => null, running = () =
|
|
|
233
254
|
},
|
|
234
255
|
notYet,
|
|
235
256
|
hasList: () => !!list,
|
|
257
|
+
hasActive: () => hasActive(list),
|
|
258
|
+
// An objective's last move as the view has it (its state, its backing), null with none.
|
|
259
|
+
moveOf: (id) => list?.items?.find((i) => i.id === id)?.move ?? null,
|
|
236
260
|
// A turn started or ended: the waiting line's words.
|
|
237
261
|
redraw: () => {
|
|
238
262
|
draw();
|