@artooi/ag-ui-web-component 0.24.0 → 0.25.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.
- package/CHANGELOG.md +118 -1
- package/README.md +55 -36
- package/dist/ag-ui-web-component.bundle.js +173 -43
- package/dist/ag-ui-web-component.bundle.js.map +3 -3
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/ag_ui_chat.d.ts +9 -0
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/run_index.d.ts +10 -0
- package/dist/core/run_index.d.ts.map +1 -1
- package/dist/index.js +271 -42
- package/dist/index.js.map +2 -2
- package/dist/ui/checkpoint_menu.d.ts.map +1 -1
- package/dist/ui/styles.d.ts +1 -1
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/tool_call_card.d.ts +26 -2
- package/dist/ui/tool_call_card.d.ts.map +1 -1
- package/dist/ui/ui_strings.d.ts +2 -0
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +10 -0
- package/src/core/ag_ui_chat.ts +115 -41
- package/src/core/run_index.ts +10 -0
- package/src/ui/checkpoint_menu.ts +32 -7
- package/src/ui/styles.ts +140 -10
- package/src/ui/tool_call_card.ts +41 -3
- package/src/ui/ui_strings.ts +3 -0
- package/src/version.ts +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -82,9 +82,19 @@ export declare const MAX_TOOL_ROUNDS = 10;
|
|
|
82
82
|
/**
|
|
83
83
|
* Lifecycle status of a rendered tool-call card. A card opens as `PENDING`
|
|
84
84
|
* while the call runs, then settles to `DONE`, `ERROR`, or `DECLINED`.
|
|
85
|
+
*
|
|
86
|
+
* `DEFERRED` is the one non-terminal state that is not "running": a server-side
|
|
87
|
+
* tool a `ToolGuard` gated never executed, the run finished on an interrupt, and
|
|
88
|
+
* the call is waiting on a person. Without it such a card sat at `PENDING` and
|
|
89
|
+
* read "running…" while the stream was over and the server idle — a status enum
|
|
90
|
+
* missing a state does not omit that state, it renders it as whichever neighbour
|
|
91
|
+
* is closest, and here the closest one claimed the opposite of the truth. A
|
|
92
|
+
* *frontend* tool waiting on its own card (`ask_user`) stays `PENDING`, because
|
|
93
|
+
* the browser really is running it.
|
|
85
94
|
*/
|
|
86
95
|
export declare const TOOL_CALL_STATUS: {
|
|
87
96
|
readonly PENDING: "pending";
|
|
97
|
+
readonly DEFERRED: "deferred";
|
|
88
98
|
readonly DONE: "done";
|
|
89
99
|
readonly ERROR: "error";
|
|
90
100
|
readonly DECLINED: "declined";
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,wEAAwE;AACxE,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC,kEAAkE;AAClE,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,qCAAqC;AACrC,eAAO,MAAM,YAAY;aACvB,IAAI,EAAE,MAAM;aACZ,SAAS,EAAE,WAAW;CACd,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,cAA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,KAAK,EAAE,OAAO;CACN,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,QAAmB,CAAC;AAE7D;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;aACvB,MAAM,EAAE,QAAQ;aAChB,OAAO,EAAE,SAAS;aAClB,OAAO,EAAE,SAAS;aAClB,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,eAAe,CAAC;AAErD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,yHAAiH,CAAC;AAExI,yEAAyE;AACzE,eAAO,MAAM,SAAS,qJAAqI,CAAC;AAE5J,2CAA2C;AAC3C,eAAO,MAAM,WAAW,wJAAgJ,CAAC;AAEzK,yDAAyD;AACzD,eAAO,MAAM,UAAU,0MAA8L,CAAC;AAEtN,mFAAmF;AACnF,eAAO,MAAM,aAAa,2KAAmK,CAAC;AAE9L;;;;;GAKG;AACH,eAAO,MAAM,SAAS,0KAAgK,CAAC;AAEvL,sEAAsE;AACtE,eAAO,MAAM,eAAe,kOAA0M,CAAC;AAEvO,sEAAsE;AACtE,eAAO,MAAM,aAAa,iQAA2O,CAAC;AAEtQ,gDAAgD;AAChD,eAAO,MAAM,cAAc,8MAAkM,CAAC"}
|
|
@@ -342,6 +342,15 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
342
342
|
* an empty panel.
|
|
343
343
|
*/
|
|
344
344
|
openCheckpoints(): void;
|
|
345
|
+
/** Close the checkpoints panel, if it is open. */
|
|
346
|
+
closeCheckpoints(): void;
|
|
347
|
+
/**
|
|
348
|
+
* Open the checkpoints panel, or close it if it is already open — what the
|
|
349
|
+
* built-in ⭯ button does, because a control that opens a panel is read as the
|
|
350
|
+
* control that also dismisses it. {@link openCheckpoints} stays open-only for a
|
|
351
|
+
* host that means exactly that.
|
|
352
|
+
*/
|
|
353
|
+
toggleCheckpoints(): void;
|
|
345
354
|
/**
|
|
346
355
|
* Start a fresh conversation: forget the persisted history, drop the
|
|
347
356
|
* in-memory run state, clear the transcript, and mint a new thread id.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAsB,IAAI,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EASL,YAAY,EAWb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,kCAAkC,CAAC;AAGvF,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAwB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AASzF,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAE1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,wBAAwB,CAAC;AAG5E,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,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,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAkBhE;IA4fD;;;;;;;;;;;;;;OAcG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,SAAS,aAAa,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB5F;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAM9B;CAqhBF"}
|
package/dist/core/run_index.d.ts
CHANGED
|
@@ -6,6 +6,16 @@ export interface RunRow {
|
|
|
6
6
|
readonly started_at: string | null;
|
|
7
7
|
/** Whether the run has a snapshot to seed from — see {@link RunIndex}. */
|
|
8
8
|
readonly continuable: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The run's first user message, one line, already truncated by the server —
|
|
11
|
+
* the only field in a row a person recognises a conversation by.
|
|
12
|
+
*
|
|
13
|
+
* Optional because a server predating the field does not send it, and
|
|
14
|
+
* `null` where the run holds no words to show (seeded from history alone, or
|
|
15
|
+
* opened with an image and no caption). A row without one falls back to the
|
|
16
|
+
* time plus a short id, which is what every row used to be.
|
|
17
|
+
*/
|
|
18
|
+
readonly preview?: string | null;
|
|
9
19
|
}
|
|
10
20
|
/** Live header source, read per request so rotated tokens / CSRF reach the server. */
|
|
11
21
|
type HeadersProvider = () => Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_index.d.ts","sourceRoot":"","sources":["../../src/core/run_index.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"run_index.d.ts","sourceRoot":"","sources":["../../src/core/run_index.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,sFAAsF;AACtF,KAAK,eAAe,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD,kFAAkF;AAClF,KAAK,mBAAmB,GAAG,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAEhE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,QAAQ;;IAKnB,YACE,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,eAA4B,EACrC,WAAW,GAAE,mBAAqC,EAKnD;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAoBvC;IAED,+CAA+C;IACzC,WAAW,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAE9C;IAED,wDAAwD;IACxD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/B;IAED,uFAAuF;IACvF,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7B;CAaF"}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var READ_PAGE_TOOL = "read_page";
|
|
|
18
18
|
var MAX_TOOL_ROUNDS = 10;
|
|
19
19
|
var TOOL_CALL_STATUS = {
|
|
20
20
|
PENDING: "pending",
|
|
21
|
+
DEFERRED: "deferred",
|
|
21
22
|
DONE: "done",
|
|
22
23
|
ERROR: "error",
|
|
23
24
|
DECLINED: "declined"
|
|
@@ -554,6 +555,7 @@ var DEFAULT_UI_STRINGS = {
|
|
|
554
555
|
transcribing: "Transcribing\u2026",
|
|
555
556
|
transcriptionFailed: "Transcription failed",
|
|
556
557
|
toolRunning: "running\u2026",
|
|
558
|
+
toolDeferred: "waiting for you",
|
|
557
559
|
toolDone: "\u2713 done",
|
|
558
560
|
toolError: "\u26A0 error",
|
|
559
561
|
toolDeclined: "\u2298 declined",
|
|
@@ -1122,12 +1124,27 @@ var CheckpointMenu = class {
|
|
|
1122
1124
|
const row = document.createElement("div");
|
|
1123
1125
|
row.className = "checkpoint-row";
|
|
1124
1126
|
row.setAttribute("part", "checkpoint-row");
|
|
1127
|
+
const preview = run.preview !== void 0 && run.preview !== null && run.preview !== "" ? run.preview : null;
|
|
1128
|
+
const time = run.started_at === null ? null : relativeTime(Date.parse(run.started_at), Date.now(), this.#strings);
|
|
1125
1129
|
const label = document.createElement("span");
|
|
1126
1130
|
label.className = "checkpoint-label";
|
|
1127
1131
|
label.setAttribute("part", "checkpoint-label");
|
|
1128
|
-
label.textContent =
|
|
1129
|
-
label.title = run.run_id;
|
|
1132
|
+
label.textContent = preview ?? time ?? run.run_id;
|
|
1130
1133
|
row.append(label);
|
|
1134
|
+
if (preview !== null && time !== null) {
|
|
1135
|
+
const when = document.createElement("span");
|
|
1136
|
+
when.className = "checkpoint-time";
|
|
1137
|
+
when.setAttribute("part", "checkpoint-time");
|
|
1138
|
+
when.textContent = time;
|
|
1139
|
+
row.append(when);
|
|
1140
|
+
} else if (run.started_at !== null) {
|
|
1141
|
+
const short = document.createElement("span");
|
|
1142
|
+
short.className = "checkpoint-id";
|
|
1143
|
+
short.setAttribute("part", "checkpoint-id");
|
|
1144
|
+
short.textContent = run.run_id.slice(0, 8);
|
|
1145
|
+
short.title = run.run_id;
|
|
1146
|
+
row.append(short);
|
|
1147
|
+
}
|
|
1131
1148
|
if (run.parent_run_id !== null) {
|
|
1132
1149
|
const branch = document.createElement("span");
|
|
1133
1150
|
branch.className = "checkpoint-branch";
|
|
@@ -5443,6 +5460,13 @@ var STYLES = `
|
|
|
5443
5460
|
to { transform: rotate(360deg); }
|
|
5444
5461
|
}
|
|
5445
5462
|
|
|
5463
|
+
/* Deferred: no spinner, because nothing is spinning. A steady accent dot, since
|
|
5464
|
+
the state is waiting-on-you rather than an outcome. */
|
|
5465
|
+
.tool-call[data-status="deferred"] .tool-call-icon {
|
|
5466
|
+
border-radius: 50%;
|
|
5467
|
+
background: var(--_accent);
|
|
5468
|
+
}
|
|
5469
|
+
|
|
5446
5470
|
/* Settled: a themeable glyph coloured by outcome. */
|
|
5447
5471
|
.tool-call[data-status="done"] .tool-call-icon::before {
|
|
5448
5472
|
content: var(--_tool-icon-done);
|
|
@@ -5485,6 +5509,10 @@ var STYLES = `
|
|
|
5485
5509
|
color: var(--_muted);
|
|
5486
5510
|
}
|
|
5487
5511
|
|
|
5512
|
+
.tool-call[data-status="deferred"] .tool-call-status {
|
|
5513
|
+
color: var(--_accent);
|
|
5514
|
+
}
|
|
5515
|
+
|
|
5488
5516
|
.tool-call[data-status="done"] .tool-call-status {
|
|
5489
5517
|
color: var(--_success);
|
|
5490
5518
|
}
|
|
@@ -5578,12 +5606,41 @@ var STYLES = `
|
|
|
5578
5606
|
|
|
5579
5607
|
/* A pending card has no result yet, and in the modes where the arguments are
|
|
5580
5608
|
hidden too there is nothing behind the toggle. Hide the control rather than
|
|
5581
|
-
offer one that expands onto nothing.
|
|
5609
|
+
offer one that expands onto nothing. A deferred card is the same, and its
|
|
5610
|
+
arguments are shown unconditionally by the rules below. */
|
|
5582
5611
|
.tool-call[data-status="pending"] .tool-call-toggle,
|
|
5612
|
+
.tool-call[data-status="deferred"] .tool-call-toggle,
|
|
5583
5613
|
:host([data-tool-display="inline"]) .tool-call[data-status="pending"] .tool-call-toggle {
|
|
5584
5614
|
display: none;
|
|
5585
5615
|
}
|
|
5586
5616
|
|
|
5617
|
+
/* The approval prompt for a gated call, rendered inside that call's own card.
|
|
5618
|
+
Empty on every card nobody is being asked about, so it collapses instead of
|
|
5619
|
+
adding a gap to each one. */
|
|
5620
|
+
.tool-call-approval:empty {
|
|
5621
|
+
display: none;
|
|
5622
|
+
}
|
|
5623
|
+
|
|
5624
|
+
.tool-call-approval {
|
|
5625
|
+
margin-top: 8px;
|
|
5626
|
+
}
|
|
5627
|
+
|
|
5628
|
+
/* A card that is asking a question shows what it is asking about, in every
|
|
5629
|
+
display mode. Three gated calls of one tool ask the same words, so the
|
|
5630
|
+
arguments are the only thing telling them apart, and a density setting must
|
|
5631
|
+
not be able to hide the answer to "which one is this". */
|
|
5632
|
+
:host([data-tool-display="minimal"]) .tool-call[data-status="deferred"] .tool-call-body {
|
|
5633
|
+
display: flex;
|
|
5634
|
+
}
|
|
5635
|
+
|
|
5636
|
+
/* The arguments region only, never every section: the result region carries the
|
|
5637
|
+
hidden attribute until a result exists, and a display value here overrides it,
|
|
5638
|
+
framing an empty RESULT heading under the question. */
|
|
5639
|
+
:host([data-tool-display="compact"]) .tool-call[data-status="deferred"] .tool-call-section--args,
|
|
5640
|
+
:host([data-tool-display="inline"]) .tool-call[data-status="deferred"] .tool-call-section--args {
|
|
5641
|
+
display: flex;
|
|
5642
|
+
}
|
|
5643
|
+
|
|
5587
5644
|
.tool-call-toggle {
|
|
5588
5645
|
align-self: flex-start;
|
|
5589
5646
|
border: none;
|
|
@@ -5803,6 +5860,20 @@ var STYLES = `
|
|
|
5803
5860
|
opacity: 0.6;
|
|
5804
5861
|
}
|
|
5805
5862
|
|
|
5863
|
+
/* The same trap the attachment tray carries a note about, two rules along: an
|
|
5864
|
+
author display beats the UA stylesheet's rule for the hidden property, so a
|
|
5865
|
+
button the element has explicitly hidden keeps laying out and painting. The
|
|
5866
|
+
clip is hidden until a host supplies an upload handler or an attachments URL,
|
|
5867
|
+
and without this it is a visible control that cannot do anything.
|
|
5868
|
+
|
|
5869
|
+
The mic needs no such rule, and the asymmetry is worth knowing before adding
|
|
5870
|
+
one: it is not hidden when unconfigured, it is never built. The voice wiring
|
|
5871
|
+
returns before constructing the button, leaving only an empty voice slot that
|
|
5872
|
+
is display: contents. A hidden-state rule for the mic would match nothing. */
|
|
5873
|
+
.attach-btn[hidden] {
|
|
5874
|
+
display: none;
|
|
5875
|
+
}
|
|
5876
|
+
|
|
5806
5877
|
/* Send closes the row on the right: a circle, the only filled control in the
|
|
5807
5878
|
composer, so "the thing that acts" reads at a glance. */
|
|
5808
5879
|
.send {
|
|
@@ -6412,47 +6483,123 @@ var STYLES = `
|
|
|
6412
6483
|
opacity: 0.7;
|
|
6413
6484
|
}
|
|
6414
6485
|
|
|
6486
|
+
/* A row is a label and two buttons, and nothing about the row itself is
|
|
6487
|
+
pressable. It used to light up on hover, which is the affordance of something
|
|
6488
|
+
clickable and made the buttons look like decoration on a clickable strip. The
|
|
6489
|
+
resting surface groups the row instead, so hover can mean what it says: only
|
|
6490
|
+
the buttons respond to it. */
|
|
6491
|
+
/* A row is a label and two buttons, and nothing about the row itself is
|
|
6492
|
+
pressable. It used to light up on hover, which is the affordance of something
|
|
6493
|
+
clickable and made the buttons look like decoration on a clickable strip. The
|
|
6494
|
+
resting surface groups the row instead, so hover can mean what it says: only
|
|
6495
|
+
the buttons respond to it.
|
|
6496
|
+
|
|
6497
|
+
It wraps for the same reason the tool-call head does. Every child but the label
|
|
6498
|
+
is fixed-width, so in a narrow panel the label is the only thing that can give
|
|
6499
|
+
-- and a flex-basis of zero lets it give everything. Adding the run id was
|
|
6500
|
+
enough to crush "just now" to zero pixels: present, correct, and invisible.
|
|
6501
|
+
Wrapping puts the buttons on their own line instead. */
|
|
6415
6502
|
.checkpoint-row {
|
|
6416
6503
|
display: flex;
|
|
6504
|
+
flex-wrap: wrap;
|
|
6417
6505
|
align-items: center;
|
|
6418
6506
|
gap: 0.5rem;
|
|
6419
|
-
padding: 0.
|
|
6507
|
+
padding: 0.3125rem 0.4375rem;
|
|
6420
6508
|
border-radius: 0.375rem;
|
|
6421
|
-
}
|
|
6422
|
-
|
|
6423
|
-
.checkpoint-row:hover {
|
|
6424
6509
|
background: var(--_hover);
|
|
6425
6510
|
}
|
|
6426
6511
|
|
|
6512
|
+
/* Grows into spare room, and refuses to shrink past the shortest thing it ever
|
|
6513
|
+
says. A time is short and bounded, so there is no case for eliding it. */
|
|
6427
6514
|
.checkpoint-label {
|
|
6428
|
-
flex: 1;
|
|
6515
|
+
flex: 1 1 auto;
|
|
6516
|
+
min-width: 7ch;
|
|
6429
6517
|
font-size: 0.8125rem;
|
|
6430
6518
|
white-space: nowrap;
|
|
6431
6519
|
overflow: hidden;
|
|
6432
6520
|
text-overflow: ellipsis;
|
|
6433
6521
|
}
|
|
6434
6522
|
|
|
6523
|
+
/* When the label holds the run's first message, the time moves here: still worth
|
|
6524
|
+
showing, no longer what identifies the row. Muted and unshrinkable, so it does
|
|
6525
|
+
not compete with the words beside it. */
|
|
6526
|
+
.checkpoint-time {
|
|
6527
|
+
flex: 0 0 auto;
|
|
6528
|
+
font-size: 0.6875rem;
|
|
6529
|
+
opacity: 0.7;
|
|
6530
|
+
white-space: nowrap;
|
|
6531
|
+
}
|
|
6532
|
+
|
|
6533
|
+
/* Enough of the run id to tell two runs apart when both say "just now". Muted
|
|
6534
|
+
and monospaced: it is a reference, not a name. */
|
|
6535
|
+
.checkpoint-id {
|
|
6536
|
+
flex: 0 0 auto;
|
|
6537
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
6538
|
+
font-size: 0.6875rem;
|
|
6539
|
+
opacity: 0.55;
|
|
6540
|
+
}
|
|
6541
|
+
|
|
6542
|
+
/* On the panel's own surface, not the row's: the row now paints the hover token
|
|
6543
|
+
itself, and a badge the same colour as what it sits on is not a badge. */
|
|
6435
6544
|
.checkpoint-branch {
|
|
6436
6545
|
font-size: 0.6875rem;
|
|
6437
6546
|
padding: 0 0.375rem;
|
|
6438
6547
|
border-radius: 999px;
|
|
6439
|
-
background: var(--
|
|
6548
|
+
background: var(--_assistant-bg);
|
|
6440
6549
|
opacity: 0.8;
|
|
6441
6550
|
}
|
|
6442
6551
|
|
|
6552
|
+
/* The two things in the row that actually do something, so they are the two
|
|
6553
|
+
things that look like it: a filled surface at rest rather than a transparent
|
|
6554
|
+
outline, which on top of the old row highlight was nearly invisible. */
|
|
6443
6555
|
.checkpoint-action {
|
|
6444
6556
|
font: inherit;
|
|
6445
6557
|
font-size: 0.75rem;
|
|
6558
|
+
line-height: 1.4;
|
|
6446
6559
|
cursor: pointer;
|
|
6447
|
-
padding: 0.
|
|
6560
|
+
padding: 0.1875rem 0.5625rem;
|
|
6448
6561
|
border: 1px solid var(--_border);
|
|
6449
6562
|
border-radius: 0.375rem;
|
|
6450
|
-
background:
|
|
6563
|
+
background: var(--_bg);
|
|
6451
6564
|
color: inherit;
|
|
6565
|
+
transition:
|
|
6566
|
+
background var(--_motion) var(--_ease),
|
|
6567
|
+
border-color var(--_motion) var(--_ease),
|
|
6568
|
+
transform var(--_motion) var(--_ease);
|
|
6569
|
+
}
|
|
6570
|
+
|
|
6571
|
+
/* Resume is what a reader wants nine times in ten; fork is the deliberate choice
|
|
6572
|
+
beside it. Filled and outlined, the same pair the confirmation and approval
|
|
6573
|
+
cards already use for their primary and secondary action. */
|
|
6574
|
+
.checkpoint-resume {
|
|
6575
|
+
font-weight: 600;
|
|
6576
|
+
border-color: var(--_accent);
|
|
6577
|
+
background: var(--_accent);
|
|
6578
|
+
color: #ffffff;
|
|
6452
6579
|
}
|
|
6453
6580
|
|
|
6454
|
-
.checkpoint-
|
|
6581
|
+
.checkpoint-fork:hover {
|
|
6455
6582
|
background: var(--_hover);
|
|
6583
|
+
border-color: var(--_accent);
|
|
6584
|
+
}
|
|
6585
|
+
|
|
6586
|
+
/* The filled one cannot go lighter on hover without losing its contrast with the
|
|
6587
|
+
white label, so it dims instead. */
|
|
6588
|
+
.checkpoint-resume:hover {
|
|
6589
|
+
opacity: 0.88;
|
|
6590
|
+
}
|
|
6591
|
+
|
|
6592
|
+
/* Pressed: a pixel down, so the click is felt as well as seen. */
|
|
6593
|
+
.checkpoint-action:active {
|
|
6594
|
+
transform: translateY(1px);
|
|
6595
|
+
}
|
|
6596
|
+
|
|
6597
|
+
/* Keyboard focus was invisible here, in a panel that traps focus and is reached
|
|
6598
|
+
by Tab -- so the one navigation path guaranteed to land on these buttons was
|
|
6599
|
+
the one with nothing to show for it. */
|
|
6600
|
+
.checkpoint-action:focus-visible {
|
|
6601
|
+
outline: 2px solid var(--_accent);
|
|
6602
|
+
outline-offset: 2px;
|
|
6456
6603
|
}
|
|
6457
6604
|
|
|
6458
6605
|
.drawer-backdrop {
|
|
@@ -6949,6 +7096,7 @@ var ThreadDrawer = class {
|
|
|
6949
7096
|
function statusLabels(strings) {
|
|
6950
7097
|
return {
|
|
6951
7098
|
[TOOL_CALL_STATUS.PENDING]: strings.toolRunning,
|
|
7099
|
+
[TOOL_CALL_STATUS.DEFERRED]: strings.toolDeferred,
|
|
6952
7100
|
[TOOL_CALL_STATUS.DONE]: strings.toolDone,
|
|
6953
7101
|
[TOOL_CALL_STATUS.ERROR]: strings.toolError,
|
|
6954
7102
|
[TOOL_CALL_STATUS.DECLINED]: strings.toolDeclined
|
|
@@ -6971,6 +7119,20 @@ function formatPayload(text2) {
|
|
|
6971
7119
|
var ToolCallCard = class {
|
|
6972
7120
|
/** The card's root element; append this into the message list. */
|
|
6973
7121
|
element;
|
|
7122
|
+
/**
|
|
7123
|
+
* Where a question about *this* call renders — the approval prompt for a
|
|
7124
|
+
* server-side tool the run deferred.
|
|
7125
|
+
*
|
|
7126
|
+
* It belongs to the card rather than to the transcript because a run can defer
|
|
7127
|
+
* several calls at once, and a prompt written per *tool* ("Add this event to
|
|
7128
|
+
* the board?") is identical for every one of them. Rendered into the answer
|
|
7129
|
+
* group they were three anonymous copies of one question, below the three
|
|
7130
|
+
* cards they gated; rendered here, position identifies them and the arguments
|
|
7131
|
+
* are already on screen above the question.
|
|
7132
|
+
*
|
|
7133
|
+
* Empty until used, and hidden while empty by the shadow CSS.
|
|
7134
|
+
*/
|
|
7135
|
+
approvalSlot;
|
|
6974
7136
|
#status;
|
|
6975
7137
|
#decision;
|
|
6976
7138
|
#toggle;
|
|
@@ -7026,7 +7188,24 @@ var ToolCallCard = class {
|
|
|
7026
7188
|
body.className = "tool-call-body";
|
|
7027
7189
|
body.setAttribute("part", "tool-card-body");
|
|
7028
7190
|
body.append(argsSection.root, resultSection.root);
|
|
7029
|
-
this.
|
|
7191
|
+
this.approvalSlot = document.createElement("div");
|
|
7192
|
+
this.approvalSlot.className = "tool-call-approval";
|
|
7193
|
+
this.approvalSlot.setAttribute("part", "tool-card-approval");
|
|
7194
|
+
this.element.append(head, this.#toggle, body, this.approvalSlot);
|
|
7195
|
+
}
|
|
7196
|
+
/**
|
|
7197
|
+
* Move between the two states that are not an outcome — `pending` (running)
|
|
7198
|
+
* and `deferred` (gated, waiting on a person).
|
|
7199
|
+
*
|
|
7200
|
+
* Ignored once {@link settle} has run: a card that was declined must not be
|
|
7201
|
+
* talked back into looking live by a late event.
|
|
7202
|
+
*/
|
|
7203
|
+
mark(status) {
|
|
7204
|
+
if (this.#settled) {
|
|
7205
|
+
return;
|
|
7206
|
+
}
|
|
7207
|
+
this.element.setAttribute("data-status", status);
|
|
7208
|
+
this.#status.textContent = statusLabels(this.#strings)[status];
|
|
7030
7209
|
}
|
|
7031
7210
|
/**
|
|
7032
7211
|
* Record that a human approved or declined this call, as a line in the card.
|
|
@@ -9227,6 +9406,7 @@ var AgUiChat = class extends HTMLElement {
|
|
|
9227
9406
|
* {@link toggleCollapsed} and {@link toggleTheme}.
|
|
9228
9407
|
*/
|
|
9229
9408
|
openThreads() {
|
|
9409
|
+
this.#checkpoints.close();
|
|
9230
9410
|
void this.#refreshDrawer();
|
|
9231
9411
|
this.#drawer.open();
|
|
9232
9412
|
}
|
|
@@ -9238,9 +9418,27 @@ var AgUiChat = class extends HTMLElement {
|
|
|
9238
9418
|
* an empty panel.
|
|
9239
9419
|
*/
|
|
9240
9420
|
openCheckpoints() {
|
|
9421
|
+
this.#drawer.close();
|
|
9241
9422
|
void this.#refreshCheckpoints();
|
|
9242
9423
|
this.#checkpoints.open();
|
|
9243
9424
|
}
|
|
9425
|
+
/** Close the checkpoints panel, if it is open. */
|
|
9426
|
+
closeCheckpoints() {
|
|
9427
|
+
this.#checkpoints.close();
|
|
9428
|
+
}
|
|
9429
|
+
/**
|
|
9430
|
+
* Open the checkpoints panel, or close it if it is already open — what the
|
|
9431
|
+
* built-in ⭯ button does, because a control that opens a panel is read as the
|
|
9432
|
+
* control that also dismisses it. {@link openCheckpoints} stays open-only for a
|
|
9433
|
+
* host that means exactly that.
|
|
9434
|
+
*/
|
|
9435
|
+
toggleCheckpoints() {
|
|
9436
|
+
if (this.#checkpoints.open_) {
|
|
9437
|
+
this.#checkpoints.close();
|
|
9438
|
+
return;
|
|
9439
|
+
}
|
|
9440
|
+
this.openCheckpoints();
|
|
9441
|
+
}
|
|
9244
9442
|
/**
|
|
9245
9443
|
* Start a fresh conversation: forget the persisted history, drop the
|
|
9246
9444
|
* in-memory run state, clear the transcript, and mint a new thread id.
|
|
@@ -9505,8 +9703,8 @@ var AgUiChat = class extends HTMLElement {
|
|
|
9505
9703
|
controls.setAttribute("part", "header-controls");
|
|
9506
9704
|
const history = this.#headerButton("history", this.#strings.chatHistory, "\u2630");
|
|
9507
9705
|
history.addEventListener("click", () => this.openThreads());
|
|
9508
|
-
const checkpoints = this.#headerButton("checkpoints", this.#strings.checkpoints, "\
|
|
9509
|
-
checkpoints.addEventListener("click", () => this.
|
|
9706
|
+
const checkpoints = this.#headerButton("checkpoints", this.#strings.checkpoints, "\u21BA");
|
|
9707
|
+
checkpoints.addEventListener("click", () => this.toggleCheckpoints());
|
|
9510
9708
|
const newChat = this.#headerButton("new", this.#strings.newChat, "\u271A");
|
|
9511
9709
|
newChat.addEventListener("click", () => this.newChat());
|
|
9512
9710
|
const collapse = this.#headerButton("collapse", this.#strings.collapse, "\u2014");
|
|
@@ -9607,6 +9805,16 @@ var AgUiChat = class extends HTMLElement {
|
|
|
9607
9805
|
this.#drawer.element,
|
|
9608
9806
|
this.#checkpoints.element
|
|
9609
9807
|
);
|
|
9808
|
+
this.#chat.addEventListener("pointerdown", (event) => {
|
|
9809
|
+
if (!this.#checkpoints.open_) {
|
|
9810
|
+
return;
|
|
9811
|
+
}
|
|
9812
|
+
const path = event.composedPath();
|
|
9813
|
+
if (path.includes(this.#checkpoints.element) || path.includes(checkpoints)) {
|
|
9814
|
+
return;
|
|
9815
|
+
}
|
|
9816
|
+
this.#checkpoints.close();
|
|
9817
|
+
});
|
|
9610
9818
|
this.#launcher.className = "launcher";
|
|
9611
9819
|
this.#launcher.type = "button";
|
|
9612
9820
|
this.#launcher.setAttribute("part", "launcher");
|
|
@@ -10024,40 +10232,61 @@ var AgUiChat = class extends HTMLElement {
|
|
|
10024
10232
|
* Render an approval card per server-side-tool interrupt and collect the
|
|
10025
10233
|
* user's decisions (approve → run it, deny → decline it).
|
|
10026
10234
|
*
|
|
10235
|
+
* **One card per gated call, in that call's own tool card, all at once.** A run
|
|
10236
|
+
* can defer several calls, and the wire answers each independently — so the UI
|
|
10237
|
+
* has to let a person answer each independently, which means saying which is
|
|
10238
|
+
* which. The prompt cannot: it comes from the tool's `x-confirm` and is
|
|
10239
|
+
* identical for every call of that tool. The tool card can, by position, and it
|
|
10240
|
+
* is already showing the arguments. Asking them serially was the other half of
|
|
10241
|
+
* the problem: the second question only appeared once the first was answered,
|
|
10242
|
+
* so a person could neither compare them nor tell that more were coming.
|
|
10243
|
+
*
|
|
10244
|
+
* Each gated card is marked `deferred` for the wait. That is not cosmetic — at
|
|
10245
|
+
* `pending` it read "running…" while the stream was over and the server idle.
|
|
10246
|
+
*
|
|
10027
10247
|
* The run is suspended on these cards. A Stop while any is open aborts the
|
|
10028
10248
|
* shared {@link #confirmAbort} controller, resolving every still-open card as
|
|
10029
10249
|
* denied. An approved tool runs on the follow-up resume run and streams its
|
|
10030
|
-
* result into the same
|
|
10031
|
-
* result will ever arrive.
|
|
10250
|
+
* result into the same card (returned to `pending`, since it now really is
|
|
10251
|
+
* running); a denied one settles here, as no result will ever arrive.
|
|
10032
10252
|
*/
|
|
10033
10253
|
async #resolveInterrupts(interrupts) {
|
|
10034
|
-
const responses = {};
|
|
10035
10254
|
this.#confirmAbort = new AbortController();
|
|
10036
10255
|
this.#hidePending();
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
request
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10256
|
+
const signal = this.#confirmAbort.signal;
|
|
10257
|
+
const answered = await Promise.all(
|
|
10258
|
+
interrupts.map(async (interrupt) => {
|
|
10259
|
+
const card = interrupt.toolCallId !== void 0 ? this.#toolCards.get(interrupt.toolCallId) : void 0;
|
|
10260
|
+
const request = {};
|
|
10261
|
+
const phrase = confirmPhrase(interrupt) ?? interrupt.message;
|
|
10262
|
+
if (phrase !== void 0) {
|
|
10263
|
+
request.message = phrase;
|
|
10264
|
+
}
|
|
10265
|
+
const toolName = card?.element.getAttribute("data-tool-name");
|
|
10266
|
+
if (toolName !== null && toolName !== void 0) {
|
|
10267
|
+
request.toolName = toolName;
|
|
10268
|
+
}
|
|
10269
|
+
card?.mark(TOOL_CALL_STATUS.DEFERRED);
|
|
10270
|
+
const approved = this.approvalRenderer !== null ? await this.approvalRenderer(request, { signal }) : await requestApproval(card?.approvalSlot ?? this.#ensureGroup(), request, {
|
|
10271
|
+
signal,
|
|
10272
|
+
strings: this.#strings
|
|
10273
|
+
});
|
|
10274
|
+
card?.recordDecision(approved ? "approved" : "declined");
|
|
10275
|
+
if (approved) {
|
|
10276
|
+
card?.mark(TOOL_CALL_STATUS.PENDING);
|
|
10277
|
+
} else {
|
|
10278
|
+
card?.settle(TOOL_CALL_STATUS.DECLINED, this.#strings.declinedAction);
|
|
10279
|
+
}
|
|
10280
|
+
return { id: interrupt.id, approved };
|
|
10281
|
+
})
|
|
10282
|
+
);
|
|
10283
|
+
this.#updateEmptyState();
|
|
10284
|
+
this.#messages.scrollTop = this.#messages.scrollHeight;
|
|
10060
10285
|
this.#confirmAbort = null;
|
|
10286
|
+
const responses = {};
|
|
10287
|
+
for (const { id, approved } of answered) {
|
|
10288
|
+
responses[id] = approved ? { status: "resolved", payload: { approved: true } } : { status: "cancelled" };
|
|
10289
|
+
}
|
|
10061
10290
|
return responses;
|
|
10062
10291
|
}
|
|
10063
10292
|
#handlers() {
|
|
@@ -10354,7 +10583,7 @@ function setControlValue(el, value) {
|
|
|
10354
10583
|
}
|
|
10355
10584
|
|
|
10356
10585
|
// src/version.ts
|
|
10357
|
-
var VERSION = "0.
|
|
10586
|
+
var VERSION = "0.25.0";
|
|
10358
10587
|
export {
|
|
10359
10588
|
ATTACHMENT_EVENT,
|
|
10360
10589
|
AgUiChat,
|