vibeostheog 0.25.5 → 0.25.6

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.
@@ -1 +1,5 @@
1
- window.__VIBEOS_DASHBOARD_BASE__ = "http://127.0.0.1:59486";
1
+ <<<<<<< HEAD
2
+ window.__VIBEOS_DASHBOARD_BASE__ = "http://127.0.0.1:53142";
3
+ =======
4
+ window.__VIBEOS_DASHBOARD_BASE__ = "http://127.0.0.1:60078";
5
+ >>>>>>> fix/flash-icon
package/dist/vibeOS.js CHANGED
@@ -485,10 +485,6 @@ function resetApiConnection() {
485
485
  state.apiFallbackMode = false;
486
486
  state.apiFallbackSince = null;
487
487
  }
488
- function isApiConnected() {
489
- const state = getRuntimeState();
490
- return state.apiConnected && !state.apiFallbackMode;
491
- }
492
488
  var RUNTIME_KEY;
493
489
  var init_runtime_state = __esm({
494
490
  "src/lib/runtime-state.js"() {
@@ -498,7 +494,7 @@ var init_runtime_state = __esm({
498
494
  });
499
495
 
500
496
  // src/lib/selection-manager.js
501
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync4, existsSync as existsSync4, statSync as statSync3, renameSync as renameSync2 } from "node:fs";
497
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync4, statSync as statSync3, renameSync as renameSync2 } from "node:fs";
502
498
  import { join as join3 } from "node:path";
503
499
  import { homedir as homedir2, tmpdir } from "node:os";
504
500
  function getVibeOSHome2() {
@@ -567,7 +563,7 @@ function writeSelection(key, value) {
567
563
  j.selection = {};
568
564
  j.selection[key] = value;
569
565
  const tmp = TIERS_FILE3 + ".tmp." + Date.now() + "." + Math.random().toString(36).slice(2, 8);
570
- writeFileSync4(tmp, JSON.stringify(j, null, 2) + "\n");
566
+ writeFileSync3(tmp, JSON.stringify(j, null, 2) + "\n");
571
567
  renameSync2(tmp, TIERS_FILE3);
572
568
  return true;
573
569
  });
@@ -597,7 +593,7 @@ function writeSessionSlot2(sid, slot) {
597
593
  j.sessions[sid] = {};
598
594
  j.sessions[sid].active_slot = slot;
599
595
  const tmp = BLACKBOX_FILE + ".tmp";
600
- writeFileSync4(tmp, JSON.stringify(j, null, 2) + "\n");
596
+ writeFileSync3(tmp, JSON.stringify(j, null, 2) + "\n");
601
597
  renameSync2(tmp, BLACKBOX_FILE);
602
598
  return true;
603
599
  } catch (err) {
@@ -637,7 +633,7 @@ function writeSessionOptMode2(sid, mode) {
637
633
  j.sessions[sid] = {};
638
634
  j.sessions[sid].optimization_mode = mode;
639
635
  const tmp = BLACKBOX_FILE + ".tmp";
640
- writeFileSync4(tmp, JSON.stringify(j, null, 2) + "\n");
636
+ writeFileSync3(tmp, JSON.stringify(j, null, 2) + "\n");
641
637
  renameSync2(tmp, BLACKBOX_FILE);
642
638
  return true;
643
639
  } catch (err) {
@@ -1395,7 +1391,7 @@ var init_smart_cache = __esm({
1395
1391
  });
1396
1392
 
1397
1393
  // src/lib/state.js
1398
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync5, appendFileSync as appendFileSync2, existsSync as existsSync5, mkdirSync as mkdirSync4, statSync as statSync4, readdirSync, openSync, readSync, closeSync, rmSync as rmSync2, copyFileSync, renameSync as renameSync3 } from "node:fs";
1394
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, appendFileSync as appendFileSync2, existsSync as existsSync5, mkdirSync as mkdirSync3, statSync as statSync4, readdirSync, openSync, readSync, closeSync, rmSync as rmSync2, copyFileSync, renameSync as renameSync3 } from "node:fs";
1399
1395
  import { join as join4, dirname as dirname4, basename as basename2 } from "node:path";
1400
1396
  import { spawn } from "node:child_process";
1401
1397
  import { homedir as homedir3, tmpdir as tmpdir2 } from "node:os";
@@ -1499,14 +1495,14 @@ function runStartupMaintenanceOnce() {
1499
1495
  function _ensureVibeOSHomeDir() {
1500
1496
  try {
1501
1497
  if (!existsSync5(VIBEOS_HOME)) {
1502
- mkdirSync4(VIBEOS_HOME, { recursive: true });
1498
+ mkdirSync3(VIBEOS_HOME, { recursive: true });
1503
1499
  return VIBEOS_HOME;
1504
1500
  }
1505
1501
  const st = statSync4(VIBEOS_HOME);
1506
1502
  if (!st.isDirectory()) {
1507
1503
  const backup = VIBEOS_HOME + ".backup." + Date.now();
1508
1504
  renameSync3(VIBEOS_HOME, backup);
1509
- mkdirSync4(VIBEOS_HOME, { recursive: true });
1505
+ mkdirSync3(VIBEOS_HOME, { recursive: true });
1510
1506
  }
1511
1507
  return VIBEOS_HOME;
1512
1508
  } catch {
@@ -1517,7 +1513,7 @@ function _handleStateCorruption2(path) {
1517
1513
  _ensureVibeOSHomeDir();
1518
1514
  const backupDir = join4(VIBEOS_HOME, ".backups");
1519
1515
  try {
1520
- mkdirSync4(backupDir, { recursive: true });
1516
+ mkdirSync3(backupDir, { recursive: true });
1521
1517
  } catch {
1522
1518
  }
1523
1519
  const backupPath = join4(backupDir, basename2(path) + ".corrupted." + Date.now());
@@ -1544,10 +1540,10 @@ function withFileLock(filePath, fn, opts = {}) {
1544
1540
  const start = Date.now();
1545
1541
  while (Date.now() - start < timeoutMs) {
1546
1542
  try {
1547
- mkdirSync4(FILE_LOCK_DIR, { recursive: true });
1543
+ mkdirSync3(FILE_LOCK_DIR, { recursive: true });
1548
1544
  const fd = openSync(lockPath, "wx");
1549
1545
  try {
1550
- writeFileSync5(fd, `${process.pid}
1546
+ writeFileSync4(fd, `${process.pid}
1551
1547
  ${Date.now()}
1552
1548
  `);
1553
1549
  } catch {
@@ -1652,9 +1648,9 @@ function updateState(mutator) {
1652
1648
  state._gen = preGen + 1;
1653
1649
  const next = mutator(state) ?? state;
1654
1650
  validateState(next, delegationStateFile);
1655
- mkdirSync4(dirname4(delegationStateFile), { recursive: true });
1651
+ mkdirSync3(dirname4(delegationStateFile), { recursive: true });
1656
1652
  const tmp = delegationStateFile + ".tmp";
1657
- writeFileSync5(tmp, JSON.stringify(next, null, 2) + "\n");
1653
+ writeFileSync4(tmp, JSON.stringify(next, null, 2) + "\n");
1658
1654
  renameSync3(tmp, delegationStateFile);
1659
1655
  invalidateSavingsCache();
1660
1656
  return next;
@@ -1743,9 +1739,9 @@ function updateGlobalLearning(mutator) {
1743
1739
  const s = loadGlobalLearning();
1744
1740
  const next = mutator(s) ?? s;
1745
1741
  next.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
1746
- mkdirSync4(dirname4(globalLearningFile), { recursive: true });
1742
+ mkdirSync3(dirname4(globalLearningFile), { recursive: true });
1747
1743
  const tmp = globalLearningFile + ".tmp";
1748
- writeFileSync5(tmp, JSON.stringify(next, null, 2));
1744
+ writeFileSync4(tmp, JSON.stringify(next, null, 2));
1749
1745
  renameSync3(tmp, globalLearningFile);
1750
1746
  return next;
1751
1747
  });
@@ -1833,9 +1829,9 @@ function saveBlackboxState(state) {
1833
1829
  continue;
1834
1830
  next.sessions[sid] = normalizeBlackboxRecord(session, sid, now).record;
1835
1831
  }
1836
- mkdirSync4(dirname4(blackboxFile), { recursive: true });
1832
+ mkdirSync3(dirname4(blackboxFile), { recursive: true });
1837
1833
  const tmp = blackboxFile + ".tmp";
1838
- writeFileSync5(tmp, JSON.stringify(next, null, 2) + "\n");
1834
+ writeFileSync4(tmp, JSON.stringify(next, null, 2) + "\n");
1839
1835
  renameSync3(tmp, blackboxFile);
1840
1836
  } catch (err) {
1841
1837
  console.error(`[vibeOS] saveBlackboxState failed: ${err.message}`);
@@ -1930,7 +1926,7 @@ function getGlobalIndexPath() {
1930
1926
  }
1931
1927
  function ensureSessionScratchpadDirs() {
1932
1928
  try {
1933
- mkdirSync4(getSessionScratchpadDir(), { recursive: true });
1929
+ mkdirSync3(getSessionScratchpadDir(), { recursive: true });
1934
1930
  return true;
1935
1931
  } catch {
1936
1932
  return false;
@@ -2122,8 +2118,8 @@ function indexAppend(hash, tool2, size, extra) {
2122
2118
  const entry = JSON.stringify(entryObj) + "\n";
2123
2119
  const globalIndex = getGlobalIndexPath();
2124
2120
  const sessionIndex = getSessionIndexPath();
2125
- mkdirSync4(dirname4(globalIndex), { recursive: true });
2126
- mkdirSync4(dirname4(sessionIndex), { recursive: true });
2121
+ mkdirSync3(dirname4(globalIndex), { recursive: true });
2122
+ mkdirSync3(dirname4(sessionIndex), { recursive: true });
2127
2123
  appendFileSync2(globalIndex, entry);
2128
2124
  appendFileSync2(sessionIndex, entry);
2129
2125
  } catch (err) {
@@ -2295,13 +2291,13 @@ function _pruneScratchpadDir(targetDir, opts = {}) {
2295
2291
  if (!existsSync5(summaryPath))
2296
2292
  try {
2297
2293
  const content = readFileSync4(fullPath, "utf-8");
2298
- writeFileSync5(summaryPath, content.slice(0, 200).replace(/\n+/g, " ").trim() + (content.length > 200 ? "\u2026" : ""));
2294
+ writeFileSync4(summaryPath, content.slice(0, 200).replace(/\n+/g, " ").trim() + (content.length > 200 ? "\u2026" : ""));
2299
2295
  } catch {
2300
2296
  }
2301
2297
  const head = _readHead(fullPath);
2302
2298
  if (!head.includes("[cold-storage]"))
2303
2299
  try {
2304
- writeFileSync5(fullPath, `[cold-storage] ${st.size}B original \u2192 ${hash}.summary.txt`);
2300
+ writeFileSync4(fullPath, `[cold-storage] ${st.size}B original \u2192 ${hash}.summary.txt`);
2305
2301
  rotated++;
2306
2302
  } catch {
2307
2303
  }
@@ -2312,13 +2308,13 @@ function _pruneScratchpadDir(targetDir, opts = {}) {
2312
2308
  if (!existsSync5(summaryPath))
2313
2309
  try {
2314
2310
  const content = readFileSync4(fullPath, "utf-8");
2315
- writeFileSync5(summaryPath, content.slice(0, SUMMARY_HEAD_TRUNCATE).replace(/\n+/g, " ").trim() + (content.length > SUMMARY_HEAD_TRUNCATE ? "\u2026" : ""));
2311
+ writeFileSync4(summaryPath, content.slice(0, SUMMARY_HEAD_TRUNCATE).replace(/\n+/g, " ").trim() + (content.length > SUMMARY_HEAD_TRUNCATE ? "\u2026" : ""));
2316
2312
  } catch {
2317
2313
  }
2318
2314
  const head = _readHead(fullPath);
2319
2315
  if (!head.includes("[warm-storage]") && !head.includes("[cold-storage]"))
2320
2316
  try {
2321
- writeFileSync5(fullPath, `[warm-storage] ${st.size}B original at ${hash}.summary.txt`);
2317
+ writeFileSync4(fullPath, `[warm-storage] ${st.size}B original at ${hash}.summary.txt`);
2322
2318
  rotated++;
2323
2319
  } catch {
2324
2320
  }
@@ -2390,9 +2386,9 @@ function _readActiveJobsRaw() {
2390
2386
  }
2391
2387
  function _writeActiveJobsRaw(jobs) {
2392
2388
  try {
2393
- mkdirSync4(dirname4(ACTIVE_JOBS_FILE), { recursive: true });
2389
+ mkdirSync3(dirname4(ACTIVE_JOBS_FILE), { recursive: true });
2394
2390
  const tmp = ACTIVE_JOBS_FILE + ".tmp";
2395
- writeFileSync5(tmp, JSON.stringify(jobs, null, 2) + "\n");
2391
+ writeFileSync4(tmp, JSON.stringify(jobs, null, 2) + "\n");
2396
2392
  renameSync3(tmp, ACTIVE_JOBS_FILE);
2397
2393
  } catch {
2398
2394
  }
@@ -2500,9 +2496,9 @@ function saveProjectState(state) {
2500
2496
  const projectStateFile = join4(getVibeOSHome3(), "project-states.json");
2501
2497
  try {
2502
2498
  withFileLock(projectStateFile, () => {
2503
- mkdirSync4(dirname4(projectStateFile), { recursive: true });
2499
+ mkdirSync3(dirname4(projectStateFile), { recursive: true });
2504
2500
  const _tmp = projectStateFile + ".tmp." + Date.now();
2505
- writeFileSync5(_tmp, JSON.stringify(state, null, 2) + "\n", "utf-8");
2501
+ writeFileSync4(_tmp, JSON.stringify(state, null, 2) + "\n", "utf-8");
2506
2502
  renameSync3(_tmp, projectStateFile);
2507
2503
  });
2508
2504
  } catch (err) {
@@ -2793,9 +2789,9 @@ function loadTodos() {
2793
2789
  }
2794
2790
  function saveTodos(todos) {
2795
2791
  try {
2796
- mkdirSync4(dirname4(TODOS_FILE), { recursive: true });
2792
+ mkdirSync3(dirname4(TODOS_FILE), { recursive: true });
2797
2793
  const tmp = TODOS_FILE + ".tmp." + Date.now();
2798
- writeFileSync5(tmp, JSON.stringify(todos, null, 2), "utf-8");
2794
+ writeFileSync4(tmp, JSON.stringify(todos, null, 2), "utf-8");
2799
2795
  renameSync3(tmp, TODOS_FILE);
2800
2796
  } catch {
2801
2797
  }
@@ -2876,7 +2872,7 @@ function _compactSavingsLedgerIfNeeded() {
2876
2872
  const compacted = kept.reverse().join("\n") + "\n";
2877
2873
  if (compacted.trim() && compacted !== raw) {
2878
2874
  const tmp = SAVINGS_LEDGER_FILE + ".tmp." + Date.now();
2879
- writeFileSync5(tmp, compacted, "utf-8");
2875
+ writeFileSync4(tmp, compacted, "utf-8");
2880
2876
  renameSync3(tmp, SAVINGS_LEDGER_FILE);
2881
2877
  }
2882
2878
  }, { timeoutMs: 4e3 });
@@ -3074,9 +3070,9 @@ function saveSessionCheckpoint() {
3074
3070
  model: session.model || ""
3075
3071
  };
3076
3072
  const cpPath = join4(getSessionRoot(), "checkpoint.json");
3077
- mkdirSync4(dirname4(cpPath), { recursive: true });
3073
+ mkdirSync3(dirname4(cpPath), { recursive: true });
3078
3074
  const tmp = cpPath + ".tmp";
3079
- writeFileSync5(tmp, JSON.stringify(cp, null, 2) + "\n");
3075
+ writeFileSync4(tmp, JSON.stringify(cp, null, 2) + "\n");
3080
3076
  renameSync3(tmp, cpPath);
3081
3077
  } catch {
3082
3078
  }
@@ -3430,7 +3426,7 @@ var init_meta_controller = __esm({
3430
3426
  });
3431
3427
 
3432
3428
  // src/vibeOS-lib/blackbox/pivot-cache.js
3433
- import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync6, writeFileSync as writeFileSync7 } from "node:fs";
3429
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "node:fs";
3434
3430
  import { join as join6, dirname as dirname6 } from "node:path";
3435
3431
  import { homedir as homedir5 } from "node:os";
3436
3432
  var PivotCache;
@@ -3468,8 +3464,8 @@ var init_pivot_cache = __esm({
3468
3464
  const p = this._storePath();
3469
3465
  const dir = dirname6(p);
3470
3466
  if (!existsSync7(dir))
3471
- mkdirSync6(dir, { recursive: true });
3472
- writeFileSync7(p, JSON.stringify(this.store, null, 2), "utf-8");
3467
+ mkdirSync5(dir, { recursive: true });
3468
+ writeFileSync6(p, JSON.stringify(this.store, null, 2), "utf-8");
3473
3469
  } catch {
3474
3470
  }
3475
3471
  }
@@ -3639,7 +3635,7 @@ __export(vibemax_exports, {
3639
3635
  vibemaxPipeline: () => vibemaxPipeline,
3640
3636
  vibemaxSelectMode: () => vibemaxSelectMode
3641
3637
  });
3642
- import { existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync7, writeFileSync as writeFileSync8 } from "node:fs";
3638
+ import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync7 } from "node:fs";
3643
3639
  import { resolve as resolve2, dirname as dirname7 } from "node:path";
3644
3640
  import { fileURLToPath as fileURLToPath4 } from "node:url";
3645
3641
  function fallback(sr, text) {
@@ -3921,8 +3917,8 @@ function loadVibeMaXModel() {
3921
3917
  return null;
3922
3918
  }
3923
3919
  function saveVibeMaXModel(model) {
3924
- mkdirSync7(dirname7(MODEL_PATH), { recursive: true });
3925
- writeFileSync8(MODEL_PATH, JSON.stringify(model, null, 2) + "\n", "utf-8");
3920
+ mkdirSync6(dirname7(MODEL_PATH), { recursive: true });
3921
+ writeFileSync7(MODEL_PATH, JSON.stringify(model, null, 2) + "\n", "utf-8");
3926
3922
  }
3927
3923
  function getVibeMaXModelMeta() {
3928
3924
  const m = loadVibeMaXModel();
@@ -4090,7 +4086,7 @@ var init_vibeultrax = __esm({
4090
4086
 
4091
4087
  // src/index.ts
4092
4088
  init_flow_enforcer();
4093
- import { readFileSync as readFileSync17, writeFileSync as writeFileSync16, existsSync as existsSync18, mkdirSync as mkdirSync14, copyFileSync as copyFileSync2, renameSync as renameSync6, statSync as statSync9 } from "node:fs";
4089
+ import { readFileSync as readFileSync17, writeFileSync as writeFileSync15, existsSync as existsSync18, mkdirSync as mkdirSync13, copyFileSync as copyFileSync2, renameSync as renameSync6, statSync as statSync9 } from "node:fs";
4094
4090
  import { join as join18, dirname as dirname13, basename as basename5 } from "node:path";
4095
4091
 
4096
4092
  // src/vibeOS-lib/session-metrics.js
@@ -4236,7 +4232,7 @@ function computeSessionMetrics(state, sessionId) {
4236
4232
  // src/lib/vibeos-mcp-server.js
4237
4233
  import http from "node:http";
4238
4234
  import { parse as parseUrl } from "node:url";
4239
- import { createReadStream, existsSync as existsSync2, mkdirSync as mkdirSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
4235
+ import { createReadStream, existsSync as existsSync2, statSync as statSync2 } from "node:fs";
4240
4236
  import { extname, join as join2, dirname as dirname2 } from "node:path";
4241
4237
  import { fileURLToPath as fileURLToPath2 } from "node:url";
4242
4238
  var MIME_MAP = {
@@ -4282,9 +4278,7 @@ var _MCP_FILENAME = fileURLToPath2(import.meta.url);
4282
4278
  var _MCP_DIR = dirname2(_MCP_FILENAME);
4283
4279
  function resolveDashboardDir() {
4284
4280
  const c = [
4285
- join2(_MCP_DIR, "dashboard", "dist"),
4286
- join2(_MCP_DIR, "assets", "dashboard"),
4287
- join2(_MCP_DIR, "assets", "dashboard", "dist")
4281
+ join2(_MCP_DIR, "dashboard", "dist")
4288
4282
  ];
4289
4283
  for (const p of c) {
4290
4284
  if (existsSync2(join2(p, "index.html")))
@@ -4293,20 +4287,6 @@ function resolveDashboardDir() {
4293
4287
  return c[0];
4294
4288
  }
4295
4289
  var DASHBOARD_DIR = resolveDashboardDir();
4296
- var DASHBOARD_CONFIG_PATH = join2(DASHBOARD_DIR, "vibeos-dashboard-config.js");
4297
- function writeDashboardBaseConfig(baseUrl) {
4298
- try {
4299
- if (!baseUrl)
4300
- return null;
4301
- mkdirSync2(DASHBOARD_DIR, { recursive: true });
4302
- const payload = `window.__VIBEOS_DASHBOARD_BASE__ = ${JSON.stringify(baseUrl.replace(/\/$/, ""))};
4303
- `;
4304
- writeFileSync2(DASHBOARD_CONFIG_PATH, payload, "utf-8");
4305
- return DASHBOARD_CONFIG_PATH;
4306
- } catch {
4307
- return null;
4308
- }
4309
- }
4310
4290
  function resolveBackendHealthUrl() {
4311
4291
  const explicit = process.env.VIBEOS_BACKEND_HEALTH_URL?.trim();
4312
4292
  if (explicit)
@@ -4633,7 +4613,7 @@ function createMcpServer(deps) {
4633
4613
 
4634
4614
  // src/lib/api-client.js
4635
4615
  init_runtime_state();
4636
- import { readFileSync as readFileSync2, writeFileSync as writeFileSync3, existsSync as existsSync3, mkdirSync as mkdirSync3, rmSync } from "node:fs";
4616
+ import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync3, mkdirSync as mkdirSync2, rmSync } from "node:fs";
4637
4617
  import { dirname as dirname3 } from "node:path";
4638
4618
  import { fileURLToPath as fileURLToPath3 } from "node:url";
4639
4619
  import { homedir } from "node:os";
@@ -4779,8 +4759,8 @@ function persistPrimaryApiEnvState(next) {
4779
4759
  }
4780
4760
  const parentDir = _envPaths[0];
4781
4761
  if (!existsSync3(parentDir))
4782
- mkdirSync3(parentDir, { recursive: true });
4783
- writeFileSync3(primaryPath, envContent.endsWith("\n") ? envContent : envContent + "\n", "utf8");
4762
+ mkdirSync2(parentDir, { recursive: true });
4763
+ writeFileSync2(primaryPath, envContent.endsWith("\n") ? envContent : envContent + "\n", "utf8");
4784
4764
  } catch (diskErr) {
4785
4765
  console.error("[vibeOS] Failed to persist API env state:", diskErr.message);
4786
4766
  }
@@ -5154,8 +5134,8 @@ function persistBootstrapToken(token) {
5154
5134
  }
5155
5135
  const parentDir = _envPaths[0];
5156
5136
  if (!existsSync3(parentDir))
5157
- mkdirSync3(parentDir, { recursive: true });
5158
- writeFileSync3(_bootstrapEnvPath, `VIBEOS_API_BOOTSTRAP_TOKEN=${clean}
5137
+ mkdirSync2(parentDir, { recursive: true });
5138
+ writeFileSync2(_bootstrapEnvPath, `VIBEOS_API_BOOTSTRAP_TOKEN=${clean}
5159
5139
  `, "utf8");
5160
5140
  } catch (diskErr) {
5161
5141
  console.error("[vibeOS] Failed to persist alpha bootstrap token:", diskErr.message);
@@ -5211,7 +5191,6 @@ function setApiBootstrapToken(newToken) {
5211
5191
  }
5212
5192
  }
5213
5193
  var _apiClient = null;
5214
- var _startupProbeDone = false;
5215
5194
  var _apiFallbackMode = false;
5216
5195
  var _apiFallbackSince = null;
5217
5196
  var _bootstrapExchangeInFlight = null;
@@ -5230,16 +5209,6 @@ function tryResetFallbackCooldown() {
5230
5209
  }
5231
5210
  return false;
5232
5211
  }
5233
- function confirmReconnection() {
5234
- _apiFallbackMode = false;
5235
- _apiFallbackSince = null;
5236
- markApiConnected();
5237
- console.warn("[vibeOS] API reconnected \u2014 health probe passed");
5238
- }
5239
- function denyReconnection(detail) {
5240
- _apiFallbackSince = (/* @__PURE__ */ new Date()).toISOString();
5241
- console.warn(`[vibeOS] API health probe failed during reconnect: ${detail} \u2014 staying in fallback`);
5242
- }
5243
5212
  function recordBackendVersion(payload) {
5244
5213
  if (!payload || typeof payload !== "object")
5245
5214
  return;
@@ -5352,60 +5321,21 @@ function getApiClient2() {
5352
5321
  function isApiFallback2() {
5353
5322
  return _apiFallbackMode || !VIBEOS_API_ENABLED;
5354
5323
  }
5355
- function isApiConnected2() {
5324
+ function isApiConnected() {
5356
5325
  tryResetFallbackCooldown();
5357
- return isApiConnected() && VIBEOS_API_ENABLED && !_apiFallbackMode;
5326
+ return VIBEOS_API_ENABLED;
5358
5327
  }
5359
5328
  function getBackendVersion() {
5360
5329
  return _backendVersion;
5361
5330
  }
5362
- function getApiFallbackSince() {
5363
- return _apiFallbackSince;
5364
- }
5365
5331
  async function remoteCall(method, args, fallbackFn) {
5366
- if (!_startupProbeDone && !_apiFallbackMode) {
5367
- _startupProbeDone = true;
5368
- try {
5369
- syncApiTokenFromDisk();
5370
- if (VIBEOS_API_ENABLED) {
5371
- const probeClient = getApiClient2();
5372
- if (probeClient) {
5373
- await probeClient.health();
5374
- confirmReconnection();
5375
- }
5376
- }
5377
- } catch {
5378
- }
5379
- }
5380
5332
  syncApiTokenFromDisk();
5381
5333
  if (!VIBEOS_API_TOKEN && VIBEOS_API_BOOTSTRAP_TOKEN) {
5382
5334
  await ensureBootstrapExchange();
5383
5335
  syncApiTokenFromDisk();
5384
5336
  }
5385
- if (_apiFallbackMode && _apiFallbackSince) {
5386
- const elapsed = Date.now() - new Date(_apiFallbackSince).getTime();
5387
- if (elapsed > FALLBACK_COOLDOWN_MS) {
5388
- try {
5389
- const probeClient = getApiClient2();
5390
- if (probeClient) {
5391
- await probeClient.health();
5392
- confirmReconnection();
5393
- } else {
5394
- denyReconnection("no client");
5395
- if (fallbackFn)
5396
- return fallbackFn();
5397
- return null;
5398
- }
5399
- } catch (probeErr) {
5400
- const probeStatus = probeErr?.statusCode || probeErr?.status || 0;
5401
- const probeBody = probeErr?.response?.body || probeErr?.body || "";
5402
- const probePreview = typeof probeBody === "string" ? probeBody.substring(0, 80) : String(probeBody).substring(0, 80);
5403
- denyReconnection(probeStatus ? `status=${probeStatus} body=${probePreview}` : `message=${probeErr?.message || probeErr}`);
5404
- if (fallbackFn)
5405
- return fallbackFn();
5406
- return null;
5407
- }
5408
- }
5337
+ if (tryResetFallbackCooldown()) {
5338
+ console.warn("[vibeOS] API fallback cooldown expired \u2014 retrying API");
5409
5339
  }
5410
5340
  if (!VIBEOS_API_ENABLED || _apiFallbackMode) {
5411
5341
  if (fallbackFn)
@@ -5466,7 +5396,7 @@ async function remoteCall(method, args, fallbackFn) {
5466
5396
 
5467
5397
  // src/lib/pricing.js
5468
5398
  init_state();
5469
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync6, existsSync as existsSync6, mkdirSync as mkdirSync5, statSync as statSync5, renameSync as renameSync4, openSync as openSync2, closeSync as closeSync2, rmSync as rmSync3, readdirSync as readdirSync2 } from "node:fs";
5399
+ import { readFileSync as readFileSync5, writeFileSync as writeFileSync5, existsSync as existsSync6, mkdirSync as mkdirSync4, statSync as statSync5, renameSync as renameSync4, openSync as openSync2, closeSync as closeSync2, rmSync as rmSync3, readdirSync as readdirSync2 } from "node:fs";
5470
5400
  import { join as join5, dirname as dirname5, resolve } from "node:path";
5471
5401
  import { homedir as homedir4, tmpdir as tmpdir3 } from "node:os";
5472
5402
  import { createHash as createHash2 } from "node:crypto";
@@ -5513,10 +5443,10 @@ function withFileLock2(filePath, fn, opts = {}) {
5513
5443
  const start = Date.now();
5514
5444
  while (Date.now() - start < timeoutMs) {
5515
5445
  try {
5516
- mkdirSync5(join5(getVibeOSHome4(), ".vibeOS-locks"), { recursive: true });
5446
+ mkdirSync4(join5(getVibeOSHome4(), ".vibeOS-locks"), { recursive: true });
5517
5447
  const fd = openSync2(lockPath, "wx");
5518
5448
  try {
5519
- writeFileSync6(fd, `${process.pid}
5449
+ writeFileSync5(fd, `${process.pid}
5520
5450
  ${Date.now()}
5521
5451
  `);
5522
5452
  } catch {
@@ -6082,7 +6012,7 @@ function _writeDynamicPricingCache(modelsMap) {
6082
6012
  const PRICING_CACHE_FILE2 = join5(getVibeOSHome4(), "model-pricing-cache.json");
6083
6013
  try {
6084
6014
  withFileLock2(PRICING_CACHE_FILE2, () => {
6085
- mkdirSync5(dirname5(PRICING_CACHE_FILE2), { recursive: true });
6015
+ mkdirSync4(dirname5(PRICING_CACHE_FILE2), { recursive: true });
6086
6016
  let merged = {};
6087
6017
  try {
6088
6018
  if (existsSync6(PRICING_CACHE_FILE2)) {
@@ -6094,7 +6024,7 @@ function _writeDynamicPricingCache(modelsMap) {
6094
6024
  }
6095
6025
  merged = { ...merged, ...modelsMap };
6096
6026
  const tmp = PRICING_CACHE_FILE2 + ".tmp";
6097
- writeFileSync6(tmp, JSON.stringify({
6027
+ writeFileSync5(tmp, JSON.stringify({
6098
6028
  ts: Date.now(),
6099
6029
  source: "dynamic-model-pricing",
6100
6030
  models: merged
@@ -6422,7 +6352,7 @@ function clearWorkspaceFollowupPauseForSession(sessionId = "") {
6422
6352
  if (!touched)
6423
6353
  continue;
6424
6354
  outer["workspace:followup"] = JSON.stringify(followup);
6425
- writeFileSync6(file, JSON.stringify(outer, null, 2) + "\n");
6355
+ writeFileSync5(file, JSON.stringify(outer, null, 2) + "\n");
6426
6356
  changed = true;
6427
6357
  } catch {
6428
6358
  }
@@ -6632,7 +6562,7 @@ function _refreshModel(directory3) {
6632
6562
  if (t?.trinity?.[s]?.oc === cfgModel) {
6633
6563
  t.selection.active_slot = s;
6634
6564
  const _tmp = TIERS_FILE3 + ".tmp." + Date.now() + "." + Math.random().toString(36).slice(2, 8);
6635
- writeFileSync6(_tmp, JSON.stringify(t, null, 2) + "\n", "utf-8");
6565
+ writeFileSync5(_tmp, JSON.stringify(t, null, 2) + "\n", "utf-8");
6636
6566
  renameSync4(_tmp, TIERS_FILE3);
6637
6567
  if (DEBUG_INTERNALS)
6638
6568
  console.error(`[vibeOS] model refresh (config fallback): synced active_slot \u2192 ${s}`);
@@ -6659,7 +6589,7 @@ function applySlot2(slot, projectDir = "") {
6659
6589
  return { ok: false, reason: `slot '${slot}' has no oc model` };
6660
6590
  j.selection.active_slot = slot;
6661
6591
  const _tmp = TIERS_FILE3 + ".tmp." + Date.now();
6662
- writeFileSync6(_tmp, JSON.stringify(j, null, 2) + "\n", "utf-8");
6592
+ writeFileSync5(_tmp, JSON.stringify(j, null, 2) + "\n", "utf-8");
6663
6593
  renameSync4(_tmp, TIERS_FILE3);
6664
6594
  const dir = projectDir || process.cwd();
6665
6595
  const localOcConfig = join5(dir, "opencode.json");
@@ -6667,7 +6597,7 @@ function applySlot2(slot, projectDir = "") {
6667
6597
  if (existsSync6(ocConfig)) {
6668
6598
  const oc = safeJsonParse3(readFileSync5(ocConfig, "utf-8"));
6669
6599
  oc.model = ocModel;
6670
- writeFileSync6(ocConfig, JSON.stringify(oc, null, 2) + "\n");
6600
+ writeFileSync5(ocConfig, JSON.stringify(oc, null, 2) + "\n");
6671
6601
  }
6672
6602
  clearWorkspaceFollowupPauseForSession(getCurrentSessionId());
6673
6603
  _refreshModel(dir);
@@ -6679,7 +6609,7 @@ function applySlot2(slot, projectDir = "") {
6679
6609
  }
6680
6610
 
6681
6611
  // src/lib/turn-classify.js
6682
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync9, existsSync as existsSync9, mkdirSync as mkdirSync8, renameSync as renameSync5 } from "node:fs";
6612
+ import { readFileSync as readFileSync8, writeFileSync as writeFileSync8, existsSync as existsSync9, mkdirSync as mkdirSync7, renameSync as renameSync5 } from "node:fs";
6683
6613
  import { join as join7, dirname as dirname8 } from "node:path";
6684
6614
 
6685
6615
  // src/vibeOS-lib/blackbox/resolution-tracker.js
@@ -8357,7 +8287,7 @@ function projectStructuredFromText(raw, selection, creditPercent = 0) {
8357
8287
  // src/lib/reporting.js
8358
8288
  init_state();
8359
8289
  init_runtime_state();
8360
- import { readFileSync as readFileSync10, writeFileSync as writeFileSync10, existsSync as existsSync11, mkdirSync as mkdirSync9, statSync as statSync6, rmSync as rmSync4 } from "node:fs";
8290
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync9, existsSync as existsSync11, mkdirSync as mkdirSync8, statSync as statSync6, rmSync as rmSync4 } from "node:fs";
8361
8291
  import { join as join9 } from "node:path";
8362
8292
  function getVibeOSHome7() {
8363
8293
  return process.env.VIBEOS_HOME || join9(process.env.HOME || "", ".claude");
@@ -8399,8 +8329,8 @@ function saveReportsIndex(idx) {
8399
8329
  const reportsIndexPath = getReportsIndexPath();
8400
8330
  const reportsDir = getReportsDir();
8401
8331
  withFileLock(reportsIndexPath, () => {
8402
- mkdirSync9(reportsDir, { recursive: true });
8403
- writeFileSync10(reportsIndexPath, JSON.stringify(idx, null, 2) + "\n");
8332
+ mkdirSync8(reportsDir, { recursive: true });
8333
+ writeFileSync9(reportsIndexPath, JSON.stringify(idx, null, 2) + "\n");
8404
8334
  });
8405
8335
  } catch (err) {
8406
8336
  console.error(`[vibeOS] reports index write failed: ${err.message}`);
@@ -8571,12 +8501,12 @@ function saveReport({ type = "manual", summary = "", findings = null, metrics =
8571
8501
  const reportsIndexPath = getReportsIndexPath();
8572
8502
  const reportsDir = getReportsDir();
8573
8503
  withFileLock(reportsIndexPath, () => {
8574
- mkdirSync9(reportsDir, { recursive: true });
8575
- writeFileSync10(join9(reportsDir, `${id2}.json`), JSON.stringify(report, null, 2) + "\n");
8504
+ mkdirSync8(reportsDir, { recursive: true });
8505
+ writeFileSync9(join9(reportsDir, `${id2}.json`), JSON.stringify(report, null, 2) + "\n");
8576
8506
  const idx = reportsIndex();
8577
8507
  const _sum = (summary || "").slice(0, 80);
8578
8508
  idx.reports.push({ id: id2, type, project: report.meta.project, fingerprint: fp2, created: report.meta.created, summary: _sum });
8579
- writeFileSync10(reportsIndexPath, JSON.stringify(idx, null, 2) + "\n");
8509
+ writeFileSync9(reportsIndexPath, JSON.stringify(idx, null, 2) + "\n");
8580
8510
  });
8581
8511
  try {
8582
8512
  if (fp2 && fp2 !== "unknown") {
@@ -8633,7 +8563,7 @@ function readReport(id2) {
8633
8563
  init_selection_manager();
8634
8564
 
8635
8565
  // src/lib/credit-api.js
8636
- import { readFileSync as readFileSync11, writeFileSync as writeFileSync11, existsSync as existsSync12 } from "node:fs";
8566
+ import { readFileSync as readFileSync11, writeFileSync as writeFileSync10, existsSync as existsSync12 } from "node:fs";
8637
8567
  import { join as join10 } from "node:path";
8638
8568
  init_state();
8639
8569
  function getVibeOSHome8() {
@@ -8704,7 +8634,7 @@ async function _snapshot() {
8704
8634
  }
8705
8635
  }
8706
8636
  try {
8707
- writeFileSync11(CREDIT_CACHE_F, JSON.stringify({ total, providers: provs, ts: Date.now() }));
8637
+ writeFileSync10(CREDIT_CACHE_F, JSON.stringify({ total, providers: provs, ts: Date.now() }));
8708
8638
  } catch {
8709
8639
  }
8710
8640
  }
@@ -9114,7 +9044,7 @@ function createTrinityTool(deps) {
9114
9044
  `Model: ${activeSlot} (${tiers?.[activeSlot]?.oc || deps.currentModel || "(unset)"})`,
9115
9045
  `Provider: ${execution.provider_label}`,
9116
9046
  `Quality: ${execution.quality_label}`,
9117
- ...isApiConnected2() ? [`Backend: connected${getBackendVersion() ? ` (${getBackendVersion()})` : ""}`] : [`Backend: offline`],
9047
+ ...isApiConnected() ? [`Backend: connected${getBackendVersion() ? ` (${getBackendVersion()})` : ""}`] : [`Backend: offline`],
9118
9048
  ...sel.requested_optimization_mode ? [`Requested mode: ${sel.requested_optimization_mode}`] : [],
9119
9049
  ...totalTurns > 0 ? [`Split: brain ${brainPct}% / worker ${workerPct}% (${totalTurns} total)`] : [],
9120
9050
  `Thinking: ${effectiveLevel}`,
@@ -10580,12 +10510,12 @@ async function probeModel(modelId, auth, providers = null) {
10580
10510
  }
10581
10511
 
10582
10512
  // src/lib/hooks/footer.js
10583
- import { readFileSync as readFileSync14, appendFileSync as appendFileSync4, mkdirSync as mkdirSync11 } from "node:fs";
10513
+ import { readFileSync as readFileSync14, appendFileSync as appendFileSync4, mkdirSync as mkdirSync10 } from "node:fs";
10584
10514
  import { join as join15 } from "node:path";
10585
10515
 
10586
10516
  // src/lib/hooks/chat-transform.js
10587
10517
  init_state();
10588
- import { readFileSync as readFileSync13, writeFileSync as writeFileSync13, appendFileSync as appendFileSync3, existsSync as existsSync14, mkdirSync as mkdirSync10, rmSync as rmSync5, readdirSync as readdirSync3, statSync as statSync7 } from "node:fs";
10518
+ import { readFileSync as readFileSync13, writeFileSync as writeFileSync12, appendFileSync as appendFileSync3, existsSync as existsSync14, mkdirSync as mkdirSync9, rmSync as rmSync5, readdirSync as readdirSync3, statSync as statSync7 } from "node:fs";
10589
10519
  import { join as join14, dirname as dirname10, basename as basename3 } from "node:path";
10590
10520
  import { createHash as createHash3 } from "node:crypto";
10591
10521
 
@@ -10782,7 +10712,7 @@ init_selection_manager();
10782
10712
  init_state();
10783
10713
  init_pattern_helpers();
10784
10714
  import { join as join13 } from "node:path";
10785
- import { writeFileSync as writeFileSync12 } from "node:fs";
10715
+ import { writeFileSync as writeFileSync11 } from "node:fs";
10786
10716
 
10787
10717
  // src/lib/text-compress.js
10788
10718
  var VERBOSE_LINE_RE = [
@@ -11140,7 +11070,7 @@ function recordSaving(tool2, reason, saveEst, meta = {}) {
11140
11070
  if (sd) {
11141
11071
  const sp = join13(sd, "delegation-state-hint.txt");
11142
11072
  try {
11143
- writeFileSync12(sp, JSON.stringify({ sid, total_savings: s.lifetime.total_savings_usd, last_reason: reason }), "utf8");
11073
+ writeFileSync11(sp, JSON.stringify({ sid, total_savings: s.lifetime.total_savings_usd, last_reason: reason }), "utf8");
11144
11074
  } catch {
11145
11075
  }
11146
11076
  }
@@ -11493,8 +11423,8 @@ function ensureProjectSkill(dir, fp2) {
11493
11423
  content += "\n";
11494
11424
  }
11495
11425
  try {
11496
- mkdirSync10(skillDir, { recursive: true });
11497
- writeFileSync13(skillPath, content, "utf-8");
11426
+ mkdirSync9(skillDir, { recursive: true });
11427
+ writeFileSync12(skillPath, content, "utf-8");
11498
11428
  console.error(`[vibeOS] Project Guard: created .opencode/skills/${projectName}/SKILL.md`);
11499
11429
  return { created: true, path: skillPath, skipped: false };
11500
11430
  } catch (err) {
@@ -11611,7 +11541,7 @@ function syncControlSettings(cv, options = {}) {
11611
11541
  writeSelection("previous_default_agent", oc.default_agent);
11612
11542
  }
11613
11543
  oc.default_agent = cv.agent_mode;
11614
- writeFileSync13(OC_CONFIG, JSON.stringify(oc, null, 2) + "\n");
11544
+ writeFileSync12(OC_CONFIG, JSON.stringify(oc, null, 2) + "\n");
11615
11545
  }
11616
11546
  }
11617
11547
  } catch {
@@ -11624,7 +11554,7 @@ function syncControlSettings(cv, options = {}) {
11624
11554
  const restoreAgent = oc.default_agent === "plan" ? resolveRestorableOpenCodeAgent(currentSel) : null;
11625
11555
  if (restoreAgent && oc.default_agent === "plan") {
11626
11556
  oc.default_agent = restoreAgent;
11627
- writeFileSync13(OC_CONFIG, JSON.stringify(oc, null, 2) + "\n");
11557
+ writeFileSync12(OC_CONFIG, JSON.stringify(oc, null, 2) + "\n");
11628
11558
  if (currentSel.previous_default_agent)
11629
11559
  writeSelection("previous_default_agent", null);
11630
11560
  }
@@ -11686,10 +11616,10 @@ ${raw}
11686
11616
  const sessPath = join14(getSessionScratchpadDir(), `${hash}.txt`);
11687
11617
  const globalPath = join14(globalDir, `${hash}.txt`);
11688
11618
  try {
11689
- mkdirSync10(globalDir, { recursive: true });
11619
+ mkdirSync9(globalDir, { recursive: true });
11690
11620
  ensureSessionScratchpadDirs();
11691
11621
  if (!existsSync14(globalPath)) {
11692
- writeFileSync13(globalPath, raw);
11622
+ writeFileSync12(globalPath, raw);
11693
11623
  indexAppend(hash, part.tool, raw.length);
11694
11624
  if (existsSync14(sessPath))
11695
11625
  rmSync5(sessPath, { force: true });
@@ -11702,7 +11632,7 @@ ${stableJson(invPart.state.input)}
11702
11632
  `).digest("hex").slice(0, 16);
11703
11633
  const ptrPath = join14(getSessionScratchpadDir(), `${inputHash}.ptr`);
11704
11634
  try {
11705
- writeFileSync13(ptrPath, JSON.stringify({ contentHash: hash, tool: part.tool }));
11635
+ writeFileSync12(ptrPath, JSON.stringify({ contentHash: hash, tool: part.tool }));
11706
11636
  } catch {
11707
11637
  }
11708
11638
  }
@@ -11982,7 +11912,7 @@ var onSystemTransform = async (_input, output) => {
11982
11912
  const system = output?.system;
11983
11913
  if (!Array.isArray(system))
11984
11914
  return;
11985
- if (isApiConnected2()) {
11915
+ if (isApiConnected()) {
11986
11916
  try {
11987
11917
  const bb = loadBlackboxState();
11988
11918
  if (!bb.enabled || _blackboxEnabled === false) {
@@ -12142,7 +12072,7 @@ var onSystemTransform = async (_input, output) => {
12142
12072
  fp: currentProjectFingerprint || ""
12143
12073
  }) + "\n";
12144
12074
  try {
12145
- mkdirSync10(calDir, { recursive: true });
12075
+ mkdirSync9(calDir, { recursive: true });
12146
12076
  appendFileSync3(calFile, calRecord);
12147
12077
  } catch {
12148
12078
  }
@@ -12566,7 +12496,7 @@ async function _appendFooter(input, output, directory3) {
12566
12496
  return;
12567
12497
  const ltTotal = ltTasks + ltCache;
12568
12498
  const activeSlot = selNowFooter.active_slot || "brain";
12569
- const flashIcon = isApiConnected2() ? " \u26A1" : "";
12499
+ const flashIcon = isApiConnected() ? " \u26A1" : "";
12570
12500
  const displayMode2 = autoSelectMode2(currentSubRegime2, _footerStress);
12571
12501
  const vibeBrand = resolveBrand(loadOptimizationMode() || displayMode2, activeSlot);
12572
12502
  const vibeLine = buildFooterLine({
@@ -12608,7 +12538,7 @@ ${vibeLine}`;
12608
12538
  tracker.recordOutcome(finalOutcome);
12609
12539
  syncOutcomeToApi(finalOutcome);
12610
12540
  try {
12611
- mkdirSync11(getVibeOSHome10(), { recursive: true });
12541
+ mkdirSync10(getVibeOSHome10(), { recursive: true });
12612
12542
  appendFileSync4(join15(getVibeOSHome10(), "calibration-data.jsonl"), JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), event: "outcome", sid: getSessionId(), outcome: finalOutcome }) + "\n");
12613
12543
  } catch {
12614
12544
  }
@@ -12636,7 +12566,7 @@ ${vibeLine} \u2014`);
12636
12566
 
12637
12567
  // src/lib/hooks/tool-execute.js
12638
12568
  init_state();
12639
- import { writeFileSync as writeFileSync15, appendFileSync as appendFileSync6, existsSync as existsSync16, mkdirSync as mkdirSync13 } from "node:fs";
12569
+ import { writeFileSync as writeFileSync14, appendFileSync as appendFileSync6, existsSync as existsSync16, mkdirSync as mkdirSync12 } from "node:fs";
12640
12570
  import { join as join17, dirname as dirname12, basename as basename4 } from "node:path";
12641
12571
  import { createHash as createHash5 } from "node:crypto";
12642
12572
  init_selection_manager();
@@ -12705,7 +12635,7 @@ init_smart_cache();
12705
12635
 
12706
12636
  // src/lib/tdd-enforcer.js
12707
12637
  init_state();
12708
- import { readFileSync as readFileSync15, writeFileSync as writeFileSync14, appendFileSync as appendFileSync5, existsSync as existsSync15, mkdirSync as mkdirSync12, statSync as statSync8, readdirSync as readdirSync4, rmSync as rmSync6, openSync as openSync3 } from "node:fs";
12638
+ import { readFileSync as readFileSync15, writeFileSync as writeFileSync13, appendFileSync as appendFileSync5, existsSync as existsSync15, mkdirSync as mkdirSync11, statSync as statSync8, readdirSync as readdirSync4, rmSync as rmSync6, openSync as openSync3 } from "node:fs";
12709
12639
  import { join as join16, dirname as dirname11 } from "node:path";
12710
12640
  import { createHash as createHash4 } from "node:crypto";
12711
12641
 
@@ -13808,7 +13738,7 @@ var COOLDOWN_MS = 6e4;
13808
13738
  var _enforcementCooldown = /* @__PURE__ */ new Set();
13809
13739
  function _acquireLock(testPath) {
13810
13740
  try {
13811
- mkdirSync12(ENFORCEMENT_LOCK_DIR, { recursive: true });
13741
+ mkdirSync11(ENFORCEMENT_LOCK_DIR, { recursive: true });
13812
13742
  const hash = createHash4("sha256").update(testPath).digest("hex").slice(0, 16);
13813
13743
  const lockPath = join16(ENFORCEMENT_LOCK_DIR, `${hash}.lock`);
13814
13744
  try {
@@ -13865,13 +13795,13 @@ function _isInCooldown(testPath) {
13865
13795
  }
13866
13796
  function _recordCooldown(testPath) {
13867
13797
  try {
13868
- mkdirSync12(dirname11(ENFORCEMENT_COOLDOWN_FILE2), { recursive: true });
13798
+ mkdirSync11(dirname11(ENFORCEMENT_COOLDOWN_FILE2), { recursive: true });
13869
13799
  const hash = createHash4("sha256").update(testPath).digest("hex").slice(0, 16);
13870
13800
  const entry = JSON.stringify({ h: hash, ts: Date.now() }) + "\n";
13871
13801
  appendFileSync5(ENFORCEMENT_COOLDOWN_FILE2, entry);
13872
13802
  const lines = readFileSync15(ENFORCEMENT_COOLDOWN_FILE2, "utf-8").trim().split("\n").filter(Boolean);
13873
13803
  if (lines.length > 500) {
13874
- writeFileSync14(ENFORCEMENT_COOLDOWN_FILE2, lines.slice(-200).join("\n") + "\n");
13804
+ writeFileSync13(ENFORCEMENT_COOLDOWN_FILE2, lines.slice(-200).join("\n") + "\n");
13875
13805
  }
13876
13806
  } catch {
13877
13807
  }
@@ -13957,8 +13887,8 @@ function enforceTestFile(filePath) {
13957
13887
  if (!_acquireLock(skeleton.path))
13958
13888
  return null;
13959
13889
  try {
13960
- mkdirSync12(skeleton.dir, { recursive: true });
13961
- writeFileSync14(skeleton.path, skeleton.content);
13890
+ mkdirSync11(skeleton.dir, { recursive: true });
13891
+ writeFileSync13(skeleton.path, skeleton.content);
13962
13892
  _enforcementCooldown.add(skeleton.path);
13963
13893
  _recordCooldown(skeleton.path);
13964
13894
  try {
@@ -14301,7 +14231,7 @@ ${argsJson}
14301
14231
  const globalFile = join17(globalDir, `${targetHash}.txt`);
14302
14232
  if (existsSync16(cachedFile) || existsSync16(globalFile)) {
14303
14233
  ensureSessionScratchpadDirs();
14304
- writeFileSync15(ptrPath, JSON.stringify({
14234
+ writeFileSync14(ptrPath, JSON.stringify({
14305
14235
  contentHash: targetHash,
14306
14236
  tool: titleCase,
14307
14237
  warmed: true,
@@ -14600,8 +14530,8 @@ ${argsJson}
14600
14530
  const missed = recordMissedContext7(_estC7);
14601
14531
  if (!existsSync16(CONTEXT7_INSTALL_FLAG)) {
14602
14532
  try {
14603
- mkdirSync13(dirname12(CONTEXT7_INSTALL_FLAG), { recursive: true });
14604
- writeFileSync15(CONTEXT7_INSTALL_FLAG, "");
14533
+ mkdirSync12(dirname12(CONTEXT7_INSTALL_FLAG), { recursive: true });
14534
+ writeFileSync14(CONTEXT7_INSTALL_FLAG, "");
14605
14535
  } catch {
14606
14536
  }
14607
14537
  console.error(`[vibeOS] Small win: install context7 MCP to save about ~$0.06/turn on docs: \`claude mcp add context7 npx @upstash/context7-mcp\``);
@@ -14692,7 +14622,7 @@ var onToolExecuteAfter = async (input, output) => {
14692
14622
  const displayMode2 = autoSelectMode2(currentSubRegime2, latestUserIntent ? scoreStress(latestUserIntent) : 0);
14693
14623
  const vibeBrand = resolveBrand(displayMode2, activeSlot);
14694
14624
  const sessionSlot = loadSessionSlot(currentSid);
14695
- const flashIcon = isApiConnected2() ? " \u26A1" : "";
14625
+ const flashIcon = isApiConnected() ? " \u26A1" : "";
14696
14626
  _footerText = buildFooterLine({
14697
14627
  activeSlot,
14698
14628
  providerLabel: execution.provider_label,
@@ -15148,6 +15078,7 @@ function ensureDeferredBootstrap() {
15148
15078
  } catch {
15149
15079
  }
15150
15080
  }
15081
+ var _apiFallbackSince2 = null;
15151
15082
  var activeJob2 = null;
15152
15083
  var fp = "";
15153
15084
  var _mcpServerRuntime = null;
@@ -15308,8 +15239,8 @@ async function _seedOrRepairModelTiers(directory3) {
15308
15239
  },
15309
15240
  trinity: nextTrinity
15310
15241
  };
15311
- mkdirSync14(dirname13(TIERS_FILE3), { recursive: true });
15312
- writeFileSync16(TIERS_FILE3, JSON.stringify(tiers, null, 2) + "\n", "utf-8");
15242
+ mkdirSync13(dirname13(TIERS_FILE3), { recursive: true });
15243
+ writeFileSync15(TIERS_FILE3, JSON.stringify(tiers, null, 2) + "\n", "utf-8");
15313
15244
  return true;
15314
15245
  }
15315
15246
  function _parseJsonc(raw) {
@@ -15364,7 +15295,9 @@ function loadMcpPort() {
15364
15295
  }
15365
15296
  } catch {
15366
15297
  }
15367
- return null;
15298
+ if (process.env.VIBEOS_TEST_CONTEXT)
15299
+ return 0;
15300
+ return 3001;
15368
15301
  }
15369
15302
  function persistMcpPort(port) {
15370
15303
  try {
@@ -15377,9 +15310,9 @@ function persistMcpPort(port) {
15377
15310
  tiers.selection.mcp_port = port;
15378
15311
  if ("mcp_port" in tiers)
15379
15312
  delete tiers.mcp_port;
15380
- mkdirSync14(dirname13(getTiersFile()), { recursive: true });
15313
+ mkdirSync13(dirname13(getTiersFile()), { recursive: true });
15381
15314
  const tmp = getTiersFile() + ".tmp." + Date.now();
15382
- writeFileSync16(tmp, JSON.stringify(tiers, null, 2) + "\n", "utf-8");
15315
+ writeFileSync15(tmp, JSON.stringify(tiers, null, 2) + "\n", "utf-8");
15383
15316
  renameSync6(tmp, getTiersFile());
15384
15317
  } catch {
15385
15318
  }
@@ -15443,11 +15376,11 @@ async function ensureMcpServerRunning() {
15443
15376
  version: readPackageVersion(),
15444
15377
  todos: loadTodos(),
15445
15378
  fallbackThinking: thinkingLevel(loadCredit()),
15446
- backendConnected: isApiConnected2(),
15379
+ backendConnected: isApiConnected(),
15447
15380
  backendHealthUrl: `${VIBEOS_API_URL}/health`,
15448
15381
  backendVersion: getBackendVersion(),
15449
15382
  apiFallbackMode: isApiFallback2(),
15450
- apiFallbackSince: getApiFallbackSince(),
15383
+ apiFallbackSince: _apiFallbackSince2,
15451
15384
  modelLocked: _modelLocked,
15452
15385
  lockedSlot: _lockedSlot,
15453
15386
  lockedModel: _lockedModel
@@ -15564,13 +15497,10 @@ async function ensureMcpServerRunning() {
15564
15497
  }
15565
15498
  });
15566
15499
  }
15567
- const requestedPort = port == null ? 0 : port;
15568
- const mcpServer = await _mcpServerRuntime.start(requestedPort);
15569
- const actualPort = Number(mcpServer?.address?.()?.port || requestedPort);
15570
- if (actualPort && actualPort !== requestedPort)
15500
+ const mcpServer = await _mcpServerRuntime.start(port);
15501
+ const actualPort = Number(mcpServer?.address?.()?.port || port);
15502
+ if (actualPort && actualPort !== port)
15571
15503
  persistMcpPort(actualPort);
15572
- if (actualPort)
15573
- writeDashboardBaseConfig(`http://127.0.0.1:${actualPort}`);
15574
15504
  console.error(`[vibeOS] MCP server on http://127.0.0.1:${actualPort}`);
15575
15505
  if (actualPort)
15576
15506
  console.error(`[vibeOS] Dashboard at http://127.0.0.1:${actualPort}/`);
@@ -15710,9 +15640,9 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
15710
15640
  };
15711
15641
  const saveProjectStateStable = (state) => {
15712
15642
  try {
15713
- mkdirSync14(dirname13(hookProjectStateFile), { recursive: true });
15643
+ mkdirSync13(dirname13(hookProjectStateFile), { recursive: true });
15714
15644
  const tmp = hookProjectStateFile + ".tmp";
15715
- writeFileSync16(tmp, JSON.stringify(state, null, 2) + "\n");
15645
+ writeFileSync15(tmp, JSON.stringify(state, null, 2) + "\n");
15716
15646
  renameSync6(tmp, hookProjectStateFile);
15717
15647
  } catch {
15718
15648
  }
@@ -15729,8 +15659,8 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
15729
15659
  };
15730
15660
  const saveReportsIndexStable = (idx) => {
15731
15661
  try {
15732
- mkdirSync14(hookReportsDir, { recursive: true });
15733
- writeFileSync16(hookReportsIndex, JSON.stringify(idx, null, 2) + "\n");
15662
+ mkdirSync13(hookReportsDir, { recursive: true });
15663
+ writeFileSync15(hookReportsIndex, JSON.stringify(idx, null, 2) + "\n");
15734
15664
  } catch {
15735
15665
  }
15736
15666
  };
@@ -15739,7 +15669,7 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
15739
15669
  if (!existsSync18(path))
15740
15670
  return null;
15741
15671
  const bkDir = join18(hookVibeHome, ".backups");
15742
- mkdirSync14(bkDir, { recursive: true });
15672
+ mkdirSync13(bkDir, { recursive: true });
15743
15673
  const bk = join18(bkDir, `${basename5(path)}.${label}.${Date.now()}.bak`);
15744
15674
  copyFileSync2(path, bk);
15745
15675
  return bk;
@@ -15775,10 +15705,10 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
15775
15705
  directory: directory3,
15776
15706
  safeJsonParse: safeJsonParse3,
15777
15707
  readFileSync: readFileSync17,
15778
- writeFileSync: writeFileSync16,
15708
+ writeFileSync: writeFileSync15,
15779
15709
  existsSync: existsSync18,
15780
15710
  renameSync: renameSync6,
15781
- mkdirSync: mkdirSync14,
15711
+ mkdirSync: mkdirSync13,
15782
15712
  get TIERS_FILE() {
15783
15713
  return hookTiersFile;
15784
15714
  },
@@ -15834,7 +15764,7 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
15834
15764
  saveBlackboxState,
15835
15765
  isApiFallback: () => isApiFallback2(),
15836
15766
  get _apiFallbackSince() {
15837
- return getApiFallbackSince();
15767
+ return _apiFallbackSince2;
15838
15768
  },
15839
15769
  reportsIndex: reportsIndexStable,
15840
15770
  saveReportsIndex: saveReportsIndexStable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibeostheog",
3
- "version": "0.25.5",
3
+ "version": "0.25.6",
4
4
  "description": "Cost-aware delegation enforcer for OpenCode. Tracks model usage, routes Task subagents to cheaper tiers, surfaces cumulative savings in chat. Includes research audit, reporting framework, project memory, progressive scratchpad decadence, and trinity CLI for brain/medium/cheap slot switching.",
5
5
  "scripts": {
6
6
  "release": "node scripts/release.mjs",