@artooi/ag-ui-web-component 0.28.0 → 0.30.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 +615 -1
- package/README.md +564 -35
- package/dist/ag-ui-web-component.bundle.js +491 -50
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/constants.d.ts +129 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/ag_ui_chat.d.ts +232 -1
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +56 -1
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2081 -98
- package/dist/index.js.map +4 -4
- package/dist/ui/approval_card.d.ts +18 -0
- package/dist/ui/approval_card.d.ts.map +1 -1
- package/dist/ui/checkpoint_menu.d.ts +10 -0
- package/dist/ui/checkpoint_menu.d.ts.map +1 -1
- package/dist/ui/confirmation_card.d.ts +16 -0
- package/dist/ui/confirmation_card.d.ts.map +1 -1
- package/dist/ui/message_actions.d.ts +56 -0
- package/dist/ui/message_actions.d.ts.map +1 -0
- package/dist/ui/page_quote_offer.d.ts +33 -0
- package/dist/ui/page_quote_offer.d.ts.map +1 -0
- package/dist/ui/quote_selection.d.ts +66 -0
- package/dist/ui/quote_selection.d.ts.map +1 -0
- package/dist/ui/relative_time.d.ts +10 -0
- package/dist/ui/relative_time.d.ts.map +1 -1
- package/dist/ui/stick_to_bottom.d.ts +55 -0
- package/dist/ui/stick_to_bottom.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/subagent_panel.d.ts +92 -0
- package/dist/ui/subagent_panel.d.ts.map +1 -0
- package/dist/ui/subagent_update.d.ts +19 -0
- package/dist/ui/subagent_update.d.ts.map +1 -0
- package/dist/ui/suggestion_chips.d.ts +29 -0
- package/dist/ui/suggestion_chips.d.ts.map +1 -0
- package/dist/ui/thread_drawer.d.ts +10 -0
- package/dist/ui/thread_drawer.d.ts.map +1 -1
- package/dist/ui/tool_call_card.d.ts +81 -1
- package/dist/ui/tool_call_card.d.ts.map +1 -1
- package/dist/ui/ui_strings.d.ts +50 -0
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +138 -1
- package/src/core/ag_ui_chat.ts +1081 -73
- package/src/core/agui_client.ts +89 -2
- package/src/index.ts +43 -0
- package/src/ui/approval_card.ts +90 -2
- package/src/ui/checkpoint_menu.ts +22 -5
- package/src/ui/confirmation_card.ts +29 -1
- package/src/ui/message_actions.ts +170 -0
- package/src/ui/page_quote_offer.ts +215 -0
- package/src/ui/quote_selection.ts +345 -0
- package/src/ui/relative_time.ts +11 -0
- package/src/ui/stick_to_bottom.ts +126 -0
- package/src/ui/styles.ts +410 -0
- package/src/ui/subagent_panel.ts +213 -0
- package/src/ui/subagent_update.ts +80 -0
- package/src/ui/suggestion_chips.ts +73 -0
- package/src/ui/thread_drawer.ts +22 -2
- package/src/ui/tool_call_card.ts +138 -3
- package/src/ui/ui_strings.ts +75 -0
- package/src/version.ts +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -44,6 +44,103 @@ export declare const ATTACHMENT_EVENT = "ag-ui-attachments";
|
|
|
44
44
|
* error and cancellation alike, since a partial write is still a write.
|
|
45
45
|
*/
|
|
46
46
|
export declare const RUN_FINISHED_EVENT = "ag-ui-run-finished";
|
|
47
|
+
/**
|
|
48
|
+
* The agent sent an AG-UI `CUSTOM` event. `detail` is {@link CustomAgentDetail}.
|
|
49
|
+
*
|
|
50
|
+
* `CUSTOM` is one of exactly two carriers whose payload name the protocol leaves
|
|
51
|
+
* an open string, and it is the **imperative** one: something for the host page
|
|
52
|
+
* to *do*, with no place in the transcript. Its sibling `ACTIVITY_SNAPSHOT`
|
|
53
|
+
* carries transcript **content**, which is why that one is materialised into a
|
|
54
|
+
* message, persisted, and replayed on restore while this one is not.
|
|
55
|
+
*
|
|
56
|
+
* That asymmetry is the rule for choosing between them. Content has a place in
|
|
57
|
+
* the conversation and should replay; an imperative has no place and no meaning
|
|
58
|
+
* once acted on, so replaying it on a thread load would be a bug. Anything that
|
|
59
|
+
* must survive a reload belongs on the other carrier.
|
|
60
|
+
*
|
|
61
|
+
* The element takes no view of what a name means -- it forwards every one. A
|
|
62
|
+
* host that does not recognise a name ignores the event, which is the graceful
|
|
63
|
+
* outcome the open field exists for.
|
|
64
|
+
*/
|
|
65
|
+
export declare const CUSTOM_AGENT_EVENT = "ag-ui-custom";
|
|
66
|
+
/**
|
|
67
|
+
* The agent named resources its write has moved. `detail` is
|
|
68
|
+
* {@link InvalidateDetail}.
|
|
69
|
+
*
|
|
70
|
+
* A convention on top of {@link CUSTOM_AGENT_EVENT}, not a second channel: the
|
|
71
|
+
* wire carries an ordinary AG-UI `CUSTOM` event whose `name` is
|
|
72
|
+
* {@link INVALIDATE_CUSTOM_NAME}, and this is that one name routed to its own
|
|
73
|
+
* DOM event so a host does not have to string-match. Every other name still
|
|
74
|
+
* arrives as `ag-ui-custom`.
|
|
75
|
+
*
|
|
76
|
+
* Fires **as each announcement arrives**, during the run, which is what makes a
|
|
77
|
+
* long multi-step run feel live: the list refreshes as the third of eight writes
|
|
78
|
+
* lands rather than when everything finishes. {@link RUN_FINISHED_EVENT} carries
|
|
79
|
+
* the same keys again at the end, de-duplicated, for a host that would rather
|
|
80
|
+
* refetch once.
|
|
81
|
+
*/
|
|
82
|
+
export declare const INVALIDATE_EVENT = "ag-ui-invalidate";
|
|
83
|
+
/**
|
|
84
|
+
* Fired when the user rates an assistant message from its action row.
|
|
85
|
+
*
|
|
86
|
+
* `detail` is a {@link FeedbackDetail}: the rated message's text and the
|
|
87
|
+
* rating. **Nothing is stored** -- a rating belongs to whatever the host
|
|
88
|
+
* already uses to hold product signals, and a write-only table inside a chat
|
|
89
|
+
* widget is a schema nobody reads.
|
|
90
|
+
*/
|
|
91
|
+
export declare const FEEDBACK_EVENT = "ag-ui-feedback";
|
|
92
|
+
/**
|
|
93
|
+
* The `activity_type` carrying server-pushed follow-up prompts.
|
|
94
|
+
*
|
|
95
|
+
* Matches django-ag-ui's `SUGGESTIONS_ACTIVITY_TYPE`. A convention inside the
|
|
96
|
+
* protocol's open `activity_type` field, not an extension of it -- so a client
|
|
97
|
+
* that has never heard of it ignores the event, and this one is not privileged.
|
|
98
|
+
*/
|
|
99
|
+
export declare const SUGGESTIONS_ACTIVITY_TYPE = "suggestions";
|
|
100
|
+
/**
|
|
101
|
+
* The AG-UI `CUSTOM` event `name` that carries an invalidation.
|
|
102
|
+
*
|
|
103
|
+
* Matched exactly. Namespaced so it cannot collide with a host's own custom
|
|
104
|
+
* events, which share the field.
|
|
105
|
+
*/
|
|
106
|
+
export declare const INVALIDATE_CUSTOM_NAME = "ag_ui.invalidate";
|
|
107
|
+
/**
|
|
108
|
+
* The AG-UI `CUSTOM` event `name` carrying a delegated sub-agent's progress.
|
|
109
|
+
*
|
|
110
|
+
* Matched exactly, and namespaced the way {@link INVALIDATE_CUSTOM_NAME} is, so
|
|
111
|
+
* it cannot collide with a host's own custom events on the same open field.
|
|
112
|
+
*
|
|
113
|
+
* Routed to the delegating tool card rather than dispatched to the page: the
|
|
114
|
+
* payload keys on the **parent's own `delegate_task` call id**, so what it
|
|
115
|
+
* describes is already on screen and the progress belongs beside it. Every other
|
|
116
|
+
* name still reaches the host as {@link CUSTOM_AGENT_EVENT}.
|
|
117
|
+
*
|
|
118
|
+
* Deliberately on the imperative carrier and not on an activity, which means it
|
|
119
|
+
* is **never persisted and never replayed**. That is the right half of the
|
|
120
|
+
* split: a delegation that was live an hour ago is not live now, and replaying
|
|
121
|
+
* its progress on a thread restore would be a lie about a run that is over. On a
|
|
122
|
+
* reload mid-run the nested detail is gone and the tool card remains.
|
|
123
|
+
*/
|
|
124
|
+
export declare const SUBAGENT_CUSTOM_NAME = "ag_ui.subagent";
|
|
125
|
+
/**
|
|
126
|
+
* The phases one delegation moves through, as the server spells them.
|
|
127
|
+
*
|
|
128
|
+
* Exactly one `STARTED` opens a delegation and exactly one `FINISHED` or
|
|
129
|
+
* `FAILED` closes it; the two tool phases repeat in between, once per call the
|
|
130
|
+
* child makes and once per result it gets back.
|
|
131
|
+
*
|
|
132
|
+
* `FAILED` carries **no exception text**, deliberately — the same reasoning that
|
|
133
|
+
* redacts a `RUN_ERROR`, since an exception's words are written for an operator.
|
|
134
|
+
* The detail rides the ordinary `TOOL_CALL_RESULT` for that delegation, on the
|
|
135
|
+
* card the progress is already attached to.
|
|
136
|
+
*/
|
|
137
|
+
export declare const SUBAGENT_PHASE: {
|
|
138
|
+
readonly STARTED: "started";
|
|
139
|
+
readonly TOOL_CALL: "tool_call";
|
|
140
|
+
readonly TOOL_RESULT: "tool_result";
|
|
141
|
+
readonly FINISHED: "finished";
|
|
142
|
+
readonly FAILED: "failed";
|
|
143
|
+
};
|
|
47
144
|
/** Roles a chat message can take. */
|
|
48
145
|
export declare const MESSAGE_ROLE: {
|
|
49
146
|
readonly USER: "user";
|
|
@@ -77,8 +174,30 @@ export declare const X_NAVIGATES_KEY = "x-navigates";
|
|
|
77
174
|
* it: refusing the one call that would refresh the agent's view deadlocks.
|
|
78
175
|
*/
|
|
79
176
|
export declare const READ_PAGE_TOOL = "read_page";
|
|
80
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* Default upper bound on frontend tool-call → re-run rounds within one send.
|
|
179
|
+
* Overridable via `data-max-tool-rounds`, or `AgUiClientConfig.maxToolRounds`
|
|
180
|
+
* for a host driving the client directly.
|
|
181
|
+
*/
|
|
81
182
|
export declare const MAX_TOOL_ROUNDS = 10;
|
|
183
|
+
/**
|
|
184
|
+
* The actions a finished assistant message's row can carry, and the tokens
|
|
185
|
+
* `data-message-actions` selects them by.
|
|
186
|
+
*
|
|
187
|
+
* All three are on when the attribute is absent. Naming them individually
|
|
188
|
+
* rather than shipping one on/off switch is what the three differ over: feedback
|
|
189
|
+
* is only useful to a host listening for {@link FEEDBACK_EVENT}, retry re-runs
|
|
190
|
+
* the agent and a constrained surface may not permit that, and copy is the one
|
|
191
|
+
* nobody objects to. A single switch would make dropping either of the first two
|
|
192
|
+
* cost the third, and a host that only wanted one gone would rebuild the row
|
|
193
|
+
* from `attachMessageActions` -- reimplementing the part names, the accessible
|
|
194
|
+
* grouping and the retry hand-off to lose two buttons.
|
|
195
|
+
*/
|
|
196
|
+
export declare const MESSAGE_ACTIONS: {
|
|
197
|
+
readonly COPY: "copy";
|
|
198
|
+
readonly RETRY: "retry";
|
|
199
|
+
readonly FEEDBACK: "feedback";
|
|
200
|
+
};
|
|
82
201
|
/**
|
|
83
202
|
* Lifecycle status of a rendered tool-call card. A card opens as `PENDING`
|
|
84
203
|
* while the call runs, then settles to `DONE`, `ERROR`, or `DECLINED`.
|
|
@@ -189,4 +308,13 @@ export declare const ICON_FILE_TEXT = "<svg class=\"glyph\" viewBox=\"0 0 24 24\
|
|
|
189
308
|
* event, which is the graceful outcome.
|
|
190
309
|
*/
|
|
191
310
|
export declare const CHART_ACTIVITY_TYPE = "chart";
|
|
311
|
+
/**
|
|
312
|
+
* How long a screen-reader status stays in the announcer before it is emptied.
|
|
313
|
+
*
|
|
314
|
+
* Long enough for a reader to pick the change up, short enough that the region
|
|
315
|
+
* is empty again before the next status lands. Emptying is what makes an
|
|
316
|
+
* identical consecutive message announce at all -- a live region is read on
|
|
317
|
+
* *change*, and setting the same string twice is not one.
|
|
318
|
+
*/
|
|
319
|
+
export declare const ANNOUNCE_CLEAR_MS = 150;
|
|
192
320
|
//# sourceMappingURL=constants.d.ts.map
|
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;;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5B,SAAS,EAAE,WAAW;aACtB,KAAK,EAAE,OAAO;aACd,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;AAE9N;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC"}
|
|
@@ -8,7 +8,8 @@ import { type PageState } from "../tools/page_state.js";
|
|
|
8
8
|
import { type RouteMap } from "../tools/route_map.js";
|
|
9
9
|
import { type ApprovalRenderer } from "../ui/approval_card.js";
|
|
10
10
|
import { type QuestionRenderer } from "../ui/question_card.js";
|
|
11
|
-
import {
|
|
11
|
+
import type { RelativeTimeFormatter } from "../ui/relative_time.js";
|
|
12
|
+
import { type ToolDisplayMode, type ToolPayloadFormatter } from "../ui/tool_call_card.js";
|
|
12
13
|
import { type UiStrings } from "../ui/ui_strings.js";
|
|
13
14
|
import { type AttachmentRef } from "./attachment.js";
|
|
14
15
|
import { type ClientConversationStore, type NavigationCheckpoint } from "./conversation_store.js";
|
|
@@ -31,6 +32,12 @@ export interface AttachmentsDetail {
|
|
|
31
32
|
readonly pending: number;
|
|
32
33
|
}
|
|
33
34
|
/** `detail` shape of the {@link STATE_EVENT} CustomEvent. */
|
|
35
|
+
/** {@link FEEDBACK_EVENT} detail: what was rated, and how. */
|
|
36
|
+
export interface FeedbackDetail {
|
|
37
|
+
/** The rated message's text, as rendered. */
|
|
38
|
+
readonly content: string;
|
|
39
|
+
readonly rating: "up" | "down";
|
|
40
|
+
}
|
|
34
41
|
export interface StateDetail {
|
|
35
42
|
readonly state: Readonly<Record<string, unknown>>;
|
|
36
43
|
}
|
|
@@ -48,6 +55,79 @@ export interface ToolRun {
|
|
|
48
55
|
export interface RunFinishedDetail {
|
|
49
56
|
/** In settle order. Empty when the interaction called no tools. */
|
|
50
57
|
readonly tools: readonly ToolRun[];
|
|
58
|
+
/**
|
|
59
|
+
* Every key announced during the interaction, de-duplicated, first-seen order.
|
|
60
|
+
*
|
|
61
|
+
* **This is the field that makes adoption one line** for a host already
|
|
62
|
+
* listening here, and the `else` is the whole compatibility story:
|
|
63
|
+
*
|
|
64
|
+
* ```js
|
|
65
|
+
* if (detail.invalidated.length > 0) refetchOnly(detail.invalidated);
|
|
66
|
+
* else if (detail.tools.some((t) => t.side === "server")) refetchEverything();
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* Empty against a server that announces nothing, so an old server and a new
|
|
70
|
+
* client fall through to the coarse refetch that shipped before either.
|
|
71
|
+
*/
|
|
72
|
+
readonly invalidated: readonly string[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Draw one activity, from its content alone.
|
|
76
|
+
*
|
|
77
|
+
* The contract is {@link ClientTool.render}'s, and for the same reason rather
|
|
78
|
+
* than by analogy. An activity is materialised into a `role: "activity"`
|
|
79
|
+
* message, persisted with the transcript, and re-fired on every restore -- so a
|
|
80
|
+
* renderer that writes to the page instead of returning DOM fires again on
|
|
81
|
+
* every thread load, which is exactly the bug the tool registry's purity rule
|
|
82
|
+
* was written to make unmakeable.
|
|
83
|
+
*
|
|
84
|
+
* - a pure function of `content` -- no host state, no network, no clock;
|
|
85
|
+
* - deterministic, so a reload reproduces what was there before;
|
|
86
|
+
* - free of effects outside the node it returns, which the component places.
|
|
87
|
+
*
|
|
88
|
+
* Return `null` for content that says nothing worth drawing. Anything already
|
|
89
|
+
* drawn under that message id is then removed: live and reload should agree,
|
|
90
|
+
* and the stored content is the version that could not be drawn.
|
|
91
|
+
*/
|
|
92
|
+
export type ActivityRenderer = (content: unknown) => Node | null;
|
|
93
|
+
/** One `activity_type` a host can draw. See {@link AgUiChat.registerActivityRenderer}. */
|
|
94
|
+
export interface ActivityRegistration {
|
|
95
|
+
/**
|
|
96
|
+
* The AG-UI `activity_type` this draws, matched exactly.
|
|
97
|
+
*
|
|
98
|
+
* An open string the protocol does not enumerate -- which is the whole reason
|
|
99
|
+
* this is a registry rather than a branch.
|
|
100
|
+
*/
|
|
101
|
+
readonly type: string;
|
|
102
|
+
readonly render: ActivityRenderer;
|
|
103
|
+
/**
|
|
104
|
+
* Shown in the transcript when something already drawn under this type stops
|
|
105
|
+
* being renderable. Omit for an activity whose disappearance needs no
|
|
106
|
+
* explanation.
|
|
107
|
+
*/
|
|
108
|
+
readonly removedNotice?: string;
|
|
109
|
+
}
|
|
110
|
+
/** `detail` shape of the {@link CUSTOM_AGENT_EVENT} CustomEvent. */
|
|
111
|
+
export interface CustomAgentDetail {
|
|
112
|
+
/** The `CUSTOM` event's `name`, verbatim. An open string; never interpreted here. */
|
|
113
|
+
readonly name: string;
|
|
114
|
+
/** Its `value`, verbatim and unparsed. `unknown` because the protocol says nothing about it. */
|
|
115
|
+
readonly value: unknown;
|
|
116
|
+
}
|
|
117
|
+
/** `detail` shape of the {@link INVALIDATE_EVENT} CustomEvent. */
|
|
118
|
+
export interface InvalidateDetail {
|
|
119
|
+
/**
|
|
120
|
+
* The resources that moved, as the server named them.
|
|
121
|
+
*
|
|
122
|
+
* **Opaque strings, and matching is exact.** `orders/42` does not imply
|
|
123
|
+
* `orders` -- a prefix rule would be this component guessing at a scheme it
|
|
124
|
+
* does not own, and `orders/1` would match `orders/11`. A server that wants
|
|
125
|
+
* the collection refreshed names it. Your own matching may be hierarchical,
|
|
126
|
+
* because in your vocabulary the scheme is known.
|
|
127
|
+
*/
|
|
128
|
+
readonly keys: readonly string[];
|
|
129
|
+
/** What caused the write -- usually the tool's name. `null` when unstated. */
|
|
130
|
+
readonly reason: string | null;
|
|
51
131
|
}
|
|
52
132
|
/** `detail` shape of the {@link TOGGLE_EVENT} CustomEvent. */
|
|
53
133
|
export interface ToggleDetail {
|
|
@@ -115,6 +195,22 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
115
195
|
* data. Enable only when the content source is trusted.
|
|
116
196
|
*/
|
|
117
197
|
allowImages: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Replace the relative timestamps in the thread drawer and the checkpoint
|
|
200
|
+
* panel -- `"5m ago"`, `"2d ago"` -- with the host's own formatting.
|
|
201
|
+
*
|
|
202
|
+
* The built-in is locale-neutral on purpose: there is no `Intl` anywhere in
|
|
203
|
+
* this component, so it never disagrees with the page it is embedded in by
|
|
204
|
+
* guessing a locale. That is a good default and a bad requirement, which is
|
|
205
|
+
* what this is for.
|
|
206
|
+
*
|
|
207
|
+
* ```js
|
|
208
|
+
* const rtf = new Intl.RelativeTimeFormat("de", { numeric: "auto" });
|
|
209
|
+
* chat.formatRelativeTime = (ts) =>
|
|
210
|
+
* rtf.format(Math.round((ts - Date.now()) / 60000), "minute");
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
formatRelativeTime: RelativeTimeFormatter | null;
|
|
118
214
|
/** When true, destructive tools execute without a confirmation modal. */
|
|
119
215
|
autoConfirm: boolean;
|
|
120
216
|
/**
|
|
@@ -138,6 +234,22 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
138
234
|
* is enabled server-side; this only changes how the decision is collected.
|
|
139
235
|
*/
|
|
140
236
|
approvalRenderer: ApprovalRenderer | null;
|
|
237
|
+
/**
|
|
238
|
+
* Let the user edit a gated call's arguments before approving it.
|
|
239
|
+
*
|
|
240
|
+
* Off by default and **an assertion about your server**, not a negotiation:
|
|
241
|
+
* AG-UI carries `editedArgs` in the resume payload and gates it on the
|
|
242
|
+
* agent's own `approveWithEdits` capability, which this component never sees
|
|
243
|
+
* -- capabilities are not on the wire it reads. So the host says whether its
|
|
244
|
+
* agent honours them. Turned on against a server that does not, the user
|
|
245
|
+
* would edit arguments it silently discards, which is worse than not
|
|
246
|
+
* offering.
|
|
247
|
+
*
|
|
248
|
+
* Only affects calls whose arguments are known here: an interrupt names a
|
|
249
|
+
* `toolCallId`, and the tool card for that call is where the arguments still
|
|
250
|
+
* are. An interrupt naming no card gets the plain approve/deny.
|
|
251
|
+
*/
|
|
252
|
+
approveWithEdits: boolean;
|
|
141
253
|
/**
|
|
142
254
|
* Optional per-call confirmation predicate. When set it is authoritative,
|
|
143
255
|
* deciding from the tool name and args whether this particular call needs
|
|
@@ -216,6 +328,30 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
216
328
|
* schema never reaches the browser. Client tools should prefer `x-summary`.
|
|
217
329
|
*/
|
|
218
330
|
toolSummaries: Record<string, string>;
|
|
331
|
+
/**
|
|
332
|
+
* Optional presentation hook for the two payload regions of a tool-call card
|
|
333
|
+
* -- the arguments and the result. Unset (the default) leaves both
|
|
334
|
+
* pretty-printed as JSON.
|
|
335
|
+
*
|
|
336
|
+
* The seam exists because a wide result has no good rendering as JSON: a
|
|
337
|
+
* thirty-field row is a wall of text where the host wanted a table, or a
|
|
338
|
+
* sentence. `ClientTool.render` cannot answer it -- it is handed the
|
|
339
|
+
* *arguments* only, and a server-side tool has no `ClientTool` at all, so the
|
|
340
|
+
* result region was the one part of the transcript a host could not reach.
|
|
341
|
+
*
|
|
342
|
+
* **Presentation, not translation.** The card and the model already read
|
|
343
|
+
* separate copies of a tool result: the model's is maintained by
|
|
344
|
+
* `@ag-ui/client` from the same event and persisted with the history, and the
|
|
345
|
+
* card has always shown that string reformatted. So a formatter changes what
|
|
346
|
+
* the person reads and nothing the agent reads -- which makes restyling safe
|
|
347
|
+
* and *rewording* a way to make the card disagree with the prose beside it.
|
|
348
|
+
* Rename a value on the server, where it reaches both.
|
|
349
|
+
*
|
|
350
|
+
* Read at render time rather than captured, so a host that sets it from a
|
|
351
|
+
* framework effect after the first card still formats the results that settle
|
|
352
|
+
* afterwards. See {@link ToolPayloadFormatter}.
|
|
353
|
+
*/
|
|
354
|
+
formatToolPayload: ToolPayloadFormatter | null;
|
|
219
355
|
/**
|
|
220
356
|
* Localizable UI strings — a partial override merged over the English
|
|
221
357
|
* {@link DEFAULT_UI_STRINGS}. Resolved once on connect (so set it before the
|
|
@@ -348,6 +484,42 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
348
484
|
* indicator clears. Without this a removed element leaks all three.
|
|
349
485
|
*/
|
|
350
486
|
disconnectedCallback(): void;
|
|
487
|
+
/**
|
|
488
|
+
* Put `text` into the composer as a markdown quotation, and focus it.
|
|
489
|
+
*
|
|
490
|
+
* Deliberately **not** a send. Quoting is how a question narrows to one part
|
|
491
|
+
* of an answer, so the quotation is the preamble and the question is what
|
|
492
|
+
* comes next -- the caret is left after it, on its own line.
|
|
493
|
+
*
|
|
494
|
+
* This is also the seam for the half of this feature the component cannot
|
|
495
|
+
* build: selection in the **host page**. A widget mounted beside a table can
|
|
496
|
+
* be asked about a row, and nothing in a chat's own transcript can offer
|
|
497
|
+
* that. A host reads its own selection, however it likes, and calls this.
|
|
498
|
+
*
|
|
499
|
+
* No-ops on text that is empty or only whitespace.
|
|
500
|
+
*/
|
|
501
|
+
quote(text: string): void;
|
|
502
|
+
/**
|
|
503
|
+
* Offer to quote what the user selects in the **host page**, not just in the
|
|
504
|
+
* transcript. Returns a function that stops offering.
|
|
505
|
+
*
|
|
506
|
+
* The same select-then-offer gesture, over a table, a diff, a report -- the
|
|
507
|
+
* surface the user actually works in, which is the half of quoting no hosted
|
|
508
|
+
* chat can reach. Opt-in, because it listens on the host's document and that
|
|
509
|
+
* is theirs to grant.
|
|
510
|
+
*
|
|
511
|
+
* Deliberately **not** a four-line recipe, which is how this shipped first
|
|
512
|
+
* and was wrong: a page listener that quotes every settled selection appends
|
|
513
|
+
* to the composer on every drag made to read, to copy or to fix a typo -- and
|
|
514
|
+
* it cannot tell a selection in the page's prose from one inside the user's
|
|
515
|
+
* own half-typed `<input>`, because Chrome reports a field's internal
|
|
516
|
+
* selection as an ordinary range over the field's *wrapper*. See
|
|
517
|
+
* {@link attachQuoteOffer} for the guards.
|
|
518
|
+
*
|
|
519
|
+
* Detached automatically when the element leaves the document; a host that
|
|
520
|
+
* re-mounts it calls this again.
|
|
521
|
+
*/
|
|
522
|
+
offerQuoteInPage(within?: HTMLElement): () => void;
|
|
351
523
|
/**
|
|
352
524
|
* Replace the host-supplied (client) skill catalog. Merged after the embedded
|
|
353
525
|
* and fetched skills (so a client skill overrides a same-named server one).
|
|
@@ -414,6 +586,23 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
414
586
|
* starts something new must not be the button that destroys what was there.
|
|
415
587
|
*/
|
|
416
588
|
newChat(): void;
|
|
589
|
+
/**
|
|
590
|
+
* Ask the same question again and replace the answer.
|
|
591
|
+
*
|
|
592
|
+
* History is truncated to the most recent user message inclusive and the run
|
|
593
|
+
* repeats, so the agent answers what it was asked rather than being told its
|
|
594
|
+
* last answer was wrong. Returns `false` when there is nothing to retry or a
|
|
595
|
+
* run is already in flight.
|
|
596
|
+
*
|
|
597
|
+
* Public because a host with its own message UI wants the same button, and
|
|
598
|
+
* because the failed-run notice reaches it from outside the action row.
|
|
599
|
+
*
|
|
600
|
+
* **A retried turn re-runs its tools**, which for a page-driving agent is not
|
|
601
|
+
* neutral: the previous attempt already clicked what it clicked, and this
|
|
602
|
+
* does not undo it. Confirmation still applies, so a destructive tool asks
|
|
603
|
+
* again -- unless the user waived it for this session.
|
|
604
|
+
*/
|
|
605
|
+
retryLastTurn(): Promise<boolean>;
|
|
417
606
|
/**
|
|
418
607
|
* Append a message bubble and return it.
|
|
419
608
|
*
|
|
@@ -473,5 +662,47 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
473
662
|
* arrives is not something to switch on for everybody.
|
|
474
663
|
*/
|
|
475
664
|
enableCharts(routes?: readonly ("tool" | "activity")[]): void;
|
|
665
|
+
/**
|
|
666
|
+
* Teach this element to draw one kind of AG-UI activity.
|
|
667
|
+
*
|
|
668
|
+
* `activity_type` is one of exactly two fields the protocol leaves an open
|
|
669
|
+
* string, and it is the **content** one: an activity is materialised into a
|
|
670
|
+
* message, persisted with the thread, and replayed on every restore. Its
|
|
671
|
+
* sibling `CUSTOM` carries an imperative and is dispatched to the page
|
|
672
|
+
* instead ({@link CUSTOM_AGENT_EVENT}).
|
|
673
|
+
*
|
|
674
|
+
* That asymmetry decides which carrier a server should use. Content has a
|
|
675
|
+
* place in the conversation and should come back; an imperative has no place
|
|
676
|
+
* and no meaning once acted on.
|
|
677
|
+
*
|
|
678
|
+
* ```js
|
|
679
|
+
* chat.registerActivityRenderer({
|
|
680
|
+
* type: "build_status",
|
|
681
|
+
* render: (content) => {
|
|
682
|
+
* const el = document.createElement("div");
|
|
683
|
+
* el.textContent = `Build ${content.status}`;
|
|
684
|
+
* return el;
|
|
685
|
+
* },
|
|
686
|
+
* });
|
|
687
|
+
* ```
|
|
688
|
+
*
|
|
689
|
+
* Registering a type twice replaces the earlier renderer, so a host can
|
|
690
|
+
* override a built-in -- `chart` and `compaction` are registrations like any
|
|
691
|
+
* other, not privileged branches.
|
|
692
|
+
*
|
|
693
|
+
* ⚠ `render` runs again on every thread load. See {@link ActivityRenderer}
|
|
694
|
+
* for what that requires of it.
|
|
695
|
+
*/
|
|
696
|
+
registerActivityRenderer(registration: ActivityRegistration): void;
|
|
697
|
+
/**
|
|
698
|
+
* Activity types that arrived with nobody registered to draw them.
|
|
699
|
+
*
|
|
700
|
+
* Deliberately the only trace an unhandled activity leaves. Ignoring an
|
|
701
|
+
* unknown name is the protocol's own answer and the whole point of an open
|
|
702
|
+
* field, so warning would fire on every forward-compatible server -- but
|
|
703
|
+
* "nothing happened and nothing was said" is impossible to debug, so the set
|
|
704
|
+
* is readable. Accumulates for the element's lifetime, across threads.
|
|
705
|
+
*/
|
|
706
|
+
get unhandledActivityTypes(): readonly string[];
|
|
476
707
|
}
|
|
477
708
|
//# sourceMappingURL=ag_ui_chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAsB,IAAI,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAsB,IAAI,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAiBL,YAAY,EAab,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,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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|
/** Fired when the reasoning block ends (before the answer text streams). */
|
|
100
100
|
onReasoningEnd(): void;
|
|
101
101
|
onRunEnd(): void;
|
|
102
|
+
/**
|
|
103
|
+
* The server replaced the whole conversation with `MESSAGES_SNAPSHOT`.
|
|
104
|
+
*
|
|
105
|
+
* `@ag-ui/client` applies the event before any subscriber sees it, so by the
|
|
106
|
+
* time this fires `agent.messages` **is** the server's list -- and the run
|
|
107
|
+
* loop persists `agent.messages`. The replacement therefore reaches the
|
|
108
|
+
* conversation store whatever the host does; this hook exists so the host can
|
|
109
|
+
* stop that being invisible.
|
|
110
|
+
*/
|
|
111
|
+
onMessagesSnapshot(messages: readonly Message[]): void;
|
|
112
|
+
/**
|
|
113
|
+
* The agent sent a `CUSTOM` event.
|
|
114
|
+
*
|
|
115
|
+
* Forwarded whole and uninterpreted: `name` is an open string the protocol
|
|
116
|
+
* does not enumerate, so a client that decided which names were legal would
|
|
117
|
+
* be the thing the open field exists to avoid.
|
|
118
|
+
*/
|
|
119
|
+
onCustomEvent(name: string, value: unknown): void;
|
|
102
120
|
onError(message: string): void;
|
|
103
121
|
/**
|
|
104
122
|
* Fired when the user cancelled the run ({@link AgUiClient.cancel}) — the
|
|
@@ -152,6 +170,22 @@ export interface AgUiClientConfig extends AgUiRunInputs {
|
|
|
152
170
|
* passes its localized string.
|
|
153
171
|
*/
|
|
154
172
|
connectionLostMessage?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Upper bound on frontend tool-call to re-run rounds within one
|
|
175
|
+
* {@link AgUiClient.send}. Defaults to {@link MAX_TOOL_ROUNDS}.
|
|
176
|
+
*
|
|
177
|
+
* The default suits a chat whose tools answer questions. A page-driving
|
|
178
|
+
* deployment reaches it legitimately -- filling a form field by field is one
|
|
179
|
+
* round each -- and the symptom is not an error but an answer that stops
|
|
180
|
+
* mid-task, which reads as the model giving up. Raise it where a turn is
|
|
181
|
+
* expected to take many small steps.
|
|
182
|
+
*
|
|
183
|
+
* Read once, when the client is built. The bound is a property of the
|
|
184
|
+
* deployment rather than of a run, so re-reading it per round would only make
|
|
185
|
+
* a mid-run change possible, and a mid-run change to how long the run may
|
|
186
|
+
* last is not a thing a host has any way to reason about.
|
|
187
|
+
*/
|
|
188
|
+
maxToolRounds?: number;
|
|
155
189
|
}
|
|
156
190
|
/**
|
|
157
191
|
* Raised when a run's stream closes cleanly at the transport level but never
|
|
@@ -185,13 +219,34 @@ export declare class AgUiClient {
|
|
|
185
219
|
*
|
|
186
220
|
* When the agent calls frontend tools, this executes them and re-runs the
|
|
187
221
|
* agent with the results, looping until the agent stops calling frontend
|
|
188
|
-
* tools (bounded by {@link
|
|
222
|
+
* tools (bounded by {@link AgUiClientConfig.maxToolRounds}, which defaults to
|
|
223
|
+
* {@link MAX_TOOL_ROUNDS}).
|
|
189
224
|
*
|
|
190
225
|
* `attachments` ride on the user message as a non-standard field so the
|
|
191
226
|
* default store round-trips them for history replay; see
|
|
192
227
|
* {@link messageAttachments}.
|
|
193
228
|
*/
|
|
194
229
|
send(content: string, attachments?: readonly AttachmentRef[]): Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Drop everything after the most recent user message, so the same question
|
|
232
|
+
* can be asked again.
|
|
233
|
+
*
|
|
234
|
+
* Returns the retained history, or `null` when there is nothing to retry (no
|
|
235
|
+
* user message has been sent yet). **Truncates only** -- the caller re-renders
|
|
236
|
+
* from the returned list and then calls {@link resume}, because the transcript
|
|
237
|
+
* belongs to the element and a client that reached into it would own two
|
|
238
|
+
* things. Running here instead would stream the new answer in underneath the
|
|
239
|
+
* old one.
|
|
240
|
+
*
|
|
241
|
+
* Re-running answers the question the agent was last asked, rather than
|
|
242
|
+
* telling it its answer was wrong, which is what makes the result a
|
|
243
|
+
* *different* answer instead of a conversation about the previous one.
|
|
244
|
+
*
|
|
245
|
+
* **A retried turn re-runs its tools.** For a page-driving agent that is not
|
|
246
|
+
* neutral: the previous attempt already clicked what it clicked, and this
|
|
247
|
+
* does not undo it.
|
|
248
|
+
*/
|
|
249
|
+
truncateToLastUser(): readonly Message[] | null;
|
|
195
250
|
/**
|
|
196
251
|
* Resume the run loop after a navigating tool's result was supplied
|
|
197
252
|
* post-reload (via {@link addToolResult}). Unlike {@link send}, adds no user
|
|
@@ -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;AAErD,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;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC;AAEpG;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,UAAU,EAAE,SAAS,SAAS,EAAE,KAC7B,OAAO,CAAC,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FAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAEvD;IAED,4CAA4C;IAC5C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,wEAAwE;IACxE,IAAI,QAAQ,IAAI,SAAS,OAAO,EAAE,CAEjC;IAED;;;;;;;;;;;OAWG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,SAAS,aAAa,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrF;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,kBAAkB,IAAI,SAAS,OAAO,EAAE,GAAG,IAAI,CAkB9C;IAED;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;IAED,0EAA0E;IAC1E,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAGvD;IAED;;;;;;OAMG;IACH,MAAM,IAAI,IAAI,CAGb;CAiQF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ATTACHMENT_EVENT, CHART_ACTIVITY_TYPE, COMPACTION_ACTIVITY_TYPE, ELEMENT_TAG, LOAD_CAPABILITY_TOOL, MAX_TOOL_ROUNDS, MESSAGE_ROLE, RUN_FINISHED_EVENT, STATE_EVENT, SUBMIT_EVENT, TOGGLE_EVENT, TOOL_CALL_STATUS, TOOL_DISPLAY, UNREAD_EVENT, X_CONFIRM_KEY, X_DESTRUCTIVE_KEY, X_NAVIGATES_KEY, X_SUMMARY_KEY, } from "./constants.js";
|
|
2
|
-
export { AgUiChat, type AttachmentsDetail, type MessageRole, type RunFinishedDetail, type StateDetail, type SubmitDetail, type ToggleDetail, type ToolRun, type UnreadDetail, } from "./core/ag_ui_chat.js";
|
|
1
|
+
export { ATTACHMENT_EVENT, CHART_ACTIVITY_TYPE, COMPACTION_ACTIVITY_TYPE, CUSTOM_AGENT_EVENT, ELEMENT_TAG, FEEDBACK_EVENT, INVALIDATE_CUSTOM_NAME, INVALIDATE_EVENT, LOAD_CAPABILITY_TOOL, MAX_TOOL_ROUNDS, MESSAGE_ACTIONS, MESSAGE_ROLE, RUN_FINISHED_EVENT, STATE_EVENT, SUBMIT_EVENT, SUGGESTIONS_ACTIVITY_TYPE, TOGGLE_EVENT, TOOL_CALL_STATUS, TOOL_DISPLAY, UNREAD_EVENT, X_CONFIRM_KEY, X_DESTRUCTIVE_KEY, X_NAVIGATES_KEY, X_SUMMARY_KEY, } from "./constants.js";
|
|
2
|
+
export { type ActivityRegistration, type ActivityRenderer, AgUiChat, type AttachmentsDetail, type CustomAgentDetail, type FeedbackDetail, type InvalidateDetail, type MessageRole, type RunFinishedDetail, type StateDetail, type SubmitDetail, type ToggleDetail, type ToolRun, type UnreadDetail, } from "./core/ag_ui_chat.js";
|
|
3
3
|
export { AgUiClient, type AgUiClientConfig, type AgUiClientHandlers, type AgUiRunInputs, type AgUiToolCall, ConnectionLostError, type ExecuteTool, type InterruptResponse, type ResolveInterrupts, type ToolExecution, } from "./core/agui_client.js";
|
|
4
4
|
export { type AttachmentRef, messageAttachments } from "./core/attachment.js";
|
|
5
5
|
export { type ClientConversationStore, type NavigationCheckpoint, SessionStorageStore, type ThreadMeta, } from "./core/conversation_store.js";
|
|
@@ -32,10 +32,15 @@ export { chartSpecFrom } from "./ui/chart_spec_from.js";
|
|
|
32
32
|
export { CHART_TOOL_NAME } from "./ui/chart_tool.js";
|
|
33
33
|
export { CheckpointMenu, type CheckpointVerb } from "./ui/checkpoint_menu.js";
|
|
34
34
|
export { type ConfirmationOptions, type ConfirmationRequest, requestConfirmation, } from "./ui/confirmation_card.js";
|
|
35
|
+
export { attachMessageActions, type MessageActionsOptions, messageActionBar, } from "./ui/message_actions.js";
|
|
36
|
+
export { attachQuoteOffer, type PageQuoteOffer, type PageQuoteOfferOptions, } from "./ui/page_quote_offer.js";
|
|
35
37
|
export { prettifyToolName } from "./ui/prettify_tool_name.js";
|
|
36
38
|
export { type QuestionOptions, type QuestionRenderer, type QuestionRequest, requestQuestion, } from "./ui/question_card.js";
|
|
39
|
+
export { asQuote, MAX_QUOTE_CHARS, type QuotableSelection, quotableSelection, } from "./ui/quote_selection.js";
|
|
40
|
+
export { type RelativeTimeFormatter, relativeTime, } from "./ui/relative_time.js";
|
|
37
41
|
export { type RenderMarkdownOptions, renderMarkdown } from "./ui/render_markdown.js";
|
|
38
|
-
export {
|
|
42
|
+
export { MAX_SUGGESTION_CHARS, MAX_SUGGESTIONS, renderSuggestionChips, suggestionPrompts, } from "./ui/suggestion_chips.js";
|
|
43
|
+
export { type SettledStatus, ToolCallCard, type ToolCallCardOptions, type ToolCallStatus, type ToolDisplayMode, type ToolPayload, type ToolPayloadFormatter, } from "./ui/tool_call_card.js";
|
|
39
44
|
export { DEFAULT_UI_STRINGS, mergeUiStrings, type UiStrings } from "./ui/ui_strings.js";
|
|
40
45
|
export { VERSION } from "./version.js";
|
|
41
46
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,YAAY,GAClB,M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xB,KAAK,mBAAmB,EACxB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,qBAAqB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,yBAAyB,EACzB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,QAAQ,EACR,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,YAAY,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,iBAA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