@workerdeck/server 2.13.0 → 2.15.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 +100 -4
- package/build/index.mjs +1250 -182
- package/build/index.mjs.map +1 -1
- package/package.json +9 -6
package/build/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
2
|
-
import { AttachmentInput, BridgeAnswer, BrowserBridgeExecutor, ClaudeAuthProbe, CostLedgerState, EngineAdapter, EngineSessionOptions, HostToolDefinition, LanguageModel, McpConnection, ParkedExecution, Runner, RunnerSnapshot, SessionInstructions, SessionRunnerConfig, ToolExecutionCall, ToolExecutionResult, ToolExecutor, ToolSet } from "@workerdeck/core";
|
|
2
|
+
import { AttachmentInput, BridgeAnswer, BrowserBridgeExecutor, ClaudeAuthProbe, CostLedgerState, EngineAdapter, EngineSessionOptions, HostToolDefinition, LanguageModel, LocalShellSource, McpConnection, ParkedExecution, Runner, RunnerSnapshot, SHELL_REFUSAL, SessionInstructions, SessionRunnerConfig, ToolExecutionCall, ToolExecutionResult, ToolExecutor, ToolSet } from "@workerdeck/core";
|
|
3
3
|
import { JobQueue, QueueAdapter } from "@workerdeck/queue";
|
|
4
|
-
import { ByModel, CreateSessionRequest, JobEvent, MessageAttachment, ModelRate, ProfileEngine, ProfileInfo, ProfileSpend, ProfileUsage, ProviderConfig, SdkSessionSummary, ServerFrame, SessionCapability, SessionInfo, SessionNotification, SessionWebhookConfig } from "@workerdeck/protocol";
|
|
4
|
+
import { ByModel, CreateSessionRequest, JobEvent, MessageAttachment, ModelRate, ProfileEngine, ProfileInfo, ProfileSpend, ProfileUsage, ProviderConfig, SdkSessionSummary, ServerFrame, SessionCapability, SessionInfo, SessionNotification, SessionWebhookConfig, ShellEndReason, ShellInfo, ShellOwner } from "@workerdeck/protocol";
|
|
5
5
|
//#region src/services/bridge.d.ts
|
|
6
6
|
type BridgeHubOptions = {
|
|
7
7
|
timeoutMs?: number;
|
|
@@ -156,6 +156,93 @@ type ProfileStore = {
|
|
|
156
156
|
declare function createMemoryProfileStore(seed?: ProfileInfo[]): ProfileStore;
|
|
157
157
|
declare function createFileProfileStore(path?: string): ProfileStore;
|
|
158
158
|
//#endregion
|
|
159
|
+
//#region src/services/process-tree.d.ts
|
|
160
|
+
type ProcessRow = {
|
|
161
|
+
pid: number;
|
|
162
|
+
ppid: number;
|
|
163
|
+
pgid: number;
|
|
164
|
+
};
|
|
165
|
+
type ProcessTable = () => ProcessRow[] | null;
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/services/shells.d.ts
|
|
168
|
+
type ShellSize = {
|
|
169
|
+
cols: number;
|
|
170
|
+
rows: number;
|
|
171
|
+
};
|
|
172
|
+
type ShellSink = {
|
|
173
|
+
write: (data: string) => void;
|
|
174
|
+
end: (reason: string) => void;
|
|
175
|
+
};
|
|
176
|
+
type ShellSpawnInput = {
|
|
177
|
+
runner: Runner;
|
|
178
|
+
command: string;
|
|
179
|
+
owner: ShellOwner;
|
|
180
|
+
};
|
|
181
|
+
type ShellSpawned = {
|
|
182
|
+
shell: ShellInfo;
|
|
183
|
+
source: LocalShellSource;
|
|
184
|
+
};
|
|
185
|
+
type ShellAttachment = {
|
|
186
|
+
shell: ShellInfo;
|
|
187
|
+
scrollback: string;
|
|
188
|
+
detach: () => void;
|
|
189
|
+
};
|
|
190
|
+
type ShellOutputQuery = {
|
|
191
|
+
view: 'text' | 'raw';
|
|
192
|
+
tail?: number;
|
|
193
|
+
};
|
|
194
|
+
type ShellErrorContext = {
|
|
195
|
+
op: 'index' | 'artifact' | 'sweep' | 'listener' | 'kill';
|
|
196
|
+
sessionId?: string;
|
|
197
|
+
shellId?: string;
|
|
198
|
+
};
|
|
199
|
+
type ShellRegistryOptions = {
|
|
200
|
+
generation: string;
|
|
201
|
+
artifactDir: string | null;
|
|
202
|
+
timeoutMs?: number;
|
|
203
|
+
artifactMaxBytes?: number;
|
|
204
|
+
artifactTtlMs?: number;
|
|
205
|
+
maxRunningPerSession?: number;
|
|
206
|
+
maxRunningTotal?: number;
|
|
207
|
+
spillBytes?: number;
|
|
208
|
+
tailRingBytes?: number;
|
|
209
|
+
tailFlushMs?: number;
|
|
210
|
+
sweepIntervalMs?: number;
|
|
211
|
+
processTable?: ProcessTable;
|
|
212
|
+
onError?: (error: unknown, context: ShellErrorContext) => void;
|
|
213
|
+
};
|
|
214
|
+
type StoredShellRecord = ShellInfo & {
|
|
215
|
+
generation: string;
|
|
216
|
+
output?: string;
|
|
217
|
+
artifact?: string;
|
|
218
|
+
};
|
|
219
|
+
type StoredShellIndex = {
|
|
220
|
+
version: 1;
|
|
221
|
+
sessionId: string;
|
|
222
|
+
nextOrdinal: number;
|
|
223
|
+
shells: StoredShellRecord[];
|
|
224
|
+
};
|
|
225
|
+
type ShellRegistry = {
|
|
226
|
+
spawn: (input: ShellSpawnInput) => Promise<ShellSpawned>;
|
|
227
|
+
get: (sessionId: string, shellId: string) => ShellInfo | undefined;
|
|
228
|
+
list: (sessionId: string) => ShellInfo[];
|
|
229
|
+
running: () => ShellInfo[];
|
|
230
|
+
kill: (sessionId: string, shellId: string, reason?: ShellEndReason) => ShellInfo | undefined;
|
|
231
|
+
killAll: (reason: ShellEndReason) => number;
|
|
232
|
+
killAllSync: () => void;
|
|
233
|
+
attach: (sessionId: string, shellId: string, sink: ShellSink) => Promise<ShellAttachment>;
|
|
234
|
+
write: (sessionId: string, shellId: string, data: string) => void;
|
|
235
|
+
resize: (sessionId: string, shellId: string, size: ShellSize) => ShellSize;
|
|
236
|
+
output: (sessionId: string, shellId: string, query: ShellOutputQuery) => Promise<string | undefined>;
|
|
237
|
+
hydrate: () => Promise<void>;
|
|
238
|
+
sweep: () => Promise<void>;
|
|
239
|
+
flush: () => Promise<void>;
|
|
240
|
+
decorate: (info: SessionInfo) => SessionInfo;
|
|
241
|
+
watch: (runner: Runner) => () => void;
|
|
242
|
+
};
|
|
243
|
+
declare function shellPermitted(shells: ShellRegistry | null, runner: Runner, operator: boolean): boolean;
|
|
244
|
+
declare function createShellRegistry(options: ShellRegistryOptions): ShellRegistry;
|
|
245
|
+
//#endregion
|
|
159
246
|
//#region src/services/spend-ledger.d.ts
|
|
160
247
|
type SpendRecord = {
|
|
161
248
|
days: Record<string, Record<string, ByModel>>;
|
|
@@ -205,7 +292,10 @@ type WorkerServerOptions = {
|
|
|
205
292
|
shell?: {
|
|
206
293
|
enabled?: boolean;
|
|
207
294
|
timeoutMs?: number;
|
|
208
|
-
|
|
295
|
+
artifactDir?: string;
|
|
296
|
+
artifactMaxBytes?: number;
|
|
297
|
+
artifactTtlMs?: number;
|
|
298
|
+
maxRunningPerSession?: number;
|
|
209
299
|
};
|
|
210
300
|
attachments?: {
|
|
211
301
|
maxFileBytes?: number;
|
|
@@ -282,6 +372,11 @@ type DrainReport = {
|
|
|
282
372
|
working: string[];
|
|
283
373
|
awaitingHuman: string[];
|
|
284
374
|
timedOut: boolean;
|
|
375
|
+
shells: {
|
|
376
|
+
sessionId: string;
|
|
377
|
+
id: string;
|
|
378
|
+
label: string;
|
|
379
|
+
}[];
|
|
285
380
|
};
|
|
286
381
|
type DrainOptions = {
|
|
287
382
|
timeoutMs?: number;
|
|
@@ -294,6 +389,7 @@ type WorkerServer = {
|
|
|
294
389
|
queue?: JobQueue;
|
|
295
390
|
bridge: BridgeHub;
|
|
296
391
|
parking: SessionParkManager;
|
|
392
|
+
shells: ShellRegistry | null;
|
|
297
393
|
listen: (port: number, host?: string) => Promise<{
|
|
298
394
|
port: number;
|
|
299
395
|
}>;
|
|
@@ -406,5 +502,5 @@ declare class ProfileUsageTracker {
|
|
|
406
502
|
usage(profile: string, now?: number): ProfileUsage | undefined;
|
|
407
503
|
}
|
|
408
504
|
//#endregion
|
|
409
|
-
export { AttachmentStore, type AttachmentStoreOptions, type Authenticator, BridgeHub, type BridgeHubOptions, type CarriedSession, type EngineRunnerContext, type FileSessionStoreOptions, MemorySessionStore, type ParkedSessionRecord, type ProducedFile, ProducedFileStore, type ProfileStore, ProfileUsageTracker, type ProviderRunnerOptions, type QueueServerOptions, type ReloadPlan, type SdkSessionLister, type SessionNotificationOptions, SessionNotifier, SessionParkManager, type SessionParkOptions, SessionRegistry, type SessionRegistryOptions, type SessionStore, SpendLedger, type SpendRecord, type SpendStore, type StoredSessionRecord, type WorkerServer, type WorkerServerOptions, createFileProfileStore, createFileSessionStore, createFileSpendStore, createMemoryProfileStore, createProviderRunner, createWorkerServer, dayKey, isDormant, reloadPlan, sandboxedProviderProfile, toDurableRecord };
|
|
505
|
+
export { AttachmentStore, type AttachmentStoreOptions, type Authenticator, BridgeHub, type BridgeHubOptions, type CarriedSession, type EngineRunnerContext, type FileSessionStoreOptions, MemorySessionStore, type ParkedSessionRecord, type ProcessRow, type ProcessTable, type ProducedFile, ProducedFileStore, type ProfileStore, ProfileUsageTracker, type ProviderRunnerOptions, type QueueServerOptions, type ReloadPlan, SHELL_REFUSAL, type SdkSessionLister, type SessionNotificationOptions, SessionNotifier, SessionParkManager, type SessionParkOptions, SessionRegistry, type SessionRegistryOptions, type SessionStore, type ShellRegistry, type ShellRegistryOptions, type ShellSink, SpendLedger, type SpendRecord, type SpendStore, type StoredSessionRecord, type StoredShellIndex, type StoredShellRecord, type WorkerServer, type WorkerServerOptions, createFileProfileStore, createFileSessionStore, createFileSpendStore, createMemoryProfileStore, createProviderRunner, createShellRegistry, createWorkerServer, dayKey, isDormant, reloadPlan, sandboxedProviderProfile, shellPermitted, toDurableRecord };
|
|
410
506
|
//# sourceMappingURL=index.d.mts.map
|