@workerdeck/core 2.15.0 → 3.0.1
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 +104 -4
- package/build/index.mjs +380 -24
- package/build/index.mjs.map +1 -1
- package/package.json +3 -3
package/build/index.d.mts
CHANGED
|
@@ -306,22 +306,61 @@ type ShellSummary = {
|
|
|
306
306
|
endReason?: ShellEndReason;
|
|
307
307
|
bytes: number;
|
|
308
308
|
capped?: boolean;
|
|
309
|
+
interactive?: boolean;
|
|
310
|
+
agentWrite?: boolean;
|
|
311
|
+
};
|
|
312
|
+
type ShellView = 'lines' | 'screen';
|
|
313
|
+
type ShellWait = {
|
|
314
|
+
outcome: 'matched' | 'timeout' | 'exited';
|
|
315
|
+
match?: string;
|
|
316
|
+
ms: number;
|
|
309
317
|
};
|
|
310
318
|
type ShellReadResult = {
|
|
311
319
|
shell: ShellSummary;
|
|
320
|
+
view: ShellView;
|
|
312
321
|
text: string;
|
|
313
322
|
lines: number;
|
|
314
323
|
totalLines: number;
|
|
315
324
|
truncated: boolean;
|
|
325
|
+
wait?: ShellWait;
|
|
316
326
|
};
|
|
317
327
|
type ShellReadOptions = {
|
|
318
328
|
tail?: number;
|
|
329
|
+
view?: ShellView;
|
|
330
|
+
waitFor?: string[];
|
|
331
|
+
timeoutMs?: number;
|
|
332
|
+
};
|
|
333
|
+
type ShellRunOptions = {
|
|
334
|
+
command: string;
|
|
335
|
+
waitFor?: string[];
|
|
336
|
+
timeoutMs?: number;
|
|
337
|
+
};
|
|
338
|
+
type ShellWriteOptions = {
|
|
339
|
+
data?: string;
|
|
340
|
+
keys?: string[];
|
|
341
|
+
waitFor?: string[];
|
|
342
|
+
timeoutMs?: number;
|
|
343
|
+
};
|
|
344
|
+
type ShellKillResult = {
|
|
345
|
+
shell: ShellSummary;
|
|
346
|
+
killed: boolean;
|
|
347
|
+
};
|
|
348
|
+
type ShellAgentWrite = 'gated' | 'allow';
|
|
349
|
+
type ShellKeyOptions = {
|
|
350
|
+
applicationCursorKeys?: boolean;
|
|
319
351
|
};
|
|
320
352
|
interface ShellDirectory {
|
|
321
353
|
list(from: string): Promise<ShellSummary[]>;
|
|
322
354
|
read(from: string, shellId: string, options?: ShellReadOptions): Promise<ShellReadResult | undefined>;
|
|
355
|
+
run(from: string, options: ShellRunOptions): Promise<ShellReadResult>;
|
|
356
|
+
write(from: string, shellId: string, options: ShellWriteOptions): Promise<ShellReadResult | undefined>;
|
|
357
|
+
kill(from: string, shellId: string): Promise<ShellKillResult | undefined>;
|
|
358
|
+
grant(from: string, shellId: string): Promise<ShellSummary | undefined>;
|
|
323
359
|
}
|
|
324
360
|
declare const SHELL_REFUSAL = "shell commands are not available on this session";
|
|
361
|
+
declare const SHELL_WRITE_REFUSAL = "the agent may not start, type into or kill shells on this session (shell.agentWrite is read-only)";
|
|
362
|
+
declare const SHELL_KEYS_MAX = 64;
|
|
363
|
+
declare const SHELL_KEY_NAMES: readonly string[];
|
|
325
364
|
declare const SHELL_TOOL_SHAPES: {
|
|
326
365
|
readonly shell_list: {
|
|
327
366
|
readonly description: string;
|
|
@@ -331,12 +370,51 @@ declare const SHELL_TOOL_SHAPES: {
|
|
|
331
370
|
readonly description: string;
|
|
332
371
|
readonly shape: {
|
|
333
372
|
readonly shellId: z.ZodString;
|
|
373
|
+
readonly view: z.ZodOptional<z.ZodEnum<{
|
|
374
|
+
lines: "lines";
|
|
375
|
+
screen: "screen";
|
|
376
|
+
}>>;
|
|
334
377
|
readonly tail: z.ZodOptional<z.ZodNumber>;
|
|
378
|
+
readonly waitFor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
379
|
+
readonly timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
readonly shell_run: {
|
|
383
|
+
readonly description: string;
|
|
384
|
+
readonly shape: {
|
|
385
|
+
readonly command: z.ZodString;
|
|
386
|
+
readonly waitFor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
387
|
+
readonly timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
readonly shell_write: {
|
|
391
|
+
readonly description: string;
|
|
392
|
+
readonly shape: {
|
|
393
|
+
readonly shellId: z.ZodString;
|
|
394
|
+
readonly data: z.ZodOptional<z.ZodString>;
|
|
395
|
+
readonly keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
396
|
+
readonly waitFor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
397
|
+
readonly timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
readonly shell_kill: {
|
|
401
|
+
readonly description: string;
|
|
402
|
+
readonly shape: {
|
|
403
|
+
readonly shellId: z.ZodString;
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
readonly shell_request_write: {
|
|
407
|
+
readonly description: string;
|
|
408
|
+
readonly shape: {
|
|
409
|
+
readonly shellId: z.ZodString;
|
|
410
|
+
readonly reason: z.ZodString;
|
|
335
411
|
};
|
|
336
412
|
};
|
|
337
413
|
};
|
|
338
414
|
type ShellToolName = keyof typeof SHELL_TOOL_SHAPES;
|
|
339
415
|
declare const SHELL_TOOL_NAMES: ShellToolName[];
|
|
416
|
+
declare const SHELL_READ_TOOL_NAMES: readonly ShellToolName[];
|
|
417
|
+
declare const SHELL_WRITE_TOOL_NAMES: readonly ShellToolName[];
|
|
340
418
|
type ShellToolSpec = {
|
|
341
419
|
name: ShellToolName;
|
|
342
420
|
description: string;
|
|
@@ -346,18 +424,33 @@ type ShellToolOutput = {
|
|
|
346
424
|
text: string;
|
|
347
425
|
isError: boolean;
|
|
348
426
|
};
|
|
349
|
-
|
|
427
|
+
type ShellToolOptions = {
|
|
428
|
+
write?: boolean;
|
|
429
|
+
};
|
|
430
|
+
declare function shellToolNames(write: boolean): ShellToolName[];
|
|
431
|
+
declare function shellToolSpecs(write?: boolean): ShellToolSpec[];
|
|
350
432
|
declare function isShellToolName(name: string): name is ShellToolName;
|
|
433
|
+
declare function isShellWriteToolName(name: string): boolean;
|
|
434
|
+
declare function shellWriteToolOf(toolName: string): ShellToolName | undefined;
|
|
435
|
+
declare function shellToolOf(toolName: string): ShellToolName | undefined;
|
|
436
|
+
declare function shellToolNeedsCard(toolName: string, agentWrite: ShellAgentWrite | undefined): boolean;
|
|
351
437
|
declare function clampShellTail(tail: number | undefined): number;
|
|
438
|
+
declare function agentMayWrite(shell: Pick<ShellInfo, 'sessionId' | 'owner' | 'agentWrite'>, from: string): boolean;
|
|
439
|
+
declare function shellOwnershipRefusal(shellId: string): string;
|
|
440
|
+
declare function shellWriteDeniedText(name: string, message: string | undefined): string;
|
|
441
|
+
declare function encodeShellKey(key: string, options?: ShellKeyOptions): string | undefined;
|
|
442
|
+
declare function encodeShellKeys(keys: readonly string[], options?: ShellKeyOptions): string;
|
|
352
443
|
declare function shellSummary(info: ShellInfo): ShellSummary;
|
|
353
444
|
declare function shellTail(text: string, tail: number): {
|
|
445
|
+
view: 'lines';
|
|
354
446
|
text: string;
|
|
355
447
|
lines: number;
|
|
356
448
|
totalLines: number;
|
|
357
449
|
truncated: boolean;
|
|
358
450
|
};
|
|
359
|
-
declare function runShellTool(shells: ShellDirectory, from: string, name: string, args: unknown): Promise<ShellToolOutput>;
|
|
360
|
-
declare function shellReadText(result: ShellReadResult): string;
|
|
451
|
+
declare function runShellTool(shells: ShellDirectory, from: string, name: string, args: unknown, options?: ShellToolOptions): Promise<ShellToolOutput>;
|
|
452
|
+
declare function shellReadText(result: ShellReadResult, verb?: 'started' | 'typed'): string;
|
|
453
|
+
declare function shellKillText(result: ShellKillResult): string;
|
|
361
454
|
declare function installShellDirectory(directory: ShellDirectory | undefined): void;
|
|
362
455
|
declare function installedShellDirectory(): ShellDirectory | undefined;
|
|
363
456
|
declare function shellDirectoryHandle(): ShellDirectory;
|
|
@@ -386,6 +479,8 @@ type SessionRunnerConfig = CreateSessionRequest & {
|
|
|
386
479
|
sessionInfoFn?: SessionInfoFn;
|
|
387
480
|
peers?: PeerDirectory;
|
|
388
481
|
shells?: ShellDirectory;
|
|
482
|
+
shellAgentWrite?: ShellAgentWrite;
|
|
483
|
+
createdByOperator?: boolean;
|
|
389
484
|
};
|
|
390
485
|
declare class SessionRunner implements Runner {
|
|
391
486
|
#private;
|
|
@@ -457,6 +552,7 @@ type AiSdkRunnerConfig = Omit<CreateSessionRequest, 'cwd'> & {
|
|
|
457
552
|
restore?: RunnerSnapshot;
|
|
458
553
|
peers?: PeerDirectory;
|
|
459
554
|
shells?: ShellDirectory;
|
|
555
|
+
shellAgentWrite?: ShellAgentWrite;
|
|
460
556
|
};
|
|
461
557
|
type PendingToolCall = {
|
|
462
558
|
toolCallId: string;
|
|
@@ -709,6 +805,7 @@ type ToolContextOptions = {
|
|
|
709
805
|
onSettle?: (executionId: string, result: ToolExecutionResult) => void;
|
|
710
806
|
peers?: PeerDirectory;
|
|
711
807
|
shells?: ShellDirectory;
|
|
808
|
+
shellWrite?: boolean;
|
|
712
809
|
selfId?: () => string;
|
|
713
810
|
};
|
|
714
811
|
type ToolContext = {
|
|
@@ -790,7 +887,9 @@ type HeadTail = {
|
|
|
790
887
|
totalLines: number;
|
|
791
888
|
totalBytes: number;
|
|
792
889
|
};
|
|
890
|
+
declare const TTY_REDRAW_CARRY = 16;
|
|
793
891
|
declare function ttyText(raw: string): string;
|
|
892
|
+
declare function ttyRedraws(raw: string): boolean;
|
|
794
893
|
declare function splitLines(text: string): string[];
|
|
795
894
|
declare function countLines(text: string): number;
|
|
796
895
|
declare function headTail(text: string, opts: HeadTailOptions): HeadTail;
|
|
@@ -1043,6 +1142,7 @@ type CodexRunnerConfig = CreateSessionRequest & {
|
|
|
1043
1142
|
backfillHistory?: boolean;
|
|
1044
1143
|
peers?: PeerDirectory;
|
|
1045
1144
|
shells?: ShellDirectory;
|
|
1145
|
+
shellAgentWrite?: ShellAgentWrite;
|
|
1046
1146
|
};
|
|
1047
1147
|
declare class CodexRunner implements Runner {
|
|
1048
1148
|
#private;
|
|
@@ -1099,5 +1199,5 @@ declare class JsonRpcStdioConnection {
|
|
|
1099
1199
|
//#region src/engines/provider/adapter.d.ts
|
|
1100
1200
|
declare const providerAdapter: EngineAdapter;
|
|
1101
1201
|
//#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 };
|
|
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 };
|
|
1103
1203
|
//# sourceMappingURL=index.d.mts.map
|