@openai/agents-core 0.3.7 → 0.3.9
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/errors.d.ts +40 -0
- package/dist/errors.js +39 -1
- package/dist/errors.js.map +1 -1
- package/dist/errors.mjs +35 -0
- package/dist/errors.mjs.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/metadata.js +2 -2
- package/dist/metadata.mjs +2 -2
- package/dist/result.d.ts +17 -0
- package/dist/result.js +71 -24
- package/dist/result.js.map +1 -1
- package/dist/result.mjs +69 -22
- package/dist/result.mjs.map +1 -1
- package/dist/run.d.ts +14 -47
- package/dist/run.js +421 -994
- package/dist/run.js.map +1 -1
- package/dist/run.mjs +405 -978
- package/dist/run.mjs.map +1 -1
- package/dist/runState.d.ts +1286 -172
- package/dist/runState.js +146 -16
- package/dist/runState.js.map +1 -1
- package/dist/runState.mjs +142 -12
- package/dist/runState.mjs.map +1 -1
- package/dist/runner/constants.d.ts +1 -0
- package/dist/runner/constants.js +6 -0
- package/dist/runner/constants.js.map +1 -0
- package/dist/runner/constants.mjs +3 -0
- package/dist/runner/constants.mjs.map +1 -0
- package/dist/runner/conversation.d.ts +85 -0
- package/dist/runner/conversation.js +275 -0
- package/dist/runner/conversation.js.map +1 -0
- package/dist/runner/conversation.mjs +269 -0
- package/dist/runner/conversation.mjs.map +1 -0
- package/dist/runner/guardrails.d.ts +23 -0
- package/dist/runner/guardrails.js +174 -0
- package/dist/runner/guardrails.js.map +1 -0
- package/dist/runner/guardrails.mjs +166 -0
- package/dist/runner/guardrails.mjs.map +1 -0
- package/dist/runner/items.d.ts +18 -0
- package/dist/runner/items.js +89 -0
- package/dist/runner/items.js.map +1 -0
- package/dist/runner/items.mjs +79 -0
- package/dist/runner/items.mjs.map +1 -0
- package/dist/runner/mcpApprovals.d.ts +25 -0
- package/dist/runner/mcpApprovals.js +66 -0
- package/dist/runner/mcpApprovals.js.map +1 -0
- package/dist/runner/mcpApprovals.mjs +63 -0
- package/dist/runner/mcpApprovals.mjs.map +1 -0
- package/dist/runner/modelOutputs.d.ts +10 -0
- package/dist/runner/modelOutputs.js +206 -0
- package/dist/runner/modelOutputs.js.map +1 -0
- package/dist/runner/modelOutputs.mjs +203 -0
- package/dist/runner/modelOutputs.mjs.map +1 -0
- package/dist/runner/modelPreparation.d.ts +8 -0
- package/dist/runner/modelPreparation.js +41 -0
- package/dist/runner/modelPreparation.js.map +1 -0
- package/dist/runner/modelPreparation.mjs +38 -0
- package/dist/runner/modelPreparation.mjs.map +1 -0
- package/dist/runner/modelSettings.d.ts +20 -0
- package/dist/runner/modelSettings.js +97 -0
- package/dist/runner/modelSettings.js.map +1 -0
- package/dist/runner/modelSettings.mjs +92 -0
- package/dist/runner/modelSettings.mjs.map +1 -0
- package/dist/runner/runLoop.d.ts +32 -0
- package/dist/runner/runLoop.js +62 -0
- package/dist/runner/runLoop.js.map +1 -0
- package/dist/runner/runLoop.mjs +57 -0
- package/dist/runner/runLoop.mjs.map +1 -0
- package/dist/runner/sessionPersistence.d.ts +26 -0
- package/dist/runner/sessionPersistence.js +441 -0
- package/dist/runner/sessionPersistence.js.map +1 -0
- package/dist/runner/sessionPersistence.mjs +431 -0
- package/dist/runner/sessionPersistence.mjs.map +1 -0
- package/dist/runner/steps.d.ts +48 -0
- package/dist/runner/steps.js +40 -0
- package/dist/runner/steps.js.map +1 -0
- package/dist/runner/steps.mjs +36 -0
- package/dist/runner/steps.mjs.map +1 -0
- package/dist/runner/streaming.d.ts +9 -0
- package/dist/runner/streaming.js +74 -0
- package/dist/runner/streaming.js.map +1 -0
- package/dist/runner/streaming.mjs +65 -0
- package/dist/runner/streaming.mjs.map +1 -0
- package/dist/runner/toolExecution.d.ts +15 -0
- package/dist/runner/toolExecution.js +997 -0
- package/dist/runner/toolExecution.js.map +1 -0
- package/dist/runner/toolExecution.mjs +984 -0
- package/dist/runner/toolExecution.mjs.map +1 -0
- package/dist/runner/toolUseTracker.d.ts +9 -0
- package/dist/runner/toolUseTracker.js +34 -0
- package/dist/runner/toolUseTracker.js.map +1 -0
- package/dist/runner/toolUseTracker.mjs +30 -0
- package/dist/runner/toolUseTracker.mjs.map +1 -0
- package/dist/runner/tracing.d.ts +23 -0
- package/dist/runner/tracing.js +45 -0
- package/dist/runner/tracing.js.map +1 -0
- package/dist/runner/tracing.mjs +41 -0
- package/dist/runner/tracing.mjs.map +1 -0
- package/dist/runner/turnPreparation.d.ts +30 -0
- package/dist/runner/turnPreparation.js +80 -0
- package/dist/runner/turnPreparation.js.map +1 -0
- package/dist/runner/turnPreparation.mjs +74 -0
- package/dist/runner/turnPreparation.mjs.map +1 -0
- package/dist/runner/turnResolution.d.ts +3 -0
- package/dist/runner/turnResolution.js +531 -0
- package/dist/runner/turnResolution.js.map +1 -0
- package/dist/runner/turnResolution.mjs +526 -0
- package/dist/runner/turnResolution.mjs.map +1 -0
- package/dist/runner/types.d.ts +66 -0
- package/dist/runner/types.js +3 -0
- package/dist/runner/types.js.map +1 -0
- package/dist/runner/types.mjs +2 -0
- package/dist/runner/types.mjs.map +1 -0
- package/dist/shims/mcp-server/node.js +51 -6
- package/dist/shims/mcp-server/node.js.map +1 -1
- package/dist/shims/mcp-server/node.mjs +51 -6
- package/dist/shims/mcp-server/node.mjs.map +1 -1
- package/dist/tool.d.ts +28 -2
- package/dist/tool.js +7 -1
- package/dist/tool.js.map +1 -1
- package/dist/tool.mjs +8 -2
- package/dist/tool.mjs.map +1 -1
- package/dist/toolGuardrail.d.ts +101 -0
- package/dist/toolGuardrail.js +58 -0
- package/dist/toolGuardrail.js.map +1 -0
- package/dist/toolGuardrail.mjs +51 -0
- package/dist/toolGuardrail.mjs.map +1 -0
- package/dist/tracing/config.d.ts +3 -0
- package/dist/tracing/config.js +3 -0
- package/dist/tracing/config.js.map +1 -0
- package/dist/tracing/config.mjs +2 -0
- package/dist/tracing/config.mjs.map +1 -0
- package/dist/tracing/context.d.ts +2 -0
- package/dist/tracing/context.js +95 -24
- package/dist/tracing/context.js.map +1 -1
- package/dist/tracing/context.mjs +95 -24
- package/dist/tracing/context.mjs.map +1 -1
- package/dist/tracing/createSpans.d.ts +11 -11
- package/dist/tracing/index.d.ts +2 -0
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/tracing/provider.js +54 -4
- package/dist/tracing/provider.js.map +1 -1
- package/dist/tracing/provider.mjs +54 -4
- package/dist/tracing/provider.mjs.map +1 -1
- package/dist/tracing/spans.d.ts +2 -0
- package/dist/tracing/spans.js +6 -0
- package/dist/tracing/spans.js.map +1 -1
- package/dist/tracing/spans.mjs +6 -0
- package/dist/tracing/spans.mjs.map +1 -1
- package/dist/tracing/traces.d.ts +11 -1
- package/dist/tracing/traces.js +15 -2
- package/dist/tracing/traces.js.map +1 -1
- package/dist/tracing/traces.mjs +15 -2
- package/dist/tracing/traces.mjs.map +1 -1
- package/dist/types/protocol.d.ts +11 -0
- package/dist/types/protocol.js +1 -0
- package/dist/types/protocol.js.map +1 -1
- package/dist/types/protocol.mjs +1 -0
- package/dist/types/protocol.mjs.map +1 -1
- package/dist/utils/binary.d.ts +6 -0
- package/dist/utils/binary.js +53 -0
- package/dist/utils/binary.js.map +1 -0
- package/dist/utils/binary.mjs +49 -0
- package/dist/utils/binary.mjs.map +1 -0
- package/dist/utils/toolGuardrails.d.ts +24 -0
- package/dist/utils/toolGuardrails.js +58 -0
- package/dist/utils/toolGuardrails.js.map +1 -0
- package/dist/utils/toolGuardrails.mjs +54 -0
- package/dist/utils/toolGuardrails.mjs.map +1 -0
- package/package.json +4 -3
- package/dist/runImplementation.d.ts +0 -161
- package/dist/runImplementation.js +0 -2054
- package/dist/runImplementation.js.map +0 -1
- package/dist/runImplementation.mjs +0 -2028
- package/dist/runImplementation.mjs.map +0 -1
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { Agent } from './agent';
|
|
2
|
-
import { Handoff } from './handoff';
|
|
3
|
-
import { RunItem, RunToolApprovalItem } from './items';
|
|
4
|
-
import { Logger } from './logger';
|
|
5
|
-
import { ModelResponse } from './model';
|
|
6
|
-
import { ComputerTool, FunctionTool, HostedMCPTool, ShellTool, ApplyPatchTool } from './tool';
|
|
7
|
-
import { AgentInputItem, UnknownContext } from './types';
|
|
8
|
-
import { Runner } from './run';
|
|
9
|
-
import { RunContext } from './runContext';
|
|
10
|
-
import { StreamedRunResult } from './result';
|
|
11
|
-
import { z } from 'zod';
|
|
12
|
-
import * as protocol from './types/protocol';
|
|
13
|
-
import { type Session, type SessionInputCallback } from './memory/session';
|
|
14
|
-
type ToolRunHandoff = {
|
|
15
|
-
toolCall: protocol.FunctionCallItem;
|
|
16
|
-
handoff: Handoff<any, any>;
|
|
17
|
-
};
|
|
18
|
-
type ToolRunFunction<TContext = UnknownContext> = {
|
|
19
|
-
toolCall: protocol.FunctionCallItem;
|
|
20
|
-
tool: FunctionTool<TContext>;
|
|
21
|
-
};
|
|
22
|
-
type ToolRunComputer = {
|
|
23
|
-
toolCall: protocol.ComputerUseCallItem;
|
|
24
|
-
computer: ComputerTool<any, any>;
|
|
25
|
-
};
|
|
26
|
-
type ToolRunShell = {
|
|
27
|
-
toolCall: protocol.ShellCallItem;
|
|
28
|
-
shell: ShellTool;
|
|
29
|
-
};
|
|
30
|
-
type ToolRunApplyPatch = {
|
|
31
|
-
toolCall: protocol.ApplyPatchCallItem;
|
|
32
|
-
applyPatch: ApplyPatchTool;
|
|
33
|
-
};
|
|
34
|
-
type ToolRunMCPApprovalRequest = {
|
|
35
|
-
requestItem: RunToolApprovalItem;
|
|
36
|
-
mcpTool: HostedMCPTool;
|
|
37
|
-
};
|
|
38
|
-
export type ProcessedResponse<TContext = UnknownContext> = {
|
|
39
|
-
newItems: RunItem[];
|
|
40
|
-
handoffs: ToolRunHandoff[];
|
|
41
|
-
functions: ToolRunFunction<TContext>[];
|
|
42
|
-
computerActions: ToolRunComputer[];
|
|
43
|
-
shellActions: ToolRunShell[];
|
|
44
|
-
applyPatchActions: ToolRunApplyPatch[];
|
|
45
|
-
mcpApprovalRequests: ToolRunMCPApprovalRequest[];
|
|
46
|
-
toolsUsed: string[];
|
|
47
|
-
hasToolsOrApprovalsToRun(): boolean;
|
|
48
|
-
};
|
|
49
|
-
export declare const nextStepSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
50
|
-
type: z.ZodLiteral<"next_step_handoff">;
|
|
51
|
-
newAgent: z.ZodAny;
|
|
52
|
-
}, "strip", z.ZodTypeAny, {
|
|
53
|
-
type: "next_step_handoff";
|
|
54
|
-
newAgent?: any;
|
|
55
|
-
}, {
|
|
56
|
-
type: "next_step_handoff";
|
|
57
|
-
newAgent?: any;
|
|
58
|
-
}>, z.ZodObject<{
|
|
59
|
-
type: z.ZodLiteral<"next_step_final_output">;
|
|
60
|
-
output: z.ZodString;
|
|
61
|
-
}, "strip", z.ZodTypeAny, {
|
|
62
|
-
type: "next_step_final_output";
|
|
63
|
-
output: string;
|
|
64
|
-
}, {
|
|
65
|
-
type: "next_step_final_output";
|
|
66
|
-
output: string;
|
|
67
|
-
}>, z.ZodObject<{
|
|
68
|
-
type: z.ZodLiteral<"next_step_run_again">;
|
|
69
|
-
}, "strip", z.ZodTypeAny, {
|
|
70
|
-
type: "next_step_run_again";
|
|
71
|
-
}, {
|
|
72
|
-
type: "next_step_run_again";
|
|
73
|
-
}>, z.ZodObject<{
|
|
74
|
-
type: z.ZodLiteral<"next_step_interruption">;
|
|
75
|
-
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
76
|
-
}, "strip", z.ZodTypeAny, {
|
|
77
|
-
type: "next_step_interruption";
|
|
78
|
-
data: Record<string, any>;
|
|
79
|
-
}, {
|
|
80
|
-
type: "next_step_interruption";
|
|
81
|
-
data: Record<string, any>;
|
|
82
|
-
}>]>;
|
|
83
|
-
export type NextStep = z.infer<typeof nextStepSchema>;
|
|
84
|
-
/**
|
|
85
|
-
* Internal convenience wrapper that groups the outcome of a single agent turn. It lets the caller
|
|
86
|
-
* update the RunState in one shot and decide which step to execute next.
|
|
87
|
-
*/
|
|
88
|
-
declare class SingleStepResult {
|
|
89
|
-
/**
|
|
90
|
-
* The input items (i.e., the items before run() was called). May be mutated by handoff input filters.
|
|
91
|
-
*/
|
|
92
|
-
originalInput: string | AgentInputItem[];
|
|
93
|
-
/**
|
|
94
|
-
* The model response for the current step
|
|
95
|
-
*/
|
|
96
|
-
modelResponse: ModelResponse;
|
|
97
|
-
/**
|
|
98
|
-
* The items before the current step was executed
|
|
99
|
-
*/
|
|
100
|
-
preStepItems: RunItem[];
|
|
101
|
-
/**
|
|
102
|
-
* The items after the current step was executed
|
|
103
|
-
*/
|
|
104
|
-
newStepItems: RunItem[];
|
|
105
|
-
/**
|
|
106
|
-
* The next step to execute
|
|
107
|
-
*/
|
|
108
|
-
nextStep: NextStep;
|
|
109
|
-
constructor(
|
|
110
|
-
/**
|
|
111
|
-
* The input items (i.e., the items before run() was called). May be mutated by handoff input filters.
|
|
112
|
-
*/
|
|
113
|
-
originalInput: string | AgentInputItem[],
|
|
114
|
-
/**
|
|
115
|
-
* The model response for the current step
|
|
116
|
-
*/
|
|
117
|
-
modelResponse: ModelResponse,
|
|
118
|
-
/**
|
|
119
|
-
* The items before the current step was executed
|
|
120
|
-
*/
|
|
121
|
-
preStepItems: RunItem[],
|
|
122
|
-
/**
|
|
123
|
-
* The items after the current step was executed
|
|
124
|
-
*/
|
|
125
|
-
newStepItems: RunItem[],
|
|
126
|
-
/**
|
|
127
|
-
* The next step to execute
|
|
128
|
-
*/
|
|
129
|
-
nextStep: NextStep);
|
|
130
|
-
/**
|
|
131
|
-
* The items generated during the agent run (i.e. everything generated after originalInput)
|
|
132
|
-
*/
|
|
133
|
-
get generatedItems(): RunItem[];
|
|
134
|
-
}
|
|
135
|
-
export declare function executeShellActions(agent: Agent<any, any>, actions: ToolRunShell[], runner: Runner, runContext: RunContext, customLogger?: Logger | undefined): Promise<RunItem[]>;
|
|
136
|
-
export declare function executeApplyPatchOperations(agent: Agent<any, any>, actions: ToolRunApplyPatch[], runner: Runner, runContext: RunContext, customLogger?: Logger | undefined): Promise<RunItem[]>;
|
|
137
|
-
export declare function streamStepItemsToRunResult(result: StreamedRunResult<any, any>, items: RunItem[]): void;
|
|
138
|
-
export declare function addStepToRunResult(result: StreamedRunResult<any, any>, step: SingleStepResult, options?: {
|
|
139
|
-
skipItems?: Set<RunItem>;
|
|
140
|
-
}): void;
|
|
141
|
-
export declare class AgentToolUseTracker {
|
|
142
|
-
#private;
|
|
143
|
-
addToolUse(agent: Agent<any, any>, toolNames: string[]): void;
|
|
144
|
-
hasUsedTools(agent: Agent<any, any>): boolean;
|
|
145
|
-
toJSON(): Record<string, string[]>;
|
|
146
|
-
}
|
|
147
|
-
export declare function prepareInputItemsWithSession(input: string | AgentInputItem[], session?: Session, sessionInputCallback?: SessionInputCallback, options?: {
|
|
148
|
-
/**
|
|
149
|
-
* When true (default), the returned `preparedInput` includes both the persisted session history
|
|
150
|
-
* and the new turn items. Set to false when upstream code already provides history to the model
|
|
151
|
-
* (e.g. server-managed conversations) to avoid sending duplicated messages each turn.
|
|
152
|
-
*/
|
|
153
|
-
includeHistoryInPreparedInput?: boolean;
|
|
154
|
-
/**
|
|
155
|
-
* When true, ensures new turn inputs are still provided to the model even if the session input
|
|
156
|
-
* callback drops them from persistence (used for server-managed conversations that redact
|
|
157
|
-
* writes).
|
|
158
|
-
*/
|
|
159
|
-
preserveDroppedNewItems?: boolean;
|
|
160
|
-
}): Promise<PreparedInputWithSessionResult>;
|
|
161
|
-
export {};
|