@livx.cc/agentx 0.99.69 → 0.99.71

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 { a as AgentOptions, H as Hooks, n as RunResult, A as Agent, g as PermissionPolicy } from './Agent-BpCqDWFG.js';
2
- export { C as ChatFragment, b as Classification, c as Classifier, d as CompactResult, D as DEFAULT_MUTATING, e as Decision, M as ModelRouter, f as ModelRouterOptions, P as PermissionOptions, h as PermissionRule, i as PreToolUseDecision, R as ReasoningEffort, j as RecordingHooks, k as RecordingLifecycle, l as RouteDecision, m as RouterState, T as Tier, o as ToolUse, p as ToolUseMeta, q as claudeCodeDisallowedTools, r as composeHooks, s as estimateTokens, t as jevAvailable, u as jevClassifier, v as pickTier, w as planMode, x as reasoningToChatFragment } from './Agent-BpCqDWFG.js';
1
+ import { a as AgentOptions, H as Hooks, n as RunResult, A as Agent, g as PermissionPolicy } from './Agent-CuXPAfSY.js';
2
+ export { C as ChatFragment, b as Classification, c as Classifier, d as CompactResult, D as DEFAULT_MUTATING, e as Decision, M as ModelRouter, f as ModelRouterOptions, P as PermissionOptions, h as PermissionRule, i as PreToolUseDecision, R as ReasoningEffort, j as RecordingHooks, k as RecordingLifecycle, l as RouteDecision, m as RouterState, T as Tier, o as ToolUse, p as ToolUseMeta, q as claudeCodeDisallowedTools, r as composeHooks, s as estimateTokens, t as jevAvailable, u as jevClassifier, v as pickTier, w as planMode, x as reasoningToChatFragment } from './Agent-CuXPAfSY.js';
3
3
  export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, 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
@@ -2778,6 +2778,44 @@ var init_tools_shell = __esm({
2778
2778
  }
2779
2779
  });
2780
2780
 
2781
+ // src/ccBridge.ts
2782
+ var CC_BRIDGED = /* @__PURE__ */ new Set(["Recall", "Remember", "MemorySearch"]);
2783
+ function ccToolServer(name, tools, call) {
2784
+ const instance = {
2785
+ async connect(t) {
2786
+ const reply = (id, body) => t.send({ jsonrpc: "2.0", id, ...body });
2787
+ t.onmessage = async (m) => {
2788
+ if (m.id === void 0 || m.id === null) return;
2789
+ try {
2790
+ switch (m.method) {
2791
+ case "initialize":
2792
+ return await reply(m.id, { result: { protocolVersion: m.params?.protocolVersion ?? "2025-06-18", capabilities: { tools: {} }, serverInfo: { name, version: "1" } } });
2793
+ case "tools/list":
2794
+ return await reply(m.id, { result: { tools: tools().map((x) => ({ name: x.name, description: x.description, inputSchema: x.parameters })) } });
2795
+ case "tools/call": {
2796
+ const r = await call(m.params?.name, m.params?.arguments ?? {});
2797
+ const text = typeof r === "string" ? r : r.text;
2798
+ const images = typeof r === "string" ? [] : (r.images ?? []).map((i) => ({ type: "image", mimeType: i.mimeType, data: i.data }));
2799
+ return await reply(m.id, { result: { content: [{ type: "text", text }, ...images] } });
2800
+ }
2801
+ case "ping":
2802
+ return await reply(m.id, { result: {} });
2803
+ default:
2804
+ return await reply(m.id, { error: { code: -32601, message: `method not found: ${m.method}` } });
2805
+ }
2806
+ } catch (e) {
2807
+ if (m.method === "tools/call") return reply(m.id, { result: { content: [{ type: "text", text: String(e?.message ?? e) }], isError: true } });
2808
+ return reply(m.id, { error: { code: -32603, message: String(e?.message ?? e) } });
2809
+ }
2810
+ };
2811
+ await t.start?.();
2812
+ },
2813
+ async close() {
2814
+ }
2815
+ };
2816
+ return { type: "sdk", name, instance };
2817
+ }
2818
+
2781
2819
  // src/Agent.ts
2782
2820
  init_llm();
2783
2821
  init_tools();
@@ -4402,6 +4440,9 @@ var Agent = class _Agent {
4402
4440
  lastTrimNotified = 0;
4403
4441
  // last auto-trim drop count surfaced via host.notify (dedup)
4404
4442
  activeTools = [];
4443
+ /** claude-code bridge for agentx-only tools (ccBridge.ts) + the current step's executor it calls. */
4444
+ ccServer;
4445
+ ccExec;
4405
4446
  /** Per-run ground truth: every tool name actually INVOKED this run (native dispatch + delegated
4406
4447
  * runtime activity). The ledger that makes a fabricated tool claim provable. Reset per run. */
4407
4448
  invokedTools = /* @__PURE__ */ new Set();
@@ -4767,25 +4808,28 @@ var Agent = class _Agent {
4767
4808
  }
4768
4809
  for (const v of toolTimeoutViolations(this.activeTools, effectiveToolTimeoutMs)) log7.warn(v);
4769
4810
  }
4770
- const cursorPo = isCursorWithTools ? {
4771
- toolTimeoutMs: effectiveToolTimeoutMs,
4772
- toolExecutor: async (name, args) => {
4773
- const tc = { id: `cursor-${Date.now()}`, type: "function", function: { name, arguments: JSON.stringify(args) } };
4774
- const job = this.jobs.track({ kind: "host", label: name, holds: true, hardCapMs: effectiveToolTimeoutMs });
4775
- try {
4776
- const r = await this.dispatch(tc);
4777
- job.finish("done");
4778
- return r;
4779
- } catch (e) {
4780
- job.finish("error", void 0, String(e));
4781
- throw e;
4782
- } finally {
4783
- this.toolRanThisAttempt = true;
4784
- this.stallPoke?.();
4785
- }
4811
+ const hostExec = async (name, args) => {
4812
+ const tc = { id: `host-${Date.now()}`, type: "function", function: { name, arguments: JSON.stringify(args) } };
4813
+ const job = this.jobs.track({ kind: "host", label: name, holds: true, hardCapMs: effectiveToolTimeoutMs });
4814
+ try {
4815
+ const r = await this.dispatch(tc);
4816
+ job.finish("done");
4817
+ return r;
4818
+ } catch (e) {
4819
+ job.finish("error", void 0, String(e));
4820
+ throw e;
4821
+ } finally {
4822
+ this.toolRanThisAttempt = true;
4823
+ this.stallPoke?.();
4786
4824
  }
4787
- } : void 0;
4825
+ };
4826
+ const cursorPo = isCursorWithTools ? { toolTimeoutMs: effectiveToolTimeoutMs, toolExecutor: hostExec } : void 0;
4788
4827
  const claudeSteerPo = o.model.startsWith("claude-code/") ? { steer: () => this.drainPendingSteers() } : void 0;
4828
+ if (claudeSteerPo && o.providerOptions?.claudeCodeSession && this.activeTools.some((t) => CC_BRIDGED.has(t.name))) {
4829
+ this.ccServer ??= ccToolServer("agentx", () => this.activeTools.filter((t) => CC_BRIDGED.has(t.name)), (n, a) => this.ccExec(n, a));
4830
+ claudeSteerPo.mcpServers = { ...o.providerOptions?.mcpServers, agentx: this.ccServer };
4831
+ }
4832
+ if (this.ccServer) this.ccExec = hostExec;
4789
4833
  const denyTools = o.model.startsWith("claude-code/") ? claudeCodeDisallowedTools(o.permissions) : [];
4790
4834
  if (denyTools.length) {
4791
4835
  const prior = o.providerOptions?.disallowedTools ?? [];