@livx.cc/agentx 0.99.125 → 0.99.126

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as AgentOptions, H as Hooks, x as RunResult, k as Decider, b as Agent, q as PermissionPolicy, G as Gender, L as LineKind, d as ChannelMode, y as SecondChannelOptions, S as SecondChannel } from './secondChannel-GFT69ax4.js';
2
- export { A as ADVISE_LIMIT, a as AdvisorSetup, C as CC_WRITE_TOOLS, e as ChatFragment, f as ChatUsage, g as Classification, h as Classifier, i as CompactResult, j as ContextFileSpec, D as DEFAULT_MUTATING, l as Decision, M as ModelRouter, m as ModelRouterOptions, P as PLANNER_BLOCKED, n as PLANNER_REFUSAL, o as PLAN_FIRST, p as PermissionOptions, r as PermissionRule, s as PreToolUseDecision, R as ReasoningEffort, t as RecordingHooks, u as RecordingLifecycle, v as RouteDecision, w as RouterState, T as Tier, z as ToolUse, B as ToolUseMeta, W as WRITE_TOOLS, E as advisorFor, F as advisorPrompt, I as ccModeOptions, J as claudeCodeDisallowedTools, K as composeHooks, N as delegatePrompt, O as delegateTools, Q as delegateWorkerFor, U as estimateTokens, V as jevAvailable, X as jevClassifier, Y as loadContextFiles, Z as loadInstructions, _ as makeAdvisor, $ as meterWorkers, a0 as pickTier, a1 as planMode, a2 as plannerBlocks, a3 as reasoningToChatFragment } from './secondChannel-GFT69ax4.js';
1
+ import { c as AgentOptions, H as Hooks, x as RunResult, k as Decider, b as Agent, q as PermissionPolicy, G as Gender, L as LineKind, d as ChannelMode, y as SecondChannelOptions, S as SecondChannel } from './secondChannel-B76KLrf7.js';
2
+ export { A as ADVISE_LIMIT, a as AdvisorSetup, C as CC_WRITE_TOOLS, e as ChatFragment, f as ChatUsage, g as Classification, h as Classifier, i as CompactResult, j as ContextFileSpec, D as DEFAULT_MUTATING, l as Decision, M as ModelRouter, m as ModelRouterOptions, P as PLANNER_BLOCKED, n as PLANNER_REFUSAL, o as PLAN_FIRST, p as PermissionOptions, r as PermissionRule, s as PreToolUseDecision, R as ReasoningEffort, t as RecordingHooks, u as RecordingLifecycle, v as RouteDecision, w as RouterState, T as Tier, z as ToolUse, B as ToolUseMeta, W as WRITE_TOOLS, E as advisorFor, F as advisorPrompt, I as ccModeOptions, J as claudeCodeDisallowedTools, K as composeHooks, N as delegatePrompt, O as delegateTools, Q as delegateWorkerFor, U as estimateTokens, V as jevAvailable, X as jevClassifier, Y as loadContextFiles, Z as loadInstructions, _ as makeAdvisor, $ as meterWorkers, a0 as pickTier, a1 as planMode, a2 as plannerBlocks, a3 as reasoningToChatFragment } from './secondChannel-B76KLrf7.js';
3
3
  export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, latestClaude, modelShortLabel, resolveModelAlias, resolveModelSwitch } from './models.js';
4
4
  import { IFilesystem, FileMetadata } from '@livx.cc/wcli/core';
5
5
  export { CommandExecutor, FileMetadata, IFilesystem, IndexedDbFilesystem, MemFilesystem, registerHeadlessCommands } from '@livx.cc/wcli/core';
package/dist/index.js CHANGED
@@ -4610,10 +4610,15 @@ function delegateWorkerFor(planner, worker) {
4610
4610
  function advisorFor(worker, advisor) {
4611
4611
  return advisor && pairOk("advisor", worker, advisor) ? advisor : void 0;
4612
4612
  }
4613
- function delegateTools(tools, planner) {
4613
+ function delegateTools(tools, planner, plannerMay) {
4614
4614
  return tools.map((t) => !plannerBlocks(t) ? t : {
4615
4615
  ...t,
4616
- run: async (...a) => a[1]?.model === planner ? PLANNER_REFUSAL : t.run(...a)
4616
+ // THROWN, not returned: a returned string read as a SUCCESSFUL write in every trace (isError false), so a host
4617
+ // counted a write that never happened (Blank prod 8834a8bd-d4b).
4618
+ run: async (...a) => {
4619
+ if (a[1]?.model === planner && !plannerMay?.(t.name, a[0])) throw new Error(PLANNER_REFUSAL);
4620
+ return t.run(...a);
4621
+ }
4617
4622
  });
4618
4623
  }
4619
4624
  function delegatePrompt(worker) {
@@ -4944,7 +4949,9 @@ var AgentOptions = class {
4944
4949
  subagents = false;
4945
4950
  /** DELEGATE MODE: `model` plans, `worker` writes. The planner's Write/Edit/MultiEdit/ApplyEdits/bash/Shell are
4946
4951
  * refused at execution; Task/TaskBatch are on (maxDepth 1, children default to `worker`) and children get the
4947
- * parent's `postToolUse` too. Off when the models are equal or either is cursor/*. Wins over `advisor`. */
4952
+ * parent's `postToolUse` too. Off when the models are equal or either is cursor/*. Wins over `advisor`.
4953
+ * `plannerMay(tool, args)`: a blocked call the planner may still make itself (the host's own carve-out, e.g. its
4954
+ * private notes) — say so in the host prompt, the planner prompt says it cannot write. */
4948
4955
  delegate;
4949
4956
  /** ADVISOR MODE: `model` does the work; an `Advise` tool asks `advisor.model` (≤`limit`, default 3) with only
4950
4957
  * the request + `snapshot()` (host state, optional) + the question. The first write waits for one consult. */
@@ -5327,7 +5334,7 @@ var Agent = class _Agent {
5327
5334
  traceDir: o.traceDir,
5328
5335
  permissions: o.permissions,
5329
5336
  // a child obeys the parent's allow/deny rules (else Task is a one-call bypass)
5330
- tools: worker ? delegateTools([...o.tools, ...this.injectedTools], o.model) : [...o.tools, ...this.injectedTools],
5337
+ tools: worker ? delegateTools([...o.tools, ...this.injectedTools], o.model, o.delegate?.plannerMay) : [...o.tools, ...this.injectedTools],
5331
5338
  systemPrompt: o.systemPrompt,
5332
5339
  // A child never resumes the parent's own claude-code session (the host's `resume` link is the parent's).
5333
5340
  providerOptionsFor: o.providerOptionsFor ?? ((m) => modelProvider(m) === modelProvider(o.model) && o.providerOptions ? { ...o.providerOptions, resume: void 0, onClaudeCodeSession: void 0 } : void 0)
@@ -5341,7 +5348,7 @@ var Agent = class _Agent {
5341
5348
  this.activeHooks = composeHooks(o.hooks, plan?.hooks, o.permissions?.hooks());
5342
5349
  this.activeTools = [...tools, ...this.injectedTools];
5343
5350
  if (worker) {
5344
- this.activeTools = delegateTools(this.activeTools, o.model);
5351
+ this.activeTools = delegateTools(this.activeTools, o.model, o.delegate?.plannerMay);
5345
5352
  systemPrompt += delegatePrompt(worker);
5346
5353
  }
5347
5354
  if (adv) {