@nuvin/agent-core 0.0.0-rc.8 → 0.0.0
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 -68
- 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 -0
- 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 -28
- 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 -0
- package/dist/hooks/index.js +1 -0
- 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 -348
- 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 +67 -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 -17
- 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-mpqTRf_e.d.ts → shared/types.d.ts} +186 -167
- 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 -773
- 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/safe-fetch.d.ts +36 -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 +23 -0
- package/dist/tools/web-search-tool.d.ts +75 -0
- package/dist/tools/workspace-paths.d.ts +5 -0
- package/package.json +6 -2
- package/dist/chunk-4DNIDCX7.js +0 -1
- package/dist/chunk-G2FR4UGO.js +0 -1
- package/dist/chunk-KVFXQ7HW.js +0 -1
- package/dist/provider-adapters-BGVEzrOK.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[];
|
|
@@ -300,33 +308,34 @@ interface TurnState {
|
|
|
300
308
|
lastResponse?: ChatResponse;
|
|
301
309
|
toolResults: ToolResult[];
|
|
302
310
|
finalMessage?: IdentifiedMessage;
|
|
311
|
+
sessionDir?: string;
|
|
303
312
|
}
|
|
304
|
-
type TurnResultStatus = "completed" | "aborted";
|
|
305
|
-
interface TurnResult {
|
|
313
|
+
export type TurnResultStatus = "completed" | "aborted";
|
|
314
|
+
export interface TurnResult {
|
|
306
315
|
status: TurnResultStatus;
|
|
307
316
|
finalMessage?: IdentifiedMessage;
|
|
308
317
|
state: TurnState;
|
|
309
318
|
}
|
|
310
|
-
type ProviderCredentialKind = "api-key" | "oauth-token" | "session-token";
|
|
311
|
-
interface ProviderCredential {
|
|
319
|
+
export type ProviderCredentialKind = "api-key" | "oauth-token" | "session-token";
|
|
320
|
+
export interface ProviderCredential {
|
|
312
321
|
kind: ProviderCredentialKind;
|
|
313
322
|
value: string;
|
|
314
323
|
}
|
|
315
|
-
interface ProviderEndpoints {
|
|
324
|
+
export interface ProviderEndpoints {
|
|
316
325
|
api?: string;
|
|
317
326
|
originTracker?: string;
|
|
318
327
|
proxy?: string;
|
|
319
328
|
telemetry?: string;
|
|
320
329
|
}
|
|
321
|
-
interface ResolvedProviderSession {
|
|
330
|
+
export interface ResolvedProviderSession {
|
|
322
331
|
credential: ProviderCredential;
|
|
323
332
|
endpoints?: ProviderEndpoints;
|
|
324
333
|
metadata?: Record<string, string>;
|
|
325
334
|
}
|
|
326
|
-
interface ProviderSessionResolver {
|
|
335
|
+
export interface ProviderSessionResolver {
|
|
327
336
|
resolve(signal?: AbortSignal): Promise<ResolvedProviderSession>;
|
|
328
337
|
}
|
|
329
|
-
interface PrepareRequestInput {
|
|
338
|
+
export interface PrepareRequestInput {
|
|
330
339
|
sessionId: string;
|
|
331
340
|
turnId: string;
|
|
332
341
|
reasoning?: ReasoningConfig;
|
|
@@ -335,162 +344,162 @@ interface PrepareRequestInput {
|
|
|
335
344
|
tools: ToolSchema[];
|
|
336
345
|
maxTokens?: number;
|
|
337
346
|
}
|
|
338
|
-
interface PreparedRequest {
|
|
347
|
+
export interface PreparedRequest {
|
|
339
348
|
request: ModelRequest;
|
|
340
349
|
session?: ResolvedProviderSession;
|
|
341
350
|
}
|
|
342
|
-
type ProviderRequestMutator = (preparedRequest: PreparedRequest) => PreparedRequest | Promise<PreparedRequest>;
|
|
343
|
-
interface ChatModel {
|
|
351
|
+
export type ProviderRequestMutator = (preparedRequest: PreparedRequest) => PreparedRequest | Promise<PreparedRequest>;
|
|
352
|
+
export interface ChatModel {
|
|
344
353
|
prepareRequest(request: PrepareRequestInput): ModelRequest;
|
|
345
354
|
complete(request: ModelRequest): Promise<ModelResponse>;
|
|
346
355
|
}
|
|
347
|
-
interface ModelExecutionOptions {
|
|
348
|
-
onProviderRetry?: (event: ProviderRetryChunk) => Promise<void> | void;
|
|
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>;
|
|
398
|
+
setTopic?: (topic: string) => void;
|
|
390
399
|
}
|
|
391
|
-
interface ToolRuntimeStartedEvent {
|
|
400
|
+
export interface ToolRuntimeStartedEvent {
|
|
392
401
|
type: "tool_started";
|
|
393
402
|
toolCall: ToolUseBlock;
|
|
394
403
|
}
|
|
395
|
-
interface ToolRuntimeOutputChunkEvent {
|
|
404
|
+
export interface ToolRuntimeOutputChunkEvent {
|
|
396
405
|
type: "tool_output_chunk";
|
|
397
406
|
toolCall: ToolUseBlock;
|
|
398
407
|
chunk: ToolResultChunk;
|
|
399
408
|
}
|
|
400
|
-
interface ToolRuntimeCompletedEvent {
|
|
409
|
+
export interface ToolRuntimeCompletedEvent {
|
|
401
410
|
type: "tool_completed";
|
|
402
411
|
toolCall: ToolUseBlock;
|
|
403
412
|
result: ToolResult;
|
|
404
413
|
}
|
|
405
|
-
interface ToolRuntimeRejectedEvent {
|
|
414
|
+
export interface ToolRuntimeRejectedEvent {
|
|
406
415
|
type: "tool_rejected";
|
|
407
416
|
toolCall: ToolUseBlock;
|
|
408
417
|
result: ToolResult;
|
|
409
418
|
}
|
|
410
|
-
type ToolRuntimeEvent = ToolRuntimeOutputChunkEvent | ToolRuntimeCompletedEvent | ToolRuntimeRejectedEvent | ToolRuntimeStartedEvent;
|
|
411
|
-
interface AgentUserMessageEvent {
|
|
419
|
+
export type ToolRuntimeEvent = ToolRuntimeOutputChunkEvent | ToolRuntimeCompletedEvent | ToolRuntimeRejectedEvent | ToolRuntimeStartedEvent;
|
|
420
|
+
export interface AgentUserMessageEvent {
|
|
412
421
|
type: "user_message";
|
|
413
422
|
message: Message;
|
|
414
423
|
}
|
|
415
|
-
interface AgentModelRequestEvent {
|
|
424
|
+
export interface AgentModelRequestEvent {
|
|
416
425
|
type: "model_request";
|
|
417
426
|
request: ChatRequest;
|
|
418
427
|
}
|
|
419
|
-
interface AgentModelResponseEvent {
|
|
428
|
+
export interface AgentModelResponseEvent {
|
|
420
429
|
type: "model_response";
|
|
421
430
|
response: ChatResponse;
|
|
422
431
|
}
|
|
423
|
-
interface AgentAssistantMessageEvent {
|
|
432
|
+
export interface AgentAssistantMessageEvent {
|
|
424
433
|
type: "assistant_message";
|
|
425
434
|
message: IdentifiedMessage;
|
|
426
435
|
}
|
|
427
|
-
interface AgentAssistantChunkEvent {
|
|
436
|
+
export interface AgentAssistantChunkEvent {
|
|
428
437
|
type: "assistant_chunk";
|
|
429
438
|
index: number;
|
|
430
439
|
messageId: string;
|
|
431
440
|
chunk: ContentDeltaChunk;
|
|
432
441
|
}
|
|
433
|
-
interface AgentToolUseMessageEvent {
|
|
442
|
+
export interface AgentToolUseMessageEvent {
|
|
434
443
|
type: "tool_use_message";
|
|
435
444
|
message: IdentifiedMessage;
|
|
436
445
|
}
|
|
437
|
-
interface AgentToolUseChunkEvent {
|
|
446
|
+
export interface AgentToolUseChunkEvent {
|
|
438
447
|
type: "tool_use_chunk";
|
|
439
448
|
index: number;
|
|
440
449
|
messageId: string;
|
|
441
450
|
chunk: ToolUseDeltaChunk;
|
|
442
451
|
}
|
|
443
|
-
interface AgentReasoningMessageEvent {
|
|
452
|
+
export interface AgentReasoningMessageEvent {
|
|
444
453
|
type: "reasoning_message";
|
|
445
454
|
message: IdentifiedMessage;
|
|
446
455
|
}
|
|
447
|
-
interface AgentReasoningChunkEvent {
|
|
456
|
+
export interface AgentReasoningChunkEvent {
|
|
448
457
|
type: "reasoning_chunk";
|
|
449
458
|
index: number;
|
|
450
459
|
messageId: string;
|
|
451
460
|
chunk: AnthropicThinkingDeltaChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk;
|
|
452
461
|
text: string;
|
|
453
462
|
}
|
|
454
|
-
interface AgentToolCallEvent {
|
|
463
|
+
export interface AgentToolCallEvent {
|
|
455
464
|
type: "tool_call";
|
|
456
465
|
toolCall: ToolUseBlock;
|
|
457
466
|
}
|
|
458
|
-
interface AgentToolResultEvent {
|
|
467
|
+
export interface AgentToolResultEvent {
|
|
459
468
|
type: "tool_result";
|
|
460
469
|
result: ToolResult;
|
|
461
470
|
}
|
|
462
|
-
interface AgentToolResultMessageEvent {
|
|
471
|
+
export interface AgentToolResultMessageEvent {
|
|
463
472
|
type: "tool_result_message";
|
|
464
473
|
message: Message;
|
|
465
474
|
}
|
|
466
|
-
interface AgentFinalMessageEvent {
|
|
475
|
+
export interface AgentFinalMessageEvent {
|
|
467
476
|
type: "final_message";
|
|
468
477
|
message: IdentifiedMessage;
|
|
469
478
|
}
|
|
470
|
-
interface AgentTurnCompleteEvent {
|
|
479
|
+
export interface AgentTurnCompleteEvent {
|
|
471
480
|
type: "turn_complete";
|
|
472
481
|
state: TurnState;
|
|
473
482
|
}
|
|
474
|
-
interface AgentProviderRetryEvent extends ProviderRetryChunk {
|
|
483
|
+
export interface AgentProviderRetryEvent extends ProviderRetryChunk {
|
|
475
484
|
}
|
|
476
|
-
type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentProviderRetryEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
|
|
477
|
-
type AgentEvent = AgentLifecycleEvent | ToolRuntimeEvent;
|
|
478
|
-
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 = {
|
|
479
488
|
action: "reject";
|
|
480
489
|
reason?: string;
|
|
481
490
|
} | {
|
|
482
491
|
action: "run";
|
|
483
492
|
};
|
|
484
|
-
type ToolRuntimeToolCallHandler = (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined;
|
|
485
|
-
type ToolRuntimeEventHandler = (event: ToolRuntimeEvent, ctx: ToolExecutionContext) => Promise<void> | void;
|
|
486
|
-
type AgentEventHandler = (event: AgentEvent, ctx: AgentEventContext) => Promise<void> | void;
|
|
487
|
-
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 {
|
|
488
497
|
listToolSchemas(): ToolSchema[];
|
|
489
498
|
setTools(tools: AnyToolDefinition[]): void;
|
|
490
499
|
executeCalls(toolCalls: ToolUseBlock[], ctx: ToolExecutionContext): Promise<ToolResult[]>;
|
|
491
500
|
execute(toolCall: ToolUseBlock, ctx: ToolExecutionContext): Promise<ToolResult>;
|
|
492
501
|
}
|
|
493
|
-
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;
|
|
494
503
|
type Expand<TValue> = TValue extends infer TObject ? {
|
|
495
504
|
[TKey in keyof TObject]: TObject[TKey];
|
|
496
505
|
} : never;
|
|
@@ -502,17 +511,20 @@ type RequiredProperties<TProperties extends Record<string, JsonSchema>, TRequire
|
|
|
502
511
|
type OptionalProperties<TProperties extends Record<string, JsonSchema>, TRequired extends readonly string[] | undefined> = {
|
|
503
512
|
[TKey in OptionalKeyUnion<TProperties, TRequired>]?: InferJsonSchema<TProperties[TKey]>;
|
|
504
513
|
};
|
|
505
|
-
type ToolOutputValue = JsonValue | ToolOutputEnvelope;
|
|
506
|
-
type ToolGenerator<TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined> = AsyncGenerator<TYield, TReturn, void>;
|
|
507
|
-
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> {
|
|
508
517
|
name: string;
|
|
509
518
|
description: string;
|
|
510
519
|
inputSchema: TSchema;
|
|
511
520
|
execute(input: TInput, ctx: ToolExecutionContext): ToolGenerator<TYield, TReturn>;
|
|
512
521
|
}
|
|
513
|
-
type AnyToolDefinition = ToolDefinition<JsonObject, ToolOutputValue, ToolOutputValue | undefined, JsonSchemaObject>;
|
|
514
|
-
type
|
|
515
|
-
|
|
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 {
|
|
527
|
+
afterMessageAppend: Message;
|
|
516
528
|
onUserMessage: Message;
|
|
517
529
|
beforeModelRequest: ChatRequest;
|
|
518
530
|
afterModelResponse: ChatResponse;
|
|
@@ -523,12 +535,12 @@ interface PayloadByStage {
|
|
|
523
535
|
beforeToolResultAppend: Message;
|
|
524
536
|
afterTurnComplete: TurnState;
|
|
525
537
|
}
|
|
526
|
-
interface ExtensionContext {
|
|
538
|
+
export interface ExtensionContext {
|
|
527
539
|
state: TurnState;
|
|
528
540
|
}
|
|
529
|
-
type Transformer<S extends
|
|
530
|
-
type Observer<S extends Stage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => Promise<void> | void;
|
|
531
|
-
interface TransformerExtensionRegistration<S extends
|
|
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> {
|
|
532
544
|
id: string;
|
|
533
545
|
stage: S;
|
|
534
546
|
kind: "transformer";
|
|
@@ -536,7 +548,7 @@ interface TransformerExtensionRegistration<S extends Stage = Stage> {
|
|
|
536
548
|
enabled: boolean;
|
|
537
549
|
run: Transformer<S>;
|
|
538
550
|
}
|
|
539
|
-
interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
551
|
+
export interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
540
552
|
id: string;
|
|
541
553
|
stage: S;
|
|
542
554
|
kind: "observer";
|
|
@@ -544,28 +556,32 @@ interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
|
544
556
|
enabled: boolean;
|
|
545
557
|
run: Observer<S>;
|
|
546
558
|
}
|
|
547
|
-
type
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
559
|
+
export type AnyExtensionRegistration = {
|
|
560
|
+
[S in Stage]: ObserverExtensionRegistration<S>;
|
|
561
|
+
}[Stage] | {
|
|
562
|
+
[S in TransformableStage]: TransformerExtensionRegistration<S>;
|
|
563
|
+
}[TransformableStage];
|
|
564
|
+
export interface ExtensionRegistry {
|
|
552
565
|
register(extension: AnyExtensionRegistration): void;
|
|
553
|
-
runTransformers<S extends
|
|
566
|
+
runTransformers<S extends TransformableStage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<PayloadByStage[S]>;
|
|
554
567
|
runObservers<S extends Stage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<void>;
|
|
555
568
|
}
|
|
556
|
-
interface RunTurnDeps {
|
|
569
|
+
export interface RunTurnDeps {
|
|
557
570
|
registry: ExtensionRegistry;
|
|
558
571
|
chatModel: EngineChatModel;
|
|
559
572
|
toolRuntime: ToolRuntime;
|
|
560
573
|
askUser?: (request: AskUserQuestionRequest) => Promise<AskUserAnswers>;
|
|
574
|
+
setTopic?: (topic: string) => void;
|
|
561
575
|
onEvent?: AgentEventHandler;
|
|
576
|
+
sessionDir?: string | (() => string | undefined);
|
|
577
|
+
outputFormat?: OutputFormat;
|
|
562
578
|
}
|
|
563
|
-
type AgentInput = MessageInput | string;
|
|
564
|
-
interface AgentSendOptions {
|
|
579
|
+
export type AgentInput = MessageInput | string;
|
|
580
|
+
export interface AgentSendOptions {
|
|
565
581
|
streaming?: boolean;
|
|
566
582
|
signal?: AbortSignal;
|
|
567
583
|
}
|
|
568
|
-
interface AgentOptions {
|
|
584
|
+
export interface AgentOptions {
|
|
569
585
|
sessionId?: string;
|
|
570
586
|
systemPrompt?: string;
|
|
571
587
|
messages?: MessageInput[];
|
|
@@ -577,26 +593,29 @@ interface AgentOptions {
|
|
|
577
593
|
chatModel?: EngineChatModel;
|
|
578
594
|
tools?: AnyToolDefinition[];
|
|
579
595
|
askUser?: (request: AskUserQuestionRequest) => Promise<AskUserAnswers>;
|
|
596
|
+
setTopic?: (topic: string) => void;
|
|
580
597
|
getContextWindowLimit?: (request: ChatRequest) => number | undefined;
|
|
598
|
+
sessionDir?: string | (() => string | undefined);
|
|
599
|
+
outputFormat?: OutputFormat;
|
|
581
600
|
}
|
|
582
|
-
interface AgentDefinitionFactoryContext {
|
|
601
|
+
export interface AgentDefinitionFactoryContext {
|
|
583
602
|
agentId: string;
|
|
584
603
|
parentSessionId?: string;
|
|
585
604
|
runId?: string;
|
|
586
605
|
toolCallId?: string;
|
|
587
606
|
}
|
|
588
|
-
interface AgentDefinition {
|
|
607
|
+
export interface AgentDefinition {
|
|
589
608
|
id: string;
|
|
590
609
|
description?: string;
|
|
591
610
|
enabled?: boolean;
|
|
592
611
|
allowedChildAgentIds?: string[];
|
|
593
612
|
createOptions(ctx?: AgentDefinitionFactoryContext): AgentOptions;
|
|
594
613
|
}
|
|
595
|
-
type ManagedRunStatus = "aborted" | "completed" | "failed" | "idle" | "running";
|
|
596
|
-
interface ManagedRunError {
|
|
614
|
+
export type ManagedRunStatus = "aborted" | "completed" | "failed" | "idle" | "running";
|
|
615
|
+
export interface ManagedRunError {
|
|
597
616
|
message: string;
|
|
598
617
|
}
|
|
599
|
-
interface ManagedAgentRun {
|
|
618
|
+
export interface ManagedAgentRun {
|
|
600
619
|
runId: string;
|
|
601
620
|
agentId: string;
|
|
602
621
|
sessionId: string;
|
|
@@ -607,7 +626,7 @@ interface ManagedAgentRun {
|
|
|
607
626
|
result?: TurnResult;
|
|
608
627
|
error?: ManagedRunError;
|
|
609
628
|
}
|
|
610
|
-
interface ManagedAgentRunHandle {
|
|
629
|
+
export interface ManagedAgentRunHandle {
|
|
611
630
|
readonly runId: string;
|
|
612
631
|
readonly agentId: string;
|
|
613
632
|
readonly sessionId: string;
|
|
@@ -615,7 +634,7 @@ interface ManagedAgentRunHandle {
|
|
|
615
634
|
snapshot(): ManagedAgentRun;
|
|
616
635
|
wait(signal?: AbortSignal): Promise<ManagedAgentRun>;
|
|
617
636
|
}
|
|
618
|
-
interface ManagedRunEvent {
|
|
637
|
+
export interface ManagedRunEvent {
|
|
619
638
|
runId: string;
|
|
620
639
|
agentId: string;
|
|
621
640
|
sessionId: string;
|
|
@@ -623,16 +642,16 @@ interface ManagedRunEvent {
|
|
|
623
642
|
originToolCallId?: string;
|
|
624
643
|
event: AgentEvent;
|
|
625
644
|
}
|
|
626
|
-
type ManagedRunEventHandler = (event: ManagedRunEvent) => Promise<void> | void;
|
|
627
|
-
interface RuntimeManagerOptions {
|
|
645
|
+
export type ManagedRunEventHandler = (event: ManagedRunEvent) => Promise<void> | void;
|
|
646
|
+
export interface RuntimeManagerOptions {
|
|
628
647
|
onEvent?: ManagedRunEventHandler;
|
|
629
648
|
}
|
|
630
|
-
interface CreateManagedRunInput {
|
|
649
|
+
export interface CreateManagedRunInput {
|
|
631
650
|
agentId: string;
|
|
632
651
|
parentRunId?: string;
|
|
633
652
|
originToolCallId?: string;
|
|
634
653
|
}
|
|
635
|
-
interface CompileRequestInput {
|
|
654
|
+
export interface CompileRequestInput {
|
|
636
655
|
sessionId: string;
|
|
637
656
|
turnId: string;
|
|
638
657
|
reasoning?: ReasoningConfig;
|
|
@@ -642,46 +661,46 @@ interface CompileRequestInput {
|
|
|
642
661
|
model?: string;
|
|
643
662
|
max_tokens?: number;
|
|
644
663
|
}
|
|
645
|
-
interface OpenAiInputText {
|
|
664
|
+
export interface OpenAiInputText {
|
|
646
665
|
type: "input_text";
|
|
647
666
|
text: string;
|
|
648
667
|
}
|
|
649
|
-
interface OpenAiInputImage {
|
|
668
|
+
export interface OpenAiInputImage {
|
|
650
669
|
type: "input_image";
|
|
651
670
|
image_url: string;
|
|
652
671
|
detail?: string;
|
|
653
672
|
}
|
|
654
|
-
interface OpenAiInputMessage {
|
|
673
|
+
export interface OpenAiInputMessage {
|
|
655
674
|
type: "message";
|
|
656
675
|
role: MessageRole;
|
|
657
|
-
content: Array<OpenAiInputImage | OpenAiInputText>;
|
|
676
|
+
content: Array<OpenAiInputImage | OpenAiInputText | OpenAiOutputTextPart>;
|
|
658
677
|
}
|
|
659
|
-
interface OpenAiFunctionCall {
|
|
678
|
+
export interface OpenAiFunctionCall {
|
|
660
679
|
type: "function_call";
|
|
661
680
|
call_id: string;
|
|
662
681
|
name: string;
|
|
663
682
|
arguments: string;
|
|
664
683
|
}
|
|
665
|
-
interface OpenAiFunctionCallOutput {
|
|
684
|
+
export interface OpenAiFunctionCallOutput {
|
|
666
685
|
type: "function_call_output";
|
|
667
686
|
call_id: string;
|
|
668
687
|
output: string;
|
|
669
688
|
}
|
|
670
|
-
interface OpenAiOutputTextPart {
|
|
689
|
+
export interface OpenAiOutputTextPart {
|
|
671
690
|
type: "output_text";
|
|
672
691
|
text: string;
|
|
673
692
|
}
|
|
674
|
-
interface OpenAiRefusalPart {
|
|
693
|
+
export interface OpenAiRefusalPart {
|
|
675
694
|
type: "refusal";
|
|
676
695
|
refusal: string;
|
|
677
696
|
}
|
|
678
|
-
interface OpenAiOutputMessage {
|
|
697
|
+
export interface OpenAiOutputMessage {
|
|
679
698
|
type: "message";
|
|
680
699
|
content?: Array<OpenAiOutputTextPart | OpenAiRefusalPart>;
|
|
681
700
|
role?: string;
|
|
682
701
|
status?: string;
|
|
683
702
|
}
|
|
684
|
-
interface OpenAiReasoningOutputItem {
|
|
703
|
+
export interface OpenAiReasoningOutputItem {
|
|
685
704
|
type: "reasoning";
|
|
686
705
|
content?: Array<{
|
|
687
706
|
text?: string;
|
|
@@ -693,19 +712,19 @@ interface OpenAiReasoningOutputItem {
|
|
|
693
712
|
summary?: OpenAiReasoningSummaryText[];
|
|
694
713
|
text?: string;
|
|
695
714
|
}
|
|
696
|
-
type OpenAiResponsesOutputItem = JsonObject | OpenAiFunctionCall | OpenAiOutputMessage | OpenAiReasoningOutputItem;
|
|
697
|
-
interface OpenAiResponsesReasoningParam {
|
|
715
|
+
export type OpenAiResponsesOutputItem = JsonObject | OpenAiFunctionCall | OpenAiOutputMessage | OpenAiReasoningOutputItem;
|
|
716
|
+
export interface OpenAiResponsesReasoningParam {
|
|
698
717
|
effort?: OpenAiReasoningEffort;
|
|
699
718
|
generate_summary?: OpenAiReasoningSummary;
|
|
700
719
|
summary?: OpenAiReasoningSummary;
|
|
701
720
|
}
|
|
702
|
-
interface OpenAiFunctionTool {
|
|
721
|
+
export interface OpenAiFunctionTool {
|
|
703
722
|
type: "function";
|
|
704
723
|
name: string;
|
|
705
724
|
description: string;
|
|
706
725
|
parameters: JsonSchemaObject;
|
|
707
726
|
}
|
|
708
|
-
interface OpenAiResponsesRequest {
|
|
727
|
+
export interface OpenAiResponsesRequest {
|
|
709
728
|
include?: string[];
|
|
710
729
|
model: string;
|
|
711
730
|
instructions: string;
|
|
@@ -714,5 +733,5 @@ interface OpenAiResponsesRequest {
|
|
|
714
733
|
reasoning?: OpenAiResponsesReasoningParam;
|
|
715
734
|
tools: OpenAiFunctionTool[];
|
|
716
735
|
}
|
|
717
|
-
|
|
718
|
-
|
|
736
|
+
export {};
|
|
737
|
+
//# sourceMappingURL=types.d.ts.map
|