@livx.cc/agentx 0.99.163 → 0.99.165

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.js CHANGED
@@ -5231,12 +5231,17 @@ var Agent = class _Agent {
5231
5231
  * No model call; the transcript gains only that system message. Other models: nothing to warm. */
5232
5232
  async prewarm() {
5233
5233
  const o = this.options;
5234
- if (!o.model.startsWith("claude-code/") || !o.providerOptions?.claudeCodeSession) return;
5234
+ const api = o.model.startsWith("anthropic/") && o.promptCache;
5235
+ if (!api && (!o.model.startsWith("claude-code/") || !o.providerOptions?.claudeCodeSession)) return;
5235
5236
  await this.ensureFs();
5236
5237
  const systemPrompt = await this.prepare(), startCtx = await this.fireSessionStart();
5237
5238
  const sys = { role: "system", content: systemPrompt + (startCtx ? "\n\n" + startCtx : "") };
5238
5239
  if (this.transcript[0]?.role === "system") this.transcript[0] = sys;
5239
5240
  else this.transcript.unshift(sys);
5241
+ if (api) {
5242
+ await o.ai.chat({ model: o.model, messages: [sys, { role: "user", content: "." }], tools: toWireTools(this.activeTools), stream: false, maxTokens: 1, promptCache: true, ...o.providerOptions ? { providerOptions: o.providerOptions } : {} });
5243
+ return;
5244
+ }
5240
5245
  const po = this.claudeCodePo(), frag = reasoningToChatFragment(o.model, o.reasoning);
5241
5246
  const r = await o.ai.chat({ model: o.model, messages: this.trimContext(), tools: [], stream: true, ...frag, ...o.promptCache ? { promptCache: true } : {}, providerOptions: { ...frag.providerOptions, ...o.providerOptions, ...po, prewarm: true } });
5242
5247
  for await (const _ of r) {
@@ -10683,6 +10688,8 @@ var REACT = /^(?:(?:oh|and|so|wait|but|ok|okay|yeah)\s+)*(?:wow|whoa|woah|really
10683
10688
  var WH_LEAD = "^(?:(?:oh|and|so|wait|but|ok|okay|um|uh|sorry)\\s+)*";
10684
10689
  var WH_QUESTION = new RegExp(WH_LEAD + "(?:who|whom|whose|where|which|why|how|when|what|\u05DE\u05D9|\u05D0\u05D9\u05E4\u05D4|\u05DC\u05DE\u05D4|\u05D0\u05D9\u05DA|\u05DE\u05EA\u05D9|\u05DE\u05D4)\\s+\\S", "u");
10685
10690
  var WH_EXCLAIM = new RegExp(WH_LEAD + "(?:what an? |how (?:cool|nice|fun|sweet|sad|funny|weird|crazy|strange|interesting|beautiful|lovely|cute|amazing|awesome)\\b)", "u");
10691
+ var BARE = /* @__PURE__ */ new Set(["yeah", "yea", "yes", "yep", "yup", "ok", "okay", "k", "right", "sure", "mm", "mmm", "hmm", "mhm", "mm-hm", "mm-hmm", "uh-huh", "um", "uh", "ah", "oh"]);
10692
+ var isBareCue = (text) => BARE.has(norm2(text).replace(/^-+|-+$/g, ""));
10686
10693
  var isReaction = (text) => {
10687
10694
  const t = norm2(text);
10688
10695
  return REACT.test(t) || new RegExp("\\s\\p{L}{1,3}$", "u").test(t) && REACT.test(t.replace(new RegExp("\\s\\p{L}{1,3}$", "u"), ""));
@@ -15646,6 +15653,10 @@ var VoiceCall = class {
15646
15653
  this.barge();
15647
15654
  return "cut";
15648
15655
  }
15656
+ if (isBareCue(text)) {
15657
+ this.o.onMetric({ name: "drop", kind: "bare cue", text });
15658
+ return "keep";
15659
+ }
15649
15660
  if (this.o.mode === "live" && isReaction(text)) return this.kept(text), "keep";
15650
15661
  const d = await this.judge.judge(text);
15651
15662
  if (d.verdict === "cut") this.barge();
@@ -15690,7 +15701,7 @@ var VoiceCall = class {
15690
15701
  * fill line: never MAIN history. */
15691
15702
  aside(text) {
15692
15703
  const now3 = this.o.now();
15693
- if (now3 - this.lastAside.at < this.o.asideGapMs) return null;
15704
+ if (isBareCue(text) || now3 - this.lastAside.at < this.o.asideGapMs) return null;
15694
15705
  const line = overlapAside(text, this.lang, this.lastAside.text, void 0, this.o.mode === "live");
15695
15706
  if (!line) return null;
15696
15707
  this.lastAside = { text: line, at: now3 };
@@ -15729,7 +15740,10 @@ var VoiceCall = class {
15729
15740
  onTurn(t) {
15730
15741
  this.floor = "";
15731
15742
  this.flushKept(t.text);
15732
- if (this.o.noteTurn && this.o.workReply && t.kind !== "replace" && this.working && !isClosing(t.text)) return void this.overWork(this.cur, t);
15743
+ if (this.o.noteTurn && this.o.workReply && t.kind !== "replace" && this.working && !isClosing(t.text)) {
15744
+ if (isBareCue(t.text)) return void this.o.onMetric({ name: "drop", id: t.id, kind: "bare cue", text: t.text });
15745
+ return void this.overWork(this.cur, t);
15746
+ }
15733
15747
  const prev = this.cur, quick = this.quickOn && !this.working && (t.kind === "new" || prev?.lane !== "deep");
15734
15748
  const now3 = this.o.now(), lastWord = this.lastWordAt !== null;
15735
15749
  const at = this.lastWordAt ?? this.firstFinalAt ?? now3;