@runtypelabs/persona 4.20.0 → 4.21.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 (52) hide show
  1. package/dist/animations/glyph-cycle.d.cts +1 -1
  2. package/dist/animations/glyph-cycle.d.ts +1 -1
  3. package/dist/animations/{types-CG-bLFmk.d.cts → types-B_JdVK9o.d.cts} +2 -0
  4. package/dist/animations/{types-CG-bLFmk.d.ts → types-B_JdVK9o.d.ts} +2 -0
  5. package/dist/animations/wipe.d.cts +1 -1
  6. package/dist/animations/wipe.d.ts +1 -1
  7. package/dist/animations-extra.d.cts +2 -0
  8. package/dist/animations-extra.d.ts +2 -0
  9. package/dist/approval-ui.d.cts +22 -0
  10. package/dist/approval-ui.d.ts +22 -0
  11. package/dist/artifacts-ui.d.cts +22 -0
  12. package/dist/artifacts-ui.d.ts +22 -0
  13. package/dist/codegen.cjs +1 -1
  14. package/dist/codegen.js +1 -1
  15. package/dist/context-mentions.d.cts +22 -0
  16. package/dist/context-mentions.d.ts +22 -0
  17. package/dist/event-stream-view.d.cts +22 -0
  18. package/dist/event-stream-view.d.ts +22 -0
  19. package/dist/forms-ui.d.cts +46 -4
  20. package/dist/forms-ui.d.ts +46 -4
  21. package/dist/history-view.d.cts +2 -0
  22. package/dist/history-view.d.ts +2 -0
  23. package/dist/index.cjs +63 -63
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +50 -4
  26. package/dist/index.d.ts +50 -4
  27. package/dist/index.global.js +48 -48
  28. package/dist/index.global.js.map +1 -1
  29. package/dist/index.js +63 -63
  30. package/dist/index.js.map +1 -1
  31. package/dist/session-reconnect.d.cts +22 -0
  32. package/dist/session-reconnect.d.ts +22 -0
  33. package/dist/smart-dom-reader.d.cts +22 -0
  34. package/dist/smart-dom-reader.d.ts +22 -0
  35. package/dist/theme-editor-preview.cjs +65 -65
  36. package/dist/theme-editor-preview.d.cts +22 -0
  37. package/dist/theme-editor-preview.d.ts +22 -0
  38. package/dist/theme-editor-preview.js +43 -43
  39. package/dist/theme-editor.d.cts +22 -0
  40. package/dist/theme-editor.d.ts +22 -0
  41. package/dist/webmcp-runtime.d.cts +16 -0
  42. package/dist/webmcp-runtime.d.ts +16 -0
  43. package/package.json +1 -1
  44. package/src/client-visitor-history.test.ts +473 -3
  45. package/src/client.test.ts +141 -3
  46. package/src/client.ts +157 -39
  47. package/src/generated/runtype-openapi-contract.ts +2 -0
  48. package/src/session.ts +139 -103
  49. package/src/session.webmcp.test.ts +48 -1
  50. package/src/types.ts +30 -0
  51. package/src/ui.history-lifecycle.test.ts +2 -2
  52. package/src/ui.ts +95 -7
package/dist/index.d.cts CHANGED
@@ -1684,8 +1684,10 @@ type RuntypeExecutionStreamEvent = ({
1684
1684
  message: string;
1685
1685
  };
1686
1686
  executionId: string;
1687
+ finalOutput?: string;
1687
1688
  kind: "agent" | "flow";
1688
1689
  seq: number;
1690
+ stopReason?: string;
1689
1691
  type: "execution_error";
1690
1692
  upgradeUrl?: string;
1691
1693
  }) | ({
@@ -3214,6 +3216,22 @@ type AgentWidgetWebMcpConfig = {
3214
3216
  * `window.confirm` fallback only applies when no widget UI is attached.
3215
3217
  */
3216
3218
  onConfirm?: WebMcpConfirmHandler;
3219
+ /**
3220
+ * How the widget runs the `webmcp:*` calls of ONE turn when the model emits
3221
+ * several at once.
3222
+ *
3223
+ * - `'parallel'` (default): every call executes concurrently and a gated
3224
+ * sibling's approval never blocks another's execution. Right for
3225
+ * independent, order-insensitive tools (catalog lookups, add-to-cart).
3226
+ * - `'sequential'`: calls execute one at a time, in the order the model
3227
+ * emitted them; the next starts only after the previous one settles
3228
+ * (including its approval bubble). Use this when the page tools share
3229
+ * mutable state that concurrent execution would interleave, e.g. a
3230
+ * canvas where every stroke selects a color/tool before drawing.
3231
+ *
3232
+ * Either way, all outputs still return to the server in a single `/resume`.
3233
+ */
3234
+ execution?: 'parallel' | 'sequential';
3217
3235
  };
3218
3236
  /**
3219
3237
  * Agent execution state tracking.
@@ -7722,6 +7740,10 @@ type ClientSession = {
7722
7740
  targetId?: string;
7723
7741
  /** Opaque change token; differs whenever the conversation transcript mutated. */
7724
7742
  conversationRevision?: string;
7743
+ /** Server-negotiated durable reconnect support for this client-token session. */
7744
+ durableRecovery?: {
7745
+ enabled: boolean;
7746
+ };
7725
7747
  /** Visitor grant backing history. `token` appears only at mint. */
7726
7748
  visitor?: ClientVisitorGrant;
7727
7749
  /** Configuration from the server */
@@ -7760,6 +7782,10 @@ type ClientInitResponse = {
7760
7782
  conversationId?: string;
7761
7783
  targetId?: string;
7762
7784
  conversationRevision?: string;
7785
+ /** Present on servers that understand the durable-recovery negotiation. */
7786
+ durableRecovery?: {
7787
+ enabled: boolean;
7788
+ };
7763
7789
  visitor?: ClientVisitorGrant;
7764
7790
  config: {
7765
7791
  welcomeMessage: string | null;
@@ -7843,6 +7869,17 @@ interface WidgetHistoryInternals {
7843
7869
  /** Persist the revision beside the active conversation id (internal only). */
7844
7870
  setStoredConversationRevision?: (revision: string | null) => void;
7845
7871
  getStoredConversationRevision?: () => string | null;
7872
+ /** Internal client-token durable resume handle, persisted with widget state. */
7873
+ setStoredResumableHandle?: (handle: {
7874
+ executionId: string;
7875
+ after: string;
7876
+ } | null) => void;
7877
+ getStoredResumableHandle?: () => {
7878
+ executionId: string;
7879
+ after: string;
7880
+ } | null;
7881
+ /** True only while Persona owns a persisted client-token recovery attempt. */
7882
+ shouldResumeDurableConversation?: () => boolean;
7846
7883
  /** "Show earlier messages" cursor for the persisted transcript. */
7847
7884
  setStoredMessageCursor?: (cursor: string | null) => void;
7848
7885
  getStoredMessageCursor?: () => string | null;
@@ -10390,6 +10427,12 @@ declare class AgentWidgetClient {
10390
10427
  * Get the current client session (if any)
10391
10428
  */
10392
10429
  getClientSession(): ClientSession | null;
10430
+ /** Persona's built-in reconnect transport for client-token sessions. */
10431
+ reconnectClientTokenStream(ctx: {
10432
+ executionId: string;
10433
+ after: string;
10434
+ signal: AbortSignal;
10435
+ }): Promise<Response>;
10393
10436
  /**
10394
10437
  * Initialize session for client token mode.
10395
10438
  * Called automatically on first message if not already initialized.
@@ -10704,6 +10747,7 @@ declare class AgentWidgetClient {
10704
10747
  resumeFlow(executionId: string, toolOutputs: Record<string, unknown>, options?: {
10705
10748
  streamResponse?: boolean;
10706
10749
  signal?: AbortSignal;
10750
+ after?: string;
10707
10751
  }): Promise<Response>;
10708
10752
  /**
10709
10753
  * The opt-in structured mention channel: the MOST RECENT user turn's
@@ -11584,10 +11628,12 @@ declare class AgentWidgetSession {
11584
11628
  /**
11585
11629
  * Resolve one or more parallel local-tool awaits sharing one paused
11586
11630
  * executionId with a SINGLE `/resume` (core#3878); `resolveWebMcpToolCall`
11587
- * delegates size-1 resolves here after its guards. Each call is executed
11588
- * against the page registry concurrently: every gated call renders its own
11589
- * native approval bubble, and a sibling's confirm Promise never blocks
11590
- * another's execution. Outputs are keyed by per-call `webMcpToolCallId`
11631
+ * delegates size-1 resolves here after its guards. By default each call is
11632
+ * executed against the page registry concurrently: every gated call renders
11633
+ * its own native approval bubble, and a sibling's confirm Promise never
11634
+ * blocks another's execution. With `webmcp.execution: "sequential"` the
11635
+ * calls run one at a time in emission order instead (see the config docs
11636
+ * for when that matters). Outputs are keyed by per-call `webMcpToolCallId`
11591
11637
  * (server prefers it over tool name; name-keying remains the fallback for
11592
11638
  * legacy single/distinct-tool turns), so two calls to the SAME tool no longer
11593
11639
  * collide. The server is tolerant: any call we omit (declined-after-abort,
package/dist/index.d.ts CHANGED
@@ -1684,8 +1684,10 @@ type RuntypeExecutionStreamEvent = ({
1684
1684
  message: string;
1685
1685
  };
1686
1686
  executionId: string;
1687
+ finalOutput?: string;
1687
1688
  kind: "agent" | "flow";
1688
1689
  seq: number;
1690
+ stopReason?: string;
1689
1691
  type: "execution_error";
1690
1692
  upgradeUrl?: string;
1691
1693
  }) | ({
@@ -3214,6 +3216,22 @@ type AgentWidgetWebMcpConfig = {
3214
3216
  * `window.confirm` fallback only applies when no widget UI is attached.
3215
3217
  */
3216
3218
  onConfirm?: WebMcpConfirmHandler;
3219
+ /**
3220
+ * How the widget runs the `webmcp:*` calls of ONE turn when the model emits
3221
+ * several at once.
3222
+ *
3223
+ * - `'parallel'` (default): every call executes concurrently and a gated
3224
+ * sibling's approval never blocks another's execution. Right for
3225
+ * independent, order-insensitive tools (catalog lookups, add-to-cart).
3226
+ * - `'sequential'`: calls execute one at a time, in the order the model
3227
+ * emitted them; the next starts only after the previous one settles
3228
+ * (including its approval bubble). Use this when the page tools share
3229
+ * mutable state that concurrent execution would interleave, e.g. a
3230
+ * canvas where every stroke selects a color/tool before drawing.
3231
+ *
3232
+ * Either way, all outputs still return to the server in a single `/resume`.
3233
+ */
3234
+ execution?: 'parallel' | 'sequential';
3217
3235
  };
3218
3236
  /**
3219
3237
  * Agent execution state tracking.
@@ -7722,6 +7740,10 @@ type ClientSession = {
7722
7740
  targetId?: string;
7723
7741
  /** Opaque change token; differs whenever the conversation transcript mutated. */
7724
7742
  conversationRevision?: string;
7743
+ /** Server-negotiated durable reconnect support for this client-token session. */
7744
+ durableRecovery?: {
7745
+ enabled: boolean;
7746
+ };
7725
7747
  /** Visitor grant backing history. `token` appears only at mint. */
7726
7748
  visitor?: ClientVisitorGrant;
7727
7749
  /** Configuration from the server */
@@ -7760,6 +7782,10 @@ type ClientInitResponse = {
7760
7782
  conversationId?: string;
7761
7783
  targetId?: string;
7762
7784
  conversationRevision?: string;
7785
+ /** Present on servers that understand the durable-recovery negotiation. */
7786
+ durableRecovery?: {
7787
+ enabled: boolean;
7788
+ };
7763
7789
  visitor?: ClientVisitorGrant;
7764
7790
  config: {
7765
7791
  welcomeMessage: string | null;
@@ -7843,6 +7869,17 @@ interface WidgetHistoryInternals {
7843
7869
  /** Persist the revision beside the active conversation id (internal only). */
7844
7870
  setStoredConversationRevision?: (revision: string | null) => void;
7845
7871
  getStoredConversationRevision?: () => string | null;
7872
+ /** Internal client-token durable resume handle, persisted with widget state. */
7873
+ setStoredResumableHandle?: (handle: {
7874
+ executionId: string;
7875
+ after: string;
7876
+ } | null) => void;
7877
+ getStoredResumableHandle?: () => {
7878
+ executionId: string;
7879
+ after: string;
7880
+ } | null;
7881
+ /** True only while Persona owns a persisted client-token recovery attempt. */
7882
+ shouldResumeDurableConversation?: () => boolean;
7846
7883
  /** "Show earlier messages" cursor for the persisted transcript. */
7847
7884
  setStoredMessageCursor?: (cursor: string | null) => void;
7848
7885
  getStoredMessageCursor?: () => string | null;
@@ -10390,6 +10427,12 @@ declare class AgentWidgetClient {
10390
10427
  * Get the current client session (if any)
10391
10428
  */
10392
10429
  getClientSession(): ClientSession | null;
10430
+ /** Persona's built-in reconnect transport for client-token sessions. */
10431
+ reconnectClientTokenStream(ctx: {
10432
+ executionId: string;
10433
+ after: string;
10434
+ signal: AbortSignal;
10435
+ }): Promise<Response>;
10393
10436
  /**
10394
10437
  * Initialize session for client token mode.
10395
10438
  * Called automatically on first message if not already initialized.
@@ -10704,6 +10747,7 @@ declare class AgentWidgetClient {
10704
10747
  resumeFlow(executionId: string, toolOutputs: Record<string, unknown>, options?: {
10705
10748
  streamResponse?: boolean;
10706
10749
  signal?: AbortSignal;
10750
+ after?: string;
10707
10751
  }): Promise<Response>;
10708
10752
  /**
10709
10753
  * The opt-in structured mention channel: the MOST RECENT user turn's
@@ -11584,10 +11628,12 @@ declare class AgentWidgetSession {
11584
11628
  /**
11585
11629
  * Resolve one or more parallel local-tool awaits sharing one paused
11586
11630
  * executionId with a SINGLE `/resume` (core#3878); `resolveWebMcpToolCall`
11587
- * delegates size-1 resolves here after its guards. Each call is executed
11588
- * against the page registry concurrently: every gated call renders its own
11589
- * native approval bubble, and a sibling's confirm Promise never blocks
11590
- * another's execution. Outputs are keyed by per-call `webMcpToolCallId`
11631
+ * delegates size-1 resolves here after its guards. By default each call is
11632
+ * executed against the page registry concurrently: every gated call renders
11633
+ * its own native approval bubble, and a sibling's confirm Promise never
11634
+ * blocks another's execution. With `webmcp.execution: "sequential"` the
11635
+ * calls run one at a time in emission order instead (see the config docs
11636
+ * for when that matters). Outputs are keyed by per-call `webMcpToolCallId`
11591
11637
  * (server prefers it over tool name; name-keying remains the fallback for
11592
11638
  * legacy single/distinct-tool turns), so two calls to the SAME tool no longer
11593
11639
  * collide. The server is tolerant: any call we omit (declined-after-abort,