@artooi/ag-ui-web-component 0.3.1 → 0.5.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 +59 -1
- package/README.md +25 -1
- package/dist/ag-ui-web-component.bundle.js +251 -54
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +18 -2
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/core/conversation_store.d.ts +37 -8
- package/dist/core/conversation_store.d.ts.map +1 -1
- package/dist/core/remote_conversation_store.d.ts +35 -0
- package/dist/core/remote_conversation_store.d.ts.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +740 -13
- package/dist/index.js.map +4 -4
- package/dist/ui/confirmation_card.d.ts +10 -1
- package/dist/ui/confirmation_card.d.ts.map +1 -1
- package/dist/ui/relative_time.d.ts +11 -0
- package/dist/ui/relative_time.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/thread_drawer.d.ts +33 -0
- package/dist/ui/thread_drawer.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/core/ag_ui_chat.ts +163 -8
- package/src/core/agui_client.ts +63 -3
- package/src/core/conversation_store.ts +148 -9
- package/src/core/remote_conversation_store.ts +147 -0
- package/src/index.ts +7 -1
- package/src/ui/confirmation_card.ts +22 -0
- package/src/ui/relative_time.ts +28 -0
- package/src/ui/styles.ts +197 -0
- package/src/ui/thread_drawer.ts +200 -0
- package/src/version.ts +1 -1
|
@@ -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,EAAW,IAAI,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,YAA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AAkB,IAAI,MAAM,EAAE,CAExC;IAED,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM7F,kDAAkD;IAClD,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAIpC,wEAAwE;IACxE,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IA0DxC,kEAAkE;IAClE,IAAI,QAAQ,IAAI,MAAM,CAErB;IAKD,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEzB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,eAAe,CAMjC;IAED,IAAI,WAAW,CAAC,KAAK,EAAE,eAAe,EAErC;IAED,iBAAiB,IAAI,IAAI;IA2CzB;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,IAAI;IAoEzC,gFAAgF;IAChF,IAAI,SAAS,IAAI,OAAO,CAEvB;IAID,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAE3B;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAgBtC,qEAAqE;IACrE,eAAe,IAAI,IAAI;IAIvB;;;OAGG;IACH,OAAO,IAAI,IAAI;IAmJf;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc;CAmalE"}
|
|
@@ -48,11 +48,19 @@ export interface AgUiClientHandlers {
|
|
|
48
48
|
onToolResult(toolCallId: string, content: string): void;
|
|
49
49
|
onRunEnd(): void;
|
|
50
50
|
onError(message: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Fired when the user cancelled the run ({@link AgUiClient.cancel}) — the
|
|
53
|
+
* deliberate-stop sibling of `onError`. Any partial assistant text already
|
|
54
|
+
* streamed stays valid; the host should keep the bubble and show a muted
|
|
55
|
+
* "stopped" affordance rather than an error. `onSettled` still follows.
|
|
56
|
+
*/
|
|
57
|
+
onCancelled(): void;
|
|
51
58
|
/**
|
|
52
59
|
* Fired exactly once when the whole interaction settles — after the run loop
|
|
53
60
|
* ends for any reason (a server-only round, frontend-tool rounds exhausted,
|
|
54
|
-
* or an error). The terminal guarantee that the UI returns
|
|
55
|
-
* indicator cleared, input re-enabled) no matter how the
|
|
61
|
+
* a cancellation, or an error). The terminal guarantee that the UI returns
|
|
62
|
+
* to rest (pending indicator cleared, input re-enabled) no matter how the
|
|
63
|
+
* run finished.
|
|
56
64
|
*/
|
|
57
65
|
onSettled(): void;
|
|
58
66
|
}
|
|
@@ -108,5 +116,13 @@ export declare class AgUiClient {
|
|
|
108
116
|
resume(): Promise<void>;
|
|
109
117
|
/** Append a frontend tool result to history (used by the resume path). */
|
|
110
118
|
addToolResult(toolCallId: string, content: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* Cancel the in-flight run (AG-UI has no server cancel route — aborting the
|
|
121
|
+
* streaming request is the protocol's cancel; the server observes the
|
|
122
|
+
* disconnect). Safe to call with no run in flight. Partial text already
|
|
123
|
+
* streamed stays in history; {@link AgUiClientHandlers.onCancelled} fires
|
|
124
|
+
* instead of `onError`, and `onSettled` still follows.
|
|
125
|
+
*/
|
|
126
|
+
cancel(): void;
|
|
111
127
|
}
|
|
112
128
|
//# 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,EAAE,KAAK,aAAa,EAAoC,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAG1D,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC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AAI,IAAI,CAAC;IACjB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;;OAKG;IACH,WAAW,IAAI,IAAI,CAAC;IACpB;;;;;;OAMG;IACH,SAAS,IAAI,IAAI,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,OAAO,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,sEAAsE;IACtE,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,oEAAoE;IACpE,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,KAAK,IAAI,CAAC;CACpD;AAED;;;;;;GAMG;AACH,qBAAa,UAAU;;gBAWT,MAAM,EAAE,gBAAgB;IASpC,4CAA4C;IAC5C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,wEAAwE;IACxE,IAAI,QAAQ,IAAI,SAAS,OAAO,EAAE,CAEjC;IAED;;;;;;OAMG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1C;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,0EAA0E;IAC1E,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAKxD;;;;;;OAMG;IACH,MAAM,IAAI,IAAI;CAgHf"}
|
|
@@ -9,6 +9,21 @@ export interface NavigationCheckpoint {
|
|
|
9
9
|
/** The tool-call id whose result must be supplied after the reload. */
|
|
10
10
|
readonly toolCallId: string;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Lightweight metadata for one conversation — the thread-drawer row shape.
|
|
14
|
+
*
|
|
15
|
+
* Returned by {@link ClientConversationStore.listThreads} so the drawer can
|
|
16
|
+
* render a list without loading message bodies. `title` defaults to a
|
|
17
|
+
* truncation of the first user message (until an explicit rename); `preview`
|
|
18
|
+
* is a one-line excerpt of the latest message; `updatedAt` is epoch ms of the
|
|
19
|
+
* last change, used to order the list.
|
|
20
|
+
*/
|
|
21
|
+
export interface ThreadMeta {
|
|
22
|
+
readonly threadId: string;
|
|
23
|
+
readonly title: string;
|
|
24
|
+
readonly updatedAt: number;
|
|
25
|
+
readonly preview: string;
|
|
26
|
+
}
|
|
12
27
|
/**
|
|
13
28
|
* Client-side persistence seam for the conversation and a pending-navigation
|
|
14
29
|
* checkpoint, keyed by `thread_id`.
|
|
@@ -16,31 +31,42 @@ export interface NavigationCheckpoint {
|
|
|
16
31
|
* The default {@link SessionStorageStore} keeps everything per-tab in
|
|
17
32
|
* `sessionStorage`, so the chat survives the full page reloads of a
|
|
18
33
|
* multi-page app. A host may inject a server-backed store instead (e.g. one
|
|
19
|
-
* that rehydrates from a history endpoint); `loadMessages`
|
|
20
|
-
* async-friendly. The checkpoint methods stay synchronous — the
|
|
21
|
-
* tiny local hint a server store can derive from history and no-op.
|
|
34
|
+
* that rehydrates from a history endpoint); `loadMessages` and `listThreads`
|
|
35
|
+
* are therefore async-friendly. The checkpoint methods stay synchronous — the
|
|
36
|
+
* marker is a tiny local hint a server store can derive from history and no-op.
|
|
37
|
+
*
|
|
38
|
+
* Thread enumeration (`listThreads` / `setActiveThread` / `renameThread`) backs
|
|
39
|
+
* the chat-history drawer; "delete a thread" reuses {@link clear} and "new
|
|
40
|
+
* chat" reuses {@link threadId} after clearing the active thread.
|
|
22
41
|
*/
|
|
23
42
|
export interface ClientConversationStore {
|
|
24
|
-
/**
|
|
43
|
+
/** The active conversation id, generated and persisted on first read. */
|
|
25
44
|
threadId(): string;
|
|
26
45
|
/** Load the persisted message history, or `null` when none exists. */
|
|
27
46
|
loadMessages(threadId: string): Promise<readonly Message[] | null>;
|
|
28
|
-
/** Persist the message history. */
|
|
47
|
+
/** Persist the message history (and refresh the thread's drawer metadata). */
|
|
29
48
|
saveMessages(threadId: string, messages: readonly Message[]): void;
|
|
30
49
|
/** Load the pending-navigation checkpoint, or `null` when none is set. */
|
|
31
50
|
loadCheckpoint(threadId: string): NavigationCheckpoint | null;
|
|
32
51
|
/** Set the pending-navigation checkpoint, or clear it when given `null`. */
|
|
33
52
|
saveCheckpoint(threadId: string, checkpoint: NavigationCheckpoint | null): void;
|
|
34
|
-
/** Forget the conversation and checkpoint (
|
|
53
|
+
/** Forget the conversation and checkpoint (a "delete thread" / "new chat"). */
|
|
35
54
|
clear(threadId: string): void;
|
|
55
|
+
/** The user's threads as drawer metadata (no message bodies), newest first. */
|
|
56
|
+
listThreads(): Promise<readonly ThreadMeta[]>;
|
|
57
|
+
/** Make `threadId` the active conversation (the drawer selecting a row). */
|
|
58
|
+
setActiveThread(threadId: string): void;
|
|
59
|
+
/** Set a thread's display title (the drawer renaming a row). */
|
|
60
|
+
renameThread(threadId: string, title: string): void;
|
|
36
61
|
}
|
|
37
62
|
/**
|
|
38
63
|
* Default {@link ClientConversationStore}: per-tab `sessionStorage`.
|
|
39
64
|
*
|
|
40
65
|
* Survives full page reloads and same-tab navigation, clears on tab close —
|
|
41
66
|
* the right scope for an embedded agent's conversation in a multi-page app.
|
|
42
|
-
*
|
|
43
|
-
*
|
|
67
|
+
* Tracks multiple threads per tab: the active id lives under one key, the
|
|
68
|
+
* message history / checkpoint are namespaced by id, and a small index feeds
|
|
69
|
+
* the drawer so it works with no server.
|
|
44
70
|
*/
|
|
45
71
|
export declare class SessionStorageStore implements ClientConversationStore {
|
|
46
72
|
#private;
|
|
@@ -50,5 +76,8 @@ export declare class SessionStorageStore implements ClientConversationStore {
|
|
|
50
76
|
loadCheckpoint(threadId: string): NavigationCheckpoint | null;
|
|
51
77
|
saveCheckpoint(threadId: string, checkpoint: NavigationCheckpoint | null): void;
|
|
52
78
|
clear(threadId: string): void;
|
|
79
|
+
listThreads(): Promise<readonly ThreadMeta[]>;
|
|
80
|
+
setActiveThread(threadId: string): void;
|
|
81
|
+
renameThread(threadId: string, title: string): void;
|
|
53
82
|
}
|
|
54
83
|
//# sourceMappingURL=conversation_store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_store.d.ts","sourceRoot":"","sources":["../../src/core/conversation_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED
|
|
1
|
+
{"version":3,"file":"conversation_store.d.ts","sourceRoot":"","sources":["../../src/core/conversation_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,uBAAuB;IACtC,yEAAyE;IACzE,QAAQ,IAAI,MAAM,CAAC;IACnB,sEAAsE;IACtE,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACnE,8EAA8E;IAC9E,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAA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ui/core";
|
|
2
|
+
import { type ClientConversationStore, type NavigationCheckpoint, type ThreadMeta } from "./conversation_store.js";
|
|
3
|
+
/** Live header source, read per request so rotated tokens / CSRF reach the server. */
|
|
4
|
+
type HeadersProvider = () => Record<string, string>;
|
|
5
|
+
/**
|
|
6
|
+
* A {@link ClientConversationStore} backed by a server thread-index endpoint —
|
|
7
|
+
* django-ag-ui's owner-scoped `ThreadsView`, the URL passed to `<ag-ui-chat>`
|
|
8
|
+
* as `data-threads-url`:
|
|
9
|
+
*
|
|
10
|
+
* - `GET <url>` → list the user's threads (metadata only);
|
|
11
|
+
* - `GET <url><id>/` → that thread's messages;
|
|
12
|
+
* - `PATCH <url><id>/` → rename (`{ "title": … }`);
|
|
13
|
+
* - `DELETE <url><id>/` → delete.
|
|
14
|
+
*
|
|
15
|
+
* It wraps a local store (default {@link SessionStorageStore}) for the
|
|
16
|
+
* client-only concerns — the active thread id, the navigation checkpoint, and a
|
|
17
|
+
* message cache — and as the graceful fallback when a request fails. Rename and
|
|
18
|
+
* delete apply **optimistically** (a small local overlay) so the drawer
|
|
19
|
+
* reflects them at once, before the fire-and-forget server round-trip lands.
|
|
20
|
+
*/
|
|
21
|
+
export declare class RemoteConversationStore implements ClientConversationStore {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(url: string, headers?: HeadersProvider, local?: ClientConversationStore);
|
|
24
|
+
threadId(): string;
|
|
25
|
+
setActiveThread(threadId: string): void;
|
|
26
|
+
saveMessages(threadId: string, messages: readonly Message[]): void;
|
|
27
|
+
loadCheckpoint(threadId: string): NavigationCheckpoint | null;
|
|
28
|
+
saveCheckpoint(threadId: string, checkpoint: NavigationCheckpoint | null): void;
|
|
29
|
+
renameThread(threadId: string, title: string): void;
|
|
30
|
+
clear(threadId: string): void;
|
|
31
|
+
listThreads(): Promise<readonly ThreadMeta[]>;
|
|
32
|
+
loadMessages(threadId: string): Promise<readonly Message[] | null>;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=remote_conversation_store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote_conversation_store.d.ts","sourceRoot":"","sources":["../../src/core/remote_conversation_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAEzB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAUjC,sFAAsF;AACtF,KAAK,eAAe,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,uBAAwB,YAAW,uBAAuB;;gBAQnE,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,eAA4B,EACrC,KAAK,GAAE,uBAAmD;IAO5D,QAAQ,IAAI,MAAM;IAIlB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIvC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAKlE,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI;IAI7D,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,GAAG,IAAI,GAAG,IAAI;IAI/E,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAMnD,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMvB,WAAW,IAAI,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC;IAQ7C,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC;CAqDzE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { ELEMENT_TAG, MAX_TOOL_ROUNDS, MESSAGE_ROLE, SUBMIT_EVENT, TOGGLE_EVENT, TOOL_CALL_STATUS, TOOL_DISPLAY, X_CONFIRM_KEY, X_DESTRUCTIVE_KEY, X_NAVIGATES_KEY, X_SUMMARY_KEY, } from "./constants.js";
|
|
2
2
|
export { AgUiChat, type MessageRole, type SubmitDetail, type ToggleDetail, } from "./core/ag_ui_chat.js";
|
|
3
3
|
export { AgUiClient, type AgUiClientConfig, type AgUiClientHandlers, type AgUiRunInputs, type AgUiToolCall, type ExecuteTool, type ToolExecution, } from "./core/agui_client.js";
|
|
4
|
-
export { type ClientConversationStore, type NavigationCheckpoint, SessionStorageStore, } from "./core/conversation_store.js";
|
|
4
|
+
export { type ClientConversationStore, type NavigationCheckpoint, SessionStorageStore, type ThreadMeta, } from "./core/conversation_store.js";
|
|
5
5
|
export { type AgentFactory, createHttpAgent, type HttpAgentOptions, } from "./core/create_http_agent.js";
|
|
6
6
|
export { defineAgUiChat } from "./core/define_ag_ui_chat.js";
|
|
7
|
+
export { RemoteConversationStore } from "./core/remote_conversation_store.js";
|
|
7
8
|
export { type FlashOptions, focusWithFlash, type HighlightClickOptions, highlightThenClick, type PressOptions, prefersReducedMotion, pressThenClick, type SelectOptions, scrollIntoCenterView, selectOption, type TextLikeElement, type ToggleOptions, type TypeOptions, toggleControl, typeInto, } from "./dom/animations.js";
|
|
8
9
|
export { clickElement, type FillFieldOptions, fillField, pressButton, selectControl, setControlValue, toggleCheckbox, } from "./dom/dom_driver.js";
|
|
9
10
|
export { setNativeChecked, setNativeValue } from "./dom/native_setter.js";
|
|
@@ -15,7 +16,7 @@ export { createPageMapContext, type PageMap } from "./tools/page_map.js";
|
|
|
15
16
|
export { parseToolCatalog, type ToolCatalogEntry } from "./tools/parse_tool_catalog.js";
|
|
16
17
|
export { createRouteTools, type Route, type RouteMap, type RouteWithParams, } from "./tools/route_map.js";
|
|
17
18
|
export { createStateHookTools, type StateHook } from "./tools/state_hook.js";
|
|
18
|
-
export { type ConfirmationRequest, requestConfirmation } from "./ui/confirmation_card.js";
|
|
19
|
+
export { type ConfirmationOptions, type ConfirmationRequest, requestConfirmation, } from "./ui/confirmation_card.js";
|
|
19
20
|
export { prettifyToolName } from "./ui/prettify_tool_name.js";
|
|
20
21
|
export { type RenderMarkdownOptions, renderMarkdown } from "./ui/render_markdown.js";
|
|
21
22
|
export { type SettledStatus, ToolCallCard, type ToolCallStatus, type ToolDisplayMode, } from "./ui/tool_call_card.js";
|
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,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,MAAM,sBA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