@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/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-CR3xWWB_.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-CR3xWWB_.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-BNDDJv6d.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-BNDDJv6d.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';
@@ -1002,6 +1002,9 @@ declare class TurnGate {
1002
1002
  text: string;
1003
1003
  started: boolean;
1004
1004
  } | undefined;
1005
+ /** The user's own line is not over: a fragment is held, or the last turn went out mid-phrase ("where is the—") within
1006
+ * `withinMs`. Their next words finish it — never a reaction to the reply. */
1007
+ unfinished(withinMs: number): boolean;
1005
1008
  /** An STT final. */
1006
1009
  final(text: string, sttId?: string): void;
1007
1010
  /** The user kept talking after turn `id` went out and before its reply made a sound: it was not over. Its words go back
package/dist/index.js CHANGED
@@ -3948,6 +3948,20 @@ var PermissionPolicy = class {
3948
3948
  denyRules(explicitOnly = false) {
3949
3949
  return this.options.rules.filter((r) => r.decision === "deny" && (!explicitOnly || r.explicit)).map((r) => `${r.tool ?? "*"}${r.pathGlob ? `(${r.pathGlob})` : ""}`);
3950
3950
  }
3951
+ /** An allow-list policy (default 'deny') as Claude Code's base tool set (SDK `tools`): the built-in tools it allows, so the
3952
+ * model never sees the rest — the hook alone let it reach for them and fail (live: a sandboxed phone-call agent tried
3953
+ * ReportFindings). MCP tools are not built-ins (the hook gates them). undefined = not an allow-list, or one that names
3954
+ * built-ins by wildcard / any-tool (then only the hook holds). */
3955
+ ccBuiltinTools() {
3956
+ if (this.options.default !== "deny") return void 0;
3957
+ const out = /* @__PURE__ */ new Set();
3958
+ for (const r of this.options.rules) {
3959
+ if (r.decision !== "allow" || r.tool?.startsWith("mcp__")) continue;
3960
+ if (!r.tool || r.tool.includes("*")) return void 0;
3961
+ out.add(CC_TOOL_ALIAS[r.tool] ?? r.tool);
3962
+ }
3963
+ return [...out];
3964
+ }
3951
3965
  /** An allow-list policy (default 'deny') as Claude Code SDK hooks: claude-code runs its own tools, which never reach
3952
3966
  * {@link hooks}, and `disallowedTools` can't say "everything else". Every tool call (native and MCP) goes through
3953
3967
  * decide(); `ask` has no host there → deny. undefined for a default-allow policy (its deny rules travel as disallowedTools). */
@@ -5203,6 +5217,8 @@ var Agent = class _Agent {
5203
5217
  const h = po.hooks ?? o.providerOptions?.hooks ?? {};
5204
5218
  po.hooks = { ...h, PreToolUse: [...h.PreToolUse ?? [], ...allowOnly.PreToolUse] };
5205
5219
  }
5220
+ const builtins = o.providerOptions?.tools === void 0 ? o.permissions?.ccBuiltinTools() : void 0;
5221
+ if (builtins) po.tools = builtins;
5206
5222
  if (this.modeKind && o.providerOptions?.claudeCodeSession) po.claudeCodeSession = `${o.providerOptions.claudeCodeSession}:${this.modeKind}`;
5207
5223
  if (denyTools.length) {
5208
5224
  const prior = o.providerOptions?.disallowedTools ?? [];
@@ -11405,6 +11421,11 @@ var TurnGate = class {
11405
11421
  get lastTurn() {
11406
11422
  return this.last && { id: this.last.id, text: this.last.text, started: this.last.started };
11407
11423
  }
11424
+ /** The user's own line is not over: a fragment is held, or the last turn went out mid-phrase ("where is the—") within
11425
+ * `withinMs`. Their next words finish it — never a reaction to the reply. */
11426
+ unfinished(withinMs) {
11427
+ return !!this.held || !!this.last && endsMidPhrase(this.last.text) && this.o.now() - this.last.at < withinMs;
11428
+ }
11408
11429
  /** An STT final. */
11409
11430
  final(text, sttId) {
11410
11431
  let t = text.trim(), replaces;
@@ -11500,7 +11521,7 @@ var TurnGate = class {
11500
11521
  }
11501
11522
  }
11502
11523
  refinal(last, t, key, sttId) {
11503
- if (!last.started) return this.send(t, key, sttId ?? last.sttId, "replace", last.id);
11524
+ if (!last.started || endsMidPhrase(last.text)) return this.send(t, key, sttId ?? last.sttId, "replace", last.id);
11504
11525
  const a = words2(last.text), b = words2(t);
11505
11526
  let i = 0;
11506
11527
  while (i < a.length && i < b.length && norm3(a[i]) === norm3(b[i])) i++;
@@ -15621,6 +15642,10 @@ var VoiceCall = class {
15621
15642
  }
15622
15643
  /** Soft barge-in: keep (a listener cue — no turn) or cut (→ barge()). */
15623
15644
  async overlap(text) {
15645
+ if (this.gate.unfinished(UNFINISHED_MS)) {
15646
+ this.barge();
15647
+ return "cut";
15648
+ }
15624
15649
  if (this.o.mode === "live" && isReaction(text)) return this.kept(text), "keep";
15625
15650
  const d = await this.judge.judge(text);
15626
15651
  if (d.verdict === "cut") this.barge();
@@ -15998,6 +16023,7 @@ var VoiceCall = class {
15998
16023
  }
15999
16024
  }
16000
16025
  };
16026
+ var UNFINISHED_MS = 8e3;
16001
16027
  var BACK_TO = { en: "Anyway,", he: "\u05D1\u05DB\u05DC \u05DE\u05E7\u05E8\u05D4," };
16002
16028
  function cutSentence(heard) {
16003
16029
  const tail = heard.trim().split(/(?<=[.!?…])\s+/).at(-1) ?? "";