omnius 1.0.444 → 1.0.445
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 +315 -35
- package/dist/scripts/live-whisper.py +83 -10
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -298591,13 +298591,29 @@ Mark tasks complete IMMEDIATELY after finishing — don't batch. Never mark comp
|
|
|
298591
298591
|
durationMs: performance.now() - start2
|
|
298592
298592
|
};
|
|
298593
298593
|
}
|
|
298594
|
+
const inProgressIndexes = incoming.map((todo, index) => todo.status === "in_progress" ? index : -1).filter((index) => index >= 0);
|
|
298595
|
+
if (inProgressIndexes.length === 0) {
|
|
298596
|
+
const firstPending = incoming.findIndex((todo) => todo.status === "pending");
|
|
298597
|
+
if (firstPending >= 0) {
|
|
298598
|
+
incoming[firstPending] = { ...incoming[firstPending], status: "in_progress" };
|
|
298599
|
+
repairNotes.push("promoted first pending todo to in_progress because a non-empty active checklist must name the current task");
|
|
298600
|
+
}
|
|
298601
|
+
} else if (inProgressIndexes.length > 1) {
|
|
298602
|
+
const keep = inProgressIndexes[0];
|
|
298603
|
+
for (const index of inProgressIndexes.slice(1)) {
|
|
298604
|
+
incoming[index] = { ...incoming[index], status: "pending" };
|
|
298605
|
+
}
|
|
298606
|
+
repairNotes.push(`kept todo ${keep + 1} in_progress and demoted extra in_progress todos to pending`);
|
|
298607
|
+
}
|
|
298594
298608
|
const sessionId = typeof args["session_id"] === "string" && args["session_id"].trim() ? args["session_id"].trim() : typeof args["sessionId"] === "string" && args["sessionId"].trim() ? args["sessionId"].trim() : getTodoSessionId();
|
|
298595
298609
|
const oldTodos = readTodos(sessionId);
|
|
298596
298610
|
const canonicalize2 = (todos) => JSON.stringify(todos.map((t2) => ({
|
|
298597
298611
|
content: t2.content,
|
|
298598
298612
|
status: t2.status,
|
|
298599
298613
|
parentId: t2.parentId ?? null,
|
|
298600
|
-
blocker: t2.blocker ?? null
|
|
298614
|
+
blocker: t2.blocker ?? null,
|
|
298615
|
+
verifyCommand: t2.verifyCommand ?? null,
|
|
298616
|
+
declaredArtifacts: Array.isArray(t2.declaredArtifacts) ? [...t2.declaredArtifacts].sort() : null
|
|
298601
298617
|
})));
|
|
298602
298618
|
const oldKey = canonicalize2(oldTodos);
|
|
298603
298619
|
const newKey = canonicalize2(incoming);
|
|
@@ -298607,8 +298623,10 @@ Mark tasks complete IMMEDIATELY after finishing — don't batch. Never mark comp
|
|
|
298607
298623
|
output: JSON.stringify({
|
|
298608
298624
|
reminder: "[NO-OP] You called todo_write with the same plan you already have. The list is unchanged. Use todo_write ONLY to add new tasks, mark a task in_progress / completed, or record a blocker — not as a way to re-read your plan (use todo_read for that, but the current plan is also surfaced automatically in your context). Proceed with the current in_progress task.",
|
|
298609
298625
|
todos: oldTodos,
|
|
298610
|
-
noop: true
|
|
298626
|
+
noop: true,
|
|
298627
|
+
noProgress: true
|
|
298611
298628
|
}),
|
|
298629
|
+
noop: true,
|
|
298612
298630
|
durationMs: performance.now() - start2
|
|
298613
298631
|
};
|
|
298614
298632
|
}
|
|
@@ -572729,6 +572747,7 @@ var init_context_fabric = __esm({
|
|
|
572729
572747
|
"use strict";
|
|
572730
572748
|
PRIORITY = {
|
|
572731
572749
|
GOAL: 100,
|
|
572750
|
+
ACTION_CONTRACT: 98,
|
|
572732
572751
|
USER_STEERING: 95,
|
|
572733
572752
|
TASK_STATE: 80,
|
|
572734
572753
|
KNOWN_FILES: 70,
|
|
@@ -572746,6 +572765,7 @@ var init_context_fabric = __esm({
|
|
|
572746
572765
|
KIND_ORDER = [
|
|
572747
572766
|
"goal",
|
|
572748
572767
|
"user_steering",
|
|
572768
|
+
"action_contract",
|
|
572749
572769
|
"task_state",
|
|
572750
572770
|
"known_files",
|
|
572751
572771
|
"recent_failure",
|
|
@@ -572762,6 +572782,7 @@ var init_context_fabric = __esm({
|
|
|
572762
572782
|
KIND_LABELS = {
|
|
572763
572783
|
goal: "Goal",
|
|
572764
572784
|
user_steering: "User Steering",
|
|
572785
|
+
action_contract: "Next Action Contract",
|
|
572765
572786
|
task_state: "Task State",
|
|
572766
572787
|
known_files: "Known Files",
|
|
572767
572788
|
recent_failure: "Recent Failures",
|
|
@@ -572778,6 +572799,7 @@ var init_context_fabric = __esm({
|
|
|
572778
572799
|
DEFAULT_KIND_CHAR_BUDGET = {
|
|
572779
572800
|
goal: 900,
|
|
572780
572801
|
user_steering: 1400,
|
|
572802
|
+
action_contract: 1800,
|
|
572781
572803
|
task_state: 1800,
|
|
572782
572804
|
known_files: 2400,
|
|
572783
572805
|
recent_failure: 2600,
|
|
@@ -574715,6 +574737,11 @@ var init_focusSupervisor = __esm({
|
|
|
574715
574737
|
return;
|
|
574716
574738
|
}
|
|
574717
574739
|
if (input.toolName === "todo_write" && input.success) {
|
|
574740
|
+
if (input.noop) {
|
|
574741
|
+
this.lastDecision = "todo_noop_not_satisfied";
|
|
574742
|
+
this.lastReason = "todo_write returned no-op; checklist state did not change";
|
|
574743
|
+
return;
|
|
574744
|
+
}
|
|
574718
574745
|
this.clearSatisfiedDirective("todo plan updated", input.turn);
|
|
574719
574746
|
return;
|
|
574720
574747
|
}
|
|
@@ -578304,6 +578331,220 @@ ${parts.join("\n")}
|
|
|
578304
578331
|
}
|
|
578305
578332
|
return null;
|
|
578306
578333
|
}
|
|
578334
|
+
_currentWorkboardSnapshotForFrame() {
|
|
578335
|
+
const dir = this._workboardDir();
|
|
578336
|
+
const fromDisk = readActiveWorkboardSnapshot(dir, this._sessionId);
|
|
578337
|
+
if (fromDisk) {
|
|
578338
|
+
this._workboard = fromDisk;
|
|
578339
|
+
return fromDisk;
|
|
578340
|
+
}
|
|
578341
|
+
if (this._workboard)
|
|
578342
|
+
return this._workboard;
|
|
578343
|
+
const goal = this._taskState.originalGoal || this._taskState.goal || "";
|
|
578344
|
+
if (this._initialWorkboardCardsForGoal(goal).length === 0)
|
|
578345
|
+
return null;
|
|
578346
|
+
return this.getOrCreateWorkboard();
|
|
578347
|
+
}
|
|
578348
|
+
_workboardEvidenceCount(card) {
|
|
578349
|
+
return card?.evidence?.length ?? 0;
|
|
578350
|
+
}
|
|
578351
|
+
_workboardHasEditEvidence(card) {
|
|
578352
|
+
if (!card)
|
|
578353
|
+
return false;
|
|
578354
|
+
const editTools = /* @__PURE__ */ new Set(["file_write", "file_edit", "batch_edit", "file_patch"]);
|
|
578355
|
+
return card.evidence.some((e2) => typeof e2.tool === "string" && editTools.has(e2.tool));
|
|
578356
|
+
}
|
|
578357
|
+
_workboardHasVerificationEvidence(card) {
|
|
578358
|
+
if (!card)
|
|
578359
|
+
return false;
|
|
578360
|
+
return card.evidence.some((e2) => e2.tool === "shell" || e2.tool === "background_run");
|
|
578361
|
+
}
|
|
578362
|
+
_deriveWorkboardActionContract(snapshot) {
|
|
578363
|
+
if (snapshot.cards.length === 0)
|
|
578364
|
+
return null;
|
|
578365
|
+
const byId = new Map(snapshot.cards.map((card) => [card.id, card]));
|
|
578366
|
+
const discovery = byId.get("discover-current-state");
|
|
578367
|
+
const implementation2 = byId.get("implement-repair");
|
|
578368
|
+
const integration = byId.get("integrate-and-run");
|
|
578369
|
+
const verification = byId.get("verify-observed-outcome");
|
|
578370
|
+
const discoveryEvidence = this._workboardEvidenceCount(discovery);
|
|
578371
|
+
const hasImplementationEvidence = this._workboardHasEditEvidence(implementation2);
|
|
578372
|
+
const hasVerificationEvidence = this._workboardHasVerificationEvidence(integration);
|
|
578373
|
+
if (hasImplementationEvidence && !hasVerificationEvidence && integration) {
|
|
578374
|
+
return {
|
|
578375
|
+
cardId: integration.id,
|
|
578376
|
+
title: integration.title,
|
|
578377
|
+
reason: "implementation evidence exists; exercise the changed runtime path before more discovery",
|
|
578378
|
+
preferredTools: ["shell"]
|
|
578379
|
+
};
|
|
578380
|
+
}
|
|
578381
|
+
if (hasVerificationEvidence && verification) {
|
|
578382
|
+
return {
|
|
578383
|
+
cardId: verification.id,
|
|
578384
|
+
title: verification.title,
|
|
578385
|
+
reason: "verification evidence exists; reconcile outcome, todos, and blockers",
|
|
578386
|
+
preferredTools: ["todo_write", "task_complete"]
|
|
578387
|
+
};
|
|
578388
|
+
}
|
|
578389
|
+
if (discoveryEvidence > 0 && !hasImplementationEvidence && implementation2) {
|
|
578390
|
+
return {
|
|
578391
|
+
cardId: implementation2.id,
|
|
578392
|
+
title: implementation2.title,
|
|
578393
|
+
reason: "discovery evidence is already present; land the smallest concrete repair",
|
|
578394
|
+
preferredTools: ["file_write", "file_edit", "batch_edit", "file_patch"]
|
|
578395
|
+
};
|
|
578396
|
+
}
|
|
578397
|
+
const active = snapshot.cards.find((card) => card.status === "in_progress") ?? snapshot.cards.find((card) => card.status === "needs_changes") ?? snapshot.cards.find((card) => card.status === "open") ?? discovery;
|
|
578398
|
+
if (!active)
|
|
578399
|
+
return null;
|
|
578400
|
+
return {
|
|
578401
|
+
cardId: active.id,
|
|
578402
|
+
title: active.title,
|
|
578403
|
+
reason: active.id === "discover-current-state" ? "no authoritative target evidence is recorded yet" : "workboard card is the next unresolved card",
|
|
578404
|
+
preferredTools: active.id === "discover-current-state" ? ["file_read", "grep_search", "list_directory", "shell"] : ["file_write", "file_edit", "batch_edit", "file_patch", "shell"]
|
|
578405
|
+
};
|
|
578406
|
+
}
|
|
578407
|
+
_focusToolsForRequiredAction(action) {
|
|
578408
|
+
switch (action) {
|
|
578409
|
+
case "update_todos":
|
|
578410
|
+
return "todo_write with a changed plan/status, or a real file edit if that is the active work";
|
|
578411
|
+
case "read_authoritative_target":
|
|
578412
|
+
case "use_cached_evidence":
|
|
578413
|
+
return "use cached evidence or one authoritative file_read/read-only shell, then act";
|
|
578414
|
+
case "edit_different_target":
|
|
578415
|
+
return "file_write, file_edit, batch_edit, or file_patch on a different supported target";
|
|
578416
|
+
case "run_verification":
|
|
578417
|
+
return "shell running the verification/runtime command";
|
|
578418
|
+
case "report_blocked":
|
|
578419
|
+
case "report_incomplete":
|
|
578420
|
+
return "task_complete with the concrete blocker/incomplete evidence";
|
|
578421
|
+
default:
|
|
578422
|
+
return "choose the narrowest tool that advances the current card";
|
|
578423
|
+
}
|
|
578424
|
+
}
|
|
578425
|
+
_renderNextActionContract(turn) {
|
|
578426
|
+
const lines = ["[NEXT ACTION CONTRACT]", `turn=${turn}`];
|
|
578427
|
+
const focus = this._focusSupervisor?.snapshot().directive ?? null;
|
|
578428
|
+
if (focus) {
|
|
578429
|
+
lines.push(`focus_required_next_action=${focus.requiredNextAction}`);
|
|
578430
|
+
lines.push(`focus_valid_tools=${this._focusToolsForRequiredAction(focus.requiredNextAction)}`);
|
|
578431
|
+
lines.push(`focus_reason=${focus.reason}`);
|
|
578432
|
+
}
|
|
578433
|
+
const snapshot = this._currentWorkboardSnapshotForFrame();
|
|
578434
|
+
const action = snapshot ? this._deriveWorkboardActionContract(snapshot) : null;
|
|
578435
|
+
if (snapshot && action) {
|
|
578436
|
+
const byId = new Map(snapshot.cards.map((card) => [card.id, card]));
|
|
578437
|
+
const discovery = byId.get("discover-current-state");
|
|
578438
|
+
const implementation2 = byId.get("implement-repair");
|
|
578439
|
+
const integration = byId.get("integrate-and-run");
|
|
578440
|
+
const verification = byId.get("verify-observed-outcome");
|
|
578441
|
+
lines.push(`workboard_current_card=${action.cardId} (${action.title})`);
|
|
578442
|
+
lines.push(`workboard_preferred_tools=${action.preferredTools.join(", ")}`);
|
|
578443
|
+
lines.push(`workboard_reason=${action.reason}`);
|
|
578444
|
+
lines.push(`workboard_evidence_counts=discover:${this._workboardEvidenceCount(discovery)} implement:${this._workboardEvidenceCount(implementation2)} integrate:${this._workboardEvidenceCount(integration)} verify:${this._workboardEvidenceCount(verification)}`);
|
|
578445
|
+
if (this._workboardHasEditEvidence(implementation2)) {
|
|
578446
|
+
lines.push("implementation_state=mutation evidence is already recorded; do not treat discovery as the active phase");
|
|
578447
|
+
}
|
|
578448
|
+
}
|
|
578449
|
+
const todos = this.readSessionTodos() ?? [];
|
|
578450
|
+
if (todos.length > 0) {
|
|
578451
|
+
const inProgress = todos.filter((todo) => todo.status === "in_progress");
|
|
578452
|
+
const pending2 = todos.filter((todo) => todo.status === "pending");
|
|
578453
|
+
const blocked = todos.filter((todo) => todo.status === "blocked");
|
|
578454
|
+
lines.push(`todo_counts=in_progress:${inProgress.length} pending:${pending2.length} blocked:${blocked.length}`);
|
|
578455
|
+
if (inProgress[0]) {
|
|
578456
|
+
lines.push(`todo_current=${inProgress[0].content.slice(0, 180)}`);
|
|
578457
|
+
} else if (pending2.length > 0) {
|
|
578458
|
+
lines.push("todo_contract=mark exactly one pending todo in_progress before using the checklist as progress");
|
|
578459
|
+
}
|
|
578460
|
+
}
|
|
578461
|
+
if (lines.length === 2)
|
|
578462
|
+
return null;
|
|
578463
|
+
lines.push("not_progress=repeat unchanged todo_write; repeat broad discovery already represented in this frame; keep discovery active after a real mutation");
|
|
578464
|
+
return lines.join("\n");
|
|
578465
|
+
}
|
|
578466
|
+
_workboardTargetCardId(snapshot, toolName, result) {
|
|
578467
|
+
const byId = new Map(snapshot.cards.map((card) => [card.id, card]));
|
|
578468
|
+
if (this._isProjectEditTool(toolName) && this._isRealProjectMutation(toolName, result)) {
|
|
578469
|
+
return byId.has("implement-repair") ? "implement-repair" : null;
|
|
578470
|
+
}
|
|
578471
|
+
if (toolName === "shell" || toolName === "background_run") {
|
|
578472
|
+
const implementation2 = byId.get("implement-repair");
|
|
578473
|
+
const target = this._workboardHasEditEvidence(implementation2) ? "integrate-and-run" : "discover-current-state";
|
|
578474
|
+
return byId.has(target) ? target : null;
|
|
578475
|
+
}
|
|
578476
|
+
if (toolName === "file_read" || toolName === "file_explore" || toolName === "list_directory" || toolName === "grep_search" || toolName === "find_files" || toolName === "web_search") {
|
|
578477
|
+
return byId.has("discover-current-state") ? "discover-current-state" : null;
|
|
578478
|
+
}
|
|
578479
|
+
const active = snapshot.cards.find((card) => card.status === "in_progress");
|
|
578480
|
+
return active?.id ?? null;
|
|
578481
|
+
}
|
|
578482
|
+
_refreshWorkboardSnapshot(snapshot) {
|
|
578483
|
+
const refreshed = readActiveWorkboardSnapshot(this._workboardDir(), this._sessionId) ?? snapshot;
|
|
578484
|
+
this._workboard = refreshed;
|
|
578485
|
+
return refreshed;
|
|
578486
|
+
}
|
|
578487
|
+
_advanceWorkboardForTool(snapshot, toolName, result, actor) {
|
|
578488
|
+
const dir = this._workboardDir();
|
|
578489
|
+
let current = snapshot;
|
|
578490
|
+
const byId = () => new Map(current.cards.map((card) => [card.id, card]));
|
|
578491
|
+
const editMutation = this._isProjectEditTool(toolName) && this._isRealProjectMutation(toolName, result);
|
|
578492
|
+
try {
|
|
578493
|
+
if (editMutation) {
|
|
578494
|
+
let cards = byId();
|
|
578495
|
+
const discovery = cards.get("discover-current-state");
|
|
578496
|
+
if (discovery && discovery.status !== "verified" && discovery.evidence.length > 0) {
|
|
578497
|
+
const completed = completeWorkboardCard(dir, {
|
|
578498
|
+
runId: this._sessionId,
|
|
578499
|
+
cardId: discovery.id,
|
|
578500
|
+
actor,
|
|
578501
|
+
outcome: "completed",
|
|
578502
|
+
reason: "Implementation started after authoritative discovery evidence was recorded."
|
|
578503
|
+
});
|
|
578504
|
+
current = completed.snapshot;
|
|
578505
|
+
cards = byId();
|
|
578506
|
+
const completedDiscovery = cards.get("discover-current-state");
|
|
578507
|
+
if (completedDiscovery?.status === "completed") {
|
|
578508
|
+
const verified = completeWorkboardCard(dir, {
|
|
578509
|
+
runId: this._sessionId,
|
|
578510
|
+
cardId: completedDiscovery.id,
|
|
578511
|
+
actor,
|
|
578512
|
+
outcome: "verified",
|
|
578513
|
+
reason: "Discovery evidence was sufficient to select and mutate the implementation target."
|
|
578514
|
+
});
|
|
578515
|
+
current = verified.snapshot;
|
|
578516
|
+
cards = byId();
|
|
578517
|
+
}
|
|
578518
|
+
}
|
|
578519
|
+
const implementation2 = cards.get("implement-repair");
|
|
578520
|
+
if (implementation2 && (implementation2.status === "open" || implementation2.status === "needs_changes")) {
|
|
578521
|
+
current = updateWorkboardCard(dir, {
|
|
578522
|
+
runId: this._sessionId,
|
|
578523
|
+
cardId: implementation2.id,
|
|
578524
|
+
actor,
|
|
578525
|
+
updates: { status: "in_progress", lane: "worker" },
|
|
578526
|
+
decisionReason: "Real project mutation landed; implementation is now the active phase."
|
|
578527
|
+
});
|
|
578528
|
+
}
|
|
578529
|
+
}
|
|
578530
|
+
if (toolName === "shell" || toolName === "background_run") {
|
|
578531
|
+
const cards = byId();
|
|
578532
|
+
const implementation2 = cards.get("implement-repair");
|
|
578533
|
+
const integration = cards.get("integrate-and-run");
|
|
578534
|
+
if (integration && this._workboardHasEditEvidence(implementation2) && (integration.status === "open" || integration.status === "needs_changes")) {
|
|
578535
|
+
current = updateWorkboardCard(dir, {
|
|
578536
|
+
runId: this._sessionId,
|
|
578537
|
+
cardId: integration.id,
|
|
578538
|
+
actor,
|
|
578539
|
+
updates: { status: "in_progress", lane: "verification" },
|
|
578540
|
+
decisionReason: "Runtime or verification command ran after implementation evidence."
|
|
578541
|
+
});
|
|
578542
|
+
}
|
|
578543
|
+
}
|
|
578544
|
+
} catch {
|
|
578545
|
+
}
|
|
578546
|
+
return this._refreshWorkboardSnapshot(current);
|
|
578547
|
+
}
|
|
578307
578548
|
/**
|
|
578308
578549
|
* Record evidence from a tool call against the active workboard.
|
|
578309
578550
|
* Matches by card assignee when the card is in progress.
|
|
@@ -578332,24 +578573,23 @@ ${parts.join("\n")}
|
|
|
578332
578573
|
ref: typeof args["path"] === "string" ? args["path"]?.slice(0, 200) : void 0
|
|
578333
578574
|
};
|
|
578334
578575
|
const actor = this.options.subAgent ? "sub-agent" : "agent";
|
|
578335
|
-
|
|
578336
|
-
|
|
578337
|
-
|
|
578338
|
-
|
|
578339
|
-
|
|
578340
|
-
|
|
578341
|
-
|
|
578342
|
-
|
|
578343
|
-
|
|
578344
|
-
if (toolName === "file_read" && !card.evidenceRequirements.some((r2) => r2.toLowerCase().includes("read") || r2.toLowerCase().includes("explor") || r2.toLowerCase().includes("understand")))
|
|
578345
|
-
continue;
|
|
578346
|
-
attachWorkboardEvidence(dir, {
|
|
578347
|
-
runId: this._sessionId,
|
|
578348
|
-
cardId: card.id,
|
|
578349
|
-
actor,
|
|
578350
|
-
evidence
|
|
578351
|
-
});
|
|
578576
|
+
const advanced = this._advanceWorkboardForTool(board, toolName, result, actor);
|
|
578577
|
+
const targetCardId = this._workboardTargetCardId(advanced, toolName, result);
|
|
578578
|
+
if (!targetCardId)
|
|
578579
|
+
return;
|
|
578580
|
+
const targetCard = advanced.cards.find((card) => card.id === targetCardId);
|
|
578581
|
+
if (!targetCard)
|
|
578582
|
+
return;
|
|
578583
|
+
if (targetCard.assignee && targetCard.assignee !== actor && targetCard.assignee !== "any") {
|
|
578584
|
+
return;
|
|
578352
578585
|
}
|
|
578586
|
+
attachWorkboardEvidence(dir, {
|
|
578587
|
+
runId: this._sessionId,
|
|
578588
|
+
cardId: targetCard.id,
|
|
578589
|
+
actor,
|
|
578590
|
+
evidence
|
|
578591
|
+
});
|
|
578592
|
+
this._refreshWorkboardSnapshot(advanced);
|
|
578353
578593
|
} catch {
|
|
578354
578594
|
}
|
|
578355
578595
|
}
|
|
@@ -579814,6 +580054,21 @@ Pick the SMALLEST concrete deliverable from the spec — typically the project e
|
|
|
579814
580054
|
return false;
|
|
579815
580055
|
return true;
|
|
579816
580056
|
}
|
|
580057
|
+
_isTodoWriteNoopResult(result) {
|
|
580058
|
+
if (!result)
|
|
580059
|
+
return false;
|
|
580060
|
+
if (result.noop === true)
|
|
580061
|
+
return true;
|
|
580062
|
+
const text2 = String(result.output ?? result.llmContent ?? "");
|
|
580063
|
+
if (!text2 || !/"noop"\s*:\s*true/.test(text2))
|
|
580064
|
+
return false;
|
|
580065
|
+
try {
|
|
580066
|
+
const parsed = JSON.parse(text2);
|
|
580067
|
+
return parsed?.noop === true;
|
|
580068
|
+
} catch {
|
|
580069
|
+
return true;
|
|
580070
|
+
}
|
|
580071
|
+
}
|
|
579817
580072
|
_toolEvidencePreview(result, displayOutput, max = 500, toolName) {
|
|
579818
580073
|
const modelVisible = result.llmContent ?? result.output ?? displayOutput ?? "";
|
|
579819
580074
|
const failurePrefix = result.success === false && result.error ? `Error: ${result.error}` : "";
|
|
@@ -582535,6 +582790,7 @@ ${chunk.content}`, {
|
|
|
582535
582790
|
const failureBlock = this._renderRecentFailuresBlock(turn);
|
|
582536
582791
|
const churnBlock = this._renderWriteChurnBlock(turn);
|
|
582537
582792
|
const focusBlock = this._focusSupervisor?.renderFrame() ?? null;
|
|
582793
|
+
const actionContractBlock = this._renderNextActionContract(turn);
|
|
582538
582794
|
const toolCacheBlock = recentToolResults ? this._renderKnowledgeBlock(recentToolResults) : null;
|
|
582539
582795
|
const anchorsBlock = this.surfaceAnchors(messages2);
|
|
582540
582796
|
const pprMemoryBlock = this._lastPprMemoryLines.length > 0 ? `[Associative Memory - related prior experience]
|
|
@@ -582572,6 +582828,13 @@ ${this._lastPprMemoryLines.slice(0, 5).join("\n")}` : null;
|
|
|
582572
582828
|
createdTurn: turn,
|
|
582573
582829
|
ttlTurns: 1
|
|
582574
582830
|
}),
|
|
582831
|
+
signalFromBlock("action_contract", "turn.next-action-contract", actionContractBlock, {
|
|
582832
|
+
id: "next-action-contract",
|
|
582833
|
+
dedupeKey: "turn.next-action-contract",
|
|
582834
|
+
priority: PRIORITY.ACTION_CONTRACT,
|
|
582835
|
+
createdTurn: turn,
|
|
582836
|
+
ttlTurns: 1
|
|
582837
|
+
}),
|
|
582575
582838
|
signalFromBlock("task_state", "turn.todos", todoBlock, {
|
|
582576
582839
|
id: "todo-state",
|
|
582577
582840
|
dedupeKey: "turn.todos",
|
|
@@ -587847,7 +588110,7 @@ Respond with EXACTLY this structure before your next tool call:
|
|
|
587847
588110
|
}
|
|
587848
588111
|
}
|
|
587849
588112
|
}
|
|
587850
|
-
if (tc.name === "todo_write" && result.success) {
|
|
588113
|
+
if (tc.name === "todo_write" && result.success && !this._isTodoWriteNoopResult(result)) {
|
|
587851
588114
|
if (this._progressGateActive) {
|
|
587852
588115
|
this.emit({
|
|
587853
588116
|
type: "status",
|
|
@@ -588430,7 +588693,7 @@ Respond with EXACTLY this structure before your next tool call:
|
|
|
588430
588693
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
588431
588694
|
});
|
|
588432
588695
|
}
|
|
588433
|
-
if (!this._newFieldNudgeFired) {
|
|
588696
|
+
if (!this._newFieldNudgeFired && !this._isTodoWriteNoopResult(result)) {
|
|
588434
588697
|
this._todoWritesObservedForNudge++;
|
|
588435
588698
|
const _anyFieldUsed = _todosNow.some((t2) => typeof t2.verifyCommand === "string" || Array.isArray(t2.declaredArtifacts));
|
|
588436
588699
|
if (this._todoWritesObservedForNudge >= 2 && !_anyFieldUsed) {
|
|
@@ -589047,7 +589310,8 @@ Evidence: ${evidencePreview}`.slice(0, 500);
|
|
|
589047
589310
|
output: result.output ?? result.llmContent ?? "",
|
|
589048
589311
|
error: result.error ?? "",
|
|
589049
589312
|
mutated: realFileMutation || shellFilesystemMutation,
|
|
589050
|
-
isReadLike
|
|
589313
|
+
isReadLike,
|
|
589314
|
+
noop: tc.name === "todo_write" ? this._isTodoWriteNoopResult(result) : result.noop
|
|
589051
589315
|
});
|
|
589052
589316
|
const focusSnapshotAfter = this._focusSupervisor?.snapshot();
|
|
589053
589317
|
focusAfterToolResult = focusSnapshotAfter ?? void 0;
|
|
@@ -589094,7 +589358,7 @@ Evidence: ${evidencePreview}`.slice(0, 500);
|
|
|
589094
589358
|
});
|
|
589095
589359
|
} catch {
|
|
589096
589360
|
}
|
|
589097
|
-
if (tc.name === "todo_write") {
|
|
589361
|
+
if (tc.name === "todo_write" && !this._isTodoWriteNoopResult(result)) {
|
|
589098
589362
|
this._lastTodoWriteTurn = turn;
|
|
589099
589363
|
}
|
|
589100
589364
|
if (tc.name === "file_read" || tc.name === "list_directory" || tc.name === "find_files" || tc.name === "grep_search") {
|
|
@@ -604602,12 +604866,14 @@ var init_py_embed = __esm({
|
|
|
604602
604866
|
var listen_exports = {};
|
|
604603
604867
|
__export(listen_exports, {
|
|
604604
604868
|
ListenEngine: () => ListenEngine,
|
|
604869
|
+
asrConsensusEnabled: () => asrConsensusEnabled,
|
|
604605
604870
|
ensureTranscribeCliBackground: () => ensureTranscribeCliBackground,
|
|
604606
604871
|
getListenEngine: () => getListenEngine,
|
|
604607
604872
|
getListenLiveState: () => getListenLiveState,
|
|
604608
604873
|
isAudioPath: () => isAudioPath,
|
|
604609
604874
|
isTranscribablePath: () => isTranscribablePath,
|
|
604610
604875
|
isVideoPath: () => isVideoPath,
|
|
604876
|
+
resolveAsrConsensusModel: () => resolveAsrConsensusModel,
|
|
604611
604877
|
transcribeFileViaWhisper: () => transcribeFileViaWhisper,
|
|
604612
604878
|
waitForTranscribeCli: () => waitForTranscribeCli
|
|
604613
604879
|
});
|
|
@@ -605012,9 +605278,25 @@ function defaultConsensusModel(primaryModel) {
|
|
|
605012
605278
|
if (model === "large-v3" || model === "large") return "small";
|
|
605013
605279
|
return "base";
|
|
605014
605280
|
}
|
|
605015
|
-
function
|
|
605016
|
-
const
|
|
605017
|
-
|
|
605281
|
+
function resolveAsrConsensusModel(primaryModel) {
|
|
605282
|
+
const disabled = String(process.env["OMNIUS_ASR_DISABLE_CONSENSUS"] ?? "").trim().toLowerCase();
|
|
605283
|
+
if (disabled === "1" || disabled === "true" || disabled === "yes" || disabled === "on") {
|
|
605284
|
+
return "off";
|
|
605285
|
+
}
|
|
605286
|
+
const consensusEnv = String(
|
|
605287
|
+
process.env["OMNIUS_ASR_CONSENSUS"] ?? process.env["OMNIUS_ASR_CONSENSUS_MODEL"] ?? ""
|
|
605288
|
+
).trim().toLowerCase();
|
|
605289
|
+
if (!consensusEnv) return "off";
|
|
605290
|
+
if (["0", "off", "false", "no", "none", "disabled"].includes(consensusEnv)) {
|
|
605291
|
+
return "off";
|
|
605292
|
+
}
|
|
605293
|
+
if (["1", "on", "true", "yes", "enabled", "auto"].includes(consensusEnv)) {
|
|
605294
|
+
return defaultConsensusModel(primaryModel);
|
|
605295
|
+
}
|
|
605296
|
+
return consensusEnv;
|
|
605297
|
+
}
|
|
605298
|
+
function asrConsensusEnabled(primaryModel = "base") {
|
|
605299
|
+
return resolveAsrConsensusModel(primaryModel) !== "off";
|
|
605018
605300
|
}
|
|
605019
605301
|
function liveAsrUseTranscribeCli() {
|
|
605020
605302
|
const value2 = String(process.env["OMNIUS_ASR_USE_TRANSCRIBE_CLI"] ?? "").trim().toLowerCase();
|
|
@@ -605247,8 +605529,7 @@ var init_listen = __esm({
|
|
|
605247
605529
|
model: this.model,
|
|
605248
605530
|
lastStatus: `loading whisper ${this.model} model...`
|
|
605249
605531
|
});
|
|
605250
|
-
const
|
|
605251
|
-
const consensusModel = consensusEnv === "0" || consensusEnv === "off" || consensusEnv === "false" ? "off" : consensusEnv || defaultConsensusModel(this.model);
|
|
605532
|
+
const consensusModel = resolveAsrConsensusModel(this.model);
|
|
605252
605533
|
const consensusThreshold = String(process.env["OMNIUS_ASR_CONSENSUS_THRESHOLD"] ?? "0.45");
|
|
605253
605534
|
const silenceMs = String(process.env["OMNIUS_ASR_SILENCE_MS"] ?? "3000");
|
|
605254
605535
|
this.process = spawn29(
|
|
@@ -605312,7 +605593,9 @@ var init_listen = __esm({
|
|
|
605312
605593
|
updateListenLiveState({
|
|
605313
605594
|
lastStatus: message2
|
|
605314
605595
|
});
|
|
605315
|
-
|
|
605596
|
+
if (process.env["OMNIUS_ASR_VERBOSE_CONSENSUS"] === "1") {
|
|
605597
|
+
this.emit("status", message2);
|
|
605598
|
+
}
|
|
605316
605599
|
}
|
|
605317
605600
|
break;
|
|
605318
605601
|
case "vad": {
|
|
@@ -605665,7 +605948,7 @@ var init_listen = __esm({
|
|
|
605665
605948
|
updateListenLiveState({ phase: "error", lastStatus: "no mic capture tool (arecord/sox/ffmpeg)" });
|
|
605666
605949
|
return "No microphone capture tool found. Install arecord (Linux), sox (macOS), or ffmpeg.";
|
|
605667
605950
|
}
|
|
605668
|
-
const consensusEnabled = asrConsensusEnabled();
|
|
605951
|
+
const consensusEnabled = asrConsensusEnabled(this.config.model);
|
|
605669
605952
|
const useTranscribeCli = liveAsrUseTranscribeCli() && !consensusEnabled;
|
|
605670
605953
|
const preferWhisperFallback = !useTranscribeCli;
|
|
605671
605954
|
if (preferWhisperFallback) {
|
|
@@ -605959,7 +606242,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
605959
606242
|
* Caller is responsible for calling .stop() when done.
|
|
605960
606243
|
*/
|
|
605961
606244
|
async createCallTranscriber() {
|
|
605962
|
-
const requireConsensus = asrConsensusEnabled();
|
|
606245
|
+
const requireConsensus = asrConsensusEnabled(this.config.model);
|
|
605963
606246
|
const useTranscribeCli = liveAsrUseTranscribeCli() && !requireConsensus;
|
|
605964
606247
|
let tc = useTranscribeCli ? await this.loadTranscribeCli() : null;
|
|
605965
606248
|
if (useTranscribeCli && !tc && _bgInstallPromise) {
|
|
@@ -740566,10 +740849,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
740566
740849
|
sharedTranscriber: null
|
|
740567
740850
|
};
|
|
740568
740851
|
const engine = getListenEngine();
|
|
740569
|
-
const callConsensusRequired = (
|
|
740570
|
-
const env2 = String(process.env["OMNIUS_ASR_CONSENSUS"] ?? "").trim().toLowerCase();
|
|
740571
|
-
return !(env2 === "0" || env2 === "off" || env2 === "false");
|
|
740572
|
-
})();
|
|
740852
|
+
const callConsensusRequired = asrConsensusEnabled();
|
|
740573
740853
|
const recentCallFinals = [];
|
|
740574
740854
|
const normalizeCallTranscript = (value2) => value2.toLowerCase().replace(/[^\p{L}\p{N}\s']/gu, " ").replace(/\s+/g, " ").trim();
|
|
740575
740855
|
const isLikelyCallAsrHallucination = (normalized) => /^(thanks|thank you) for watching(?: this video)?$/.test(normalized) || /^thanks for watching and/.test(normalized) || /\bdon't forget to (like|subscribe)\b/.test(normalized);
|
|
@@ -14,8 +14,8 @@ Architecture (EGG voice/whisper lineage):
|
|
|
14
14
|
(USB 2886:0018), the XMOS DSP's SPEECHDETECTED register gates utterances,
|
|
15
15
|
on-chip echo cancellation is enabled, and the DOA angle is attached to
|
|
16
16
|
transcripts. Falls back to adaptive energy VAD otherwise.
|
|
17
|
-
-
|
|
18
|
-
utterances
|
|
17
|
+
- Optional dual-model consensus: a second whisper model can validate
|
|
18
|
+
finalized utterances when explicitly enabled.
|
|
19
19
|
|
|
20
20
|
Protocol:
|
|
21
21
|
stdin — raw PCM16 audio (16kHz, mono, 16-bit signed LE)
|
|
@@ -58,6 +58,23 @@ SAMPLE_WIDTH = 2 # 16-bit
|
|
|
58
58
|
BLOCK_SECONDS = 0.2
|
|
59
59
|
BLOCK_SAMPLES = int(SAMPLE_RATE * BLOCK_SECONDS)
|
|
60
60
|
|
|
61
|
+
|
|
62
|
+
def env_float(name: str, default: float) -> float:
|
|
63
|
+
raw = os.environ.get(name, "").strip()
|
|
64
|
+
if not raw:
|
|
65
|
+
return default
|
|
66
|
+
try:
|
|
67
|
+
return float(raw)
|
|
68
|
+
except ValueError:
|
|
69
|
+
return default
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def env_bool(name: str, default: bool = False) -> bool:
|
|
73
|
+
raw = os.environ.get(name, "").strip().lower()
|
|
74
|
+
if not raw:
|
|
75
|
+
return default
|
|
76
|
+
return raw in ("1", "true", "yes", "on", "enabled")
|
|
77
|
+
|
|
61
78
|
# ---------------------------------------------------------------------------
|
|
62
79
|
# Output helpers (JSON lines to stdout)
|
|
63
80
|
# ---------------------------------------------------------------------------
|
|
@@ -450,7 +467,7 @@ def main():
|
|
|
450
467
|
parser.add_argument("--chunk-seconds", type=float, default=3, help=argparse.SUPPRESS)
|
|
451
468
|
parser.add_argument("--window-seconds", type=float, default=10, help=argparse.SUPPRESS)
|
|
452
469
|
parser.add_argument("--language", default=None, help="Language code (e.g. en, es, fr). Auto-detect if omitted.")
|
|
453
|
-
parser.add_argument("--consensus-model", default="
|
|
470
|
+
parser.add_argument("--consensus-model", default="off",
|
|
454
471
|
help="Second whisper model run in parallel on finalized utterances; transcripts are only emitted when both models agree. 'off' disables.")
|
|
455
472
|
parser.add_argument("--consensus-threshold", type=float, default=0.55,
|
|
456
473
|
help="Token similarity (0-1) required between the two models' transcripts.")
|
|
@@ -460,6 +477,18 @@ def main():
|
|
|
460
477
|
help="Audio kept from before speech onset.")
|
|
461
478
|
parser.add_argument("--max-utterance-seconds", type=float, default=22,
|
|
462
479
|
help="Force-finalize utterances longer than this.")
|
|
480
|
+
parser.add_argument("--partials", action="store_true", default=env_bool("OMNIUS_ASR_PARTIALS", False),
|
|
481
|
+
help="Emit interim Whisper transcripts during long utterances. Disabled by default to avoid silence/noise hallucinations.")
|
|
482
|
+
parser.add_argument("--min-speech-ms", type=float, default=env_float("OMNIUS_ASR_MIN_SPEECH_MS", 450.0),
|
|
483
|
+
help="Minimum VAD-positive speech duration required before an utterance is sent to Whisper.")
|
|
484
|
+
parser.add_argument("--start-rms", type=float, default=env_float("OMNIUS_ASR_START_RMS", 0.0025),
|
|
485
|
+
help="Minimum block RMS required for software VAD speech start.")
|
|
486
|
+
parser.add_argument("--energy-ratio", type=float, default=env_float("OMNIUS_ASR_ENERGY_RATIO", 3.5),
|
|
487
|
+
help="Software VAD speech gate as a multiple of the adaptive noise floor.")
|
|
488
|
+
parser.add_argument("--min-utterance-rms", type=float, default=env_float("OMNIUS_ASR_MIN_UTTERANCE_RMS", 0.003),
|
|
489
|
+
help="Minimum loud-block RMS required before final transcription.")
|
|
490
|
+
parser.add_argument("--min-utterance-peak", type=float, default=env_float("OMNIUS_ASR_MIN_UTTERANCE_PEAK", 0.015),
|
|
491
|
+
help="Minimum utterance peak amplitude required when RMS is low.")
|
|
463
492
|
args = parser.parse_args()
|
|
464
493
|
|
|
465
494
|
import whisper
|
|
@@ -543,6 +572,9 @@ def main():
|
|
|
543
572
|
utterance = [] # list of float32 blocks while capturing
|
|
544
573
|
capturing = False
|
|
545
574
|
silence_run = 0
|
|
575
|
+
speech_blocks = 0
|
|
576
|
+
utterance_rms_values = []
|
|
577
|
+
utterance_peak = 0.0
|
|
546
578
|
noise_floor = None
|
|
547
579
|
last_partial_at = 0.0
|
|
548
580
|
last_final_text = ""
|
|
@@ -558,7 +590,7 @@ def main():
|
|
|
558
590
|
noise_floor = 0.7 * noise_floor + 0.3 * block_rms # drop fast
|
|
559
591
|
else:
|
|
560
592
|
noise_floor = 0.995 * noise_floor + 0.005 * block_rms # creep up slowly
|
|
561
|
-
gate = max(
|
|
593
|
+
gate = max(float(args.start_rms), noise_floor * float(args.energy_ratio))
|
|
562
594
|
return block_rms >= gate
|
|
563
595
|
|
|
564
596
|
def transcribe_partial(samples):
|
|
@@ -574,9 +606,31 @@ def main():
|
|
|
574
606
|
except Exception as e:
|
|
575
607
|
emit_error(f"Transcription error: {e}")
|
|
576
608
|
|
|
577
|
-
def
|
|
578
|
-
nonlocal last_final_text
|
|
609
|
+
def utterance_quality_ok(samples, speech_block_count, rms_values, peak) -> bool:
|
|
579
610
|
if len(samples) < int(0.4 * SAMPLE_RATE):
|
|
611
|
+
return False
|
|
612
|
+
speech_ms = speech_block_count * BLOCK_SECONDS * 1000.0
|
|
613
|
+
if speech_ms < float(args.min_speech_ms):
|
|
614
|
+
if env_bool("OMNIUS_ASR_VERBOSE_VAD", False):
|
|
615
|
+
emit_status(f"Dropped short VAD blob before Whisper: speech_ms={speech_ms:.0f}")
|
|
616
|
+
return False
|
|
617
|
+
if rms_values:
|
|
618
|
+
ordered = sorted(float(v) for v in rms_values)
|
|
619
|
+
loud_half = ordered[len(ordered) // 2:] or ordered
|
|
620
|
+
loud_rms = loud_half[len(loud_half) // 2]
|
|
621
|
+
else:
|
|
622
|
+
loud_rms = float(np.sqrt(np.mean(samples ** 2))) if len(samples) else 0.0
|
|
623
|
+
if loud_rms < float(args.min_utterance_rms) and peak < float(args.min_utterance_peak):
|
|
624
|
+
if env_bool("OMNIUS_ASR_VERBOSE_VAD", False):
|
|
625
|
+
emit_status(
|
|
626
|
+
f"Dropped low-energy VAD blob before Whisper: loud_rms={loud_rms:.5f} peak={peak:.5f}"
|
|
627
|
+
)
|
|
628
|
+
return False
|
|
629
|
+
return True
|
|
630
|
+
|
|
631
|
+
def transcribe_final(samples, speech_block_count=0, rms_values=None, peak=0.0):
|
|
632
|
+
nonlocal last_final_text
|
|
633
|
+
if not utterance_quality_ok(samples, speech_block_count, rms_values or [], peak):
|
|
580
634
|
return
|
|
581
635
|
samples = amplify(samples)
|
|
582
636
|
try:
|
|
@@ -612,7 +666,9 @@ def main():
|
|
|
612
666
|
last_final_text = primary_text
|
|
613
667
|
emit_transcript(primary_text, is_final=True, doa=primary_doa, consensus=True)
|
|
614
668
|
except Exception as e:
|
|
615
|
-
|
|
669
|
+
emit_consensus_rejected(primary_text, "", "validator_error")
|
|
670
|
+
if env_bool("OMNIUS_ASR_VERBOSE_CONSENSUS", False):
|
|
671
|
+
emit_status(f"Consensus validation error: {e}")
|
|
616
672
|
|
|
617
673
|
threading.Thread(
|
|
618
674
|
target=validate_consensus,
|
|
@@ -664,12 +720,18 @@ def main():
|
|
|
664
720
|
if speech:
|
|
665
721
|
capturing = True
|
|
666
722
|
silence_run = 0
|
|
723
|
+
speech_blocks = 1
|
|
724
|
+
utterance_rms_values = [block_rms]
|
|
725
|
+
utterance_peak = float(np.max(np.abs(block))) if len(block) else 0.0
|
|
667
726
|
utterance = list(preroll)
|
|
668
727
|
preroll.clear()
|
|
669
728
|
continue
|
|
670
729
|
|
|
671
730
|
utterance.append(block)
|
|
731
|
+
utterance_rms_values.append(block_rms)
|
|
732
|
+
utterance_peak = max(utterance_peak, float(np.max(np.abs(block))) if len(block) else 0.0)
|
|
672
733
|
if speech:
|
|
734
|
+
speech_blocks += 1
|
|
673
735
|
silence_run = 0
|
|
674
736
|
else:
|
|
675
737
|
silence_run += 1
|
|
@@ -677,11 +739,17 @@ def main():
|
|
|
677
739
|
utter_samples = sum(len(b) for b in utterance)
|
|
678
740
|
if silence_run >= finalize_blocks or utter_samples >= max_utter_samples:
|
|
679
741
|
samples = np.concatenate(utterance)
|
|
742
|
+
final_speech_blocks = speech_blocks
|
|
743
|
+
final_rms_values = list(utterance_rms_values)
|
|
744
|
+
final_peak = utterance_peak
|
|
680
745
|
capturing = False
|
|
681
746
|
utterance = []
|
|
682
747
|
silence_run = 0
|
|
683
|
-
|
|
684
|
-
|
|
748
|
+
speech_blocks = 0
|
|
749
|
+
utterance_rms_values = []
|
|
750
|
+
utterance_peak = 0.0
|
|
751
|
+
transcribe_final(samples, final_speech_blocks, final_rms_values, final_peak)
|
|
752
|
+
elif args.partials and utter_samples >= int(3.5 * SAMPLE_RATE) and now - last_partial_at >= 2.5:
|
|
685
753
|
last_partial_at = now
|
|
686
754
|
transcribe_partial(np.concatenate(utterance))
|
|
687
755
|
except KeyboardInterrupt:
|
|
@@ -690,7 +758,12 @@ def main():
|
|
|
690
758
|
# EOF: finalize any in-flight utterance.
|
|
691
759
|
if utterance:
|
|
692
760
|
try:
|
|
693
|
-
transcribe_final(
|
|
761
|
+
transcribe_final(
|
|
762
|
+
np.concatenate(utterance),
|
|
763
|
+
speech_blocks,
|
|
764
|
+
list(utterance_rms_values),
|
|
765
|
+
utterance_peak,
|
|
766
|
+
)
|
|
694
767
|
except Exception:
|
|
695
768
|
pass
|
|
696
769
|
if tuning is not None:
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.445",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.445",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED