@livx.cc/agentx 0.97.7 → 0.97.9

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
@@ -858,6 +858,10 @@ interface TaskRecord {
858
858
  /** Per-worker `<spoken>` splitter — the worker OWNS delivery: spoken segments stream during its run.
859
859
  * Read at settle (spokeAny) to decide the no-spoken fallback. */
860
860
  splitter?: SpokenSplitter;
861
+ /** Set when the user barged in / took the floor while this task was in flight: its remaining SPOKEN
862
+ * delivery is suppressed (don't talk over the new topic), but its full result still lands in the
863
+ * transcript so the reflex can surface it on request. See parkInFlightDeliveries(). */
864
+ deliveryParked?: boolean;
861
865
  }
862
866
  type WorkerTier = 'act' | 'think';
863
867
  declare class DuplexAgentOptions {
@@ -998,6 +1002,11 @@ declare class DuplexAgent {
998
1002
  send(content: MessageContent): Promise<RunResult>;
999
1003
  /** Cancel a running background task — shared by the CancelTask tool and the CLI /tasks picker. */
1000
1004
  cancelTask(id: string): string;
1005
+ /** Barge-in: the user took the floor while task(s) were running. Suppress those tasks' remaining SPOKEN
1006
+ * delivery so a superseded topic never talks over the new one (the debt-after-jokes regression). The
1007
+ * tasks keep running and still fold their result into the transcript — recoverable, just not spoken.
1008
+ * Returns the parked ids (for logging). Does NOT cancel: that's a deliberate reflex/user action. */
1009
+ parkInFlightDeliveries(): string[];
1001
1010
  /** Resolve when all queued voice turns AND all in-flight worker tasks have settled (tests, graceful shutdown). */
1002
1011
  idle(): Promise<void>;
1003
1012
  /** Promise-chain mutex: turns run strictly one at a time; a failed turn doesn't poison the chain. */
package/dist/index.js CHANGED
@@ -5014,6 +5014,19 @@ Today's date: ${(/* @__PURE__ */ new Date()).toDateString()}.`;
5014
5014
  rec.controller.abort();
5015
5015
  return `Task ${rec.id} (${rec.label}) cancelled.`;
5016
5016
  }
5017
+ /** Barge-in: the user took the floor while task(s) were running. Suppress those tasks' remaining SPOKEN
5018
+ * delivery so a superseded topic never talks over the new one (the debt-after-jokes regression). The
5019
+ * tasks keep running and still fold their result into the transcript — recoverable, just not spoken.
5020
+ * Returns the parked ids (for logging). Does NOT cancel: that's a deliberate reflex/user action. */
5021
+ parkInFlightDeliveries() {
5022
+ const parked = [];
5023
+ for (const rec of this.tasks.values())
5024
+ if (rec.status === "running" && !rec.deliveryParked) {
5025
+ rec.deliveryParked = true;
5026
+ parked.push(rec.id);
5027
+ }
5028
+ return parked;
5029
+ }
5017
5030
  /** Resolve when all queued voice turns AND all in-flight worker tasks have settled (tests, graceful shutdown). */
5018
5031
  async idle() {
5019
5032
  while (true) {
@@ -5111,7 +5124,7 @@ ${recent}` : brief) + verify + deliverContract;
5111
5124
  };
5112
5125
  const splitter = new SpokenSplitter();
5113
5126
  const speak = (seg) => {
5114
- if (seg) o.host?.notify?.({ kind: "speak_utterance", message: seg });
5127
+ if (seg && !this.tasks.get(id)?.deliveryParked) o.host?.notify?.({ kind: "speak_utterance", message: seg });
5115
5128
  };
5116
5129
  const coalescer = new SentenceCoalescer();
5117
5130
  const feedSpoken = (s) => {
@@ -5332,9 +5345,9 @@ Another agent just implemented the above. Independently check the CURRENT state
5332
5345
  return this.queueRevoice(this.integrationPrompt(rec, "incomplete", res.text, res.finishReason), true);
5333
5346
  }
5334
5347
  const tail = rec.splitter?.flush();
5335
- if (tail?.spoken) this.options.host?.notify?.({ kind: "speak_utterance", message: tail.spoken });
5348
+ if (tail?.spoken && !rec.deliveryParked) this.options.host?.notify?.({ kind: "speak_utterance", message: tail.spoken });
5336
5349
  if (res.text.trim()) this.voice.transcript.push({ role: "assistant", content: res.text });
5337
- if (!rec.splitter?.spokeAny && res.text.trim())
5350
+ if (!rec.splitter?.spokeAny && res.text.trim() && !rec.deliveryParked)
5338
5351
  this.options.host?.notify?.({ kind: "speak_utterance", message: res.text });
5339
5352
  }
5340
5353
  onWorkerFailed(id, err) {