@tanstack/ai-preact 0.11.1 → 0.12.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.
package/README.md CHANGED
@@ -1,5 +1,19 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/TanStack/ai/main/media/header_ai.png" alt="TanStack AI" />
2
+ <picture>
3
+ <source
4
+ media="(prefers-color-scheme: dark)"
5
+ srcset="https://tanstack.com/api/readme/ai.png?framework=preact&theme=dark"
6
+ />
7
+ <source
8
+ media="(prefers-color-scheme: light)"
9
+ srcset="https://tanstack.com/api/readme/ai.png?framework=preact"
10
+ />
11
+ <img
12
+ src="https://tanstack.com/api/readme/ai.png?framework=preact"
13
+ alt="TanStack Preact AI"
14
+ width="900"
15
+ />
16
+ </picture>
3
17
  </div>
4
18
 
5
19
  <br />
@@ -2,4 +2,4 @@ export { useChat } from './use-chat.js';
2
2
  export { useMcpAppBridge } from './use-mcp-app-bridge.js';
3
3
  export type { UseMcpAppBridgeOptions } from './use-mcp-app-bridge.js';
4
4
  export type { UseChatOptions, UseChatReturn, UIMessage, ChatRequestBody, QueuedMessage, SendMessageOptions, WhenBusy, QueueConfig, QueueStrategy, QueueOption, } from './types.js';
5
- export { fetchServerSentEvents, fetchHttpStream, xhrServerSentEvents, xhrHttpStream, stream, rpcStream, createChatClientOptions, createMcpAppBridge, type McpAppBridge, type CreateMcpAppBridgeOptions, type ConnectionAdapter, type ConnectConnectionAdapter, type SubscribeConnectionAdapter, type RunAgentInputContext, type FetchConnectionOptions, type XhrConnectionOptions, type InferChatMessages, } from '@tanstack/ai-client';
5
+ export { fetchServerSentEvents, localStoragePersistence, sessionStoragePersistence, indexedDBPersistence, StorageUnavailableError, type ChatClientPersistence, type ChatPersistedState, type ChatPersistenceOption, type ChatStorageAdapter, type WebStoragePersistenceOptions, type IndexedDBPersistenceOptions, fetchHttpStream, xhrServerSentEvents, xhrHttpStream, stream, rpcStream, createChatClientOptions, createMcpAppBridge, type McpAppBridge, type CreateMcpAppBridgeOptions, type ConnectionAdapter, type ConnectConnectionAdapter, type SubscribeConnectionAdapter, type RunAgentInputContext, type FetchConnectionOptions, type XhrConnectionOptions, type InferChatMessages, } from '@tanstack/ai-client';
package/dist/esm/index.js CHANGED
@@ -1,16 +1,4 @@
1
1
  import { useChat } from "./use-chat.js";
2
2
  import { useMcpAppBridge } from "./use-mcp-app-bridge.js";
3
- import { createChatClientOptions, createMcpAppBridge, fetchHttpStream, fetchServerSentEvents, rpcStream, stream, xhrHttpStream, xhrServerSentEvents } from "@tanstack/ai-client";
4
- export {
5
- createChatClientOptions,
6
- createMcpAppBridge,
7
- fetchHttpStream,
8
- fetchServerSentEvents,
9
- rpcStream,
10
- stream,
11
- useChat,
12
- useMcpAppBridge,
13
- xhrHttpStream,
14
- xhrServerSentEvents
15
- };
16
- //# sourceMappingURL=index.js.map
3
+ import { StorageUnavailableError, createChatClientOptions, createMcpAppBridge, fetchHttpStream, fetchServerSentEvents, indexedDBPersistence, localStoragePersistence, rpcStream, sessionStoragePersistence, stream, xhrHttpStream, xhrServerSentEvents } from "@tanstack/ai-client";
4
+ export { StorageUnavailableError, createChatClientOptions, createMcpAppBridge, fetchHttpStream, fetchServerSentEvents, indexedDBPersistence, localStoragePersistence, rpcStream, sessionStoragePersistence, stream, useChat, useMcpAppBridge, xhrHttpStream, xhrServerSentEvents };
@@ -1,52 +1,73 @@
1
- import { jsx } from "preact/jsx-runtime";
2
1
  import { AppRenderer } from "@mcp-ui/client";
2
+ import { jsx } from "preact/jsx-runtime";
3
+ //#region src/mcp-apps.tsx
4
+ /**
5
+ * MCPAppResource — Preact wrapper for rendering MCP App UI resources.
6
+ *
7
+ * PREACT/COMPAT NOTE:
8
+ * `@mcp-ui/client@7.1.1` is published React-only: `AppRenderer` is a React
9
+ * `forwardRef` component. There is NO dedicated preact entry point and NO web
10
+ * component variant. This wrapper imports `{ AppRenderer }` from
11
+ * `'@mcp-ui/client'` identically to the React wrapper and relies on the
12
+ * *consumer's* `preact/compat` alias (resolving `react` / `react-dom` to
13
+ * `preact/compat`) to render the React component under Preact.
14
+ * Wiring up that alias is the consumer's responsibility and is NOT
15
+ * runtime-verified in this repository.
16
+ */
3
17
  function isRecord(value) {
4
- return typeof value === "object" && value !== null && !Array.isArray(value);
18
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5
19
  }
20
+ /**
21
+ * Coalesce an arbitrary bridge result into the `string` required by the
22
+ * `CallToolResult` text content block. `JSON.stringify` is typed to return
23
+ * `string` but actually returns `undefined` for inputs like `undefined` or a
24
+ * function, so we narrow explicitly to avoid `text: undefined`.
25
+ */
6
26
  function resultToText(result) {
7
- if (typeof result === "string") return result;
8
- const stringify = JSON.stringify;
9
- return stringify(result) ?? "null";
27
+ if (typeof result === "string") return result;
28
+ const stringify = JSON.stringify;
29
+ return stringify(result) ?? "null";
10
30
  }
31
+ /**
32
+ * Renders an MCP App UI resource inside a sandboxed iframe.
33
+ *
34
+ * Wraps `@mcp-ui/client`'s `AppRenderer` and wires its callbacks to a
35
+ * framework-agnostic {@link McpAppBridge}.
36
+ */
11
37
  function MCPAppResource(props) {
12
- const { part, bridge, sandbox, toolInput } = props;
13
- const onCallTool = bridge ? async (params) => {
14
- const result = await bridge.callTool({
15
- serverId: part.serverId,
16
- toolName: params.name,
17
- args: params.arguments
18
- });
19
- return {
20
- content: [
21
- {
22
- type: "text",
23
- text: resultToText(result)
24
- }
25
- ],
26
- structuredContent: isRecord(result) ? result : void 0
27
- };
28
- } : void 0;
29
- const onMessage = bridge ? async (params) => {
30
- const text = params.content.filter((c) => c.type === "text").map((c) => c.text).join("");
31
- if (text) await bridge.sendPrompt(text);
32
- return {};
33
- } : void 0;
34
- const onOpenLink = bridge ? (params) => Promise.resolve(bridge.openLink(params.url)) : void 0;
35
- return /* @__PURE__ */ jsx(
36
- AppRenderer,
37
- {
38
- toolName: part.toolName,
39
- sandbox,
40
- html: part.resource.text,
41
- toolResourceUri: part.resource.uri,
42
- toolInput,
43
- onCallTool,
44
- onMessage,
45
- onOpenLink
46
- }
47
- );
38
+ const { part, bridge, sandbox, toolInput } = props;
39
+ const onCallTool = bridge ? async (params) => {
40
+ const result = await bridge.callTool({
41
+ serverId: part.serverId,
42
+ toolName: params.name,
43
+ args: params.arguments
44
+ });
45
+ return {
46
+ content: [{
47
+ type: "text",
48
+ text: resultToText(result)
49
+ }],
50
+ structuredContent: isRecord(result) ? result : void 0
51
+ };
52
+ } : void 0;
53
+ const onMessage = bridge ? async (params) => {
54
+ const text = params.content.filter((c) => c.type === "text").map((c) => c.text).join("");
55
+ if (text) await bridge.sendPrompt(text);
56
+ return {};
57
+ } : void 0;
58
+ const onOpenLink = bridge ? (params) => Promise.resolve(bridge.openLink(params.url)) : void 0;
59
+ return /* @__PURE__ */ jsx(AppRenderer, {
60
+ toolName: part.toolName,
61
+ sandbox,
62
+ html: part.resource.text,
63
+ toolResourceUri: part.resource.uri,
64
+ toolInput,
65
+ onCallTool,
66
+ onMessage,
67
+ onOpenLink
68
+ });
48
69
  }
49
- export {
50
- MCPAppResource
51
- };
52
- //# sourceMappingURL=mcp-apps.js.map
70
+ //#endregion
71
+ export { MCPAppResource };
72
+
73
+ //# sourceMappingURL=mcp-apps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-apps.js","sources":["../../src/mcp-apps.tsx"],"sourcesContent":["/**\n * MCPAppResource — Preact wrapper for rendering MCP App UI resources.\n *\n * PREACT/COMPAT NOTE:\n * `@mcp-ui/client@7.1.1` is published React-only: `AppRenderer` is a React\n * `forwardRef` component. There is NO dedicated preact entry point and NO web\n * component variant. This wrapper imports `{ AppRenderer }` from\n * `'@mcp-ui/client'` identically to the React wrapper and relies on the\n * *consumer's* `preact/compat` alias (resolving `react` / `react-dom` to\n * `preact/compat`) to render the React component under Preact.\n * Wiring up that alias is the consumer's responsibility and is NOT\n * runtime-verified in this repository.\n */\nimport { AppRenderer } from '@mcp-ui/client'\nimport type { AppRendererProps } from '@mcp-ui/client'\nimport type { UIResourcePart } from '@tanstack/ai'\nimport type { McpAppBridge } from '@tanstack/ai-client'\n\nexport interface MCPAppResourceProps {\n /** The ui-resource part from a UIMessage assistant part. */\n part: UIResourcePart\n /**\n * Framework-agnostic bridge for tool calls, prompt sending, and link opening.\n * Omit it to render the widget in display-only mode — iframe interactions\n * that would trigger tool calls or prompts are ignored.\n */\n bridge?: McpAppBridge\n /** Sandbox iframe configuration — must include the proxy page URL. */\n sandbox: { url: URL }\n /** Optional structured arguments forwarded to the guest UI once it's ready. */\n toolInput?: Record<string, unknown>\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Coalesce an arbitrary bridge result into the `string` required by the\n * `CallToolResult` text content block. `JSON.stringify` is typed to return\n * `string` but actually returns `undefined` for inputs like `undefined` or a\n * function, so we narrow explicitly to avoid `text: undefined`.\n */\nfunction resultToText(result: unknown): string {\n if (typeof result === 'string') return result\n // `JSON.stringify`'s lib signature claims `string`, but it returns\n // `undefined` for `undefined`/function inputs; type the call honestly.\n const stringify: (value: unknown) => string | undefined = JSON.stringify\n return stringify(result) ?? 'null'\n}\n\n/**\n * Renders an MCP App UI resource inside a sandboxed iframe.\n *\n * Wraps `@mcp-ui/client`'s `AppRenderer` and wires its callbacks to a\n * framework-agnostic {@link McpAppBridge}.\n */\nexport function MCPAppResource(props: MCPAppResourceProps) {\n const { part, bridge, sandbox, toolInput } = props\n\n const onCallTool: AppRendererProps['onCallTool'] = bridge\n ? async (params) => {\n const result = await bridge.callTool({\n serverId: part.serverId,\n toolName: params.name,\n args: params.arguments,\n })\n\n return {\n content: [\n {\n type: 'text' as const,\n text: resultToText(result),\n },\n ],\n structuredContent: isRecord(result) ? result : undefined,\n }\n }\n : undefined\n\n const onMessage: AppRendererProps['onMessage'] = bridge\n ? async (params) => {\n const text = params.content\n .filter((c): c is { type: 'text'; text: string } => c.type === 'text')\n .map((c) => c.text)\n .join('')\n if (text) await bridge.sendPrompt(text)\n return {}\n }\n : undefined\n\n const onOpenLink: AppRendererProps['onOpenLink'] = bridge\n ? (params) => Promise.resolve(bridge.openLink(params.url))\n : undefined\n\n return (\n <AppRenderer\n toolName={part.toolName}\n sandbox={sandbox}\n html={part.resource.text}\n toolResourceUri={part.resource.uri}\n toolInput={toolInput}\n onCallTool={onCallTool}\n onMessage={onMessage}\n onOpenLink={onOpenLink}\n />\n )\n}\n"],"names":[],"mappings":";;AAiCA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAQA,SAAS,aAAa,QAAyB;AAC7C,MAAI,OAAO,WAAW,SAAU,QAAO;AAGvC,QAAM,YAAoD,KAAK;AAC/D,SAAO,UAAU,MAAM,KAAK;AAC9B;AAQO,SAAS,eAAe,OAA4B;AACzD,QAAM,EAAE,MAAM,QAAQ,SAAS,cAAc;AAE7C,QAAM,aAA6C,SAC/C,OAAO,WAAW;AAChB,UAAM,SAAS,MAAM,OAAO,SAAS;AAAA,MACnC,UAAU,KAAK;AAAA,MACf,UAAU,OAAO;AAAA,MACjB,MAAM,OAAO;AAAA,IAAA,CACd;AAED,WAAO;AAAA,MACL,SAAS;AAAA,QACP;AAAA,UACE,MAAM;AAAA,UACN,MAAM,aAAa,MAAM;AAAA,QAAA;AAAA,MAC3B;AAAA,MAEF,mBAAmB,SAAS,MAAM,IAAI,SAAS;AAAA,IAAA;AAAA,EAEnD,IACA;AAEJ,QAAM,YAA2C,SAC7C,OAAO,WAAW;AAChB,UAAM,OAAO,OAAO,QACjB,OAAO,CAAC,MAA2C,EAAE,SAAS,MAAM,EACpE,IAAI,CAAC,MAAM,EAAE,IAAI,EACjB,KAAK,EAAE;AACV,QAAI,KAAM,OAAM,OAAO,WAAW,IAAI;AACtC,WAAO,CAAA;AAAA,EACT,IACA;AAEJ,QAAM,aAA6C,SAC/C,CAAC,WAAW,QAAQ,QAAQ,OAAO,SAAS,OAAO,GAAG,CAAC,IACvD;AAEJ,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAU,KAAK;AAAA,MACf;AAAA,MACA,MAAM,KAAK,SAAS;AAAA,MACpB,iBAAiB,KAAK,SAAS;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"mcp-apps.js","names":[],"sources":["../../src/mcp-apps.tsx"],"sourcesContent":["/**\n * MCPAppResource — Preact wrapper for rendering MCP App UI resources.\n *\n * PREACT/COMPAT NOTE:\n * `@mcp-ui/client@7.1.1` is published React-only: `AppRenderer` is a React\n * `forwardRef` component. There is NO dedicated preact entry point and NO web\n * component variant. This wrapper imports `{ AppRenderer }` from\n * `'@mcp-ui/client'` identically to the React wrapper and relies on the\n * *consumer's* `preact/compat` alias (resolving `react` / `react-dom` to\n * `preact/compat`) to render the React component under Preact.\n * Wiring up that alias is the consumer's responsibility and is NOT\n * runtime-verified in this repository.\n */\nimport { AppRenderer } from '@mcp-ui/client'\nimport type { AppRendererProps } from '@mcp-ui/client'\nimport type { UIResourcePart } from '@tanstack/ai'\nimport type { McpAppBridge } from '@tanstack/ai-client'\n\nexport interface MCPAppResourceProps {\n /** The ui-resource part from a UIMessage assistant part. */\n part: UIResourcePart\n /**\n * Framework-agnostic bridge for tool calls, prompt sending, and link opening.\n * Omit it to render the widget in display-only mode — iframe interactions\n * that would trigger tool calls or prompts are ignored.\n */\n bridge?: McpAppBridge\n /** Sandbox iframe configuration — must include the proxy page URL. */\n sandbox: { url: URL }\n /** Optional structured arguments forwarded to the guest UI once it's ready. */\n toolInput?: Record<string, unknown>\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Coalesce an arbitrary bridge result into the `string` required by the\n * `CallToolResult` text content block. `JSON.stringify` is typed to return\n * `string` but actually returns `undefined` for inputs like `undefined` or a\n * function, so we narrow explicitly to avoid `text: undefined`.\n */\nfunction resultToText(result: unknown): string {\n if (typeof result === 'string') return result\n // `JSON.stringify`'s lib signature claims `string`, but it returns\n // `undefined` for `undefined`/function inputs; type the call honestly.\n const stringify: (value: unknown) => string | undefined = JSON.stringify\n return stringify(result) ?? 'null'\n}\n\n/**\n * Renders an MCP App UI resource inside a sandboxed iframe.\n *\n * Wraps `@mcp-ui/client`'s `AppRenderer` and wires its callbacks to a\n * framework-agnostic {@link McpAppBridge}.\n */\nexport function MCPAppResource(props: MCPAppResourceProps) {\n const { part, bridge, sandbox, toolInput } = props\n\n const onCallTool: AppRendererProps['onCallTool'] = bridge\n ? async (params) => {\n const result = await bridge.callTool({\n serverId: part.serverId,\n toolName: params.name,\n args: params.arguments,\n })\n\n return {\n content: [\n {\n type: 'text' as const,\n text: resultToText(result),\n },\n ],\n structuredContent: isRecord(result) ? result : undefined,\n }\n }\n : undefined\n\n const onMessage: AppRendererProps['onMessage'] = bridge\n ? async (params) => {\n const text = params.content\n .filter((c): c is { type: 'text'; text: string } => c.type === 'text')\n .map((c) => c.text)\n .join('')\n if (text) await bridge.sendPrompt(text)\n return {}\n }\n : undefined\n\n const onOpenLink: AppRendererProps['onOpenLink'] = bridge\n ? (params) => Promise.resolve(bridge.openLink(params.url))\n : undefined\n\n return (\n <AppRenderer\n toolName={part.toolName}\n sandbox={sandbox}\n html={part.resource.text}\n toolResourceUri={part.resource.uri}\n toolInput={toolInput}\n onCallTool={onCallTool}\n onMessage={onMessage}\n onOpenLink={onOpenLink}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;;;AAQA,SAAS,aAAa,QAAyB;CAC7C,IAAI,OAAO,WAAW,UAAU,OAAO;CAGvC,MAAM,YAAoD,KAAK;CAC/D,OAAO,UAAU,MAAM,KAAK;AAC9B;;;;;;;AAQA,SAAgB,eAAe,OAA4B;CACzD,MAAM,EAAE,MAAM,QAAQ,SAAS,cAAc;CAE7C,MAAM,aAA6C,SAC/C,OAAO,WAAW;EAChB,MAAM,SAAS,MAAM,OAAO,SAAS;GACnC,UAAU,KAAK;GACf,UAAU,OAAO;GACjB,MAAM,OAAO;EACf,CAAC;EAED,OAAO;GACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,aAAa,MAAM;GAC3B,CACF;GACA,mBAAmB,SAAS,MAAM,IAAI,SAAS,KAAA;EACjD;CACF,IACA,KAAA;CAEJ,MAAM,YAA2C,SAC7C,OAAO,WAAW;EAChB,MAAM,OAAO,OAAO,QACjB,QAAQ,MAA2C,EAAE,SAAS,MAAM,CAAC,CACrE,KAAK,MAAM,EAAE,IAAI,CAAC,CAClB,KAAK,EAAE;EACV,IAAI,MAAM,MAAM,OAAO,WAAW,IAAI;EACtC,OAAO,CAAC;CACV,IACA,KAAA;CAEJ,MAAM,aAA6C,UAC9C,WAAW,QAAQ,QAAQ,OAAO,SAAS,OAAO,GAAG,CAAC,IACvD,KAAA;CAEJ,OACE,oBAAC,aAAD;EACE,UAAU,KAAK;EACN;EACT,MAAM,KAAK,SAAS;EACpB,iBAAiB,KAAK,SAAS;EACpB;EACC;EACD;EACC;CACb,CAAA;AAEL"}
@@ -1,5 +1,5 @@
1
- import { AnyClientTool, ModelMessage, SchemaInput } from '@tanstack/ai';
2
- import { AIDevtoolsDisplayOptions, ChatClientOptions, ChatClientState, ChatRequestBody, ClientContextOptionFromTools, ConnectionStatus, DistributedOmit, InferredClientContext, MultimodalContent, QueueConfig, QueueOption, QueueStrategy, QueuedMessage, SendMessageOptions, UIMessage, WhenBusy } from '@tanstack/ai-client';
1
+ import { AnyClientTool, ModelMessage, RunAgentResumeItem, SchemaInput } from '@tanstack/ai';
2
+ import { AIDevtoolsDisplayOptions, BoundInterrupts, ChatClientOptions, ChatClientState, ChatInterrupt, ChatInterruptState, ChatRequestBody, ChatResumeState, ClientContextOptionFromTools, ConnectionStatus, DistributedOmit, InferredClientContext, MultimodalContent, QueueConfig, QueueOption, QueueStrategy, QueuedMessage, SendMessageOptions, UIMessage, WhenBusy } from '@tanstack/ai-client';
3
3
  export type { ChatRequestBody, MultimodalContent, QueueConfig, QueuedMessage, QueueOption, QueueStrategy, SendMessageOptions, UIMessage, WhenBusy, };
4
4
  /**
5
5
  * Options for the useChat hook.
@@ -17,7 +17,7 @@ export type { ChatRequestBody, MultimodalContent, QueueConfig, QueuedMessage, Qu
17
17
  * Note: Connection and body changes will recreate the ChatClient instance.
18
18
  * To update these options, remount the component or use a key prop.
19
19
  */
20
- export type UseChatOptions<TTools extends ReadonlyArray<AnyClientTool> = any, TContext = InferredClientContext<TTools>> = DistributedOmit<ChatClientOptions<TTools, TContext>, 'onMessagesChange' | 'onLoadingChange' | 'onErrorChange' | 'onStatusChange' | 'onSubscriptionChange' | 'onConnectionStatusChange' | 'onSessionGeneratingChange' | 'onQueueChange' | 'context' | 'devtools'> & {
20
+ export type UseChatOptions<TTools extends ReadonlyArray<AnyClientTool> = any, TContext = InferredClientContext<TTools>> = DistributedOmit<ChatClientOptions<TTools, TContext>, 'onMessagesChange' | 'onLoadingChange' | 'onErrorChange' | 'onStatusChange' | 'onSubscriptionChange' | 'onConnectionStatusChange' | 'onSessionGeneratingChange' | 'onQueueChange' | 'onResumeStateChange' | 'onRunIdChange' | 'context' | 'devtools' | 'id'> & {
21
21
  live?: boolean;
22
22
  /** Display options for TanStack AI Devtools. */
23
23
  devtools?: AIDevtoolsDisplayOptions;
@@ -68,6 +68,32 @@ export interface UseChatReturn<TTools extends ReadonlyArray<AnyClientTool> = any
68
68
  id: string;
69
69
  approved: boolean;
70
70
  }) => Promise<void>;
71
+ /**
72
+ * The id of the run this client has in flight — one it started or rejoined —
73
+ * or `null` when there is none (including while a run sits paused on an
74
+ * interrupt, waiting on approval).
75
+ *
76
+ * A run is one turn of the conversation, so this changes from turn to turn. A
77
+ * whole tool loop stays inside one run, while resuming after an interrupt
78
+ * continues the turn under a new id — so one user message can produce several
79
+ * run ids. Use it to talk to your own server about that run (cancel it, poll
80
+ * it, correlate a log line).
81
+ */
82
+ runId: string | null;
83
+ interrupts: BoundInterrupts<TTools>;
84
+ /** @deprecated Use `interrupts`. */
85
+ pendingInterrupts: BoundInterrupts<TTools>;
86
+ interruptErrors: ChatInterruptState<TTools>['interruptErrors'];
87
+ resuming: boolean;
88
+ resolveInterrupts: {
89
+ (approved: boolean): void;
90
+ (resolver: (interrupt: ChatInterrupt<TTools>) => undefined): void;
91
+ };
92
+ cancelInterrupts: () => void;
93
+ retryInterrupts: () => void;
94
+ resumeInterruptsUnsafe: (resume: Array<RunAgentResumeItem>, state?: ChatResumeState) => Promise<boolean>;
95
+ /** @deprecated Use bound interrupt methods or `resumeInterruptsUnsafe`. */
96
+ resumeInterrupts: (resume: Array<RunAgentResumeItem>, state?: ChatResumeState) => Promise<boolean>;
71
97
  /**
72
98
  * Reload the last assistant message
73
99
  */