@livx.cc/agentx 0.99.146 → 0.99.148

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
@@ -991,6 +991,9 @@ declare class TurnGate {
991
991
  } | undefined;
992
992
  /** An STT final. */
993
993
  final(text: string, sttId?: string): void;
994
+ /** The user kept talking after turn `id` went out and before its reply made a sound: it was not over. Its words go back
995
+ * to being held — the rest merges in and one whole turn replaces it; silence sends them again as they were. */
996
+ reopen(id: string): void;
994
997
  /** The user is speaking again (a partial): a held fragment waits for the rest. */
995
998
  speaking(): void;
996
999
  /** MAIN started replying to turn `id` (its first text/tool/audio): a later re-final only adds its new words. */
@@ -1665,7 +1668,7 @@ declare class ProgressOptions {
1665
1668
  /** The voice's gender: picks the gendered table (`${lang}-f`/`-m`) when one exists. */
1666
1669
  gender: Gender;
1667
1670
  /** Fast-model fallback for a tool with no template (fastProgressGenerator). Absent → silence. */
1668
- generate?: (tool: string, hint: string, lang: string, signal: AbortSignal) => Promise<string>;
1671
+ generate?: (tool: string, hint: string, lang: string, signal: AbortSignal, avoid?: string[]) => Promise<string>;
1669
1672
  generateBudgetMs: number;
1670
1673
  /** Speak only when nothing has been audible for this long. */
1671
1674
  silenceMs: number;
@@ -1678,21 +1681,39 @@ declare class Progress {
1678
1681
  private said;
1679
1682
  private lastAt;
1680
1683
  private streamed;
1684
+ private lines;
1681
1685
  constructor(options?: Partial<ProgressOptions> | undefined);
1682
1686
  private get o();
1683
1687
  /** A new MAIN turn started. */
1684
1688
  turn(): void;
1685
- /** MAIN's text streamed this turn: no more progress lines for it. */
1689
+ /** MAIN's text streamed this turn: no more progress lines, until a tool runs again. */
1686
1690
  text(): void;
1687
- /** May a line play now? (the caller passes when the user last heard anything) */
1688
- due(lastAudibleAt: number): boolean;
1691
+ /** A tool started: MAIN is working again. */
1692
+ tool(): void;
1693
+ /** May a line play now, or `leadMs` from now? (the caller passes when the user last heard anything) */
1694
+ due(lastAudibleAt: number, leadMs?: number): boolean;
1689
1695
  /** Mark `line` spoken. */
1690
1696
  spoke(line: string): void;
1697
+ /** A line the user heard from elsewhere (an aside): progress never repeats it. */
1698
+ note(line: string): void;
1699
+ /** The last lines heard, for a writer to avoid. */
1700
+ get recent(): string[];
1691
1701
  /** `about`: the user's request, for a generated line. The line for this tool call in `lang`, or '' (no template and no/late/invalid generation, a repeat, a result claim). */
1692
1702
  line(tool: string, args: unknown, lang: string, about?: string): Promise<string>;
1693
1703
  }
1704
+ /** What the fast model knows when the user speaks over MAIN's work. */
1705
+ interface WorkContext {
1706
+ request: string;
1707
+ heard: string;
1708
+ tool: string;
1709
+ hint: string;
1710
+ lang: string;
1711
+ avoid: string[];
1712
+ }
1713
+ /** The spoken answer. `stop:` opens it when they called the work off, `work:` when they change or add to it. '' = silence. */
1714
+ type WorkReply = (c: WorkContext, signal: AbortSignal) => Promise<string>;
1694
1715
 
1695
- type FillKind = LineKind | 'progress';
1716
+ type FillKind = LineKind | 'progress' | 'aside';
1696
1717
  /** MAIN's stream as the host forwards it. `id` = the turn (sendTurn's id); absent → the current turn. */
1697
1718
  interface MainEvent {
1698
1719
  type: 'start' | 'text' | 'tool' | 'tool_done' | 'audio' | 'done' | 'error';
@@ -1746,6 +1767,14 @@ declare class VoiceCallOptions {
1746
1767
  }) => void;
1747
1768
  /** Host aborts a running MAIN turn (barge-in). */
1748
1769
  abortTurn: (id: string) => void;
1770
+ /** Host keeps `note` for MAIN's next turn. With it (and `workReply`), what the user says while MAIN works is answered at
1771
+ * once by the fast model and MAIN is not aborted or restarted: a remark reaches MAIN as this note, a change or addition
1772
+ * runs as MAIN's next turn. Not injected mid-run: that makes MAIN run again just to hear a remark. Absent: such a line
1773
+ * barges in as before. */
1774
+ noteTurn?: (note: string) => void;
1775
+ /** Writes that immediate answer (fastWorkReply). */
1776
+ workReply?: WorkReply;
1777
+ workReplyBudgetMs: number;
1749
1778
  /** Host TTS (fill lane): resolves when played; `false` = could not play. */
1750
1779
  speak: (text: string, kind: FillKind) => Promise<unknown> | boolean;
1751
1780
  /** Stop the in-flight fill line now (barge-in only). */
@@ -1775,6 +1804,13 @@ declare class VoiceCallOptions {
1775
1804
  now: () => number;
1776
1805
  /** An aside (aside()) needs this long since the last one — a cue answered every time sounds scripted. */
1777
1806
  asideGapMs: number;
1807
+ /** After a turn went out, new words this soon are the same turn going on (it gives way to the fuller one), if MAIN has
1808
+ * not started. Later ones are a new thing said over the work. */
1809
+ resumeMs: number;
1810
+ /** Progress waits while the user spoke this recently. */
1811
+ userQuietMs: number;
1812
+ /** A progress line starts being written this long before it is due. */
1813
+ progressLeadMs: number;
1778
1814
  }
1779
1815
  declare class VoiceCall {
1780
1816
  options?: Partial<VoiceCallOptions> | undefined;
@@ -1790,6 +1826,7 @@ declare class VoiceCall {
1790
1826
  private lastWordAt;
1791
1827
  private earlyHeard;
1792
1828
  private progressTimer;
1829
+ private lastUserAt;
1793
1830
  private ended;
1794
1831
  constructor(options?: Partial<VoiceCallOptions> | undefined);
1795
1832
  private get o();
@@ -1801,6 +1838,8 @@ declare class VoiceCall {
1801
1838
  text: string;
1802
1839
  running: boolean;
1803
1840
  } | undefined;
1841
+ /** MAIN is on this turn and has the floor to itself: nothing the user says now stops it, unless they ask it to. */
1842
+ get working(): boolean;
1804
1843
  /** The host STT's language (BCP-47): the current language until the user's words say otherwise. */
1805
1844
  setLanguage(tag: string): void;
1806
1845
  /** STT partial (the whole partial). */
@@ -1826,6 +1865,7 @@ declare class VoiceCall {
1826
1865
  main(ev: MainEvent, inMs?: number): void;
1827
1866
  /** The user barged in (hard): cut fill + MAIN audio (the host cuts its own), abort a running MAIN turn. */
1828
1867
  barge(): void;
1868
+ private giveWay;
1829
1869
  /** Soft barge-in: keep (a listener cue — no turn) or cut (→ barge()). */
1830
1870
  overlap(text: string): Promise<OverlapVerdict>;
1831
1871
  /** The fill channel's spoken aside for an overlap judged 'keep' ("yeah" → "Oh yeah, definitely."): the host plays it
@@ -1849,7 +1889,11 @@ declare class VoiceCall {
1849
1889
  /** The turn is over (answered + audible, replaced, the next turn, the call's end): its timeline, once. A turn whose MAIN
1850
1890
  * never became audible still reports first_word — with no ms and why (cut / replaced / silent) — so every turn has one. */
1851
1891
  private close;
1852
- private onTool;
1892
+ /** The user spoke while MAIN works: the fast model answers now, the words reach MAIN as a note, MAIN keeps going. */
1893
+ private overWork;
1894
+ /** While MAIN's tools run: a progress line once nothing was heard for `silenceMs`, then every `gapMs`, written just ahead
1895
+ * so it plays on time. Ticks are local (no network) and stop with the turn. */
1896
+ private beat;
1853
1897
  private clearProgress;
1854
1898
  }
1855
1899