@workerdeck/core 3.5.0 → 3.6.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 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, ChecklistItem, ContextReading, ContextUsageCategory, CostBreakdown, CreateSessionRequest, EngineCapabilities, McpServerConfigWire, McpServerStatusInfo, MessageAttachment, MessageOrigin, ModelOption, PeerSessionSummary, PermissionDecisionSource, PermissionMode, PermissionRequest, PricingTable, ProfileEngine, ProfileInfo, ProviderContextWindow, SdkSessionSummary, SessionEvent, SessionEventBody, SessionInfo, SessionStatus, ShellEndReason, ShellInfo, ShellOwner, ShellStatus, ToolCallRequestFrame, ToolExecutionBackend, ToolExecutionOutput } from "@workerdeck/protocol";
2
+ import { ApiMessage, ByModel, ChecklistItem, ContextReading, ContextUsageCategory, CostBreakdown, CreateSessionRequest, EngineCapabilities, McpServerConfigWire, McpServerStatusInfo, MessageAttachment, MessageOrigin, ModelOption, PeerSessionSummary, PermissionDecisionSource, PermissionMode, PermissionRequest, PricingTable, ProfileEngine, ProfileInfo, ProviderContextWindow, SdkSessionSummary, SessionEvent, SessionEventBody, SessionInfo, SessionStatus, ShellEndReason, ShellInfo, ShellOwner, ShellStatus, StatusLabel, StatusLabelInput, 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";
@@ -26,6 +26,15 @@ type GatewayToolSpec<N extends string = string> = {
26
26
  inputSchema: Record<string, unknown>;
27
27
  };
28
28
  //#endregion
29
+ //#region src/lib/avatar-tool.d.ts
30
+ interface AvatarDirectory {
31
+ change(sessionId: string, seed?: string): Promise<string>;
32
+ }
33
+ declare const CHANGE_AVATAR_TOOL = "change_avatar";
34
+ declare const AVATAR_SEED_MAX = 64;
35
+ declare function installAvatarDirectory(directory: AvatarDirectory | undefined): void;
36
+ declare function avatarDirectoryHandle(own?: () => AvatarDirectory | undefined): AvatarDirectory;
37
+ //#endregion
29
38
  //#region src/lib/context-reset.d.ts
30
39
  type ContextResetRequest = {
31
40
  prompt: string;
@@ -402,6 +411,7 @@ type EngineRunnerConfig = CreateSessionRequest & {
402
411
  instructions?: SessionInstructions;
403
412
  defaultApprovalTimeoutMs?: number | null;
404
413
  peers?: PeerDirectory;
414
+ avatar?: AvatarDirectory;
405
415
  contextReset?: ContextResetDirectory;
406
416
  shells?: ShellDirectory;
407
417
  shellAgentWrite?: ShellAgentWrite;
@@ -409,6 +419,7 @@ type EngineRunnerConfig = CreateSessionRequest & {
409
419
  fallbackTitle?: string;
410
420
  startAsleep?: boolean;
411
421
  effortDefaults?: Record<string, string>;
422
+ statusLabel?: StatusLabel;
412
423
  };
413
424
  type ParkedExecution = {
414
425
  executionId: string;
@@ -465,6 +476,7 @@ interface Runner {
465
476
  reconnectMcpServer?(name: string): Promise<void>;
466
477
  setMcpServerEnabled?(name: string, enabled: boolean): Promise<void>;
467
478
  setTitle(title: string | undefined): void;
479
+ setStatusLabel?(label: StatusLabelInput | null): StatusLabel | null;
468
480
  resolvePermission(requestId: string, decision: PermissionDecision): boolean;
469
481
  interrupt(): Promise<void>;
470
482
  stopTask?(toolUseId: string): Promise<boolean>;
@@ -492,6 +504,7 @@ declare class EventLog {
492
504
  get proseCount(): number;
493
505
  get contextUsage(): ContextReading | undefined;
494
506
  get checklist(): ChecklistItem[] | undefined;
507
+ get statusLabel(): StatusLabel | null | undefined;
495
508
  get resetSeq(): number;
496
509
  get lastActivityAt(): number | undefined;
497
510
  append(body: SessionEventBody): SessionEvent;
@@ -639,9 +652,15 @@ type SessionReportInput = {
639
652
  declare const SESSION_INFO_TOOL = "session_info";
640
653
  declare function buildSessionReport(input: SessionReportInput): SessionReport;
641
654
  //#endregion
655
+ //#region src/lib/status-label.d.ts
656
+ type StatusLabelSink = (label: StatusLabelInput | null) => StatusLabel | null;
657
+ declare const SET_STATUS_TOOL = "set_status";
658
+ //#endregion
642
659
  //#region src/lib/session-tools.d.ts
643
660
  type SessionToolSources = {
644
661
  report?: SessionReportSource;
662
+ status?: StatusLabelSink;
663
+ avatar?: AvatarDirectory;
645
664
  reset?: ContextResetDirectory;
646
665
  peers?: PeerDirectory;
647
666
  shells?: ShellDirectory;
@@ -676,6 +695,7 @@ declare abstract class EngineRunner<C extends EngineRunnerConfig> {
676
695
  get lastSeq(): number;
677
696
  get pendingApprovals(): PermissionRequest[];
678
697
  setTitle(title: string | undefined): void;
698
+ setStatusLabel(input: StatusLabelInput | null): StatusLabel | null;
679
699
  carryCost(state: CostLedgerState): void;
680
700
  costState(): CostLedgerState;
681
701
  resolvePermission(requestId: string, decision: PermissionDecision): boolean;
@@ -704,6 +724,7 @@ declare abstract class EngineRunner<C extends EngineRunnerConfig> {
704
724
  scope: Record<string, string> | undefined;
705
725
  agentContextReset: true | undefined;
706
726
  title: string | undefined;
727
+ statusLabel: StatusLabel | undefined;
707
728
  costUsd: number | undefined;
708
729
  usageByModel: import("@workerdeck/protocol").ByModel | undefined;
709
730
  lastActivityAt: number | undefined;
@@ -1038,6 +1059,8 @@ type ToolContextOptions = {
1038
1059
  shellWrite?: boolean;
1039
1060
  selfId?: () => string;
1040
1061
  report?: SessionReportSource;
1062
+ status?: StatusLabelSink;
1063
+ avatar?: AvatarDirectory;
1041
1064
  };
1042
1065
  type ToolContext = {
1043
1066
  vfs: SandboxVfs;
@@ -1422,5 +1445,5 @@ declare class JsonRpcStdioConnection {
1422
1445
  //#region src/engines/provider/adapter.d.ts
1423
1446
  declare const providerAdapter: EngineAdapter;
1424
1447
  //#endregion
1425
- 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, CONTEXT_RESET_PROMPT_MAX, CONTEXT_RESET_REASON_MAX, CONTEXT_RESET_TOOL, type ClaudeAuthProbe, type ClaudeAuthStatus, type ClearContextOptions, type CodexAdapterConfig, CodexRunner, type CodexRunnerConfig, type ContextResetDirectory, type ContextResetRequest, 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, SESSION_INFO_TOOL, 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 SessionContextReport, type SessionEventListener, type SessionInstructions, type SessionRateLimitReport, type SessionReport, 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, type SleepResult, 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, buildSessionReport, checkClaudeAuth, clampShellTail, claudeAdapter, codexAdapter, composeInstructions, connectAppServer, connectMcpTools, contextResetDirectoryHandle, countLines, createEngineSession, createToolContext, createWebFetch, encodeShellKey, encodeShellKeys, getEngineAdapter, headTail, htmlToMarkdown, installContextResetDirectory, 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, withoutPeerContext };
1448
+ export { AVATAR_SEED_MAX, 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 AvatarDirectory, type BridgeAnswer, BrowserBridgeExecutor, type BrowserBridgeExecutorOptions, CHANGE_AVATAR_TOOL, CLAUDE_CATALOG, CODEX_CATALOG, CONTEXT_RESET_PROMPT_MAX, CONTEXT_RESET_REASON_MAX, CONTEXT_RESET_TOOL, type ClaudeAuthProbe, type ClaudeAuthStatus, type ClearContextOptions, type CodexAdapterConfig, CodexRunner, type CodexRunnerConfig, type ContextResetDirectory, type ContextResetRequest, 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, SESSION_INFO_TOOL, SET_STATUS_TOOL, 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 SessionContextReport, type SessionEventListener, type SessionInstructions, type SessionRateLimitReport, type SessionReport, 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, type SleepResult, type StatusLabelSink, 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, avatarDirectoryHandle, buildSessionReport, checkClaudeAuth, clampShellTail, claudeAdapter, codexAdapter, composeInstructions, connectAppServer, connectMcpTools, contextResetDirectoryHandle, countLines, createEngineSession, createToolContext, createWebFetch, encodeShellKey, encodeShellKeys, getEngineAdapter, headTail, htmlToMarkdown, installAvatarDirectory, installContextResetDirectory, 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, withoutPeerContext };
1426
1449
  //# sourceMappingURL=index.d.mts.map
package/build/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { createHash, randomUUID } from "node:crypto";
3
3
  import { createSdkMcpServer, getSessionInfo, getSessionMessages, listSessions, query, tool } from "@anthropic-ai/claude-agent-sdk";
4
- import { CHECKLIST_TEXT_MAX, ENGINE_CAPABILITIES, PEER_MENTION_MAX, PROTOCOL_VERSION, SHELL_COMMAND_MAX, SHELL_CONTEXT_FLUSH_MAX_CHARS, SHELL_CONTEXT_HEAD_CHARS, SHELL_CONTEXT_HEAD_LINES, SHELL_CONTEXT_TAIL_CHARS, SHELL_CONTEXT_TAIL_LINES, SHELL_INLINE_CHARS, SHELL_INLINE_LINES, SHELL_INLINE_LINE_CHARS, SHELL_INPUT_MAX, SHELL_INTERACTIVE_NOTE, SHELL_READ_DEFAULT_LINES, SHELL_READ_MAX_LINES, SHELL_WAIT_DEFAULT_MS, SHELL_WAIT_MAX_MS, SUBAGENT_HISTORY, TOOL_RESULT_HEAD_CHARS, addTokenUsage, byModelTotalTokens, canonicalModel, contextReading, costOfByModel, emptyTokenUsage, errorMessage, imagePartRef, logCoalesceKey, mergeByModel, parseTodoWriteInput, peerDeliveredPrefix, replayCoalesceKey, replayRetains, sanitizeToolTitle, snapshotRetains, supportsPermissionMode, teamRole, tokenUsageFromWire, totalTokens, transcriptActivity, transcriptContent, transcriptProse, usageIsStale } from "@workerdeck/protocol";
4
+ import { CHECKLIST_TEXT_MAX, ENGINE_CAPABILITIES, PEER_MENTION_MAX, PROTOCOL_VERSION, SHELL_COMMAND_MAX, SHELL_CONTEXT_FLUSH_MAX_CHARS, SHELL_CONTEXT_HEAD_CHARS, SHELL_CONTEXT_HEAD_LINES, SHELL_CONTEXT_TAIL_CHARS, SHELL_CONTEXT_TAIL_LINES, SHELL_INLINE_CHARS, SHELL_INLINE_LINES, SHELL_INLINE_LINE_CHARS, SHELL_INPUT_MAX, SHELL_INTERACTIVE_NOTE, SHELL_READ_DEFAULT_LINES, SHELL_READ_MAX_LINES, SHELL_WAIT_DEFAULT_MS, SHELL_WAIT_MAX_MS, STATUS_LABEL_EMOJI_MAX, STATUS_LABEL_TEXT_MAX, SUBAGENT_HISTORY, TOOL_RESULT_HEAD_CHARS, addTokenUsage, byModelTotalTokens, canonicalModel, contextReading, costOfByModel, emptyTokenUsage, errorMessage, imagePartRef, logCoalesceKey, mergeByModel, parseTodoWriteInput, peerDeliveredPrefix, replayCoalesceKey, replayRetains, sanitizeToolTitle, snapshotRetains, supportsPermissionMode, teamRole, tokenUsageFromWire, totalTokens, transcriptActivity, transcriptContent, transcriptProse, usageIsStale } from "@workerdeck/protocol";
5
5
  import { z } from "zod";
6
6
  import { appendFileSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
7
7
  import { homedir, tmpdir } from "node:os";
@@ -1196,6 +1196,7 @@ var EventLog = class {
1196
1196
  #proseCount = 0;
1197
1197
  #contextUsage;
1198
1198
  #checklist;
1199
+ #statusLabel;
1199
1200
  #resetSeq = 0;
1200
1201
  #lastActivityAt;
1201
1202
  get events() {
@@ -1216,6 +1217,9 @@ var EventLog = class {
1216
1217
  get checklist() {
1217
1218
  return this.#checklist;
1218
1219
  }
1220
+ get statusLabel() {
1221
+ return this.#statusLabel;
1222
+ }
1219
1223
  get resetSeq() {
1220
1224
  return this.#resetSeq;
1221
1225
  }
@@ -1243,6 +1247,7 @@ var EventLog = class {
1243
1247
  this.#proseCount = 0;
1244
1248
  this.#contextUsage = void 0;
1245
1249
  this.#checklist = void 0;
1250
+ this.#statusLabel = void 0;
1246
1251
  this.#resetSeq = 0;
1247
1252
  for (const event of events) {
1248
1253
  this.#fold(event);
@@ -1265,10 +1270,12 @@ var EventLog = class {
1265
1270
  this.#proseCount += transcriptProse(event);
1266
1271
  this.#contextUsage = contextReading(event) ?? this.#contextUsage;
1267
1272
  if (event.type === "checklist") this.#checklist = event.items.length > 0 ? event.items : void 0;
1273
+ if (event.type === "status_label") this.#statusLabel = event.label;
1268
1274
  if (event.type === "conversation_reset") {
1269
1275
  this.#resetSeq = event.seq;
1270
1276
  this.#contextUsage = void 0;
1271
1277
  this.#checklist = void 0;
1278
+ this.#statusLabel = null;
1272
1279
  }
1273
1280
  }
1274
1281
  };
@@ -1958,6 +1965,18 @@ var EngineRunner = class {
1958
1965
  setTitle(title) {
1959
1966
  this.config = withTitle(this.config, title);
1960
1967
  }
1968
+ setStatusLabel(input) {
1969
+ this.assertAccepting();
1970
+ const label = input ? {
1971
+ ...input,
1972
+ setAt: Date.now()
1973
+ } : null;
1974
+ this.core.emit({
1975
+ type: "status_label",
1976
+ label
1977
+ });
1978
+ return label;
1979
+ }
1961
1980
  carryCost(state) {
1962
1981
  this.core.carryCost(state);
1963
1982
  }
@@ -2006,6 +2025,8 @@ var EngineRunner = class {
2006
2025
  get toolSources() {
2007
2026
  return {
2008
2027
  report: () => this.sessionReport(),
2028
+ status: (input) => this.setStatusLabel(input),
2029
+ avatar: this.config.avatar,
2009
2030
  reset: this.config.contextReset,
2010
2031
  peers: this.config.peers,
2011
2032
  shells: this.config.shells,
@@ -2031,6 +2052,7 @@ var EngineRunner = class {
2031
2052
  scope: this.config.scope,
2032
2053
  agentContextReset: this.config.contextReset ? true : void 0,
2033
2054
  title: sessionTitle(this.config, engineTitle),
2055
+ statusLabel: (log.statusLabel === void 0 ? this.config.statusLabel : log.statusLabel) ?? void 0,
2034
2056
  costUsd: this.core.cost.costUsd,
2035
2057
  usageByModel: this.core.cost.byModel,
2036
2058
  lastActivityAt: log.lastActivityAt
@@ -2336,6 +2358,61 @@ function agentResetFields(options) {
2336
2358
  return options?.agentReason === void 0 ? {} : { agentReason: options.agentReason };
2337
2359
  }
2338
2360
  //#endregion
2361
+ //#region src/lib/avatar-tool.ts
2362
+ const CHANGE_AVATAR_TOOL = "change_avatar";
2363
+ const AVATAR_SEED_MAX = 64;
2364
+ const AVATAR_SLOT = globalSlot("workerdeck.avatar.directory");
2365
+ const CHANGE_AVATAR_TOOL_SHAPES = { [CHANGE_AVATAR_TOOL]: {
2366
+ description: "Give yourself a new avatar: the picture the human sees beside your name in the session list. Each call rolls a new one; pass `seed` to get the same avatar for the same seed (any short word or phrase). On the workerdeck CLI a seed starting with a pack name and a colon picks the family: `monkey:`, `toad:`, `steampunk-bulldogs:` or `panda:`. You cannot see the result, so only change it when the human asks or you have a reason to.",
2367
+ shape: { seed: z.string().trim().min(1).max(64).optional().describe("Optional: the same seed always rolls the same avatar") }
2368
+ } };
2369
+ const CHANGE_AVATAR_TOOLS = defineToolFamily(CHANGE_AVATAR_TOOL_SHAPES, { [CHANGE_AVATAR_TOOL]: async (directory, from, input) => ({
2370
+ text: await directory.change(from, input.seed),
2371
+ isError: false
2372
+ }) });
2373
+ const CHANGE_AVATAR_TOOL_SHAPE = CHANGE_AVATAR_TOOL_SHAPES[CHANGE_AVATAR_TOOL];
2374
+ function isChangeAvatarToolName(name) {
2375
+ return CHANGE_AVATAR_TOOLS.is(name);
2376
+ }
2377
+ function runChangeAvatarTool(directory, from, args) {
2378
+ return CHANGE_AVATAR_TOOLS.run(directory, from, CHANGE_AVATAR_TOOL, args);
2379
+ }
2380
+ function installAvatarDirectory(directory) {
2381
+ AVATAR_SLOT.install(directory);
2382
+ }
2383
+ function avatarDirectoryHandle(own) {
2384
+ return lateBoundDirectory(["change"], AVATAR_SLOT, own, "avatars are not available on this gateway");
2385
+ }
2386
+ //#endregion
2387
+ //#region src/lib/status-label.ts
2388
+ const SET_STATUS_TOOL = "set_status";
2389
+ const SET_STATUS_TOOL_SHAPES = { [SET_STATUS_TOOL]: {
2390
+ description: "Set the one-line status shown under your name in the human's session list, like a chat status: what you are doing, waiting on, or need from them (\"waiting on CI\", \"blocked: needs an API key\", \"done, ready for review\"). It stays until you change it and clears when your conversation is reset. Pass an empty `text` to clear it. Keep it short and current; it is a glance, not a log.",
2391
+ shape: {
2392
+ text: z.string().max(STATUS_LABEL_TEXT_MAX).describe("The status line; empty clears it"),
2393
+ emoji: z.string().max(STATUS_LABEL_EMOJI_MAX).optional().describe("One emoji shown before the text")
2394
+ }
2395
+ } };
2396
+ const SET_STATUS_TOOLS = defineToolFamily(SET_STATUS_TOOL_SHAPES, { [SET_STATUS_TOOL]: async (sink, _from, input) => {
2397
+ const text = input.text.replace(/\s+/g, " ").trim();
2398
+ const emoji = input.emoji?.trim();
2399
+ const label = sink(text ? emoji ? {
2400
+ text,
2401
+ emoji
2402
+ } : { text } : null);
2403
+ return {
2404
+ text: label ? `Status set: ${label.emoji ? `${label.emoji} ` : ""}${label.text}` : "Status cleared",
2405
+ isError: false
2406
+ };
2407
+ } });
2408
+ const SET_STATUS_TOOL_SHAPE = SET_STATUS_TOOL_SHAPES[SET_STATUS_TOOL];
2409
+ function isSetStatusToolName(name) {
2410
+ return SET_STATUS_TOOLS.is(name);
2411
+ }
2412
+ function runSetStatusTool(sink, from, args) {
2413
+ return SET_STATUS_TOOLS.run(sink, from, SET_STATUS_TOOL, args);
2414
+ }
2415
+ //#endregion
2339
2416
  //#region src/lib/shells.ts
2340
2417
  const SHELL_REFUSAL = "shell commands are not available on this session";
2341
2418
  const SHELL_WRITE_REFUSAL = "the agent may not start, type into or kill shells on this session (shell.agentWrite is read-only)";
@@ -2684,13 +2761,23 @@ function shellDirectoryHandle(own) {
2684
2761
  //#endregion
2685
2762
  //#region src/lib/session-tools.ts
2686
2763
  function sessionTools(sources, from) {
2687
- const { report, reset, peers, shells, write } = sources;
2764
+ const { report, status, avatar, reset, peers, shells, write } = sources;
2688
2765
  return [
2689
2766
  ...report ? [{
2690
2767
  name: SESSION_INFO_TOOL,
2691
2768
  ...SESSION_INFO_TOOL_SHAPE,
2692
2769
  run: () => runSessionInfoTool(report, from())
2693
2770
  }] : [],
2771
+ ...status ? [{
2772
+ name: SET_STATUS_TOOL,
2773
+ ...SET_STATUS_TOOL_SHAPE,
2774
+ run: (args) => runSetStatusTool(status, from(), args)
2775
+ }] : [],
2776
+ ...avatar ? [{
2777
+ name: CHANGE_AVATAR_TOOL,
2778
+ ...CHANGE_AVATAR_TOOL_SHAPE,
2779
+ run: (args) => runChangeAvatarTool(avatar, from(), args)
2780
+ }] : [],
2694
2781
  ...reset ? [{
2695
2782
  name: CONTEXT_RESET_TOOL,
2696
2783
  ...CONTEXT_RESET_TOOL_SHAPE,
@@ -2713,6 +2800,8 @@ function sessionToolSpecs(sources) {
2713
2800
  }
2714
2801
  function runSessionTool(sources, from, name, args) {
2715
2802
  if (sources.report && isSessionInfoToolName(name)) return runSessionInfoTool(sources.report, from);
2803
+ if (sources.status && isSetStatusToolName(name)) return runSetStatusTool(sources.status, from, args);
2804
+ if (sources.avatar && isChangeAvatarToolName(name)) return runChangeAvatarTool(sources.avatar, from, args);
2716
2805
  if (sources.reset && isContextResetToolName(name)) return runContextResetTool(sources.reset, from, args);
2717
2806
  if (sources.peers && isPeerToolName(name)) return runPeerTool(sources.peers, from, name, args);
2718
2807
  if (sources.shells && isShellToolName(name)) return runShellTool(sources.shells, from, name, args, { write: sources.write });
@@ -5362,6 +5451,8 @@ function createToolContext(options) {
5362
5451
  }
5363
5452
  const gatewayTools = sessionTools({
5364
5453
  report: options.report,
5454
+ status: options.status,
5455
+ avatar: options.avatar,
5365
5456
  reset: options.contextReset,
5366
5457
  peers: options.peers,
5367
5458
  shells: options.shells,
@@ -5539,10 +5630,15 @@ function createEngineSession(options) {
5539
5630
  onFileDelivered: options.capabilities?.deliverFiles === false || !isGranted("deliverFiles") ? void 0 : (file) => runner?.emitFileDelivered(file),
5540
5631
  peers: options.config.peers,
5541
5632
  contextReset: options.config.contextReset,
5633
+ avatar: options.config.avatar,
5542
5634
  shells: options.config.shells,
5543
5635
  shellWrite: options.config.shellAgentWrite !== void 0,
5544
5636
  selfId: () => runner?.id ?? "pending",
5545
- report: () => runner ? runner.sessionReport() : Promise.reject(/* @__PURE__ */ new Error("session is still starting"))
5637
+ report: () => runner ? runner.sessionReport() : Promise.reject(/* @__PURE__ */ new Error("session is still starting")),
5638
+ status: (label) => {
5639
+ if (!runner) throw new Error("session is still starting");
5640
+ return runner.setStatusLabel(label);
5641
+ }
5546
5642
  });
5547
5643
  const declaredServers = options.profile?.session?.mcpServers;
5548
5644
  const connected = options.mcp?.tools ?? options.mcpTools;
@@ -8332,6 +8428,6 @@ function getEngineAdapter(engine) {
8332
8428
  return ADAPTERS[engine ?? "claude"];
8333
8429
  }
8334
8430
  //#endregion
8335
- export { AiSdkRunner, BrowserBridgeExecutor, CLAUDE_CATALOG, CODEX_CATALOG, CONTEXT_RESET_PROMPT_MAX, CONTEXT_RESET_REASON_MAX, CONTEXT_RESET_TOOL, CodexRunner, CostLedger, DeferredExecutor, GATEWAY_SECRET_ENV_KEYS, InputQueue, JsonRpcError, JsonRpcStdioConnection, LocalCommandQueue, PEER_MCP_SERVER, PEER_MESSAGE_MAX_CHARS, PEER_RECENT_DEFAULT, PEER_RECENT_MAX, PEER_TOOL_NAMES, PendingRequestRegistry, QuickJsExecutor, SESSION_INFO_TOOL, 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, SessionRunner, TTY_REDRAW_CARRY, agentMayWrite, attachmentContentBlocks, attachmentKind, attachmentRef, buildSessionReport, checkClaudeAuth, clampShellTail, claudeAdapter, codexAdapter, composeInstructions, connectAppServer, connectMcpTools, contextResetDirectoryHandle, countLines, createEngineSession, createToolContext, createWebFetch, encodeShellKey, encodeShellKeys, getEngineAdapter, headTail, htmlToMarkdown, installContextResetDirectory, 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, withoutPeerContext };
8431
+ export { AVATAR_SEED_MAX, AiSdkRunner, BrowserBridgeExecutor, CHANGE_AVATAR_TOOL, CLAUDE_CATALOG, CODEX_CATALOG, CONTEXT_RESET_PROMPT_MAX, CONTEXT_RESET_REASON_MAX, CONTEXT_RESET_TOOL, CodexRunner, CostLedger, DeferredExecutor, GATEWAY_SECRET_ENV_KEYS, InputQueue, JsonRpcError, JsonRpcStdioConnection, LocalCommandQueue, PEER_MCP_SERVER, PEER_MESSAGE_MAX_CHARS, PEER_RECENT_DEFAULT, PEER_RECENT_MAX, PEER_TOOL_NAMES, PendingRequestRegistry, QuickJsExecutor, SESSION_INFO_TOOL, SET_STATUS_TOOL, 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, SessionRunner, TTY_REDRAW_CARRY, agentMayWrite, attachmentContentBlocks, attachmentKind, attachmentRef, avatarDirectoryHandle, buildSessionReport, checkClaudeAuth, clampShellTail, claudeAdapter, codexAdapter, composeInstructions, connectAppServer, connectMcpTools, contextResetDirectoryHandle, countLines, createEngineSession, createToolContext, createWebFetch, encodeShellKey, encodeShellKeys, getEngineAdapter, headTail, htmlToMarkdown, installAvatarDirectory, installContextResetDirectory, 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, withoutPeerContext };
8336
8432
 
8337
8433
  //# sourceMappingURL=index.mjs.map