@livx.cc/agentx 0.99.122 → 0.99.124

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.
@@ -1,4 +1,4 @@
1
- import { A as AgentTool } from './tools-DZHZIyxh.js';
1
+ import { A as AgentTool } from './tools-DwfeF8VQ.js';
2
2
 
3
3
  /**
4
4
  * MCP bridge — adapt a Model Context Protocol tool list into the agent's AgentTool[],
@@ -1,5 +1,5 @@
1
- import { e as McpToolSearchOptions, f as McpToolSpec } from './mcp-CUo-9LUe.js';
2
- import { A as AgentTool } from './tools-DZHZIyxh.js';
1
+ import { e as McpToolSearchOptions, f as McpToolSpec } from './mcp-DZhcLur2.js';
2
+ import { A as AgentTool } from './tools-DwfeF8VQ.js';
3
3
  import '@livx.cc/wcli/core';
4
4
 
5
5
  /** Hard cap for `tools/call`. NOT the 30s protocol timeout: a tool call is real work (an image render, a crawl)
@@ -1,5 +1,5 @@
1
1
  import { IFilesystem } from '@livx.cc/wcli/core';
2
- import { M as Message, o as MessageContent, H as HostBridge, A as AgentTool, C as ChatLike, k as JobRegistry, U as UserQuestion } from './tools-DZHZIyxh.js';
2
+ import { M as Message, o as MessageContent, H as HostBridge, A as AgentTool, C as ChatLike, k as JobRegistry, U as UserQuestion } from './tools-DwfeF8VQ.js';
3
3
 
4
4
  /**
5
5
  * `--model auto`: per-turn model routing. A classifier (Jev by default — injected, so a regex or
@@ -99,6 +99,26 @@ type JevOpts = {
99
99
  declare function jevAvailable(opts?: JevOpts): Promise<boolean>;
100
100
  declare function jevClassifier(opts?: JevOpts): Classifier;
101
101
 
102
+ /**
103
+ * Walk the VFS directory tree from `/` down, collecting instruction files
104
+ * (AGENT.md, AGENTS.md, CLAUDE.md, .claude/<name>) at each level.
105
+ * Merges all found files general-first → specific-last (mirrors Claude Code's
106
+ * hierarchical CLAUDE.md discovery). First matching filename per directory wins
107
+ * (no duplicates from the same level). Edge-portable: works over any IFilesystem.
108
+ */
109
+ declare function loadInstructions(fs: IFilesystem, names?: string[]): Promise<string>;
110
+ /** An extra file injected into the prompt next to the instructions (e.g. a kb/user-space note). */
111
+ interface ContextFileSpec {
112
+ path: string;
113
+ maxChars?: number;
114
+ label?: string;
115
+ }
116
+ /**
117
+ * Load explicit context files, same section format as instructions. Missing/empty → skipped;
118
+ * ≤ `maxChars` → full; over → head + a pointer to the full file (the agent can Read the rest).
119
+ */
120
+ declare function loadContextFiles(fs: IFilesystem, specs?: ContextFileSpec[]): Promise<string>;
121
+
102
122
  /**
103
123
  * Hooks — deterministic interception points around tool execution, run by the
104
124
  * harness/host (mirrors Claude Code hooks). The seam stays edge-safe: hooks are
@@ -284,6 +304,12 @@ declare function composeHooks(...list: (Hooks | undefined)[]): Hooks;
284
304
  declare const WRITE_TOOLS: Set<string>;
285
305
  /** The planner also loses the shells: either one can write files. */
286
306
  declare const PLANNER_BLOCKED: Set<string>;
307
+ /** Does the planner lose this tool? By the tool's own `writes` flag first — it survives a host rename (shraga-ee's
308
+ * `Shell` → `Bash`) — then by name, case-insensitively (`Bash`, a host's own `write`). */
309
+ declare const plannerBlocks: (t: {
310
+ name: string;
311
+ writes?: boolean;
312
+ }) => boolean;
287
313
  declare const PLANNER_REFUSAL = "Refused: you are the planner and do not write files. Delegate the change with Task/TaskBatch (model set to the worker) and give the worker a full spec.";
288
314
  declare const PLAN_FIRST = "Refused: check your plan with `Advise` before the first write (files, data shape, the hard parts). Then write.";
289
315
  /** A build may consult at most this many times by default: plan + review + one spare. */
@@ -338,6 +364,21 @@ declare function meterWorkers<T extends ChatLike>(ai: T, main: string): {
338
364
  model: () => string | undefined;
339
365
  reset: () => void;
340
366
  };
367
+ /** Claude Code's NATIVE file-changing tools (its own loop runs them; agentx's tool wrappers never see the call). */
368
+ declare const CC_WRITE_TOOLS: string[];
369
+ /**
370
+ * The same two modes for a claude-code/* agent. Claude Code runs its OWN tool loop, so `delegateTools`/`gate`
371
+ * (which wrap agentx tools) never fire there — Opus wrote with its native Write and had no worker tool.
372
+ * - planner: native writes, Bash and native Task/Agent are `disallowedTools` (the SDK strips them); agentx's
373
+ * Task/TaskBatch reach it over the in-process bridge (ccBridge.ts), so it delegates to workers on the worker model.
374
+ * - advised worker: `Advise` goes over the bridge; a PreToolUse hook denies a native write until one consult
375
+ * (`used()` > 0). The host's own `hooks` are kept.
376
+ */
377
+ declare function ccModeOptions(kind: 'delegate' | 'advisor' | undefined, hostHooks: Record<string, unknown[]> | undefined, used: () => number): {
378
+ bridge: Set<string>;
379
+ disallow: string[];
380
+ hooks?: Record<string, unknown[]>;
381
+ };
341
382
 
342
383
  /**
343
384
  * Normalized reasoning/thinking control → provider-specific request fragment.
@@ -542,6 +583,8 @@ declare class AgentOptions {
542
583
  * Walks the VFS tree and merges all found files (general → specific, like Claude Code).
543
584
  * `true` (default) = auto-discover standard names. `string[]` = custom names. `false` = skip. */
544
585
  instructionFiles: boolean | string[];
586
+ /** Extra files injected right after the instructions (missing → skipped; over `maxChars` → head + pointer to the full file). */
587
+ contextFiles?: ContextFileSpec[];
545
588
  /** Host interaction channel (human-in-the-loop). If set: adds the `AskUserQuestion` tool. */
546
589
  host?: HostBridge;
547
590
  /** Add the `AskUserQuestion` tool when a host is present (default true). Set false for an agent that
@@ -664,6 +707,8 @@ declare class Agent {
664
707
  private activeTools;
665
708
  private meter?;
666
709
  private modeModel?;
710
+ private modeKind?;
711
+ private adv?;
667
712
  private lastTask;
668
713
  /** claude-code bridge for agentx-only tools (ccBridge.ts) + the current step's executor it calls. */
669
714
  private ccServer?;
@@ -1189,4 +1234,4 @@ declare class SecondChannel {
1189
1234
  private say;
1190
1235
  }
1191
1236
 
1192
- export { ADVISE_LIMIT as A, advisorPrompt as B, type ChannelMode as C, DEFAULT_MUTATING as D, claudeCodeDisallowedTools as E, composeHooks as F, type Gender as G, type Hooks as H, delegatePrompt as I, delegateTools as J, delegateWorkerFor as K, type LineKind as L, ModelRouter as M, estimateTokens as N, jevAvailable as O, PLANNER_BLOCKED as P, jevClassifier as Q, type ReasoningEffort as R, SecondChannel as S, type Tier as T, makeAdvisor as U, meterWorkers as V, WRITE_TOOLS as W, pickTier as X, planMode as Y, reasoningToChatFragment as Z, type AdvisorSetup as a, Agent as b, AgentOptions as c, type ChatFragment as d, type ChatUsage as e, type Classification as f, type Classifier as g, type CompactResult as h, type Decider as i, type Decision as j, ModelRouterOptions as k, PLANNER_REFUSAL as l, PLAN_FIRST as m, PermissionOptions as n, PermissionPolicy as o, type PermissionRule as p, type PreToolUseDecision as q, RecordingHooks as r, RecordingLifecycle as s, type RouteDecision as t, type RouterState as u, type RunResult as v, SecondChannelOptions as w, type ToolUse as x, type ToolUseMeta as y, advisorFor as z };
1237
+ export { meterWorkers as $, ADVISE_LIMIT as A, type ToolUseMeta as B, CC_WRITE_TOOLS as C, DEFAULT_MUTATING as D, advisorFor as E, advisorPrompt as F, type Gender as G, type Hooks as H, ccModeOptions as I, claudeCodeDisallowedTools as J, composeHooks as K, type LineKind as L, ModelRouter as M, delegatePrompt as N, delegateTools as O, PLANNER_BLOCKED as P, delegateWorkerFor as Q, type ReasoningEffort as R, SecondChannel as S, type Tier as T, estimateTokens as U, jevAvailable as V, WRITE_TOOLS as W, jevClassifier as X, loadContextFiles as Y, loadInstructions as Z, makeAdvisor as _, type AdvisorSetup as a, pickTier as a0, planMode as a1, plannerBlocks as a2, reasoningToChatFragment as a3, Agent as b, AgentOptions as c, type ChannelMode as d, type ChatFragment as e, type ChatUsage as f, type Classification as g, type Classifier as h, type CompactResult as i, type ContextFileSpec as j, type Decider as k, type Decision as l, ModelRouterOptions as m, PLANNER_REFUSAL as n, PLAN_FIRST as o, PermissionOptions as p, PermissionPolicy as q, type PermissionRule as r, type PreToolUseDecision as s, RecordingHooks as t, RecordingLifecycle as u, type RouteDecision as v, type RouterState as w, type RunResult as x, SecondChannelOptions as y, type ToolUse as z };
@@ -552,6 +552,9 @@ interface AgentTool {
552
552
  * result. Omit for tools that return promptly.
553
553
  */
554
554
  maxDurationMs?: number;
555
+ /** This tool can change files (a file editor or a shell). Survives a host rename (`Shell` → `Bash`), so policy that
556
+ * must hold whatever the tool is called — delegate mode's planner refusal — keys on it, not on the name. */
557
+ writes?: boolean;
555
558
  /**
556
559
  * Is `maxDurationMs` SELF-ENFORCED — does this tool abort itself at that bound and return?
557
560
  * An enforced bound cannot be overrun, so a transport above it needs only modest slack; an ADVISORY
@@ -1,4 +1,4 @@
1
- import { k as JobRegistry, A as AgentTool } from './tools-DZHZIyxh.js';
1
+ import { k as JobRegistry, A as AgentTool } from './tools-DwfeF8VQ.js';
2
2
  import '@livx.cc/wcli/core';
3
3
 
4
4
  /**
@@ -1221,6 +1221,7 @@ function makeRealShellTool(options) {
1221
1221
  };
1222
1222
  return {
1223
1223
  name: "Shell",
1224
+ writes: true,
1224
1225
  // Rebind for an isolated child agent (git worktree): same policy/env/timeouts, new cwd. The
1225
1226
  // `registry` is deliberately dropped — it is bound to the PARENT's cwd (and, in hosts like
1226
1227
  // shraga-ee, to the parent's session), so a background job started from the child would run