@livx.cc/agentx 0.99.105 → 0.99.107

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, n as RunResult, A as Agent, g as PermissionPolicy } from './Agent-BhOcPaxG.js';
2
- export { C as ChatFragment, b as Classification, c as Classifier, d as CompactResult, D as DEFAULT_MUTATING, e as Decision, M as ModelRouter, f as ModelRouterOptions, P as PermissionOptions, h as PermissionRule, i as PreToolUseDecision, R as ReasoningEffort, j as RecordingHooks, k as RecordingLifecycle, l as RouteDecision, m as RouterState, T as Tier, o as ToolUse, p as ToolUseMeta, q as claudeCodeDisallowedTools, r as composeHooks, s as estimateTokens, t as jevAvailable, u as jevClassifier, v as pickTier, w as planMode, x as reasoningToChatFragment } from './Agent-BhOcPaxG.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-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';
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';
@@ -852,6 +852,8 @@ declare function writeFact(fs: IFilesystem, dir: string, slug: string, body: str
852
852
  type?: string;
853
853
  description?: string;
854
854
  }): Promise<void>;
855
+ /** Delete a fact file and its pointer line in that dir's MEMORY.md. Returns the dirs it was removed from. */
856
+ declare function forgetFact(fs: IFilesystem, dirs: string[], slug: string): Promise<string[]>;
855
857
 
856
858
  /**
857
859
  * Automatic mistake → lesson → steer loop. Closes the within-run learning gap: the agent
@@ -908,17 +910,65 @@ declare function reflectOnRun(o: ReflectOptions): Promise<string | null>;
908
910
  */
909
911
  declare function loadInstructions(fs: IFilesystem, names?: string[]): Promise<string>;
910
912
 
911
- /** Structural subset of ai.libx.js DecideClient.decide — keeps this module provider-agnostic. */
912
- interface Decider {
913
- decide(o: {
914
- state: unknown;
915
- questions: Record<string, unknown>;
916
- }): Promise<{
917
- answers: Record<string, {
918
- choice: string;
919
- probabilities: Record<string, number>;
920
- }>;
921
- }>;
913
+ type OverlapVerdict = 'keep' | 'cut';
914
+
915
+ /** Does the user's line stop mid-phrase (trailing connective / spelled punctuation / comma / slash)? Only the user's own
916
+ * words count — host notes appended after a newline ("[the user interrupted you…]") are ignored. */
917
+ declare function endsMidPhrase(text: string): boolean;
918
+ /** A short closing line ("ok bye", "thanks, see you", "ביי", "להתראות"). Long lines that merely contain "bye" are not. */
919
+ declare function isClosing(text: string): boolean;
920
+ interface GateTurn {
921
+ id: string;
922
+ /** The user's words, verbatim (several finals joined by a space when merged). */
923
+ text: string;
924
+ /** The turn this one replaces (its reply had not started): the host rolls it back. */
925
+ replaces?: string;
926
+ /** new = a fresh turn · replace = a fuller re-final of the last · extend = only the words a re-final added after the reply started. */
927
+ kind: 'new' | 'replace' | 'extend';
928
+ }
929
+ type GateDrop = 'empty' | 'dupe' | 'stale' | 'goodbye';
930
+ declare class TurnGateOptions {
931
+ holdMs: number;
932
+ /** An identical final within this window is a duplicate. */
933
+ dupWindowMs: number;
934
+ /** A fuller final within this window of the last turn (or with its sttId) is a re-final of it. */
935
+ refinalWindowMs: number;
936
+ onTurn: (t: GateTurn) => void;
937
+ onDrop: (text: string, why: GateDrop) => void;
938
+ /** A final is being held (ends mid-phrase) — the fill channel may cover it with a filler, never a bridge. */
939
+ onHold: (text: string) => void;
940
+ now: () => number;
941
+ }
942
+ declare class TurnGate {
943
+ options?: Partial<TurnGateOptions> | undefined;
944
+ private last?;
945
+ private held?;
946
+ private seq;
947
+ private closed;
948
+ constructor(options?: Partial<TurnGateOptions> | undefined);
949
+ private get o();
950
+ /** A closing turn went out — the call is ending. */
951
+ get ending(): boolean;
952
+ /** Is a final held right now? */
953
+ get holding(): boolean;
954
+ /** The last turn sent (id + text), if any. */
955
+ get lastTurn(): {
956
+ id: string;
957
+ text: string;
958
+ started: boolean;
959
+ } | undefined;
960
+ /** An STT final. */
961
+ final(text: string, sttId?: string): void;
962
+ /** The user is speaking again (a partial): a held fragment waits for the rest. */
963
+ speaking(): void;
964
+ /** MAIN started replying to turn `id` (its first text/tool/audio): a later re-final only adds its new words. */
965
+ replyStarted(id: string): void;
966
+ /** Send a held fragment now (e.g. the call ends). */
967
+ flush(): void;
968
+ end(): void;
969
+ private refinal;
970
+ private send;
971
+ private emit;
922
972
  }
923
973
 
924
974
  /**
@@ -1558,6 +1608,144 @@ declare function makeTaskBatchTool(opts: TaskToolOptions): AgentTool;
1558
1608
  /** Component-scoped logger (libx.js). debug/verbose gated via DEBUG env/localStorage. */
1559
1609
  declare const forComponent: (name: string) => libx_js_src_modules_log.ComponentLogger;
1560
1610
 
1611
+ type Topic = 'board' | 'search' | 'web' | 'read' | 'write' | 'run' | 'mail' | 'calendar' | 'memory';
1612
+ /** Two phrasings per topic and language (never the same line twice in a call). */
1613
+ declare const PROGRESS_TEMPLATES: Record<string, Record<Topic, string[]>>;
1614
+ declare class ProgressOptions {
1615
+ templates: Record<string, Partial<Record<Topic, string[]>>>;
1616
+ /** Fast-model fallback for a tool with no template (fastProgressGenerator). Absent → silence. */
1617
+ generate?: (tool: string, hint: string, lang: string, signal: AbortSignal) => Promise<string>;
1618
+ generateBudgetMs: number;
1619
+ /** Speak only when nothing has been audible for this long. */
1620
+ silenceMs: number;
1621
+ /** At most one progress line per this long. */
1622
+ gapMs: number;
1623
+ now: () => number;
1624
+ }
1625
+ declare class Progress {
1626
+ options?: Partial<ProgressOptions> | undefined;
1627
+ private said;
1628
+ private lastAt;
1629
+ private streamed;
1630
+ constructor(options?: Partial<ProgressOptions> | undefined);
1631
+ private get o();
1632
+ /** A new MAIN turn started. */
1633
+ turn(): void;
1634
+ /** MAIN's text streamed this turn: no more progress lines for it. */
1635
+ text(): void;
1636
+ /** May a line play now? (the caller passes when the user last heard anything) */
1637
+ due(lastAudibleAt: number): boolean;
1638
+ /** Mark `line` spoken. */
1639
+ spoke(line: string): void;
1640
+ /** The line for this tool call in `lang`, or '' (no template and no/late/invalid generation, a repeat, a result claim). */
1641
+ line(tool: string, args: unknown, lang: string): Promise<string>;
1642
+ }
1643
+
1644
+ type FillKind = LineKind | 'progress';
1645
+ /** MAIN's stream as the host forwards it. `id` = the turn (sendTurn's id); absent → the current turn. */
1646
+ interface MainEvent {
1647
+ type: 'start' | 'text' | 'tool' | 'tool_done' | 'audio' | 'done' | 'error';
1648
+ id?: string;
1649
+ text?: string;
1650
+ name?: string;
1651
+ args?: unknown;
1652
+ }
1653
+ interface CallMetric {
1654
+ name: 'first_sound' | 'first_word' | 'turn' | 'drop' | 'hold' | 'fill' | 'lang';
1655
+ id?: string;
1656
+ /** ms from the user's final (the first final of a held/merged turn) */
1657
+ ms?: number;
1658
+ by?: 'fill' | 'progress' | 'main';
1659
+ kind?: string;
1660
+ text?: string;
1661
+ lang?: string | null;
1662
+ }
1663
+ declare class VoiceCallOptions {
1664
+ /** Host runs MAIN with exactly `text` (a replace: roll the `replaces` turn back first). */
1665
+ sendTurn: (text: string, o: {
1666
+ id: string;
1667
+ replaces?: string;
1668
+ }) => void;
1669
+ /** Host aborts a running MAIN turn (barge-in). */
1670
+ abortTurn: (id: string) => void;
1671
+ /** Host TTS (fill lane): resolves when played; `false` = could not play. */
1672
+ speak: (text: string, kind: FillKind) => Promise<unknown> | boolean;
1673
+ /** Stop the in-flight fill line now (barge-in only). */
1674
+ cancel: () => void;
1675
+ /** Host caption — never history. */
1676
+ show: (text: string, kind: FillKind) => void;
1677
+ /** The fast model (lines, banks, progress) — used only with `ai`. */
1678
+ fastModel: string;
1679
+ /** Model client for the fast model + the channel decider / overlap judge. Absent → canned lines and rules only. */
1680
+ ai?: ChatLike;
1681
+ /** Cache dir for per-language banks (ChannelBanks). */
1682
+ bankCacheDir?: string;
1683
+ /** The host STT's language (BCP-47) — the starting language; each turn's own words still decide. */
1684
+ lang?: string;
1685
+ aec: boolean;
1686
+ mode: ChannelMode;
1687
+ gate: Partial<TurnGateOptions>;
1688
+ progress: Partial<ProgressOptions>;
1689
+ /** Extra SecondChannel options (tests, tuning). speak/show/cancel are always VoiceCall's own. */
1690
+ channel: Partial<SecondChannelOptions>;
1691
+ onMetric: (m: CallMetric) => void;
1692
+ now: () => number;
1693
+ }
1694
+ declare class VoiceCall {
1695
+ options?: Partial<VoiceCallOptions> | undefined;
1696
+ readonly fill: SecondChannel;
1697
+ readonly gate: TurnGate;
1698
+ readonly progress: Progress;
1699
+ private judge;
1700
+ private cur?;
1701
+ private lang;
1702
+ private lastAudibleAt;
1703
+ private firstFinalAt;
1704
+ private progressTimer;
1705
+ private ended;
1706
+ constructor(options?: Partial<VoiceCallOptions> | undefined);
1707
+ private get o();
1708
+ /** The language the fill channel speaks right now (null = unknown → silent). */
1709
+ get language(): string | null;
1710
+ /** The MAIN turn in flight (or the last one). */
1711
+ get turn(): {
1712
+ id: string;
1713
+ text: string;
1714
+ running: boolean;
1715
+ } | undefined;
1716
+ /** The host STT's language (BCP-47): the current language until the user's words say otherwise. */
1717
+ setLanguage(tag: string): void;
1718
+ /** STT partial (the whole partial). */
1719
+ interim(text: string, _atMs?: number, aec?: boolean): void;
1720
+ /** STT final → TurnGate. */
1721
+ final(text: string, sttId?: string): void;
1722
+ /** A v2 host that decides turns itself: the user's line already went to MAIN (no TurnGate, no sendTurn) — the fill
1723
+ * channel follows its language and covers the wait. */
1724
+ hostTurn(text: string): void;
1725
+ pause(ms: number): void;
1726
+ /** MAIN's stream. */
1727
+ main(ev: MainEvent): void;
1728
+ /** The user barged in (hard): cut fill + MAIN audio (the host cuts its own), abort a running MAIN turn. */
1729
+ barge(): void;
1730
+ /** Soft barge-in: keep (a listener cue — no turn) or cut (→ barge()). */
1731
+ overlap(text: string): Promise<OverlapVerdict>;
1732
+ /** Did the last barge cut OUR fill line `text`? (hosts strip it from the cut reply — it is not MAIN's speech) */
1733
+ spoke(text: string): boolean;
1734
+ /** Resolves when the in-flight fill line finished — hosts queue MAIN audio behind it (stack, don't cut). */
1735
+ drain(): Promise<void>;
1736
+ end(): void;
1737
+ /** Follow the user's language from their own words: a confident detection, else the current language if the words
1738
+ * fit it, else unknown (silent). Pinned into the channel so its own detection never diverges. */
1739
+ private follow;
1740
+ private onTurn;
1741
+ private onDrop;
1742
+ /** Every fill/progress line passes here: only in the turn's known language, never after the call ended. */
1743
+ private say;
1744
+ private sounded;
1745
+ private onTool;
1746
+ private clearProgress;
1747
+ }
1748
+
1561
1749
  declare function validateWorktreeSlug(slug: string): void;
1562
1750
  declare function worktreeBranchName(slug: string): string;
1563
1751
  interface WorktreeInfo {
@@ -1589,4 +1777,4 @@ declare function exitWorktree(): {
1589
1777
  reason?: string;
1590
1778
  } | null;
1591
1779
 
1592
- export { Agent, type AgentDef, AgentOptions, AgentTool, type AskOptions, type Attempt, BodDbFilesystem, ChatLike, ChatOptions, ChatResponse, type CommandInfo, ConsoleHostBridge, DEFAULT_DENY, DEFAULT_MAX_DEPTH, DEFAULT_SKIP_DIRS, DuplexAgent, DuplexAgentOptions, type DuplexTaskStatus, FakeAIClient, type FileScanOptions, Hooks, HostBridge, JailOptions, JailedFilesystem, type LessonOptions, LessonOptionsDefaults, type LoadMemoryOpts, MEMORY_PROMPT, MessageContent, type Mount, MountFilesystem, NodeDiskFilesystem, OverlayFilesystem, PermissionPolicy, type ReflectOptions, RunResult, SCRATCH_DIR, type ScheduledJob, type ScheduledJobSnapshot, Scheduler, type SchedulerOptions, Scratch, type ScratchOptions, ScriptedHostBridge, type SiblingResolver, type SkillInfo, type TaskRecord, type TaskToolOptions, ToolCall, type ToolSpec, type Trigger, type TriggerCron, type TriggerInterval, type TriggerOneOff, UserQuestion, VOICE_MEMORY_PROMPT, VOICE_SYSTEM_PROMPT, type WebFetchOptions, type WebSearchOptions, type WorkerTier, type WorktreeInfo, type WorktreeSession, applyEditsTool, askUserQuestionTool, checkpointTool, checkpointTools, cleanupWorktree, compileSynthesizedTool, cronMatches, decodeDdgUrl, diskAgentOptions, enterWorktree, exitWorktree, expandCommand, expandEntry, expandTemplate, findGitRoot, forComponent, fullAgentOptions, getOrCreateWorktree, getWorktreeSession, globTool, grepTool, htmlToText, idfWeights, lessonCapture, loadAgents, loadCommands, loadInstructions, loadMemory, loadSkills, makeAskTool, makeGlobTool, makeGrepTool, makeScheduleTools, makeTaskBatchTool, makeTaskTool, makeWebFetchTool, makeWebSearchAnthropicTool, makeWebSearchTool, mkdirp, multiEditTool, nextCronAfter, parseCron, parseDdgHtml, raceAttempts, reflectOnRun, relevanceScore, repoIndex, repoMapTool, rollbackTool, sandboxAgentOptions, scanCommands, scanSkills, slugify, tokenize, toolCall, topByRelevance, validateToolCode, validateWorktreeSlug, webFetchTool, webSearchAnthropicTool, webSearchTool, worktreeBranchName, writeFact, writeTool };
1780
+ export { Agent, type AgentDef, AgentOptions, AgentTool, type AskOptions, type Attempt, BodDbFilesystem, type CallMetric, ChatLike, ChatOptions, ChatResponse, type CommandInfo, ConsoleHostBridge, DEFAULT_DENY, DEFAULT_MAX_DEPTH, DEFAULT_SKIP_DIRS, DuplexAgent, DuplexAgentOptions, type DuplexTaskStatus, FakeAIClient, type FileScanOptions, type FillKind, type GateDrop, type GateTurn, Hooks, HostBridge, JailOptions, JailedFilesystem, type LessonOptions, LessonOptionsDefaults, type LoadMemoryOpts, MEMORY_PROMPT, type MainEvent, MessageContent, type Mount, MountFilesystem, NodeDiskFilesystem, OverlayFilesystem, PROGRESS_TEMPLATES, PermissionPolicy, Progress, ProgressOptions, type ReflectOptions, RunResult, SCRATCH_DIR, type ScheduledJob, type ScheduledJobSnapshot, Scheduler, type SchedulerOptions, Scratch, type ScratchOptions, ScriptedHostBridge, type SiblingResolver, type SkillInfo, type TaskRecord, type TaskToolOptions, ToolCall, type ToolSpec, type Trigger, type TriggerCron, type TriggerInterval, type TriggerOneOff, TurnGate, TurnGateOptions, UserQuestion, VOICE_MEMORY_PROMPT, VOICE_SYSTEM_PROMPT, VoiceCall, VoiceCallOptions, type WebFetchOptions, type WebSearchOptions, type WorkerTier, type WorktreeInfo, type WorktreeSession, applyEditsTool, askUserQuestionTool, checkpointTool, checkpointTools, cleanupWorktree, compileSynthesizedTool, cronMatches, decodeDdgUrl, diskAgentOptions, endsMidPhrase, enterWorktree, exitWorktree, expandCommand, expandEntry, expandTemplate, findGitRoot, forComponent, forgetFact, fullAgentOptions, getOrCreateWorktree, getWorktreeSession, globTool, grepTool, htmlToText, idfWeights, isClosing, lessonCapture, loadAgents, loadCommands, loadInstructions, loadMemory, loadSkills, makeAskTool, makeGlobTool, makeGrepTool, makeScheduleTools, makeTaskBatchTool, makeTaskTool, makeWebFetchTool, makeWebSearchAnthropicTool, makeWebSearchTool, mkdirp, multiEditTool, nextCronAfter, parseCron, parseDdgHtml, raceAttempts, reflectOnRun, relevanceScore, repoIndex, repoMapTool, rollbackTool, sandboxAgentOptions, scanCommands, scanSkills, slugify, tokenize, toolCall, topByRelevance, validateToolCode, validateWorktreeSlug, webFetchTool, webSearchAnthropicTool, webSearchTool, worktreeBranchName, writeFact, writeTool };