@workerdeck/core 2.8.0 → 2.10.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 +39 -9
- package/build/index.mjs +293 -46
- package/build/index.mjs.map +1 -1
- package/package.json +3 -3
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, 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, ModelOption, PermissionMode, PermissionRequest, ProfileEngine, ProfileInfo, SdkSessionSummary, SessionEvent, SessionEventBody, SessionInfo, SessionStatus, ToolCallRequestFrame, ToolExecutionBackend, ToolExecutionOutput } from "@workerdeck/protocol";
|
|
3
3
|
import { LanguageModel, LanguageModel as LanguageModel$1, ModelMessage, Tool, Tool as Tool$1, ToolSet, ToolSet as ToolSet$1 } from "ai";
|
|
4
4
|
import { SandboxEngine, SandboxVfs } from "@workerdeck/sandbox";
|
|
5
5
|
import { Readable, Writable } from "node:stream";
|
|
@@ -24,6 +24,28 @@ type LocalCommandResult = {
|
|
|
24
24
|
declare function localCommandTranscript(result: LocalCommandResult): string;
|
|
25
25
|
declare function localCommandContext(pending: readonly string[]): string | undefined;
|
|
26
26
|
//#endregion
|
|
27
|
+
//#region src/lib/cost-ledger.d.ts
|
|
28
|
+
type CostFigures = {
|
|
29
|
+
byModel?: ByModel;
|
|
30
|
+
reportedCostUsd?: number;
|
|
31
|
+
};
|
|
32
|
+
type CostLedgerState = CostFigures & {
|
|
33
|
+
lifetime?: CostFigures;
|
|
34
|
+
};
|
|
35
|
+
declare class CostLedger {
|
|
36
|
+
#private;
|
|
37
|
+
carry(state: CostLedgerState | undefined): void;
|
|
38
|
+
carryUnlessRestored(state: CostLedgerState | undefined): void;
|
|
39
|
+
observeCumulative(byModel: ByModel | undefined, reportedCostUsd: number | undefined): void;
|
|
40
|
+
observeDelta(byModel: ByModel): void;
|
|
41
|
+
rollover(): void;
|
|
42
|
+
get byModel(): ByModel | undefined;
|
|
43
|
+
get breakdown(): CostBreakdown;
|
|
44
|
+
get costUsd(): number | undefined;
|
|
45
|
+
get reportedCostUsd(): number | undefined;
|
|
46
|
+
snapshot(): CostLedgerState;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
27
49
|
//#region src/executors/tool-executor.d.ts
|
|
28
50
|
type ToolExecutionResult = {
|
|
29
51
|
status: 'ok';
|
|
@@ -104,6 +126,7 @@ interface Runner {
|
|
|
104
126
|
eventAt?(seq: number): SessionEvent | undefined;
|
|
105
127
|
sendMessage(text: string, attachments?: readonly AttachmentInput[]): void;
|
|
106
128
|
queueLocalCommand?(result: LocalCommandResult): void;
|
|
129
|
+
refreshUsage?(): Promise<void>;
|
|
107
130
|
mcpServers?(): Promise<McpServerStatusInfo[] | undefined>;
|
|
108
131
|
reconnectMcpServer?(name: string): Promise<void>;
|
|
109
132
|
setMcpServerEnabled?(name: string, enabled: boolean): Promise<void>;
|
|
@@ -116,6 +139,8 @@ interface Runner {
|
|
|
116
139
|
settleExecution?(executionId: string, result: ToolExecutionResult): boolean;
|
|
117
140
|
park?(): RunnerSnapshot | undefined;
|
|
118
141
|
snapshot?(): RunnerSnapshot | undefined;
|
|
142
|
+
carryCost?(state: CostLedgerState): void;
|
|
143
|
+
costState?(): CostLedgerState;
|
|
119
144
|
fail(message: string): void;
|
|
120
145
|
close(reason?: 'client' | 'server' | 'error'): void;
|
|
121
146
|
}
|
|
@@ -161,6 +186,8 @@ declare class SessionRunner implements Runner {
|
|
|
161
186
|
get pendingApprovals(): PermissionRequest[];
|
|
162
187
|
info(): SessionInfo;
|
|
163
188
|
setTitle(title: string | undefined): void;
|
|
189
|
+
carryCost(state: CostLedgerState): void;
|
|
190
|
+
costState(): CostLedgerState;
|
|
164
191
|
start(): Promise<void>;
|
|
165
192
|
sendMessage(text: string, attachments?: readonly AttachmentInput[]): void;
|
|
166
193
|
queueLocalCommand(result: LocalCommandResult): void;
|
|
@@ -176,6 +203,7 @@ declare class SessionRunner implements Runner {
|
|
|
176
203
|
close(reason?: 'client' | 'server' | 'error'): void;
|
|
177
204
|
eventAt(seq: number): SessionEvent | undefined;
|
|
178
205
|
subscribe(listener: SessionEventListener, afterSeq?: number, options?: SubscribeOptions): () => void;
|
|
206
|
+
refreshUsage(minIntervalMs?: number): Promise<void>;
|
|
179
207
|
}
|
|
180
208
|
//#endregion
|
|
181
209
|
//#region src/lib/replay.d.ts
|
|
@@ -219,7 +247,7 @@ type PendingToolCall = {
|
|
|
219
247
|
toolCallId: string;
|
|
220
248
|
toolName: string;
|
|
221
249
|
input: unknown;
|
|
222
|
-
|
|
250
|
+
parkable?: boolean;
|
|
223
251
|
expiresAt?: number;
|
|
224
252
|
};
|
|
225
253
|
type AiSdkSessionState = {
|
|
@@ -227,12 +255,6 @@ type AiSdkSessionState = {
|
|
|
227
255
|
pendingToolCalls: PendingToolCall[];
|
|
228
256
|
dispatched: string[];
|
|
229
257
|
numTurns: number;
|
|
230
|
-
totalUsage: {
|
|
231
|
-
input: number;
|
|
232
|
-
output: number;
|
|
233
|
-
cacheWrite: number;
|
|
234
|
-
cacheRead: number;
|
|
235
|
-
};
|
|
236
258
|
turnAccum?: {
|
|
237
259
|
startedAt: number;
|
|
238
260
|
input: number;
|
|
@@ -265,6 +287,8 @@ declare class AiSdkRunner implements Runner {
|
|
|
265
287
|
get pendingApprovals(): PermissionRequest[];
|
|
266
288
|
get vfs(): SandboxVfs | undefined;
|
|
267
289
|
info(): SessionInfo;
|
|
290
|
+
carryCost(state: CostLedgerState): void;
|
|
291
|
+
costState(): CostLedgerState;
|
|
268
292
|
start(): Promise<void>;
|
|
269
293
|
park(): RunnerSnapshot | undefined;
|
|
270
294
|
snapshot(): RunnerSnapshot | undefined;
|
|
@@ -724,6 +748,10 @@ type AppServerUserInput = {
|
|
|
724
748
|
} | {
|
|
725
749
|
type: 'localImage';
|
|
726
750
|
path: string;
|
|
751
|
+
} | {
|
|
752
|
+
type: 'skill';
|
|
753
|
+
name: string;
|
|
754
|
+
path: string;
|
|
727
755
|
};
|
|
728
756
|
type AppServerConnection = {
|
|
729
757
|
request(method: string, params?: unknown): Promise<unknown>;
|
|
@@ -773,6 +801,8 @@ declare class CodexRunner implements Runner {
|
|
|
773
801
|
get pendingApprovals(): PermissionRequest[];
|
|
774
802
|
info(): SessionInfo;
|
|
775
803
|
setTitle(title: string | undefined): void;
|
|
804
|
+
carryCost(state: CostLedgerState): void;
|
|
805
|
+
costState(): CostLedgerState;
|
|
776
806
|
start(): Promise<void>;
|
|
777
807
|
sendMessage(text: string, attachments?: readonly AttachmentInput[]): void;
|
|
778
808
|
queueLocalCommand(result: LocalCommandResult): void;
|
|
@@ -815,5 +845,5 @@ declare class JsonRpcStdioConnection {
|
|
|
815
845
|
//#region src/engines/provider/adapter.d.ts
|
|
816
846
|
declare const providerAdapter: EngineAdapter;
|
|
817
847
|
//#endregion
|
|
818
|
-
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 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 };
|
|
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 };
|
|
819
849
|
//# sourceMappingURL=index.d.mts.map
|