@workerdeck/core 3.0.1 → 3.2.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/build/index.d.mts +367 -260
- package/build/index.mjs +3081 -2883
- package/build/index.mjs.map +1 -1
- package/package.json +6 -9
package/build/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McpServerStatus, Options, Query, SDKMessage, SDKSessionInfo, SDKUserMessage, SessionMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
-
import { ApiMessage, ByModel, CostBreakdown, CreateSessionRequest, EngineCapabilities, McpServerConfigWire, McpServerStatusInfo, MessageAttachment, MessageOrigin, ModelOption, PermissionMode, PermissionRequest, ProfileEngine, ProfileInfo, SdkSessionSummary, SessionEvent, SessionEventBody, SessionInfo, SessionStatus, ShellEndReason, ShellInfo, ShellOwner, ShellStatus, ToolCallRequestFrame, ToolExecutionBackend, ToolExecutionOutput } from "@workerdeck/protocol";
|
|
2
|
+
import { ApiMessage, ByModel, ChecklistItem, ContextReading, CostBreakdown, CreateSessionRequest, EngineCapabilities, McpServerConfigWire, McpServerStatusInfo, MessageAttachment, MessageOrigin, ModelOption, PermissionDecisionSource, PermissionMode, PermissionRequest, PricingTable, ProfileEngine, ProfileInfo, SdkSessionSummary, SessionEvent, SessionEventBody, SessionInfo, SessionStatus, ShellEndReason, ShellInfo, ShellOwner, ShellStatus, ToolCallRequestFrame, ToolExecutionBackend, ToolExecutionOutput } from "@workerdeck/protocol";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { LanguageModel, LanguageModel as LanguageModel$1, ModelMessage, Tool, Tool as Tool$1, ToolSet, ToolSet as ToolSet$1 } from "ai";
|
|
5
5
|
import { SandboxEngine, SandboxVfs } from "@workerdeck/sandbox";
|
|
@@ -15,6 +15,39 @@ declare const SUPPORTED_ATTACHMENT_TYPES: string;
|
|
|
15
15
|
declare function attachmentContentBlocks(attachments: readonly AttachmentInput[]): Array<Record<string, unknown>>;
|
|
16
16
|
declare function attachmentRef(attachment: AttachmentInput): MessageAttachment;
|
|
17
17
|
//#endregion
|
|
18
|
+
//#region src/lib/cost-ledger.d.ts
|
|
19
|
+
type CostFigures = {
|
|
20
|
+
byModel?: ByModel;
|
|
21
|
+
reportedCostUsd?: number;
|
|
22
|
+
};
|
|
23
|
+
type CostLedgerState = CostFigures & {
|
|
24
|
+
lifetime?: CostFigures;
|
|
25
|
+
};
|
|
26
|
+
declare class CostLedger {
|
|
27
|
+
#private;
|
|
28
|
+
constructor(pricing?: PricingTable);
|
|
29
|
+
carry(state: CostLedgerState | undefined): void;
|
|
30
|
+
carryUnlessRestored(state: CostLedgerState | undefined): void;
|
|
31
|
+
observeCumulative(byModel: ByModel | undefined, reportedCostUsd: number | undefined): void;
|
|
32
|
+
observeDelta(byModel: ByModel): void;
|
|
33
|
+
rollover(): void;
|
|
34
|
+
get byModel(): ByModel | undefined;
|
|
35
|
+
get breakdown(): CostBreakdown;
|
|
36
|
+
get costUsd(): number | undefined;
|
|
37
|
+
get reportedCostUsd(): number | undefined;
|
|
38
|
+
snapshot(): CostLedgerState;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/lib/instructions.d.ts
|
|
42
|
+
type InstructionsContext = {
|
|
43
|
+
sessionId: string;
|
|
44
|
+
cwd?: string;
|
|
45
|
+
profile?: string;
|
|
46
|
+
};
|
|
47
|
+
type SessionInstructions = string | ((context: InstructionsContext) => string);
|
|
48
|
+
declare function resolveInstructions(instructions: SessionInstructions | undefined, context: InstructionsContext): string | undefined;
|
|
49
|
+
declare function composeInstructions(...parts: Array<SessionInstructions | undefined>): SessionInstructions | undefined;
|
|
50
|
+
//#endregion
|
|
18
51
|
//#region src/lib/local-command.d.ts
|
|
19
52
|
type LocalCommandResult = {
|
|
20
53
|
command: string;
|
|
@@ -54,27 +87,16 @@ declare class LocalCommandQueue {
|
|
|
54
87
|
clear(): void;
|
|
55
88
|
}
|
|
56
89
|
//#endregion
|
|
57
|
-
//#region src/lib/
|
|
58
|
-
type
|
|
59
|
-
|
|
60
|
-
|
|
90
|
+
//#region src/lib/gateway-tools.d.ts
|
|
91
|
+
type GatewayToolOutput = {
|
|
92
|
+
text: string;
|
|
93
|
+
isError: boolean;
|
|
61
94
|
};
|
|
62
|
-
type
|
|
63
|
-
|
|
95
|
+
type GatewayToolSpec<N extends string = string> = {
|
|
96
|
+
name: N;
|
|
97
|
+
description: string;
|
|
98
|
+
inputSchema: Record<string, unknown>;
|
|
64
99
|
};
|
|
65
|
-
declare class CostLedger {
|
|
66
|
-
#private;
|
|
67
|
-
carry(state: CostLedgerState | undefined): void;
|
|
68
|
-
carryUnlessRestored(state: CostLedgerState | undefined): void;
|
|
69
|
-
observeCumulative(byModel: ByModel | undefined, reportedCostUsd: number | undefined): void;
|
|
70
|
-
observeDelta(byModel: ByModel): void;
|
|
71
|
-
rollover(): void;
|
|
72
|
-
get byModel(): ByModel | undefined;
|
|
73
|
-
get breakdown(): CostBreakdown;
|
|
74
|
-
get costUsd(): number | undefined;
|
|
75
|
-
get reportedCostUsd(): number | undefined;
|
|
76
|
-
snapshot(): CostLedgerState;
|
|
77
|
-
}
|
|
78
100
|
//#endregion
|
|
79
101
|
//#region src/lib/peers.d.ts
|
|
80
102
|
type PeerSessionSummary = {
|
|
@@ -147,16 +169,9 @@ declare const PEER_TOOL_SHAPES: {
|
|
|
147
169
|
};
|
|
148
170
|
};
|
|
149
171
|
type PeerToolName = keyof typeof PEER_TOOL_SHAPES;
|
|
150
|
-
|
|
151
|
-
type
|
|
152
|
-
|
|
153
|
-
description: string;
|
|
154
|
-
inputSchema: Record<string, unknown>;
|
|
155
|
-
};
|
|
156
|
-
type PeerToolOutput = {
|
|
157
|
-
text: string;
|
|
158
|
-
isError: boolean;
|
|
159
|
-
};
|
|
172
|
+
type PeerToolSpec = GatewayToolSpec<PeerToolName>;
|
|
173
|
+
type PeerToolOutput = GatewayToolOutput;
|
|
174
|
+
declare const PEER_TOOL_NAMES: ("peers_list" | "peers_peek" | "peers_send")[];
|
|
160
175
|
declare function peerToolSpecs(): PeerToolSpec[];
|
|
161
176
|
declare function runPeerTool(peers: PeerDirectory, from: string, name: string, args: unknown): Promise<PeerToolOutput>;
|
|
162
177
|
declare function peerMessageEnvelope(text: string, origin: MessageOrigin): string;
|
|
@@ -169,127 +184,7 @@ declare function peerSummary(info: SessionInfo): PeerSessionSummary;
|
|
|
169
184
|
declare function recentLines(events: readonly SessionEvent[], limit: number): string[];
|
|
170
185
|
declare function installPeerDirectory(directory: PeerDirectory | undefined): void;
|
|
171
186
|
declare function installedPeerDirectory(): PeerDirectory | undefined;
|
|
172
|
-
declare function peerDirectoryHandle(): PeerDirectory;
|
|
173
|
-
//#endregion
|
|
174
|
-
//#region src/executors/tool-executor.d.ts
|
|
175
|
-
type ToolExecutionResult = {
|
|
176
|
-
status: 'ok';
|
|
177
|
-
output: unknown;
|
|
178
|
-
logs?: string[];
|
|
179
|
-
} | {
|
|
180
|
-
status: 'failed';
|
|
181
|
-
reason: string;
|
|
182
|
-
error: string;
|
|
183
|
-
logs?: string[];
|
|
184
|
-
};
|
|
185
|
-
type ToolExecutionCall = {
|
|
186
|
-
executionId: string;
|
|
187
|
-
sessionId: string;
|
|
188
|
-
tool: string;
|
|
189
|
-
input: unknown;
|
|
190
|
-
vfs?: SandboxVfs;
|
|
191
|
-
limits?: {
|
|
192
|
-
timeoutMs?: number;
|
|
193
|
-
memoryLimitBytes?: number;
|
|
194
|
-
};
|
|
195
|
-
signal?: AbortSignal;
|
|
196
|
-
};
|
|
197
|
-
type ToolExecutionDispatch = {
|
|
198
|
-
executionId: string;
|
|
199
|
-
status: 'settled';
|
|
200
|
-
result: ToolExecutionResult;
|
|
201
|
-
} | {
|
|
202
|
-
executionId: string;
|
|
203
|
-
status: 'pending';
|
|
204
|
-
};
|
|
205
|
-
type ToolExecutionProfile = {
|
|
206
|
-
backend?: ToolExecutionBackend;
|
|
207
|
-
deferred?: boolean;
|
|
208
|
-
timeoutMs?: number;
|
|
209
|
-
};
|
|
210
|
-
interface ToolExecutor {
|
|
211
|
-
describe?(call: ToolExecutionCall): ToolExecutionProfile;
|
|
212
|
-
dispatch(call: ToolExecutionCall): Promise<ToolExecutionDispatch>;
|
|
213
|
-
}
|
|
214
|
-
//#endregion
|
|
215
|
-
//#region src/runner-interface.d.ts
|
|
216
|
-
type SessionEventListener = (event: SessionEvent) => void;
|
|
217
|
-
type ParkedExecution = {
|
|
218
|
-
executionId: string;
|
|
219
|
-
toolName: string;
|
|
220
|
-
expiresAt?: number;
|
|
221
|
-
};
|
|
222
|
-
type RunnerSnapshot = {
|
|
223
|
-
engine: ProfileEngine;
|
|
224
|
-
id: string;
|
|
225
|
-
createdAt: number;
|
|
226
|
-
seq: number;
|
|
227
|
-
events: SessionEvent[];
|
|
228
|
-
vfs?: Record<string, string>;
|
|
229
|
-
parked: ParkedExecution[];
|
|
230
|
-
state: unknown;
|
|
231
|
-
};
|
|
232
|
-
type SendMessageOptions = {
|
|
233
|
-
origin?: MessageOrigin;
|
|
234
|
-
mentions?: readonly PeerMention[];
|
|
235
|
-
};
|
|
236
|
-
type PermissionDecision = {
|
|
237
|
-
behavior: 'allow';
|
|
238
|
-
updatedInput?: Record<string, unknown>;
|
|
239
|
-
} | {
|
|
240
|
-
behavior: 'deny';
|
|
241
|
-
message?: string;
|
|
242
|
-
interrupt?: boolean;
|
|
243
|
-
};
|
|
244
|
-
interface Runner {
|
|
245
|
-
readonly id: string;
|
|
246
|
-
readonly pendingApprovals: PermissionRequest[];
|
|
247
|
-
readonly vfs?: SandboxVfs;
|
|
248
|
-
start(): Promise<void>;
|
|
249
|
-
info(): SessionInfo;
|
|
250
|
-
subscribe(listener: SessionEventListener, afterSeq?: number, options?: {
|
|
251
|
-
coalesceReplay?: boolean;
|
|
252
|
-
truncateResults?: boolean;
|
|
253
|
-
imageRefs?: boolean;
|
|
254
|
-
}): () => void;
|
|
255
|
-
eventAt?(seq: number): SessionEvent | undefined;
|
|
256
|
-
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
257
|
-
queueLocalCommand?(input: LocalCommandResult | LocalShellSource): void;
|
|
258
|
-
refreshUsage?(): Promise<void>;
|
|
259
|
-
mcpServers?(): Promise<McpServerStatusInfo[] | undefined>;
|
|
260
|
-
reconnectMcpServer?(name: string): Promise<void>;
|
|
261
|
-
setMcpServerEnabled?(name: string, enabled: boolean): Promise<void>;
|
|
262
|
-
setTitle(title: string | undefined): void;
|
|
263
|
-
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
264
|
-
interrupt(): Promise<void>;
|
|
265
|
-
clearContext?(): Promise<void>;
|
|
266
|
-
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
267
|
-
setModel(model?: string): Promise<void>;
|
|
268
|
-
settleExecution?(executionId: string, result: ToolExecutionResult): boolean;
|
|
269
|
-
park?(): RunnerSnapshot | undefined;
|
|
270
|
-
snapshot?(): RunnerSnapshot | undefined;
|
|
271
|
-
carryCost?(state: CostLedgerState): void;
|
|
272
|
-
costState?(): CostLedgerState;
|
|
273
|
-
fail(message: string): void;
|
|
274
|
-
close(reason?: 'client' | 'server' | 'error'): void;
|
|
275
|
-
}
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/lib/subscribers.d.ts
|
|
278
|
-
type SubscribeOptions = {
|
|
279
|
-
coalesceReplay?: boolean;
|
|
280
|
-
truncateResults?: boolean;
|
|
281
|
-
imageRefs?: boolean;
|
|
282
|
-
};
|
|
283
|
-
//#endregion
|
|
284
|
-
//#region src/lib/instructions.d.ts
|
|
285
|
-
type InstructionsContext = {
|
|
286
|
-
sessionId: string;
|
|
287
|
-
cwd?: string;
|
|
288
|
-
profile?: string;
|
|
289
|
-
};
|
|
290
|
-
type SessionInstructions = string | ((context: InstructionsContext) => string);
|
|
291
|
-
declare function resolveInstructions(instructions: SessionInstructions | undefined, context: InstructionsContext): string | undefined;
|
|
292
|
-
declare function composeInstructions(...parts: Array<SessionInstructions | undefined>): SessionInstructions | undefined;
|
|
187
|
+
declare function peerDirectoryHandle(own?: () => PeerDirectory | undefined): PeerDirectory;
|
|
293
188
|
//#endregion
|
|
294
189
|
//#region src/lib/shells.d.ts
|
|
295
190
|
type ShellSummary = {
|
|
@@ -412,21 +307,14 @@ declare const SHELL_TOOL_SHAPES: {
|
|
|
412
307
|
};
|
|
413
308
|
};
|
|
414
309
|
type ShellToolName = keyof typeof SHELL_TOOL_SHAPES;
|
|
415
|
-
declare const SHELL_TOOL_NAMES: ShellToolName[];
|
|
416
310
|
declare const SHELL_READ_TOOL_NAMES: readonly ShellToolName[];
|
|
417
311
|
declare const SHELL_WRITE_TOOL_NAMES: readonly ShellToolName[];
|
|
418
|
-
type ShellToolSpec =
|
|
419
|
-
|
|
420
|
-
description: string;
|
|
421
|
-
inputSchema: Record<string, unknown>;
|
|
422
|
-
};
|
|
423
|
-
type ShellToolOutput = {
|
|
424
|
-
text: string;
|
|
425
|
-
isError: boolean;
|
|
426
|
-
};
|
|
312
|
+
type ShellToolSpec = GatewayToolSpec<ShellToolName>;
|
|
313
|
+
type ShellToolOutput = GatewayToolOutput;
|
|
427
314
|
type ShellToolOptions = {
|
|
428
315
|
write?: boolean;
|
|
429
316
|
};
|
|
317
|
+
declare const SHELL_TOOL_NAMES: ("shell_list" | "shell_read" | "shell_run" | "shell_write" | "shell_kill" | "shell_request_write")[];
|
|
430
318
|
declare function shellToolNames(write: boolean): ShellToolName[];
|
|
431
319
|
declare function shellToolSpecs(write?: boolean): ShellToolSpec[];
|
|
432
320
|
declare function isShellToolName(name: string): name is ShellToolName;
|
|
@@ -453,7 +341,273 @@ declare function shellReadText(result: ShellReadResult, verb?: 'started' | 'type
|
|
|
453
341
|
declare function shellKillText(result: ShellKillResult): string;
|
|
454
342
|
declare function installShellDirectory(directory: ShellDirectory | undefined): void;
|
|
455
343
|
declare function installedShellDirectory(): ShellDirectory | undefined;
|
|
456
|
-
declare function shellDirectoryHandle(): ShellDirectory;
|
|
344
|
+
declare function shellDirectoryHandle(own?: () => ShellDirectory | undefined): ShellDirectory;
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/executors/tool-executor.d.ts
|
|
347
|
+
type ToolExecutionResult = {
|
|
348
|
+
status: 'ok';
|
|
349
|
+
output: unknown;
|
|
350
|
+
logs?: string[];
|
|
351
|
+
} | {
|
|
352
|
+
status: 'failed';
|
|
353
|
+
reason: string;
|
|
354
|
+
error: string;
|
|
355
|
+
logs?: string[];
|
|
356
|
+
};
|
|
357
|
+
type ToolExecutionCall = {
|
|
358
|
+
executionId: string;
|
|
359
|
+
sessionId: string;
|
|
360
|
+
tool: string;
|
|
361
|
+
input: unknown;
|
|
362
|
+
vfs?: SandboxVfs;
|
|
363
|
+
limits?: {
|
|
364
|
+
timeoutMs?: number;
|
|
365
|
+
memoryLimitBytes?: number;
|
|
366
|
+
};
|
|
367
|
+
signal?: AbortSignal;
|
|
368
|
+
};
|
|
369
|
+
type ToolExecutionDispatch = {
|
|
370
|
+
executionId: string;
|
|
371
|
+
status: 'settled';
|
|
372
|
+
result: ToolExecutionResult;
|
|
373
|
+
} | {
|
|
374
|
+
executionId: string;
|
|
375
|
+
status: 'pending';
|
|
376
|
+
};
|
|
377
|
+
type ToolExecutionProfile = {
|
|
378
|
+
backend?: ToolExecutionBackend;
|
|
379
|
+
deferred?: boolean;
|
|
380
|
+
timeoutMs?: number;
|
|
381
|
+
};
|
|
382
|
+
interface ToolExecutor {
|
|
383
|
+
describe?(call: ToolExecutionCall): ToolExecutionProfile;
|
|
384
|
+
dispatch(call: ToolExecutionCall): Promise<ToolExecutionDispatch>;
|
|
385
|
+
}
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/runner-interface.d.ts
|
|
388
|
+
type SessionEventListener = (event: SessionEvent) => void;
|
|
389
|
+
type EngineRunnerConfig = CreateSessionRequest & {
|
|
390
|
+
epoch?: number;
|
|
391
|
+
pricing?: PricingTable;
|
|
392
|
+
env?: Record<string, string | undefined>;
|
|
393
|
+
instructions?: SessionInstructions;
|
|
394
|
+
defaultApprovalTimeoutMs?: number | null;
|
|
395
|
+
peers?: PeerDirectory;
|
|
396
|
+
shells?: ShellDirectory;
|
|
397
|
+
shellAgentWrite?: ShellAgentWrite;
|
|
398
|
+
createdByOperator?: boolean;
|
|
399
|
+
fallbackTitle?: string;
|
|
400
|
+
};
|
|
401
|
+
type ParkedExecution = {
|
|
402
|
+
executionId: string;
|
|
403
|
+
toolName: string;
|
|
404
|
+
expiresAt?: number;
|
|
405
|
+
};
|
|
406
|
+
type RunnerSnapshot = {
|
|
407
|
+
engine: ProfileEngine;
|
|
408
|
+
id: string;
|
|
409
|
+
createdAt: number;
|
|
410
|
+
seq: number;
|
|
411
|
+
events: SessionEvent[];
|
|
412
|
+
vfs?: Record<string, string>;
|
|
413
|
+
parked: ParkedExecution[];
|
|
414
|
+
state: unknown;
|
|
415
|
+
};
|
|
416
|
+
type SendMessageOptions = {
|
|
417
|
+
origin?: MessageOrigin;
|
|
418
|
+
mentions?: readonly PeerMention[];
|
|
419
|
+
};
|
|
420
|
+
type PermissionDecision = {
|
|
421
|
+
behavior: 'allow';
|
|
422
|
+
updatedInput?: Record<string, unknown>;
|
|
423
|
+
} | {
|
|
424
|
+
behavior: 'deny';
|
|
425
|
+
message?: string;
|
|
426
|
+
interrupt?: boolean;
|
|
427
|
+
};
|
|
428
|
+
interface Runner {
|
|
429
|
+
readonly id: string;
|
|
430
|
+
readonly pendingApprovals: PermissionRequest[];
|
|
431
|
+
readonly vfs?: SandboxVfs;
|
|
432
|
+
start(): Promise<void>;
|
|
433
|
+
info(): SessionInfo;
|
|
434
|
+
subscribe(listener: SessionEventListener, afterSeq?: number, options?: {
|
|
435
|
+
coalesceReplay?: boolean;
|
|
436
|
+
truncateResults?: boolean;
|
|
437
|
+
imageRefs?: boolean;
|
|
438
|
+
}): () => void;
|
|
439
|
+
eventAt?(seq: number): SessionEvent | undefined;
|
|
440
|
+
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
441
|
+
queueLocalCommand?(input: LocalCommandResult | LocalShellSource): void;
|
|
442
|
+
refreshUsage?(): Promise<void>;
|
|
443
|
+
mcpServers?(): Promise<McpServerStatusInfo[] | undefined>;
|
|
444
|
+
reconnectMcpServer?(name: string): Promise<void>;
|
|
445
|
+
setMcpServerEnabled?(name: string, enabled: boolean): Promise<void>;
|
|
446
|
+
setTitle(title: string | undefined): void;
|
|
447
|
+
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
448
|
+
interrupt(): Promise<void>;
|
|
449
|
+
stopTask?(toolUseId: string): Promise<boolean>;
|
|
450
|
+
clearContext?(): Promise<void>;
|
|
451
|
+
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
452
|
+
setModel(model?: string): Promise<void>;
|
|
453
|
+
settleExecution?(executionId: string, result: ToolExecutionResult): boolean;
|
|
454
|
+
park?(): RunnerSnapshot | undefined;
|
|
455
|
+
snapshot?(): RunnerSnapshot | undefined;
|
|
456
|
+
carryCost?(state: CostLedgerState): void;
|
|
457
|
+
costState?(): CostLedgerState;
|
|
458
|
+
fail(message: string): void;
|
|
459
|
+
close(reason?: 'client' | 'server' | 'error'): void;
|
|
460
|
+
}
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/lib/event-log.d.ts
|
|
463
|
+
declare class EventLog {
|
|
464
|
+
#private;
|
|
465
|
+
get events(): readonly SessionEvent[];
|
|
466
|
+
get seq(): number;
|
|
467
|
+
get activityCount(): number;
|
|
468
|
+
get proseCount(): number;
|
|
469
|
+
get contextUsage(): ContextReading | undefined;
|
|
470
|
+
get checklist(): ChecklistItem[] | undefined;
|
|
471
|
+
get resetSeq(): number;
|
|
472
|
+
get lastActivityAt(): number | undefined;
|
|
473
|
+
append(body: SessionEventBody): SessionEvent;
|
|
474
|
+
at(seq: number): SessionEvent | undefined;
|
|
475
|
+
restore(events: readonly SessionEvent[], seq: number, lastActivityAt: number | undefined): void;
|
|
476
|
+
}
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/lib/subscribers.d.ts
|
|
479
|
+
type SubscribeOptions = {
|
|
480
|
+
coalesceReplay?: boolean;
|
|
481
|
+
truncateResults?: boolean;
|
|
482
|
+
imageRefs?: boolean;
|
|
483
|
+
};
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region src/lib/runner-core.d.ts
|
|
486
|
+
type CloseReason = 'client' | 'server' | 'error';
|
|
487
|
+
type RunnerCoreHooks = {
|
|
488
|
+
prepare?: (body: SessionEventBody) => SessionEventBody;
|
|
489
|
+
observe?: (body: SessionEventBody, event: SessionEvent) => void;
|
|
490
|
+
settled?: (body: SessionEventBody, event: SessionEvent) => void;
|
|
491
|
+
holdStatus?: (status: SessionStatus) => boolean;
|
|
492
|
+
};
|
|
493
|
+
type RunnerCoreOptions = {
|
|
494
|
+
pricing?: PricingTable;
|
|
495
|
+
cost?: 'additive' | 'reconcile';
|
|
496
|
+
hooks?: RunnerCoreHooks;
|
|
497
|
+
};
|
|
498
|
+
type ApprovalResolution = {
|
|
499
|
+
behavior: 'allow' | 'deny';
|
|
500
|
+
resolvedBy: PermissionDecisionSource;
|
|
501
|
+
message?: string;
|
|
502
|
+
};
|
|
503
|
+
type ApprovalHandler = {
|
|
504
|
+
timeoutMs?: number;
|
|
505
|
+
wireId?: string | number;
|
|
506
|
+
respond: (decision: PermissionDecision, resolvedBy: PermissionDecisionSource) => ApprovalResolution;
|
|
507
|
+
after?: (resolution: ApprovalResolution, decision: PermissionDecision) => void;
|
|
508
|
+
};
|
|
509
|
+
type TurnResultBody = Extract<SessionEventBody, {
|
|
510
|
+
type: 'turn_result';
|
|
511
|
+
}>;
|
|
512
|
+
type TurnReport = {
|
|
513
|
+
startedAt: number;
|
|
514
|
+
numTurns: number;
|
|
515
|
+
result?: string;
|
|
516
|
+
errors?: string[];
|
|
517
|
+
usage?: TurnResultBody['usage'];
|
|
518
|
+
byModel?: ByModel;
|
|
519
|
+
costs: boolean;
|
|
520
|
+
totalCostUsd?: number;
|
|
521
|
+
};
|
|
522
|
+
declare class RunnerCore {
|
|
523
|
+
#private;
|
|
524
|
+
readonly log: EventLog;
|
|
525
|
+
readonly cost: CostLedger;
|
|
526
|
+
constructor(options?: RunnerCoreOptions);
|
|
527
|
+
get status(): SessionStatus;
|
|
528
|
+
get closed(): boolean;
|
|
529
|
+
get terminal(): boolean;
|
|
530
|
+
get pendingApprovals(): PermissionRequest[];
|
|
531
|
+
get pendingCount(): number;
|
|
532
|
+
restoreStatus(status: SessionStatus): void;
|
|
533
|
+
emit(body: SessionEventBody): SessionEvent;
|
|
534
|
+
setStatus(status: SessionStatus, detail?: string): void;
|
|
535
|
+
subscribe(listener: SessionEventListener, afterSeq?: number, options?: SubscribeOptions): () => void;
|
|
536
|
+
clearSubscribers(): void;
|
|
537
|
+
eventAt(seq: number): SessionEvent | undefined;
|
|
538
|
+
carryCost(state: CostLedgerState): void;
|
|
539
|
+
costState(): CostLedgerState;
|
|
540
|
+
fail(message: string, close: (reason: CloseReason) => void): void;
|
|
541
|
+
close(reason: CloseReason, teardown?: () => void, options?: {
|
|
542
|
+
settleApprovals?: boolean;
|
|
543
|
+
}): boolean;
|
|
544
|
+
requestApproval(request: PermissionRequest, handler: ApprovalHandler): void;
|
|
545
|
+
resolveApproval(requestId: string, decision: PermissionDecision, resolvedBy?: PermissionDecisionSource): boolean;
|
|
546
|
+
settleAllApprovals(decision: PermissionDecision, resolvedBy: PermissionDecisionSource, followUp?: boolean): void;
|
|
547
|
+
findApproval(predicate: (request: PermissionRequest, wireId: string | number | undefined) => boolean): string | undefined;
|
|
548
|
+
resolveByPolicy(request: PermissionRequest, behavior: 'allow' | 'deny', message?: string): void;
|
|
549
|
+
resolveQuestionByPolicy(request: PermissionRequest, mode: 'auto' | 'deny'): boolean;
|
|
550
|
+
emitTurnResult(report: TurnReport): void;
|
|
551
|
+
}
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region src/lib/session-tools.d.ts
|
|
554
|
+
type SessionToolSources = {
|
|
555
|
+
peers?: PeerDirectory;
|
|
556
|
+
shells?: ShellDirectory;
|
|
557
|
+
write: boolean;
|
|
558
|
+
};
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/lib/engine-runner.d.ts
|
|
561
|
+
type EngineRunnerCoreOptions = Pick<RunnerCoreOptions, 'cost'>;
|
|
562
|
+
type ApprovalDeadline = {
|
|
563
|
+
timeoutMs: number | undefined;
|
|
564
|
+
expiresAt: number | undefined;
|
|
565
|
+
};
|
|
566
|
+
declare abstract class EngineRunner<C extends EngineRunnerConfig> {
|
|
567
|
+
readonly id: string;
|
|
568
|
+
readonly createdAt: number;
|
|
569
|
+
protected config: C;
|
|
570
|
+
protected readonly core: RunnerCore;
|
|
571
|
+
protected readonly localCommands: LocalCommandQueue;
|
|
572
|
+
protected constructor(config: C, id: string, createdAt: number, options?: EngineRunnerCoreOptions);
|
|
573
|
+
abstract close(reason?: CloseReason): void;
|
|
574
|
+
protected coreHooks(): RunnerCoreHooks;
|
|
575
|
+
get status(): SessionStatus;
|
|
576
|
+
get lastSeq(): number;
|
|
577
|
+
get pendingApprovals(): PermissionRequest[];
|
|
578
|
+
setTitle(title: string | undefined): void;
|
|
579
|
+
carryCost(state: CostLedgerState): void;
|
|
580
|
+
costState(): CostLedgerState;
|
|
581
|
+
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
582
|
+
queueLocalCommand(input: LocalCommandResult | LocalShellSource): void;
|
|
583
|
+
eventAt(seq: number): SessionEvent | undefined;
|
|
584
|
+
subscribe(listener: SessionEventListener, afterSeq?: number, options?: SubscribeOptions): () => void;
|
|
585
|
+
fail(message: string): void;
|
|
586
|
+
protected assertAccepting(): void;
|
|
587
|
+
protected echoUser(text: string, attachments: readonly AttachmentInput[] | undefined, options: SendMessageOptions | undefined): void;
|
|
588
|
+
protected approvalDeadline(): ApprovalDeadline;
|
|
589
|
+
protected get toolSources(): SessionToolSources;
|
|
590
|
+
protected baseInfo(engineTitle?: string): {
|
|
591
|
+
id: string;
|
|
592
|
+
status: SessionStatus;
|
|
593
|
+
profile: string | undefined;
|
|
594
|
+
shellAgentWrite: ShellAgentWrite | undefined;
|
|
595
|
+
createdAt: number;
|
|
596
|
+
epoch: number | undefined;
|
|
597
|
+
lastSeq: number;
|
|
598
|
+
activityCount: number;
|
|
599
|
+
proseCount: number;
|
|
600
|
+
contextUsage: import("@workerdeck/protocol").ContextReading | undefined;
|
|
601
|
+
checklist: import("@workerdeck/protocol").ChecklistItem[] | undefined;
|
|
602
|
+
pendingPermissionCount: number;
|
|
603
|
+
meta: Record<string, unknown> | undefined;
|
|
604
|
+
scope: Record<string, string> | undefined;
|
|
605
|
+
title: string | undefined;
|
|
606
|
+
costUsd: number | undefined;
|
|
607
|
+
usageByModel: import("@workerdeck/protocol").ByModel | undefined;
|
|
608
|
+
lastActivityAt: number | undefined;
|
|
609
|
+
};
|
|
610
|
+
}
|
|
457
611
|
//#endregion
|
|
458
612
|
//#region src/engines/claude/runner.d.ts
|
|
459
613
|
type QueryFn = (params: {
|
|
@@ -466,51 +620,32 @@ type HistoryFn = (sdkSessionId: string, options: {
|
|
|
466
620
|
type SessionInfoFn = (sdkSessionId: string, options: {
|
|
467
621
|
dir?: string;
|
|
468
622
|
}) => Promise<SDKSessionInfo | undefined>;
|
|
469
|
-
type SessionRunnerConfig =
|
|
470
|
-
epoch?: number;
|
|
623
|
+
type SessionRunnerConfig = EngineRunnerConfig & {
|
|
471
624
|
queryFn?: QueryFn;
|
|
472
|
-
env?: Record<string, string | undefined>;
|
|
473
625
|
pathToClaudeCodeExecutable?: string;
|
|
474
626
|
extraOptions?: Partial<Options>;
|
|
475
|
-
instructions?: SessionInstructions;
|
|
476
|
-
defaultApprovalTimeoutMs?: number | null;
|
|
477
627
|
backfillHistory?: boolean;
|
|
478
628
|
historyFn?: HistoryFn;
|
|
479
629
|
sessionInfoFn?: SessionInfoFn;
|
|
480
|
-
peers?: PeerDirectory;
|
|
481
|
-
shells?: ShellDirectory;
|
|
482
|
-
shellAgentWrite?: ShellAgentWrite;
|
|
483
|
-
createdByOperator?: boolean;
|
|
484
630
|
};
|
|
485
|
-
declare class SessionRunner implements Runner {
|
|
631
|
+
declare class SessionRunner extends EngineRunner<SessionRunnerConfig> implements Runner {
|
|
486
632
|
#private;
|
|
487
|
-
readonly id: string;
|
|
488
|
-
readonly createdAt: number;
|
|
489
633
|
constructor(config: SessionRunnerConfig, id?: string);
|
|
490
|
-
|
|
634
|
+
protected coreHooks(): RunnerCoreHooks;
|
|
491
635
|
get sdkSessionId(): string | undefined;
|
|
492
|
-
get lastSeq(): number;
|
|
493
636
|
get apiKeySource(): string | undefined;
|
|
494
|
-
get pendingApprovals(): PermissionRequest[];
|
|
495
637
|
info(): SessionInfo;
|
|
496
|
-
setTitle(title: string | undefined): void;
|
|
497
|
-
carryCost(state: CostLedgerState): void;
|
|
498
|
-
costState(): CostLedgerState;
|
|
499
638
|
start(): Promise<void>;
|
|
500
639
|
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
501
|
-
queueLocalCommand(input: LocalCommandResult | LocalShellSource): void;
|
|
502
640
|
mcpServers(): Promise<McpServerStatusInfo[] | undefined>;
|
|
503
641
|
reconnectMcpServer(name: string): Promise<void>;
|
|
504
642
|
setMcpServerEnabled(name: string, enabled: boolean): Promise<void>;
|
|
505
|
-
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
506
643
|
interrupt(): Promise<void>;
|
|
644
|
+
stopTask(toolUseId: string): Promise<boolean>;
|
|
507
645
|
clearContext(): Promise<void>;
|
|
508
646
|
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
509
647
|
setModel(model?: string): Promise<void>;
|
|
510
|
-
|
|
511
|
-
close(reason?: 'client' | 'server' | 'error'): void;
|
|
512
|
-
eventAt(seq: number): SessionEvent | undefined;
|
|
513
|
-
subscribe(listener: SessionEventListener, afterSeq?: number, options?: SubscribeOptions): () => void;
|
|
648
|
+
close(reason?: CloseReason): void;
|
|
514
649
|
refreshUsage(minIntervalMs?: number): Promise<void>;
|
|
515
650
|
}
|
|
516
651
|
//#endregion
|
|
@@ -524,13 +659,19 @@ declare function replaySlice(events: readonly SessionEvent[], options: {
|
|
|
524
659
|
}): SessionEvent[];
|
|
525
660
|
declare function truncateResultBlocks(event: SessionEvent): SessionEvent;
|
|
526
661
|
//#endregion
|
|
662
|
+
//#region src/engines/provider/turn.d.ts
|
|
663
|
+
type TurnUsage = {
|
|
664
|
+
startedAt: number;
|
|
665
|
+
input: number;
|
|
666
|
+
output: number;
|
|
667
|
+
cacheWrite: number;
|
|
668
|
+
cacheRead: number;
|
|
669
|
+
};
|
|
670
|
+
//#endregion
|
|
527
671
|
//#region src/engines/provider/runner.d.ts
|
|
528
|
-
type AiSdkRunnerConfig =
|
|
529
|
-
epoch?: number;
|
|
530
|
-
cwd?: string;
|
|
672
|
+
type AiSdkRunnerConfig = EngineRunnerConfig & {
|
|
531
673
|
languageModel: LanguageModel$1;
|
|
532
674
|
tools?: ToolSet$1;
|
|
533
|
-
instructions?: SessionInstructions;
|
|
534
675
|
maxSteps?: number;
|
|
535
676
|
executor?: ToolExecutor;
|
|
536
677
|
executableTools?: string[];
|
|
@@ -545,14 +686,10 @@ type AiSdkRunnerConfig = Omit<CreateSessionRequest, 'cwd'> & {
|
|
|
545
686
|
toolName: string;
|
|
546
687
|
input: unknown;
|
|
547
688
|
}) => boolean;
|
|
548
|
-
defaultApprovalTimeoutMs?: number | null;
|
|
549
689
|
resolveModel?: (modelId: string | undefined) => LanguageModel$1;
|
|
550
690
|
reportMcpServers?: () => Promise<McpServerStatusInfo[] | undefined>;
|
|
551
691
|
onClose?: () => void | Promise<void>;
|
|
552
692
|
restore?: RunnerSnapshot;
|
|
553
|
-
peers?: PeerDirectory;
|
|
554
|
-
shells?: ShellDirectory;
|
|
555
|
-
shellAgentWrite?: ShellAgentWrite;
|
|
556
693
|
};
|
|
557
694
|
type PendingToolCall = {
|
|
558
695
|
toolCallId: string;
|
|
@@ -566,13 +703,7 @@ type AiSdkSessionState = {
|
|
|
566
703
|
pendingToolCalls: PendingToolCall[];
|
|
567
704
|
dispatched: string[];
|
|
568
705
|
numTurns: number;
|
|
569
|
-
turnAccum?:
|
|
570
|
-
startedAt: number;
|
|
571
|
-
input: number;
|
|
572
|
-
output: number;
|
|
573
|
-
cacheWrite: number;
|
|
574
|
-
cacheRead: number;
|
|
575
|
-
};
|
|
706
|
+
turnAccum?: TurnUsage;
|
|
576
707
|
permissionMode: PermissionMode;
|
|
577
708
|
model?: string;
|
|
578
709
|
lastActivityAt?: number;
|
|
@@ -586,29 +717,21 @@ type ToolCallOutput = {
|
|
|
586
717
|
type: 'json';
|
|
587
718
|
value: unknown;
|
|
588
719
|
};
|
|
589
|
-
declare class AiSdkRunner implements Runner {
|
|
720
|
+
declare class AiSdkRunner extends EngineRunner<AiSdkRunnerConfig> implements Runner {
|
|
590
721
|
#private;
|
|
591
|
-
readonly id: string;
|
|
592
|
-
readonly createdAt: number;
|
|
593
722
|
constructor(config: AiSdkRunnerConfig, id?: string);
|
|
594
|
-
get status(): SessionStatus;
|
|
595
|
-
get lastSeq(): number;
|
|
596
723
|
get messages(): ModelMessage[];
|
|
597
724
|
get pendingToolCalls(): PendingToolCall[];
|
|
598
|
-
get pendingApprovals(): PermissionRequest[];
|
|
599
725
|
get vfs(): SandboxVfs | undefined;
|
|
600
726
|
info(): SessionInfo;
|
|
601
|
-
carryCost(state: CostLedgerState): void;
|
|
602
|
-
costState(): CostLedgerState;
|
|
603
727
|
start(): Promise<void>;
|
|
604
728
|
park(): RunnerSnapshot | undefined;
|
|
605
729
|
snapshot(): RunnerSnapshot | undefined;
|
|
606
730
|
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
607
|
-
|
|
731
|
+
protected assertAccepting(): void;
|
|
608
732
|
resolveToolCall(toolCallId: string, output: ToolCallOutput, options?: {
|
|
609
733
|
isError?: boolean;
|
|
610
734
|
}): boolean;
|
|
611
|
-
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
612
735
|
emitFileDelivered(file: {
|
|
613
736
|
path: string;
|
|
614
737
|
bytes: number;
|
|
@@ -619,13 +742,9 @@ declare class AiSdkRunner implements Runner {
|
|
|
619
742
|
interrupt(): Promise<void>;
|
|
620
743
|
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
621
744
|
setModel(model?: string): Promise<void>;
|
|
622
|
-
|
|
623
|
-
close(reason?: 'client' | 'server' | 'error'): void;
|
|
624
|
-
eventAt(seq: number): SessionEvent | undefined;
|
|
625
|
-
subscribe(listener: SessionEventListener, afterSeq?: number, options?: SubscribeOptions): () => void;
|
|
745
|
+
close(reason?: CloseReason): void;
|
|
626
746
|
settleExecution(executionId: string, result: ToolExecutionResult): boolean;
|
|
627
747
|
mcpServers(): Promise<McpServerStatusInfo[] | undefined>;
|
|
628
|
-
setTitle(title: string | undefined): void;
|
|
629
748
|
}
|
|
630
749
|
//#endregion
|
|
631
750
|
//#region src/engines/claude/auth.d.ts
|
|
@@ -644,6 +763,7 @@ type QuickJsExecutorOptions = {
|
|
|
644
763
|
allowedHosts?: string[];
|
|
645
764
|
hostFetch?: HostFetch;
|
|
646
765
|
fetchTimeoutMs?: number;
|
|
766
|
+
fetchMaxBytes?: number;
|
|
647
767
|
defaultTimeoutMs?: number;
|
|
648
768
|
defaultMemoryLimitBytes?: number;
|
|
649
769
|
};
|
|
@@ -865,6 +985,10 @@ declare function connectMcpTools(servers: Record<string, McpServerConfigWire>, o
|
|
|
865
985
|
required?: boolean;
|
|
866
986
|
}): Promise<McpConnection>;
|
|
867
987
|
//#endregion
|
|
988
|
+
//#region src/lib/child-env.d.ts
|
|
989
|
+
declare const GATEWAY_SECRET_ENV_KEYS: readonly string[];
|
|
990
|
+
declare function withoutGatewaySecrets<T extends string | undefined>(env: Record<string, T>): Record<string, T>;
|
|
991
|
+
//#endregion
|
|
868
992
|
//#region src/lib/input-queue.d.ts
|
|
869
993
|
declare class InputQueue implements AsyncIterable<SDKUserMessage> {
|
|
870
994
|
#private;
|
|
@@ -921,18 +1045,19 @@ type ModelCatalog = {
|
|
|
921
1045
|
models: ModelOption[];
|
|
922
1046
|
provenance: string;
|
|
923
1047
|
};
|
|
924
|
-
type EngineRunnerRequest = {
|
|
925
|
-
config:
|
|
1048
|
+
type EngineRunnerRequest<C extends EngineRunnerConfig = EngineRunnerConfig> = {
|
|
1049
|
+
config: C;
|
|
926
1050
|
profile?: ProfileInfo;
|
|
927
1051
|
restore?: RunnerSnapshot;
|
|
928
1052
|
id?: string;
|
|
929
1053
|
};
|
|
930
|
-
interface EngineAdapter {
|
|
1054
|
+
interface EngineAdapter<C extends EngineRunnerConfig = EngineRunnerConfig> {
|
|
931
1055
|
readonly engine: ProfileEngine;
|
|
932
1056
|
readonly capabilities: EngineCapabilities;
|
|
933
1057
|
readonly catalog: ModelCatalog;
|
|
934
1058
|
checkAvailability(profile: ProfileInfo, env: Record<string, string | undefined>): Promise<EngineAvailability>;
|
|
935
|
-
createRunner(request: EngineRunnerRequest): Runner | Promise<Runner>;
|
|
1059
|
+
createRunner(request: EngineRunnerRequest<C>): Runner | Promise<Runner>;
|
|
1060
|
+
sessionEnv?(profile: ProfileInfo, base: Record<string, string | undefined>): Record<string, string | undefined>;
|
|
936
1061
|
listSessions?(options: {
|
|
937
1062
|
profile?: ProfileInfo;
|
|
938
1063
|
env: Record<string, string | undefined>;
|
|
@@ -944,7 +1069,7 @@ interface EngineAdapter {
|
|
|
944
1069
|
declare function getEngineAdapter(engine: ProfileEngine | undefined): EngineAdapter;
|
|
945
1070
|
//#endregion
|
|
946
1071
|
//#region src/engines/claude/adapter.d.ts
|
|
947
|
-
declare const claudeAdapter: EngineAdapter
|
|
1072
|
+
declare const claudeAdapter: EngineAdapter<SessionRunnerConfig>;
|
|
948
1073
|
//#endregion
|
|
949
1074
|
//#region src/engines/claude/catalog.d.ts
|
|
950
1075
|
declare const CLAUDE_CATALOG: ModelCatalog;
|
|
@@ -1115,63 +1240,45 @@ type AppServerConnectOptions = {
|
|
|
1115
1240
|
};
|
|
1116
1241
|
type AppServerConnectFn = (options: AppServerConnectOptions) => AppServerConnection;
|
|
1117
1242
|
//#endregion
|
|
1118
|
-
//#region src/engines/codex/adapter.d.ts
|
|
1119
|
-
declare function resolveBundledCodexExecutable(): string | undefined;
|
|
1120
|
-
declare function listCodexSessions(options: {
|
|
1121
|
-
connectFn: AppServerConnectFn;
|
|
1122
|
-
profile?: ProfileInfo;
|
|
1123
|
-
env: Record<string, string | undefined>;
|
|
1124
|
-
dir?: string;
|
|
1125
|
-
limit?: number;
|
|
1126
|
-
offset?: number;
|
|
1127
|
-
}): Promise<SdkSessionSummary[]>;
|
|
1128
|
-
declare const codexAdapter: EngineAdapter;
|
|
1129
|
-
//#endregion
|
|
1130
|
-
//#region src/engines/codex/catalog.d.ts
|
|
1131
|
-
declare const CODEX_CATALOG: ModelCatalog;
|
|
1132
|
-
//#endregion
|
|
1133
1243
|
//#region src/engines/codex/runner.d.ts
|
|
1134
|
-
type CodexRunnerConfig =
|
|
1135
|
-
epoch?: number;
|
|
1244
|
+
type CodexRunnerConfig = EngineRunnerConfig & {
|
|
1136
1245
|
connectFn: AppServerConnectFn;
|
|
1137
|
-
env?: Record<string, string | undefined>;
|
|
1138
1246
|
codexHome?: string;
|
|
1139
1247
|
codexPathOverride?: string;
|
|
1140
|
-
instructions?: SessionInstructions;
|
|
1141
|
-
defaultApprovalTimeoutMs?: number | null;
|
|
1142
1248
|
backfillHistory?: boolean;
|
|
1143
|
-
peers?: PeerDirectory;
|
|
1144
|
-
shells?: ShellDirectory;
|
|
1145
|
-
shellAgentWrite?: ShellAgentWrite;
|
|
1146
1249
|
};
|
|
1147
|
-
declare class CodexRunner implements Runner {
|
|
1250
|
+
declare class CodexRunner extends EngineRunner<CodexRunnerConfig> implements Runner {
|
|
1148
1251
|
#private;
|
|
1149
|
-
readonly id: string;
|
|
1150
|
-
readonly createdAt: number;
|
|
1151
1252
|
constructor(config: CodexRunnerConfig, id?: string);
|
|
1152
|
-
|
|
1253
|
+
protected coreHooks(): RunnerCoreHooks;
|
|
1153
1254
|
get sdkSessionId(): string | undefined;
|
|
1154
|
-
get lastSeq(): number;
|
|
1155
|
-
get pendingApprovals(): PermissionRequest[];
|
|
1156
1255
|
info(): SessionInfo;
|
|
1157
|
-
setTitle(title: string | undefined): void;
|
|
1158
|
-
carryCost(state: CostLedgerState): void;
|
|
1159
|
-
costState(): CostLedgerState;
|
|
1160
1256
|
start(): Promise<void>;
|
|
1161
1257
|
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
1162
|
-
queueLocalCommand(input: LocalCommandResult | LocalShellSource): void;
|
|
1163
|
-
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
1164
1258
|
interrupt(): Promise<void>;
|
|
1165
1259
|
clearContext(): Promise<void>;
|
|
1166
1260
|
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
1167
1261
|
setModel(model?: string): Promise<void>;
|
|
1168
|
-
|
|
1169
|
-
close(reason?: 'client' | 'server' | 'error'): void;
|
|
1170
|
-
eventAt(seq: number): SessionEvent | undefined;
|
|
1171
|
-
subscribe(listener: SessionEventListener, afterSeq?: number, options?: SubscribeOptions): () => void;
|
|
1262
|
+
close(reason?: CloseReason): void;
|
|
1172
1263
|
mcpServers(): Promise<McpServerStatusInfo[] | undefined>;
|
|
1173
1264
|
}
|
|
1174
1265
|
//#endregion
|
|
1266
|
+
//#region src/engines/codex/adapter.d.ts
|
|
1267
|
+
declare function resolveBundledCodexExecutable(): string | undefined;
|
|
1268
|
+
declare function listCodexSessions(options: {
|
|
1269
|
+
connectFn: AppServerConnectFn;
|
|
1270
|
+
profile?: ProfileInfo;
|
|
1271
|
+
env: Record<string, string | undefined>;
|
|
1272
|
+
dir?: string;
|
|
1273
|
+
limit?: number;
|
|
1274
|
+
offset?: number;
|
|
1275
|
+
}): Promise<SdkSessionSummary[]>;
|
|
1276
|
+
type CodexAdapterConfig = Omit<CodexRunnerConfig, 'connectFn'>;
|
|
1277
|
+
declare const codexAdapter: EngineAdapter<CodexAdapterConfig>;
|
|
1278
|
+
//#endregion
|
|
1279
|
+
//#region src/engines/codex/catalog.d.ts
|
|
1280
|
+
declare const CODEX_CATALOG: ModelCatalog;
|
|
1281
|
+
//#endregion
|
|
1175
1282
|
//#region src/engines/codex/process.d.ts
|
|
1176
1283
|
declare function connectAppServer(options: {
|
|
1177
1284
|
executable: string;
|
|
@@ -1199,5 +1306,5 @@ declare class JsonRpcStdioConnection {
|
|
|
1199
1306
|
//#region src/engines/provider/adapter.d.ts
|
|
1200
1307
|
declare const providerAdapter: EngineAdapter;
|
|
1201
1308
|
//#endregion
|
|
1202
|
-
export { AiSdkRunner, type AiSdkRunnerConfig, type AiSdkSessionState, type AppServerConnectFn, type AppServerConnectOptions, type AppServerConnection, type AppServerHistoryTurn, type AppServerItem, type AppServerThreadListResponse, type AppServerThreadSummary, type AppServerTokenUsage, type AppServerTurn, type AppServerUserInput, type AttachmentInput, type AttachmentKind, type BridgeAnswer, BrowserBridgeExecutor, type BrowserBridgeExecutorOptions, CLAUDE_CATALOG, CODEX_CATALOG, type ClaudeAuthProbe, type ClaudeAuthStatus, CodexRunner, type CodexRunnerConfig, type CostFigures, CostLedger, type CostLedgerState, type DeferredDispatch, DeferredExecutor, type DeferredExecutorOptions, type EngineAdapter, type EngineAvailability, type EngineRunnerRequest, type EngineSessionOptions, type HeadTail, type HeadTailOptions, type HistoryFn, type HostFetch, type HostToolDefinition, InputQueue, type InstructionsContext, JsonRpcError, JsonRpcStdioConnection, type LanguageModel, type LocalCommandEmit, type LocalCommandEvent, LocalCommandQueue, type LocalCommandResult, type LocalShellSource, type McpConnection, type ModelCatalog, PEER_MCP_SERVER, PEER_MESSAGE_MAX_CHARS, PEER_RECENT_DEFAULT, PEER_RECENT_MAX, PEER_TOOL_NAMES, type ParkedExecution, type PeerDirectory, type PeerMention, type PeerPeek, type PeerSendOptions, type PeerSendResult, type PeerSessionSummary, type PeerToolName, type PeerToolSpec, type PendingEntry, type PendingKind, type PendingOutcome, PendingRequestRegistry, type PendingToolCall, type PermissionDecision, type QueryFn, QuickJsExecutor, type QuickJsExecutorOptions, type RegisterOptions, type Runner, type RunnerSnapshot, SHELL_KEYS_MAX, SHELL_KEY_NAMES, SHELL_READ_TOOL_NAMES, SHELL_REFUSAL, SHELL_TOOL_NAMES, SHELL_TOOL_SHAPES, SHELL_WRITE_REFUSAL, SHELL_WRITE_TOOL_NAMES, SUPPORTED_ATTACHMENT_TYPES, type SendMessageOptions, type SessionEventListener, type SessionInstructions, SessionRunner, type SessionRunnerConfig, type SettledBy, type ShellAgentWrite, type ShellContextOptions, type ShellDirectory, type ShellKeyOptions, type ShellKillResult, type ShellReadOptions, type ShellReadResult, type ShellRunOptions, type ShellSummary, type ShellToolName, type ShellToolOptions, type ShellToolOutput, type ShellToolSpec, type ShellView, type ShellWait, type ShellWriteOptions, TTY_REDRAW_CARRY, type Tool, type ToolCallOutput, type ToolContext, type ToolContextOptions, type ToolDefinition, type ToolExecutionCall, type ToolExecutionDispatch, type ToolExecutionResult, type ToolExecutor, type ToolSet, type ToolTrust, type WebFetchDigest, type WebFetchFn, type WebFetchOptions, type WebFetchResult, agentMayWrite, attachmentContentBlocks, attachmentKind, attachmentRef, checkClaudeAuth, clampShellTail, claudeAdapter, codexAdapter, composeInstructions, connectAppServer, connectMcpTools, countLines, createEngineSession, createToolContext, createWebFetch, encodeShellKey, encodeShellKeys, getEngineAdapter, headTail, htmlToMarkdown, installPeerDirectory, installShellDirectory, installedPeerDirectory, installedShellDirectory, isHostAllowed, isLocalShellSource, isPrivateAddress, isShellToolName, isShellWriteToolName, isSlashCommand, listCodexSessions, localCommandContext, localCommandEvent, localCommandTranscript, mcpStatusInfo, modelOptionsFromSdk, normalizeMediaType, normalizeSdkMessage, peerDirectoryHandle, peerMentionsEnvelope, peerMessageEnvelope, peerSummary, peerToolSpecs, providerAdapter, recentLines, replaySlice, resolveBundledClaudeExecutable, resolveBundledCodexExecutable, resolveInstructions, runPeerTool, runShellTool, shellContextText, shellDirectoryHandle, shellInlineText, shellKillText, shellOwnershipRefusal, shellReadText, shellSummary, shellTail, shellToolNames, shellToolNeedsCard, shellToolOf, shellToolSpecs, shellWriteDeniedText, shellWriteToolOf, splitLines, toApiMessage, toExecutionResult, truncateResultBlocks, ttyRedraws, ttyText, withHostTools, withMcpTools, withPeerContext };
|
|
1309
|
+
export { AiSdkRunner, type AiSdkRunnerConfig, type AiSdkSessionState, type AppServerConnectFn, type AppServerConnectOptions, type AppServerConnection, type AppServerHistoryTurn, type AppServerItem, type AppServerThreadListResponse, type AppServerThreadSummary, type AppServerTokenUsage, type AppServerTurn, type AppServerUserInput, type AttachmentInput, type AttachmentKind, type BridgeAnswer, BrowserBridgeExecutor, type BrowserBridgeExecutorOptions, CLAUDE_CATALOG, CODEX_CATALOG, type ClaudeAuthProbe, type ClaudeAuthStatus, type CodexAdapterConfig, CodexRunner, type CodexRunnerConfig, type CostFigures, CostLedger, type CostLedgerState, type DeferredDispatch, DeferredExecutor, type DeferredExecutorOptions, type EngineAdapter, type EngineAvailability, type EngineRunnerConfig, type EngineRunnerRequest, type EngineSessionOptions, GATEWAY_SECRET_ENV_KEYS, type HeadTail, type HeadTailOptions, type HistoryFn, type HostFetch, type HostToolDefinition, InputQueue, type InstructionsContext, JsonRpcError, JsonRpcStdioConnection, type LanguageModel, type LocalCommandEmit, type LocalCommandEvent, LocalCommandQueue, type LocalCommandResult, type LocalShellSource, type McpConnection, type ModelCatalog, PEER_MCP_SERVER, PEER_MESSAGE_MAX_CHARS, PEER_RECENT_DEFAULT, PEER_RECENT_MAX, PEER_TOOL_NAMES, type ParkedExecution, type PeerDirectory, type PeerMention, type PeerPeek, type PeerSendOptions, type PeerSendResult, type PeerSessionSummary, type PeerToolName, type PeerToolSpec, type PendingEntry, type PendingKind, type PendingOutcome, PendingRequestRegistry, type PendingToolCall, type PermissionDecision, type QueryFn, QuickJsExecutor, type QuickJsExecutorOptions, type RegisterOptions, type Runner, type RunnerSnapshot, SHELL_KEYS_MAX, SHELL_KEY_NAMES, SHELL_READ_TOOL_NAMES, SHELL_REFUSAL, SHELL_TOOL_NAMES, SHELL_TOOL_SHAPES, SHELL_WRITE_REFUSAL, SHELL_WRITE_TOOL_NAMES, SUPPORTED_ATTACHMENT_TYPES, type SendMessageOptions, type SessionEventListener, type SessionInstructions, SessionRunner, type SessionRunnerConfig, type SettledBy, type ShellAgentWrite, type ShellContextOptions, type ShellDirectory, type ShellKeyOptions, type ShellKillResult, type ShellReadOptions, type ShellReadResult, type ShellRunOptions, type ShellSummary, type ShellToolName, type ShellToolOptions, type ShellToolOutput, type ShellToolSpec, type ShellView, type ShellWait, type ShellWriteOptions, TTY_REDRAW_CARRY, type Tool, type ToolCallOutput, type ToolContext, type ToolContextOptions, type ToolDefinition, type ToolExecutionCall, type ToolExecutionDispatch, type ToolExecutionResult, type ToolExecutor, type ToolSet, type ToolTrust, type WebFetchDigest, type WebFetchFn, type WebFetchOptions, type WebFetchResult, agentMayWrite, attachmentContentBlocks, attachmentKind, attachmentRef, checkClaudeAuth, clampShellTail, claudeAdapter, codexAdapter, composeInstructions, connectAppServer, connectMcpTools, countLines, createEngineSession, createToolContext, createWebFetch, encodeShellKey, encodeShellKeys, getEngineAdapter, headTail, htmlToMarkdown, installPeerDirectory, installShellDirectory, installedPeerDirectory, installedShellDirectory, isHostAllowed, isLocalShellSource, isPrivateAddress, isShellToolName, isShellWriteToolName, isSlashCommand, listCodexSessions, localCommandContext, localCommandEvent, localCommandTranscript, mcpStatusInfo, modelOptionsFromSdk, normalizeMediaType, normalizeSdkMessage, peerDirectoryHandle, peerMentionsEnvelope, peerMessageEnvelope, peerSummary, peerToolSpecs, providerAdapter, recentLines, replaySlice, resolveBundledClaudeExecutable, resolveBundledCodexExecutable, resolveInstructions, runPeerTool, runShellTool, shellContextText, shellDirectoryHandle, shellInlineText, shellKillText, shellOwnershipRefusal, shellReadText, shellSummary, shellTail, shellToolNames, shellToolNeedsCard, shellToolOf, shellToolSpecs, shellWriteDeniedText, shellWriteToolOf, splitLines, toApiMessage, toExecutionResult, truncateResultBlocks, ttyRedraws, ttyText, withHostTools, withMcpTools, withPeerContext, withoutGatewaySecrets };
|
|
1203
1310
|
//# sourceMappingURL=index.d.mts.map
|