@livx.cc/agentx 0.99.40 → 0.99.41

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/README.md CHANGED
@@ -86,6 +86,7 @@ Beyond file tools, the runtime ships the higher-altitude pieces too — each an
86
86
 
87
87
  - **Skills + memory** — VFS-backed (`skillsDir`/`memoryDir`); persistence is just the backend choice.
88
88
  - **Subagents** (`subagents`; **typed agents** via `agentsDir` — `<dir>/<name>.md` defines a persona + model + scoped tools, selected with the `Task` `agentType`), **hooks** (`hooks`: preToolUse/postToolUse/onStop — block or audit any tool call), **slash-commands** (`commandsDir`), **TodoWrite**, **MCP** (`mcpToolsToAgentTools`).
89
+ - **A delegated child is a full agent**: it inherits the parent's **tools** (incl. host-injected/MCP ones), **system prompt**, and **providerOptions** (only when it stays on the same provider — cursor's `cwd`/`cursorSession` never leak onto an anthropic child; override with `providerOptionsFor(model)`). `Task({ model })` (and a `TaskBatch` task's `model`) runs one sub-task on another model — alias or full id, precedence **explicit `model` > `agentType` def's `model` > parent's**. A def's frontmatter `tools:` allowlist narrows the inherited set and may name a host-injected tool by name; its body still overrides the persona. The host's `preToolUse` gate is inherited too, so delegation is not a way around it (the observer/lifecycle hooks stay parent-only). Inherited tools that escape the VFS are re-bound per child (`AgentTool.withCwd`): a `isolation:"worktree"` child's real `Shell` runs in the WORKTREE, keeping any host rename (`Shell` -> `Bash`) (background shell jobs are off there, and the parent-bound `ShellOutput`/`ShellStatus`/`ShellKill` are dropped rather than pointed at the parent's jobs); an overlay child's shell writes straight to the working tree — an overlay isolates the VFS, not a process.
89
90
  - **Streaming** (`stream: true` → `text_delta` via `HostBridge.notify`) and **context compaction** (`compaction: { maxMessages }` → edge-safe summarize-and-boundary). Defaults preserve the original non-stream, drop-oldest behavior.
90
91
  - **Multi-turn + project context** — `Agent.send()` continues a conversation across turns (vs `run()`, which starts fresh); **project instructions** (`instructionFiles`: `AGENTS.md`/`CLAUDE.md` at the FS root) inject into the system prompt.
91
92
  - **DuplexAgent** (`src/duplex.ts`) — voice-optimized three-tier engine (reflex/act/think): a fast reflex agent streams instant replies and self-selects escalation — `Act` for standard tool work (Sonnet-class), `Think` for deep reasoning (Opus-class, configurable, default on). Results are pushed back and re-voiced by the reflex (turn mutex, coalesced completions, `TaskStatus`/`CancelTask`). See [`mind/10`](./mind/10-duplex.md).
@@ -1,5 +1,5 @@
1
1
  import { IFilesystem } from '@livx.cc/wcli/core';
2
- import { M as Message, H as HostBridge, A as AgentTool, C as ChatLike, g as MessageContent, U as UserQuestion } from './tools-BWzPQVy0.js';
2
+ import { M as Message, H as HostBridge, A as AgentTool, C as ChatLike, g as MessageContent, U as UserQuestion } from './tools-S-ArIR3o.js';
3
3
 
4
4
  /**
5
5
  * Hooks — deterministic interception points around tool execution, run by the
@@ -375,6 +375,10 @@ declare class AgentOptions {
375
375
  };
376
376
  /** Provider-specific options forwarded to ai.chat() (e.g. cursor mcpServers, cwd). */
377
377
  providerOptions?: Record<string, unknown>;
378
+ /** Derive `providerOptions` for a DELEGATED child whose model may differ from this agent's
379
+ * (`Task({ model })` / an agentType def). Default: inherit `providerOptions` only when the child's
380
+ * model is on the SAME provider — cursor's `cwd`/`cursorSession` on an anthropic child is a 400. */
381
+ providerOptionsFor?: (model: string) => Record<string, unknown> | undefined;
378
382
  /** Prompt caching (providers that support it, e.g. Anthropic): cache tools/system/conversation
379
383
  * prefix across the loop's steps — reads cost 0.1x, writes 1.25x. A multi-step agent loop
380
384
  * re-sends its whole prefix every step, so this is a large net cost cut. Default on. */
package/dist/cli.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
- import { H as Hooks, i as RunResult, R as ReasoningEffort, A as Agent } from './Agent-D4-CLnxC.js';
2
+ import { H as Hooks, i as RunResult, R as ReasoningEffort, A as Agent } from './Agent-DydgLoT-.js';
3
3
  import { IFilesystem } from '@livx.cc/wcli/core';
4
- import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, g as MessageContent } from './tools-BWzPQVy0.js';
4
+ import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, g as MessageContent } from './tools-S-ArIR3o.js';
5
5
 
6
6
  /**
7
7
  * On-disk session store for the CLI: each conversation is one JSON file at
package/dist/cli.js CHANGED
@@ -1361,11 +1361,12 @@ function toolRegistry() {
1361
1361
  const all = [bashTool, readTool, editTool, grepTool, globTool, writeTool, multiEditTool, applyEditsTool, repoMapTool, reviewTool(), todoWriteTool, webFetchTool, webSearchTool, webSearchAnthropicTool];
1362
1362
  return Object.fromEntries(all.map((t) => [t.name, t]));
1363
1363
  }
1364
- function toolsByName(names) {
1364
+ function toolsByName(names, available) {
1365
1365
  const reg = toolRegistry();
1366
+ const extra = Object.fromEntries((available ?? []).map((t) => [t.name, t]));
1366
1367
  return names.map((n) => {
1367
- const t = reg[n];
1368
- if (!t) throw new Error(`unknown tool '${n}'. Known: ${Object.keys(reg).join(", ")}`);
1368
+ const t = extra[n] ?? reg[n];
1369
+ if (!t) throw new Error(`unknown tool '${n}'. Known: ${[.../* @__PURE__ */ new Set([...Object.keys(extra), ...Object.keys(reg)])].join(", ")}`);
1369
1370
  return t;
1370
1371
  });
1371
1372
  }
@@ -2159,6 +2160,24 @@ function makeRealShellTool(options) {
2159
2160
  };
2160
2161
  return {
2161
2162
  name: "Shell",
2163
+ // Rebind for an isolated child agent (git worktree): same policy/env/timeouts, new cwd. The
2164
+ // `registry` is deliberately dropped — it is bound to the PARENT's cwd (and, in hosts like
2165
+ // shraga-ee, to the parent's session), so a background job started from the child would run
2166
+ // outside the child's isolation and report into the parent. Background stays a parent capability
2167
+ // (`makeShellJobTools`' companions drop out of an isolated child entirely — see their `withCwd`).
2168
+ // Only `run` is rebuilt: everything else is carried over from THIS instance, because a host may
2169
+ // have mutated the tool AFTER construction (shraga-ee renames `Shell` -> `Bash` and its system
2170
+ // prompt says `Bash` everywhere). Rebuilding from `options` alone silently dropped that rename,
2171
+ // so a worktree child advertised `Shell` while being told to call `Bash` — an unknown-tool error
2172
+ // on its first call, and a hard failure for an agentType def whose allowlist names `Bash`.
2173
+ // `description` is the ONE thing taken from the rebound tool instead: it is derived from the
2174
+ // options and states whether `background:true` works — the rebind drops the registry, so carrying
2175
+ // the parent's text over would advertise a background capability the child does not have. (The
2176
+ // spread also collapses the getter below to a plain value, which is why this override is explicit.)
2177
+ withCwd(cwd) {
2178
+ const rebound = makeRealShellTool({ ...options, cwd, registry: void 0 });
2179
+ return { ...this, description: rebound.description, run: rebound.run, withCwd: rebound.withCwd };
2180
+ },
2162
2181
  get description() {
2163
2182
  return `Run a shell command via /bin/sh in the working directory. Executes any installed binary \u2014 ls, cat, grep, git, bun, node, curl, scripts, etc. Returns combined stdout+stderr; non-zero exits are prefixed \`[exit N]\`. Runs non-interactively with no terminal (stdin is /dev/null): commands that prompt for input fail fast rather than hang \u2014 for privileged actions use a non-interactive flag (e.g. \`sudo -n\`), or ask the user to run the command themselves. Each command is killed after ${defaultTimeoutMs}ms (result \`[exit 124]\` with whatever output it produced) \u2014 pass \`timeoutMs\` (max ${maxTimeoutMs}) for a legitimately slower command, and always bound network commands yourself (e.g. \`curl -m 10\`). ` + backgroundDoc();
2164
2183
  },
@@ -2272,8 +2291,10 @@ ${body}` : head;
2272
2291
  }
2273
2292
  function makeShellJobTools(registry) {
2274
2293
  const idParam = { type: "object", properties: { id: { type: "string", description: "the job id from Shell({background:true})" } } };
2294
+ const dropOnRebind = { withCwd: () => void 0 };
2275
2295
  return [
2276
2296
  {
2297
+ ...dropOnRebind,
2277
2298
  name: "ShellOutput",
2278
2299
  description: "Read the accumulated output (tail) of a background Shell job by id.",
2279
2300
  parameters: { type: "object", required: ["id"], properties: { id: { type: "string" } } },
@@ -2286,6 +2307,7 @@ ${clean(out) || "(no output yet)"}`;
2286
2307
  }
2287
2308
  },
2288
2309
  {
2310
+ ...dropOnRebind,
2289
2311
  name: "ShellStatus",
2290
2312
  description: "Status of a background Shell job (running/exited/killed + exit code). Omit `id` to list all jobs.",
2291
2313
  parameters: idParam,
@@ -2299,6 +2321,7 @@ ${clean(out) || "(no output yet)"}`;
2299
2321
  }
2300
2322
  },
2301
2323
  {
2324
+ ...dropOnRebind,
2302
2325
  name: "ShellKill",
2303
2326
  description: "Stop a running background Shell job by id (SIGTERM).",
2304
2327
  parameters: { type: "object", required: ["id"], properties: { id: { type: "string" } } },
@@ -3131,6 +3154,32 @@ ${sections.join("\n\n---\n\n")}`;
3131
3154
  init_tools();
3132
3155
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
3133
3156
  import { join as join4 } from "path";
3157
+
3158
+ // src/models.ts
3159
+ var MODEL_ALIASES = {
3160
+ fable: "claude-fable-5",
3161
+ "fable-5": "claude-fable-5",
3162
+ opus: "claude-opus-4-8",
3163
+ "opus-4-8": "claude-opus-4-8",
3164
+ "opus-4-7": "claude-opus-4-7",
3165
+ "opus-4-6": "claude-opus-4-6",
3166
+ sonnet: "claude-sonnet-4-6",
3167
+ haiku: "claude-haiku-4-5-20251001"
3168
+ };
3169
+ function resolveModelAlias(input) {
3170
+ const slash = input.indexOf("/");
3171
+ const prefix = slash === -1 ? "" : input.slice(0, slash + 1);
3172
+ const rest = slash === -1 ? input : input.slice(slash + 1);
3173
+ return prefix + (MODEL_ALIASES[rest.toLowerCase()] ?? rest);
3174
+ }
3175
+ function modelProvider(model) {
3176
+ const i = model.indexOf("/");
3177
+ if (i !== -1) return model.slice(0, i);
3178
+ if (/^claude-/i.test(model)) return "anthropic";
3179
+ return `?${model}`;
3180
+ }
3181
+
3182
+ // src/subagent.ts
3134
3183
  init_OverlayFilesystem();
3135
3184
  init_worktree();
3136
3185
  init_NodeDiskFilesystem();
@@ -3189,6 +3238,14 @@ function createWorktreeFs(cwd, label, index) {
3189
3238
  function releaseWorktree(handle) {
3190
3239
  return cleanupWorktree(handle.repoRoot, handle.slug, { force: true });
3191
3240
  }
3241
+ function rebindTools(tools, root) {
3242
+ if (!tools || !root) return tools;
3243
+ return tools.flatMap((t) => {
3244
+ if (!t.withCwd) return [t];
3245
+ const rebound = t.withCwd(root);
3246
+ return rebound ? [rebound] : [];
3247
+ });
3248
+ }
3192
3249
  function worktreePromptPrefix(branch) {
3193
3250
  return `You are running in an isolated git worktree on branch "${branch}". When you finish making changes, commit them with a clear message before replying with your summary. Your worktree will be removed after you finish \u2014 only committed work survives (on the branch).
3194
3251
 
@@ -3256,22 +3313,30 @@ async function runChildTraced(args) {
3256
3313
  await opts.hooks?.onSubagentStop?.(result, { label, agentType });
3257
3314
  return { res, result };
3258
3315
  }
3259
- function childOptionsFor(opts, fs, depth, maxDepth, agentType) {
3316
+ function childOptionsFor(opts, fs, depth, maxDepth, agentType, model, root) {
3260
3317
  let def;
3261
3318
  if (agentType) {
3262
3319
  def = (opts.agents ?? []).find((a) => a.name === agentType);
3263
3320
  if (!def) return `no subagent type '${agentType}'. Available: ${(opts.agents ?? []).map((a) => a.name).join(", ") || "(none defined)"}`;
3264
3321
  }
3265
- const childOpts = { ai: opts.ai, fs, model: def?.model ?? opts.model, subagents: true, depth: depth + 1, maxDepth, traceDir: opts.traceDir };
3322
+ const childModel = resolveModelAlias(model || def?.model || opts.model);
3323
+ const childOpts = { ai: opts.ai, fs, model: childModel, subagents: true, depth: depth + 1, maxDepth, traceDir: opts.traceDir };
3266
3324
  if (opts.maxSteps != null) childOpts.maxSteps = opts.maxSteps;
3267
- if (def?.systemPrompt) childOpts.systemPrompt = def.systemPrompt;
3325
+ const childPrompt = def?.systemPrompt ?? opts.systemPrompt;
3326
+ if (childPrompt) childOpts.systemPrompt = childPrompt;
3327
+ const inherited = rebindTools(opts.tools, root);
3268
3328
  if (def?.tools?.length) {
3269
3329
  try {
3270
- childOpts.tools = toolsByName(def.tools);
3330
+ childOpts.tools = toolsByName(def.tools, inherited);
3271
3331
  } catch (e) {
3272
3332
  return `subagent '${agentType}' declares an unknown tool \u2014 ${e.message}`;
3273
3333
  }
3334
+ } else if (inherited?.length) {
3335
+ childOpts.tools = inherited;
3274
3336
  }
3337
+ const po = opts.providerOptionsFor?.(childModel);
3338
+ if (po) childOpts.providerOptions = po;
3339
+ if (opts.hooks?.preToolUse) childOpts.hooks = { preToolUse: opts.hooks.preToolUse.bind(opts.hooks) };
3275
3340
  return childOpts;
3276
3341
  }
3277
3342
  function makeTaskTool(opts) {
@@ -3279,7 +3344,7 @@ function makeTaskTool(opts) {
3279
3344
  const maxDepth = opts.maxDepth ?? 2;
3280
3345
  return {
3281
3346
  name: "Task",
3282
- description: 'Delegate a self-contained sub-task to a child agent over the same filesystem. It runs autonomously with its own step budget and a wall-clock deadline, and returns a concise summary \u2014 use to isolate context-heavy work (broad search, a scoped refactor). Provide a short `description` and a full `prompt`. If it is interrupted or fails, the result is a STATUS HINT with a pointer to its full transcript (Read it to recover what it did, then decide whether to continue or restart) \u2014 do not assume an incomplete sub-task succeeded. Set `background: true` to run it detached (returns a job id to poll with JobOutput while you keep working); its file edits are overlay-isolated and commit when it finishes. Set `isolation: "worktree"` to run in a real git worktree (needed when the child uses real shell commands that must see/modify actual files) \u2014 slower (~200ms setup), auto-cleaned if no changes.',
3347
+ description: 'Delegate a self-contained sub-task to a child agent over the same filesystem. It runs autonomously with its own step budget and a wall-clock deadline, and returns a concise summary \u2014 use to isolate context-heavy work (broad search, a scoped refactor). Provide a short `description` and a full `prompt`. If it is interrupted or fails, the result is a STATUS HINT with a pointer to its full transcript (Read it to recover what it did, then decide whether to continue or restart) \u2014 do not assume an incomplete sub-task succeeded. Set `background: true` to run it detached (returns a job id to poll with JobOutput while you keep working); its VFS file edits are overlay-isolated and commit when it finishes \u2014 but a child that uses the real `Shell` writes straight to the working tree (an overlay cannot isolate a real process), so pair shell-heavy work with `isolation: "worktree"`. Set `isolation: "worktree"` to run in a real git worktree (needed when the child uses real shell commands that must see/modify actual files \u2014 its shell is re-bound to the worktree \u2014 keeping any name your host gave it \u2014 and background shell jobs, including inspecting or killing MINE, are unavailable there) \u2014 slower (~200ms setup), auto-cleaned if no changes. The child inherits YOUR tools and system prompt by default (and is subject to the same tool-use gate); pass `model` to run this one sub-task on a different model (e.g. a cheap one for bulk search, a stronger one for hard reasoning) \u2014 it overrides the agentType default.',
3283
3348
  parameters: {
3284
3349
  type: "object",
3285
3350
  required: ["description", "prompt"],
@@ -3287,6 +3352,7 @@ function makeTaskTool(opts) {
3287
3352
  description: { type: "string", description: "a short (3-5 word) label for the sub-task" },
3288
3353
  prompt: { type: "string", description: "the full instructions the child agent should carry out" },
3289
3354
  agentType: { type: "string", description: "optional named subagent type (its persona, model, and scoped tools) \u2014 see the catalog" },
3355
+ model: { type: "string", description: 'optional model for THIS sub-task (alias like "haiku"/"opus"/"sonnet", or a full id). Overrides the agentType default; otherwise the child runs on your model.' },
3290
3356
  background: { type: "boolean", description: "run detached (overlay-isolated, commits on finish); returns a job id to poll with JobOutput instead of blocking" },
3291
3357
  isolation: { type: "string", enum: ["overlay", "worktree"], description: 'isolation mode: "overlay" (default, VFS layer) or "worktree" (real git worktree for shell-heavy work)' }
3292
3358
  }
@@ -3297,7 +3363,7 @@ function makeTaskTool(opts) {
3297
3363
  maxDurationMs: opts.maxDurationMs ?? SUBAGENT_MAX_DURATION_MS,
3298
3364
  maxDurationEnforced: true,
3299
3365
  // the wall clock below ABORTS the child at this bound — it cannot be overrun, so the transport needs slack, not a doubling
3300
- async run({ description, prompt, agentType, background, isolation }, ctx) {
3366
+ async run({ description, prompt, agentType, model, background, isolation }, ctx) {
3301
3367
  if (depth >= maxDepth) {
3302
3368
  return `Error: Task depth limit reached (maxDepth ${maxDepth}). Cannot spawn another child agent \u2014 do this work directly instead.`;
3303
3369
  }
@@ -3320,7 +3386,7 @@ function makeTaskTool(opts) {
3320
3386
  fs2 = overlay;
3321
3387
  commit = () => overlay.commit();
3322
3388
  }
3323
- const childOpts2 = childOptionsFor(opts, fs2, depth, maxDepth, agentType);
3389
+ const childOpts2 = childOptionsFor(opts, fs2, depth, maxDepth, agentType, model, wtHandle2?.worktreePath);
3324
3390
  if (typeof childOpts2 === "string") throw new Error(childOpts2);
3325
3391
  const childPrompt = wtHandle2 ? worktreePromptPrefix(wtHandle2.branch) + String(prompt ?? "") : String(prompt ?? "");
3326
3392
  const { res, result } = await runChildTraced({ opts, childOpts: childOpts2, prompt: childPrompt, label, agentType, childDepth: depth + 1, signal });
@@ -3350,7 +3416,7 @@ function makeTaskTool(opts) {
3350
3416
  } else {
3351
3417
  fs = opts.fs;
3352
3418
  }
3353
- const childOpts = childOptionsFor(opts, fs, depth, maxDepth, agentType);
3419
+ const childOpts = childOptionsFor(opts, fs, depth, maxDepth, agentType, model, wtHandle?.worktreePath);
3354
3420
  if (typeof childOpts === "string") {
3355
3421
  wtHandle && releaseWorktree(wtHandle);
3356
3422
  return `Error: ${childOpts}`;
@@ -3379,7 +3445,7 @@ function makeTaskBatchTool(opts) {
3379
3445
  const maxParallel = opts.maxParallel ?? 4;
3380
3446
  return {
3381
3447
  name: "TaskBatch",
3382
- description: 'Delegate SEVERAL independent sub-tasks to child agents that run concurrently; returns all their summaries. Each child is write-isolated (its file edits are merged back in array order). Use for parallel fan-out (review/search/scoped refactors across files). Provide `tasks: [{ description, prompt, agentType? }]`. Set `isolation: "worktree"` to run each child in its own git worktree (needed for real shell commands) \u2014 slower, auto-cleaned if no changes.',
3448
+ description: 'Delegate SEVERAL independent sub-tasks to child agents that run concurrently; returns all their summaries. Each child is write-isolated at the VFS level (its file edits are merged back in array order); real `Shell` commands are NOT \u2014 use `isolation: "worktree"` for those. Use for parallel fan-out (review/search/scoped refactors across files). Provide `tasks: [{ description, prompt, agentType?, model? }]` \u2014 each child inherits your tools and system prompt, and `model` runs that one child on a different model. Set `isolation: "worktree"` to run each child in its own git worktree (needed for real shell commands) \u2014 slower, auto-cleaned if no changes.',
3383
3449
  parameters: {
3384
3450
  type: "object",
3385
3451
  required: ["tasks"],
@@ -3393,7 +3459,8 @@ function makeTaskBatchTool(opts) {
3393
3459
  properties: {
3394
3460
  description: { type: "string", description: "a short (3-5 word) label" },
3395
3461
  prompt: { type: "string", description: "the full instructions for this child" },
3396
- agentType: { type: "string", description: "optional named subagent type" }
3462
+ agentType: { type: "string", description: "optional named subagent type" },
3463
+ model: { type: "string", description: "optional model for this child (alias or full id); overrides the agentType default" }
3397
3464
  }
3398
3465
  }
3399
3466
  },
@@ -3426,7 +3493,7 @@ function makeTaskBatchTool(opts) {
3426
3493
  overlay = new OverlayFilesystem(opts.fs);
3427
3494
  fs = overlay;
3428
3495
  }
3429
- const childOpts = childOptionsFor(opts, fs, depth, maxDepth, t?.agentType);
3496
+ const childOpts = childOptionsFor(opts, fs, depth, maxDepth, t?.agentType, t?.model, wtHandle?.worktreePath);
3430
3497
  if (typeof childOpts === "string") return { label, error: childOpts, ok: false };
3431
3498
  try {
3432
3499
  const childPrompt = wtHandle ? worktreePromptPrefix(wtHandle.branch) + String(t?.prompt ?? "") : String(t?.prompt ?? "");
@@ -3853,6 +3920,10 @@ var AgentOptions = class {
3853
3920
  autoTest;
3854
3921
  /** Provider-specific options forwarded to ai.chat() (e.g. cursor mcpServers, cwd). */
3855
3922
  providerOptions;
3923
+ /** Derive `providerOptions` for a DELEGATED child whose model may differ from this agent's
3924
+ * (`Task({ model })` / an agentType def). Default: inherit `providerOptions` only when the child's
3925
+ * model is on the SAME provider — cursor's `cwd`/`cursorSession` on an anthropic child is a 400. */
3926
+ providerOptionsFor;
3856
3927
  /** Prompt caching (providers that support it, e.g. Anthropic): cache tools/system/conversation
3857
3928
  * prefix across the loop's steps — reads cost 0.1x, writes 1.25x. A multi-step agent loop
3858
3929
  * re-sends its whole prefix every step, so this is a large net cost cut. Default on. */
@@ -4076,7 +4147,19 @@ var Agent = class _Agent {
4076
4147
  agents = loaded.agents;
4077
4148
  if (loaded.catalog) systemPrompt += "\n\n" + loaded.catalog;
4078
4149
  }
4079
- const taskOpts = { ai: o.ai, model: o.model, fs, depth: o.depth, maxDepth: o.maxDepth, agents, hooks: o.hooks, traceDir: o.traceDir };
4150
+ const taskOpts = {
4151
+ ai: o.ai,
4152
+ model: o.model,
4153
+ fs,
4154
+ depth: o.depth,
4155
+ maxDepth: o.maxDepth,
4156
+ agents,
4157
+ hooks: o.hooks,
4158
+ traceDir: o.traceDir,
4159
+ tools: [...o.tools, ...this.injectedTools],
4160
+ systemPrompt: o.systemPrompt,
4161
+ providerOptionsFor: o.providerOptionsFor ?? ((m) => modelProvider(m) === modelProvider(o.model) ? o.providerOptions : void 0)
4162
+ };
4080
4163
  tools = [...tools, makeTaskTool(taskOpts), makeTaskBatchTool(taskOpts)];
4081
4164
  }
4082
4165
  if (o.checkpoints) tools = [...tools, ...checkpointTools()];