@runtypelabs/persona 4.27.0 → 4.28.1

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 (72) hide show
  1. package/README.md +25 -0
  2. package/dist/{approval-ui-QAKWNFNM.js → approval-ui-OBBI62ES.js} +1 -1
  3. package/dist/approval-ui.cjs +2 -2
  4. package/dist/approval-ui.d.cts +20 -5
  5. package/dist/approval-ui.d.ts +20 -5
  6. package/dist/approval-ui.js +2 -2
  7. package/dist/artifacts-ui.d.cts +20 -5
  8. package/dist/artifacts-ui.d.ts +20 -5
  9. package/dist/{chunk-NQLDCJAP.js → chunk-D4TDKCT5.js} +2 -2
  10. package/dist/chunk-FNXK3VTC.js +1 -0
  11. package/dist/{client-history-HTRKHBAF.js → client-history-QGAFMCBE.js} +1 -1
  12. package/dist/client-history.js +1 -1
  13. package/dist/{client-stream-N22JHTLE.js → client-stream-WXD2FL23.js} +1 -1
  14. package/dist/client-stream.js +3 -3
  15. package/dist/codegen.cjs +4 -4
  16. package/dist/codegen.js +5 -5
  17. package/dist/context-mentions.d.cts +20 -5
  18. package/dist/context-mentions.d.ts +20 -5
  19. package/dist/event-stream-view.d.cts +20 -5
  20. package/dist/event-stream-view.d.ts +20 -5
  21. package/dist/forms-ui.d.cts +26 -5
  22. package/dist/forms-ui.d.ts +26 -5
  23. package/dist/index.cjs +41 -41
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +59 -30
  26. package/dist/index.d.ts +59 -30
  27. package/dist/index.global.js +1 -1
  28. package/dist/index.global.js.map +1 -1
  29. package/dist/index.js +41 -41
  30. package/dist/index.js.map +1 -1
  31. package/dist/session-reconnect.d.cts +20 -5
  32. package/dist/session-reconnect.d.ts +20 -5
  33. package/dist/smart-dom-reader.d.cts +20 -5
  34. package/dist/smart-dom-reader.d.ts +20 -5
  35. package/dist/theme-editor-preview.cjs +63 -63
  36. package/dist/theme-editor-preview.d.cts +20 -5
  37. package/dist/theme-editor-preview.d.ts +20 -5
  38. package/dist/theme-editor-preview.js +6 -6
  39. package/dist/theme-editor.d.cts +21 -6
  40. package/dist/theme-editor.d.ts +21 -6
  41. package/dist/voice-runtime-TWFJ4UUS.js +17 -0
  42. package/dist/voice-runtime.cjs +8 -8
  43. package/dist/voice-runtime.d.cts +31 -5
  44. package/dist/voice-runtime.d.ts +31 -5
  45. package/dist/voice-runtime.js +8 -8
  46. package/dist/webmcp-runtime-5Q3IHAHP.js +6 -0
  47. package/dist/webmcp-runtime.cjs +2 -2
  48. package/dist/webmcp-runtime.d.cts +22 -26
  49. package/dist/webmcp-runtime.d.ts +22 -26
  50. package/dist/webmcp-runtime.js +2 -2
  51. package/package.json +5 -2
  52. package/src/client.interrupt.test.ts +18 -0
  53. package/src/client.ts +7 -0
  54. package/src/generated/runtype-openapi-contract.ts +3 -0
  55. package/src/session.ts +11 -3
  56. package/src/session.voice.test.ts +140 -0
  57. package/src/theme-editor/webmcp/types.ts +1 -1
  58. package/src/types.ts +26 -5
  59. package/src/voice/runtype-voice-provider.ts +93 -11
  60. package/src/voice/voice-clause-buffer.test.ts +143 -0
  61. package/src/voice/voice-clause-buffer.ts +187 -0
  62. package/src/voice/voice-delegation.ts +85 -3
  63. package/src/voice/voice.test.ts +257 -2
  64. package/src/webmcp-bridge.test.ts +87 -21
  65. package/src/webmcp-bridge.ts +21 -26
  66. package/src/webmcp-polyfill.integration.test.ts +339 -0
  67. package/src/webmcp-polyfill.ts +7 -4
  68. package/src/webmcp-runtime-bundle.test.ts +1 -1
  69. package/src/webmcp-runtime-entry.ts +34 -19
  70. package/dist/chunk-3255TNY7.js +0 -1
  71. package/dist/voice-runtime-RHRX4F3T.js +0 -17
  72. package/dist/webmcp-runtime-V6ZWW3PI.js +0 -6
@@ -3214,9 +3214,8 @@ type WebMcpConfirmInfo = {
3214
3214
  };
3215
3215
  /**
3216
3216
  * Why the confirm was requested. Currently always `'gate'`: the default
3217
- * confirm-by-default gate that fires before every `webmcp:*` call. (The
3218
- * `@mcp-b/webmcp-polyfill` owns the spec's `requestUserInteraction` callback
3219
- * internally, so Persona no longer surfaces a nested in-tool confirm.)
3217
+ * confirm-by-default gate that fires before every `webmcp:*` call. Tool
3218
+ * callbacks on v6 receive an AbortSignal, not a nested confirmation API.
3220
3219
  */
3221
3220
  reason: 'gate';
3222
3221
  };
@@ -7125,6 +7124,13 @@ type VoiceDelegationRequest = {
7125
7124
  role: string;
7126
7125
  content: unknown;
7127
7126
  }>;
7127
+ /**
7128
+ * Set when the server streams delegated answers (`delegation_stream`): called
7129
+ * with each speakable piece of the turn's answer, in order, while it renders.
7130
+ * The pieces, concatenated, are a prefix of the result's `text`; the result
7131
+ * says how much of it with `streamedChars`.
7132
+ */
7133
+ stream?: (text: string) => void;
7128
7134
  };
7129
7135
  /**
7130
7136
  * How a delegated turn ended, or that it waits on an approval (contract
@@ -7155,6 +7161,12 @@ type VoiceDelegationResult = {
7155
7161
  * @default true
7156
7162
  */
7157
7163
  inChat?: boolean;
7164
+ /**
7165
+ * How many leading characters of `text` already went out through
7166
+ * `request.stream` (the rest, such as an approval script, is unstreamed).
7167
+ * Omitted or 0: nothing was streamed.
7168
+ */
7169
+ streamedChars?: number;
7158
7170
  /**
7159
7171
  * Set when the turn parked on approvals (`text` then asks for the decision).
7160
7172
  * Resolves with the terminal result once the visitor decides (or the
@@ -9274,8 +9286,11 @@ type AgentWidgetConfig = {
9274
9286
  /**
9275
9287
  * WebMCP: consume page-registered tools (`document.modelContext.registerTool`).
9276
9288
  * When `enabled`, the widget installs `@mcp-b/webmcp-polyfill`, snapshots the
9277
- * registry on every dispatch, ships it as `clientTools[]`, and executes
9278
- * returned `webmcp:*` tool calls with confirm-by-default gating.
9289
+ * current document's registry on every dispatch, ships it as `clientTools[]`,
9290
+ * and executes returned `webmcp:*` calls with confirm-by-default gating.
9291
+ * Supports host-installed v5 JSON-string and v6 object-input contracts.
9292
+ * The automatic fallback stays on v5 to preserve existing browser support
9293
+ * and callback-result behavior.
9279
9294
  *
9280
9295
  * Server-side policy on the chat surface is the source of truth: these
9281
9296
  * fields layer on top.
@@ -3214,9 +3214,8 @@ type WebMcpConfirmInfo = {
3214
3214
  };
3215
3215
  /**
3216
3216
  * Why the confirm was requested. Currently always `'gate'`: the default
3217
- * confirm-by-default gate that fires before every `webmcp:*` call. (The
3218
- * `@mcp-b/webmcp-polyfill` owns the spec's `requestUserInteraction` callback
3219
- * internally, so Persona no longer surfaces a nested in-tool confirm.)
3217
+ * confirm-by-default gate that fires before every `webmcp:*` call. Tool
3218
+ * callbacks on v6 receive an AbortSignal, not a nested confirmation API.
3220
3219
  */
3221
3220
  reason: 'gate';
3222
3221
  };
@@ -7125,6 +7124,13 @@ type VoiceDelegationRequest = {
7125
7124
  role: string;
7126
7125
  content: unknown;
7127
7126
  }>;
7127
+ /**
7128
+ * Set when the server streams delegated answers (`delegation_stream`): called
7129
+ * with each speakable piece of the turn's answer, in order, while it renders.
7130
+ * The pieces, concatenated, are a prefix of the result's `text`; the result
7131
+ * says how much of it with `streamedChars`.
7132
+ */
7133
+ stream?: (text: string) => void;
7128
7134
  };
7129
7135
  /**
7130
7136
  * How a delegated turn ended, or that it waits on an approval (contract
@@ -7155,6 +7161,12 @@ type VoiceDelegationResult = {
7155
7161
  * @default true
7156
7162
  */
7157
7163
  inChat?: boolean;
7164
+ /**
7165
+ * How many leading characters of `text` already went out through
7166
+ * `request.stream` (the rest, such as an approval script, is unstreamed).
7167
+ * Omitted or 0: nothing was streamed.
7168
+ */
7169
+ streamedChars?: number;
7158
7170
  /**
7159
7171
  * Set when the turn parked on approvals (`text` then asks for the decision).
7160
7172
  * Resolves with the terminal result once the visitor decides (or the
@@ -9274,8 +9286,11 @@ type AgentWidgetConfig = {
9274
9286
  /**
9275
9287
  * WebMCP: consume page-registered tools (`document.modelContext.registerTool`).
9276
9288
  * When `enabled`, the widget installs `@mcp-b/webmcp-polyfill`, snapshots the
9277
- * registry on every dispatch, ships it as `clientTools[]`, and executes
9278
- * returned `webmcp:*` tool calls with confirm-by-default gating.
9289
+ * current document's registry on every dispatch, ships it as `clientTools[]`,
9290
+ * and executes returned `webmcp:*` calls with confirm-by-default gating.
9291
+ * Supports host-installed v5 JSON-string and v6 object-input contracts.
9292
+ * The automatic fallback stays on v5 to preserve existing browser support
9293
+ * and callback-result behavior.
9279
9294
  *
9280
9295
  * Server-side policy on the chat surface is the source of truth: these
9281
9296
  * fields layer on top.
@@ -3483,9 +3483,8 @@ type WebMcpConfirmInfo = {
3483
3483
  };
3484
3484
  /**
3485
3485
  * Why the confirm was requested. Currently always `'gate'`: the default
3486
- * confirm-by-default gate that fires before every `webmcp:*` call. (The
3487
- * `@mcp-b/webmcp-polyfill` owns the spec's `requestUserInteraction` callback
3488
- * internally, so Persona no longer surfaces a nested in-tool confirm.)
3486
+ * confirm-by-default gate that fires before every `webmcp:*` call. Tool
3487
+ * callbacks on v6 receive an AbortSignal, not a nested confirmation API.
3489
3488
  */
3490
3489
  reason: 'gate';
3491
3490
  };
@@ -7394,6 +7393,13 @@ type VoiceDelegationRequest = {
7394
7393
  role: string;
7395
7394
  content: unknown;
7396
7395
  }>;
7396
+ /**
7397
+ * Set when the server streams delegated answers (`delegation_stream`): called
7398
+ * with each speakable piece of the turn's answer, in order, while it renders.
7399
+ * The pieces, concatenated, are a prefix of the result's `text`; the result
7400
+ * says how much of it with `streamedChars`.
7401
+ */
7402
+ stream?: (text: string) => void;
7397
7403
  };
7398
7404
  /**
7399
7405
  * How a delegated turn ended, or that it waits on an approval (contract
@@ -7424,6 +7430,12 @@ type VoiceDelegationResult = {
7424
7430
  * @default true
7425
7431
  */
7426
7432
  inChat?: boolean;
7433
+ /**
7434
+ * How many leading characters of `text` already went out through
7435
+ * `request.stream` (the rest, such as an approval script, is unstreamed).
7436
+ * Omitted or 0: nothing was streamed.
7437
+ */
7438
+ streamedChars?: number;
7427
7439
  /**
7428
7440
  * Set when the turn parked on approvals (`text` then asks for the decision).
7429
7441
  * Resolves with the terminal result once the visitor decides (or the
@@ -9543,8 +9555,11 @@ type AgentWidgetConfig = {
9543
9555
  /**
9544
9556
  * WebMCP: consume page-registered tools (`document.modelContext.registerTool`).
9545
9557
  * When `enabled`, the widget installs `@mcp-b/webmcp-polyfill`, snapshots the
9546
- * registry on every dispatch, ships it as `clientTools[]`, and executes
9547
- * returned `webmcp:*` tool calls with confirm-by-default gating.
9558
+ * current document's registry on every dispatch, ships it as `clientTools[]`,
9559
+ * and executes returned `webmcp:*` calls with confirm-by-default gating.
9560
+ * Supports host-installed v5 JSON-string and v6 object-input contracts.
9561
+ * The automatic fallback stays on v5 to preserve existing browser support
9562
+ * and callback-result behavior.
9548
9563
  *
9549
9564
  * Server-side policy on the chat surface is the source of truth: these
9550
9565
  * fields layer on top.
@@ -3483,9 +3483,8 @@ type WebMcpConfirmInfo = {
3483
3483
  };
3484
3484
  /**
3485
3485
  * Why the confirm was requested. Currently always `'gate'`: the default
3486
- * confirm-by-default gate that fires before every `webmcp:*` call. (The
3487
- * `@mcp-b/webmcp-polyfill` owns the spec's `requestUserInteraction` callback
3488
- * internally, so Persona no longer surfaces a nested in-tool confirm.)
3486
+ * confirm-by-default gate that fires before every `webmcp:*` call. Tool
3487
+ * callbacks on v6 receive an AbortSignal, not a nested confirmation API.
3489
3488
  */
3490
3489
  reason: 'gate';
3491
3490
  };
@@ -7394,6 +7393,13 @@ type VoiceDelegationRequest = {
7394
7393
  role: string;
7395
7394
  content: unknown;
7396
7395
  }>;
7396
+ /**
7397
+ * Set when the server streams delegated answers (`delegation_stream`): called
7398
+ * with each speakable piece of the turn's answer, in order, while it renders.
7399
+ * The pieces, concatenated, are a prefix of the result's `text`; the result
7400
+ * says how much of it with `streamedChars`.
7401
+ */
7402
+ stream?: (text: string) => void;
7397
7403
  };
7398
7404
  /**
7399
7405
  * How a delegated turn ended, or that it waits on an approval (contract
@@ -7424,6 +7430,12 @@ type VoiceDelegationResult = {
7424
7430
  * @default true
7425
7431
  */
7426
7432
  inChat?: boolean;
7433
+ /**
7434
+ * How many leading characters of `text` already went out through
7435
+ * `request.stream` (the rest, such as an approval script, is unstreamed).
7436
+ * Omitted or 0: nothing was streamed.
7437
+ */
7438
+ streamedChars?: number;
7427
7439
  /**
7428
7440
  * Set when the turn parked on approvals (`text` then asks for the decision).
7429
7441
  * Resolves with the terminal result once the visitor decides (or the
@@ -9543,8 +9555,11 @@ type AgentWidgetConfig = {
9543
9555
  /**
9544
9556
  * WebMCP: consume page-registered tools (`document.modelContext.registerTool`).
9545
9557
  * When `enabled`, the widget installs `@mcp-b/webmcp-polyfill`, snapshots the
9546
- * registry on every dispatch, ships it as `clientTools[]`, and executes
9547
- * returned `webmcp:*` tool calls with confirm-by-default gating.
9558
+ * current document's registry on every dispatch, ships it as `clientTools[]`,
9559
+ * and executes returned `webmcp:*` calls with confirm-by-default gating.
9560
+ * Supports host-installed v5 JSON-string and v6 object-input contracts.
9561
+ * The automatic fallback stays on v5 to preserve existing browser support
9562
+ * and callback-result behavior.
9548
9563
  *
9549
9564
  * Server-side policy on the chat surface is the source of truth: these
9550
9565
  * fields layer on top.