@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
|
@@ -1681,12 +1681,44 @@ type AgentToolsConfig = {
|
|
|
1681
1681
|
mcpServers?: Array<Record<string, unknown>>;
|
|
1682
1682
|
/** Maximum number of tool invocations per execution */
|
|
1683
1683
|
maxToolCalls?: number;
|
|
1684
|
+
/** How the model is steered toward tools: let it decide, force a call, or disable */
|
|
1685
|
+
toolCallStrategy?: "auto" | "required" | "none";
|
|
1686
|
+
/** Per-tool invocation limits / requirements keyed by tool name */
|
|
1687
|
+
perToolLimits?: Record<string, {
|
|
1688
|
+
maxCalls?: number;
|
|
1689
|
+
required?: boolean;
|
|
1690
|
+
}>;
|
|
1684
1691
|
/** Tool approval configuration for human-in-the-loop workflows */
|
|
1685
1692
|
approval?: {
|
|
1686
1693
|
/** Tool names/patterns to require approval for, or true for all tools */
|
|
1687
1694
|
require: string[] | boolean;
|
|
1688
1695
|
/** Approval timeout in milliseconds (default: 300000 / 5 minutes) */
|
|
1689
1696
|
timeout?: number;
|
|
1697
|
+
/** Ask the agent to state its intent alongside approval requests (default: true) */
|
|
1698
|
+
requestReason?: boolean;
|
|
1699
|
+
};
|
|
1700
|
+
/**
|
|
1701
|
+
* Enables the synthesized `spawn_subagent` tool: the model can spin up
|
|
1702
|
+
* ad-hoc child agents at runtime, restricted to `toolPool` (tool IDs /
|
|
1703
|
+
* runtime-tool names already granted to the parent agent).
|
|
1704
|
+
*/
|
|
1705
|
+
subagentConfig?: {
|
|
1706
|
+
toolPool: string[];
|
|
1707
|
+
defaultMaxTurns?: number;
|
|
1708
|
+
maxTurnsLimit?: number;
|
|
1709
|
+
maxSpawnsPerRun?: number;
|
|
1710
|
+
defaultModel?: string;
|
|
1711
|
+
allowNesting?: boolean;
|
|
1712
|
+
defaultTimeoutMs?: number;
|
|
1713
|
+
};
|
|
1714
|
+
/**
|
|
1715
|
+
* Enables the synthesized `code_mode` tool: the model writes JS that calls
|
|
1716
|
+
* pool tools inside a sandbox instead of issuing individual tool calls.
|
|
1717
|
+
*/
|
|
1718
|
+
codeModeConfig?: {
|
|
1719
|
+
toolPool: string[];
|
|
1720
|
+
description?: string;
|
|
1721
|
+
timeoutMs?: number;
|
|
1690
1722
|
};
|
|
1691
1723
|
};
|
|
1692
1724
|
/** Artifact kinds for the Persona sidebar and dispatch payload */
|
|
@@ -1742,8 +1774,13 @@ type ClientToolDefinition = {
|
|
|
1742
1774
|
description: string;
|
|
1743
1775
|
/** JSON Schema (per WebMCP spec) — passed through as-is. */
|
|
1744
1776
|
parametersSchema?: object;
|
|
1745
|
-
/**
|
|
1746
|
-
|
|
1777
|
+
/**
|
|
1778
|
+
* `'webmcp'` for tools discovered via the polyfill (server prepends the
|
|
1779
|
+
* `webmcp:` wire prefix); `'sdk'` for widget/SDK-provided tools (name stays
|
|
1780
|
+
* bare on the wire). Matches the server's accepted enum — any other value
|
|
1781
|
+
* fails dispatch validation.
|
|
1782
|
+
*/
|
|
1783
|
+
origin?: 'webmcp' | 'sdk';
|
|
1747
1784
|
/** Origin of the page that registered the tool — for server-side audit. */
|
|
1748
1785
|
pageOrigin?: string;
|
|
1749
1786
|
/**
|
|
@@ -1872,6 +1909,13 @@ type AgentMessageMetadata = {
|
|
|
1872
1909
|
* paginated stepper. Persists alongside `askUserQuestionAnswers`.
|
|
1873
1910
|
*/
|
|
1874
1911
|
askUserQuestionIndex?: number;
|
|
1912
|
+
/**
|
|
1913
|
+
* Set to `true` once a `suggest_replies` tool call's fire-and-forget
|
|
1914
|
+
* `/resume` has been accepted by the server. Persisted belt-and-suspenders
|
|
1915
|
+
* mirror of the in-memory resolved-key dedupe, so hydration/re-emit paths
|
|
1916
|
+
* never re-resume the call.
|
|
1917
|
+
*/
|
|
1918
|
+
suggestRepliesResolved?: boolean;
|
|
1875
1919
|
};
|
|
1876
1920
|
type AgentWidgetRequestMiddlewareContext = {
|
|
1877
1921
|
payload: AgentWidgetRequestPayload;
|
|
@@ -2470,6 +2514,37 @@ type AgentWidgetFeatureFlags = {
|
|
|
2470
2514
|
* pills + optional free-text input.
|
|
2471
2515
|
*/
|
|
2472
2516
|
askUserQuestion?: AgentWidgetAskUserQuestionFeature;
|
|
2517
|
+
/**
|
|
2518
|
+
* Built-in `suggest_replies` quick-reply chips. When the assistant invokes
|
|
2519
|
+
* the tool, the widget shows the suggestions as tappable chips above the
|
|
2520
|
+
* composer (reusing the suggestion-chips surface) and immediately resumes
|
|
2521
|
+
* the execution — fire-and-forget, no user input awaited.
|
|
2522
|
+
*/
|
|
2523
|
+
suggestReplies?: AgentWidgetSuggestRepliesFeature;
|
|
2524
|
+
};
|
|
2525
|
+
/**
|
|
2526
|
+
* Feature config for the built-in `suggest_replies` quick-reply chips.
|
|
2527
|
+
* Chips render in the existing suggestions slot above the composer and are
|
|
2528
|
+
* styled by the widget-level `suggestionChipsConfig`. A tapped chip is sent
|
|
2529
|
+
* verbatim as the user's next message; chips clear once any user message
|
|
2530
|
+
* follows them.
|
|
2531
|
+
*/
|
|
2532
|
+
type AgentWidgetSuggestRepliesFeature = {
|
|
2533
|
+
/**
|
|
2534
|
+
* Enable the feature. Defaults to true. When false, `suggest_replies`
|
|
2535
|
+
* renders as a regular tool bubble and is NOT auto-resumed — only set this
|
|
2536
|
+
* with no server-side `suggest_replies` declaration, or the execution
|
|
2537
|
+
* parks awaiting a resume that never comes.
|
|
2538
|
+
*/
|
|
2539
|
+
enabled?: boolean;
|
|
2540
|
+
/**
|
|
2541
|
+
* Advertise the built-in `suggest_replies` tool to the agent on every
|
|
2542
|
+
* dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
|
|
2543
|
+
* needed. Defaults to `false`: flows that already declare the tool via
|
|
2544
|
+
* `runtimeTools` would otherwise present it to the model twice. Ignored
|
|
2545
|
+
* when `enabled` is `false`.
|
|
2546
|
+
*/
|
|
2547
|
+
expose?: boolean;
|
|
2473
2548
|
};
|
|
2474
2549
|
/**
|
|
2475
2550
|
* Single selectable option in an `ask_user_question` prompt.
|
|
@@ -2530,6 +2605,19 @@ type AgentWidgetAskUserQuestionStyles = {
|
|
|
2530
2605
|
type AgentWidgetAskUserQuestionFeature = {
|
|
2531
2606
|
/** Enable the feature. Defaults to true. When false, `ask_user_question` renders as a regular tool bubble. */
|
|
2532
2607
|
enabled?: boolean;
|
|
2608
|
+
/**
|
|
2609
|
+
* Advertise the built-in `ask_user_question` tool to the agent on every
|
|
2610
|
+
* dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
|
|
2611
|
+
* needed. The tool ships with a model-facing description and JSON schema
|
|
2612
|
+
* matching {@link AskUserQuestionPayload}; when the model calls it, the
|
|
2613
|
+
* existing answer-pill sheet renders and the answer resumes the execution.
|
|
2614
|
+
*
|
|
2615
|
+
* Defaults to `false`: flows that already declare `ask_user_question` via
|
|
2616
|
+
* `runtimeTools` would otherwise present the tool to the model twice.
|
|
2617
|
+
* Ignored when `enabled` is `false` — never offer the agent a question
|
|
2618
|
+
* tool the widget can't render an answer UI for.
|
|
2619
|
+
*/
|
|
2620
|
+
expose?: boolean;
|
|
2533
2621
|
/** Slide-in animation duration in ms. Defaults to 180. */
|
|
2534
2622
|
slideInMs?: number;
|
|
2535
2623
|
/** Label for the free-text pill. Defaults to "Other…". */
|
|
@@ -2711,6 +2799,26 @@ type AgentWidgetDockConfig = {
|
|
|
2711
2799
|
* it appears to emerge at full width like a floating widget.
|
|
2712
2800
|
*/
|
|
2713
2801
|
reveal?: "resize" | "overlay" | "push" | "emerge";
|
|
2802
|
+
/**
|
|
2803
|
+
* Maximum height of the dock panel, applied as a viewport-overflow guard.
|
|
2804
|
+
*
|
|
2805
|
+
* The docked shell sizes itself with `height: 100%`, which only resolves when
|
|
2806
|
+
* an ancestor (usually `html, body { height: 100% }`) provides a definite
|
|
2807
|
+
* height. Without one, the dock column would otherwise grow with the
|
|
2808
|
+
* conversation and scroll off the page. This cap clamps the panel to the
|
|
2809
|
+
* viewport (and keeps the `resize`/`emerge` reveals pinned with
|
|
2810
|
+
* `position: sticky`; `push`/`overlay` get the cap only, since their
|
|
2811
|
+
* transform/absolute contexts defeat sticky) so a missing height chain
|
|
2812
|
+
* degrades gracefully instead of breaking the chat.
|
|
2813
|
+
*
|
|
2814
|
+
* - Set a CSS length (e.g. `"600px"`, `"80vh"`) to override the cap.
|
|
2815
|
+
* - Set `false` to disable the guard entirely (the panel then sizes purely
|
|
2816
|
+
* from the surrounding layout — make sure your page provides a definite
|
|
2817
|
+
* height all the way down to the dock target's parent).
|
|
2818
|
+
*
|
|
2819
|
+
* @default "100dvh"
|
|
2820
|
+
*/
|
|
2821
|
+
maxHeight?: string | false;
|
|
2714
2822
|
};
|
|
2715
2823
|
/**
|
|
2716
2824
|
* Layout configuration for `mountMode: "composer-bar"`. Controls how the
|
|
@@ -1681,12 +1681,44 @@ type AgentToolsConfig = {
|
|
|
1681
1681
|
mcpServers?: Array<Record<string, unknown>>;
|
|
1682
1682
|
/** Maximum number of tool invocations per execution */
|
|
1683
1683
|
maxToolCalls?: number;
|
|
1684
|
+
/** How the model is steered toward tools: let it decide, force a call, or disable */
|
|
1685
|
+
toolCallStrategy?: "auto" | "required" | "none";
|
|
1686
|
+
/** Per-tool invocation limits / requirements keyed by tool name */
|
|
1687
|
+
perToolLimits?: Record<string, {
|
|
1688
|
+
maxCalls?: number;
|
|
1689
|
+
required?: boolean;
|
|
1690
|
+
}>;
|
|
1684
1691
|
/** Tool approval configuration for human-in-the-loop workflows */
|
|
1685
1692
|
approval?: {
|
|
1686
1693
|
/** Tool names/patterns to require approval for, or true for all tools */
|
|
1687
1694
|
require: string[] | boolean;
|
|
1688
1695
|
/** Approval timeout in milliseconds (default: 300000 / 5 minutes) */
|
|
1689
1696
|
timeout?: number;
|
|
1697
|
+
/** Ask the agent to state its intent alongside approval requests (default: true) */
|
|
1698
|
+
requestReason?: boolean;
|
|
1699
|
+
};
|
|
1700
|
+
/**
|
|
1701
|
+
* Enables the synthesized `spawn_subagent` tool: the model can spin up
|
|
1702
|
+
* ad-hoc child agents at runtime, restricted to `toolPool` (tool IDs /
|
|
1703
|
+
* runtime-tool names already granted to the parent agent).
|
|
1704
|
+
*/
|
|
1705
|
+
subagentConfig?: {
|
|
1706
|
+
toolPool: string[];
|
|
1707
|
+
defaultMaxTurns?: number;
|
|
1708
|
+
maxTurnsLimit?: number;
|
|
1709
|
+
maxSpawnsPerRun?: number;
|
|
1710
|
+
defaultModel?: string;
|
|
1711
|
+
allowNesting?: boolean;
|
|
1712
|
+
defaultTimeoutMs?: number;
|
|
1713
|
+
};
|
|
1714
|
+
/**
|
|
1715
|
+
* Enables the synthesized `code_mode` tool: the model writes JS that calls
|
|
1716
|
+
* pool tools inside a sandbox instead of issuing individual tool calls.
|
|
1717
|
+
*/
|
|
1718
|
+
codeModeConfig?: {
|
|
1719
|
+
toolPool: string[];
|
|
1720
|
+
description?: string;
|
|
1721
|
+
timeoutMs?: number;
|
|
1690
1722
|
};
|
|
1691
1723
|
};
|
|
1692
1724
|
/** Artifact kinds for the Persona sidebar and dispatch payload */
|
|
@@ -1742,8 +1774,13 @@ type ClientToolDefinition = {
|
|
|
1742
1774
|
description: string;
|
|
1743
1775
|
/** JSON Schema (per WebMCP spec) — passed through as-is. */
|
|
1744
1776
|
parametersSchema?: object;
|
|
1745
|
-
/**
|
|
1746
|
-
|
|
1777
|
+
/**
|
|
1778
|
+
* `'webmcp'` for tools discovered via the polyfill (server prepends the
|
|
1779
|
+
* `webmcp:` wire prefix); `'sdk'` for widget/SDK-provided tools (name stays
|
|
1780
|
+
* bare on the wire). Matches the server's accepted enum — any other value
|
|
1781
|
+
* fails dispatch validation.
|
|
1782
|
+
*/
|
|
1783
|
+
origin?: 'webmcp' | 'sdk';
|
|
1747
1784
|
/** Origin of the page that registered the tool — for server-side audit. */
|
|
1748
1785
|
pageOrigin?: string;
|
|
1749
1786
|
/**
|
|
@@ -1872,6 +1909,13 @@ type AgentMessageMetadata = {
|
|
|
1872
1909
|
* paginated stepper. Persists alongside `askUserQuestionAnswers`.
|
|
1873
1910
|
*/
|
|
1874
1911
|
askUserQuestionIndex?: number;
|
|
1912
|
+
/**
|
|
1913
|
+
* Set to `true` once a `suggest_replies` tool call's fire-and-forget
|
|
1914
|
+
* `/resume` has been accepted by the server. Persisted belt-and-suspenders
|
|
1915
|
+
* mirror of the in-memory resolved-key dedupe, so hydration/re-emit paths
|
|
1916
|
+
* never re-resume the call.
|
|
1917
|
+
*/
|
|
1918
|
+
suggestRepliesResolved?: boolean;
|
|
1875
1919
|
};
|
|
1876
1920
|
type AgentWidgetRequestMiddlewareContext = {
|
|
1877
1921
|
payload: AgentWidgetRequestPayload;
|
|
@@ -2470,6 +2514,37 @@ type AgentWidgetFeatureFlags = {
|
|
|
2470
2514
|
* pills + optional free-text input.
|
|
2471
2515
|
*/
|
|
2472
2516
|
askUserQuestion?: AgentWidgetAskUserQuestionFeature;
|
|
2517
|
+
/**
|
|
2518
|
+
* Built-in `suggest_replies` quick-reply chips. When the assistant invokes
|
|
2519
|
+
* the tool, the widget shows the suggestions as tappable chips above the
|
|
2520
|
+
* composer (reusing the suggestion-chips surface) and immediately resumes
|
|
2521
|
+
* the execution — fire-and-forget, no user input awaited.
|
|
2522
|
+
*/
|
|
2523
|
+
suggestReplies?: AgentWidgetSuggestRepliesFeature;
|
|
2524
|
+
};
|
|
2525
|
+
/**
|
|
2526
|
+
* Feature config for the built-in `suggest_replies` quick-reply chips.
|
|
2527
|
+
* Chips render in the existing suggestions slot above the composer and are
|
|
2528
|
+
* styled by the widget-level `suggestionChipsConfig`. A tapped chip is sent
|
|
2529
|
+
* verbatim as the user's next message; chips clear once any user message
|
|
2530
|
+
* follows them.
|
|
2531
|
+
*/
|
|
2532
|
+
type AgentWidgetSuggestRepliesFeature = {
|
|
2533
|
+
/**
|
|
2534
|
+
* Enable the feature. Defaults to true. When false, `suggest_replies`
|
|
2535
|
+
* renders as a regular tool bubble and is NOT auto-resumed — only set this
|
|
2536
|
+
* with no server-side `suggest_replies` declaration, or the execution
|
|
2537
|
+
* parks awaiting a resume that never comes.
|
|
2538
|
+
*/
|
|
2539
|
+
enabled?: boolean;
|
|
2540
|
+
/**
|
|
2541
|
+
* Advertise the built-in `suggest_replies` tool to the agent on every
|
|
2542
|
+
* dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
|
|
2543
|
+
* needed. Defaults to `false`: flows that already declare the tool via
|
|
2544
|
+
* `runtimeTools` would otherwise present it to the model twice. Ignored
|
|
2545
|
+
* when `enabled` is `false`.
|
|
2546
|
+
*/
|
|
2547
|
+
expose?: boolean;
|
|
2473
2548
|
};
|
|
2474
2549
|
/**
|
|
2475
2550
|
* Single selectable option in an `ask_user_question` prompt.
|
|
@@ -2530,6 +2605,19 @@ type AgentWidgetAskUserQuestionStyles = {
|
|
|
2530
2605
|
type AgentWidgetAskUserQuestionFeature = {
|
|
2531
2606
|
/** Enable the feature. Defaults to true. When false, `ask_user_question` renders as a regular tool bubble. */
|
|
2532
2607
|
enabled?: boolean;
|
|
2608
|
+
/**
|
|
2609
|
+
* Advertise the built-in `ask_user_question` tool to the agent on every
|
|
2610
|
+
* dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
|
|
2611
|
+
* needed. The tool ships with a model-facing description and JSON schema
|
|
2612
|
+
* matching {@link AskUserQuestionPayload}; when the model calls it, the
|
|
2613
|
+
* existing answer-pill sheet renders and the answer resumes the execution.
|
|
2614
|
+
*
|
|
2615
|
+
* Defaults to `false`: flows that already declare `ask_user_question` via
|
|
2616
|
+
* `runtimeTools` would otherwise present the tool to the model twice.
|
|
2617
|
+
* Ignored when `enabled` is `false` — never offer the agent a question
|
|
2618
|
+
* tool the widget can't render an answer UI for.
|
|
2619
|
+
*/
|
|
2620
|
+
expose?: boolean;
|
|
2533
2621
|
/** Slide-in animation duration in ms. Defaults to 180. */
|
|
2534
2622
|
slideInMs?: number;
|
|
2535
2623
|
/** Label for the free-text pill. Defaults to "Other…". */
|
|
@@ -2711,6 +2799,26 @@ type AgentWidgetDockConfig = {
|
|
|
2711
2799
|
* it appears to emerge at full width like a floating widget.
|
|
2712
2800
|
*/
|
|
2713
2801
|
reveal?: "resize" | "overlay" | "push" | "emerge";
|
|
2802
|
+
/**
|
|
2803
|
+
* Maximum height of the dock panel, applied as a viewport-overflow guard.
|
|
2804
|
+
*
|
|
2805
|
+
* The docked shell sizes itself with `height: 100%`, which only resolves when
|
|
2806
|
+
* an ancestor (usually `html, body { height: 100% }`) provides a definite
|
|
2807
|
+
* height. Without one, the dock column would otherwise grow with the
|
|
2808
|
+
* conversation and scroll off the page. This cap clamps the panel to the
|
|
2809
|
+
* viewport (and keeps the `resize`/`emerge` reveals pinned with
|
|
2810
|
+
* `position: sticky`; `push`/`overlay` get the cap only, since their
|
|
2811
|
+
* transform/absolute contexts defeat sticky) so a missing height chain
|
|
2812
|
+
* degrades gracefully instead of breaking the chat.
|
|
2813
|
+
*
|
|
2814
|
+
* - Set a CSS length (e.g. `"600px"`, `"80vh"`) to override the cap.
|
|
2815
|
+
* - Set `false` to disable the guard entirely (the panel then sizes purely
|
|
2816
|
+
* from the surrounding layout — make sure your page provides a definite
|
|
2817
|
+
* height all the way down to the dock target's parent).
|
|
2818
|
+
*
|
|
2819
|
+
* @default "100dvh"
|
|
2820
|
+
*/
|
|
2821
|
+
maxHeight?: string | false;
|
|
2714
2822
|
};
|
|
2715
2823
|
/**
|
|
2716
2824
|
* Layout configuration for `mountMode: "composer-bar"`. Controls how the
|