@runtypelabs/persona 4.23.1 → 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 (47) 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 +41 -41
  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 +26 -26
  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 +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 +48 -48
  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 +31 -31
  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.tool-pair-replay.test.ts +325 -0
  43. package/src/client.ts +32 -31
  44. package/src/generated/runtype-openapi-contract.ts +26 -11
  45. package/src/session.ts +32 -3
  46. package/src/types.ts +43 -1
  47. package/src/utils/tool-pair-replay.ts +100 -0
@@ -1702,6 +1702,7 @@ type RuntypeExecutionStreamEvent = ({
1702
1702
  turnIndex?: number;
1703
1703
  type: "turn_start";
1704
1704
  }) | ({
1705
+ attributes?: Record<string, string | number | boolean>;
1705
1706
  completedAt?: string;
1706
1707
  content?: string;
1707
1708
  cost?: number;
@@ -1760,7 +1761,8 @@ type RuntypeExecutionStreamEvent = ({
1760
1761
  };
1761
1762
  turnId?: string;
1762
1763
  type: "model_call_start";
1763
- } | {
1764
+ } | ({
1765
+ attributes?: Record<string, string | number | boolean>;
1764
1766
  completedAt?: string;
1765
1767
  cost?: number;
1766
1768
  durationMs?: number;
@@ -1784,10 +1786,11 @@ type RuntypeExecutionStreamEvent = ({
1784
1786
  cacheWrite?: number;
1785
1787
  input: number;
1786
1788
  output: number;
1789
+ reasoning?: number;
1787
1790
  };
1788
1791
  turnId?: string;
1789
1792
  type: "model_call_complete";
1790
- } | {
1793
+ }) | {
1791
1794
  executionId: string;
1792
1795
  id: string;
1793
1796
  index?: number;
@@ -2887,10 +2890,32 @@ type AgentWidgetContextMentionTokenRenderContext = {
2887
2890
  ref: AgentWidgetContextMentionRef;
2888
2891
  readonly: boolean;
2889
2892
  };
2893
+ /** One earlier client-tool call replayed to the model, in `/v1/dispatch` shape. */
2894
+ type AgentWidgetReplayedToolCall = {
2895
+ toolCallId: string;
2896
+ /** Model-facing (sanitized) name, e.g. `webmcp_search`. */
2897
+ toolName: string;
2898
+ args: Record<string, unknown>;
2899
+ };
2900
+ /** The browser's answer to an {@link AgentWidgetReplayedToolCall}. */
2901
+ type AgentWidgetReplayedToolResult = {
2902
+ toolCallId: string;
2903
+ toolName: string;
2904
+ result: unknown;
2905
+ };
2906
+ /**
2907
+ * A message in the proxy/agent request payload. Earlier client-tool calls the
2908
+ * browser answered replay as an assistant message carrying `toolCalls`,
2909
+ * followed by a `tool` message carrying the matching `toolResults`; both have
2910
+ * empty `content`. Client-token mode never sends them: the server replays
2911
+ * from its own stored transcript there.
2912
+ */
2890
2913
  type AgentWidgetRequestPayloadMessage = {
2891
- role: AgentWidgetMessageRole;
2914
+ role: AgentWidgetMessageRole | "tool";
2892
2915
  content: MessageContent;
2893
2916
  createdAt: string;
2917
+ toolCalls?: AgentWidgetReplayedToolCall[];
2918
+ toolResults?: AgentWidgetReplayedToolResult[];
2894
2919
  };
2895
2920
  type AgentWidgetRequestPayload = {
2896
2921
  messages: AgentWidgetRequestPayloadMessage[];
@@ -3253,6 +3278,24 @@ type AgentMessageMetadata = {
3253
3278
  * never re-resume the call.
3254
3279
  */
3255
3280
  suggestRepliesResolved?: boolean;
3281
+ /**
3282
+ * The client-tool answer the server accepted through `/resume`, kept so
3283
+ * later proxy/agent turns can replay the call and its result to the model.
3284
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
3285
+ * built-in). Set only after the resume succeeds; preserved across
3286
+ * re-emissions of the tool message.
3287
+ */
3288
+ clientToolAnswer?: {
3289
+ toolCallId: string;
3290
+ toolName: string;
3291
+ args: unknown;
3292
+ result: unknown;
3293
+ /**
3294
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
3295
+ * turn's parallel calls; a chained call gets a new batch.
3296
+ */
3297
+ batch?: string;
3298
+ };
3256
3299
  };
3257
3300
  type AgentWidgetRequestMiddlewareContext = {
3258
3301
  payload: AgentWidgetRequestPayload;
@@ -1702,6 +1702,7 @@ type RuntypeExecutionStreamEvent = ({
1702
1702
  turnIndex?: number;
1703
1703
  type: "turn_start";
1704
1704
  }) | ({
1705
+ attributes?: Record<string, string | number | boolean>;
1705
1706
  completedAt?: string;
1706
1707
  content?: string;
1707
1708
  cost?: number;
@@ -1760,7 +1761,8 @@ type RuntypeExecutionStreamEvent = ({
1760
1761
  };
1761
1762
  turnId?: string;
1762
1763
  type: "model_call_start";
1763
- } | {
1764
+ } | ({
1765
+ attributes?: Record<string, string | number | boolean>;
1764
1766
  completedAt?: string;
1765
1767
  cost?: number;
1766
1768
  durationMs?: number;
@@ -1784,10 +1786,11 @@ type RuntypeExecutionStreamEvent = ({
1784
1786
  cacheWrite?: number;
1785
1787
  input: number;
1786
1788
  output: number;
1789
+ reasoning?: number;
1787
1790
  };
1788
1791
  turnId?: string;
1789
1792
  type: "model_call_complete";
1790
- } | {
1793
+ }) | {
1791
1794
  executionId: string;
1792
1795
  id: string;
1793
1796
  index?: number;
@@ -2887,10 +2890,32 @@ type AgentWidgetContextMentionTokenRenderContext = {
2887
2890
  ref: AgentWidgetContextMentionRef;
2888
2891
  readonly: boolean;
2889
2892
  };
2893
+ /** One earlier client-tool call replayed to the model, in `/v1/dispatch` shape. */
2894
+ type AgentWidgetReplayedToolCall = {
2895
+ toolCallId: string;
2896
+ /** Model-facing (sanitized) name, e.g. `webmcp_search`. */
2897
+ toolName: string;
2898
+ args: Record<string, unknown>;
2899
+ };
2900
+ /** The browser's answer to an {@link AgentWidgetReplayedToolCall}. */
2901
+ type AgentWidgetReplayedToolResult = {
2902
+ toolCallId: string;
2903
+ toolName: string;
2904
+ result: unknown;
2905
+ };
2906
+ /**
2907
+ * A message in the proxy/agent request payload. Earlier client-tool calls the
2908
+ * browser answered replay as an assistant message carrying `toolCalls`,
2909
+ * followed by a `tool` message carrying the matching `toolResults`; both have
2910
+ * empty `content`. Client-token mode never sends them: the server replays
2911
+ * from its own stored transcript there.
2912
+ */
2890
2913
  type AgentWidgetRequestPayloadMessage = {
2891
- role: AgentWidgetMessageRole;
2914
+ role: AgentWidgetMessageRole | "tool";
2892
2915
  content: MessageContent;
2893
2916
  createdAt: string;
2917
+ toolCalls?: AgentWidgetReplayedToolCall[];
2918
+ toolResults?: AgentWidgetReplayedToolResult[];
2894
2919
  };
2895
2920
  type AgentWidgetRequestPayload = {
2896
2921
  messages: AgentWidgetRequestPayloadMessage[];
@@ -3253,6 +3278,24 @@ type AgentMessageMetadata = {
3253
3278
  * never re-resume the call.
3254
3279
  */
3255
3280
  suggestRepliesResolved?: boolean;
3281
+ /**
3282
+ * The client-tool answer the server accepted through `/resume`, kept so
3283
+ * later proxy/agent turns can replay the call and its result to the model.
3284
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
3285
+ * built-in). Set only after the resume succeeds; preserved across
3286
+ * re-emissions of the tool message.
3287
+ */
3288
+ clientToolAnswer?: {
3289
+ toolCallId: string;
3290
+ toolName: string;
3291
+ args: unknown;
3292
+ result: unknown;
3293
+ /**
3294
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
3295
+ * turn's parallel calls; a chained call gets a new batch.
3296
+ */
3297
+ batch?: string;
3298
+ };
3256
3299
  };
3257
3300
  type AgentWidgetRequestMiddlewareContext = {
3258
3301
  payload: AgentWidgetRequestPayload;
@@ -1971,6 +1971,7 @@ type RuntypeExecutionStreamEvent = ({
1971
1971
  turnIndex?: number;
1972
1972
  type: "turn_start";
1973
1973
  }) | ({
1974
+ attributes?: Record<string, string | number | boolean>;
1974
1975
  completedAt?: string;
1975
1976
  content?: string;
1976
1977
  cost?: number;
@@ -2029,7 +2030,8 @@ type RuntypeExecutionStreamEvent = ({
2029
2030
  };
2030
2031
  turnId?: string;
2031
2032
  type: "model_call_start";
2032
- } | {
2033
+ } | ({
2034
+ attributes?: Record<string, string | number | boolean>;
2033
2035
  completedAt?: string;
2034
2036
  cost?: number;
2035
2037
  durationMs?: number;
@@ -2053,10 +2055,11 @@ type RuntypeExecutionStreamEvent = ({
2053
2055
  cacheWrite?: number;
2054
2056
  input: number;
2055
2057
  output: number;
2058
+ reasoning?: number;
2056
2059
  };
2057
2060
  turnId?: string;
2058
2061
  type: "model_call_complete";
2059
- } | {
2062
+ }) | {
2060
2063
  executionId: string;
2061
2064
  id: string;
2062
2065
  index?: number;
@@ -3156,10 +3159,32 @@ type AgentWidgetContextMentionTokenRenderContext = {
3156
3159
  ref: AgentWidgetContextMentionRef;
3157
3160
  readonly: boolean;
3158
3161
  };
3162
+ /** One earlier client-tool call replayed to the model, in `/v1/dispatch` shape. */
3163
+ type AgentWidgetReplayedToolCall = {
3164
+ toolCallId: string;
3165
+ /** Model-facing (sanitized) name, e.g. `webmcp_search`. */
3166
+ toolName: string;
3167
+ args: Record<string, unknown>;
3168
+ };
3169
+ /** The browser's answer to an {@link AgentWidgetReplayedToolCall}. */
3170
+ type AgentWidgetReplayedToolResult = {
3171
+ toolCallId: string;
3172
+ toolName: string;
3173
+ result: unknown;
3174
+ };
3175
+ /**
3176
+ * A message in the proxy/agent request payload. Earlier client-tool calls the
3177
+ * browser answered replay as an assistant message carrying `toolCalls`,
3178
+ * followed by a `tool` message carrying the matching `toolResults`; both have
3179
+ * empty `content`. Client-token mode never sends them: the server replays
3180
+ * from its own stored transcript there.
3181
+ */
3159
3182
  type AgentWidgetRequestPayloadMessage = {
3160
- role: AgentWidgetMessageRole;
3183
+ role: AgentWidgetMessageRole | "tool";
3161
3184
  content: MessageContent;
3162
3185
  createdAt: string;
3186
+ toolCalls?: AgentWidgetReplayedToolCall[];
3187
+ toolResults?: AgentWidgetReplayedToolResult[];
3163
3188
  };
3164
3189
  type AgentWidgetRequestPayload = {
3165
3190
  messages: AgentWidgetRequestPayloadMessage[];
@@ -3522,6 +3547,24 @@ type AgentMessageMetadata = {
3522
3547
  * never re-resume the call.
3523
3548
  */
3524
3549
  suggestRepliesResolved?: boolean;
3550
+ /**
3551
+ * The client-tool answer the server accepted through `/resume`, kept so
3552
+ * later proxy/agent turns can replay the call and its result to the model.
3553
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
3554
+ * built-in). Set only after the resume succeeds; preserved across
3555
+ * re-emissions of the tool message.
3556
+ */
3557
+ clientToolAnswer?: {
3558
+ toolCallId: string;
3559
+ toolName: string;
3560
+ args: unknown;
3561
+ result: unknown;
3562
+ /**
3563
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
3564
+ * turn's parallel calls; a chained call gets a new batch.
3565
+ */
3566
+ batch?: string;
3567
+ };
3525
3568
  };
3526
3569
  type AgentWidgetRequestMiddlewareContext = {
3527
3570
  payload: AgentWidgetRequestPayload;
@@ -1971,6 +1971,7 @@ type RuntypeExecutionStreamEvent = ({
1971
1971
  turnIndex?: number;
1972
1972
  type: "turn_start";
1973
1973
  }) | ({
1974
+ attributes?: Record<string, string | number | boolean>;
1974
1975
  completedAt?: string;
1975
1976
  content?: string;
1976
1977
  cost?: number;
@@ -2029,7 +2030,8 @@ type RuntypeExecutionStreamEvent = ({
2029
2030
  };
2030
2031
  turnId?: string;
2031
2032
  type: "model_call_start";
2032
- } | {
2033
+ } | ({
2034
+ attributes?: Record<string, string | number | boolean>;
2033
2035
  completedAt?: string;
2034
2036
  cost?: number;
2035
2037
  durationMs?: number;
@@ -2053,10 +2055,11 @@ type RuntypeExecutionStreamEvent = ({
2053
2055
  cacheWrite?: number;
2054
2056
  input: number;
2055
2057
  output: number;
2058
+ reasoning?: number;
2056
2059
  };
2057
2060
  turnId?: string;
2058
2061
  type: "model_call_complete";
2059
- } | {
2062
+ }) | {
2060
2063
  executionId: string;
2061
2064
  id: string;
2062
2065
  index?: number;
@@ -3156,10 +3159,32 @@ type AgentWidgetContextMentionTokenRenderContext = {
3156
3159
  ref: AgentWidgetContextMentionRef;
3157
3160
  readonly: boolean;
3158
3161
  };
3162
+ /** One earlier client-tool call replayed to the model, in `/v1/dispatch` shape. */
3163
+ type AgentWidgetReplayedToolCall = {
3164
+ toolCallId: string;
3165
+ /** Model-facing (sanitized) name, e.g. `webmcp_search`. */
3166
+ toolName: string;
3167
+ args: Record<string, unknown>;
3168
+ };
3169
+ /** The browser's answer to an {@link AgentWidgetReplayedToolCall}. */
3170
+ type AgentWidgetReplayedToolResult = {
3171
+ toolCallId: string;
3172
+ toolName: string;
3173
+ result: unknown;
3174
+ };
3175
+ /**
3176
+ * A message in the proxy/agent request payload. Earlier client-tool calls the
3177
+ * browser answered replay as an assistant message carrying `toolCalls`,
3178
+ * followed by a `tool` message carrying the matching `toolResults`; both have
3179
+ * empty `content`. Client-token mode never sends them: the server replays
3180
+ * from its own stored transcript there.
3181
+ */
3159
3182
  type AgentWidgetRequestPayloadMessage = {
3160
- role: AgentWidgetMessageRole;
3183
+ role: AgentWidgetMessageRole | "tool";
3161
3184
  content: MessageContent;
3162
3185
  createdAt: string;
3186
+ toolCalls?: AgentWidgetReplayedToolCall[];
3187
+ toolResults?: AgentWidgetReplayedToolResult[];
3163
3188
  };
3164
3189
  type AgentWidgetRequestPayload = {
3165
3190
  messages: AgentWidgetRequestPayloadMessage[];
@@ -3522,6 +3547,24 @@ type AgentMessageMetadata = {
3522
3547
  * never re-resume the call.
3523
3548
  */
3524
3549
  suggestRepliesResolved?: boolean;
3550
+ /**
3551
+ * The client-tool answer the server accepted through `/resume`, kept so
3552
+ * later proxy/agent turns can replay the call and its result to the model.
3553
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
3554
+ * built-in). Set only after the resume succeeds; preserved across
3555
+ * re-emissions of the tool message.
3556
+ */
3557
+ clientToolAnswer?: {
3558
+ toolCallId: string;
3559
+ toolName: string;
3560
+ args: unknown;
3561
+ result: unknown;
3562
+ /**
3563
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
3564
+ * turn's parallel calls; a chained call gets a new batch.
3565
+ */
3566
+ batch?: string;
3567
+ };
3525
3568
  };
3526
3569
  type AgentWidgetRequestMiddlewareContext = {
3527
3570
  payload: AgentWidgetRequestPayload;