@openai/agents-core 0.0.15 → 0.0.17
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/agent.d.ts +1 -1
- package/dist/agent.js +34 -22
- package/dist/agent.js.map +1 -1
- package/dist/agent.mjs +6 -1
- package/dist/agent.mjs.map +1 -1
- package/dist/computer.js +2 -1
- package/dist/config.js +12 -6
- package/dist/config.js.map +1 -1
- package/dist/errors.js +21 -9
- package/dist/errors.js.map +1 -1
- package/dist/events.js +9 -3
- package/dist/events.js.map +1 -1
- package/dist/extensions/handoffFilters.js +9 -6
- package/dist/extensions/handoffFilters.js.map +1 -1
- package/dist/extensions/handoffPrompt.js +7 -3
- package/dist/extensions/handoffPrompt.js.map +1 -1
- package/dist/extensions/index.js +8 -2
- package/dist/extensions/index.js.map +1 -1
- package/dist/guardrail.js +6 -2
- package/dist/guardrail.js.map +1 -1
- package/dist/handoff.js +28 -18
- package/dist/handoff.js.map +1 -1
- package/dist/helpers/message.js +8 -3
- package/dist/helpers/message.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +121 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/items.d.ts +0 -32
- package/dist/items.js +23 -11
- package/dist/items.js.map +1 -1
- package/dist/lifecycle.js +12 -6
- package/dist/lifecycle.js.map +1 -1
- package/dist/logger.js +15 -8
- package/dist/logger.js.map +1 -1
- package/dist/mcp.d.ts +14 -7
- package/dist/mcp.js +119 -96
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +65 -57
- package/dist/mcp.mjs.map +1 -1
- package/dist/mcpUtil.js +4 -1
- package/dist/mcpUtil.js.map +1 -1
- package/dist/metadata.d.ts +0 -1
- package/dist/metadata.js +7 -5
- package/dist/metadata.js.map +1 -1
- package/dist/metadata.mjs +2 -3
- package/dist/metadata.mjs.map +1 -1
- package/dist/model.js +2 -1
- package/dist/providers.js +6 -2
- package/dist/providers.js.map +1 -1
- package/dist/result.js +22 -14
- package/dist/result.js.map +1 -1
- package/dist/run.js +106 -95
- package/dist/run.js.map +1 -1
- package/dist/runContext.js +13 -6
- package/dist/runContext.js.map +1 -1
- package/dist/runImplementation.d.ts +1 -1
- package/dist/runImplementation.js +106 -89
- package/dist/runImplementation.js.map +1 -1
- package/dist/runImplementation.mjs +1 -1
- package/dist/runImplementation.mjs.map +1 -1
- package/dist/runState.d.ts +7 -186
- package/dist/runState.js +204 -151
- package/dist/runState.js.map +1 -1
- package/dist/runState.mjs +10 -1
- package/dist/runState.mjs.map +1 -1
- package/dist/shims/interface.js +2 -1
- package/dist/shims/mcp-server/browser.js +10 -4
- package/dist/shims/mcp-server/browser.js.map +1 -1
- package/dist/shims/mcp-server/node.js +68 -25
- package/dist/shims/mcp-server/node.js.map +1 -1
- package/dist/shims/mcp-server/node.mjs +1 -0
- package/dist/shims/mcp-server/node.mjs.map +1 -1
- package/dist/shims/shims-browser.js +25 -13
- package/dist/shims/shims-browser.js.map +1 -1
- package/dist/shims/shims-node.js +72 -15
- package/dist/shims/shims-node.js.map +1 -1
- package/dist/shims/shims-node.mjs +11 -3
- package/dist/shims/shims-node.mjs.map +1 -1
- package/dist/shims/shims-workerd.d.ts +1 -1
- package/dist/shims/shims-workerd.js +77 -18
- package/dist/shims/shims-workerd.js.map +1 -1
- package/dist/shims/shims-workerd.mjs +12 -4
- package/dist/shims/shims-workerd.mjs.map +1 -1
- package/dist/shims/shims.js +17 -1
- package/dist/shims/shims.js.map +1 -1
- package/dist/tool.d.ts +1 -1
- package/dist/tool.js +37 -29
- package/dist/tool.js.map +1 -1
- package/dist/tracing/context.js +25 -14
- package/dist/tracing/context.js.map +1 -1
- package/dist/tracing/createSpans.js +52 -38
- package/dist/tracing/createSpans.js.map +1 -1
- package/dist/tracing/index.js +51 -15
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/processor.js +31 -20
- package/dist/tracing/processor.js.map +1 -1
- package/dist/tracing/provider.js +53 -45
- package/dist/tracing/provider.js.map +1 -1
- package/dist/tracing/spans.js +18 -10
- package/dist/tracing/spans.js.map +1 -1
- package/dist/tracing/traces.js +11 -6
- package/dist/tracing/traces.js.map +1 -1
- package/dist/tracing/utils.js +16 -9
- package/dist/tracing/utils.js.map +1 -1
- package/dist/types/aliases.js +2 -1
- package/dist/types/helpers.d.ts +1 -1
- package/dist/types/helpers.js +2 -1
- package/dist/types/index.js +44 -5
- package/dist/types/index.js.map +1 -1
- package/dist/types/protocol.d.ts +1 -221
- package/dist/types/protocol.js +188 -186
- package/dist/types/protocol.js.map +1 -1
- package/dist/types/protocol.mjs +1 -2
- package/dist/types/protocol.mjs.map +1 -1
- package/dist/types/providerData.js +2 -1
- package/dist/usage.d.ts +10 -3
- package/dist/usage.js +16 -10
- package/dist/usage.js.map +1 -1
- package/dist/usage.mjs +9 -7
- package/dist/usage.mjs.map +1 -1
- package/dist/utils/index.js +9 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/messages.js +6 -2
- package/dist/utils/messages.js.map +1 -1
- package/dist/utils/safeExecute.js +4 -1
- package/dist/utils/safeExecute.js.map +1 -1
- package/dist/utils/serialize.js +6 -2
- package/dist/utils/serialize.js.map +1 -1
- package/dist/utils/smartString.js +4 -1
- package/dist/utils/smartString.js.map +1 -1
- package/dist/utils/tools.js +16 -11
- package/dist/utils/tools.js.map +1 -1
- package/dist/utils/typeGuards.d.ts +1 -1
- package/dist/utils/typeGuards.js +6 -2
- package/dist/utils/typeGuards.js.map +1 -1
- package/package.json +23 -42
package/dist/handoff.js
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Handoff = void 0;
|
|
7
|
+
exports.getTransferMessage = getTransferMessage;
|
|
8
|
+
exports.handoff = handoff;
|
|
9
|
+
exports.getHandoff = getHandoff;
|
|
10
|
+
const errors_1 = require("./errors.js");
|
|
11
|
+
const tools_1 = require("./utils/tools.js");
|
|
12
|
+
const tools_2 = require("./utils/tools.js");
|
|
13
|
+
const context_1 = require("./tracing/context.js");
|
|
14
|
+
const logger_1 = __importDefault(require("./logger.js"));
|
|
6
15
|
/**
|
|
7
16
|
* Generates the message that will be given as tool output to the model that requested the handoff.
|
|
8
17
|
*
|
|
9
18
|
* @param agent The agent to transfer to
|
|
10
19
|
* @returns The message that will be given as tool output to the model that requested the handoff
|
|
11
20
|
*/
|
|
12
|
-
|
|
21
|
+
function getTransferMessage(agent) {
|
|
13
22
|
return JSON.stringify({ assistant: agent.name });
|
|
14
23
|
}
|
|
15
24
|
/**
|
|
@@ -19,7 +28,7 @@ export function getTransferMessage(agent) {
|
|
|
19
28
|
* @returns The name of the tool that represents the handoff
|
|
20
29
|
*/
|
|
21
30
|
function defaultHandoffToolName(agent) {
|
|
22
|
-
return `transfer_to_${toFunctionToolName(agent.name)}`;
|
|
31
|
+
return `transfer_to_${(0, tools_1.toFunctionToolName)(agent.name)}`;
|
|
23
32
|
}
|
|
24
33
|
/**
|
|
25
34
|
* Generates the description of the tool that represents the handoff.
|
|
@@ -39,7 +48,7 @@ function defaultHandoffToolDescription(agent) {
|
|
|
39
48
|
* @template TContext The context of the handoff
|
|
40
49
|
* @template TOutput The output type of the handoff
|
|
41
50
|
*/
|
|
42
|
-
|
|
51
|
+
class Handoff {
|
|
43
52
|
/**
|
|
44
53
|
* The name of the tool that represents the handoff.
|
|
45
54
|
*/
|
|
@@ -110,6 +119,7 @@ export class Handoff {
|
|
|
110
119
|
this.agent = agent;
|
|
111
120
|
}
|
|
112
121
|
}
|
|
122
|
+
exports.Handoff = Handoff;
|
|
113
123
|
/**
|
|
114
124
|
* Creates a handoff from an agent. Handoffs are automatically created when you pass an agent
|
|
115
125
|
* into the `handoffs` option of the `Agent` constructor. Alternatively, you can use this function
|
|
@@ -119,24 +129,24 @@ export class Handoff {
|
|
|
119
129
|
* @template TOutput The output type of the handoff
|
|
120
130
|
* @template TInputType The input type of the handoff
|
|
121
131
|
*/
|
|
122
|
-
|
|
132
|
+
function handoff(agent, config = {}) {
|
|
123
133
|
let parser = undefined;
|
|
124
134
|
const hasOnHandoff = !!config.onHandoff;
|
|
125
135
|
const hasInputType = !!config.inputType;
|
|
126
136
|
const hasBothOrNeitherHandoffAndInputType = hasOnHandoff === hasInputType;
|
|
127
137
|
if (!hasBothOrNeitherHandoffAndInputType) {
|
|
128
|
-
throw new UserError('You must provide either both `onHandoff` and `inputType` or neither.');
|
|
138
|
+
throw new errors_1.UserError('You must provide either both `onHandoff` and `inputType` or neither.');
|
|
129
139
|
}
|
|
130
140
|
async function onInvokeHandoff(context, inputJsonString) {
|
|
131
141
|
if (parser) {
|
|
132
142
|
if (!inputJsonString) {
|
|
133
|
-
addErrorToCurrentSpan({
|
|
143
|
+
(0, context_1.addErrorToCurrentSpan)({
|
|
134
144
|
message: `Handoff function expected non empty input but got: ${inputJsonString}`,
|
|
135
145
|
data: {
|
|
136
146
|
details: `input is empty`,
|
|
137
147
|
},
|
|
138
148
|
});
|
|
139
|
-
throw new ModelBehaviorError('Handoff function expected non empty input');
|
|
149
|
+
throw new errors_1.ModelBehaviorError('Handoff function expected non empty input');
|
|
140
150
|
}
|
|
141
151
|
try {
|
|
142
152
|
// verify that it's valid input but we don't care about the result
|
|
@@ -146,14 +156,14 @@ export function handoff(agent, config = {}) {
|
|
|
146
156
|
}
|
|
147
157
|
}
|
|
148
158
|
catch (error) {
|
|
149
|
-
addErrorToCurrentSpan({
|
|
159
|
+
(0, context_1.addErrorToCurrentSpan)({
|
|
150
160
|
message: `Invalid JSON provided`,
|
|
151
161
|
data: {},
|
|
152
162
|
});
|
|
153
|
-
if (!
|
|
154
|
-
|
|
163
|
+
if (!logger_1.default.dontLogToolData) {
|
|
164
|
+
logger_1.default.error(`Invalid JSON when parsing: ${inputJsonString}. Error: ${error}`);
|
|
155
165
|
}
|
|
156
|
-
throw new ModelBehaviorError('Invalid JSON provided');
|
|
166
|
+
throw new errors_1.ModelBehaviorError('Invalid JSON provided');
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
169
|
else {
|
|
@@ -163,7 +173,7 @@ export function handoff(agent, config = {}) {
|
|
|
163
173
|
}
|
|
164
174
|
const handoff = new Handoff(agent, onInvokeHandoff);
|
|
165
175
|
if (config.inputType) {
|
|
166
|
-
const result = getSchemaAndParserFromInputType(config.inputType, handoff.toolName);
|
|
176
|
+
const result = (0, tools_2.getSchemaAndParserFromInputType)(config.inputType, handoff.toolName);
|
|
167
177
|
handoff.inputJsonSchema = result.schema;
|
|
168
178
|
handoff.strictJsonSchema = true;
|
|
169
179
|
parser = result.parser;
|
|
@@ -186,7 +196,7 @@ export function handoff(agent, config = {}) {
|
|
|
186
196
|
* @template TContext The context of the handoff
|
|
187
197
|
* @template TOutput The output type of the handoff
|
|
188
198
|
*/
|
|
189
|
-
|
|
199
|
+
function getHandoff(agent) {
|
|
190
200
|
if (agent instanceof Handoff) {
|
|
191
201
|
return agent;
|
|
192
202
|
}
|
package/dist/handoff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handoff.js","sourceRoot":"","sources":["../src/handoff.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handoff.js","sourceRoot":"","sources":["../src/handoff.ts"],"names":[],"mappings":";;;;;;AAmDA,gDAIC;AAmLD,0BAmFC;AASD,gCAQC;AApUD,wCAAyD;AAEzD,4CAAmD;AACnD,4CAAgE;AAChE,kDAA0D;AAC1D,yDAA8B;AA8B9B;;;;;GAKG;AACH,SAAgB,kBAAkB,CAChC,KAA+B;IAE/B,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,IA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|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.user = user;
|
|
4
|
+
exports.system = system;
|
|
5
|
+
exports.assistant = assistant;
|
|
1
6
|
/**
|
|
2
7
|
* Creates a user message entry
|
|
3
8
|
*
|
|
@@ -5,7 +10,7 @@
|
|
|
5
10
|
* @param options Any additional options that will be directly passed to the model
|
|
6
11
|
* @returns a message entry
|
|
7
12
|
*/
|
|
8
|
-
|
|
13
|
+
function user(input, options) {
|
|
9
14
|
return {
|
|
10
15
|
type: 'message',
|
|
11
16
|
role: 'user',
|
|
@@ -27,7 +32,7 @@ export function user(input, options) {
|
|
|
27
32
|
* @param options Any additional options that will be directly passed to the model
|
|
28
33
|
* @returns a message entry
|
|
29
34
|
*/
|
|
30
|
-
|
|
35
|
+
function system(input, options) {
|
|
31
36
|
return {
|
|
32
37
|
type: 'message',
|
|
33
38
|
role: 'system',
|
|
@@ -42,7 +47,7 @@ export function system(input, options) {
|
|
|
42
47
|
* @param options Any additional options that will be directly passed to the model
|
|
43
48
|
* @returns a message entry
|
|
44
49
|
*/
|
|
45
|
-
|
|
50
|
+
function assistant(content, options) {
|
|
46
51
|
return {
|
|
47
52
|
type: 'message',
|
|
48
53
|
role: 'assistant',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/helpers/message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/helpers/message.ts"],"names":[],"mappings":";;AAeA,oBAkBC;AASD,wBAUC;AASD,8BAmBC;AAxED;;;;;;GAMG;AACH,SAAgB,IAAI,CAClB,KAA6B,EAC7B,OAA6B;IAE7B,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,MAAM;QACZ,OAAO,EACL,OAAO,KAAK,KAAK,QAAQ;YACvB,CAAC,CAAC;gBACE;oBACE,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,KAAK;iBACZ;aACF;YACH,CAAC,CAAC,KAAK;QACX,YAAY,EAAE,OAAO;KACtB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,KAAa,EACb,OAA6B;IAE7B,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,KAAK;QACd,YAAY,EAAE,OAAO;KACtB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,OAAoC,EACpC,OAA6B;IAE7B,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,WAAW;QACjB,OAAO,EACL,OAAO,OAAO,KAAK,QAAQ;YACzB,CAAC,CAAC;gBACE;oBACE,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,OAAO;iBACd;aACF;YACH,CAAC,CAAC,OAAO;QACb,MAAM,EAAE,WAAW;QACnB,YAAY,EAAE,OAAO;KACtB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { assistant, system, user } from './helpers/message';
|
|
|
9
9
|
export { extractAllTextOutput, RunHandoffCallItem, RunHandoffOutputItem, RunItem, RunMessageOutputItem, RunReasoningItem, RunToolApprovalItem, RunToolCallItem, RunToolCallOutputItem, } from './items';
|
|
10
10
|
export { AgentHooks } from './lifecycle';
|
|
11
11
|
export { getLogger } from './logger';
|
|
12
|
-
export { getAllMcpTools, invalidateServerToolsCache, MCPServer, MCPServerStdio, MCPServerStreamableHttp, MCPServerSSE, } from './mcp';
|
|
12
|
+
export { getAllMcpTools, invalidateServerToolsCache, mcpToFunctionTool, MCPServer, MCPServerStdio, MCPServerStreamableHttp, MCPServerSSE, GetAllMcpToolsOptions, } from './mcp';
|
|
13
13
|
export { MCPToolFilterCallable, MCPToolFilterContext, MCPToolFilterStatic, createMCPToolStaticFilter, } from './mcpUtil';
|
|
14
14
|
export { Model, ModelProvider, ModelRequest, ModelResponse, ModelSettings, ModelSettingsToolChoice, SerializedHandoff, SerializedTool, SerializedOutputType, } from './model';
|
|
15
15
|
export { setDefaultModelProvider } from './providers';
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getGlobalTraceProvider = exports.tool = exports.hostedMcpTool = exports.computerTool = exports.RunState = exports.RunContext = exports.Runner = exports.run = exports.StreamedRunResult = exports.RunResult = exports.setDefaultModelProvider = exports.createMCPToolStaticFilter = exports.MCPServerSSE = exports.MCPServerStreamableHttp = exports.MCPServerStdio = exports.mcpToFunctionTool = exports.invalidateServerToolsCache = exports.getAllMcpTools = exports.getLogger = exports.AgentHooks = exports.RunToolCallOutputItem = exports.RunToolCallItem = exports.RunToolApprovalItem = exports.RunReasoningItem = exports.RunMessageOutputItem = exports.RunHandoffOutputItem = exports.RunHandoffCallItem = exports.extractAllTextOutput = exports.user = exports.system = exports.assistant = exports.handoff = exports.Handoff = exports.getTransferMessage = exports.getHandoff = exports.defineOutputGuardrail = exports.RunItemStreamEvent = exports.RunRawModelStreamEvent = exports.RunAgentUpdatedStreamEvent = exports.SystemError = exports.UserError = exports.ToolCallError = exports.OutputGuardrailTripwireTriggered = exports.ModelBehaviorError = exports.MaxTurnsExceededError = exports.InputGuardrailTripwireTriggered = exports.GuardrailExecutionError = exports.AgentsError = exports.Agent = exports.RuntimeEventEmitter = void 0;
|
|
40
|
+
exports.protocol = exports.Usage = exports.TraceProvider = void 0;
|
|
41
|
+
const tracing_1 = require("./tracing/index.js");
|
|
42
|
+
const processor_1 = require("./tracing/processor.js");
|
|
43
|
+
var _shims_1 = require("@openai/agents-core/_shims");
|
|
44
|
+
Object.defineProperty(exports, "RuntimeEventEmitter", { enumerable: true, get: function () { return _shims_1.RuntimeEventEmitter; } });
|
|
45
|
+
var agent_1 = require("./agent.js");
|
|
46
|
+
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_1.Agent; } });
|
|
47
|
+
var errors_1 = require("./errors.js");
|
|
48
|
+
Object.defineProperty(exports, "AgentsError", { enumerable: true, get: function () { return errors_1.AgentsError; } });
|
|
49
|
+
Object.defineProperty(exports, "GuardrailExecutionError", { enumerable: true, get: function () { return errors_1.GuardrailExecutionError; } });
|
|
50
|
+
Object.defineProperty(exports, "InputGuardrailTripwireTriggered", { enumerable: true, get: function () { return errors_1.InputGuardrailTripwireTriggered; } });
|
|
51
|
+
Object.defineProperty(exports, "MaxTurnsExceededError", { enumerable: true, get: function () { return errors_1.MaxTurnsExceededError; } });
|
|
52
|
+
Object.defineProperty(exports, "ModelBehaviorError", { enumerable: true, get: function () { return errors_1.ModelBehaviorError; } });
|
|
53
|
+
Object.defineProperty(exports, "OutputGuardrailTripwireTriggered", { enumerable: true, get: function () { return errors_1.OutputGuardrailTripwireTriggered; } });
|
|
54
|
+
Object.defineProperty(exports, "ToolCallError", { enumerable: true, get: function () { return errors_1.ToolCallError; } });
|
|
55
|
+
Object.defineProperty(exports, "UserError", { enumerable: true, get: function () { return errors_1.UserError; } });
|
|
56
|
+
Object.defineProperty(exports, "SystemError", { enumerable: true, get: function () { return errors_1.SystemError; } });
|
|
57
|
+
var events_1 = require("./events.js");
|
|
58
|
+
Object.defineProperty(exports, "RunAgentUpdatedStreamEvent", { enumerable: true, get: function () { return events_1.RunAgentUpdatedStreamEvent; } });
|
|
59
|
+
Object.defineProperty(exports, "RunRawModelStreamEvent", { enumerable: true, get: function () { return events_1.RunRawModelStreamEvent; } });
|
|
60
|
+
Object.defineProperty(exports, "RunItemStreamEvent", { enumerable: true, get: function () { return events_1.RunItemStreamEvent; } });
|
|
61
|
+
var guardrail_1 = require("./guardrail.js");
|
|
62
|
+
Object.defineProperty(exports, "defineOutputGuardrail", { enumerable: true, get: function () { return guardrail_1.defineOutputGuardrail; } });
|
|
63
|
+
var handoff_1 = require("./handoff.js");
|
|
64
|
+
Object.defineProperty(exports, "getHandoff", { enumerable: true, get: function () { return handoff_1.getHandoff; } });
|
|
65
|
+
Object.defineProperty(exports, "getTransferMessage", { enumerable: true, get: function () { return handoff_1.getTransferMessage; } });
|
|
66
|
+
Object.defineProperty(exports, "Handoff", { enumerable: true, get: function () { return handoff_1.Handoff; } });
|
|
67
|
+
Object.defineProperty(exports, "handoff", { enumerable: true, get: function () { return handoff_1.handoff; } });
|
|
68
|
+
var message_1 = require("./helpers/message.js");
|
|
69
|
+
Object.defineProperty(exports, "assistant", { enumerable: true, get: function () { return message_1.assistant; } });
|
|
70
|
+
Object.defineProperty(exports, "system", { enumerable: true, get: function () { return message_1.system; } });
|
|
71
|
+
Object.defineProperty(exports, "user", { enumerable: true, get: function () { return message_1.user; } });
|
|
72
|
+
var items_1 = require("./items.js");
|
|
73
|
+
Object.defineProperty(exports, "extractAllTextOutput", { enumerable: true, get: function () { return items_1.extractAllTextOutput; } });
|
|
74
|
+
Object.defineProperty(exports, "RunHandoffCallItem", { enumerable: true, get: function () { return items_1.RunHandoffCallItem; } });
|
|
75
|
+
Object.defineProperty(exports, "RunHandoffOutputItem", { enumerable: true, get: function () { return items_1.RunHandoffOutputItem; } });
|
|
76
|
+
Object.defineProperty(exports, "RunMessageOutputItem", { enumerable: true, get: function () { return items_1.RunMessageOutputItem; } });
|
|
77
|
+
Object.defineProperty(exports, "RunReasoningItem", { enumerable: true, get: function () { return items_1.RunReasoningItem; } });
|
|
78
|
+
Object.defineProperty(exports, "RunToolApprovalItem", { enumerable: true, get: function () { return items_1.RunToolApprovalItem; } });
|
|
79
|
+
Object.defineProperty(exports, "RunToolCallItem", { enumerable: true, get: function () { return items_1.RunToolCallItem; } });
|
|
80
|
+
Object.defineProperty(exports, "RunToolCallOutputItem", { enumerable: true, get: function () { return items_1.RunToolCallOutputItem; } });
|
|
81
|
+
var lifecycle_1 = require("./lifecycle.js");
|
|
82
|
+
Object.defineProperty(exports, "AgentHooks", { enumerable: true, get: function () { return lifecycle_1.AgentHooks; } });
|
|
83
|
+
var logger_1 = require("./logger.js");
|
|
84
|
+
Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return logger_1.getLogger; } });
|
|
85
|
+
var mcp_1 = require("./mcp.js");
|
|
86
|
+
Object.defineProperty(exports, "getAllMcpTools", { enumerable: true, get: function () { return mcp_1.getAllMcpTools; } });
|
|
87
|
+
Object.defineProperty(exports, "invalidateServerToolsCache", { enumerable: true, get: function () { return mcp_1.invalidateServerToolsCache; } });
|
|
88
|
+
Object.defineProperty(exports, "mcpToFunctionTool", { enumerable: true, get: function () { return mcp_1.mcpToFunctionTool; } });
|
|
89
|
+
Object.defineProperty(exports, "MCPServerStdio", { enumerable: true, get: function () { return mcp_1.MCPServerStdio; } });
|
|
90
|
+
Object.defineProperty(exports, "MCPServerStreamableHttp", { enumerable: true, get: function () { return mcp_1.MCPServerStreamableHttp; } });
|
|
91
|
+
Object.defineProperty(exports, "MCPServerSSE", { enumerable: true, get: function () { return mcp_1.MCPServerSSE; } });
|
|
92
|
+
var mcpUtil_1 = require("./mcpUtil.js");
|
|
93
|
+
Object.defineProperty(exports, "createMCPToolStaticFilter", { enumerable: true, get: function () { return mcpUtil_1.createMCPToolStaticFilter; } });
|
|
94
|
+
var providers_1 = require("./providers.js");
|
|
95
|
+
Object.defineProperty(exports, "setDefaultModelProvider", { enumerable: true, get: function () { return providers_1.setDefaultModelProvider; } });
|
|
96
|
+
var result_1 = require("./result.js");
|
|
97
|
+
Object.defineProperty(exports, "RunResult", { enumerable: true, get: function () { return result_1.RunResult; } });
|
|
98
|
+
Object.defineProperty(exports, "StreamedRunResult", { enumerable: true, get: function () { return result_1.StreamedRunResult; } });
|
|
99
|
+
var run_1 = require("./run.js");
|
|
100
|
+
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return run_1.run; } });
|
|
101
|
+
Object.defineProperty(exports, "Runner", { enumerable: true, get: function () { return run_1.Runner; } });
|
|
102
|
+
var runContext_1 = require("./runContext.js");
|
|
103
|
+
Object.defineProperty(exports, "RunContext", { enumerable: true, get: function () { return runContext_1.RunContext; } });
|
|
104
|
+
var runState_1 = require("./runState.js");
|
|
105
|
+
Object.defineProperty(exports, "RunState", { enumerable: true, get: function () { return runState_1.RunState; } });
|
|
106
|
+
var tool_1 = require("./tool.js");
|
|
107
|
+
Object.defineProperty(exports, "computerTool", { enumerable: true, get: function () { return tool_1.computerTool; } });
|
|
108
|
+
Object.defineProperty(exports, "hostedMcpTool", { enumerable: true, get: function () { return tool_1.hostedMcpTool; } });
|
|
109
|
+
Object.defineProperty(exports, "tool", { enumerable: true, get: function () { return tool_1.tool; } });
|
|
110
|
+
__exportStar(require("./tracing/index.js"), exports);
|
|
111
|
+
var provider_1 = require("./tracing/provider.js");
|
|
112
|
+
Object.defineProperty(exports, "getGlobalTraceProvider", { enumerable: true, get: function () { return provider_1.getGlobalTraceProvider; } });
|
|
113
|
+
Object.defineProperty(exports, "TraceProvider", { enumerable: true, get: function () { return provider_1.TraceProvider; } });
|
|
114
|
+
var usage_1 = require("./usage.js");
|
|
115
|
+
Object.defineProperty(exports, "Usage", { enumerable: true, get: function () { return usage_1.Usage; } });
|
|
116
|
+
/**
|
|
117
|
+
* Exporting the whole protocol as an object here. This contains both the types
|
|
118
|
+
* and the zod schemas for parsing the protocol.
|
|
119
|
+
*/
|
|
120
|
+
exports.protocol = __importStar(require("./types/protocol.js"));
|
|
25
121
|
/**
|
|
26
122
|
* Add the default processor, which exports traces and spans to the backend in batches. You can
|
|
27
123
|
* change the default behavior by either:
|
|
28
124
|
* 1. calling addTraceProcessor, which adds additional processors, or
|
|
29
125
|
* 2. calling setTraceProcessors, which sets the processors and discards the default one
|
|
30
126
|
*/
|
|
31
|
-
addTraceProcessor(defaultProcessor());
|
|
127
|
+
(0, tracing_1.addTraceProcessor)((0, processor_1.defaultProcessor)());
|
|
32
128
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA8C;AAC9C,sDAAuD;AAEvD,qDAAiE;AAAxD,6GAAA,mBAAmB,OAAA;AAC5B,oCAUiB;AATf,8FAAA,KAAK,OAAA;AAWP,sCAUkB;AAThB,qGAAA,WAAW,OAAA;AACX,iHAAA,uBAAuB,OAAA;AACvB,yHAAA,+BAA+B,OAAA;AAC/B,+GAAA,qBAAqB,OAAA;AACrB,4GAAA,kBAAkB,OAAA;AAClB,0HAAA,gCAAgC,OAAA;AAChC,uGAAA,aAAa,OAAA;AACb,mGAAA,SAAS,OAAA;AACT,qGAAA,WAAW,OAAA;AAEb,sCAKkB;AAJhB,oHAAA,0BAA0B,OAAA;AAC1B,gHAAA,sBAAsB,OAAA;AACtB,4GAAA,kBAAkB,OAAA;AAGpB,4CAcqB;AAbnB,kHAAA,qBAAqB,OAAA;AAcvB,wCAMmB;AALjB,qGAAA,UAAU,OAAA;AACV,6GAAA,kBAAkB,OAAA;AAClB,kGAAA,OAAO,OAAA;AACP,kGAAA,OAAO,OAAA;AAGT,gDAA4D;AAAnD,oGAAA,SAAS,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,+FAAA,IAAI,OAAA;AAChC,oCAUiB;AATf,6GAAA,oBAAoB,OAAA;AACpB,2GAAA,kBAAkB,OAAA;AAClB,6GAAA,oBAAoB,OAAA;AAEpB,6GAAA,oBAAoB,OAAA;AACpB,yGAAA,gBAAgB,OAAA;AAChB,4GAAA,mBAAmB,OAAA;AACnB,wGAAA,eAAe,OAAA;AACf,8GAAA,qBAAqB,OAAA;AAEvB,4CAAyC;AAAhC,uGAAA,UAAU,OAAA;AACnB,sCAAqC;AAA5B,mGAAA,SAAS,OAAA;AAClB,gCASe;AARb,qGAAA,cAAc,OAAA;AACd,iHAAA,0BAA0B,OAAA;AAC1B,wGAAA,iBAAiB,OAAA;AAEjB,qGAAA,cAAc,OAAA;AACd,8GAAA,uBAAuB,OAAA;AACvB,mGAAA,YAAY,OAAA;AAGd,wCAKmB;AADjB,oHAAA,yBAAyB,OAAA;AAa3B,4CAAsD;AAA7C,oHAAA,uBAAuB,OAAA;AAChC,sCAAwD;AAA/C,mGAAA,SAAS,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AACrC,gCAOe;AAJb,0FAAA,GAAG,OAAA;AAEH,6FAAA,MAAM,OAAA;AAGR,8CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,0CAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,kCAWgB;AARd,oGAAA,YAAY,OAAA;AAEZ,qGAAA,aAAa,OAAA;AAIb,4FAAA,IAAI,OAAA;AAGN,qDAA0B;AAC1B,kDAA2E;AAAlE,kHAAA,sBAAsB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAyB9C,oCAAgC;AAAvB,8FAAA,KAAK,OAAA;AAEd;;;GAGG;AACH,gEAA6C;AAE7C;;;;;GAKG;AACH,IAAA,2BAAiB,EAAC,IAAA,4BAAgB,GAAE,CAAC,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ export { assistant, system, user } from "./helpers/message.mjs";
|
|
|
10
10
|
export { extractAllTextOutput, RunHandoffCallItem, RunHandoffOutputItem, RunMessageOutputItem, RunReasoningItem, RunToolApprovalItem, RunToolCallItem, RunToolCallOutputItem, } from "./items.mjs";
|
|
11
11
|
export { AgentHooks } from "./lifecycle.mjs";
|
|
12
12
|
export { getLogger } from "./logger.mjs";
|
|
13
|
-
export { getAllMcpTools, invalidateServerToolsCache, MCPServerStdio, MCPServerStreamableHttp, MCPServerSSE, } from "./mcp.mjs";
|
|
13
|
+
export { getAllMcpTools, invalidateServerToolsCache, mcpToFunctionTool, MCPServerStdio, MCPServerStreamableHttp, MCPServerSSE, } from "./mcp.mjs";
|
|
14
14
|
export { createMCPToolStaticFilter, } from "./mcpUtil.mjs";
|
|
15
15
|
export { setDefaultModelProvider } from "./providers.mjs";
|
|
16
16
|
export { RunResult, StreamedRunResult } from "./result.mjs";
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"OAAO,EAAE,iBAAiB,EAAE;OACrB,EAAE,gBAAgB,EAAE;OAEpB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B;OACzD,EACL,KAAK,GASN;OAEM,EACL,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,qBAAqB,EACrB,kBAAkB,EAClB,gCAAgC,EAChC,aAAa,EACb,SAAS,EACT,WAAW,GACZ;OACM,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,GAEnB;OACM,EACL,qBAAqB,GAatB;OACM,EACL,UAAU,EACV,kBAAkB,EAClB,OAAO,EACP,OAAO,GAER;OACM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;OAC3B,EACL,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EAEpB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACtB;OACM,EAAE,UAAU,EAAE;OACd,EAAE,SAAS,EAAE;OACb,EACL,cAAc,EACd,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"OAAO,EAAE,iBAAiB,EAAE;OACrB,EAAE,gBAAgB,EAAE;OAEpB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B;OACzD,EACL,KAAK,GASN;OAEM,EACL,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,qBAAqB,EACrB,kBAAkB,EAClB,gCAAgC,EAChC,aAAa,EACb,SAAS,EACT,WAAW,GACZ;OACM,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,GAEnB;OACM,EACL,qBAAqB,GAatB;OACM,EACL,UAAU,EACV,kBAAkB,EAClB,OAAO,EACP,OAAO,GAER;OACM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;OAC3B,EACL,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EAEpB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACtB;OACM,EAAE,UAAU,EAAE;OACd,EAAE,SAAS,EAAE;OACb,EACL,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EAEjB,cAAc,EACd,uBAAuB,EACvB,YAAY,GAEb;OACM,EAIL,yBAAyB,GAC1B;OAYM,EAAE,uBAAuB,EAAE;OAC3B,EAAE,SAAS,EAAE,iBAAiB,EAAE;OAChC,EAGL,GAAG,EAEH,MAAM,GAEP;OACM,EAAE,UAAU,EAAE;OACd,EAAE,QAAQ,EAAE;OACZ,EAGL,YAAY,EAEZ,aAAa,EAIb,IAAI,GAEL;;OAEM,EAAE,sBAAsB,EAAE,aAAa,EAAE;OAyBzC,EAAE,KAAK,EAAE;OAMT,KAAK,QAAQ;AAEpB;;;;;GAKG;AACH,iBAAiB,CAAC,gBAAgB,EAAE,CAAC,CAAC"}
|
package/dist/items.d.ts
CHANGED
|
@@ -16,10 +16,6 @@ export declare class RunItemBase {
|
|
|
16
16
|
type: "output_text";
|
|
17
17
|
text: string;
|
|
18
18
|
providerData?: Record<string, any> | undefined;
|
|
19
|
-
} | {
|
|
20
|
-
type: "input_text";
|
|
21
|
-
text: string;
|
|
22
|
-
providerData?: Record<string, any> | undefined;
|
|
23
19
|
} | {
|
|
24
20
|
type: "audio";
|
|
25
21
|
audio: string | {
|
|
@@ -201,10 +197,6 @@ export declare class RunMessageOutputItem extends RunItemBase {
|
|
|
201
197
|
type: "output_text";
|
|
202
198
|
text: string;
|
|
203
199
|
providerData?: Record<string, any> | undefined;
|
|
204
|
-
} | {
|
|
205
|
-
type: "input_text";
|
|
206
|
-
text: string;
|
|
207
|
-
providerData?: Record<string, any> | undefined;
|
|
208
200
|
} | {
|
|
209
201
|
type: "audio";
|
|
210
202
|
audio: string | {
|
|
@@ -387,10 +379,6 @@ export declare class RunToolCallItem extends RunItemBase {
|
|
|
387
379
|
type: "output_text";
|
|
388
380
|
text: string;
|
|
389
381
|
providerData?: Record<string, any> | undefined;
|
|
390
|
-
} | {
|
|
391
|
-
type: "input_text";
|
|
392
|
-
text: string;
|
|
393
|
-
providerData?: Record<string, any> | undefined;
|
|
394
382
|
} | {
|
|
395
383
|
type: "audio";
|
|
396
384
|
audio: string | {
|
|
@@ -574,10 +562,6 @@ export declare class RunToolCallOutputItem extends RunItemBase {
|
|
|
574
562
|
type: "output_text";
|
|
575
563
|
text: string;
|
|
576
564
|
providerData?: Record<string, any> | undefined;
|
|
577
|
-
} | {
|
|
578
|
-
type: "input_text";
|
|
579
|
-
text: string;
|
|
580
|
-
providerData?: Record<string, any> | undefined;
|
|
581
565
|
} | {
|
|
582
566
|
type: "audio";
|
|
583
567
|
audio: string | {
|
|
@@ -759,10 +743,6 @@ export declare class RunReasoningItem extends RunItemBase {
|
|
|
759
743
|
type: "output_text";
|
|
760
744
|
text: string;
|
|
761
745
|
providerData?: Record<string, any> | undefined;
|
|
762
|
-
} | {
|
|
763
|
-
type: "input_text";
|
|
764
|
-
text: string;
|
|
765
|
-
providerData?: Record<string, any> | undefined;
|
|
766
746
|
} | {
|
|
767
747
|
type: "audio";
|
|
768
748
|
audio: string | {
|
|
@@ -944,10 +924,6 @@ export declare class RunHandoffCallItem extends RunItemBase {
|
|
|
944
924
|
type: "output_text";
|
|
945
925
|
text: string;
|
|
946
926
|
providerData?: Record<string, any> | undefined;
|
|
947
|
-
} | {
|
|
948
|
-
type: "input_text";
|
|
949
|
-
text: string;
|
|
950
|
-
providerData?: Record<string, any> | undefined;
|
|
951
927
|
} | {
|
|
952
928
|
type: "audio";
|
|
953
929
|
audio: string | {
|
|
@@ -1133,10 +1109,6 @@ export declare class RunHandoffOutputItem extends RunItemBase {
|
|
|
1133
1109
|
type: "output_text";
|
|
1134
1110
|
text: string;
|
|
1135
1111
|
providerData?: Record<string, any> | undefined;
|
|
1136
|
-
} | {
|
|
1137
|
-
type: "input_text";
|
|
1138
|
-
text: string;
|
|
1139
|
-
providerData?: Record<string, any> | undefined;
|
|
1140
1112
|
} | {
|
|
1141
1113
|
type: "audio";
|
|
1142
1114
|
audio: string | {
|
|
@@ -1318,10 +1290,6 @@ export declare class RunToolApprovalItem extends RunItemBase {
|
|
|
1318
1290
|
type: "output_text";
|
|
1319
1291
|
text: string;
|
|
1320
1292
|
providerData?: Record<string, any> | undefined;
|
|
1321
|
-
} | {
|
|
1322
|
-
type: "input_text";
|
|
1323
|
-
text: string;
|
|
1324
|
-
providerData?: Record<string, any> | undefined;
|
|
1325
1293
|
} | {
|
|
1326
1294
|
type: "audio";
|
|
1327
1295
|
audio: string | {
|
package/dist/items.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunToolApprovalItem = exports.RunHandoffOutputItem = exports.RunHandoffCallItem = exports.RunReasoningItem = exports.RunToolCallOutputItem = exports.RunToolCallItem = exports.RunMessageOutputItem = exports.RunItemBase = void 0;
|
|
4
|
+
exports.extractAllTextOutput = extractAllTextOutput;
|
|
5
|
+
const smartString_1 = require("./utils/smartString.js");
|
|
6
|
+
class RunItemBase {
|
|
3
7
|
type = 'base_item';
|
|
4
8
|
rawItem;
|
|
5
9
|
toJSON() {
|
|
@@ -9,7 +13,8 @@ export class RunItemBase {
|
|
|
9
13
|
};
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
|
-
|
|
16
|
+
exports.RunItemBase = RunItemBase;
|
|
17
|
+
class RunMessageOutputItem extends RunItemBase {
|
|
13
18
|
rawItem;
|
|
14
19
|
agent;
|
|
15
20
|
type = 'message_output_item';
|
|
@@ -34,7 +39,8 @@ export class RunMessageOutputItem extends RunItemBase {
|
|
|
34
39
|
return content;
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
|
-
|
|
42
|
+
exports.RunMessageOutputItem = RunMessageOutputItem;
|
|
43
|
+
class RunToolCallItem extends RunItemBase {
|
|
38
44
|
rawItem;
|
|
39
45
|
agent;
|
|
40
46
|
type = 'tool_call_item';
|
|
@@ -50,7 +56,8 @@ export class RunToolCallItem extends RunItemBase {
|
|
|
50
56
|
};
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
|
-
|
|
59
|
+
exports.RunToolCallItem = RunToolCallItem;
|
|
60
|
+
class RunToolCallOutputItem extends RunItemBase {
|
|
54
61
|
rawItem;
|
|
55
62
|
agent;
|
|
56
63
|
output;
|
|
@@ -65,11 +72,12 @@ export class RunToolCallOutputItem extends RunItemBase {
|
|
|
65
72
|
return {
|
|
66
73
|
...super.toJSON(),
|
|
67
74
|
agent: this.agent.toJSON(),
|
|
68
|
-
output: toSmartString(this.output),
|
|
75
|
+
output: (0, smartString_1.toSmartString)(this.output),
|
|
69
76
|
};
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
|
-
|
|
79
|
+
exports.RunToolCallOutputItem = RunToolCallOutputItem;
|
|
80
|
+
class RunReasoningItem extends RunItemBase {
|
|
73
81
|
rawItem;
|
|
74
82
|
agent;
|
|
75
83
|
type = 'reasoning_item';
|
|
@@ -85,7 +93,8 @@ export class RunReasoningItem extends RunItemBase {
|
|
|
85
93
|
};
|
|
86
94
|
}
|
|
87
95
|
}
|
|
88
|
-
|
|
96
|
+
exports.RunReasoningItem = RunReasoningItem;
|
|
97
|
+
class RunHandoffCallItem extends RunItemBase {
|
|
89
98
|
rawItem;
|
|
90
99
|
agent;
|
|
91
100
|
type = 'handoff_call_item';
|
|
@@ -101,7 +110,8 @@ export class RunHandoffCallItem extends RunItemBase {
|
|
|
101
110
|
};
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
|
-
|
|
113
|
+
exports.RunHandoffCallItem = RunHandoffCallItem;
|
|
114
|
+
class RunHandoffOutputItem extends RunItemBase {
|
|
105
115
|
rawItem;
|
|
106
116
|
sourceAgent;
|
|
107
117
|
targetAgent;
|
|
@@ -120,7 +130,8 @@ export class RunHandoffOutputItem extends RunItemBase {
|
|
|
120
130
|
};
|
|
121
131
|
}
|
|
122
132
|
}
|
|
123
|
-
|
|
133
|
+
exports.RunHandoffOutputItem = RunHandoffOutputItem;
|
|
134
|
+
class RunToolApprovalItem extends RunItemBase {
|
|
124
135
|
rawItem;
|
|
125
136
|
agent;
|
|
126
137
|
type = 'tool_approval_item';
|
|
@@ -136,6 +147,7 @@ export class RunToolApprovalItem extends RunItemBase {
|
|
|
136
147
|
};
|
|
137
148
|
}
|
|
138
149
|
}
|
|
150
|
+
exports.RunToolApprovalItem = RunToolApprovalItem;
|
|
139
151
|
/**
|
|
140
152
|
* Extract all text output from a list of run items by concatenating the content of all
|
|
141
153
|
* message output items.
|
|
@@ -143,7 +155,7 @@ export class RunToolApprovalItem extends RunItemBase {
|
|
|
143
155
|
* @param items - The list of run items to extract text from.
|
|
144
156
|
* @returns A string of all the text output from the run items.
|
|
145
157
|
*/
|
|
146
|
-
|
|
158
|
+
function extractAllTextOutput(items) {
|
|
147
159
|
return items
|
|
148
160
|
.filter((item) => item.type === 'message_output_item')
|
|
149
161
|
.map((item) => item.content)
|
package/dist/items.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.js","sourceRoot":"","sources":["../src/items.ts"],"names":[],"mappings":"
|
|
1
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
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunHooks = exports.AgentHooks = exports.EventEmitterDelegate = void 0;
|
|
4
|
+
const _shims_1 = require("@openai/agents-core/_shims");
|
|
5
|
+
class EventEmitterDelegate {
|
|
3
6
|
on(type, listener) {
|
|
4
7
|
this.eventEmitter.on(type, listener);
|
|
5
8
|
return this.eventEmitter;
|
|
@@ -16,18 +19,21 @@ export class EventEmitterDelegate {
|
|
|
16
19
|
return this.eventEmitter;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
22
|
+
exports.EventEmitterDelegate = EventEmitterDelegate;
|
|
19
23
|
/**
|
|
20
24
|
* Event emitter that every Agent instance inherits from and that emits events for the lifecycle
|
|
21
25
|
* of the agent.
|
|
22
26
|
*/
|
|
23
|
-
|
|
24
|
-
eventEmitter = new RuntimeEventEmitter();
|
|
27
|
+
class AgentHooks extends EventEmitterDelegate {
|
|
28
|
+
eventEmitter = new _shims_1.RuntimeEventEmitter();
|
|
25
29
|
}
|
|
30
|
+
exports.AgentHooks = AgentHooks;
|
|
26
31
|
/**
|
|
27
32
|
* Event emitter that every Runner instance inherits from and that emits events for the lifecycle
|
|
28
33
|
* of the overall run.
|
|
29
34
|
*/
|
|
30
|
-
|
|
31
|
-
eventEmitter = new RuntimeEventEmitter();
|
|
35
|
+
class RunHooks extends EventEmitterDelegate {
|
|
36
|
+
eventEmitter = new _shims_1.RuntimeEventEmitter();
|
|
32
37
|
}
|
|
38
|
+
exports.RunHooks = RunHooks;
|
|
33
39
|
//# sourceMappingURL=lifecycle.js.map
|