@agentstorm/platform-protocol 0.2.5
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/LICENSE +671 -0
- package/README.md +12 -0
- package/dist/agent-attention-notification.d.ts +43 -0
- package/dist/agent-attention-notification.js +141 -0
- package/dist/agent-deep-link.d.ts +8 -0
- package/dist/agent-deep-link.js +49 -0
- package/dist/agent-labels.d.ts +7 -0
- package/dist/agent-labels.js +11 -0
- package/dist/agent-lifecycle.d.ts +3 -0
- package/dist/agent-lifecycle.js +8 -0
- package/dist/agent-state-bucket.d.ts +14 -0
- package/dist/agent-state-bucket.js +41 -0
- package/dist/agent-title-limits.d.ts +2 -0
- package/dist/agent-title-limits.js +2 -0
- package/dist/agent-types.d.ts +451 -0
- package/dist/agent-types.js +22 -0
- package/dist/binary-frames/demux.d.ts +11 -0
- package/dist/binary-frames/demux.js +23 -0
- package/dist/binary-frames/file-transfer.d.ts +51 -0
- package/dist/binary-frames/file-transfer.js +108 -0
- package/dist/binary-frames/index.d.ts +4 -0
- package/dist/binary-frames/index.js +4 -0
- package/dist/binary-frames/terminal.d.ts +35 -0
- package/dist/binary-frames/terminal.js +100 -0
- package/dist/branch-slug.d.ts +14 -0
- package/dist/branch-slug.js +49 -0
- package/dist/browser-automation/capabilities.d.ts +7 -0
- package/dist/browser-automation/capabilities.js +31 -0
- package/dist/browser-automation/rpc-schemas.d.ts +1112 -0
- package/dist/browser-automation/rpc-schemas.js +462 -0
- package/dist/chat/rpc-schemas.d.ts +158 -0
- package/dist/chat/rpc-schemas.js +103 -0
- package/dist/chat/types.d.ts +30 -0
- package/dist/chat/types.js +22 -0
- package/dist/client-capabilities.d.ts +11 -0
- package/dist/client-capabilities.js +25 -0
- package/dist/connection-offer.d.ts +36 -0
- package/dist/connection-offer.js +53 -0
- package/dist/daemon-endpoints.d.ts +47 -0
- package/dist/daemon-endpoints.js +201 -0
- package/dist/error-utils.d.ts +11 -0
- package/dist/error-utils.js +27 -0
- package/dist/forge-manifest.d.ts +66 -0
- package/dist/forge-manifest.js +92 -0
- package/dist/generated/validation/ws-outbound.aot.d.ts +2 -0
- package/dist/generated/validation/ws-outbound.aot.js +65207 -0
- package/dist/git-remote.d.ts +33 -0
- package/dist/git-remote.js +94 -0
- package/dist/host-connection-schema.d.ts +11 -0
- package/dist/host-connection-schema.js +9 -0
- package/dist/literal-union.d.ts +2 -0
- package/dist/literal-union.js +2 -0
- package/dist/loop/rpc-schemas.d.ts +636 -0
- package/dist/loop/rpc-schemas.js +163 -0
- package/dist/messages.d.ts +40580 -0
- package/dist/messages.js +4999 -0
- package/dist/paseo-config-schema.d.ts +138 -0
- package/dist/paseo-config-schema.js +98 -0
- package/dist/path-utils.d.ts +2 -0
- package/dist/path-utils.js +16 -0
- package/dist/provider-config.d.ts +126 -0
- package/dist/provider-config.js +110 -0
- package/dist/provider-icon-names.d.ts +5 -0
- package/dist/provider-icon-names.js +52 -0
- package/dist/provider-manifest.d.ts +35 -0
- package/dist/provider-manifest.js +254 -0
- package/dist/schedule/cadence.d.ts +6 -0
- package/dist/schedule/cadence.js +28 -0
- package/dist/schedule/cron-expression.d.ts +13 -0
- package/dist/schedule/cron-expression.js +97 -0
- package/dist/schedule/rpc-schemas.d.ts +624 -0
- package/dist/schedule/rpc-schemas.js +155 -0
- package/dist/schedule/types.d.ts +222 -0
- package/dist/schedule/types.js +78 -0
- package/dist/terminal-activity.d.ts +21 -0
- package/dist/terminal-activity.js +25 -0
- package/dist/terminal-input-mode.d.ts +30 -0
- package/dist/terminal-input-mode.js +180 -0
- package/dist/terminal-key-input.d.ts +13 -0
- package/dist/terminal-key-input.js +210 -0
- package/dist/terminal-profiles.d.ts +6 -0
- package/dist/terminal-profiles.js +28 -0
- package/dist/terminal-snapshot.d.ts +3 -0
- package/dist/terminal-snapshot.js +178 -0
- package/dist/terminal-stream-protocol.d.ts +2 -0
- package/dist/terminal-stream-protocol.js +2 -0
- package/dist/terminal-subscription-key.d.ts +2 -0
- package/dist/terminal-subscription-key.js +9 -0
- package/dist/tool-call-display.d.ts +11 -0
- package/dist/tool-call-display.js +135 -0
- package/dist/tool-name-normalization.d.ts +9 -0
- package/dist/tool-name-normalization.js +82 -0
- package/dist/validation/ws-outbound-schema-metadata.d.ts +7570 -0
- package/dist/validation/ws-outbound-schema-metadata.js +3 -0
- package/dist/validation/ws-outbound.d.ts +12 -0
- package/dist/validation/ws-outbound.js +8 -0
- package/package.json +32 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import type { AgentAttachment } from "./messages.js";
|
|
2
|
+
export type AgentProvider = string;
|
|
3
|
+
export interface AgentMetadata {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
export type AgentProviderNotice = {
|
|
7
|
+
type: "info";
|
|
8
|
+
message: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: "warning";
|
|
11
|
+
message: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: "error";
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Stdio-based MCP server (spawns a subprocess).
|
|
18
|
+
*/
|
|
19
|
+
export interface McpStdioServerConfig {
|
|
20
|
+
type: "stdio";
|
|
21
|
+
command: string;
|
|
22
|
+
args?: string[];
|
|
23
|
+
env?: Record<string, string>;
|
|
24
|
+
/**
|
|
25
|
+
* When true, all tools from this server are always included in the prompt
|
|
26
|
+
* and never deferred behind tool search. Honored by the Claude provider.
|
|
27
|
+
*/
|
|
28
|
+
alwaysLoad?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* HTTP-based MCP server.
|
|
32
|
+
*/
|
|
33
|
+
export interface McpHttpServerConfig {
|
|
34
|
+
type: "http";
|
|
35
|
+
url: string;
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* When true, all tools from this server are always included in the prompt
|
|
39
|
+
* and never deferred behind tool search. Honored by the Claude provider.
|
|
40
|
+
*/
|
|
41
|
+
alwaysLoad?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* SSE-based MCP server (Server-Sent Events over HTTP).
|
|
45
|
+
*/
|
|
46
|
+
export interface McpSseServerConfig {
|
|
47
|
+
type: "sse";
|
|
48
|
+
url: string;
|
|
49
|
+
headers?: Record<string, string>;
|
|
50
|
+
/**
|
|
51
|
+
* When true, all tools from this server are always included in the prompt
|
|
52
|
+
* and never deferred behind tool search. Honored by the Claude provider.
|
|
53
|
+
*/
|
|
54
|
+
alwaysLoad?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Canonical MCP server configuration.
|
|
58
|
+
* Discriminated union by `type` field.
|
|
59
|
+
* Each provider normalizes this to their expected format.
|
|
60
|
+
*/
|
|
61
|
+
export type McpServerConfig = McpStdioServerConfig | McpHttpServerConfig | McpSseServerConfig;
|
|
62
|
+
export interface AgentMode {
|
|
63
|
+
id: string;
|
|
64
|
+
label: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
icon?: string;
|
|
67
|
+
colorTier?: string;
|
|
68
|
+
}
|
|
69
|
+
export type ProviderStatus = "ready" | "loading" | "error" | "unavailable";
|
|
70
|
+
export interface AgentModelDefinition {
|
|
71
|
+
provider: AgentProvider;
|
|
72
|
+
id: string;
|
|
73
|
+
label: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
isDefault?: boolean;
|
|
76
|
+
metadata?: AgentMetadata;
|
|
77
|
+
contextWindowMaxTokens?: number;
|
|
78
|
+
thinkingOptions?: AgentSelectOption[];
|
|
79
|
+
defaultThinkingOptionId?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface AgentSelectOption {
|
|
82
|
+
id: string;
|
|
83
|
+
label: string;
|
|
84
|
+
description?: string;
|
|
85
|
+
isDefault?: boolean;
|
|
86
|
+
metadata?: AgentMetadata;
|
|
87
|
+
}
|
|
88
|
+
export declare function normalizeAgentModelDefinition(model: AgentModelDefinition): AgentModelDefinition;
|
|
89
|
+
export interface ProviderSnapshotEntry {
|
|
90
|
+
provider: AgentProvider;
|
|
91
|
+
status: ProviderStatus;
|
|
92
|
+
enabled: boolean;
|
|
93
|
+
source?: "builtin" | "custom";
|
|
94
|
+
error?: string;
|
|
95
|
+
models?: AgentModelDefinition[];
|
|
96
|
+
modes?: AgentMode[];
|
|
97
|
+
fetchedAt?: string;
|
|
98
|
+
label?: string;
|
|
99
|
+
description?: string;
|
|
100
|
+
defaultModeId?: string | null;
|
|
101
|
+
}
|
|
102
|
+
export interface AgentFeatureToggle {
|
|
103
|
+
type: "toggle";
|
|
104
|
+
id: string;
|
|
105
|
+
label: string;
|
|
106
|
+
description?: string;
|
|
107
|
+
tooltip?: string;
|
|
108
|
+
icon?: string;
|
|
109
|
+
value: boolean;
|
|
110
|
+
}
|
|
111
|
+
export interface AgentFeatureSelect {
|
|
112
|
+
type: "select";
|
|
113
|
+
id: string;
|
|
114
|
+
label: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
tooltip?: string;
|
|
117
|
+
icon?: string;
|
|
118
|
+
value: string | null;
|
|
119
|
+
options: AgentSelectOption[];
|
|
120
|
+
}
|
|
121
|
+
export type AgentFeature = AgentFeatureToggle | AgentFeatureSelect;
|
|
122
|
+
export interface AgentCapabilityFlags {
|
|
123
|
+
[capability: string]: boolean | undefined;
|
|
124
|
+
supportsStreaming: boolean;
|
|
125
|
+
supportsSessionPersistence: boolean;
|
|
126
|
+
supportsSessionListing?: boolean;
|
|
127
|
+
supportsDynamicModes: boolean;
|
|
128
|
+
supportsMcpServers: boolean;
|
|
129
|
+
supportsReasoningStream: boolean;
|
|
130
|
+
supportsToolInvocations: boolean;
|
|
131
|
+
supportsRewindConversation?: boolean;
|
|
132
|
+
supportsRewindFiles?: boolean;
|
|
133
|
+
supportsRewindBoth?: boolean;
|
|
134
|
+
}
|
|
135
|
+
export interface AgentPersistenceHandle {
|
|
136
|
+
provider: AgentProvider;
|
|
137
|
+
sessionId: string;
|
|
138
|
+
/** Provider specific handle (Codex thread id, Claude resume token, etc). */
|
|
139
|
+
nativeHandle?: string;
|
|
140
|
+
metadata?: AgentMetadata;
|
|
141
|
+
}
|
|
142
|
+
export type AgentPromptContentBlock = {
|
|
143
|
+
type: "text";
|
|
144
|
+
text: string;
|
|
145
|
+
} | {
|
|
146
|
+
type: "image";
|
|
147
|
+
data: string;
|
|
148
|
+
mimeType: string;
|
|
149
|
+
} | AgentAttachment;
|
|
150
|
+
export type AgentPromptInput = string | AgentPromptContentBlock[];
|
|
151
|
+
export interface AgentRunOptions {
|
|
152
|
+
outputSchema?: unknown;
|
|
153
|
+
resumeFrom?: AgentPersistenceHandle;
|
|
154
|
+
maxThinkingTokens?: number;
|
|
155
|
+
}
|
|
156
|
+
export interface AgentUsage {
|
|
157
|
+
inputTokens?: number;
|
|
158
|
+
cachedInputTokens?: number;
|
|
159
|
+
outputTokens?: number;
|
|
160
|
+
totalCostUsd?: number;
|
|
161
|
+
contextWindowMaxTokens?: number;
|
|
162
|
+
contextWindowUsedTokens?: number;
|
|
163
|
+
}
|
|
164
|
+
export declare const TOOL_CALL_ICON_NAMES: readonly ["wrench", "square_terminal", "eye", "pencil", "search", "bot", "sparkles", "brain", "mic_vocal"];
|
|
165
|
+
export type ToolCallIconName = (typeof TOOL_CALL_ICON_NAMES)[number];
|
|
166
|
+
export type ToolCallDetail = {
|
|
167
|
+
type: "shell";
|
|
168
|
+
command: string;
|
|
169
|
+
cwd?: string;
|
|
170
|
+
output?: string;
|
|
171
|
+
exitCode?: number | null;
|
|
172
|
+
} | {
|
|
173
|
+
type: "read";
|
|
174
|
+
filePath: string;
|
|
175
|
+
content?: string;
|
|
176
|
+
offset?: number;
|
|
177
|
+
limit?: number;
|
|
178
|
+
} | {
|
|
179
|
+
type: "edit";
|
|
180
|
+
filePath: string;
|
|
181
|
+
oldString?: string;
|
|
182
|
+
newString?: string;
|
|
183
|
+
unifiedDiff?: string;
|
|
184
|
+
} | {
|
|
185
|
+
type: "write";
|
|
186
|
+
filePath: string;
|
|
187
|
+
content?: string;
|
|
188
|
+
} | {
|
|
189
|
+
type: "search";
|
|
190
|
+
query: string;
|
|
191
|
+
toolName?: "search" | "grep" | "glob" | "web_search";
|
|
192
|
+
content?: string;
|
|
193
|
+
filePaths?: string[];
|
|
194
|
+
webResults?: Array<{
|
|
195
|
+
title: string;
|
|
196
|
+
url: string;
|
|
197
|
+
}>;
|
|
198
|
+
annotations?: string[];
|
|
199
|
+
numFiles?: number;
|
|
200
|
+
numMatches?: number;
|
|
201
|
+
durationMs?: number;
|
|
202
|
+
durationSeconds?: number;
|
|
203
|
+
truncated?: boolean;
|
|
204
|
+
mode?: "content" | "files_with_matches" | "count";
|
|
205
|
+
} | {
|
|
206
|
+
type: "fetch";
|
|
207
|
+
url: string;
|
|
208
|
+
prompt?: string;
|
|
209
|
+
result?: string;
|
|
210
|
+
code?: number;
|
|
211
|
+
codeText?: string;
|
|
212
|
+
bytes?: number;
|
|
213
|
+
durationMs?: number;
|
|
214
|
+
} | {
|
|
215
|
+
type: "worktree_setup";
|
|
216
|
+
worktreePath: string;
|
|
217
|
+
branchName: string;
|
|
218
|
+
log: string;
|
|
219
|
+
commands: Array<{
|
|
220
|
+
index: number;
|
|
221
|
+
command: string;
|
|
222
|
+
cwd: string;
|
|
223
|
+
log: string;
|
|
224
|
+
status: "running" | "completed" | "failed";
|
|
225
|
+
exitCode: number | null;
|
|
226
|
+
durationMs?: number;
|
|
227
|
+
}>;
|
|
228
|
+
truncated?: boolean;
|
|
229
|
+
} | {
|
|
230
|
+
type: "sub_agent";
|
|
231
|
+
subAgentType?: string;
|
|
232
|
+
description?: string;
|
|
233
|
+
childSessionId?: string;
|
|
234
|
+
log: string;
|
|
235
|
+
actions?: Array<{
|
|
236
|
+
index: number;
|
|
237
|
+
toolName: string;
|
|
238
|
+
summary?: string;
|
|
239
|
+
}>;
|
|
240
|
+
} | {
|
|
241
|
+
type: "plain_text";
|
|
242
|
+
label?: string;
|
|
243
|
+
text?: string;
|
|
244
|
+
icon?: ToolCallIconName;
|
|
245
|
+
} | {
|
|
246
|
+
type: "plan";
|
|
247
|
+
text: string;
|
|
248
|
+
} | {
|
|
249
|
+
type: "unknown";
|
|
250
|
+
input: unknown;
|
|
251
|
+
output: unknown;
|
|
252
|
+
};
|
|
253
|
+
interface ToolCallBase {
|
|
254
|
+
[key: string]: unknown;
|
|
255
|
+
type: "tool_call";
|
|
256
|
+
callId: string;
|
|
257
|
+
name: string;
|
|
258
|
+
detail: ToolCallDetail;
|
|
259
|
+
metadata?: Record<string, unknown>;
|
|
260
|
+
}
|
|
261
|
+
type ToolCallRunningTimelineItem = ToolCallBase & {
|
|
262
|
+
status: "running";
|
|
263
|
+
error: null;
|
|
264
|
+
};
|
|
265
|
+
type ToolCallCompletedTimelineItem = ToolCallBase & {
|
|
266
|
+
status: "completed";
|
|
267
|
+
error: null;
|
|
268
|
+
};
|
|
269
|
+
type ToolCallFailedTimelineItem = ToolCallBase & {
|
|
270
|
+
status: "failed";
|
|
271
|
+
error: unknown;
|
|
272
|
+
};
|
|
273
|
+
type ToolCallCanceledTimelineItem = ToolCallBase & {
|
|
274
|
+
status: "canceled";
|
|
275
|
+
error: null;
|
|
276
|
+
};
|
|
277
|
+
export type ToolCallTimelineItem = ToolCallRunningTimelineItem | ToolCallCompletedTimelineItem | ToolCallFailedTimelineItem | ToolCallCanceledTimelineItem;
|
|
278
|
+
export interface CompactionTimelineItem {
|
|
279
|
+
[key: string]: unknown;
|
|
280
|
+
type: "compaction";
|
|
281
|
+
status: "loading" | "completed";
|
|
282
|
+
trigger?: "auto" | "manual";
|
|
283
|
+
preTokens?: number;
|
|
284
|
+
}
|
|
285
|
+
export type AgentTimelineItem = {
|
|
286
|
+
type: "user_message";
|
|
287
|
+
text: string;
|
|
288
|
+
messageId?: string;
|
|
289
|
+
clientMessageId?: string;
|
|
290
|
+
} | {
|
|
291
|
+
type: "assistant_message";
|
|
292
|
+
text: string;
|
|
293
|
+
messageId?: string;
|
|
294
|
+
} | {
|
|
295
|
+
type: "reasoning";
|
|
296
|
+
text: string;
|
|
297
|
+
} | ToolCallTimelineItem | {
|
|
298
|
+
type: "todo";
|
|
299
|
+
items: {
|
|
300
|
+
text: string;
|
|
301
|
+
completed: boolean;
|
|
302
|
+
}[];
|
|
303
|
+
} | {
|
|
304
|
+
type: "error";
|
|
305
|
+
message: string;
|
|
306
|
+
} | CompactionTimelineItem;
|
|
307
|
+
export type AgentStreamEvent = {
|
|
308
|
+
type: "thread_started";
|
|
309
|
+
sessionId: string;
|
|
310
|
+
provider: AgentProvider;
|
|
311
|
+
} | {
|
|
312
|
+
type: "turn_started";
|
|
313
|
+
provider: AgentProvider;
|
|
314
|
+
turnId?: string;
|
|
315
|
+
} | {
|
|
316
|
+
type: "turn_completed";
|
|
317
|
+
provider: AgentProvider;
|
|
318
|
+
usage?: AgentUsage;
|
|
319
|
+
turnId?: string;
|
|
320
|
+
} | {
|
|
321
|
+
type: "usage_updated";
|
|
322
|
+
provider: AgentProvider;
|
|
323
|
+
usage: AgentUsage;
|
|
324
|
+
turnId?: string;
|
|
325
|
+
} | {
|
|
326
|
+
type: "mode_changed";
|
|
327
|
+
provider: AgentProvider;
|
|
328
|
+
currentModeId: string | null;
|
|
329
|
+
availableModes: AgentMode[];
|
|
330
|
+
} | {
|
|
331
|
+
type: "model_changed";
|
|
332
|
+
provider: AgentProvider;
|
|
333
|
+
runtimeInfo: AgentRuntimeInfo;
|
|
334
|
+
} | {
|
|
335
|
+
type: "thinking_option_changed";
|
|
336
|
+
provider: AgentProvider;
|
|
337
|
+
thinkingOptionId: string | null;
|
|
338
|
+
} | {
|
|
339
|
+
type: "turn_failed";
|
|
340
|
+
provider: AgentProvider;
|
|
341
|
+
error: string;
|
|
342
|
+
code?: string;
|
|
343
|
+
diagnostic?: string;
|
|
344
|
+
turnId?: string;
|
|
345
|
+
} | {
|
|
346
|
+
type: "turn_canceled";
|
|
347
|
+
provider: AgentProvider;
|
|
348
|
+
reason: string;
|
|
349
|
+
turnId?: string;
|
|
350
|
+
} | {
|
|
351
|
+
type: "timeline";
|
|
352
|
+
item: AgentTimelineItem;
|
|
353
|
+
provider: AgentProvider;
|
|
354
|
+
turnId?: string;
|
|
355
|
+
timestamp?: string;
|
|
356
|
+
} | {
|
|
357
|
+
type: "permission_requested";
|
|
358
|
+
provider: AgentProvider;
|
|
359
|
+
request: AgentPermissionRequest;
|
|
360
|
+
turnId?: string;
|
|
361
|
+
} | {
|
|
362
|
+
type: "permission_resolved";
|
|
363
|
+
provider: AgentProvider;
|
|
364
|
+
requestId: string;
|
|
365
|
+
resolution: AgentPermissionResponse;
|
|
366
|
+
turnId?: string;
|
|
367
|
+
} | {
|
|
368
|
+
type: "attention_required";
|
|
369
|
+
provider: AgentProvider;
|
|
370
|
+
reason: "finished" | "error" | "permission";
|
|
371
|
+
timestamp: string;
|
|
372
|
+
};
|
|
373
|
+
export declare function getAgentStreamEventTurnId(event: AgentStreamEvent): string | undefined;
|
|
374
|
+
export type AgentPermissionRequestKind = "tool" | "plan" | "question" | "mode" | "other";
|
|
375
|
+
export type AgentPermissionUpdate = AgentMetadata;
|
|
376
|
+
export interface AgentPermissionAction {
|
|
377
|
+
id: string;
|
|
378
|
+
label: string;
|
|
379
|
+
behavior: "allow" | "deny";
|
|
380
|
+
variant?: "primary" | "secondary" | "danger";
|
|
381
|
+
intent?: "implement" | "implement_resume" | "dismiss";
|
|
382
|
+
}
|
|
383
|
+
export interface AgentPermissionRequest {
|
|
384
|
+
id: string;
|
|
385
|
+
provider: AgentProvider;
|
|
386
|
+
name: string;
|
|
387
|
+
kind: AgentPermissionRequestKind;
|
|
388
|
+
title?: string;
|
|
389
|
+
description?: string;
|
|
390
|
+
input?: AgentMetadata;
|
|
391
|
+
detail?: ToolCallDetail;
|
|
392
|
+
suggestions?: AgentPermissionUpdate[];
|
|
393
|
+
actions?: AgentPermissionAction[];
|
|
394
|
+
metadata?: AgentMetadata;
|
|
395
|
+
}
|
|
396
|
+
export type AgentPermissionResponse = {
|
|
397
|
+
behavior: "allow";
|
|
398
|
+
selectedActionId?: string;
|
|
399
|
+
updatedInput?: AgentMetadata;
|
|
400
|
+
updatedPermissions?: AgentPermissionUpdate[];
|
|
401
|
+
} | {
|
|
402
|
+
behavior: "deny";
|
|
403
|
+
selectedActionId?: string;
|
|
404
|
+
message?: string;
|
|
405
|
+
interrupt?: boolean;
|
|
406
|
+
};
|
|
407
|
+
export interface AgentRunResult {
|
|
408
|
+
sessionId: string;
|
|
409
|
+
finalText: string;
|
|
410
|
+
usage?: AgentUsage;
|
|
411
|
+
timeline: AgentTimelineItem[];
|
|
412
|
+
canceled?: boolean;
|
|
413
|
+
}
|
|
414
|
+
export interface AgentSessionConfig {
|
|
415
|
+
provider: AgentProvider;
|
|
416
|
+
cwd: string;
|
|
417
|
+
/**
|
|
418
|
+
* Provider-agnostic system/developer instruction string.
|
|
419
|
+
* Mapped by each provider to its native instruction field.
|
|
420
|
+
*/
|
|
421
|
+
systemPrompt?: string;
|
|
422
|
+
modeId?: string;
|
|
423
|
+
model?: string;
|
|
424
|
+
thinkingOptionId?: string;
|
|
425
|
+
featureValues?: Record<string, unknown>;
|
|
426
|
+
title?: string | null;
|
|
427
|
+
approvalPolicy?: string;
|
|
428
|
+
sandboxMode?: string;
|
|
429
|
+
networkAccess?: boolean;
|
|
430
|
+
webSearch?: boolean;
|
|
431
|
+
extra?: {
|
|
432
|
+
codex?: AgentMetadata;
|
|
433
|
+
claude?: AgentMetadata;
|
|
434
|
+
};
|
|
435
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
436
|
+
/**
|
|
437
|
+
* Internal agents are hidden from listings and don't trigger notifications.
|
|
438
|
+
* They are used for ephemeral system tasks like commit/PR generation.
|
|
439
|
+
*/
|
|
440
|
+
internal?: boolean;
|
|
441
|
+
}
|
|
442
|
+
export interface AgentRuntimeInfo {
|
|
443
|
+
provider: AgentProvider;
|
|
444
|
+
sessionId: string | null;
|
|
445
|
+
model?: string | null;
|
|
446
|
+
thinkingOptionId?: string | null;
|
|
447
|
+
modeId?: string | null;
|
|
448
|
+
extra?: AgentMetadata;
|
|
449
|
+
}
|
|
450
|
+
export {};
|
|
451
|
+
//# sourceMappingURL=agent-types.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function normalizeAgentModelDefinition(model) {
|
|
2
|
+
const defaultThinkingOptionId = model.defaultThinkingOptionId ?? model.thinkingOptions?.find((option) => option.isDefault)?.id;
|
|
3
|
+
if (!defaultThinkingOptionId || defaultThinkingOptionId === model.defaultThinkingOptionId) {
|
|
4
|
+
return model;
|
|
5
|
+
}
|
|
6
|
+
return { ...model, defaultThinkingOptionId };
|
|
7
|
+
}
|
|
8
|
+
export const TOOL_CALL_ICON_NAMES = [
|
|
9
|
+
"wrench",
|
|
10
|
+
"square_terminal",
|
|
11
|
+
"eye",
|
|
12
|
+
"pencil",
|
|
13
|
+
"search",
|
|
14
|
+
"bot",
|
|
15
|
+
"sparkles",
|
|
16
|
+
"brain",
|
|
17
|
+
"mic_vocal",
|
|
18
|
+
];
|
|
19
|
+
export function getAgentStreamEventTurnId(event) {
|
|
20
|
+
return "turnId" in event ? event.turnId : undefined;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=agent-types.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FileTransferFrame } from "./file-transfer.js";
|
|
2
|
+
import { type TerminalStreamFrame } from "./terminal.js";
|
|
3
|
+
export type BinaryFrame = {
|
|
4
|
+
kind: "terminal";
|
|
5
|
+
frame: TerminalStreamFrame;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "file_transfer";
|
|
8
|
+
frame: FileTransferFrame;
|
|
9
|
+
};
|
|
10
|
+
export declare function decodeBinaryFrame(bytes: Uint8Array): BinaryFrame | null;
|
|
11
|
+
//# sourceMappingURL=demux.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { decodeFileTransferFrame, FileTransferOpcode, } from "./file-transfer.js";
|
|
2
|
+
import { decodeTerminalStreamFrame, TerminalStreamOpcode, } from "./terminal.js";
|
|
3
|
+
export function decodeBinaryFrame(bytes) {
|
|
4
|
+
switch (bytes[0]) {
|
|
5
|
+
case TerminalStreamOpcode.Output:
|
|
6
|
+
case TerminalStreamOpcode.Input:
|
|
7
|
+
case TerminalStreamOpcode.Resize:
|
|
8
|
+
case TerminalStreamOpcode.Snapshot:
|
|
9
|
+
case TerminalStreamOpcode.Restore: {
|
|
10
|
+
const frame = decodeTerminalStreamFrame(bytes);
|
|
11
|
+
return frame ? { kind: "terminal", frame } : null;
|
|
12
|
+
}
|
|
13
|
+
case FileTransferOpcode.FileBegin:
|
|
14
|
+
case FileTransferOpcode.FileChunk:
|
|
15
|
+
case FileTransferOpcode.FileEnd: {
|
|
16
|
+
const frame = decodeFileTransferFrame(bytes);
|
|
17
|
+
return frame ? { kind: "file_transfer", frame } : null;
|
|
18
|
+
}
|
|
19
|
+
default:
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=demux.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const FileTransferOpcode: {
|
|
3
|
+
readonly FileBegin: 16;
|
|
4
|
+
readonly FileChunk: 17;
|
|
5
|
+
readonly FileEnd: 18;
|
|
6
|
+
};
|
|
7
|
+
export type FileTransferOpcode = (typeof FileTransferOpcode)[keyof typeof FileTransferOpcode];
|
|
8
|
+
export declare const FileBeginMetadataSchema: z.ZodObject<{
|
|
9
|
+
mime: z.ZodString;
|
|
10
|
+
size: z.ZodNumber;
|
|
11
|
+
encoding: z.ZodEnum<{
|
|
12
|
+
binary: "binary";
|
|
13
|
+
"utf-8": "utf-8";
|
|
14
|
+
}>;
|
|
15
|
+
modifiedAt: z.ZodString;
|
|
16
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
17
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export interface FileBegin {
|
|
20
|
+
opcode: typeof FileTransferOpcode.FileBegin;
|
|
21
|
+
requestId: string;
|
|
22
|
+
metadata: z.infer<typeof FileBeginMetadataSchema>;
|
|
23
|
+
payload: Uint8Array;
|
|
24
|
+
}
|
|
25
|
+
export interface FileChunk {
|
|
26
|
+
opcode: typeof FileTransferOpcode.FileChunk;
|
|
27
|
+
requestId: string;
|
|
28
|
+
payload: Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
export interface FileEnd {
|
|
31
|
+
opcode: typeof FileTransferOpcode.FileEnd;
|
|
32
|
+
requestId: string;
|
|
33
|
+
payload: Uint8Array;
|
|
34
|
+
}
|
|
35
|
+
export type FileTransferFrame = FileBegin | FileChunk | FileEnd;
|
|
36
|
+
type FileTransferFrameInput = {
|
|
37
|
+
opcode: typeof FileTransferOpcode.FileBegin;
|
|
38
|
+
requestId: string;
|
|
39
|
+
metadata: z.infer<typeof FileBeginMetadataSchema>;
|
|
40
|
+
} | {
|
|
41
|
+
opcode: typeof FileTransferOpcode.FileChunk;
|
|
42
|
+
requestId: string;
|
|
43
|
+
payload?: Uint8Array | ArrayBuffer | string;
|
|
44
|
+
} | {
|
|
45
|
+
opcode: typeof FileTransferOpcode.FileEnd;
|
|
46
|
+
requestId: string;
|
|
47
|
+
};
|
|
48
|
+
export declare function encodeFileTransferFrame(input: FileTransferFrameInput): Uint8Array;
|
|
49
|
+
export declare function decodeFileTransferFrame(bytes: Uint8Array): FileTransferFrame | null;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=file-transfer.d.ts.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { asUint8Array } from "./terminal.js";
|
|
3
|
+
export const FileTransferOpcode = {
|
|
4
|
+
FileBegin: 0x10,
|
|
5
|
+
FileChunk: 0x11,
|
|
6
|
+
FileEnd: 0x12,
|
|
7
|
+
};
|
|
8
|
+
export const FileBeginMetadataSchema = z.object({
|
|
9
|
+
mime: z.string().min(1),
|
|
10
|
+
size: z.number().int().nonnegative(),
|
|
11
|
+
encoding: z.enum(["utf-8", "binary"]),
|
|
12
|
+
modifiedAt: z.string(),
|
|
13
|
+
revision: z.string().optional(),
|
|
14
|
+
fileName: z.string().optional(),
|
|
15
|
+
});
|
|
16
|
+
export function encodeFileTransferFrame(input) {
|
|
17
|
+
const requestId = encodeRequestId(input.requestId);
|
|
18
|
+
if (input.opcode === FileTransferOpcode.FileBegin) {
|
|
19
|
+
const metadata = encodeJsonPayload(input.metadata);
|
|
20
|
+
if (metadata.byteLength > 0xffff) {
|
|
21
|
+
throw new RangeError("FileBegin metadata is too long");
|
|
22
|
+
}
|
|
23
|
+
const bytes = new Uint8Array(4 + requestId.byteLength + metadata.byteLength);
|
|
24
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
25
|
+
bytes[0] = input.opcode;
|
|
26
|
+
bytes[1] = requestId.byteLength;
|
|
27
|
+
bytes.set(requestId, 2);
|
|
28
|
+
view.setUint16(2 + requestId.byteLength, metadata.byteLength);
|
|
29
|
+
bytes.set(metadata, 4 + requestId.byteLength);
|
|
30
|
+
return bytes;
|
|
31
|
+
}
|
|
32
|
+
const payload = input.opcode === FileTransferOpcode.FileChunk
|
|
33
|
+
? (asUint8Array(input.payload ?? new Uint8Array()) ?? new Uint8Array())
|
|
34
|
+
: new Uint8Array();
|
|
35
|
+
const bytes = new Uint8Array(2 + requestId.byteLength + payload.byteLength);
|
|
36
|
+
bytes[0] = input.opcode;
|
|
37
|
+
bytes[1] = requestId.byteLength;
|
|
38
|
+
bytes.set(requestId, 2);
|
|
39
|
+
bytes.set(payload, 2 + requestId.byteLength);
|
|
40
|
+
return bytes;
|
|
41
|
+
}
|
|
42
|
+
export function decodeFileTransferFrame(bytes) {
|
|
43
|
+
if (bytes.byteLength < 2) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const opcode = bytes[0];
|
|
47
|
+
if (!isFileTransferOpcode(opcode)) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const requestIdLength = bytes[1];
|
|
51
|
+
if (requestIdLength === 0 || requestIdLength > bytes.byteLength - 2) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const requestId = decodeRequestId(bytes.subarray(2, 2 + requestIdLength));
|
|
55
|
+
const body = bytes.subarray(2 + requestIdLength);
|
|
56
|
+
if (opcode === FileTransferOpcode.FileBegin) {
|
|
57
|
+
if (body.byteLength < 2) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const view = new DataView(body.buffer, body.byteOffset, body.byteLength);
|
|
61
|
+
const metadataLength = view.getUint16(0);
|
|
62
|
+
if (metadataLength !== body.byteLength - 2) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const metadataBytes = body.subarray(2);
|
|
66
|
+
const result = FileBeginMetadataSchema.safeParse(decodeJsonPayload(metadataBytes));
|
|
67
|
+
return result.success
|
|
68
|
+
? { opcode, requestId, metadata: result.data, payload: new Uint8Array() }
|
|
69
|
+
: null;
|
|
70
|
+
}
|
|
71
|
+
if (opcode === FileTransferOpcode.FileChunk) {
|
|
72
|
+
return { opcode, requestId, payload: body };
|
|
73
|
+
}
|
|
74
|
+
if (body.byteLength !== 0) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return { opcode, requestId, payload: new Uint8Array() };
|
|
78
|
+
}
|
|
79
|
+
function isFileTransferOpcode(value) {
|
|
80
|
+
return (value === FileTransferOpcode.FileBegin ||
|
|
81
|
+
value === FileTransferOpcode.FileChunk ||
|
|
82
|
+
value === FileTransferOpcode.FileEnd);
|
|
83
|
+
}
|
|
84
|
+
function encodeJsonPayload(value) {
|
|
85
|
+
return new TextEncoder().encode(JSON.stringify(value));
|
|
86
|
+
}
|
|
87
|
+
function encodeRequestId(requestId) {
|
|
88
|
+
const bytes = new TextEncoder().encode(requestId);
|
|
89
|
+
if (bytes.byteLength === 0) {
|
|
90
|
+
throw new RangeError("File transfer requestId is required");
|
|
91
|
+
}
|
|
92
|
+
if (bytes.byteLength > 0xff) {
|
|
93
|
+
throw new RangeError("File transfer requestId is too long");
|
|
94
|
+
}
|
|
95
|
+
return bytes;
|
|
96
|
+
}
|
|
97
|
+
function decodeRequestId(bytes) {
|
|
98
|
+
return new TextDecoder().decode(bytes);
|
|
99
|
+
}
|
|
100
|
+
function decodeJsonPayload(bytes) {
|
|
101
|
+
try {
|
|
102
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=file-transfer.js.map
|