vibeostheog 0.25.4 → 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.
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1543
|
+
mkdirSync3(FILE_LOCK_DIR, { recursive: true });
|
|
1548
1544
|
const fd = openSync(lockPath, "wx");
|
|
1549
1545
|
try {
|
|
1550
|
-
|
|
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
|
-
|
|
1651
|
+
mkdirSync3(dirname4(delegationStateFile), { recursive: true });
|
|
1656
1652
|
const tmp = delegationStateFile + ".tmp";
|
|
1657
|
-
|
|
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
|
-
|
|
1742
|
+
mkdirSync3(dirname4(globalLearningFile), { recursive: true });
|
|
1747
1743
|
const tmp = globalLearningFile + ".tmp";
|
|
1748
|
-
|
|
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
|
-
|
|
1832
|
+
mkdirSync3(dirname4(blackboxFile), { recursive: true });
|
|
1837
1833
|
const tmp = blackboxFile + ".tmp";
|
|
1838
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2126
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2389
|
+
mkdirSync3(dirname4(ACTIVE_JOBS_FILE), { recursive: true });
|
|
2394
2390
|
const tmp = ACTIVE_JOBS_FILE + ".tmp";
|
|
2395
|
-
|
|
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
|
-
|
|
2499
|
+
mkdirSync3(dirname4(projectStateFile), { recursive: true });
|
|
2504
2500
|
const _tmp = projectStateFile + ".tmp." + Date.now();
|
|
2505
|
-
|
|
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
|
-
|
|
2792
|
+
mkdirSync3(dirname4(TODOS_FILE), { recursive: true });
|
|
2797
2793
|
const tmp = TODOS_FILE + ".tmp." + Date.now();
|
|
2798
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3073
|
+
mkdirSync3(dirname4(cpPath), { recursive: true });
|
|
3078
3074
|
const tmp = cpPath + ".tmp";
|
|
3079
|
-
|
|
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
|
|
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
|
-
|
|
3472
|
-
|
|
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
|
|
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
|
-
|
|
3925
|
-
|
|
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
|
|
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,
|
|
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
|
|
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
|
-
|
|
4783
|
-
|
|
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
|
-
|
|
5158
|
-
|
|
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);
|
|
@@ -5341,9 +5321,9 @@ function getApiClient2() {
|
|
|
5341
5321
|
function isApiFallback2() {
|
|
5342
5322
|
return _apiFallbackMode || !VIBEOS_API_ENABLED;
|
|
5343
5323
|
}
|
|
5344
|
-
function
|
|
5324
|
+
function isApiConnected() {
|
|
5345
5325
|
tryResetFallbackCooldown();
|
|
5346
|
-
return
|
|
5326
|
+
return VIBEOS_API_ENABLED;
|
|
5347
5327
|
}
|
|
5348
5328
|
function getBackendVersion() {
|
|
5349
5329
|
return _backendVersion;
|
|
@@ -5416,7 +5396,7 @@ async function remoteCall(method, args, fallbackFn) {
|
|
|
5416
5396
|
|
|
5417
5397
|
// src/lib/pricing.js
|
|
5418
5398
|
init_state();
|
|
5419
|
-
import { readFileSync as readFileSync5, writeFileSync as
|
|
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";
|
|
5420
5400
|
import { join as join5, dirname as dirname5, resolve } from "node:path";
|
|
5421
5401
|
import { homedir as homedir4, tmpdir as tmpdir3 } from "node:os";
|
|
5422
5402
|
import { createHash as createHash2 } from "node:crypto";
|
|
@@ -5463,10 +5443,10 @@ function withFileLock2(filePath, fn, opts = {}) {
|
|
|
5463
5443
|
const start = Date.now();
|
|
5464
5444
|
while (Date.now() - start < timeoutMs) {
|
|
5465
5445
|
try {
|
|
5466
|
-
|
|
5446
|
+
mkdirSync4(join5(getVibeOSHome4(), ".vibeOS-locks"), { recursive: true });
|
|
5467
5447
|
const fd = openSync2(lockPath, "wx");
|
|
5468
5448
|
try {
|
|
5469
|
-
|
|
5449
|
+
writeFileSync5(fd, `${process.pid}
|
|
5470
5450
|
${Date.now()}
|
|
5471
5451
|
`);
|
|
5472
5452
|
} catch {
|
|
@@ -6032,7 +6012,7 @@ function _writeDynamicPricingCache(modelsMap) {
|
|
|
6032
6012
|
const PRICING_CACHE_FILE2 = join5(getVibeOSHome4(), "model-pricing-cache.json");
|
|
6033
6013
|
try {
|
|
6034
6014
|
withFileLock2(PRICING_CACHE_FILE2, () => {
|
|
6035
|
-
|
|
6015
|
+
mkdirSync4(dirname5(PRICING_CACHE_FILE2), { recursive: true });
|
|
6036
6016
|
let merged = {};
|
|
6037
6017
|
try {
|
|
6038
6018
|
if (existsSync6(PRICING_CACHE_FILE2)) {
|
|
@@ -6044,7 +6024,7 @@ function _writeDynamicPricingCache(modelsMap) {
|
|
|
6044
6024
|
}
|
|
6045
6025
|
merged = { ...merged, ...modelsMap };
|
|
6046
6026
|
const tmp = PRICING_CACHE_FILE2 + ".tmp";
|
|
6047
|
-
|
|
6027
|
+
writeFileSync5(tmp, JSON.stringify({
|
|
6048
6028
|
ts: Date.now(),
|
|
6049
6029
|
source: "dynamic-model-pricing",
|
|
6050
6030
|
models: merged
|
|
@@ -6372,7 +6352,7 @@ function clearWorkspaceFollowupPauseForSession(sessionId = "") {
|
|
|
6372
6352
|
if (!touched)
|
|
6373
6353
|
continue;
|
|
6374
6354
|
outer["workspace:followup"] = JSON.stringify(followup);
|
|
6375
|
-
|
|
6355
|
+
writeFileSync5(file, JSON.stringify(outer, null, 2) + "\n");
|
|
6376
6356
|
changed = true;
|
|
6377
6357
|
} catch {
|
|
6378
6358
|
}
|
|
@@ -6582,7 +6562,7 @@ function _refreshModel(directory3) {
|
|
|
6582
6562
|
if (t?.trinity?.[s]?.oc === cfgModel) {
|
|
6583
6563
|
t.selection.active_slot = s;
|
|
6584
6564
|
const _tmp = TIERS_FILE3 + ".tmp." + Date.now() + "." + Math.random().toString(36).slice(2, 8);
|
|
6585
|
-
|
|
6565
|
+
writeFileSync5(_tmp, JSON.stringify(t, null, 2) + "\n", "utf-8");
|
|
6586
6566
|
renameSync4(_tmp, TIERS_FILE3);
|
|
6587
6567
|
if (DEBUG_INTERNALS)
|
|
6588
6568
|
console.error(`[vibeOS] model refresh (config fallback): synced active_slot \u2192 ${s}`);
|
|
@@ -6609,7 +6589,7 @@ function applySlot2(slot, projectDir = "") {
|
|
|
6609
6589
|
return { ok: false, reason: `slot '${slot}' has no oc model` };
|
|
6610
6590
|
j.selection.active_slot = slot;
|
|
6611
6591
|
const _tmp = TIERS_FILE3 + ".tmp." + Date.now();
|
|
6612
|
-
|
|
6592
|
+
writeFileSync5(_tmp, JSON.stringify(j, null, 2) + "\n", "utf-8");
|
|
6613
6593
|
renameSync4(_tmp, TIERS_FILE3);
|
|
6614
6594
|
const dir = projectDir || process.cwd();
|
|
6615
6595
|
const localOcConfig = join5(dir, "opencode.json");
|
|
@@ -6617,7 +6597,7 @@ function applySlot2(slot, projectDir = "") {
|
|
|
6617
6597
|
if (existsSync6(ocConfig)) {
|
|
6618
6598
|
const oc = safeJsonParse3(readFileSync5(ocConfig, "utf-8"));
|
|
6619
6599
|
oc.model = ocModel;
|
|
6620
|
-
|
|
6600
|
+
writeFileSync5(ocConfig, JSON.stringify(oc, null, 2) + "\n");
|
|
6621
6601
|
}
|
|
6622
6602
|
clearWorkspaceFollowupPauseForSession(getCurrentSessionId());
|
|
6623
6603
|
_refreshModel(dir);
|
|
@@ -6629,7 +6609,7 @@ function applySlot2(slot, projectDir = "") {
|
|
|
6629
6609
|
}
|
|
6630
6610
|
|
|
6631
6611
|
// src/lib/turn-classify.js
|
|
6632
|
-
import { readFileSync as readFileSync8, writeFileSync as
|
|
6612
|
+
import { readFileSync as readFileSync8, writeFileSync as writeFileSync8, existsSync as existsSync9, mkdirSync as mkdirSync7, renameSync as renameSync5 } from "node:fs";
|
|
6633
6613
|
import { join as join7, dirname as dirname8 } from "node:path";
|
|
6634
6614
|
|
|
6635
6615
|
// src/vibeOS-lib/blackbox/resolution-tracker.js
|
|
@@ -8307,7 +8287,7 @@ function projectStructuredFromText(raw, selection, creditPercent = 0) {
|
|
|
8307
8287
|
// src/lib/reporting.js
|
|
8308
8288
|
init_state();
|
|
8309
8289
|
init_runtime_state();
|
|
8310
|
-
import { readFileSync as readFileSync10, writeFileSync as
|
|
8290
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync9, existsSync as existsSync11, mkdirSync as mkdirSync8, statSync as statSync6, rmSync as rmSync4 } from "node:fs";
|
|
8311
8291
|
import { join as join9 } from "node:path";
|
|
8312
8292
|
function getVibeOSHome7() {
|
|
8313
8293
|
return process.env.VIBEOS_HOME || join9(process.env.HOME || "", ".claude");
|
|
@@ -8349,8 +8329,8 @@ function saveReportsIndex(idx) {
|
|
|
8349
8329
|
const reportsIndexPath = getReportsIndexPath();
|
|
8350
8330
|
const reportsDir = getReportsDir();
|
|
8351
8331
|
withFileLock(reportsIndexPath, () => {
|
|
8352
|
-
|
|
8353
|
-
|
|
8332
|
+
mkdirSync8(reportsDir, { recursive: true });
|
|
8333
|
+
writeFileSync9(reportsIndexPath, JSON.stringify(idx, null, 2) + "\n");
|
|
8354
8334
|
});
|
|
8355
8335
|
} catch (err) {
|
|
8356
8336
|
console.error(`[vibeOS] reports index write failed: ${err.message}`);
|
|
@@ -8521,12 +8501,12 @@ function saveReport({ type = "manual", summary = "", findings = null, metrics =
|
|
|
8521
8501
|
const reportsIndexPath = getReportsIndexPath();
|
|
8522
8502
|
const reportsDir = getReportsDir();
|
|
8523
8503
|
withFileLock(reportsIndexPath, () => {
|
|
8524
|
-
|
|
8525
|
-
|
|
8504
|
+
mkdirSync8(reportsDir, { recursive: true });
|
|
8505
|
+
writeFileSync9(join9(reportsDir, `${id2}.json`), JSON.stringify(report, null, 2) + "\n");
|
|
8526
8506
|
const idx = reportsIndex();
|
|
8527
8507
|
const _sum = (summary || "").slice(0, 80);
|
|
8528
8508
|
idx.reports.push({ id: id2, type, project: report.meta.project, fingerprint: fp2, created: report.meta.created, summary: _sum });
|
|
8529
|
-
|
|
8509
|
+
writeFileSync9(reportsIndexPath, JSON.stringify(idx, null, 2) + "\n");
|
|
8530
8510
|
});
|
|
8531
8511
|
try {
|
|
8532
8512
|
if (fp2 && fp2 !== "unknown") {
|
|
@@ -8583,7 +8563,7 @@ function readReport(id2) {
|
|
|
8583
8563
|
init_selection_manager();
|
|
8584
8564
|
|
|
8585
8565
|
// src/lib/credit-api.js
|
|
8586
|
-
import { readFileSync as readFileSync11, writeFileSync as
|
|
8566
|
+
import { readFileSync as readFileSync11, writeFileSync as writeFileSync10, existsSync as existsSync12 } from "node:fs";
|
|
8587
8567
|
import { join as join10 } from "node:path";
|
|
8588
8568
|
init_state();
|
|
8589
8569
|
function getVibeOSHome8() {
|
|
@@ -8654,7 +8634,7 @@ async function _snapshot() {
|
|
|
8654
8634
|
}
|
|
8655
8635
|
}
|
|
8656
8636
|
try {
|
|
8657
|
-
|
|
8637
|
+
writeFileSync10(CREDIT_CACHE_F, JSON.stringify({ total, providers: provs, ts: Date.now() }));
|
|
8658
8638
|
} catch {
|
|
8659
8639
|
}
|
|
8660
8640
|
}
|
|
@@ -9064,7 +9044,7 @@ function createTrinityTool(deps) {
|
|
|
9064
9044
|
`Model: ${activeSlot} (${tiers?.[activeSlot]?.oc || deps.currentModel || "(unset)"})`,
|
|
9065
9045
|
`Provider: ${execution.provider_label}`,
|
|
9066
9046
|
`Quality: ${execution.quality_label}`,
|
|
9067
|
-
...
|
|
9047
|
+
...isApiConnected() ? [`Backend: connected${getBackendVersion() ? ` (${getBackendVersion()})` : ""}`] : [`Backend: offline`],
|
|
9068
9048
|
...sel.requested_optimization_mode ? [`Requested mode: ${sel.requested_optimization_mode}`] : [],
|
|
9069
9049
|
...totalTurns > 0 ? [`Split: brain ${brainPct}% / worker ${workerPct}% (${totalTurns} total)`] : [],
|
|
9070
9050
|
`Thinking: ${effectiveLevel}`,
|
|
@@ -10530,12 +10510,12 @@ async function probeModel(modelId, auth, providers = null) {
|
|
|
10530
10510
|
}
|
|
10531
10511
|
|
|
10532
10512
|
// src/lib/hooks/footer.js
|
|
10533
|
-
import { readFileSync as readFileSync14, appendFileSync as appendFileSync4, mkdirSync as
|
|
10513
|
+
import { readFileSync as readFileSync14, appendFileSync as appendFileSync4, mkdirSync as mkdirSync10 } from "node:fs";
|
|
10534
10514
|
import { join as join15 } from "node:path";
|
|
10535
10515
|
|
|
10536
10516
|
// src/lib/hooks/chat-transform.js
|
|
10537
10517
|
init_state();
|
|
10538
|
-
import { readFileSync as readFileSync13, writeFileSync as
|
|
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";
|
|
10539
10519
|
import { join as join14, dirname as dirname10, basename as basename3 } from "node:path";
|
|
10540
10520
|
import { createHash as createHash3 } from "node:crypto";
|
|
10541
10521
|
|
|
@@ -10732,7 +10712,7 @@ init_selection_manager();
|
|
|
10732
10712
|
init_state();
|
|
10733
10713
|
init_pattern_helpers();
|
|
10734
10714
|
import { join as join13 } from "node:path";
|
|
10735
|
-
import { writeFileSync as
|
|
10715
|
+
import { writeFileSync as writeFileSync11 } from "node:fs";
|
|
10736
10716
|
|
|
10737
10717
|
// src/lib/text-compress.js
|
|
10738
10718
|
var VERBOSE_LINE_RE = [
|
|
@@ -11090,7 +11070,7 @@ function recordSaving(tool2, reason, saveEst, meta = {}) {
|
|
|
11090
11070
|
if (sd) {
|
|
11091
11071
|
const sp = join13(sd, "delegation-state-hint.txt");
|
|
11092
11072
|
try {
|
|
11093
|
-
|
|
11073
|
+
writeFileSync11(sp, JSON.stringify({ sid, total_savings: s.lifetime.total_savings_usd, last_reason: reason }), "utf8");
|
|
11094
11074
|
} catch {
|
|
11095
11075
|
}
|
|
11096
11076
|
}
|
|
@@ -11443,8 +11423,8 @@ function ensureProjectSkill(dir, fp2) {
|
|
|
11443
11423
|
content += "\n";
|
|
11444
11424
|
}
|
|
11445
11425
|
try {
|
|
11446
|
-
|
|
11447
|
-
|
|
11426
|
+
mkdirSync9(skillDir, { recursive: true });
|
|
11427
|
+
writeFileSync12(skillPath, content, "utf-8");
|
|
11448
11428
|
console.error(`[vibeOS] Project Guard: created .opencode/skills/${projectName}/SKILL.md`);
|
|
11449
11429
|
return { created: true, path: skillPath, skipped: false };
|
|
11450
11430
|
} catch (err) {
|
|
@@ -11561,7 +11541,7 @@ function syncControlSettings(cv, options = {}) {
|
|
|
11561
11541
|
writeSelection("previous_default_agent", oc.default_agent);
|
|
11562
11542
|
}
|
|
11563
11543
|
oc.default_agent = cv.agent_mode;
|
|
11564
|
-
|
|
11544
|
+
writeFileSync12(OC_CONFIG, JSON.stringify(oc, null, 2) + "\n");
|
|
11565
11545
|
}
|
|
11566
11546
|
}
|
|
11567
11547
|
} catch {
|
|
@@ -11574,7 +11554,7 @@ function syncControlSettings(cv, options = {}) {
|
|
|
11574
11554
|
const restoreAgent = oc.default_agent === "plan" ? resolveRestorableOpenCodeAgent(currentSel) : null;
|
|
11575
11555
|
if (restoreAgent && oc.default_agent === "plan") {
|
|
11576
11556
|
oc.default_agent = restoreAgent;
|
|
11577
|
-
|
|
11557
|
+
writeFileSync12(OC_CONFIG, JSON.stringify(oc, null, 2) + "\n");
|
|
11578
11558
|
if (currentSel.previous_default_agent)
|
|
11579
11559
|
writeSelection("previous_default_agent", null);
|
|
11580
11560
|
}
|
|
@@ -11636,10 +11616,10 @@ ${raw}
|
|
|
11636
11616
|
const sessPath = join14(getSessionScratchpadDir(), `${hash}.txt`);
|
|
11637
11617
|
const globalPath = join14(globalDir, `${hash}.txt`);
|
|
11638
11618
|
try {
|
|
11639
|
-
|
|
11619
|
+
mkdirSync9(globalDir, { recursive: true });
|
|
11640
11620
|
ensureSessionScratchpadDirs();
|
|
11641
11621
|
if (!existsSync14(globalPath)) {
|
|
11642
|
-
|
|
11622
|
+
writeFileSync12(globalPath, raw);
|
|
11643
11623
|
indexAppend(hash, part.tool, raw.length);
|
|
11644
11624
|
if (existsSync14(sessPath))
|
|
11645
11625
|
rmSync5(sessPath, { force: true });
|
|
@@ -11652,7 +11632,7 @@ ${stableJson(invPart.state.input)}
|
|
|
11652
11632
|
`).digest("hex").slice(0, 16);
|
|
11653
11633
|
const ptrPath = join14(getSessionScratchpadDir(), `${inputHash}.ptr`);
|
|
11654
11634
|
try {
|
|
11655
|
-
|
|
11635
|
+
writeFileSync12(ptrPath, JSON.stringify({ contentHash: hash, tool: part.tool }));
|
|
11656
11636
|
} catch {
|
|
11657
11637
|
}
|
|
11658
11638
|
}
|
|
@@ -11932,7 +11912,7 @@ var onSystemTransform = async (_input, output) => {
|
|
|
11932
11912
|
const system = output?.system;
|
|
11933
11913
|
if (!Array.isArray(system))
|
|
11934
11914
|
return;
|
|
11935
|
-
if (
|
|
11915
|
+
if (isApiConnected()) {
|
|
11936
11916
|
try {
|
|
11937
11917
|
const bb = loadBlackboxState();
|
|
11938
11918
|
if (!bb.enabled || _blackboxEnabled === false) {
|
|
@@ -12092,7 +12072,7 @@ var onSystemTransform = async (_input, output) => {
|
|
|
12092
12072
|
fp: currentProjectFingerprint || ""
|
|
12093
12073
|
}) + "\n";
|
|
12094
12074
|
try {
|
|
12095
|
-
|
|
12075
|
+
mkdirSync9(calDir, { recursive: true });
|
|
12096
12076
|
appendFileSync3(calFile, calRecord);
|
|
12097
12077
|
} catch {
|
|
12098
12078
|
}
|
|
@@ -12516,7 +12496,7 @@ async function _appendFooter(input, output, directory3) {
|
|
|
12516
12496
|
return;
|
|
12517
12497
|
const ltTotal = ltTasks + ltCache;
|
|
12518
12498
|
const activeSlot = selNowFooter.active_slot || "brain";
|
|
12519
|
-
const flashIcon =
|
|
12499
|
+
const flashIcon = isApiConnected() ? " \u26A1" : "";
|
|
12520
12500
|
const displayMode2 = autoSelectMode2(currentSubRegime2, _footerStress);
|
|
12521
12501
|
const vibeBrand = resolveBrand(loadOptimizationMode() || displayMode2, activeSlot);
|
|
12522
12502
|
const vibeLine = buildFooterLine({
|
|
@@ -12558,7 +12538,7 @@ ${vibeLine}`;
|
|
|
12558
12538
|
tracker.recordOutcome(finalOutcome);
|
|
12559
12539
|
syncOutcomeToApi(finalOutcome);
|
|
12560
12540
|
try {
|
|
12561
|
-
|
|
12541
|
+
mkdirSync10(getVibeOSHome10(), { recursive: true });
|
|
12562
12542
|
appendFileSync4(join15(getVibeOSHome10(), "calibration-data.jsonl"), JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), event: "outcome", sid: getSessionId(), outcome: finalOutcome }) + "\n");
|
|
12563
12543
|
} catch {
|
|
12564
12544
|
}
|
|
@@ -12586,7 +12566,7 @@ ${vibeLine} \u2014`);
|
|
|
12586
12566
|
|
|
12587
12567
|
// src/lib/hooks/tool-execute.js
|
|
12588
12568
|
init_state();
|
|
12589
|
-
import { writeFileSync as
|
|
12569
|
+
import { writeFileSync as writeFileSync14, appendFileSync as appendFileSync6, existsSync as existsSync16, mkdirSync as mkdirSync12 } from "node:fs";
|
|
12590
12570
|
import { join as join17, dirname as dirname12, basename as basename4 } from "node:path";
|
|
12591
12571
|
import { createHash as createHash5 } from "node:crypto";
|
|
12592
12572
|
init_selection_manager();
|
|
@@ -12655,7 +12635,7 @@ init_smart_cache();
|
|
|
12655
12635
|
|
|
12656
12636
|
// src/lib/tdd-enforcer.js
|
|
12657
12637
|
init_state();
|
|
12658
|
-
import { readFileSync as readFileSync15, writeFileSync as
|
|
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";
|
|
12659
12639
|
import { join as join16, dirname as dirname11 } from "node:path";
|
|
12660
12640
|
import { createHash as createHash4 } from "node:crypto";
|
|
12661
12641
|
|
|
@@ -13758,7 +13738,7 @@ var COOLDOWN_MS = 6e4;
|
|
|
13758
13738
|
var _enforcementCooldown = /* @__PURE__ */ new Set();
|
|
13759
13739
|
function _acquireLock(testPath) {
|
|
13760
13740
|
try {
|
|
13761
|
-
|
|
13741
|
+
mkdirSync11(ENFORCEMENT_LOCK_DIR, { recursive: true });
|
|
13762
13742
|
const hash = createHash4("sha256").update(testPath).digest("hex").slice(0, 16);
|
|
13763
13743
|
const lockPath = join16(ENFORCEMENT_LOCK_DIR, `${hash}.lock`);
|
|
13764
13744
|
try {
|
|
@@ -13815,13 +13795,13 @@ function _isInCooldown(testPath) {
|
|
|
13815
13795
|
}
|
|
13816
13796
|
function _recordCooldown(testPath) {
|
|
13817
13797
|
try {
|
|
13818
|
-
|
|
13798
|
+
mkdirSync11(dirname11(ENFORCEMENT_COOLDOWN_FILE2), { recursive: true });
|
|
13819
13799
|
const hash = createHash4("sha256").update(testPath).digest("hex").slice(0, 16);
|
|
13820
13800
|
const entry = JSON.stringify({ h: hash, ts: Date.now() }) + "\n";
|
|
13821
13801
|
appendFileSync5(ENFORCEMENT_COOLDOWN_FILE2, entry);
|
|
13822
13802
|
const lines = readFileSync15(ENFORCEMENT_COOLDOWN_FILE2, "utf-8").trim().split("\n").filter(Boolean);
|
|
13823
13803
|
if (lines.length > 500) {
|
|
13824
|
-
|
|
13804
|
+
writeFileSync13(ENFORCEMENT_COOLDOWN_FILE2, lines.slice(-200).join("\n") + "\n");
|
|
13825
13805
|
}
|
|
13826
13806
|
} catch {
|
|
13827
13807
|
}
|
|
@@ -13907,8 +13887,8 @@ function enforceTestFile(filePath) {
|
|
|
13907
13887
|
if (!_acquireLock(skeleton.path))
|
|
13908
13888
|
return null;
|
|
13909
13889
|
try {
|
|
13910
|
-
|
|
13911
|
-
|
|
13890
|
+
mkdirSync11(skeleton.dir, { recursive: true });
|
|
13891
|
+
writeFileSync13(skeleton.path, skeleton.content);
|
|
13912
13892
|
_enforcementCooldown.add(skeleton.path);
|
|
13913
13893
|
_recordCooldown(skeleton.path);
|
|
13914
13894
|
try {
|
|
@@ -14251,7 +14231,7 @@ ${argsJson}
|
|
|
14251
14231
|
const globalFile = join17(globalDir, `${targetHash}.txt`);
|
|
14252
14232
|
if (existsSync16(cachedFile) || existsSync16(globalFile)) {
|
|
14253
14233
|
ensureSessionScratchpadDirs();
|
|
14254
|
-
|
|
14234
|
+
writeFileSync14(ptrPath, JSON.stringify({
|
|
14255
14235
|
contentHash: targetHash,
|
|
14256
14236
|
tool: titleCase,
|
|
14257
14237
|
warmed: true,
|
|
@@ -14550,8 +14530,8 @@ ${argsJson}
|
|
|
14550
14530
|
const missed = recordMissedContext7(_estC7);
|
|
14551
14531
|
if (!existsSync16(CONTEXT7_INSTALL_FLAG)) {
|
|
14552
14532
|
try {
|
|
14553
|
-
|
|
14554
|
-
|
|
14533
|
+
mkdirSync12(dirname12(CONTEXT7_INSTALL_FLAG), { recursive: true });
|
|
14534
|
+
writeFileSync14(CONTEXT7_INSTALL_FLAG, "");
|
|
14555
14535
|
} catch {
|
|
14556
14536
|
}
|
|
14557
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\``);
|
|
@@ -14642,7 +14622,7 @@ var onToolExecuteAfter = async (input, output) => {
|
|
|
14642
14622
|
const displayMode2 = autoSelectMode2(currentSubRegime2, latestUserIntent ? scoreStress(latestUserIntent) : 0);
|
|
14643
14623
|
const vibeBrand = resolveBrand(displayMode2, activeSlot);
|
|
14644
14624
|
const sessionSlot = loadSessionSlot(currentSid);
|
|
14645
|
-
const flashIcon =
|
|
14625
|
+
const flashIcon = isApiConnected() ? " \u26A1" : "";
|
|
14646
14626
|
_footerText = buildFooterLine({
|
|
14647
14627
|
activeSlot,
|
|
14648
14628
|
providerLabel: execution.provider_label,
|
|
@@ -15259,8 +15239,8 @@ async function _seedOrRepairModelTiers(directory3) {
|
|
|
15259
15239
|
},
|
|
15260
15240
|
trinity: nextTrinity
|
|
15261
15241
|
};
|
|
15262
|
-
|
|
15263
|
-
|
|
15242
|
+
mkdirSync13(dirname13(TIERS_FILE3), { recursive: true });
|
|
15243
|
+
writeFileSync15(TIERS_FILE3, JSON.stringify(tiers, null, 2) + "\n", "utf-8");
|
|
15264
15244
|
return true;
|
|
15265
15245
|
}
|
|
15266
15246
|
function _parseJsonc(raw) {
|
|
@@ -15315,7 +15295,9 @@ function loadMcpPort() {
|
|
|
15315
15295
|
}
|
|
15316
15296
|
} catch {
|
|
15317
15297
|
}
|
|
15318
|
-
|
|
15298
|
+
if (process.env.VIBEOS_TEST_CONTEXT)
|
|
15299
|
+
return 0;
|
|
15300
|
+
return 3001;
|
|
15319
15301
|
}
|
|
15320
15302
|
function persistMcpPort(port) {
|
|
15321
15303
|
try {
|
|
@@ -15328,9 +15310,9 @@ function persistMcpPort(port) {
|
|
|
15328
15310
|
tiers.selection.mcp_port = port;
|
|
15329
15311
|
if ("mcp_port" in tiers)
|
|
15330
15312
|
delete tiers.mcp_port;
|
|
15331
|
-
|
|
15313
|
+
mkdirSync13(dirname13(getTiersFile()), { recursive: true });
|
|
15332
15314
|
const tmp = getTiersFile() + ".tmp." + Date.now();
|
|
15333
|
-
|
|
15315
|
+
writeFileSync15(tmp, JSON.stringify(tiers, null, 2) + "\n", "utf-8");
|
|
15334
15316
|
renameSync6(tmp, getTiersFile());
|
|
15335
15317
|
} catch {
|
|
15336
15318
|
}
|
|
@@ -15394,7 +15376,7 @@ async function ensureMcpServerRunning() {
|
|
|
15394
15376
|
version: readPackageVersion(),
|
|
15395
15377
|
todos: loadTodos(),
|
|
15396
15378
|
fallbackThinking: thinkingLevel(loadCredit()),
|
|
15397
|
-
backendConnected:
|
|
15379
|
+
backendConnected: isApiConnected(),
|
|
15398
15380
|
backendHealthUrl: `${VIBEOS_API_URL}/health`,
|
|
15399
15381
|
backendVersion: getBackendVersion(),
|
|
15400
15382
|
apiFallbackMode: isApiFallback2(),
|
|
@@ -15515,13 +15497,10 @@ async function ensureMcpServerRunning() {
|
|
|
15515
15497
|
}
|
|
15516
15498
|
});
|
|
15517
15499
|
}
|
|
15518
|
-
const
|
|
15519
|
-
const
|
|
15520
|
-
|
|
15521
|
-
if (actualPort && actualPort !== requestedPort)
|
|
15500
|
+
const mcpServer = await _mcpServerRuntime.start(port);
|
|
15501
|
+
const actualPort = Number(mcpServer?.address?.()?.port || port);
|
|
15502
|
+
if (actualPort && actualPort !== port)
|
|
15522
15503
|
persistMcpPort(actualPort);
|
|
15523
|
-
if (actualPort)
|
|
15524
|
-
writeDashboardBaseConfig(`http://127.0.0.1:${actualPort}`);
|
|
15525
15504
|
console.error(`[vibeOS] MCP server on http://127.0.0.1:${actualPort}`);
|
|
15526
15505
|
if (actualPort)
|
|
15527
15506
|
console.error(`[vibeOS] Dashboard at http://127.0.0.1:${actualPort}/`);
|
|
@@ -15661,9 +15640,9 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
|
|
|
15661
15640
|
};
|
|
15662
15641
|
const saveProjectStateStable = (state) => {
|
|
15663
15642
|
try {
|
|
15664
|
-
|
|
15643
|
+
mkdirSync13(dirname13(hookProjectStateFile), { recursive: true });
|
|
15665
15644
|
const tmp = hookProjectStateFile + ".tmp";
|
|
15666
|
-
|
|
15645
|
+
writeFileSync15(tmp, JSON.stringify(state, null, 2) + "\n");
|
|
15667
15646
|
renameSync6(tmp, hookProjectStateFile);
|
|
15668
15647
|
} catch {
|
|
15669
15648
|
}
|
|
@@ -15680,8 +15659,8 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
|
|
|
15680
15659
|
};
|
|
15681
15660
|
const saveReportsIndexStable = (idx) => {
|
|
15682
15661
|
try {
|
|
15683
|
-
|
|
15684
|
-
|
|
15662
|
+
mkdirSync13(hookReportsDir, { recursive: true });
|
|
15663
|
+
writeFileSync15(hookReportsIndex, JSON.stringify(idx, null, 2) + "\n");
|
|
15685
15664
|
} catch {
|
|
15686
15665
|
}
|
|
15687
15666
|
};
|
|
@@ -15690,7 +15669,7 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
|
|
|
15690
15669
|
if (!existsSync18(path))
|
|
15691
15670
|
return null;
|
|
15692
15671
|
const bkDir = join18(hookVibeHome, ".backups");
|
|
15693
|
-
|
|
15672
|
+
mkdirSync13(bkDir, { recursive: true });
|
|
15694
15673
|
const bk = join18(bkDir, `${basename5(path)}.${label}.${Date.now()}.bak`);
|
|
15695
15674
|
copyFileSync2(path, bk);
|
|
15696
15675
|
return bk;
|
|
@@ -15726,10 +15705,10 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
|
|
|
15726
15705
|
directory: directory3,
|
|
15727
15706
|
safeJsonParse: safeJsonParse3,
|
|
15728
15707
|
readFileSync: readFileSync17,
|
|
15729
|
-
writeFileSync:
|
|
15708
|
+
writeFileSync: writeFileSync15,
|
|
15730
15709
|
existsSync: existsSync18,
|
|
15731
15710
|
renameSync: renameSync6,
|
|
15732
|
-
mkdirSync:
|
|
15711
|
+
mkdirSync: mkdirSync13,
|
|
15733
15712
|
get TIERS_FILE() {
|
|
15734
15713
|
return hookTiersFile;
|
|
15735
15714
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibeostheog",
|
|
3
|
-
"version": "0.25.
|
|
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",
|