@livx.cc/agentx 0.99.148 → 0.99.149
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/cli.js +192 -15
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.js +38 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1672,8 +1672,10 @@ declare class ProgressOptions {
|
|
|
1672
1672
|
generateBudgetMs: number;
|
|
1673
1673
|
/** Speak only when nothing has been audible for this long. */
|
|
1674
1674
|
silenceMs: number;
|
|
1675
|
-
/** At most one
|
|
1675
|
+
/** At most one spoken work line (progress, bridge or aside) per this long. */
|
|
1676
1676
|
gapMs: number;
|
|
1677
|
+
/** One stage (a tool's topic) gets one line; a stage still running after this long may get another. 0 = 3 × gapMs. */
|
|
1678
|
+
stageRepeatMs: number;
|
|
1677
1679
|
now: () => number;
|
|
1678
1680
|
}
|
|
1679
1681
|
declare class Progress {
|
|
@@ -1682,6 +1684,7 @@ declare class Progress {
|
|
|
1682
1684
|
private lastAt;
|
|
1683
1685
|
private streamed;
|
|
1684
1686
|
private lines;
|
|
1687
|
+
private stages;
|
|
1685
1688
|
constructor(options?: Partial<ProgressOptions> | undefined);
|
|
1686
1689
|
private get o();
|
|
1687
1690
|
/** A new MAIN turn started. */
|
|
@@ -1691,9 +1694,12 @@ declare class Progress {
|
|
|
1691
1694
|
/** A tool started: MAIN is working again. */
|
|
1692
1695
|
tool(): void;
|
|
1693
1696
|
/** 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;
|
|
1695
|
-
/** Mark `line` spoken. */
|
|
1696
|
-
spoke(line: string): void;
|
|
1697
|
+
due(lastAudibleAt: number, leadMs?: number, tool?: string): boolean;
|
|
1698
|
+
/** Mark `line` spoken, for `tool`'s stage. */
|
|
1699
|
+
spoke(line: string, tool?: string): void;
|
|
1700
|
+
/** A work line played from elsewhere (a bridge, an aside): the same thought, so the gap counts from it. */
|
|
1701
|
+
heard(): void;
|
|
1702
|
+
private stage;
|
|
1697
1703
|
/** A line the user heard from elsewhere (an aside): progress never repeats it. */
|
|
1698
1704
|
note(line: string): void;
|
|
1699
1705
|
/** The last lines heard, for a writer to avoid. */
|
package/dist/index.js
CHANGED
|
@@ -10511,6 +10511,7 @@ var OverlapJudge = class {
|
|
|
10511
10511
|
};
|
|
10512
10512
|
const rule = overlapRule(heard);
|
|
10513
10513
|
if (rule) return done(rule, "rule");
|
|
10514
|
+
if (norm2(heard).split(/[\s-]+/).filter(Boolean).length < 2) return done("keep", "lone");
|
|
10514
10515
|
if (!this.o.model) return done("cut", "none");
|
|
10515
10516
|
const ctl = new AbortController();
|
|
10516
10517
|
let timer;
|
|
@@ -13944,8 +13945,10 @@ var ProgressOptions = class {
|
|
|
13944
13945
|
generateBudgetMs = 800;
|
|
13945
13946
|
/** Speak only when nothing has been audible for this long. */
|
|
13946
13947
|
silenceMs = 3e3;
|
|
13947
|
-
/** At most one
|
|
13948
|
+
/** At most one spoken work line (progress, bridge or aside) per this long. */
|
|
13948
13949
|
gapMs = 4e3;
|
|
13950
|
+
/** One stage (a tool's topic) gets one line; a stage still running after this long may get another. 0 = 3 × gapMs. */
|
|
13951
|
+
stageRepeatMs = 0;
|
|
13949
13952
|
now = () => performance.now();
|
|
13950
13953
|
};
|
|
13951
13954
|
function argsHint(args) {
|
|
@@ -13963,6 +13966,7 @@ var Progress = class {
|
|
|
13963
13966
|
lastAt = -Infinity;
|
|
13964
13967
|
streamed = false;
|
|
13965
13968
|
lines = [];
|
|
13969
|
+
stages = /* @__PURE__ */ new Map();
|
|
13966
13970
|
get o() {
|
|
13967
13971
|
return this.options;
|
|
13968
13972
|
}
|
|
@@ -13979,15 +13983,25 @@ var Progress = class {
|
|
|
13979
13983
|
this.streamed = false;
|
|
13980
13984
|
}
|
|
13981
13985
|
/** May a line play now, or `leadMs` from now? (the caller passes when the user last heard anything) */
|
|
13982
|
-
due(lastAudibleAt, leadMs = 0) {
|
|
13983
|
-
const now3 = this.o.now();
|
|
13986
|
+
due(lastAudibleAt, leadMs = 0, tool = "") {
|
|
13987
|
+
const now3 = this.o.now(), spoken = tool ? this.stages.get(this.stage(tool)) : void 0;
|
|
13988
|
+
if (spoken !== void 0 && now3 - spoken < (this.o.stageRepeatMs || 3 * this.o.gapMs) - leadMs) return false;
|
|
13984
13989
|
return !this.streamed && now3 - lastAudibleAt >= this.o.silenceMs - leadMs && now3 - this.lastAt >= this.o.gapMs - leadMs;
|
|
13985
13990
|
}
|
|
13986
|
-
/** Mark `line` spoken. */
|
|
13987
|
-
spoke(line) {
|
|
13991
|
+
/** Mark `line` spoken, for `tool`'s stage. */
|
|
13992
|
+
spoke(line, tool = "") {
|
|
13988
13993
|
this.note(line);
|
|
13994
|
+
this.heard();
|
|
13995
|
+
if (tool) this.stages.set(this.stage(tool), this.o.now());
|
|
13996
|
+
}
|
|
13997
|
+
/** A work line played from elsewhere (a bridge, an aside): the same thought, so the gap counts from it. */
|
|
13998
|
+
heard() {
|
|
13989
13999
|
this.lastAt = this.o.now();
|
|
13990
14000
|
}
|
|
14001
|
+
stage(tool) {
|
|
14002
|
+
const n = tool.toLowerCase();
|
|
14003
|
+
return TOPICS.find(([re]) => re.test(n))?.[1] ?? n;
|
|
14004
|
+
}
|
|
13991
14005
|
/** A line the user heard from elsewhere (an aside): progress never repeats it. */
|
|
13992
14006
|
note(line) {
|
|
13993
14007
|
this.said.add(norm3(line));
|
|
@@ -14034,9 +14048,16 @@ function fastProgressGenerator(ai, model, gender) {
|
|
|
14034
14048
|
return r.content ?? "";
|
|
14035
14049
|
};
|
|
14036
14050
|
}
|
|
14051
|
+
var WORK_CLAIM = /\b(?:none|nothing|nobody|zero|\d+|one|two|three|four|five|many|several|some|looks like|seems|turns out|apparently|it'?s|they'?re|there'?s)\b|(?:^|\s)(?:כלום|אף|נראה)(?=\s|$|[.,!…])/iu;
|
|
14052
|
+
var claimsResult = (l) => RESULT_CLAIM_RE.test(l) || HE_RESULT_CLAIM.test(l) || WORK_CLAIM.test(l);
|
|
14037
14053
|
function cleanWorkReply(raw, lang) {
|
|
14038
14054
|
const l = cleanLine(raw.replace(/^\s*(?:stop|work)\s*:/i, ""), lang, 8);
|
|
14039
|
-
return
|
|
14055
|
+
return claimsResult(l) ? "" : l;
|
|
14056
|
+
}
|
|
14057
|
+
function workAck(raw, lang, gender = "") {
|
|
14058
|
+
const l = cleanLine(raw.replace(/^\s*(?:stop|work)\s*:/i, ""), lang, 8);
|
|
14059
|
+
if (!l || !claimsResult(l)) return "";
|
|
14060
|
+
return (PROGRESS_TEMPLATES[gender ? `${lang}-${gender[0]}` : lang] ?? PROGRESS_TEMPLATES[lang])?.delegate[1] ?? "";
|
|
14040
14061
|
}
|
|
14041
14062
|
|
|
14042
14063
|
// src/voice/secondChannel.ts
|
|
@@ -14197,6 +14218,11 @@ var SecondChannelOptions = class {
|
|
|
14197
14218
|
random = Math.random;
|
|
14198
14219
|
};
|
|
14199
14220
|
var words2 = (s) => s.trim() ? s.trim().split(/\s+/) : [];
|
|
14221
|
+
var HESITATION = /^(?:a+y*|a+i|e+[hr]*|erm+|u+[hm]*|h?m+|o+h+|ooh|like|so|well|אה+|אמ+|אה?ם+|ממ+)$/u;
|
|
14222
|
+
var onlyHesitation = (s) => {
|
|
14223
|
+
const w = words2(s).slice(-3).map((x) => x.toLowerCase().replace(/[^\p{L}]/gu, "")).filter(Boolean);
|
|
14224
|
+
return !!w.length && w.every((x) => HESITATION.test(x));
|
|
14225
|
+
};
|
|
14200
14226
|
function withBudget(p, ms, what, ac) {
|
|
14201
14227
|
let t;
|
|
14202
14228
|
const late = new Promise((r) => {
|
|
@@ -14815,6 +14841,7 @@ var SecondChannel = class {
|
|
|
14815
14841
|
return p;
|
|
14816
14842
|
}
|
|
14817
14843
|
say(kind, text) {
|
|
14844
|
+
if (kind === "backchannel" && onlyHesitation(this.heard)) return false;
|
|
14818
14845
|
let r;
|
|
14819
14846
|
try {
|
|
14820
14847
|
r = this.o.speak(text, kind);
|
|
@@ -15276,6 +15303,7 @@ var VoiceCall = class {
|
|
|
15276
15303
|
}
|
|
15277
15304
|
if (r === false) return false;
|
|
15278
15305
|
this.o.onMetric({ name: "fill", kind, text, lang: this.lang });
|
|
15306
|
+
if (kind !== "backchannel") this.progress.heard();
|
|
15279
15307
|
const c = this.cur && !this.cur.closed ? this.cur : void 0;
|
|
15280
15308
|
const forTurn = !!c && (kind === "bridge" || kind === "progress" || kind === "filler" && c.running && !c.sounded);
|
|
15281
15309
|
if (c && forTurn && c.marks.fill === void 0) {
|
|
@@ -15333,7 +15361,7 @@ var VoiceCall = class {
|
|
|
15333
15361
|
log31.warn(`work reply failed \u2014 MAIN only: ${e?.message ?? e}`);
|
|
15334
15362
|
return "";
|
|
15335
15363
|
}).finally(() => clearTimeout(late)) : "";
|
|
15336
|
-
const line = cleanWorkReply(raw, lang ?? ""), stop = /^\s*stop\s*:/i.test(raw), change = !line || /^\s*work\s*:/i.test(raw);
|
|
15364
|
+
const ack = workAck(raw, lang ?? "", this.o.gender), line = cleanWorkReply(raw, lang ?? "") || ack, stop = /^\s*stop\s*:/i.test(raw), change = !line || /^\s*work\s*:/i.test(raw);
|
|
15337
15365
|
const noted = `[The user said this on the call while you worked: "${t.text}".${line ? ` You answered aloud: "${line}".` : ""}${stop ? " That stopped the work." : ""} Take it into account; do not answer it again.]`;
|
|
15338
15366
|
if (line && !this.ended) {
|
|
15339
15367
|
for (let i = 0; i < 8 && this.say(line, "aside") === false; i++) {
|
|
@@ -15369,7 +15397,7 @@ var VoiceCall = class {
|
|
|
15369
15397
|
this.progressTimer = null;
|
|
15370
15398
|
if (this.ended || this.cur !== c || !c.running || c.streamed && c.open <= 0) return;
|
|
15371
15399
|
const lang = this.lang, now3 = this.o.now();
|
|
15372
|
-
if (lang && !c.draft && !c.drafting && now3 - c.draftAt >= 1e3 && this.progress.due(this.lastAudibleAt, this.o.progressLeadMs)) {
|
|
15400
|
+
if (lang && !c.draft && !c.drafting && now3 - c.draftAt >= 1e3 && this.progress.due(this.lastAudibleAt, this.o.progressLeadMs, c.tool)) {
|
|
15373
15401
|
c.drafting = true;
|
|
15374
15402
|
void this.progress.line(c.tool, c.args, lang, this.o.mode === "live" ? c.text : "").then((l) => {
|
|
15375
15403
|
c.drafting = false;
|
|
@@ -15383,9 +15411,9 @@ var VoiceCall = class {
|
|
|
15383
15411
|
this.progressTimer = setTimeout(tick, 250);
|
|
15384
15412
|
};
|
|
15385
15413
|
const sayDraft = () => {
|
|
15386
|
-
if (!c.draft || this.ended || this.cur !== c || !c.running || c.streamed && c.open <= 0 || this.o.now() - this.lastUserAt < this.o.userQuietMs || !this.progress.due(this.lastAudibleAt)) return;
|
|
15414
|
+
if (!c.draft || this.ended || this.cur !== c || !c.running || c.streamed && c.open <= 0 || this.o.now() - this.lastUserAt < this.o.userQuietMs || !this.progress.due(this.lastAudibleAt, 0, c.tool)) return;
|
|
15387
15415
|
if (this.say(c.draft, "progress") !== false) {
|
|
15388
|
-
this.progress.spoke(c.draft);
|
|
15416
|
+
this.progress.spoke(c.draft, c.tool);
|
|
15389
15417
|
this.fill.covered();
|
|
15390
15418
|
this.o.show(c.draft, "progress");
|
|
15391
15419
|
c.draft = "";
|