@yukino.js/yukino 0.0.13 → 0.0.14

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.
Files changed (38) hide show
  1. package/README.md +12 -10
  2. package/dist/{a2a-DKWMWGID.js → a2a-D7KSHNUT.js} +4 -3
  3. package/dist/{acp-RL6DKS3R.js → acp-W4R5P6CZ.js} +7 -7
  4. package/dist/{anthropic-74ALYMH2.js → anthropic-DSNN5AE5.js} +1 -1
  5. package/dist/browser/dist/index.html +44 -0
  6. package/dist/browser/dist/static/index.css +2 -0
  7. package/dist/{fe → browser}/dist/static/index.js +48 -48
  8. package/dist/{chunk-A5G5NTDB.js → chunk-D2SZ6GQJ.js} +184 -186
  9. package/dist/{chunk-APJAUOF6.js → chunk-GVRZBATW.js} +1 -1
  10. package/dist/{chunk-CJSMVCUF.js → chunk-I356BFD2.js} +1 -1
  11. package/dist/chunk-JDK4YHNF.js +63 -0
  12. package/dist/{chunk-NEU4ER5V.js → chunk-T6WQ3Z5J.js} +1 -1
  13. package/dist/{chunk-6JUOKMSJ.js → chunk-UUWXDH7J.js} +1 -1
  14. package/dist/{chunk-6FSIG63T.js → chunk-WKSVBXUO.js} +10 -9
  15. package/dist/{chunk-556TRLPT.js → chunk-Z3EFT645.js} +1 -1
  16. package/dist/lib/{anthropic-EQRUGP2C.js → anthropic-TDNNKQMT.js} +4 -4
  17. package/dist/lib/{chunk-EGT7BJRD.js → chunk-56DL5ZYL.js} +2 -2
  18. package/dist/lib/{chunk-WWCSFKMR.js → chunk-BRLCCEU7.js} +1 -1
  19. package/dist/lib/{chunk-JYCSWXCR.js → chunk-EJNKEFE7.js} +2 -2
  20. package/dist/lib/{chunk-CDMR25FD.js → chunk-IZXMDC5O.js} +3 -3
  21. package/dist/lib/{chunk-UBVKYJFI.js → chunk-UKXGO7AW.js} +143 -300
  22. package/dist/lib/{chunk-HUTUNNDX.js → chunk-WNGF7243.js} +0 -1
  23. package/dist/lib/{chunk-FUJDUZTH.js → chunk-WXR5HNB4.js} +1 -1
  24. package/dist/lib/index.d.ts +70 -275
  25. package/dist/lib/index.js +385 -1243
  26. package/dist/lib/{openai-B3I5WBFT.js → openai-6VYIA7CT.js} +3 -3
  27. package/dist/lib/{providers-EJ4VBHNP.js → providers-UXL5FVF7.js} +2 -2
  28. package/dist/lib/{tool-filter-TURPCYFR.js → tool-filter-O6YLSFAS.js} +3 -3
  29. package/dist/{main-JEEKFCGX.js → main-FOIMPIOD.js} +220 -221
  30. package/dist/main.js +2 -2
  31. package/dist/{providers-U23PWAHG.js → providers-TH6MQC7V.js} +1 -1
  32. package/dist/{server-EOSEQPNY.js → server-TC5GDF6E.js} +1 -1
  33. package/dist/tool-filter-SYH5ZFC2.js +4 -0
  34. package/package.json +6 -6
  35. package/dist/chunk-SCR7NDDL.js +0 -63
  36. package/dist/fe/dist/index.html +0 -21
  37. package/dist/fe/dist/static/index.css +0 -2
  38. package/dist/tool-filter-UDSHRE5F.js +0 -4
@@ -235,7 +235,7 @@ declare namespace index$y {
235
235
  export { index$y_GOAL_RECORD as GOAL_RECORD, index$y_GoalManager as GoalManager, index$y_GoalSchema as GoalSchema, type index$y_GoalState as GoalState, index$y_MAX_GOAL_TURNS as MAX_GOAL_TURNS, index$y_handleGoalCommand as handleGoalCommand };
236
236
  }
237
237
 
238
- declare function requestToolPermission(handler: PermissionRequestHandler, toolName: string, args: Record<string, unknown>, decision: Decision, toolCallId: string, signal?: AbortSignal): ReturnType<PermissionRequestHandler>;
238
+ declare function requestToolPermission(handler: PermissionRequestHandler, toolName: string, args: Record<string, unknown>, decision: Decision, toolCallId: string, signal?: AbortSignal, source?: PermissionRequestSource): ReturnType<PermissionRequestHandler>;
239
239
 
240
240
  declare const request_requestToolPermission: typeof requestToolPermission;
241
241
  declare namespace request {
@@ -282,21 +282,19 @@ declare function isSafeCommand(command: string): boolean;
282
282
  declare class PermissionChecker {
283
283
  private readonly cwd;
284
284
  private modeState;
285
- private delegated;
286
- planModeLocked: boolean;
285
+ private parent?;
287
286
  planFilePath: string;
288
287
  teammate: boolean;
289
288
  sandboxEnabled: boolean;
290
289
  sandboxAutoAllow: boolean;
291
290
  private sandbox;
292
291
  private ruleEngine;
293
- constructor(cwd: string, mode?: PermissionMode, modeSource?: () => PermissionMode);
292
+ constructor(cwd: string, mode?: PermissionMode);
294
293
  get mode(): PermissionMode;
295
294
  set mode(mode: PermissionMode);
296
- get delegatedMode(): Exclude<PermissionMode, "plan">;
297
295
  subscribeMode(listener: () => void): () => void;
298
296
  forCwd(cwd: string): PermissionChecker;
299
- forSubagent(cwd: string): PermissionChecker;
297
+ forSubagent(cwd: string, mode?: PermissionMode): PermissionChecker;
300
298
  check(toolName: string, category: "read" | "write" | "command", args: Record<string, unknown>): Decision;
301
299
  allowExtraRoot(path: string): void;
302
300
  allowAlways(toolName: string, args: Record<string, unknown>): void;
@@ -423,7 +421,11 @@ interface ToolResult {
423
421
  contentBlocks?: ToolResultContentBlock[];
424
422
  isError: boolean;
425
423
  }
426
- type PermissionRequestHandler = (toolName: string, args: Record<string, unknown>, decision: Decision, toolCallId: string, abortSignal?: AbortSignal) => Promise<"allow" | "deny" | "allowAlways">;
424
+ interface PermissionRequestSource {
425
+ agentName: string;
426
+ cwd: string;
427
+ }
428
+ type PermissionRequestHandler = (toolName: string, args: Record<string, unknown>, decision: Decision, toolCallId: string, abortSignal?: AbortSignal, source?: PermissionRequestSource) => Promise<"allow" | "deny" | "allowAlways">;
427
429
  interface ToolContext {
428
430
  cwd: string;
429
431
  goalManager?: GoalManager;
@@ -451,6 +453,7 @@ interface ToolContext {
451
453
  fileHistory?: FileHistory | undefined;
452
454
  fileStateCache?: FileStateCache | undefined;
453
455
  permissionChecker?: PermissionChecker;
456
+ approvedPermissionMode?: PermissionChecker["mode"];
454
457
  onPermissionRequest?: PermissionRequestHandler;
455
458
  }
456
459
  /**
@@ -542,6 +545,7 @@ type types$1_McpLoadingMode = McpLoadingMode;
542
545
  type types$1_OpenAICompatToolSchema = OpenAICompatToolSchema;
543
546
  type types$1_OpenAIResponsesToolSchema = OpenAIResponsesToolSchema;
544
547
  type types$1_PermissionRequestHandler = PermissionRequestHandler;
548
+ type types$1_PermissionRequestSource = PermissionRequestSource;
545
549
  type types$1_ProviderToolSchema = ProviderToolSchema;
546
550
  declare const types$1_SKIP_DIRS: typeof SKIP_DIRS;
547
551
  type types$1_Tool = Tool;
@@ -554,7 +558,7 @@ type types$1_ToolSchema = ToolSchema;
554
558
  declare const types$1_isToolResultContentBlock: typeof isToolResultContentBlock;
555
559
  declare const types$1_normalizeToolResultContentBlock: typeof normalizeToolResultContentBlock;
556
560
  declare namespace types$1 {
557
- export { type types$1_AnthropicToolSchema as AnthropicToolSchema, type types$1_MCPToolLike as MCPToolLike, type types$1_McpLoadingMode as McpLoadingMode, type types$1_OpenAICompatToolSchema as OpenAICompatToolSchema, type types$1_OpenAIResponsesToolSchema as OpenAIResponsesToolSchema, type types$1_PermissionRequestHandler as PermissionRequestHandler, type types$1_ProviderToolSchema as ProviderToolSchema, types$1_SKIP_DIRS as SKIP_DIRS, type types$1_Tool as Tool, type types$1_ToolCategory as ToolCategory, type types$1_ToolContext as ToolContext, type types$1_ToolProtocol as ToolProtocol, type types$1_ToolResult as ToolResult, type types$1_ToolResultContentBlock as ToolResultContentBlock, type types$1_ToolSchema as ToolSchema, types$1_isToolResultContentBlock as isToolResultContentBlock, types$1_normalizeToolResultContentBlock as normalizeToolResultContentBlock };
561
+ export { type types$1_AnthropicToolSchema as AnthropicToolSchema, type types$1_MCPToolLike as MCPToolLike, type types$1_McpLoadingMode as McpLoadingMode, type types$1_OpenAICompatToolSchema as OpenAICompatToolSchema, type types$1_OpenAIResponsesToolSchema as OpenAIResponsesToolSchema, type types$1_PermissionRequestHandler as PermissionRequestHandler, type types$1_PermissionRequestSource as PermissionRequestSource, type types$1_ProviderToolSchema as ProviderToolSchema, types$1_SKIP_DIRS as SKIP_DIRS, type types$1_Tool as Tool, type types$1_ToolCategory as ToolCategory, type types$1_ToolContext as ToolContext, type types$1_ToolProtocol as ToolProtocol, type types$1_ToolResult as ToolResult, type types$1_ToolResultContentBlock as ToolResultContentBlock, type types$1_ToolSchema as ToolSchema, types$1_isToolResultContentBlock as isToolResultContentBlock, types$1_normalizeToolResultContentBlock as normalizeToolResultContentBlock };
558
562
  }
559
563
 
560
564
  declare function expandAtRefs(text: string, cwd: string): string;
@@ -2202,7 +2206,7 @@ declare namespace privacy {
2202
2206
  export { privacy_scrubTelemetryPayload as scrubTelemetryPayload };
2203
2207
  }
2204
2208
 
2205
- type TelemetryMode = "a2a" | "acp" | "print" | "remote" | "teammate" | "terminal" | "unknown";
2209
+ type TelemetryMode = "a2a" | "acp" | "print" | "remote" | "terminal" | "unknown";
2206
2210
  type TelemetryObservationKind = "agent" | "generation" | "tool";
2207
2211
  type TelemetryMetricKind = "counter" | "histogram";
2208
2212
  type TelemetryAttributes = Record<string, string | number | boolean>;
@@ -2312,6 +2316,7 @@ declare namespace streamingExecutor {
2312
2316
  }
2313
2317
 
2314
2318
  interface AgentConfig {
2319
+ agentName?: string;
2315
2320
  client: LLMClient;
2316
2321
  registry: ToolRegistry;
2317
2322
  checker: PermissionChecker;
@@ -2380,6 +2385,7 @@ declare class Agent {
2380
2385
  private onLoopComplete?;
2381
2386
  private compactTracking;
2382
2387
  private onPermissionRequest?;
2388
+ private agentName;
2383
2389
  private toolFilter?;
2384
2390
  private coordinatorActiveFn?;
2385
2391
  activeSkills: Map<string, string>;
@@ -2458,6 +2464,7 @@ interface InteractionSummary {
2458
2464
  failedToolCalls: number;
2459
2465
  /** Uncached prompt tokens; the cached prefix is counted separately. */
2460
2466
  inputTokens: number;
2467
+ latestVersion?: string;
2461
2468
  outputTokens: number;
2462
2469
  sessionId: string;
2463
2470
  startedAt: number;
@@ -3128,13 +3135,6 @@ declare const TeamMemberEntrySchema: z$1.ZodObject<{
3128
3135
  model: z$1.ZodOptional<z$1.ZodString>;
3129
3136
  joinedAt: z$1.ZodNumber;
3130
3137
  worktreePath: z$1.ZodOptional<z$1.ZodString>;
3131
- backendType: z$1.ZodEnum<{
3132
- "in-process": "in-process";
3133
- tmux: "tmux";
3134
- iterm: "iterm";
3135
- }>;
3136
- paneId: z$1.ZodOptional<z$1.ZodString>;
3137
- workerPid: z$1.ZodOptional<z$1.ZodNumber>;
3138
3138
  isActive: z$1.ZodBoolean;
3139
3139
  }, z$1.core.$strip>;
3140
3140
  type TeamMemberEntry = z$1.infer<typeof TeamMemberEntrySchema>;
@@ -3146,19 +3146,10 @@ type TeamMemberEntry = z$1.infer<typeof TeamMemberEntrySchema>;
3146
3146
  * with both sides correlated by member name.
3147
3147
  *
3148
3148
  * This file serves Leader-side cross-restart continuity: TeamManager.get()
3149
- * hydrates the roster and recreates runtime UI/stop handles for active members.
3150
- * Pane teammates read it for leader liveness (leaderPid): a teammate whose
3151
- * leader has been gone for a sustained period exits instead of polling forever.
3152
- * Teammates receive the team name, member name, and mailbox directory via
3153
- * command-line flags at spawn.
3149
+ * hydrates the roster and marks interrupted runtimes inactive.
3154
3150
  */
3155
3151
  declare const TeamFileSchema: z$1.ZodObject<{
3156
3152
  name: z$1.ZodString;
3157
- mode: z$1.ZodEnum<{
3158
- "in-process": "in-process";
3159
- tmux: "tmux";
3160
- iterm: "iterm";
3161
- }>;
3162
3153
  description: z$1.ZodOptional<z$1.ZodString>;
3163
3154
  createdAt: z$1.ZodNumber;
3164
3155
  leaderAgentId: z$1.ZodString;
@@ -3168,7 +3159,6 @@ declare const TeamFileSchema: z$1.ZodObject<{
3168
3159
  plan: "plan";
3169
3160
  bypassPermissions: "bypassPermissions";
3170
3161
  }>;
3171
- leaderPid: z$1.ZodOptional<z$1.ZodNumber>;
3172
3162
  members: z$1.ZodArray<z$1.ZodObject<{
3173
3163
  agentId: z$1.ZodString;
3174
3164
  name: z$1.ZodString;
@@ -3176,13 +3166,6 @@ declare const TeamFileSchema: z$1.ZodObject<{
3176
3166
  model: z$1.ZodOptional<z$1.ZodString>;
3177
3167
  joinedAt: z$1.ZodNumber;
3178
3168
  worktreePath: z$1.ZodOptional<z$1.ZodString>;
3179
- backendType: z$1.ZodEnum<{
3180
- "in-process": "in-process";
3181
- tmux: "tmux";
3182
- iterm: "iterm";
3183
- }>;
3184
- paneId: z$1.ZodOptional<z$1.ZodString>;
3185
- workerPid: z$1.ZodOptional<z$1.ZodNumber>;
3186
3169
  isActive: z$1.ZodBoolean;
3187
3170
  }, z$1.core.$strip>>;
3188
3171
  }, z$1.core.$strip>;
@@ -3190,7 +3173,7 @@ type TeamFile = z$1.infer<typeof TeamFileSchema>;
3190
3173
  /**
3191
3174
  * Project-scoped root directory for team data. The canonical cwd is
3192
3175
  * hashed so unrelated projects cannot restore, list, mutate, or delete each
3193
- * other's teams while pane teammates can still use a home-anchored path.
3176
+ * other's teams.
3194
3177
  */
3195
3178
  declare function teamsBaseDir(cwd: string): string;
3196
3179
  /**
@@ -3221,7 +3204,6 @@ declare function readTeamFileAtPath(path: string): TeamFile | null;
3221
3204
  * Persistence remains best-effort for the in-memory team.
3222
3205
  */
3223
3206
  declare function writeTeamFile(cwd: string, name: string, file: TeamFile, removedMembers?: string[]): void;
3224
- declare function registerTeammateProcess(configPath: string, memberName: string, pid: number): void;
3225
3207
 
3226
3208
  type teamFile_TeamFile = TeamFile;
3227
3209
  type teamFile_TeamMemberEntry = TeamMemberEntry;
@@ -3229,14 +3211,13 @@ declare const teamFile_TeamMemberEntrySchema: typeof TeamMemberEntrySchema;
3229
3211
  declare const teamFile_listTeamNames: typeof listTeamNames;
3230
3212
  declare const teamFile_readTeamFile: typeof readTeamFile;
3231
3213
  declare const teamFile_readTeamFileAtPath: typeof readTeamFileAtPath;
3232
- declare const teamFile_registerTeammateProcess: typeof registerTeammateProcess;
3233
3214
  declare const teamFile_sanitizeTeamName: typeof sanitizeTeamName;
3234
3215
  declare const teamFile_teamConfigPath: typeof teamConfigPath;
3235
3216
  declare const teamFile_teamDir: typeof teamDir;
3236
3217
  declare const teamFile_teamsBaseDir: typeof teamsBaseDir;
3237
3218
  declare const teamFile_writeTeamFile: typeof writeTeamFile;
3238
3219
  declare namespace teamFile {
3239
- export { type teamFile_TeamFile as TeamFile, type teamFile_TeamMemberEntry as TeamMemberEntry, teamFile_TeamMemberEntrySchema as TeamMemberEntrySchema, teamFile_listTeamNames as listTeamNames, teamFile_readTeamFile as readTeamFile, teamFile_readTeamFileAtPath as readTeamFileAtPath, teamFile_registerTeammateProcess as registerTeammateProcess, teamFile_sanitizeTeamName as sanitizeTeamName, teamFile_teamConfigPath as teamConfigPath, teamFile_teamDir as teamDir, teamFile_teamsBaseDir as teamsBaseDir, teamFile_writeTeamFile as writeTeamFile };
3220
+ export { type teamFile_TeamFile as TeamFile, type teamFile_TeamMemberEntry as TeamMemberEntry, teamFile_TeamMemberEntrySchema as TeamMemberEntrySchema, teamFile_listTeamNames as listTeamNames, teamFile_readTeamFile as readTeamFile, teamFile_readTeamFileAtPath as readTeamFileAtPath, teamFile_sanitizeTeamName as sanitizeTeamName, teamFile_teamConfigPath as teamConfigPath, teamFile_teamDir as teamDir, teamFile_teamsBaseDir as teamsBaseDir, teamFile_writeTeamFile as writeTeamFile };
3240
3221
  }
3241
3222
 
3242
3223
  interface AgentDefinition {
@@ -3247,7 +3228,7 @@ interface AgentDefinition {
3247
3228
  systemPromptOverride?: string;
3248
3229
  maxTurns?: number;
3249
3230
  model?: string;
3250
- permissionMode?: "plan";
3231
+ permissionMode?: PermissionMode;
3251
3232
  background?: boolean;
3252
3233
  isolation?: "worktree";
3253
3234
  initialPrompt?: string;
@@ -3285,6 +3266,7 @@ type SubagentProgressEvent = {
3285
3266
  };
3286
3267
  type AgentEventSink = (event: SubagentProgressEvent) => void;
3287
3268
  interface SubagentRunOptions {
3269
+ agentName?: string;
3288
3270
  abortSignal?: AbortSignal;
3289
3271
  background?: boolean;
3290
3272
  onPermissionRequest?: AgentConfig["onPermissionRequest"];
@@ -3295,9 +3277,7 @@ interface SubagentRunOptions {
3295
3277
  * In-process teammate turns pass false: a teammate loop is one run per task
3296
3278
  * turn, so the turn-end stopAll() would immediately kill anything the
3297
3279
  * teammate backgrounded, and the drain disappears before any notification
3298
- * could be delivered. Teammates stay purely foreground (matching the
3299
- * subprocess teammate path); neither path exposes the Agent tool, so a
3300
- * teammate never has subagents of its own.
3280
+ * could be delivered. Teammates stay purely foreground and do not expose the Agent tool.
3301
3281
  */
3302
3282
  backgroundTasks?: boolean;
3303
3283
  }
@@ -3315,53 +3295,6 @@ declare namespace spawn {
3315
3295
  export { type spawn_AgentEventSink as AgentEventSink, spawn_SUBAGENT_INTERRUPTED_MARKER as SUBAGENT_INTERRUPTED_MARKER, type spawn_SubagentProgressEvent as SubagentProgressEvent, type spawn_SubagentRunOptions as SubagentRunOptions, spawn_spawnSubagent as spawnSubagent };
3316
3296
  }
3317
3297
 
3318
- /**
3319
- * Auto-detect the best backend for running teammates.
3320
- *
3321
- * Auto-detection logic:
3322
- * - Windows: always **in-process**.
3323
- * - Otherwise: tmux/iTerm panes when the corresponding environment is
3324
- * detected (TMUX / ITERM_SESSION_ID), else **in-process** so progress
3325
- * tracking works (agent events flow in the same process and can update
3326
- * the teammate progress UI in real time).
3327
- *
3328
- * In-process teammates share the Node.js event loop but are context-isolated.
3329
- * They communicate via the same file-based mailbox as external teammates.
3330
- */
3331
- declare function detectBackend(): TeamMode;
3332
- /**
3333
- * Detect available pane backend from the environment (TMUX /
3334
- * ITERM_SESSION_ID); falls back to in-process. Called unconditionally by
3335
- * detectBackend on non-Windows platforms.
3336
- */
3337
- declare function detectBackendFromEnv(): TeamMode;
3338
- /** Rebuilds the stable cancellation handle available for a restored tmux member. */
3339
- declare function restoreTeammateCancel(mode: TeamMode, paneId?: string): (() => void) | undefined;
3340
- interface SpawnConfig {
3341
- mode: Exclude<TeamMode, "in-process">;
3342
- command: string;
3343
- args: string[];
3344
- cwd: string;
3345
- paneId?: string;
3346
- }
3347
- declare function isProcessAlive(pid: number): boolean;
3348
- declare function isTeammateAlive(mode: TeamMode, paneId?: string, workerPid?: number): boolean;
3349
- declare function spawnTeammate(config: SpawnConfig): {
3350
- cancel: () => void;
3351
- paneId?: string;
3352
- };
3353
-
3354
- type backend_SpawnConfig = SpawnConfig;
3355
- declare const backend_detectBackend: typeof detectBackend;
3356
- declare const backend_detectBackendFromEnv: typeof detectBackendFromEnv;
3357
- declare const backend_isProcessAlive: typeof isProcessAlive;
3358
- declare const backend_isTeammateAlive: typeof isTeammateAlive;
3359
- declare const backend_restoreTeammateCancel: typeof restoreTeammateCancel;
3360
- declare const backend_spawnTeammate: typeof spawnTeammate;
3361
- declare namespace backend {
3362
- export { type backend_SpawnConfig as SpawnConfig, backend_detectBackend as detectBackend, backend_detectBackendFromEnv as detectBackendFromEnv, backend_isProcessAlive as isProcessAlive, backend_isTeammateAlive as isTeammateAlive, backend_restoreTeammateCancel as restoreTeammateCancel, backend_spawnTeammate as spawnTeammate };
3363
- }
3364
-
3365
3298
  declare function isCoordinatorTool(name: string): boolean;
3366
3299
  /**
3367
3300
  * Returns the tool-filter predicate for the Leader Agent.
@@ -3421,11 +3354,6 @@ declare const TEAMMATE_COORDINATION_TOOLS: ReadonlySet<string>;
3421
3354
  declare function isValidTeammateName(name: string): boolean;
3422
3355
  /** Text control form used by the leader's stop path and the agents dialog. */
3423
3356
  declare const SHUTDOWN_PREFIX = "[shutdown]";
3424
- /**
3425
- * Generates a request identifier. Uses a random string rather than an auto-incrementing
3426
- * sequence because requests may originate from teammates in different processes,
3427
- * where an incrementing counter would collide across process boundaries.
3428
- */
3429
3357
  declare function newRequestId(): string;
3430
3358
  /**
3431
3359
  * Shutdown request. The text carries the reason so the recipient can decide
@@ -3437,21 +3365,14 @@ declare function shutdownRequest(from: string, reason?: string): FileMailMessage
3437
3365
  declare function shutdownResponse(from: string, requestId: string, approve: boolean, reason?: string): FileMailMessage;
3438
3366
  /** Plan approval request; text contains the full plan content. */
3439
3367
  declare function planApprovalRequest(from: string, plan: string): FileMailMessage;
3440
- /** Approval result; on rejection, feedback explains what needs to change. */
3441
- declare function planApprovalResponse(from: string, requestId: string, approve: boolean, feedback?: string): FileMailMessage;
3368
+ /** Records the runtime's automatic plan approval. */
3369
+ declare function planApprovalResponse(from: string, requestId: string, feedback?: string): FileMailMessage;
3442
3370
  /**
3443
3371
  * Determines whether a message is a shutdown request.
3444
3372
  *
3445
3373
  * Both the typed protocol and the leader's plain-text stop control are accepted.
3446
3374
  */
3447
3375
  declare function isShutdownRequest(m: FileMailMessage): boolean;
3448
- /**
3449
- * Whether the response constitutes approval. When the field is absent, it is
3450
- * treated as not approved — silence is never interpreted as consent; the
3451
- * requester follows the rejection path instead (for plan approval, the
3452
- * teammate revises and resubmits).
3453
- */
3454
- declare function approved(m: FileMailMessage): boolean;
3455
3376
 
3456
3377
  declare const protocol_LEADER_NAME: typeof LEADER_NAME;
3457
3378
  declare const protocol_MSG_PLAN_APPROVAL_REQUEST: typeof MSG_PLAN_APPROVAL_REQUEST;
@@ -3461,7 +3382,6 @@ declare const protocol_MSG_SHUTDOWN_RESPONSE: typeof MSG_SHUTDOWN_RESPONSE;
3461
3382
  declare const protocol_MSG_TEXT: typeof MSG_TEXT;
3462
3383
  declare const protocol_SHUTDOWN_PREFIX: typeof SHUTDOWN_PREFIX;
3463
3384
  declare const protocol_TEAMMATE_COORDINATION_TOOLS: typeof TEAMMATE_COORDINATION_TOOLS;
3464
- declare const protocol_approved: typeof approved;
3465
3385
  declare const protocol_isShutdownRequest: typeof isShutdownRequest;
3466
3386
  declare const protocol_isValidTeammateName: typeof isValidTeammateName;
3467
3387
  declare const protocol_newRequestId: typeof newRequestId;
@@ -3470,7 +3390,7 @@ declare const protocol_planApprovalResponse: typeof planApprovalResponse;
3470
3390
  declare const protocol_shutdownRequest: typeof shutdownRequest;
3471
3391
  declare const protocol_shutdownResponse: typeof shutdownResponse;
3472
3392
  declare namespace protocol {
3473
- export { protocol_LEADER_NAME as LEADER_NAME, protocol_MSG_PLAN_APPROVAL_REQUEST as MSG_PLAN_APPROVAL_REQUEST, protocol_MSG_PLAN_APPROVAL_RESPONSE as MSG_PLAN_APPROVAL_RESPONSE, protocol_MSG_SHUTDOWN_REQUEST as MSG_SHUTDOWN_REQUEST, protocol_MSG_SHUTDOWN_RESPONSE as MSG_SHUTDOWN_RESPONSE, protocol_MSG_TEXT as MSG_TEXT, protocol_SHUTDOWN_PREFIX as SHUTDOWN_PREFIX, protocol_TEAMMATE_COORDINATION_TOOLS as TEAMMATE_COORDINATION_TOOLS, protocol_approved as approved, protocol_isShutdownRequest as isShutdownRequest, protocol_isValidTeammateName as isValidTeammateName, protocol_newRequestId as newRequestId, protocol_planApprovalRequest as planApprovalRequest, protocol_planApprovalResponse as planApprovalResponse, protocol_shutdownRequest as shutdownRequest, protocol_shutdownResponse as shutdownResponse };
3393
+ export { protocol_LEADER_NAME as LEADER_NAME, protocol_MSG_PLAN_APPROVAL_REQUEST as MSG_PLAN_APPROVAL_REQUEST, protocol_MSG_PLAN_APPROVAL_RESPONSE as MSG_PLAN_APPROVAL_RESPONSE, protocol_MSG_SHUTDOWN_REQUEST as MSG_SHUTDOWN_REQUEST, protocol_MSG_SHUTDOWN_RESPONSE as MSG_SHUTDOWN_RESPONSE, protocol_MSG_TEXT as MSG_TEXT, protocol_SHUTDOWN_PREFIX as SHUTDOWN_PREFIX, protocol_TEAMMATE_COORDINATION_TOOLS as TEAMMATE_COORDINATION_TOOLS, protocol_isShutdownRequest as isShutdownRequest, protocol_isValidTeammateName as isValidTeammateName, protocol_newRequestId as newRequestId, protocol_planApprovalRequest as planApprovalRequest, protocol_planApprovalResponse as planApprovalResponse, protocol_shutdownRequest as shutdownRequest, protocol_shutdownResponse as shutdownResponse };
3474
3394
  }
3475
3395
 
3476
3396
  /**
@@ -3600,7 +3520,6 @@ declare namespace tools$1 {
3600
3520
  export { tools$1_ListTeamsTool as ListTeamsTool, tools$1_SendMessageTool as SendMessageTool, tools$1_TeamCreateTool as TeamCreateTool, tools$1_TeamDeleteTool as TeamDeleteTool };
3601
3521
  }
3602
3522
 
3603
- type TeamMode = "in-process" | "tmux" | "iterm";
3604
3523
  type AgentEventCallback = (event: SubagentProgressEvent) => void;
3605
3524
  interface Member {
3606
3525
  name: string;
@@ -3612,17 +3531,8 @@ interface Member {
3612
3531
  stopping?: Promise<void>;
3613
3532
  mailbox: FileMailbox;
3614
3533
  uiState?: TeammateUIState;
3615
- /** Stable tmux session name, persisted so cancellation survives leader restart. */
3616
- paneId?: string;
3617
- workerPid?: number;
3618
- /** Actual backend used by this member (which can differ after fallback). */
3619
- backendType?: TeamMode;
3620
- /** Whether this is an external-process teammate (tmux/iTerm); stopOne writes the mailbox shutdown notice only for external members. */
3621
- external?: boolean;
3622
- /** Optional: permission checker for the teammate. Plan mode uses it to determine the current state; permissions are elevated in place once approval is granted. */
3623
3534
  checker?: PermissionChecker;
3624
3535
  planApprovalRequired?: boolean;
3625
- readOnlyRole?: boolean;
3626
3536
  agentId?: string;
3627
3537
  agentType?: string;
3628
3538
  model?: string;
@@ -3632,23 +3542,15 @@ interface Member {
3632
3542
  type RunAgent = (task: string, onEvent?: AgentEventCallback, abortSignal?: AbortSignal) => Promise<string>;
3633
3543
  declare class Team {
3634
3544
  name: string;
3635
- mode: TeamMode;
3636
3545
  members: Map<string, Member>;
3637
3546
  leaderMailbox: FileMailbox;
3638
3547
  private mailboxDir;
3639
3548
  private cwd;
3640
- private lastLivenessCheck;
3641
3549
  leaderAgentId: string;
3642
3550
  permissionMode: PermissionChecker["mode"];
3643
3551
  description?: string;
3644
3552
  createdAt: number;
3645
- /**
3646
- * PID of the leader process. Written to config.json so external teammates
3647
- * can detect a dead leader (they exit instead of polling forever); a
3648
- * restarted leader re-claims it when the team is restored from disk.
3649
- */
3650
- leaderPid: number;
3651
- constructor(name: string, mode: TeamMode, cwd: string);
3553
+ constructor(name: string, cwd: string);
3652
3554
  private createMember;
3653
3555
  addMember(name: string): Member;
3654
3556
  removeMember(name: string): void;
@@ -3671,38 +3573,13 @@ declare class Team {
3671
3573
  */
3672
3574
  persist(): void;
3673
3575
  static readonly IDLE_POLL_INTERVAL_MS = 500;
3674
- static readonly STOP_GRACE_MS = 2500;
3675
3576
  static readonly SHUTDOWN_PREFIX = "[shutdown]";
3676
- /**
3677
- * Spawns a teammate, dispatching by team backend mode.
3678
- * - in-process: runs the agent main loop in a background task within this process (idle-poll-continue).
3679
- * - tmux / iterm: assembles the teammate startup command and delegates to the backend to launch
3680
- * an independent worker process in a new pane / tab, communicating bidirectionally with the
3681
- * leader via the shared file-based mailbox.
3682
- * Falls back to in-process when the external backend is unavailable (tmux not installed,
3683
- * non-iTerm environment, etc.) to avoid crashes.
3684
- */
3685
- spawnTeammate(name: string, task: string, runAgent: RunAgent, checker?: PermissionChecker, providerIndex?: number, originToolCallId?: string, memberCwd?: string, role?: {
3577
+ spawnTeammate(name: string, task: string, runAgent: RunAgent, checker?: PermissionChecker, originToolCallId?: string, memberCwd?: string, role?: {
3686
3578
  agentType?: string;
3687
3579
  model?: string;
3688
3580
  planApprovalRequired?: boolean;
3689
- readOnly?: boolean;
3690
3581
  cleanup?: () => Promise<void>;
3691
- }): TeamMode;
3692
- /**
3693
- * tmux / iTerm backend: launches the teammate as an independent process in a new pane / tab.
3694
- * The teammate process connects back to the team via the same mailbox directory pointed to
3695
- * by `--team-dir`; task assignments from the leader and idle/result notifications from the
3696
- * worker all land in this directory, keeping both sides in sync.
3697
- */
3698
- private spawnExternal;
3699
- /**
3700
- * Starts an in-process teammate: runs the agent's main loop in the background,
3701
- * sends an idle notification upon completion, and then polls the mailbox for new tasks.
3702
- * Exits the loop upon receiving a shutdown message or being canceled.
3703
- * Uses the idle-poll-continue pattern: after each turn completes, reports idle and waits for the next task.
3704
- */
3705
- private spawnInProcess;
3582
+ }): void;
3706
3583
  /**
3707
3584
  * Polls the teammate's mailbox until a new message arrives.
3708
3585
  * Returns the concatenated prompt, or the shutdown message itself in the
@@ -3710,18 +3587,8 @@ declare class Team {
3710
3587
  * shutdown message from the leader is returned instead.
3711
3588
  */
3712
3589
  private waitForNextPromptOrShutdown;
3713
- /** Reads the teammate's plan file for review; returns a fallback note when empty or unreadable. */
3714
- private readPlanForReview;
3715
- /**
3716
- * Sends the teammate's completed plan to the Leader, blocks until approval is received,
3717
- * and returns the prompt to feed the model on the next turn.
3718
- *
3719
- * The teammate holds read-only permissions at this point, so no matter how long the
3720
- * wait, no damage can occur — hence no timeout is set here. Rather than timing out and
3721
- * autonomously modifying files, it is better to wait indefinitely and let the user
3722
- * drive progress from the Leader side. Returns null when the teammate has been
3723
- * deactivated; the caller should exit the main loop.
3724
- */
3590
+ /** Reads the submitted plan, falling back to the final response. */
3591
+ private readPlan;
3725
3592
  private runPlanApproval;
3726
3593
  getMember(name: string): Member | undefined;
3727
3594
  private waitForMember;
@@ -3729,63 +3596,33 @@ declare class Team {
3729
3596
  sendMessage(from: string, to: string, content: string): Promise<void>;
3730
3597
  stopMember(name: string): Promise<void>;
3731
3598
  stopAll(): Promise<void>;
3732
- /**
3733
- * Stops a single teammate: marks it inactive, updates UI state, and
3734
- * unregisters the name so SendMessage can no longer resolve it.
3735
- * External teammates get a grace window after the shutdown notice — they
3736
- * poll their mailbox every ~2 s, so waiting one poll interval lets the
3737
- * common (idle) case exit gracefully before the pane is force-killed.
3738
- * In-process teammates are stopped via cancel (abort) alone; `done` is then
3739
- * awaited so the loop has fully exited (external members have no promise).
3740
- */
3741
3599
  private stopOne;
3742
3600
  private stopMemberRuntime;
3743
3601
  listMembers(): Member[];
3744
3602
  getTeammateStates(): TeammateUIState[];
3745
- refreshExternalMembers(): void;
3746
3603
  pruneTerminatedMembers(): void;
3747
3604
  }
3748
- interface TeamManagerOptions {
3749
- /**
3750
- * Whether this manager acts as the team leader: leaders claim leaderPid on
3751
- * create/restore (persisted for teammate liveness checks), while teammate
3752
- * processes must leave it untouched. Defaults to true.
3753
- */
3754
- claimLeadership?: boolean;
3755
- }
3756
3605
  declare class TeamManager {
3757
3606
  /** Teams keyed by their canonical disk slug; Team.name remains the display name. */
3758
3607
  private teams;
3759
3608
  private cwd;
3760
- private claimLeadership;
3761
3609
  private permissionChecker?;
3762
3610
  private unsubscribePermissions?;
3763
3611
  private taskStores;
3764
3612
  private listeners;
3765
- constructor(cwd: string, opts?: TeamManagerOptions);
3613
+ constructor(cwd: string);
3766
3614
  subscribe(listener: () => void): () => void;
3767
3615
  private emitChange;
3768
3616
  setPermissionChecker(checker: PermissionChecker): void;
3769
3617
  private teamKey;
3770
3618
  private teamDir;
3771
- create(name: string, mode?: TeamMode, opts?: {
3619
+ create(name: string, opts?: {
3772
3620
  leaderAgentId?: string;
3773
3621
  description?: string;
3774
3622
  }): Team;
3775
- /**
3776
- * Checks the in-memory cache first; on miss, hydrates config.json without
3777
- * incremental member writes. Active members regain their runtime-facing UI,
3778
- * registry, and external cancellation metadata. A leader claims leadership
3779
- * with one final snapshot; teammate processes leave the file byte-identical.
3780
- */
3781
3623
  get(name: string): Team | undefined;
3782
- /**
3783
- * Loads every team found on disk into the manager. Called on leader startup
3784
- * so teams (and their leader mailboxes) survive a leader restart: external
3785
- * teammates keep running, and their notifications are drained again.
3786
- */
3787
3624
  restoreFromDisk(): void;
3788
- /** Retrieves the team's shared task store; loads from disk (tasks.json) when not cached in memory (e.g. in a teammate process). */
3625
+ /** Retrieves the team's shared task store, loading tasks.json after restoration. */
3789
3626
  getTaskStore(teamName: string): SharedTaskStore;
3790
3627
  list(): Team[];
3791
3628
  stopAll(): Promise<void>;
@@ -3814,10 +3651,8 @@ type index$m_Team = Team;
3814
3651
  declare const index$m_Team: typeof Team;
3815
3652
  type index$m_TeamManager = TeamManager;
3816
3653
  declare const index$m_TeamManager: typeof TeamManager;
3817
- type index$m_TeamManagerOptions = TeamManagerOptions;
3818
- type index$m_TeamMode = TeamMode;
3819
3654
  declare namespace index$m {
3820
- export { type index$m_AgentEventCallback as AgentEventCallback, backend as Backend, coordinator$1 as Coordinator, fileLock as FileLock, fileMailbox as FileMailbox, type index$m_Member as Member, progress$1 as Progress, protocol as Protocol, registry as Registry, type index$m_RunAgent as RunAgent, sharedTask as SharedTask, taskStop as TaskStop, taskTools as TaskTools, index$m_Team as Team, teamFile as TeamFile, index$m_TeamManager as TeamManager, type index$m_TeamManagerOptions as TeamManagerOptions, type index$m_TeamMode as TeamMode, tools$1 as Tools };
3655
+ export { type index$m_AgentEventCallback as AgentEventCallback, coordinator$1 as Coordinator, fileLock as FileLock, fileMailbox as FileMailbox, type index$m_Member as Member, progress$1 as Progress, protocol as Protocol, registry as Registry, type index$m_RunAgent as RunAgent, sharedTask as SharedTask, taskStop as TaskStop, taskTools as TaskTools, index$m_Team as Team, teamFile as TeamFile, index$m_TeamManager as TeamManager, tools$1 as Tools };
3821
3656
  }
3822
3657
 
3823
3658
  declare function countMcpTools(registry: ToolRegistry): number;
@@ -4793,7 +4628,7 @@ interface InitLoggerOptions {
4793
4628
  skipCleanup?: boolean;
4794
4629
  /**
4795
4630
  * Mirror JSONL to stdout in addition to the log file. Only safe in remote
4796
- * mode (UI owns stdout; teammates use it for IPC). Lets users watch logs
4631
+ * mode (UI owns stdout). Lets users watch logs
4797
4632
  * live or pipe them through pino-pretty.
4798
4633
  */
4799
4634
  stdout?: boolean;
@@ -5851,6 +5686,7 @@ declare namespace index$7 {
5851
5686
  }
5852
5687
 
5853
5688
  interface TeammateRunOptions {
5689
+ agentName: string;
5854
5690
  definition: AgentDefinition;
5855
5691
  modelOverride?: string;
5856
5692
  onPermissionRequest?: ToolContext["onPermissionRequest"];
@@ -5881,7 +5717,6 @@ declare class AgentTool implements Tool {
5881
5717
  * and returns the callback that runs the teammate agent's main loop.
5882
5718
  */
5883
5719
  private teamRunAgentFactory?;
5884
- private teamProviderIndex?;
5885
5720
  private spawnHandler;
5886
5721
  private forkHandler?;
5887
5722
  constructor(cwd: string, registry: ToolRegistry, spawnHandler: (def: AgentDefinition, prompt: string, bg: boolean, modelOverride?: string, cwdOverride?: string, context?: ToolContext) => Promise<string>, conversation?: ConversationManager, forkHandler?: (prompt: string, conversation: ConversationManager, registry: ToolRegistry, modelOverride?: string, context?: ToolContext) => Promise<string>, taskManager?: TaskManager);
@@ -5889,7 +5724,7 @@ declare class AgentTool implements Tool {
5889
5724
  * Sets the team manager and teammate run callback, enabling the team_name parameter
5890
5725
  * so teammates can be spawned directly through the Agent tool.
5891
5726
  */
5892
- setTeamManager(mgr: TeamManager, runAgentFactory: (registry: ToolRegistry, checker?: PermissionChecker, cwd?: string, options?: TeammateRunOptions) => RunAgent, providerIndex?: number): void;
5727
+ setTeamManager(mgr: TeamManager, runAgentFactory: (registry: ToolRegistry, checker?: PermissionChecker, cwd?: string, options?: TeammateRunOptions) => RunAgent): void;
5893
5728
  forFork(registry: ToolRegistry): AgentTool;
5894
5729
  schema(): ToolSchema;
5895
5730
  private buildDescription;
@@ -5897,8 +5732,7 @@ declare class AgentTool implements Tool {
5897
5732
  private startBackground;
5898
5733
  /**
5899
5734
  * Team-member mode: Spawns a persistent teammate in the specified team.
5900
- * Delegates to Team.spawnTeammate(), which dispatches by team backend mode
5901
- * (in-process idle-poll loop, or an external pane/tab process).
5735
+ * Runs persistently within this process.
5902
5736
  */
5903
5737
  private runAsTeammate;
5904
5738
  /**
@@ -6061,6 +5895,7 @@ declare class BashTool implements Tool {
6061
5895
  backgroundForegroundTasks(): number;
6062
5896
  schema(): ToolSchema;
6063
5897
  execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
5898
+ private executeCommand;
6064
5899
  /**
6065
5900
  * Spawn the command with stdout+stderr writing directly into the output
6066
5901
  * file (file-descriptor mode): output never flows through JS, so
@@ -6233,6 +6068,7 @@ declare class EditFileTool implements Tool {
6233
6068
  category: ToolCategory;
6234
6069
  schema(): ToolSchema;
6235
6070
  execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
6071
+ private executeMutation;
6236
6072
  }
6237
6073
 
6238
6074
  type editFile_EditFileTool = EditFileTool;
@@ -6296,6 +6132,21 @@ declare namespace exitPlanMode {
6296
6132
  export { exitPlanMode_ExitPlanModeTool as ExitPlanModeTool };
6297
6133
  }
6298
6134
 
6135
+ declare function acquireWorkspaceMutation(cwd: string, signal?: AbortSignal): Promise<() => void>;
6136
+ declare function acquireCommandExecution(cwd: string, command: string, signal?: AbortSignal): Promise<() => void>;
6137
+ declare function checkExecutionPermission(ctx: ToolContext, toolName: string, args: Record<string, unknown>): ToolResult | undefined;
6138
+ declare function withCommandExecution(ctx: ToolContext, toolName: string, args: Record<string, unknown>, command: string, run: (started: (done: Promise<void>) => void) => Promise<ToolResult>): Promise<ToolResult>;
6139
+ declare function withWorkspaceMutation(ctx: ToolContext, toolName: string, args: Record<string, unknown>, run: () => Promise<ToolResult>): Promise<ToolResult>;
6140
+
6141
+ declare const executionCoordinator_acquireCommandExecution: typeof acquireCommandExecution;
6142
+ declare const executionCoordinator_acquireWorkspaceMutation: typeof acquireWorkspaceMutation;
6143
+ declare const executionCoordinator_checkExecutionPermission: typeof checkExecutionPermission;
6144
+ declare const executionCoordinator_withCommandExecution: typeof withCommandExecution;
6145
+ declare const executionCoordinator_withWorkspaceMutation: typeof withWorkspaceMutation;
6146
+ declare namespace executionCoordinator {
6147
+ export { executionCoordinator_acquireCommandExecution as acquireCommandExecution, executionCoordinator_acquireWorkspaceMutation as acquireWorkspaceMutation, executionCoordinator_checkExecutionPermission as checkExecutionPermission, executionCoordinator_withCommandExecution as withCommandExecution, executionCoordinator_withWorkspaceMutation as withWorkspaceMutation };
6148
+ }
6149
+
6299
6150
  declare class ExitWorktreeTool implements Tool {
6300
6151
  name: string;
6301
6152
  description: string;
@@ -6497,6 +6348,7 @@ declare class PowerShellTool implements Tool {
6497
6348
  backgroundForegroundTasks(): number;
6498
6349
  schema(): ToolSchema;
6499
6350
  execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
6351
+ private executeCommand;
6500
6352
  /**
6501
6353
  * Spawn PowerShell with stdout+stderr writing directly into the output file
6502
6354
  * (fd mode, shared with BashTool): output never flows through JS, so
@@ -6545,12 +6397,8 @@ declare namespace searchOutput {
6545
6397
 
6546
6398
  /** Notification body budget: larger outputs stay on disk and only a preview travels in the notification. */
6547
6399
  declare const BACKGROUND_NOTIFICATION_BYTES = 30000;
6548
- /**
6549
- * A backgrounded command may fill up to 5GB before the size watchdog kills it:
6550
- * with no JS in the write path, a stuck append loop could otherwise grow the
6551
- * output file without bound. Foreground keeps the historical 10MB cap.
6552
- */
6553
- declare const BACKGROUND_MAX_OUTPUT_BYTES: number;
6400
+ /** Disk cap for foreground and background commands, independent of display limits. */
6401
+ declare const MAX_SHELL_OUTPUT_FILE_BYTES: number;
6554
6402
  declare const SIZE_WATCHDOG_INTERVAL_MS = 500;
6555
6403
  type BackgroundReason = "explicit" | "user" | "timeout";
6556
6404
  /** Terminal facts about the child process, consumed to build results and notifications. */
@@ -6563,6 +6411,7 @@ interface ShellExit {
6563
6411
  spawnError?: string;
6564
6412
  }
6565
6413
  interface CommandHandle {
6414
+ done: Promise<void>;
6566
6415
  /** Resolves the tool call: either the inline completion or an early "moved to background" message. */
6567
6416
  result: Promise<ToolResult>;
6568
6417
  /**
@@ -6587,7 +6436,7 @@ declare function openOutputFd(path: string): number;
6587
6436
  /**
6588
6437
  * Create the file that receives a command's stdout+stderr. Lives in the
6589
6438
  * session tool-results directory (the established spill location, readable by
6590
- * the model for backgrounded commands); falls back to the OS temp dir when
6439
+ * the model for large command outputs); falls back to the OS temp dir when
6591
6440
  * that directory cannot be created.
6592
6441
  */
6593
6442
  declare function createShellOutputFile(sessionId: string): {
@@ -6602,15 +6451,12 @@ declare function createShellOutputFile(sessionId: string): {
6602
6451
  */
6603
6452
  declare function formatFinalResult(prompt: string, command: string, exit: ShellExit, merged: string, truncated: boolean, timeout: number): ToolResult;
6604
6453
  /**
6605
- * Build the notification body for a finished background command from the
6606
- * output file. Small outputs are inlined and the file is deleted; large
6607
- * outputs keep the file on disk and the notification carries its path with a
6454
+ * Build a finished command's result from its output file. Small outputs are
6455
+ * inlined and the file is deleted; large outputs stay on disk with a
6608
6456
  * byte-bounded preview, so the full text stays readable via ReadFile without
6609
- * ever loading it into JS here. `annotate` is the sandbox's stderr annotator
6610
- * (sandbox violation notes); the foreground path applies it in
6611
- * settleExit, and background notifications must report identically.
6457
+ * loading it into JS. `annotate` adds sandbox violation notes to captured output.
6612
6458
  */
6613
- declare function buildBackgroundBody(prompt: string, command: string, exit: ShellExit, outputPath: string, timeout: number, annotate?: (text: string) => string): ToolResult;
6459
+ declare function buildShellResult(prompt: string, command: string, exit: ShellExit, outputPath: string, timeout: number, inlineLimit?: number, annotate?: (text: string) => string): ToolResult;
6614
6460
  declare const BackgroundableToolShape: z$1.ZodObject<{
6615
6461
  taskManager: z$1.ZodNullable<z$1.ZodInstanceOf<TaskManager>>;
6616
6462
  backgroundEnabled: z$1.ZodFunction<z$1.ZodTuple<readonly [], null>, z$1.ZodBoolean>;
@@ -6640,18 +6486,18 @@ declare function hasAnyForegroundTasks(registry: ToolRegistry): boolean;
6640
6486
  declare function backgroundAllForegroundTasks(registry: ToolRegistry): number;
6641
6487
 
6642
6488
  declare const shellBackground_BACKGROUNDABLE_TOOL_NAMES: typeof BACKGROUNDABLE_TOOL_NAMES;
6643
- declare const shellBackground_BACKGROUND_MAX_OUTPUT_BYTES: typeof BACKGROUND_MAX_OUTPUT_BYTES;
6644
6489
  declare const shellBackground_BACKGROUND_NOTIFICATION_BYTES: typeof BACKGROUND_NOTIFICATION_BYTES;
6645
6490
  type shellBackground_BackgroundReason = BackgroundReason;
6646
6491
  type shellBackground_BackgroundableTool = BackgroundableTool;
6647
6492
  type shellBackground_CommandHandle = CommandHandle;
6493
+ declare const shellBackground_MAX_SHELL_OUTPUT_FILE_BYTES: typeof MAX_SHELL_OUTPUT_FILE_BYTES;
6648
6494
  declare const shellBackground_SIZE_WATCHDOG_INTERVAL_MS: typeof SIZE_WATCHDOG_INTERVAL_MS;
6649
6495
  type shellBackground_ShellExit = ShellExit;
6650
6496
  declare const shellBackground_attachBackgroundTaskManager: typeof attachBackgroundTaskManager;
6651
6497
  declare const shellBackground_backgroundAllForegroundTasks: typeof backgroundAllForegroundTasks;
6652
6498
  declare const shellBackground_backgroundMessage: typeof backgroundMessage;
6653
6499
  declare const shellBackground_backgroundTaskName: typeof backgroundTaskName;
6654
- declare const shellBackground_buildBackgroundBody: typeof buildBackgroundBody;
6500
+ declare const shellBackground_buildShellResult: typeof buildShellResult;
6655
6501
  declare const shellBackground_createShellOutputFile: typeof createShellOutputFile;
6656
6502
  declare const shellBackground_discardFd: typeof discardFd;
6657
6503
  declare const shellBackground_formatFinalResult: typeof formatFinalResult;
@@ -6661,7 +6507,7 @@ declare const shellBackground_readOutputFile: typeof readOutputFile;
6661
6507
  declare const shellBackground_sliceUtf8Safe: typeof sliceUtf8Safe;
6662
6508
  declare const shellBackground_unlinkQuiet: typeof unlinkQuiet;
6663
6509
  declare namespace shellBackground {
6664
- export { shellBackground_BACKGROUNDABLE_TOOL_NAMES as BACKGROUNDABLE_TOOL_NAMES, shellBackground_BACKGROUND_MAX_OUTPUT_BYTES as BACKGROUND_MAX_OUTPUT_BYTES, shellBackground_BACKGROUND_NOTIFICATION_BYTES as BACKGROUND_NOTIFICATION_BYTES, type shellBackground_BackgroundReason as BackgroundReason, type shellBackground_BackgroundableTool as BackgroundableTool, type shellBackground_CommandHandle as CommandHandle, shellBackground_SIZE_WATCHDOG_INTERVAL_MS as SIZE_WATCHDOG_INTERVAL_MS, type shellBackground_ShellExit as ShellExit, shellBackground_attachBackgroundTaskManager as attachBackgroundTaskManager, shellBackground_backgroundAllForegroundTasks as backgroundAllForegroundTasks, shellBackground_backgroundMessage as backgroundMessage, shellBackground_backgroundTaskName as backgroundTaskName, shellBackground_buildBackgroundBody as buildBackgroundBody, shellBackground_createShellOutputFile as createShellOutputFile, shellBackground_discardFd as discardFd, shellBackground_formatFinalResult as formatFinalResult, shellBackground_hasAnyForegroundTasks as hasAnyForegroundTasks, shellBackground_openOutputFd as openOutputFd, shellBackground_readOutputFile as readOutputFile, shellBackground_sliceUtf8Safe as sliceUtf8Safe, shellBackground_unlinkQuiet as unlinkQuiet };
6510
+ export { shellBackground_BACKGROUNDABLE_TOOL_NAMES as BACKGROUNDABLE_TOOL_NAMES, shellBackground_BACKGROUND_NOTIFICATION_BYTES as BACKGROUND_NOTIFICATION_BYTES, type shellBackground_BackgroundReason as BackgroundReason, type shellBackground_BackgroundableTool as BackgroundableTool, type shellBackground_CommandHandle as CommandHandle, shellBackground_MAX_SHELL_OUTPUT_FILE_BYTES as MAX_SHELL_OUTPUT_FILE_BYTES, shellBackground_SIZE_WATCHDOG_INTERVAL_MS as SIZE_WATCHDOG_INTERVAL_MS, type shellBackground_ShellExit as ShellExit, shellBackground_attachBackgroundTaskManager as attachBackgroundTaskManager, shellBackground_backgroundAllForegroundTasks as backgroundAllForegroundTasks, shellBackground_backgroundMessage as backgroundMessage, shellBackground_backgroundTaskName as backgroundTaskName, shellBackground_buildShellResult as buildShellResult, shellBackground_createShellOutputFile as createShellOutputFile, shellBackground_discardFd as discardFd, shellBackground_formatFinalResult as formatFinalResult, shellBackground_hasAnyForegroundTasks as hasAnyForegroundTasks, shellBackground_openOutputFd as openOutputFd, shellBackground_readOutputFile as readOutputFile, shellBackground_sliceUtf8Safe as sliceUtf8Safe, shellBackground_unlinkQuiet as unlinkQuiet };
6665
6511
  }
6666
6512
 
6667
6513
  declare const MAX_SHELL_OUTPUT_BYTES: number;
@@ -6789,6 +6635,7 @@ declare class WriteFileTool implements Tool {
6789
6635
  category: ToolCategory;
6790
6636
  schema(): ToolSchema;
6791
6637
  execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
6638
+ private executeMutation;
6792
6639
  }
6793
6640
 
6794
6641
  type writeFile_WriteFileTool = WriteFileTool;
@@ -6798,7 +6645,7 @@ declare namespace writeFile {
6798
6645
  }
6799
6646
 
6800
6647
  declare namespace index$4 {
6801
- export { askUser as AskUser, bash as Bash, bingSearch as BingSearch, computerUse as ComputerUse, descriptions as Descriptions, diff as Diff, editFile as EditFile, editFileDiagnostics as EditFileDiagnostics, enterWorktree as EnterWorktree, exitCodeHints as ExitCodeHints, exitPlanMode as ExitPlanMode, exitWorktree as ExitWorktree, fileMutationQueue as FileMutationQueue, fileStateCache as FileStateCache, glob as Glob, goal as Goal, grep as Grep, isDiffTool$1 as IsDiffTool, lsp as LSP, mcpCall as McpCall, powershell as PowerShell, readFile as ReadFile, registry$1 as Registry, searchOutput as SearchOutput, shellBackground as ShellBackground, shellOutput as ShellOutput, snippets as Snippets, syntheticOutput as SyntheticOutput, taskOutput as TaskOutput, toolSearch as ToolSearch, types$1 as Types, webFetch as WebFetch, webSearch as WebSearch, writeFile as WriteFile };
6648
+ export { askUser as AskUser, bash as Bash, bingSearch as BingSearch, computerUse as ComputerUse, descriptions as Descriptions, diff as Diff, editFile as EditFile, editFileDiagnostics as EditFileDiagnostics, enterWorktree as EnterWorktree, executionCoordinator as ExecutionCoordinator, exitCodeHints as ExitCodeHints, exitPlanMode as ExitPlanMode, exitWorktree as ExitWorktree, fileMutationQueue as FileMutationQueue, fileStateCache as FileStateCache, glob as Glob, goal as Goal, grep as Grep, isDiffTool$1 as IsDiffTool, lsp as LSP, mcpCall as McpCall, powershell as PowerShell, readFile as ReadFile, registry$1 as Registry, searchOutput as SearchOutput, shellBackground as ShellBackground, shellOutput as ShellOutput, snippets as Snippets, syntheticOutput as SyntheticOutput, taskOutput as TaskOutput, toolSearch as ToolSearch, types$1 as Types, webFetch as WebFetch, webSearch as WebSearch, writeFile as WriteFile };
6802
6649
  }
6803
6650
 
6804
6651
  type PackageManager = "npm" | "yarn" | "pnpm";
@@ -7076,58 +6923,6 @@ declare namespace recover$1 {
7076
6923
  export { recover$1_isTerminalGone as isTerminalGone, recover$1_record as record, recover$1_recordError as recordError, recover$1_recordExit as recordExit, recover$1_recover as recover };
7077
6924
  }
7078
6925
 
7079
- interface TeammateArgs {
7080
- teamDir: string;
7081
- teamCwd?: string;
7082
- teamName: string;
7083
- memberName: string;
7084
- initialTask: string;
7085
- permissionMode: PermissionMode;
7086
- agentType?: string;
7087
- model?: string;
7088
- /** Index into the config's providers array; defaults to `default_provider`. */
7089
- providerIndex?: number;
7090
- }
7091
- declare function parseTeammateFlags(args: string[]): TeammateArgs | null;
7092
- /**
7093
- * Assemble the teammate tool registry: file/command tools, tool search,
7094
- * worktree switching, Skills, and MCP extensions, plus team collaboration
7095
- * tools (SendMessage under the member's own name, and the shared task board).
7096
- * The task board resolves to a single tasks.json by team name, so all
7097
- * teammates operate on the same board.
7098
- *
7099
- * Agent is intentionally excluded — the call tree terminates at the teammate
7100
- * level. TeamCreate and TeamDelete are also excluded; team lifecycle
7101
- * management is the Leader's responsibility.
7102
- */
7103
- declare function buildTeammateRegistry(opts: {
7104
- sandboxConfig?: SandboxYamlConfig;
7105
- cwd: string;
7106
- teamCwd?: string;
7107
- definition?: AgentDefinition;
7108
- teamName: string;
7109
- memberName: string;
7110
- catalog: SkillCatalog;
7111
- skillHost: SkillHost;
7112
- mcpServers?: MCPServerConfig[];
7113
- lspServers?: LspServerConfig[];
7114
- /** The running teammate retains this manager and disconnects it on exit. */
7115
- mcpManager?: MCPManager;
7116
- /** Used to decide the MCP loading mode: total schema volume is weighed against the context window. */
7117
- baseUrl?: string;
7118
- /** Provider protocol; native deferred loading is Anthropic-only. */
7119
- protocol?: ProviderConfig["protocol"];
7120
- contextWindow?: number;
7121
- }): Promise<ToolRegistry>;
7122
- declare function runTeammate(args: TeammateArgs): Promise<void>;
7123
-
7124
- declare const teammate_buildTeammateRegistry: typeof buildTeammateRegistry;
7125
- declare const teammate_parseTeammateFlags: typeof parseTeammateFlags;
7126
- declare const teammate_runTeammate: typeof runTeammate;
7127
- declare namespace teammate {
7128
- export { teammate_buildTeammateRegistry as buildTeammateRegistry, teammate_parseTeammateFlags as parseTeammateFlags, teammate_runTeammate as runTeammate };
7129
- }
7130
-
7131
6926
  declare const version: string;
7132
6927
 
7133
6928
  declare const version$1_version: typeof version;
@@ -7135,4 +6930,4 @@ declare namespace version$1 {
7135
6930
  export { version$1_version as version };
7136
6931
  }
7137
6932
 
7138
- export { index$u as A2a, index$t as Acp, index$p as Agent, index$l as Bootstrap, index$k as CodeReview, index$j as Commands, index$i as Compact, index$s as Config, index$w as Conversation, index$z as FileHistory, index$y as Goal, index$h as History, index$r as Hooks, index$g as Images, index$f as LLM, index$d as LSP, index$e as Logger, index$c as MCP, index$b as Memory, index$x as Permissions, index$a as PlanFile, printMode as PrintMode, index$9 as Prompt, recover$1 as Recover, index$8 as Remote, index$7 as Sandbox, index$v as Session, index$o as Skills, index$6 as Subagent, teammate as Teammate, index$m as Teams, index$q as Telemetry, index$n as Todo, index$5 as ToolResult, index$4 as Tools, index$3 as Update, index$2 as Utils, index$1 as VSCode, version$1 as Version, index as Worktree };
6933
+ export { index$u as A2a, index$t as Acp, index$p as Agent, index$l as Bootstrap, index$k as CodeReview, index$j as Commands, index$i as Compact, index$s as Config, index$w as Conversation, index$z as FileHistory, index$y as Goal, index$h as History, index$r as Hooks, index$g as Images, index$f as LLM, index$d as LSP, index$e as Logger, index$c as MCP, index$b as Memory, index$x as Permissions, index$a as PlanFile, printMode as PrintMode, index$9 as Prompt, recover$1 as Recover, index$8 as Remote, index$7 as Sandbox, index$v as Session, index$o as Skills, index$6 as Subagent, index$m as Teams, index$q as Telemetry, index$n as Todo, index$5 as ToolResult, index$4 as Tools, index$3 as Update, index$2 as Utils, index$1 as VSCode, version$1 as Version, index as Worktree };