@livx.cc/agentx 0.99.107 → 0.99.108

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, p as RunResult, f as Decider, A as Agent, i as PermissionPolicy, L as LineKind, C as ChannelMode, q as SecondChannelOptions, S as SecondChannel } from './secondChannel-BYW5qPAJ.js';
2
- export { b as ChatFragment, c as Classification, d as Classifier, e as CompactResult, D as DEFAULT_MUTATING, g as Decision, M as ModelRouter, h as ModelRouterOptions, P as PermissionOptions, j as PermissionRule, k as PreToolUseDecision, R as ReasoningEffort, l as RecordingHooks, m as RecordingLifecycle, n as RouteDecision, o as RouterState, T as Tier, r as ToolUse, s as ToolUseMeta, t as claudeCodeDisallowedTools, u as composeHooks, v as estimateTokens, w as jevAvailable, x as jevClassifier, y as pickTier, z as planMode, B as reasoningToChatFragment } from './secondChannel-BYW5qPAJ.js';
1
+ import { a as AgentOptions, H as Hooks, p as RunResult, f as Decider, A as Agent, i as PermissionPolicy, L as LineKind, C as ChannelMode, q as SecondChannelOptions, S as SecondChannel } from './secondChannel-3IPP3Qgh.js';
2
+ export { b as ChatFragment, c as Classification, d as Classifier, e as CompactResult, D as DEFAULT_MUTATING, g as Decision, M as ModelRouter, h as ModelRouterOptions, P as PermissionOptions, j as PermissionRule, k as PreToolUseDecision, R as ReasoningEffort, l as RecordingHooks, m as RecordingLifecycle, n as RouteDecision, o as RouterState, T as Tier, r as ToolUse, s as ToolUseMeta, t as claudeCodeDisallowedTools, u as composeHooks, v as estimateTokens, w as jevAvailable, x as jevClassifier, y as pickTier, z as planMode, B as reasoningToChatFragment } from './secondChannel-3IPP3Qgh.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
@@ -12690,6 +12690,9 @@ var SecondChannelOptions = class {
12690
12690
  /** A bridge waits this long after the user's turn is dispatched, and plays only if channel-1 has said nothing yet
12691
12691
  * (a fast reply/ack needs no bridge — one before it reads as the agent starting a different sentence). 0 = at once. */
12692
12692
  bridgeDelayMs = 1200;
12693
+ /** Duplex v3 (§3 first sound): a bridge skips the decider (the veto stays for backchannels/fillers) and speaks a
12694
+ * canned line at once; a generated one is started at dispatch and used only if it already landed. */
12695
+ instantBridge = false;
12693
12696
  /** No new interim for this long → a pause (hosts may also call onPause). */
12694
12697
  fillerPauseMs = 700;
12695
12698
  fillerMinWords = 4;
@@ -12761,6 +12764,8 @@ var SecondChannel = class {
12761
12764
  // the line the last barge actually cut (spoke())
12762
12765
  bridged = false;
12763
12766
  // one bridge per main turn
12767
+ bridgeDraft = null;
12768
+ // a bridge generated ahead, used only if ready in time
12764
12769
  recent = [];
12765
12770
  picks = /* @__PURE__ */ new Map();
12766
12771
  inflight = null;
@@ -12896,6 +12901,7 @@ var SecondChannel = class {
12896
12901
  if (this[k]) clearTimeout(this[k]);
12897
12902
  this[k] = null;
12898
12903
  }
12904
+ if (this.o.instantBridge) this.prefetchBridge();
12899
12905
  const wait = Math.max(this.o.bridgeDelayMs, this.o.minGapMs - (this.o.now() - this.lastAt));
12900
12906
  if (wait > 0) this.bridgeTimer = setTimeout(() => {
12901
12907
  this.bridgeTimer = null;
@@ -13028,7 +13034,7 @@ var SecondChannel = class {
13028
13034
  try {
13029
13035
  let kind = rule;
13030
13036
  let choice;
13031
- if (this.o.decide && !cue) {
13037
+ if (this.o.decide && !cue && !(rule === "bridge" && this.o.instantBridge)) {
13032
13038
  const ac = new AbortController();
13033
13039
  const d = await withBudget(this.o.decide(this.tail(), { ...this.state(pauseMs), rule }, ac.signal), this.o.decisionBudgetMs, "channel decision", ac);
13034
13040
  choice = d?.choice;
@@ -13062,7 +13068,24 @@ var SecondChannel = class {
13062
13068
  call_ms: Math.round(now3 - this.startedAt)
13063
13069
  };
13064
13070
  }
13071
+ /** Start writing this turn's bridge now, so it may be ready by bridgeDelayMs. The bridge never waits for it. */
13072
+ prefetchBridge() {
13073
+ this.bridgeDraft = null;
13074
+ if (!this.o.generate || !this.o.generateFor.includes("bridge") || !this.lang || !this.heard) return;
13075
+ const gen = this.gen, ac = new AbortController();
13076
+ const ctx = { kind: "bridge", heard: this.tail(), state: this.main, avoid: [...this.recent], lang: this.lang };
13077
+ void withBudget(this.o.generate(ctx, ac.signal), Math.max(this.o.generateBudgetMs, this.o.bridgeDelayMs), "bridge generate", ac).then((raw) => {
13078
+ const text = cleanLine(raw ?? "", ctx.lang);
13079
+ if (text && gen === this.gen) this.bridgeDraft = { gen, text };
13080
+ }).catch((e) => log28.debug(`bridge prefetch failed: ${e?.message ?? e}`));
13081
+ }
13065
13082
  async line(kind, react = true) {
13083
+ if (kind === "bridge" && this.o.instantBridge) {
13084
+ const d = this.bridgeDraft?.gen === this.gen ? this.bridgeDraft.text : "";
13085
+ this.bridgeDraft = null;
13086
+ if (d && !this.recent.some((r) => norm3(r) === norm3(d))) return d;
13087
+ return this.pick(kind);
13088
+ }
13066
13089
  if (this.o.generate && this.o.generateFor.includes(kind) && (kind !== "backchannel" || react)) {
13067
13090
  const ac = new AbortController();
13068
13091
  const ctx = { kind, heard: this.tail(), state: this.main, avoid: [...this.recent], lang: this.lang, ...kind === "backchannel" && this.o.reactionGapMs ? { react: true } : {} };
@@ -13212,6 +13235,9 @@ var VoiceCall = class {
13212
13235
  } : {},
13213
13236
  mode: o.mode,
13214
13237
  aec: o.aec,
13238
+ bridgeDelayMs: 700,
13239
+ instantBridge: true,
13240
+ // v3 §3: first sound <1.2s p50 — a bridge at 700ms if MAIN is still silent, no veto, no wait
13215
13241
  ...this.lang ? { lang: this.lang } : {},
13216
13242
  ...o.channel,
13217
13243
  speak: (text, kind) => this.say(text, kind),