@runtypelabs/persona 3.31.1 → 3.34.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/README.md +17 -10
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-quh7NmYD.d.cts → types-CthJFfNx.d.cts} +7 -0
- package/dist/animations/{types-quh7NmYD.d.ts → types-CthJFfNx.d.ts} +7 -0
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.js +1 -1
- package/dist/index.cjs +43 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +320 -8
- package/dist/index.d.ts +320 -8
- package/dist/index.global.js +193 -192
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +43 -43
- package/dist/index.js.map +1 -1
- package/dist/launcher.global.js +117 -117
- package/dist/launcher.global.js.map +1 -1
- package/dist/smart-dom-reader.d.cts +110 -2
- package/dist/smart-dom-reader.d.ts +110 -2
- package/dist/theme-editor.cjs +30 -30
- package/dist/theme-editor.d.cts +124 -5
- package/dist/theme-editor.d.ts +124 -5
- package/dist/theme-editor.js +30 -30
- package/package.json +3 -3
- package/src/ask-user-question-tool.test.ts +148 -0
- package/src/ask-user-question-tool.ts +138 -0
- package/src/client.ts +43 -9
- package/src/codegen.test.ts +0 -14
- package/src/components/messages.ts +10 -0
- package/src/components/suggestions.ts +49 -6
- package/src/index-core.ts +15 -0
- package/src/runtime/host-layout.test.ts +206 -9
- package/src/runtime/host-layout.ts +121 -8
- package/src/runtime/init.test.ts +2 -2
- package/src/session.ts +188 -32
- package/src/session.webmcp.test.ts +48 -0
- package/src/suggest-replies-tool.test.ts +445 -0
- package/src/suggest-replies-tool.ts +152 -0
- package/src/theme-editor/index.ts +2 -0
- package/src/theme-editor/webmcp/index.ts +2 -0
- package/src/theme-editor/webmcp/types.ts +16 -3
- package/src/types.ts +108 -2
- package/src/ui.docked.test.ts +2 -2
- package/src/ui.suggest-replies.test.ts +237 -0
- package/src/ui.ts +57 -13
- package/src/utils/dock.test.ts +23 -1
- package/src/utils/dock.ts +2 -0
- package/src/voice/voice.test.ts +0 -51
- package/src/install-config.test.ts +0 -38
package/dist/index.d.cts
CHANGED
|
@@ -2119,12 +2119,44 @@ type AgentToolsConfig = {
|
|
|
2119
2119
|
mcpServers?: Array<Record<string, unknown>>;
|
|
2120
2120
|
/** Maximum number of tool invocations per execution */
|
|
2121
2121
|
maxToolCalls?: number;
|
|
2122
|
+
/** How the model is steered toward tools: let it decide, force a call, or disable */
|
|
2123
|
+
toolCallStrategy?: "auto" | "required" | "none";
|
|
2124
|
+
/** Per-tool invocation limits / requirements keyed by tool name */
|
|
2125
|
+
perToolLimits?: Record<string, {
|
|
2126
|
+
maxCalls?: number;
|
|
2127
|
+
required?: boolean;
|
|
2128
|
+
}>;
|
|
2122
2129
|
/** Tool approval configuration for human-in-the-loop workflows */
|
|
2123
2130
|
approval?: {
|
|
2124
2131
|
/** Tool names/patterns to require approval for, or true for all tools */
|
|
2125
2132
|
require: string[] | boolean;
|
|
2126
2133
|
/** Approval timeout in milliseconds (default: 300000 / 5 minutes) */
|
|
2127
2134
|
timeout?: number;
|
|
2135
|
+
/** Ask the agent to state its intent alongside approval requests (default: true) */
|
|
2136
|
+
requestReason?: boolean;
|
|
2137
|
+
};
|
|
2138
|
+
/**
|
|
2139
|
+
* Enables the synthesized `spawn_subagent` tool: the model can spin up
|
|
2140
|
+
* ad-hoc child agents at runtime, restricted to `toolPool` (tool IDs /
|
|
2141
|
+
* runtime-tool names already granted to the parent agent).
|
|
2142
|
+
*/
|
|
2143
|
+
subagentConfig?: {
|
|
2144
|
+
toolPool: string[];
|
|
2145
|
+
defaultMaxTurns?: number;
|
|
2146
|
+
maxTurnsLimit?: number;
|
|
2147
|
+
maxSpawnsPerRun?: number;
|
|
2148
|
+
defaultModel?: string;
|
|
2149
|
+
allowNesting?: boolean;
|
|
2150
|
+
defaultTimeoutMs?: number;
|
|
2151
|
+
};
|
|
2152
|
+
/**
|
|
2153
|
+
* Enables the synthesized `code_mode` tool: the model writes JS that calls
|
|
2154
|
+
* pool tools inside a sandbox instead of issuing individual tool calls.
|
|
2155
|
+
*/
|
|
2156
|
+
codeModeConfig?: {
|
|
2157
|
+
toolPool: string[];
|
|
2158
|
+
description?: string;
|
|
2159
|
+
timeoutMs?: number;
|
|
2128
2160
|
};
|
|
2129
2161
|
};
|
|
2130
2162
|
/** Artifact kinds for the Persona sidebar and dispatch payload */
|
|
@@ -2195,8 +2227,13 @@ type ClientToolDefinition = {
|
|
|
2195
2227
|
description: string;
|
|
2196
2228
|
/** JSON Schema (per WebMCP spec) — passed through as-is. */
|
|
2197
2229
|
parametersSchema?: object;
|
|
2198
|
-
/**
|
|
2199
|
-
|
|
2230
|
+
/**
|
|
2231
|
+
* `'webmcp'` for tools discovered via the polyfill (server prepends the
|
|
2232
|
+
* `webmcp:` wire prefix); `'sdk'` for widget/SDK-provided tools (name stays
|
|
2233
|
+
* bare on the wire). Matches the server's accepted enum — any other value
|
|
2234
|
+
* fails dispatch validation.
|
|
2235
|
+
*/
|
|
2236
|
+
origin?: 'webmcp' | 'sdk';
|
|
2200
2237
|
/** Origin of the page that registered the tool — for server-side audit. */
|
|
2201
2238
|
pageOrigin?: string;
|
|
2202
2239
|
/**
|
|
@@ -2358,6 +2395,13 @@ type AgentMessageMetadata = {
|
|
|
2358
2395
|
* paginated stepper. Persists alongside `askUserQuestionAnswers`.
|
|
2359
2396
|
*/
|
|
2360
2397
|
askUserQuestionIndex?: number;
|
|
2398
|
+
/**
|
|
2399
|
+
* Set to `true` once a `suggest_replies` tool call's fire-and-forget
|
|
2400
|
+
* `/resume` has been accepted by the server. Persisted belt-and-suspenders
|
|
2401
|
+
* mirror of the in-memory resolved-key dedupe, so hydration/re-emit paths
|
|
2402
|
+
* never re-resume the call.
|
|
2403
|
+
*/
|
|
2404
|
+
suggestRepliesResolved?: boolean;
|
|
2361
2405
|
};
|
|
2362
2406
|
type AgentWidgetRequestMiddlewareContext = {
|
|
2363
2407
|
payload: AgentWidgetRequestPayload;
|
|
@@ -3003,6 +3047,37 @@ type AgentWidgetFeatureFlags = {
|
|
|
3003
3047
|
* pills + optional free-text input.
|
|
3004
3048
|
*/
|
|
3005
3049
|
askUserQuestion?: AgentWidgetAskUserQuestionFeature;
|
|
3050
|
+
/**
|
|
3051
|
+
* Built-in `suggest_replies` quick-reply chips. When the assistant invokes
|
|
3052
|
+
* the tool, the widget shows the suggestions as tappable chips above the
|
|
3053
|
+
* composer (reusing the suggestion-chips surface) and immediately resumes
|
|
3054
|
+
* the execution — fire-and-forget, no user input awaited.
|
|
3055
|
+
*/
|
|
3056
|
+
suggestReplies?: AgentWidgetSuggestRepliesFeature;
|
|
3057
|
+
};
|
|
3058
|
+
/**
|
|
3059
|
+
* Feature config for the built-in `suggest_replies` quick-reply chips.
|
|
3060
|
+
* Chips render in the existing suggestions slot above the composer and are
|
|
3061
|
+
* styled by the widget-level `suggestionChipsConfig`. A tapped chip is sent
|
|
3062
|
+
* verbatim as the user's next message; chips clear once any user message
|
|
3063
|
+
* follows them.
|
|
3064
|
+
*/
|
|
3065
|
+
type AgentWidgetSuggestRepliesFeature = {
|
|
3066
|
+
/**
|
|
3067
|
+
* Enable the feature. Defaults to true. When false, `suggest_replies`
|
|
3068
|
+
* renders as a regular tool bubble and is NOT auto-resumed — only set this
|
|
3069
|
+
* with no server-side `suggest_replies` declaration, or the execution
|
|
3070
|
+
* parks awaiting a resume that never comes.
|
|
3071
|
+
*/
|
|
3072
|
+
enabled?: boolean;
|
|
3073
|
+
/**
|
|
3074
|
+
* Advertise the built-in `suggest_replies` tool to the agent on every
|
|
3075
|
+
* dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
|
|
3076
|
+
* needed. Defaults to `false`: flows that already declare the tool via
|
|
3077
|
+
* `runtimeTools` would otherwise present it to the model twice. Ignored
|
|
3078
|
+
* when `enabled` is `false`.
|
|
3079
|
+
*/
|
|
3080
|
+
expose?: boolean;
|
|
3006
3081
|
};
|
|
3007
3082
|
/**
|
|
3008
3083
|
* Single selectable option in an `ask_user_question` prompt.
|
|
@@ -3063,6 +3138,19 @@ type AgentWidgetAskUserQuestionStyles = {
|
|
|
3063
3138
|
type AgentWidgetAskUserQuestionFeature = {
|
|
3064
3139
|
/** Enable the feature. Defaults to true. When false, `ask_user_question` renders as a regular tool bubble. */
|
|
3065
3140
|
enabled?: boolean;
|
|
3141
|
+
/**
|
|
3142
|
+
* Advertise the built-in `ask_user_question` tool to the agent on every
|
|
3143
|
+
* dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
|
|
3144
|
+
* needed. The tool ships with a model-facing description and JSON schema
|
|
3145
|
+
* matching {@link AskUserQuestionPayload}; when the model calls it, the
|
|
3146
|
+
* existing answer-pill sheet renders and the answer resumes the execution.
|
|
3147
|
+
*
|
|
3148
|
+
* Defaults to `false`: flows that already declare `ask_user_question` via
|
|
3149
|
+
* `runtimeTools` would otherwise present the tool to the model twice.
|
|
3150
|
+
* Ignored when `enabled` is `false` — never offer the agent a question
|
|
3151
|
+
* tool the widget can't render an answer UI for.
|
|
3152
|
+
*/
|
|
3153
|
+
expose?: boolean;
|
|
3066
3154
|
/** Slide-in animation duration in ms. Defaults to 180. */
|
|
3067
3155
|
slideInMs?: number;
|
|
3068
3156
|
/** Label for the free-text pill. Defaults to "Other…". */
|
|
@@ -3244,6 +3332,26 @@ type AgentWidgetDockConfig = {
|
|
|
3244
3332
|
* it appears to emerge at full width like a floating widget.
|
|
3245
3333
|
*/
|
|
3246
3334
|
reveal?: "resize" | "overlay" | "push" | "emerge";
|
|
3335
|
+
/**
|
|
3336
|
+
* Maximum height of the dock panel, applied as a viewport-overflow guard.
|
|
3337
|
+
*
|
|
3338
|
+
* The docked shell sizes itself with `height: 100%`, which only resolves when
|
|
3339
|
+
* an ancestor (usually `html, body { height: 100% }`) provides a definite
|
|
3340
|
+
* height. Without one, the dock column would otherwise grow with the
|
|
3341
|
+
* conversation and scroll off the page. This cap clamps the panel to the
|
|
3342
|
+
* viewport (and keeps the `resize`/`emerge` reveals pinned with
|
|
3343
|
+
* `position: sticky`; `push`/`overlay` get the cap only, since their
|
|
3344
|
+
* transform/absolute contexts defeat sticky) so a missing height chain
|
|
3345
|
+
* degrades gracefully instead of breaking the chat.
|
|
3346
|
+
*
|
|
3347
|
+
* - Set a CSS length (e.g. `"600px"`, `"80vh"`) to override the cap.
|
|
3348
|
+
* - Set `false` to disable the guard entirely (the panel then sizes purely
|
|
3349
|
+
* from the surrounding layout — make sure your page provides a definite
|
|
3350
|
+
* height all the way down to the dock target's parent).
|
|
3351
|
+
*
|
|
3352
|
+
* @default "100dvh"
|
|
3353
|
+
*/
|
|
3354
|
+
maxHeight?: string | false;
|
|
3247
3355
|
};
|
|
3248
3356
|
/**
|
|
3249
3357
|
* Layout configuration for `mountMode: "composer-bar"`. Controls how the
|
|
@@ -6034,6 +6142,25 @@ declare class AgentWidgetClient {
|
|
|
6034
6142
|
private clientToolsFingerprintSessionId;
|
|
6035
6143
|
private readonly webMcpBridge;
|
|
6036
6144
|
constructor(config?: AgentWidgetConfig);
|
|
6145
|
+
/**
|
|
6146
|
+
* Refresh config in place WITHOUT tearing down the live connection or the
|
|
6147
|
+
* WebMCP bridge. `AgentWidgetSession.updateConfig` calls this when only
|
|
6148
|
+
* connection-irrelevant fields changed (theme, copy, layout, suggestions, …),
|
|
6149
|
+
* so a UI update that lands mid-turn — e.g. a `webmcp:*` tool restyling the
|
|
6150
|
+
* widget while the agent's turn is still streaming — doesn't abandon the
|
|
6151
|
+
* in-flight stream/resume. Connection or request-shaping changes (apiUrl,
|
|
6152
|
+
* clientToken, webmcp, headers, parser, …) take the full client rebuild path
|
|
6153
|
+
* in the session instead, which is the only place the bridge is recreated.
|
|
6154
|
+
*
|
|
6155
|
+
* Only the live-read `config` is refreshed (e.g. `iterationDisplay`); the
|
|
6156
|
+
* constructor-derived request-shaping fields (apiUrl, headers, parser,
|
|
6157
|
+
* contextProviders, middleware, …) are left untouched because the session
|
|
6158
|
+
* routes any change to those down the full-rebuild path instead — so they are
|
|
6159
|
+
* guaranteed unchanged here. The `webMcpBridge` instance and its
|
|
6160
|
+
* installed-polyfill memo are deliberately preserved, which keeps any
|
|
6161
|
+
* in-flight resolve alive.
|
|
6162
|
+
*/
|
|
6163
|
+
updateConfig(next: AgentWidgetConfig): void;
|
|
6037
6164
|
/**
|
|
6038
6165
|
* Set callback for capturing raw SSE events
|
|
6039
6166
|
*/
|
|
@@ -6559,7 +6686,8 @@ declare class AgentWidgetSession {
|
|
|
6559
6686
|
markAskUserQuestionResolved(toolMessage: AgentWidgetMessage, answers?: Record<string, string | string[]>): void;
|
|
6560
6687
|
resolveAskUserQuestion(toolMessage: AgentWidgetMessage, answer: string | Record<string, string | string[]>): Promise<void>;
|
|
6561
6688
|
/**
|
|
6562
|
-
* Collect
|
|
6689
|
+
* Collect an auto-resolving LOCAL-tool `step_await` (`webmcp:*` page tools
|
|
6690
|
+
* and the built-in `suggest_replies`) into a per-executionId batch
|
|
6563
6691
|
* and schedule a single deferred flush. Parallel calls (core#3878) emit
|
|
6564
6692
|
* several `step_await`s for ONE paused execution within the same stream tick;
|
|
6565
6693
|
* buffering them and flushing once lets us post ONE `/resume` keyed by the
|
|
@@ -6596,6 +6724,17 @@ declare class AgentWidgetSession {
|
|
|
6596
6724
|
*/
|
|
6597
6725
|
private flushWebMcpAwaitBatch;
|
|
6598
6726
|
private resolveWebMcpToolStartedAt;
|
|
6727
|
+
/**
|
|
6728
|
+
* Persisted-resolution guard for `suggest_replies`. The in-memory dedupe
|
|
6729
|
+
* sets (`webMcpInflightKeys` / `webMcpResolvedKeys`) are cleared by
|
|
6730
|
+
* hydrateMessages/clearMessages/cancel, but `suggestRepliesResolved`
|
|
6731
|
+
* survives on the stored message — so a stale `step_await` re-emit after a
|
|
6732
|
+
* hydration must not re-POST `/resume` for an already-resolved call (the
|
|
6733
|
+
* historical double-resume failure mode the batching work exists to avoid).
|
|
6734
|
+
* Checks the LIVE message first; the handleEvent snapshot is a fresh wire
|
|
6735
|
+
* skeleton whose metadata never carries the flag.
|
|
6736
|
+
*/
|
|
6737
|
+
private isSuggestRepliesAlreadyResolved;
|
|
6599
6738
|
private markWebMcpToolRunning;
|
|
6600
6739
|
private markWebMcpToolComplete;
|
|
6601
6740
|
/**
|
|
@@ -6614,12 +6753,16 @@ declare class AgentWidgetSession {
|
|
|
6614
6753
|
*/
|
|
6615
6754
|
private resolveWebMcpToolCallBatch;
|
|
6616
6755
|
/**
|
|
6617
|
-
* Resolve a paused
|
|
6618
|
-
*
|
|
6756
|
+
* Resolve a paused auto-resolving LOCAL tool call and post the result to
|
|
6757
|
+
* `/resume`: `webmcp:*` calls execute against the host page's tool
|
|
6758
|
+
* registry; the built-in `suggest_replies` skips execution entirely and
|
|
6759
|
+
* resumes with a canned "shown" result (the chips render from the message
|
|
6760
|
+
* list, not from this resolve).
|
|
6619
6761
|
*
|
|
6620
6762
|
* Triggered automatically from `handleEvent` when a `step_await`-derived
|
|
6621
|
-
* message arrives
|
|
6622
|
-
*
|
|
6763
|
+
* message arrives for such a tool — the user does not click a pill; the
|
|
6764
|
+
* bridge's confirm-bubble gate (WebMCP only) is the only interactive
|
|
6765
|
+
* surface.
|
|
6623
6766
|
*
|
|
6624
6767
|
* Idempotent on the message's `toolCall.id`: re-emits of the same step_await
|
|
6625
6768
|
* (e.g. from message coalescing) won't double-fire `tool.execute`. Failure
|
|
@@ -6893,6 +7036,175 @@ declare const ensureAskUserQuestionSheet: (message: AgentWidgetMessage, config:
|
|
|
6893
7036
|
*/
|
|
6894
7037
|
declare const removeAskUserQuestionSheet: (overlay: HTMLElement | null | undefined, toolCallId?: string) => void;
|
|
6895
7038
|
|
|
7039
|
+
/**
|
|
7040
|
+
* Built-in `ask_user_question` client tool.
|
|
7041
|
+
*
|
|
7042
|
+
* The widget can advertise this tool to the agent on every dispatch via
|
|
7043
|
+
* `clientTools[]` (set `features.askUserQuestion.expose: true`) — the same
|
|
7044
|
+
* wire surface WebMCP page tools ride. The server registers it as a LOCAL
|
|
7045
|
+
* tool under its bare name (`origin: 'sdk'` tools are not `webmcp:`-prefixed),
|
|
7046
|
+
* so when the model calls it the execution pauses with a `step_await`
|
|
7047
|
+
* (`awaitReason: "local_tool_required"`), the widget's answer-pill sheet
|
|
7048
|
+
* renders, and `session.resolveAskUserQuestion()` resumes the execution with
|
|
7049
|
+
* the structured answers.
|
|
7050
|
+
*
|
|
7051
|
+
* This replaces the previous integrator burden of hand-declaring the tool in
|
|
7052
|
+
* a flow's `runtimeTools` and keeping that schema in sync with the renderer.
|
|
7053
|
+
* Flows that already declare `ask_user_question` server-side should leave
|
|
7054
|
+
* `expose` off — the model would otherwise see the tool twice.
|
|
7055
|
+
*/
|
|
7056
|
+
|
|
7057
|
+
/**
|
|
7058
|
+
* JSON Schema for the tool's parameters. Mirrors {@link AskUserQuestionPayload}
|
|
7059
|
+
* — the shape `parseAskUserQuestionPayload` hydrates the answer sheet from —
|
|
7060
|
+
* so the schema the model is held to and the schema the renderer expects can
|
|
7061
|
+
* never drift.
|
|
7062
|
+
*/
|
|
7063
|
+
declare const ASK_USER_QUESTION_PARAMETERS_SCHEMA: {
|
|
7064
|
+
readonly type: "object";
|
|
7065
|
+
readonly properties: {
|
|
7066
|
+
readonly questions: {
|
|
7067
|
+
readonly type: "array";
|
|
7068
|
+
readonly minItems: 1;
|
|
7069
|
+
readonly maxItems: 8;
|
|
7070
|
+
readonly description: "Questions to ask the user. Prefer a single question.";
|
|
7071
|
+
readonly items: {
|
|
7072
|
+
readonly type: "object";
|
|
7073
|
+
readonly properties: {
|
|
7074
|
+
readonly question: {
|
|
7075
|
+
readonly type: "string";
|
|
7076
|
+
readonly description: "The complete question, ending with a question mark.";
|
|
7077
|
+
};
|
|
7078
|
+
readonly header: {
|
|
7079
|
+
readonly type: "string";
|
|
7080
|
+
readonly maxLength: 12;
|
|
7081
|
+
readonly description: "Short topic label, e.g. \"Auth method\".";
|
|
7082
|
+
};
|
|
7083
|
+
readonly options: {
|
|
7084
|
+
readonly type: "array";
|
|
7085
|
+
readonly minItems: 2;
|
|
7086
|
+
readonly maxItems: 4;
|
|
7087
|
+
readonly description: "2-4 distinct choices. Do NOT add an \"Other\" option — free text is automatic.";
|
|
7088
|
+
readonly items: {
|
|
7089
|
+
readonly type: "object";
|
|
7090
|
+
readonly properties: {
|
|
7091
|
+
readonly label: {
|
|
7092
|
+
readonly type: "string";
|
|
7093
|
+
readonly description: "Concise choice text (1-5 words).";
|
|
7094
|
+
};
|
|
7095
|
+
readonly description: {
|
|
7096
|
+
readonly type: "string";
|
|
7097
|
+
readonly description: "What the option means or implies.";
|
|
7098
|
+
};
|
|
7099
|
+
};
|
|
7100
|
+
readonly required: readonly ["label"];
|
|
7101
|
+
readonly additionalProperties: false;
|
|
7102
|
+
};
|
|
7103
|
+
};
|
|
7104
|
+
readonly multiSelect: {
|
|
7105
|
+
readonly type: "boolean";
|
|
7106
|
+
readonly description: "Allow selecting multiple options. Default false.";
|
|
7107
|
+
};
|
|
7108
|
+
readonly allowFreeText: {
|
|
7109
|
+
readonly type: "boolean";
|
|
7110
|
+
readonly description: "Show a free-text input. Default true.";
|
|
7111
|
+
};
|
|
7112
|
+
};
|
|
7113
|
+
readonly required: readonly ["question", "options"];
|
|
7114
|
+
readonly additionalProperties: false;
|
|
7115
|
+
};
|
|
7116
|
+
};
|
|
7117
|
+
};
|
|
7118
|
+
readonly required: readonly ["questions"];
|
|
7119
|
+
readonly additionalProperties: false;
|
|
7120
|
+
};
|
|
7121
|
+
/**
|
|
7122
|
+
* The `ClientToolDefinition` shipped on `dispatch.clientTools[]` when
|
|
7123
|
+
* `features.askUserQuestion.expose` is on. Exported so integrators who prefer
|
|
7124
|
+
* declaring the tool server-side (a flow's `runtimeTools`) can reuse the same
|
|
7125
|
+
* description and schema instead of hand-writing them.
|
|
7126
|
+
*/
|
|
7127
|
+
declare const ASK_USER_QUESTION_CLIENT_TOOL: ClientToolDefinition;
|
|
7128
|
+
/**
|
|
7129
|
+
* Built-in client tools to append to a dispatch's `clientTools[]` for the
|
|
7130
|
+
* given widget config: `ask_user_question` and `suggest_replies`; future
|
|
7131
|
+
* built-in local tools join here.
|
|
7132
|
+
*
|
|
7133
|
+
* Each tool is gated on BOTH of its feature flags: `expose` opts the tool
|
|
7134
|
+
* into the agent's catalog, and `enabled !== false` guarantees the widget can
|
|
7135
|
+
* actually render UI (and, for fire-and-forget tools, auto-resume) for it —
|
|
7136
|
+
* exposing a tool with its feature disabled would park the execution on a
|
|
7137
|
+
* generic tool bubble with no way to advance.
|
|
7138
|
+
*/
|
|
7139
|
+
declare const builtInClientToolsForDispatch: (config: AgentWidgetConfig | undefined) => ClientToolDefinition[];
|
|
7140
|
+
|
|
7141
|
+
/**
|
|
7142
|
+
* Built-in `suggest_replies` client tool.
|
|
7143
|
+
*
|
|
7144
|
+
* The widget can advertise this tool to the agent on every dispatch via
|
|
7145
|
+
* `clientTools[]` (set `features.suggestReplies.expose: true`) — the same
|
|
7146
|
+
* wire surface as `ask_user_question` and WebMCP page tools. When the model
|
|
7147
|
+
* calls it, the execution pauses with a `step_await`
|
|
7148
|
+
* (`awaitReason: "local_tool_required"`); unlike `ask_user_question`, the
|
|
7149
|
+
* widget resolves it FIRE-AND-FORGET — it renders the suggestions as tappable
|
|
7150
|
+
* chips above the composer and immediately resumes the execution with a
|
|
7151
|
+
* canned "shown" result, so the agent's turn completes without waiting on the
|
|
7152
|
+
* user. Tapping a chip sends its text verbatim as the user's next message.
|
|
7153
|
+
*
|
|
7154
|
+
* Chip visibility is DERIVED state, not imperative show/hide: the chips of
|
|
7155
|
+
* the last `suggest_replies` tool message with no user message after it are
|
|
7156
|
+
* shown (see {@link latestAgentSuggestions}). That single rule covers
|
|
7157
|
+
* soft-dismiss on any user message (typed, voice, or chip click), restore on
|
|
7158
|
+
* reload/hydration, and latest-wins when a turn carries multiple calls.
|
|
7159
|
+
*/
|
|
7160
|
+
|
|
7161
|
+
declare const SUGGEST_REPLIES_TOOL_NAME = "suggest_replies";
|
|
7162
|
+
/**
|
|
7163
|
+
* JSON Schema for the tool's parameters. Mirrors what
|
|
7164
|
+
* {@link parseSuggestRepliesPayload} hydrates the chips from, so the schema
|
|
7165
|
+
* the model is held to and the shape the renderer expects can never drift.
|
|
7166
|
+
*/
|
|
7167
|
+
declare const SUGGEST_REPLIES_PARAMETERS_SCHEMA: {
|
|
7168
|
+
readonly type: "object";
|
|
7169
|
+
readonly properties: {
|
|
7170
|
+
readonly suggestions: {
|
|
7171
|
+
readonly type: "array";
|
|
7172
|
+
readonly minItems: 1;
|
|
7173
|
+
readonly maxItems: 4;
|
|
7174
|
+
readonly description: "1-4 short, distinct follow-up replies, phrased in the user's voice.";
|
|
7175
|
+
readonly items: {
|
|
7176
|
+
readonly type: "string";
|
|
7177
|
+
readonly minLength: 1;
|
|
7178
|
+
readonly maxLength: 60;
|
|
7179
|
+
};
|
|
7180
|
+
};
|
|
7181
|
+
};
|
|
7182
|
+
readonly required: readonly ["suggestions"];
|
|
7183
|
+
readonly additionalProperties: false;
|
|
7184
|
+
};
|
|
7185
|
+
/**
|
|
7186
|
+
* The `ClientToolDefinition` shipped on `dispatch.clientTools[]` when
|
|
7187
|
+
* `features.suggestReplies.expose` is on. Exported so integrators who prefer
|
|
7188
|
+
* declaring the tool server-side (a flow's `runtimeTools`) can reuse the same
|
|
7189
|
+
* description and schema instead of hand-writing them.
|
|
7190
|
+
*/
|
|
7191
|
+
declare const SUGGEST_REPLIES_CLIENT_TOOL: ClientToolDefinition;
|
|
7192
|
+
/** A tool-variant message produced by a `suggest_replies` call. */
|
|
7193
|
+
declare const isSuggestRepliesMessage: (message: AgentWidgetMessage) => boolean;
|
|
7194
|
+
/**
|
|
7195
|
+
* Tolerant parse of a `suggest_replies` tool call's args into chip labels:
|
|
7196
|
+
* accepts a JSON string or object, coerces items to trimmed strings, drops
|
|
7197
|
+
* empties, and truncates past the renderer cap with a console warning.
|
|
7198
|
+
*/
|
|
7199
|
+
declare const parseSuggestRepliesPayload: (args: unknown) => string[];
|
|
7200
|
+
/**
|
|
7201
|
+
* The chips to show right now: those of the LAST `suggest_replies` tool
|
|
7202
|
+
* message with NO user message after it, or `null` when none apply. All
|
|
7203
|
+
* calls in a turn still get resumed (the server awaits each); only the
|
|
7204
|
+
* latest renders.
|
|
7205
|
+
*/
|
|
7206
|
+
declare const latestAgentSuggestions: (messages: AgentWidgetMessage[]) => string[] | null;
|
|
7207
|
+
|
|
6896
7208
|
type WidgetHostLayoutMode = "direct" | "docked";
|
|
6897
7209
|
type WidgetHostLayout = {
|
|
6898
7210
|
mode: WidgetHostLayoutMode;
|
|
@@ -8671,4 +8983,4 @@ interface DemoCarouselHandle {
|
|
|
8671
8983
|
}
|
|
8672
8984
|
declare function createDemoCarousel(container: HTMLElement, options: DemoCarouselOptions): DemoCarouselHandle;
|
|
8673
8985
|
|
|
8674
|
-
export { ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetActionContext, type AgentWidgetActionEventPayload, type AgentWidgetActionHandler, type AgentWidgetActionHandlerResult, type AgentWidgetActionParser, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetApprovalDecisionOptions, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetParsedAction, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type AgentWidgetWebMcpConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type ClientToolDefinition, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateComboButtonOptions, type CreateDropdownOptions, type CreateIconButtonOptions, type CreateLabelButtonOptions, type CreateStandardBubbleOptions, type CreateThemeOptions, type CreateToggleGroupOptions, DEFAULT_COMPONENTS, DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH, DEFAULT_FLOATING_LAUNCHER_WIDTH, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DeepPartial, type DemoCarouselHandle, type DemoCarouselItem, type DemoCarouselOptions, type DomContextMode, type DomContextOptions, type DropdownMenuHandle, type DropdownMenuItem, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IconButtonTokens, type IconName, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectComponentDirectiveOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LabelButtonTokens, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type RuntypeAgentSSEEvent, type RuntypeAgentTurnCompleteEvent, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeDispatchSSEEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, type SSEEventCallback, type SSEEventRecord, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createAskUserQuestionBubble, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComboButton, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDemoCarousel, createDirectivePostprocessor, createDropdownMenu, createFlexibleJsonStreamParser, createIconButton, createImagePart, createJsonStreamParser, createLabelButton, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, ensureAskUserQuestionSheet, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isAskUserQuestionMessage, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, isWebMcpToolName, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, parseAskUserQuestionPayload, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
|
|
8986
|
+
export { ASK_USER_QUESTION_CLIENT_TOOL, ASK_USER_QUESTION_PARAMETERS_SCHEMA, ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetActionContext, type AgentWidgetActionEventPayload, type AgentWidgetActionHandler, type AgentWidgetActionHandlerResult, type AgentWidgetActionParser, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetApprovalDecisionOptions, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetParsedAction, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type AgentWidgetWebMcpConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type ClientToolDefinition, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateComboButtonOptions, type CreateDropdownOptions, type CreateIconButtonOptions, type CreateLabelButtonOptions, type CreateStandardBubbleOptions, type CreateThemeOptions, type CreateToggleGroupOptions, DEFAULT_COMPONENTS, DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH, DEFAULT_FLOATING_LAUNCHER_WIDTH, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DeepPartial, type DemoCarouselHandle, type DemoCarouselItem, type DemoCarouselOptions, type DomContextMode, type DomContextOptions, type DropdownMenuHandle, type DropdownMenuItem, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IconButtonTokens, type IconName, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectComponentDirectiveOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LabelButtonTokens, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type RuntypeAgentSSEEvent, type RuntypeAgentTurnCompleteEvent, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeDispatchSSEEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, type SSEEventCallback, type SSEEventRecord, SUGGEST_REPLIES_CLIENT_TOOL, SUGGEST_REPLIES_PARAMETERS_SCHEMA, SUGGEST_REPLIES_TOOL_NAME, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, builtInClientToolsForDispatch, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createAskUserQuestionBubble, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComboButton, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDemoCarousel, createDirectivePostprocessor, createDropdownMenu, createFlexibleJsonStreamParser, createIconButton, createImagePart, createJsonStreamParser, createLabelButton, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, ensureAskUserQuestionSheet, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isAskUserQuestionMessage, isComponentDirectiveType, isDockedMountMode, isSuggestRepliesMessage, isVoiceSupported, isWebMcpToolName, latestAgentSuggestions, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, parseAskUserQuestionPayload, parseSuggestRepliesPayload, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
|