omnius 1.0.443 → 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 CHANGED
@@ -118324,7 +118324,7 @@ var require_auto = __commonJS({
118324
118324
  // ../node_modules/acme-client/src/client.js
118325
118325
  var require_client = __commonJS({
118326
118326
  "../node_modules/acme-client/src/client.js"(exports, module) {
118327
- var { createHash: createHash47 } = __require("crypto");
118327
+ var { createHash: createHash48 } = __require("crypto");
118328
118328
  var { getPemBodyAsB64u } = require_crypto();
118329
118329
  var { log: log22 } = require_logger();
118330
118330
  var HttpClient = require_http();
@@ -118635,14 +118635,14 @@ var require_client = __commonJS({
118635
118635
  */
118636
118636
  async getChallengeKeyAuthorization(challenge) {
118637
118637
  const jwk = this.http.getJwk();
118638
- const keysum = createHash47("sha256").update(JSON.stringify(jwk));
118638
+ const keysum = createHash48("sha256").update(JSON.stringify(jwk));
118639
118639
  const thumbprint = keysum.digest("base64url");
118640
118640
  const result = `${challenge.token}.${thumbprint}`;
118641
118641
  if (challenge.type === "http-01") {
118642
118642
  return result;
118643
118643
  }
118644
118644
  if (challenge.type === "dns-01") {
118645
- return createHash47("sha256").update(result).digest("base64url");
118645
+ return createHash48("sha256").update(result).digest("base64url");
118646
118646
  }
118647
118647
  if (challenge.type === "tls-alpn-01") {
118648
118648
  return result;
@@ -261322,7 +261322,7 @@ var require_websocket2 = __commonJS({
261322
261322
  var http6 = __require("http");
261323
261323
  var net5 = __require("net");
261324
261324
  var tls2 = __require("tls");
261325
- var { randomBytes: randomBytes31, createHash: createHash47 } = __require("crypto");
261325
+ var { randomBytes: randomBytes31, createHash: createHash48 } = __require("crypto");
261326
261326
  var { Duplex: Duplex3, Readable } = __require("stream");
261327
261327
  var { URL: URL3 } = __require("url");
261328
261328
  var PerMessageDeflate3 = require_permessage_deflate2();
@@ -261982,7 +261982,7 @@ var require_websocket2 = __commonJS({
261982
261982
  abortHandshake(websocket, socket, "Invalid Upgrade header");
261983
261983
  return;
261984
261984
  }
261985
- const digest3 = createHash47("sha1").update(key + GUID).digest("base64");
261985
+ const digest3 = createHash48("sha1").update(key + GUID).digest("base64");
261986
261986
  if (res.headers["sec-websocket-accept"] !== digest3) {
261987
261987
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
261988
261988
  return;
@@ -262349,7 +262349,7 @@ var require_websocket_server = __commonJS({
262349
262349
  var EventEmitter15 = __require("events");
262350
262350
  var http6 = __require("http");
262351
262351
  var { Duplex: Duplex3 } = __require("stream");
262352
- var { createHash: createHash47 } = __require("crypto");
262352
+ var { createHash: createHash48 } = __require("crypto");
262353
262353
  var extension3 = require_extension2();
262354
262354
  var PerMessageDeflate3 = require_permessage_deflate2();
262355
262355
  var subprotocol3 = require_subprotocol();
@@ -262650,7 +262650,7 @@ var require_websocket_server = __commonJS({
262650
262650
  );
262651
262651
  }
262652
262652
  if (this._state > RUNNING) return abortHandshake(socket, 503);
262653
- const digest3 = createHash47("sha1").update(key + GUID).digest("base64");
262653
+ const digest3 = createHash48("sha1").update(key + GUID).digest("base64");
262654
262654
  const headers = [
262655
262655
  "HTTP/1.1 101 Switching Protocols",
262656
262656
  "Upgrade: websocket",
@@ -275457,13 +275457,13 @@ Justification: ${justification || "(none provided)"}`,
275457
275457
  }
275458
275458
  const snapshot = JSON.stringify(this.selfState, null, 2);
275459
275459
  try {
275460
- const { createHash: createHash47 } = await import("node:crypto");
275460
+ const { createHash: createHash48 } = await import("node:crypto");
275461
275461
  const snapshotDir = join44(this.cwd, ".omnius", "identity", "snapshots");
275462
275462
  await mkdir7(snapshotDir, { recursive: true });
275463
275463
  const version5 = this.selfState.version;
275464
275464
  const snapshotPath = join44(snapshotDir, `v${version5}.json`);
275465
275465
  await writeFile12(snapshotPath, snapshot, "utf8");
275466
- const hash = createHash47("sha256").update(snapshot).digest("hex");
275466
+ const hash = createHash48("sha256").update(snapshot).digest("hex");
275467
275467
  await writeFile12(join44(this.cwd, ".omnius", "identity", "latest-hash.txt"), hash, "utf8");
275468
275468
  let ipfsCid = "";
275469
275469
  try {
@@ -275596,8 +275596,8 @@ New: ${newNarrative.slice(0, 200)}...`,
275596
275596
  }
275597
275597
  // ── Helpers ──────────────────────────────────────────────────────────────
275598
275598
  createDefaultState() {
275599
- const { createHash: createHash47 } = __require("node:crypto");
275600
- const machineId = createHash47("sha256").update(this.cwd).digest("hex").slice(0, 12);
275599
+ const { createHash: createHash48 } = __require("node:crypto");
275600
+ const machineId = createHash48("sha256").update(this.cwd).digest("hex").slice(0, 12);
275601
275601
  return {
275602
275602
  self_id: `omnius-${machineId}`,
275603
275603
  version: 1,
@@ -275679,9 +275679,9 @@ New: ${newNarrative.slice(0, 200)}...`,
275679
275679
  let cid;
275680
275680
  if (this.selfState.version > prevVersion) {
275681
275681
  try {
275682
- const { createHash: createHash47 } = await import("node:crypto");
275682
+ const { createHash: createHash48 } = await import("node:crypto");
275683
275683
  const stateJson = JSON.stringify(this.selfState);
275684
- const hash = createHash47("sha256").update(stateJson).digest("hex").slice(0, 32);
275684
+ const hash = createHash48("sha256").update(stateJson).digest("hex").slice(0, 32);
275685
275685
  const cidsPath = join44(this.cwd, ".omnius", "identity", "cids.json");
275686
275686
  const cidsData = { latest: "", hash, version: this.selfState.version };
275687
275687
  try {
@@ -296247,7 +296247,7 @@ var init_working_notes = __esm({
296247
296247
  // packages/execution/dist/tools/workboard.js
296248
296248
  import { appendFileSync as appendFileSync4, existsSync as existsSync58, mkdirSync as mkdirSync32, readFileSync as readFileSync42, renameSync as renameSync6, unlinkSync as unlinkSync10, writeFileSync as writeFileSync27 } from "node:fs";
296249
296249
  import { join as join70 } from "node:path";
296250
- import { randomBytes as randomBytes16 } from "node:crypto";
296250
+ import { createHash as createHash21, randomBytes as randomBytes16 } from "node:crypto";
296251
296251
  function workboardRoot(workingDir = process.cwd()) {
296252
296252
  return join70(workingDir, ".omnius", "workboards");
296253
296253
  }
@@ -296408,7 +296408,7 @@ function replayWorkboardEvents(events) {
296408
296408
  }
296409
296409
  cards.set(card.id, {
296410
296410
  ...card,
296411
- evidence: [...card.evidence, ...event.payload.evidence.map(cloneEvidence)],
296411
+ evidence: appendUniqueEvidence(card.evidence, event.payload.evidence),
296412
296412
  updatedAt: event.createdAt
296413
296413
  });
296414
296414
  break;
@@ -296662,6 +296662,9 @@ function attachWorkboardEvidence(workingDir, input) {
296662
296662
  if (evidence.length === 0) {
296663
296663
  throw new WorkboardError("evidence_required", "at least one evidence item is required");
296664
296664
  }
296665
+ const uniqueEvidence = filterNewEvidence(card.evidence, evidence);
296666
+ if (uniqueEvidence.length === 0)
296667
+ return snapshot;
296665
296668
  const now2 = (/* @__PURE__ */ new Date()).toISOString();
296666
296669
  return appendWorkboardEvents(workingDir, runId, [{
296667
296670
  schemaVersion: WORKBOARD_SCHEMA_VERSION,
@@ -296670,7 +296673,7 @@ function attachWorkboardEvidence(workingDir, input) {
296670
296673
  type: "evidence.attached",
296671
296674
  createdAt: now2,
296672
296675
  actor: cleanString(input.actor),
296673
- payload: { cardId: card.id, evidence }
296676
+ payload: { cardId: card.id, evidence: uniqueEvidence }
296674
296677
  }]);
296675
296678
  }
296676
296679
  function completeWorkboardCard(workingDir, input) {
@@ -296696,8 +296699,9 @@ function completeWorkboardCard(workingDir, input) {
296696
296699
  const now2 = (/* @__PURE__ */ new Date()).toISOString();
296697
296700
  if (outcome === "request_changes") {
296698
296701
  const evidence2 = input.evidence === void 0 ? [] : normalizeEvidenceCollection(input.evidence, input.actor);
296702
+ const uniqueEvidence2 = evidence2.length > 0 ? filterNewEvidence(card.evidence, evidence2) : [];
296699
296703
  const events = [];
296700
- if (evidence2.length > 0) {
296704
+ if (uniqueEvidence2.length > 0) {
296701
296705
  events.push({
296702
296706
  schemaVersion: WORKBOARD_SCHEMA_VERSION,
296703
296707
  id: newEventId("evidence"),
@@ -296705,7 +296709,7 @@ function completeWorkboardCard(workingDir, input) {
296705
296709
  type: "evidence.attached",
296706
296710
  createdAt: now2,
296707
296711
  actor: cleanString(input.actor),
296708
- payload: { cardId: card.id, evidence: evidence2 }
296712
+ payload: { cardId: card.id, evidence: uniqueEvidence2 }
296709
296713
  });
296710
296714
  }
296711
296715
  const missingEvidence = normalizeStringArray(input.missingEvidence);
@@ -296770,7 +296774,8 @@ function completeWorkboardCard(workingDir, input) {
296770
296774
  }
296771
296775
  const evidence = input.evidence === void 0 ? [] : normalizeEvidenceCollection(input.evidence, input.actor);
296772
296776
  let evidenceSnapshot = snapshot;
296773
- if (evidence.length > 0) {
296777
+ const uniqueEvidence = evidence.length > 0 ? filterNewEvidence(card.evidence, evidence) : [];
296778
+ if (uniqueEvidence.length > 0) {
296774
296779
  evidenceSnapshot = appendWorkboardEvents(workingDir, runId, [{
296775
296780
  schemaVersion: WORKBOARD_SCHEMA_VERSION,
296776
296781
  id: newEventId("evidence"),
@@ -296778,7 +296783,7 @@ function completeWorkboardCard(workingDir, input) {
296778
296783
  type: "evidence.attached",
296779
296784
  createdAt: now2,
296780
296785
  actor: cleanString(input.actor),
296781
- payload: { cardId: card.id, evidence }
296786
+ payload: { cardId: card.id, evidence: uniqueEvidence }
296782
296787
  }]);
296783
296788
  }
296784
296789
  const currentCard = evidenceSnapshot.cards.find((existing) => existing.id === card.id) ?? card;
@@ -297281,6 +297286,46 @@ function cloneEvidence(evidence) {
297281
297286
  verifies: evidence.verifies ? [...evidence.verifies] : void 0
297282
297287
  };
297283
297288
  }
297289
+ function appendUniqueEvidence(existing, incoming) {
297290
+ const seen = new Set(existing.map(evidenceFingerprint));
297291
+ const next = existing.map(cloneEvidence);
297292
+ for (const item of incoming) {
297293
+ const fingerprint = evidenceFingerprint(item);
297294
+ if (seen.has(fingerprint))
297295
+ continue;
297296
+ seen.add(fingerprint);
297297
+ next.push(cloneEvidence(item));
297298
+ }
297299
+ return next;
297300
+ }
297301
+ function filterNewEvidence(existing, incoming) {
297302
+ const seen = new Set(existing.map(evidenceFingerprint));
297303
+ const next = [];
297304
+ for (const item of incoming) {
297305
+ const fingerprint = evidenceFingerprint(item);
297306
+ if (seen.has(fingerprint))
297307
+ continue;
297308
+ seen.add(fingerprint);
297309
+ next.push(cloneEvidence(item));
297310
+ }
297311
+ return next;
297312
+ }
297313
+ function evidenceFingerprint(evidence) {
297314
+ const contentDigest = createHash21("sha256").update(evidence.content ?? "").digest("hex");
297315
+ const key = {
297316
+ kind: evidence.kind,
297317
+ summary: evidence.summary,
297318
+ tool: evidence.tool,
297319
+ command: evidence.command,
297320
+ ref: evidence.ref,
297321
+ path: evidence.path,
297322
+ url: evidence.url,
297323
+ message: evidence.message,
297324
+ verifies: [...evidence.verifies ?? []].sort(),
297325
+ contentDigest
297326
+ };
297327
+ return createHash21("sha256").update(JSON.stringify(key)).digest("hex");
297328
+ }
297284
297329
  function cleanString(value2) {
297285
297330
  return typeof value2 === "string" && value2.trim() ? value2.trim() : void 0;
297286
297331
  }
@@ -298546,13 +298591,29 @@ Mark tasks complete IMMEDIATELY after finishing — don't batch. Never mark comp
298546
298591
  durationMs: performance.now() - start2
298547
298592
  };
298548
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
+ }
298549
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();
298550
298609
  const oldTodos = readTodos(sessionId);
298551
298610
  const canonicalize2 = (todos) => JSON.stringify(todos.map((t2) => ({
298552
298611
  content: t2.content,
298553
298612
  status: t2.status,
298554
298613
  parentId: t2.parentId ?? null,
298555
- blocker: t2.blocker ?? null
298614
+ blocker: t2.blocker ?? null,
298615
+ verifyCommand: t2.verifyCommand ?? null,
298616
+ declaredArtifacts: Array.isArray(t2.declaredArtifacts) ? [...t2.declaredArtifacts].sort() : null
298556
298617
  })));
298557
298618
  const oldKey = canonicalize2(oldTodos);
298558
298619
  const newKey = canonicalize2(incoming);
@@ -298562,8 +298623,10 @@ Mark tasks complete IMMEDIATELY after finishing — don't batch. Never mark comp
298562
298623
  output: JSON.stringify({
298563
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.",
298564
298625
  todos: oldTodos,
298565
- noop: true
298626
+ noop: true,
298627
+ noProgress: true
298566
298628
  }),
298629
+ noop: true,
298567
298630
  durationMs: performance.now() - start2
298568
298631
  };
298569
298632
  }
@@ -299118,7 +299181,7 @@ var init_import_graph = __esm({
299118
299181
  import { createRequire as __createRequireGlob } from "node:module";
299119
299182
  import ignore from "ignore";
299120
299183
  import { readFile as readFile22, stat as stat8 } from "node:fs/promises";
299121
- import { createHash as createHash21 } from "node:crypto";
299184
+ import { createHash as createHash22 } from "node:crypto";
299122
299185
  import { join as join73, relative as relative6, extname as extname10, basename as basename14 } from "node:path";
299123
299186
  var __requireGlob, glob2, DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
299124
299187
  var init_codebase_indexer = __esm({
@@ -299186,7 +299249,7 @@ var init_codebase_indexer = __esm({
299186
299249
  if (fileStat.size > this.config.maxFileSize)
299187
299250
  continue;
299188
299251
  const content = await readFile22(fullPath);
299189
- const hash = createHash21("sha256").update(content).digest("hex");
299252
+ const hash = createHash22("sha256").update(content).digest("hex");
299190
299253
  const ext = extname10(relativePath);
299191
299254
  indexed.push({
299192
299255
  path: fullPath,
@@ -543498,7 +543561,7 @@ var init_ts_morph_parser = __esm({
543498
543561
 
543499
543562
  // packages/indexer/dist/code-graph-db.js
543500
543563
  import { createRequire as createRequire4 } from "node:module";
543501
- import { createHash as createHash22 } from "node:crypto";
543564
+ import { createHash as createHash23 } from "node:crypto";
543502
543565
  import { mkdirSync as mkdirSync34, readFileSync as readFileSync45 } from "node:fs";
543503
543566
  import { join as join74, dirname as dirname20, extname as extname11 } from "node:path";
543504
543567
  function loadDatabaseCtor() {
@@ -543570,7 +543633,7 @@ function extractFileImports(content, filePath) {
543570
543633
  return imports.map((p2) => p2.replace(/\.(js|ts|jsx|tsx|mjs|cjs)$/, ""));
543571
543634
  }
543572
543635
  function hashContent2(content) {
543573
- return createHash22("sha1").update(content).digest("hex").slice(0, 16);
543636
+ return createHash23("sha1").update(content).digest("hex").slice(0, 16);
543574
543637
  }
543575
543638
  function detectLanguage(filePath) {
543576
543639
  return EXT_TO_LANG[extname11(filePath)] ?? "unknown";
@@ -553136,7 +553199,7 @@ var init_client3 = __esm({
553136
553199
  import { existsSync as existsSync72, readFileSync as readFileSync52, writeFileSync as writeFileSync35, mkdirSync as mkdirSync44, chmodSync, statSync as statSync28 } from "node:fs";
553137
553200
  import { join as join85, dirname as dirname23 } from "node:path";
553138
553201
  import { homedir as homedir23 } from "node:os";
553139
- import { randomBytes as randomBytes19, createHash as createHash23 } from "node:crypto";
553202
+ import { randomBytes as randomBytes19, createHash as createHash24 } from "node:crypto";
553140
553203
  function secretsPath(scope, repoRoot) {
553141
553204
  return scope === "global" ? join85(homedir23(), ".omnius", "secrets.json") : join85(repoRoot, ".omnius", "secrets.json");
553142
553205
  }
@@ -553177,7 +553240,7 @@ function sanitizeHint(hint) {
553177
553240
  return hint.toUpperCase().replace(/[^A-Z0-9]+/g, "_").replace(/^_+|_+$/g, "").slice(0, 32) || "GENERIC";
553178
553241
  }
553179
553242
  function shortDigest(value2) {
553180
- return createHash23("sha256").update(value2).digest("hex").slice(0, 6);
553243
+ return createHash24("sha256").update(value2).digest("hex").slice(0, 6);
553181
553244
  }
553182
553245
  function randomSuffix() {
553183
553246
  return randomBytes19(3).toString("hex");
@@ -554991,7 +555054,7 @@ var init_environment_snapshot = __esm({
554991
555054
  import { existsSync as existsSync76, mkdirSync as mkdirSync46, writeFileSync as writeFileSync38, readFileSync as readFileSync56, readdirSync as readdirSync26, unlinkSync as unlinkSync16, rmSync as rmSync9 } from "node:fs";
554992
555055
  import { join as join88, basename as basename17, isAbsolute as isAbsolute6, resolve as resolve44 } from "node:path";
554993
555056
  import { homedir as homedir26 } from "node:os";
554994
- import { createHash as createHash24 } from "node:crypto";
555057
+ import { createHash as createHash25 } from "node:crypto";
554995
555058
  function isYouTubeUrl2(url) {
554996
555059
  return /(?:youtube\.com\/(?:watch|shorts|live|embed|v\/)|youtu\.be\/)/i.test(url);
554997
555060
  }
@@ -555076,7 +555139,7 @@ async function extractAudioIfPresent(videoPath, audioPath, probe) {
555076
555139
  function imageHash(imagePath) {
555077
555140
  try {
555078
555141
  const data = readFileSync56(imagePath);
555079
- return createHash24("md5").update(data).digest("hex").slice(0, 12);
555142
+ return createHash25("md5").update(data).digest("hex").slice(0, 12);
555080
555143
  } catch {
555081
555144
  return "unknown";
555082
555145
  }
@@ -565440,7 +565503,10 @@ var init_ollama_pool = __esm({
565440
565503
  }
565441
565504
  /** Synchronous routing decision; returns the instance or null if every one is saturated. */
565442
565505
  pickInstance(opts) {
565443
- const candidates = this.instances.filter((inst) => !this.isEffectivelySaturated(inst) && !(this.activePlacementMode === "dedicated" && this.dedicatedGpuPoolActive && !inst.state.poolOwned && !opts.preferBaseInstance));
565506
+ const candidates = this.instances.filter((inst) => {
565507
+ const baseResidentDedicatedModel = this.activePlacementMode === "dedicated" && this.dedicatedGpuPoolActive && !inst.state.poolOwned && inst.state.knownModels.has(opts.model) && !this.allowDuplicateBaseModelResident();
565508
+ return !this.isEffectivelySaturated(inst) && !(this.activePlacementMode === "dedicated" && this.dedicatedGpuPoolActive && !inst.state.poolOwned && !opts.preferBaseInstance && !baseResidentDedicatedModel);
565509
+ });
565444
565510
  if (candidates.length === 0)
565445
565511
  return null;
565446
565512
  const affinityTargetId = opts.agentId ? this.affinityById.get(opts.agentId) : void 0;
@@ -565561,7 +565627,12 @@ var init_ollama_pool = __esm({
565561
565627
  await this.withSpawnGate(async () => {
565562
565628
  if (!this.canSpawnWithSharedModelStore(model))
565563
565629
  return;
565564
- const target = this.dedicatedTargetCount(gpus);
565630
+ const baseInstance = this.instances.find((i2) => !i2.state.poolOwned);
565631
+ const baseResidentModel = baseInstance !== void 0 && !this.allowDuplicateBaseModelResident() && await this.isModelLoadedOnInstance(baseInstance, model);
565632
+ if (baseResidentModel && baseInstance) {
565633
+ baseInstance.state.knownModels.add(model);
565634
+ }
565635
+ const target = Math.max(0, this.dedicatedTargetCount(gpus) - (baseResidentModel ? 1 : 0));
565565
565636
  const vramNeededMB = await this.estimateModelVramMB(model);
565566
565637
  while (this.instances.filter((i2) => i2.state.poolOwned).length < target) {
565567
565638
  const candidates = this.gpusWithCapacityForModel(gpus, vramNeededMB);
@@ -565625,6 +565696,10 @@ var init_ollama_pool = __esm({
565625
565696
  const cappedByGpuCount = Math.min(requested, gpus.length);
565626
565697
  return this.config.maxSpawnedInstances > 0 ? Math.min(cappedByGpuCount, this.config.maxSpawnedInstances) : cappedByGpuCount;
565627
565698
  }
565699
+ allowDuplicateBaseModelResident() {
565700
+ const raw = process.env["OMNIUS_OLLAMA_DUPLICATE_BASE_MODEL"] ?? process.env["OMNIUS_OLLAMA_ALLOW_BASE_DUPLICATE"] ?? "";
565701
+ return /^(1|true|yes|on)$/i.test(raw.trim());
565702
+ }
565628
565703
  elasticSpawnCap(gpus) {
565629
565704
  return this.config.maxSpawnedInstances > 0 ? this.config.maxSpawnedInstances : Math.max(0, gpus.length - 1);
565630
565705
  }
@@ -565898,6 +565973,38 @@ var init_ollama_pool = __esm({
565898
565973
  }
565899
565974
  this.instances = survivors;
565900
565975
  }
565976
+ /**
565977
+ * Probe `/api/ps` on an instance and return true when the requested model is
565978
+ * already resident there. This lets dedicated placement reuse an externally
565979
+ * managed base service instead of loading the same large model twice.
565980
+ */
565981
+ async isModelLoadedOnInstance(inst, model) {
565982
+ try {
565983
+ const url = `${inst.state.baseUrl.replace(/\/+$/, "")}/api/ps`;
565984
+ const resp = await fetch(url, { signal: AbortSignal.timeout(2e3) });
565985
+ if (!resp.ok)
565986
+ return false;
565987
+ const data = await resp.json();
565988
+ if (!Array.isArray(data.models))
565989
+ return false;
565990
+ return data.models.some((resident) => this.modelNamesMatch(model, resident.name ?? resident.model ?? ""));
565991
+ } catch {
565992
+ return false;
565993
+ }
565994
+ }
565995
+ modelNamesMatch(requested, resident) {
565996
+ const req3 = requested.trim();
565997
+ const res = resident.trim();
565998
+ if (!req3 || !res)
565999
+ return false;
566000
+ if (req3 === res)
566001
+ return true;
566002
+ if (!req3.includes(":") && res.startsWith(`${req3}:`))
566003
+ return true;
566004
+ if (!res.includes(":") && req3.startsWith(`${res}:`))
566005
+ return true;
566006
+ return false;
566007
+ }
565901
566008
  /**
565902
566009
  * Probe `/api/ps` on the instance and return true if any resident model has
565903
566010
  * less than 95% of its weights in VRAM — the unmistakable CPU-offload
@@ -566129,7 +566236,7 @@ function evaluate2(inputs) {
566129
566236
  compacted: cached?.compacted
566130
566237
  };
566131
566238
  }
566132
- const cacheEligible = isReadLike || proposedCall.tool === "shell" || proposedCall.tool === "memory_write";
566239
+ const cacheEligible = isReadLike || proposedCall.tool === "shell" || proposedCall.tool === "memory_write" || NOOP_WRITE_CACHE_TOOLS.has(proposedCall.tool);
566133
566240
  if (cacheEligible) {
566134
566241
  const cached = recentToolResults.get(fingerprint);
566135
566242
  if (cached !== void 0) {
@@ -566195,9 +566302,16 @@ function isStagnant(signals, opts) {
566195
566302
  return false;
566196
566303
  return signals.completedDelta <= 0 && signals.filesDelta < filesDeltaMin && signals.failureSum >= failureThreshold && signals.variantCount >= variantThreshold;
566197
566304
  }
566305
+ var NOOP_WRITE_CACHE_TOOLS;
566198
566306
  var init_critic = __esm({
566199
566307
  "packages/orchestrator/dist/critic.js"() {
566200
566308
  "use strict";
566309
+ NOOP_WRITE_CACHE_TOOLS = /* @__PURE__ */ new Set([
566310
+ "file_write",
566311
+ "file_edit",
566312
+ "batch_edit",
566313
+ "file_patch"
566314
+ ]);
566201
566315
  }
566202
566316
  });
566203
566317
 
@@ -566557,14 +566671,14 @@ var init_artifact_inspector = __esm({
566557
566671
  // packages/orchestrator/dist/lesson-bank.js
566558
566672
  import { existsSync as existsSync90, mkdirSync as mkdirSync52, appendFileSync as appendFileSync7, readFileSync as readFileSync69 } from "node:fs";
566559
566673
  import { join as join101, dirname as dirname30 } from "node:path";
566560
- import { createHash as createHash25 } from "node:crypto";
566674
+ import { createHash as createHash26 } from "node:crypto";
566561
566675
  function tokenize4(text2) {
566562
566676
  if (!text2)
566563
566677
  return [];
566564
566678
  return text2.toLowerCase().split(TOKENIZE_RE).filter((t2) => t2.length >= 3).slice(0, 80);
566565
566679
  }
566566
566680
  function shortHash(s2) {
566567
- return createHash25("sha256").update(s2).digest("hex").slice(0, 16);
566681
+ return createHash26("sha256").update(s2).digest("hex").slice(0, 16);
566568
566682
  }
566569
566683
  function solicit(args) {
566570
566684
  const { taskGoal, stem, reflections, successOutputPreview } = args;
@@ -566660,7 +566774,7 @@ var init_lesson_bank = __esm({
566660
566774
  // packages/orchestrator/dist/intervention-replay.js
566661
566775
  import { existsSync as existsSync91, mkdirSync as mkdirSync53, readFileSync as readFileSync70, writeFileSync as writeFileSync43, readdirSync as readdirSync29 } from "node:fs";
566662
566776
  import { join as join102, dirname as dirname31 } from "node:path";
566663
- import { createHash as createHash26 } from "node:crypto";
566777
+ import { createHash as createHash27 } from "node:crypto";
566664
566778
  function checkpointDir2(workingDir) {
566665
566779
  return workingDir ? join102(workingDir, ".omnius", "checkpoints") : join102(process.env["HOME"] || ".", ".omnius", "checkpoints");
566666
566780
  }
@@ -566694,7 +566808,7 @@ function sanitizeMessagesForCheckpoint(messages2) {
566694
566808
  deduped.push(m2);
566695
566809
  continue;
566696
566810
  }
566697
- const digest3 = createHash26("sha1").update(content).digest("hex");
566811
+ const digest3 = createHash27("sha1").update(content).digest("hex");
566698
566812
  if (seenSystemDigests.has(digest3))
566699
566813
  continue;
566700
566814
  seenSystemDigests.add(digest3);
@@ -572633,6 +572747,7 @@ var init_context_fabric = __esm({
572633
572747
  "use strict";
572634
572748
  PRIORITY = {
572635
572749
  GOAL: 100,
572750
+ ACTION_CONTRACT: 98,
572636
572751
  USER_STEERING: 95,
572637
572752
  TASK_STATE: 80,
572638
572753
  KNOWN_FILES: 70,
@@ -572650,6 +572765,7 @@ var init_context_fabric = __esm({
572650
572765
  KIND_ORDER = [
572651
572766
  "goal",
572652
572767
  "user_steering",
572768
+ "action_contract",
572653
572769
  "task_state",
572654
572770
  "known_files",
572655
572771
  "recent_failure",
@@ -572666,6 +572782,7 @@ var init_context_fabric = __esm({
572666
572782
  KIND_LABELS = {
572667
572783
  goal: "Goal",
572668
572784
  user_steering: "User Steering",
572785
+ action_contract: "Next Action Contract",
572669
572786
  task_state: "Task State",
572670
572787
  known_files: "Known Files",
572671
572788
  recent_failure: "Recent Failures",
@@ -572682,6 +572799,7 @@ var init_context_fabric = __esm({
572682
572799
  DEFAULT_KIND_CHAR_BUDGET = {
572683
572800
  goal: 900,
572684
572801
  user_steering: 1400,
572802
+ action_contract: 1800,
572685
572803
  task_state: 1800,
572686
572804
  known_files: 2400,
572687
572805
  recent_failure: 2600,
@@ -573035,7 +573153,7 @@ var init_evidenceLedger = __esm({
573035
573153
  import { existsSync as existsSync100, mkdirSync as mkdirSync58, readdirSync as readdirSync32, readFileSync as readFileSync78, statSync as statSync36, unlinkSync as unlinkSync17, writeFileSync as writeFileSync48, appendFileSync as appendFileSync9 } from "node:fs";
573036
573154
  import { homedir as homedir35 } from "node:os";
573037
573155
  import { join as join111, resolve as resolve51 } from "node:path";
573038
- import { createHash as createHash27 } from "node:crypto";
573156
+ import { createHash as createHash28 } from "node:crypto";
573039
573157
  function contextWindowDumpDir(cwd4 = process.cwd()) {
573040
573158
  const envDir = process.env["OMNIUS_CONTEXT_WINDOW_DUMP_DIR"]?.trim();
573041
573159
  if (envDir)
@@ -573268,7 +573386,7 @@ function safeId(value2) {
573268
573386
  return String(value2 || "unknown").replace(/[^a-zA-Z0-9_.:-]/g, "_").slice(0, 160);
573269
573387
  }
573270
573388
  function shortHash2(value2) {
573271
- return createHash27("sha256").update(value2).digest("hex").slice(0, 10);
573389
+ return createHash28("sha256").update(value2).digest("hex").slice(0, 10);
573272
573390
  }
573273
573391
  function pruneOldDumpFiles(dir) {
573274
573392
  const raw = Number(process.env["OMNIUS_CONTEXT_WINDOW_DUMP_MAX_FILES"]);
@@ -573645,7 +573763,7 @@ var init_adversaryStream = __esm({
573645
573763
 
573646
573764
  // packages/orchestrator/dist/debugArtifactLibrary.js
573647
573765
  import { appendFileSync as appendFileSync10, existsSync as existsSync101, mkdirSync as mkdirSync59, readFileSync as readFileSync79, statSync as statSync37, writeFileSync as writeFileSync49 } from "node:fs";
573648
- import { createHash as createHash28 } from "node:crypto";
573766
+ import { createHash as createHash29 } from "node:crypto";
573649
573767
  import { basename as basename23, join as join112, relative as relative10, resolve as resolve52 } from "node:path";
573650
573768
  function debugArtifactRoot(cwd4 = process.cwd(), stateDir) {
573651
573769
  const envDir = process.env["OMNIUS_DEBUG_ARTIFACT_DIR"]?.trim();
@@ -574269,7 +574387,7 @@ function safeId2(value2) {
574269
574387
  return String(value2 || "unknown").replace(/[^a-zA-Z0-9_.:-]/g, "_").slice(0, 160);
574270
574388
  }
574271
574389
  function shortHash3(value2) {
574272
- return createHash28("sha256").update(value2).digest("hex").slice(0, 10);
574390
+ return createHash29("sha256").update(value2).digest("hex").slice(0, 10);
574273
574391
  }
574274
574392
  var DEBUG_LIBRARY_DIR, RUN_EVENTS_LIMIT, PREVIEW_LIMIT;
574275
574393
  var init_debugArtifactLibrary = __esm({
@@ -574619,6 +574737,11 @@ var init_focusSupervisor = __esm({
574619
574737
  return;
574620
574738
  }
574621
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
+ }
574622
574745
  this.clearSatisfiedDirective("todo plan updated", input.turn);
574623
574746
  return;
574624
574747
  }
@@ -575754,7 +575877,7 @@ __export(preflightSnapshot_exports, {
575754
575877
  import { existsSync as existsSync102, readFileSync as readFileSync80, statSync as statSync38, statfsSync as statfsSync6 } from "node:fs";
575755
575878
  import { homedir as homedir36, platform as platform4, arch as arch2, totalmem as totalmem4, freemem as freemem3, hostname as hostname3 } from "node:os";
575756
575879
  import { join as join113 } from "node:path";
575757
- import { createHash as createHash29 } from "node:crypto";
575880
+ import { createHash as createHash30 } from "node:crypto";
575758
575881
  function capturePreflightSnapshot(workingDir) {
575759
575882
  const warnings = [];
575760
575883
  const configFingerprints = {};
@@ -575923,7 +576046,7 @@ function expandPath(p2) {
575923
576046
  return p2;
575924
576047
  }
575925
576048
  function sha2564(s2) {
575926
- return createHash29("sha256").update(s2).digest("hex").slice(0, 16);
576049
+ return createHash30("sha256").update(s2).digest("hex").slice(0, 16);
575927
576050
  }
575928
576051
  function freeDiskBytes(path12 = "/tmp") {
575929
576052
  try {
@@ -578208,21 +578331,239 @@ ${parts.join("\n")}
578208
578331
  }
578209
578332
  return null;
578210
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
+ }
578211
578548
  /**
578212
578549
  * Record evidence from a tool call against the active workboard.
578213
578550
  * Matches by card assignee when the card is in progress.
578214
578551
  * Non-fatal: failures to attach evidence are silently caught.
578215
578552
  */
578216
- recordWorkboardToolCall(toolName, args, success, output) {
578553
+ recordWorkboardToolCall(toolName, args, success, output, result) {
578217
578554
  const board = this._workboard ?? this.getOrCreateWorkboard();
578218
578555
  if (!board)
578219
578556
  return;
578220
578557
  if (toolName === "task_complete" || toolName === "workboard_create")
578221
578558
  return;
578559
+ if (result?.success === true && this._isProjectEditTool(toolName) && !this._isRealProjectMutation(toolName, result)) {
578560
+ return;
578561
+ }
578222
578562
  const dir = this._workboardDir();
578223
578563
  try {
578224
578564
  const evidenceSummary = `${toolName} ${success ? "ok" : "fail"}`;
578225
- const evidenceContent = (success ? typeof output === "string" ? output : "" : "").slice(0, 1e3);
578565
+ const rawEvidenceOutput = typeof output === "string" && output.length > 0 ? output : result?.output || result?.error || "";
578566
+ const evidenceContent = rawEvidenceOutput.slice(0, 1e3);
578226
578567
  const evidence = {
578227
578568
  kind: "tool_result",
578228
578569
  summary: evidenceSummary,
@@ -578232,24 +578573,23 @@ ${parts.join("\n")}
578232
578573
  ref: typeof args["path"] === "string" ? args["path"]?.slice(0, 200) : void 0
578233
578574
  };
578234
578575
  const actor = this.options.subAgent ? "sub-agent" : "agent";
578235
- for (const card of board.cards) {
578236
- if (card.status !== "in_progress" && card.status !== "open")
578237
- continue;
578238
- if (card.assignee && card.assignee !== actor && card.assignee !== "any")
578239
- continue;
578240
- if (toolName === "shell" && !card.evidenceRequirements.some((r2) => r2.toLowerCase().includes("shell") || r2.toLowerCase().includes("build") || r2.toLowerCase().includes("test")))
578241
- continue;
578242
- if (toolName === "file_write" && !card.evidenceRequirements.some((r2) => r2.toLowerCase().includes("file") || r2.toLowerCase().includes("write") || r2.toLowerCase().includes("implement")))
578243
- continue;
578244
- if (toolName === "file_read" && !card.evidenceRequirements.some((r2) => r2.toLowerCase().includes("read") || r2.toLowerCase().includes("explor") || r2.toLowerCase().includes("understand")))
578245
- continue;
578246
- attachWorkboardEvidence(dir, {
578247
- runId: this._sessionId,
578248
- cardId: card.id,
578249
- actor,
578250
- evidence
578251
- });
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;
578252
578585
  }
578586
+ attachWorkboardEvidence(dir, {
578587
+ runId: this._sessionId,
578588
+ cardId: targetCard.id,
578589
+ actor,
578590
+ evidence
578591
+ });
578592
+ this._refreshWorkboardSnapshot(advanced);
578253
578593
  } catch {
578254
578594
  }
578255
578595
  }
@@ -579714,6 +580054,21 @@ Pick the SMALLEST concrete deliverable from the spec — typically the project e
579714
580054
  return false;
579715
580055
  return true;
579716
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
+ }
579717
580072
  _toolEvidencePreview(result, displayOutput, max = 500, toolName) {
579718
580073
  const modelVisible = result.llmContent ?? result.output ?? displayOutput ?? "";
579719
580074
  const failurePrefix = result.success === false && result.error ? `Error: ${result.error}` : "";
@@ -579799,6 +580154,9 @@ ${modelVisible}` : modelVisible || result.error || displayOutput || "";
579799
580154
  const realFileMutation = input.realFileMutation ?? this._isRealProjectMutation(input.toolName, input.result);
579800
580155
  const attemptedTargetPaths = this._extractToolTargetPaths(input.toolName, input.args, input.result);
579801
580156
  const realMutationPaths = input.realMutationPaths ?? (realFileMutation ? attemptedTargetPaths : []);
580157
+ if (input.result.success === true && this._isProjectEditTool(input.toolName) && !realFileMutation) {
580158
+ return;
580159
+ }
579802
580160
  if (this._shouldSuppressCompletionDiscoveryEvidence(input.toolName, input.result, attemptedTargetPaths)) {
579803
580161
  return;
579804
580162
  }
@@ -582432,6 +582790,7 @@ ${chunk.content}`, {
582432
582790
  const failureBlock = this._renderRecentFailuresBlock(turn);
582433
582791
  const churnBlock = this._renderWriteChurnBlock(turn);
582434
582792
  const focusBlock = this._focusSupervisor?.renderFrame() ?? null;
582793
+ const actionContractBlock = this._renderNextActionContract(turn);
582435
582794
  const toolCacheBlock = recentToolResults ? this._renderKnowledgeBlock(recentToolResults) : null;
582436
582795
  const anchorsBlock = this.surfaceAnchors(messages2);
582437
582796
  const pprMemoryBlock = this._lastPprMemoryLines.length > 0 ? `[Associative Memory - related prior experience]
@@ -582469,6 +582828,13 @@ ${this._lastPprMemoryLines.slice(0, 5).join("\n")}` : null;
582469
582828
  createdTurn: turn,
582470
582829
  ttlTurns: 1
582471
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
+ }),
582472
582838
  signalFromBlock("task_state", "turn.todos", todoBlock, {
582473
582839
  id: "todo-state",
582474
582840
  dedupeKey: "turn.todos",
@@ -584430,6 +584796,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
584430
584796
  const recentToolResults = /* @__PURE__ */ new Map();
584431
584797
  const dedupHitCount = /* @__PURE__ */ new Map();
584432
584798
  const noopedMemoryWriteFingerprints = /* @__PURE__ */ new Set();
584799
+ const noopedProjectWriteFingerprints = /* @__PURE__ */ new Set();
584433
584800
  const DEDUP_ESCALATION_THRESHOLD = 3;
584434
584801
  const toolCallBudget = /* @__PURE__ */ new Map();
584435
584802
  const loopTier = this.options.modelTier ?? "large";
@@ -586073,8 +586440,8 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
586073
586440
  if (process.env["OMNIUS_DISABLE_ADAPTIVE_RETRIEVAL"] !== "1") {
586074
586441
  const goalForSig = (this._taskState.goal || "").slice(0, 200);
586075
586442
  const recentTools = this._toolSequence.slice(-5).join("|");
586076
- const { createHash: createHash47 } = await import("node:crypto");
586077
- const sig = createHash47("sha256").update(`${goalForSig}::${recentTools}`).digest("hex").slice(0, 16);
586443
+ const { createHash: createHash48 } = await import("node:crypto");
586444
+ const sig = createHash48("sha256").update(`${goalForSig}::${recentTools}`).digest("hex").slice(0, 16);
586078
586445
  if (this._lastPprSig === sig && this._lastPprMemoryLines.length > 0) {
586079
586446
  compacted.push({
586080
586447
  role: "system",
@@ -587019,7 +587386,9 @@ Corrective action: try a different approach first: read relevant files, adjust a
587019
587386
  }
587020
587387
  const exactToolFingerprint = this._buildToolFingerprint(tc.name, tc.arguments ?? {});
587021
587388
  const toolFingerprint = this._resolveReadCoverageFingerprint(tc.name, tc.arguments ?? {}, exactToolFingerprint);
587022
- if (tc.name === "memory_write" && noopedMemoryWriteFingerprints.has(toolFingerprint)) {
587389
+ const repeatedMemoryWriteNoop = tc.name === "memory_write" && noopedMemoryWriteFingerprints.has(toolFingerprint);
587390
+ const repeatedProjectWriteNoop = this._isProjectEditTool(tc.name) && noopedProjectWriteFingerprints.has(toolFingerprint);
587391
+ if (repeatedMemoryWriteNoop || repeatedProjectWriteNoop) {
587023
587392
  this.emit({
587024
587393
  type: "tool_call",
587025
587394
  toolName: tc.name,
@@ -587027,9 +587396,11 @@ Corrective action: try a different approach first: read relevant files, adjust a
587027
587396
  turn,
587028
587397
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
587029
587398
  });
587030
- const repeatNoopMsg = `[MEMORY WRITE NO-OP REPEAT BLOCK] Exact repeat of memory_write(${JSON.stringify(tc.arguments ?? {}).slice(0, 200)}).
587399
+ const repeatNoopMsg = repeatedMemoryWriteNoop ? `[MEMORY WRITE NO-OP REPEAT BLOCK] Exact repeat of memory_write(${JSON.stringify(tc.arguments ?? {}).slice(0, 200)}).
587031
587400
  This same topic/key/value was already confirmed stored, so the call was not executed again.
587032
- Use the saved fact to continue the promised synthesis or next concrete step, or call task_complete if this bookkeeping was the final step.`;
587401
+ Use the saved fact to continue the promised synthesis or next concrete step, or call task_complete if this bookkeeping was the final step.` : `[PROJECT WRITE NO-OP REPEAT BLOCK] Exact repeat of ${tc.name}(${JSON.stringify(tc.arguments ?? {}).slice(0, 200)}).
587402
+ This edit was already confirmed to make no file change, so the call was not executed again.
587403
+ Read the current file if needed, make a different concrete edit, or move to verification/completion.`;
587033
587404
  this.emit({
587034
587405
  type: "tool_result",
587035
587406
  toolName: tc.name,
@@ -587040,7 +587411,7 @@ Use the saved fact to continue the promised synthesis or next concrete step, or
587040
587411
  });
587041
587412
  this._tagSyntheticFailure({
587042
587413
  mode: "step_repetition",
587043
- rationale: "memory_write retried after an exact no-op was observed"
587414
+ rationale: repeatedMemoryWriteNoop ? "memory_write retried after an exact no-op was observed" : `${tc.name} retried after an exact project-write no-op was observed`
587044
587415
  });
587045
587416
  return {
587046
587417
  tc,
@@ -587739,7 +588110,7 @@ Respond with EXACTLY this structure before your next tool call:
587739
588110
  }
587740
588111
  }
587741
588112
  }
587742
- if (tc.name === "todo_write" && result.success) {
588113
+ if (tc.name === "todo_write" && result.success && !this._isTodoWriteNoopResult(result)) {
587743
588114
  if (this._progressGateActive) {
587744
588115
  this.emit({
587745
588116
  type: "status",
@@ -588322,7 +588693,7 @@ Respond with EXACTLY this structure before your next tool call:
588322
588693
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
588323
588694
  });
588324
588695
  }
588325
- if (!this._newFieldNudgeFired) {
588696
+ if (!this._newFieldNudgeFired && !this._isTodoWriteNoopResult(result)) {
588326
588697
  this._todoWritesObservedForNudge++;
588327
588698
  const _anyFieldUsed = _todosNow.some((t2) => typeof t2.verifyCommand === "string" || Array.isArray(t2.declaredArtifacts));
588328
588699
  if (this._todoWritesObservedForNudge >= 2 && !_anyFieldUsed) {
@@ -588444,7 +588815,8 @@ Respond with EXACTLY this structure before your next tool call:
588444
588815
  }
588445
588816
  }
588446
588817
  const cacheableMemoryNoop = tc.name === "memory_write" && result.success && result.noop;
588447
- if (isReadLike && result.success || tc.name === "shell" || cacheableMemoryNoop) {
588818
+ const cacheableProjectWriteNoop = this._isProjectEditTool(tc.name) && result.success && !this._isRealProjectMutation(tc.name, result) && (result.noop === true || result.mutated === false);
588819
+ if (isReadLike && result.success || tc.name === "shell" || cacheableMemoryNoop || cacheableProjectWriteNoop) {
588448
588820
  recentToolResults.set(toolFingerprint, {
588449
588821
  result: tc.name === "shell" ? this._buildShellCacheResult(tc.arguments, result) : (
588450
588822
  // Read-like results are SERVED BACK to the model when the
@@ -588465,10 +588837,17 @@ Respond with EXACTLY this structure before your next tool call:
588465
588837
  if (firstKey !== void 0) {
588466
588838
  recentToolResults.delete(firstKey);
588467
588839
  dedupHitCount.delete(firstKey);
588840
+ noopedMemoryWriteFingerprints.delete(firstKey);
588841
+ noopedProjectWriteFingerprints.delete(firstKey);
588468
588842
  }
588469
588843
  }
588470
- if (cacheableMemoryNoop) {
588471
- noopedMemoryWriteFingerprints.add(toolFingerprint);
588844
+ if (cacheableMemoryNoop || cacheableProjectWriteNoop) {
588845
+ if (cacheableMemoryNoop) {
588846
+ noopedMemoryWriteFingerprints.add(toolFingerprint);
588847
+ }
588848
+ if (cacheableProjectWriteNoop) {
588849
+ noopedProjectWriteFingerprints.add(toolFingerprint);
588850
+ }
588472
588851
  const repeatGateSeed = Math.max(0, this._resolveRepeatGateMax() - 1);
588473
588852
  if (repeatGateSeed > 0) {
588474
588853
  dedupHitCount.set(toolFingerprint, Math.max(dedupHitCount.get(toolFingerprint) ?? 0, repeatGateSeed));
@@ -588489,6 +588868,10 @@ Respond with EXACTLY this structure before your next tool call:
588489
588868
  if (key.includes(mp))
588490
588869
  recentToolResults.delete(key);
588491
588870
  }
588871
+ for (const key of Array.from(noopedProjectWriteFingerprints)) {
588872
+ if (key.includes(mp))
588873
+ noopedProjectWriteFingerprints.delete(key);
588874
+ }
588492
588875
  for (const covKey of Array.from(this._readCoverage.keys())) {
588493
588876
  if (covKey.includes(mp))
588494
588877
  this._readCoverage.delete(covKey);
@@ -588496,15 +588879,18 @@ Respond with EXACTLY this structure before your next tool call:
588496
588879
  }
588497
588880
  } else if (dedupHitCount.size > 0) {
588498
588881
  dedupHitCount.clear();
588882
+ recentToolResults.clear();
588883
+ noopedProjectWriteFingerprints.clear();
588499
588884
  }
588500
588885
  }
588501
588886
  if (shellFilesystemMutation && recentToolResults.size > 0) {
588502
588887
  for (const key of Array.from(recentToolResults.keys())) {
588503
- if (key.startsWith("shell:") || key.startsWith("file_read:") || key.startsWith("list_directory:") || key.startsWith("grep_search:") || key.startsWith("find_files:")) {
588888
+ if (key.startsWith("shell:") || key.startsWith("file_read:") || key.startsWith("file_write:") || key.startsWith("file_edit:") || key.startsWith("batch_edit:") || key.startsWith("file_patch:") || key.startsWith("list_directory:") || key.startsWith("grep_search:") || key.startsWith("find_files:")) {
588504
588889
  recentToolResults.delete(key);
588505
588890
  dedupHitCount.delete(key);
588506
588891
  }
588507
588892
  }
588893
+ noopedProjectWriteFingerprints.clear();
588508
588894
  this._readCoverage.clear();
588509
588895
  this.emit({
588510
588896
  type: "status",
@@ -588790,12 +589176,12 @@ Evidence: ${evidencePreview}`.slice(0, 500);
588790
589176
  this.emit({
588791
589177
  type: "tool_result",
588792
589178
  toolName: tc.name,
588793
- content: this.toolResultEventContent(tc.name, output),
589179
+ content: this.toolResultEventContent(tc.name, output || result.output || result.error || ""),
588794
589180
  success: result.success,
588795
589181
  turn,
588796
589182
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
588797
589183
  });
588798
- this.recordWorkboardToolCall(tc.name, tc.arguments, result.success, result.output || output);
589184
+ this.recordWorkboardToolCall(tc.name, tc.arguments, result.success, result.output || result.error || output, result);
588799
589185
  this._taskState.toolCallCount++;
588800
589186
  if (realFileMutation) {
588801
589187
  this._lastFileWriteTurn = turn;
@@ -588924,7 +589310,8 @@ Evidence: ${evidencePreview}`.slice(0, 500);
588924
589310
  output: result.output ?? result.llmContent ?? "",
588925
589311
  error: result.error ?? "",
588926
589312
  mutated: realFileMutation || shellFilesystemMutation,
588927
- isReadLike
589313
+ isReadLike,
589314
+ noop: tc.name === "todo_write" ? this._isTodoWriteNoopResult(result) : result.noop
588928
589315
  });
588929
589316
  const focusSnapshotAfter = this._focusSupervisor?.snapshot();
588930
589317
  focusAfterToolResult = focusSnapshotAfter ?? void 0;
@@ -588953,7 +589340,7 @@ Evidence: ${evidencePreview}`.slice(0, 500);
588953
589340
  args: tc.arguments,
588954
589341
  success: result.success,
588955
589342
  durationMs: performance.now() - toolStart,
588956
- output: result.output || output,
589343
+ output: result.output || output || result.error || "",
588957
589344
  error: result.error ?? "",
588958
589345
  llmContent: result.llmContent,
588959
589346
  realFileMutation,
@@ -588971,7 +589358,7 @@ Evidence: ${evidencePreview}`.slice(0, 500);
588971
589358
  });
588972
589359
  } catch {
588973
589360
  }
588974
- if (tc.name === "todo_write") {
589361
+ if (tc.name === "todo_write" && !this._isTodoWriteNoopResult(result)) {
588975
589362
  this._lastTodoWriteTurn = turn;
588976
589363
  }
588977
589364
  if (tc.name === "file_read" || tc.name === "list_directory" || tc.name === "find_files" || tc.name === "grep_search") {
@@ -589028,12 +589415,13 @@ Do NOT retry ${tc.name} with similar arguments.`);
589028
589415
  }
589029
589416
  }
589030
589417
  if (filePath && (tc.name === "file_read" || tc.name === "file_write" || tc.name === "file_edit" || tc.name === "batch_edit" || tc.name === "file_patch")) {
589031
- const isModify = tc.name !== "file_read";
589418
+ const isRead = tc.name === "file_read";
589419
+ const isModify = realFileMutation;
589032
589420
  const existing = this._fileRegistry.get(filePath);
589033
589421
  this._fileRegistry.set(filePath, {
589034
589422
  lastSeenTurn: turn,
589035
589423
  modified: existing?.modified || isModify,
589036
- summary: isModify ? `Modified (${tc.name}) turn ${turn}` : `Read turn ${turn} (${result.output.split("\n").length} lines)`,
589424
+ summary: isModify ? `Modified (${tc.name}) turn ${turn}` : isRead ? `Read turn ${turn} (${result.output.split("\n").length} lines)` : `${tc.name} no file change turn ${turn}`,
589037
589425
  accessCount: (existing?.accessCount ?? 0) + 1
589038
589426
  });
589039
589427
  if (isModify) {
@@ -589054,7 +589442,9 @@ Do NOT retry ${tc.name} with similar arguments.`);
589054
589442
  }
589055
589443
  if (result.success) {
589056
589444
  if (tc.name === "file_write" || tc.name === "file_edit" || tc.name === "batch_edit") {
589057
- this._taskState.completedSteps.push(`${tc.name}: \`${filePath}\``);
589445
+ if (realFileMutation) {
589446
+ this._taskState.completedSteps.push(`${tc.name}: \`${filePath}\``);
589447
+ }
589058
589448
  } else if ((tc.name === "shell" || tc.name === "background_run") && /PASS|passed|success|✓/i.test(result.output)) {
589059
589449
  this._taskState.completedSteps.push(`Test passed: \`${String(tc.arguments?.command ?? "").slice(0, 80)}\``);
589060
589450
  } else if (tc.name === "memory_write" && !result.noop) {
@@ -590299,7 +590689,7 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
590299
590689
  this.emit({
590300
590690
  type: "tool_result",
590301
590691
  toolName: tc.name,
590302
- content: this.toolResultEventContent(tc.name, output),
590692
+ content: this.toolResultEventContent(tc.name, output || result.output || result.error || ""),
590303
590693
  success: result.success,
590304
590694
  turn,
590305
590695
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
@@ -591722,7 +592112,7 @@ ${marker}` : marker);
591722
592112
  }
591723
592113
  return;
591724
592114
  }
591725
- if (toolName === "file_write" && path12 && result.success && result.mutated !== false) {
592115
+ if (toolName === "file_write" && path12 && this._isRealProjectMutation(toolName, result)) {
591726
592116
  for (const [key2, entry] of this._staleEditFamilies) {
591727
592117
  if (entry.pathKey === pathKey)
591728
592118
  this._staleEditFamilies.delete(key2);
@@ -591735,7 +592125,7 @@ ${marker}` : marker);
591735
592125
  if (!target)
591736
592126
  return;
591737
592127
  const targetPathKey = this.staleEditPathKey(target.path);
591738
- if (result.success && result.mutated !== false) {
592128
+ if (this._isRealProjectMutation(toolName, result)) {
591739
592129
  for (const [key2, entry] of this._staleEditFamilies) {
591740
592130
  if (entry.pathKey === targetPathKey)
591741
592131
  this._staleEditFamilies.delete(key2);
@@ -598101,7 +598491,7 @@ var init_composite_scorer = __esm({
598101
598491
  });
598102
598492
 
598103
598493
  // packages/orchestrator/dist/memory/materialization-policy.js
598104
- import { createHash as createHash30 } from "node:crypto";
598494
+ import { createHash as createHash31 } from "node:crypto";
598105
598495
  function materializeMemoryItems(items, options2 = {}) {
598106
598496
  const config = options2.config ?? DEFAULT_WEIGHTING_CONFIG;
598107
598497
  const sorted = [...items].sort((a2, b) => b.weight - a2.weight || a2.id.localeCompare(b.id));
@@ -598339,7 +598729,7 @@ function estimateTokens4(text2) {
598339
598729
  return Math.max(1, Math.ceil(text2.length / 4));
598340
598730
  }
598341
598731
  function hashText(text2) {
598342
- return createHash30("sha256").update(text2).digest("hex");
598732
+ return createHash31("sha256").update(text2).digest("hex");
598343
598733
  }
598344
598734
  var init_materialization_policy = __esm({
598345
598735
  "packages/orchestrator/dist/memory/materialization-policy.js"() {
@@ -598503,7 +598893,7 @@ var init_config_loader = __esm({
598503
598893
  });
598504
598894
 
598505
598895
  // packages/orchestrator/dist/memory/stability-tracker.js
598506
- import { createHash as createHash31 } from "node:crypto";
598896
+ import { createHash as createHash32 } from "node:crypto";
598507
598897
  import { existsSync as existsSync106, mkdirSync as mkdirSync60, readFileSync as readFileSync83, writeFileSync as writeFileSync51 } from "node:fs";
598508
598898
  import { dirname as dirname36, join as join117 } from "node:path";
598509
598899
  function stabilityFilePath(repoRoot) {
@@ -598567,7 +598957,7 @@ function computeStabilityHash(item) {
598567
598957
  item.scope.name,
598568
598958
  item.topicKey
598569
598959
  ].join("|");
598570
- return createHash31("sha256").update(normalized).digest("hex");
598960
+ return createHash32("sha256").update(normalized).digest("hex");
598571
598961
  }
598572
598962
  function normalizeContent2(content) {
598573
598963
  return content.replace(/\s+/g, " ").trim();
@@ -602539,10 +602929,10 @@ var init_project_arc = __esm({
602539
602929
  });
602540
602930
 
602541
602931
  // packages/orchestrator/dist/dedup-gate.js
602542
- import { createHash as createHash32 } from "node:crypto";
602932
+ import { createHash as createHash33 } from "node:crypto";
602543
602933
  function fingerprintCall(name10, args) {
602544
602934
  const canon = canonicalize(args);
602545
- return createHash32("sha1").update(`${name10}\0${canon}`).digest("hex").slice(0, 16);
602935
+ return createHash33("sha1").update(`${name10}\0${canon}`).digest("hex").slice(0, 16);
602546
602936
  }
602547
602937
  function canonicalize(value2) {
602548
602938
  if (value2 === null || typeof value2 !== "object")
@@ -604476,12 +604866,14 @@ var init_py_embed = __esm({
604476
604866
  var listen_exports = {};
604477
604867
  __export(listen_exports, {
604478
604868
  ListenEngine: () => ListenEngine,
604869
+ asrConsensusEnabled: () => asrConsensusEnabled,
604479
604870
  ensureTranscribeCliBackground: () => ensureTranscribeCliBackground,
604480
604871
  getListenEngine: () => getListenEngine,
604481
604872
  getListenLiveState: () => getListenLiveState,
604482
604873
  isAudioPath: () => isAudioPath,
604483
604874
  isTranscribablePath: () => isTranscribablePath,
604484
604875
  isVideoPath: () => isVideoPath,
604876
+ resolveAsrConsensusModel: () => resolveAsrConsensusModel,
604485
604877
  transcribeFileViaWhisper: () => transcribeFileViaWhisper,
604486
604878
  waitForTranscribeCli: () => waitForTranscribeCli
604487
604879
  });
@@ -604886,9 +605278,25 @@ function defaultConsensusModel(primaryModel) {
604886
605278
  if (model === "large-v3" || model === "large") return "small";
604887
605279
  return "base";
604888
605280
  }
604889
- function asrConsensusEnabled() {
604890
- const consensusEnv = String(process.env["OMNIUS_ASR_CONSENSUS"] ?? "").trim().toLowerCase();
604891
- return !(consensusEnv === "0" || consensusEnv === "off" || consensusEnv === "false");
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";
604892
605300
  }
604893
605301
  function liveAsrUseTranscribeCli() {
604894
605302
  const value2 = String(process.env["OMNIUS_ASR_USE_TRANSCRIBE_CLI"] ?? "").trim().toLowerCase();
@@ -605121,8 +605529,7 @@ var init_listen = __esm({
605121
605529
  model: this.model,
605122
605530
  lastStatus: `loading whisper ${this.model} model...`
605123
605531
  });
605124
- const consensusEnv = String(process.env["OMNIUS_ASR_CONSENSUS"] ?? "").trim().toLowerCase();
605125
- const consensusModel = consensusEnv === "0" || consensusEnv === "off" || consensusEnv === "false" ? "off" : consensusEnv || defaultConsensusModel(this.model);
605532
+ const consensusModel = resolveAsrConsensusModel(this.model);
605126
605533
  const consensusThreshold = String(process.env["OMNIUS_ASR_CONSENSUS_THRESHOLD"] ?? "0.45");
605127
605534
  const silenceMs = String(process.env["OMNIUS_ASR_SILENCE_MS"] ?? "3000");
605128
605535
  this.process = spawn29(
@@ -605186,7 +605593,9 @@ var init_listen = __esm({
605186
605593
  updateListenLiveState({
605187
605594
  lastStatus: message2
605188
605595
  });
605189
- this.emit("status", message2);
605596
+ if (process.env["OMNIUS_ASR_VERBOSE_CONSENSUS"] === "1") {
605597
+ this.emit("status", message2);
605598
+ }
605190
605599
  }
605191
605600
  break;
605192
605601
  case "vad": {
@@ -605539,7 +605948,7 @@ var init_listen = __esm({
605539
605948
  updateListenLiveState({ phase: "error", lastStatus: "no mic capture tool (arecord/sox/ffmpeg)" });
605540
605949
  return "No microphone capture tool found. Install arecord (Linux), sox (macOS), or ffmpeg.";
605541
605950
  }
605542
- const consensusEnabled = asrConsensusEnabled();
605951
+ const consensusEnabled = asrConsensusEnabled(this.config.model);
605543
605952
  const useTranscribeCli = liveAsrUseTranscribeCli() && !consensusEnabled;
605544
605953
  const preferWhisperFallback = !useTranscribeCli;
605545
605954
  if (preferWhisperFallback) {
@@ -605833,7 +606242,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
605833
606242
  * Caller is responsible for calling .stop() when done.
605834
606243
  */
605835
606244
  async createCallTranscriber() {
605836
- const requireConsensus = asrConsensusEnabled();
606245
+ const requireConsensus = asrConsensusEnabled(this.config.model);
605837
606246
  const useTranscribeCli = liveAsrUseTranscribeCli() && !requireConsensus;
605838
606247
  let tc = useTranscribeCli ? await this.loadTranscribeCli() : null;
605839
606248
  if (useTranscribeCli && !tc && _bgInstallPromise) {
@@ -612845,7 +613254,7 @@ var require_websocket3 = __commonJS({
612845
613254
  var http6 = __require("http");
612846
613255
  var net5 = __require("net");
612847
613256
  var tls2 = __require("tls");
612848
- var { randomBytes: randomBytes31, createHash: createHash47 } = __require("crypto");
613257
+ var { randomBytes: randomBytes31, createHash: createHash48 } = __require("crypto");
612849
613258
  var { Duplex: Duplex3, Readable } = __require("stream");
612850
613259
  var { URL: URL3 } = __require("url");
612851
613260
  var PerMessageDeflate3 = require_permessage_deflate3();
@@ -613505,7 +613914,7 @@ var require_websocket3 = __commonJS({
613505
613914
  abortHandshake(websocket, socket, "Invalid Upgrade header");
613506
613915
  return;
613507
613916
  }
613508
- const digest3 = createHash47("sha1").update(key + GUID).digest("base64");
613917
+ const digest3 = createHash48("sha1").update(key + GUID).digest("base64");
613509
613918
  if (res.headers["sec-websocket-accept"] !== digest3) {
613510
613919
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
613511
613920
  return;
@@ -613872,7 +614281,7 @@ var require_websocket_server2 = __commonJS({
613872
614281
  var EventEmitter15 = __require("events");
613873
614282
  var http6 = __require("http");
613874
614283
  var { Duplex: Duplex3 } = __require("stream");
613875
- var { createHash: createHash47 } = __require("crypto");
614284
+ var { createHash: createHash48 } = __require("crypto");
613876
614285
  var extension3 = require_extension3();
613877
614286
  var PerMessageDeflate3 = require_permessage_deflate3();
613878
614287
  var subprotocol3 = require_subprotocol2();
@@ -614173,7 +614582,7 @@ var require_websocket_server2 = __commonJS({
614173
614582
  );
614174
614583
  }
614175
614584
  if (this._state > RUNNING) return abortHandshake(socket, 503);
614176
- const digest3 = createHash47("sha1").update(key + GUID).digest("base64");
614585
+ const digest3 = createHash48("sha1").update(key + GUID).digest("base64");
614177
614586
  const headers = [
614178
614587
  "HTTP/1.1 101 Switching Protocols",
614179
614588
  "Upgrade: websocket",
@@ -620726,14 +621135,14 @@ var init_voice_session = __esm({
620726
621135
  });
620727
621136
 
620728
621137
  // packages/cli/src/tui/scoped-personality.ts
620729
- import { createHash as createHash33 } from "node:crypto";
621138
+ import { createHash as createHash34 } from "node:crypto";
620730
621139
  import { appendFileSync as appendFileSync13, existsSync as existsSync117, mkdirSync as mkdirSync72, readFileSync as readFileSync96, writeFileSync as writeFileSync60 } from "node:fs";
620731
621140
  import { join as join131, resolve as resolve56 } from "node:path";
620732
621141
  function safeName(input) {
620733
621142
  return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
620734
621143
  }
620735
621144
  function scopeHash(scope) {
620736
- return createHash33("sha1").update(`${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
621145
+ return createHash34("sha1").update(`${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
620737
621146
  }
620738
621147
  function scopedPersonalityDir(repoRoot, kind) {
620739
621148
  return resolve56(repoRoot, ".omnius", "scoped-personality", kind);
@@ -621105,7 +621514,7 @@ var init_scoped_personality = __esm({
621105
621514
  });
621106
621515
 
621107
621516
  // packages/cli/src/tui/voice-soul.ts
621108
- import { createHash as createHash34 } from "node:crypto";
621517
+ import { createHash as createHash35 } from "node:crypto";
621109
621518
  import { existsSync as existsSync118, readdirSync as readdirSync38, readFileSync as readFileSync97 } from "node:fs";
621110
621519
  import { basename as basename25, join as join132, resolve as resolve57 } from "node:path";
621111
621520
  function compactText(text2, limit) {
@@ -621120,7 +621529,7 @@ function blockText(text2, limit) {
621120
621529
  ... [truncated]`;
621121
621530
  }
621122
621531
  function scopeStateKey(scope, surface) {
621123
- return createHash34("sha1").update(`${surface}:${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
621532
+ return createHash35("sha1").update(`${surface}:${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
621124
621533
  }
621125
621534
  function safeName2(input) {
621126
621535
  return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
@@ -623764,7 +624173,7 @@ var init_types3 = __esm({
623764
624173
  });
623765
624174
 
623766
624175
  // packages/cli/src/tui/p2p/secret-vault.ts
623767
- import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash35 } from "node:crypto";
624176
+ import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash36 } from "node:crypto";
623768
624177
  import { readFileSync as readFileSync99, writeFileSync as writeFileSync62, existsSync as existsSync120, mkdirSync as mkdirSync74 } from "node:fs";
623769
624178
  import { dirname as dirname39 } from "node:path";
623770
624179
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
@@ -624009,7 +624418,7 @@ var init_secret_vault = __esm({
624009
624418
  /** Generate a deterministic fingerprint of vault contents (for sync verification) */
624010
624419
  fingerprint() {
624011
624420
  const names = Array.from(this.secrets.keys()).sort();
624012
- const hash = createHash35("sha256");
624421
+ const hash = createHash36("sha256");
624013
624422
  for (const name10 of names) {
624014
624423
  hash.update(name10 + ":");
624015
624424
  hash.update(this.secrets.get(name10).value);
@@ -624024,7 +624433,7 @@ var init_secret_vault = __esm({
624024
624433
  // packages/cli/src/tui/p2p/peer-mesh.ts
624025
624434
  import { EventEmitter as EventEmitter9 } from "node:events";
624026
624435
  import { createServer as createServer6 } from "node:http";
624027
- import { randomBytes as randomBytes24, createHash as createHash36, generateKeyPairSync } from "node:crypto";
624436
+ import { randomBytes as randomBytes24, createHash as createHash37, generateKeyPairSync } from "node:crypto";
624028
624437
  var PING_INTERVAL_MS, PEER_TIMEOUT_MS, GOSSIP_INTERVAL_MS, MAX_PEERS, PeerMesh;
624029
624438
  var init_peer_mesh = __esm({
624030
624439
  "packages/cli/src/tui/p2p/peer-mesh.ts"() {
@@ -624041,7 +624450,7 @@ var init_peer_mesh = __esm({
624041
624450
  const { publicKey: publicKey2, privateKey } = generateKeyPairSync("ed25519");
624042
624451
  this.publicKey = publicKey2.export({ type: "spki", format: "der" });
624043
624452
  this.privateKey = privateKey.export({ type: "pkcs8", format: "der" });
624044
- this.peerId = createHash36("sha256").update(this.publicKey).digest("base64url").slice(0, 22);
624453
+ this.peerId = createHash37("sha256").update(this.publicKey).digest("base64url").slice(0, 22);
624045
624454
  this.capabilities = options2.capabilities;
624046
624455
  this.displayName = options2.displayName;
624047
624456
  this._authKey = options2.authKey ?? randomBytes24(24).toString("base64url");
@@ -625406,7 +625815,7 @@ __export(omnius_directory_exports, {
625406
625815
  import { appendFileSync as appendFileSync14, cpSync as cpSync2, existsSync as existsSync122, mkdirSync as mkdirSync76, readFileSync as readFileSync101, writeFileSync as writeFileSync64, readdirSync as readdirSync41, statSync as statSync47, unlinkSync as unlinkSync23, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync11, watch as fsWatch2 } from "node:fs";
625407
625816
  import { join as join136, relative as relative14, basename as basename26, dirname as dirname40, resolve as resolve58 } from "node:path";
625408
625817
  import { homedir as homedir42 } from "node:os";
625409
- import { createHash as createHash38 } from "node:crypto";
625818
+ import { createHash as createHash39 } from "node:crypto";
625410
625819
  function isGitRoot(dir) {
625411
625820
  const gitPath = join136(dir, ".git");
625412
625821
  if (!existsSync122(gitPath)) return false;
@@ -625888,7 +626297,7 @@ function buildHandoffPrompt(repoRoot) {
625888
626297
  return lines.join("\n");
625889
626298
  }
625890
626299
  function computeDedupeHash(task, savedAt) {
625891
- return createHash38("sha256").update(`${task}|${savedAt}`).digest("hex").slice(0, 16);
626300
+ return createHash39("sha256").update(`${task}|${savedAt}`).digest("hex").slice(0, 16);
625892
626301
  }
625893
626302
  function generateSessionId() {
625894
626303
  const timestamp = Date.now().toString(36);
@@ -650659,7 +651068,7 @@ __export(commands_exports, {
650659
651068
  });
650660
651069
  import * as nodeOs from "node:os";
650661
651070
  import { spawn as nodeSpawn2 } from "node:child_process";
650662
- import { createHash as createHash39 } from "node:crypto";
651071
+ import { createHash as createHash40 } from "node:crypto";
650663
651072
  import {
650664
651073
  existsSync as existsSync142,
650665
651074
  readFileSync as readFileSync116,
@@ -663936,7 +664345,7 @@ async function collectSponsorMediaStream(args) {
663936
664345
  };
663937
664346
  }
663938
664347
  if (artifact.sha256) {
663939
- const sha = createHash39("sha256").update(bytes).digest("hex");
664348
+ const sha = createHash40("sha256").update(bytes).digest("hex");
663940
664349
  if (sha !== artifact.sha256)
663941
664350
  return { ok: false, error: `Artifact hash mismatch for ${artifactId}` };
663942
664351
  }
@@ -672344,8 +672753,9 @@ function createEditHistoryLogger(repoRoot, sessionId) {
672344
672753
  mkdirSync90(historyDir, { recursive: true });
672345
672754
  } catch {
672346
672755
  }
672347
- function logToolCall(toolName, toolArgs, success) {
672756
+ function logToolCall(toolName, toolArgs, success, resultContent = "") {
672348
672757
  if (!EDIT_TOOLS.has(toolName)) return;
672758
+ if (success && /^\[NO-OP\b/i.test(resultContent.trim())) return;
672349
672759
  const entry = {
672350
672760
  ts: (/* @__PURE__ */ new Date()).toISOString(),
672351
672761
  tool: toolName,
@@ -679061,7 +679471,7 @@ import {
679061
679471
  unlinkSync as unlinkSync33
679062
679472
  } from "node:fs";
679063
679473
  import { join as join166 } from "node:path";
679064
- import { createHash as createHash40 } from "node:crypto";
679474
+ import { createHash as createHash41 } from "node:crypto";
679065
679475
  function safeFilePart(value2) {
679066
679476
  return value2.replace(/[^A-Za-z0-9_.-]+/g, "_").slice(0, 80) || "telegram";
679067
679477
  }
@@ -679069,7 +679479,7 @@ function daydreamRoot(repoRoot) {
679069
679479
  return join166(repoRoot, ".omnius", "telegram-daydreams");
679070
679480
  }
679071
679481
  function sessionDir(repoRoot, sessionKey) {
679072
- const hash = createHash40("sha1").update(sessionKey).digest("hex").slice(0, 20);
679482
+ const hash = createHash41("sha1").update(sessionKey).digest("hex").slice(0, 20);
679073
679483
  return join166(daydreamRoot(repoRoot), safeFilePart(hash));
679074
679484
  }
679075
679485
  function compactLine2(value2, max = 220) {
@@ -679180,7 +679590,7 @@ function buildReplyOpportunities(input, openQuestions) {
679180
679590
  return opportunities;
679181
679591
  }
679182
679592
  function daydreamOpportunityId(input, trigger) {
679183
- return createHash40("sha1").update(`${input.sessionKey}:${input.generatedAtMs}:${trigger}`).digest("hex").slice(0, 16);
679593
+ return createHash41("sha1").update(`${input.sessionKey}:${input.generatedAtMs}:${trigger}`).digest("hex").slice(0, 16);
679184
679594
  }
679185
679595
  function clamp0114(value2) {
679186
679596
  if (!Number.isFinite(value2)) return 0;
@@ -679585,7 +679995,7 @@ function buildTelegramChannelDaydream(input, corpus, extraction, extractionCommi
679585
679995
  const seed = `${input.sessionKey}:${input.generatedAtMs}:${input.history.length}`;
679586
679996
  return {
679587
679997
  version: 3,
679588
- id: createHash40("sha1").update(seed).digest("hex").slice(0, 16),
679998
+ id: createHash41("sha1").update(seed).digest("hex").slice(0, 16),
679589
679999
  sessionKey: input.sessionKey,
679590
680000
  chatId: input.chatId,
679591
680001
  chatTitle: input.chatTitle,
@@ -679898,12 +680308,12 @@ var init_telegram_channel_dmn = __esm({
679898
680308
  });
679899
680309
 
679900
680310
  // packages/cli/src/tui/telegram-reflection-corpus.ts
679901
- import { createHash as createHash41 } from "node:crypto";
680311
+ import { createHash as createHash42 } from "node:crypto";
679902
680312
  function telegramReflectionMemoryDbPaths(repoRoot) {
679903
680313
  return omniusMemoryDbPaths(repoRoot);
679904
680314
  }
679905
680315
  function stableHash2(value2, length4 = 16) {
679906
- return createHash41("sha1").update(value2).digest("hex").slice(0, length4);
680316
+ return createHash42("sha1").update(value2).digest("hex").slice(0, length4);
679907
680317
  }
679908
680318
  function clean3(value2) {
679909
680319
  return String(value2 ?? "").replace(/\s+/g, " ").trim();
@@ -680718,7 +681128,7 @@ var init_telegram_reflection_extraction = __esm({
680718
681128
  });
680719
681129
 
680720
681130
  // packages/cli/src/tui/telegram-social-state-types.ts
680721
- import { createHash as createHash42 } from "node:crypto";
681131
+ import { createHash as createHash43 } from "node:crypto";
680722
681132
  function telegramSocialActorKey(actor) {
680723
681133
  if (!actor) return "unknown";
680724
681134
  if (typeof actor.userId === "number") return `user:${actor.userId}`;
@@ -680751,7 +681161,7 @@ function appendUnique(items, value2, max) {
680751
681161
  return next.slice(-max);
680752
681162
  }
680753
681163
  function hashTelegramSocialId(parts) {
680754
- return createHash42("sha1").update(parts.map((part) => String(part ?? "")).join(":")).digest("hex").slice(0, 16);
681164
+ return createHash43("sha1").update(parts.map((part) => String(part ?? "")).join(":")).digest("hex").slice(0, 16);
680755
681165
  }
680756
681166
  function cleanUsername(value2) {
680757
681167
  if (typeof value2 !== "string") return void 0;
@@ -681817,7 +682227,7 @@ import {
681817
682227
  } from "node:path";
681818
682228
  import { homedir as homedir55 } from "node:os";
681819
682229
  import { writeFile as writeFileAsync } from "node:fs/promises";
681820
- import { createHash as createHash43, randomBytes as randomBytes27, randomInt } from "node:crypto";
682230
+ import { createHash as createHash44, randomBytes as randomBytes27, randomInt } from "node:crypto";
681821
682231
  function formatModelBytes(bytes) {
681822
682232
  if (!Number.isFinite(bytes) || bytes <= 0) return "0 B";
681823
682233
  const units = ["B", "KB", "MB", "GB", "TB"];
@@ -683062,7 +683472,7 @@ function buildTelegramRuntimeContext(now2 = /* @__PURE__ */ new Date(), repoRoot
683062
683472
  return buildConversationRuntimeContext(now2, repoRoot);
683063
683473
  }
683064
683474
  function telegramSessionIdFromKey(sessionKey) {
683065
- return `telegram-${createHash43("sha1").update(sessionKey).digest("hex").slice(0, 16)}`;
683475
+ return `telegram-${createHash44("sha1").update(sessionKey).digest("hex").slice(0, 16)}`;
683066
683476
  }
683067
683477
  function normalizeTelegramSubAgentLimit(value2) {
683068
683478
  const parsed = typeof value2 === "number" ? value2 : typeof value2 === "string" && value2.trim() ? Number(value2.trim()) : TELEGRAM_SUB_AGENT_DEFAULT_LIMIT;
@@ -685230,7 +685640,7 @@ Telegram link integrity contract:
685230
685640
  return !!this.adminAuthChallenge && this.adminAuthChallenge.expiresAtMs > Date.now();
685231
685641
  }
685232
685642
  hashAdminAuthCode(code8) {
685233
- return createHash43("sha256").update(`omnius-telegram-admin:${code8.trim()}`).digest("hex");
685643
+ return createHash44("sha256").update(`omnius-telegram-admin:${code8.trim()}`).digest("hex");
685234
685644
  }
685235
685645
  viewIdForMessage(msg) {
685236
685646
  return `telegram-${this.sessionKeyForMessage(msg).replace(/[^A-Za-z0-9_-]/g, "-")}`;
@@ -687294,11 +687704,11 @@ ${mediaContext}` : ""
687294
687704
  return payload;
687295
687705
  }
687296
687706
  telegramConversationPath(sessionKey) {
687297
- const safe = createHash43("sha1").update(sessionKey).digest("hex").slice(0, 20);
687707
+ const safe = createHash44("sha1").update(sessionKey).digest("hex").slice(0, 20);
687298
687708
  return join168(this.telegramConversationDir, `${safe}.json`);
687299
687709
  }
687300
687710
  telegramConversationLedgerPath(sessionKey) {
687301
- const safe = createHash43("sha1").update(sessionKey).digest("hex").slice(0, 20);
687711
+ const safe = createHash44("sha1").update(sessionKey).digest("hex").slice(0, 20);
687302
687712
  return join168(this.telegramConversationDir, `${safe}.events.jsonl`);
687303
687713
  }
687304
687714
  telegramDb() {
@@ -687531,7 +687941,7 @@ ${mediaContext}` : ""
687531
687941
  relationships: Array.isArray(raw.relationships) ? raw.relationships.slice(0, TELEGRAM_ASSOCIATIVE_RELATION_LIMIT).map((fact) => this.normalizeTelegramAssociativeFact(fact)) : [],
687532
687942
  actions: Array.isArray(raw.actions) ? raw.actions.slice(-TELEGRAM_ASSOCIATIVE_ACTION_LIMIT).map((action) => ({
687533
687943
  id: String(
687534
- action.id || createHash43("sha1").update(JSON.stringify(action)).digest("hex").slice(0, 12)
687944
+ action.id || createHash44("sha1").update(JSON.stringify(action)).digest("hex").slice(0, 12)
687535
687945
  ),
687536
687946
  ts: typeof action.ts === "number" ? action.ts : Date.now(),
687537
687947
  role: action.role === "assistant" ? "assistant" : "user",
@@ -687550,7 +687960,7 @@ ${mediaContext}` : ""
687550
687960
  const now2 = Date.now();
687551
687961
  return {
687552
687962
  id: String(
687553
- raw.id || createHash43("sha1").update(text2 || String(now2)).digest("hex").slice(0, 12)
687963
+ raw.id || createHash44("sha1").update(text2 || String(now2)).digest("hex").slice(0, 12)
687554
687964
  ),
687555
687965
  text: text2,
687556
687966
  tags: Array.isArray(raw.tags) ? raw.tags.map(String).slice(0, 16) : [],
@@ -688007,7 +688417,7 @@ ${mediaContext}` : ""
688007
688417
  telegramHistoryBackfillMessageId(sessionKey, entry, index) {
688008
688418
  if (typeof entry.messageId === "number" && Number.isFinite(entry.messageId))
688009
688419
  return entry.messageId;
688010
- const digest3 = createHash43("sha1").update(
688420
+ const digest3 = createHash44("sha1").update(
688011
688421
  `${sessionKey}:${index}:${entry.role}:${entry.ts ?? ""}:${entry.text}`
688012
688422
  ).digest("hex").slice(0, 8);
688013
688423
  return -Number.parseInt(digest3, 16);
@@ -689197,7 +689607,7 @@ ${mediaContext}` : ""
689197
689607
  const now2 = entry.ts ?? Date.now();
689198
689608
  memory.updatedAt = now2;
689199
689609
  const speaker = telegramHistorySpeaker(entry);
689200
- const actionId = createHash43("sha1").update(
689610
+ const actionId = createHash44("sha1").update(
689201
689611
  `${sessionKey}:${entry.role}:${entry.messageId ?? ""}:${now2}:${entry.text}`
689202
689612
  ).digest("hex").slice(0, 16);
689203
689613
  if (!memory.actions.some((action) => action.id === actionId)) {
@@ -689360,7 +689770,7 @@ ${mediaContext}` : ""
689360
689770
  let fact = facts.find((item) => item.text.toLowerCase() === key);
689361
689771
  if (!fact) {
689362
689772
  fact = {
689363
- id: createHash43("sha1").update(`${entry.chatId ?? ""}:${key}`).digest("hex").slice(0, 12),
689773
+ id: createHash44("sha1").update(`${entry.chatId ?? ""}:${key}`).digest("hex").slice(0, 12),
689364
689774
  text: clean5,
689365
689775
  tags: telegramMemoryTags(clean5, entry.mediaSummary),
689366
689776
  speakers: [],
@@ -689445,7 +689855,7 @@ ${mediaContext}` : ""
689445
689855
  const titleTags = tags.slice(0, 4);
689446
689856
  const title = titleTags.length > 0 ? `${speaker} / ${titleTags.join(" ")}` : `${speaker} / conversation`;
689447
689857
  const card = {
689448
- id: createHash43("sha1").update(`${sessionKey}:${now2}:${speaker}:${text2}`).digest("hex").slice(0, 12),
689858
+ id: createHash44("sha1").update(`${sessionKey}:${now2}:${speaker}:${text2}`).digest("hex").slice(0, 12),
689449
689859
  title,
689450
689860
  notes: [],
689451
689861
  tags: [],
@@ -692392,7 +692802,7 @@ ${list}` : "No shared group target is currently known for this sender. Ask in th
692392
692802
  }
692393
692803
  telegramRunnerStateDir(sessionKey) {
692394
692804
  if (!this.repoRoot) return void 0;
692395
- const safe = createHash43("sha1").update(sessionKey).digest("hex").slice(0, 20);
692805
+ const safe = createHash44("sha1").update(sessionKey).digest("hex").slice(0, 20);
692396
692806
  return join168(this.repoRoot, ".omnius", "telegram-runner-state", safe);
692397
692807
  }
692398
692808
  buildTelegramAdminOverviewContext(currentSessionKey) {
@@ -703077,14 +703487,14 @@ var init_access_policy = __esm({
703077
703487
  });
703078
703488
 
703079
703489
  // packages/cli/src/api/project-preferences.ts
703080
- import { createHash as createHash44 } from "node:crypto";
703490
+ import { createHash as createHash45 } from "node:crypto";
703081
703491
  import { existsSync as existsSync158, mkdirSync as mkdirSync98, readFileSync as readFileSync131, renameSync as renameSync15, writeFileSync as writeFileSync85, unlinkSync as unlinkSync36 } from "node:fs";
703082
703492
  import { homedir as homedir57 } from "node:os";
703083
703493
  import { join as join170, resolve as resolve70 } from "node:path";
703084
703494
  import { randomUUID as randomUUID20 } from "node:crypto";
703085
703495
  function projectKey(root) {
703086
703496
  const canonical = resolve70(root);
703087
- return createHash44("sha256").update(canonical).digest("hex").slice(0, 16);
703497
+ return createHash45("sha256").update(canonical).digest("hex").slice(0, 16);
703088
703498
  }
703089
703499
  function projectDir(root) {
703090
703500
  return join170(PROJECTS_DIR, projectKey(root));
@@ -703378,7 +703788,7 @@ var init_disk_task_output = __esm({
703378
703788
  });
703379
703789
 
703380
703790
  // packages/cli/src/api/http.ts
703381
- import { createHash as createHash45 } from "node:crypto";
703791
+ import { createHash as createHash46 } from "node:crypto";
703382
703792
  function problemDetails(opts) {
703383
703793
  const p2 = {
703384
703794
  type: opts.type ?? "about:blank",
@@ -703441,7 +703851,7 @@ function paginated(items, page2, total) {
703441
703851
  }
703442
703852
  function computeEtag(payload) {
703443
703853
  const json = typeof payload === "string" ? payload : JSON.stringify(payload);
703444
- const hash = createHash45("sha1").update(json).digest("hex").slice(0, 16);
703854
+ const hash = createHash46("sha1").update(json).digest("hex").slice(0, 16);
703445
703855
  return `W/"${hash}"`;
703446
703856
  }
703447
703857
  function checkNotModified(req3, res, etag) {
@@ -722108,7 +722518,7 @@ import {
722108
722518
  closeSync as closeSync6
722109
722519
  } from "node:fs";
722110
722520
  import { randomBytes as randomBytes29, randomUUID as randomUUID21, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
722111
- import { createHash as createHash46 } from "node:crypto";
722521
+ import { createHash as createHash47 } from "node:crypto";
722112
722522
  function memoryDbPaths3(baseDir = process.cwd()) {
722113
722523
  const dir = join182(baseDir, ".omnius");
722114
722524
  return {
@@ -730376,7 +730786,7 @@ function listScheduledTasks() {
730376
730786
  );
730377
730787
  const enabled2 = typeof t2?.enabled === "boolean" ? t2.enabled : true;
730378
730788
  const realId = typeof t2?.id === "string" && t2.id ? t2.id : null;
730379
- const fallbackId = createHash46("sha1").update(`${file}#${i2}`).digest("hex").slice(0, 16);
730789
+ const fallbackId = createHash47("sha1").update(`${file}#${i2}`).digest("hex").slice(0, 16);
730380
730790
  const uid = realId || fallbackId;
730381
730791
  const key = `${uid}`;
730382
730792
  if (seen.has(key)) return;
@@ -730514,8 +730924,8 @@ function deleteScheduledById(id2) {
730514
730924
  if (typeof entry?.id === "string" && entry.id && !candidates.includes(entry.id))
730515
730925
  candidates.push(entry.id);
730516
730926
  try {
730517
- const { createHash: createHash47 } = require4("node:crypto");
730518
- const fallback = createHash47("sha1").update(`${target.file}#${target.index}`).digest("hex").slice(0, 16);
730927
+ const { createHash: createHash48 } = require4("node:crypto");
730928
+ const fallback = createHash48("sha1").update(`${target.file}#${target.index}`).digest("hex").slice(0, 16);
730519
730929
  if (!candidates.includes(fallback)) candidates.push(fallback);
730520
730930
  } catch {
730521
730931
  }
@@ -735713,6 +736123,35 @@ ${entry.fullContent}`
735713
736123
  statusBar.refreshDynamicBlocks();
735714
736124
  return true;
735715
736125
  };
736126
+ const EDIT_TOOL_NAMES = /* @__PURE__ */ new Set([
736127
+ "file_write",
736128
+ "file_edit",
736129
+ "file_patch",
736130
+ "batch_edit"
736131
+ ]);
736132
+ const extractEditToolPaths = (toolName, args) => {
736133
+ if (!EDIT_TOOL_NAMES.has(toolName)) return [];
736134
+ if (toolName === "batch_edit" && Array.isArray(args.edits)) {
736135
+ return [
736136
+ ...new Set(
736137
+ args.edits.map(
736138
+ (edit) => edit && typeof edit === "object" ? edit.path : void 0
736139
+ ).filter((path12) => typeof path12 === "string" && path12.length > 0)
736140
+ )
736141
+ ];
736142
+ }
736143
+ return typeof args.path === "string" && args.path.length > 0 ? [args.path] : [];
736144
+ };
736145
+ const recordEditToolPaths = (toolName, args) => {
736146
+ for (const filePath of extractEditToolPaths(toolName, args)) {
736147
+ filesTouched.add(filePath);
736148
+ sessionMetrics?.recordFileModified(filePath);
736149
+ if (isNeovimActive()) {
736150
+ notifyNeovimFileChange(filePath).catch(() => {
736151
+ });
736152
+ }
736153
+ }
736154
+ };
735716
736155
  runner.onEvent((event) => {
735717
736156
  emotionEngine?.appraise(event);
735718
736157
  switch (event.type) {
@@ -735739,19 +736178,6 @@ ${entry.fullContent}`
735739
736178
  });
735740
736179
  }
735741
736180
  }
735742
- if (event.toolArgs?.path && typeof event.toolArgs.path === "string") {
735743
- const name10 = event.toolName ?? "";
735744
- if (name10 === "file_write" || name10 === "file_edit" || name10 === "file_patch" || name10 === "batch_edit") {
735745
- filesTouched.add(event.toolArgs.path);
735746
- sessionMetrics?.recordFileModified(event.toolArgs.path);
735747
- if (isNeovimActive()) {
735748
- notifyNeovimFileChange(event.toolArgs.path).catch(
735749
- () => {
735750
- }
735751
- );
735752
- }
735753
- }
735754
- }
735755
736181
  getActivityFeed().push({
735756
736182
  ts: Date.now(),
735757
736183
  source: "main",
@@ -735841,10 +736267,15 @@ ${entry.fullContent}`
735841
736267
  );
735842
736268
  }
735843
736269
  if (lastToolCall) {
736270
+ const editNoop = (event.success ?? false) && /^\[NO-OP\b/i.test(rawContent2.trim());
736271
+ if ((event.success ?? false) && !editNoop) {
736272
+ recordEditToolPaths(lastToolCall.name, lastToolCall.args);
736273
+ }
735844
736274
  editHistory.logToolCall(
735845
736275
  lastToolCall.name,
735846
736276
  lastToolCall.args,
735847
- event.success ?? false
736277
+ event.success ?? false,
736278
+ rawContent2
735848
736279
  );
735849
736280
  lastToolCall = null;
735850
736281
  }
@@ -740418,10 +740849,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
740418
740849
  sharedTranscriber: null
740419
740850
  };
740420
740851
  const engine = getListenEngine();
740421
- const callConsensusRequired = (() => {
740422
- const env2 = String(process.env["OMNIUS_ASR_CONSENSUS"] ?? "").trim().toLowerCase();
740423
- return !(env2 === "0" || env2 === "off" || env2 === "false");
740424
- })();
740852
+ const callConsensusRequired = asrConsensusEnabled();
740425
740853
  const recentCallFinals = [];
740426
740854
  const normalizeCallTranscript = (value2) => value2.toLowerCase().replace(/[^\p{L}\p{N}\s']/gu, " ").replace(/\s+/g, " ").trim();
740427
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);
@@ -742447,13 +742875,13 @@ ${taskInput}`;
742447
742875
  writeContent(() => renderError(errMsg));
742448
742876
  if (failureStore) {
742449
742877
  try {
742450
- const { createHash: createHash47 } = await import("node:crypto");
742878
+ const { createHash: createHash48 } = await import("node:crypto");
742451
742879
  failureStore.insert({
742452
742880
  taskId: "",
742453
742881
  sessionId: `${Date.now()}`,
742454
742882
  repoRoot,
742455
742883
  failureType: "runtime-error",
742456
- fingerprint: createHash47("sha256").update(errMsg.slice(0, 200)).digest("hex").slice(0, 16),
742884
+ fingerprint: createHash48("sha256").update(errMsg.slice(0, 200)).digest("hex").slice(0, 16),
742457
742885
  filePath: null,
742458
742886
  errorMessage: errMsg.slice(0, 500),
742459
742887
  context: null,