omnius 1.0.32 → 1.0.34

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
@@ -127443,7 +127443,7 @@ var require_snapshot_recorder = __commonJS({
127443
127443
  "../node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
127444
127444
  "use strict";
127445
127445
  var { writeFile: writeFile22, readFile: readFile23, mkdir: mkdir18 } = __require("node:fs/promises");
127446
- var { dirname: dirname41, resolve: resolve49 } = __require("node:path");
127446
+ var { dirname: dirname40, resolve: resolve49 } = __require("node:path");
127447
127447
  var { setTimeout: setTimeout3, clearTimeout: clearTimeout3 } = __require("node:timers");
127448
127448
  var { InvalidArgumentError, UndiciError } = require_errors2();
127449
127449
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -127674,7 +127674,7 @@ var require_snapshot_recorder = __commonJS({
127674
127674
  throw new InvalidArgumentError("Snapshot path is required");
127675
127675
  }
127676
127676
  const resolvedPath = resolve49(path11);
127677
- await mkdir18(dirname41(resolvedPath), { recursive: true });
127677
+ await mkdir18(dirname40(resolvedPath), { recursive: true });
127678
127678
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
127679
127679
  hash,
127680
127680
  snapshot
@@ -241336,15 +241336,15 @@ var init_ls = __esm({
241336
241336
  });
241337
241337
 
241338
241338
  // ../node_modules/@helia/unixfs/dist/src/commands/mkdir.js
241339
- async function mkdir5(parentCid, dirname41, blockstore, options2 = {}) {
241340
- if (dirname41.includes("/")) {
241339
+ async function mkdir5(parentCid, dirname40, blockstore, options2 = {}) {
241340
+ if (dirname40.includes("/")) {
241341
241341
  throw new InvalidParametersError4("Path must not have slashes");
241342
241342
  }
241343
241343
  const entry = await exporter2(parentCid, blockstore, options2);
241344
241344
  if (entry.type !== "directory") {
241345
241345
  throw new NotADirectoryError(`${parentCid.toString()} was not a UnixFS directory`);
241346
241346
  }
241347
- log16("creating %s", dirname41);
241347
+ log16("creating %s", dirname40);
241348
241348
  const metadata = new UnixFS({
241349
241349
  type: "directory",
241350
241350
  mode: options2.mode,
@@ -241360,9 +241360,9 @@ async function mkdir5(parentCid, dirname41, blockstore, options2 = {}) {
241360
241360
  await blockstore.put(emptyDirCid, buf);
241361
241361
  const [directory, pblink] = await Promise.all([
241362
241362
  cidToDirectory(parentCid, blockstore, options2),
241363
- cidToPBLink(emptyDirCid, dirname41, blockstore, options2)
241363
+ cidToPBLink(emptyDirCid, dirname40, blockstore, options2)
241364
241364
  ]);
241365
- log16("adding empty dir called %s to %c", dirname41, parentCid);
241365
+ log16("adding empty dir called %s to %c", dirname40, parentCid);
241366
241366
  const result = await addLink(directory, pblink, blockstore, {
241367
241367
  ...options2,
241368
241368
  allowOverwriting: options2.force
@@ -241861,8 +241861,8 @@ var init_unixfs2 = __esm({
241861
241861
  async *ls(cid, options2 = {}) {
241862
241862
  yield* ls(cid, this.components.blockstore, options2);
241863
241863
  }
241864
- async mkdir(cid, dirname41, options2 = {}) {
241865
- return mkdir5(cid, dirname41, this.components.blockstore, options2);
241864
+ async mkdir(cid, dirname40, options2 = {}) {
241865
+ return mkdir5(cid, dirname40, this.components.blockstore, options2);
241866
241866
  }
241867
241867
  async rm(cid, path11, options2 = {}) {
241868
241868
  return rm3(cid, path11, this.components.blockstore, options2);
@@ -249106,7 +249106,7 @@ print("${sentinel}")
249106
249106
  if (!this.proc || this.proc.killed) {
249107
249107
  return { success: false, path: "" };
249108
249108
  }
249109
- const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync71 } = await import("node:fs");
249109
+ const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync70 } = await import("node:fs");
249110
249110
  const sessionDir = join31(this.cwd, ".omnius", "rlm");
249111
249111
  mkdirSync77(sessionDir, { recursive: true });
249112
249112
  const sessionPath2 = join31(sessionDir, "session.json");
@@ -249132,7 +249132,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
249132
249132
  trajectoryCount: this.trajectory.length,
249133
249133
  subCallCount: this.subCallCount
249134
249134
  };
249135
- writeFileSync71(sessionPath2, JSON.stringify(sessionData, null, 2), "utf8");
249135
+ writeFileSync70(sessionPath2, JSON.stringify(sessionData, null, 2), "utf8");
249136
249136
  return { success: true, path: sessionPath2 };
249137
249137
  }
249138
249138
  } catch {
@@ -249741,7 +249741,7 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
249741
249741
  /** Update memory scores based on task outcome. Called after task completion.
249742
249742
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
249743
249743
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
249744
- const { readFileSync: readFileSync102, writeFileSync: writeFileSync71, existsSync: existsSync124, mkdirSync: mkdirSync77 } = __require("node:fs");
249744
+ const { readFileSync: readFileSync102, writeFileSync: writeFileSync70, existsSync: existsSync124, mkdirSync: mkdirSync77 } = __require("node:fs");
249745
249745
  const metaDir = join32(this.cwd, ".omnius", "memory", "metabolism");
249746
249746
  const storeFile = join32(metaDir, "store.json");
249747
249747
  if (!existsSync124(storeFile))
@@ -249773,7 +249773,7 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
249773
249773
  }
249774
249774
  if (updated) {
249775
249775
  mkdirSync77(metaDir, { recursive: true });
249776
- writeFileSync71(storeFile, JSON.stringify(store2, null, 2));
249776
+ writeFileSync70(storeFile, JSON.stringify(store2, null, 2));
249777
249777
  }
249778
249778
  }
249779
249779
  // ── Storage ──────────────────────────────────────────────────────────
@@ -250219,7 +250219,7 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
250219
250219
  }
250220
250220
  /** Archive a strategy variant synchronously (for task completion path) */
250221
250221
  archiveVariantSync(strategy, outcome, tags = []) {
250222
- const { readFileSync: readFileSync102, writeFileSync: writeFileSync71, existsSync: existsSync124, mkdirSync: mkdirSync77 } = __require("node:fs");
250222
+ const { readFileSync: readFileSync102, writeFileSync: writeFileSync70, existsSync: existsSync124, mkdirSync: mkdirSync77 } = __require("node:fs");
250223
250223
  const dir = join34(this.cwd, ".omnius", "arche");
250224
250224
  const archiveFile = join34(dir, "variants.json");
250225
250225
  let variants = [];
@@ -250241,7 +250241,7 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
250241
250241
  if (variants.length > 50)
250242
250242
  variants = variants.slice(-50);
250243
250243
  mkdirSync77(dir, { recursive: true });
250244
- writeFileSync71(archiveFile, JSON.stringify(variants, null, 2));
250244
+ writeFileSync70(archiveFile, JSON.stringify(variants, null, 2));
250245
250245
  }
250246
250246
  async saveArchive(variants) {
250247
250247
  const dir = join34(this.cwd, ".omnius", "arche");
@@ -255916,6 +255916,141 @@ Note: Advanced Python pipeline not available — install pytesseract, opencv-pyt
255916
255916
  }
255917
255917
  });
255918
255918
 
255919
+ // packages/execution/dist/tools/dom-summary.js
255920
+ function downsampleDom(html) {
255921
+ const lines = [];
255922
+ let idx = 0;
255923
+ const titleMatch = html.match(/<title[^>]*>([^<]*)<\/title>/i);
255924
+ if (titleMatch)
255925
+ lines.push(`Page: ${titleMatch[1].trim()}`);
255926
+ const headings = html.matchAll(/<h([1-3])[^>]*>([\s\S]*?)<\/h\1>/gi);
255927
+ for (const m2 of headings) {
255928
+ const text = stripTags(m2[2]).trim();
255929
+ if (text && text.length > 1 && text.length < 200) {
255930
+ lines.push(`[H${m2[1]}] ${text}`);
255931
+ }
255932
+ }
255933
+ lines.push("");
255934
+ lines.push("Interactive elements:");
255935
+ const links2 = html.matchAll(/<a\b([^>]*)>([\s\S]*?)<\/a>/gi);
255936
+ for (const m2 of links2) {
255937
+ const href = m2[1].match(/href="([^"]+)"/)?.[1] || "";
255938
+ const text = stripTags(m2[2]).trim();
255939
+ if (text && text.length > 1 && href && !href.startsWith("#") && !href.startsWith("javascript:")) {
255940
+ idx++;
255941
+ const id = m2[1].match(/id="([^"]+)"/)?.[1] || "";
255942
+ const selector = id ? `a#${cssEscapeIdentifier(id)}` : `a[href="${cssEscapeAttribute(href)}"]`;
255943
+ lines.push(` [${idx}] LINK "${text.slice(0, 60)}" -> href: ${href.slice(0, 80)} -> selector: ${selector}`);
255944
+ }
255945
+ if (idx > 50)
255946
+ break;
255947
+ }
255948
+ const buttons = html.matchAll(/<button\b([^>]*)>([\s\S]*?)<\/button>/gi);
255949
+ for (const m2 of buttons) {
255950
+ const text = stripTags(m2[2]).trim();
255951
+ const id = m2[1].match(/id="([^"]+)"/)?.[1] || "";
255952
+ const cls = m2[1].match(/class="([^"]+)"/)?.[1]?.split(/\s+/).slice(0, 3).join(".") || "";
255953
+ if (text) {
255954
+ idx++;
255955
+ const selector = id ? `button#${id}` : cls ? `button.${cls}` : "button";
255956
+ lines.push(` [${idx}] BUTTON "${text.slice(0, 60)}" -> selector: ${selector}`);
255957
+ }
255958
+ }
255959
+ const inputs = html.matchAll(/<input\b([^>]*)>/gi);
255960
+ for (const m2 of inputs) {
255961
+ const type = m2[1].match(/type="([^"]+)"/)?.[1] || "text";
255962
+ if (type === "hidden")
255963
+ continue;
255964
+ const name10 = m2[1].match(/name="([^"]+)"/)?.[1] || "";
255965
+ const id = m2[1].match(/id="([^"]+)"/)?.[1] || "";
255966
+ const placeholder = m2[1].match(/placeholder="([^"]+)"/)?.[1] || "";
255967
+ const value2 = m2[1].match(/value="([^"]+)"/)?.[1] || "";
255968
+ idx++;
255969
+ const selector = id ? `input#${id}` : name10 ? `input[name="${name10}"]` : `input[type="${type}"]`;
255970
+ lines.push(` [${idx}] INPUT type=${type}${placeholder ? ` placeholder="${placeholder}"` : ""}${value2 ? ` value="${value2}"` : ""} -> selector: ${selector}`);
255971
+ }
255972
+ const textareas = html.matchAll(/<textarea\b([^>]*)>([\s\S]*?)<\/textarea>/gi);
255973
+ for (const m2 of textareas) {
255974
+ const id = m2[1].match(/id="([^"]+)"/)?.[1] || "";
255975
+ const name10 = m2[1].match(/name="([^"]+)"/)?.[1] || "";
255976
+ idx++;
255977
+ const selector = id ? `textarea#${id}` : name10 ? `textarea[name="${name10}"]` : "textarea";
255978
+ lines.push(` [${idx}] TEXTAREA -> selector: ${selector}`);
255979
+ }
255980
+ const selects = html.matchAll(/<select\b([^>]*)>([\s\S]*?)<\/select>/gi);
255981
+ for (const m2 of selects) {
255982
+ const id = m2[1].match(/id="([^"]+)"/)?.[1] || "";
255983
+ const name10 = m2[1].match(/name="([^"]+)"/)?.[1] || "";
255984
+ const cls = m2[1].match(/class="([^"]+)"/)?.[1]?.split(/\s+/).slice(0, 2).join(".") || "";
255985
+ idx++;
255986
+ const selector = id ? `select#${id}` : name10 ? `select[name="${name10}"]` : cls ? `select.${cls}` : "select";
255987
+ const options2 = m2[2].matchAll(/<option\b([^>]*)>([\s\S]*?)<\/option>/gi);
255988
+ const optList = [];
255989
+ const selected = [];
255990
+ for (const opt of options2) {
255991
+ const val = opt[1].match(/value="([^"]+)"/)?.[1] || "";
255992
+ const text = stripTags(opt[2]).trim();
255993
+ const isSel = /selected/i.test(opt[1]);
255994
+ if (text && val) {
255995
+ optList.push(`${val}="${text.slice(0, 30)}"`);
255996
+ if (isSel)
255997
+ selected.push(text);
255998
+ }
255999
+ }
256000
+ const selectedText = selected.length > 0 ? ` [SELECTED: ${selected.join(", ")}]` : "";
256001
+ const optPreview = optList.length <= 10 ? optList.join(", ") : optList.slice(0, 5).join(", ") + ` ... (${optList.length} total)`;
256002
+ lines.push(` [${idx}] SELECT${selectedText} -> selector: ${selector}`);
256003
+ lines.push(` options: ${optPreview}`);
256004
+ }
256005
+ const paragraphs = html.matchAll(/<p\b[^>]*>([\s\S]*?)<\/p>/gi);
256006
+ let pCount = 0;
256007
+ const textParts = [];
256008
+ for (const m2 of paragraphs) {
256009
+ const text = stripTags(m2[1]).trim();
256010
+ if (text && text.length > 20 && text.length < 500) {
256011
+ textParts.push(text.slice(0, 150));
256012
+ pCount++;
256013
+ if (pCount >= 5)
256014
+ break;
256015
+ }
256016
+ }
256017
+ if (textParts.length > 0) {
256018
+ lines.push("");
256019
+ lines.push("Visible text:");
256020
+ for (const t2 of textParts)
256021
+ lines.push(` ${t2}`);
256022
+ }
256023
+ lines.push("");
256024
+ lines.push(`Summary: ${idx} interactive elements found. Use 'click' with the selector shown, or 'type' with selector + text.`);
256025
+ lines.push("Indexes like [1] are references only; do not pass them as selectors.");
256026
+ lines.push(`For select/dropdown: use 'click' on 'select.CLASS option[value="CODE"]' to select an option.`);
256027
+ return lines.join("\n");
256028
+ }
256029
+ function cssEscapeAttribute(value2) {
256030
+ return value2.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
256031
+ }
256032
+ function cssEscapeIdentifier(value2) {
256033
+ return value2.replace(/([^a-zA-Z0-9_-])/g, "\\$1");
256034
+ }
256035
+ function stripTags(html) {
256036
+ return html.replace(/<[^>]+>/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim();
256037
+ }
256038
+ function extractDomSummarySelectors(summary) {
256039
+ const selectors2 = /* @__PURE__ */ new Map();
256040
+ for (const line of summary.split(/\r?\n/)) {
256041
+ const match = line.match(/^\s+\[(\d+)\].* -> selector: (.+)$/);
256042
+ if (!match)
256043
+ continue;
256044
+ selectors2.set(Number(match[1]), match[2].trim());
256045
+ }
256046
+ return selectors2;
256047
+ }
256048
+ var init_dom_summary = __esm({
256049
+ "packages/execution/dist/tools/dom-summary.js"() {
256050
+ "use strict";
256051
+ }
256052
+ });
256053
+
255919
256054
  // packages/execution/dist/tools/browser-action.js
255920
256055
  import { execSync as execSync19, spawn as spawn12 } from "node:child_process";
255921
256056
  import { copyFileSync, existsSync as existsSync30, mkdirSync as mkdirSync10, readFileSync as readFileSync24 } from "node:fs";
@@ -256068,119 +256203,11 @@ async function apiCall(endpoint, method = "POST", body) {
256068
256203
  const res = await fetch(url, options2);
256069
256204
  return await res.json();
256070
256205
  }
256071
- function downsampleDom(html) {
256072
- const lines = [];
256073
- let idx = 0;
256074
- const titleMatch = html.match(/<title[^>]*>([^<]*)<\/title>/i);
256075
- if (titleMatch)
256076
- lines.push(`Page: ${titleMatch[1].trim()}`);
256077
- const headings = html.matchAll(/<h([1-3])[^>]*>([\s\S]*?)<\/h\1>/gi);
256078
- for (const m2 of headings) {
256079
- const text = stripTags(m2[2]).trim();
256080
- if (text && text.length > 1 && text.length < 200) {
256081
- lines.push(`[H${m2[1]}] ${text}`);
256082
- }
256083
- }
256084
- lines.push("");
256085
- lines.push("Interactive elements:");
256086
- const links2 = html.matchAll(/<a\b([^>]*)>([\s\S]*?)<\/a>/gi);
256087
- for (const m2 of links2) {
256088
- const href = m2[1].match(/href="([^"]+)"/)?.[1] || "";
256089
- const text = stripTags(m2[2]).trim();
256090
- if (text && text.length > 1 && href && !href.startsWith("#") && !href.startsWith("javascript:")) {
256091
- idx++;
256092
- lines.push(` [${idx}] LINK "${text.slice(0, 60)}" → ${href.slice(0, 80)}`);
256093
- }
256094
- if (idx > 50)
256095
- break;
256096
- }
256097
- const buttons = html.matchAll(/<button\b([^>]*)>([\s\S]*?)<\/button>/gi);
256098
- for (const m2 of buttons) {
256099
- const text = stripTags(m2[2]).trim();
256100
- const id = m2[1].match(/id="([^"]+)"/)?.[1] || "";
256101
- const cls = m2[1].match(/class="([^"]+)"/)?.[1]?.split(/\s+/).slice(0, 3).join(".") || "";
256102
- if (text && text.length > 0) {
256103
- idx++;
256104
- const selector = id ? `button#${id}` : cls ? `button.${cls}` : "button";
256105
- lines.push(` [${idx}] BUTTON "${text.slice(0, 60)}" → selector: ${selector}`);
256106
- }
256107
- }
256108
- const inputs = html.matchAll(/<input\b([^>]*)>/gi);
256109
- for (const m2 of inputs) {
256110
- const type = m2[1].match(/type="([^"]+)"/)?.[1] || "text";
256111
- if (type === "hidden")
256112
- continue;
256113
- const name10 = m2[1].match(/name="([^"]+)"/)?.[1] || "";
256114
- const id = m2[1].match(/id="([^"]+)"/)?.[1] || "";
256115
- const placeholder = m2[1].match(/placeholder="([^"]+)"/)?.[1] || "";
256116
- const value2 = m2[1].match(/value="([^"]+)"/)?.[1] || "";
256117
- idx++;
256118
- const selector = id ? `input#${id}` : name10 ? `input[name="${name10}"]` : `input[type="${type}"]`;
256119
- lines.push(` [${idx}] INPUT type=${type}${placeholder ? ` placeholder="${placeholder}"` : ""}${value2 ? ` value="${value2}"` : ""} → selector: ${selector}`);
256120
- }
256121
- const textareas = html.matchAll(/<textarea\b([^>]*)>([\s\S]*?)<\/textarea>/gi);
256122
- for (const m2 of textareas) {
256123
- const id = m2[1].match(/id="([^"]+)"/)?.[1] || "";
256124
- const name10 = m2[1].match(/name="([^"]+)"/)?.[1] || "";
256125
- idx++;
256126
- const selector = id ? `textarea#${id}` : name10 ? `textarea[name="${name10}"]` : "textarea";
256127
- lines.push(` [${idx}] TEXTAREA → selector: ${selector}`);
256128
- }
256129
- const selects = html.matchAll(/<select\b([^>]*)>([\s\S]*?)<\/select>/gi);
256130
- for (const m2 of selects) {
256131
- const id = m2[1].match(/id="([^"]+)"/)?.[1] || "";
256132
- const name10 = m2[1].match(/name="([^"]+)"/)?.[1] || "";
256133
- const cls = m2[1].match(/class="([^"]+)"/)?.[1]?.split(/\s+/).slice(0, 2).join(".") || "";
256134
- idx++;
256135
- const selector = id ? `select#${id}` : name10 ? `select[name="${name10}"]` : cls ? `select.${cls}` : "select";
256136
- const options2 = m2[2].matchAll(/<option\b([^>]*)>([\s\S]*?)<\/option>/gi);
256137
- const optList = [];
256138
- const selected = [];
256139
- for (const opt of options2) {
256140
- const val = opt[1].match(/value="([^"]+)"/)?.[1] || "";
256141
- const text = stripTags(opt[2]).trim();
256142
- const isSel = /selected/i.test(opt[1]);
256143
- if (text && val) {
256144
- optList.push(`${val}="${text.slice(0, 30)}"`);
256145
- if (isSel)
256146
- selected.push(text);
256147
- }
256148
- }
256149
- const selectedText = selected.length > 0 ? ` [SELECTED: ${selected.join(", ")}]` : "";
256150
- const optPreview = optList.length <= 10 ? optList.join(", ") : optList.slice(0, 5).join(", ") + ` ... (${optList.length} total)`;
256151
- lines.push(` [${idx}] SELECT${selectedText} → selector: ${selector}`);
256152
- lines.push(` options: ${optPreview}`);
256153
- }
256154
- const paragraphs = html.matchAll(/<p\b[^>]*>([\s\S]*?)<\/p>/gi);
256155
- let pCount = 0;
256156
- const textParts = [];
256157
- for (const m2 of paragraphs) {
256158
- const text = stripTags(m2[1]).trim();
256159
- if (text && text.length > 20 && text.length < 500) {
256160
- textParts.push(text.slice(0, 150));
256161
- pCount++;
256162
- if (pCount >= 5)
256163
- break;
256164
- }
256165
- }
256166
- if (textParts.length > 0) {
256167
- lines.push("");
256168
- lines.push("Visible text:");
256169
- for (const t2 of textParts)
256170
- lines.push(` ${t2}`);
256171
- }
256172
- lines.push("");
256173
- lines.push(`Summary: ${idx} interactive elements found. Use 'click' with the selector shown, or 'type' with selector + text.`);
256174
- lines.push(`For select/dropdown: use 'click' on 'select.CLASS option[value="CODE"]' to select an option.`);
256175
- return lines.join("\n");
256176
- }
256177
- function stripTags(html) {
256178
- return html.replace(/<[^>]+>/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim();
256179
- }
256180
256206
  var __dirname4, DEFAULT_PORT, SCRAPE_SCRIPT, BASE_URL, serviceProcess, activeSessionId, BrowserActionTool;
256181
256207
  var init_browser_action = __esm({
256182
256208
  "packages/execution/dist/tools/browser-action.js"() {
256183
256209
  "use strict";
256210
+ init_dom_summary();
256184
256211
  __dirname4 = dirname11(fileURLToPath6(import.meta.url));
256185
256212
  DEFAULT_PORT = 8130;
256186
256213
  SCRAPE_SCRIPT = findScrapeScript();
@@ -256545,15 +256572,114 @@ var init_browser_action = __esm({
256545
256572
  });
256546
256573
 
256547
256574
  // packages/execution/dist/tools/playwright-browser.js
256548
- import { execSync as execSync20, exec } from "node:child_process";
256549
- import { existsSync as existsSync31, writeFileSync as writeFileSync12, mkdirSync as mkdirSync11 } from "node:fs";
256550
- import { join as join43, dirname as dirname12 } from "node:path";
256575
+ import { execFileSync as execFileSync3, execSync as execSync20 } from "node:child_process";
256576
+ import { existsSync as existsSync31, mkdirSync as mkdirSync11 } from "node:fs";
256577
+ import { join as join43 } from "node:path";
256578
+ import { pathToFileURL } from "node:url";
256551
256579
  import { homedir as homedir10 } from "node:os";
256552
256580
  function pushBounded(buf, item) {
256553
256581
  buf.push(item);
256554
256582
  if (buf.length > MAX_BUFFER)
256555
256583
  buf.splice(0, buf.length - MAX_BUFFER);
256556
256584
  }
256585
+ function which(cmd) {
256586
+ try {
256587
+ const out = execFileSync3("which", [cmd], {
256588
+ encoding: "utf8",
256589
+ stdio: ["ignore", "pipe", "ignore"],
256590
+ timeout: 2e3
256591
+ }).trim();
256592
+ const first2 = out.split(/\r?\n/)[0]?.trim();
256593
+ return first2 && existsSync31(first2) ? first2 : null;
256594
+ } catch {
256595
+ return null;
256596
+ }
256597
+ }
256598
+ function findSystemChromiumExecutable() {
256599
+ const envPath = process.env["OMNIUS_PLAYWRIGHT_CHROMIUM"] || process.env["PLAYWRIGHT_CHROMIUM_EXECUTABLE"];
256600
+ if (envPath && existsSync31(envPath))
256601
+ return envPath;
256602
+ const candidates = [
256603
+ "/opt/google/chrome-canary/chrome",
256604
+ "/usr/bin/google-chrome",
256605
+ "/usr/bin/google-chrome-stable",
256606
+ "/usr/bin/chromium",
256607
+ "/usr/bin/chromium-browser",
256608
+ "/snap/bin/chromium",
256609
+ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
256610
+ "/Applications/Chromium.app/Contents/MacOS/Chromium"
256611
+ ];
256612
+ for (const candidate of candidates) {
256613
+ if (existsSync31(candidate))
256614
+ return candidate;
256615
+ }
256616
+ for (const command of ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]) {
256617
+ const resolved = which(command);
256618
+ if (resolved)
256619
+ return resolved;
256620
+ }
256621
+ return null;
256622
+ }
256623
+ async function importPlaywrightFromRuntime() {
256624
+ for (const rel of ["index.mjs", "index.js"]) {
256625
+ const entry = join43(PLAYWRIGHT_RUNTIME_DIR, "node_modules", "playwright", rel);
256626
+ if (!existsSync31(entry))
256627
+ continue;
256628
+ pw = await dynamicImport(pathToFileURL(entry).href);
256629
+ return true;
256630
+ }
256631
+ return false;
256632
+ }
256633
+ function runNpm(args, timeout2 = 3e5, extraEnv = {}) {
256634
+ return execFileSync3("npm", args, {
256635
+ cwd: PLAYWRIGHT_RUNTIME_DIR,
256636
+ encoding: "utf8",
256637
+ stdio: ["ignore", "pipe", "pipe"],
256638
+ timeout: timeout2,
256639
+ env: {
256640
+ ...process.env,
256641
+ PLAYWRIGHT_BROWSERS_PATH: PLAYWRIGHT_BROWSERS_DIR,
256642
+ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1",
256643
+ npm_config_audit: "false",
256644
+ npm_config_fund: "false",
256645
+ CI: "true",
256646
+ ...extraEnv
256647
+ }
256648
+ });
256649
+ }
256650
+ async function installPlaywrightPackage() {
256651
+ try {
256652
+ mkdirSync11(PLAYWRIGHT_RUNTIME_DIR, { recursive: true });
256653
+ runNpm(["install", "--prefix", PLAYWRIGHT_RUNTIME_DIR, "playwright@latest", "--no-audit", "--no-fund", "--loglevel=error"]);
256654
+ if (await importPlaywrightFromRuntime())
256655
+ return null;
256656
+ return `Playwright installed under ${PLAYWRIGHT_RUNTIME_DIR}, but the module entry was not found.`;
256657
+ } catch (err) {
256658
+ const msg = err instanceof Error ? err.message : String(err);
256659
+ return `Failed to install Playwright package without privileged commands: ${msg}`;
256660
+ }
256661
+ }
256662
+ function looksLikeMissingPlaywrightBrowser(err) {
256663
+ const msg = err instanceof Error ? err.message : String(err);
256664
+ return /Executable doesn't exist|Please run the following command to download new browsers|playwright install/i.test(msg);
256665
+ }
256666
+ async function installPlaywrightBrowser() {
256667
+ try {
256668
+ mkdirSync11(PLAYWRIGHT_RUNTIME_DIR, { recursive: true });
256669
+ if (!existsSync31(join43(PLAYWRIGHT_RUNTIME_DIR, "node_modules", "playwright", "package.json"))) {
256670
+ const packageErr = await installPlaywrightPackage();
256671
+ if (packageErr)
256672
+ return packageErr;
256673
+ }
256674
+ runNpm(["exec", "--prefix", PLAYWRIGHT_RUNTIME_DIR, "--", "playwright", "install", "chromium"], 3e5, {
256675
+ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: void 0
256676
+ });
256677
+ return null;
256678
+ } catch (err) {
256679
+ const msg = err instanceof Error ? err.message : String(err);
256680
+ return `Failed to install Playwright Chromium without OS dependency escalation: ${msg}`;
256681
+ }
256682
+ }
256557
256683
  async function ensurePlaywright() {
256558
256684
  if (pw)
256559
256685
  return null;
@@ -256562,18 +256688,14 @@ async function ensurePlaywright() {
256562
256688
  return null;
256563
256689
  } catch {
256564
256690
  try {
256565
- mkdirSync11(join43(homedir10(), ".omnius"), { recursive: true });
256566
- execSync20("npm install playwright@latest 2>&1 && npx playwright install chromium --with-deps 2>&1", {
256567
- timeout: 3e5,
256568
- encoding: "utf8",
256569
- stdio: "pipe",
256570
- cwd: join43(homedir10(), ".omnius")
256571
- });
256572
- pw = await dynamicImport("playwright");
256573
- return null;
256574
- } catch (err) {
256575
- return `Failed to install Playwright: ${err instanceof Error ? err.message : String(err)}. Run: npm install playwright && npx playwright install chromium`;
256691
+ if (await importPlaywrightFromRuntime())
256692
+ return null;
256693
+ } catch {
256576
256694
  }
256695
+ const installErr = await installPlaywrightPackage();
256696
+ if (!installErr)
256697
+ return null;
256698
+ return `${installErr}. Install manually with: npm install playwright. Do not run Playwright --with-deps from an agent session.`;
256577
256699
  }
256578
256700
  }
256579
256701
  async function ensureBrowser() {
@@ -256583,9 +256705,11 @@ async function ensureBrowser() {
256583
256705
  if (!pw)
256584
256706
  return "Playwright not loaded";
256585
256707
  if (!browser2 || !browser2.isConnected?.()) {
256708
+ const executablePath = findSystemChromiumExecutable();
256586
256709
  try {
256587
256710
  browser2 = await pw.chromium.launch({
256588
256711
  headless: true,
256712
+ ...executablePath ? { executablePath } : {},
256589
256713
  args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage"]
256590
256714
  });
256591
256715
  context = await browser2.newContext({
@@ -256595,6 +256719,26 @@ async function ensureBrowser() {
256595
256719
  page = await context.newPage();
256596
256720
  attachDiagnosticListeners(page);
256597
256721
  } catch (err) {
256722
+ if (!executablePath && looksLikeMissingPlaywrightBrowser(err)) {
256723
+ const browserInstallErr = await installPlaywrightBrowser();
256724
+ if (browserInstallErr)
256725
+ return browserInstallErr;
256726
+ try {
256727
+ browser2 = await pw.chromium.launch({
256728
+ headless: true,
256729
+ args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage"]
256730
+ });
256731
+ context = await browser2.newContext({
256732
+ viewport: { width: 1280, height: 720 },
256733
+ userAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
256734
+ });
256735
+ page = await context.newPage();
256736
+ attachDiagnosticListeners(page);
256737
+ return null;
256738
+ } catch (retryErr) {
256739
+ return `Failed to launch Playwright Chromium after browser download: ${retryErr instanceof Error ? retryErr.message : String(retryErr)}. If this mentions missing shared libraries, install OS dependencies outside Omnius.`;
256740
+ }
256741
+ }
256598
256742
  return `Failed to launch browser: ${err instanceof Error ? err.message : String(err)}`;
256599
256743
  }
256600
256744
  }
@@ -256657,6 +256801,13 @@ function clearDiagnosticBuffers() {
256657
256801
  consoleBuffer = [];
256658
256802
  networkBuffer = [];
256659
256803
  errorBuffer = [];
256804
+ lastDomSummarySelectors = /* @__PURE__ */ new Map();
256805
+ }
256806
+ function resolveDomSummarySelector(selector) {
256807
+ const match = selector.trim().match(/^\[(\d+)\]$/);
256808
+ if (!match)
256809
+ return selector;
256810
+ return lastDomSummarySelectors.get(Number(match[1])) ?? null;
256660
256811
  }
256661
256812
  function ok(output, start2) {
256662
256813
  return { success: true, output, durationMs: Date.now() - start2 };
@@ -256664,10 +256815,11 @@ function ok(output, start2) {
256664
256815
  function fail(error, start2) {
256665
256816
  return { success: false, output: "", error, durationMs: Date.now() - start2 };
256666
256817
  }
256667
- var pw, browser2, context, page, MAX_BUFFER, consoleBuffer, networkBuffer, errorBuffer, dynamicImport, PlaywrightBrowserTool;
256818
+ var pw, browser2, context, page, MAX_BUFFER, consoleBuffer, networkBuffer, errorBuffer, lastDomSummarySelectors, dynamicImport, PLAYWRIGHT_RUNTIME_DIR, PLAYWRIGHT_BROWSERS_DIR, PlaywrightBrowserTool;
256668
256819
  var init_playwright_browser = __esm({
256669
256820
  "packages/execution/dist/tools/playwright-browser.js"() {
256670
256821
  "use strict";
256822
+ init_dom_summary();
256671
256823
  pw = null;
256672
256824
  browser2 = null;
256673
256825
  context = null;
@@ -256676,10 +256828,13 @@ var init_playwright_browser = __esm({
256676
256828
  consoleBuffer = [];
256677
256829
  networkBuffer = [];
256678
256830
  errorBuffer = [];
256831
+ lastDomSummarySelectors = /* @__PURE__ */ new Map();
256679
256832
  dynamicImport = new Function("mod", "return import(mod)");
256833
+ PLAYWRIGHT_RUNTIME_DIR = join43(homedir10(), ".omnius", "playwright-runtime");
256834
+ PLAYWRIGHT_BROWSERS_DIR = join43(PLAYWRIGHT_RUNTIME_DIR, "browsers");
256680
256835
  PlaywrightBrowserTool = class {
256681
256836
  name = "playwright_browser";
256682
- description = "Full-scope Playwright browser automation + diagnostic capture. Launches a persistent headless Chromium session. Beyond navigation/interaction, this tool buffers everything the running app emits (console messages, network requests, JS exceptions, accessibility tree) so the agent can verify what is ACTUALLY happening — not just what the build/test reports. Auto-installs Playwright + Chromium on first use. Diagnostic actions: console_logs, network_log, page_errors, a11y_snapshot, bounding_box, query_all, performance, cookies, storage, viewport, clear_diagnostics. Interaction actions: navigate, click, fill, type, press, select, check, hover. Capture actions: screenshot, pdf, content, innerText, innerHTML, getAttribute, evaluate. Workflow: navigate → screenshot or content → console_logs/network_log/page_errors to verify state → click/fill/type to drive UI → repeat.";
256837
+ description = "Full-scope Playwright browser automation + diagnostic capture. Launches a persistent headless Chromium session. Beyond navigation/interaction, this tool buffers everything the running app emits (console messages, network requests, JS exceptions, accessibility tree) so the agent can verify what is ACTUALLY happening — not just what the build/test reports. Auto-installs Playwright + Chromium on first use without sudo or OS package manager escalation. Diagnostic actions: dom_summary, dom, console_logs, network_log, page_errors, a11y_snapshot, bounding_box, query_all, performance, cookies, storage, viewport, clear_diagnostics. Interaction actions: navigate, click, fill, type, press, select, check, hover. Capture actions: screenshot, pdf, content, innerText, innerHTML, getAttribute, evaluate. Workflow: navigate → screenshot or content → console_logs/network_log/page_errors to verify state → click/fill/type to drive UI → repeat.";
256683
256838
  parameters = {
256684
256839
  type: "object",
256685
256840
  properties: {
@@ -256694,6 +256849,8 @@ var init_playwright_browser = __esm({
256694
256849
  "screenshot",
256695
256850
  "evaluate",
256696
256851
  "content",
256852
+ "dom",
256853
+ "dom_summary",
256697
256854
  "innerText",
256698
256855
  "select",
256699
256856
  "check",
@@ -256725,7 +256882,7 @@ var init_playwright_browser = __esm({
256725
256882
  "clear_diagnostics",
256726
256883
  "close"
256727
256884
  ],
256728
- description: "Action to perform:\n- navigate: go to a URL\n- click: click element by selector\n- fill: clear input and type text (for form fields)\n- type: type text character by character (simulates real typing)\n- press: press a key (Enter, Tab, Escape, etc.)\n- screenshot: capture the headless browser page, not the desktop; use value to choose the output file path\n- evaluate: run JavaScript in page context\n- content: get page text content (readable, stripped)\n- innerText: get innerText of a specific element\n- select: select dropdown option by value\n- check/uncheck: toggle checkbox\n- hover: hover over element\n- wait: wait for a selector to appear\n- waitForNavigation: wait for page navigation to complete\n- waitForSelector: wait for element matching selector\n- title: get page title\n- url: get current URL\n- getAttribute: get element attribute value\n- innerHTML: get element's innerHTML\n- textContent: get element's textContent\n- goBack/goForward/reload: browser navigation\n- pdf: save page as PDF\n- close: close browser session"
256885
+ description: "Action to perform:\n- navigate: go to a URL\n- click: click element by selector\n- fill: clear input and type text (for form fields)\n- type: type text character by character (simulates real typing)\n- press: press a key (Enter, Tab, Escape, etc.)\n- screenshot: capture the headless browser page, not the desktop; use value to choose the output file path\n- evaluate: run JavaScript in page context\n- content: get page text content (readable, stripped)\n- dom: get raw page HTML (truncated)\n- dom_summary: compact interactive DOM summary with selectors\n- innerText: get innerText of a specific element\n- select: select dropdown option by value\n- check/uncheck: toggle checkbox\n- hover: hover over element\n- wait: wait for a selector to appear\n- waitForNavigation: wait for page navigation to complete\n- waitForSelector: wait for element matching selector\n- title: get page title\n- url: get current URL\n- getAttribute: get element attribute value\n- innerHTML: get element's innerHTML\n- textContent: get element's textContent\n- goBack/goForward/reload: browser navigation\n- pdf: save page as PDF\n- close: close browser session"
256729
256886
  },
256730
256887
  url: {
256731
256888
  type: "string",
@@ -256743,9 +256900,29 @@ var init_playwright_browser = __esm({
256743
256900
  type: "string",
256744
256901
  description: "Value for select action, or file path for screenshot/pdf"
256745
256902
  },
256903
+ output_path: {
256904
+ type: "string",
256905
+ description: "Alias for screenshot/pdf output file path; matches browser_action's screenshot contract"
256906
+ },
256907
+ path: {
256908
+ type: "string",
256909
+ description: "Alias for screenshot/pdf output file path"
256910
+ },
256746
256911
  timeout: {
256747
256912
  type: "number",
256748
256913
  description: "Timeout in milliseconds (default: 10000)"
256914
+ },
256915
+ width: {
256916
+ type: "number",
256917
+ description: "Viewport width in CSS pixels for screenshot/viewport actions"
256918
+ },
256919
+ height: {
256920
+ type: "number",
256921
+ description: "Viewport height in CSS pixels for screenshot/viewport actions"
256922
+ },
256923
+ full_page: {
256924
+ type: "boolean",
256925
+ description: "For screenshot: capture the full scrollable page instead of the current viewport"
256749
256926
  }
256750
256927
  },
256751
256928
  required: ["action"]
@@ -256757,7 +256934,10 @@ var init_playwright_browser = __esm({
256757
256934
  const text = args.text;
256758
256935
  const url = args.url;
256759
256936
  const value2 = args.value;
256937
+ const outputPath2 = typeof args.output_path === "string" && args.output_path.trim() ? args.output_path.trim() : typeof args.path === "string" && args.path.trim() ? args.path.trim() : void 0;
256760
256938
  const timeout2 = args.timeout || 1e4;
256939
+ const width = typeof args.width === "number" ? Math.max(320, Math.min(3840, Math.round(args.width))) : void 0;
256940
+ const height = typeof args.height === "number" ? Math.max(240, Math.min(2160, Math.round(args.height))) : void 0;
256761
256941
  if (action === "close") {
256762
256942
  try {
256763
256943
  if (page && !page.isClosed())
@@ -256809,8 +256989,11 @@ var init_playwright_browser = __esm({
256809
256989
  case "click": {
256810
256990
  if (!selector)
256811
256991
  return fail("selector is required", start2);
256812
- await page.click(selector, { timeout: timeout2 });
256813
- return ok(`Clicked: ${selector}`, start2);
256992
+ const resolvedSelector = resolveDomSummarySelector(selector);
256993
+ if (!resolvedSelector)
256994
+ return fail(`No selector known for DOM summary reference ${selector}; run dom_summary and use the emitted selector.`, start2);
256995
+ await page.click(resolvedSelector, { timeout: timeout2 });
256996
+ return ok(`Clicked: ${resolvedSelector}${resolvedSelector !== selector ? ` (from ${selector})` : ""}`, start2);
256814
256997
  }
256815
256998
  case "fill": {
256816
256999
  if (!selector)
@@ -256860,8 +257043,11 @@ var init_playwright_browser = __esm({
256860
257043
  case "hover": {
256861
257044
  if (!selector)
256862
257045
  return fail("selector is required", start2);
256863
- await page.hover(selector, { timeout: timeout2 });
256864
- return ok(`Hovered: ${selector}`, start2);
257046
+ const resolvedSelector = resolveDomSummarySelector(selector);
257047
+ if (!resolvedSelector)
257048
+ return fail(`No selector known for DOM summary reference ${selector}; run dom_summary and use the emitted selector.`, start2);
257049
+ await page.hover(resolvedSelector, { timeout: timeout2 });
257050
+ return ok(`Hovered: ${resolvedSelector}${resolvedSelector !== selector ? ` (from ${selector})` : ""}`, start2);
256865
257051
  }
256866
257052
  // ── Waiting ──
256867
257053
  case "wait":
@@ -256887,6 +257073,19 @@ var init_playwright_browser = __esm({
256887
257073
 
256888
257074
  [truncated — ${textContent.length} chars total]` : ""), start2);
256889
257075
  }
257076
+ case "dom": {
257077
+ const html = await page.content();
257078
+ const truncated = html.slice(0, 5e4);
257079
+ return ok(truncated + (html.length > 5e4 ? `
257080
+
257081
+ [truncated - ${html.length} chars total]` : ""), start2);
257082
+ }
257083
+ case "dom_summary": {
257084
+ const html = await page.content();
257085
+ const summary = downsampleDom(html);
257086
+ lastDomSummarySelectors = extractDomSummarySelectors(summary);
257087
+ return ok(summary, start2);
257088
+ }
256890
257089
  case "innerText": {
256891
257090
  if (!selector)
256892
257091
  return fail("selector is required", start2);
@@ -256926,8 +257125,15 @@ var init_playwright_browser = __esm({
256926
257125
  }
256927
257126
  // ── Screenshot / PDF ──
256928
257127
  case "screenshot": {
256929
- const filePath = value2 || "screenshot.png";
256930
- await page.screenshot({ path: filePath, fullPage: false });
257128
+ if (width || height) {
257129
+ const current = page.viewportSize?.() ?? { width: 1280, height: 720 };
257130
+ await page.setViewportSize({
257131
+ width: width ?? current.width ?? 1280,
257132
+ height: height ?? current.height ?? 720
257133
+ });
257134
+ }
257135
+ const filePath = outputPath2 || value2 || "screenshot.png";
257136
+ await page.screenshot({ path: filePath, fullPage: args.full_page === true });
256931
257137
  let b64 = null;
256932
257138
  let mimeType = "image/png";
256933
257139
  try {
@@ -256958,7 +257164,7 @@ var init_playwright_browser = __esm({
256958
257164
  return ok(`Screenshot saved to ${filePath}`, start2);
256959
257165
  }
256960
257166
  case "pdf": {
256961
- const pdfPath = value2 || "page.pdf";
257167
+ const pdfPath = outputPath2 || value2 || "page.pdf";
256962
257168
  await page.pdf({ path: pdfPath, format: "A4" });
256963
257169
  return ok(`PDF saved to ${pdfPath}`, start2);
256964
257170
  }
@@ -257108,6 +257314,15 @@ ${lines.join("\n")}`, start2);
257108
257314
  ${JSON.stringify(data, null, 2)}`, start2);
257109
257315
  }
257110
257316
  case "viewport": {
257317
+ if (width || height) {
257318
+ const current = page.viewportSize?.() ?? { width: 1280, height: 720 };
257319
+ const next = {
257320
+ width: width ?? current.width ?? 1280,
257321
+ height: height ?? current.height ?? 720
257322
+ };
257323
+ await page.setViewportSize(next);
257324
+ return ok(`Viewport set to ${next.width}x${next.height}`, start2);
257325
+ }
257111
257326
  const v = (text || value2 || "").trim();
257112
257327
  const m2 = v.match(/^(\d+)\s*[x×]\s*(\d+)$/);
257113
257328
  if (m2) {
@@ -257141,11 +257356,11 @@ ${JSON.stringify(data, null, 2)}`, start2);
257141
257356
 
257142
257357
  // packages/execution/dist/tools/autoresearch.js
257143
257358
  import { execSync as execSync21, spawn as spawn13 } from "node:child_process";
257144
- import { existsSync as existsSync32, readFileSync as readFileSync25, writeFileSync as writeFileSync13, mkdirSync as mkdirSync12, appendFileSync, copyFileSync as copyFileSync2 } from "node:fs";
257145
- import { join as join44, resolve as resolve25, dirname as dirname13 } from "node:path";
257359
+ import { existsSync as existsSync32, readFileSync as readFileSync25, writeFileSync as writeFileSync12, mkdirSync as mkdirSync12, appendFileSync, copyFileSync as copyFileSync2 } from "node:fs";
257360
+ import { join as join44, resolve as resolve25, dirname as dirname12 } from "node:path";
257146
257361
  import { fileURLToPath as fileURLToPath7 } from "node:url";
257147
257362
  function findAutoresearchScript(scriptName) {
257148
- const thisDir = dirname13(fileURLToPath7(import.meta.url));
257363
+ const thisDir = dirname12(fileURLToPath7(import.meta.url));
257149
257364
  const devPath3 = resolve25(thisDir, "../../scripts", scriptName);
257150
257365
  if (existsSync32(devPath3))
257151
257366
  return devPath3;
@@ -257323,7 +257538,7 @@ name = "pytorch-cu128"
257323
257538
  url = "https://download.pytorch.org/whl/cu128"
257324
257539
  explicit = true
257325
257540
  `;
257326
- writeFileSync13(join44(workspace, "pyproject.toml"), pyprojectContent, "utf-8");
257541
+ writeFileSync12(join44(workspace, "pyproject.toml"), pyprojectContent, "utf-8");
257327
257542
  output.push("Created pyproject.toml");
257328
257543
  try {
257329
257544
  execSync21("git rev-parse --git-dir", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
@@ -257367,7 +257582,7 @@ explicit = true
257367
257582
  }
257368
257583
  const tsvPath = join44(workspace, "results.tsv");
257369
257584
  if (!existsSync32(tsvPath)) {
257370
- writeFileSync13(tsvPath, "commit val_bpb memory_gb status description\n", "utf-8");
257585
+ writeFileSync12(tsvPath, "commit val_bpb memory_gb status description\n", "utf-8");
257371
257586
  output.push("Created results.tsv");
257372
257587
  }
257373
257588
  return {
@@ -257429,7 +257644,7 @@ Next steps:
257429
257644
  clearTimeout(timer);
257430
257645
  const fullLog = stdout + "\n" + stderr;
257431
257646
  try {
257432
- writeFileSync13(logPath3, fullLog, "utf-8");
257647
+ writeFileSync12(logPath3, fullLog, "utf-8");
257433
257648
  } catch {
257434
257649
  }
257435
257650
  if (timedOut) {
@@ -257469,7 +257684,7 @@ ${fullLog.slice(-2e3)}`,
257469
257684
  return;
257470
257685
  }
257471
257686
  try {
257472
- writeFileSync13(join44(workspace, ".last-result.json"), JSON.stringify(result, null, 2), "utf-8");
257687
+ writeFileSync12(join44(workspace, ".last-result.json"), JSON.stringify(result, null, 2), "utf-8");
257473
257688
  } catch {
257474
257689
  }
257475
257690
  const memGB = (result.peak_vram_mb / 1024).toFixed(1);
@@ -261487,7 +261702,7 @@ var init_project_scaffolding = __esm({
261487
261702
  });
261488
261703
 
261489
261704
  // packages/execution/dist/tools/todo-store.js
261490
- import { existsSync as existsSync35, readFileSync as readFileSync26, writeFileSync as writeFileSync14, mkdirSync as mkdirSync13, renameSync, unlinkSync as unlinkSync5, readdirSync as readdirSync11 } from "node:fs";
261705
+ import { existsSync as existsSync35, readFileSync as readFileSync26, writeFileSync as writeFileSync13, mkdirSync as mkdirSync13, renameSync, unlinkSync as unlinkSync5, readdirSync as readdirSync11 } from "node:fs";
261491
261706
  import { join as join51 } from "node:path";
261492
261707
  import { homedir as homedir13 } from "node:os";
261493
261708
  import { randomBytes as randomBytes15 } from "node:crypto";
@@ -261547,7 +261762,7 @@ function writeTodos(sessionId, incoming) {
261547
261762
  const finalPath = todoPath(sessionId);
261548
261763
  const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
261549
261764
  try {
261550
- writeFileSync14(tmpPath, JSON.stringify(newTodos, null, 2), "utf-8");
261765
+ writeFileSync13(tmpPath, JSON.stringify(newTodos, null, 2), "utf-8");
261551
261766
  renameSync(tmpPath, finalPath);
261552
261767
  } catch (err) {
261553
261768
  try {
@@ -261789,10 +262004,10 @@ var init_todo_write = __esm({
261789
262004
 
261790
262005
  // packages/execution/dist/tools/repo-map.js
261791
262006
  import { readdirSync as readdirSync12, readFileSync as readFileSync27, statSync as statSync14, existsSync as existsSync36 } from "node:fs";
261792
- import { join as join52, relative as relative3, extname as extname7, dirname as dirname14, basename as basename12 } from "node:path";
262007
+ import { join as join52, relative as relative3, extname as extname7, dirname as dirname13, basename as basename12 } from "node:path";
261793
262008
  function parseJSImports(content, filePath) {
261794
262009
  const imports = [];
261795
- const dir = dirname14(filePath);
262010
+ const dir = dirname13(filePath);
261796
262011
  const esRegex = /(?:import|export)\s+(?:[\s\S]*?)\s+from\s+['"]([^'"]+)['"]/g;
261797
262012
  let m2;
261798
262013
  while ((m2 = esRegex.exec(content)) !== null) {
@@ -477720,10 +477935,10 @@ var require_commonjs3 = __commonJS({
477720
477935
  let ai = 0;
477721
477936
  let bi = 0;
477722
477937
  let result = [];
477723
- let which2 = "";
477938
+ let which3 = "";
477724
477939
  while (ai < a2.length && bi < b.length) {
477725
477940
  if (a2[ai] === b[bi]) {
477726
- result.push(which2 === "b" ? b[bi] : a2[ai]);
477941
+ result.push(which3 === "b" ? b[bi] : a2[ai]);
477727
477942
  ai++;
477728
477943
  bi++;
477729
477944
  } else if (emptyGSMatch && a2[ai] === "**" && b[bi] === a2[ai + 1]) {
@@ -477733,16 +477948,16 @@ var require_commonjs3 = __commonJS({
477733
477948
  result.push(b[bi]);
477734
477949
  bi++;
477735
477950
  } else if (a2[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
477736
- if (which2 === "b")
477951
+ if (which3 === "b")
477737
477952
  return false;
477738
- which2 = "a";
477953
+ which3 = "a";
477739
477954
  result.push(a2[ai]);
477740
477955
  ai++;
477741
477956
  bi++;
477742
477957
  } else if (b[bi] === "*" && a2[ai] && (this.options.dot || !a2[ai].startsWith(".")) && a2[ai] !== "**") {
477743
- if (which2 === "a")
477958
+ if (which3 === "a")
477744
477959
  return false;
477745
- which2 = "b";
477960
+ which3 = "b";
477746
477961
  result.push(b[bi]);
477747
477962
  ai++;
477748
477963
  bi++;
@@ -478323,7 +478538,7 @@ var require_path_browserify = __commonJS({
478323
478538
  _makeLong: function _makeLong(path11) {
478324
478539
  return path11;
478325
478540
  },
478326
- dirname: function dirname41(path11) {
478541
+ dirname: function dirname40(path11) {
478327
478542
  assertPath(path11);
478328
478543
  if (path11.length === 0) return ".";
478329
478544
  var code8 = path11.charCodeAt(0);
@@ -506638,7 +506853,7 @@ var init_ts_morph_parser = __esm({
506638
506853
  import { createRequire as createRequire2 } from "node:module";
506639
506854
  import { createHash as createHash7 } from "node:crypto";
506640
506855
  import { mkdirSync as mkdirSync14, readFileSync as readFileSync28 } from "node:fs";
506641
- import { join as join54, dirname as dirname15, extname as extname9 } from "node:path";
506856
+ import { join as join54, dirname as dirname14, extname as extname9 } from "node:path";
506642
506857
  function loadDatabaseCtor() {
506643
506858
  if (_DatabaseCtor)
506644
506859
  return _DatabaseCtor;
@@ -506688,7 +506903,7 @@ function extractFileSymbols(content, filePath) {
506688
506903
  }
506689
506904
  function extractFileImports(content, filePath) {
506690
506905
  const imports = [];
506691
- const dir = dirname15(filePath);
506906
+ const dir = dirname14(filePath);
506692
506907
  const esRe = /(?:import|export)\s+(?:[\s\S]*?)\s+from\s+['"]([^'"]+)['"]/g;
506693
506908
  let m2;
506694
506909
  while ((m2 = esRe.exec(content)) !== null) {
@@ -506758,7 +506973,7 @@ var init_code_graph_db = __esm({
506758
506973
  constructor(rootDir, dbPath) {
506759
506974
  this.rootDir = rootDir;
506760
506975
  const resolvedPath = dbPath ?? join54(rootDir, ".omnius", "index", "code-graph.db");
506761
- mkdirSync14(dirname15(resolvedPath), { recursive: true });
506976
+ mkdirSync14(dirname14(resolvedPath), { recursive: true });
506762
506977
  const Database = loadDatabaseCtor();
506763
506978
  this.db = new Database(resolvedPath);
506764
506979
  this.db.pragma("journal_mode = WAL");
@@ -506854,7 +507069,7 @@ var init_code_graph_db = __esm({
506854
507069
  for (const sym of astGraph.symbols) {
506855
507070
  this.stmts.insertSymbol.run(relPath, sym.name, sym.kind, sym.startLine, sym.endLine, sym.signature, sym.docstring, sym.exported ? 1 : 0);
506856
507071
  }
506857
- const dir = dirname15(relPath);
507072
+ const dir = dirname14(relPath);
506858
507073
  for (const edge of astGraph.edges) {
506859
507074
  if (edge.kind === "imports") {
506860
507075
  let target = edge.target;
@@ -507817,7 +508032,7 @@ var init_process_health = __esm({
507817
508032
 
507818
508033
  // packages/execution/dist/tools/camera-capture.js
507819
508034
  import { execSync as execSync27 } from "node:child_process";
507820
- import { readFileSync as readFileSync29, writeFileSync as writeFileSync15, unlinkSync as unlinkSync6, existsSync as existsSync38, mkdirSync as mkdirSync15, statSync as statSync16 } from "node:fs";
508035
+ import { readFileSync as readFileSync29, writeFileSync as writeFileSync14, unlinkSync as unlinkSync6, existsSync as existsSync38, mkdirSync as mkdirSync15, statSync as statSync16 } from "node:fs";
507821
508036
  import { join as join56 } from "node:path";
507822
508037
  import { tmpdir as tmpdir9 } from "node:os";
507823
508038
  var KANDAO_USB_VENDORS, QOOCAM_WIFI_PASSWORD, QOOCAM_DEFAULT_IP, OSC_TIMEOUT, CameraCaptureTool;
@@ -508279,7 +508494,7 @@ ${cameras.join("\n")}`,
508279
508494
  mkdirSync15(join56(process.cwd(), ".omnius", "camera-captures"), {
508280
508495
  recursive: true
508281
508496
  });
508282
- writeFileSync15(outputPath2, data);
508497
+ writeFileSync14(outputPath2, data);
508283
508498
  }
508284
508499
  if (userOutputPath) {
508285
508500
  return {
@@ -508560,22 +508775,22 @@ Saved to: ${tempFile}`,
508560
508775
  });
508561
508776
 
508562
508777
  // packages/execution/dist/tools/audio-playback.js
508563
- import { execFileSync as execFileSync3, execSync as execSync29, spawn as spawn16 } from "node:child_process";
508564
- import { copyFileSync as copyFileSync3, existsSync as existsSync40, statSync as statSync18, writeFileSync as writeFileSync16, mkdirSync as mkdirSync17, readdirSync as readdirSync14 } from "node:fs";
508778
+ import { execFileSync as execFileSync4, execSync as execSync29, spawn as spawn16 } from "node:child_process";
508779
+ import { copyFileSync as copyFileSync3, existsSync as existsSync40, statSync as statSync18, writeFileSync as writeFileSync15, mkdirSync as mkdirSync17, readdirSync as readdirSync14 } from "node:fs";
508565
508780
  import { basename as basename14, extname as extname10, isAbsolute, join as join58 } from "node:path";
508566
508781
  import { homedir as homedir14, tmpdir as tmpdir11 } from "node:os";
508567
508782
  function hasCommand3(command) {
508568
508783
  try {
508569
508784
  if (process.platform === "win32") {
508570
- execFileSync3("where", [command], { stdio: "ignore", timeout: 2e3 });
508785
+ execFileSync4("where", [command], { stdio: "ignore", timeout: 2e3 });
508571
508786
  } else {
508572
- execFileSync3("command", ["-v", command], { stdio: "ignore", timeout: 2e3 });
508787
+ execFileSync4("command", ["-v", command], { stdio: "ignore", timeout: 2e3 });
508573
508788
  }
508574
508789
  return true;
508575
508790
  } catch {
508576
508791
  if (process.platform !== "win32") {
508577
508792
  try {
508578
- execFileSync3("which", [command], { stdio: "ignore", timeout: 2e3 });
508793
+ execFileSync4("which", [command], { stdio: "ignore", timeout: 2e3 });
508579
508794
  return true;
508580
508795
  } catch {
508581
508796
  return false;
@@ -508630,7 +508845,7 @@ function playSoundFile(file, opts = {}) {
508630
508845
  };
508631
508846
  }
508632
508847
  try {
508633
- execFileSync3(command.command, command.args, { timeout: opts.timeoutMs ?? 3e5, stdio: "pipe" });
508848
+ execFileSync4(command.command, command.args, { timeout: opts.timeoutMs ?? 3e5, stdio: "pipe" });
508634
508849
  return { ok: true, player: command.label };
508635
508850
  } catch (err) {
508636
508851
  return { ok: false, error: `Playback via ${command.label} failed: ${err instanceof Error ? err.message.slice(0, 300) : String(err).slice(0, 300)}` };
@@ -508777,16 +508992,16 @@ function ensureSupertonicInstalled() {
508777
508992
  const py = findPython32();
508778
508993
  if (!py)
508779
508994
  throw new Error("python3 is required to set up Supertonic TTS.");
508780
- execFileSync3(py, ["-m", "venv", join58(voiceDir(), "supertonic3-venv")], { stdio: "pipe", timeout: 18e4 });
508995
+ execFileSync4(py, ["-m", "venv", join58(voiceDir(), "supertonic3-venv")], { stdio: "pipe", timeout: 18e4 });
508781
508996
  }
508782
508997
  try {
508783
- execFileSync3(venvPy, ["-c", "import supertonic"], { stdio: "pipe", timeout: 1e4 });
508998
+ execFileSync4(venvPy, ["-c", "import supertonic"], { stdio: "pipe", timeout: 1e4 });
508784
508999
  } catch {
508785
- execFileSync3(venvPy, ["-m", "pip", "install", "--quiet", "--upgrade", "pip"], { stdio: "pipe", timeout: 12e4 });
508786
- execFileSync3(venvPy, ["-m", "pip", "install", "--quiet", "supertonic"], { stdio: "pipe", timeout: 6e5 });
509000
+ execFileSync4(venvPy, ["-m", "pip", "install", "--quiet", "--upgrade", "pip"], { stdio: "pipe", timeout: 12e4 });
509001
+ execFileSync4(venvPy, ["-m", "pip", "install", "--quiet", "supertonic"], { stdio: "pipe", timeout: 6e5 });
508787
509002
  }
508788
509003
  mkdirSync17(voiceDir(), { recursive: true });
508789
- writeFileSync16(supertonicInferScript(), SUPERTONIC_INFER_PY, "utf-8");
509004
+ writeFileSync15(supertonicInferScript(), SUPERTONIC_INFER_PY, "utf-8");
508790
509005
  return venvPy;
508791
509006
  }
508792
509007
  function ensureMlxInstalled() {
@@ -508798,19 +509013,19 @@ function ensureMlxInstalled() {
508798
509013
  const py = findPython32();
508799
509014
  if (!py)
508800
509015
  throw new Error("python3 is required to set up MLX Audio.");
508801
- execFileSync3(py, ["-m", "venv", join58(voiceDir(), "mlx-venv")], { stdio: "pipe", timeout: 18e4 });
509016
+ execFileSync4(py, ["-m", "venv", join58(voiceDir(), "mlx-venv")], { stdio: "pipe", timeout: 18e4 });
508802
509017
  }
508803
509018
  try {
508804
- execFileSync3(venvPy, ["-c", "import mlx_audio"], { stdio: "pipe", timeout: 1e4 });
509019
+ execFileSync4(venvPy, ["-c", "import mlx_audio"], { stdio: "pipe", timeout: 1e4 });
508805
509020
  } catch {
508806
- execFileSync3(venvPy, ["-m", "pip", "install", "--quiet", "--upgrade", "pip"], { stdio: "pipe", timeout: 12e4 });
508807
- execFileSync3(venvPy, ["-m", "pip", "install", "--quiet", "mlx-audio"], { stdio: "pipe", timeout: 6e5 });
509021
+ execFileSync4(venvPy, ["-m", "pip", "install", "--quiet", "--upgrade", "pip"], { stdio: "pipe", timeout: 12e4 });
509022
+ execFileSync4(venvPy, ["-m", "pip", "install", "--quiet", "mlx-audio"], { stdio: "pipe", timeout: 6e5 });
508808
509023
  }
508809
509024
  return venvPy;
508810
509025
  }
508811
509026
  function pythonCanImportLuxTts(venvPy) {
508812
509027
  try {
508813
- execFileSync3(venvPy, [
509028
+ execFileSync4(venvPy, [
508814
509029
  "-c",
508815
509030
  "import sys, os; sys.path.insert(0, os.environ['LUXTTS_REPO_PATH']); from zipvoice.luxvoice import LuxTTS; print('ok')"
508816
509031
  ], {
@@ -508824,7 +509039,7 @@ function pythonCanImportLuxTts(venvPy) {
508824
509039
  }
508825
509040
  }
508826
509041
  function pipInstall(venvPy, packages, timeout2 = 9e5) {
508827
- execFileSync3(venvPy, ["-m", "pip", "install", "--prefer-binary", ...packages], {
509042
+ execFileSync4(venvPy, ["-m", "pip", "install", "--prefer-binary", ...packages], {
508828
509043
  stdio: "pipe",
508829
509044
  timeout: timeout2,
508830
509045
  env: process.env
@@ -508835,16 +509050,16 @@ function ensureLuxttsInstalled() {
508835
509050
  const repoDir = luxttsRepoDir();
508836
509051
  mkdirSync17(voiceDir(), { recursive: true });
508837
509052
  if (existsSync40(venvPy) && existsSync40(join58(repoDir, "zipvoice", "luxvoice.py")) && pythonCanImportLuxTts(venvPy)) {
508838
- writeFileSync16(luxttsInferScript(), LUXTTS_DAEMON_PY, "utf-8");
509053
+ writeFileSync15(luxttsInferScript(), LUXTTS_DAEMON_PY, "utf-8");
508839
509054
  return venvPy;
508840
509055
  }
508841
509056
  const py = findPython32();
508842
509057
  if (!py)
508843
509058
  throw new Error("python3 is required to set up LuxTTS voice cloning.");
508844
509059
  if (!existsSync40(venvPy)) {
508845
- execFileSync3(py, ["-m", "venv", luxttsVenvDir()], { stdio: "pipe", timeout: 18e4 });
509060
+ execFileSync4(py, ["-m", "venv", luxttsVenvDir()], { stdio: "pipe", timeout: 18e4 });
508846
509061
  }
508847
- execFileSync3(venvPy, ["-m", "pip", "install", "--upgrade", "pip", "wheel", "setuptools<81"], {
509062
+ execFileSync4(venvPy, ["-m", "pip", "install", "--upgrade", "pip", "wheel", "setuptools<81"], {
508848
509063
  stdio: "pipe",
508849
509064
  timeout: 3e5
508850
509065
  });
@@ -508852,7 +509067,7 @@ function ensureLuxttsInstalled() {
508852
509067
  if (!existsSync40(join58(repoDir, "zipvoice", "luxvoice.py"))) {
508853
509068
  if (!hasCommand3("git"))
508854
509069
  throw new Error("git is required to set up LuxTTS voice cloning.");
508855
- execFileSync3("git", ["clone", "--depth", "1", "https://github.com/ysharma3501/LuxTTS.git", repoDir], {
509070
+ execFileSync4("git", ["clone", "--depth", "1", "https://github.com/ysharma3501/LuxTTS.git", repoDir], {
508856
509071
  stdio: "pipe",
508857
509072
  timeout: 3e5
508858
509073
  });
@@ -508877,7 +509092,7 @@ function ensureLuxttsInstalled() {
508877
509092
  } catch {
508878
509093
  }
508879
509094
  pipInstall(venvPy, ["-e", repoDir], 6e5);
508880
- writeFileSync16(luxttsInferScript(), LUXTTS_DAEMON_PY, "utf-8");
509095
+ writeFileSync15(luxttsInferScript(), LUXTTS_DAEMON_PY, "utf-8");
508881
509096
  if (!pythonCanImportLuxTts(venvPy)) {
508882
509097
  throw new Error(`LuxTTS setup completed but import still fails in ${luxttsVenvDir()}.`);
508883
509098
  }
@@ -508892,10 +509107,10 @@ function ensurePiperInstalled() {
508892
509107
  if (!py)
508893
509108
  throw new Error("python3 is required to set up Piper TTS.");
508894
509109
  mkdirSync17(voiceDir(), { recursive: true });
508895
- execFileSync3(py, ["-m", "venv", piperVenvDir()], { stdio: "pipe", timeout: 18e4 });
509110
+ execFileSync4(py, ["-m", "venv", piperVenvDir()], { stdio: "pipe", timeout: 18e4 });
508896
509111
  const venvPy = process.platform === "win32" ? join58(piperVenvDir(), "Scripts", "python.exe") : join58(piperVenvDir(), "bin", "python3");
508897
- execFileSync3(venvPy, ["-m", "pip", "install", "--quiet", "--upgrade", "pip"], { stdio: "pipe", timeout: 12e4 });
508898
- execFileSync3(venvPy, ["-m", "pip", "install", "--quiet", "piper-tts"], { stdio: "pipe", timeout: 6e5 });
509112
+ execFileSync4(venvPy, ["-m", "pip", "install", "--quiet", "--upgrade", "pip"], { stdio: "pipe", timeout: 12e4 });
509113
+ execFileSync4(venvPy, ["-m", "pip", "install", "--quiet", "piper-tts"], { stdio: "pipe", timeout: 6e5 });
508899
509114
  }
508900
509115
  if (!existsSync40(bin)) {
508901
509116
  throw new Error("Piper TTS installed but the piper executable was not found in the managed venv.");
@@ -509425,7 +509640,7 @@ ${tried.map((line) => `- ${line}`).join("\n")}`,
509425
509640
  "d=(np.clip(wav.cpu().numpy().squeeze(), -1, 1)*32767).astype(np.int16)",
509426
509641
  "f=wave.open(args['output'], 'wb'); f.setnchannels(1); f.setsampwidth(2); f.setframerate(48000); f.writeframes(d.tobytes()); f.close()"
509427
509642
  ].join("; ");
509428
- execFileSync3(venvPy, ["-c", pyScript, JSON.stringify({ text, output: outputPath2, clone_ref: cloneRef, repo: repoDir, speed })], {
509643
+ execFileSync4(venvPy, ["-c", pyScript, JSON.stringify({ text, output: outputPath2, clone_ref: cloneRef, repo: repoDir, speed })], {
509429
509644
  stdio: "pipe",
509430
509645
  timeout: 12e4,
509431
509646
  env: { ...process.env, LUXTTS_REPO_PATH: repoDir }
@@ -509438,7 +509653,7 @@ ${tried.map((line) => `- ${line}`).join("\n")}`,
509438
509653
  const lang = typeof args["lang"] === "string" ? args["lang"] : "en";
509439
509654
  const speed = numberArg3(args["speed"], 1.05);
509440
509655
  const totalStep = Math.round(numberArg3(args["total_step"], 8));
509441
- const stdout = execFileSync3(venvPy, [supertonicInferScript()], {
509656
+ const stdout = execFileSync4(venvPy, [supertonicInferScript()], {
509442
509657
  input: JSON.stringify({ text, output_path: outputPath2, voice_name: voice, lang, speed, total_step: totalStep }),
509443
509658
  encoding: "utf8",
509444
509659
  stdio: ["pipe", "pipe", "pipe"],
@@ -509461,7 +509676,7 @@ ${tried.map((line) => `- ${line}`).join("\n")}`,
509461
509676
  "args=json.loads(sys.argv[1])",
509462
509677
  "tts_gen.main(['--model', args['model'], '--text', args['text'], '--voice', args['voice'], '--lang_code', args['lang'], '--audio_path', args['output']])"
509463
509678
  ].join("; ");
509464
- execFileSync3(py, ["-c", pyScript, JSON.stringify({ text, model, voice, lang, output: outputPath2 })], {
509679
+ execFileSync4(py, ["-c", pyScript, JSON.stringify({ text, model, voice, lang, output: outputPath2 })], {
509465
509680
  stdio: "pipe",
509466
509681
  timeout: 18e4,
509467
509682
  cwd: tmpdir11()
@@ -509482,7 +509697,7 @@ ${tried.map((line) => `- ${line}`).join("\n")}`,
509482
509697
  } else {
509483
509698
  throw new Error(`${requireModel ? "Raw ONNX" : "Piper"} TTS requires model=<path.onnx> or voice=<path.onnx>.`);
509484
509699
  }
509485
- execFileSync3(piper, argv, { input: text, stdio: ["pipe", "pipe", "pipe"], timeout: 12e4 });
509700
+ execFileSync4(piper, argv, { input: text, stdio: ["pipe", "pipe", "pipe"], timeout: 12e4 });
509486
509701
  return summary;
509487
509702
  }
509488
509703
  synthesizeEspeak(text, outputPath2, args) {
@@ -509490,7 +509705,7 @@ ${tried.map((line) => `- ${line}`).join("\n")}`,
509490
509705
  throw new Error("Local fallback TTS command not found.");
509491
509706
  const voice = typeof args["voice"] === "string" ? args["voice"] : "en";
509492
509707
  const speed = Math.round(numberArg3(args["speed"], 160));
509493
- execFileSync3("espeak-ng", ["-v", voice, "-s", String(speed), "-w", outputPath2, text], {
509708
+ execFileSync4("espeak-ng", ["-v", voice, "-s", String(speed), "-w", outputPath2, text], {
509494
509709
  stdio: "pipe",
509495
509710
  timeout: 6e4
509496
509711
  });
@@ -510861,7 +511076,7 @@ ${result.trim()}`, durationMs: performance.now() - start2 };
510861
511076
 
510862
511077
  // packages/execution/dist/tools/audio-analyze.js
510863
511078
  import { execSync as execSync35 } from "node:child_process";
510864
- import { existsSync as existsSync43, mkdirSync as mkdirSync19, writeFileSync as writeFileSync17, readFileSync as readFileSync32 } from "node:fs";
511079
+ import { existsSync as existsSync43, mkdirSync as mkdirSync19, writeFileSync as writeFileSync16, readFileSync as readFileSync32 } from "node:fs";
510865
511080
  import { join as join60 } from "node:path";
510866
511081
  import { homedir as homedir15, tmpdir as tmpdir13 } from "node:os";
510867
511082
  var VENV_DIR, VENV_PIP, VENV_PYTHON, AudioAnalyzeTool;
@@ -511122,7 +511337,7 @@ except Exception as e:
511122
511337
  spectrum: spectrumResult.success ? spectrumResult.output : "unknown"
511123
511338
  };
511124
511339
  const contextFile = join60(contextDir, "latest.json");
511125
- writeFileSync17(contextFile, JSON.stringify(context2, null, 2));
511340
+ writeFileSync16(contextFile, JSON.stringify(context2, null, 2));
511126
511341
  return {
511127
511342
  success: true,
511128
511343
  output: `Audio context captured (${duration}s):
@@ -511174,7 +511389,7 @@ Context saved to: ${contextFile}`,
511174
511389
  /** Run a Python script in the venv and parse JSON output */
511175
511390
  runPythonScript(script, start2, label) {
511176
511391
  const scriptFile = join60(tmpdir13(), `omnius-audio-${Date.now()}.py`);
511177
- writeFileSync17(scriptFile, script);
511392
+ writeFileSync16(scriptFile, script);
511178
511393
  try {
511179
511394
  const output = execSync35(`${VENV_PYTHON} ${scriptFile}`, {
511180
511395
  encoding: "utf8",
@@ -511208,7 +511423,7 @@ ${output}`, durationMs: performance.now() - start2 };
511208
511423
 
511209
511424
  // packages/execution/dist/tools/gps-location.js
511210
511425
  import { execSync as execSync36, spawnSync as spawnSync4 } from "node:child_process";
511211
- import { existsSync as existsSync44, readFileSync as readFileSync33, writeFileSync as writeFileSync18, mkdirSync as mkdirSync20 } from "node:fs";
511426
+ import { existsSync as existsSync44, readFileSync as readFileSync33, writeFileSync as writeFileSync17, mkdirSync as mkdirSync20 } from "node:fs";
511212
511427
  import { join as join61 } from "node:path";
511213
511428
  import { tmpdir as tmpdir14, homedir as homedir16 } from "node:os";
511214
511429
  var GPS_USB_IDS, GpsLocationTool;
@@ -511336,7 +511551,7 @@ var init_gps_location = __esm({
511336
511551
  async runGpsPython(script, timeoutMs = 3e4) {
511337
511552
  await this.ensureGpsVenv();
511338
511553
  const scriptFile = join61(tmpdir14(), `omnius-gps-${Date.now()}.py`);
511339
- writeFileSync18(scriptFile, script);
511554
+ writeFileSync17(scriptFile, script);
511340
511555
  try {
511341
511556
  const output = execSync36(`${this.GPS_PYTHON} ${scriptFile}`, {
511342
511557
  encoding: "utf8",
@@ -512012,7 +512227,7 @@ ${content.slice(0, 500)}`,
512012
512227
 
512013
512228
  // packages/execution/dist/tools/visual-memory.js
512014
512229
  import { execSync as execSync37 } from "node:child_process";
512015
- import { existsSync as existsSync45, mkdirSync as mkdirSync21, writeFileSync as writeFileSync19, readFileSync as readFileSync34 } from "node:fs";
512230
+ import { existsSync as existsSync45, mkdirSync as mkdirSync21, writeFileSync as writeFileSync18, readFileSync as readFileSync34 } from "node:fs";
512016
512231
  import { join as join62 } from "node:path";
512017
512232
  import { homedir as homedir17, tmpdir as tmpdir15 } from "node:os";
512018
512233
  var VMEM_DIR, VENV_DIR2, VENV_PY, VENV_PIP2, VisualMemoryTool;
@@ -512503,7 +512718,7 @@ ${objects.join("\n") || " (none taught)"}`,
512503
512718
  const db = JSON.parse(readFileSync34(path11, "utf8"));
512504
512719
  if (id in db) {
512505
512720
  delete db[id];
512506
- writeFileSync19(path11, JSON.stringify(db));
512721
+ writeFileSync18(path11, JSON.stringify(db));
512507
512722
  removed = true;
512508
512723
  }
512509
512724
  } catch {
@@ -512541,7 +512756,7 @@ ${objects.join("\n") || " (none taught)"}`,
512541
512756
  }
512542
512757
  async runVisionPython(script, timeoutMs = 6e4) {
512543
512758
  const scriptFile = join62(tmpdir15(), `omnius-vmem-${Date.now()}.py`);
512544
- writeFileSync19(scriptFile, script);
512759
+ writeFileSync18(scriptFile, script);
512545
512760
  try {
512546
512761
  const output = execSync37(`${VENV_PY} ${scriptFile}`, {
512547
512762
  encoding: "utf8",
@@ -512572,7 +512787,7 @@ ${objects.join("\n") || " (none taught)"}`,
512572
512787
 
512573
512788
  // packages/execution/dist/tools/multimodal-memory.js
512574
512789
  import { execSync as execSync38 } from "node:child_process";
512575
- import { existsSync as existsSync46, mkdirSync as mkdirSync22, writeFileSync as writeFileSync20, readFileSync as readFileSync35, readdirSync as readdirSync15 } from "node:fs";
512790
+ import { existsSync as existsSync46, mkdirSync as mkdirSync22, writeFileSync as writeFileSync19, readFileSync as readFileSync35, readdirSync as readdirSync15 } from "node:fs";
512576
512791
  import { join as join63 } from "node:path";
512577
512792
  import { homedir as homedir18, tmpdir as tmpdir16 } from "node:os";
512578
512793
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -512683,7 +512898,7 @@ with torch.no_grad():
512683
512898
  print(json.dumps(features[0].cpu().numpy().tolist()))
512684
512899
  `;
512685
512900
  const scriptFile = join63(tmpdir16(), `mm-clip-${Date.now()}.py`);
512686
- writeFileSync20(scriptFile, clipScript);
512901
+ writeFileSync19(scriptFile, clipScript);
512687
512902
  const clipOutput = execSync38(`${venvPy} ${scriptFile}`, { encoding: "utf8", timeout: 12e4, env: { ...process.env, PYTHONUNBUFFERED: "1" } });
512688
512903
  const embedding = JSON.parse(clipOutput.trim().split("\n").pop());
512689
512904
  episode.visual.clipEmbedding = embedding;
@@ -512705,7 +512920,7 @@ result = [{"confidence": float(f.det_score), "age": int(f.age) if hasattr(f, 'ag
512705
512920
  print(json.dumps(result))
512706
512921
  `;
512707
512922
  const scriptFile = join63(tmpdir16(), `mm-face-${Date.now()}.py`);
512708
- writeFileSync20(scriptFile, faceScript);
512923
+ writeFileSync19(scriptFile, faceScript);
512709
512924
  const faceOutput = execSync38(`${venvPy} ${scriptFile}`, { encoding: "utf8", timeout: 6e4, env: { ...process.env, PYTHONUNBUFFERED: "1" } });
512710
512925
  const faces = JSON.parse(faceOutput.trim().split("\n").pop());
512711
512926
  episode.visual.faceIds = faces.map((_, i2) => `face_${i2}`);
@@ -512757,7 +512972,7 @@ top=scores.numpy().mean(axis=0).argsort()[-1]
512757
512972
  print(classes[top])
512758
512973
  `;
512759
512974
  const scriptFile = join63(tmpdir16(), `mm-yamnet-${Date.now()}.py`);
512760
- writeFileSync20(scriptFile, classifyScript);
512975
+ writeFileSync19(scriptFile, classifyScript);
512761
512976
  const soundClass = execSync38(`${mlVenvPy} ${scriptFile}`, { encoding: "utf8", timeout: 12e4 }).trim().split("\n").pop();
512762
512977
  episode.audio.soundClass = soundClass;
512763
512978
  results.push(`Sound: ${soundClass}`);
@@ -512853,7 +513068,7 @@ else:
512853
513068
  print(json.dumps({"enrolled": False, "reason": "no face detected"}))
512854
513069
  `;
512855
513070
  const scriptFile = join63(tmpdir16(), `mm-enroll-${Date.now()}.py`);
512856
- writeFileSync20(scriptFile, enrollScript);
513071
+ writeFileSync19(scriptFile, enrollScript);
512857
513072
  const enrollOutput = execSync38(`${venvPy} ${scriptFile}`, { encoding: "utf8", timeout: 6e4, env: { ...process.env, PYTHONUNBUFFERED: "1" } });
512858
513073
  const enrollResult = JSON.parse(enrollOutput.trim().split("\n").pop());
512859
513074
  if (enrollResult.enrolled) {
@@ -512908,7 +513123,7 @@ with torch.no_grad():
512908
513123
  print(json.dumps(features[0].cpu().numpy().tolist()))
512909
513124
  `;
512910
513125
  const scriptFile = join63(tmpdir16(), `mm-clipq-${Date.now()}.py`);
512911
- writeFileSync20(scriptFile, clipTextScript);
513126
+ writeFileSync19(scriptFile, clipTextScript);
512912
513127
  const output = execSync38(`${venvPy} ${scriptFile}`, { encoding: "utf8", timeout: 6e4, env: { ...process.env, PYTHONUNBUFFERED: "1" } });
512913
513128
  queryClipEmbedding = JSON.parse(output.trim().split("\n").pop());
512914
513129
  }
@@ -513022,7 +513237,7 @@ ${lines.join("\n")}`,
513022
513237
  // =========================================================================
513023
513238
  saveEpisode(episode) {
513024
513239
  const episodeFile = join63(MM_DIR, episode.id, "episode.json");
513025
- writeFileSync20(episodeFile, JSON.stringify(episode, null, 2));
513240
+ writeFileSync19(episodeFile, JSON.stringify(episode, null, 2));
513026
513241
  let index = [];
513027
513242
  try {
513028
513243
  index = JSON.parse(readFileSync35(MM_INDEX, "utf8"));
@@ -513034,7 +513249,7 @@ ${lines.join("\n")}`,
513034
513249
  timestamp: episode.timestamp,
513035
513250
  summary: episode.text?.content?.slice(0, 100) || "episode"
513036
513251
  });
513037
- writeFileSync20(MM_INDEX, JSON.stringify(index, null, 2));
513252
+ writeFileSync19(MM_INDEX, JSON.stringify(index, null, 2));
513038
513253
  }
513039
513254
  /**
513040
513255
  * WO-AM-GAP-02: Bridge multimodal episode to SQLite EpisodeStore + TemporalGraph.
@@ -513157,14 +513372,14 @@ ${lines.join("\n")}`,
513157
513372
 
513158
513373
  // packages/execution/dist/tools/asr-listen.js
513159
513374
  import { execSync as execSync39, spawnSync as spawnSync5 } from "node:child_process";
513160
- import { existsSync as existsSync47, mkdirSync as mkdirSync23, writeFileSync as writeFileSync21, readFileSync as readFileSync36, unlinkSync as unlinkSync9 } from "node:fs";
513161
- import { dirname as dirname16, join as join64, resolve as resolve32 } from "node:path";
513375
+ import { existsSync as existsSync47, mkdirSync as mkdirSync23, writeFileSync as writeFileSync20, readFileSync as readFileSync36, unlinkSync as unlinkSync9 } from "node:fs";
513376
+ import { dirname as dirname15, join as join64, resolve as resolve32 } from "node:path";
513162
513377
  import { tmpdir as tmpdir17, homedir as homedir19 } from "node:os";
513163
513378
  import { fileURLToPath as fileURLToPath8 } from "node:url";
513164
513379
  function _findNemotronScript() {
513165
513380
  const candidates = [];
513166
513381
  try {
513167
- const here = dirname16(fileURLToPath8(import.meta.url));
513382
+ const here = dirname15(fileURLToPath8(import.meta.url));
513168
513383
  candidates.push(resolve32(here, "../../scripts/live-nemotron.py"));
513169
513384
  candidates.push(resolve32(here, "../../../scripts/live-nemotron.py"));
513170
513385
  } catch {
@@ -513405,7 +513620,7 @@ except Exception:
513405
513620
  print(json.dumps({"ok": False, "error": "No whisper backend available"}))
513406
513621
  `;
513407
513622
  const scriptFile = join64(tmpdir17(), `omnius-asr-whisper-${Date.now()}.py`);
513408
- writeFileSync21(scriptFile, whisperScript);
513623
+ writeFileSync20(scriptFile, whisperScript);
513409
513624
  const pyPaths = [
513410
513625
  join64(homedir19(), ".omnius", "venv", "bin", "python3"),
513411
513626
  "python3",
@@ -514976,8 +515191,8 @@ var init_client3 = __esm({
514976
515191
  });
514977
515192
 
514978
515193
  // packages/execution/dist/mcp/manager.js
514979
- import { existsSync as existsSync49, readFileSync as readFileSync37, writeFileSync as writeFileSync22, mkdirSync as mkdirSync25 } from "node:fs";
514980
- import { join as join66, dirname as dirname17 } from "node:path";
515194
+ import { existsSync as existsSync49, readFileSync as readFileSync37, writeFileSync as writeFileSync21, mkdirSync as mkdirSync25 } from "node:fs";
515195
+ import { join as join66, dirname as dirname16 } from "node:path";
514981
515196
  import { homedir as homedir20 } from "node:os";
514982
515197
  function loadMcpConfig(repoRoot) {
514983
515198
  const servers = {};
@@ -515040,8 +515255,8 @@ function saveMcpServerToConfig(repoRoot, serverName, config, scope = "project")
515040
515255
  }
515041
515256
  }
515042
515257
  existing.mcpServers[serverName] = config;
515043
- mkdirSync25(dirname17(path11), { recursive: true });
515044
- writeFileSync22(path11, JSON.stringify(existing, null, 2) + "\n");
515258
+ mkdirSync25(dirname16(path11), { recursive: true });
515259
+ writeFileSync21(path11, JSON.stringify(existing, null, 2) + "\n");
515045
515260
  return path11;
515046
515261
  }
515047
515262
  function removeMcpServerFromConfig(repoRoot, serverName, scope = "project") {
@@ -515057,7 +515272,7 @@ function removeMcpServerFromConfig(repoRoot, serverName, scope = "project") {
515057
515272
  if (!cfg.mcpServers || !cfg.mcpServers[serverName])
515058
515273
  return false;
515059
515274
  delete cfg.mcpServers[serverName];
515060
- writeFileSync22(path11, JSON.stringify(cfg, null, 2) + "\n");
515275
+ writeFileSync21(path11, JSON.stringify(cfg, null, 2) + "\n");
515061
515276
  return true;
515062
515277
  }
515063
515278
  var McpManager;
@@ -515746,7 +515961,7 @@ var init_plugin_system = __esm({
515746
515961
  });
515747
515962
 
515748
515963
  // packages/execution/dist/tools/notebook-edit.js
515749
- import { readFileSync as readFileSync39, writeFileSync as writeFileSync23, existsSync as existsSync51 } from "node:fs";
515964
+ import { readFileSync as readFileSync39, writeFileSync as writeFileSync22, existsSync as existsSync51 } from "node:fs";
515750
515965
  function readNotebook(path11) {
515751
515966
  if (!existsSync51(path11))
515752
515967
  return `File not found: ${path11}`;
@@ -515763,7 +515978,7 @@ function readNotebook(path11) {
515763
515978
  }
515764
515979
  }
515765
515980
  function writeNotebook(path11, nb) {
515766
- writeFileSync23(path11, JSON.stringify(nb, null, 1) + "\n", "utf8");
515981
+ writeFileSync22(path11, JSON.stringify(nb, null, 1) + "\n", "utf8");
515767
515982
  }
515768
515983
  function sourceToLines(source) {
515769
515984
  const lines = source.split("\n");
@@ -516050,7 +516265,7 @@ var init_environment_snapshot = __esm({
516050
516265
 
516051
516266
  // packages/execution/dist/tools/video-understand.js
516052
516267
  import { execSync as execSync42 } from "node:child_process";
516053
- import { existsSync as existsSync52, mkdirSync as mkdirSync26, writeFileSync as writeFileSync24, readFileSync as readFileSync40, readdirSync as readdirSync17, unlinkSync as unlinkSync10 } from "node:fs";
516268
+ import { existsSync as existsSync52, mkdirSync as mkdirSync26, writeFileSync as writeFileSync23, readFileSync as readFileSync40, readdirSync as readdirSync17, unlinkSync as unlinkSync10 } from "node:fs";
516054
516269
  import { join as join68, basename as basename15 } from "node:path";
516055
516270
  import { createHash as createHash8 } from "node:crypto";
516056
516271
  function isYouTubeUrl2(url) {
@@ -516220,7 +516435,7 @@ var init_video_understand = __esm({
516220
516435
  for (const frame of frames.filter((f2) => !f2.isDuplicate)) {
516221
516436
  const dest = join68(permanentDir, basename15(frame.path));
516222
516437
  try {
516223
- writeFileSync24(dest, readFileSync40(frame.path));
516438
+ writeFileSync23(dest, readFileSync40(frame.path));
516224
516439
  frame.path = dest;
516225
516440
  } catch {
516226
516441
  }
@@ -516257,7 +516472,7 @@ var init_video_understand = __esm({
516257
516472
  };
516258
516473
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
516259
516474
  const resultFile = join68(outDir, `understanding-${timestamp}.json`);
516260
- writeFileSync24(resultFile, JSON.stringify(result, null, 2), "utf-8");
516475
+ writeFileSync23(resultFile, JSON.stringify(result, null, 2), "utf-8");
516261
516476
  try {
516262
516477
  const memDir = join68(this.workingDir, ".omnius", "memory");
516263
516478
  mkdirSync26(memDir, { recursive: true });
@@ -516280,7 +516495,7 @@ var init_video_understand = __esm({
516280
516495
  });
516281
516496
  if (indexEntries.length > 30)
516282
516497
  indexEntries = indexEntries.slice(-30);
516283
- writeFileSync24(indexFile, JSON.stringify(indexEntries, null, 2), "utf-8");
516498
+ writeFileSync23(indexFile, JSON.stringify(indexEntries, null, 2), "utf-8");
516284
516499
  const CHUNK_WINDOW = 30;
516285
516500
  const transcriptFile = join68(memDir, "video-transcripts.json");
516286
516501
  let transcriptEntries = {};
@@ -516311,7 +516526,7 @@ var init_video_understand = __esm({
516311
516526
  Topic: ${segments.slice(0, 5).map((s2) => s2.text).join(" ").slice(0, 300)}`,
516312
516527
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
516313
516528
  };
516314
- writeFileSync24(transcriptFile, JSON.stringify(transcriptEntries, null, 2), "utf-8");
516529
+ writeFileSync23(transcriptFile, JSON.stringify(transcriptEntries, null, 2), "utf-8");
516315
516530
  } catch {
516316
516531
  }
516317
516532
  const lines = [];
@@ -516609,8 +516824,8 @@ var init_gitWorktree = __esm({
516609
516824
  });
516610
516825
 
516611
516826
  // packages/execution/dist/patchApplier.js
516612
- import { readFileSync as readFileSync42, writeFileSync as writeFileSync25, existsSync as existsSync54, mkdirSync as mkdirSync27 } from "node:fs";
516613
- import { dirname as dirname18 } from "node:path";
516827
+ import { readFileSync as readFileSync42, writeFileSync as writeFileSync24, existsSync as existsSync54, mkdirSync as mkdirSync27 } from "node:fs";
516828
+ import { dirname as dirname17 } from "node:path";
516614
516829
  import { spawn as spawn20 } from "node:child_process";
516615
516830
  async function applyPatch(patch) {
516616
516831
  switch (patch.type) {
@@ -516630,17 +516845,17 @@ function applyBlockReplace(patch) {
516630
516845
  throw new Error(`Block not found in "${patch.filePath}": the oldContent string was not found in the file.`);
516631
516846
  }
516632
516847
  const updated = original.replace(patch.oldContent, patch.newContent);
516633
- writeFileSync25(patch.filePath, updated, "utf-8");
516848
+ writeFileSync24(patch.filePath, updated, "utf-8");
516634
516849
  }
516635
516850
  function applyRewrite(patch) {
516636
- writeFileSync25(patch.filePath, patch.newContent, "utf-8");
516851
+ writeFileSync24(patch.filePath, patch.newContent, "utf-8");
516637
516852
  }
516638
516853
  function applyNewFile(patch) {
516639
516854
  if (existsSync54(patch.filePath)) {
516640
516855
  throw new Error(`Cannot create new file: "${patch.filePath}" already exists.`);
516641
516856
  }
516642
- mkdirSync27(dirname18(patch.filePath), { recursive: true });
516643
- writeFileSync25(patch.filePath, patch.newContent, "utf-8");
516857
+ mkdirSync27(dirname17(patch.filePath), { recursive: true });
516858
+ writeFileSync24(patch.filePath, patch.newContent, "utf-8");
516644
516859
  }
516645
516860
  async function applyUnifiedDiff(patch) {
516646
516861
  const { filePath, diff } = patch;
@@ -516651,7 +516866,7 @@ async function applyUnifiedDiff(patch) {
516651
516866
  "-p1",
516652
516867
  filePath
516653
516868
  ],
516654
- cwd: dirname18(filePath),
516869
+ cwd: dirname17(filePath),
516655
516870
  stdin: diff
516656
516871
  });
516657
516872
  if (!result.success) {
@@ -516997,7 +517212,7 @@ var init_buildRunner = __esm({
516997
517212
  });
516998
517213
 
516999
517214
  // packages/execution/dist/constraints.js
517000
- import { existsSync as existsSync55, readFileSync as readFileSync43, writeFileSync as writeFileSync26, mkdirSync as mkdirSync28 } from "node:fs";
517215
+ import { existsSync as existsSync55, readFileSync as readFileSync43, writeFileSync as writeFileSync25, mkdirSync as mkdirSync28 } from "node:fs";
517001
517216
  import { join as join70 } from "node:path";
517002
517217
  import { homedir as homedir22 } from "node:os";
517003
517218
  function loadConstraints(projectRoot) {
@@ -517029,7 +517244,7 @@ function addProjectConstraint(projectRoot, constraint) {
517029
517244
  }
517030
517245
  data.constraints.push(constraint);
517031
517246
  mkdirSync28(join70(projectRoot, ".omnius"), { recursive: true });
517032
- writeFileSync26(path11, JSON.stringify(data, null, 2), "utf-8");
517247
+ writeFileSync25(path11, JSON.stringify(data, null, 2), "utf-8");
517033
517248
  projectConstraints = data.constraints;
517034
517249
  }
517035
517250
  function getAllConstraints() {
@@ -518378,7 +518593,7 @@ var init_dist6 = __esm({
518378
518593
 
518379
518594
  // packages/orchestrator/dist/promptLoader.js
518380
518595
  import { readFileSync as readFileSync44, existsSync as existsSync56 } from "node:fs";
518381
- import { join as join71, dirname as dirname19 } from "node:path";
518596
+ import { join as join71, dirname as dirname18 } from "node:path";
518382
518597
  import { fileURLToPath as fileURLToPath9 } from "node:url";
518383
518598
  function loadPrompt(promptPath, vars) {
518384
518599
  let content = cache5.get(promptPath);
@@ -518399,7 +518614,7 @@ var init_promptLoader = __esm({
518399
518614
  "packages/orchestrator/dist/promptLoader.js"() {
518400
518615
  "use strict";
518401
518616
  __filename3 = fileURLToPath9(import.meta.url);
518402
- __dirname5 = dirname19(__filename3);
518617
+ __dirname5 = dirname18(__filename3);
518403
518618
  PROMPTS_DIR = join71(__dirname5, "..", "prompts");
518404
518619
  cache5 = /* @__PURE__ */ new Map();
518405
518620
  }
@@ -520129,7 +520344,7 @@ var init_artifact_inspector = __esm({
520129
520344
 
520130
520345
  // packages/orchestrator/dist/lesson-bank.js
520131
520346
  import { existsSync as existsSync58, mkdirSync as mkdirSync29, appendFileSync as appendFileSync2, readFileSync as readFileSync45 } from "node:fs";
520132
- import { join as join72, dirname as dirname20 } from "node:path";
520347
+ import { join as join72, dirname as dirname19 } from "node:path";
520133
520348
  import { createHash as createHash9 } from "node:crypto";
520134
520349
  function tokenize2(text) {
520135
520350
  if (!text)
@@ -520166,7 +520381,7 @@ function lessonBankPath(workingDir) {
520166
520381
  }
520167
520382
  function bank(lesson, workingDir) {
520168
520383
  const path11 = lessonBankPath(workingDir);
520169
- mkdirSync29(dirname20(path11), { recursive: true });
520384
+ mkdirSync29(dirname19(path11), { recursive: true });
520170
520385
  appendFileSync2(path11, JSON.stringify(lesson) + "\n", "utf-8");
520171
520386
  }
520172
520387
  function readAll(workingDir) {
@@ -520231,8 +520446,8 @@ var init_lesson_bank = __esm({
520231
520446
  });
520232
520447
 
520233
520448
  // packages/orchestrator/dist/intervention-replay.js
520234
- import { existsSync as existsSync59, mkdirSync as mkdirSync30, readFileSync as readFileSync46, writeFileSync as writeFileSync27, readdirSync as readdirSync18 } from "node:fs";
520235
- import { join as join73, dirname as dirname21 } from "node:path";
520449
+ import { existsSync as existsSync59, mkdirSync as mkdirSync30, readFileSync as readFileSync46, writeFileSync as writeFileSync26, readdirSync as readdirSync18 } from "node:fs";
520450
+ import { join as join73, dirname as dirname20 } from "node:path";
520236
520451
  function checkpointDir2(workingDir) {
520237
520452
  return workingDir ? join73(workingDir, ".omnius", "checkpoints") : join73(process.env["HOME"] || ".", ".omnius", "checkpoints");
520238
520453
  }
@@ -520249,8 +520464,8 @@ function writeCheckpoint(args) {
520249
520464
  notes: args.notes
520250
520465
  };
520251
520466
  const path11 = checkpointPath(args.workingDir, args.turn);
520252
- mkdirSync30(dirname21(path11), { recursive: true });
520253
- writeFileSync27(path11, JSON.stringify(snap), "utf-8");
520467
+ mkdirSync30(dirname20(path11), { recursive: true });
520468
+ writeFileSync26(path11, JSON.stringify(snap), "utf-8");
520254
520469
  } catch {
520255
520470
  }
520256
520471
  }
@@ -520647,7 +520862,7 @@ var init_world_state_plan_reconciler = __esm({
520647
520862
 
520648
520863
  // packages/orchestrator/dist/world-state-drift-detector.js
520649
520864
  import { existsSync as existsSync62, readFileSync as readFileSync48, statSync as statSync23 } from "node:fs";
520650
- import { dirname as dirname22, isAbsolute as isAbsolute4, join as join76, resolve as pathResolve } from "node:path";
520865
+ import { dirname as dirname21, isAbsolute as isAbsolute4, join as join76, resolve as pathResolve } from "node:path";
520651
520866
  function parseImports(source) {
520652
520867
  const out = [];
520653
520868
  const lines = source.split(/\r?\n/);
@@ -520845,7 +521060,7 @@ function resolveImportPath2(importingFile, source, workingDir, aliases) {
520845
521060
  }
520846
521061
  if (bestAlias)
520847
521062
  resolvedSpec = aliases[bestAlias] + source.slice(bestAlias.length);
520848
- const importerDir = dirname22(importingFile);
521063
+ const importerDir = dirname21(importingFile);
520849
521064
  const base3 = resolvedSpec.startsWith(".") ? pathResolve(importerDir, resolvedSpec) : resolvedSpec.startsWith("/") ? resolvedSpec : pathResolve(workingDir, resolvedSpec);
520850
521065
  const candidates = [];
520851
521066
  for (const ext of FILE_EXTENSIONS)
@@ -525278,7 +525493,7 @@ var init_splanifold = __esm({
525278
525493
  });
525279
525494
 
525280
525495
  // packages/memory/dist/embeddingAligner.js
525281
- import { existsSync as existsSync66, readFileSync as readFileSync50, writeFileSync as writeFileSync28, mkdirSync as mkdirSync33 } from "node:fs";
525496
+ import { existsSync as existsSync66, readFileSync as readFileSync50, writeFileSync as writeFileSync27, mkdirSync as mkdirSync33 } from "node:fs";
525282
525497
  import { join as join80 } from "node:path";
525283
525498
  function computeTopKPCA(sources, mean, srcDim, K2, S) {
525284
525499
  const components = new Float64Array(K2 * srcDim);
@@ -525537,7 +525752,7 @@ var init_embeddingAligner = __esm({
525537
525752
  const dir = join80(this.persistPath, "..");
525538
525753
  if (!existsSync66(dir))
525539
525754
  mkdirSync33(dir, { recursive: true });
525540
- writeFileSync28(this.persistPath, JSON.stringify(this.serializeState(), null, 2));
525755
+ writeFileSync27(this.persistPath, JSON.stringify(this.serializeState(), null, 2));
525541
525756
  } catch {
525542
525757
  }
525543
525758
  }
@@ -525795,7 +526010,7 @@ var init_memory4 = __esm({
525795
526010
 
525796
526011
  // packages/memory/dist/crl/config.js
525797
526012
  import { join as join81 } from "node:path";
525798
- import { existsSync as existsSync67, mkdirSync as mkdirSync34, readFileSync as readFileSync51, writeFileSync as writeFileSync29 } from "node:fs";
526013
+ import { existsSync as existsSync67, mkdirSync as mkdirSync34, readFileSync as readFileSync51, writeFileSync as writeFileSync28 } from "node:fs";
525799
526014
  function getCRLConfigStore(workingDir) {
525800
526015
  if (!globalConfigStore) {
525801
526016
  const dir = workingDir || process.cwd();
@@ -525843,7 +526058,7 @@ var init_config5 = __esm({
525843
526058
  }
525844
526059
  }
525845
526060
  save() {
525846
- writeFileSync29(this.configPath, JSON.stringify(this.config, null, 2), "utf-8");
526061
+ writeFileSync28(this.configPath, JSON.stringify(this.config, null, 2), "utf-8");
525847
526062
  }
525848
526063
  get() {
525849
526064
  return { ...this.config };
@@ -525887,7 +526102,7 @@ var init_config5 = __esm({
525887
526102
 
525888
526103
  // packages/memory/dist/crl/converter.js
525889
526104
  import { join as join82 } from "node:path";
525890
- import { existsSync as existsSync68, mkdirSync as mkdirSync35, readFileSync as readFileSync52, writeFileSync as writeFileSync30, readdirSync as readdirSync20 } from "node:fs";
526105
+ import { existsSync as existsSync68, mkdirSync as mkdirSync35, readFileSync as readFileSync52, writeFileSync as writeFileSync29, readdirSync as readdirSync20 } from "node:fs";
525891
526106
  var BACKUP_DIR, CRLBackupManager, CRLConverter;
525892
526107
  var init_converter = __esm({
525893
526108
  "packages/memory/dist/crl/converter.js"() {
@@ -525905,7 +526120,7 @@ var init_converter = __esm({
525905
526120
  }
525906
526121
  backupEpisode(episode) {
525907
526122
  const backupFile = join82(this.backupPath, `${episode.id}.json`);
525908
- writeFileSync30(backupFile, JSON.stringify(episode, null, 2), "utf-8");
526123
+ writeFileSync29(backupFile, JSON.stringify(episode, null, 2), "utf-8");
525909
526124
  return backupFile;
525910
526125
  }
525911
526126
  restoreEpisode(episodeId) {
@@ -525935,7 +526150,7 @@ var init_converter = __esm({
525935
526150
  if (file.endsWith(".json")) {
525936
526151
  try {
525937
526152
  const filePath = join82(this.backupPath, file);
525938
- writeFileSync30(filePath, "", "utf-8");
526153
+ writeFileSync29(filePath, "", "utf-8");
525939
526154
  cleared++;
525940
526155
  } catch {
525941
526156
  }
@@ -529488,12 +529703,12 @@ var init_reflectionBuffer = __esm({
529488
529703
  if (!this.persistPath)
529489
529704
  return;
529490
529705
  try {
529491
- const { writeFileSync: writeFileSync71, mkdirSync: mkdirSync77, existsSync: existsSync124 } = __require("node:fs");
529706
+ const { writeFileSync: writeFileSync70, mkdirSync: mkdirSync77, existsSync: existsSync124 } = __require("node:fs");
529492
529707
  const { join: join142 } = __require("node:path");
529493
529708
  const dir = join142(this.persistPath, "..");
529494
529709
  if (!existsSync124(dir))
529495
529710
  mkdirSync77(dir, { recursive: true });
529496
- writeFileSync71(this.persistPath, JSON.stringify(this.state, null, 2));
529711
+ writeFileSync70(this.persistPath, JSON.stringify(this.state, null, 2));
529497
529712
  } catch {
529498
529713
  }
529499
529714
  }
@@ -530554,7 +530769,7 @@ var init_hooks = __esm({
530554
530769
  });
530555
530770
 
530556
530771
  // packages/orchestrator/dist/todo-context-chunker.js
530557
- import { mkdirSync as mkdirSync38, writeFileSync as writeFileSync33, readFileSync as readFileSync55, existsSync as existsSync71, readdirSync as readdirSync21 } from "node:fs";
530772
+ import { mkdirSync as mkdirSync38, writeFileSync as writeFileSync32, readFileSync as readFileSync55, existsSync as existsSync71, readdirSync as readdirSync21 } from "node:fs";
530558
530773
  import { join as join85 } from "node:path";
530559
530774
  function chunkDir(workingDir) {
530560
530775
  return join85(workingDir, ".omnius", "todo-chunks");
@@ -530772,7 +530987,7 @@ function persistTodoChunk(workingDir, chunk) {
530772
530987
  if (!existsSync71(dir)) {
530773
530988
  mkdirSync38(dir, { recursive: true });
530774
530989
  }
530775
- writeFileSync33(chunkPath(workingDir, chunk.todoId), JSON.stringify(chunk, null, 2), "utf-8");
530990
+ writeFileSync32(chunkPath(workingDir, chunk.todoId), JSON.stringify(chunk, null, 2), "utf-8");
530776
530991
  }
530777
530992
  function loadTodoChunk(workingDir, todoId) {
530778
530993
  const p2 = chunkPath(workingDir, todoId);
@@ -531144,8 +531359,8 @@ var init_streaming_executor = __esm({
531144
531359
  startExecution(entry) {
531145
531360
  entry.state = "executing";
531146
531361
  entry.startedAt = Date.now();
531147
- const exec5 = this.executeFn;
531148
- entry.promise = exec5(entry.name, entry.args).then((result) => {
531362
+ const exec4 = this.executeFn;
531363
+ entry.promise = exec4(entry.name, entry.args).then((result) => {
531149
531364
  entry.state = "completed";
531150
531365
  entry.result = result;
531151
531366
  entry.completedAt = Date.now();
@@ -535548,6 +535763,9 @@ ${blob}
535548
535763
  _buildToolFingerprint(name10, args) {
535549
535764
  return `${name10}:${this._buildExactArgsKey(args)}`;
535550
535765
  }
535766
+ _isStatefulBrowserTool(name10) {
535767
+ return name10 === "playwright_browser" || name10 === "browser_action";
535768
+ }
535551
535769
  /**
535552
535770
  * REG-62: Build a resource-level key for semantic dedup.
535553
535771
  *
@@ -538445,7 +538663,8 @@ ${memoryLines.join("\n")}`
538445
538663
  "todo_write",
538446
538664
  "nexus"
538447
538665
  ].includes(tc.name);
538448
- const isReadLike = baseIsReadLike || tc.name === "shell" && this._isShellCommandReadOnly(tc.arguments?.["command"] ?? tc.arguments?.["cmd"] ?? "");
538666
+ const isStatefulBrowserTool = this._isStatefulBrowserTool(tc.name);
538667
+ const isReadLike = !isStatefulBrowserTool && (baseIsReadLike || tc.name === "shell" && this._isShellCommandReadOnly(tc.arguments?.["command"] ?? tc.arguments?.["cmd"] ?? ""));
538449
538668
  const observerRedundantBlock = this._littlemanRedundantBlocks.has(toolFingerprint);
538450
538669
  if (observerRedundantBlock) {
538451
538670
  this._littlemanRedundantBlocks.delete(toolFingerprint);
@@ -541337,7 +541556,7 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
541337
541556
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
541338
541557
  });
541339
541558
  try {
541340
- const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync71 } = __require("node:fs");
541559
+ const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync70 } = __require("node:fs");
541341
541560
  const { join: join142 } = __require("node:path");
541342
541561
  const contextDir = join142(this._workingDirectory || process.cwd(), ".omnius", "context");
541343
541562
  mkdirSync77(contextDir, { recursive: true });
@@ -541381,8 +541600,8 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
541381
541600
  section("Top Concepts", topConcepts);
541382
541601
  lines.push("(Use file_read on this file for quick recall. See provenance JSON for full edge detail.)");
541383
541602
  const outPath = join142(contextDir, `kg-summary-${this._sessionId}.md`);
541384
- writeFileSync71(outPath, lines.join("\n"), "utf-8");
541385
- writeFileSync71(join142(contextDir, `kg-summary-latest.md`), lines.join("\n"), "utf-8");
541603
+ writeFileSync70(outPath, lines.join("\n"), "utf-8");
541604
+ writeFileSync70(join142(contextDir, `kg-summary-latest.md`), lines.join("\n"), "utf-8");
541386
541605
  } catch {
541387
541606
  }
541388
541607
  }
@@ -541572,11 +541791,11 @@ ${errOutput}`;
541572
541791
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
541573
541792
  });
541574
541793
  try {
541575
- const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync71 } = __require("node:fs");
541794
+ const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync70 } = __require("node:fs");
541576
541795
  const { join: join142 } = __require("node:path");
541577
541796
  const resultsDir = join142(this.omniusStateDir(), "tool-results");
541578
541797
  mkdirSync77(resultsDir, { recursive: true });
541579
- writeFileSync71(join142(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
541798
+ writeFileSync70(join142(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
541580
541799
  # Turn: ${turn}
541581
541800
  # Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}
541582
541801
  # Size: ${result.output.length} chars, ${lineCount} lines
@@ -541937,7 +542156,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
541937
542156
  if (!this._workingDirectory)
541938
542157
  return;
541939
542158
  try {
541940
- const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync71 } = __require("node:fs");
542159
+ const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync70 } = __require("node:fs");
541941
542160
  const { join: join142 } = __require("node:path");
541942
542161
  const sessionDir = this.options.stateDir ? join142(this.omniusStateDir(), "session", this._sessionId) : join142(this._workingDirectory, ".omnius", "session", this._sessionId);
541943
542162
  mkdirSync77(sessionDir, { recursive: true });
@@ -541952,7 +542171,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
541952
542171
  memexEntryCount: this._memexArchive.size,
541953
542172
  fileRegistrySize: this._fileRegistry.size
541954
542173
  };
541955
- writeFileSync71(join142(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
542174
+ writeFileSync70(join142(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
541956
542175
  } catch {
541957
542176
  }
541958
542177
  }
@@ -542777,6 +542996,8 @@ ${trimmedNew}`;
542777
542996
  const lastToolCalls = recent.filter((m2) => m2.role === "assistant" && m2.tool_calls?.length).flatMap((m2) => m2.tool_calls ?? []);
542778
542997
  for (const tc of lastToolCalls) {
542779
542998
  const name10 = tc.function.name;
542999
+ if (this._isStatefulBrowserTool(name10))
543000
+ continue;
542780
543001
  let args = {};
542781
543002
  try {
542782
543003
  args = JSON.parse(tc.function.arguments);
@@ -544171,12 +544392,12 @@ ${result}`
544171
544392
  let resizedBase64 = null;
544172
544393
  try {
544173
544394
  const { execSync: execSync60 } = await import("node:child_process");
544174
- const { writeFileSync: writeFileSync71, readFileSync: readFileSync102, unlinkSync: unlinkSync26 } = await import("node:fs");
544395
+ const { writeFileSync: writeFileSync70, readFileSync: readFileSync102, unlinkSync: unlinkSync26 } = await import("node:fs");
544175
544396
  const { join: join142 } = await import("node:path");
544176
544397
  const { tmpdir: tmpdir23 } = await import("node:os");
544177
544398
  const tmpIn = join142(tmpdir23(), `omnius_img_in_${Date.now()}.png`);
544178
544399
  const tmpOut = join142(tmpdir23(), `omnius_img_out_${Date.now()}.jpg`);
544179
- writeFileSync71(tmpIn, buffer2);
544400
+ writeFileSync70(tmpIn, buffer2);
544180
544401
  const pyBin = process.platform === "win32" ? "python" : "python3";
544181
544402
  const escapedIn = tmpIn.replace(/\\/g, "\\\\");
544182
544403
  const escapedOut = tmpOut.replace(/\\/g, "\\\\");
@@ -545333,7 +545554,7 @@ var init_constraint_learner = __esm({
545333
545554
  });
545334
545555
 
545335
545556
  // packages/orchestrator/dist/nexusBackend.js
545336
- import { existsSync as existsSync74, statSync as statSync27, openSync, readSync, closeSync, unlinkSync as unlinkSync11, writeFileSync as writeFileSync34 } from "node:fs";
545557
+ import { existsSync as existsSync74, statSync as statSync27, openSync, readSync, closeSync, unlinkSync as unlinkSync11, writeFileSync as writeFileSync33 } from "node:fs";
545337
545558
  import { watch as fsWatch } from "node:fs";
545338
545559
  import { join as join88 } from "node:path";
545339
545560
  import { tmpdir as tmpdir18 } from "node:os";
@@ -545486,7 +545707,7 @@ var init_nexusBackend = __esm({
545486
545707
  */
545487
545708
  async *chatCompletionStream(request) {
545488
545709
  const streamFile = join88(tmpdir18(), `nexus-stream-${randomBytes17(6).toString("hex")}.jsonl`);
545489
- writeFileSync34(streamFile, "", "utf8");
545710
+ writeFileSync33(streamFile, "", "utf8");
545490
545711
  const daemonArgs = {
545491
545712
  model: this.model,
545492
545713
  messages: JSON.stringify(request.messages),
@@ -547261,7 +547482,7 @@ var init_agent_task = __esm({
547261
547482
  });
547262
547483
 
547263
547484
  // packages/orchestrator/dist/task-recovery.js
547264
- import { existsSync as existsSync75, readFileSync as readFileSync58, writeFileSync as writeFileSync35, mkdirSync as mkdirSync39, readdirSync as readdirSync23, renameSync as renameSync2, unlinkSync as unlinkSync12 } from "node:fs";
547485
+ import { existsSync as existsSync75, readFileSync as readFileSync58, writeFileSync as writeFileSync34, mkdirSync as mkdirSync39, readdirSync as readdirSync23, renameSync as renameSync2, unlinkSync as unlinkSync12 } from "node:fs";
547265
547486
  import { join as join89 } from "node:path";
547266
547487
  import { homedir as homedir24 } from "node:os";
547267
547488
  function sidecarDir() {
@@ -547277,7 +547498,7 @@ function persistAgentTaskSidecar(task) {
547277
547498
  const finalPath = sidecarPath(task.id);
547278
547499
  const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
547279
547500
  const { abortController: _ignore, ...serializable } = task;
547280
- writeFileSync35(tmpPath, JSON.stringify(serializable, null, 2), "utf-8");
547501
+ writeFileSync34(tmpPath, JSON.stringify(serializable, null, 2), "utf-8");
547281
547502
  renameSync2(tmpPath, finalPath);
547282
547503
  } catch {
547283
547504
  }
@@ -549440,7 +549661,7 @@ __export(py_embed_exports, {
549440
549661
  runTranscribeFile: () => runTranscribeFile
549441
549662
  });
549442
549663
  import { spawnSync as spawnSync6 } from "node:child_process";
549443
- import { existsSync as existsSync77, mkdirSync as mkdirSync43, writeFileSync as writeFileSync39 } from "node:fs";
549664
+ import { existsSync as existsSync77, mkdirSync as mkdirSync43, writeFileSync as writeFileSync38 } from "node:fs";
549444
549665
  import { join as join93 } from "node:path";
549445
549666
  import { homedir as homedir25 } from "node:os";
549446
549667
  function getVenvDir() {
@@ -549532,7 +549753,7 @@ function locateScript(name10) {
549532
549753
  for (const c9 of candidates) if (existsSync77(c9)) return c9;
549533
549754
  const fallback = join93(process.cwd(), name10);
549534
549755
  try {
549535
- writeFileSync39(fallback, 'print("missing script")\n');
549756
+ writeFileSync38(fallback, 'print("missing script")\n');
549536
549757
  } catch {
549537
549758
  }
549538
549759
  return fallback;
@@ -549555,8 +549776,8 @@ __export(listen_exports, {
549555
549776
  waitForTranscribeCli: () => waitForTranscribeCli
549556
549777
  });
549557
549778
  import { spawn as spawn21, execSync as execSync46 } from "node:child_process";
549558
- import { existsSync as existsSync78, mkdirSync as mkdirSync44, writeFileSync as writeFileSync40, readdirSync as readdirSync24 } from "node:fs";
549559
- import { join as join94, dirname as dirname25 } from "node:path";
549779
+ import { existsSync as existsSync78, mkdirSync as mkdirSync44, writeFileSync as writeFileSync39, readdirSync as readdirSync24 } from "node:fs";
549780
+ import { join as join94, dirname as dirname24 } from "node:path";
549560
549781
  import { homedir as homedir26 } from "node:os";
549561
549782
  import { fileURLToPath as fileURLToPath10 } from "node:url";
549562
549783
  import { EventEmitter as EventEmitter4 } from "node:events";
@@ -549640,7 +549861,7 @@ function findMicCaptureCommand() {
549640
549861
  return null;
549641
549862
  }
549642
549863
  function findTranscribeFileScript() {
549643
- const thisDir = dirname25(fileURLToPath10(import.meta.url));
549864
+ const thisDir = dirname24(fileURLToPath10(import.meta.url));
549644
549865
  const candidates = [
549645
549866
  join94(thisDir, "../../../../packages/execution/scripts/transcribe-file.py"),
549646
549867
  join94(thisDir, "../../../packages/execution/scripts/transcribe-file.py"),
@@ -549725,7 +549946,7 @@ async function transcribeFileViaWhisper(filePath, model) {
549725
549946
  });
549726
549947
  }
549727
549948
  function findLiveWhisperScript() {
549728
- const thisDir = dirname25(fileURLToPath10(import.meta.url));
549949
+ const thisDir = dirname24(fileURLToPath10(import.meta.url));
549729
549950
  const candidates = [
549730
549951
  join94(thisDir, "../../../../packages/execution/scripts/live-whisper.py"),
549731
549952
  join94(thisDir, "../../../packages/execution/scripts/live-whisper.py"),
@@ -549798,9 +550019,9 @@ function ensureTranscribeCliBackground() {
549798
550019
  } catch {
549799
550020
  }
549800
550021
  try {
549801
- const { exec: exec5 } = await import("node:child_process");
550022
+ const { exec: exec4 } = await import("node:child_process");
549802
550023
  return new Promise((resolve49) => {
549803
- exec5("npm i -g transcribe-cli", { timeout: 18e4 }, (err) => {
550024
+ exec4("npm i -g transcribe-cli", { timeout: 18e4 }, (err) => {
549804
550025
  resolve49(!err);
549805
550026
  });
549806
550027
  });
@@ -550094,7 +550315,7 @@ var init_listen = __esm({
550094
550315
  if (TranscribeLive) {
550095
550316
  let tcUpToDate = false;
550096
550317
  try {
550097
- const tcPkgPath = join94(dirname25(__require.resolve?.("transcribe-cli/package.json") || ""), "package.json");
550318
+ const tcPkgPath = join94(dirname24(__require.resolve?.("transcribe-cli/package.json") || ""), "package.json");
550098
550319
  if (existsSync78(tcPkgPath)) {
550099
550320
  const tcPkg = JSON.parse(__require("fs").readFileSync(tcPkgPath, "utf8"));
550100
550321
  tcUpToDate = tcPkg.version && tcPkg.version >= "2.0.1";
@@ -550440,7 +550661,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
550440
550661
  const transcriptDir = join94(outputDir, ".omnius", "transcripts");
550441
550662
  mkdirSync44(transcriptDir, { recursive: true });
550442
550663
  const outFile = join94(transcriptDir, `${basename28(filePath)}.txt`);
550443
- writeFileSync40(outFile, result.text, "utf-8");
550664
+ writeFileSync39(outFile, result.text, "utf-8");
550444
550665
  }
550445
550666
  return {
550446
550667
  text: result.text,
@@ -550459,7 +550680,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
550459
550680
  const transcriptDir = join94(outputDir, ".omnius", "transcripts");
550460
550681
  mkdirSync44(transcriptDir, { recursive: true });
550461
550682
  const outFile = join94(transcriptDir, `${basename28(filePath)}.txt`);
550462
- writeFileSync40(outFile, fb.text, "utf-8");
550683
+ writeFileSync39(outFile, fb.text, "utf-8");
550463
550684
  }
550464
550685
  return fb;
550465
550686
  }
@@ -557263,7 +557484,7 @@ var init_voice_session = __esm({
557263
557484
 
557264
557485
  // packages/cli/src/tui/scoped-personality.ts
557265
557486
  import { createHash as createHash15 } from "node:crypto";
557266
- import { existsSync as existsSync79, mkdirSync as mkdirSync45, readFileSync as readFileSync62, writeFileSync as writeFileSync41 } from "node:fs";
557487
+ import { existsSync as existsSync79, mkdirSync as mkdirSync45, readFileSync as readFileSync62, writeFileSync as writeFileSync40 } from "node:fs";
557267
557488
  import { join as join95, resolve as resolve35 } from "node:path";
557268
557489
  function safeName(input) {
557269
557490
  return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
@@ -557357,8 +557578,8 @@ function loadScopedPersonality(scope) {
557357
557578
  function saveScopedPersonality(scope, doc) {
557358
557579
  const paths = scopedPersonalityPaths(scope);
557359
557580
  mkdirSync45(scopedPersonalityDir(scope.repoRoot, scope.kind), { recursive: true });
557360
- writeFileSync41(paths.json, JSON.stringify(doc, null, 2) + "\n", "utf8");
557361
- writeFileSync41(paths.markdown, renderScopedPersonalityMarkdown(doc) + "\n", "utf8");
557581
+ writeFileSync40(paths.json, JSON.stringify(doc, null, 2) + "\n", "utf8");
557582
+ writeFileSync40(paths.markdown, renderScopedPersonalityMarkdown(doc) + "\n", "utf8");
557362
557583
  }
557363
557584
  function updateScopedPersonality(scope, observation) {
557364
557585
  const doc = loadScopedPersonality(scope);
@@ -557529,12 +557750,12 @@ var init_scoped_personality = __esm({
557529
557750
 
557530
557751
  // packages/cli/src/tui/expose.ts
557531
557752
  import { createServer as createServer4, request as httpRequest } from "node:http";
557532
- import { spawn as spawn23, exec as exec2 } from "node:child_process";
557753
+ import { spawn as spawn23, exec } from "node:child_process";
557533
557754
  import { EventEmitter as EventEmitter6 } from "node:events";
557534
557755
  import { randomBytes as randomBytes18 } from "node:crypto";
557535
557756
  import { URL as URL2 } from "node:url";
557536
557757
  import { loadavg, cpus as cpus2, totalmem as totalmem3, freemem as freemem3 } from "node:os";
557537
- import { existsSync as existsSync80, readFileSync as readFileSync63, writeFileSync as writeFileSync42, unlinkSync as unlinkSync13, mkdirSync as mkdirSync46, readdirSync as readdirSync25, statSync as statSync28, statfsSync as statfsSync2 } from "node:fs";
557758
+ import { existsSync as existsSync80, readFileSync as readFileSync63, writeFileSync as writeFileSync41, unlinkSync as unlinkSync13, mkdirSync as mkdirSync46, readdirSync as readdirSync25, statSync as statSync28, statfsSync as statfsSync2 } from "node:fs";
557538
557759
  import { join as join96 } from "node:path";
557539
557760
  function cleanForwardHeaders(raw, targetHost) {
557540
557761
  const out = {};
@@ -557569,7 +557790,7 @@ function readExposeState(stateDir) {
557569
557790
  function writeExposeState(stateDir, state) {
557570
557791
  try {
557571
557792
  mkdirSync46(stateDir, { recursive: true });
557572
- writeFileSync42(join96(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
557793
+ writeFileSync41(join96(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
557573
557794
  } catch {
557574
557795
  }
557575
557796
  }
@@ -557655,7 +557876,7 @@ async function collectSystemMetricsAsync() {
557655
557876
  };
557656
557877
  try {
557657
557878
  const smi = await new Promise((resolve49, reject) => {
557658
- exec2(
557879
+ exec(
557659
557880
  "nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null",
557660
557881
  { encoding: "utf8", timeout: 3e3 },
557661
557882
  (err, stdout) => err ? reject(err) : resolve49(stdout)
@@ -557707,7 +557928,7 @@ function readP2PExposeState(stateDir) {
557707
557928
  function writeP2PExposeState(stateDir, state) {
557708
557929
  try {
557709
557930
  mkdirSync46(stateDir, { recursive: true });
557710
- writeFileSync42(join96(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
557931
+ writeFileSync41(join96(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
557711
557932
  } catch {
557712
557933
  }
557713
557934
  }
@@ -559111,8 +559332,8 @@ var init_types = __esm({
559111
559332
 
559112
559333
  // packages/cli/src/tui/p2p/secret-vault.ts
559113
559334
  import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes19, scryptSync as scryptSync2, createHash as createHash16 } from "node:crypto";
559114
- import { readFileSync as readFileSync64, writeFileSync as writeFileSync43, existsSync as existsSync81, mkdirSync as mkdirSync47 } from "node:fs";
559115
- import { dirname as dirname26 } from "node:path";
559335
+ import { readFileSync as readFileSync64, writeFileSync as writeFileSync42, existsSync as existsSync81, mkdirSync as mkdirSync47 } from "node:fs";
559336
+ import { dirname as dirname25 } from "node:path";
559116
559337
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
559117
559338
  var init_secret_vault = __esm({
559118
559339
  "packages/cli/src/tui/p2p/secret-vault.ts"() {
@@ -559319,9 +559540,9 @@ var init_secret_vault = __esm({
559319
559540
  const encrypted = Buffer.concat([cipher.update(data, "utf8"), cipher.final()]);
559320
559541
  const tag = cipher.getAuthTag();
559321
559542
  const blob = Buffer.concat([salt, iv, tag, encrypted]);
559322
- const dir = dirname26(this.storePath);
559543
+ const dir = dirname25(this.storePath);
559323
559544
  if (!existsSync81(dir)) mkdirSync47(dir, { recursive: true });
559324
- writeFileSync43(this.storePath, blob, { mode: 384 });
559545
+ writeFileSync42(this.storePath, blob, { mode: 384 });
559325
559546
  }
559326
559547
  /**
559327
559548
  * Load vault from disk, decrypting with the given passphrase.
@@ -560917,7 +561138,7 @@ var init_render2 = __esm({
560917
561138
 
560918
561139
  // packages/prompts/dist/promptLoader.js
560919
561140
  import { readFileSync as readFileSync65, existsSync as existsSync82 } from "node:fs";
560920
- import { join as join98, dirname as dirname27 } from "node:path";
561141
+ import { join as join98, dirname as dirname26 } from "node:path";
560921
561142
  import { fileURLToPath as fileURLToPath11 } from "node:url";
560922
561143
  function loadPrompt2(promptPath, vars) {
560923
561144
  let content = cache6.get(promptPath);
@@ -560938,7 +561159,7 @@ var init_promptLoader2 = __esm({
560938
561159
  "packages/prompts/dist/promptLoader.js"() {
560939
561160
  "use strict";
560940
561161
  __filename4 = fileURLToPath11(import.meta.url);
560941
- __dirname6 = dirname27(__filename4);
561162
+ __dirname6 = dirname26(__filename4);
560942
561163
  devPath = join98(__dirname6, "..", "templates");
560943
561164
  publishedPath = join98(__dirname6, "..", "prompts", "templates");
560944
561165
  PROMPTS_DIR2 = existsSync82(devPath) ? devPath : publishedPath;
@@ -561052,7 +561273,7 @@ var init_task_templates = __esm({
561052
561273
  });
561053
561274
 
561054
561275
  // packages/prompts/dist/index.js
561055
- import { join as join99, dirname as dirname28 } from "node:path";
561276
+ import { join as join99, dirname as dirname27 } from "node:path";
561056
561277
  import { fileURLToPath as fileURLToPath12 } from "node:url";
561057
561278
  var _dir, _packageRoot;
561058
561279
  var init_dist9 = __esm({
@@ -561062,7 +561283,7 @@ var init_dist9 = __esm({
561062
561283
  init_render2();
561063
561284
  init_task_templates();
561064
561285
  init_render2();
561065
- _dir = dirname28(fileURLToPath12(import.meta.url));
561286
+ _dir = dirname27(fileURLToPath12(import.meta.url));
561066
561287
  _packageRoot = join99(_dir, "..");
561067
561288
  }
561068
561289
  });
@@ -561107,8 +561328,8 @@ __export(omnius_directory_exports, {
561107
561328
  writeIndexMeta: () => writeIndexMeta,
561108
561329
  writeTaskHandoff: () => writeTaskHandoff2
561109
561330
  });
561110
- import { cpSync, existsSync as existsSync83, mkdirSync as mkdirSync48, readFileSync as readFileSync66, writeFileSync as writeFileSync44, readdirSync as readdirSync26, statSync as statSync29, unlinkSync as unlinkSync14, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync3 } from "node:fs";
561111
- import { join as join100, relative as relative9, basename as basename17, dirname as dirname29 } from "node:path";
561331
+ import { cpSync, existsSync as existsSync83, mkdirSync as mkdirSync48, readFileSync as readFileSync66, writeFileSync as writeFileSync43, readdirSync as readdirSync26, statSync as statSync29, unlinkSync as unlinkSync14, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync3 } from "node:fs";
561332
+ import { join as join100, relative as relative9, basename as basename17, dirname as dirname28 } from "node:path";
561112
561333
  import { homedir as homedir27 } from "node:os";
561113
561334
  import { createHash as createHash18 } from "node:crypto";
561114
561335
  function findGitRoot(startDir) {
@@ -561145,7 +561366,7 @@ function ensureOmniusIgnored(repoRoot) {
561145
561366
  if (!gitRoot) return;
561146
561367
  const gitignorePath = findNearestExistingGitignore(repoRoot, gitRoot);
561147
561368
  if (!gitignorePath) return;
561148
- const gitignoreDir = dirname29(gitignorePath);
561369
+ const gitignoreDir = dirname28(gitignorePath);
561149
561370
  const relDir = relative9(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
561150
561371
  const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
561151
561372
  const content = readFileSync66(gitignorePath, "utf-8");
@@ -561156,7 +561377,7 @@ function ensureOmniusIgnored(repoRoot) {
561156
561377
  return normalizeIgnoreRule(trimmed) === normalizedTarget;
561157
561378
  });
561158
561379
  if (alreadyIgnored) return;
561159
- writeFileSync44(
561380
+ writeFileSync43(
561160
561381
  gitignorePath,
561161
561382
  (content.trimEnd() ? `${content.trimEnd()}
561162
561383
  ` : "") + `${ignorePattern}
@@ -561209,7 +561430,7 @@ function saveProjectSettings(repoRoot, settings) {
561209
561430
  mkdirSync48(omniusPath, { recursive: true });
561210
561431
  const existing = loadProjectSettings(repoRoot);
561211
561432
  const merged = { ...existing, ...settings };
561212
- writeFileSync44(join100(omniusPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
561433
+ writeFileSync43(join100(omniusPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
561213
561434
  }
561214
561435
  function loadGlobalSettings() {
561215
561436
  const settingsPath = join100(homedir27(), ".omnius", "settings.json");
@@ -561226,7 +561447,7 @@ function saveGlobalSettings(settings) {
561226
561447
  mkdirSync48(dir, { recursive: true });
561227
561448
  const existing = loadGlobalSettings();
561228
561449
  const merged = { ...existing, ...settings };
561229
- writeFileSync44(join100(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
561450
+ writeFileSync43(join100(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
561230
561451
  }
561231
561452
  function resolveSettings(repoRoot) {
561232
561453
  const global2 = loadGlobalSettings();
@@ -561287,7 +561508,7 @@ function readIndexMeta(repoRoot) {
561287
561508
  function writeIndexMeta(repoRoot, meta) {
561288
561509
  const metaPath = join100(repoRoot, OMNIUS_DIR, "index", "meta.json");
561289
561510
  mkdirSync48(join100(repoRoot, OMNIUS_DIR, "index"), { recursive: true });
561290
- writeFileSync44(metaPath, JSON.stringify(meta, null, 2), "utf-8");
561511
+ writeFileSync43(metaPath, JSON.stringify(meta, null, 2), "utf-8");
561291
561512
  }
561292
561513
  function readIndexData(repoRoot, filename) {
561293
561514
  const filePath = join100(repoRoot, OMNIUS_DIR, "index", filename);
@@ -561300,7 +561521,7 @@ function readIndexData(repoRoot, filename) {
561300
561521
  function writeIndexData(repoRoot, filename, data) {
561301
561522
  const filePath = join100(repoRoot, OMNIUS_DIR, "index", filename);
561302
561523
  mkdirSync48(join100(repoRoot, OMNIUS_DIR, "index"), { recursive: true });
561303
- writeFileSync44(filePath, JSON.stringify(data, null, 2), "utf-8");
561524
+ writeFileSync43(filePath, JSON.stringify(data, null, 2), "utf-8");
561304
561525
  }
561305
561526
  function generateProjectMap(repoRoot) {
561306
561527
  const sections = [];
@@ -561349,13 +561570,13 @@ ${tree2}\`\`\`
561349
561570
  const content = sections.join("\n");
561350
561571
  const contextDir = join100(repoRoot, OMNIUS_DIR, "context");
561351
561572
  mkdirSync48(contextDir, { recursive: true });
561352
- writeFileSync44(join100(contextDir, "project-map.md"), content, "utf-8");
561573
+ writeFileSync43(join100(contextDir, "project-map.md"), content, "utf-8");
561353
561574
  return content;
561354
561575
  }
561355
561576
  function saveSession(repoRoot, session) {
561356
561577
  const historyDir = join100(repoRoot, OMNIUS_DIR, "history");
561357
561578
  mkdirSync48(historyDir, { recursive: true });
561358
- writeFileSync44(
561579
+ writeFileSync43(
561359
561580
  join100(historyDir, `${session.id}.json`),
561360
561581
  JSON.stringify(session, null, 2),
561361
561582
  "utf-8"
@@ -561385,7 +561606,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
561385
561606
  function savePendingTask(repoRoot, task) {
561386
561607
  const historyDir = join100(repoRoot, OMNIUS_DIR, "history");
561387
561608
  mkdirSync48(historyDir, { recursive: true });
561388
- writeFileSync44(
561609
+ writeFileSync43(
561389
561610
  join100(historyDir, PENDING_TASK_FILE),
561390
561611
  JSON.stringify(task, null, 2) + "\n",
561391
561612
  "utf-8"
@@ -561410,11 +561631,11 @@ function writeTaskHandoff2(repoRoot, handoff) {
561410
561631
  mkdirSync48(contextDir, { recursive: true });
561411
561632
  const filePath = join100(contextDir, HANDOFF_FILE);
561412
561633
  const tempPath = filePath + ".tmp";
561413
- writeFileSync44(tempPath, JSON.stringify(handoff, null, 2) + "\n", "utf-8");
561634
+ writeFileSync43(tempPath, JSON.stringify(handoff, null, 2) + "\n", "utf-8");
561414
561635
  try {
561415
561636
  renameSync3(tempPath, filePath);
561416
561637
  } catch {
561417
- writeFileSync44(filePath, JSON.stringify(handoff, null, 2) + "\n", "utf-8");
561638
+ writeFileSync43(filePath, JSON.stringify(handoff, null, 2) + "\n", "utf-8");
561418
561639
  try {
561419
561640
  unlinkSync14(tempPath);
561420
561641
  } catch {
@@ -561505,7 +561726,7 @@ function acquireLock(lockPath) {
561505
561726
  try {
561506
561727
  const fd = openSync2(lockPath, "wx");
561507
561728
  const lockData = JSON.stringify({ pid, acquiredAt: Date.now() });
561508
- writeFileSync44(fd, lockData);
561729
+ writeFileSync43(fd, lockData);
561509
561730
  closeSync2(fd);
561510
561731
  return true;
561511
561732
  } catch (err) {
@@ -561683,18 +561904,18 @@ function saveSessionContext(repoRoot, entry) {
561683
561904
  }
561684
561905
  ctx3.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
561685
561906
  const tempFilePath = filePath + ".tmp";
561686
- writeFileSync44(tempFilePath, JSON.stringify(ctx3, null, 2) + "\n", "utf-8");
561907
+ writeFileSync43(tempFilePath, JSON.stringify(ctx3, null, 2) + "\n", "utf-8");
561687
561908
  try {
561688
561909
  renameSync3(tempFilePath, filePath);
561689
561910
  } catch {
561690
- writeFileSync44(filePath, JSON.stringify(ctx3, null, 2) + "\n", "utf-8");
561911
+ writeFileSync43(filePath, JSON.stringify(ctx3, null, 2) + "\n", "utf-8");
561691
561912
  try {
561692
561913
  unlinkSync14(tempFilePath);
561693
561914
  } catch {
561694
561915
  }
561695
561916
  }
561696
561917
  try {
561697
- writeFileSync44(
561918
+ writeFileSync43(
561698
561919
  join100(contextDir, "session-diary.md"),
561699
561920
  renderSessionDiary(ctx3.entries.slice(-10)),
561700
561921
  "utf-8"
@@ -561858,7 +562079,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
561858
562079
  const autoName = meta.name || generateSessionName(stripped);
561859
562080
  const autoDesc = meta.description || generateSessionDescription(stripped);
561860
562081
  const contentPath = join100(sessDir, `${sessionId}.jsonl`);
561861
- writeFileSync44(contentPath, stripped.join("\n"), "utf-8");
562082
+ writeFileSync43(contentPath, stripped.join("\n"), "utf-8");
561862
562083
  const indexPath = join100(sessDir, SESSIONS_INDEX);
561863
562084
  let index = [];
561864
562085
  try {
@@ -561889,7 +562110,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
561889
562110
  } catch {
561890
562111
  }
561891
562112
  }
561892
- writeFileSync44(indexPath, JSON.stringify(index, null, 2), "utf-8");
562113
+ writeFileSync43(indexPath, JSON.stringify(index, null, 2), "utf-8");
561893
562114
  }
561894
562115
  function listSessions(repoRoot) {
561895
562116
  const indexPath = join100(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
@@ -561919,7 +562140,7 @@ function deleteSession(repoRoot, sessionId) {
561919
562140
  if (existsSync83(indexPath)) {
561920
562141
  let index = JSON.parse(readFileSync66(indexPath, "utf-8"));
561921
562142
  index = index.filter((s2) => s2.id !== sessionId);
561922
- writeFileSync44(indexPath, JSON.stringify(index, null, 2), "utf-8");
562143
+ writeFileSync43(indexPath, JSON.stringify(index, null, 2), "utf-8");
561923
562144
  }
561924
562145
  return true;
561925
562146
  } catch {
@@ -562055,7 +562276,7 @@ function loadUsageFile(filePath) {
562055
562276
  function saveUsageFile(filePath, data) {
562056
562277
  const dir = join100(filePath, "..");
562057
562278
  mkdirSync48(dir, { recursive: true });
562058
- writeFileSync44(filePath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
562279
+ writeFileSync43(filePath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
562059
562280
  }
562060
562281
  function recordUsage(kind, value2, opts) {
562061
562282
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -562559,7 +562780,7 @@ __export(system_metrics_exports, {
562559
562780
  instantaneousCpuPct: () => instantaneousCpuPct
562560
562781
  });
562561
562782
  import { loadavg as loadavg2, cpus as cpus3, totalmem as totalmem5, freemem as freemem4, platform as platform3 } from "node:os";
562562
- import { exec as exec3 } from "node:child_process";
562783
+ import { exec as exec2 } from "node:child_process";
562563
562784
  import { readFile as readFile22 } from "node:fs/promises";
562564
562785
  function formatRate(bytesPerSec) {
562565
562786
  if (bytesPerSec < 1024) return `${Math.round(bytesPerSec)}B`;
@@ -562606,7 +562827,7 @@ async function collectNetworkMetrics() {
562606
562827
  if (plat === "darwin") {
562607
562828
  try {
562608
562829
  const output = await new Promise((resolve49, reject) => {
562609
- exec3("netstat -ib 2>/dev/null | head -30", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve49(stdout));
562830
+ exec2("netstat -ib 2>/dev/null | head -30", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve49(stdout));
562610
562831
  });
562611
562832
  let rxBytes = 0, txBytes = 0;
562612
562833
  for (const line of output.split("\n")) {
@@ -562640,7 +562861,7 @@ async function collectGpuMetrics() {
562640
562861
  if (_nvidiaSmiAvailable === false) return noGpu;
562641
562862
  try {
562642
562863
  const smi = await new Promise((resolve49, reject) => {
562643
- exec3(
562864
+ exec2(
562644
562865
  "nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null",
562645
562866
  { encoding: "utf8", timeout: 3e3 },
562646
562867
  (err, stdout) => err ? reject(err) : resolve49(stdout)
@@ -567973,8 +568194,8 @@ __export(personaplex_exports, {
567973
568194
  startPersonaPlexDaemon: () => startPersonaPlexDaemon,
567974
568195
  stopPersonaPlex: () => stopPersonaPlex
567975
568196
  });
567976
- import { existsSync as existsSync85, writeFileSync as writeFileSync45, readFileSync as readFileSync69, mkdirSync as mkdirSync49, copyFileSync as copyFileSync4, readdirSync as readdirSync27, statSync as statSync30 } from "node:fs";
567977
- import { join as join102, dirname as dirname30 } from "node:path";
568197
+ import { existsSync as existsSync85, writeFileSync as writeFileSync44, readFileSync as readFileSync69, mkdirSync as mkdirSync49, copyFileSync as copyFileSync4, readdirSync as readdirSync27, statSync as statSync30 } from "node:fs";
568198
+ import { join as join102, dirname as dirname29 } from "node:path";
567978
568199
  import { homedir as homedir29 } from "node:os";
567979
568200
  import { execSync as execSync49, spawn as spawn24 } from "node:child_process";
567980
568201
  import { fileURLToPath as fileURLToPath13 } from "node:url";
@@ -568111,7 +568332,7 @@ function getWeightTier() {
568111
568332
  if (saved in WEIGHT_REPOS) {
568112
568333
  const vram = detected.vramGB;
568113
568334
  if (saved === "nf4-distilled" && vram < 24) {
568114
- writeFileSync45(tierFile, "nf4");
568335
+ writeFileSync44(tierFile, "nf4");
568115
568336
  return "nf4";
568116
568337
  }
568117
568338
  return saved;
@@ -568241,7 +568462,7 @@ async function installPersonaPlex(onInfo, weightTier) {
568241
568462
  let src2 = readFileSync69(serverFile, "utf8");
568242
568463
  if (src2.includes('int(request["seed"])')) {
568243
568464
  src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
568244
- writeFileSync45(serverFile, src2);
568465
+ writeFileSync44(serverFile, src2);
568245
568466
  log22("Applied seed parameter bug fix to moshi server.");
568246
568467
  }
568247
568468
  }
@@ -568345,7 +568566,7 @@ $2if filename.endswith(".safetensors"):`
568345
568566
  ${patchPoint}`
568346
568567
  );
568347
568568
  }
568348
- writeFileSync45(loadersFile, src2);
568569
+ writeFileSync44(loadersFile, src2);
568349
568570
  log22("Patched loaders.py with 2-bit TurboQuant native dequant support.");
568350
568571
  }
568351
568572
  }
@@ -568443,7 +568664,7 @@ $2if filename.endswith(".safetensors"):`
568443
568664
  await execAsync(`"${python}" -c "from huggingface_hub import hf_hub_download; hf_hub_download('${nf4.repo}', '${nf4.file}', token=False)"`, {
568444
568665
  timeout: 6e5
568445
568666
  });
568446
- writeFileSync45(join102(PERSONAPLEX_DIR, "weight_tier"), "nf4");
568667
+ writeFileSync44(join102(PERSONAPLEX_DIR, "weight_tier"), "nf4");
568447
568668
  log22(`Downloaded INT4 weights instead (${nf4.sizeGB}GB, public).`);
568448
568669
  } catch {
568449
568670
  log22("Weight download failed.");
@@ -568455,8 +568676,8 @@ $2if filename.endswith(".safetensors"):`
568455
568676
  log22("Weights will download on first server launch.");
568456
568677
  }
568457
568678
  }
568458
- writeFileSync45(join102(PERSONAPLEX_DIR, "weight_tier"), tier);
568459
- writeFileSync45(join102(PERSONAPLEX_DIR, "model_ready"), (/* @__PURE__ */ new Date()).toISOString());
568679
+ writeFileSync44(join102(PERSONAPLEX_DIR, "weight_tier"), tier);
568680
+ writeFileSync44(join102(PERSONAPLEX_DIR, "model_ready"), (/* @__PURE__ */ new Date()).toISOString());
568460
568681
  log22(`PersonaPlex installed (${tier} tier). Use /call to start voice session.`);
568461
568682
  return true;
568462
568683
  }
@@ -568623,8 +568844,8 @@ print('Converted')
568623
568844
  cwd: PERSONAPLEX_DIR
568624
568845
  });
568625
568846
  if (child.pid) {
568626
- writeFileSync45(PID_FILE, String(child.pid));
568627
- writeFileSync45(PORT_FILE, String(PORT));
568847
+ writeFileSync44(PID_FILE, String(child.pid));
568848
+ writeFileSync44(PORT_FILE, String(PORT));
568628
568849
  registry2.register({
568629
568850
  name: "PersonaPlex",
568630
568851
  pid: child.pid,
@@ -568788,7 +569009,7 @@ function getShippedVoicesDir() {
568788
569009
  // repo root
568789
569010
  ];
568790
569011
  try {
568791
- const modDir = dirname30(fileURLToPath13(import.meta.url));
569012
+ const modDir = dirname29(fileURLToPath13(import.meta.url));
568792
569013
  candidates.push(join102(modDir, "..", "..", "..", "voices", "personaplex"));
568793
569014
  candidates.push(join102(modDir, "..", "..", "..", "..", "voices", "personaplex"));
568794
569015
  } catch {
@@ -568884,7 +569105,7 @@ function patchFrontendVoiceList(onInfo) {
568884
569105
  if (js.includes(needle)) {
568885
569106
  const additions = customVoices.map((v) => `"${v}"`).join(", ");
568886
569107
  js = js.replace(needle, `"VARM4.pt", ${additions}]`);
568887
- writeFileSync45(jsPath, js);
569108
+ writeFileSync44(jsPath, js);
568888
569109
  log22(`Added ${customVoices.length} custom voice(s) to frontend: ${customVoices.map((v) => v.replace(".pt", "")).join(", ")}`);
568889
569110
  }
568890
569111
  }
@@ -568981,9 +569202,9 @@ __export(setup_exports, {
568981
569202
  updateOllama: () => updateOllama
568982
569203
  });
568983
569204
  import * as readline from "node:readline";
568984
- import { execSync as execSync50, spawn as spawn25, exec as exec4 } from "node:child_process";
569205
+ import { execSync as execSync50, spawn as spawn25, exec as exec3 } from "node:child_process";
568985
569206
  import { promisify as promisify6 } from "node:util";
568986
- import { existsSync as existsSync86, writeFileSync as writeFileSync46, readFileSync as readFileSync70, appendFileSync as appendFileSync4, mkdirSync as mkdirSync50 } from "node:fs";
569207
+ import { existsSync as existsSync86, writeFileSync as writeFileSync45, readFileSync as readFileSync70, appendFileSync as appendFileSync4, mkdirSync as mkdirSync50 } from "node:fs";
568987
569208
  import { join as join103 } from "node:path";
568988
569209
  import { homedir as homedir30, platform as platform4 } from "node:os";
568989
569210
  function wrapText(value2, width) {
@@ -569383,7 +569604,7 @@ osascript -e 'Tell application "System Events" to display dialog "Omnius needs a
569383
569604
  return null;
569384
569605
  }
569385
569606
  try {
569386
- writeFileSync46(helperPath, body, { mode: 448 });
569607
+ writeFileSync45(helperPath, body, { mode: 448 });
569387
569608
  execSync50(`chmod 700 "${helperPath}"`, { stdio: "ignore" });
569388
569609
  return helperPath;
569389
569610
  } catch {
@@ -570350,7 +570571,7 @@ ${c3.cyan(OMNIUS_FIRST_RUN_BANNER)}
570350
570571
  const modelDir2 = join103(homedir30(), ".omnius", "models");
570351
570572
  mkdirSync50(modelDir2, { recursive: true });
570352
570573
  const modelfilePath = join103(modelDir2, `Modelfile.${customName}`);
570353
- writeFileSync46(modelfilePath, modelfileContent + "\n", "utf8");
570574
+ writeFileSync45(modelfilePath, modelfileContent + "\n", "utf8");
570354
570575
  process.stdout.write(` ${c3.dim("Creating model...")} `);
570355
570576
  execSync50(`ollama create ${customName} -f ${modelfilePath}`, {
570356
570577
  stdio: "pipe",
@@ -570718,7 +570939,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
570718
570939
  }
570719
570940
  try {
570720
570941
  mkdirSync50(_visionMarkerDir, { recursive: true });
570721
- writeFileSync46(_visionMarkerFile, JSON.stringify({
570942
+ writeFileSync45(_visionMarkerFile, JSON.stringify({
570722
570943
  installed: [..._visionPreviouslyInstalled],
570723
570944
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
570724
570945
  }, null, 2));
@@ -571009,7 +571230,7 @@ function createExpandedVariantNamed(targetModel, baseModel, specs, sizeGB, kvByt
571009
571230
  const modelDir2 = join103(homedir30(), ".omnius", "models");
571010
571231
  mkdirSync50(modelDir2, { recursive: true });
571011
571232
  const modelfilePath = join103(modelDir2, `Modelfile.${targetModel}`);
571012
- writeFileSync46(modelfilePath, modelfileContent + "\n", "utf8");
571233
+ writeFileSync45(modelfilePath, modelfileContent + "\n", "utf8");
571013
571234
  execSync50(`ollama create ${targetModel} -f ${modelfilePath}`, {
571014
571235
  stdio: "pipe",
571015
571236
  timeout: 12e4
@@ -571026,7 +571247,7 @@ async function createExpandedVariantNamedAsync(targetModel, baseModel, specs, si
571026
571247
  const modelDir2 = join103(homedir30(), ".omnius", "models");
571027
571248
  mkdirSync50(modelDir2, { recursive: true });
571028
571249
  const modelfilePath = join103(modelDir2, `Modelfile.${targetModel}`);
571029
- writeFileSync46(modelfilePath, modelfileContent + "\n", "utf8");
571250
+ writeFileSync45(modelfilePath, modelfileContent + "\n", "utf8");
571030
571251
  await execAsync2(`ollama create ${targetModel} -f ${modelfilePath}`, {
571031
571252
  timeout: 12e4
571032
571253
  });
@@ -571364,7 +571585,7 @@ var init_setup = __esm({
571364
571585
  init_config();
571365
571586
  init_dist();
571366
571587
  init_tui_select();
571367
- execAsync2 = promisify6(exec4);
571588
+ execAsync2 = promisify6(exec3);
571368
571589
  OMNIUS_FIRST_RUN_BANNER = [
571369
571590
  " ░▒▓██████▓▒░░▒▓██████████████▓▒░░▒▓███████▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓███████▓▒░ ",
571370
571591
  "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ",
@@ -575296,11 +575517,11 @@ __export(daemon_exports, {
575296
575517
  stopDaemon: () => stopDaemon
575297
575518
  });
575298
575519
  import { spawn as spawn26 } from "node:child_process";
575299
- import { existsSync as existsSync92, readFileSync as readFileSync73, writeFileSync as writeFileSync47, mkdirSync as mkdirSync51, unlinkSync as unlinkSync16, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
575520
+ import { existsSync as existsSync92, readFileSync as readFileSync73, writeFileSync as writeFileSync46, mkdirSync as mkdirSync51, unlinkSync as unlinkSync16, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
575300
575521
  import { join as join107 } from "node:path";
575301
575522
  import { homedir as homedir32 } from "node:os";
575302
575523
  import { fileURLToPath as fileURLToPath14 } from "node:url";
575303
- import { dirname as dirname31 } from "node:path";
575524
+ import { dirname as dirname30 } from "node:path";
575304
575525
  function getDaemonPort() {
575305
575526
  const env2 = process.env["OMNIUS_HOST"];
575306
575527
  if (env2) {
@@ -575357,15 +575578,15 @@ async function resolveDaemonCommand(nodeExe) {
575357
575578
  if (process.argv[1]) candidates.push(process.argv[1]);
575358
575579
  try {
575359
575580
  const { spawnSync: spawnSync7 } = await import("node:child_process");
575360
- const which2 = spawnSync7(process.platform === "win32" ? "where" : "which", ["omnius"], {
575581
+ const which3 = spawnSync7(process.platform === "win32" ? "where" : "which", ["omnius"], {
575361
575582
  encoding: "utf8",
575362
575583
  stdio: ["ignore", "pipe", "ignore"]
575363
575584
  });
575364
- const first2 = which2.stdout?.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
575585
+ const first2 = which3.stdout?.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
575365
575586
  if (first2) candidates.push(first2);
575366
575587
  } catch {
575367
575588
  }
575368
- const thisDir = dirname31(fileURLToPath14(import.meta.url));
575589
+ const thisDir = dirname30(fileURLToPath14(import.meta.url));
575369
575590
  candidates.push(join107(thisDir, "index.js"));
575370
575591
  const seen = /* @__PURE__ */ new Set();
575371
575592
  for (const candidate of candidates) {
@@ -575398,7 +575619,7 @@ async function startDaemon() {
575398
575619
  child.unref();
575399
575620
  const pid = child.pid ?? null;
575400
575621
  if (pid) {
575401
- writeFileSync47(PID_FILE2, String(pid), "utf8");
575622
+ writeFileSync46(PID_FILE2, String(pid), "utf8");
575402
575623
  }
575403
575624
  return pid;
575404
575625
  } catch {
@@ -575936,7 +576157,7 @@ __export(sponsor_wizard_exports, {
575936
576157
  saveSponsorConfig: () => saveSponsorConfig,
575937
576158
  showSponsorDashboard: () => showSponsorDashboard
575938
576159
  });
575939
- import { existsSync as existsSync93, readFileSync as readFileSync74, writeFileSync as writeFileSync48, mkdirSync as mkdirSync52 } from "node:fs";
576160
+ import { existsSync as existsSync93, readFileSync as readFileSync74, writeFileSync as writeFileSync47, mkdirSync as mkdirSync52 } from "node:fs";
575940
576161
  import { join as join108 } from "node:path";
575941
576162
  function colorPreview(code8) {
575942
576163
  return `\x1B[38;5;${code8}m████\x1B[0m (${code8})`;
@@ -575968,7 +576189,7 @@ function saveSponsorConfig(projectDir2, config) {
575968
576189
  const dir = sponsorDir(projectDir2);
575969
576190
  mkdirSync52(dir, { recursive: true });
575970
576191
  config.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
575971
- writeFileSync48(configPath(projectDir2), JSON.stringify(config, null, 2), "utf8");
576192
+ writeFileSync47(configPath(projectDir2), JSON.stringify(config, null, 2), "utf8");
575972
576193
  }
575973
576194
  function defaultConfig2() {
575974
576195
  return {
@@ -576863,7 +577084,7 @@ __export(image_ascii_preview_exports, {
576863
577084
  extractSavedImagePath: () => extractSavedImagePath,
576864
577085
  formatImageAsciiContext: () => formatImageAsciiContext
576865
577086
  });
576866
- import { execFileSync as execFileSync4 } from "node:child_process";
577087
+ import { execFileSync as execFileSync5 } from "node:child_process";
576867
577088
  import { createRequire as createRequire5 } from "node:module";
576868
577089
  import { existsSync as existsSync94, readFileSync as readFileSync75, statSync as statSync32 } from "node:fs";
576869
577090
  import { resolve as resolve38 } from "node:path";
@@ -577000,7 +577221,7 @@ function convertWithFfmpeg(imagePath, width, height, timeoutMs) {
577000
577221
  `scale=${width}:${height}`,
577001
577222
  "format=gray"
577002
577223
  ].join(",");
577003
- const raw = execFileSync4(
577224
+ const raw = execFileSync5(
577004
577225
  "ffmpeg",
577005
577226
  [
577006
577227
  "-hide_banner",
@@ -577118,13 +577339,13 @@ __export(voice_exports, {
577118
577339
  import {
577119
577340
  existsSync as existsSync95,
577120
577341
  mkdirSync as mkdirSync53,
577121
- writeFileSync as writeFileSync49,
577342
+ writeFileSync as writeFileSync48,
577122
577343
  readFileSync as readFileSync76,
577123
577344
  unlinkSync as unlinkSync17,
577124
577345
  readdirSync as readdirSync29,
577125
577346
  statSync as statSync33
577126
577347
  } from "node:fs";
577127
- import { join as join109, dirname as dirname32 } from "node:path";
577348
+ import { join as join109, dirname as dirname31 } from "node:path";
577128
577349
  import { homedir as homedir33, tmpdir as tmpdir20, platform as platform5 } from "node:os";
577129
577350
  import {
577130
577351
  execSync as execSync52,
@@ -577365,7 +577586,7 @@ function insertTagAfterOpeningClause(text, tag) {
577365
577586
  function writeDetectTorchScript(targetPath) {
577366
577587
  if (existsSync95(targetPath)) return;
577367
577588
  try {
577368
- mkdirSync53(dirname32(targetPath), { recursive: true });
577589
+ mkdirSync53(dirname31(targetPath), { recursive: true });
577369
577590
  } catch {
577370
577591
  }
577371
577592
  const script = `#!/usr/bin/env python3
@@ -577438,7 +577659,7 @@ def main():
577438
577659
  if __name__ == "__main__": main()
577439
577660
  `;
577440
577661
  try {
577441
- writeFileSync49(targetPath, script, { mode: 493 });
577662
+ writeFileSync48(targetPath, script, { mode: 493 });
577442
577663
  } catch {
577443
577664
  }
577444
577665
  }
@@ -578435,7 +578656,7 @@ except Exception as exc:
578435
578656
  const destPath = join109(refsDir, destFilename);
578436
578657
  try {
578437
578658
  const data = readFileSync76(audioPath);
578438
- writeFileSync49(destPath, data);
578659
+ writeFileSync48(destPath, data);
578439
578660
  } catch (err) {
578440
578661
  return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
578441
578662
  }
@@ -578506,7 +578727,7 @@ except Exception as exc:
578506
578727
  saveCloneMeta(meta) {
578507
578728
  const dir = luxttsCloneRefsDir();
578508
578729
  if (!existsSync95(dir)) mkdirSync53(dir, { recursive: true });
578509
- writeFileSync49(_VoiceEngine.cloneMetaFile(), JSON.stringify(meta, null, 2));
578730
+ writeFileSync48(_VoiceEngine.cloneMetaFile(), JSON.stringify(meta, null, 2));
578510
578731
  }
578511
578732
  /** Audio file extensions recognized as clone references */
578512
578733
  static AUDIO_EXTS = /* @__PURE__ */ new Set([
@@ -579131,7 +579352,7 @@ except Exception as exc:
579131
579352
  );
579132
579353
  pos += 2;
579133
579354
  }
579134
- writeFileSync49(path11, buffer2);
579355
+ writeFileSync48(path11, buffer2);
579135
579356
  }
579136
579357
  // -------------------------------------------------------------------------
579137
579358
  // Phonemization
@@ -579210,7 +579431,7 @@ except Exception as exc:
579210
579431
  return buffer2;
579211
579432
  }
579212
579433
  writeWav(samples, sampleRate, path11) {
579213
- writeFileSync49(path11, this.buildWavBuffer(samples, sampleRate));
579434
+ writeFileSync48(path11, this.buildWavBuffer(samples, sampleRate));
579214
579435
  }
579215
579436
  // -------------------------------------------------------------------------
579216
579437
  // Audio playback (system default speakers)
@@ -579345,7 +579566,7 @@ except Exception as exc:
579345
579566
  }
579346
579567
  saveSupertonicStore(store2) {
579347
579568
  mkdirSync53(voiceDir2(), { recursive: true });
579348
- writeFileSync49(
579569
+ writeFileSync48(
579349
579570
  supertonicProfilesFile(),
579350
579571
  JSON.stringify(store2, null, 2),
579351
579572
  "utf-8"
@@ -579399,7 +579620,7 @@ except Exception as exc:
579399
579620
  }
579400
579621
  writeSupertonicInferScript() {
579401
579622
  mkdirSync53(voiceDir2(), { recursive: true });
579402
- writeFileSync49(supertonicInferScript2(), SUPERTONIC_INFER_PY2, "utf-8");
579623
+ writeFileSync48(supertonicInferScript2(), SUPERTONIC_INFER_PY2, "utf-8");
579403
579624
  }
579404
579625
  supertonicRequest(req2, timeoutMs = 12e4) {
579405
579626
  return new Promise((resolve49, reject) => {
@@ -579683,7 +579904,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
579683
579904
  header,
579684
579905
  Buffer.from(samples.buffer, samples.byteOffset, samples.byteLength)
579685
579906
  ]);
579686
- writeFileSync49(wavPath, scaled);
579907
+ writeFileSync48(wavPath, scaled);
579687
579908
  }
579688
579909
  } catch {
579689
579910
  }
@@ -580316,7 +580537,7 @@ if __name__ == '__main__':
580316
580537
  `;
580317
580538
  const scriptPath2 = luxttsInferScript2();
580318
580539
  mkdirSync53(voiceDir2(), { recursive: true });
580319
- writeFileSync49(scriptPath2, script);
580540
+ writeFileSync48(scriptPath2, script);
580320
580541
  }
580321
580542
  /** Ensure the LuxTTS daemon is running, spawn if needed */
580322
580543
  async ensureLuxttsDaemon() {
@@ -580465,7 +580686,7 @@ if __name__ == '__main__':
580465
580686
  header,
580466
580687
  Buffer.from(samples.buffer, samples.byteOffset, samples.byteLength)
580467
580688
  ]);
580468
- writeFileSync49(wavPath, scaled);
580689
+ writeFileSync48(wavPath, scaled);
580469
580690
  }
580470
580691
  } catch {
580471
580692
  }
@@ -580596,13 +580817,13 @@ if __name__ == '__main__':
580596
580817
  const existing = JSON.parse(readFileSync76(pkgPath, "utf8"));
580597
580818
  if (!existing.dependencies?.["phonemizer"]) {
580598
580819
  existing.dependencies = { ...existing.dependencies, ...expectedDeps };
580599
- writeFileSync49(pkgPath, JSON.stringify(existing, null, 2));
580820
+ writeFileSync48(pkgPath, JSON.stringify(existing, null, 2));
580600
580821
  }
580601
580822
  } catch {
580602
580823
  }
580603
580824
  }
580604
580825
  if (!existsSync95(pkgPath)) {
580605
- writeFileSync49(
580826
+ writeFileSync48(
580606
580827
  pkgPath,
580607
580828
  JSON.stringify(
580608
580829
  {
@@ -580705,7 +580926,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
580705
580926
  if (!configResp.ok)
580706
580927
  throw new Error(`Failed to download config: HTTP ${configResp.status}`);
580707
580928
  const configText = await configResp.text();
580708
- writeFileSync49(configPath2, configText);
580929
+ writeFileSync48(configPath2, configText);
580709
580930
  }
580710
580931
  if (!existsSync95(onnxPath)) {
580711
580932
  renderInfo(
@@ -580737,7 +580958,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
580737
580958
  }
580738
580959
  }
580739
580960
  const fullBuffer = Buffer.concat(chunks);
580740
- writeFileSync49(onnxPath, fullBuffer);
580961
+ writeFileSync48(onnxPath, fullBuffer);
580741
580962
  renderInfo(
580742
580963
  `${model.label} model downloaded (${formatBytes4(fullBuffer.length)}).`
580743
580964
  );
@@ -580913,7 +581134,7 @@ import { execSync as nodeExecSync } from "node:child_process";
580913
581134
  import {
580914
581135
  existsSync as existsSync96,
580915
581136
  readFileSync as readFileSync77,
580916
- writeFileSync as writeFileSync50,
581137
+ writeFileSync as writeFileSync49,
580917
581138
  mkdirSync as mkdirSync54,
580918
581139
  readdirSync as readdirSync30,
580919
581140
  lstatSync,
@@ -581177,12 +581398,12 @@ async function ensureVoiceDeps(ctx3) {
581177
581398
  renderInfo(res.log.split("\n").slice(-3).join(" ").slice(0, 200));
581178
581399
  }
581179
581400
  if (typeof mod2.getVenvPython === "function") {
581180
- const { dirname: dirname41 } = await import("node:path");
581401
+ const { dirname: dirname40 } = await import("node:path");
581181
581402
  const { existsSync: existsSync124 } = await import("node:fs");
581182
581403
  const venvPy = mod2.getVenvPython();
581183
581404
  if (existsSync124(venvPy)) {
581184
581405
  process.env.TRANSCRIBE_PYTHON = venvPy;
581185
- const venvBin = dirname41(venvPy);
581406
+ const venvBin = dirname40(venvPy);
581186
581407
  const sep3 = process.platform === "win32" ? ";" : ":";
581187
581408
  const cur = process.env.PATH || "";
581188
581409
  if (!cur.split(sep3).includes(venvBin)) {
@@ -581618,13 +581839,13 @@ async function handleSlashCommand(input, ctx3) {
581618
581839
  try {
581619
581840
  const { randomBytes: randomBytes26 } = await import("node:crypto");
581620
581841
  const { homedir: homedir48 } = await import("node:os");
581621
- const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync71 } = await import("node:fs");
581842
+ const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync70 } = await import("node:fs");
581622
581843
  const { join: join142 } = await import("node:path");
581623
581844
  const newKey = randomBytes26(16).toString("hex");
581624
581845
  process.env["OMNIUS_API_KEY"] = newKey;
581625
581846
  const dir = join142(homedir48(), ".omnius");
581626
581847
  mkdirSync77(dir, { recursive: true });
581627
- writeFileSync71(join142(dir, "api.key"), newKey + "\n", "utf8");
581848
+ writeFileSync70(join142(dir, "api.key"), newKey + "\n", "utf8");
581628
581849
  renderInfo(`New API key: ${c3.bold(c3.yellow(newKey))}`);
581629
581850
  renderInfo(
581630
581851
  "Restart the daemon to apply if needed. Use /access any to restart quickly."
@@ -581886,11 +582107,11 @@ async function handleSlashCommand(input, ctx3) {
581886
582107
  );
581887
582108
  try {
581888
582109
  const { homedir: homedir49 } = await import("node:os");
581889
- const { mkdirSync: mkdirSync78, writeFileSync: writeFileSync72 } = await import("node:fs");
582110
+ const { mkdirSync: mkdirSync78, writeFileSync: writeFileSync71 } = await import("node:fs");
581890
582111
  const { join: join143 } = await import("node:path");
581891
582112
  const dir = join143(homedir49(), ".omnius");
581892
582113
  mkdirSync78(dir, { recursive: true });
581893
- writeFileSync72(join143(dir, "api.key"), apiKey + "\n", "utf8");
582114
+ writeFileSync71(join143(dir, "api.key"), apiKey + "\n", "utf8");
581894
582115
  } catch {
581895
582116
  }
581896
582117
  }
@@ -581902,11 +582123,11 @@ async function handleSlashCommand(input, ctx3) {
581902
582123
  const port2 = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
581903
582124
  try {
581904
582125
  const { homedir: homedir49 } = await import("node:os");
581905
- const { mkdirSync: mkdirSync78, writeFileSync: writeFileSync72 } = await import("node:fs");
582126
+ const { mkdirSync: mkdirSync78, writeFileSync: writeFileSync71 } = await import("node:fs");
581906
582127
  const { join: join143 } = await import("node:path");
581907
582128
  const dir = join143(homedir49(), ".omnius");
581908
582129
  mkdirSync78(dir, { recursive: true });
581909
- writeFileSync72(join143(dir, "access"), `${val2}
582130
+ writeFileSync71(join143(dir, "access"), `${val2}
581910
582131
  `, "utf8");
581911
582132
  } catch {
581912
582133
  }
@@ -582006,11 +582227,11 @@ async function handleSlashCommand(input, ctx3) {
582006
582227
  );
582007
582228
  try {
582008
582229
  const { homedir: homedir49 } = await import("node:os");
582009
- const { mkdirSync: mkdirSync78, writeFileSync: writeFileSync72 } = await import("node:fs");
582230
+ const { mkdirSync: mkdirSync78, writeFileSync: writeFileSync71 } = await import("node:fs");
582010
582231
  const { join: join143 } = await import("node:path");
582011
582232
  const dir = join143(homedir49(), ".omnius");
582012
582233
  mkdirSync78(dir, { recursive: true });
582013
- writeFileSync72(join143(dir, "api.key"), apiKey + "\n", "utf8");
582234
+ writeFileSync71(join143(dir, "api.key"), apiKey + "\n", "utf8");
582014
582235
  } catch {
582015
582236
  }
582016
582237
  }
@@ -582021,12 +582242,12 @@ async function handleSlashCommand(input, ctx3) {
582021
582242
  }
582022
582243
  const port = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
582023
582244
  const { homedir: homedir48 } = await import("node:os");
582024
- const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync71 } = await import("node:fs");
582245
+ const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync70 } = await import("node:fs");
582025
582246
  const { join: join142 } = await import("node:path");
582026
582247
  try {
582027
582248
  const dir = join142(homedir48(), ".omnius");
582028
582249
  mkdirSync77(dir, { recursive: true });
582029
- writeFileSync71(join142(dir, "access"), `${val}
582250
+ writeFileSync70(join142(dir, "access"), `${val}
582030
582251
  `, "utf8");
582031
582252
  } catch (e2) {
582032
582253
  renderWarning(
@@ -583347,7 +583568,7 @@ async function handleSlashCommand(input, ctx3) {
583347
583568
  };
583348
583569
  const jwtFile = join110(ctx3.repoRoot, ".omnius", "fortemi-jwt.json");
583349
583570
  mkdirSync54(join110(ctx3.repoRoot, ".omnius"), { recursive: true });
583350
- writeFileSync50(jwtFile, JSON.stringify(jwtPayload, null, 2));
583571
+ writeFileSync49(jwtFile, JSON.stringify(jwtPayload, null, 2));
583351
583572
  renderInfo(`Launching fortemi-react from ${fDir}...`);
583352
583573
  try {
583353
583574
  const { spawn: spawn31 } = __require("node:child_process");
@@ -583366,7 +583587,7 @@ async function handleSlashCommand(input, ctx3) {
583366
583587
  renderInfo(`JWT saved to ${jwtFile}`);
583367
583588
  renderInfo("Memory operations will proxy to fortemi when available.");
583368
583589
  const bridgeFile = join110(ctx3.repoRoot, ".omnius", "fortemi-bridge.json");
583369
- writeFileSync50(
583590
+ writeFileSync49(
583370
583591
  bridgeFile,
583371
583592
  JSON.stringify(
583372
583593
  {
@@ -590100,13 +590321,13 @@ async function handleSponsoredEndpoint(ctx3, local) {
590100
590321
  sponsors.push(...verified);
590101
590322
  if (verified.length > 0) {
590102
590323
  try {
590103
- const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync71 } = __require("node:fs");
590324
+ const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync70 } = __require("node:fs");
590104
590325
  mkdirSync77(sponsorDir2, { recursive: true });
590105
590326
  const cached = verified.map((s2) => ({
590106
590327
  ...s2,
590107
590328
  lastVerified: Date.now()
590108
590329
  }));
590109
- writeFileSync71(knownFile, JSON.stringify(cached, null, 2));
590330
+ writeFileSync70(knownFile, JSON.stringify(cached, null, 2));
590110
590331
  } catch {
590111
590332
  }
590112
590333
  }
@@ -590224,7 +590445,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
590224
590445
  (s2) => (s2.url || s2.peerId || s2.name) !== saveKey
590225
590446
  );
590226
590447
  updated.push(selected);
590227
- writeFileSync50(knownFile, JSON.stringify(updated, null, 2), "utf8");
590448
+ writeFileSync49(knownFile, JSON.stringify(updated, null, 2), "utf8");
590228
590449
  } catch {
590229
590450
  }
590230
590451
  renderInfo(`Connected to sponsored endpoint: ${selected.name}`);
@@ -590308,16 +590529,16 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local) {
590308
590529
  const models = await fetchModels(peerUrl, authKey);
590309
590530
  if (models.length > 0) {
590310
590531
  try {
590311
- const { writeFileSync: writeFileSync71, mkdirSync: mkdirSync77 } = await import("node:fs");
590312
- const { join: join142, dirname: dirname41 } = await import("node:path");
590532
+ const { writeFileSync: writeFileSync70, mkdirSync: mkdirSync77 } = await import("node:fs");
590533
+ const { join: join142, dirname: dirname40 } = await import("node:path");
590313
590534
  const cachePath = join142(
590314
590535
  ctx3.repoRoot || process.cwd(),
590315
590536
  ".omnius",
590316
590537
  "nexus",
590317
590538
  "peer-models-cache.json"
590318
590539
  );
590319
- mkdirSync77(dirname41(cachePath), { recursive: true });
590320
- writeFileSync71(
590540
+ mkdirSync77(dirname40(cachePath), { recursive: true });
590541
+ writeFileSync70(
590321
590542
  cachePath,
590322
590543
  JSON.stringify(
590323
590544
  {
@@ -591089,10 +591310,10 @@ async function handleUpdate(subcommand, ctx3) {
591089
591310
  try {
591090
591311
  const { createRequire: createRequire10 } = await import("node:module");
591091
591312
  const { fileURLToPath: fileURLToPath20 } = await import("node:url");
591092
- const { dirname: dirname41, join: join142 } = await import("node:path");
591313
+ const { dirname: dirname40, join: join142 } = await import("node:path");
591093
591314
  const { existsSync: existsSync124 } = await import("node:fs");
591094
591315
  const req2 = createRequire10(import.meta.url);
591095
- const thisDir = dirname41(fileURLToPath20(import.meta.url));
591316
+ const thisDir = dirname40(fileURLToPath20(import.meta.url));
591096
591317
  const candidates = [
591097
591318
  join142(thisDir, "..", "package.json"),
591098
591319
  join142(thisDir, "..", "..", "package.json"),
@@ -591296,9 +591517,9 @@ async function handleUpdate(subcommand, ctx3) {
591296
591517
  }
591297
591518
  };
591298
591519
  }
591299
- const { exec: exec5, execSync: es2 } = await import("node:child_process");
591520
+ const { exec: exec4, execSync: es2 } = await import("node:child_process");
591300
591521
  const execA = (cmd, opts) => new Promise(
591301
- (res, rej) => exec5(
591522
+ (res, rej) => exec4(
591302
591523
  cmd,
591303
591524
  {
591304
591525
  encoding: "utf8",
@@ -591611,7 +591832,7 @@ async function handleUpdate(subcommand, ctx3) {
591611
591832
  _installTotal = 20;
591612
591833
  _installPhase = "Preparing...";
591613
591834
  const runInstall2 = (cmd) => new Promise((resolve49) => {
591614
- const child = exec5(cmd, { timeout: 18e4 }, (err, _stdout, stderr) => {
591835
+ const child = exec4(cmd, { timeout: 18e4 }, (err, _stdout, stderr) => {
591615
591836
  if (err) installError = (stderr || err.message || "").trim();
591616
591837
  resolve49(!err);
591617
591838
  });
@@ -591890,7 +592111,7 @@ async function handleUpdate(subcommand, ctx3) {
591890
592111
  installOverlay.setPhase("Native Modules");
591891
592112
  installOverlay.setStatus("Rebuilding native modules...");
591892
592113
  await new Promise((resolve49) => {
591893
- const child = exec5(
592114
+ const child = exec4(
591894
592115
  `${sudoPrefix}npm rebuild -g omnius 2>/dev/null || true`,
591895
592116
  { timeout: 12e4 },
591896
592117
  () => resolve49(true)
@@ -591932,7 +592153,7 @@ async function handleUpdate(subcommand, ctx3) {
591932
592153
  if (fsExists(venvPip2)) {
591933
592154
  installOverlay.setStatus("Upgrading Python packages...");
591934
592155
  await new Promise((resolve49) => {
591935
- const child = exec5(
592156
+ const child = exec4(
591936
592157
  `"${venvPip2}" install --upgrade moondream-station pytesseract Pillow opencv-python-headless numpy 2>/dev/null || true`,
591937
592158
  { timeout: 3e5 },
591938
592159
  (err) => resolve49(!err)
@@ -592557,13 +592778,13 @@ var init_commands = __esm({
592557
592778
  try {
592558
592779
  const { randomBytes: randomBytes26 } = await import("node:crypto");
592559
592780
  const { homedir: homedir48 } = await import("node:os");
592560
- const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync71 } = await import("node:fs");
592781
+ const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync70 } = await import("node:fs");
592561
592782
  const { join: join142 } = await import("node:path");
592562
592783
  const apiKey = randomBytes26(16).toString("hex");
592563
592784
  process.env["OMNIUS_API_KEY"] = apiKey;
592564
592785
  const dir = join142(homedir48(), ".omnius");
592565
592786
  mkdirSync77(dir, { recursive: true });
592566
- writeFileSync71(join142(dir, "api.key"), apiKey + "\n", "utf8");
592787
+ writeFileSync70(join142(dir, "api.key"), apiKey + "\n", "utf8");
592567
592788
  renderInfo(`Generated API key: ${c3.bold(c3.yellow(apiKey))}`);
592568
592789
  renderInfo(
592569
592790
  "Use Authorization: Bearer <key> or click 'key' in the Web UI header to paste it."
@@ -592582,11 +592803,11 @@ var init_commands = __esm({
592582
592803
  const port = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
592583
592804
  try {
592584
592805
  const { homedir: homedir48 } = await import("node:os");
592585
- const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync71 } = await import("node:fs");
592806
+ const { mkdirSync: mkdirSync77, writeFileSync: writeFileSync70 } = await import("node:fs");
592586
592807
  const { join: join142 } = await import("node:path");
592587
592808
  const dir = join142(homedir48(), ".omnius");
592588
592809
  mkdirSync77(dir, { recursive: true });
592589
- writeFileSync71(join142(dir, "access"), `${val}
592810
+ writeFileSync70(join142(dir, "access"), `${val}
592590
592811
  `, "utf8");
592591
592812
  } catch {
592592
592813
  }
@@ -593376,7 +593597,7 @@ __export(banner_exports, {
593376
593597
  setBannerWriter: () => setBannerWriter,
593377
593598
  setGridText: () => setGridText
593378
593599
  });
593379
- import { existsSync as existsSync98, readFileSync as readFileSync79, writeFileSync as writeFileSync51, mkdirSync as mkdirSync55 } from "node:fs";
593600
+ import { existsSync as existsSync98, readFileSync as readFileSync79, writeFileSync as writeFileSync50, mkdirSync as mkdirSync55 } from "node:fs";
593380
593601
  import { join as join112 } from "node:path";
593381
593602
  function setBannerWriter(writer) {
593382
593603
  chromeWrite3 = writer;
@@ -593512,7 +593733,7 @@ function createSponsorBanner(sponsorName, tagline, primaryColor = 214, bgColor =
593512
593733
  function saveBannerDesign(workDir, design) {
593513
593734
  const dir = join112(workDir, ".omnius", "banners");
593514
593735
  mkdirSync55(dir, { recursive: true });
593515
- writeFileSync51(join112(dir, `${design.id}.json`), JSON.stringify(design, null, 2), "utf8");
593736
+ writeFileSync50(join112(dir, `${design.id}.json`), JSON.stringify(design, null, 2), "utf8");
593516
593737
  }
593517
593738
  function loadBannerDesign(workDir, id) {
593518
593739
  const file = join112(workDir, ".omnius", "banners", `${id}.json`);
@@ -593848,7 +594069,7 @@ var init_banner = __esm({
593848
594069
  });
593849
594070
 
593850
594071
  // packages/cli/src/tui/carousel-descriptors.ts
593851
- import { existsSync as existsSync99, readFileSync as readFileSync80, writeFileSync as writeFileSync52, mkdirSync as mkdirSync56, readdirSync as readdirSync32 } from "node:fs";
594072
+ import { existsSync as existsSync99, readFileSync as readFileSync80, writeFileSync as writeFileSync51, mkdirSync as mkdirSync56, readdirSync as readdirSync32 } from "node:fs";
593852
594073
  import { join as join113, basename as basename20 } from "node:path";
593853
594074
  function loadToolProfile(repoRoot) {
593854
594075
  const filePath = join113(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
@@ -593862,7 +594083,7 @@ function loadToolProfile(repoRoot) {
593862
594083
  function saveToolProfile(repoRoot, profile) {
593863
594084
  const contextDir = join113(repoRoot, OMNIUS_DIR, "context");
593864
594085
  mkdirSync56(contextDir, { recursive: true });
593865
- writeFileSync52(join113(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
594086
+ writeFileSync51(join113(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
593866
594087
  }
593867
594088
  function categorizeToolCall(toolName) {
593868
594089
  for (const cat2 of TOOL_CATEGORIES) {
@@ -593934,7 +594155,7 @@ function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
593934
594155
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
593935
594156
  sourceHash
593936
594157
  };
593937
- writeFileSync52(join113(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
594158
+ writeFileSync51(join113(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
593938
594159
  }
593939
594160
  function generateDescriptors(repoRoot) {
593940
594161
  const profile = loadToolProfile(repoRoot);
@@ -594935,7 +595156,7 @@ var init_edit_history = __esm({
594935
595156
 
594936
595157
  // packages/cli/src/tui/promptLoader.ts
594937
595158
  import { readFileSync as readFileSync81, existsSync as existsSync100 } from "node:fs";
594938
- import { join as join115, dirname as dirname33 } from "node:path";
595159
+ import { join as join115, dirname as dirname32 } from "node:path";
594939
595160
  import { fileURLToPath as fileURLToPath15 } from "node:url";
594940
595161
  function loadPrompt3(promptPath, vars) {
594941
595162
  let content = cache7.get(promptPath);
@@ -594955,7 +595176,7 @@ var init_promptLoader3 = __esm({
594955
595176
  "packages/cli/src/tui/promptLoader.ts"() {
594956
595177
  "use strict";
594957
595178
  __filename5 = fileURLToPath15(import.meta.url);
594958
- __dirname7 = dirname33(__filename5);
595179
+ __dirname7 = dirname32(__filename5);
594959
595180
  devPath2 = join115(__dirname7, "..", "..", "prompts");
594960
595181
  publishedPath2 = join115(__dirname7, "..", "prompts");
594961
595182
  PROMPTS_DIR3 = existsSync100(devPath2) ? devPath2 : publishedPath2;
@@ -594964,7 +595185,7 @@ var init_promptLoader3 = __esm({
594964
595185
  });
594965
595186
 
594966
595187
  // packages/cli/src/tui/dream-engine.ts
594967
- import { mkdirSync as mkdirSync58, writeFileSync as writeFileSync53, readFileSync as readFileSync82, existsSync as existsSync101, readdirSync as readdirSync33 } from "node:fs";
595188
+ import { mkdirSync as mkdirSync58, writeFileSync as writeFileSync52, readFileSync as readFileSync82, existsSync as existsSync101, readdirSync as readdirSync33 } from "node:fs";
594968
595189
  import { join as join116, basename as basename21 } from "node:path";
594969
595190
  import { execSync as execSync54 } from "node:child_process";
594970
595191
  function setDreamWriteContent(fn) {
@@ -595185,7 +595406,7 @@ var init_dream_engine = __esm({
595185
595406
  try {
595186
595407
  const dir = join116(targetPath, "..");
595187
595408
  mkdirSync58(dir, { recursive: true });
595188
- writeFileSync53(targetPath, content, "utf-8");
595409
+ writeFileSync52(targetPath, content, "utf-8");
595189
595410
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
595190
595411
  } catch (err) {
595191
595412
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
@@ -595226,7 +595447,7 @@ var init_dream_engine = __esm({
595226
595447
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
595227
595448
  }
595228
595449
  content = content.replace(oldStr, newStr);
595229
- writeFileSync53(targetPath, content, "utf-8");
595450
+ writeFileSync52(targetPath, content, "utf-8");
595230
595451
  return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start2 };
595231
595452
  } catch (err) {
595232
595453
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
@@ -595273,7 +595494,7 @@ var init_dream_engine = __esm({
595273
595494
  try {
595274
595495
  const dir = join116(targetPath, "..");
595275
595496
  mkdirSync58(dir, { recursive: true });
595276
- writeFileSync53(targetPath, content, "utf-8");
595497
+ writeFileSync52(targetPath, content, "utf-8");
595277
595498
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
595278
595499
  } catch (err) {
595279
595500
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
@@ -595314,7 +595535,7 @@ var init_dream_engine = __esm({
595314
595535
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
595315
595536
  }
595316
595537
  content = content.replace(oldStr, newStr);
595317
- writeFileSync53(targetPath, content, "utf-8");
595538
+ writeFileSync52(targetPath, content, "utf-8");
595318
595539
  return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start2 };
595319
595540
  } catch (err) {
595320
595541
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
@@ -595475,7 +595696,7 @@ ${result.summary}`;
595475
595696
  renderDreamContraction(cycle);
595476
595697
  const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
595477
595698
  const summaryPath = join116(this.dreamsDir, `cycle-${cycle}-summary.md`);
595478
- writeFileSync53(summaryPath, cycleSummary, "utf-8");
595699
+ writeFileSync52(summaryPath, cycleSummary, "utf-8");
595479
595700
  }
595480
595701
  if (mode === "lucid" && !this.abortController.signal.aborted) {
595481
595702
  this.saveVersionCheckpoint(cycle);
@@ -596138,7 +596359,7 @@ ${summaryResult}
596138
596359
  `;
596139
596360
  try {
596140
596361
  mkdirSync58(this.dreamsDir, { recursive: true });
596141
- writeFileSync53(reportPath, report2, "utf-8");
596362
+ writeFileSync52(reportPath, report2, "utf-8");
596142
596363
  } catch {
596143
596364
  }
596144
596365
  renderSwarmComplete(workspace);
@@ -596230,7 +596451,7 @@ ${summaryResult}
596230
596451
  return { success: false, output: "", error: "todos must be an array" };
596231
596452
  }
596232
596453
  try {
596233
- writeFileSync53(todoPath3, JSON.stringify({ todos, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), "utf-8");
596454
+ writeFileSync52(todoPath3, JSON.stringify({ todos, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), "utf-8");
596234
596455
  const summary = todos.map(
596235
596456
  (t2, i2) => ` ${t2.status === "completed" ? "✓" : t2.status === "in_progress" ? "▶" : "◯"} ${i2 + 1}: ${t2.content || "(untitled)"}`
596236
596457
  ).join("\n");
@@ -596278,11 +596499,11 @@ ${summary}` };
596278
596499
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
596279
596500
  };
596280
596501
  notes2.push(note);
596281
- writeFileSync53(notesPath, JSON.stringify(notes2, null, 2), "utf-8");
596502
+ writeFileSync52(notesPath, JSON.stringify(notes2, null, 2), "utf-8");
596282
596503
  return { success: true, output: `Note added: [${note.category}] ${note.content.slice(0, 80)}` };
596283
596504
  }
596284
596505
  if (action === "clear") {
596285
- writeFileSync53(notesPath, "[]", "utf-8");
596506
+ writeFileSync52(notesPath, "[]", "utf-8");
596286
596507
  return { success: true, output: "All notes cleared." };
596287
596508
  }
596288
596509
  if (action === "search") {
@@ -596337,10 +596558,10 @@ ${summary}` };
596337
596558
  encoding: "utf-8",
596338
596559
  timeout: 5e3
596339
596560
  }).trim();
596340
- writeFileSync53(join116(checkpointDir3, "git-status.txt"), gitStatus, "utf-8");
596341
- writeFileSync53(join116(checkpointDir3, "git-diff.patch"), gitDiff, "utf-8");
596342
- writeFileSync53(join116(checkpointDir3, "git-hash.txt"), gitHash, "utf-8");
596343
- writeFileSync53(
596561
+ writeFileSync52(join116(checkpointDir3, "git-status.txt"), gitStatus, "utf-8");
596562
+ writeFileSync52(join116(checkpointDir3, "git-diff.patch"), gitDiff, "utf-8");
596563
+ writeFileSync52(join116(checkpointDir3, "git-hash.txt"), gitHash, "utf-8");
596564
+ writeFileSync52(
596344
596565
  join116(checkpointDir3, "checkpoint.json"),
596345
596566
  JSON.stringify({
596346
596567
  cycle,
@@ -596352,7 +596573,7 @@ ${summary}` };
596352
596573
  );
596353
596574
  renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
596354
596575
  } catch {
596355
- writeFileSync53(
596576
+ writeFileSync52(
596356
596577
  join116(checkpointDir3, "checkpoint.json"),
596357
596578
  JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2),
596358
596579
  "utf-8"
@@ -596414,7 +596635,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
596414
596635
  ---
596415
596636
  *Auto-generated by omnius dream engine*
596416
596637
  `;
596417
- writeFileSync53(join116(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
596638
+ writeFileSync52(join116(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
596418
596639
  } catch {
596419
596640
  }
596420
596641
  }
@@ -596502,7 +596723,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
596502
596723
  durationMs
596503
596724
  });
596504
596725
  try {
596505
- writeFileSync53(
596726
+ writeFileSync52(
596506
596727
  join116(memoryDir, ".last-consolidation"),
596507
596728
  JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), summary: result.summary?.slice(0, 500) }) + "\n"
596508
596729
  );
@@ -596520,7 +596741,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
596520
596741
  /** Save dream state for resume/inspection */
596521
596742
  saveDreamState() {
596522
596743
  try {
596523
- writeFileSync53(
596744
+ writeFileSync52(
596524
596745
  join116(this.dreamsDir, "dream-state.json"),
596525
596746
  JSON.stringify(this.state, null, 2) + "\n",
596526
596747
  "utf-8"
@@ -596897,7 +597118,7 @@ var init_bless_engine = __esm({
596897
597118
  });
596898
597119
 
596899
597120
  // packages/cli/src/tui/dmn-engine.ts
596900
- import { existsSync as existsSync102, readFileSync as readFileSync83, writeFileSync as writeFileSync54, mkdirSync as mkdirSync59, readdirSync as readdirSync34, unlinkSync as unlinkSync18 } from "node:fs";
597121
+ import { existsSync as existsSync102, readFileSync as readFileSync83, writeFileSync as writeFileSync53, mkdirSync as mkdirSync59, readdirSync as readdirSync34, unlinkSync as unlinkSync18 } from "node:fs";
596901
597122
  import { join as join117, basename as basename22 } from "node:path";
596902
597123
  function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
596903
597124
  const competenceReport = competence.length > 0 ? competence.map((c9) => {
@@ -597669,7 +597890,7 @@ OUTPUT: Call task_complete with JSON:
597669
597890
  }
597670
597891
  saveState() {
597671
597892
  try {
597672
- writeFileSync54(
597893
+ writeFileSync53(
597673
597894
  join117(this.stateDir, "state.json"),
597674
597895
  JSON.stringify(this.state, null, 2) + "\n",
597675
597896
  "utf-8"
@@ -597680,7 +597901,7 @@ OUTPUT: Call task_complete with JSON:
597680
597901
  saveCycleResult(result) {
597681
597902
  try {
597682
597903
  const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
597683
- writeFileSync54(
597904
+ writeFileSync53(
597684
597905
  join117(this.historyDir, filename),
597685
597906
  JSON.stringify(result, null, 2) + "\n",
597686
597907
  "utf-8"
@@ -598621,12 +598842,12 @@ import {
598621
598842
  readFileSync as readFileSync85,
598622
598843
  statSync as statSync35,
598623
598844
  unlinkSync as unlinkSync19,
598624
- writeFileSync as writeFileSync55
598845
+ writeFileSync as writeFileSync54
598625
598846
  } from "node:fs";
598626
598847
  import { mkdir as mkdir17 } from "node:fs/promises";
598627
598848
  import {
598628
598849
  basename as basename24,
598629
- dirname as dirname34,
598850
+ dirname as dirname33,
598630
598851
  extname as extname14,
598631
598852
  isAbsolute as isAbsolute6,
598632
598853
  join as join119,
@@ -598778,8 +598999,8 @@ function scopedTool(base3, root, mode) {
598778
598999
  if (mode === "edit" && !existsSync104(guarded.path.abs)) {
598779
599000
  const materialized = materializeTelegramCreativeArtifactForSend(rootAbs, guarded.path.rel);
598780
599001
  if (!materialized.ok) return denied(materialized.error);
598781
- mkdirSync60(dirname34(guarded.path.abs), { recursive: true });
598782
- writeFileSync55(guarded.path.abs, readFileSync85(materialized.path));
599002
+ mkdirSync60(dirname33(guarded.path.abs), { recursive: true });
599003
+ writeFileSync54(guarded.path.abs, readFileSync85(materialized.path));
598783
599004
  materialized.cleanup?.();
598784
599005
  restoredEditPath = guarded.path.abs;
598785
599006
  }
@@ -598865,7 +599086,7 @@ function ensureManifest(root) {
598865
599086
  mkdirSync60(root, { recursive: true });
598866
599087
  const path11 = manifestPath(root);
598867
599088
  if (!existsSync104(path11)) {
598868
- writeFileSync55(path11, JSON.stringify({ files: [], updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2) + "\n", "utf8");
599089
+ writeFileSync54(path11, JSON.stringify({ files: [], updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2) + "\n", "utf8");
598869
599090
  }
598870
599091
  }
598871
599092
  function readManifest(root) {
@@ -598891,7 +599112,7 @@ function readManifest(root) {
598891
599112
  }
598892
599113
  function writeManifest(root, manifest) {
598893
599114
  ensureManifest(root);
598894
- writeFileSync55(manifestPath(root), JSON.stringify(manifest, null, 2) + "\n", "utf8");
599115
+ writeFileSync54(manifestPath(root), JSON.stringify(manifest, null, 2) + "\n", "utf8");
598895
599116
  }
598896
599117
  function manifestHas(root, relPath) {
598897
599118
  const rel = relPath.replace(/\\/g, "/");
@@ -598925,7 +599146,7 @@ function rememberCreated(root, absPath) {
598925
599146
  const tag = cipher.getAuthTag();
598926
599147
  const storedRel = join119(OBJECTS_DIR, `${Date.now()}-${randomBytes21(12).toString("hex")}.blob`).replace(/\\/g, "/");
598927
599148
  const storedAbs = join119(root, storedRel);
598928
- writeFileSync55(storedAbs, Buffer.concat([prefix, encrypted]));
599149
+ writeFileSync54(storedAbs, Buffer.concat([prefix, encrypted]));
598929
599150
  try {
598930
599151
  unlinkSync19(guarded.path.abs);
598931
599152
  } catch {
@@ -598986,7 +599207,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
598986
599207
  const stageDir = join119(rootAbs, SEND_DIR, `${Date.now()}-${randomBytes21(8).toString("hex")}`);
598987
599208
  mkdirSync60(stageDir, { recursive: true });
598988
599209
  const staged = join119(stageDir, object.originalName || basename24(rel));
598989
- writeFileSync55(staged, payload);
599210
+ writeFileSync54(staged, payload);
598990
599211
  return {
598991
599212
  ok: true,
598992
599213
  path: staged,
@@ -599152,7 +599373,7 @@ var init_telegram_creative_tools = __esm({
599152
599373
  }
599153
599374
  let result;
599154
599375
  try {
599155
- await mkdir17(dirname34(guarded.path.abs), { recursive: true });
599376
+ await mkdir17(dirname33(guarded.path.abs), { recursive: true });
599156
599377
  const tts = new TtsGenerateTool();
599157
599378
  result = await tts.execute({
599158
599379
  text,
@@ -599386,12 +599607,12 @@ __export(vision_ingress_exports, {
599386
599607
  queryVisionModel: () => queryVisionModel,
599387
599608
  runVisionIngress: () => runVisionIngress
599388
599609
  });
599389
- import { execFileSync as execFileSync5 } from "node:child_process";
599610
+ import { execFileSync as execFileSync6 } from "node:child_process";
599390
599611
  import { existsSync as existsSync105, readFileSync as readFileSync86, unlinkSync as unlinkSync20 } from "node:fs";
599391
599612
  import { join as join120 } from "node:path";
599392
599613
  function isTesseractAvailable() {
599393
599614
  try {
599394
- execFileSync5("tesseract", ["--version"], { stdio: "ignore", timeout: 3e3 });
599615
+ execFileSync6("tesseract", ["--version"], { stdio: "ignore", timeout: 3e3 });
599395
599616
  return true;
599396
599617
  } catch {
599397
599618
  return false;
@@ -599432,7 +599653,7 @@ function advancedOcr(imagePath) {
599432
599653
  for (const psm of psmModes) {
599433
599654
  const outFile = `${tmpBase}_psm${psm}`;
599434
599655
  try {
599435
- execFileSync5("tesseract", [
599656
+ execFileSync6("tesseract", [
599436
599657
  imagePath,
599437
599658
  outFile,
599438
599659
  "--psm",
@@ -599530,7 +599751,7 @@ var init_vision_ingress = __esm({
599530
599751
  });
599531
599752
 
599532
599753
  // packages/cli/src/tui/telegram-bridge.ts
599533
- import { mkdirSync as mkdirSync61, existsSync as existsSync106, unlinkSync as unlinkSync21, readdirSync as readdirSync36, statSync as statSync36, statfsSync as statfsSync3, readFileSync as readFileSync87, writeFileSync as writeFileSync57 } from "node:fs";
599754
+ import { mkdirSync as mkdirSync61, existsSync as existsSync106, unlinkSync as unlinkSync21, readdirSync as readdirSync36, statSync as statSync36, statfsSync as statfsSync3, readFileSync as readFileSync87, writeFileSync as writeFileSync56 } from "node:fs";
599534
599755
  import { join as join121, resolve as resolve40, basename as basename25, relative as relative13, isAbsolute as isAbsolute7, extname as extname15 } from "node:path";
599535
599756
  import { writeFile as writeFileAsync } from "node:fs/promises";
599536
599757
  import { createHash as createHash19, randomInt } from "node:crypto";
@@ -599708,6 +599929,21 @@ function telegramSpeakerLabel(msg) {
599708
599929
  if (msg.fromUserId) return `user:${msg.fromUserId}`;
599709
599930
  return "Telegram user";
599710
599931
  }
599932
+ function telegramReplySenderLabel(sender) {
599933
+ if (!sender) return "unknown sender";
599934
+ if (sender.username) return `@${sender.username}`;
599935
+ if (sender.title) return sender.title;
599936
+ if (sender.firstName) return sender.firstName;
599937
+ if (sender.id) return `user:${sender.id}`;
599938
+ return "unknown sender";
599939
+ }
599940
+ function telegramReplyParameters(replyToMessageId) {
599941
+ if (!replyToMessageId || !Number.isFinite(replyToMessageId)) return void 0;
599942
+ return {
599943
+ message_id: Math.floor(replyToMessageId),
599944
+ allow_sending_without_reply: true
599945
+ };
599946
+ }
599711
599947
  function telegramHistorySpeaker(entry) {
599712
599948
  if (entry.role === "assistant") return entry.speaker || "Assistant";
599713
599949
  if (entry.speaker) return entry.speaker;
@@ -600123,6 +600359,140 @@ function normalizeTelegramMedia(message2) {
600123
600359
  }
600124
600360
  return void 0;
600125
600361
  }
600362
+ function telegramOptionalString(value2) {
600363
+ return typeof value2 === "string" && value2.trim() ? value2 : void 0;
600364
+ }
600365
+ function telegramOptionalNumber(value2) {
600366
+ return typeof value2 === "number" && Number.isFinite(value2) ? value2 : void 0;
600367
+ }
600368
+ function normalizeTelegramReplySender(message2) {
600369
+ if (!message2) return void 0;
600370
+ const from3 = typeof message2.from === "object" && message2.from ? message2.from : void 0;
600371
+ const senderChat = typeof message2.sender_chat === "object" && message2.sender_chat ? message2.sender_chat : void 0;
600372
+ const origin = typeof message2.origin === "object" && message2.origin ? message2.origin : void 0;
600373
+ const originUser = typeof origin?.sender_user === "object" && origin.sender_user ? origin.sender_user : void 0;
600374
+ const originChat = typeof origin?.chat === "object" && origin.chat ? origin.chat : void 0;
600375
+ const source = from3 ?? senderChat ?? originUser ?? originChat;
600376
+ if (!source) {
600377
+ const senderUserName = telegramOptionalString(origin?.sender_user_name);
600378
+ const authorSignature = telegramOptionalString(origin?.author_signature);
600379
+ if (!senderUserName && !authorSignature) return void 0;
600380
+ return {
600381
+ firstName: senderUserName ?? authorSignature
600382
+ };
600383
+ }
600384
+ return {
600385
+ id: telegramOptionalNumber(source.id),
600386
+ username: telegramOptionalString(source.username),
600387
+ firstName: telegramOptionalString(source.first_name),
600388
+ title: telegramOptionalString(source.title),
600389
+ isBot: typeof source.is_bot === "boolean" ? source.is_bot : void 0
600390
+ };
600391
+ }
600392
+ function telegramReplyTextFromMessage(message2, poll) {
600393
+ return telegramOptionalString(message2.text) ?? telegramOptionalString(message2.caption) ?? (poll ? formatTelegramPollSummary(poll) : void 0);
600394
+ }
600395
+ function telegramReplyOriginSummary(origin) {
600396
+ if (!origin || typeof origin !== "object") return void 0;
600397
+ const record = origin;
600398
+ const type = telegramOptionalString(record.type);
600399
+ const sender = normalizeTelegramReplySender({ origin: record });
600400
+ const label = sender?.username ? `@${sender.username}` : sender?.title ?? sender?.firstName;
600401
+ return [type ? `origin:${type}` : "", label ? `from ${label}` : ""].filter(Boolean).join(" ") || void 0;
600402
+ }
600403
+ function normalizeTelegramQuote(raw) {
600404
+ if (!raw || typeof raw !== "object") return void 0;
600405
+ const quote = raw;
600406
+ const text = telegramOptionalString(quote.text);
600407
+ const position = telegramOptionalNumber(quote.position);
600408
+ if (!text && position === void 0) return void 0;
600409
+ return { text, position };
600410
+ }
600411
+ function normalizeTelegramReplyContext(message2) {
600412
+ const quote = normalizeTelegramQuote(message2.quote);
600413
+ const replyTo = message2.reply_to_message && typeof message2.reply_to_message === "object" ? message2.reply_to_message : void 0;
600414
+ if (replyTo) {
600415
+ const poll = normalizeTelegramPoll(replyTo.poll);
600416
+ const media = normalizeTelegramMedia(replyTo);
600417
+ return {
600418
+ kind: "message",
600419
+ source: "reply_to_message",
600420
+ messageId: telegramOptionalNumber(replyTo.message_id),
600421
+ chatId: normalizeTelegramChatId(replyTo.chat?.id ?? message2.chat?.id),
600422
+ threadId: telegramOptionalNumber(replyTo.message_thread_id ?? message2.message_thread_id),
600423
+ sender: normalizeTelegramReplySender(replyTo),
600424
+ text: telegramReplyTextFromMessage(replyTo, poll),
600425
+ caption: telegramOptionalString(replyTo.caption),
600426
+ quote: quote?.text,
600427
+ quotePosition: quote?.position,
600428
+ media,
600429
+ poll,
600430
+ checklistTaskId: telegramOptionalNumber(message2.reply_to_checklist_task_id),
600431
+ pollOptionId: telegramOptionalString(message2.reply_to_poll_option_id)
600432
+ };
600433
+ }
600434
+ const externalReply = message2.external_reply && typeof message2.external_reply === "object" ? message2.external_reply : void 0;
600435
+ if (externalReply) {
600436
+ const poll = normalizeTelegramPoll(externalReply.poll);
600437
+ const media = normalizeTelegramMedia(externalReply);
600438
+ return {
600439
+ kind: "external",
600440
+ source: "external_reply",
600441
+ messageId: telegramOptionalNumber(externalReply.message_id),
600442
+ chatId: externalReply.chat?.id !== void 0 ? normalizeTelegramChatId(externalReply.chat.id) : void 0,
600443
+ threadId: telegramOptionalNumber(message2.message_thread_id),
600444
+ sender: normalizeTelegramReplySender(externalReply),
600445
+ text: telegramReplyTextFromMessage(externalReply, poll),
600446
+ caption: telegramOptionalString(externalReply.caption),
600447
+ quote: quote?.text,
600448
+ quotePosition: quote?.position,
600449
+ media,
600450
+ poll,
600451
+ checklistTaskId: telegramOptionalNumber(message2.reply_to_checklist_task_id),
600452
+ pollOptionId: telegramOptionalString(message2.reply_to_poll_option_id),
600453
+ originSummary: telegramReplyOriginSummary(externalReply.origin)
600454
+ };
600455
+ }
600456
+ if (quote?.text) {
600457
+ return {
600458
+ kind: "quote",
600459
+ source: "quote",
600460
+ threadId: telegramOptionalNumber(message2.message_thread_id),
600461
+ quote: quote.text,
600462
+ quotePosition: quote.position
600463
+ };
600464
+ }
600465
+ const story = message2.reply_to_story && typeof message2.reply_to_story === "object" ? message2.reply_to_story : void 0;
600466
+ if (story) {
600467
+ return {
600468
+ kind: "story",
600469
+ source: "reply_to_story",
600470
+ chatId: story.chat?.id !== void 0 ? normalizeTelegramChatId(story.chat.id) : void 0,
600471
+ storyId: telegramOptionalNumber(story.id),
600472
+ sender: normalizeTelegramReplySender(story),
600473
+ threadId: telegramOptionalNumber(message2.message_thread_id)
600474
+ };
600475
+ }
600476
+ const checklistTaskId = telegramOptionalNumber(message2.reply_to_checklist_task_id);
600477
+ if (checklistTaskId !== void 0) {
600478
+ return {
600479
+ kind: "checklist_task",
600480
+ source: "reply_to_checklist_task",
600481
+ checklistTaskId,
600482
+ threadId: telegramOptionalNumber(message2.message_thread_id)
600483
+ };
600484
+ }
600485
+ const pollOptionId = telegramOptionalString(message2.reply_to_poll_option_id);
600486
+ if (pollOptionId) {
600487
+ return {
600488
+ kind: "poll_option",
600489
+ source: "reply_to_poll_option",
600490
+ pollOptionId,
600491
+ threadId: telegramOptionalNumber(message2.message_thread_id)
600492
+ };
600493
+ }
600494
+ return void 0;
600495
+ }
600126
600496
  function telegramMediaIsImage(media) {
600127
600497
  if (media.type === "photo") return true;
600128
600498
  if (media.mimeType?.toLowerCase().startsWith("image/")) return true;
@@ -600205,10 +600575,7 @@ function normalizeTelegramUpdate(update2) {
600205
600575
  const username = message2.from?.username ?? message2.sender_chat?.username ?? "";
600206
600576
  const chatType = message2.chat?.type ?? "private";
600207
600577
  const media = normalizeTelegramMedia(message2);
600208
- const replyTo = message2.reply_to_message && typeof message2.reply_to_message === "object" ? message2.reply_to_message : void 0;
600209
- const replyToMedia = replyTo ? normalizeTelegramMedia(replyTo) : void 0;
600210
- const replyToPoll = replyTo ? normalizeTelegramPoll(replyTo.poll) : void 0;
600211
- const replyToText = replyTo ? replyTo.text || replyTo.caption || (replyToPoll ? formatTelegramPollSummary(replyToPoll) : "") : "";
600578
+ const replyContext = normalizeTelegramReplyContext(message2);
600212
600579
  const poll = normalizeTelegramPoll(message2.poll);
600213
600580
  const livePhoto = normalizeTelegramLivePhoto(message2.live_photo);
600214
600581
  const text = message2.text || message2.caption || (poll ? formatTelegramPollSummary(poll) : "");
@@ -600223,8 +600590,6 @@ function normalizeTelegramUpdate(update2) {
600223
600590
  chatType,
600224
600591
  chatTitle: message2.chat?.title,
600225
600592
  media,
600226
- replyToMedia,
600227
- replyToText: replyToText || void 0,
600228
600593
  poll,
600229
600594
  livePhoto,
600230
600595
  guestQueryId: typeof message2.guest_query_id === "string" ? message2.guest_query_id : void 0,
@@ -600233,9 +600598,13 @@ function normalizeTelegramUpdate(update2) {
600233
600598
  isGuestMessage: sourceUpdateType === "guest_message",
600234
600599
  isDirectMessages: Boolean(message2.chat?.is_direct_messages),
600235
600600
  parentChatId: message2.chat?.parent_chat?.id ?? message2.direct_messages_topic?.parent_topic?.id,
600236
- replyToMessageId: replyTo?.message_id,
600237
- replyToUsername: replyTo?.from?.username ?? replyTo?.sender_chat?.username,
600238
- replyToBot: Boolean(replyTo?.from?.is_bot),
600601
+ messageThreadId: telegramOptionalNumber(message2.message_thread_id),
600602
+ replyContext,
600603
+ replyToMedia: replyContext?.media,
600604
+ replyToText: replyContext?.text || replyContext?.quote,
600605
+ replyToMessageId: replyContext?.messageId,
600606
+ replyToUsername: replyContext?.sender?.username,
600607
+ replyToBot: Boolean(replyContext?.sender?.isBot),
600239
600608
  mentionedUsernames: extractTelegramMentionedUsernames(message2, text),
600240
600609
  sourceUpdateType
600241
600610
  };
@@ -600874,6 +601243,134 @@ Telegram response contract:
600874
601243
  }
600875
601244
  this.chatHistory.set(sessionKey, existing);
600876
601245
  }
601246
+ telegramReplySenderWithSelfFlag(sender) {
601247
+ if (!sender) return void 0;
601248
+ const bot = this.state.botUsername.trim().replace(/^@/, "").toLowerCase();
601249
+ const senderUsername = sender.username?.trim().replace(/^@/, "").toLowerCase();
601250
+ const isSelf = Boolean(sender.isSelf || bot && senderUsername === bot);
601251
+ return isSelf === sender.isSelf ? sender : { ...sender, isSelf };
601252
+ }
601253
+ telegramReplyContextFromHistoryEntry(entry) {
601254
+ if (!entry.messageId) return void 0;
601255
+ const sender = entry.role === "assistant" ? {
601256
+ username: this.state.botUsername || void 0,
601257
+ firstName: entry.speaker || "Assistant",
601258
+ isBot: true,
601259
+ isSelf: true
601260
+ } : {
601261
+ id: entry.fromUserId,
601262
+ username: entry.username,
601263
+ firstName: entry.firstName,
601264
+ isBot: false
601265
+ };
601266
+ return {
601267
+ kind: "message",
601268
+ source: "local_history",
601269
+ messageId: entry.messageId,
601270
+ chatId: entry.chatId,
601271
+ threadId: entry.messageThreadId,
601272
+ sender: this.telegramReplySenderWithSelfFlag(sender),
601273
+ text: entry.text,
601274
+ mediaSummary: entry.mediaSummary
601275
+ };
601276
+ }
601277
+ resolveTelegramReplyContext(sessionKey, msg) {
601278
+ this.ensureTelegramConversationLoaded(sessionKey);
601279
+ const targetId = msg.replyContext?.messageId ?? msg.replyToMessageId;
601280
+ const history = this.chatHistory.get(sessionKey) ?? [];
601281
+ const local = targetId ? [...history].reverse().find((entry) => entry.messageId === targetId) : void 0;
601282
+ const localContext = local ? this.telegramReplyContextFromHistoryEntry(local) : void 0;
601283
+ let reply;
601284
+ if (msg.replyContext && localContext) {
601285
+ reply = {
601286
+ ...localContext,
601287
+ ...msg.replyContext,
601288
+ chatId: msg.replyContext.chatId ?? localContext.chatId,
601289
+ threadId: msg.replyContext.threadId ?? localContext.threadId,
601290
+ sender: this.telegramReplySenderWithSelfFlag({
601291
+ ...localContext.sender ?? {},
601292
+ ...msg.replyContext.sender ?? {}
601293
+ }),
601294
+ text: msg.replyContext.text ?? localContext.text,
601295
+ mediaSummary: msg.replyContext.mediaSummary ?? localContext.mediaSummary
601296
+ };
601297
+ } else if (msg.replyContext) {
601298
+ reply = {
601299
+ ...msg.replyContext,
601300
+ sender: this.telegramReplySenderWithSelfFlag(msg.replyContext.sender)
601301
+ };
601302
+ } else if (localContext) {
601303
+ reply = localContext;
601304
+ } else if (msg.replyToMessageId) {
601305
+ reply = {
601306
+ kind: "message",
601307
+ source: "local_history",
601308
+ messageId: msg.replyToMessageId,
601309
+ threadId: msg.messageThreadId
601310
+ };
601311
+ }
601312
+ return reply;
601313
+ }
601314
+ quoteTelegramContextBlock(text, maxLength = 1800) {
601315
+ const clean3 = stripTelegramHiddenThinking(text).trim();
601316
+ const clipped = clean3.length > maxLength ? `${clean3.slice(0, Math.max(0, maxLength - 60)).trimEnd()}
601317
+ [reply context truncated]` : clean3;
601318
+ return clipped.split(/\r?\n/).map((line) => `> ${line}`).join("\n");
601319
+ }
601320
+ buildTelegramCurrentReplyContext(sessionKey, msg) {
601321
+ const reply = this.resolveTelegramReplyContext(sessionKey, msg);
601322
+ if (!reply) return "";
601323
+ const current = telegramSpeakerLabel(msg);
601324
+ const target = telegramReplySenderLabel(reply.sender);
601325
+ const selfMarker = reply.sender?.isSelf ? " (bot/self)" : reply.sender?.isBot ? " (bot)" : "";
601326
+ const targetId = reply.messageId ? ` message_id ${reply.messageId}` : "";
601327
+ const relation = reply.kind === "external" ? "is replying to an external Telegram message" : reply.kind === "quote" ? "is replying to a quoted Telegram excerpt" : reply.kind === "story" ? "is replying to a Telegram story" : reply.kind === "checklist_task" ? "is replying to a Telegram checklist task" : reply.kind === "poll_option" ? "is replying to a Telegram poll option" : "is replying to a Telegram message";
601328
+ const metadata = [
601329
+ `Current message_id ${msg.messageId} from ${current} ${relation}${targetId}.`,
601330
+ `Replied-to author: ${target}${selfMarker}.`,
601331
+ `Reply source: ${reply.source}.`,
601332
+ reply.chatId !== void 0 ? `Replied-to chat_id: ${String(reply.chatId)}.` : "",
601333
+ reply.threadId !== void 0 ? `Telegram thread/topic id: ${reply.threadId}.` : "",
601334
+ reply.originSummary ? `External origin: ${reply.originSummary}.` : "",
601335
+ reply.storyId !== void 0 ? `Story id: ${reply.storyId}.` : "",
601336
+ reply.checklistTaskId !== void 0 ? `Checklist task id: ${reply.checklistTaskId}.` : "",
601337
+ reply.pollOptionId ? `Poll option id: ${reply.pollOptionId}.` : ""
601338
+ ].filter(Boolean);
601339
+ const content = reply.text || reply.caption;
601340
+ const blocks = [
601341
+ "### Current Telegram Reply Relationship",
601342
+ metadata.join("\n"),
601343
+ reply.quote ? `Quoted excerpt:
601344
+ ${this.quoteTelegramContextBlock(reply.quote, 1e3)}` : "",
601345
+ content ? `Replied-to content:
601346
+ ${this.quoteTelegramContextBlock(content, 2200)}` : "",
601347
+ reply.mediaSummary ? `Replied-to media: ${reply.mediaSummary}` : "",
601348
+ reply.media && !reply.mediaSummary ? `Replied-to media: ${reply.media.type}${reply.media.fileName ? ` ${reply.media.fileName}` : ""}${reply.media.mimeType ? ` ${reply.media.mimeType}` : ""}` : "",
601349
+ msg.text ? `Current user message:
601350
+ ${this.quoteTelegramContextBlock(msg.text, 1e3)}` : "",
601351
+ 'Instruction: resolve pronouns, follow-up requests, and requests like "links", "repos", "instructions", "that", or "this" against the replied-to content before broader chat/workspace context.'
601352
+ ].filter(Boolean);
601353
+ return blocks.join("\n");
601354
+ }
601355
+ formatTelegramCurrentMessageForPrompt(sessionKey, msg, header, mediaContext = "") {
601356
+ return [
601357
+ this.buildTelegramCurrentReplyContext(sessionKey, msg),
601358
+ `${header}:
601359
+ ${msg.text}`,
601360
+ mediaContext ? `[Media attached - processed content below]
601361
+ ${mediaContext}` : ""
601362
+ ].filter(Boolean).join("\n\n");
601363
+ }
601364
+ formatTelegramReplyEdgeForTui(sessionKey, msg) {
601365
+ const reply = this.resolveTelegramReplyContext(sessionKey, msg);
601366
+ if (!reply) return "";
601367
+ const current = telegramSpeakerLabel(msg);
601368
+ const target = telegramReplySenderLabel(reply.sender);
601369
+ const selfMarker = reply.sender?.isSelf ? " (bot/self)" : "";
601370
+ const id = reply.messageId ? ` #${reply.messageId}` : "";
601371
+ const preview = truncateTelegramContextLine(reply.quote || reply.text || reply.caption || reply.mediaSummary || reply.originSummary || reply.kind, 160);
601372
+ return `reply: ${current} -> ${target}${selfMarker}${id}${preview ? `: "${preview}"` : ""}`;
601373
+ }
600877
601374
  telegramConversationPath(sessionKey) {
600878
601375
  const safe = createHash19("sha1").update(sessionKey).digest("hex").slice(0, 20);
600879
601376
  return join121(this.telegramConversationDir, `${safe}.json`);
@@ -600951,7 +601448,7 @@ Telegram response contract:
600951
601448
  memoryCards: this.chatMemoryCards.get(sessionKey) ?? [],
600952
601449
  stimulation: this.stimulation.getState(sessionKey)
600953
601450
  };
600954
- writeFileSync57(this.telegramConversationPath(sessionKey), JSON.stringify(payload, null, 2) + "\n", "utf8");
601451
+ writeFileSync56(this.telegramConversationPath(sessionKey), JSON.stringify(payload, null, 2) + "\n", "utf8");
600955
601452
  } catch {
600956
601453
  }
600957
601454
  }
@@ -600976,7 +601473,9 @@ Telegram response contract:
600976
601473
  firstName: msg.firstName,
600977
601474
  fromUserId: msg.fromUserId,
600978
601475
  messageId: msg.messageId,
601476
+ messageThreadId: msg.messageThreadId,
600979
601477
  replyToMessageId: msg.replyToMessageId,
601478
+ replyContext: msg.replyContext,
600980
601479
  chatType: msg.chatType,
600981
601480
  chatTitle: msg.chatTitle,
600982
601481
  mediaSummary
@@ -601000,7 +601499,7 @@ Telegram response contract:
601000
601499
  }
601001
601500
  this.saveTelegramConversationState(sessionKey);
601002
601501
  }
601003
- recordTelegramAssistantMessage(msg, text, mode) {
601502
+ recordTelegramAssistantMessage(msg, text, mode, options2 = {}) {
601004
601503
  const clean3 = stripTelegramHiddenThinking(text).trim();
601005
601504
  if (!clean3) return;
601006
601505
  const sessionKey = this.sessionKeyForMessage(msg);
@@ -601010,6 +601509,9 @@ Telegram response contract:
601010
601509
  mode,
601011
601510
  chatId: msg.chatId,
601012
601511
  speaker: this.state.botUsername ? `@${this.state.botUsername}` : "Assistant",
601512
+ messageId: options2.messageId ?? void 0,
601513
+ messageThreadId: msg.messageThreadId,
601514
+ replyToMessageId: options2.replyToMessageId,
601013
601515
  chatType: msg.chatType,
601014
601516
  chatTitle: msg.chatTitle
601015
601517
  };
@@ -601246,12 +601748,14 @@ Telegram response contract:
601246
601748
  })).sort((a2, b) => b.score - a2.score || b.card.updatedAt - a2.card.updatedAt).slice(0, limit);
601247
601749
  }
601248
601750
  buildTelegramConversationContextStream(sessionKey, msg, maxRecent = TELEGRAM_CONTEXT_RECENT_DEFAULT) {
601751
+ this.ensureTelegramConversationLoaded(sessionKey);
601249
601752
  const history = this.chatHistory.get(sessionKey) ?? [];
601250
601753
  const participants = [...this.chatParticipants.get(sessionKey)?.values() ?? []].sort((a2, b) => b.lastSeenTs - a2.lastSeenTs);
601251
601754
  const isGroup = msg.chatType !== "private";
601252
601755
  const retainedCount = history.length;
601253
601756
  const olderCount = Math.max(0, retainedCount - maxRecent);
601254
601757
  const currentSpeaker = telegramSpeakerLabel(msg);
601758
+ const currentReplyContext = this.buildTelegramCurrentReplyContext(sessionKey, msg);
601255
601759
  const sections = [
601256
601760
  "## Telegram Conversation Context Stream",
601257
601761
  [
@@ -601259,9 +601763,13 @@ Telegram response contract:
601259
601763
  `Retained messages in bridge memory: ${retainedCount}`,
601260
601764
  olderCount ? `Older retained messages compacted below: ${olderCount}` : "",
601261
601765
  `Current sender: ${currentSpeaker}${msg.fromUserId ? ` (id ${msg.fromUserId})` : ""}`,
601766
+ msg.messageThreadId !== void 0 ? `Current Telegram thread/topic id: ${msg.messageThreadId}` : "",
601262
601767
  msg.replyToMessageId ? `Current message replies to message_id ${msg.replyToMessageId}` : ""
601263
601768
  ].filter(Boolean).join("\n")
601264
601769
  ];
601770
+ if (currentReplyContext) {
601771
+ sections.push(currentReplyContext);
601772
+ }
601265
601773
  const scopedPersonality = this.renderTelegramScopedPersonality(sessionKey, msg);
601266
601774
  if (scopedPersonality) {
601267
601775
  sections.push(scopedPersonality);
@@ -601336,7 +601844,8 @@ ${olderLines.join("\n")}`);
601336
601844
  const when = telegramHistoryTime(entry);
601337
601845
  const speaker = telegramHistorySpeaker(entry);
601338
601846
  const mode = entry.mode ? `/${entry.mode}` : "";
601339
- const reply = entry.replyToMessageId ? ` reply_to:${entry.replyToMessageId}` : "";
601847
+ const replySender = entry.replyContext?.sender ? `/${telegramReplySenderLabel(entry.replyContext.sender)}` : "";
601848
+ const reply = entry.replyToMessageId ? ` reply_to:${entry.replyToMessageId}${replySender}` : "";
601340
601849
  const media = entry.mediaSummary ? ` [${entry.mediaSummary}]` : "";
601341
601850
  const prefix = [when, `${speaker}${mode}${reply}${media}`].filter(Boolean).join(" ");
601342
601851
  return `${prefix}: ${truncateTelegramContextLine(entry.text)}`;
@@ -601372,11 +601881,20 @@ ${lines.join("\n")}`);
601372
601881
  );
601373
601882
  if (mentioned) return true;
601374
601883
  if (msg.replyToUsername && msg.replyToUsername.trim().replace(/^@/, "").toLowerCase() === bot) return true;
601884
+ const replyUsername = msg.replyContext?.sender?.username?.trim().replace(/^@/, "").toLowerCase();
601885
+ if (replyUsername && replyUsername === bot) return true;
601886
+ const resolvedReply = this.resolveTelegramReplyContext(this.sessionKeyForMessage(msg), msg);
601887
+ if (resolvedReply?.sender?.isSelf) return true;
601375
601888
  return false;
601376
601889
  }
601377
601890
  telegramMessageRepliesToBot(msg) {
601378
601891
  const bot = this.state.botUsername.trim().replace(/^@/, "").toLowerCase();
601379
- return !!bot && !!msg.replyToUsername && msg.replyToUsername.trim().replace(/^@/, "").toLowerCase() === bot;
601892
+ if (!bot) return false;
601893
+ const legacyReply = msg.replyToUsername?.trim().replace(/^@/, "").toLowerCase();
601894
+ const contextReply = msg.replyContext?.sender?.username?.trim().replace(/^@/, "").toLowerCase();
601895
+ if (legacyReply === bot || contextReply === bot) return true;
601896
+ const resolvedReply = this.resolveTelegramReplyContext(this.sessionKeyForMessage(msg), msg);
601897
+ return Boolean(resolvedReply?.sender?.isSelf);
601380
601898
  }
601381
601899
  applyTelegramStimulationDecision(sessionKey, decision) {
601382
601900
  this.stimulation.applyAgentDecision(sessionKey, {
@@ -601428,6 +601946,7 @@ ${lines.join("\n")}`);
601428
601946
  );
601429
601947
  const forcedLine = forcedRoute ? `The operator selected Telegram mode "${forcedRoute}". The route field MUST be "${forcedRoute}", but should_reply must still be inferred live from context.` : `The operator selected Telegram mode "auto". Infer route live from context.`;
601430
601948
  const context2 = this.buildTelegramConversationContextStream(sessionKey, msg, isGroup ? 36 : 20);
601949
+ const currentReplyContext = this.buildTelegramCurrentReplyContext(sessionKey, msg);
601431
601950
  const userPrompt = [
601432
601951
  `You are the Telegram live routing and reply-discretion model.`,
601433
601952
  `Return JSON only, with no markdown and no explanation outside JSON.`,
@@ -601452,6 +601971,7 @@ ${lines.join("\n")}`);
601452
601971
  `Current sender: ${telegramSpeakerLabel(msg)}`,
601453
601972
  msg.replyToMessageId ? `Current message replies to message_id ${msg.replyToMessageId}` : "",
601454
601973
  msg.replyToUsername ? `Current message replies to @${msg.replyToUsername}` : "",
601974
+ currentReplyContext,
601455
601975
  (msg.mentionedUsernames ?? []).length > 0 ? `Current message mentions: ${(msg.mentionedUsernames ?? []).map((name10) => `@${name10}`).join(", ")}` : "",
601456
601976
  msg.media ? `Current message has media: ${summarizeTelegramMessageAttachments(msg)}` : "",
601457
601977
  ``,
@@ -601844,7 +602364,8 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
601844
602364
  text: initialText,
601845
602365
  parse_mode: "HTML"
601846
602366
  };
601847
- if (replyToMessageId) body["reply_to_message_id"] = replyToMessageId;
602367
+ const replyParameters = telegramReplyParameters(replyToMessageId);
602368
+ if (replyParameters) body["reply_parameters"] = replyParameters;
601848
602369
  const result = await this.apiCall("sendMessage", body);
601849
602370
  this.state.messagesSent++;
601850
602371
  return result.result?.message_id ?? null;
@@ -601854,7 +602375,8 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
601854
602375
  chat_id: chatId,
601855
602376
  text: initialText
601856
602377
  };
601857
- if (replyToMessageId) body["reply_to_message_id"] = replyToMessageId;
602378
+ const replyParameters = telegramReplyParameters(replyToMessageId);
602379
+ if (replyParameters) body["reply_parameters"] = replyParameters;
601858
602380
  const result = await this.apiCall("sendMessage", body);
601859
602381
  this.state.messagesSent++;
601860
602382
  return result.result?.message_id ?? null;
@@ -601897,7 +602419,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
601897
602419
  }
601898
602420
  async sendOrEditFinalTelegramHTML(msg, html, liveMessageId) {
601899
602421
  const chunks = splitTelegramMessageText(html, 3900);
601900
- if (chunks.length === 0) return;
602422
+ if (chunks.length === 0) return null;
601901
602423
  const replyToMessageId = msg.chatType !== "private" ? msg.messageId : void 0;
601902
602424
  if (liveMessageId && !msg.guestQueryId) {
601903
602425
  const edited = await this.editLiveMessage(msg.chatId, liveMessageId, chunks[0]);
@@ -601905,16 +602427,19 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
601905
602427
  for (const chunk of chunks.slice(1)) {
601906
602428
  await this.sendMessageHTML(msg.chatId, chunk);
601907
602429
  }
601908
- return;
602430
+ return liveMessageId;
601909
602431
  }
601910
602432
  }
601911
602433
  if (msg.guestQueryId) {
601912
602434
  await this.answerGuestQuery(msg.guestQueryId, chunks.join("\n\n"), { parseMode: "HTML" });
601913
- return;
602435
+ return null;
601914
602436
  }
602437
+ let firstMessageId = null;
601915
602438
  for (let idx = 0; idx < chunks.length; idx++) {
601916
- await this.sendMessageHTML(msg.chatId, chunks[idx], idx === 0 ? replyToMessageId : void 0);
602439
+ const messageId = await this.sendMessageHTML(msg.chatId, chunks[idx], idx === 0 ? replyToMessageId : void 0);
602440
+ if (firstMessageId === null) firstMessageId = messageId;
601917
602441
  }
602442
+ return firstMessageId;
601918
602443
  }
601919
602444
  async deleteLiveMessage(chatId, messageId) {
601920
602445
  try {
@@ -602046,16 +602571,16 @@ Join: ${newUrl}`);
602046
602571
  return;
602047
602572
  }
602048
602573
  }
602049
- let steeringText = msg.text;
602574
+ let mediaContext = "";
602050
602575
  if (msg.media || msg.replyToMedia) {
602051
- const mediaContext = await this.processMediaContextForMessage(msg);
602052
- if (mediaContext) {
602053
- steeringText += `
602054
-
602055
- [Media attached — processed content below]
602056
- ${mediaContext}`;
602057
- }
602576
+ mediaContext = await this.processMediaContextForMessage(msg);
602058
602577
  }
602578
+ const steeringText = this.formatTelegramCurrentMessageForPrompt(
602579
+ sessionKey,
602580
+ msg,
602581
+ `Telegram steering message from @${msg.username}`,
602582
+ mediaContext
602583
+ );
602059
602584
  if (isGroup) {
602060
602585
  this.markLastTelegramUserMessageMode(msg, "steering");
602061
602586
  } else {
@@ -602116,11 +602641,18 @@ ${mediaContext}`;
602116
602641
  `✈ @${msg.username || "telegram"}`,
602117
602642
  `Telegram ${toolContext} message: ${msg.text.slice(0, 160)}`
602118
602643
  );
602644
+ const replyEdge = this.formatTelegramReplyEdgeForTui(sessionKey, msg);
602645
+ if (replyEdge) {
602646
+ this.subAgentViewCallbacks?.onWrite(subAgent.viewId, replyEdge);
602647
+ }
602119
602648
  this.subAgentViewCallbacks?.onWrite(subAgent.viewId, `✈ Telegram message from @${msg.username}: ${msg.text}`);
602120
602649
  if (this.canUseChatActions(msg)) {
602121
602650
  subAgent.typingInterval = this.startTypingIndicator(msg.chatId);
602122
602651
  }
602123
602652
  this.tuiWrite(() => renderTelegramSubAgentStart(msg.username, msg.text, isAdminDM));
602653
+ if (replyEdge) {
602654
+ this.tuiWrite(() => renderTelegramSubAgentEvent(msg.username, replyEdge));
602655
+ }
602124
602656
  try {
602125
602657
  let mediaContext = "";
602126
602658
  if (msg.media || msg.replyToMedia) {
@@ -602150,9 +602682,12 @@ ${mediaContext}`;
602150
602682
  await subAgent.liveMessagePromise.catch(() => {
602151
602683
  });
602152
602684
  }
602153
- this.recordTelegramAssistantMessage(msg, finalText, "action");
602154
602685
  const finalHtml = convertMarkdownToTelegramHTML(finalText);
602155
- await this.sendOrEditFinalTelegramHTML(msg, finalHtml, subAgent.liveMessageId);
602686
+ const sentMessageId = await this.sendOrEditFinalTelegramHTML(msg, finalHtml, subAgent.liveMessageId);
602687
+ this.recordTelegramAssistantMessage(msg, finalText, "action", {
602688
+ messageId: sentMessageId,
602689
+ replyToMessageId: msg.chatType !== "private" ? msg.messageId : void 0
602690
+ });
602156
602691
  await this.sendGeneratedArtifactsFromSubAgent(
602157
602692
  msg,
602158
602693
  subAgent,
@@ -602218,6 +602753,10 @@ ${mediaContext}`;
602218
602753
  `✈ @${msg.username || "telegram"}`,
602219
602754
  `Telegram admin chat: ${msg.text.slice(0, 160)}`
602220
602755
  );
602756
+ const replyEdge = this.formatTelegramReplyEdgeForTui(sessionKey, msg);
602757
+ if (replyEdge) {
602758
+ this.subAgentViewCallbacks?.onWrite(subAgent.viewId, replyEdge);
602759
+ }
602221
602760
  this.subAgentViewCallbacks?.onWrite(subAgent.viewId, `✈ Telegram admin chat from @${msg.username}: ${msg.text}`);
602222
602761
  this.subAgentViewCallbacks?.onWrite(subAgent.viewId, `route: chat (${this.interactionMode}) with admin tools`);
602223
602762
  this.subAgentViewCallbacks?.onStatus(subAgent.viewId, "running");
@@ -602225,6 +602764,9 @@ ${mediaContext}`;
602225
602764
  subAgent.typingInterval = this.startTypingIndicator(msg.chatId);
602226
602765
  }
602227
602766
  this.tuiWrite(() => renderTelegramSubAgentEvent(msg.username, `admin chat with full context/tools (${this.interactionMode})`));
602767
+ if (replyEdge) {
602768
+ this.tuiWrite(() => renderTelegramSubAgentEvent(msg.username, replyEdge));
602769
+ }
602228
602770
  try {
602229
602771
  let mediaContext = "";
602230
602772
  if (msg.media || msg.replyToMedia) {
@@ -602249,9 +602791,12 @@ ${mediaContext}`;
602249
602791
  this.subAgentViewCallbacks?.onStatus(subAgent.viewId, "completed");
602250
602792
  return;
602251
602793
  }
602252
- this.recordTelegramAssistantMessage(msg, finalText, "chat");
602253
602794
  const finalHtml = convertMarkdownToTelegramHTML(finalText);
602254
- await this.sendOrEditFinalTelegramHTML(msg, finalHtml, subAgent.liveMessageId);
602795
+ const sentMessageId = await this.sendOrEditFinalTelegramHTML(msg, finalHtml, subAgent.liveMessageId);
602796
+ this.recordTelegramAssistantMessage(msg, finalText, "chat", {
602797
+ messageId: sentMessageId,
602798
+ replyToMessageId: msg.chatType !== "private" ? msg.messageId : void 0
602799
+ });
602255
602800
  await this.sendGeneratedArtifactsFromSubAgent(
602256
602801
  msg,
602257
602802
  subAgent,
@@ -602289,6 +602834,7 @@ ${mediaContext}`;
602289
602834
  return;
602290
602835
  }
602291
602836
  const viewId = `${this.viewIdForMessage(msg)}-chat`;
602837
+ const sessionKey = this.sessionKeyForMessage(msg);
602292
602838
  let typingInterval = null;
602293
602839
  let liveMessageId = null;
602294
602840
  let accumulated = "";
@@ -602303,6 +602849,10 @@ ${mediaContext}`;
602303
602849
  `✈ @${msg.username || "telegram"}`,
602304
602850
  `Telegram quick chat: ${msg.text.slice(0, 160)}`
602305
602851
  );
602852
+ const replyEdge = this.formatTelegramReplyEdgeForTui(sessionKey, msg);
602853
+ if (replyEdge) {
602854
+ this.subAgentViewCallbacks?.onWrite(viewId, replyEdge);
602855
+ }
602306
602856
  this.subAgentViewCallbacks?.onWrite(viewId, `✈ Telegram quick chat from @${msg.username}: ${msg.text}`);
602307
602857
  this.subAgentViewCallbacks?.onWrite(viewId, `route: chat (${this.interactionMode})`);
602308
602858
  this.subAgentViewCallbacks?.onStatus(viewId, "running");
@@ -602371,9 +602921,12 @@ ${mediaContext}`;
602371
602921
  this.subAgentViewCallbacks?.onStatus(viewId, "completed");
602372
602922
  return;
602373
602923
  }
602374
- this.recordTelegramAssistantMessage(msg, cleaned, "chat");
602375
602924
  const finalHtml = convertMarkdownToTelegramHTML(cleaned);
602376
- await this.sendOrEditFinalTelegramHTML(msg, finalHtml, liveMessageId);
602925
+ const sentMessageId = await this.sendOrEditFinalTelegramHTML(msg, finalHtml, liveMessageId);
602926
+ this.recordTelegramAssistantMessage(msg, cleaned, "chat", {
602927
+ messageId: sentMessageId,
602928
+ replyToMessageId: msg.chatType !== "private" ? msg.messageId : void 0
602929
+ });
602377
602930
  this.subAgentViewCallbacks?.onWrite(viewId, `completed: ${cleaned}`);
602378
602931
  this.subAgentViewCallbacks?.onStatus(viewId, "completed");
602379
602932
  } catch (err) {
@@ -602436,12 +602989,15 @@ ${conversationStream}`
602436
602989
  }
602437
602990
  ];
602438
602991
  const chatLabel = isGroup ? ` in group "${msg.chatTitle || "unknown"}"` : "";
602992
+ const currentPrompt = this.formatTelegramCurrentMessageForPrompt(
602993
+ sessionKey,
602994
+ msg,
602995
+ `Telegram message from @${msg.username}${chatLabel}`,
602996
+ mediaContext
602997
+ );
602439
602998
  messages2.push({
602440
602999
  role: "user",
602441
- content: `Telegram message from @${msg.username}${chatLabel}:
602442
- ${msg.text}${mediaContext ? `
602443
-
602444
- ${mediaContext}` : ""}`
603000
+ content: currentPrompt
602445
603001
  });
602446
603002
  return messages2;
602447
603003
  }
@@ -602648,6 +603204,11 @@ ${mediaContext}` : ""}`
602648
603204
 
602649
603205
  ${GROUP_REPLY_DISCRETION_PROMPT}` : "";
602650
603206
  const chatLabel = isGroup ? ` in group "${msg.chatTitle || "unknown"}"` : "";
603207
+ const currentTelegramPrompt = this.formatTelegramCurrentMessageForPrompt(
603208
+ sessionContext.sessionKey,
603209
+ msg,
603210
+ `${isAdminDM ? "Telegram message from admin" : "Telegram message from"} @${msg.username}${isAdminDM ? "" : chatLabel}`
603211
+ );
602651
603212
  let userPrompt;
602652
603213
  if (isAdminDM) {
602653
603214
  const profileLine = profile === "chat" ? "Handle this as contextual Telegram chat: answer directly if simple, use tools/delegation if needed." : "Handle this as Telegram action work: complete the requested task or clearly report the blocker.";
@@ -602659,8 +603220,7 @@ ${reminderToolContract}
602659
603220
 
602660
603221
  ${profileLine}
602661
603222
 
602662
- Telegram message from admin @${msg.username}:
602663
- ${msg.text}`;
603223
+ ${currentTelegramPrompt}`;
602664
603224
  } else {
602665
603225
  const toolHint = [
602666
603226
  "You have access to isolated per-chat memory (memory_write, memory_read, memory_search) scoped to this conversation.",
@@ -602677,8 +603237,7 @@ ${toolHint}
602677
603237
 
602678
603238
  ---
602679
603239
 
602680
- Telegram message from @${msg.username}${chatLabel}:
602681
- ${msg.text}
603240
+ ${currentTelegramPrompt}
602682
603241
 
602683
603242
  Respond concisely and safely. Send the actual chat reply, not router/status/completion commentary.`;
602684
603243
  }
@@ -603667,12 +604226,12 @@ ${text}`.trim());
603667
604226
  }
603668
604227
  // ── Message sending ───────────────────────────────────────────────────
603669
604228
  /** Send a response back to a Telegram chat (Markdown → HTML conversion) */
603670
- async sendMessage(chatId, text) {
604229
+ async sendMessage(chatId, text, replyToMessageId) {
603671
604230
  const extracted = extractMediaReferences(text);
603672
604231
  const html = convertMarkdownToTelegramHTML(extracted.text);
603673
- const msgId = extracted.text.trim() ? await this.sendMessageHTML(chatId, html) : null;
604232
+ const msgId = extracted.text.trim() ? await this.sendMessageHTML(chatId, html, replyToMessageId) : null;
603674
604233
  for (const media of extracted.media) {
603675
- await this.sendMediaReference(chatId, media).catch(() => null);
604234
+ await this.sendMediaReference(chatId, media, { replyToMessageId }).catch(() => null);
603676
604235
  }
603677
604236
  return msgId;
603678
604237
  }
@@ -603682,8 +604241,13 @@ ${text}`.trim());
603682
604241
  const sendHtml = extracted.text || (extracted.media.length > 0 ? "" : html);
603683
604242
  let sentId = null;
603684
604243
  if (!sendHtml.trim()) {
603685
- for (const media of extracted.media) {
603686
- const mediaId = await this.sendMediaReference(chatId, media).catch(() => null);
604244
+ for (let idx = 0; idx < extracted.media.length; idx++) {
604245
+ const media = extracted.media[idx];
604246
+ const mediaId = await this.sendMediaReference(
604247
+ chatId,
604248
+ media,
604249
+ idx === 0 ? { replyToMessageId } : {}
604250
+ ).catch(() => null);
603687
604251
  if (sentId === null) sentId = mediaId;
603688
604252
  }
603689
604253
  return sentId;
@@ -603696,7 +604260,8 @@ ${text}`.trim());
603696
604260
  text: chunk,
603697
604261
  parse_mode: "HTML"
603698
604262
  };
603699
- if (idx === 0 && replyToMessageId) body["reply_to_message_id"] = replyToMessageId;
604263
+ const replyParameters = idx === 0 ? telegramReplyParameters(replyToMessageId) : void 0;
604264
+ if (replyParameters) body["reply_parameters"] = replyParameters;
603700
604265
  try {
603701
604266
  const result = await this.apiCall("sendMessage", body);
603702
604267
  if (result.ok === false) throw new Error(String(result.description || "Telegram sendMessage failed"));
@@ -603705,7 +604270,7 @@ ${text}`.trim());
603705
604270
  } catch {
603706
604271
  const plain = chunk.replace(/<[^>]+>/g, "");
603707
604272
  const fallbackBody = { chat_id: chatId, text: plain };
603708
- if (idx === 0 && replyToMessageId) fallbackBody["reply_to_message_id"] = replyToMessageId;
604273
+ if (replyParameters) fallbackBody["reply_parameters"] = replyParameters;
603709
604274
  try {
603710
604275
  const result = await this.apiCall("sendMessage", fallbackBody);
603711
604276
  if (result.ok === false) throw new Error(String(result.description || "Telegram sendMessage failed"));
@@ -603727,7 +604292,7 @@ ${text}`.trim());
603727
604292
  parseMode: options2.html ? "HTML" : void 0
603728
604293
  });
603729
604294
  }
603730
- return options2.html ? this.sendMessageHTML(msg.chatId, text, options2.replyToMessageId) : this.sendMessage(msg.chatId, text);
604295
+ return options2.html ? this.sendMessageHTML(msg.chatId, text, options2.replyToMessageId) : this.sendMessage(msg.chatId, text, options2.replyToMessageId);
603731
604296
  }
603732
604297
  async sendTelegramFileToChat(chatId, path11, options2) {
603733
604298
  const abs = resolve40(path11);
@@ -603752,12 +604317,13 @@ ${text}`.trim());
603752
604317
  async sendMediaReferenceStrict(chatId, media, options2 = {}) {
603753
604318
  const { method, field } = mediaTelegramMethod(media.kind);
603754
604319
  const caption = options2.caption?.trim();
604320
+ const replyParameters = telegramReplyParameters(options2.replyToMessageId);
603755
604321
  if (media.source === "url") {
603756
604322
  const result2 = await this.apiCall(method, {
603757
604323
  chat_id: chatId,
603758
604324
  [field]: media.value,
603759
604325
  ...caption ? { caption } : {},
603760
- ...options2.replyToMessageId ? { reply_to_message_id: options2.replyToMessageId } : {}
604326
+ ...replyParameters ? { reply_parameters: replyParameters } : {}
603761
604327
  });
603762
604328
  if (result2.ok === false) throw new Error(String(result2.description || `Telegram ${method} failed`));
603763
604329
  this.state.messagesSent++;
@@ -603780,7 +604346,7 @@ ${text}`.trim());
603780
604346
  };
603781
604347
  addField("chat_id", String(chatId));
603782
604348
  if (caption) addField("caption", caption);
603783
- if (options2.replyToMessageId) addField("reply_to_message_id", String(options2.replyToMessageId));
604349
+ if (replyParameters) addField("reply_parameters", JSON.stringify(replyParameters));
603784
604350
  parts.push(Buffer.from(`--${boundary}\r
603785
604351
  `));
603786
604352
  parts.push(Buffer.from(
@@ -604286,7 +604852,7 @@ import {
604286
604852
  existsSync as existsSync107,
604287
604853
  readFileSync as readFileSync88,
604288
604854
  readdirSync as readdirSync37,
604289
- writeFileSync as writeFileSync58,
604855
+ writeFileSync as writeFileSync57,
604290
604856
  renameSync as renameSync5,
604291
604857
  mkdirSync as mkdirSync62,
604292
604858
  unlinkSync as unlinkSync22
@@ -604309,7 +604875,7 @@ function persistSession(s2) {
604309
604875
  mkdirSync62(sessionsDir(), { recursive: true });
604310
604876
  const final2 = sessionPath(s2.id);
604311
604877
  const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
604312
- writeFileSync58(tmp, JSON.stringify(s2, null, 2), "utf-8");
604878
+ writeFileSync57(tmp, JSON.stringify(s2, null, 2), "utf-8");
604313
604879
  renameSync5(tmp, final2);
604314
604880
  } catch {
604315
604881
  }
@@ -604319,7 +604885,7 @@ function persistInFlight(j) {
604319
604885
  mkdirSync62(sessionsDir(), { recursive: true });
604320
604886
  const final2 = inFlightPath(j.sessionId);
604321
604887
  const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
604322
- writeFileSync58(tmp, JSON.stringify(j, null, 2), "utf-8");
604888
+ writeFileSync57(tmp, JSON.stringify(j, null, 2), "utf-8");
604323
604889
  renameSync5(tmp, final2);
604324
604890
  } catch {
604325
604891
  }
@@ -604351,7 +604917,7 @@ function loadPersistedSessions() {
604351
604917
  parsed.error = "Daemon restart while subprocess was running";
604352
604918
  parsed.completedAt = Date.now();
604353
604919
  try {
604354
- writeFileSync58(fp, JSON.stringify(parsed, null, 2), "utf-8");
604920
+ writeFileSync57(fp, JSON.stringify(parsed, null, 2), "utf-8");
604355
604921
  } catch {
604356
604922
  }
604357
604923
  report2.staleInFlight++;
@@ -604933,7 +605499,7 @@ __export(projects_exports, {
604933
605499
  setCurrentProject: () => setCurrentProject,
604934
605500
  unregisterProject: () => unregisterProject
604935
605501
  });
604936
- import { readFileSync as readFileSync89, writeFileSync as writeFileSync59, mkdirSync as mkdirSync63, existsSync as existsSync108, statSync as statSync37, renameSync as renameSync6 } from "node:fs";
605502
+ import { readFileSync as readFileSync89, writeFileSync as writeFileSync58, mkdirSync as mkdirSync63, existsSync as existsSync108, statSync as statSync37, renameSync as renameSync6 } from "node:fs";
604937
605503
  import { homedir as homedir37 } from "node:os";
604938
605504
  import { basename as basename26, join as join123, resolve as resolve41 } from "node:path";
604939
605505
  import { randomUUID as randomUUID14 } from "node:crypto";
@@ -604951,7 +605517,7 @@ function readAll2() {
604951
605517
  function writeAll(file) {
604952
605518
  mkdirSync63(OMNIUS_DIR3, { recursive: true });
604953
605519
  const tmp = `${PROJECTS_FILE}.${randomUUID14().slice(0, 8)}.tmp`;
604954
- writeFileSync59(tmp, JSON.stringify(file, null, 2), "utf8");
605520
+ writeFileSync58(tmp, JSON.stringify(file, null, 2), "utf8");
604955
605521
  renameSync6(tmp, PROJECTS_FILE);
604956
605522
  }
604957
605523
  function listProjects() {
@@ -605034,7 +605600,7 @@ function setCurrentProject(root) {
605034
605600
  currentRoot = canonical;
605035
605601
  try {
605036
605602
  mkdirSync63(OMNIUS_DIR3, { recursive: true });
605037
- writeFileSync59(CURRENT_FILE, `${canonical}
605603
+ writeFileSync58(CURRENT_FILE, `${canonical}
605038
605604
  `, "utf8");
605039
605605
  } catch {
605040
605606
  }
@@ -605753,7 +606319,7 @@ var init_access_policy = __esm({
605753
606319
 
605754
606320
  // packages/cli/src/api/project-preferences.ts
605755
606321
  import { createHash as createHash20 } from "node:crypto";
605756
- import { existsSync as existsSync109, mkdirSync as mkdirSync64, readFileSync as readFileSync90, renameSync as renameSync7, writeFileSync as writeFileSync60, unlinkSync as unlinkSync23 } from "node:fs";
606322
+ import { existsSync as existsSync109, mkdirSync as mkdirSync64, readFileSync as readFileSync90, renameSync as renameSync7, writeFileSync as writeFileSync59, unlinkSync as unlinkSync23 } from "node:fs";
605757
606323
  import { homedir as homedir38 } from "node:os";
605758
606324
  import { join as join124, resolve as resolve42 } from "node:path";
605759
606325
  import { randomUUID as randomUUID15 } from "node:crypto";
@@ -605776,7 +606342,7 @@ function ensureDir(root) {
605776
606342
  const sentinel = rootSentinelPath(root);
605777
606343
  try {
605778
606344
  if (!existsSync109(sentinel)) {
605779
- writeFileSync60(sentinel, `${resolve42(root)}
606345
+ writeFileSync59(sentinel, `${resolve42(root)}
605780
606346
  `, "utf8");
605781
606347
  }
605782
606348
  } catch {
@@ -605805,12 +606371,12 @@ function writeProjectPreferences(root, partial) {
605805
606371
  };
605806
606372
  const file = prefsPath(root);
605807
606373
  const tmp = `${file}.${randomUUID15().slice(0, 8)}.tmp`;
605808
- writeFileSync60(tmp, JSON.stringify(merged, null, 2), "utf8");
606374
+ writeFileSync59(tmp, JSON.stringify(merged, null, 2), "utf8");
605809
606375
  try {
605810
606376
  renameSync7(tmp, file);
605811
606377
  } catch (err) {
605812
606378
  try {
605813
- writeFileSync60(file, JSON.stringify(merged, null, 2), "utf8");
606379
+ writeFileSync59(file, JSON.stringify(merged, null, 2), "utf8");
605814
606380
  } catch {
605815
606381
  }
605816
606382
  try {
@@ -606812,7 +607378,7 @@ var init_audit_log = __esm({
606812
607378
  // packages/cli/src/api/disk-task-output.ts
606813
607379
  import { open } from "node:fs/promises";
606814
607380
  import { existsSync as existsSync111, mkdirSync as mkdirSync66, statSync as statSync38 } from "node:fs";
606815
- import { dirname as dirname36 } from "node:path";
607381
+ import { dirname as dirname35 } from "node:path";
606816
607382
  import * as fsConstants from "node:constants";
606817
607383
  var O_NOFOLLOW2, O_APPEND2, O_CREAT2, O_WRONLY2, OPEN_FLAGS_WRITE, OPEN_MODE, DiskTaskOutput;
606818
607384
  var init_disk_task_output = __esm({
@@ -606831,7 +607397,7 @@ var init_disk_task_output = __esm({
606831
607397
  fileSize = 0;
606832
607398
  constructor(outputPath2) {
606833
607399
  this.path = outputPath2;
606834
- mkdirSync66(dirname36(outputPath2), { recursive: true });
607400
+ mkdirSync66(dirname35(outputPath2), { recursive: true });
606835
607401
  }
606836
607402
  /** Queue content for async append. Non-blocking. */
606837
607403
  append(chunk) {
@@ -607869,7 +608435,7 @@ __export(runtime_keys_exports, {
607869
608435
  mintKey: () => mintKey,
607870
608436
  revokeByPrefix: () => revokeByPrefix
607871
608437
  });
607872
- import { existsSync as existsSync113, readFileSync as readFileSync93, writeFileSync as writeFileSync61, mkdirSync as mkdirSync67, chmodSync } from "node:fs";
608438
+ import { existsSync as existsSync113, readFileSync as readFileSync93, writeFileSync as writeFileSync60, mkdirSync as mkdirSync67, chmodSync } from "node:fs";
607873
608439
  import { join as join127 } from "node:path";
607874
608440
  import { homedir as homedir40 } from "node:os";
607875
608441
  import { randomBytes as randomBytes22 } from "node:crypto";
@@ -607890,7 +608456,7 @@ function loadAll() {
607890
608456
  }
607891
608457
  function persistAll(records) {
607892
608458
  ensureDir2();
607893
- writeFileSync61(KEYS_FILE, JSON.stringify(records, null, 2), "utf-8");
608459
+ writeFileSync60(KEYS_FILE, JSON.stringify(records, null, 2), "utf-8");
607894
608460
  try {
607895
608461
  chmodSync(KEYS_FILE, 384);
607896
608462
  } catch {
@@ -608124,20 +608690,20 @@ __export(graphical_sudo_exports, {
608124
608690
  runGraphicalSudo: () => runGraphicalSudo
608125
608691
  });
608126
608692
  import { spawn as spawn27 } from "node:child_process";
608127
- import { existsSync as existsSync115, mkdirSync as mkdirSync68, writeFileSync as writeFileSync62, chmodSync as chmodSync2 } from "node:fs";
608693
+ import { existsSync as existsSync115, mkdirSync as mkdirSync68, writeFileSync as writeFileSync61, chmodSync as chmodSync2 } from "node:fs";
608128
608694
  import { join as join129 } from "node:path";
608129
608695
  import { tmpdir as tmpdir21 } from "node:os";
608130
608696
  function detectSudoHelper() {
608131
608697
  if (process.platform === "win32") return null;
608132
608698
  if (process.platform === "darwin") return "osascript";
608133
- if (which("pkexec")) return "pkexec";
608134
- if (which("ssh-askpass")) return "ssh-askpass";
608135
- if (which("zenity")) return "zenity";
608136
- if (which("kdialog")) return "kdialog";
608137
- if (which("sudo")) return "sudo-tty";
608699
+ if (which2("pkexec")) return "pkexec";
608700
+ if (which2("ssh-askpass")) return "ssh-askpass";
608701
+ if (which2("zenity")) return "zenity";
608702
+ if (which2("kdialog")) return "kdialog";
608703
+ if (which2("sudo")) return "sudo-tty";
608138
608704
  return null;
608139
608705
  }
608140
- function which(cmd) {
608706
+ function which2(cmd) {
608141
608707
  const path11 = process.env["PATH"] || "/usr/bin:/bin:/usr/local/bin";
608142
608708
  for (const dir of path11.split(":")) {
608143
608709
  if (!dir) continue;
@@ -608160,7 +608726,7 @@ exec zenity --password --title="Omnius needs sudo" --text="${description.replace
608160
608726
  exec kdialog --password "${description.replace(/"/g, '\\"')}" 2>/dev/null
608161
608727
  `;
608162
608728
  }
608163
- writeFileSync62(shim, body, "utf-8");
608729
+ writeFileSync61(shim, body, "utf-8");
608164
608730
  chmodSync2(shim, 493);
608165
608731
  return shim;
608166
608732
  }
@@ -608184,7 +608750,7 @@ async function runGraphicalSudo(opts) {
608184
608750
  cmd = "osascript";
608185
608751
  args = ["-e", `do shell script "${inner.replace(/"/g, '\\"')}" with administrator privileges`];
608186
608752
  } else if (helper === "ssh-askpass" || helper === "zenity" || helper === "kdialog") {
608187
- const shim = helper === "ssh-askpass" ? which("ssh-askpass") : ensureAskpassShim(helper, description);
608753
+ const shim = helper === "ssh-askpass" ? which2("ssh-askpass") : ensureAskpassShim(helper, description);
608188
608754
  extraEnv = { ...extraEnv, SUDO_ASKPASS: shim, DISPLAY: process.env["DISPLAY"] || ":0" };
608189
608755
  cmd = "sudo";
608190
608756
  args = ["-A", "-E", "/bin/bash", opts.scriptPath, ...opts.args ?? []];
@@ -620341,7 +620907,7 @@ var init_auth_oidc = __esm({
620341
620907
  });
620342
620908
 
620343
620909
  // packages/cli/src/api/usage-tracker.ts
620344
- import { mkdirSync as mkdirSync69, readFileSync as readFileSync96, writeFileSync as writeFileSync63, existsSync as existsSync117 } from "node:fs";
620910
+ import { mkdirSync as mkdirSync69, readFileSync as readFileSync96, writeFileSync as writeFileSync62, existsSync as existsSync117 } from "node:fs";
620345
620911
  import { join as join131 } from "node:path";
620346
620912
  function initUsageTracker(omniusDir) {
620347
620913
  const dir = join131(omniusDir, "usage");
@@ -620385,7 +620951,7 @@ function flush2() {
620385
620951
  if (!initialized2 || !dirty) return;
620386
620952
  try {
620387
620953
  store.lastSaved = (/* @__PURE__ */ new Date()).toISOString();
620388
- writeFileSync63(usageFile, JSON.stringify(store, null, 2), "utf-8");
620954
+ writeFileSync62(usageFile, JSON.stringify(store, null, 2), "utf-8");
620389
620955
  dirty = false;
620390
620956
  } catch {
620391
620957
  }
@@ -620413,7 +620979,7 @@ var init_usage_tracker = __esm({
620413
620979
  });
620414
620980
 
620415
620981
  // packages/cli/src/api/profiles.ts
620416
- import { existsSync as existsSync118, readFileSync as readFileSync97, writeFileSync as writeFileSync64, mkdirSync as mkdirSync70, readdirSync as readdirSync40, unlinkSync as unlinkSync24 } from "node:fs";
620982
+ import { existsSync as existsSync118, readFileSync as readFileSync97, writeFileSync as writeFileSync63, mkdirSync as mkdirSync70, readdirSync as readdirSync40, unlinkSync as unlinkSync24 } from "node:fs";
620417
620983
  import { join as join132 } from "node:path";
620418
620984
  import { homedir as homedir43 } from "node:os";
620419
620985
  import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv5, randomBytes as randomBytes23, scryptSync as scryptSync3 } from "node:crypto";
@@ -620483,10 +621049,10 @@ function saveProfile(profile, password, scope = "global", projectDir2) {
620483
621049
  profile.modified = (/* @__PURE__ */ new Date()).toISOString();
620484
621050
  if (password) {
620485
621051
  const encrypted = encryptProfile(profile, password);
620486
- writeFileSync64(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
621052
+ writeFileSync63(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
620487
621053
  } else {
620488
621054
  profile.encrypted = false;
620489
- writeFileSync64(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
621055
+ writeFileSync63(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
620490
621056
  }
620491
621057
  }
620492
621058
  function deleteProfile(name10, scope = "global", projectDir2) {
@@ -620670,8 +621236,8 @@ var init_profiles = __esm({
620670
621236
 
620671
621237
  // packages/cli/src/docker.ts
620672
621238
  import { execSync as execSync56, spawn as spawn28 } from "node:child_process";
620673
- import { existsSync as existsSync119, mkdirSync as mkdirSync71, writeFileSync as writeFileSync65 } from "node:fs";
620674
- import { join as join133, resolve as resolve43, dirname as dirname37 } from "node:path";
621239
+ import { existsSync as existsSync119, mkdirSync as mkdirSync71, writeFileSync as writeFileSync64 } from "node:fs";
621240
+ import { join as join133, resolve as resolve43, dirname as dirname36 } from "node:path";
620675
621241
  import { homedir as homedir44 } from "node:os";
620676
621242
  import { fileURLToPath as fileURLToPath16 } from "node:url";
620677
621243
  function getDockerDir() {
@@ -620682,7 +621248,7 @@ function getDockerDir() {
620682
621248
  } catch {
620683
621249
  }
620684
621250
  try {
620685
- const thisDir = dirname37(fileURLToPath16(import.meta.url));
621251
+ const thisDir = dirname36(fileURLToPath16(import.meta.url));
620686
621252
  return join133(thisDir, "..", "..", "..", "docker");
620687
621253
  } catch {
620688
621254
  }
@@ -620895,8 +621461,8 @@ chown -R node:node /workspace /home/node/.omnius 2>/dev/null || true
620895
621461
  if [ "$1" = "omnius" ]; then shift; exec su - node -c "cd /workspace && omnius $*"; fi
620896
621462
  exec "$@"
620897
621463
  `;
620898
- writeFileSync65(join133(dir, "Dockerfile"), dockerfile);
620899
- writeFileSync65(join133(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
621464
+ writeFileSync64(join133(dir, "Dockerfile"), dockerfile);
621465
+ writeFileSync64(join133(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
620900
621466
  }
620901
621467
  function hasNvidiaGpu() {
620902
621468
  try {
@@ -621151,15 +621717,15 @@ import * as http5 from "node:http";
621151
621717
  import * as https3 from "node:https";
621152
621718
  import { createRequire as createRequire7 } from "node:module";
621153
621719
  import { fileURLToPath as fileURLToPath17 } from "node:url";
621154
- import { dirname as dirname38, join as join135, resolve as resolve44 } from "node:path";
621720
+ import { dirname as dirname37, join as join135, resolve as resolve44 } from "node:path";
621155
621721
  import { homedir as homedir45 } from "node:os";
621156
621722
  import { spawn as spawn29, execSync as execSync57 } from "node:child_process";
621157
- import { mkdirSync as mkdirSync72, writeFileSync as writeFileSync66, readFileSync as readFileSync98, readdirSync as readdirSync41, existsSync as existsSync120, watch as fsWatch3, renameSync as renameSync8, unlinkSync as unlinkSync25 } from "node:fs";
621723
+ import { mkdirSync as mkdirSync72, writeFileSync as writeFileSync65, readFileSync as readFileSync98, readdirSync as readdirSync41, existsSync as existsSync120, watch as fsWatch3, renameSync as renameSync8, unlinkSync as unlinkSync25 } from "node:fs";
621158
621724
  import { randomBytes as randomBytes24, randomUUID as randomUUID16 } from "node:crypto";
621159
621725
  import { createHash as createHash23 } from "node:crypto";
621160
621726
  function getVersion3() {
621161
621727
  try {
621162
- const thisDir = dirname38(fileURLToPath17(import.meta.url));
621728
+ const thisDir = dirname37(fileURLToPath17(import.meta.url));
621163
621729
  const candidates = [
621164
621730
  join135(thisDir, "..", "package.json"),
621165
621731
  join135(thisDir, "..", "..", "package.json"),
@@ -622249,11 +622815,11 @@ function atomicJobWrite(dir, id, job) {
622249
622815
  const finalPath = join135(dir, `${id}.json`);
622250
622816
  const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
622251
622817
  try {
622252
- writeFileSync66(tmpPath, JSON.stringify(job, null, 2), "utf-8");
622818
+ writeFileSync65(tmpPath, JSON.stringify(job, null, 2), "utf-8");
622253
622819
  renameSync8(tmpPath, finalPath);
622254
622820
  } catch {
622255
622821
  try {
622256
- writeFileSync66(finalPath, JSON.stringify(job, null, 2), "utf-8");
622822
+ writeFileSync65(finalPath, JSON.stringify(job, null, 2), "utf-8");
622257
622823
  } catch {
622258
622824
  }
622259
622825
  try {
@@ -623711,7 +624277,7 @@ function writeUpdateState(state) {
623711
624277
  mkdirSync72(dir, { recursive: true });
623712
624278
  const finalPath = updateStateFile();
623713
624279
  const tmpPath = `${finalPath}.tmp.${process.pid}`;
623714
- writeFileSync66(tmpPath, JSON.stringify(state, null, 2), "utf-8");
624280
+ writeFileSync65(tmpPath, JSON.stringify(state, null, 2), "utf-8");
623715
624281
  renameSync8(tmpPath, finalPath);
623716
624282
  } catch {
623717
624283
  }
@@ -623751,7 +624317,7 @@ async function handleV1Update(req2, res, requestId) {
623751
624317
  }, { subject: req2._authUser ?? "anonymous" });
623752
624318
  const fs10 = require4("node:fs");
623753
624319
  const nodeBin = process.execPath;
623754
- const nodeDir = dirname38(nodeBin);
624320
+ const nodeDir = dirname37(nodeBin);
623755
624321
  const { execSync: es } = require4("node:child_process");
623756
624322
  const isWin2 = process.platform === "win32";
623757
624323
  let npmBin = "";
@@ -623766,7 +624332,7 @@ async function handleV1Update(req2, res, requestId) {
623766
624332
  const dir = join135(homedir45(), ".omnius");
623767
624333
  fs10.mkdirSync(dir, { recursive: true });
623768
624334
  const logFd = fs10.openSync(logPath3, "w");
623769
- const npmPrefix = dirname38(nodeDir);
624335
+ const npmPrefix = dirname37(nodeDir);
623770
624336
  let globalBinDir = "";
623771
624337
  try {
623772
624338
  if (isWin2) {
@@ -623855,8 +624421,8 @@ async function handleV1Update(req2, res, requestId) {
623855
624421
  }
623856
624422
  let omniusAbs = "omnius";
623857
624423
  try {
623858
- const which2 = es("command -v omnius 2>/dev/null || which omnius 2>/dev/null", { encoding: "utf8", timeout: 2e3, stdio: "pipe", env: cleanEnv }).trim();
623859
- if (which2) omniusAbs = which2;
624424
+ const which3 = es("command -v omnius 2>/dev/null || which omnius 2>/dev/null", { encoding: "utf8", timeout: 2e3, stdio: "pipe", env: cleanEnv }).trim();
624425
+ if (which3) omniusAbs = which3;
623860
624426
  } catch {
623861
624427
  }
623862
624428
  const relaunchScript = [
@@ -625292,10 +625858,10 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
625292
625858
  return;
625293
625859
  }
625294
625860
  const { tmpdir: tmpdir23 } = await import("node:os");
625295
- const { writeFileSync: writeFileSync71, unlinkSync: unlinkSync26 } = await import("node:fs");
625861
+ const { writeFileSync: writeFileSync70, unlinkSync: unlinkSync26 } = await import("node:fs");
625296
625862
  const { join: pjoin } = await import("node:path");
625297
625863
  const tmpPath = pjoin(tmpdir23(), `omnius-clone-upload-${Date.now()}-${safeName2}`);
625298
- writeFileSync71(tmpPath, buf);
625864
+ writeFileSync70(tmpPath, buf);
625299
625865
  try {
625300
625866
  const ve = getVoiceEngine();
625301
625867
  const msg = await ve.setCloneVoice(tmpPath);
@@ -625887,7 +626453,7 @@ data: ${JSON.stringify(data)}
625887
626453
  }
625888
626454
  for (const f2 of seenFiles) {
625889
626455
  try {
625890
- writeFileSync66(f2, JSON.stringify({ tasks: [] }, null, 2));
626456
+ writeFileSync65(f2, JSON.stringify({ tasks: [] }, null, 2));
625891
626457
  deleted++;
625892
626458
  } catch {
625893
626459
  }
@@ -627094,11 +627660,11 @@ function setScheduledEnabled(id, enabled2) {
627094
627660
  arr[target.index].enabled = enabled2;
627095
627661
  if (Array.isArray(json?.tasks)) {
627096
627662
  json.tasks = arr;
627097
- writeFileSync66(target.file, JSON.stringify(json, null, 2));
627663
+ writeFileSync65(target.file, JSON.stringify(json, null, 2));
627098
627664
  } else if (Array.isArray(json)) {
627099
- writeFileSync66(target.file, JSON.stringify(arr, null, 2));
627665
+ writeFileSync65(target.file, JSON.stringify(arr, null, 2));
627100
627666
  } else {
627101
- writeFileSync66(target.file, JSON.stringify({ tasks: arr }, null, 2));
627667
+ writeFileSync65(target.file, JSON.stringify({ tasks: arr }, null, 2));
627102
627668
  }
627103
627669
  if (!enabled2) {
627104
627670
  try {
@@ -627128,11 +627694,11 @@ function deleteScheduledById(id) {
627128
627694
  arr.splice(target.index, 1);
627129
627695
  if (Array.isArray(json?.tasks)) {
627130
627696
  json.tasks = arr;
627131
- writeFileSync66(target.file, JSON.stringify(json, null, 2));
627697
+ writeFileSync65(target.file, JSON.stringify(json, null, 2));
627132
627698
  } else if (Array.isArray(json)) {
627133
- writeFileSync66(target.file, JSON.stringify(arr, null, 2));
627699
+ writeFileSync65(target.file, JSON.stringify(arr, null, 2));
627134
627700
  } else {
627135
- writeFileSync66(target.file, JSON.stringify({ tasks: arr }, null, 2));
627701
+ writeFileSync65(target.file, JSON.stringify({ tasks: arr }, null, 2));
627136
627702
  }
627137
627703
  const candidates = [];
627138
627704
  if (id) candidates.push(id);
@@ -627402,7 +627968,7 @@ function reconcileScheduledTasks(apply) {
627402
627968
  const toWrite = Array.isArray(json?.tasks) ? { ...json, tasks: arr } : Array.isArray(json) ? arr : { tasks: arr };
627403
627969
  mkdirSync72(join135(wdir, ".omnius", "scheduled"), { recursive: true });
627404
627970
  mkdirSync72(join135(wdir, ".omnius", "scheduled", "logs"), { recursive: true });
627405
- writeFileSync66(file, JSON.stringify(toWrite, null, 2));
627971
+ writeFileSync65(file, JSON.stringify(toWrite, null, 2));
627406
627972
  adopted.push({ file, index: arr.length - 1 });
627407
627973
  }
627408
627974
  } else {
@@ -627536,8 +628102,8 @@ WantedBy=timers.target
627536
628102
  `;
627537
628103
  if (!dryRun) {
627538
628104
  mkdirSync72(unitDir, { recursive: true });
627539
- writeFileSync66(svc, svcText);
627540
- writeFileSync66(tim, timText);
628105
+ writeFileSync65(svc, svcText);
628106
+ writeFileSync65(tim, timText);
627541
628107
  try {
627542
628108
  const { execSync: es } = require4("node:child_process");
627543
628109
  es("systemctl --user daemon-reload", { stdio: "pipe" });
@@ -627860,7 +628426,7 @@ function startApiServer(options2 = {}) {
627860
628426
  try {
627861
628427
  const dir = join135(homedir45(), ".omnius");
627862
628428
  mkdirSync72(dir, { recursive: true });
627863
- writeFileSync66(join135(dir, "access"), `${runtimeAccessMode}
628429
+ writeFileSync65(join135(dir, "access"), `${runtimeAccessMode}
627864
628430
  `, "utf8");
627865
628431
  } catch {
627866
628432
  }
@@ -628153,7 +628719,7 @@ function startApiServer(options2 = {}) {
628153
628719
  return;
628154
628720
  }
628155
628721
  try {
628156
- const { writeFileSync: writeFileSync71, mkdirSync: mkdirSync77, existsSync: _exists, readFileSync: _rfs } = require4("node:fs");
628722
+ const { writeFileSync: writeFileSync70, mkdirSync: mkdirSync77, existsSync: _exists, readFileSync: _rfs } = require4("node:fs");
628157
628723
  const { join: _join } = require4("node:path");
628158
628724
  const { homedir: _homedir } = require4("node:os");
628159
628725
  const apiHint = JSON.stringify({
@@ -628183,7 +628749,7 @@ function startApiServer(options2 = {}) {
628183
628749
  for (const dir of dirSet) {
628184
628750
  try {
628185
628751
  if (!_exists(dir)) mkdirSync77(dir, { recursive: true });
628186
- writeFileSync71(_join(dir, "api-port.json"), apiHint);
628752
+ writeFileSync70(_join(dir, "api-port.json"), apiHint);
628187
628753
  written++;
628188
628754
  } catch {
628189
628755
  }
@@ -628657,8 +629223,8 @@ var clipboard_media_exports = {};
628657
629223
  __export(clipboard_media_exports, {
628658
629224
  pasteClipboardImageToFile: () => pasteClipboardImageToFile
628659
629225
  });
628660
- import { execFileSync as execFileSync6, execSync as execSync58 } from "node:child_process";
628661
- import { mkdirSync as mkdirSync73, readFileSync as readFileSync99, rmSync as rmSync5, writeFileSync as writeFileSync67 } from "node:fs";
629226
+ import { execFileSync as execFileSync7, execSync as execSync58 } from "node:child_process";
629227
+ import { mkdirSync as mkdirSync73, readFileSync as readFileSync99, rmSync as rmSync5, writeFileSync as writeFileSync66 } from "node:fs";
628662
629228
  import { join as join136 } from "node:path";
628663
629229
  function pasteClipboardImageToFile(repoRoot) {
628664
629230
  const image = readClipboardImage();
@@ -628666,7 +629232,7 @@ function pasteClipboardImageToFile(repoRoot) {
628666
629232
  const dir = join136(repoRoot, ".omnius", "clipboard");
628667
629233
  mkdirSync73(dir, { recursive: true });
628668
629234
  const path11 = join136(dir, `clipboard-${Date.now()}${image.ext}`);
628669
- writeFileSync67(path11, image.buffer);
629235
+ writeFileSync66(path11, image.buffer);
628670
629236
  return { path: path11, buffer: image.buffer, mime: image.mime };
628671
629237
  }
628672
629238
  function readClipboardImage() {
@@ -628674,7 +629240,7 @@ function readClipboardImage() {
628674
629240
  try {
628675
629241
  execSync58("command -v pngpaste", { stdio: "ignore", timeout: 1e3 });
628676
629242
  const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
628677
- execFileSync6("pngpaste", [tmp], { timeout: 3e3 });
629243
+ execFileSync7("pngpaste", [tmp], { timeout: 3e3 });
628678
629244
  const buffer2 = readFileSync99(tmp);
628679
629245
  try {
628680
629246
  rmSync5(tmp);
@@ -628694,7 +629260,7 @@ function readClipboardImage() {
628694
629260
  ];
628695
629261
  for (const attempt of attempts) {
628696
629262
  try {
628697
- const buffer2 = execFileSync6(attempt.cmd, attempt.args, { timeout: 3e3, maxBuffer: 25 * 1024 * 1024 });
629263
+ const buffer2 = execFileSync7(attempt.cmd, attempt.args, { timeout: 3e3, maxBuffer: 25 * 1024 * 1024 });
628698
629264
  if (buffer2.length > 0) return { buffer: buffer2, mime: attempt.mime, ext: attempt.ext };
628699
629265
  } catch {
628700
629266
  continue;
@@ -628711,7 +629277,7 @@ function readClipboardImage() {
628711
629277
  "$img.Save($ms,[Drawing.Imaging.ImageFormat]::Png);",
628712
629278
  "[Console]::OpenStandardOutput().Write($ms.ToArray(),0,$ms.Length)"
628713
629279
  ].join("");
628714
- const buffer2 = execFileSync6("powershell.exe", ["-NoProfile", "-Command", ps], {
629280
+ const buffer2 = execFileSync7("powershell.exe", ["-NoProfile", "-Command", ps], {
628715
629281
  timeout: 5e3,
628716
629282
  maxBuffer: 25 * 1024 * 1024
628717
629283
  });
@@ -628730,12 +629296,12 @@ var init_clipboard_media = __esm({
628730
629296
 
628731
629297
  // packages/cli/src/tui/interactive.ts
628732
629298
  import { cwd } from "node:process";
628733
- import { resolve as resolve45, join as join137, dirname as dirname39, extname as extname16, relative as relative14 } from "node:path";
629299
+ import { resolve as resolve45, join as join137, dirname as dirname38, extname as extname16, relative as relative14 } from "node:path";
628734
629300
  import { createRequire as createRequire8 } from "node:module";
628735
629301
  import { fileURLToPath as fileURLToPath18 } from "node:url";
628736
629302
  import {
628737
629303
  readFileSync as readFileSync100,
628738
- writeFileSync as writeFileSync68,
629304
+ writeFileSync as writeFileSync67,
628739
629305
  appendFileSync as appendFileSync8,
628740
629306
  rmSync as rmSync6,
628741
629307
  readdirSync as readdirSync42,
@@ -628757,7 +629323,7 @@ function formatTimeAgo2(date) {
628757
629323
  function getVersion4() {
628758
629324
  try {
628759
629325
  const require5 = createRequire8(import.meta.url);
628760
- const thisDir = dirname39(fileURLToPath18(import.meta.url));
629326
+ const thisDir = dirname38(fileURLToPath18(import.meta.url));
628761
629327
  const candidates = [
628762
629328
  join137(thisDir, "..", "package.json"),
628763
629329
  join137(thisDir, "..", "..", "package.json"),
@@ -631476,7 +632042,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
631476
632042
  }
631477
632043
  ikState.session_count = (ikState.session_count || 0) + 1;
631478
632044
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
631479
- writeFileSync68(ikFile, JSON.stringify(ikState, null, 2));
632045
+ writeFileSync67(ikFile, JSON.stringify(ikState, null, 2));
631480
632046
  } catch (ikErr) {
631481
632047
  try {
631482
632048
  console.error("[IK-OBSERVE]", ikErr);
@@ -631532,7 +632098,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
631532
632098
  ikState.version_history = ikState.version_history.slice(-200);
631533
632099
  ikState.session_count = (ikState.session_count || 0) + 1;
631534
632100
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
631535
- writeFileSync68(ikFile, JSON.stringify(ikState, null, 2));
632101
+ writeFileSync67(ikFile, JSON.stringify(ikState, null, 2));
631536
632102
  }
631537
632103
  } catch {
631538
632104
  }
@@ -633144,7 +633710,7 @@ This is an independent background session started from /background.`
633144
633710
  if (Math.random() < 0.02) {
633145
633711
  const all2 = readFileSync100(HISTORY_FILE, "utf8").trim().split("\n");
633146
633712
  if (all2.length > MAX_HISTORY_LINES) {
633147
- writeFileSync68(
633713
+ writeFileSync67(
633148
633714
  HISTORY_FILE,
633149
633715
  all2.slice(-MAX_HISTORY_LINES).join("\n") + "\n",
633150
633716
  "utf8"
@@ -634014,7 +634580,7 @@ Log: ${nexusLogPath}`)
634014
634580
  sessionTitle = title.trim() || null;
634015
634581
  try {
634016
634582
  mkdirSync74(join137(repoRoot, ".omnius"), { recursive: true });
634017
- writeFileSync68(join137(repoRoot, ".omnius", "session-title"), `${sessionTitle ?? ""}
634583
+ writeFileSync67(join137(repoRoot, ".omnius", "session-title"), `${sessionTitle ?? ""}
634018
634584
  `, "utf8");
634019
634585
  } catch {
634020
634586
  }
@@ -635291,14 +635857,14 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
635291
635857
  throw err;
635292
635858
  }
635293
635859
  },
635294
- async exposeStop(which2) {
635295
- if (!which2 || which2 === "tunnel") {
635860
+ async exposeStop(which3) {
635861
+ if (!which3 || which3 === "tunnel") {
635296
635862
  if (tunnelGateway) {
635297
635863
  await tunnelGateway.stop();
635298
635864
  tunnelGateway = null;
635299
635865
  }
635300
635866
  }
635301
- if (!which2 || which2 === "libp2p") {
635867
+ if (!which3 || which3 === "libp2p") {
635302
635868
  if (p2pGateway) {
635303
635869
  await p2pGateway.stop();
635304
635870
  p2pGateway = null;
@@ -636629,8 +637195,8 @@ NEW TASK: ${fullInput}`;
636629
637195
  const updateInfo = await checkForUpdate(version4);
636630
637196
  if (updateInfo) {
636631
637197
  _autoUpdatedThisSession = true;
636632
- const { exec: exec5 } = await import("node:child_process");
636633
- exec5(
637198
+ const { exec: exec4 } = await import("node:child_process");
637199
+ exec4(
636634
637200
  `npm install -g omnius@latest --prefer-online`,
636635
637201
  { timeout: 18e4 },
636636
637202
  (err) => {
@@ -637013,7 +637579,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
637013
637579
  );
637014
637580
  ikState.session_count = (ikState.session_count || 0) + 1;
637015
637581
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
637016
- writeFileSync68(ikFile, JSON.stringify(ikState, null, 2));
637582
+ writeFileSync67(ikFile, JSON.stringify(ikState, null, 2));
637017
637583
  } catch (ikErr) {
637018
637584
  }
637019
637585
  try {
@@ -637046,7 +637612,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
637046
637612
  });
637047
637613
  if (variants.length > 50) variants = variants.slice(-50);
637048
637614
  mkdirSync74(archeDir, { recursive: true });
637049
- writeFileSync68(archeFile, JSON.stringify(variants, null, 2));
637615
+ writeFileSync67(archeFile, JSON.stringify(variants, null, 2));
637050
637616
  } catch {
637051
637617
  }
637052
637618
  }
@@ -637077,7 +637643,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
637077
637643
  updated = true;
637078
637644
  }
637079
637645
  if (updated) {
637080
- writeFileSync68(metaFile, JSON.stringify(store2, null, 2));
637646
+ writeFileSync67(metaFile, JSON.stringify(store2, null, 2));
637081
637647
  }
637082
637648
  }
637083
637649
  } catch {
@@ -637186,7 +637752,7 @@ Rules:
637186
637752
  });
637187
637753
  if (store2.length > 100) store2 = store2.slice(-100);
637188
637754
  mkdirSync74(metaDir, { recursive: true });
637189
- writeFileSync68(storeFile, JSON.stringify(store2, null, 2));
637755
+ writeFileSync67(storeFile, JSON.stringify(store2, null, 2));
637190
637756
  }
637191
637757
  }
637192
637758
  } catch {
@@ -637250,7 +637816,7 @@ Rules:
637250
637816
  );
637251
637817
  ikState.session_count = (ikState.session_count || 0) + 1;
637252
637818
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
637253
- writeFileSync68(ikFile, JSON.stringify(ikState, null, 2));
637819
+ writeFileSync67(ikFile, JSON.stringify(ikState, null, 2));
637254
637820
  }
637255
637821
  const metaFile = join137(
637256
637822
  repoRoot,
@@ -637278,7 +637844,7 @@ Rules:
637278
637844
  (item.scores.confidence || 0.5) - 0.02
637279
637845
  );
637280
637846
  }
637281
- writeFileSync68(metaFile, JSON.stringify(store2, null, 2));
637847
+ writeFileSync67(metaFile, JSON.stringify(store2, null, 2));
637282
637848
  }
637283
637849
  try {
637284
637850
  const archeDir = join137(repoRoot, ".omnius", "arche");
@@ -637301,7 +637867,7 @@ Rules:
637301
637867
  });
637302
637868
  if (variants.length > 50) variants = variants.slice(-50);
637303
637869
  mkdirSync74(archeDir, { recursive: true });
637304
- writeFileSync68(archeFile, JSON.stringify(variants, null, 2));
637870
+ writeFileSync67(archeFile, JSON.stringify(variants, null, 2));
637305
637871
  } catch {
637306
637872
  }
637307
637873
  } catch {
@@ -637394,7 +637960,7 @@ __export(run_exports, {
637394
637960
  });
637395
637961
  import { resolve as resolve46 } from "node:path";
637396
637962
  import { spawn as spawn30 } from "node:child_process";
637397
- import { mkdirSync as mkdirSync75, writeFileSync as writeFileSync69, readFileSync as readFileSync101, readdirSync as readdirSync43, existsSync as existsSync122 } from "node:fs";
637963
+ import { mkdirSync as mkdirSync75, writeFileSync as writeFileSync68, readFileSync as readFileSync101, readdirSync as readdirSync43, existsSync as existsSync122 } from "node:fs";
637398
637964
  import { randomBytes as randomBytes25 } from "node:crypto";
637399
637965
  import { join as join138 } from "node:path";
637400
637966
  function jobsDir2(repoPath) {
@@ -637522,7 +638088,7 @@ async function runBackground(task, config, opts) {
637522
638088
  }
637523
638089
  });
637524
638090
  job.pid = child.pid ?? 0;
637525
- writeFileSync69(join138(dir, `${id}.json`), JSON.stringify(job, null, 2));
638091
+ writeFileSync68(join138(dir, `${id}.json`), JSON.stringify(job, null, 2));
637526
638092
  let output = "";
637527
638093
  child.stdout?.on("data", (chunk) => {
637528
638094
  output += chunk.toString();
@@ -637538,7 +638104,7 @@ async function runBackground(task, config, opts) {
637538
638104
  job.summary = result.summary;
637539
638105
  job.durationMs = result.durationMs;
637540
638106
  job.error = result.error;
637541
- writeFileSync69(join138(dir, `${id}.json`), JSON.stringify(job, null, 2));
638107
+ writeFileSync68(join138(dir, `${id}.json`), JSON.stringify(job, null, 2));
637542
638108
  } catch {
637543
638109
  }
637544
638110
  });
@@ -638170,7 +638736,7 @@ __export(eval_exports, {
638170
638736
  evalCommand: () => evalCommand
638171
638737
  });
638172
638738
  import { tmpdir as tmpdir22 } from "node:os";
638173
- import { mkdirSync as mkdirSync76, writeFileSync as writeFileSync70 } from "node:fs";
638739
+ import { mkdirSync as mkdirSync76, writeFileSync as writeFileSync69 } from "node:fs";
638174
638740
  import { join as join140 } from "node:path";
638175
638741
  async function evalCommand(opts, config) {
638176
638742
  const suiteName = opts.suite ?? "basic";
@@ -638302,7 +638868,7 @@ async function evalCommand(opts, config) {
638302
638868
  function createTempEvalRepo() {
638303
638869
  const dir = join140(tmpdir22(), `omnius-eval-${Date.now()}`);
638304
638870
  mkdirSync76(dir, { recursive: true });
638305
- writeFileSync70(
638871
+ writeFileSync69(
638306
638872
  join140(dir, "package.json"),
638307
638873
  JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n",
638308
638874
  "utf8"
@@ -638367,7 +638933,7 @@ init_typed_node_events();
638367
638933
  import { parseArgs as nodeParseArgs2 } from "node:util";
638368
638934
  import { createRequire as createRequire9 } from "node:module";
638369
638935
  import { fileURLToPath as fileURLToPath19 } from "node:url";
638370
- import { dirname as dirname40, join as join141 } from "node:path";
638936
+ import { dirname as dirname39, join as join141 } from "node:path";
638371
638937
 
638372
638938
  // packages/cli/src/cli.ts
638373
638939
  init_typed_node_events();
@@ -638507,7 +639073,7 @@ init_output();
638507
639073
  function getVersion5() {
638508
639074
  try {
638509
639075
  const require5 = createRequire9(import.meta.url);
638510
- const pkgPath = join141(dirname40(fileURLToPath19(import.meta.url)), "..", "package.json");
639076
+ const pkgPath = join141(dirname39(fileURLToPath19(import.meta.url)), "..", "package.json");
638511
639077
  const pkg = require5(pkgPath);
638512
639078
  return pkg.version;
638513
639079
  } catch {