@openai/agents-core 0.13.1 → 0.13.3
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/dist/config.js +4 -6
- package/dist/config.js.map +1 -1
- package/dist/config.mjs +4 -4
- package/dist/config.mjs.map +1 -1
- package/dist/items.d.ts +270 -0
- package/dist/mcp.d.ts +6 -105
- package/dist/mcp.js +23 -170
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +5 -153
- package/dist/mcp.mjs.map +1 -1
- package/dist/mcpShared.d.ts +103 -0
- package/dist/mcpShared.js +137 -0
- package/dist/mcpShared.js.map +1 -0
- package/dist/mcpShared.mjs +127 -0
- package/dist/mcpShared.mjs.map +1 -0
- package/dist/mcpToolCache.d.ts +9 -0
- package/dist/mcpToolCache.js +28 -0
- package/dist/mcpToolCache.js.map +1 -0
- package/dist/mcpToolCache.mjs +24 -0
- package/dist/mcpToolCache.mjs.map +1 -0
- package/dist/metadata.js +2 -2
- package/dist/metadata.mjs +2 -2
- package/dist/model.d.ts +25 -0
- package/dist/runState.d.ts +105 -0
- package/dist/runState.js +12 -0
- package/dist/runState.js.map +1 -1
- package/dist/runState.mjs +12 -0
- package/dist/runState.mjs.map +1 -1
- package/dist/runner/modelSettingsMerge.js +5 -1
- package/dist/runner/modelSettingsMerge.js.map +1 -1
- package/dist/runner/modelSettingsMerge.mjs +5 -1
- package/dist/runner/modelSettingsMerge.mjs.map +1 -1
- package/dist/shims/config-browser.d.ts +2 -0
- package/dist/shims/config-browser.js +11 -0
- package/dist/shims/config-browser.js.map +1 -0
- package/dist/shims/config-browser.mjs +7 -0
- package/dist/shims/config-browser.mjs.map +1 -0
- package/dist/shims/config-node.d.ts +7 -0
- package/dist/shims/config-node.js +60 -0
- package/dist/shims/config-node.js.map +1 -0
- package/dist/shims/config-node.mjs +23 -0
- package/dist/shims/config-node.mjs.map +1 -0
- package/dist/shims/config-workerd.d.ts +2 -0
- package/dist/shims/config-workerd.js +10 -0
- package/dist/shims/config-workerd.js.map +1 -0
- package/dist/shims/config-workerd.mjs +5 -0
- package/dist/shims/config-workerd.mjs.map +1 -0
- package/dist/shims/mcp-server/browser.d.ts +2 -1
- package/dist/shims/mcp-server/browser.js +4 -4
- package/dist/shims/mcp-server/browser.js.map +1 -1
- package/dist/shims/mcp-server/browser.mjs +1 -1
- package/dist/shims/mcp-server/browser.mjs.map +1 -1
- package/dist/shims/mcp-server/node.d.ts +2 -1
- package/dist/shims/mcp-server/node.js +11 -10
- package/dist/shims/mcp-server/node.js.map +1 -1
- package/dist/shims/mcp-server/node.mjs +2 -1
- package/dist/shims/mcp-server/node.mjs.map +1 -1
- package/dist/shims/shims-browser.d.ts +2 -2
- package/dist/shims/shims-browser.js +8 -11
- package/dist/shims/shims-browser.js.map +1 -1
- package/dist/shims/shims-browser.mjs +4 -8
- package/dist/shims/shims-browser.mjs.map +1 -1
- package/dist/shims/shims-node.d.ts +2 -7
- package/dist/shims/shims-node.js +7 -59
- package/dist/shims/shims-node.js.map +1 -1
- package/dist/shims/shims-node.mjs +3 -23
- package/dist/shims/shims-node.mjs.map +1 -1
- package/dist/shims/shims-workerd.d.ts +2 -7
- package/dist/shims/shims-workerd.js +8 -60
- package/dist/shims/shims-workerd.js.map +1 -1
- package/dist/shims/shims-workerd.mjs +4 -24
- package/dist/shims/shims-workerd.mjs.map +1 -1
- package/dist/tracing/provider.js +4 -1
- package/dist/tracing/provider.js.map +1 -1
- package/dist/tracing/provider.mjs +4 -1
- package/dist/tracing/provider.mjs.map +1 -1
- package/dist/types/protocol.d.ts +154 -0
- package/dist/types/protocol.js +24 -2
- package/dist/types/protocol.js.map +1 -1
- package/dist/types/protocol.mjs +22 -0
- package/dist/types/protocol.mjs.map +1 -1
- package/package.json +24 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import debug from 'debug';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getLogger } from "./logger.mjs";
|
|
4
|
+
export const DEFAULT_STDIO_MCP_CLIENT_LOGGER_NAME = 'openai-agents:stdio-mcp-client';
|
|
5
|
+
export const DEFAULT_STREAMABLE_HTTP_MCP_CLIENT_LOGGER_NAME = 'openai-agents:streamable-http-mcp-client';
|
|
6
|
+
export const DEFAULT_SSE_MCP_CLIENT_LOGGER_NAME = 'openai-agents:sse-mcp-client';
|
|
7
|
+
export class BaseMCPServerStdio {
|
|
8
|
+
cacheToolsList;
|
|
9
|
+
_cachedTools = undefined;
|
|
10
|
+
toolFilter;
|
|
11
|
+
toolMetaResolver;
|
|
12
|
+
customDataExtractor;
|
|
13
|
+
useStructuredContent;
|
|
14
|
+
errorFunction;
|
|
15
|
+
logger;
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.logger =
|
|
18
|
+
options.logger ?? getLogger(DEFAULT_STDIO_MCP_CLIENT_LOGGER_NAME);
|
|
19
|
+
this.cacheToolsList = options.cacheToolsList ?? false;
|
|
20
|
+
this.toolFilter = options.toolFilter;
|
|
21
|
+
this.toolMetaResolver = options.toolMetaResolver;
|
|
22
|
+
this.customDataExtractor = options.customDataExtractor;
|
|
23
|
+
this.useStructuredContent = options.useStructuredContent;
|
|
24
|
+
this.errorFunction = options.errorFunction;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Logs a debug message when debug logging is enabled.
|
|
28
|
+
* @param buildMessage A function that returns the message to log.
|
|
29
|
+
*/
|
|
30
|
+
debugLog(buildMessage) {
|
|
31
|
+
if (debug.enabled(this.logger.namespace)) {
|
|
32
|
+
// Only build the message when debug logging is enabled.
|
|
33
|
+
this.logger.debug(buildMessage());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class BaseMCPServerStreamableHttp {
|
|
38
|
+
cacheToolsList;
|
|
39
|
+
_cachedTools = undefined;
|
|
40
|
+
toolFilter;
|
|
41
|
+
toolMetaResolver;
|
|
42
|
+
customDataExtractor;
|
|
43
|
+
useStructuredContent;
|
|
44
|
+
errorFunction;
|
|
45
|
+
logger;
|
|
46
|
+
constructor(options) {
|
|
47
|
+
this.logger =
|
|
48
|
+
options.logger ??
|
|
49
|
+
getLogger(DEFAULT_STREAMABLE_HTTP_MCP_CLIENT_LOGGER_NAME);
|
|
50
|
+
this.cacheToolsList = options.cacheToolsList ?? false;
|
|
51
|
+
this.toolFilter = options.toolFilter;
|
|
52
|
+
this.toolMetaResolver = options.toolMetaResolver;
|
|
53
|
+
this.customDataExtractor = options.customDataExtractor;
|
|
54
|
+
this.useStructuredContent = options.useStructuredContent;
|
|
55
|
+
this.errorFunction = options.errorFunction;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Logs a debug message when debug logging is enabled.
|
|
59
|
+
* @param buildMessage A function that returns the message to log.
|
|
60
|
+
*/
|
|
61
|
+
debugLog(buildMessage) {
|
|
62
|
+
if (debug.enabled(this.logger.namespace)) {
|
|
63
|
+
// Only build the message when debug logging is enabled.
|
|
64
|
+
this.logger.debug(buildMessage());
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export class BaseMCPServerSSE {
|
|
69
|
+
cacheToolsList;
|
|
70
|
+
_cachedTools = undefined;
|
|
71
|
+
toolFilter;
|
|
72
|
+
toolMetaResolver;
|
|
73
|
+
customDataExtractor;
|
|
74
|
+
useStructuredContent;
|
|
75
|
+
errorFunction;
|
|
76
|
+
logger;
|
|
77
|
+
constructor(options) {
|
|
78
|
+
this.logger =
|
|
79
|
+
options.logger ?? getLogger(DEFAULT_SSE_MCP_CLIENT_LOGGER_NAME);
|
|
80
|
+
this.cacheToolsList = options.cacheToolsList ?? false;
|
|
81
|
+
this.toolFilter = options.toolFilter;
|
|
82
|
+
this.toolMetaResolver = options.toolMetaResolver;
|
|
83
|
+
this.customDataExtractor = options.customDataExtractor;
|
|
84
|
+
this.useStructuredContent = options.useStructuredContent;
|
|
85
|
+
this.errorFunction = options.errorFunction;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Logs a debug message when debug logging is enabled.
|
|
89
|
+
* @param buildMessage A function that returns the message to log.
|
|
90
|
+
*/
|
|
91
|
+
debugLog(buildMessage) {
|
|
92
|
+
if (debug.enabled(this.logger.namespace)) {
|
|
93
|
+
// Only build the message when debug logging is enabled.
|
|
94
|
+
this.logger.debug(buildMessage());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Minimum MCP tool data definition.
|
|
100
|
+
* This type definition does not intend to cover all possible properties.
|
|
101
|
+
* It supports the properties that are used in this SDK.
|
|
102
|
+
*/
|
|
103
|
+
export const MCPTool = z.object({
|
|
104
|
+
name: z.string(),
|
|
105
|
+
description: z.string().optional(),
|
|
106
|
+
inputSchema: z.object({
|
|
107
|
+
type: z.literal('object'),
|
|
108
|
+
properties: z.record(z.string(), z.any()),
|
|
109
|
+
required: z.array(z.string()),
|
|
110
|
+
additionalProperties: z.boolean(),
|
|
111
|
+
}),
|
|
112
|
+
});
|
|
113
|
+
export function attachCallToolResultMetadata(content, metadata) {
|
|
114
|
+
const result = content;
|
|
115
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
116
|
+
if (typeof value === 'undefined') {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
Object.defineProperty(result, key, {
|
|
120
|
+
value,
|
|
121
|
+
enumerable: false,
|
|
122
|
+
configurable: true,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=mcpShared.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpShared.mjs","sourceRoot":"","sources":["../src/mcpShared.ts"],"names":[],"mappings":"OAAO,KAAK,MAAM,OAAO;OAClB,EAAE,CAAC,EAAE,MAAM,KAAK;OAChB,EAAE,SAAS,EAAe;AAsBjC,MAAM,CAAC,MAAM,oCAAoC,GAC/C,gCAAgC,CAAC;AAEnC,MAAM,CAAC,MAAM,8CA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IAAI;SACnB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MCPTool } from './mcpShared';
|
|
2
|
+
export declare const cachedMcpTools: Record<string, MCPTool[]>;
|
|
3
|
+
export declare const cachedMcpToolKeysByServer: Record<string, Set<string>>;
|
|
4
|
+
/**
|
|
5
|
+
* Remove cached tools for the given server so the next lookup fetches fresh data.
|
|
6
|
+
*
|
|
7
|
+
* @param serverName - Name of the MCP server whose cache should be cleared.
|
|
8
|
+
*/
|
|
9
|
+
export declare function invalidateServerToolsCache(serverName: string): Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cachedMcpToolKeysByServer = exports.cachedMcpTools = void 0;
|
|
4
|
+
exports.invalidateServerToolsCache = invalidateServerToolsCache;
|
|
5
|
+
exports.cachedMcpTools = {};
|
|
6
|
+
exports.cachedMcpToolKeysByServer = {};
|
|
7
|
+
/**
|
|
8
|
+
* Remove cached tools for the given server so the next lookup fetches fresh data.
|
|
9
|
+
*
|
|
10
|
+
* @param serverName - Name of the MCP server whose cache should be cleared.
|
|
11
|
+
*/
|
|
12
|
+
async function invalidateServerToolsCache(serverName) {
|
|
13
|
+
const cachedKeys = exports.cachedMcpToolKeysByServer[serverName];
|
|
14
|
+
if (cachedKeys) {
|
|
15
|
+
for (const cacheKey of cachedKeys) {
|
|
16
|
+
delete exports.cachedMcpTools[cacheKey];
|
|
17
|
+
}
|
|
18
|
+
delete exports.cachedMcpToolKeysByServer[serverName];
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
delete exports.cachedMcpTools[serverName];
|
|
22
|
+
for (const cacheKey of Object.keys(exports.cachedMcpTools)) {
|
|
23
|
+
if (cacheKey.startsWith(`${serverName}:`)) {
|
|
24
|
+
delete exports.cachedMcpTools[cacheKey];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=mcpToolCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpToolCache.js","sourceRoot":"","sources":["../src/mcpToolCache.ts"],"names":[],"mappings":";;;AAUA,gEAgBC;AAxBY,QAAA,cAAc,GAA8B,EAAE,CAAC;AAC/C,QAAA,yBAAyB,GAAgC,EAAE,CAAC;AAEzE;;;;GAIG;AACI,KAAK,UAAU,0BAA0B,CAAC,UAAkB;IACjE,MAAM,UAAU,GAAG,iCAAyB,CAAC,UAAU,CAAC,CAAC;IACzD,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAClC,OAAO,sBAAc,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,iCAAyB,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,OAAO,sBAAc,CAAC,UAAU,CAAC,CAAC;IAClC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,sBAAc,CAAC,EAAE,CAAC;QACnD,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC;YAC1C,OAAO,sBAAc,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const cachedMcpTools = {};
|
|
2
|
+
export const cachedMcpToolKeysByServer = {};
|
|
3
|
+
/**
|
|
4
|
+
* Remove cached tools for the given server so the next lookup fetches fresh data.
|
|
5
|
+
*
|
|
6
|
+
* @param serverName - Name of the MCP server whose cache should be cleared.
|
|
7
|
+
*/
|
|
8
|
+
export async function invalidateServerToolsCache(serverName) {
|
|
9
|
+
const cachedKeys = cachedMcpToolKeysByServer[serverName];
|
|
10
|
+
if (cachedKeys) {
|
|
11
|
+
for (const cacheKey of cachedKeys) {
|
|
12
|
+
delete cachedMcpTools[cacheKey];
|
|
13
|
+
}
|
|
14
|
+
delete cachedMcpToolKeysByServer[serverName];
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
delete cachedMcpTools[serverName];
|
|
18
|
+
for (const cacheKey of Object.keys(cachedMcpTools)) {
|
|
19
|
+
if (cacheKey.startsWith(`${serverName}:`)) {
|
|
20
|
+
delete cachedMcpTools[cacheKey];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=mcpToolCache.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpToolCache.mjs","sourceRoot":"","sources":["../src/mcpToolCache.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAA8B,EAAE,CAAC;AAC5D,MAAM,CAAC,MAAM,yBAAyB,GAAgC,EAAE,CAAC;AAEzE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,UAAkB;IACjE,MAAM,UAAU,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACzD,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAClC,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,yBAAyB,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;QACnD,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC;YAC1C,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/metadata.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.METADATA = void 0;
|
|
5
5
|
exports.METADATA = {
|
|
6
6
|
"name": "@openai/agents-core",
|
|
7
|
-
"version": "0.13.
|
|
7
|
+
"version": "0.13.3",
|
|
8
8
|
"versions": {
|
|
9
|
-
"@openai/agents-core": "0.13.
|
|
9
|
+
"@openai/agents-core": "0.13.3",
|
|
10
10
|
"openai": "^6.46.0"
|
|
11
11
|
}
|
|
12
12
|
};
|
package/dist/metadata.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is automatically generated
|
|
2
2
|
export const METADATA = {
|
|
3
3
|
"name": "@openai/agents-core",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.3",
|
|
5
5
|
"versions": {
|
|
6
|
-
"@openai/agents-core": "0.13.
|
|
6
|
+
"@openai/agents-core": "0.13.3",
|
|
7
7
|
"openai": "^6.46.0"
|
|
8
8
|
}
|
|
9
9
|
};
|
package/dist/model.d.ts
CHANGED
|
@@ -15,12 +15,20 @@ export type ModelSettingsReasoningEffort = 'none' | 'minimal' | 'low' | 'medium'
|
|
|
15
15
|
* Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
|
16
16
|
*/
|
|
17
17
|
export type ModelSettingsReasoning = {
|
|
18
|
+
/**
|
|
19
|
+
* Controls which reasoning items are rendered back to the model on later turns.
|
|
20
|
+
*/
|
|
21
|
+
context?: 'auto' | 'current_turn' | 'all_turns' | null;
|
|
18
22
|
/**
|
|
19
23
|
* Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
|
20
24
|
* Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
|
|
21
25
|
* Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
|
|
22
26
|
*/
|
|
23
27
|
effort?: ModelSettingsReasoningEffort | null;
|
|
28
|
+
/**
|
|
29
|
+
* Controls the reasoning execution mode for the request.
|
|
30
|
+
*/
|
|
31
|
+
mode?: 'standard' | 'pro' | (string & {});
|
|
24
32
|
/**
|
|
25
33
|
* A summary of the reasoning performed by the model.
|
|
26
34
|
* This can be useful for debugging and understanding the model's reasoning process.
|
|
@@ -28,6 +36,19 @@ export type ModelSettingsReasoning = {
|
|
|
28
36
|
*/
|
|
29
37
|
summary?: 'auto' | 'concise' | 'detailed' | null;
|
|
30
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Prompt-cache configuration for supported model providers.
|
|
41
|
+
*/
|
|
42
|
+
export type ModelSettingsPromptCacheOptions = {
|
|
43
|
+
/**
|
|
44
|
+
* Controls whether the provider creates an implicit cache breakpoint.
|
|
45
|
+
*/
|
|
46
|
+
mode?: 'implicit' | 'explicit';
|
|
47
|
+
/**
|
|
48
|
+
* The minimum lifetime applied to cache breakpoints written by the request.
|
|
49
|
+
*/
|
|
50
|
+
ttl?: '30m';
|
|
51
|
+
};
|
|
31
52
|
export interface ModelSettingsText {
|
|
32
53
|
/**
|
|
33
54
|
* Constrains the verbosity of the model's response.
|
|
@@ -224,6 +245,10 @@ export type ModelSettings = {
|
|
|
224
245
|
* See https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention for the available options.
|
|
225
246
|
*/
|
|
226
247
|
promptCacheRetention?: 'in-memory' | '24h' | null;
|
|
248
|
+
/**
|
|
249
|
+
* Controls implicit and explicit prompt caching for supported model providers.
|
|
250
|
+
*/
|
|
251
|
+
promptCacheOptions?: ModelSettingsPromptCacheOptions;
|
|
227
252
|
/**
|
|
228
253
|
* Context-management strategies to apply when calling the model.
|
|
229
254
|
* This setting is available on OpenAI Responses requests, including server-side compaction.
|
package/dist/runState.d.ts
CHANGED
|
@@ -126,6 +126,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
126
126
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
127
127
|
type: z.ZodLiteral<"input_text">;
|
|
128
128
|
text: z.ZodString;
|
|
129
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
130
|
+
mode: z.ZodLiteral<"explicit">;
|
|
131
|
+
}, z.core.$strip>>;
|
|
129
132
|
}, z.core.$strip>, z.ZodObject<{
|
|
130
133
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
131
134
|
type: z.ZodLiteral<"input_image">;
|
|
@@ -133,6 +136,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
133
136
|
id: z.ZodString;
|
|
134
137
|
}, z.core.$strip>]>>;
|
|
135
138
|
detail: z.ZodOptional<z.ZodString>;
|
|
139
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
140
|
+
mode: z.ZodLiteral<"explicit">;
|
|
141
|
+
}, z.core.$strip>>;
|
|
136
142
|
}, z.core.$strip>, z.ZodObject<{
|
|
137
143
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
138
144
|
type: z.ZodLiteral<"input_file">;
|
|
@@ -142,6 +148,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
142
148
|
url: z.ZodString;
|
|
143
149
|
}, z.core.$strip>]>>;
|
|
144
150
|
filename: z.ZodOptional<z.ZodString>;
|
|
151
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
mode: z.ZodLiteral<"explicit">;
|
|
153
|
+
}, z.core.$strip>>;
|
|
145
154
|
}, z.core.$strip>, z.ZodObject<{
|
|
146
155
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
147
156
|
type: z.ZodLiteral<"audio">;
|
|
@@ -150,6 +159,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
150
159
|
}, z.core.$strip>]>;
|
|
151
160
|
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
152
161
|
transcript: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
162
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
mode: z.ZodLiteral<"explicit">;
|
|
164
|
+
}, z.core.$strip>>;
|
|
153
165
|
}, z.core.$strip>], "type">>, z.ZodString]>;
|
|
154
166
|
}, z.core.$strip>, z.ZodObject<{
|
|
155
167
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -177,6 +189,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
177
189
|
}, z.core.$strip>]>;
|
|
178
190
|
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
179
191
|
transcript: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
192
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
193
|
+
mode: z.ZodLiteral<"explicit">;
|
|
194
|
+
}, z.core.$strip>>;
|
|
180
195
|
}, z.core.$strip>, z.ZodObject<{
|
|
181
196
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
182
197
|
type: z.ZodLiteral<"image">;
|
|
@@ -410,6 +425,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
410
425
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
411
426
|
type: z.ZodLiteral<"input_text">;
|
|
412
427
|
text: z.ZodString;
|
|
428
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
429
|
+
mode: z.ZodLiteral<"explicit">;
|
|
430
|
+
}, z.core.$strip>>;
|
|
413
431
|
}, z.core.$strip>, z.ZodObject<{
|
|
414
432
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
415
433
|
type: z.ZodLiteral<"input_image">;
|
|
@@ -417,6 +435,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
417
435
|
id: z.ZodString;
|
|
418
436
|
}, z.core.$strip>]>>;
|
|
419
437
|
detail: z.ZodOptional<z.ZodString>;
|
|
438
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
439
|
+
mode: z.ZodLiteral<"explicit">;
|
|
440
|
+
}, z.core.$strip>>;
|
|
420
441
|
}, z.core.$strip>, z.ZodObject<{
|
|
421
442
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
422
443
|
type: z.ZodLiteral<"input_file">;
|
|
@@ -426,6 +447,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
426
447
|
url: z.ZodString;
|
|
427
448
|
}, z.core.$strip>]>>;
|
|
428
449
|
filename: z.ZodOptional<z.ZodString>;
|
|
450
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
451
|
+
mode: z.ZodLiteral<"explicit">;
|
|
452
|
+
}, z.core.$strip>>;
|
|
429
453
|
}, z.core.$strip>], "type">>]>;
|
|
430
454
|
}, z.core.$strip>, z.ZodObject<{
|
|
431
455
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -471,6 +495,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
471
495
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
472
496
|
type: z.ZodLiteral<"input_text">;
|
|
473
497
|
text: z.ZodString;
|
|
498
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
499
|
+
mode: z.ZodLiteral<"explicit">;
|
|
500
|
+
}, z.core.$strip>>;
|
|
474
501
|
}, z.core.$strip>>;
|
|
475
502
|
rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
476
503
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -531,6 +558,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
531
558
|
}, z.core.$strip>]>;
|
|
532
559
|
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
533
560
|
transcript: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
561
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
562
|
+
mode: z.ZodLiteral<"explicit">;
|
|
563
|
+
}, z.core.$strip>>;
|
|
534
564
|
}, z.core.$strip>, z.ZodObject<{
|
|
535
565
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
536
566
|
type: z.ZodLiteral<"image">;
|
|
@@ -758,6 +788,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
758
788
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
759
789
|
type: z.ZodLiteral<"input_text">;
|
|
760
790
|
text: z.ZodString;
|
|
791
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
792
|
+
mode: z.ZodLiteral<"explicit">;
|
|
793
|
+
}, z.core.$strip>>;
|
|
761
794
|
}, z.core.$strip>, z.ZodObject<{
|
|
762
795
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
763
796
|
type: z.ZodLiteral<"input_image">;
|
|
@@ -765,6 +798,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
765
798
|
id: z.ZodString;
|
|
766
799
|
}, z.core.$strip>]>>;
|
|
767
800
|
detail: z.ZodOptional<z.ZodString>;
|
|
801
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
802
|
+
mode: z.ZodLiteral<"explicit">;
|
|
803
|
+
}, z.core.$strip>>;
|
|
768
804
|
}, z.core.$strip>, z.ZodObject<{
|
|
769
805
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
770
806
|
type: z.ZodLiteral<"input_file">;
|
|
@@ -774,6 +810,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
774
810
|
url: z.ZodString;
|
|
775
811
|
}, z.core.$strip>]>>;
|
|
776
812
|
filename: z.ZodOptional<z.ZodString>;
|
|
813
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
814
|
+
mode: z.ZodLiteral<"explicit">;
|
|
815
|
+
}, z.core.$strip>>;
|
|
777
816
|
}, z.core.$strip>], "type">>]>;
|
|
778
817
|
}, z.core.$strip>, z.ZodObject<{
|
|
779
818
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -809,6 +848,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
809
848
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
810
849
|
type: z.ZodLiteral<"input_text">;
|
|
811
850
|
text: z.ZodString;
|
|
851
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
852
|
+
mode: z.ZodLiteral<"explicit">;
|
|
853
|
+
}, z.core.$strip>>;
|
|
812
854
|
}, z.core.$strip>>;
|
|
813
855
|
rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
814
856
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -975,6 +1017,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
975
1017
|
}, z.core.$strip>]>;
|
|
976
1018
|
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
977
1019
|
transcript: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1020
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1021
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1022
|
+
}, z.core.$strip>>;
|
|
978
1023
|
}, z.core.$strip>, z.ZodObject<{
|
|
979
1024
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
980
1025
|
type: z.ZodLiteral<"image">;
|
|
@@ -1202,6 +1247,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1202
1247
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1203
1248
|
type: z.ZodLiteral<"input_text">;
|
|
1204
1249
|
text: z.ZodString;
|
|
1250
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1251
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1252
|
+
}, z.core.$strip>>;
|
|
1205
1253
|
}, z.core.$strip>, z.ZodObject<{
|
|
1206
1254
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1207
1255
|
type: z.ZodLiteral<"input_image">;
|
|
@@ -1209,6 +1257,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1209
1257
|
id: z.ZodString;
|
|
1210
1258
|
}, z.core.$strip>]>>;
|
|
1211
1259
|
detail: z.ZodOptional<z.ZodString>;
|
|
1260
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1261
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1262
|
+
}, z.core.$strip>>;
|
|
1212
1263
|
}, z.core.$strip>, z.ZodObject<{
|
|
1213
1264
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1214
1265
|
type: z.ZodLiteral<"input_file">;
|
|
@@ -1218,6 +1269,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1218
1269
|
url: z.ZodString;
|
|
1219
1270
|
}, z.core.$strip>]>>;
|
|
1220
1271
|
filename: z.ZodOptional<z.ZodString>;
|
|
1272
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1273
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1274
|
+
}, z.core.$strip>>;
|
|
1221
1275
|
}, z.core.$strip>], "type">>]>;
|
|
1222
1276
|
}, z.core.$strip>, z.ZodObject<{
|
|
1223
1277
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -1253,6 +1307,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1253
1307
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1254
1308
|
type: z.ZodLiteral<"input_text">;
|
|
1255
1309
|
text: z.ZodString;
|
|
1310
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1311
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1312
|
+
}, z.core.$strip>>;
|
|
1256
1313
|
}, z.core.$strip>>;
|
|
1257
1314
|
rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1258
1315
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -1302,6 +1359,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1302
1359
|
}, z.core.$strip>]>;
|
|
1303
1360
|
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1304
1361
|
transcript: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1362
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1363
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1364
|
+
}, z.core.$strip>>;
|
|
1305
1365
|
}, z.core.$strip>, z.ZodObject<{
|
|
1306
1366
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1307
1367
|
type: z.ZodLiteral<"image">;
|
|
@@ -1565,6 +1625,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1565
1625
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1566
1626
|
type: z.ZodLiteral<"input_text">;
|
|
1567
1627
|
text: z.ZodString;
|
|
1628
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1629
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1630
|
+
}, z.core.$strip>>;
|
|
1568
1631
|
}, z.core.$strip>, z.ZodObject<{
|
|
1569
1632
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1570
1633
|
type: z.ZodLiteral<"input_image">;
|
|
@@ -1572,6 +1635,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1572
1635
|
id: z.ZodString;
|
|
1573
1636
|
}, z.core.$strip>]>>;
|
|
1574
1637
|
detail: z.ZodOptional<z.ZodString>;
|
|
1638
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1639
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1640
|
+
}, z.core.$strip>>;
|
|
1575
1641
|
}, z.core.$strip>, z.ZodObject<{
|
|
1576
1642
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1577
1643
|
type: z.ZodLiteral<"input_file">;
|
|
@@ -1581,6 +1647,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1581
1647
|
url: z.ZodString;
|
|
1582
1648
|
}, z.core.$strip>]>>;
|
|
1583
1649
|
filename: z.ZodOptional<z.ZodString>;
|
|
1650
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1651
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1652
|
+
}, z.core.$strip>>;
|
|
1584
1653
|
}, z.core.$strip>], "type">>]>;
|
|
1585
1654
|
}, z.core.$strip>, z.ZodObject<{
|
|
1586
1655
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -1635,6 +1704,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1635
1704
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1636
1705
|
type: z.ZodLiteral<"input_text">;
|
|
1637
1706
|
text: z.ZodString;
|
|
1707
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1708
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1709
|
+
}, z.core.$strip>>;
|
|
1638
1710
|
}, z.core.$strip>>;
|
|
1639
1711
|
rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1640
1712
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -1714,6 +1786,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1714
1786
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1715
1787
|
type: z.ZodLiteral<"input_text">;
|
|
1716
1788
|
text: z.ZodString;
|
|
1789
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1790
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1791
|
+
}, z.core.$strip>>;
|
|
1717
1792
|
}, z.core.$strip>, z.ZodObject<{
|
|
1718
1793
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1719
1794
|
type: z.ZodLiteral<"input_image">;
|
|
@@ -1721,6 +1796,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1721
1796
|
id: z.ZodString;
|
|
1722
1797
|
}, z.core.$strip>]>>;
|
|
1723
1798
|
detail: z.ZodOptional<z.ZodString>;
|
|
1799
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1800
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1801
|
+
}, z.core.$strip>>;
|
|
1724
1802
|
}, z.core.$strip>, z.ZodObject<{
|
|
1725
1803
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1726
1804
|
type: z.ZodLiteral<"input_file">;
|
|
@@ -1730,6 +1808,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1730
1808
|
url: z.ZodString;
|
|
1731
1809
|
}, z.core.$strip>]>>;
|
|
1732
1810
|
filename: z.ZodOptional<z.ZodString>;
|
|
1811
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
1812
|
+
mode: z.ZodLiteral<"explicit">;
|
|
1813
|
+
}, z.core.$strip>>;
|
|
1733
1814
|
}, z.core.$strip>], "type">>]>;
|
|
1734
1815
|
}, z.core.$strip>;
|
|
1735
1816
|
sourceAgent: z.ZodObject<{
|
|
@@ -1931,6 +2012,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
1931
2012
|
}, z.core.$strip>]>;
|
|
1932
2013
|
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1933
2014
|
transcript: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2015
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
2016
|
+
mode: z.ZodLiteral<"explicit">;
|
|
2017
|
+
}, z.core.$strip>>;
|
|
1934
2018
|
}, z.core.$strip>, z.ZodObject<{
|
|
1935
2019
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1936
2020
|
type: z.ZodLiteral<"image">;
|
|
@@ -2194,6 +2278,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
2194
2278
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2195
2279
|
type: z.ZodLiteral<"input_text">;
|
|
2196
2280
|
text: z.ZodString;
|
|
2281
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
2282
|
+
mode: z.ZodLiteral<"explicit">;
|
|
2283
|
+
}, z.core.$strip>>;
|
|
2197
2284
|
}, z.core.$strip>, z.ZodObject<{
|
|
2198
2285
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2199
2286
|
type: z.ZodLiteral<"input_image">;
|
|
@@ -2201,6 +2288,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
2201
2288
|
id: z.ZodString;
|
|
2202
2289
|
}, z.core.$strip>]>>;
|
|
2203
2290
|
detail: z.ZodOptional<z.ZodString>;
|
|
2291
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
2292
|
+
mode: z.ZodLiteral<"explicit">;
|
|
2293
|
+
}, z.core.$strip>>;
|
|
2204
2294
|
}, z.core.$strip>, z.ZodObject<{
|
|
2205
2295
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2206
2296
|
type: z.ZodLiteral<"input_file">;
|
|
@@ -2210,6 +2300,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
2210
2300
|
url: z.ZodString;
|
|
2211
2301
|
}, z.core.$strip>]>>;
|
|
2212
2302
|
filename: z.ZodOptional<z.ZodString>;
|
|
2303
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
2304
|
+
mode: z.ZodLiteral<"explicit">;
|
|
2305
|
+
}, z.core.$strip>>;
|
|
2213
2306
|
}, z.core.$strip>], "type">>]>;
|
|
2214
2307
|
}, z.core.$strip>, z.ZodObject<{
|
|
2215
2308
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -2264,6 +2357,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
2264
2357
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2265
2358
|
type: z.ZodLiteral<"input_text">;
|
|
2266
2359
|
text: z.ZodString;
|
|
2360
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
2361
|
+
mode: z.ZodLiteral<"explicit">;
|
|
2362
|
+
}, z.core.$strip>>;
|
|
2267
2363
|
}, z.core.$strip>>;
|
|
2268
2364
|
rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2269
2365
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -2343,6 +2439,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
2343
2439
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2344
2440
|
type: z.ZodLiteral<"input_text">;
|
|
2345
2441
|
text: z.ZodString;
|
|
2442
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
2443
|
+
mode: z.ZodLiteral<"explicit">;
|
|
2444
|
+
}, z.core.$strip>>;
|
|
2346
2445
|
}, z.core.$strip>, z.ZodObject<{
|
|
2347
2446
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2348
2447
|
type: z.ZodLiteral<"input_image">;
|
|
@@ -2350,6 +2449,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
2350
2449
|
id: z.ZodString;
|
|
2351
2450
|
}, z.core.$strip>]>>;
|
|
2352
2451
|
detail: z.ZodOptional<z.ZodString>;
|
|
2452
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
2453
|
+
mode: z.ZodLiteral<"explicit">;
|
|
2454
|
+
}, z.core.$strip>>;
|
|
2353
2455
|
}, z.core.$strip>, z.ZodObject<{
|
|
2354
2456
|
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2355
2457
|
type: z.ZodLiteral<"input_file">;
|
|
@@ -2359,6 +2461,9 @@ export declare const SerializedRunState: z.ZodObject<{
|
|
|
2359
2461
|
url: z.ZodString;
|
|
2360
2462
|
}, z.core.$strip>]>>;
|
|
2361
2463
|
filename: z.ZodOptional<z.ZodString>;
|
|
2464
|
+
promptCacheBreakpoint: z.ZodOptional<z.ZodObject<{
|
|
2465
|
+
mode: z.ZodLiteral<"explicit">;
|
|
2466
|
+
}, z.core.$strip>>;
|
|
2362
2467
|
}, z.core.$strip>], "type">>]>;
|
|
2363
2468
|
}, z.core.$strip>;
|
|
2364
2469
|
sourceAgent: z.ZodObject<{
|
package/dist/runState.js
CHANGED
|
@@ -1130,6 +1130,18 @@ async function buildRunStateFromJson(initialAgent, stateJson, options = {}) {
|
|
|
1130
1130
|
typeof context.toolInput === 'undefined') {
|
|
1131
1131
|
context.toolInput = stateJson.context.toolInput;
|
|
1132
1132
|
}
|
|
1133
|
+
// Restore the aggregated run usage. toJSON serializes context.usage, but a
|
|
1134
|
+
// freshly constructed RunContext starts with an empty Usage, so without this
|
|
1135
|
+
// a resumed run reports zero token usage.
|
|
1136
|
+
//
|
|
1137
|
+
// Only restore on the no-override path. A caller-supplied RunContext is
|
|
1138
|
+
// authoritative and owns its usage accounting: its counters do not reveal
|
|
1139
|
+
// whether its Usage is newly owned or shared with another run (for example a
|
|
1140
|
+
// nested agent-tool resume passes a context whose usage aggregate is shared
|
|
1141
|
+
// with the outer run), so it is left untouched.
|
|
1142
|
+
if (!contextOverride) {
|
|
1143
|
+
context.usage = new usage_1.Usage(stateJson.context.usage);
|
|
1144
|
+
}
|
|
1133
1145
|
//
|
|
1134
1146
|
// Find the current agent from the initial agent
|
|
1135
1147
|
//
|