@artooi/ag-ui-web-component 0.38.0 → 0.40.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 +515 -1
- package/README.md +232 -56
- package/dist/ag-ui-web-component.bundle.js +370 -139
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/constants.d.ts +17 -14
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/activity_registry.d.ts +46 -0
- package/dist/core/activity_registry.d.ts.map +1 -0
- package/dist/core/ag_ui_chat.d.ts +23 -10
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +28 -0
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/core/client_seed.d.ts +27 -0
- package/dist/core/client_seed.d.ts.map +1 -0
- package/dist/core/read_max_tool_rounds.d.ts +9 -0
- package/dist/core/read_max_tool_rounds.d.ts.map +1 -0
- package/dist/core/run_handlers.d.ts +80 -0
- package/dist/core/run_handlers.d.ts.map +1 -0
- package/dist/core/storage_scope.d.ts +110 -0
- package/dist/core/storage_scope.d.ts.map +1 -0
- package/dist/core/tool_outcome.d.ts +2 -3
- package/dist/core/tool_outcome.d.ts.map +1 -1
- package/dist/core/utils.d.ts +46 -0
- package/dist/core/utils.d.ts.map +1 -1
- package/dist/index.js +16268 -14747
- package/dist/index.js.map +4 -4
- package/dist/skills/skill_catalog.d.ts +67 -0
- package/dist/skills/skill_catalog.d.ts.map +1 -0
- package/dist/skills/skill_name_from.d.ts +12 -0
- package/dist/skills/skill_name_from.d.ts.map +1 -0
- package/dist/tools/tool_catalog.d.ts +79 -0
- package/dist/tools/tool_catalog.d.ts.map +1 -0
- package/dist/tools/tool_dispatch.d.ts +104 -0
- package/dist/tools/tool_dispatch.d.ts.map +1 -0
- package/dist/ui/composer/attachment_tray.d.ts.map +1 -1
- package/dist/ui/composer/auto_grow.d.ts +10 -0
- package/dist/ui/composer/auto_grow.d.ts.map +1 -0
- package/dist/ui/composer/composer_attachments.d.ts +57 -0
- package/dist/ui/composer/composer_attachments.d.ts.map +1 -0
- package/dist/ui/composer/composer_voice.d.ts +48 -0
- package/dist/ui/composer/composer_voice.d.ts.map +1 -0
- package/dist/ui/composer/voice_input.d.ts.map +1 -1
- package/dist/ui/excerpts/transcript_quote_offer.d.ts +57 -0
- package/dist/ui/excerpts/transcript_quote_offer.d.ts.map +1 -0
- package/dist/ui/fill_ui_string.d.ts +32 -0
- package/dist/ui/fill_ui_string.d.ts.map +1 -0
- package/dist/ui/history/conversation_history.d.ts +203 -0
- package/dist/ui/history/conversation_history.d.ts.map +1 -0
- package/dist/ui/history/relative_time.d.ts.map +1 -1
- package/dist/ui/history/thread_drawer.d.ts +0 -14
- package/dist/ui/history/thread_drawer.d.ts.map +1 -1
- package/dist/ui/interrupts/confirmation_card.d.ts.map +1 -1
- package/dist/ui/interrupts/pending_decision.d.ts +23 -0
- package/dist/ui/interrupts/pending_decision.d.ts.map +1 -0
- package/dist/ui/placement/is_collapsible_placement.d.ts +18 -0
- package/dist/ui/placement/is_collapsible_placement.d.ts.map +1 -0
- package/dist/ui/placement/is_draggable_placement.d.ts +9 -0
- package/dist/ui/placement/is_draggable_placement.d.ts.map +1 -0
- package/dist/ui/placement/launcher_drag.d.ts +6 -0
- package/dist/ui/placement/launcher_drag.d.ts.map +1 -1
- package/dist/ui/placement/panel_placement.d.ts +119 -0
- package/dist/ui/placement/panel_placement.d.ts.map +1 -0
- package/dist/ui/progress/run_announcer.d.ts +41 -0
- package/dist/ui/progress/run_announcer.d.ts.map +1 -0
- package/dist/ui/progress/subagent_progress.d.ts +58 -0
- package/dist/ui/progress/subagent_progress.d.ts.map +1 -0
- package/dist/ui/progress/tool_call_card.d.ts.map +1 -1
- package/dist/ui/shell/adopt_styles.d.ts +23 -0
- package/dist/ui/shell/adopt_styles.d.ts.map +1 -0
- package/dist/ui/shell/glyph_slot.d.ts +7 -0
- package/dist/ui/shell/glyph_slot.d.ts.map +1 -0
- package/dist/ui/shell/header_button.d.ts +10 -0
- package/dist/ui/shell/header_button.d.ts.map +1 -0
- package/dist/ui/shell/icon_element.d.ts +12 -0
- package/dist/ui/shell/icon_element.d.ts.map +1 -0
- package/dist/ui/shell/is_unread_badge_enabled.d.ts +10 -0
- package/dist/ui/shell/is_unread_badge_enabled.d.ts.map +1 -0
- package/dist/ui/shell/read_launcher_icon_url.d.ts +8 -0
- package/dist/ui/shell/read_launcher_icon_url.d.ts.map +1 -0
- package/dist/ui/styles.d.ts +1 -1
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/transcript/answer_actions.d.ts +39 -0
- package/dist/ui/transcript/answer_actions.d.ts.map +1 -0
- package/dist/ui/transcript/answer_stream.d.ts +56 -0
- package/dist/ui/transcript/answer_stream.d.ts.map +1 -0
- package/dist/ui/transcript/render_or_warn.d.ts +16 -0
- package/dist/ui/transcript/render_or_warn.d.ts.map +1 -0
- package/dist/ui/transcript/starter_chips.d.ts +21 -0
- package/dist/ui/transcript/starter_chips.d.ts.map +1 -0
- package/dist/ui/transcript/transcript.d.ts +171 -0
- package/dist/ui/transcript/transcript.d.ts.map +1 -0
- package/dist/ui/ui_strings.d.ts +29 -1
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +17 -15
- package/src/core/activity_registry.ts +133 -0
- package/src/core/ag_ui_chat.ts +945 -4419
- package/src/core/agui_client.ts +172 -16
- package/src/core/client_seed.ts +27 -0
- package/src/core/read_max_tool_rounds.ts +13 -0
- package/src/core/remote_conversation_store.ts +1 -1
- package/src/core/run_handlers.ts +501 -0
- package/src/core/storage_scope.ts +279 -0
- package/src/core/tool_outcome.ts +5 -3
- package/src/core/utils.ts +109 -0
- package/src/skills/skill_catalog.ts +166 -0
- package/src/skills/skill_name_from.ts +19 -0
- package/src/tools/tool_catalog.ts +354 -0
- package/src/tools/tool_dispatch.ts +521 -0
- package/src/ui/composer/attachment_tray.ts +6 -5
- package/src/ui/composer/auto_grow.ts +12 -0
- package/src/ui/composer/composer_attachments.ts +324 -0
- package/src/ui/composer/composer_voice.ts +93 -0
- package/src/ui/composer/voice_input.ts +4 -4
- package/src/ui/excerpts/transcript_quote_offer.ts +198 -0
- package/src/ui/fill_ui_string.ts +41 -0
- package/src/ui/history/conversation_history.ts +699 -0
- package/src/ui/history/relative_time.ts +5 -4
- package/src/ui/history/thread_drawer.ts +3 -50
- package/src/ui/interrupts/confirmation_card.ts +4 -2
- package/src/ui/interrupts/pending_decision.ts +34 -0
- package/src/ui/placement/is_collapsible_placement.ts +19 -0
- package/src/ui/placement/is_draggable_placement.ts +23 -0
- package/src/ui/placement/launcher_drag.ts +104 -89
- package/src/ui/placement/panel_placement.ts +1130 -0
- package/src/ui/progress/run_announcer.ts +67 -0
- package/src/ui/progress/subagent_progress.ts +201 -0
- package/src/ui/progress/tool_call_card.ts +2 -0
- package/src/ui/shell/adopt_styles.ts +28 -0
- package/src/ui/shell/glyph_slot.ts +12 -0
- package/src/ui/shell/header_button.ts +21 -0
- package/src/ui/shell/icon_element.ts +33 -0
- package/src/ui/shell/is_unread_badge_enabled.ts +11 -0
- package/src/ui/shell/read_launcher_icon_url.ts +9 -0
- package/src/ui/styles.ts +301 -70
- package/src/ui/transcript/answer_actions.ts +139 -0
- package/src/ui/transcript/answer_stream.ts +123 -0
- package/src/ui/transcript/render_or_warn.ts +22 -0
- package/src/ui/transcript/starter_chips.ts +42 -0
- package/src/ui/transcript/transcript.ts +429 -0
- package/src/ui/ui_strings.ts +38 -1
- package/src/version.ts +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -219,7 +219,13 @@ export declare const MESSAGE_ACTIONS: {
|
|
|
219
219
|
};
|
|
220
220
|
/**
|
|
221
221
|
* Lifecycle status of a rendered tool-call card. A card opens as `PENDING`
|
|
222
|
-
* while the call runs, then settles to `DONE`, `ERROR`,
|
|
222
|
+
* while the call runs, then settles to `DONE`, `ERROR`, `DECLINED` or
|
|
223
|
+
* `INTERRUPTED`.
|
|
224
|
+
*
|
|
225
|
+
* `INTERRUPTED` is a call that never produced a result and that nobody refused:
|
|
226
|
+
* the run was stopped or failed before it finished, or no tool here answered it.
|
|
227
|
+
* Neither of the older terminal states is true of it. `DONE` claimed a success
|
|
228
|
+
* nothing achieved, and `DECLINED` says a person or a guard refused.
|
|
223
229
|
*
|
|
224
230
|
* `DEFERRED` is the one non-terminal state that is not "running": a server-side
|
|
225
231
|
* tool a `ToolGuard` gated never executed, the run finished on an interrupt, and
|
|
@@ -236,6 +242,7 @@ export declare const TOOL_CALL_STATUS: {
|
|
|
236
242
|
readonly DONE: "done";
|
|
237
243
|
readonly ERROR: "error";
|
|
238
244
|
readonly DECLINED: "declined";
|
|
245
|
+
readonly INTERRUPTED: "interrupted";
|
|
239
246
|
};
|
|
240
247
|
/**
|
|
241
248
|
* How a tool call ended, as the server states it on `TOOL_CALL_RESULT`.
|
|
@@ -250,10 +257,14 @@ export declare const TOOL_CALL_STATUS: {
|
|
|
250
257
|
* annotation on the event and not a required one. `FAILED` is a call that ran
|
|
251
258
|
* and failed; `DENIED` is one a person or a guard refused, so it never ran at
|
|
252
259
|
* all. The two are worth distinguishing on screen because only the second is
|
|
253
|
-
* something the user did.
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
260
|
+
* something the user did. `INTERRUPTED` is a call that produced no result because
|
|
261
|
+
* the run ended first: pydantic-ai writes it when it repairs a history a
|
|
262
|
+
* cancelled stream left, and the element writes it for the same reason when a
|
|
263
|
+
* run ends with a call still unanswered, so the next request carries a result
|
|
264
|
+
* for every call without claiming anyone refused one.
|
|
265
|
+
*
|
|
266
|
+
* Anything *else* on the wire — a value from a later protocol version — is read
|
|
267
|
+
* as a success rather than rejected.
|
|
257
268
|
* A card is a claim about what happened, and "I do not know this word" is not
|
|
258
269
|
* grounds for claiming failure. `toolStatusFromOutcome` is where that is done.
|
|
259
270
|
*/
|
|
@@ -261,6 +272,7 @@ export declare const TOOL_OUTCOME: {
|
|
|
261
272
|
readonly SUCCESS: "success";
|
|
262
273
|
readonly FAILED: "failed";
|
|
263
274
|
readonly DENIED: "denied";
|
|
275
|
+
readonly INTERRUPTED: "interrupted";
|
|
264
276
|
};
|
|
265
277
|
/**
|
|
266
278
|
* Lifecycle status of a pending-attachment chip in the composer tray. A chip
|
|
@@ -409,15 +421,6 @@ export declare const ANNOUNCE_CLEAR_MS = 150;
|
|
|
409
421
|
* no pointer events at any point, so being on top costs the page nothing.
|
|
410
422
|
*/
|
|
411
423
|
export declare const HIGHLIGHT_OVERLAY_Z_INDEX = 2147483001;
|
|
412
|
-
/**
|
|
413
|
-
* The panel width at which the conversation list stops covering the transcript
|
|
414
|
-
* and docks beside it.
|
|
415
|
-
*
|
|
416
|
-
* Wide enough that the list and a readable column both fit: the list asks for
|
|
417
|
-
* 300px and the reading column is capped at 820px. Below this a docked list
|
|
418
|
-
* would leave a strip of transcript narrower than the messages in it.
|
|
419
|
-
*/
|
|
420
|
-
export declare const THREADS_DOCK_MIN_WIDTH = 900;
|
|
421
424
|
/**
|
|
422
425
|
* How many characters a pasted string has to reach before it becomes an
|
|
423
426
|
* attachment rather than composer text.
|
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;AAE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AAC;AAE5J,2CAA2C;AAC3C,eAAO,MAAM,WAAW,wJAAgJ,CAAC;AAEzK,yDAAyD;AACzD,eAAO,MAAM,UAAU,0MAA8L,CAAC;AAEtN;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,8IAAsI,CAAC;AAE7J,yDAAyD;AACzD,eAAO,MAAM,QAAQ,gOAAkN,CAAC;AAExO,mFAAmF;AACnF,eAAO,MAAM,aAAa,2KAAmK,CAAC;AAE9L;;;;;GAKG;AACH,yEAAyE;AACzE,eAAO,MAAM,SAAS,EAAE,MAA+J,CAAC;AAExL,+BAA+B;AAC/B,eAAO,MAAM,UAAU,EAAE,MAAqI,CAAC;AAE/J,eAAe;AACf,eAAO,MAAM,aAAa,EAAE,MAAmM,CAAC;AAEhO,4EAA4E;AAC5E,eAAO,MAAM,eAAe,EAAE,MAAiM,CAAC;AAEhO,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;AAE9N;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,aAAa,CAAC;AAEpD;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ActivityRegistration } from "./activity_registration.js";
|
|
2
|
+
/** What the activity registry needs from the element that owns it. */
|
|
3
|
+
export interface ActivityRegistryHost {
|
|
4
|
+
/** The current answer group, opening one if none is open. */
|
|
5
|
+
readonly ensureGroup: () => HTMLDivElement;
|
|
6
|
+
/** Update the empty state and follow the foot after the transcript grew. */
|
|
7
|
+
readonly afterTranscriptGrew: () => void;
|
|
8
|
+
/** Append an ambient run notice to the current group. */
|
|
9
|
+
readonly appendNotice: (icon: string, text: string, kind: string) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The AG-UI activities this element can draw, and the blocks it drew: which
|
|
13
|
+
* `activity_type`s have a renderer, which arrived with none, and the node each
|
|
14
|
+
* drawn activity is on screen as.
|
|
15
|
+
*
|
|
16
|
+
* Owned one-to-one by an `<ag-ui-chat>`, and holding no state outside the
|
|
17
|
+
* instance.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ActivityRegistry {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(host: ActivityRegistryHost);
|
|
22
|
+
/** The registration behind `AgUiChat.registerActivityRenderer`, whose doc is the contract. */
|
|
23
|
+
register(registration: ActivityRegistration): void;
|
|
24
|
+
/** Whether a renderer is registered for `activityType`. */
|
|
25
|
+
has(activityType: string): boolean;
|
|
26
|
+
/** The set behind `AgUiChat.unhandledActivityTypes`, whose doc is the contract. */
|
|
27
|
+
unhandledTypes(): readonly string[];
|
|
28
|
+
/** Forget the drawn blocks, with the transcript they were drawn into. */
|
|
29
|
+
clearBlocks(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Draw, replace or remove one activity, whatever kind it is.
|
|
32
|
+
*
|
|
33
|
+
* The single path for all three routes an activity arrives by -- pushed
|
|
34
|
+
* (`onActivity`), patched (`onActivityChanged`) and replayed from history --
|
|
35
|
+
* which is why the renderer contract has to be pure: the same content is
|
|
36
|
+
* drawn again on every thread load.
|
|
37
|
+
*
|
|
38
|
+
* An unregistered type draws nothing and says nothing. That is the protocol's
|
|
39
|
+
* own answer -- a client that does not know a name ignores the event -- and a
|
|
40
|
+
* warning here would fire on every well-behaved forward-compatible server,
|
|
41
|
+
* while a placeholder would put the protocol's growth in the user's face.
|
|
42
|
+
* {@link unhandledTypes} is the way to find out what arrived.
|
|
43
|
+
*/
|
|
44
|
+
draw(messageId: string, activityType: string, content: unknown): void;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=activity_registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity_registry.d.ts","sourceRoot":"","sources":["../../src/core/activity_registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,WAAW,EAAE,MAAM,cAAc,CAAC;IAC3C,4EAA4E;IAC5E,QAAQ,CAAC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IACzC,yDAAyD;IACzD,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3E;AAED;;;;;;;GAOG;AACH,qBAAa,gBAAgB;;IAe3B,YAAY,IAAI,EAAE,oBAAoB,EAErC;IAED,8FAA8F;IAC9F,QAAQ,CAAC,YAAY,EAAE,oBAAoB,GAAG,IAAI,CAGjD;IAED,2DAA2D;IAC3D,GAAG,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAEjC;IAED,mFAAmF;IACnF,cAAc,IAAI,SAAS,MAAM,EAAE,CAElC;IAED,yEAAyE;IACzE,WAAW,IAAI,IAAI,CAElB;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAsBpE;CAmCF"}
|
|
@@ -105,6 +105,8 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
105
105
|
* Optional full replacement for the `ask_user` question UI, resolving with
|
|
106
106
|
* the answer; the same seam as {@link approvalRenderer}, styled via `strings`
|
|
107
107
|
* and the `question*` `::part()`s when left unset. Requires {@link askUser}.
|
|
108
|
+
* A renderer that throws or rejects hands the question to the built-in card,
|
|
109
|
+
* as a failing {@link approvalRenderer} does, unless Stop already fired.
|
|
108
110
|
*/
|
|
109
111
|
askUserRenderer: QuestionRenderer | null;
|
|
110
112
|
/**
|
|
@@ -313,6 +315,17 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
313
315
|
*/
|
|
314
316
|
get userKey(): string;
|
|
315
317
|
set userKey(value: string);
|
|
318
|
+
/**
|
|
319
|
+
* The signed-in user's display name, from the `user-name` attribute, for the
|
|
320
|
+
* greeting an empty conversation shows under `placement="page"`.
|
|
321
|
+
*
|
|
322
|
+
* Presentation only. Unlike {@link userKey} it scopes nothing and is never
|
|
323
|
+
* sent to the server. Absent or blank means the nameless greeting. Live: a
|
|
324
|
+
* name that arrives after the element connected replaces the greeting on
|
|
325
|
+
* screen.
|
|
326
|
+
*/
|
|
327
|
+
get userName(): string;
|
|
328
|
+
set userName(value: string);
|
|
316
329
|
/**
|
|
317
330
|
* Cookie policy for **every** request this element makes, as `fetch`'s own
|
|
318
331
|
* `credentials` mode (`"omit"` / `"same-origin"` / `"include"`). Mirrored to
|
|
@@ -475,13 +488,7 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
475
488
|
* an empty panel.
|
|
476
489
|
*/
|
|
477
490
|
openCheckpoints(): void;
|
|
478
|
-
/**
|
|
479
|
-
* Close the conversation list, if it is open.
|
|
480
|
-
*
|
|
481
|
-
* No state sync here: the drawer reports every close through `onVisibility`,
|
|
482
|
-
* including the four that never reach this method, and doing it twice would
|
|
483
|
-
* be a second place to keep right.
|
|
484
|
-
*/
|
|
491
|
+
/** Close the conversation list, if it is open. */
|
|
485
492
|
closeThreads(): void;
|
|
486
493
|
/** Close the checkpoints panel, if it is open. */
|
|
487
494
|
closeCheckpoints(): void;
|
|
@@ -499,6 +506,10 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
499
506
|
* The conversation being left is kept, and stays in the history drawer to
|
|
500
507
|
* return to. Deleting one is the drawer row's own action; a button that
|
|
501
508
|
* starts something new must not be the button that destroys what was there.
|
|
509
|
+
*
|
|
510
|
+
* Focus moves to the composer, unless the widget is collapsed and the
|
|
511
|
+
* composer is not on screen: starting a conversation is a request to type
|
|
512
|
+
* one. The page is not scrolled to bring the composer into view.
|
|
502
513
|
*/
|
|
503
514
|
newChat(): void;
|
|
504
515
|
/**
|
|
@@ -540,9 +551,11 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
540
551
|
* `attachments` are durable {@link AttachmentRef}s — what {@link attachFile}
|
|
541
552
|
* resolves to and what {@link ATTACHMENT_EVENT} reports.
|
|
542
553
|
*
|
|
543
|
-
* No-ops on an empty message, and while a run
|
|
544
|
-
*
|
|
545
|
-
*
|
|
554
|
+
* No-ops on an empty message, and while a run or a picked checkpoint's
|
|
555
|
+
* continuation is in flight, since a second concurrent run would orphan the
|
|
556
|
+
* first. Unlike the built-in Send it does not queue: it returns, and the
|
|
557
|
+
* caller keeps what it tried to send. Nor does it consult the tray -- what
|
|
558
|
+
* you pass is what is sent.
|
|
546
559
|
*/
|
|
547
560
|
sendMessage(content: string, attachments?: readonly AttachmentRef[]): Promise<void>;
|
|
548
561
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAoBjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAg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,CAE9C;CACF"}
|
|
@@ -219,6 +219,22 @@ export interface AgUiClientConfig extends AgUiRunInputs {
|
|
|
219
219
|
* passes its localized string.
|
|
220
220
|
*/
|
|
221
221
|
connectionLostMessage?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Result content for a tool call the conversation moved past without one: a
|
|
224
|
+
* Stop while the stream was arriving, a round that ended on `RUN_ERROR`, a
|
|
225
|
+
* call no {@link executeTool} answered, or history restored with a call still
|
|
226
|
+
* open. Sent to the agent, so it says only that the call did not finish --
|
|
227
|
+
* nobody refused it. Defaults to an English sentence; the host passes its
|
|
228
|
+
* localized string.
|
|
229
|
+
*/
|
|
230
|
+
unfinishedMessage?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Result content for a server-side approval that Stop closed while it was
|
|
233
|
+
* open, which the host's {@link resolveInterrupts} answers as declined.
|
|
234
|
+
* Defaults to `"User declined the action."`; the host passes its localized
|
|
235
|
+
* string.
|
|
236
|
+
*/
|
|
237
|
+
declinedMessage?: string;
|
|
222
238
|
/**
|
|
223
239
|
* Upper bound on frontend tool-call to re-run rounds within one
|
|
224
240
|
* {@link AgUiClient.send}. Defaults to {@link MAX_TOOL_ROUNDS}.
|
|
@@ -312,5 +328,17 @@ export declare class AgUiClient {
|
|
|
312
328
|
* instead of `onError`, and `onSettled` still follows.
|
|
313
329
|
*/
|
|
314
330
|
cancel(): void;
|
|
331
|
+
/**
|
|
332
|
+
* The history in the form a save writes it: {@link messages}, with how each
|
|
333
|
+
* tool call ended annotated onto its result -- exactly what
|
|
334
|
+
* {@link AgUiClientConfig.onPersist} is handed.
|
|
335
|
+
*
|
|
336
|
+
* For writing the conversation somewhere other than a save. The element needs
|
|
337
|
+
* it when a checkpoint continuation adds to a conversation this client holds:
|
|
338
|
+
* the continuation's saves write the conversation ahead of the exchange, and
|
|
339
|
+
* the bare {@link messages} would drop the annotations, so a declined card
|
|
340
|
+
* turned green on the next reload.
|
|
341
|
+
*/
|
|
342
|
+
get annotatedMessages(): readonly Message[];
|
|
315
343
|
}
|
|
316
344
|
//# sourceMappingURL=agui_client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agui_client.d.ts","sourceRoot":"","sources":["../../src/core/agui_client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,IAAI,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"agui_client.d.ts","sourceRoot":"","sources":["../../src/core/agui_client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,IAAI,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;G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JD;;;;;;;;;;OAUG;IACH,IAAI,iBAAiB,IAAI,SAAS,OAAO,EAAE,CAmB1C;CAwRF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Message } from "@ag-ui/core";
|
|
2
|
+
/**
|
|
3
|
+
* What differs between the clients one conversation builds -- its own, and one
|
|
4
|
+
* per checkpoint continuation. Everything else about a client comes from the
|
|
5
|
+
* element's single construction, so an option added for one reaches the other.
|
|
6
|
+
*/
|
|
7
|
+
export interface ClientSeed {
|
|
8
|
+
/** Where the client's runs are sent. */
|
|
9
|
+
readonly endpoint: string;
|
|
10
|
+
/** The history the agent starts from, and sends with its first run. */
|
|
11
|
+
readonly initialMessages: readonly Message[];
|
|
12
|
+
/**
|
|
13
|
+
* The conversation this client's own history continues, which every save
|
|
14
|
+
* writes ahead of it.
|
|
15
|
+
*
|
|
16
|
+
* Empty for the conversation's own client, whose history is the whole
|
|
17
|
+
* conversation. A continuation's history is only the turn it adds and its
|
|
18
|
+
* answer -- the endpoint supplies the rest from its snapshot -- and a store
|
|
19
|
+
* keeps one list per thread, so a save of that history alone would replace
|
|
20
|
+
* the conversation with its last exchange, and not saving it lost the
|
|
21
|
+
* exchange on the next reload.
|
|
22
|
+
*/
|
|
23
|
+
readonly follows: readonly Message[];
|
|
24
|
+
/** Handed the whole conversation each time the client saves it, as written. */
|
|
25
|
+
readonly onSaved?: (conversation: readonly Message[]) => void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=client_seed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client_seed.d.ts","sourceRoot":"","sources":["../../src/core/client_seed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,eAAe,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,OAAO,EAAE,KAAK,IAAI,CAAC;CAC/D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tool-round budget from `element`'s `data-max-tool-rounds`, for one send.
|
|
3
|
+
*
|
|
4
|
+
* Anything unparseable becomes `NaN`, which {@link AgUiClient} rejects along
|
|
5
|
+
* with a bound below one -- so the two ways of setting this are validated in
|
|
6
|
+
* one place rather than agreeing by coincidence.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readMaxToolRounds(element: Element): number;
|
|
9
|
+
//# sourceMappingURL=read_max_tool_rounds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_max_tool_rounds.d.ts","sourceRoot":"","sources":["../../src/core/read_max_tool_rounds.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAG1D"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { RunAnnouncer } from "../ui/progress/run_announcer.js";
|
|
2
|
+
import type { SubAgentProgress } from "../ui/progress/subagent_progress.js";
|
|
3
|
+
import type { AnswerActions } from "../ui/transcript/answer_actions.js";
|
|
4
|
+
import type { AnswerStream } from "../ui/transcript/answer_stream.js";
|
|
5
|
+
import type { Transcript } from "../ui/transcript/transcript.js";
|
|
6
|
+
import type { UiStrings } from "../ui/ui_strings.js";
|
|
7
|
+
import type { ActivityRegistry } from "./activity_registry.js";
|
|
8
|
+
import type { AgUiClientHandlers } from "./agui_client.js";
|
|
9
|
+
import type { MessageRole } from "./message_role.js";
|
|
10
|
+
/** What the run's event handlers need from the element that owns them. */
|
|
11
|
+
export interface RunHandlersHost {
|
|
12
|
+
/** The custom element, which the run's events are dispatched on. */
|
|
13
|
+
readonly element: HTMLElement;
|
|
14
|
+
/** The transcript the run draws into. */
|
|
15
|
+
readonly transcript: Transcript;
|
|
16
|
+
/** The answer streaming into its bubble. */
|
|
17
|
+
readonly stream: AnswerStream;
|
|
18
|
+
/** The action row under each finished answer. */
|
|
19
|
+
readonly actions: AnswerActions;
|
|
20
|
+
/** The activity renderers, and the blocks they drew. */
|
|
21
|
+
readonly activities: ActivityRegistry;
|
|
22
|
+
/** A delegated sub-agent's progress, on the card that delegated. */
|
|
23
|
+
readonly subagents: SubAgentProgress;
|
|
24
|
+
/** The screen-reader status region. */
|
|
25
|
+
readonly announcer: RunAnnouncer;
|
|
26
|
+
/** The resolved string table. */
|
|
27
|
+
readonly strings: () => UiStrings;
|
|
28
|
+
/** Whether an interaction is already in flight, which the composer owns. */
|
|
29
|
+
readonly running: () => boolean;
|
|
30
|
+
/** Swap the composer between Send and Stop; settling sends a queued turn. */
|
|
31
|
+
readonly setRunning: (running: boolean) => void;
|
|
32
|
+
/** The element's `appendMessage`, which a failed run's bubble opens through. */
|
|
33
|
+
readonly appendMessage: (role: MessageRole, content: string) => HTMLDivElement;
|
|
34
|
+
/** Count an answer that finished while the widget was collapsed. */
|
|
35
|
+
readonly noteUnread: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The AG-UI event handlers a run is drawn by, and what one interaction
|
|
39
|
+
* accumulates for the host between its first round and its settle: the tool
|
|
40
|
+
* calls it made, the keys it invalidated, and whether it already said how it
|
|
41
|
+
* ended.
|
|
42
|
+
*
|
|
43
|
+
* A controller rather than a factory. The handlers hold nothing of their own,
|
|
44
|
+
* but that bookkeeping is state, and it has never belonged to one handler
|
|
45
|
+
* table: a table is built per client -- the conversation's own, rebuilt after
|
|
46
|
+
* a reset, and one for each checkpoint continuation -- and every table built
|
|
47
|
+
* for one conversation reports into the same bookkeeping. {@link forClient}
|
|
48
|
+
* still returns a fresh table per call.
|
|
49
|
+
*
|
|
50
|
+
* Owned one-to-one by an `<ag-ui-chat>`, and holding no state outside the
|
|
51
|
+
* instance.
|
|
52
|
+
*/
|
|
53
|
+
export declare class RunHandlers {
|
|
54
|
+
#private;
|
|
55
|
+
constructor(host: RunHandlersHost);
|
|
56
|
+
/**
|
|
57
|
+
* Detach every handler table built so far, because the conversation they
|
|
58
|
+
* drew into has been cleared away.
|
|
59
|
+
*
|
|
60
|
+
* The element calls this when it resets, having first cancelled what was
|
|
61
|
+
* running. A cancelled run still ends later, and a detached table still
|
|
62
|
+
* reports to the host what that run did: a run stopped part-way may already
|
|
63
|
+
* have written something, and {@link RUN_FINISHED_EVENT} fires on
|
|
64
|
+
* cancellation for exactly that reason. Everything else it would do -- draw a
|
|
65
|
+
* stopped note, announce, put the composer back to Send, settle the pending
|
|
66
|
+
* cards -- would land in a transcript and a composer that now belong to
|
|
67
|
+
* another conversation, possibly mid-run, and is dropped. So is any event the
|
|
68
|
+
* run streams after the reset, invalidations included: an abort closes the
|
|
69
|
+
* request those would arrive on, so what a cancelled run still delivers is
|
|
70
|
+
* how it ended.
|
|
71
|
+
*/
|
|
72
|
+
detach(): void;
|
|
73
|
+
/**
|
|
74
|
+
* A handler table for one AG-UI client. Every table built for the current
|
|
75
|
+
* conversation draws into the same transcript and shares its bookkeeping, so
|
|
76
|
+
* a continuation run reports into the interaction the user is looking at.
|
|
77
|
+
*/
|
|
78
|
+
forClient(): AgUiClientHandlers;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=run_handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_handlers.d.ts","sourceRoot":"","sources":["../../src/core/run_handlers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,E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ED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,WAAW;;IAQtB,YAAY,IAAI,EAAE,eAAe,EAEhC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,IAAI,IAAI,CAEb;IAED;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,CAgB9B;CAiTF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type ClientConversationStore, SessionStorageStore } from "./conversation_store.js";
|
|
2
|
+
/** What the storage scope needs from the element that owns it. */
|
|
3
|
+
export interface StorageScopeHost {
|
|
4
|
+
/** The element's `id`, the namespace it prefers. */
|
|
5
|
+
readonly id: () => string;
|
|
6
|
+
/** The element's `endpoint`, the namespace it falls back to. */
|
|
7
|
+
readonly endpoint: () => string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Which storage keys are this element's: the namespace it claims in the
|
|
11
|
+
* document, the key a layout preference is stored under, and the built-in
|
|
12
|
+
* conversation store scoped to it.
|
|
13
|
+
*
|
|
14
|
+
* Owned one-to-one by an `<ag-ui-chat>`. The one thing it shares is the record
|
|
15
|
+
* of claimed namespaces above, which is what keeps two elements apart.
|
|
16
|
+
*/
|
|
17
|
+
export declare class StorageScope {
|
|
18
|
+
#private;
|
|
19
|
+
constructor(host: StorageScopeHost);
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the per-instance storage namespace, before any key is read or
|
|
22
|
+
* written, so this instance doesn't share collapsed/theme/thread state with
|
|
23
|
+
* another on the same origin.
|
|
24
|
+
*/
|
|
25
|
+
claim(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Give the namespace back. A disconnect is not necessarily a farewell — a
|
|
28
|
+
* DOM move and a framework re-render both look like one — and an element
|
|
29
|
+
* that could not reclaim its own namespace on the way back in would lose its
|
|
30
|
+
* conversation to a false collision.
|
|
31
|
+
*/
|
|
32
|
+
release(): void;
|
|
33
|
+
/**
|
|
34
|
+
* The conversation store's namespace: this element's, scoped to the principal
|
|
35
|
+
* `key` names.
|
|
36
|
+
*
|
|
37
|
+
* Only the conversation is principal-scoped. The panel's own collapsed / size
|
|
38
|
+
* / theme preferences stay on the element's own namespace, because they are
|
|
39
|
+
* this element's UI state rather than anyone's data — they carry no word of
|
|
40
|
+
* what was said — and because they are read once while connecting, so
|
|
41
|
+
* re-scoping them under a live element would rearrange the panel around a
|
|
42
|
+
* user who had only just signed in.
|
|
43
|
+
*/
|
|
44
|
+
conversationNamespace(key: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Namespace the built-in default store, and hand back the store to use. A
|
|
47
|
+
* host-injected store is used verbatim; the built-in one is remembered
|
|
48
|
+
* either way, because it is the element's own store and a later `user-key`
|
|
49
|
+
* change may move it to another namespace.
|
|
50
|
+
*/
|
|
51
|
+
scopeStore(store: ClientConversationStore, key: string): ClientConversationStore;
|
|
52
|
+
/**
|
|
53
|
+
* Rebuild the built-in store under `namespace`, or `null` for a store of the
|
|
54
|
+
* host's own kind, which holds its data somewhere the element cannot see and
|
|
55
|
+
* has to scope itself.
|
|
56
|
+
*/
|
|
57
|
+
rescopeStore(namespace: string): SessionStorageStore | null;
|
|
58
|
+
/** This instance's namespaced form of an origin-scoped storage key. */
|
|
59
|
+
key(base: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Read a namespaced origin-scoped value, falling back once to the legacy
|
|
62
|
+
* pre-namespacing global key (left in place) so an existing collapsed/theme
|
|
63
|
+
* preference survives the upgrade.
|
|
64
|
+
*/
|
|
65
|
+
readScopedItem(base: string): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Read a layout preference: where the widget sits, how big it is, which
|
|
68
|
+
* theme it wears.
|
|
69
|
+
*
|
|
70
|
+
* These live in `localStorage` rather than beside the transcript, because a
|
|
71
|
+
* layout preference is not a conversation. The transcript is deliberately
|
|
72
|
+
* per-tab -- two tabs are two conversations, and closing the tab ends it --
|
|
73
|
+
* and everything else inherited that scoping without earning it. A user who
|
|
74
|
+
* dragged the panel clear of their own UI did it again in the next tab, and
|
|
75
|
+
* again after every restart.
|
|
76
|
+
*
|
|
77
|
+
* Whether the widget is *currently open* stays per-tab with the transcript.
|
|
78
|
+
* It is a statement about this tab rather than a preference: carrying it
|
|
79
|
+
* across would pop the panel open on every new tab because it was opened
|
|
80
|
+
* once, somewhere else.
|
|
81
|
+
*
|
|
82
|
+
* Falls back to the session value it used to be written to, so an existing
|
|
83
|
+
* position survives the upgrade rather than resetting once.
|
|
84
|
+
*/
|
|
85
|
+
readPreference(base: string): string | null;
|
|
86
|
+
/**
|
|
87
|
+
* Persist a layout preference as durably as this browser allows: to
|
|
88
|
+
* `localStorage` so it outlives the tab, and to the per-tab store as well.
|
|
89
|
+
*
|
|
90
|
+
* The second write is not redundancy for its own sake. A privacy mode can
|
|
91
|
+
* deny `localStorage` while allowing `sessionStorage`, and losing the
|
|
92
|
+
* durable copy should degrade to the per-tab behaviour this replaced rather
|
|
93
|
+
* than to no persistence at all. The read above prefers the durable copy, so
|
|
94
|
+
* a tab that has both cannot be shadowed by its own stale one.
|
|
95
|
+
*
|
|
96
|
+
* Neither write is worth an exception. Losing where the panel sat is not
|
|
97
|
+
* worth a warning either -- unlike the transcript, which says so once,
|
|
98
|
+
* because losing that loses the conversation on the next reload.
|
|
99
|
+
*/
|
|
100
|
+
writePreference(base: string, value: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Drop a layout preference from both stores.
|
|
103
|
+
*
|
|
104
|
+
* The mirror of {@link writePreference}, and it has to clear both for the
|
|
105
|
+
* same reason that writes both: leaving either copy behind means the value
|
|
106
|
+
* comes back on the next read.
|
|
107
|
+
*/
|
|
108
|
+
clearPreference(base: string): void;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=storage_scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage_scope.d.ts","sourceRoot":"","sources":["../../src/core/storage_scope.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,uBAAuB,EAC5B,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AAkBjC,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,EAAE,MAAM,MAAM,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,qBAAa,YAAY;;IAqBvB,YAAY,IAAI,EAAE,gBAAgB,EAEjC;IAED;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAEZ;IAED;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAKd;IAED;;;;;;;;;;OAUG;IACH,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzC;IAED;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,uBAAuB,EAAE,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAO/E;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAM1D;IAED,uEAAuE;IACvE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExB;IAED;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM1C;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU1C;IAED;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAQjD;IAED;;;;;;OAMG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAYlC;CAyDF"}
|
|
@@ -19,9 +19,8 @@ export type ToolOutcome = (typeof TOOL_OUTCOME)[keyof typeof TOOL_OUTCOME];
|
|
|
19
19
|
* expected to be successes, but because the alternative is worse in the
|
|
20
20
|
* direction that matters: a card claiming a call failed when it did not is a
|
|
21
21
|
* lie the user acts on, while a card claiming success has at least the result
|
|
22
|
-
* text under it for them to read.
|
|
23
|
-
*
|
|
24
|
-
* may add more. Forward compatibility is the point of the open field.
|
|
22
|
+
* text under it for them to read. A future release may add words, and forward
|
|
23
|
+
* compatibility is the point of the open field.
|
|
25
24
|
*/
|
|
26
25
|
export declare function toolStatusFromOutcome(outcome: unknown): SettledStatus;
|
|
27
26
|
//# sourceMappingURL=tool_outcome.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool_outcome.d.ts","sourceRoot":"","sources":["../../src/core/tool_outcome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE3E
|
|
1
|
+
{"version":3,"file":"tool_outcome.d.ts","sourceRoot":"","sources":["../../src/core/tool_outcome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,CAWrE"}
|
package/dist/core/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Message } from "@ag-ui/core";
|
|
1
2
|
import type { ClientConversationStore } from "./conversation_store.js";
|
|
2
3
|
/**
|
|
3
4
|
* Overlay a `credentials` mode onto a fetch `init`, or hand the `init` back
|
|
@@ -49,4 +50,49 @@ export declare function mintThread(store: ClientConversationStore): string;
|
|
|
49
50
|
* least interesting of the seven.
|
|
50
51
|
*/
|
|
51
52
|
export declare function warnOnCrossOriginCredentials(url: string | URL, credentialNames: readonly string[], trustedOrigins: readonly string[], warned: Set<string>): void;
|
|
53
|
+
/**
|
|
54
|
+
* The tokens of a comma-separated attribute value, trimmed, with empty ones
|
|
55
|
+
* dropped -- so `"scroll, drag,"` is `["scroll", "drag"]`.
|
|
56
|
+
*
|
|
57
|
+
* Shared by every attribute that names a set of opt-ins, so each one reads a
|
|
58
|
+
* stray space or a trailing comma the same way.
|
|
59
|
+
*/
|
|
60
|
+
export declare function commaTokens(value: string): string[];
|
|
61
|
+
/**
|
|
62
|
+
* `messages` with a result for every tool call that has none, each placed at the
|
|
63
|
+
* end of the round that made the call.
|
|
64
|
+
*
|
|
65
|
+
* **Why every call.** Several model providers reject a request carrying a tool
|
|
66
|
+
* call with no result, and a conversation that sends one cannot continue. A run
|
|
67
|
+
* leaves calls unanswered in more ways than any one path can list: Stop while
|
|
68
|
+
* the stream is still arriving, a round ending on `RUN_ERROR`, a name no tool
|
|
69
|
+
* here owns, a server that never streamed a result, a page reloaded mid-run.
|
|
70
|
+
* Answering whatever is unanswered, rather than each of those where it happens,
|
|
71
|
+
* is what keeps a path nobody listed from sending one.
|
|
72
|
+
*
|
|
73
|
+
* **Where each result goes.** At the end of its round: the assistant turns
|
|
74
|
+
* carrying calls, then the results that follow them. That is the shape the run
|
|
75
|
+
* loop writes for a round it executed, and a provider reads a result only in the
|
|
76
|
+
* turn straight after the calls; appended at the end of history, it would sit
|
|
77
|
+
* behind a user turn or a reply the conversation has moved on to. A call with a
|
|
78
|
+
* result after a *later* turn is left alone, since it is answered.
|
|
79
|
+
*
|
|
80
|
+
* `answer` builds the one message for a call id, so the caller decides what is
|
|
81
|
+
* true to say and where the label for a reload goes. Calls in `except` are about
|
|
82
|
+
* to be answered by something else -- a resumed approval, or a navigation
|
|
83
|
+
* result -- and must not be answered twice.
|
|
84
|
+
*
|
|
85
|
+
* Returns `messages` itself when nothing is owed.
|
|
86
|
+
*
|
|
87
|
+
* Every condition deciding a round's end is one branch arc, which a coverage
|
|
88
|
+
* gate reports as covered with any part of it deleted. Each is held by a test in
|
|
89
|
+
* `ag_ui_chat_unanswered_tool_calls.test.ts`: a result continuing the round by
|
|
90
|
+
* "answers it after the round's own results"; a turn without calls closing it by
|
|
91
|
+
* "sends a not-finished result for a call that arrived before it"; a turn with
|
|
92
|
+
* calls after a result closing it by "answers each round's open call before the
|
|
93
|
+
* next round starts"; the answered check by "sends the decline Stop gave the
|
|
94
|
+
* open approval"; and the exclusion by "leaves the call it resumes for the
|
|
95
|
+
* server to answer".
|
|
96
|
+
*/
|
|
97
|
+
export declare function answerUnansweredCalls(messages: readonly Message[], answer: (toolCallId: string) => Message, except?: ReadonlySet<string>): readonly Message[];
|
|
52
98
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/core/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/core/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,WAAW,EAAE,kBAAkB,GAAG,SAAS,GAC1C,WAAW,GAAG,SAAS,CAEzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,uBAAuB,GAAG,MAAM,CAOjE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,eAAe,EAAE,SAAS,MAAM,EAAE,EAClC,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAClB,IAAI,CAwBN"}
|
|
1
|
+
{"version":3,"file":"utils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