@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;