@workerdeck/core 2.10.0 → 2.12.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 +126 -7
- package/build/index.mjs +471 -58
- package/build/index.mjs.map +1 -1
- package/package.json +3 -3
package/build/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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, ModelOption, PermissionMode, PermissionRequest, ProfileEngine, ProfileInfo, SdkSessionSummary, SessionEvent, SessionEventBody, SessionInfo, SessionStatus, ToolCallRequestFrame, ToolExecutionBackend, ToolExecutionOutput } from "@workerdeck/protocol";
|
|
2
|
+
import { ApiMessage, ByModel, CostBreakdown, CreateSessionRequest, EngineCapabilities, McpServerConfigWire, McpServerStatusInfo, MessageAttachment, MessageOrigin, ModelOption, PermissionMode, PermissionRequest, ProfileEngine, ProfileInfo, SdkSessionSummary, SessionEvent, SessionEventBody, SessionInfo, SessionStatus, ToolCallRequestFrame, ToolExecutionBackend, ToolExecutionOutput } from "@workerdeck/protocol";
|
|
3
|
+
import { z } from "zod";
|
|
3
4
|
import { LanguageModel, LanguageModel as LanguageModel$1, ModelMessage, Tool, Tool as Tool$1, ToolSet, ToolSet as ToolSet$1 } from "ai";
|
|
4
5
|
import { SandboxEngine, SandboxVfs } from "@workerdeck/sandbox";
|
|
5
6
|
import { Readable, Writable } from "node:stream";
|
|
@@ -23,6 +24,7 @@ type LocalCommandResult = {
|
|
|
23
24
|
};
|
|
24
25
|
declare function localCommandTranscript(result: LocalCommandResult): string;
|
|
25
26
|
declare function localCommandContext(pending: readonly string[]): string | undefined;
|
|
27
|
+
declare function isSlashCommand(text: string): boolean;
|
|
26
28
|
//#endregion
|
|
27
29
|
//#region src/lib/cost-ledger.d.ts
|
|
28
30
|
type CostFigures = {
|
|
@@ -46,6 +48,101 @@ declare class CostLedger {
|
|
|
46
48
|
snapshot(): CostLedgerState;
|
|
47
49
|
}
|
|
48
50
|
//#endregion
|
|
51
|
+
//#region src/lib/peers.d.ts
|
|
52
|
+
type PeerSessionSummary = {
|
|
53
|
+
id: string;
|
|
54
|
+
engine?: ProfileEngine;
|
|
55
|
+
status: SessionStatus;
|
|
56
|
+
title?: string;
|
|
57
|
+
project?: string;
|
|
58
|
+
cwd: string;
|
|
59
|
+
profile?: string;
|
|
60
|
+
lastActivityAt?: number;
|
|
61
|
+
pendingPermissionCount: number;
|
|
62
|
+
};
|
|
63
|
+
type PeerPeek = PeerSessionSummary & {
|
|
64
|
+
live: boolean;
|
|
65
|
+
checklist?: SessionInfo['checklist'];
|
|
66
|
+
pendingApprovals: string[];
|
|
67
|
+
recent: string[];
|
|
68
|
+
};
|
|
69
|
+
type PeerSendResult = {
|
|
70
|
+
delivered: true;
|
|
71
|
+
sessionId: string;
|
|
72
|
+
name?: string;
|
|
73
|
+
queued: boolean;
|
|
74
|
+
} | {
|
|
75
|
+
delivered: false;
|
|
76
|
+
reason: string;
|
|
77
|
+
};
|
|
78
|
+
type PeerSendOptions = {
|
|
79
|
+
hops?: string[];
|
|
80
|
+
};
|
|
81
|
+
type PeerMention = {
|
|
82
|
+
typed: string;
|
|
83
|
+
id: string;
|
|
84
|
+
name?: string;
|
|
85
|
+
engine?: ProfileEngine;
|
|
86
|
+
status: SessionStatus;
|
|
87
|
+
cwd: string;
|
|
88
|
+
ambiguousWith?: string[];
|
|
89
|
+
};
|
|
90
|
+
interface PeerDirectory {
|
|
91
|
+
list(from: string): Promise<PeerSessionSummary[]>;
|
|
92
|
+
peek(from: string, sessionId: string, options?: {
|
|
93
|
+
recent?: number;
|
|
94
|
+
}): Promise<PeerPeek | undefined>;
|
|
95
|
+
send(from: string, sessionId: string, text: string, options?: PeerSendOptions): Promise<PeerSendResult>;
|
|
96
|
+
}
|
|
97
|
+
declare const PEER_MCP_SERVER = "workerdeck";
|
|
98
|
+
declare const PEER_MESSAGE_MAX_CHARS = 16000;
|
|
99
|
+
declare const PEER_RECENT_DEFAULT = 8;
|
|
100
|
+
declare const PEER_RECENT_MAX = 40;
|
|
101
|
+
declare const PEER_TOOL_SHAPES: {
|
|
102
|
+
readonly peers_list: {
|
|
103
|
+
readonly description: string;
|
|
104
|
+
readonly shape: {};
|
|
105
|
+
};
|
|
106
|
+
readonly peers_peek: {
|
|
107
|
+
readonly description: string;
|
|
108
|
+
readonly shape: {
|
|
109
|
+
readonly sessionId: z.ZodString;
|
|
110
|
+
readonly recent: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
readonly peers_send: {
|
|
114
|
+
readonly description: string;
|
|
115
|
+
readonly shape: {
|
|
116
|
+
readonly sessionId: z.ZodString;
|
|
117
|
+
readonly text: z.ZodString;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
type PeerToolName = keyof typeof PEER_TOOL_SHAPES;
|
|
122
|
+
declare const PEER_TOOL_NAMES: PeerToolName[];
|
|
123
|
+
type PeerToolSpec = {
|
|
124
|
+
name: PeerToolName;
|
|
125
|
+
description: string;
|
|
126
|
+
inputSchema: Record<string, unknown>;
|
|
127
|
+
};
|
|
128
|
+
type PeerToolOutput = {
|
|
129
|
+
text: string;
|
|
130
|
+
isError: boolean;
|
|
131
|
+
};
|
|
132
|
+
declare function peerToolSpecs(): PeerToolSpec[];
|
|
133
|
+
declare function runPeerTool(peers: PeerDirectory, from: string, name: string, args: unknown): Promise<PeerToolOutput>;
|
|
134
|
+
declare function peerMessageEnvelope(text: string, origin: MessageOrigin): string;
|
|
135
|
+
declare function peerMentionsEnvelope(mentions: readonly PeerMention[] | undefined): string | undefined;
|
|
136
|
+
declare function withPeerContext(text: string, options?: {
|
|
137
|
+
origin?: MessageOrigin;
|
|
138
|
+
mentions?: readonly PeerMention[];
|
|
139
|
+
}): string;
|
|
140
|
+
declare function peerSummary(info: SessionInfo): PeerSessionSummary;
|
|
141
|
+
declare function recentLines(events: readonly SessionEvent[], limit: number): string[];
|
|
142
|
+
declare function installPeerDirectory(directory: PeerDirectory | undefined): void;
|
|
143
|
+
declare function installedPeerDirectory(): PeerDirectory | undefined;
|
|
144
|
+
declare function peerDirectoryHandle(): PeerDirectory;
|
|
145
|
+
//#endregion
|
|
49
146
|
//#region src/executors/tool-executor.d.ts
|
|
50
147
|
type ToolExecutionResult = {
|
|
51
148
|
status: 'ok';
|
|
@@ -104,6 +201,10 @@ type RunnerSnapshot = {
|
|
|
104
201
|
parked: ParkedExecution[];
|
|
105
202
|
state: unknown;
|
|
106
203
|
};
|
|
204
|
+
type SendMessageOptions = {
|
|
205
|
+
origin?: MessageOrigin;
|
|
206
|
+
mentions?: readonly PeerMention[];
|
|
207
|
+
};
|
|
107
208
|
type PermissionDecision = {
|
|
108
209
|
behavior: 'allow';
|
|
109
210
|
updatedInput?: Record<string, unknown>;
|
|
@@ -124,7 +225,7 @@ interface Runner {
|
|
|
124
225
|
imageRefs?: boolean;
|
|
125
226
|
}): () => void;
|
|
126
227
|
eventAt?(seq: number): SessionEvent | undefined;
|
|
127
|
-
sendMessage(text: string, attachments?: readonly AttachmentInput[]): void;
|
|
228
|
+
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
128
229
|
queueLocalCommand?(result: LocalCommandResult): void;
|
|
129
230
|
refreshUsage?(): Promise<void>;
|
|
130
231
|
mcpServers?(): Promise<McpServerStatusInfo[] | undefined>;
|
|
@@ -173,6 +274,7 @@ type SessionRunnerConfig = CreateSessionRequest & {
|
|
|
173
274
|
backfillHistory?: boolean;
|
|
174
275
|
historyFn?: HistoryFn;
|
|
175
276
|
sessionInfoFn?: SessionInfoFn;
|
|
277
|
+
peers?: PeerDirectory;
|
|
176
278
|
};
|
|
177
279
|
declare class SessionRunner implements Runner {
|
|
178
280
|
#private;
|
|
@@ -189,7 +291,7 @@ declare class SessionRunner implements Runner {
|
|
|
189
291
|
carryCost(state: CostLedgerState): void;
|
|
190
292
|
costState(): CostLedgerState;
|
|
191
293
|
start(): Promise<void>;
|
|
192
|
-
sendMessage(text: string, attachments?: readonly AttachmentInput[]): void;
|
|
294
|
+
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
193
295
|
queueLocalCommand(result: LocalCommandResult): void;
|
|
194
296
|
mcpServers(): Promise<McpServerStatusInfo[] | undefined>;
|
|
195
297
|
reconnectMcpServer(name: string): Promise<void>;
|
|
@@ -242,6 +344,7 @@ type AiSdkRunnerConfig = Omit<CreateSessionRequest, 'cwd'> & {
|
|
|
242
344
|
reportMcpServers?: () => Promise<McpServerStatusInfo[] | undefined>;
|
|
243
345
|
onClose?: () => void | Promise<void>;
|
|
244
346
|
restore?: RunnerSnapshot;
|
|
347
|
+
peers?: PeerDirectory;
|
|
245
348
|
};
|
|
246
349
|
type PendingToolCall = {
|
|
247
350
|
toolCallId: string;
|
|
@@ -292,7 +395,7 @@ declare class AiSdkRunner implements Runner {
|
|
|
292
395
|
start(): Promise<void>;
|
|
293
396
|
park(): RunnerSnapshot | undefined;
|
|
294
397
|
snapshot(): RunnerSnapshot | undefined;
|
|
295
|
-
sendMessage(text: string, attachments?: readonly AttachmentInput[]): void;
|
|
398
|
+
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
296
399
|
queueLocalCommand(result: LocalCommandResult): void;
|
|
297
400
|
resolveToolCall(toolCallId: string, output: ToolCallOutput, options?: {
|
|
298
401
|
isError?: boolean;
|
|
@@ -492,6 +595,8 @@ type ToolContextOptions = {
|
|
|
492
595
|
};
|
|
493
596
|
onDispatch?: (executionId: string, toolName: string) => void;
|
|
494
597
|
onSettle?: (executionId: string, result: ToolExecutionResult) => void;
|
|
598
|
+
peers?: PeerDirectory;
|
|
599
|
+
selfId?: () => string;
|
|
495
600
|
};
|
|
496
601
|
type ToolContext = {
|
|
497
602
|
vfs: SandboxVfs;
|
|
@@ -702,6 +807,19 @@ type AppServerCollabAgentToolCallItem = {
|
|
|
702
807
|
reasoningEffort?: string | null;
|
|
703
808
|
agentsStates?: Record<string, unknown> | null;
|
|
704
809
|
};
|
|
810
|
+
type AppServerDynamicToolCallItem = {
|
|
811
|
+
id: string;
|
|
812
|
+
type: 'dynamicToolCall';
|
|
813
|
+
tool: string;
|
|
814
|
+
namespace?: string | null;
|
|
815
|
+
arguments: unknown;
|
|
816
|
+
status: string;
|
|
817
|
+
success?: boolean | null;
|
|
818
|
+
contentItems?: Array<{
|
|
819
|
+
type: string;
|
|
820
|
+
text?: string;
|
|
821
|
+
}> | null;
|
|
822
|
+
};
|
|
705
823
|
type AppServerUserMessageItem = {
|
|
706
824
|
id: string;
|
|
707
825
|
type: 'userMessage';
|
|
@@ -711,7 +829,7 @@ type AppServerContextCompactionItem = {
|
|
|
711
829
|
id: string;
|
|
712
830
|
type: 'contextCompaction';
|
|
713
831
|
};
|
|
714
|
-
type AppServerItem = AppServerAgentMessageItem | AppServerReasoningItem | AppServerCommandExecutionItem | AppServerFileChangeItem | AppServerMcpToolCallItem | AppServerWebSearchItem | AppServerImageGenerationItem | AppServerImageViewItem | AppServerUserMessageItem | AppServerSubAgentActivityItem | AppServerCollabAgentToolCallItem | AppServerContextCompactionItem;
|
|
832
|
+
type AppServerItem = AppServerAgentMessageItem | AppServerReasoningItem | AppServerCommandExecutionItem | AppServerFileChangeItem | AppServerMcpToolCallItem | AppServerDynamicToolCallItem | AppServerWebSearchItem | AppServerImageGenerationItem | AppServerImageViewItem | AppServerUserMessageItem | AppServerSubAgentActivityItem | AppServerCollabAgentToolCallItem | AppServerContextCompactionItem;
|
|
715
833
|
type AppServerTurn = {
|
|
716
834
|
id: string;
|
|
717
835
|
status: string;
|
|
@@ -789,6 +907,7 @@ type CodexRunnerConfig = CreateSessionRequest & {
|
|
|
789
907
|
codexHome?: string;
|
|
790
908
|
defaultApprovalTimeoutMs?: number | null;
|
|
791
909
|
backfillHistory?: boolean;
|
|
910
|
+
peers?: PeerDirectory;
|
|
792
911
|
};
|
|
793
912
|
declare class CodexRunner implements Runner {
|
|
794
913
|
#private;
|
|
@@ -804,7 +923,7 @@ declare class CodexRunner implements Runner {
|
|
|
804
923
|
carryCost(state: CostLedgerState): void;
|
|
805
924
|
costState(): CostLedgerState;
|
|
806
925
|
start(): Promise<void>;
|
|
807
|
-
sendMessage(text: string, attachments?: readonly AttachmentInput[]): void;
|
|
926
|
+
sendMessage(text: string, attachments?: readonly AttachmentInput[], options?: SendMessageOptions): void;
|
|
808
927
|
queueLocalCommand(result: LocalCommandResult): void;
|
|
809
928
|
resolvePermission(requestId: string, decision: PermissionDecision): boolean;
|
|
810
929
|
interrupt(): Promise<void>;
|
|
@@ -845,5 +964,5 @@ declare class JsonRpcStdioConnection {
|
|
|
845
964
|
//#region src/engines/provider/adapter.d.ts
|
|
846
965
|
declare const providerAdapter: EngineAdapter;
|
|
847
966
|
//#endregion
|
|
848
|
-
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 HistoryFn, type HostFetch, type HostToolDefinition, InputQueue, JsonRpcError, JsonRpcStdioConnection, type LanguageModel, type LocalCommandResult, type McpConnection, type ModelCatalog, type ParkedExecution, type PendingEntry, type PendingKind, type PendingOutcome, PendingRequestRegistry, type PendingToolCall, type PermissionDecision, type QueryFn, QuickJsExecutor, type QuickJsExecutorOptions, type RegisterOptions, type Runner, type RunnerSnapshot, SUPPORTED_ATTACHMENT_TYPES, type SessionEventListener, SessionRunner, type SessionRunnerConfig, type SettledBy, 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, claudeAdapter, codexAdapter, connectAppServer, connectMcpTools, createEngineSession, createToolContext, createWebFetch, getEngineAdapter, htmlToMarkdown, isHostAllowed, isPrivateAddress, listCodexSessions, localCommandContext, localCommandTranscript, mcpStatusInfo, modelOptionsFromSdk, normalizeMediaType, normalizeSdkMessage, providerAdapter, replaySlice, resolveBundledClaudeExecutable, resolveBundledCodexExecutable, toApiMessage, toExecutionResult, truncateResultBlocks, withHostTools, withMcpTools };
|
|
967
|
+
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 HistoryFn, type HostFetch, type HostToolDefinition, InputQueue, JsonRpcError, JsonRpcStdioConnection, type LanguageModel, type LocalCommandResult, 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, SUPPORTED_ATTACHMENT_TYPES, type SendMessageOptions, type SessionEventListener, SessionRunner, type SessionRunnerConfig, type SettledBy, 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, claudeAdapter, codexAdapter, connectAppServer, connectMcpTools, createEngineSession, createToolContext, createWebFetch, getEngineAdapter, htmlToMarkdown, installPeerDirectory, installedPeerDirectory, isHostAllowed, isPrivateAddress, isSlashCommand, listCodexSessions, localCommandContext, localCommandTranscript, mcpStatusInfo, modelOptionsFromSdk, normalizeMediaType, normalizeSdkMessage, peerDirectoryHandle, peerMentionsEnvelope, peerMessageEnvelope, peerSummary, peerToolSpecs, providerAdapter, recentLines, replaySlice, resolveBundledClaudeExecutable, resolveBundledCodexExecutable, runPeerTool, toApiMessage, toExecutionResult, truncateResultBlocks, withHostTools, withMcpTools, withPeerContext };
|
|
849
968
|
//# sourceMappingURL=index.d.mts.map
|