@nuvin/agent-core 0.0.0-rc.17 → 0.0.0-rc.19
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/VERSION +2 -2
- package/dist/agent/agent.d.ts +28 -0
- package/dist/agent/context-compactor.d.ts +8 -0
- package/dist/agent/extension-registry.d.ts +3 -0
- package/dist/agent/index.d.ts +8 -99
- package/dist/agent/index.js +1 -1
- package/dist/agent/messages-to-text.d.ts +3 -0
- package/dist/agent/metrics.d.ts +30 -0
- package/dist/agent/topic-reminder-extension.d.ts +32 -0
- package/dist/agent/turn-engine.d.ts +3 -0
- package/dist/chunk-FFIZ6TKW.js +1 -1
- package/dist/chunk-HRU363DY.js +1 -0
- package/dist/chunk-NHBKADBW.js +1 -0
- package/dist/chunk-NYZR4XKO.js +1 -1
- package/dist/chunk-QDOE7NWO.js +1 -0
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/formats/base64-image-content.d.ts +4 -0
- package/dist/formats/index.d.ts +4 -39
- package/dist/formats/index.js +1 -1
- package/dist/formats/message-format.d.ts +33 -0
- package/dist/formats/provider-adapters.d.ts +3 -0
- package/dist/hooks/executor.d.ts +3 -0
- package/dist/hooks/extensions.d.ts +28 -0
- package/dist/hooks/index.d.ts +7 -76
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/registry.d.ts +8 -0
- package/dist/hooks/types.d.ts +40 -0
- package/dist/lsp/client.d.ts +11 -0
- package/dist/lsp/index.d.ts +24 -0
- package/dist/lsp/installer.d.ts +11 -0
- package/dist/lsp/language.d.ts +2 -0
- package/dist/lsp/server.d.ts +6 -0
- package/dist/lsp/types.d.ts +68 -0
- package/dist/models/anthropic-model.d.ts +27 -0
- package/dist/models/anthropic-surface.d.ts +5 -0
- package/dist/models/chat-model.d.ts +31 -0
- package/dist/models/github-model.d.ts +32 -0
- package/dist/models/http-transport.d.ts +10 -0
- package/dist/models/index.d.ts +16 -390
- package/dist/models/index.js +1 -1
- package/dist/models/mock-model.d.ts +15 -0
- package/dist/models/model-errors.d.ts +16 -0
- package/dist/models/model-limits.d.ts +7 -0
- package/dist/models/model-registry.d.ts +44 -0
- package/dist/models/model-surface-router.d.ts +19 -0
- package/dist/models/model-transports.d.ts +17 -0
- package/dist/models/openai-model.d.ts +60 -0
- package/dist/models/openai-surfaces.d.ts +74 -0
- package/dist/models/provider-adapter.d.ts +23 -0
- package/dist/models/provider-session.d.ts +16 -0
- package/dist/models/routed-model.d.ts +90 -0
- package/dist/shared/abort.d.ts +9 -0
- package/dist/shared/index.d.ts +5 -22
- package/dist/shared/index.js +1 -1
- package/dist/shared/reasoning-config.d.ts +5 -0
- package/dist/shared/turn-failed.d.ts +6 -0
- package/dist/{types-3UUDPpJs.d.ts → shared/types.d.ts} +172 -162
- package/dist/tools/ask-user-tool.d.ts +55 -0
- package/dist/tools/bash-tool.d.ts +63 -0
- package/dist/tools/command-tool.d.ts +23 -0
- package/dist/tools/file-edit-tool.d.ts +29 -0
- package/dist/tools/file-new-tool.d.ts +21 -0
- package/dist/tools/file-read-tool.d.ts +27 -0
- package/dist/tools/glob-tool.d.ts +26 -0
- package/dist/tools/grep-tool.d.ts +34 -0
- package/dist/tools/index.d.ts +28 -809
- package/dist/tools/index.js +1 -1
- package/dist/tools/internal-tool-runtime.d.ts +8 -0
- package/dist/tools/ls-tool.d.ts +20 -0
- package/dist/tools/lsp-tool.d.ts +36 -0
- package/dist/tools/mcp-oauth-provider.d.ts +11 -0
- package/dist/tools/mcp-server-manager.d.ts +43 -0
- package/dist/tools/mcp-tool-adapter.d.ts +47 -0
- package/dist/tools/mock-tool-runtime.d.ts +3 -0
- package/dist/tools/ripgrep.d.ts +20 -0
- package/dist/tools/runtime-manager-tools.d.ts +58 -0
- package/dist/tools/skill-tool.d.ts +33 -0
- package/dist/tools/todo-write-tool.d.ts +66 -0
- package/dist/tools/tool-output-offload.d.ts +12 -0
- package/dist/tools/tools.d.ts +24 -0
- package/dist/tools/update-topic-tool.d.ts +12 -0
- package/dist/tools/view-file-tool.d.ts +22 -0
- package/dist/tools/web-fetch-tool.d.ts +20 -0
- package/dist/tools/web-search-tool.d.ts +72 -0
- package/dist/tools/workspace-paths.d.ts +5 -0
- package/package.json +2 -2
- package/dist/chunk-SEP4YYY3.js +0 -1
- package/dist/chunk-T7UKN6FZ.js +0 -1
- package/dist/chunk-WHYFEBOU.js +0 -1
- package/dist/provider-adapters-Bupd2RBH.d.ts +0 -5
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
type JsonPrimitive = boolean | number | string | null;
|
|
2
|
-
interface JsonObject {
|
|
1
|
+
export type JsonPrimitive = boolean | number | string | null;
|
|
2
|
+
export interface JsonObject {
|
|
3
3
|
[key: string]: JsonValue;
|
|
4
4
|
}
|
|
5
|
-
type JsonValue = JsonObject | JsonPrimitive | JsonValue[];
|
|
6
|
-
type JsonSchemaType = "array" | "boolean" | "number" | "object" | "string";
|
|
7
|
-
interface JsonSchemaString {
|
|
5
|
+
export type JsonValue = JsonObject | JsonPrimitive | JsonValue[];
|
|
6
|
+
export type JsonSchemaType = "array" | "boolean" | "number" | "object" | "string";
|
|
7
|
+
export interface JsonSchemaString {
|
|
8
8
|
type: "string";
|
|
9
9
|
}
|
|
10
|
-
interface JsonSchemaNumber {
|
|
10
|
+
export interface JsonSchemaNumber {
|
|
11
11
|
type: "number";
|
|
12
12
|
}
|
|
13
|
-
interface JsonSchemaBoolean {
|
|
13
|
+
export interface JsonSchemaBoolean {
|
|
14
14
|
type: "boolean";
|
|
15
15
|
}
|
|
16
|
-
interface JsonSchemaArray<TItem extends JsonSchema = JsonSchema> {
|
|
16
|
+
export interface JsonSchemaArray<TItem extends JsonSchema = JsonSchema> {
|
|
17
17
|
type: "array";
|
|
18
18
|
items: TItem;
|
|
19
19
|
}
|
|
20
|
-
interface JsonSchemaObject<TProperties extends Record<string, JsonSchema> = Record<string, JsonSchema>, TRequired extends readonly string[] | undefined = readonly string[] | undefined> {
|
|
20
|
+
export interface JsonSchemaObject<TProperties extends Record<string, JsonSchema> = Record<string, JsonSchema>, TRequired extends readonly string[] | undefined = readonly string[] | undefined> {
|
|
21
21
|
type: "object";
|
|
22
22
|
properties: TProperties;
|
|
23
23
|
required?: TRequired;
|
|
24
24
|
}
|
|
25
|
-
type JsonSchema = JsonSchemaArray | JsonSchemaBoolean | JsonSchemaNumber | JsonSchemaObject | JsonSchemaString;
|
|
26
|
-
interface TextBlock {
|
|
25
|
+
export type JsonSchema = JsonSchemaArray | JsonSchemaBoolean | JsonSchemaNumber | JsonSchemaObject | JsonSchemaString;
|
|
26
|
+
export interface TextBlock {
|
|
27
27
|
type: "text";
|
|
28
28
|
text: string;
|
|
29
29
|
}
|
|
30
|
-
type ImageMediaType = "image/gif" | "image/jpeg" | "image/png" | "image/webp";
|
|
31
|
-
interface ImageBlock {
|
|
30
|
+
export type ImageMediaType = "image/gif" | "image/jpeg" | "image/png" | "image/webp";
|
|
31
|
+
export interface ImageBlock {
|
|
32
32
|
type: "image";
|
|
33
33
|
source: {
|
|
34
34
|
type: "base64";
|
|
@@ -36,122 +36,128 @@ interface ImageBlock {
|
|
|
36
36
|
data: string;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
type ToolResultContentBlock = ImageBlock | TextBlock;
|
|
40
|
-
type ToolResultContent = string | ToolResultContentBlock[];
|
|
41
|
-
interface AnthropicThinkingBlock {
|
|
39
|
+
export type ToolResultContentBlock = ImageBlock | TextBlock;
|
|
40
|
+
export type ToolResultContent = string | ToolResultContentBlock[];
|
|
41
|
+
export interface AnthropicThinkingBlock {
|
|
42
42
|
type: "anthropic_thinking";
|
|
43
43
|
thinking: string;
|
|
44
44
|
signature: string;
|
|
45
45
|
}
|
|
46
|
-
interface AnthropicRedactedThinkingBlock {
|
|
46
|
+
export interface AnthropicRedactedThinkingBlock {
|
|
47
47
|
type: "anthropic_redacted_thinking";
|
|
48
48
|
data: string;
|
|
49
49
|
}
|
|
50
|
-
interface OpenAiReasoningSummaryText {
|
|
50
|
+
export interface OpenAiReasoningSummaryText {
|
|
51
51
|
type: "summary_text";
|
|
52
52
|
text: string;
|
|
53
53
|
}
|
|
54
|
-
interface OpenAiReasoningBlock {
|
|
54
|
+
export interface OpenAiReasoningBlock {
|
|
55
55
|
type: "openai_reasoning";
|
|
56
56
|
encryptedContent?: string;
|
|
57
57
|
id?: string;
|
|
58
58
|
summary: OpenAiReasoningSummaryText[];
|
|
59
59
|
text?: string;
|
|
60
60
|
}
|
|
61
|
-
interface ToolUseBlock {
|
|
61
|
+
export interface ToolUseBlock {
|
|
62
62
|
type: "tool_use";
|
|
63
63
|
id: string;
|
|
64
64
|
name: string;
|
|
65
65
|
input: JsonValue;
|
|
66
66
|
}
|
|
67
|
-
interface ToolResultBlock {
|
|
67
|
+
export interface ToolResultBlock {
|
|
68
68
|
type: "tool_result";
|
|
69
69
|
tool_use_id: string;
|
|
70
70
|
content: ToolResultContent;
|
|
71
71
|
is_error: boolean;
|
|
72
72
|
}
|
|
73
|
-
interface AnthropicThinkingWireBlock {
|
|
73
|
+
export interface AnthropicThinkingWireBlock {
|
|
74
74
|
type: "thinking";
|
|
75
75
|
thinking: string;
|
|
76
76
|
signature: string;
|
|
77
77
|
}
|
|
78
|
-
interface AnthropicRedactedThinkingWireBlock {
|
|
78
|
+
export interface AnthropicRedactedThinkingWireBlock {
|
|
79
79
|
type: "redacted_thinking";
|
|
80
80
|
data: string;
|
|
81
81
|
}
|
|
82
|
-
type AnthropicAssistantContentBlock = AnthropicRedactedThinkingWireBlock | AnthropicThinkingWireBlock | TextBlock | ToolUseBlock;
|
|
83
|
-
type ReasoningVisibility = "continuity-only" | "user-visible";
|
|
84
|
-
type AutoReasoningEffort = "low" | "medium" | "high";
|
|
85
|
-
interface AutoReasoningConfig {
|
|
82
|
+
export type AnthropicAssistantContentBlock = AnthropicRedactedThinkingWireBlock | AnthropicThinkingWireBlock | TextBlock | ToolUseBlock;
|
|
83
|
+
export type ReasoningVisibility = "continuity-only" | "user-visible";
|
|
84
|
+
export type AutoReasoningEffort = "low" | "medium" | "high";
|
|
85
|
+
export interface AutoReasoningConfig {
|
|
86
86
|
effort: AutoReasoningEffort;
|
|
87
87
|
}
|
|
88
|
-
type AnthropicThinkingDisplay = "omitted" | "summarized";
|
|
89
|
-
type AnthropicThinkingEffort = "low" | "medium" | "high";
|
|
90
|
-
interface AnthropicEnabledThinkingConfig {
|
|
88
|
+
export type AnthropicThinkingDisplay = "omitted" | "summarized";
|
|
89
|
+
export type AnthropicThinkingEffort = "low" | "medium" | "high";
|
|
90
|
+
export interface AnthropicEnabledThinkingConfig {
|
|
91
91
|
type: "enabled";
|
|
92
92
|
budgetTokens: number;
|
|
93
93
|
display?: AnthropicThinkingDisplay;
|
|
94
94
|
interleaved?: boolean;
|
|
95
95
|
}
|
|
96
|
-
interface AnthropicAdaptiveThinkingConfig {
|
|
96
|
+
export interface AnthropicAdaptiveThinkingConfig {
|
|
97
97
|
type: "adaptive";
|
|
98
98
|
display?: AnthropicThinkingDisplay;
|
|
99
99
|
effort?: AnthropicThinkingEffort;
|
|
100
100
|
interleaved?: boolean;
|
|
101
101
|
}
|
|
102
|
-
interface AnthropicDisabledThinkingConfig {
|
|
102
|
+
export interface AnthropicDisabledThinkingConfig {
|
|
103
103
|
type: "disabled";
|
|
104
104
|
}
|
|
105
|
-
type AnthropicThinkingConfig = AnthropicAdaptiveThinkingConfig | AnthropicDisabledThinkingConfig | AnthropicEnabledThinkingConfig;
|
|
106
|
-
type OpenAiReasoningEffort = "high" | "low" | "medium" | "minimal" | "none" | "xhigh";
|
|
107
|
-
type OpenAiReasoningSummary = "auto" | "concise" | "detailed";
|
|
108
|
-
interface OpenAiReasoningConfig {
|
|
105
|
+
export type AnthropicThinkingConfig = AnthropicAdaptiveThinkingConfig | AnthropicDisabledThinkingConfig | AnthropicEnabledThinkingConfig;
|
|
106
|
+
export type OpenAiReasoningEffort = "high" | "low" | "medium" | "minimal" | "none" | "xhigh";
|
|
107
|
+
export type OpenAiReasoningSummary = "auto" | "concise" | "detailed";
|
|
108
|
+
export interface OpenAiReasoningConfig {
|
|
109
109
|
effort?: OpenAiReasoningEffort;
|
|
110
110
|
includeEncryptedContent?: boolean;
|
|
111
111
|
summary?: OpenAiReasoningSummary;
|
|
112
112
|
}
|
|
113
|
-
interface ReasoningConfig {
|
|
113
|
+
export interface ReasoningConfig {
|
|
114
114
|
auto?: AutoReasoningConfig;
|
|
115
115
|
anthropic?: AnthropicThinkingConfig;
|
|
116
116
|
openai?: OpenAiReasoningConfig;
|
|
117
117
|
visibility?: ReasoningVisibility;
|
|
118
118
|
}
|
|
119
|
-
interface MessageProviderState {
|
|
119
|
+
export interface MessageProviderState {
|
|
120
120
|
anthropicAssistantContent?: AnthropicAssistantContentBlock[];
|
|
121
121
|
openaiResponsesOutput?: OpenAiResponsesOutputItem[];
|
|
122
122
|
openaiResponsesResponseId?: string;
|
|
123
123
|
}
|
|
124
|
-
type AssistantContentBlock = AnthropicRedactedThinkingBlock | AnthropicThinkingBlock | OpenAiReasoningBlock | TextBlock | ToolUseBlock;
|
|
125
|
-
type ContentBlock = AssistantContentBlock | ImageBlock | ToolResultBlock;
|
|
126
|
-
type ContentInput = ContentBlock[] | string | null | undefined;
|
|
127
|
-
type MessageRole = "assistant" | "user";
|
|
128
|
-
type SystemInput = TextBlock[] | string | null | undefined;
|
|
129
|
-
interface Message {
|
|
124
|
+
export type AssistantContentBlock = AnthropicRedactedThinkingBlock | AnthropicThinkingBlock | OpenAiReasoningBlock | TextBlock | ToolUseBlock;
|
|
125
|
+
export type ContentBlock = AssistantContentBlock | ImageBlock | ToolResultBlock;
|
|
126
|
+
export type ContentInput = ContentBlock[] | string | null | undefined;
|
|
127
|
+
export type MessageRole = "assistant" | "user";
|
|
128
|
+
export type SystemInput = TextBlock[] | string | null | undefined;
|
|
129
|
+
export interface Message {
|
|
130
130
|
id?: string;
|
|
131
131
|
role: MessageRole;
|
|
132
132
|
content: ContentBlock[];
|
|
133
133
|
providerState?: MessageProviderState;
|
|
134
134
|
}
|
|
135
|
-
interface IdentifiedMessage extends Message {
|
|
135
|
+
export interface IdentifiedMessage extends Message {
|
|
136
136
|
id: string;
|
|
137
137
|
}
|
|
138
|
-
interface MessageInput {
|
|
138
|
+
export interface MessageInput {
|
|
139
139
|
id?: string;
|
|
140
140
|
role: MessageRole;
|
|
141
141
|
content?: ContentInput;
|
|
142
142
|
providerState?: MessageProviderState;
|
|
143
143
|
}
|
|
144
|
-
interface ToolSchema {
|
|
144
|
+
export interface ToolSchema {
|
|
145
145
|
name: string;
|
|
146
146
|
description: string;
|
|
147
147
|
input_schema: JsonSchemaObject;
|
|
148
148
|
}
|
|
149
|
-
interface Usage {
|
|
149
|
+
export interface Usage {
|
|
150
150
|
input_tokens: number;
|
|
151
151
|
output_tokens: number;
|
|
152
152
|
reasoning_tokens?: number;
|
|
153
153
|
}
|
|
154
|
-
interface
|
|
154
|
+
export interface OutputFormat {
|
|
155
|
+
type: "json_schema";
|
|
156
|
+
name?: string;
|
|
157
|
+
schema: JsonSchemaObject;
|
|
158
|
+
strict?: boolean;
|
|
159
|
+
}
|
|
160
|
+
export interface ModelRequest {
|
|
155
161
|
model: string;
|
|
156
162
|
max_tokens: number;
|
|
157
163
|
reasoning?: ReasoningConfig;
|
|
@@ -162,8 +168,9 @@ interface ModelRequest {
|
|
|
162
168
|
session_id: string;
|
|
163
169
|
turn_id: string;
|
|
164
170
|
};
|
|
171
|
+
outputFormat?: OutputFormat;
|
|
165
172
|
}
|
|
166
|
-
interface ModelResponse {
|
|
173
|
+
export interface ModelResponse {
|
|
167
174
|
id: string;
|
|
168
175
|
type: "message";
|
|
169
176
|
role: "assistant";
|
|
@@ -173,7 +180,7 @@ interface ModelResponse {
|
|
|
173
180
|
usage: Usage;
|
|
174
181
|
providerState?: MessageProviderState;
|
|
175
182
|
}
|
|
176
|
-
interface ChatRequest {
|
|
183
|
+
export interface ChatRequest {
|
|
177
184
|
model: string;
|
|
178
185
|
maxTokens: number;
|
|
179
186
|
reasoning?: ReasoningConfig;
|
|
@@ -184,8 +191,9 @@ interface ChatRequest {
|
|
|
184
191
|
sessionId: string;
|
|
185
192
|
turnId: string;
|
|
186
193
|
};
|
|
194
|
+
outputFormat?: OutputFormat;
|
|
187
195
|
}
|
|
188
|
-
interface ChatResponse {
|
|
196
|
+
export interface ChatResponse {
|
|
189
197
|
id: string;
|
|
190
198
|
content: AssistantContentBlock[];
|
|
191
199
|
stopReason: "end_turn" | "tool_use";
|
|
@@ -198,43 +206,43 @@ interface ChatResponse {
|
|
|
198
206
|
};
|
|
199
207
|
providerState?: MessageProviderState;
|
|
200
208
|
}
|
|
201
|
-
interface ContentDeltaChunk {
|
|
209
|
+
export interface ContentDeltaChunk {
|
|
202
210
|
type: "content_delta";
|
|
203
211
|
index?: number;
|
|
204
212
|
text?: string;
|
|
205
213
|
}
|
|
206
|
-
interface ToolUseDeltaChunk {
|
|
214
|
+
export interface ToolUseDeltaChunk {
|
|
207
215
|
type: "tool_use_delta";
|
|
208
216
|
id: string;
|
|
209
217
|
index: number;
|
|
210
218
|
inputDelta?: string;
|
|
211
219
|
name?: string;
|
|
212
220
|
}
|
|
213
|
-
interface AnthropicThinkingDeltaChunk {
|
|
221
|
+
export interface AnthropicThinkingDeltaChunk {
|
|
214
222
|
type: "anthropic_thinking_delta";
|
|
215
223
|
index: number;
|
|
216
224
|
thinking: string;
|
|
217
225
|
}
|
|
218
|
-
interface AnthropicSignatureDeltaChunk {
|
|
226
|
+
export interface AnthropicSignatureDeltaChunk {
|
|
219
227
|
type: "anthropic_signature_delta";
|
|
220
228
|
index: number;
|
|
221
229
|
signature: string;
|
|
222
230
|
}
|
|
223
|
-
interface OpenAiReasoningDeltaChunk {
|
|
231
|
+
export interface OpenAiReasoningDeltaChunk {
|
|
224
232
|
type: "openai_reasoning_delta";
|
|
225
233
|
contentIndex: number;
|
|
226
234
|
delta: string;
|
|
227
235
|
itemId: string;
|
|
228
236
|
outputIndex: number;
|
|
229
237
|
}
|
|
230
|
-
interface OpenAiReasoningSummaryDeltaChunk {
|
|
238
|
+
export interface OpenAiReasoningSummaryDeltaChunk {
|
|
231
239
|
type: "openai_reasoning_summary_delta";
|
|
232
240
|
delta: string;
|
|
233
241
|
itemId: string;
|
|
234
242
|
outputIndex: number;
|
|
235
243
|
summaryIndex: number;
|
|
236
244
|
}
|
|
237
|
-
interface ProviderRetryChunk {
|
|
245
|
+
export interface ProviderRetryChunk {
|
|
238
246
|
type: "provider_retry";
|
|
239
247
|
attempt: number;
|
|
240
248
|
maxAttempts: number;
|
|
@@ -243,37 +251,37 @@ interface ProviderRetryChunk {
|
|
|
243
251
|
reason: "http_status" | "stream_error" | "transport_error";
|
|
244
252
|
status?: number;
|
|
245
253
|
}
|
|
246
|
-
interface DoneChunk {
|
|
254
|
+
export interface DoneChunk {
|
|
247
255
|
type: "done";
|
|
248
256
|
response: ChatResponse;
|
|
249
257
|
}
|
|
250
|
-
type ChatResponseChunk = AnthropicSignatureDeltaChunk | AnthropicThinkingDeltaChunk | ContentDeltaChunk | DoneChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk | ProviderRetryChunk | ToolUseDeltaChunk;
|
|
251
|
-
interface ModelLimits {
|
|
258
|
+
export type ChatResponseChunk = AnthropicSignatureDeltaChunk | AnthropicThinkingDeltaChunk | ContentDeltaChunk | DoneChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk | ProviderRetryChunk | ToolUseDeltaChunk;
|
|
259
|
+
export interface ModelLimits {
|
|
252
260
|
contextWindow?: number;
|
|
253
261
|
maxOutput?: number;
|
|
254
262
|
}
|
|
255
|
-
interface ModelInfo {
|
|
263
|
+
export interface ModelInfo {
|
|
256
264
|
id: string;
|
|
257
265
|
name: string;
|
|
258
266
|
limits?: ModelLimits;
|
|
259
267
|
supportedEndpoints?: string[];
|
|
260
268
|
}
|
|
261
|
-
interface ToolResultMeta {
|
|
269
|
+
export interface ToolResultMeta {
|
|
262
270
|
truncated?: boolean;
|
|
263
271
|
originalBytes?: number;
|
|
264
272
|
transforms: string[];
|
|
265
273
|
}
|
|
266
|
-
interface ToolResultChunk {
|
|
274
|
+
export interface ToolResultChunk {
|
|
267
275
|
output: string;
|
|
268
276
|
structured: JsonObject;
|
|
269
277
|
content?: ToolResultContent;
|
|
270
278
|
}
|
|
271
|
-
interface ToolOutputEnvelope {
|
|
279
|
+
export interface ToolOutputEnvelope {
|
|
272
280
|
output: string;
|
|
273
281
|
structured?: JsonObject;
|
|
274
282
|
content?: ToolResultContent;
|
|
275
283
|
}
|
|
276
|
-
interface ToolResult {
|
|
284
|
+
export interface ToolResult {
|
|
277
285
|
callId: string;
|
|
278
286
|
toolName: string;
|
|
279
287
|
status: "error" | "ok";
|
|
@@ -283,7 +291,7 @@ interface ToolResult {
|
|
|
283
291
|
chunks: ToolResultChunk[];
|
|
284
292
|
meta: ToolResultMeta;
|
|
285
293
|
}
|
|
286
|
-
interface TurnInput {
|
|
294
|
+
export interface TurnInput {
|
|
287
295
|
sessionId: string;
|
|
288
296
|
turnId: string;
|
|
289
297
|
streaming?: boolean;
|
|
@@ -292,7 +300,7 @@ interface TurnInput {
|
|
|
292
300
|
messages?: MessageInput[];
|
|
293
301
|
message: MessageInput;
|
|
294
302
|
}
|
|
295
|
-
interface TurnState {
|
|
303
|
+
export interface TurnState {
|
|
296
304
|
sessionId: string;
|
|
297
305
|
turnId: string;
|
|
298
306
|
system: TextBlock[];
|
|
@@ -302,32 +310,32 @@ interface TurnState {
|
|
|
302
310
|
finalMessage?: IdentifiedMessage;
|
|
303
311
|
sessionDir?: string;
|
|
304
312
|
}
|
|
305
|
-
type TurnResultStatus = "completed" | "aborted";
|
|
306
|
-
interface TurnResult {
|
|
313
|
+
export type TurnResultStatus = "completed" | "aborted";
|
|
314
|
+
export interface TurnResult {
|
|
307
315
|
status: TurnResultStatus;
|
|
308
316
|
finalMessage?: IdentifiedMessage;
|
|
309
317
|
state: TurnState;
|
|
310
318
|
}
|
|
311
|
-
type ProviderCredentialKind = "api-key" | "oauth-token" | "session-token";
|
|
312
|
-
interface ProviderCredential {
|
|
319
|
+
export type ProviderCredentialKind = "api-key" | "oauth-token" | "session-token";
|
|
320
|
+
export interface ProviderCredential {
|
|
313
321
|
kind: ProviderCredentialKind;
|
|
314
322
|
value: string;
|
|
315
323
|
}
|
|
316
|
-
interface ProviderEndpoints {
|
|
324
|
+
export interface ProviderEndpoints {
|
|
317
325
|
api?: string;
|
|
318
326
|
originTracker?: string;
|
|
319
327
|
proxy?: string;
|
|
320
328
|
telemetry?: string;
|
|
321
329
|
}
|
|
322
|
-
interface ResolvedProviderSession {
|
|
330
|
+
export interface ResolvedProviderSession {
|
|
323
331
|
credential: ProviderCredential;
|
|
324
332
|
endpoints?: ProviderEndpoints;
|
|
325
333
|
metadata?: Record<string, string>;
|
|
326
334
|
}
|
|
327
|
-
interface ProviderSessionResolver {
|
|
335
|
+
export interface ProviderSessionResolver {
|
|
328
336
|
resolve(signal?: AbortSignal): Promise<ResolvedProviderSession>;
|
|
329
337
|
}
|
|
330
|
-
interface PrepareRequestInput {
|
|
338
|
+
export interface PrepareRequestInput {
|
|
331
339
|
sessionId: string;
|
|
332
340
|
turnId: string;
|
|
333
341
|
reasoning?: ReasoningConfig;
|
|
@@ -336,162 +344,162 @@ interface PrepareRequestInput {
|
|
|
336
344
|
tools: ToolSchema[];
|
|
337
345
|
maxTokens?: number;
|
|
338
346
|
}
|
|
339
|
-
interface PreparedRequest {
|
|
347
|
+
export interface PreparedRequest {
|
|
340
348
|
request: ModelRequest;
|
|
341
349
|
session?: ResolvedProviderSession;
|
|
342
350
|
}
|
|
343
|
-
type ProviderRequestMutator = (preparedRequest: PreparedRequest) => PreparedRequest | Promise<PreparedRequest>;
|
|
344
|
-
interface ChatModel {
|
|
351
|
+
export type ProviderRequestMutator = (preparedRequest: PreparedRequest) => PreparedRequest | Promise<PreparedRequest>;
|
|
352
|
+
export interface ChatModel {
|
|
345
353
|
prepareRequest(request: PrepareRequestInput): ModelRequest;
|
|
346
354
|
complete(request: ModelRequest): Promise<ModelResponse>;
|
|
347
355
|
}
|
|
348
|
-
interface ModelExecutionOptions {
|
|
356
|
+
export interface ModelExecutionOptions {
|
|
349
357
|
signal?: AbortSignal;
|
|
350
358
|
}
|
|
351
|
-
interface EngineChatModel {
|
|
359
|
+
export interface EngineChatModel {
|
|
352
360
|
model: string;
|
|
353
361
|
maxTokens?: number;
|
|
354
362
|
complete(request: ChatRequest, options?: ModelExecutionOptions): Promise<ChatResponse>;
|
|
355
363
|
stream?(request: ChatRequest, options?: ModelExecutionOptions): AsyncIterable<ChatResponseChunk>;
|
|
356
364
|
getModels?(signal?: AbortSignal): Promise<ModelInfo[]>;
|
|
357
365
|
}
|
|
358
|
-
interface BaseChatModelOptions {
|
|
366
|
+
export interface BaseChatModelOptions {
|
|
359
367
|
model: string;
|
|
360
368
|
maxTokens?: number;
|
|
361
369
|
reasoning?: ReasoningConfig;
|
|
362
370
|
providerSessionResolver?: ProviderSessionResolver;
|
|
363
371
|
requestMutators?: ProviderRequestMutator[];
|
|
364
372
|
}
|
|
365
|
-
interface AgentEventContext {
|
|
373
|
+
export interface AgentEventContext {
|
|
366
374
|
sessionId: string;
|
|
367
375
|
turnId: string;
|
|
368
376
|
state: TurnState;
|
|
369
377
|
}
|
|
370
|
-
type AskUserOption = {
|
|
378
|
+
export type AskUserOption = {
|
|
371
379
|
label: string;
|
|
372
380
|
description: string;
|
|
373
381
|
};
|
|
374
|
-
type AskUserQuestion = {
|
|
382
|
+
export type AskUserQuestion = {
|
|
375
383
|
id: string;
|
|
376
384
|
question: string;
|
|
377
385
|
topic: string;
|
|
378
386
|
options: AskUserOption[];
|
|
379
387
|
multiSelect: boolean;
|
|
380
388
|
};
|
|
381
|
-
type AskUserAnswers = Record<string, string | string[]>;
|
|
382
|
-
type AskUserQuestionRequest = {
|
|
389
|
+
export type AskUserAnswers = Record<string, string | string[]>;
|
|
390
|
+
export type AskUserQuestionRequest = {
|
|
383
391
|
questionId: string;
|
|
384
392
|
questions: AskUserQuestion[];
|
|
385
393
|
};
|
|
386
|
-
interface ToolExecutionContext extends AgentEventContext {
|
|
394
|
+
export interface ToolExecutionContext extends AgentEventContext {
|
|
387
395
|
signal: AbortSignal;
|
|
388
396
|
toolCallId?: string;
|
|
389
397
|
askUser?: (request: AskUserQuestionRequest) => Promise<AskUserAnswers>;
|
|
390
398
|
setTopic?: (topic: string) => void;
|
|
391
399
|
}
|
|
392
|
-
interface ToolRuntimeStartedEvent {
|
|
400
|
+
export interface ToolRuntimeStartedEvent {
|
|
393
401
|
type: "tool_started";
|
|
394
402
|
toolCall: ToolUseBlock;
|
|
395
403
|
}
|
|
396
|
-
interface ToolRuntimeOutputChunkEvent {
|
|
404
|
+
export interface ToolRuntimeOutputChunkEvent {
|
|
397
405
|
type: "tool_output_chunk";
|
|
398
406
|
toolCall: ToolUseBlock;
|
|
399
407
|
chunk: ToolResultChunk;
|
|
400
408
|
}
|
|
401
|
-
interface ToolRuntimeCompletedEvent {
|
|
409
|
+
export interface ToolRuntimeCompletedEvent {
|
|
402
410
|
type: "tool_completed";
|
|
403
411
|
toolCall: ToolUseBlock;
|
|
404
412
|
result: ToolResult;
|
|
405
413
|
}
|
|
406
|
-
interface ToolRuntimeRejectedEvent {
|
|
414
|
+
export interface ToolRuntimeRejectedEvent {
|
|
407
415
|
type: "tool_rejected";
|
|
408
416
|
toolCall: ToolUseBlock;
|
|
409
417
|
result: ToolResult;
|
|
410
418
|
}
|
|
411
|
-
type ToolRuntimeEvent = ToolRuntimeOutputChunkEvent | ToolRuntimeCompletedEvent | ToolRuntimeRejectedEvent | ToolRuntimeStartedEvent;
|
|
412
|
-
interface AgentUserMessageEvent {
|
|
419
|
+
export type ToolRuntimeEvent = ToolRuntimeOutputChunkEvent | ToolRuntimeCompletedEvent | ToolRuntimeRejectedEvent | ToolRuntimeStartedEvent;
|
|
420
|
+
export interface AgentUserMessageEvent {
|
|
413
421
|
type: "user_message";
|
|
414
422
|
message: Message;
|
|
415
423
|
}
|
|
416
|
-
interface AgentModelRequestEvent {
|
|
424
|
+
export interface AgentModelRequestEvent {
|
|
417
425
|
type: "model_request";
|
|
418
426
|
request: ChatRequest;
|
|
419
427
|
}
|
|
420
|
-
interface AgentModelResponseEvent {
|
|
428
|
+
export interface AgentModelResponseEvent {
|
|
421
429
|
type: "model_response";
|
|
422
430
|
response: ChatResponse;
|
|
423
431
|
}
|
|
424
|
-
interface AgentAssistantMessageEvent {
|
|
432
|
+
export interface AgentAssistantMessageEvent {
|
|
425
433
|
type: "assistant_message";
|
|
426
434
|
message: IdentifiedMessage;
|
|
427
435
|
}
|
|
428
|
-
interface AgentAssistantChunkEvent {
|
|
436
|
+
export interface AgentAssistantChunkEvent {
|
|
429
437
|
type: "assistant_chunk";
|
|
430
438
|
index: number;
|
|
431
439
|
messageId: string;
|
|
432
440
|
chunk: ContentDeltaChunk;
|
|
433
441
|
}
|
|
434
|
-
interface AgentToolUseMessageEvent {
|
|
442
|
+
export interface AgentToolUseMessageEvent {
|
|
435
443
|
type: "tool_use_message";
|
|
436
444
|
message: IdentifiedMessage;
|
|
437
445
|
}
|
|
438
|
-
interface AgentToolUseChunkEvent {
|
|
446
|
+
export interface AgentToolUseChunkEvent {
|
|
439
447
|
type: "tool_use_chunk";
|
|
440
448
|
index: number;
|
|
441
449
|
messageId: string;
|
|
442
450
|
chunk: ToolUseDeltaChunk;
|
|
443
451
|
}
|
|
444
|
-
interface AgentReasoningMessageEvent {
|
|
452
|
+
export interface AgentReasoningMessageEvent {
|
|
445
453
|
type: "reasoning_message";
|
|
446
454
|
message: IdentifiedMessage;
|
|
447
455
|
}
|
|
448
|
-
interface AgentReasoningChunkEvent {
|
|
456
|
+
export interface AgentReasoningChunkEvent {
|
|
449
457
|
type: "reasoning_chunk";
|
|
450
458
|
index: number;
|
|
451
459
|
messageId: string;
|
|
452
460
|
chunk: AnthropicThinkingDeltaChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk;
|
|
453
461
|
text: string;
|
|
454
462
|
}
|
|
455
|
-
interface AgentToolCallEvent {
|
|
463
|
+
export interface AgentToolCallEvent {
|
|
456
464
|
type: "tool_call";
|
|
457
465
|
toolCall: ToolUseBlock;
|
|
458
466
|
}
|
|
459
|
-
interface AgentToolResultEvent {
|
|
467
|
+
export interface AgentToolResultEvent {
|
|
460
468
|
type: "tool_result";
|
|
461
469
|
result: ToolResult;
|
|
462
470
|
}
|
|
463
|
-
interface AgentToolResultMessageEvent {
|
|
471
|
+
export interface AgentToolResultMessageEvent {
|
|
464
472
|
type: "tool_result_message";
|
|
465
473
|
message: Message;
|
|
466
474
|
}
|
|
467
|
-
interface AgentFinalMessageEvent {
|
|
475
|
+
export interface AgentFinalMessageEvent {
|
|
468
476
|
type: "final_message";
|
|
469
477
|
message: IdentifiedMessage;
|
|
470
478
|
}
|
|
471
|
-
interface AgentTurnCompleteEvent {
|
|
479
|
+
export interface AgentTurnCompleteEvent {
|
|
472
480
|
type: "turn_complete";
|
|
473
481
|
state: TurnState;
|
|
474
482
|
}
|
|
475
|
-
interface AgentProviderRetryEvent extends ProviderRetryChunk {
|
|
483
|
+
export interface AgentProviderRetryEvent extends ProviderRetryChunk {
|
|
476
484
|
}
|
|
477
|
-
type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentProviderRetryEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
|
|
478
|
-
type AgentEvent = AgentLifecycleEvent | ToolRuntimeEvent;
|
|
479
|
-
type ToolRuntimeDispatchDecision = {
|
|
485
|
+
export type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentProviderRetryEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
|
|
486
|
+
export type AgentEvent = AgentLifecycleEvent | ToolRuntimeEvent;
|
|
487
|
+
export type ToolRuntimeDispatchDecision = {
|
|
480
488
|
action: "reject";
|
|
481
489
|
reason?: string;
|
|
482
490
|
} | {
|
|
483
491
|
action: "run";
|
|
484
492
|
};
|
|
485
|
-
type ToolRuntimeToolCallHandler = (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined;
|
|
486
|
-
type ToolRuntimeEventHandler = (event: ToolRuntimeEvent, ctx: ToolExecutionContext) => Promise<void> | void;
|
|
487
|
-
type AgentEventHandler = (event: AgentEvent, ctx: AgentEventContext) => Promise<void> | void;
|
|
488
|
-
interface ToolRuntime {
|
|
493
|
+
export type ToolRuntimeToolCallHandler = (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined;
|
|
494
|
+
export type ToolRuntimeEventHandler = (event: ToolRuntimeEvent, ctx: ToolExecutionContext) => Promise<void> | void;
|
|
495
|
+
export type AgentEventHandler = (event: AgentEvent, ctx: AgentEventContext) => Promise<void> | void;
|
|
496
|
+
export interface ToolRuntime {
|
|
489
497
|
listToolSchemas(): ToolSchema[];
|
|
490
498
|
setTools(tools: AnyToolDefinition[]): void;
|
|
491
499
|
executeCalls(toolCalls: ToolUseBlock[], ctx: ToolExecutionContext): Promise<ToolResult[]>;
|
|
492
500
|
execute(toolCall: ToolUseBlock, ctx: ToolExecutionContext): Promise<ToolResult>;
|
|
493
501
|
}
|
|
494
|
-
type InferJsonSchema<TSchema extends JsonSchema> = TSchema extends JsonSchemaString ? string : TSchema extends JsonSchemaNumber ? number : TSchema extends JsonSchemaBoolean ? boolean : TSchema extends JsonSchemaArray<infer TItem> ? InferJsonSchema<TItem>[] : TSchema extends JsonSchemaObject<infer TProperties, infer TRequired> ? Expand<RequiredProperties<TProperties, TRequired> & OptionalProperties<TProperties, TRequired>> : never;
|
|
502
|
+
export type InferJsonSchema<TSchema extends JsonSchema> = TSchema extends JsonSchemaString ? string : TSchema extends JsonSchemaNumber ? number : TSchema extends JsonSchemaBoolean ? boolean : TSchema extends JsonSchemaArray<infer TItem> ? InferJsonSchema<TItem>[] : TSchema extends JsonSchemaObject<infer TProperties, infer TRequired> ? Expand<RequiredProperties<TProperties, TRequired> & OptionalProperties<TProperties, TRequired>> : never;
|
|
495
503
|
type Expand<TValue> = TValue extends infer TObject ? {
|
|
496
504
|
[TKey in keyof TObject]: TObject[TKey];
|
|
497
505
|
} : never;
|
|
@@ -503,19 +511,19 @@ type RequiredProperties<TProperties extends Record<string, JsonSchema>, TRequire
|
|
|
503
511
|
type OptionalProperties<TProperties extends Record<string, JsonSchema>, TRequired extends readonly string[] | undefined> = {
|
|
504
512
|
[TKey in OptionalKeyUnion<TProperties, TRequired>]?: InferJsonSchema<TProperties[TKey]>;
|
|
505
513
|
};
|
|
506
|
-
type ToolOutputValue = JsonValue | ToolOutputEnvelope;
|
|
507
|
-
type ToolGenerator<TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined> = AsyncGenerator<TYield, TReturn, void>;
|
|
508
|
-
interface ToolDefinition<TInput extends JsonObject = JsonObject, TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined, TSchema extends JsonSchemaObject = JsonSchemaObject> {
|
|
514
|
+
export type ToolOutputValue = JsonValue | ToolOutputEnvelope;
|
|
515
|
+
export type ToolGenerator<TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined> = AsyncGenerator<TYield, TReturn, void>;
|
|
516
|
+
export interface ToolDefinition<TInput extends JsonObject = JsonObject, TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined, TSchema extends JsonSchemaObject = JsonSchemaObject> {
|
|
509
517
|
name: string;
|
|
510
518
|
description: string;
|
|
511
519
|
inputSchema: TSchema;
|
|
512
520
|
execute(input: TInput, ctx: ToolExecutionContext): ToolGenerator<TYield, TReturn>;
|
|
513
521
|
}
|
|
514
|
-
type AnyToolDefinition = ToolDefinition<JsonObject, ToolOutputValue, ToolOutputValue | undefined, JsonSchemaObject>;
|
|
515
|
-
type TransformableStage = "afterModelResponse" | "afterToolResult" | "beforeAssistantAppend" | "beforeFinalOutput" | "beforeModelRequest" | "beforeToolExecution" | "beforeToolResultAppend" | "onUserMessage";
|
|
516
|
-
type ObserverOnlyStage = "afterMessageAppend" | "afterTurnComplete";
|
|
517
|
-
type Stage = ObserverOnlyStage | TransformableStage;
|
|
518
|
-
interface PayloadByStage {
|
|
522
|
+
export type AnyToolDefinition = ToolDefinition<JsonObject, ToolOutputValue, ToolOutputValue | undefined, JsonSchemaObject>;
|
|
523
|
+
export type TransformableStage = "afterModelResponse" | "afterToolResult" | "beforeAssistantAppend" | "beforeFinalOutput" | "beforeModelRequest" | "beforeToolExecution" | "beforeToolResultAppend" | "onUserMessage";
|
|
524
|
+
export type ObserverOnlyStage = "afterMessageAppend" | "afterTurnComplete";
|
|
525
|
+
export type Stage = ObserverOnlyStage | TransformableStage;
|
|
526
|
+
export interface PayloadByStage {
|
|
519
527
|
afterMessageAppend: Message;
|
|
520
528
|
onUserMessage: Message;
|
|
521
529
|
beforeModelRequest: ChatRequest;
|
|
@@ -527,12 +535,12 @@ interface PayloadByStage {
|
|
|
527
535
|
beforeToolResultAppend: Message;
|
|
528
536
|
afterTurnComplete: TurnState;
|
|
529
537
|
}
|
|
530
|
-
interface ExtensionContext {
|
|
538
|
+
export interface ExtensionContext {
|
|
531
539
|
state: TurnState;
|
|
532
540
|
}
|
|
533
|
-
type Transformer<S extends TransformableStage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => PayloadByStage[S] | Promise<PayloadByStage[S]>;
|
|
534
|
-
type Observer<S extends Stage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => Promise<void> | void;
|
|
535
|
-
interface TransformerExtensionRegistration<S extends TransformableStage = TransformableStage> {
|
|
541
|
+
export type Transformer<S extends TransformableStage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => PayloadByStage[S] | Promise<PayloadByStage[S]>;
|
|
542
|
+
export type Observer<S extends Stage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => Promise<void> | void;
|
|
543
|
+
export interface TransformerExtensionRegistration<S extends TransformableStage = TransformableStage> {
|
|
536
544
|
id: string;
|
|
537
545
|
stage: S;
|
|
538
546
|
kind: "transformer";
|
|
@@ -540,7 +548,7 @@ interface TransformerExtensionRegistration<S extends TransformableStage = Transf
|
|
|
540
548
|
enabled: boolean;
|
|
541
549
|
run: Transformer<S>;
|
|
542
550
|
}
|
|
543
|
-
interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
551
|
+
export interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
544
552
|
id: string;
|
|
545
553
|
stage: S;
|
|
546
554
|
kind: "observer";
|
|
@@ -548,17 +556,17 @@ interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
|
548
556
|
enabled: boolean;
|
|
549
557
|
run: Observer<S>;
|
|
550
558
|
}
|
|
551
|
-
type AnyExtensionRegistration = {
|
|
559
|
+
export type AnyExtensionRegistration = {
|
|
552
560
|
[S in Stage]: ObserverExtensionRegistration<S>;
|
|
553
561
|
}[Stage] | {
|
|
554
562
|
[S in TransformableStage]: TransformerExtensionRegistration<S>;
|
|
555
563
|
}[TransformableStage];
|
|
556
|
-
interface ExtensionRegistry {
|
|
564
|
+
export interface ExtensionRegistry {
|
|
557
565
|
register(extension: AnyExtensionRegistration): void;
|
|
558
566
|
runTransformers<S extends TransformableStage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<PayloadByStage[S]>;
|
|
559
567
|
runObservers<S extends Stage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<void>;
|
|
560
568
|
}
|
|
561
|
-
interface RunTurnDeps {
|
|
569
|
+
export interface RunTurnDeps {
|
|
562
570
|
registry: ExtensionRegistry;
|
|
563
571
|
chatModel: EngineChatModel;
|
|
564
572
|
toolRuntime: ToolRuntime;
|
|
@@ -566,13 +574,14 @@ interface RunTurnDeps {
|
|
|
566
574
|
setTopic?: (topic: string) => void;
|
|
567
575
|
onEvent?: AgentEventHandler;
|
|
568
576
|
sessionDir?: string | (() => string | undefined);
|
|
577
|
+
outputFormat?: OutputFormat;
|
|
569
578
|
}
|
|
570
|
-
type AgentInput = MessageInput | string;
|
|
571
|
-
interface AgentSendOptions {
|
|
579
|
+
export type AgentInput = MessageInput | string;
|
|
580
|
+
export interface AgentSendOptions {
|
|
572
581
|
streaming?: boolean;
|
|
573
582
|
signal?: AbortSignal;
|
|
574
583
|
}
|
|
575
|
-
interface AgentOptions {
|
|
584
|
+
export interface AgentOptions {
|
|
576
585
|
sessionId?: string;
|
|
577
586
|
systemPrompt?: string;
|
|
578
587
|
messages?: MessageInput[];
|
|
@@ -587,25 +596,26 @@ interface AgentOptions {
|
|
|
587
596
|
setTopic?: (topic: string) => void;
|
|
588
597
|
getContextWindowLimit?: (request: ChatRequest) => number | undefined;
|
|
589
598
|
sessionDir?: string | (() => string | undefined);
|
|
599
|
+
outputFormat?: OutputFormat;
|
|
590
600
|
}
|
|
591
|
-
interface AgentDefinitionFactoryContext {
|
|
601
|
+
export interface AgentDefinitionFactoryContext {
|
|
592
602
|
agentId: string;
|
|
593
603
|
parentSessionId?: string;
|
|
594
604
|
runId?: string;
|
|
595
605
|
toolCallId?: string;
|
|
596
606
|
}
|
|
597
|
-
interface AgentDefinition {
|
|
607
|
+
export interface AgentDefinition {
|
|
598
608
|
id: string;
|
|
599
609
|
description?: string;
|
|
600
610
|
enabled?: boolean;
|
|
601
611
|
allowedChildAgentIds?: string[];
|
|
602
612
|
createOptions(ctx?: AgentDefinitionFactoryContext): AgentOptions;
|
|
603
613
|
}
|
|
604
|
-
type ManagedRunStatus = "aborted" | "completed" | "failed" | "idle" | "running";
|
|
605
|
-
interface ManagedRunError {
|
|
614
|
+
export type ManagedRunStatus = "aborted" | "completed" | "failed" | "idle" | "running";
|
|
615
|
+
export interface ManagedRunError {
|
|
606
616
|
message: string;
|
|
607
617
|
}
|
|
608
|
-
interface ManagedAgentRun {
|
|
618
|
+
export interface ManagedAgentRun {
|
|
609
619
|
runId: string;
|
|
610
620
|
agentId: string;
|
|
611
621
|
sessionId: string;
|
|
@@ -616,7 +626,7 @@ interface ManagedAgentRun {
|
|
|
616
626
|
result?: TurnResult;
|
|
617
627
|
error?: ManagedRunError;
|
|
618
628
|
}
|
|
619
|
-
interface ManagedAgentRunHandle {
|
|
629
|
+
export interface ManagedAgentRunHandle {
|
|
620
630
|
readonly runId: string;
|
|
621
631
|
readonly agentId: string;
|
|
622
632
|
readonly sessionId: string;
|
|
@@ -624,7 +634,7 @@ interface ManagedAgentRunHandle {
|
|
|
624
634
|
snapshot(): ManagedAgentRun;
|
|
625
635
|
wait(signal?: AbortSignal): Promise<ManagedAgentRun>;
|
|
626
636
|
}
|
|
627
|
-
interface ManagedRunEvent {
|
|
637
|
+
export interface ManagedRunEvent {
|
|
628
638
|
runId: string;
|
|
629
639
|
agentId: string;
|
|
630
640
|
sessionId: string;
|
|
@@ -632,16 +642,16 @@ interface ManagedRunEvent {
|
|
|
632
642
|
originToolCallId?: string;
|
|
633
643
|
event: AgentEvent;
|
|
634
644
|
}
|
|
635
|
-
type ManagedRunEventHandler = (event: ManagedRunEvent) => Promise<void> | void;
|
|
636
|
-
interface RuntimeManagerOptions {
|
|
645
|
+
export type ManagedRunEventHandler = (event: ManagedRunEvent) => Promise<void> | void;
|
|
646
|
+
export interface RuntimeManagerOptions {
|
|
637
647
|
onEvent?: ManagedRunEventHandler;
|
|
638
648
|
}
|
|
639
|
-
interface CreateManagedRunInput {
|
|
649
|
+
export interface CreateManagedRunInput {
|
|
640
650
|
agentId: string;
|
|
641
651
|
parentRunId?: string;
|
|
642
652
|
originToolCallId?: string;
|
|
643
653
|
}
|
|
644
|
-
interface CompileRequestInput {
|
|
654
|
+
export interface CompileRequestInput {
|
|
645
655
|
sessionId: string;
|
|
646
656
|
turnId: string;
|
|
647
657
|
reasoning?: ReasoningConfig;
|
|
@@ -651,46 +661,46 @@ interface CompileRequestInput {
|
|
|
651
661
|
model?: string;
|
|
652
662
|
max_tokens?: number;
|
|
653
663
|
}
|
|
654
|
-
interface OpenAiInputText {
|
|
664
|
+
export interface OpenAiInputText {
|
|
655
665
|
type: "input_text";
|
|
656
666
|
text: string;
|
|
657
667
|
}
|
|
658
|
-
interface OpenAiInputImage {
|
|
668
|
+
export interface OpenAiInputImage {
|
|
659
669
|
type: "input_image";
|
|
660
670
|
image_url: string;
|
|
661
671
|
detail?: string;
|
|
662
672
|
}
|
|
663
|
-
interface OpenAiInputMessage {
|
|
673
|
+
export interface OpenAiInputMessage {
|
|
664
674
|
type: "message";
|
|
665
675
|
role: MessageRole;
|
|
666
676
|
content: Array<OpenAiInputImage | OpenAiInputText | OpenAiOutputTextPart>;
|
|
667
677
|
}
|
|
668
|
-
interface OpenAiFunctionCall {
|
|
678
|
+
export interface OpenAiFunctionCall {
|
|
669
679
|
type: "function_call";
|
|
670
680
|
call_id: string;
|
|
671
681
|
name: string;
|
|
672
682
|
arguments: string;
|
|
673
683
|
}
|
|
674
|
-
interface OpenAiFunctionCallOutput {
|
|
684
|
+
export interface OpenAiFunctionCallOutput {
|
|
675
685
|
type: "function_call_output";
|
|
676
686
|
call_id: string;
|
|
677
687
|
output: string;
|
|
678
688
|
}
|
|
679
|
-
interface OpenAiOutputTextPart {
|
|
689
|
+
export interface OpenAiOutputTextPart {
|
|
680
690
|
type: "output_text";
|
|
681
691
|
text: string;
|
|
682
692
|
}
|
|
683
|
-
interface OpenAiRefusalPart {
|
|
693
|
+
export interface OpenAiRefusalPart {
|
|
684
694
|
type: "refusal";
|
|
685
695
|
refusal: string;
|
|
686
696
|
}
|
|
687
|
-
interface OpenAiOutputMessage {
|
|
697
|
+
export interface OpenAiOutputMessage {
|
|
688
698
|
type: "message";
|
|
689
699
|
content?: Array<OpenAiOutputTextPart | OpenAiRefusalPart>;
|
|
690
700
|
role?: string;
|
|
691
701
|
status?: string;
|
|
692
702
|
}
|
|
693
|
-
interface OpenAiReasoningOutputItem {
|
|
703
|
+
export interface OpenAiReasoningOutputItem {
|
|
694
704
|
type: "reasoning";
|
|
695
705
|
content?: Array<{
|
|
696
706
|
text?: string;
|
|
@@ -702,19 +712,19 @@ interface OpenAiReasoningOutputItem {
|
|
|
702
712
|
summary?: OpenAiReasoningSummaryText[];
|
|
703
713
|
text?: string;
|
|
704
714
|
}
|
|
705
|
-
type OpenAiResponsesOutputItem = JsonObject | OpenAiFunctionCall | OpenAiOutputMessage | OpenAiReasoningOutputItem;
|
|
706
|
-
interface OpenAiResponsesReasoningParam {
|
|
715
|
+
export type OpenAiResponsesOutputItem = JsonObject | OpenAiFunctionCall | OpenAiOutputMessage | OpenAiReasoningOutputItem;
|
|
716
|
+
export interface OpenAiResponsesReasoningParam {
|
|
707
717
|
effort?: OpenAiReasoningEffort;
|
|
708
718
|
generate_summary?: OpenAiReasoningSummary;
|
|
709
719
|
summary?: OpenAiReasoningSummary;
|
|
710
720
|
}
|
|
711
|
-
interface OpenAiFunctionTool {
|
|
721
|
+
export interface OpenAiFunctionTool {
|
|
712
722
|
type: "function";
|
|
713
723
|
name: string;
|
|
714
724
|
description: string;
|
|
715
725
|
parameters: JsonSchemaObject;
|
|
716
726
|
}
|
|
717
|
-
interface OpenAiResponsesRequest {
|
|
727
|
+
export interface OpenAiResponsesRequest {
|
|
718
728
|
include?: string[];
|
|
719
729
|
model: string;
|
|
720
730
|
instructions: string;
|
|
@@ -723,5 +733,5 @@ interface OpenAiResponsesRequest {
|
|
|
723
733
|
reasoning?: OpenAiResponsesReasoningParam;
|
|
724
734
|
tools: OpenAiFunctionTool[];
|
|
725
735
|
}
|
|
726
|
-
|
|
727
|
-
|
|
736
|
+
export {};
|
|
737
|
+
//# sourceMappingURL=types.d.ts.map
|