@nuvin/agent-core 0.0.0-rc.9 → 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 -347
- 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-Bb2eVtsy.d.ts → shared/types.d.ts} +180 -164
- 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-3QLMAAJY.js +0 -1
- package/dist/chunk-4DNIDCX7.js +0 -1
- package/dist/chunk-G2FR4UGO.js +0 -1
- package/dist/provider-adapters-NxiNWlxu.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,161 +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 {
|
|
356
|
+
export interface ModelExecutionOptions {
|
|
348
357
|
signal?: AbortSignal;
|
|
349
358
|
}
|
|
350
|
-
interface EngineChatModel {
|
|
359
|
+
export interface EngineChatModel {
|
|
351
360
|
model: string;
|
|
352
361
|
maxTokens?: number;
|
|
353
362
|
complete(request: ChatRequest, options?: ModelExecutionOptions): Promise<ChatResponse>;
|
|
354
363
|
stream?(request: ChatRequest, options?: ModelExecutionOptions): AsyncIterable<ChatResponseChunk>;
|
|
355
364
|
getModels?(signal?: AbortSignal): Promise<ModelInfo[]>;
|
|
356
365
|
}
|
|
357
|
-
interface BaseChatModelOptions {
|
|
366
|
+
export interface BaseChatModelOptions {
|
|
358
367
|
model: string;
|
|
359
368
|
maxTokens?: number;
|
|
360
369
|
reasoning?: ReasoningConfig;
|
|
361
370
|
providerSessionResolver?: ProviderSessionResolver;
|
|
362
371
|
requestMutators?: ProviderRequestMutator[];
|
|
363
372
|
}
|
|
364
|
-
interface AgentEventContext {
|
|
373
|
+
export interface AgentEventContext {
|
|
365
374
|
sessionId: string;
|
|
366
375
|
turnId: string;
|
|
367
376
|
state: TurnState;
|
|
368
377
|
}
|
|
369
|
-
type AskUserOption = {
|
|
378
|
+
export type AskUserOption = {
|
|
370
379
|
label: string;
|
|
371
380
|
description: string;
|
|
372
381
|
};
|
|
373
|
-
type AskUserQuestion = {
|
|
382
|
+
export type AskUserQuestion = {
|
|
374
383
|
id: string;
|
|
375
384
|
question: string;
|
|
376
|
-
|
|
385
|
+
topic: string;
|
|
377
386
|
options: AskUserOption[];
|
|
378
387
|
multiSelect: boolean;
|
|
379
388
|
};
|
|
380
|
-
type AskUserAnswers = Record<string, string | string[]>;
|
|
381
|
-
type AskUserQuestionRequest = {
|
|
389
|
+
export type AskUserAnswers = Record<string, string | string[]>;
|
|
390
|
+
export type AskUserQuestionRequest = {
|
|
382
391
|
questionId: string;
|
|
383
392
|
questions: AskUserQuestion[];
|
|
384
393
|
};
|
|
385
|
-
interface ToolExecutionContext extends AgentEventContext {
|
|
394
|
+
export interface ToolExecutionContext extends AgentEventContext {
|
|
386
395
|
signal: AbortSignal;
|
|
387
396
|
toolCallId?: string;
|
|
388
397
|
askUser?: (request: AskUserQuestionRequest) => Promise<AskUserAnswers>;
|
|
398
|
+
setTopic?: (topic: string) => void;
|
|
389
399
|
}
|
|
390
|
-
interface ToolRuntimeStartedEvent {
|
|
400
|
+
export interface ToolRuntimeStartedEvent {
|
|
391
401
|
type: "tool_started";
|
|
392
402
|
toolCall: ToolUseBlock;
|
|
393
403
|
}
|
|
394
|
-
interface ToolRuntimeOutputChunkEvent {
|
|
404
|
+
export interface ToolRuntimeOutputChunkEvent {
|
|
395
405
|
type: "tool_output_chunk";
|
|
396
406
|
toolCall: ToolUseBlock;
|
|
397
407
|
chunk: ToolResultChunk;
|
|
398
408
|
}
|
|
399
|
-
interface ToolRuntimeCompletedEvent {
|
|
409
|
+
export interface ToolRuntimeCompletedEvent {
|
|
400
410
|
type: "tool_completed";
|
|
401
411
|
toolCall: ToolUseBlock;
|
|
402
412
|
result: ToolResult;
|
|
403
413
|
}
|
|
404
|
-
interface ToolRuntimeRejectedEvent {
|
|
414
|
+
export interface ToolRuntimeRejectedEvent {
|
|
405
415
|
type: "tool_rejected";
|
|
406
416
|
toolCall: ToolUseBlock;
|
|
407
417
|
result: ToolResult;
|
|
408
418
|
}
|
|
409
|
-
type ToolRuntimeEvent = ToolRuntimeOutputChunkEvent | ToolRuntimeCompletedEvent | ToolRuntimeRejectedEvent | ToolRuntimeStartedEvent;
|
|
410
|
-
interface AgentUserMessageEvent {
|
|
419
|
+
export type ToolRuntimeEvent = ToolRuntimeOutputChunkEvent | ToolRuntimeCompletedEvent | ToolRuntimeRejectedEvent | ToolRuntimeStartedEvent;
|
|
420
|
+
export interface AgentUserMessageEvent {
|
|
411
421
|
type: "user_message";
|
|
412
422
|
message: Message;
|
|
413
423
|
}
|
|
414
|
-
interface AgentModelRequestEvent {
|
|
424
|
+
export interface AgentModelRequestEvent {
|
|
415
425
|
type: "model_request";
|
|
416
426
|
request: ChatRequest;
|
|
417
427
|
}
|
|
418
|
-
interface AgentModelResponseEvent {
|
|
428
|
+
export interface AgentModelResponseEvent {
|
|
419
429
|
type: "model_response";
|
|
420
430
|
response: ChatResponse;
|
|
421
431
|
}
|
|
422
|
-
interface AgentAssistantMessageEvent {
|
|
432
|
+
export interface AgentAssistantMessageEvent {
|
|
423
433
|
type: "assistant_message";
|
|
424
434
|
message: IdentifiedMessage;
|
|
425
435
|
}
|
|
426
|
-
interface AgentAssistantChunkEvent {
|
|
436
|
+
export interface AgentAssistantChunkEvent {
|
|
427
437
|
type: "assistant_chunk";
|
|
428
438
|
index: number;
|
|
429
439
|
messageId: string;
|
|
430
440
|
chunk: ContentDeltaChunk;
|
|
431
441
|
}
|
|
432
|
-
interface AgentToolUseMessageEvent {
|
|
442
|
+
export interface AgentToolUseMessageEvent {
|
|
433
443
|
type: "tool_use_message";
|
|
434
444
|
message: IdentifiedMessage;
|
|
435
445
|
}
|
|
436
|
-
interface AgentToolUseChunkEvent {
|
|
446
|
+
export interface AgentToolUseChunkEvent {
|
|
437
447
|
type: "tool_use_chunk";
|
|
438
448
|
index: number;
|
|
439
449
|
messageId: string;
|
|
440
450
|
chunk: ToolUseDeltaChunk;
|
|
441
451
|
}
|
|
442
|
-
interface AgentReasoningMessageEvent {
|
|
452
|
+
export interface AgentReasoningMessageEvent {
|
|
443
453
|
type: "reasoning_message";
|
|
444
454
|
message: IdentifiedMessage;
|
|
445
455
|
}
|
|
446
|
-
interface AgentReasoningChunkEvent {
|
|
456
|
+
export interface AgentReasoningChunkEvent {
|
|
447
457
|
type: "reasoning_chunk";
|
|
448
458
|
index: number;
|
|
449
459
|
messageId: string;
|
|
450
460
|
chunk: AnthropicThinkingDeltaChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk;
|
|
451
461
|
text: string;
|
|
452
462
|
}
|
|
453
|
-
interface AgentToolCallEvent {
|
|
463
|
+
export interface AgentToolCallEvent {
|
|
454
464
|
type: "tool_call";
|
|
455
465
|
toolCall: ToolUseBlock;
|
|
456
466
|
}
|
|
457
|
-
interface AgentToolResultEvent {
|
|
467
|
+
export interface AgentToolResultEvent {
|
|
458
468
|
type: "tool_result";
|
|
459
469
|
result: ToolResult;
|
|
460
470
|
}
|
|
461
|
-
interface AgentToolResultMessageEvent {
|
|
471
|
+
export interface AgentToolResultMessageEvent {
|
|
462
472
|
type: "tool_result_message";
|
|
463
473
|
message: Message;
|
|
464
474
|
}
|
|
465
|
-
interface AgentFinalMessageEvent {
|
|
475
|
+
export interface AgentFinalMessageEvent {
|
|
466
476
|
type: "final_message";
|
|
467
477
|
message: IdentifiedMessage;
|
|
468
478
|
}
|
|
469
|
-
interface AgentTurnCompleteEvent {
|
|
479
|
+
export interface AgentTurnCompleteEvent {
|
|
470
480
|
type: "turn_complete";
|
|
471
481
|
state: TurnState;
|
|
472
482
|
}
|
|
473
|
-
interface AgentProviderRetryEvent extends ProviderRetryChunk {
|
|
483
|
+
export interface AgentProviderRetryEvent extends ProviderRetryChunk {
|
|
474
484
|
}
|
|
475
|
-
type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentProviderRetryEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
|
|
476
|
-
type AgentEvent = AgentLifecycleEvent | ToolRuntimeEvent;
|
|
477
|
-
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 = {
|
|
478
488
|
action: "reject";
|
|
479
489
|
reason?: string;
|
|
480
490
|
} | {
|
|
481
491
|
action: "run";
|
|
482
492
|
};
|
|
483
|
-
type ToolRuntimeToolCallHandler = (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined;
|
|
484
|
-
type ToolRuntimeEventHandler = (event: ToolRuntimeEvent, ctx: ToolExecutionContext) => Promise<void> | void;
|
|
485
|
-
type AgentEventHandler = (event: AgentEvent, ctx: AgentEventContext) => Promise<void> | void;
|
|
486
|
-
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 {
|
|
487
497
|
listToolSchemas(): ToolSchema[];
|
|
488
498
|
setTools(tools: AnyToolDefinition[]): void;
|
|
489
499
|
executeCalls(toolCalls: ToolUseBlock[], ctx: ToolExecutionContext): Promise<ToolResult[]>;
|
|
490
500
|
execute(toolCall: ToolUseBlock, ctx: ToolExecutionContext): Promise<ToolResult>;
|
|
491
501
|
}
|
|
492
|
-
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;
|
|
493
503
|
type Expand<TValue> = TValue extends infer TObject ? {
|
|
494
504
|
[TKey in keyof TObject]: TObject[TKey];
|
|
495
505
|
} : never;
|
|
@@ -501,19 +511,19 @@ type RequiredProperties<TProperties extends Record<string, JsonSchema>, TRequire
|
|
|
501
511
|
type OptionalProperties<TProperties extends Record<string, JsonSchema>, TRequired extends readonly string[] | undefined> = {
|
|
502
512
|
[TKey in OptionalKeyUnion<TProperties, TRequired>]?: InferJsonSchema<TProperties[TKey]>;
|
|
503
513
|
};
|
|
504
|
-
type ToolOutputValue = JsonValue | ToolOutputEnvelope;
|
|
505
|
-
type ToolGenerator<TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined> = AsyncGenerator<TYield, TReturn, void>;
|
|
506
|
-
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> {
|
|
507
517
|
name: string;
|
|
508
518
|
description: string;
|
|
509
519
|
inputSchema: TSchema;
|
|
510
520
|
execute(input: TInput, ctx: ToolExecutionContext): ToolGenerator<TYield, TReturn>;
|
|
511
521
|
}
|
|
512
|
-
type AnyToolDefinition = ToolDefinition<JsonObject, ToolOutputValue, ToolOutputValue | undefined, JsonSchemaObject>;
|
|
513
|
-
type TransformableStage = "afterModelResponse" | "afterToolResult" | "beforeAssistantAppend" | "beforeFinalOutput" | "beforeModelRequest" | "beforeToolExecution" | "beforeToolResultAppend" | "onUserMessage";
|
|
514
|
-
type ObserverOnlyStage = "afterMessageAppend" | "afterTurnComplete";
|
|
515
|
-
type Stage = ObserverOnlyStage | TransformableStage;
|
|
516
|
-
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 {
|
|
517
527
|
afterMessageAppend: Message;
|
|
518
528
|
onUserMessage: Message;
|
|
519
529
|
beforeModelRequest: ChatRequest;
|
|
@@ -525,12 +535,12 @@ interface PayloadByStage {
|
|
|
525
535
|
beforeToolResultAppend: Message;
|
|
526
536
|
afterTurnComplete: TurnState;
|
|
527
537
|
}
|
|
528
|
-
interface ExtensionContext {
|
|
538
|
+
export interface ExtensionContext {
|
|
529
539
|
state: TurnState;
|
|
530
540
|
}
|
|
531
|
-
type Transformer<S extends TransformableStage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => PayloadByStage[S] | Promise<PayloadByStage[S]>;
|
|
532
|
-
type Observer<S extends Stage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => Promise<void> | void;
|
|
533
|
-
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> {
|
|
534
544
|
id: string;
|
|
535
545
|
stage: S;
|
|
536
546
|
kind: "transformer";
|
|
@@ -538,7 +548,7 @@ interface TransformerExtensionRegistration<S extends TransformableStage = Transf
|
|
|
538
548
|
enabled: boolean;
|
|
539
549
|
run: Transformer<S>;
|
|
540
550
|
}
|
|
541
|
-
interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
551
|
+
export interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
542
552
|
id: string;
|
|
543
553
|
stage: S;
|
|
544
554
|
kind: "observer";
|
|
@@ -546,29 +556,32 @@ interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
|
546
556
|
enabled: boolean;
|
|
547
557
|
run: Observer<S>;
|
|
548
558
|
}
|
|
549
|
-
type AnyExtensionRegistration = {
|
|
559
|
+
export type AnyExtensionRegistration = {
|
|
550
560
|
[S in Stage]: ObserverExtensionRegistration<S>;
|
|
551
561
|
}[Stage] | {
|
|
552
562
|
[S in TransformableStage]: TransformerExtensionRegistration<S>;
|
|
553
563
|
}[TransformableStage];
|
|
554
|
-
interface ExtensionRegistry {
|
|
564
|
+
export interface ExtensionRegistry {
|
|
555
565
|
register(extension: AnyExtensionRegistration): void;
|
|
556
566
|
runTransformers<S extends TransformableStage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<PayloadByStage[S]>;
|
|
557
567
|
runObservers<S extends Stage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<void>;
|
|
558
568
|
}
|
|
559
|
-
interface RunTurnDeps {
|
|
569
|
+
export interface RunTurnDeps {
|
|
560
570
|
registry: ExtensionRegistry;
|
|
561
571
|
chatModel: EngineChatModel;
|
|
562
572
|
toolRuntime: ToolRuntime;
|
|
563
573
|
askUser?: (request: AskUserQuestionRequest) => Promise<AskUserAnswers>;
|
|
574
|
+
setTopic?: (topic: string) => void;
|
|
564
575
|
onEvent?: AgentEventHandler;
|
|
576
|
+
sessionDir?: string | (() => string | undefined);
|
|
577
|
+
outputFormat?: OutputFormat;
|
|
565
578
|
}
|
|
566
|
-
type AgentInput = MessageInput | string;
|
|
567
|
-
interface AgentSendOptions {
|
|
579
|
+
export type AgentInput = MessageInput | string;
|
|
580
|
+
export interface AgentSendOptions {
|
|
568
581
|
streaming?: boolean;
|
|
569
582
|
signal?: AbortSignal;
|
|
570
583
|
}
|
|
571
|
-
interface AgentOptions {
|
|
584
|
+
export interface AgentOptions {
|
|
572
585
|
sessionId?: string;
|
|
573
586
|
systemPrompt?: string;
|
|
574
587
|
messages?: MessageInput[];
|
|
@@ -580,26 +593,29 @@ interface AgentOptions {
|
|
|
580
593
|
chatModel?: EngineChatModel;
|
|
581
594
|
tools?: AnyToolDefinition[];
|
|
582
595
|
askUser?: (request: AskUserQuestionRequest) => Promise<AskUserAnswers>;
|
|
596
|
+
setTopic?: (topic: string) => void;
|
|
583
597
|
getContextWindowLimit?: (request: ChatRequest) => number | undefined;
|
|
598
|
+
sessionDir?: string | (() => string | undefined);
|
|
599
|
+
outputFormat?: OutputFormat;
|
|
584
600
|
}
|
|
585
|
-
interface AgentDefinitionFactoryContext {
|
|
601
|
+
export interface AgentDefinitionFactoryContext {
|
|
586
602
|
agentId: string;
|
|
587
603
|
parentSessionId?: string;
|
|
588
604
|
runId?: string;
|
|
589
605
|
toolCallId?: string;
|
|
590
606
|
}
|
|
591
|
-
interface AgentDefinition {
|
|
607
|
+
export interface AgentDefinition {
|
|
592
608
|
id: string;
|
|
593
609
|
description?: string;
|
|
594
610
|
enabled?: boolean;
|
|
595
611
|
allowedChildAgentIds?: string[];
|
|
596
612
|
createOptions(ctx?: AgentDefinitionFactoryContext): AgentOptions;
|
|
597
613
|
}
|
|
598
|
-
type ManagedRunStatus = "aborted" | "completed" | "failed" | "idle" | "running";
|
|
599
|
-
interface ManagedRunError {
|
|
614
|
+
export type ManagedRunStatus = "aborted" | "completed" | "failed" | "idle" | "running";
|
|
615
|
+
export interface ManagedRunError {
|
|
600
616
|
message: string;
|
|
601
617
|
}
|
|
602
|
-
interface ManagedAgentRun {
|
|
618
|
+
export interface ManagedAgentRun {
|
|
603
619
|
runId: string;
|
|
604
620
|
agentId: string;
|
|
605
621
|
sessionId: string;
|
|
@@ -610,7 +626,7 @@ interface ManagedAgentRun {
|
|
|
610
626
|
result?: TurnResult;
|
|
611
627
|
error?: ManagedRunError;
|
|
612
628
|
}
|
|
613
|
-
interface ManagedAgentRunHandle {
|
|
629
|
+
export interface ManagedAgentRunHandle {
|
|
614
630
|
readonly runId: string;
|
|
615
631
|
readonly agentId: string;
|
|
616
632
|
readonly sessionId: string;
|
|
@@ -618,7 +634,7 @@ interface ManagedAgentRunHandle {
|
|
|
618
634
|
snapshot(): ManagedAgentRun;
|
|
619
635
|
wait(signal?: AbortSignal): Promise<ManagedAgentRun>;
|
|
620
636
|
}
|
|
621
|
-
interface ManagedRunEvent {
|
|
637
|
+
export interface ManagedRunEvent {
|
|
622
638
|
runId: string;
|
|
623
639
|
agentId: string;
|
|
624
640
|
sessionId: string;
|
|
@@ -626,16 +642,16 @@ interface ManagedRunEvent {
|
|
|
626
642
|
originToolCallId?: string;
|
|
627
643
|
event: AgentEvent;
|
|
628
644
|
}
|
|
629
|
-
type ManagedRunEventHandler = (event: ManagedRunEvent) => Promise<void> | void;
|
|
630
|
-
interface RuntimeManagerOptions {
|
|
645
|
+
export type ManagedRunEventHandler = (event: ManagedRunEvent) => Promise<void> | void;
|
|
646
|
+
export interface RuntimeManagerOptions {
|
|
631
647
|
onEvent?: ManagedRunEventHandler;
|
|
632
648
|
}
|
|
633
|
-
interface CreateManagedRunInput {
|
|
649
|
+
export interface CreateManagedRunInput {
|
|
634
650
|
agentId: string;
|
|
635
651
|
parentRunId?: string;
|
|
636
652
|
originToolCallId?: string;
|
|
637
653
|
}
|
|
638
|
-
interface CompileRequestInput {
|
|
654
|
+
export interface CompileRequestInput {
|
|
639
655
|
sessionId: string;
|
|
640
656
|
turnId: string;
|
|
641
657
|
reasoning?: ReasoningConfig;
|
|
@@ -645,46 +661,46 @@ interface CompileRequestInput {
|
|
|
645
661
|
model?: string;
|
|
646
662
|
max_tokens?: number;
|
|
647
663
|
}
|
|
648
|
-
interface OpenAiInputText {
|
|
664
|
+
export interface OpenAiInputText {
|
|
649
665
|
type: "input_text";
|
|
650
666
|
text: string;
|
|
651
667
|
}
|
|
652
|
-
interface OpenAiInputImage {
|
|
668
|
+
export interface OpenAiInputImage {
|
|
653
669
|
type: "input_image";
|
|
654
670
|
image_url: string;
|
|
655
671
|
detail?: string;
|
|
656
672
|
}
|
|
657
|
-
interface OpenAiInputMessage {
|
|
673
|
+
export interface OpenAiInputMessage {
|
|
658
674
|
type: "message";
|
|
659
675
|
role: MessageRole;
|
|
660
|
-
content: Array<OpenAiInputImage | OpenAiInputText>;
|
|
676
|
+
content: Array<OpenAiInputImage | OpenAiInputText | OpenAiOutputTextPart>;
|
|
661
677
|
}
|
|
662
|
-
interface OpenAiFunctionCall {
|
|
678
|
+
export interface OpenAiFunctionCall {
|
|
663
679
|
type: "function_call";
|
|
664
680
|
call_id: string;
|
|
665
681
|
name: string;
|
|
666
682
|
arguments: string;
|
|
667
683
|
}
|
|
668
|
-
interface OpenAiFunctionCallOutput {
|
|
684
|
+
export interface OpenAiFunctionCallOutput {
|
|
669
685
|
type: "function_call_output";
|
|
670
686
|
call_id: string;
|
|
671
687
|
output: string;
|
|
672
688
|
}
|
|
673
|
-
interface OpenAiOutputTextPart {
|
|
689
|
+
export interface OpenAiOutputTextPart {
|
|
674
690
|
type: "output_text";
|
|
675
691
|
text: string;
|
|
676
692
|
}
|
|
677
|
-
interface OpenAiRefusalPart {
|
|
693
|
+
export interface OpenAiRefusalPart {
|
|
678
694
|
type: "refusal";
|
|
679
695
|
refusal: string;
|
|
680
696
|
}
|
|
681
|
-
interface OpenAiOutputMessage {
|
|
697
|
+
export interface OpenAiOutputMessage {
|
|
682
698
|
type: "message";
|
|
683
699
|
content?: Array<OpenAiOutputTextPart | OpenAiRefusalPart>;
|
|
684
700
|
role?: string;
|
|
685
701
|
status?: string;
|
|
686
702
|
}
|
|
687
|
-
interface OpenAiReasoningOutputItem {
|
|
703
|
+
export interface OpenAiReasoningOutputItem {
|
|
688
704
|
type: "reasoning";
|
|
689
705
|
content?: Array<{
|
|
690
706
|
text?: string;
|
|
@@ -696,19 +712,19 @@ interface OpenAiReasoningOutputItem {
|
|
|
696
712
|
summary?: OpenAiReasoningSummaryText[];
|
|
697
713
|
text?: string;
|
|
698
714
|
}
|
|
699
|
-
type OpenAiResponsesOutputItem = JsonObject | OpenAiFunctionCall | OpenAiOutputMessage | OpenAiReasoningOutputItem;
|
|
700
|
-
interface OpenAiResponsesReasoningParam {
|
|
715
|
+
export type OpenAiResponsesOutputItem = JsonObject | OpenAiFunctionCall | OpenAiOutputMessage | OpenAiReasoningOutputItem;
|
|
716
|
+
export interface OpenAiResponsesReasoningParam {
|
|
701
717
|
effort?: OpenAiReasoningEffort;
|
|
702
718
|
generate_summary?: OpenAiReasoningSummary;
|
|
703
719
|
summary?: OpenAiReasoningSummary;
|
|
704
720
|
}
|
|
705
|
-
interface OpenAiFunctionTool {
|
|
721
|
+
export interface OpenAiFunctionTool {
|
|
706
722
|
type: "function";
|
|
707
723
|
name: string;
|
|
708
724
|
description: string;
|
|
709
725
|
parameters: JsonSchemaObject;
|
|
710
726
|
}
|
|
711
|
-
interface OpenAiResponsesRequest {
|
|
727
|
+
export interface OpenAiResponsesRequest {
|
|
712
728
|
include?: string[];
|
|
713
729
|
model: string;
|
|
714
730
|
instructions: string;
|
|
@@ -717,5 +733,5 @@ interface OpenAiResponsesRequest {
|
|
|
717
733
|
reasoning?: OpenAiResponsesReasoningParam;
|
|
718
734
|
tools: OpenAiFunctionTool[];
|
|
719
735
|
}
|
|
720
|
-
|
|
721
|
-
|
|
736
|
+
export {};
|
|
737
|
+
//# sourceMappingURL=types.d.ts.map
|