@workerdeck/core 2.15.0 → 3.1.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 +406 -199
- package/build/index.mjs +3185 -2712
- package/build/index.mjs.map +1 -1
- package/package.json +4 -7
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,7 +184,164 @@ 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;
|
|
187
|
+
declare function peerDirectoryHandle(own?: () => PeerDirectory | undefined): PeerDirectory;
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/lib/shells.d.ts
|
|
190
|
+
type ShellSummary = {
|
|
191
|
+
id: string;
|
|
192
|
+
ordinal: number;
|
|
193
|
+
command: string;
|
|
194
|
+
label: string;
|
|
195
|
+
cwd: string;
|
|
196
|
+
owner: ShellOwner;
|
|
197
|
+
status: ShellStatus;
|
|
198
|
+
startedAt: number;
|
|
199
|
+
endedAt?: number;
|
|
200
|
+
exitCode?: number;
|
|
201
|
+
endReason?: ShellEndReason;
|
|
202
|
+
bytes: number;
|
|
203
|
+
capped?: boolean;
|
|
204
|
+
interactive?: boolean;
|
|
205
|
+
agentWrite?: boolean;
|
|
206
|
+
};
|
|
207
|
+
type ShellView = 'lines' | 'screen';
|
|
208
|
+
type ShellWait = {
|
|
209
|
+
outcome: 'matched' | 'timeout' | 'exited';
|
|
210
|
+
match?: string;
|
|
211
|
+
ms: number;
|
|
212
|
+
};
|
|
213
|
+
type ShellReadResult = {
|
|
214
|
+
shell: ShellSummary;
|
|
215
|
+
view: ShellView;
|
|
216
|
+
text: string;
|
|
217
|
+
lines: number;
|
|
218
|
+
totalLines: number;
|
|
219
|
+
truncated: boolean;
|
|
220
|
+
wait?: ShellWait;
|
|
221
|
+
};
|
|
222
|
+
type ShellReadOptions = {
|
|
223
|
+
tail?: number;
|
|
224
|
+
view?: ShellView;
|
|
225
|
+
waitFor?: string[];
|
|
226
|
+
timeoutMs?: number;
|
|
227
|
+
};
|
|
228
|
+
type ShellRunOptions = {
|
|
229
|
+
command: string;
|
|
230
|
+
waitFor?: string[];
|
|
231
|
+
timeoutMs?: number;
|
|
232
|
+
};
|
|
233
|
+
type ShellWriteOptions = {
|
|
234
|
+
data?: string;
|
|
235
|
+
keys?: string[];
|
|
236
|
+
waitFor?: string[];
|
|
237
|
+
timeoutMs?: number;
|
|
238
|
+
};
|
|
239
|
+
type ShellKillResult = {
|
|
240
|
+
shell: ShellSummary;
|
|
241
|
+
killed: boolean;
|
|
242
|
+
};
|
|
243
|
+
type ShellAgentWrite = 'gated' | 'allow';
|
|
244
|
+
type ShellKeyOptions = {
|
|
245
|
+
applicationCursorKeys?: boolean;
|
|
246
|
+
};
|
|
247
|
+
interface ShellDirectory {
|
|
248
|
+
list(from: string): Promise<ShellSummary[]>;
|
|
249
|
+
read(from: string, shellId: string, options?: ShellReadOptions): Promise<ShellReadResult | undefined>;
|
|
250
|
+
run(from: string, options: ShellRunOptions): Promise<ShellReadResult>;
|
|
251
|
+
write(from: string, shellId: string, options: ShellWriteOptions): Promise<ShellReadResult | undefined>;
|
|
252
|
+
kill(from: string, shellId: string): Promise<ShellKillResult | undefined>;
|
|
253
|
+
grant(from: string, shellId: string): Promise<ShellSummary | undefined>;
|
|
254
|
+
}
|
|
255
|
+
declare const SHELL_REFUSAL = "shell commands are not available on this session";
|
|
256
|
+
declare const SHELL_WRITE_REFUSAL = "the agent may not start, type into or kill shells on this session (shell.agentWrite is read-only)";
|
|
257
|
+
declare const SHELL_KEYS_MAX = 64;
|
|
258
|
+
declare const SHELL_KEY_NAMES: readonly string[];
|
|
259
|
+
declare const SHELL_TOOL_SHAPES: {
|
|
260
|
+
readonly shell_list: {
|
|
261
|
+
readonly description: string;
|
|
262
|
+
readonly shape: {};
|
|
263
|
+
};
|
|
264
|
+
readonly shell_read: {
|
|
265
|
+
readonly description: string;
|
|
266
|
+
readonly shape: {
|
|
267
|
+
readonly shellId: z.ZodString;
|
|
268
|
+
readonly view: z.ZodOptional<z.ZodEnum<{
|
|
269
|
+
lines: "lines";
|
|
270
|
+
screen: "screen";
|
|
271
|
+
}>>;
|
|
272
|
+
readonly tail: z.ZodOptional<z.ZodNumber>;
|
|
273
|
+
readonly waitFor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
274
|
+
readonly timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
readonly shell_run: {
|
|
278
|
+
readonly description: string;
|
|
279
|
+
readonly shape: {
|
|
280
|
+
readonly command: z.ZodString;
|
|
281
|
+
readonly waitFor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
282
|
+
readonly timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
readonly shell_write: {
|
|
286
|
+
readonly description: string;
|
|
287
|
+
readonly shape: {
|
|
288
|
+
readonly shellId: z.ZodString;
|
|
289
|
+
readonly data: z.ZodOptional<z.ZodString>;
|
|
290
|
+
readonly keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
291
|
+
readonly waitFor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
292
|
+
readonly timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
readonly shell_kill: {
|
|
296
|
+
readonly description: string;
|
|
297
|
+
readonly shape: {
|
|
298
|
+
readonly shellId: z.ZodString;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
readonly shell_request_write: {
|
|
302
|
+
readonly description: string;
|
|
303
|
+
readonly shape: {
|
|
304
|
+
readonly shellId: z.ZodString;
|
|
305
|
+
readonly reason: z.ZodString;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
type ShellToolName = keyof typeof SHELL_TOOL_SHAPES;
|
|
310
|
+
declare const SHELL_READ_TOOL_NAMES: readonly ShellToolName[];
|
|
311
|
+
declare const SHELL_WRITE_TOOL_NAMES: readonly ShellToolName[];
|
|
312
|
+
type ShellToolSpec = GatewayToolSpec<ShellToolName>;
|
|
313
|
+
type ShellToolOutput = GatewayToolOutput;
|
|
314
|
+
type ShellToolOptions = {
|
|
315
|
+
write?: boolean;
|
|
316
|
+
};
|
|
317
|
+
declare const SHELL_TOOL_NAMES: ("shell_list" | "shell_read" | "shell_run" | "shell_write" | "shell_kill" | "shell_request_write")[];
|
|
318
|
+
declare function shellToolNames(write: boolean): ShellToolName[];
|
|
319
|
+
declare function shellToolSpecs(write?: boolean): ShellToolSpec[];
|
|
320
|
+
declare function isShellToolName(name: string): name is ShellToolName;
|
|
321
|
+
declare function isShellWriteToolName(name: string): boolean;
|
|
322
|
+
declare function shellWriteToolOf(toolName: string): ShellToolName | undefined;
|
|
323
|
+
declare function shellToolOf(toolName: string): ShellToolName | undefined;
|
|
324
|
+
declare function shellToolNeedsCard(toolName: string, agentWrite: ShellAgentWrite | undefined): boolean;
|
|
325
|
+
declare function clampShellTail(tail: number | undefined): number;
|
|
326
|
+
declare function agentMayWrite(shell: Pick<ShellInfo, 'sessionId' | 'owner' | 'agentWrite'>, from: string): boolean;
|
|
327
|
+
declare function shellOwnershipRefusal(shellId: string): string;
|
|
328
|
+
declare function shellWriteDeniedText(name: string, message: string | undefined): string;
|
|
329
|
+
declare function encodeShellKey(key: string, options?: ShellKeyOptions): string | undefined;
|
|
330
|
+
declare function encodeShellKeys(keys: readonly string[], options?: ShellKeyOptions): string;
|
|
331
|
+
declare function shellSummary(info: ShellInfo): ShellSummary;
|
|
332
|
+
declare function shellTail(text: string, tail: number): {
|
|
333
|
+
view: 'lines';
|
|
334
|
+
text: string;
|
|
335
|
+
lines: number;
|
|
336
|
+
totalLines: number;
|
|
337
|
+
truncated: boolean;
|
|
338
|
+
};
|
|
339
|
+
declare function runShellTool(shells: ShellDirectory, from: string, name: string, args: unknown, options?: ShellToolOptions): Promise<ShellToolOutput>;
|
|
340
|
+
declare function shellReadText(result: ShellReadResult, verb?: 'started' | 'typed'): string;
|
|
341
|
+
declare function shellKillText(result: ShellKillResult): string;
|
|
342
|
+
declare function installShellDirectory(directory: ShellDirectory | undefined): void;
|
|
343
|
+
declare function installedShellDirectory(): ShellDirectory | undefined;
|
|
344
|
+
declare function shellDirectoryHandle(own?: () => ShellDirectory | undefined): ShellDirectory;
|
|
173
345
|
//#endregion
|
|
174
346
|
//#region src/executors/tool-executor.d.ts
|
|
175
347
|
type ToolExecutionResult = {
|
|
@@ -214,6 +386,18 @@ interface ToolExecutor {
|
|
|
214
386
|
//#endregion
|
|
215
387
|
//#region src/runner-interface.d.ts
|
|
216
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
|
+
};
|
|
217
401
|
type ParkedExecution = {
|
|
218
402
|
executionId: string;
|
|
219
403
|
toolName: string;
|
|
@@ -262,6 +446,7 @@ interface Runner {
|
|
|
262
446
|
setTitle(title: string | undefined): void;
|
|
263
447
|
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
264
448
|
interrupt(): Promise<void>;
|
|
449
|
+
stopTask?(toolUseId: string): Promise<boolean>;
|
|
265
450
|
clearContext?(): Promise<void>;
|
|
266
451
|
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
267
452
|
setModel(model?: string): Promise<void>;
|
|
@@ -274,6 +459,22 @@ interface Runner {
|
|
|
274
459
|
close(reason?: 'client' | 'server' | 'error'): void;
|
|
275
460
|
}
|
|
276
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
|
|
277
478
|
//#region src/lib/subscribers.d.ts
|
|
278
479
|
type SubscribeOptions = {
|
|
279
480
|
coalesceReplay?: boolean;
|
|
@@ -281,86 +482,132 @@ type SubscribeOptions = {
|
|
|
281
482
|
imageRefs?: boolean;
|
|
282
483
|
};
|
|
283
484
|
//#endregion
|
|
284
|
-
//#region src/lib/
|
|
285
|
-
type
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
owner: ShellOwner;
|
|
302
|
-
status: ShellStatus;
|
|
303
|
-
startedAt: number;
|
|
304
|
-
endedAt?: number;
|
|
305
|
-
exitCode?: number;
|
|
306
|
-
endReason?: ShellEndReason;
|
|
307
|
-
bytes: number;
|
|
308
|
-
capped?: boolean;
|
|
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;
|
|
309
502
|
};
|
|
310
|
-
type
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
truncated: boolean;
|
|
503
|
+
type ApprovalHandler = {
|
|
504
|
+
timeoutMs?: number;
|
|
505
|
+
wireId?: string | number;
|
|
506
|
+
respond: (decision: PermissionDecision, resolvedBy: PermissionDecisionSource) => ApprovalResolution;
|
|
507
|
+
after?: (resolution: ApprovalResolution, decision: PermissionDecision) => void;
|
|
316
508
|
};
|
|
317
|
-
type
|
|
318
|
-
|
|
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;
|
|
319
521
|
};
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
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;
|
|
323
551
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
readonly shell_read: {
|
|
331
|
-
readonly description: string;
|
|
332
|
-
readonly shape: {
|
|
333
|
-
readonly shellId: z.ZodString;
|
|
334
|
-
readonly tail: z.ZodOptional<z.ZodNumber>;
|
|
335
|
-
};
|
|
336
|
-
};
|
|
337
|
-
};
|
|
338
|
-
type ShellToolName = keyof typeof SHELL_TOOL_SHAPES;
|
|
339
|
-
declare const SHELL_TOOL_NAMES: ShellToolName[];
|
|
340
|
-
type ShellToolSpec = {
|
|
341
|
-
name: ShellToolName;
|
|
342
|
-
description: string;
|
|
343
|
-
inputSchema: Record<string, unknown>;
|
|
344
|
-
};
|
|
345
|
-
type ShellToolOutput = {
|
|
346
|
-
text: string;
|
|
347
|
-
isError: boolean;
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region src/lib/session-tools.d.ts
|
|
554
|
+
type SessionToolSources = {
|
|
555
|
+
peers?: PeerDirectory;
|
|
556
|
+
shells?: ShellDirectory;
|
|
557
|
+
write: boolean;
|
|
348
558
|
};
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
lines: number;
|
|
356
|
-
totalLines: number;
|
|
357
|
-
truncated: boolean;
|
|
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;
|
|
358
565
|
};
|
|
359
|
-
declare
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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
|
+
}
|
|
364
611
|
//#endregion
|
|
365
612
|
//#region src/engines/claude/runner.d.ts
|
|
366
613
|
type QueryFn = (params: {
|
|
@@ -373,49 +620,32 @@ type HistoryFn = (sdkSessionId: string, options: {
|
|
|
373
620
|
type SessionInfoFn = (sdkSessionId: string, options: {
|
|
374
621
|
dir?: string;
|
|
375
622
|
}) => Promise<SDKSessionInfo | undefined>;
|
|
376
|
-
type SessionRunnerConfig =
|
|
377
|
-
epoch?: number;
|
|
623
|
+
type SessionRunnerConfig = EngineRunnerConfig & {
|
|
378
624
|
queryFn?: QueryFn;
|
|
379
|
-
env?: Record<string, string | undefined>;
|
|
380
625
|
pathToClaudeCodeExecutable?: string;
|
|
381
626
|
extraOptions?: Partial<Options>;
|
|
382
|
-
instructions?: SessionInstructions;
|
|
383
|
-
defaultApprovalTimeoutMs?: number | null;
|
|
384
627
|
backfillHistory?: boolean;
|
|
385
628
|
historyFn?: HistoryFn;
|
|
386
629
|
sessionInfoFn?: SessionInfoFn;
|
|
387
|
-
peers?: PeerDirectory;
|
|
388
|
-
shells?: ShellDirectory;
|
|
389
630
|
};
|
|
390
|
-
declare class SessionRunner implements Runner {
|
|
631
|
+
declare class SessionRunner extends EngineRunner<SessionRunnerConfig> implements Runner {
|
|
391
632
|
#private;
|
|
392
|
-
readonly id: string;
|
|
393
|
-
readonly createdAt: number;
|
|
394
633
|
constructor(config: SessionRunnerConfig, id?: string);
|
|
395
|
-
|
|
634
|
+
protected coreHooks(): RunnerCoreHooks;
|
|
396
635
|
get sdkSessionId(): string | undefined;
|
|
397
|
-
get lastSeq(): number;
|
|
398
636
|
get apiKeySource(): string | undefined;
|
|
399
|
-
get pendingApprovals(): PermissionRequest[];
|
|
400
637
|
info(): SessionInfo;
|
|
401
|
-
setTitle(title: string | undefined): void;
|
|
402
|
-
carryCost(state: CostLedgerState): void;
|
|
403
|
-
costState(): CostLedgerState;
|
|
404
638
|
start(): Promise<void>;
|
|
405
639
|
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
406
|
-
queueLocalCommand(input: LocalCommandResult | LocalShellSource): void;
|
|
407
640
|
mcpServers(): Promise<McpServerStatusInfo[] | undefined>;
|
|
408
641
|
reconnectMcpServer(name: string): Promise<void>;
|
|
409
642
|
setMcpServerEnabled(name: string, enabled: boolean): Promise<void>;
|
|
410
|
-
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
411
643
|
interrupt(): Promise<void>;
|
|
644
|
+
stopTask(toolUseId: string): Promise<boolean>;
|
|
412
645
|
clearContext(): Promise<void>;
|
|
413
646
|
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
414
647
|
setModel(model?: string): Promise<void>;
|
|
415
|
-
|
|
416
|
-
close(reason?: 'client' | 'server' | 'error'): void;
|
|
417
|
-
eventAt(seq: number): SessionEvent | undefined;
|
|
418
|
-
subscribe(listener: SessionEventListener, afterSeq?: number, options?: SubscribeOptions): () => void;
|
|
648
|
+
close(reason?: CloseReason): void;
|
|
419
649
|
refreshUsage(minIntervalMs?: number): Promise<void>;
|
|
420
650
|
}
|
|
421
651
|
//#endregion
|
|
@@ -429,13 +659,19 @@ declare function replaySlice(events: readonly SessionEvent[], options: {
|
|
|
429
659
|
}): SessionEvent[];
|
|
430
660
|
declare function truncateResultBlocks(event: SessionEvent): SessionEvent;
|
|
431
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
|
|
432
671
|
//#region src/engines/provider/runner.d.ts
|
|
433
|
-
type AiSdkRunnerConfig =
|
|
434
|
-
epoch?: number;
|
|
435
|
-
cwd?: string;
|
|
672
|
+
type AiSdkRunnerConfig = EngineRunnerConfig & {
|
|
436
673
|
languageModel: LanguageModel$1;
|
|
437
674
|
tools?: ToolSet$1;
|
|
438
|
-
instructions?: SessionInstructions;
|
|
439
675
|
maxSteps?: number;
|
|
440
676
|
executor?: ToolExecutor;
|
|
441
677
|
executableTools?: string[];
|
|
@@ -450,13 +686,10 @@ type AiSdkRunnerConfig = Omit<CreateSessionRequest, 'cwd'> & {
|
|
|
450
686
|
toolName: string;
|
|
451
687
|
input: unknown;
|
|
452
688
|
}) => boolean;
|
|
453
|
-
defaultApprovalTimeoutMs?: number | null;
|
|
454
689
|
resolveModel?: (modelId: string | undefined) => LanguageModel$1;
|
|
455
690
|
reportMcpServers?: () => Promise<McpServerStatusInfo[] | undefined>;
|
|
456
691
|
onClose?: () => void | Promise<void>;
|
|
457
692
|
restore?: RunnerSnapshot;
|
|
458
|
-
peers?: PeerDirectory;
|
|
459
|
-
shells?: ShellDirectory;
|
|
460
693
|
};
|
|
461
694
|
type PendingToolCall = {
|
|
462
695
|
toolCallId: string;
|
|
@@ -470,13 +703,7 @@ type AiSdkSessionState = {
|
|
|
470
703
|
pendingToolCalls: PendingToolCall[];
|
|
471
704
|
dispatched: string[];
|
|
472
705
|
numTurns: number;
|
|
473
|
-
turnAccum?:
|
|
474
|
-
startedAt: number;
|
|
475
|
-
input: number;
|
|
476
|
-
output: number;
|
|
477
|
-
cacheWrite: number;
|
|
478
|
-
cacheRead: number;
|
|
479
|
-
};
|
|
706
|
+
turnAccum?: TurnUsage;
|
|
480
707
|
permissionMode: PermissionMode;
|
|
481
708
|
model?: string;
|
|
482
709
|
lastActivityAt?: number;
|
|
@@ -490,29 +717,21 @@ type ToolCallOutput = {
|
|
|
490
717
|
type: 'json';
|
|
491
718
|
value: unknown;
|
|
492
719
|
};
|
|
493
|
-
declare class AiSdkRunner implements Runner {
|
|
720
|
+
declare class AiSdkRunner extends EngineRunner<AiSdkRunnerConfig> implements Runner {
|
|
494
721
|
#private;
|
|
495
|
-
readonly id: string;
|
|
496
|
-
readonly createdAt: number;
|
|
497
722
|
constructor(config: AiSdkRunnerConfig, id?: string);
|
|
498
|
-
get status(): SessionStatus;
|
|
499
|
-
get lastSeq(): number;
|
|
500
723
|
get messages(): ModelMessage[];
|
|
501
724
|
get pendingToolCalls(): PendingToolCall[];
|
|
502
|
-
get pendingApprovals(): PermissionRequest[];
|
|
503
725
|
get vfs(): SandboxVfs | undefined;
|
|
504
726
|
info(): SessionInfo;
|
|
505
|
-
carryCost(state: CostLedgerState): void;
|
|
506
|
-
costState(): CostLedgerState;
|
|
507
727
|
start(): Promise<void>;
|
|
508
728
|
park(): RunnerSnapshot | undefined;
|
|
509
729
|
snapshot(): RunnerSnapshot | undefined;
|
|
510
730
|
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
511
|
-
|
|
731
|
+
protected assertAccepting(): void;
|
|
512
732
|
resolveToolCall(toolCallId: string, output: ToolCallOutput, options?: {
|
|
513
733
|
isError?: boolean;
|
|
514
734
|
}): boolean;
|
|
515
|
-
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
516
735
|
emitFileDelivered(file: {
|
|
517
736
|
path: string;
|
|
518
737
|
bytes: number;
|
|
@@ -523,13 +742,9 @@ declare class AiSdkRunner implements Runner {
|
|
|
523
742
|
interrupt(): Promise<void>;
|
|
524
743
|
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
525
744
|
setModel(model?: string): Promise<void>;
|
|
526
|
-
|
|
527
|
-
close(reason?: 'client' | 'server' | 'error'): void;
|
|
528
|
-
eventAt(seq: number): SessionEvent | undefined;
|
|
529
|
-
subscribe(listener: SessionEventListener, afterSeq?: number, options?: SubscribeOptions): () => void;
|
|
745
|
+
close(reason?: CloseReason): void;
|
|
530
746
|
settleExecution(executionId: string, result: ToolExecutionResult): boolean;
|
|
531
747
|
mcpServers(): Promise<McpServerStatusInfo[] | undefined>;
|
|
532
|
-
setTitle(title: string | undefined): void;
|
|
533
748
|
}
|
|
534
749
|
//#endregion
|
|
535
750
|
//#region src/engines/claude/auth.d.ts
|
|
@@ -548,6 +763,7 @@ type QuickJsExecutorOptions = {
|
|
|
548
763
|
allowedHosts?: string[];
|
|
549
764
|
hostFetch?: HostFetch;
|
|
550
765
|
fetchTimeoutMs?: number;
|
|
766
|
+
fetchMaxBytes?: number;
|
|
551
767
|
defaultTimeoutMs?: number;
|
|
552
768
|
defaultMemoryLimitBytes?: number;
|
|
553
769
|
};
|
|
@@ -709,6 +925,7 @@ type ToolContextOptions = {
|
|
|
709
925
|
onSettle?: (executionId: string, result: ToolExecutionResult) => void;
|
|
710
926
|
peers?: PeerDirectory;
|
|
711
927
|
shells?: ShellDirectory;
|
|
928
|
+
shellWrite?: boolean;
|
|
712
929
|
selfId?: () => string;
|
|
713
930
|
};
|
|
714
931
|
type ToolContext = {
|
|
@@ -768,6 +985,10 @@ declare function connectMcpTools(servers: Record<string, McpServerConfigWire>, o
|
|
|
768
985
|
required?: boolean;
|
|
769
986
|
}): Promise<McpConnection>;
|
|
770
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
|
|
771
992
|
//#region src/lib/input-queue.d.ts
|
|
772
993
|
declare class InputQueue implements AsyncIterable<SDKUserMessage> {
|
|
773
994
|
#private;
|
|
@@ -790,7 +1011,9 @@ type HeadTail = {
|
|
|
790
1011
|
totalLines: number;
|
|
791
1012
|
totalBytes: number;
|
|
792
1013
|
};
|
|
1014
|
+
declare const TTY_REDRAW_CARRY = 16;
|
|
793
1015
|
declare function ttyText(raw: string): string;
|
|
1016
|
+
declare function ttyRedraws(raw: string): boolean;
|
|
794
1017
|
declare function splitLines(text: string): string[];
|
|
795
1018
|
declare function countLines(text: string): number;
|
|
796
1019
|
declare function headTail(text: string, opts: HeadTailOptions): HeadTail;
|
|
@@ -822,18 +1045,19 @@ type ModelCatalog = {
|
|
|
822
1045
|
models: ModelOption[];
|
|
823
1046
|
provenance: string;
|
|
824
1047
|
};
|
|
825
|
-
type EngineRunnerRequest = {
|
|
826
|
-
config:
|
|
1048
|
+
type EngineRunnerRequest<C extends EngineRunnerConfig = EngineRunnerConfig> = {
|
|
1049
|
+
config: C;
|
|
827
1050
|
profile?: ProfileInfo;
|
|
828
1051
|
restore?: RunnerSnapshot;
|
|
829
1052
|
id?: string;
|
|
830
1053
|
};
|
|
831
|
-
interface EngineAdapter {
|
|
1054
|
+
interface EngineAdapter<C extends EngineRunnerConfig = EngineRunnerConfig> {
|
|
832
1055
|
readonly engine: ProfileEngine;
|
|
833
1056
|
readonly capabilities: EngineCapabilities;
|
|
834
1057
|
readonly catalog: ModelCatalog;
|
|
835
1058
|
checkAvailability(profile: ProfileInfo, env: Record<string, string | undefined>): Promise<EngineAvailability>;
|
|
836
|
-
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>;
|
|
837
1061
|
listSessions?(options: {
|
|
838
1062
|
profile?: ProfileInfo;
|
|
839
1063
|
env: Record<string, string | undefined>;
|
|
@@ -845,7 +1069,7 @@ interface EngineAdapter {
|
|
|
845
1069
|
declare function getEngineAdapter(engine: ProfileEngine | undefined): EngineAdapter;
|
|
846
1070
|
//#endregion
|
|
847
1071
|
//#region src/engines/claude/adapter.d.ts
|
|
848
|
-
declare const claudeAdapter: EngineAdapter
|
|
1072
|
+
declare const claudeAdapter: EngineAdapter<SessionRunnerConfig>;
|
|
849
1073
|
//#endregion
|
|
850
1074
|
//#region src/engines/claude/catalog.d.ts
|
|
851
1075
|
declare const CLAUDE_CATALOG: ModelCatalog;
|
|
@@ -1016,62 +1240,45 @@ type AppServerConnectOptions = {
|
|
|
1016
1240
|
};
|
|
1017
1241
|
type AppServerConnectFn = (options: AppServerConnectOptions) => AppServerConnection;
|
|
1018
1242
|
//#endregion
|
|
1019
|
-
//#region src/engines/codex/adapter.d.ts
|
|
1020
|
-
declare function resolveBundledCodexExecutable(): string | undefined;
|
|
1021
|
-
declare function listCodexSessions(options: {
|
|
1022
|
-
connectFn: AppServerConnectFn;
|
|
1023
|
-
profile?: ProfileInfo;
|
|
1024
|
-
env: Record<string, string | undefined>;
|
|
1025
|
-
dir?: string;
|
|
1026
|
-
limit?: number;
|
|
1027
|
-
offset?: number;
|
|
1028
|
-
}): Promise<SdkSessionSummary[]>;
|
|
1029
|
-
declare const codexAdapter: EngineAdapter;
|
|
1030
|
-
//#endregion
|
|
1031
|
-
//#region src/engines/codex/catalog.d.ts
|
|
1032
|
-
declare const CODEX_CATALOG: ModelCatalog;
|
|
1033
|
-
//#endregion
|
|
1034
1243
|
//#region src/engines/codex/runner.d.ts
|
|
1035
|
-
type CodexRunnerConfig =
|
|
1036
|
-
epoch?: number;
|
|
1244
|
+
type CodexRunnerConfig = EngineRunnerConfig & {
|
|
1037
1245
|
connectFn: AppServerConnectFn;
|
|
1038
|
-
env?: Record<string, string | undefined>;
|
|
1039
1246
|
codexHome?: string;
|
|
1040
1247
|
codexPathOverride?: string;
|
|
1041
|
-
instructions?: SessionInstructions;
|
|
1042
|
-
defaultApprovalTimeoutMs?: number | null;
|
|
1043
1248
|
backfillHistory?: boolean;
|
|
1044
|
-
peers?: PeerDirectory;
|
|
1045
|
-
shells?: ShellDirectory;
|
|
1046
1249
|
};
|
|
1047
|
-
declare class CodexRunner implements Runner {
|
|
1250
|
+
declare class CodexRunner extends EngineRunner<CodexRunnerConfig> implements Runner {
|
|
1048
1251
|
#private;
|
|
1049
|
-
readonly id: string;
|
|
1050
|
-
readonly createdAt: number;
|
|
1051
1252
|
constructor(config: CodexRunnerConfig, id?: string);
|
|
1052
|
-
|
|
1253
|
+
protected coreHooks(): RunnerCoreHooks;
|
|
1053
1254
|
get sdkSessionId(): string | undefined;
|
|
1054
|
-
get lastSeq(): number;
|
|
1055
|
-
get pendingApprovals(): PermissionRequest[];
|
|
1056
1255
|
info(): SessionInfo;
|
|
1057
|
-
setTitle(title: string | undefined): void;
|
|
1058
|
-
carryCost(state: CostLedgerState): void;
|
|
1059
|
-
costState(): CostLedgerState;
|
|
1060
1256
|
start(): Promise<void>;
|
|
1061
1257
|
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
1062
|
-
queueLocalCommand(input: LocalCommandResult | LocalShellSource): void;
|
|
1063
|
-
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
1064
1258
|
interrupt(): Promise<void>;
|
|
1065
1259
|
clearContext(): Promise<void>;
|
|
1066
1260
|
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
1067
1261
|
setModel(model?: string): Promise<void>;
|
|
1068
|
-
|
|
1069
|
-
close(reason?: 'client' | 'server' | 'error'): void;
|
|
1070
|
-
eventAt(seq: number): SessionEvent | undefined;
|
|
1071
|
-
subscribe(listener: SessionEventListener, afterSeq?: number, options?: SubscribeOptions): () => void;
|
|
1262
|
+
close(reason?: CloseReason): void;
|
|
1072
1263
|
mcpServers(): Promise<McpServerStatusInfo[] | undefined>;
|
|
1073
1264
|
}
|
|
1074
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
|
|
1075
1282
|
//#region src/engines/codex/process.d.ts
|
|
1076
1283
|
declare function connectAppServer(options: {
|
|
1077
1284
|
executable: string;
|
|
@@ -1099,5 +1306,5 @@ declare class JsonRpcStdioConnection {
|
|
|
1099
1306
|
//#region src/engines/provider/adapter.d.ts
|
|
1100
1307
|
declare const providerAdapter: EngineAdapter;
|
|
1101
1308
|
//#endregion
|
|
1102
|
-
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_REFUSAL, SHELL_TOOL_NAMES, SHELL_TOOL_SHAPES, SUPPORTED_ATTACHMENT_TYPES, type SendMessageOptions, type SessionEventListener, type SessionInstructions, SessionRunner, type SessionRunnerConfig, type SettledBy, type ShellContextOptions, type ShellDirectory, type ShellReadOptions, type ShellReadResult, type ShellSummary, type ShellToolName, type ShellToolOutput, type ShellToolSpec, 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, attachmentContentBlocks, attachmentKind, attachmentRef, checkClaudeAuth, clampShellTail, claudeAdapter, codexAdapter, composeInstructions, connectAppServer, connectMcpTools, countLines, createEngineSession, createToolContext, createWebFetch, getEngineAdapter, headTail, htmlToMarkdown, installPeerDirectory, installShellDirectory, installedPeerDirectory, installedShellDirectory, isHostAllowed, isLocalShellSource, isPrivateAddress, isShellToolName, 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, shellReadText, shellSummary, shellTail, shellToolSpecs, splitLines, toApiMessage, toExecutionResult, truncateResultBlocks, 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 };
|
|
1103
1310
|
//# sourceMappingURL=index.d.mts.map
|