@runtypelabs/persona 3.31.0 → 3.33.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.
Files changed (51) hide show
  1. package/README.md +2 -0
  2. package/dist/animations/glyph-cycle.d.cts +1 -1
  3. package/dist/animations/glyph-cycle.d.ts +1 -1
  4. package/dist/animations/{types-quh7NmYD.d.cts → types-CthJFfNx.d.cts} +7 -0
  5. package/dist/animations/{types-quh7NmYD.d.ts → types-CthJFfNx.d.ts} +7 -0
  6. package/dist/animations/wipe.d.cts +1 -1
  7. package/dist/animations/wipe.d.ts +1 -1
  8. package/dist/codegen.cjs +4 -4
  9. package/dist/codegen.js +3 -3
  10. package/dist/index.cjs +43 -43
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +288 -8
  13. package/dist/index.d.ts +288 -8
  14. package/dist/index.global.js +76 -79
  15. package/dist/index.global.js.map +1 -1
  16. package/dist/index.js +43 -43
  17. package/dist/index.js.map +1 -1
  18. package/dist/launcher.global.js.map +1 -1
  19. package/dist/smart-dom-reader.d.cts +78 -2
  20. package/dist/smart-dom-reader.d.ts +78 -2
  21. package/dist/theme-editor.cjs +30 -30
  22. package/dist/theme-editor.d.cts +92 -5
  23. package/dist/theme-editor.d.ts +92 -5
  24. package/dist/theme-editor.js +30 -30
  25. package/dist/webmcp-polyfill.js +4 -0
  26. package/package.json +4 -3
  27. package/src/ask-user-question-tool.test.ts +148 -0
  28. package/src/ask-user-question-tool.ts +138 -0
  29. package/src/client.ts +43 -9
  30. package/src/components/messages.ts +10 -0
  31. package/src/components/suggestions.ts +49 -6
  32. package/src/index-core.ts +15 -0
  33. package/src/index-global.ts +39 -0
  34. package/src/runtime/host-layout.test.ts +158 -3
  35. package/src/runtime/host-layout.ts +95 -1
  36. package/src/session.ts +188 -32
  37. package/src/session.webmcp.test.ts +48 -0
  38. package/src/suggest-replies-tool.test.ts +445 -0
  39. package/src/suggest-replies-tool.ts +152 -0
  40. package/src/theme-editor/index.ts +2 -0
  41. package/src/theme-editor/webmcp/index.ts +2 -0
  42. package/src/theme-editor/webmcp/types.ts +16 -3
  43. package/src/types.ts +79 -2
  44. package/src/ui.suggest-replies.test.ts +237 -0
  45. package/src/ui.ts +57 -13
  46. package/src/utils/dock.test.ts +23 -1
  47. package/src/utils/dock.ts +2 -0
  48. package/src/version.ts +5 -2
  49. package/src/webmcp-bridge.test.ts +60 -0
  50. package/src/webmcp-bridge.ts +34 -1
  51. package/src/webmcp-polyfill.ts +16 -0
@@ -1742,8 +1742,13 @@ type ClientToolDefinition = {
1742
1742
  description: string;
1743
1743
  /** JSON Schema (per WebMCP spec) — passed through as-is. */
1744
1744
  parametersSchema?: object;
1745
- /** Set to `'webmcp'` for tools discovered via the polyfill. */
1746
- origin?: 'webmcp' | 'local';
1745
+ /**
1746
+ * `'webmcp'` for tools discovered via the polyfill (server prepends the
1747
+ * `webmcp:` wire prefix); `'sdk'` for widget/SDK-provided tools (name stays
1748
+ * bare on the wire). Matches the server's accepted enum — any other value
1749
+ * fails dispatch validation.
1750
+ */
1751
+ origin?: 'webmcp' | 'sdk';
1747
1752
  /** Origin of the page that registered the tool — for server-side audit. */
1748
1753
  pageOrigin?: string;
1749
1754
  /**
@@ -1872,6 +1877,13 @@ type AgentMessageMetadata = {
1872
1877
  * paginated stepper. Persists alongside `askUserQuestionAnswers`.
1873
1878
  */
1874
1879
  askUserQuestionIndex?: number;
1880
+ /**
1881
+ * Set to `true` once a `suggest_replies` tool call's fire-and-forget
1882
+ * `/resume` has been accepted by the server. Persisted belt-and-suspenders
1883
+ * mirror of the in-memory resolved-key dedupe, so hydration/re-emit paths
1884
+ * never re-resume the call.
1885
+ */
1886
+ suggestRepliesResolved?: boolean;
1875
1887
  };
1876
1888
  type AgentWidgetRequestMiddlewareContext = {
1877
1889
  payload: AgentWidgetRequestPayload;
@@ -2470,6 +2482,37 @@ type AgentWidgetFeatureFlags = {
2470
2482
  * pills + optional free-text input.
2471
2483
  */
2472
2484
  askUserQuestion?: AgentWidgetAskUserQuestionFeature;
2485
+ /**
2486
+ * Built-in `suggest_replies` quick-reply chips. When the assistant invokes
2487
+ * the tool, the widget shows the suggestions as tappable chips above the
2488
+ * composer (reusing the suggestion-chips surface) and immediately resumes
2489
+ * the execution — fire-and-forget, no user input awaited.
2490
+ */
2491
+ suggestReplies?: AgentWidgetSuggestRepliesFeature;
2492
+ };
2493
+ /**
2494
+ * Feature config for the built-in `suggest_replies` quick-reply chips.
2495
+ * Chips render in the existing suggestions slot above the composer and are
2496
+ * styled by the widget-level `suggestionChipsConfig`. A tapped chip is sent
2497
+ * verbatim as the user's next message; chips clear once any user message
2498
+ * follows them.
2499
+ */
2500
+ type AgentWidgetSuggestRepliesFeature = {
2501
+ /**
2502
+ * Enable the feature. Defaults to true. When false, `suggest_replies`
2503
+ * renders as a regular tool bubble and is NOT auto-resumed — only set this
2504
+ * with no server-side `suggest_replies` declaration, or the execution
2505
+ * parks awaiting a resume that never comes.
2506
+ */
2507
+ enabled?: boolean;
2508
+ /**
2509
+ * Advertise the built-in `suggest_replies` tool to the agent on every
2510
+ * dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
2511
+ * needed. Defaults to `false`: flows that already declare the tool via
2512
+ * `runtimeTools` would otherwise present it to the model twice. Ignored
2513
+ * when `enabled` is `false`.
2514
+ */
2515
+ expose?: boolean;
2473
2516
  };
2474
2517
  /**
2475
2518
  * Single selectable option in an `ask_user_question` prompt.
@@ -2530,6 +2573,19 @@ type AgentWidgetAskUserQuestionStyles = {
2530
2573
  type AgentWidgetAskUserQuestionFeature = {
2531
2574
  /** Enable the feature. Defaults to true. When false, `ask_user_question` renders as a regular tool bubble. */
2532
2575
  enabled?: boolean;
2576
+ /**
2577
+ * Advertise the built-in `ask_user_question` tool to the agent on every
2578
+ * dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
2579
+ * needed. The tool ships with a model-facing description and JSON schema
2580
+ * matching {@link AskUserQuestionPayload}; when the model calls it, the
2581
+ * existing answer-pill sheet renders and the answer resumes the execution.
2582
+ *
2583
+ * Defaults to `false`: flows that already declare `ask_user_question` via
2584
+ * `runtimeTools` would otherwise present the tool to the model twice.
2585
+ * Ignored when `enabled` is `false` — never offer the agent a question
2586
+ * tool the widget can't render an answer UI for.
2587
+ */
2588
+ expose?: boolean;
2533
2589
  /** Slide-in animation duration in ms. Defaults to 180. */
2534
2590
  slideInMs?: number;
2535
2591
  /** Label for the free-text pill. Defaults to "Other…". */
@@ -2711,6 +2767,26 @@ type AgentWidgetDockConfig = {
2711
2767
  * it appears to emerge at full width like a floating widget.
2712
2768
  */
2713
2769
  reveal?: "resize" | "overlay" | "push" | "emerge";
2770
+ /**
2771
+ * Maximum height of the dock panel, applied as a viewport-overflow guard.
2772
+ *
2773
+ * The docked shell sizes itself with `height: 100%`, which only resolves when
2774
+ * an ancestor (usually `html, body { height: 100% }`) provides a definite
2775
+ * height. Without one, the dock column would otherwise grow with the
2776
+ * conversation and scroll off the page. This cap clamps the panel to the
2777
+ * viewport (and keeps the `resize`/`emerge` reveals pinned with
2778
+ * `position: sticky`; `push`/`overlay` get the cap only, since their
2779
+ * transform/absolute contexts defeat sticky) so a missing height chain
2780
+ * degrades gracefully instead of breaking the chat.
2781
+ *
2782
+ * - Set a CSS length (e.g. `"600px"`, `"80vh"`) to override the cap.
2783
+ * - Set `false` to disable the guard entirely (the panel then sizes purely
2784
+ * from the surrounding layout — make sure your page provides a definite
2785
+ * height all the way down to the dock target's parent).
2786
+ *
2787
+ * @default "100dvh"
2788
+ */
2789
+ maxHeight?: string | false;
2714
2790
  };
2715
2791
  /**
2716
2792
  * Layout configuration for `mountMode: "composer-bar"`. Controls how the
@@ -1742,8 +1742,13 @@ type ClientToolDefinition = {
1742
1742
  description: string;
1743
1743
  /** JSON Schema (per WebMCP spec) — passed through as-is. */
1744
1744
  parametersSchema?: object;
1745
- /** Set to `'webmcp'` for tools discovered via the polyfill. */
1746
- origin?: 'webmcp' | 'local';
1745
+ /**
1746
+ * `'webmcp'` for tools discovered via the polyfill (server prepends the
1747
+ * `webmcp:` wire prefix); `'sdk'` for widget/SDK-provided tools (name stays
1748
+ * bare on the wire). Matches the server's accepted enum — any other value
1749
+ * fails dispatch validation.
1750
+ */
1751
+ origin?: 'webmcp' | 'sdk';
1747
1752
  /** Origin of the page that registered the tool — for server-side audit. */
1748
1753
  pageOrigin?: string;
1749
1754
  /**
@@ -1872,6 +1877,13 @@ type AgentMessageMetadata = {
1872
1877
  * paginated stepper. Persists alongside `askUserQuestionAnswers`.
1873
1878
  */
1874
1879
  askUserQuestionIndex?: number;
1880
+ /**
1881
+ * Set to `true` once a `suggest_replies` tool call's fire-and-forget
1882
+ * `/resume` has been accepted by the server. Persisted belt-and-suspenders
1883
+ * mirror of the in-memory resolved-key dedupe, so hydration/re-emit paths
1884
+ * never re-resume the call.
1885
+ */
1886
+ suggestRepliesResolved?: boolean;
1875
1887
  };
1876
1888
  type AgentWidgetRequestMiddlewareContext = {
1877
1889
  payload: AgentWidgetRequestPayload;
@@ -2470,6 +2482,37 @@ type AgentWidgetFeatureFlags = {
2470
2482
  * pills + optional free-text input.
2471
2483
  */
2472
2484
  askUserQuestion?: AgentWidgetAskUserQuestionFeature;
2485
+ /**
2486
+ * Built-in `suggest_replies` quick-reply chips. When the assistant invokes
2487
+ * the tool, the widget shows the suggestions as tappable chips above the
2488
+ * composer (reusing the suggestion-chips surface) and immediately resumes
2489
+ * the execution — fire-and-forget, no user input awaited.
2490
+ */
2491
+ suggestReplies?: AgentWidgetSuggestRepliesFeature;
2492
+ };
2493
+ /**
2494
+ * Feature config for the built-in `suggest_replies` quick-reply chips.
2495
+ * Chips render in the existing suggestions slot above the composer and are
2496
+ * styled by the widget-level `suggestionChipsConfig`. A tapped chip is sent
2497
+ * verbatim as the user's next message; chips clear once any user message
2498
+ * follows them.
2499
+ */
2500
+ type AgentWidgetSuggestRepliesFeature = {
2501
+ /**
2502
+ * Enable the feature. Defaults to true. When false, `suggest_replies`
2503
+ * renders as a regular tool bubble and is NOT auto-resumed — only set this
2504
+ * with no server-side `suggest_replies` declaration, or the execution
2505
+ * parks awaiting a resume that never comes.
2506
+ */
2507
+ enabled?: boolean;
2508
+ /**
2509
+ * Advertise the built-in `suggest_replies` tool to the agent on every
2510
+ * dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
2511
+ * needed. Defaults to `false`: flows that already declare the tool via
2512
+ * `runtimeTools` would otherwise present it to the model twice. Ignored
2513
+ * when `enabled` is `false`.
2514
+ */
2515
+ expose?: boolean;
2473
2516
  };
2474
2517
  /**
2475
2518
  * Single selectable option in an `ask_user_question` prompt.
@@ -2530,6 +2573,19 @@ type AgentWidgetAskUserQuestionStyles = {
2530
2573
  type AgentWidgetAskUserQuestionFeature = {
2531
2574
  /** Enable the feature. Defaults to true. When false, `ask_user_question` renders as a regular tool bubble. */
2532
2575
  enabled?: boolean;
2576
+ /**
2577
+ * Advertise the built-in `ask_user_question` tool to the agent on every
2578
+ * dispatch via `clientTools[]` — no server-side `runtimeTools` declaration
2579
+ * needed. The tool ships with a model-facing description and JSON schema
2580
+ * matching {@link AskUserQuestionPayload}; when the model calls it, the
2581
+ * existing answer-pill sheet renders and the answer resumes the execution.
2582
+ *
2583
+ * Defaults to `false`: flows that already declare `ask_user_question` via
2584
+ * `runtimeTools` would otherwise present the tool to the model twice.
2585
+ * Ignored when `enabled` is `false` — never offer the agent a question
2586
+ * tool the widget can't render an answer UI for.
2587
+ */
2588
+ expose?: boolean;
2533
2589
  /** Slide-in animation duration in ms. Defaults to 180. */
2534
2590
  slideInMs?: number;
2535
2591
  /** Label for the free-text pill. Defaults to "Other…". */
@@ -2711,6 +2767,26 @@ type AgentWidgetDockConfig = {
2711
2767
  * it appears to emerge at full width like a floating widget.
2712
2768
  */
2713
2769
  reveal?: "resize" | "overlay" | "push" | "emerge";
2770
+ /**
2771
+ * Maximum height of the dock panel, applied as a viewport-overflow guard.
2772
+ *
2773
+ * The docked shell sizes itself with `height: 100%`, which only resolves when
2774
+ * an ancestor (usually `html, body { height: 100% }`) provides a definite
2775
+ * height. Without one, the dock column would otherwise grow with the
2776
+ * conversation and scroll off the page. This cap clamps the panel to the
2777
+ * viewport (and keeps the `resize`/`emerge` reveals pinned with
2778
+ * `position: sticky`; `push`/`overlay` get the cap only, since their
2779
+ * transform/absolute contexts defeat sticky) so a missing height chain
2780
+ * degrades gracefully instead of breaking the chat.
2781
+ *
2782
+ * - Set a CSS length (e.g. `"600px"`, `"80vh"`) to override the cap.
2783
+ * - Set `false` to disable the guard entirely (the panel then sizes purely
2784
+ * from the surrounding layout — make sure your page provides a definite
2785
+ * height all the way down to the dock target's parent).
2786
+ *
2787
+ * @default "100dvh"
2788
+ */
2789
+ maxHeight?: string | false;
2714
2790
  };
2715
2791
  /**
2716
2792
  * Layout configuration for `mountMode: "composer-bar"`. Controls how the