@threadplane/chat 0.0.51 → 0.0.52
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/fesm2022/threadplane-chat.mjs +246 -119
- package/fesm2022/threadplane-chat.mjs.map +1 -1
- package/package.json +1 -1
- package/types/threadplane-chat.d.ts +141 -21
package/package.json
CHANGED
|
@@ -52,6 +52,12 @@ type ClientToolDef = AnyFunctionToolDef | ViewToolDef | AskToolDef;
|
|
|
52
52
|
/** A frozen, name-keyed registry of client tools. */
|
|
53
53
|
type ClientToolRegistry = Readonly<Record<string, ClientToolDef>>;
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Application-wide options for {@link provideChat}. Every field is optional;
|
|
57
|
+
* the values are exposed to all chat components in the tree via the
|
|
58
|
+
* `CHAT_CONFIG` injection token, so you set them once at bootstrap instead of
|
|
59
|
+
* threading props through every component.
|
|
60
|
+
*/
|
|
55
61
|
interface ChatConfig {
|
|
56
62
|
/** Shared render registry for consumers that read CHAT_CONFIG. */
|
|
57
63
|
renderRegistry?: AngularRegistry;
|
|
@@ -198,15 +204,55 @@ interface Message {
|
|
|
198
204
|
*/
|
|
199
205
|
toolCallIds?: string[];
|
|
200
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Type guard narrowing a {@link Message} to `role: 'user'`.
|
|
209
|
+
*
|
|
210
|
+
* @param m The message to test.
|
|
211
|
+
* @returns `true` (and narrows `m`) when the message was sent by the user.
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* const userTurns = agent.messages().filter(isUserMessage);
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
201
217
|
declare function isUserMessage(m: Message): m is Message & {
|
|
202
218
|
role: 'user';
|
|
203
219
|
};
|
|
220
|
+
/**
|
|
221
|
+
* Type guard narrowing a {@link Message} to `role: 'assistant'`.
|
|
222
|
+
*
|
|
223
|
+
* @param m The message to test.
|
|
224
|
+
* @returns `true` (and narrows `m`) when the message came from the assistant.
|
|
225
|
+
* @example
|
|
226
|
+
* ```ts
|
|
227
|
+
* const reply = agent.messages().findLast(isAssistantMessage);
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
204
230
|
declare function isAssistantMessage(m: Message): m is Message & {
|
|
205
231
|
role: 'assistant';
|
|
206
232
|
};
|
|
233
|
+
/**
|
|
234
|
+
* Type guard narrowing a {@link Message} to `role: 'tool'` (a tool result turn).
|
|
235
|
+
*
|
|
236
|
+
* @param m The message to test.
|
|
237
|
+
* @returns `true` (and narrows `m`) when the message is a tool result.
|
|
238
|
+
* @example
|
|
239
|
+
* ```ts
|
|
240
|
+
* if (isToolMessage(m)) console.log(m.toolCallId);
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
207
243
|
declare function isToolMessage(m: Message): m is Message & {
|
|
208
244
|
role: 'tool';
|
|
209
245
|
};
|
|
246
|
+
/**
|
|
247
|
+
* Type guard narrowing a {@link Message} to `role: 'system'`.
|
|
248
|
+
*
|
|
249
|
+
* @param m The message to test.
|
|
250
|
+
* @returns `true` (and narrows `m`) when the message is a system message.
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* const visible = agent.messages().filter((m) => !isSystemMessage(m));
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
210
256
|
declare function isSystemMessage(m: Message): m is Message & {
|
|
211
257
|
role: 'system';
|
|
212
258
|
};
|
|
@@ -714,6 +760,18 @@ declare class ChatInputComponent {
|
|
|
714
760
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatInputComponent, "chat-input", never, { "agent": { "alias": "agent"; "required": true; "isSignal": true; }; "submitOnEnter": { "alias": "submitOnEnter"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "showStopButton": { "alias": "showStopButton"; "required": false; "isSignal": true; }; }, { "submitted": "submitted"; "stopped": "stopped"; }, never, ["[chatInputBanner]", "[chatInputAttachments]", "[chatInputLeading]", "[chatInputModelSelect]", "[chatInputTrailing]", "[chatInputFooter]"], true, never>;
|
|
715
761
|
}
|
|
716
762
|
|
|
763
|
+
/**
|
|
764
|
+
* Whether the agent should show a "typing" indicator — it is loading and has
|
|
765
|
+
* not yet started streaming the assistant's reply.
|
|
766
|
+
*
|
|
767
|
+
* @param agent The agent to inspect.
|
|
768
|
+
* @returns `true` while the agent is awaiting a response but no assistant text
|
|
769
|
+
* has streamed yet; `false` once tokens arrive or the agent is idle.
|
|
770
|
+
* @example
|
|
771
|
+
* ```ts
|
|
772
|
+
* \@if (isTyping(agent)) { <chat-typing-indicator [agent]="agent" /> }
|
|
773
|
+
* ```
|
|
774
|
+
*/
|
|
717
775
|
declare function isTyping(agent: Agent): boolean;
|
|
718
776
|
declare class ChatTypingIndicatorComponent {
|
|
719
777
|
readonly agent: _angular_core.InputSignal<Agent<Record<string, unknown>>>;
|
|
@@ -817,6 +875,18 @@ declare class ChatErrorComponent {
|
|
|
817
875
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatErrorComponent, "chat-error", never, { "agent": { "alias": "agent"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
818
876
|
}
|
|
819
877
|
|
|
878
|
+
/**
|
|
879
|
+
* Read the agent's current human-in-the-loop interrupt, if any.
|
|
880
|
+
*
|
|
881
|
+
* @param agent The agent to inspect.
|
|
882
|
+
* @returns The pending {@link AgentInterrupt}, or `undefined` when the agent is
|
|
883
|
+
* not currently waiting on an interrupt.
|
|
884
|
+
* @example
|
|
885
|
+
* ```ts
|
|
886
|
+
* const interrupt = getInterrupt(agent);
|
|
887
|
+
* if (interrupt) agent.resume('approved');
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
820
890
|
declare function getInterrupt(agent: Agent): AgentInterrupt | undefined;
|
|
821
891
|
declare class ChatInterruptComponent {
|
|
822
892
|
readonly agent: _angular_core.InputSignal<Agent<Record<string, unknown>>>;
|
|
@@ -886,6 +956,8 @@ interface Group {
|
|
|
886
956
|
name: string;
|
|
887
957
|
calls: ToolCall[];
|
|
888
958
|
templateRef?: ChatToolCallTemplateDirective;
|
|
959
|
+
/** Present when this group anchors a subagent spawned by its (single) task call. */
|
|
960
|
+
subagent?: Subagent;
|
|
889
961
|
}
|
|
890
962
|
declare class ChatToolCallsComponent {
|
|
891
963
|
readonly agent: _angular_core.InputSignal<Agent<Record<string, unknown>>>;
|
|
@@ -1347,6 +1419,21 @@ interface ParseTreeStore {
|
|
|
1347
1419
|
readonly spec: Signal<Spec | null>;
|
|
1348
1420
|
readonly elementStates: Signal<Map<string, ElementAccumulationState>>;
|
|
1349
1421
|
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Create a {@link ParseTreeStore} — feeds streamed JSON chunks through a
|
|
1424
|
+
* partial-JSON parser and exposes the progressively-materialized spec and
|
|
1425
|
+
* per-element accumulation state as signals, so a generative-UI surface can
|
|
1426
|
+
* render while the spec is still arriving.
|
|
1427
|
+
*
|
|
1428
|
+
* @param parser The partial-JSON parser used to incrementally materialize chunks.
|
|
1429
|
+
* @returns A {@link ParseTreeStore}; call `push(chunk)` as bytes stream in.
|
|
1430
|
+
* @example
|
|
1431
|
+
* ```ts
|
|
1432
|
+
* const store = createParseTreeStore(parser);
|
|
1433
|
+
* store.push('{"type":"Car');
|
|
1434
|
+
* store.spec(); // best-effort Spec | null
|
|
1435
|
+
* ```
|
|
1436
|
+
*/
|
|
1350
1437
|
declare function createParseTreeStore(parser: PartialJsonParser): ParseTreeStore;
|
|
1351
1438
|
|
|
1352
1439
|
/** Chat-internal projection of an A2UI component, materialized by the
|
|
@@ -1401,6 +1488,19 @@ interface A2uiSurfaceStore {
|
|
|
1401
1488
|
readonly surfaceStates: Signal<Map<string, A2uiSurfaceState>>;
|
|
1402
1489
|
surfaceState(surfaceId: string): Signal<A2uiSurfaceState | undefined>;
|
|
1403
1490
|
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Create an {@link A2uiSurfaceStore} — the per-conversation store that buffers
|
|
1493
|
+
* streamed A2UI surface updates, tracks each surface's data model + lifecycle
|
|
1494
|
+
* state, and exposes them as signals for rendering. One store backs a chat
|
|
1495
|
+
* thread's A2UI surfaces.
|
|
1496
|
+
*
|
|
1497
|
+
* @returns A fresh, empty {@link A2uiSurfaceStore}.
|
|
1498
|
+
* @example
|
|
1499
|
+
* ```ts
|
|
1500
|
+
* const store = createA2uiSurfaceStore();
|
|
1501
|
+
* const surfaces = store.surfaces; // Signal<Map<string, A2uiSurface>>
|
|
1502
|
+
* ```
|
|
1503
|
+
*/
|
|
1404
1504
|
declare function createA2uiSurfaceStore(): A2uiSurfaceStore;
|
|
1405
1505
|
|
|
1406
1506
|
type ContentType = 'pending' | 'markdown' | 'json-render' | 'a2ui' | 'mixed';
|
|
@@ -1416,6 +1516,19 @@ interface ContentClassifier {
|
|
|
1416
1516
|
readonly errors: Signal<string[]>;
|
|
1417
1517
|
dispose(): void;
|
|
1418
1518
|
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Create a {@link ContentClassifier} — the streaming accumulator that inspects
|
|
1521
|
+
* an assistant message's content as it arrives and classifies it (markdown vs a
|
|
1522
|
+
* generative-UI/A2UI spec), exposing the parsed result and per-element state as
|
|
1523
|
+
* signals so the renderer can switch modes mid-stream.
|
|
1524
|
+
*
|
|
1525
|
+
* @returns A fresh {@link ContentClassifier}; call `dispose()` when done.
|
|
1526
|
+
* @example
|
|
1527
|
+
* ```ts
|
|
1528
|
+
* const cc = createContentClassifier();
|
|
1529
|
+
* effect(() => console.log(cc.type())); // 'pending' | 'markdown' | 'spec'
|
|
1530
|
+
* ```
|
|
1531
|
+
*/
|
|
1419
1532
|
declare function createContentClassifier(): ContentClassifier;
|
|
1420
1533
|
|
|
1421
1534
|
/**
|
|
@@ -2069,8 +2182,6 @@ declare class MarkdownTableCellComponent {
|
|
|
2069
2182
|
*/
|
|
2070
2183
|
declare const IS_HEADER_ROW: InjectionToken<Signal<boolean>>;
|
|
2071
2184
|
|
|
2072
|
-
declare const CHAT_MARKDOWN_STYLES = "\n chat-streaming-md { display: block; color: var(--ngaf-chat-text); line-height: var(--ngaf-chat-line-height); }\n\n /* Headings */\n chat-streaming-md h1, chat-streaming-md h2, chat-streaming-md h3, chat-streaming-md h4, chat-streaming-md h5, chat-streaming-md h6 {\n font-weight: 600;\n line-height: 1.25;\n margin: 1.25rem 0 0.75rem;\n }\n chat-streaming-md h1:first-child, chat-streaming-md h2:first-child, chat-streaming-md h3:first-child,\n chat-streaming-md h4:first-child, chat-streaming-md h5:first-child, chat-streaming-md h6:first-child { margin-top: 0; }\n chat-streaming-md h1 { font-size: 1.5em; font-weight: 700; }\n chat-streaming-md h2 { font-size: 1.25em; }\n chat-streaming-md h3 { font-size: 1.1em; }\n chat-streaming-md h4 { font-size: 1em; }\n chat-streaming-md h5, chat-streaming-md h6 { font-size: 0.95em; color: var(--ngaf-chat-text-muted); }\n\n /* Paragraphs and inline emphasis */\n chat-streaming-md p { margin: 0 0 0.75rem; line-height: 1.6; font-size: var(--ngaf-chat-font-size); }\n chat-streaming-md p:last-child { margin-bottom: 0; }\n chat-streaming-md strong, chat-streaming-md b { font-weight: 700; }\n chat-streaming-md em, chat-streaming-md i { font-style: italic; }\n chat-streaming-md del, chat-streaming-md s { text-decoration: line-through; color: var(--ngaf-chat-text-muted); }\n chat-streaming-md mark { background: var(--ngaf-chat-surface-alt); padding: 0 2px; border-radius: 2px; }\n chat-streaming-md sub { font-size: 0.75em; vertical-align: sub; }\n chat-streaming-md sup { font-size: 0.75em; vertical-align: super; }\n\n /* Links */\n chat-streaming-md a { color: var(--ngaf-chat-primary); text-decoration: underline; text-underline-offset: 2px; }\n chat-streaming-md a:hover { text-decoration-thickness: 2px; }\n\n /* Lists (CommonMark + GFM task lists) */\n chat-streaming-md ul, chat-streaming-md ol { margin: 0 0 0.75rem; padding-left: 1.5rem; }\n chat-streaming-md ul { list-style: disc outside; }\n chat-streaming-md ol { list-style: decimal outside; }\n chat-streaming-md ul ul { list-style: circle outside; }\n chat-streaming-md ul ul ul { list-style: square outside; }\n chat-streaming-md li { margin: 0.2rem 0; }\n chat-streaming-md li::marker { color: var(--ngaf-chat-text-muted); }\n chat-streaming-md li > p { margin: 0 0 0.25rem; }\n chat-streaming-md li > ul, chat-streaming-md li > ol { margin: 0.25rem 0 0; }\n /* GFM task lists: marked emits <li><input type=\"checkbox\" disabled> ... */\n chat-streaming-md li:has(> input[type=\"checkbox\"]) { list-style: none; margin-left: -1.25rem; }\n chat-streaming-md li > input[type=\"checkbox\"] { margin-right: 0.5rem; vertical-align: middle; }\n\n /* Code (inline + fenced) */\n chat-streaming-md code {\n background: var(--ngaf-chat-surface-alt);\n color: var(--ngaf-chat-text);\n padding: 1px 5px;\n border-radius: 4px;\n font-family: var(--ngaf-chat-font-mono);\n font-size: 0.9em;\n }\n chat-streaming-md pre {\n background: var(--ngaf-chat-surface-alt);\n color: var(--ngaf-chat-text);\n padding: 12px 14px;\n border-radius: var(--ngaf-chat-radius-card);\n overflow-x: auto;\n font-family: var(--ngaf-chat-font-mono);\n font-size: var(--ngaf-chat-font-size-sm);\n line-height: 1.5;\n margin: 0 0 0.75rem;\n }\n chat-streaming-md pre code { background: transparent; padding: 0; border-radius: 0; font-size: inherit; }\n\n /* Blockquote */\n chat-streaming-md blockquote {\n border-left: 3px solid var(--ngaf-chat-separator);\n padding: 0.25rem 0 0.25rem 12px;\n margin: 0 0 0.75rem;\n color: var(--ngaf-chat-text-muted);\n }\n chat-streaming-md blockquote > :last-child { margin-bottom: 0; }\n\n /* Horizontal rule */\n chat-streaming-md hr {\n border: none;\n border-top: 1px solid var(--ngaf-chat-separator);\n margin: 1rem 0;\n }\n\n /* Tables (GFM) */\n chat-streaming-md table {\n border-collapse: collapse;\n margin: 0 0 0.75rem;\n width: 100%;\n font-size: 0.95em;\n }\n chat-streaming-md thead { background: var(--ngaf-chat-surface-alt); }\n chat-streaming-md th, chat-streaming-md td {\n border: 1px solid var(--ngaf-chat-separator);\n padding: 6px 10px;\n text-align: left;\n vertical-align: top;\n }\n chat-streaming-md th { font-weight: 600; }\n /* Component-rendered table: chat-md-table becomes a horizontally-scrollable\n wrapper for the inner <table>; row/cell elements stay layout-transparent\n so the browser's table layout takes over. Without this overflow wrapper,\n wide tables push their parent container past the viewport horizontally. */\n chat-streaming-md chat-md-table {\n display: block;\n overflow-x: auto;\n max-width: 100%;\n margin: 0 0 0.75rem;\n }\n chat-streaming-md chat-md-table-row { display: contents; }\n chat-streaming-md chat-md-table-cell { display: contents; }\n chat-streaming-md chat-md-table > table { margin: 0; }\n /* Task-list items: checkbox + first paragraph render inline; subsequent\n blocks (sub-lists, multi-paragraph items) flow normally below. */\n chat-streaming-md li.chat-md-list-item--task {\n list-style: none;\n margin-left: -1.25rem;\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n gap: 0.5rem;\n }\n chat-streaming-md li.chat-md-list-item--task > input[type=\"checkbox\"] {\n margin: 0;\n flex: 0 0 auto;\n transform: translateY(2px);\n }\n /* The chat-md-children wrapper around list-item content takes remaining width */\n chat-streaming-md li.chat-md-list-item--task > chat-md-children {\n flex: 1 1 auto;\n min-width: 0;\n }\n /* Tight task items: only the FIRST paragraph aligns inline with the\n checkbox (margin collapsed). Subsequent paragraphs/blocks keep their\n normal vertical spacing so multi-block items render readably. */\n chat-streaming-md li.chat-md-list-item--task > chat-md-children > chat-md-paragraph:first-child > p {\n margin: 0;\n }\n\n /* Media */\n chat-streaming-md img { max-width: 100%; height: auto; border-radius: 6px; }\n /* Broken-image fallback: muted pill showing alt text + icon. Triggered\n when <img> fires (error). Caught by live browser smoke \u2014 prior impl\n showed only the browser's broken-image icon with no readable alt. */\n chat-streaming-md .chat-md-image--broken {\n display: inline-flex;\n align-items: center;\n gap: 0.4rem;\n padding: 0.25rem 0.5rem;\n background: var(--ngaf-chat-surface-alt);\n border: 1px dashed var(--ngaf-chat-separator);\n border-radius: 6px;\n font-size: 0.9em;\n color: var(--ngaf-chat-text-muted, currentColor);\n opacity: 0.85;\n }\n chat-streaming-md .chat-md-image__icon { font-size: 1em; line-height: 1; }\n chat-streaming-md .chat-md-image__alt { font-style: italic; }\n";
|
|
2073
|
-
|
|
2074
2185
|
/**
|
|
2075
2186
|
* Renders markdown content to sanitized HTML.
|
|
2076
2187
|
* Falls back to plain text with newline->br conversion if `marked` is not installed.
|
|
@@ -2090,21 +2201,6 @@ declare function renderMarkdown(content: string, sanitizer: DomSanitizer): SafeH
|
|
|
2090
2201
|
*/
|
|
2091
2202
|
declare function formatDuration(ms: number): string;
|
|
2092
2203
|
|
|
2093
|
-
/** Chevron down (▼ replacement). 12x12, stroke-based. */
|
|
2094
|
-
declare const ICON_CHEVRON_DOWN = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 4.5L6 7.5L9 4.5\"/></svg>";
|
|
2095
|
-
/** Chevron up (▲ replacement). 12x12, stroke-based. */
|
|
2096
|
-
declare const ICON_CHEVRON_UP = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 7.5L6 4.5L9 7.5\"/></svg>";
|
|
2097
|
-
/** Gear icon (⚙ replacement). 14x14. */
|
|
2098
|
-
declare const ICON_TOOL = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"3\"/><path d=\"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42\"/></svg>";
|
|
2099
|
-
/** Warning triangle (⚠ replacement). 18x18. */
|
|
2100
|
-
declare const ICON_WARNING = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z\"/><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/></svg>";
|
|
2101
|
-
/** Robot/agent icon (replacement). 14x14. */
|
|
2102
|
-
declare const ICON_AGENT = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"11\" width=\"18\" height=\"10\" rx=\"2\"/><circle cx=\"12\" cy=\"5\" r=\"2\"/><path d=\"M12 7v4\"/><line x1=\"8\" y1=\"16\" x2=\"8\" y2=\"16\"/><line x1=\"16\" y1=\"16\" x2=\"16\" y2=\"16\"/></svg>";
|
|
2103
|
-
/** Check mark replacement. 12x12. */
|
|
2104
|
-
declare const ICON_CHECK = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M2.5 6L5 8.5L9.5 3.5\"/></svg>";
|
|
2105
|
-
/** Send arrow (for chat input). 16x16. */
|
|
2106
|
-
declare const ICON_SEND = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M8 12V4M8 4L4 8M8 4L12 8\"/></svg>";
|
|
2107
|
-
|
|
2108
2204
|
/** Catalog entry for the A2UI surface renderer.
|
|
2109
2205
|
*
|
|
2110
2206
|
* `component` is mounted once all of the component's bindings (data
|
|
@@ -2222,14 +2318,24 @@ declare class A2uiSurfaceComponent {
|
|
|
2222
2318
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<A2uiSurfaceComponent, "a2ui-surface", never, { "surface": { "alias": "surface"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "catalog": { "alias": "catalog"; "required": true; "isSignal": true; }; "handlers": { "alias": "handlers"; "required": false; "isSignal": true; }; "surfaceFallback": { "alias": "surfaceFallback"; "required": false; "isSignal": true; }; }, { "events": "events"; "action": "action"; }, never, never, true, never>;
|
|
2223
2319
|
}
|
|
2224
2320
|
|
|
2225
|
-
declare function surfaceToSpec(surface: A2uiSurface): Spec | null;
|
|
2226
|
-
|
|
2227
2321
|
/** Builds an A2uiActionMessage from handler params and the current surface.
|
|
2228
2322
|
* The action.context is serialized as v1 DynamicValue-wrapped entries.
|
|
2229
2323
|
* Sets action.label when the source component is a Button with a Text
|
|
2230
2324
|
* child whose literalString is non-empty. */
|
|
2231
2325
|
declare function buildA2uiActionMessage(params: Record<string, unknown>, surface: A2uiSurface): A2uiActionMessage;
|
|
2232
2326
|
|
|
2327
|
+
/**
|
|
2328
|
+
* Build the built-in A2UI component catalog — a {@link ViewRegistry} mapping
|
|
2329
|
+
* the standard A2UI element types (Card, Button, TextField, Image, AudioPlayer,
|
|
2330
|
+
* Video, …) to their Angular renderers. Spread it into `provideViews` (with any
|
|
2331
|
+
* of your own views) so an agent's A2UI surface specs render.
|
|
2332
|
+
*
|
|
2333
|
+
* @returns A {@link ViewRegistry} of the standard A2UI components.
|
|
2334
|
+
* @example
|
|
2335
|
+
* ```ts
|
|
2336
|
+
* providers: [provideViews({ ...a2uiBasicCatalog(), MyWidget: MyWidgetComponent })]
|
|
2337
|
+
* ```
|
|
2338
|
+
*/
|
|
2233
2339
|
declare function a2uiBasicCatalog(): ViewRegistry;
|
|
2234
2340
|
|
|
2235
2341
|
/** Writes a typed value to the render state store if the prop has a binding path. */
|
|
@@ -2763,7 +2869,6 @@ interface ClientToolsCoordinator {
|
|
|
2763
2869
|
}
|
|
2764
2870
|
/** Build the catalog spec list shipped to the model. */
|
|
2765
2871
|
declare function toClientToolSpecs(registry: ClientToolRegistry): ClientToolSpec[];
|
|
2766
|
-
declare function createClientToolsCoordinator(registry: ClientToolRegistry): ClientToolsCoordinator;
|
|
2767
2872
|
|
|
2768
2873
|
interface MockAgent extends Agent {
|
|
2769
2874
|
messages: WritableSignal<Message[]>;
|
|
@@ -2814,10 +2919,25 @@ interface MockAgentOptions {
|
|
|
2814
2919
|
history?: AgentCheckpoint[];
|
|
2815
2920
|
events$?: Observable<AgentEvent>;
|
|
2816
2921
|
}
|
|
2922
|
+
/**
|
|
2923
|
+
* Build an in-memory {@link Agent} for tests and stories — no transport, no
|
|
2924
|
+
* network. Every field is a writable signal so a test can drive UI states
|
|
2925
|
+
* (loading, error, interrupts, tool calls, subagents) deterministically.
|
|
2926
|
+
*
|
|
2927
|
+
* @param opts Initial values for the mock's signals; all optional.
|
|
2928
|
+
* @returns A {@link MockAgent} satisfying the full `Agent` contract.
|
|
2929
|
+
* @example
|
|
2930
|
+
* ```ts
|
|
2931
|
+
* const agent = mockAgent({
|
|
2932
|
+
* messages: [{ id: '1', role: 'assistant', content: 'Hi' }],
|
|
2933
|
+
* isLoading: true,
|
|
2934
|
+
* });
|
|
2935
|
+
* ```
|
|
2936
|
+
*/
|
|
2817
2937
|
declare function mockAgent(opts?: MockAgentOptions): MockAgent;
|
|
2818
2938
|
|
|
2819
2939
|
/** Inferred argument type for a schema (alias of StandardSchemaInferOutput). */
|
|
2820
2940
|
type ToolArgs<S extends StandardSchemaV1> = StandardSchemaInferOutput<S>;
|
|
2821
2941
|
|
|
2822
|
-
export { A2uiAudioPlayerComponent, A2uiButtonComponent, A2uiCardComponent, A2uiCheckBoxComponent, A2uiColumnComponent, A2uiDateTimeInputComponent, A2uiDividerComponent, A2uiIconComponent, A2uiImageComponent, A2uiListComponent, A2uiModalComponent, A2uiMultipleChoiceComponent, A2uiRowComponent, A2uiSliderComponent, A2uiSurfaceComponent, A2uiTabsComponent, A2uiTextComponent, A2uiTextFieldComponent, A2uiVideoComponent, AGENT_ERROR_MESSAGES, AgentError, CHAT_CONFIG, CHAT_LIFECYCLE,
|
|
2942
|
+
export { A2uiAudioPlayerComponent, A2uiButtonComponent, A2uiCardComponent, A2uiCheckBoxComponent, A2uiColumnComponent, A2uiDateTimeInputComponent, A2uiDividerComponent, A2uiIconComponent, A2uiImageComponent, A2uiListComponent, A2uiModalComponent, A2uiMultipleChoiceComponent, A2uiRowComponent, A2uiSliderComponent, A2uiSurfaceComponent, A2uiTabsComponent, A2uiTextComponent, A2uiTextFieldComponent, A2uiVideoComponent, AGENT_ERROR_MESSAGES, AgentError, CHAT_CONFIG, CHAT_LIFECYCLE, ChatApprovalCardComponent, ChatCitationCardTemplateDirective, ChatCitationsCardComponent, ChatCitationsComponent, ChatComponent, ChatConfirmDialogComponent, ChatErrorComponent, ChatGenerativeUiComponent, ChatGenuiSkeletonComponent, ChatHistorySearchPaletteComponent, ChatInputComponent, ChatInterruptComponent, ChatInterruptPanelComponent, ChatLauncherButtonComponent, ChatMessageActionsComponent, ChatMessageComponent, ChatMessageListComponent, ChatOverflowMenuComponent, ChatPopupComponent, ChatProjectListComponent, ChatReasoningComponent, ChatScrollBubbleComponent, ChatSelectComponent, ChatSidebarComponent, ChatSidenavComponent, ChatSidenavScrimComponent, ChatStreamingMdComponent, ChatSubagentCardComponent, ChatSubagentsComponent, ChatSuggestionsComponent, ChatThreadListComponent, ChatTimelineComponent, ChatTimelineSliderComponent, ChatToolCallCardComponent, ChatToolCallTemplateDirective, ChatToolCallsComponent, ChatToolViewsComponent, ChatTraceComponent, ChatTypingIndicatorComponent, ChatWelcomeComponent, ChatWelcomeSuggestionComponent, ChatWindowComponent, CitationsResolverService, IS_HEADER_ROW, MARKDOWN_VIEW_REGISTRY, MarkdownAutolinkComponent, MarkdownBlockquoteComponent, MarkdownChildrenComponent, MarkdownCitationReferenceComponent, MarkdownCodeBlockComponent, MarkdownDocumentComponent, MarkdownEmphasisComponent, MarkdownHardBreakComponent, MarkdownHeadingComponent, MarkdownImageComponent, MarkdownInlineCodeComponent, MarkdownLinkComponent, MarkdownListComponent, MarkdownListItemComponent, MarkdownParagraphComponent, MarkdownSoftBreakComponent, MarkdownStrikethroughComponent, MarkdownStrongComponent, MarkdownTableCellComponent, MarkdownTableComponent, MarkdownTableRowComponent, MarkdownTextComponent, MarkdownThematicBreakComponent, MessageTemplateDirective, a2uiBasicCatalog, action, ask, buildA2uiActionMessage, cacheplaneMarkdownViews, createA2uiSurfaceStore, createAgentRef, createContentClassifier, createParseTreeStore, createPartialArgsBridge, deriveJsonSchema, emitBinding, executeFunctionTool, extractErrorMessage, formatDuration, getInterrupt, getMessageType, injectThreadRouting, isAbortError, isAssistantMessage, isSystemMessage, isToolMessage, isTyping, isUserMessage, messageContent, mockAgent, normalizeEnvelopeArgs, normalizeViewEntry, provideChat, renderMarkdown, startClientToolExecutor, statusColor, submitMessage, toAgentError, toClientToolSpecs, tools, validateArgs, view };
|
|
2823
2943
|
export type { A2uiComponentView, A2uiSurfaceState, A2uiSurfaceStore, A2uiViewEntry, A2uiViews, Agent, AgentCheckpoint, AgentCustomEvent, AgentErrorKind, AgentEvent, AgentInterrupt, AgentRef, AgentRuntimeTelemetryEvent, AgentRuntimeTelemetryPayload, AgentRuntimeTelemetryProperties, AgentRuntimeTelemetrySink, AgentStateUpdateEvent, AgentStatus, AgentSubmitInput, AgentSubmitOptions, AgentWithHistory, AnyFunctionToolDef, AskToolDef, ChatApprovalAction, ChatConfig, ChatLifecycle, ChatMessageRole, ChatRenderEvent, ChatScrollBubbleMode, ChatSelectOption, ChatSidenavMode, ChatToolCallTemplateContext, Citation, ClientToolDef, ClientToolRegistry, ClientToolResult, ClientToolSpec, ClientToolsCapability, ClientToolsCoordinator, ContentBlock, ContentClassifier, ContentType, ElementAccumulationState, FunctionToolDef, InterruptAction, Message, MessageTemplateType, MockAgent, MockAgentOptions, OverflowMenuItem, ParseTreeStore, PartialArgsBridge, Project, ProjectActionAdapter, ResolvedCitation, Role, Subagent, SubagentStatus, Thread, ThreadActionAdapter, ThreadMatch, ThreadRoutingConfig, ToolArgs, ToolCall, ToolCallInfo, ToolCallStatus, TraceState, ViewProps, ViewToolDef };
|