@runtypelabs/persona 4.23.0 → 4.23.2

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 (49) 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-9Vxm-PPz.d.cts → types-CI7OckWI.d.cts} +23 -2
  4. package/dist/animations/{types-9Vxm-PPz.d.ts → types-CI7OckWI.d.ts} +23 -2
  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 +23 -2
  8. package/dist/animations-extra.d.ts +23 -2
  9. package/dist/approval-ui.d.cts +46 -3
  10. package/dist/approval-ui.d.ts +46 -3
  11. package/dist/artifacts-ui.d.cts +46 -3
  12. package/dist/artifacts-ui.d.ts +46 -3
  13. package/dist/codegen.cjs +1 -1
  14. package/dist/codegen.js +1 -1
  15. package/dist/context-mentions.d.cts +46 -3
  16. package/dist/context-mentions.d.ts +46 -3
  17. package/dist/event-stream-view.d.cts +46 -3
  18. package/dist/event-stream-view.d.ts +46 -3
  19. package/dist/forms-ui.d.cts +46 -3
  20. package/dist/forms-ui.d.ts +46 -3
  21. package/dist/history-view.d.cts +23 -2
  22. package/dist/history-view.d.ts +23 -2
  23. package/dist/index.cjs +43 -43
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +67 -12
  26. package/dist/index.d.ts +67 -12
  27. package/dist/index.global.js +28 -28
  28. package/dist/index.global.js.map +1 -1
  29. package/dist/index.js +43 -43
  30. package/dist/index.js.map +1 -1
  31. package/dist/session-reconnect.d.cts +46 -3
  32. package/dist/session-reconnect.d.ts +46 -3
  33. package/dist/smart-dom-reader.d.cts +46 -3
  34. package/dist/smart-dom-reader.d.ts +46 -3
  35. package/dist/theme-editor-preview.cjs +49 -49
  36. package/dist/theme-editor-preview.d.cts +46 -3
  37. package/dist/theme-editor-preview.d.ts +46 -3
  38. package/dist/theme-editor-preview.js +33 -33
  39. package/dist/theme-editor.d.cts +46 -3
  40. package/dist/theme-editor.d.ts +46 -3
  41. package/package.json +1 -1
  42. package/src/client-session-renewal.test.ts +268 -0
  43. package/src/client.interrupt.test.ts +1 -1
  44. package/src/client.tool-pair-replay.test.ts +325 -0
  45. package/src/client.ts +93 -49
  46. package/src/generated/runtype-openapi-contract.ts +26 -11
  47. package/src/session.ts +32 -3
  48. package/src/types.ts +43 -1
  49. package/src/utils/tool-pair-replay.ts +100 -0
package/dist/index.d.cts CHANGED
@@ -1742,6 +1742,7 @@ type RuntypeExecutionStreamEvent = ({
1742
1742
  turnIndex?: number;
1743
1743
  type: "turn_start";
1744
1744
  }) | ({
1745
+ attributes?: Record<string, string | number | boolean>;
1745
1746
  completedAt?: string;
1746
1747
  content?: string;
1747
1748
  cost?: number;
@@ -1800,7 +1801,8 @@ type RuntypeExecutionStreamEvent = ({
1800
1801
  };
1801
1802
  turnId?: string;
1802
1803
  type: "model_call_start";
1803
- } | {
1804
+ } | ({
1805
+ attributes?: Record<string, string | number | boolean>;
1804
1806
  completedAt?: string;
1805
1807
  cost?: number;
1806
1808
  durationMs?: number;
@@ -1824,10 +1826,11 @@ type RuntypeExecutionStreamEvent = ({
1824
1826
  cacheWrite?: number;
1825
1827
  input: number;
1826
1828
  output: number;
1829
+ reasoning?: number;
1827
1830
  };
1828
1831
  turnId?: string;
1829
1832
  type: "model_call_complete";
1830
- } | {
1833
+ }) | {
1831
1834
  executionId: string;
1832
1835
  id: string;
1833
1836
  index?: number;
@@ -2211,38 +2214,50 @@ type RuntypeStreamEventOf<U, T extends string> = Extract<U, {
2211
2214
  type RuntypeTurnCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent, "turn_complete">;
2212
2215
  type RuntypeStepCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent, "step_complete">;
2213
2216
  type RuntypeStopReasonKind = NonNullable<RuntypeTurnCompleteEvent["stopReason"] | RuntypeStepCompleteEvent["stopReason"]>;
2214
- type RuntypeClientInitRequest = {
2217
+ type RuntypeClientInitRequest = ({
2215
2218
  durableRecovery?: boolean;
2216
2219
  flowId?: string;
2217
- identityProof?: string;
2220
+ identityProof?: string | {
2221
+ provider: string;
2222
+ token: string;
2223
+ };
2218
2224
  token: string;
2219
2225
  visitorHistory?: boolean;
2220
2226
  visitorToken?: string;
2221
- } | {
2227
+ }) | ({
2222
2228
  durableRecovery?: boolean;
2223
2229
  flowId?: string;
2224
- identityProof?: string;
2230
+ identityProof?: string | {
2231
+ provider: string;
2232
+ token: string;
2233
+ };
2225
2234
  sessionId: string;
2226
2235
  token: string;
2227
2236
  visitorHistory?: boolean;
2228
2237
  visitorToken?: string;
2229
- } | {
2238
+ }) | ({
2230
2239
  conversationId: string;
2231
2240
  durableRecovery?: boolean;
2232
2241
  flowId?: string;
2233
- identityProof?: string;
2242
+ identityProof?: string | {
2243
+ provider: string;
2244
+ token: string;
2245
+ };
2234
2246
  token: string;
2235
2247
  visitorHistory?: boolean;
2236
2248
  visitorToken: string;
2237
- } | {
2249
+ }) | ({
2238
2250
  conversationId: string;
2239
2251
  durableRecovery?: boolean;
2240
2252
  flowId?: string;
2241
- identityProof: string;
2253
+ identityProof: string | {
2254
+ provider: string;
2255
+ token: string;
2256
+ };
2242
2257
  token: string;
2243
2258
  visitorHistory?: boolean;
2244
2259
  visitorToken?: string;
2245
- };
2260
+ });
2246
2261
  type RuntypeClientInitResponse = {
2247
2262
  app?: {
2248
2263
  id: string;
@@ -3091,10 +3106,32 @@ type AgentWidgetContextMentionTokenRenderContext = {
3091
3106
  ref: AgentWidgetContextMentionRef;
3092
3107
  readonly: boolean;
3093
3108
  };
3109
+ /** One earlier client-tool call replayed to the model, in `/v1/dispatch` shape. */
3110
+ type AgentWidgetReplayedToolCall = {
3111
+ toolCallId: string;
3112
+ /** Model-facing (sanitized) name, e.g. `webmcp_search`. */
3113
+ toolName: string;
3114
+ args: Record<string, unknown>;
3115
+ };
3116
+ /** The browser's answer to an {@link AgentWidgetReplayedToolCall}. */
3117
+ type AgentWidgetReplayedToolResult = {
3118
+ toolCallId: string;
3119
+ toolName: string;
3120
+ result: unknown;
3121
+ };
3122
+ /**
3123
+ * A message in the proxy/agent request payload. Earlier client-tool calls the
3124
+ * browser answered replay as an assistant message carrying `toolCalls`,
3125
+ * followed by a `tool` message carrying the matching `toolResults`; both have
3126
+ * empty `content`. Client-token mode never sends them: the server replays
3127
+ * from its own stored transcript there.
3128
+ */
3094
3129
  type AgentWidgetRequestPayloadMessage = {
3095
- role: AgentWidgetMessageRole;
3130
+ role: AgentWidgetMessageRole | "tool";
3096
3131
  content: MessageContent;
3097
3132
  createdAt: string;
3133
+ toolCalls?: AgentWidgetReplayedToolCall[];
3134
+ toolResults?: AgentWidgetReplayedToolResult[];
3098
3135
  };
3099
3136
  type AgentWidgetRequestPayload = {
3100
3137
  messages: AgentWidgetRequestPayloadMessage[];
@@ -3511,6 +3548,24 @@ type AgentMessageMetadata = {
3511
3548
  * never re-resume the call.
3512
3549
  */
3513
3550
  suggestRepliesResolved?: boolean;
3551
+ /**
3552
+ * The client-tool answer the server accepted through `/resume`, kept so
3553
+ * later proxy/agent turns can replay the call and its result to the model.
3554
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
3555
+ * built-in). Set only after the resume succeeds; preserved across
3556
+ * re-emissions of the tool message.
3557
+ */
3558
+ clientToolAnswer?: {
3559
+ toolCallId: string;
3560
+ toolName: string;
3561
+ args: unknown;
3562
+ result: unknown;
3563
+ /**
3564
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
3565
+ * turn's parallel calls; a chained call gets a new batch.
3566
+ */
3567
+ batch?: string;
3568
+ };
3514
3569
  };
3515
3570
  type AgentWidgetRequestMiddlewareContext = {
3516
3571
  payload: AgentWidgetRequestPayload;
package/dist/index.d.ts CHANGED
@@ -1742,6 +1742,7 @@ type RuntypeExecutionStreamEvent = ({
1742
1742
  turnIndex?: number;
1743
1743
  type: "turn_start";
1744
1744
  }) | ({
1745
+ attributes?: Record<string, string | number | boolean>;
1745
1746
  completedAt?: string;
1746
1747
  content?: string;
1747
1748
  cost?: number;
@@ -1800,7 +1801,8 @@ type RuntypeExecutionStreamEvent = ({
1800
1801
  };
1801
1802
  turnId?: string;
1802
1803
  type: "model_call_start";
1803
- } | {
1804
+ } | ({
1805
+ attributes?: Record<string, string | number | boolean>;
1804
1806
  completedAt?: string;
1805
1807
  cost?: number;
1806
1808
  durationMs?: number;
@@ -1824,10 +1826,11 @@ type RuntypeExecutionStreamEvent = ({
1824
1826
  cacheWrite?: number;
1825
1827
  input: number;
1826
1828
  output: number;
1829
+ reasoning?: number;
1827
1830
  };
1828
1831
  turnId?: string;
1829
1832
  type: "model_call_complete";
1830
- } | {
1833
+ }) | {
1831
1834
  executionId: string;
1832
1835
  id: string;
1833
1836
  index?: number;
@@ -2211,38 +2214,50 @@ type RuntypeStreamEventOf<U, T extends string> = Extract<U, {
2211
2214
  type RuntypeTurnCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent, "turn_complete">;
2212
2215
  type RuntypeStepCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent, "step_complete">;
2213
2216
  type RuntypeStopReasonKind = NonNullable<RuntypeTurnCompleteEvent["stopReason"] | RuntypeStepCompleteEvent["stopReason"]>;
2214
- type RuntypeClientInitRequest = {
2217
+ type RuntypeClientInitRequest = ({
2215
2218
  durableRecovery?: boolean;
2216
2219
  flowId?: string;
2217
- identityProof?: string;
2220
+ identityProof?: string | {
2221
+ provider: string;
2222
+ token: string;
2223
+ };
2218
2224
  token: string;
2219
2225
  visitorHistory?: boolean;
2220
2226
  visitorToken?: string;
2221
- } | {
2227
+ }) | ({
2222
2228
  durableRecovery?: boolean;
2223
2229
  flowId?: string;
2224
- identityProof?: string;
2230
+ identityProof?: string | {
2231
+ provider: string;
2232
+ token: string;
2233
+ };
2225
2234
  sessionId: string;
2226
2235
  token: string;
2227
2236
  visitorHistory?: boolean;
2228
2237
  visitorToken?: string;
2229
- } | {
2238
+ }) | ({
2230
2239
  conversationId: string;
2231
2240
  durableRecovery?: boolean;
2232
2241
  flowId?: string;
2233
- identityProof?: string;
2242
+ identityProof?: string | {
2243
+ provider: string;
2244
+ token: string;
2245
+ };
2234
2246
  token: string;
2235
2247
  visitorHistory?: boolean;
2236
2248
  visitorToken: string;
2237
- } | {
2249
+ }) | ({
2238
2250
  conversationId: string;
2239
2251
  durableRecovery?: boolean;
2240
2252
  flowId?: string;
2241
- identityProof: string;
2253
+ identityProof: string | {
2254
+ provider: string;
2255
+ token: string;
2256
+ };
2242
2257
  token: string;
2243
2258
  visitorHistory?: boolean;
2244
2259
  visitorToken?: string;
2245
- };
2260
+ });
2246
2261
  type RuntypeClientInitResponse = {
2247
2262
  app?: {
2248
2263
  id: string;
@@ -3091,10 +3106,32 @@ type AgentWidgetContextMentionTokenRenderContext = {
3091
3106
  ref: AgentWidgetContextMentionRef;
3092
3107
  readonly: boolean;
3093
3108
  };
3109
+ /** One earlier client-tool call replayed to the model, in `/v1/dispatch` shape. */
3110
+ type AgentWidgetReplayedToolCall = {
3111
+ toolCallId: string;
3112
+ /** Model-facing (sanitized) name, e.g. `webmcp_search`. */
3113
+ toolName: string;
3114
+ args: Record<string, unknown>;
3115
+ };
3116
+ /** The browser's answer to an {@link AgentWidgetReplayedToolCall}. */
3117
+ type AgentWidgetReplayedToolResult = {
3118
+ toolCallId: string;
3119
+ toolName: string;
3120
+ result: unknown;
3121
+ };
3122
+ /**
3123
+ * A message in the proxy/agent request payload. Earlier client-tool calls the
3124
+ * browser answered replay as an assistant message carrying `toolCalls`,
3125
+ * followed by a `tool` message carrying the matching `toolResults`; both have
3126
+ * empty `content`. Client-token mode never sends them: the server replays
3127
+ * from its own stored transcript there.
3128
+ */
3094
3129
  type AgentWidgetRequestPayloadMessage = {
3095
- role: AgentWidgetMessageRole;
3130
+ role: AgentWidgetMessageRole | "tool";
3096
3131
  content: MessageContent;
3097
3132
  createdAt: string;
3133
+ toolCalls?: AgentWidgetReplayedToolCall[];
3134
+ toolResults?: AgentWidgetReplayedToolResult[];
3098
3135
  };
3099
3136
  type AgentWidgetRequestPayload = {
3100
3137
  messages: AgentWidgetRequestPayloadMessage[];
@@ -3511,6 +3548,24 @@ type AgentMessageMetadata = {
3511
3548
  * never re-resume the call.
3512
3549
  */
3513
3550
  suggestRepliesResolved?: boolean;
3551
+ /**
3552
+ * The client-tool answer the server accepted through `/resume`, kept so
3553
+ * later proxy/agent turns can replay the call and its result to the model.
3554
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
3555
+ * built-in). Set only after the resume succeeds; preserved across
3556
+ * re-emissions of the tool message.
3557
+ */
3558
+ clientToolAnswer?: {
3559
+ toolCallId: string;
3560
+ toolName: string;
3561
+ args: unknown;
3562
+ result: unknown;
3563
+ /**
3564
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
3565
+ * turn's parallel calls; a chained call gets a new batch.
3566
+ */
3567
+ batch?: string;
3568
+ };
3514
3569
  };
3515
3570
  type AgentWidgetRequestMiddlewareContext = {
3516
3571
  payload: AgentWidgetRequestPayload;