@artooi/ag-ui-web-component 0.10.0 → 0.12.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 +78 -1
- package/README.md +144 -7
- package/dist/ag-ui-web-component.bundle.js +237 -40
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/core/ag_ui_chat.d.ts +29 -0
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +28 -1
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/core/run_index.d.ts +50 -0
- package/dist/core/run_index.d.ts.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +942 -101
- package/dist/index.js.map +4 -4
- package/dist/ui/approval_card.d.ts +51 -0
- package/dist/ui/approval_card.d.ts.map +1 -0
- package/dist/ui/attachment_chips.d.ts.map +1 -1
- package/dist/ui/attachment_tray.d.ts.map +1 -1
- package/dist/ui/checkpoint_menu.d.ts +32 -0
- package/dist/ui/checkpoint_menu.d.ts.map +1 -0
- package/dist/ui/question_card.d.ts +52 -0
- package/dist/ui/question_card.d.ts.map +1 -0
- package/dist/ui/skills_menu.d.ts.map +1 -1
- package/dist/ui/styles.d.ts +1 -1
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/thoughts_block.d.ts.map +1 -1
- package/dist/ui/thread_drawer.d.ts.map +1 -1
- package/dist/ui/ui_strings.d.ts +26 -0
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/core/ag_ui_chat.ts +263 -4
- package/src/core/agui_client.ts +86 -11
- package/src/core/run_index.ts +91 -0
- package/src/index.ts +16 -0
- package/src/ui/approval_card.ts +119 -0
- package/src/ui/attachment_chips.ts +5 -0
- package/src/ui/attachment_tray.ts +8 -0
- package/src/ui/checkpoint_menu.ts +153 -0
- package/src/ui/question_card.ts +216 -0
- package/src/ui/skills_menu.ts +6 -0
- package/src/ui/styles.ts +197 -0
- package/src/ui/thoughts_block.ts +1 -0
- package/src/ui/thread_drawer.ts +11 -0
- package/src/ui/ui_strings.ts +45 -0
- package/src/version.ts +1 -1
|
@@ -6,6 +6,8 @@ import { type ResolvePageTarget } from "../tools/page_action_tools.js";
|
|
|
6
6
|
import { type PageMap } from "../tools/page_map.js";
|
|
7
7
|
import { type RouteMap } from "../tools/route_map.js";
|
|
8
8
|
import { type StateHook } from "../tools/state_hook.js";
|
|
9
|
+
import { type ApprovalRenderer } from "../ui/approval_card.js";
|
|
10
|
+
import { type QuestionRenderer } from "../ui/question_card.js";
|
|
9
11
|
import { type ToolDisplayMode } from "../ui/tool_call_card.js";
|
|
10
12
|
import { type UiStrings } from "../ui/ui_strings.js";
|
|
11
13
|
import { type AttachmentRef } from "./attachment.js";
|
|
@@ -52,6 +54,33 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
52
54
|
allowImages: boolean;
|
|
53
55
|
/** When true, destructive tools execute without a confirmation modal. */
|
|
54
56
|
autoConfirm: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* When true, the built-in `ask_user` frontend tool is offered to the agent:
|
|
59
|
+
* calling it renders an inline question card (radio choices and/or a free-text
|
|
60
|
+
* field) and returns the user's answer. Off by default — like the other
|
|
61
|
+
* built-in tool groups (route / page-action), it is opt-in so it doesn't
|
|
62
|
+
* change the advertised catalog until a host asks for it.
|
|
63
|
+
*/
|
|
64
|
+
askUser: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Optional full replacement for the `ask_user` question UI. When set, calling
|
|
67
|
+
* `ask_user` invokes this instead of the built-in inline card: the host
|
|
68
|
+
* renders whatever it likes (a native modal, a framework component, …) and
|
|
69
|
+
* resolves with the answer. Unset (default) uses the built-in
|
|
70
|
+
* {@link requestQuestion} card — style that via the `strings` override and the
|
|
71
|
+
* `question*` CSS `::part()`s. Requires {@link askUser} to be enabled.
|
|
72
|
+
*/
|
|
73
|
+
askUserRenderer: QuestionRenderer | null;
|
|
74
|
+
/**
|
|
75
|
+
* Optional full replacement for the server-side-tool approval UI. When set, an
|
|
76
|
+
* approval interrupt invokes this instead of the built-in inline approval
|
|
77
|
+
* card: the host renders whatever it likes and resolves `true` to approve /
|
|
78
|
+
* `false` to deny. Unset (default) uses the built-in {@link requestApproval}
|
|
79
|
+
* card — style that via the `strings` override and the `approval*` CSS
|
|
80
|
+
* `::part()`s. The gate itself is enabled server-side; this only changes how
|
|
81
|
+
* the decision is collected.
|
|
82
|
+
*/
|
|
83
|
+
approvalRenderer: ApprovalRenderer | null;
|
|
55
84
|
/**
|
|
56
85
|
* Optional per-call confirmation predicate. When set, it is authoritative:
|
|
57
86
|
* given a tool name + args it decides whether *this* call needs confirmation
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAsB,IAAI,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAEL,YAAY,EAOb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,kCAAkC,CAAC;AAGvF,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAwB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EACL,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AE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAO7F,kDAAkD;IAClD,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAIpC,wEAAwE;IACxE,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAyJxC,kEAAkE;IAClE,IAAI,QAAQ,IAAI,MAAM,CAErB;IAKD,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEzB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,eAAe,CAUjC;IAED,IAAI,WAAW,CAAC,KAAK,EAAE,eAAe,EAErC;IAED,iBAAiB,IAAI,IAAI;IAqCzB;;;;;;;OAOG;IACH,oBAAoB,IAAI,IAAI;IA2L5B;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,IAAI;IAsEzC,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;IAiBtC,qEAAqE;IACrE,eAAe,IAAI,IAAI;IAIvB;;;;;OAKG;IACH,WAAW,IAAI,IAAI;IA+BnB;;;OAGG;IACH,OAAO,IAAI,IAAI;IAsKf;;;;;;;;;;OAUG;IACH,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc;CAmsBlE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AbstractAgent } from "@ag-ui/client";
|
|
2
|
-
import type { Context, Message, Tool } from "@ag-ui/core";
|
|
2
|
+
import type { Context, Interrupt, Message, Tool } from "@ag-ui/core";
|
|
3
3
|
import type { AttachmentRef } from "./attachment.js";
|
|
4
4
|
/** A tool call surfaced to the host by {@link AgUiClient}. */
|
|
5
5
|
export interface AgUiToolCall {
|
|
@@ -28,6 +28,28 @@ export interface ToolExecution {
|
|
|
28
28
|
* already executed — the client must not re-run for it).
|
|
29
29
|
*/
|
|
30
30
|
export type ExecuteTool = (call: AgUiToolCall) => Promise<ToolExecution | null>;
|
|
31
|
+
/**
|
|
32
|
+
* One user decision for a server-side-tool approval interrupt. Structurally
|
|
33
|
+
* matches `@ag-ui/client`'s (non-exported) `ResumeResponse`, the payload
|
|
34
|
+
* {@link buildResumeArray} turns into a `ResumeEntry`: `resolved` approves (with
|
|
35
|
+
* an optional `payload`, e.g. `{ approved: true }`), `cancelled` denies.
|
|
36
|
+
*/
|
|
37
|
+
export type InterruptResponse = {
|
|
38
|
+
status: "resolved";
|
|
39
|
+
payload?: unknown;
|
|
40
|
+
} | {
|
|
41
|
+
status: "cancelled";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Resolves the approval interrupts a run finished on, keyed by interrupt id.
|
|
45
|
+
*
|
|
46
|
+
* When a gated **server-side** tool defers instead of executing, the run
|
|
47
|
+
* finishes on an AG-UI interrupt outcome; the host renders an approval card per
|
|
48
|
+
* interrupt and returns each decision here, and the loop resumes the run with
|
|
49
|
+
* the answers. Omit for agents that never gate server-side tools — an
|
|
50
|
+
* unresolved interrupt then simply ends the loop.
|
|
51
|
+
*/
|
|
52
|
+
export type ResolveInterrupts = (interrupts: readonly Interrupt[]) => Promise<Record<string, InterruptResponse>>;
|
|
31
53
|
/**
|
|
32
54
|
* Callbacks the {@link AgUiClient} invokes as a run progresses. The host
|
|
33
55
|
* (the `<ag-ui-chat>` element) implements these to render streaming text and
|
|
@@ -86,6 +108,11 @@ export interface AgUiClientConfig extends AgUiRunInputs {
|
|
|
86
108
|
handlers: AgUiClientHandlers;
|
|
87
109
|
/** Executes frontend tool calls. Omit for server-only tool sets. */
|
|
88
110
|
executeTool?: ExecuteTool;
|
|
111
|
+
/**
|
|
112
|
+
* Resolves server-side-tool approval interrupts. Omit when no server-side
|
|
113
|
+
* tool is gated for approval — an interrupt then ends the loop unanswered.
|
|
114
|
+
*/
|
|
115
|
+
resolveInterrupts?: ResolveInterrupts;
|
|
89
116
|
/**
|
|
90
117
|
* Invoked with the latest history whenever it changes, so the host can
|
|
91
118
|
* persist it for durability across page reloads. Omit to keep the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agui_client.d.ts","sourceRoot":"","sources":["../../src/core/agui_client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,CAA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iB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,KAAK,IAAI,CAAC;IACnD;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;GAMG;AACH,qBAAa,UAAU;;gBAaT,MAAM,EAAE,gBAAgB;IAWpC,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;IAatF;;;;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;CAiLf"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** One row of the server run index (django-ag-ui's `RunsView` wire shape). */
|
|
2
|
+
export interface RunRow {
|
|
3
|
+
readonly run_id: string;
|
|
4
|
+
readonly thread_id: string | null;
|
|
5
|
+
readonly parent_run_id: string | null;
|
|
6
|
+
readonly started_at: string | null;
|
|
7
|
+
/** Whether the run has a snapshot to seed from — see {@link RunIndex}. */
|
|
8
|
+
readonly continuable: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Live header source, read per request so rotated tokens / CSRF reach the server. */
|
|
11
|
+
type HeadersProvider = () => Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Reads the server's run index and derives the resume / fork URLs beside it.
|
|
14
|
+
*
|
|
15
|
+
* Backed by django-ag-ui's owner-scoped `RunsView` — the URL passed to
|
|
16
|
+
* `<ag-ui-chat>` as `data-runs-url`:
|
|
17
|
+
*
|
|
18
|
+
* - `GET <url>` → the user's runs, newest first.
|
|
19
|
+
*
|
|
20
|
+
* **Only `continuable` rows can be resumed.** The server reports whether a run
|
|
21
|
+
* has a saved snapshot to seed from; a run that never reached a provider-valid
|
|
22
|
+
* boundary has none, so resuming it would start from nothing. Callers should
|
|
23
|
+
* offer the action only for those rows and treat the rest as informational — a
|
|
24
|
+
* crashed run worth showing, not worth continuing. {@link continuable} filters
|
|
25
|
+
* for exactly that.
|
|
26
|
+
*
|
|
27
|
+
* **Resume and fork are siblings of the index**, not separate configuration.
|
|
28
|
+
* django-ag-ui mounts all three under one prefix whenever a step store is
|
|
29
|
+
* configured (`runs/`, `resume/<id>/`, `fork/<id>/`), so one URL locates them
|
|
30
|
+
* all and there is no way to configure a half-working set.
|
|
31
|
+
*/
|
|
32
|
+
export declare class RunIndex {
|
|
33
|
+
#private;
|
|
34
|
+
constructor(url: string, headers?: HeadersProvider);
|
|
35
|
+
/**
|
|
36
|
+
* The user's runs, or `[]` when the endpoint is unreachable or answers with
|
|
37
|
+
* an error. A history affordance that cannot load is empty, never broken:
|
|
38
|
+
* the caller renders its empty state rather than surfacing a transport fault
|
|
39
|
+
* the user can do nothing about.
|
|
40
|
+
*/
|
|
41
|
+
list(): Promise<readonly RunRow[]>;
|
|
42
|
+
/** The rows a client may actually continue. */
|
|
43
|
+
continuable(): Promise<readonly RunRow[]>;
|
|
44
|
+
/** The endpoint that continues `runId` as a new run. */
|
|
45
|
+
resumeUrl(runId: string): string;
|
|
46
|
+
/** The endpoint that branches `runId` into a new run, leaving the source untouched. */
|
|
47
|
+
forkUrl(runId: string): string;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=run_index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_index.d.ts","sourceRoot":"","sources":["../../src/core/run_index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,sFAAsF;AACtF,KAAK,eAAe,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,QAAQ;;gBAIP,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,eAA4B;IAK9D;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAgBxC,+CAA+C;IACzC,WAAW,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAI/C,wDAAwD;IACxD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIhC,uFAAuF;IACvF,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAe/B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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
|
-
export { AgUiClient, type AgUiClientConfig, type AgUiClientHandlers, type AgUiRunInputs, type AgUiToolCall, ConnectionLostError, type ExecuteTool, type ToolExecution, } from "./core/agui_client.js";
|
|
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";
|
|
6
6
|
export { type AgentFactory, createHttpAgent, type HttpAgentOptions, } from "./core/create_http_agent.js";
|
|
7
7
|
export { defineAgUiChat } from "./core/define_ag_ui_chat.js";
|
|
8
8
|
export { RemoteConversationStore } from "./core/remote_conversation_store.js";
|
|
9
|
+
export { RunIndex, type RunRow } from "./core/run_index.js";
|
|
9
10
|
export { type TranscribeHandler, type TranscribeOptions, transcribeAudio, } from "./core/transcribe_audio.js";
|
|
10
11
|
export { type UploadHandler, type UploadOptions, uploadAttachment, } from "./core/upload_attachment.js";
|
|
11
12
|
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";
|
|
@@ -20,8 +21,11 @@ export { createPageMapContext, type PageMap } from "./tools/page_map.js";
|
|
|
20
21
|
export { parseToolCatalog, type ToolCatalogEntry } from "./tools/parse_tool_catalog.js";
|
|
21
22
|
export { createRouteTools, type Route, type RouteMap, type RouteWithParams, } from "./tools/route_map.js";
|
|
22
23
|
export { createStateHookTools, type StateHook } from "./tools/state_hook.js";
|
|
24
|
+
export { type ApprovalOptions, type ApprovalRenderer, type ApprovalRequest, requestApproval, } from "./ui/approval_card.js";
|
|
25
|
+
export { CheckpointMenu, type CheckpointVerb } from "./ui/checkpoint_menu.js";
|
|
23
26
|
export { type ConfirmationOptions, type ConfirmationRequest, requestConfirmation, } from "./ui/confirmation_card.js";
|
|
24
27
|
export { prettifyToolName } from "./ui/prettify_tool_name.js";
|
|
28
|
+
export { type QuestionOptions, type QuestionRenderer, type QuestionRequest, requestQuestion, } from "./ui/question_card.js";
|
|
25
29
|
export { type RenderMarkdownOptions, renderMarkdown } from "./ui/render_markdown.js";
|
|
26
30
|
export { type SettledStatus, ToolCallCard, type ToolCallStatus, type ToolDisplayMode, } from "./ui/tool_call_card.js";
|
|
27
31
|
export { DEFAULT_UI_STRINGS, mergeUiStrings, type UiStrings } from "./ui/ui_strings.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,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,mBAAmB,EACnB,KAAK,UAAU,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,YAAY,EACjB,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EA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