@livx.cc/agentx 0.99.161 → 0.99.163

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/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- import { w as RouterState, H as Hooks, c as AgentOptions, x as RunResult, f as ChatUsage, R as ReasoningEffort, d as ChannelMode, b as Agent } from './secondChannel-CR3xWWB_.js';
2
+ import { w as RouterState, H as Hooks, c as AgentOptions, x as RunResult, f as ChatUsage, R as ReasoningEffort, d as ChannelMode, b as Agent } from './secondChannel-BNDDJv6d.js';
3
3
  import { IFilesystem } from '@livx.cc/wcli/core';
4
4
  import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, o as MessageContent } from './tools-DwfeF8VQ.js';
5
5
 
package/dist/cli.js CHANGED
@@ -4207,6 +4207,20 @@ var PermissionPolicy = class {
4207
4207
  denyRules(explicitOnly = false) {
4208
4208
  return this.options.rules.filter((r) => r.decision === "deny" && (!explicitOnly || r.explicit)).map((r) => `${r.tool ?? "*"}${r.pathGlob ? `(${r.pathGlob})` : ""}`);
4209
4209
  }
4210
+ /** An allow-list policy (default 'deny') as Claude Code's base tool set (SDK `tools`): the built-in tools it allows, so the
4211
+ * model never sees the rest — the hook alone let it reach for them and fail (live: a sandboxed phone-call agent tried
4212
+ * ReportFindings). MCP tools are not built-ins (the hook gates them). undefined = not an allow-list, or one that names
4213
+ * built-ins by wildcard / any-tool (then only the hook holds). */
4214
+ ccBuiltinTools() {
4215
+ if (this.options.default !== "deny") return void 0;
4216
+ const out = /* @__PURE__ */ new Set();
4217
+ for (const r of this.options.rules) {
4218
+ if (r.decision !== "allow" || r.tool?.startsWith("mcp__")) continue;
4219
+ if (!r.tool || r.tool.includes("*")) return void 0;
4220
+ out.add(CC_TOOL_ALIAS[r.tool] ?? r.tool);
4221
+ }
4222
+ return [...out];
4223
+ }
4210
4224
  /** An allow-list policy (default 'deny') as Claude Code SDK hooks: claude-code runs its own tools, which never reach
4211
4225
  * {@link hooks}, and `disallowedTools` can't say "everything else". Every tool call (native and MCP) goes through
4212
4226
  * decide(); `ask` has no host there → deny. undefined for a default-allow policy (its deny rules travel as disallowedTools). */
@@ -5312,6 +5326,8 @@ var Agent = class _Agent {
5312
5326
  const h = po.hooks ?? o.providerOptions?.hooks ?? {};
5313
5327
  po.hooks = { ...h, PreToolUse: [...h.PreToolUse ?? [], ...allowOnly.PreToolUse] };
5314
5328
  }
5329
+ const builtins = o.providerOptions?.tools === void 0 ? o.permissions?.ccBuiltinTools() : void 0;
5330
+ if (builtins) po.tools = builtins;
5315
5331
  if (this.modeKind && o.providerOptions?.claudeCodeSession) po.claudeCodeSession = `${o.providerOptions.claudeCodeSession}:${this.modeKind}`;
5316
5332
  if (denyTools.length) {
5317
5333
  const prior = o.providerOptions?.disallowedTools ?? [];
@@ -11745,6 +11761,11 @@ var TurnGate = class {
11745
11761
  get lastTurn() {
11746
11762
  return this.last && { id: this.last.id, text: this.last.text, started: this.last.started };
11747
11763
  }
11764
+ /** The user's own line is not over: a fragment is held, or the last turn went out mid-phrase ("where is the—") within
11765
+ * `withinMs`. Their next words finish it — never a reaction to the reply. */
11766
+ unfinished(withinMs) {
11767
+ return !!this.held || !!this.last && endsMidPhrase(this.last.text) && this.o.now() - this.last.at < withinMs;
11768
+ }
11748
11769
  /** An STT final. */
11749
11770
  final(text, sttId) {
11750
11771
  let t = text.trim(), replaces;
@@ -11840,7 +11861,7 @@ var TurnGate = class {
11840
11861
  }
11841
11862
  }
11842
11863
  refinal(last, t, key, sttId) {
11843
- if (!last.started) return this.send(t, key, sttId ?? last.sttId, "replace", last.id);
11864
+ if (!last.started || endsMidPhrase(last.text)) return this.send(t, key, sttId ?? last.sttId, "replace", last.id);
11844
11865
  const a = words3(last.text), b = words3(t);
11845
11866
  let i = 0;
11846
11867
  while (i < a.length && i < b.length && norm3(a[i]) === norm3(b[i])) i++;
@@ -16050,6 +16071,10 @@ var VoiceCall = class {
16050
16071
  }
16051
16072
  /** Soft barge-in: keep (a listener cue — no turn) or cut (→ barge()). */
16052
16073
  async overlap(text) {
16074
+ if (this.gate.unfinished(UNFINISHED_MS)) {
16075
+ this.barge();
16076
+ return "cut";
16077
+ }
16053
16078
  if (this.o.mode === "live" && isReaction(text)) return this.kept(text), "keep";
16054
16079
  const d = await this.judge.judge(text);
16055
16080
  if (d.verdict === "cut") this.barge();
@@ -16427,6 +16452,7 @@ var VoiceCall = class {
16427
16452
  }
16428
16453
  }
16429
16454
  };
16455
+ var UNFINISHED_MS = 8e3;
16430
16456
  var BACK_TO = { en: "Anyway,", he: "\u05D1\u05DB\u05DC \u05DE\u05E7\u05E8\u05D4," };
16431
16457
  function cutSentence(heard) {
16432
16458
  const tail = heard.trim().split(/(?<=[.!?…])\s+/).at(-1) ?? "";