@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
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-9Vxm-PPz.cjs';
1
+ import { S as StreamAnimationPlugin } from './types-CI7OckWI.cjs';
2
2
 
3
3
  declare const glyphCycle: StreamAnimationPlugin;
4
4
 
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-9Vxm-PPz.js';
1
+ import { S as StreamAnimationPlugin } from './types-CI7OckWI.js';
2
2
 
3
3
  declare const glyphCycle: StreamAnimationPlugin;
4
4
 
@@ -69,6 +69,7 @@ type RuntypeExecutionStreamEvent = ({
69
69
  turnIndex?: number;
70
70
  type: "turn_start";
71
71
  }) | ({
72
+ attributes?: Record<string, string | number | boolean>;
72
73
  completedAt?: string;
73
74
  content?: string;
74
75
  cost?: number;
@@ -127,7 +128,8 @@ type RuntypeExecutionStreamEvent = ({
127
128
  };
128
129
  turnId?: string;
129
130
  type: "model_call_start";
130
- } | {
131
+ } | ({
132
+ attributes?: Record<string, string | number | boolean>;
131
133
  completedAt?: string;
132
134
  cost?: number;
133
135
  durationMs?: number;
@@ -151,10 +153,11 @@ type RuntypeExecutionStreamEvent = ({
151
153
  cacheWrite?: number;
152
154
  input: number;
153
155
  output: number;
156
+ reasoning?: number;
154
157
  };
155
158
  turnId?: string;
156
159
  type: "model_call_complete";
157
- } | {
160
+ }) | {
158
161
  executionId: string;
159
162
  id: string;
160
163
  index?: number;
@@ -677,6 +680,24 @@ type AgentMessageMetadata = {
677
680
  * never re-resume the call.
678
681
  */
679
682
  suggestRepliesResolved?: boolean;
683
+ /**
684
+ * The client-tool answer the server accepted through `/resume`, kept so
685
+ * later proxy/agent turns can replay the call and its result to the model.
686
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
687
+ * built-in). Set only after the resume succeeds; preserved across
688
+ * re-emissions of the tool message.
689
+ */
690
+ clientToolAnswer?: {
691
+ toolCallId: string;
692
+ toolName: string;
693
+ args: unknown;
694
+ result: unknown;
695
+ /**
696
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
697
+ * turn's parallel calls; a chained call gets a new batch.
698
+ */
699
+ batch?: string;
700
+ };
680
701
  };
681
702
  /**
682
703
  * Context passed to plugin lifecycle hooks. Carries the live DOM references
@@ -69,6 +69,7 @@ type RuntypeExecutionStreamEvent = ({
69
69
  turnIndex?: number;
70
70
  type: "turn_start";
71
71
  }) | ({
72
+ attributes?: Record<string, string | number | boolean>;
72
73
  completedAt?: string;
73
74
  content?: string;
74
75
  cost?: number;
@@ -127,7 +128,8 @@ type RuntypeExecutionStreamEvent = ({
127
128
  };
128
129
  turnId?: string;
129
130
  type: "model_call_start";
130
- } | {
131
+ } | ({
132
+ attributes?: Record<string, string | number | boolean>;
131
133
  completedAt?: string;
132
134
  cost?: number;
133
135
  durationMs?: number;
@@ -151,10 +153,11 @@ type RuntypeExecutionStreamEvent = ({
151
153
  cacheWrite?: number;
152
154
  input: number;
153
155
  output: number;
156
+ reasoning?: number;
154
157
  };
155
158
  turnId?: string;
156
159
  type: "model_call_complete";
157
- } | {
160
+ }) | {
158
161
  executionId: string;
159
162
  id: string;
160
163
  index?: number;
@@ -677,6 +680,24 @@ type AgentMessageMetadata = {
677
680
  * never re-resume the call.
678
681
  */
679
682
  suggestRepliesResolved?: boolean;
683
+ /**
684
+ * The client-tool answer the server accepted through `/resume`, kept so
685
+ * later proxy/agent turns can replay the call and its result to the model.
686
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
687
+ * built-in). Set only after the resume succeeds; preserved across
688
+ * re-emissions of the tool message.
689
+ */
690
+ clientToolAnswer?: {
691
+ toolCallId: string;
692
+ toolName: string;
693
+ args: unknown;
694
+ result: unknown;
695
+ /**
696
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
697
+ * turn's parallel calls; a chained call gets a new batch.
698
+ */
699
+ batch?: string;
700
+ };
680
701
  };
681
702
  /**
682
703
  * Context passed to plugin lifecycle hooks. Carries the live DOM references
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-9Vxm-PPz.cjs';
1
+ import { S as StreamAnimationPlugin } from './types-CI7OckWI.cjs';
2
2
 
3
3
  declare const wipe: StreamAnimationPlugin;
4
4
 
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-9Vxm-PPz.js';
1
+ import { S as StreamAnimationPlugin } from './types-CI7OckWI.js';
2
2
 
3
3
  declare const wipe: StreamAnimationPlugin;
4
4
 
@@ -69,6 +69,7 @@ type RuntypeExecutionStreamEvent = ({
69
69
  turnIndex?: number;
70
70
  type: "turn_start";
71
71
  }) | ({
72
+ attributes?: Record<string, string | number | boolean>;
72
73
  completedAt?: string;
73
74
  content?: string;
74
75
  cost?: number;
@@ -127,7 +128,8 @@ type RuntypeExecutionStreamEvent = ({
127
128
  };
128
129
  turnId?: string;
129
130
  type: "model_call_start";
130
- } | {
131
+ } | ({
132
+ attributes?: Record<string, string | number | boolean>;
131
133
  completedAt?: string;
132
134
  cost?: number;
133
135
  durationMs?: number;
@@ -151,10 +153,11 @@ type RuntypeExecutionStreamEvent = ({
151
153
  cacheWrite?: number;
152
154
  input: number;
153
155
  output: number;
156
+ reasoning?: number;
154
157
  };
155
158
  turnId?: string;
156
159
  type: "model_call_complete";
157
- } | {
160
+ }) | {
158
161
  executionId: string;
159
162
  id: string;
160
163
  index?: number;
@@ -677,6 +680,24 @@ type AgentMessageMetadata = {
677
680
  * never re-resume the call.
678
681
  */
679
682
  suggestRepliesResolved?: boolean;
683
+ /**
684
+ * The client-tool answer the server accepted through `/resume`, kept so
685
+ * later proxy/agent turns can replay the call and its result to the model.
686
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
687
+ * built-in). Set only after the resume succeeds; preserved across
688
+ * re-emissions of the tool message.
689
+ */
690
+ clientToolAnswer?: {
691
+ toolCallId: string;
692
+ toolName: string;
693
+ args: unknown;
694
+ result: unknown;
695
+ /**
696
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
697
+ * turn's parallel calls; a chained call gets a new batch.
698
+ */
699
+ batch?: string;
700
+ };
680
701
  };
681
702
  /**
682
703
  * Context passed to plugin lifecycle hooks. Carries the live DOM references
@@ -69,6 +69,7 @@ type RuntypeExecutionStreamEvent = ({
69
69
  turnIndex?: number;
70
70
  type: "turn_start";
71
71
  }) | ({
72
+ attributes?: Record<string, string | number | boolean>;
72
73
  completedAt?: string;
73
74
  content?: string;
74
75
  cost?: number;
@@ -127,7 +128,8 @@ type RuntypeExecutionStreamEvent = ({
127
128
  };
128
129
  turnId?: string;
129
130
  type: "model_call_start";
130
- } | {
131
+ } | ({
132
+ attributes?: Record<string, string | number | boolean>;
131
133
  completedAt?: string;
132
134
  cost?: number;
133
135
  durationMs?: number;
@@ -151,10 +153,11 @@ type RuntypeExecutionStreamEvent = ({
151
153
  cacheWrite?: number;
152
154
  input: number;
153
155
  output: number;
156
+ reasoning?: number;
154
157
  };
155
158
  turnId?: string;
156
159
  type: "model_call_complete";
157
- } | {
160
+ }) | {
158
161
  executionId: string;
159
162
  id: string;
160
163
  index?: number;
@@ -677,6 +680,24 @@ type AgentMessageMetadata = {
677
680
  * never re-resume the call.
678
681
  */
679
682
  suggestRepliesResolved?: boolean;
683
+ /**
684
+ * The client-tool answer the server accepted through `/resume`, kept so
685
+ * later proxy/agent turns can replay the call and its result to the model.
686
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
687
+ * built-in). Set only after the resume succeeds; preserved across
688
+ * re-emissions of the tool message.
689
+ */
690
+ clientToolAnswer?: {
691
+ toolCallId: string;
692
+ toolName: string;
693
+ args: unknown;
694
+ result: unknown;
695
+ /**
696
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
697
+ * turn's parallel calls; a chained call gets a new batch.
698
+ */
699
+ batch?: string;
700
+ };
680
701
  };
681
702
  /**
682
703
  * Context passed to plugin lifecycle hooks. Carries the live DOM references
@@ -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;
@@ -1704,6 +1704,7 @@ type RuntypeExecutionStreamEvent = ({
1704
1704
  turnIndex?: number;
1705
1705
  type: "turn_start";
1706
1706
  }) | ({
1707
+ attributes?: Record<string, string | number | boolean>;
1707
1708
  completedAt?: string;
1708
1709
  content?: string;
1709
1710
  cost?: number;
@@ -1762,7 +1763,8 @@ type RuntypeExecutionStreamEvent = ({
1762
1763
  };
1763
1764
  turnId?: string;
1764
1765
  type: "model_call_start";
1765
- } | {
1766
+ } | ({
1767
+ attributes?: Record<string, string | number | boolean>;
1766
1768
  completedAt?: string;
1767
1769
  cost?: number;
1768
1770
  durationMs?: number;
@@ -1786,10 +1788,11 @@ type RuntypeExecutionStreamEvent = ({
1786
1788
  cacheWrite?: number;
1787
1789
  input: number;
1788
1790
  output: number;
1791
+ reasoning?: number;
1789
1792
  };
1790
1793
  turnId?: string;
1791
1794
  type: "model_call_complete";
1792
- } | {
1795
+ }) | {
1793
1796
  executionId: string;
1794
1797
  id: string;
1795
1798
  index?: number;
@@ -2889,10 +2892,32 @@ type AgentWidgetContextMentionTokenRenderContext = {
2889
2892
  ref: AgentWidgetContextMentionRef;
2890
2893
  readonly: boolean;
2891
2894
  };
2895
+ /** One earlier client-tool call replayed to the model, in `/v1/dispatch` shape. */
2896
+ type AgentWidgetReplayedToolCall = {
2897
+ toolCallId: string;
2898
+ /** Model-facing (sanitized) name, e.g. `webmcp_search`. */
2899
+ toolName: string;
2900
+ args: Record<string, unknown>;
2901
+ };
2902
+ /** The browser's answer to an {@link AgentWidgetReplayedToolCall}. */
2903
+ type AgentWidgetReplayedToolResult = {
2904
+ toolCallId: string;
2905
+ toolName: string;
2906
+ result: unknown;
2907
+ };
2908
+ /**
2909
+ * A message in the proxy/agent request payload. Earlier client-tool calls the
2910
+ * browser answered replay as an assistant message carrying `toolCalls`,
2911
+ * followed by a `tool` message carrying the matching `toolResults`; both have
2912
+ * empty `content`. Client-token mode never sends them: the server replays
2913
+ * from its own stored transcript there.
2914
+ */
2892
2915
  type AgentWidgetRequestPayloadMessage = {
2893
- role: AgentWidgetMessageRole;
2916
+ role: AgentWidgetMessageRole | "tool";
2894
2917
  content: MessageContent;
2895
2918
  createdAt: string;
2919
+ toolCalls?: AgentWidgetReplayedToolCall[];
2920
+ toolResults?: AgentWidgetReplayedToolResult[];
2896
2921
  };
2897
2922
  type AgentWidgetRequestPayload = {
2898
2923
  messages: AgentWidgetRequestPayloadMessage[];
@@ -3255,6 +3280,24 @@ type AgentMessageMetadata = {
3255
3280
  * never re-resume the call.
3256
3281
  */
3257
3282
  suggestRepliesResolved?: boolean;
3283
+ /**
3284
+ * The client-tool answer the server accepted through `/resume`, kept so
3285
+ * later proxy/agent turns can replay the call and its result to the model.
3286
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
3287
+ * built-in). Set only after the resume succeeds; preserved across
3288
+ * re-emissions of the tool message.
3289
+ */
3290
+ clientToolAnswer?: {
3291
+ toolCallId: string;
3292
+ toolName: string;
3293
+ args: unknown;
3294
+ result: unknown;
3295
+ /**
3296
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
3297
+ * turn's parallel calls; a chained call gets a new batch.
3298
+ */
3299
+ batch?: string;
3300
+ };
3258
3301
  };
3259
3302
  type AgentWidgetRequestMiddlewareContext = {
3260
3303
  payload: AgentWidgetRequestPayload;
@@ -1704,6 +1704,7 @@ type RuntypeExecutionStreamEvent = ({
1704
1704
  turnIndex?: number;
1705
1705
  type: "turn_start";
1706
1706
  }) | ({
1707
+ attributes?: Record<string, string | number | boolean>;
1707
1708
  completedAt?: string;
1708
1709
  content?: string;
1709
1710
  cost?: number;
@@ -1762,7 +1763,8 @@ type RuntypeExecutionStreamEvent = ({
1762
1763
  };
1763
1764
  turnId?: string;
1764
1765
  type: "model_call_start";
1765
- } | {
1766
+ } | ({
1767
+ attributes?: Record<string, string | number | boolean>;
1766
1768
  completedAt?: string;
1767
1769
  cost?: number;
1768
1770
  durationMs?: number;
@@ -1786,10 +1788,11 @@ type RuntypeExecutionStreamEvent = ({
1786
1788
  cacheWrite?: number;
1787
1789
  input: number;
1788
1790
  output: number;
1791
+ reasoning?: number;
1789
1792
  };
1790
1793
  turnId?: string;
1791
1794
  type: "model_call_complete";
1792
- } | {
1795
+ }) | {
1793
1796
  executionId: string;
1794
1797
  id: string;
1795
1798
  index?: number;
@@ -2889,10 +2892,32 @@ type AgentWidgetContextMentionTokenRenderContext = {
2889
2892
  ref: AgentWidgetContextMentionRef;
2890
2893
  readonly: boolean;
2891
2894
  };
2895
+ /** One earlier client-tool call replayed to the model, in `/v1/dispatch` shape. */
2896
+ type AgentWidgetReplayedToolCall = {
2897
+ toolCallId: string;
2898
+ /** Model-facing (sanitized) name, e.g. `webmcp_search`. */
2899
+ toolName: string;
2900
+ args: Record<string, unknown>;
2901
+ };
2902
+ /** The browser's answer to an {@link AgentWidgetReplayedToolCall}. */
2903
+ type AgentWidgetReplayedToolResult = {
2904
+ toolCallId: string;
2905
+ toolName: string;
2906
+ result: unknown;
2907
+ };
2908
+ /**
2909
+ * A message in the proxy/agent request payload. Earlier client-tool calls the
2910
+ * browser answered replay as an assistant message carrying `toolCalls`,
2911
+ * followed by a `tool` message carrying the matching `toolResults`; both have
2912
+ * empty `content`. Client-token mode never sends them: the server replays
2913
+ * from its own stored transcript there.
2914
+ */
2892
2915
  type AgentWidgetRequestPayloadMessage = {
2893
- role: AgentWidgetMessageRole;
2916
+ role: AgentWidgetMessageRole | "tool";
2894
2917
  content: MessageContent;
2895
2918
  createdAt: string;
2919
+ toolCalls?: AgentWidgetReplayedToolCall[];
2920
+ toolResults?: AgentWidgetReplayedToolResult[];
2896
2921
  };
2897
2922
  type AgentWidgetRequestPayload = {
2898
2923
  messages: AgentWidgetRequestPayloadMessage[];
@@ -3255,6 +3280,24 @@ type AgentMessageMetadata = {
3255
3280
  * never re-resume the call.
3256
3281
  */
3257
3282
  suggestRepliesResolved?: boolean;
3283
+ /**
3284
+ * The client-tool answer the server accepted through `/resume`, kept so
3285
+ * later proxy/agent turns can replay the call and its result to the model.
3286
+ * `toolName` is the widget's internal name (`webmcp:<name>` or a bare
3287
+ * built-in). Set only after the resume succeeds; preserved across
3288
+ * re-emissions of the tool message.
3289
+ */
3290
+ clientToolAnswer?: {
3291
+ toolCallId: string;
3292
+ toolName: string;
3293
+ args: unknown;
3294
+ result: unknown;
3295
+ /**
3296
+ * Shared by the answers posted in one `/resume`, i.e. one assistant
3297
+ * turn's parallel calls; a chained call gets a new batch.
3298
+ */
3299
+ batch?: string;
3300
+ };
3258
3301
  };
3259
3302
  type AgentWidgetRequestMiddlewareContext = {
3260
3303
  payload: AgentWidgetRequestPayload;
package/dist/codegen.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var w=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var R=(e,i)=>{for(var r in i)w(e,r,{get:i[r],enumerable:!0})},W=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of T(i))!M.call(e,a)&&a!==r&&w(e,a,{get:()=>i[a],enumerable:!(s=_(i,a))||s.enumerable});return e};var H=e=>W(w({},"__esModule",{value:!0}),e);var z={};R(z,{generateCodeSnippet:()=>P});module.exports=H(z);var S="4.23.0";var j=S;function $(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${j}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function q(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var A=`({ text, message }: any) => {
1
+ "use strict";var w=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var R=(e,i)=>{for(var r in i)w(e,r,{get:i[r],enumerable:!0})},W=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of T(i))!M.call(e,a)&&a!==r&&w(e,a,{get:()=>i[a],enumerable:!(s=_(i,a))||s.enumerable});return e};var H=e=>W(w({},"__esModule",{value:!0}),e);var z={};R(z,{generateCodeSnippet:()=>P});module.exports=H(z);var S="4.23.2";var j=S;function $(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${j}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function q(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var A=`({ text, message }: any) => {
2
2
  const jsonSource = (message as any).rawContent || text || message.content;
3
3
  if (!jsonSource || typeof jsonSource !== 'string') return null;
4
4
  let cleanJson = jsonSource
package/dist/codegen.js CHANGED
@@ -1,4 +1,4 @@
1
- var x="4.23.0";var S=x;function w(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${S}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function I(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var j=`({ text, message }: any) => {
1
+ var x="4.23.2";var S=x;function w(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${S}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function I(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var j=`({ text, message }: any) => {
2
2
  const jsonSource = (message as any).rawContent || text || message.content;
3
3
  if (!jsonSource || typeof jsonSource !== 'string') return null;
4
4
  let cleanJson = jsonSource