omnius 1.0.692 → 1.0.693
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +532 -292
- package/docs/DISCOVERY.json +40 -0
- package/docs/DISCOVERY.md +1 -0
- package/docs/work-orders/runtime-health-remediation/TRACKER.md +17 -0
- package/docs/work-orders/runtime-health-remediation/WO-23-long-horizon-control-plane-reconciliation.md +154 -0
- package/npm-shrinkwrap.json +51 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -112363,10 +112363,10 @@ var init_parser = __esm({
|
|
|
112363
112363
|
* the separator character will only be read on index > 0 (see
|
|
112364
112364
|
* readIPv4Addr for an example)
|
|
112365
112365
|
*/
|
|
112366
|
-
readSeparator(
|
|
112366
|
+
readSeparator(sep16, index, inner) {
|
|
112367
112367
|
return this.readAtomically(() => {
|
|
112368
112368
|
if (index > 0) {
|
|
112369
|
-
if (this.readGivenChar(
|
|
112369
|
+
if (this.readGivenChar(sep16) === void 0) {
|
|
112370
112370
|
return void 0;
|
|
112371
112371
|
}
|
|
112372
112372
|
}
|
|
@@ -212996,7 +212996,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
212996
212996
|
"../node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
212997
212997
|
"use strict";
|
|
212998
212998
|
var { writeFile: writeFile31, readFile: readFile30, mkdir: mkdir29 } = __require("node:fs/promises");
|
|
212999
|
-
var { dirname:
|
|
212999
|
+
var { dirname: dirname88, resolve: resolve103 } = __require("node:path");
|
|
213000
213000
|
var { setTimeout: setTimeout3, clearTimeout: clearTimeout3 } = __require("node:timers");
|
|
213001
213001
|
var { InvalidArgumentError, UndiciError } = require_errors2();
|
|
213002
213002
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -213227,7 +213227,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
213227
213227
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
213228
213228
|
}
|
|
213229
213229
|
const resolvedPath = resolve103(path16);
|
|
213230
|
-
await mkdir29(
|
|
213230
|
+
await mkdir29(dirname88(resolvedPath), { recursive: true });
|
|
213231
213231
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
213232
213232
|
hash: hash2,
|
|
213233
213233
|
snapshot
|
|
@@ -326889,15 +326889,15 @@ var init_ls = __esm({
|
|
|
326889
326889
|
});
|
|
326890
326890
|
|
|
326891
326891
|
// ../node_modules/@helia/unixfs/dist/src/commands/mkdir.js
|
|
326892
|
-
async function mkdir8(parentCid,
|
|
326893
|
-
if (
|
|
326892
|
+
async function mkdir8(parentCid, dirname88, blockstore, options2 = {}) {
|
|
326893
|
+
if (dirname88.includes("/")) {
|
|
326894
326894
|
throw new InvalidParametersError4("Path must not have slashes");
|
|
326895
326895
|
}
|
|
326896
326896
|
const entry = await exporter2(parentCid, blockstore, options2);
|
|
326897
326897
|
if (entry.type !== "directory") {
|
|
326898
326898
|
throw new NotADirectoryError(`${parentCid.toString()} was not a UnixFS directory`);
|
|
326899
326899
|
}
|
|
326900
|
-
log16("creating %s",
|
|
326900
|
+
log16("creating %s", dirname88);
|
|
326901
326901
|
const metadata = new UnixFS({
|
|
326902
326902
|
type: "directory",
|
|
326903
326903
|
mode: options2.mode,
|
|
@@ -326913,9 +326913,9 @@ async function mkdir8(parentCid, dirname87, blockstore, options2 = {}) {
|
|
|
326913
326913
|
await blockstore.put(emptyDirCid, buf);
|
|
326914
326914
|
const [directory, pblink] = await Promise.all([
|
|
326915
326915
|
cidToDirectory(parentCid, blockstore, options2),
|
|
326916
|
-
cidToPBLink(emptyDirCid,
|
|
326916
|
+
cidToPBLink(emptyDirCid, dirname88, blockstore, options2)
|
|
326917
326917
|
]);
|
|
326918
|
-
log16("adding empty dir called %s to %c",
|
|
326918
|
+
log16("adding empty dir called %s to %c", dirname88, parentCid);
|
|
326919
326919
|
const result = await addLink(directory, pblink, blockstore, {
|
|
326920
326920
|
...options2,
|
|
326921
326921
|
allowOverwriting: options2.force
|
|
@@ -327414,8 +327414,8 @@ var init_unixfs2 = __esm({
|
|
|
327414
327414
|
async *ls(cid, options2 = {}) {
|
|
327415
327415
|
yield* ls(cid, this.components.blockstore, options2);
|
|
327416
327416
|
}
|
|
327417
|
-
async mkdir(cid,
|
|
327418
|
-
return mkdir8(cid,
|
|
327417
|
+
async mkdir(cid, dirname88, options2 = {}) {
|
|
327418
|
+
return mkdir8(cid, dirname88, this.components.blockstore, options2);
|
|
327419
327419
|
}
|
|
327420
327420
|
async rm(cid, path16, options2 = {}) {
|
|
327421
327421
|
return rm6(cid, path16, this.components.blockstore, options2);
|
|
@@ -330860,7 +330860,7 @@ var require_pattern = __commonJS({
|
|
|
330860
330860
|
const absolute = [];
|
|
330861
330861
|
const relative31 = [];
|
|
330862
330862
|
for (const pattern of patterns) {
|
|
330863
|
-
if (
|
|
330863
|
+
if (isAbsolute27(pattern)) {
|
|
330864
330864
|
absolute.push(pattern);
|
|
330865
330865
|
} else {
|
|
330866
330866
|
relative31.push(pattern);
|
|
@@ -330869,10 +330869,10 @@ var require_pattern = __commonJS({
|
|
|
330869
330869
|
return [absolute, relative31];
|
|
330870
330870
|
}
|
|
330871
330871
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
330872
|
-
function
|
|
330872
|
+
function isAbsolute27(pattern) {
|
|
330873
330873
|
return path16.isAbsolute(pattern);
|
|
330874
330874
|
}
|
|
330875
|
-
exports.isAbsolute =
|
|
330875
|
+
exports.isAbsolute = isAbsolute27;
|
|
330876
330876
|
}
|
|
330877
330877
|
});
|
|
330878
330878
|
|
|
@@ -361391,7 +361391,7 @@ var require_util9 = __commonJS({
|
|
|
361391
361391
|
}
|
|
361392
361392
|
path16 = url.path;
|
|
361393
361393
|
}
|
|
361394
|
-
var
|
|
361394
|
+
var isAbsolute27 = exports.isAbsolute(path16);
|
|
361395
361395
|
var parts = path16.split(/\/+/);
|
|
361396
361396
|
for (var part, up = 0, i2 = parts.length - 1; i2 >= 0; i2--) {
|
|
361397
361397
|
part = parts[i2];
|
|
@@ -361411,7 +361411,7 @@ var require_util9 = __commonJS({
|
|
|
361411
361411
|
}
|
|
361412
361412
|
path16 = parts.join("/");
|
|
361413
361413
|
if (path16 === "") {
|
|
361414
|
-
path16 =
|
|
361414
|
+
path16 = isAbsolute27 ? "/" : ".";
|
|
361415
361415
|
}
|
|
361416
361416
|
if (url) {
|
|
361417
361417
|
url.path = path16;
|
|
@@ -411606,11 +411606,11 @@ ${lanes.join("\n")}
|
|
|
411606
411606
|
if (i2 < rootLength) {
|
|
411607
411607
|
return void 0;
|
|
411608
411608
|
}
|
|
411609
|
-
const
|
|
411610
|
-
if (
|
|
411609
|
+
const sep16 = directory.lastIndexOf(directorySeparator, i2 - 1);
|
|
411610
|
+
if (sep16 === -1) {
|
|
411611
411611
|
return void 0;
|
|
411612
411612
|
}
|
|
411613
|
-
return directory.substr(0, Math.max(
|
|
411613
|
+
return directory.substr(0, Math.max(sep16, rootLength));
|
|
411614
411614
|
}
|
|
411615
411615
|
}
|
|
411616
411616
|
}
|
|
@@ -576978,7 +576978,7 @@ var require_path_browserify = __commonJS({
|
|
|
576978
576978
|
}
|
|
576979
576979
|
return res;
|
|
576980
576980
|
}
|
|
576981
|
-
function _format(
|
|
576981
|
+
function _format(sep16, pathObject) {
|
|
576982
576982
|
var dir = pathObject.dir || pathObject.root;
|
|
576983
576983
|
var base3 = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
576984
576984
|
if (!dir) {
|
|
@@ -576987,7 +576987,7 @@ var require_path_browserify = __commonJS({
|
|
|
576987
576987
|
if (dir === pathObject.root) {
|
|
576988
576988
|
return dir + base3;
|
|
576989
576989
|
}
|
|
576990
|
-
return dir +
|
|
576990
|
+
return dir + sep16 + base3;
|
|
576991
576991
|
}
|
|
576992
576992
|
var posix = {
|
|
576993
576993
|
// path.resolve([from ...], to)
|
|
@@ -577026,15 +577026,15 @@ var require_path_browserify = __commonJS({
|
|
|
577026
577026
|
normalize: function normalize6(path16) {
|
|
577027
577027
|
assertPath(path16);
|
|
577028
577028
|
if (path16.length === 0) return ".";
|
|
577029
|
-
var
|
|
577029
|
+
var isAbsolute27 = path16.charCodeAt(0) === 47;
|
|
577030
577030
|
var trailingSeparator = path16.charCodeAt(path16.length - 1) === 47;
|
|
577031
|
-
path16 = normalizeStringPosix(path16, !
|
|
577032
|
-
if (path16.length === 0 && !
|
|
577031
|
+
path16 = normalizeStringPosix(path16, !isAbsolute27);
|
|
577032
|
+
if (path16.length === 0 && !isAbsolute27) path16 = ".";
|
|
577033
577033
|
if (path16.length > 0 && trailingSeparator) path16 += "/";
|
|
577034
|
-
if (
|
|
577034
|
+
if (isAbsolute27) return "/" + path16;
|
|
577035
577035
|
return path16;
|
|
577036
577036
|
},
|
|
577037
|
-
isAbsolute: function
|
|
577037
|
+
isAbsolute: function isAbsolute27(path16) {
|
|
577038
577038
|
assertPath(path16);
|
|
577039
577039
|
return path16.length > 0 && path16.charCodeAt(0) === 47;
|
|
577040
577040
|
},
|
|
@@ -577125,7 +577125,7 @@ var require_path_browserify = __commonJS({
|
|
|
577125
577125
|
_makeLong: function _makeLong(path16) {
|
|
577126
577126
|
return path16;
|
|
577127
577127
|
},
|
|
577128
|
-
dirname: function
|
|
577128
|
+
dirname: function dirname88(path16) {
|
|
577129
577129
|
assertPath(path16);
|
|
577130
577130
|
if (path16.length === 0) return ".";
|
|
577131
577131
|
var code8 = path16.charCodeAt(0);
|
|
@@ -577248,9 +577248,9 @@ var require_path_browserify = __commonJS({
|
|
|
577248
577248
|
var ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
577249
577249
|
if (path16.length === 0) return ret;
|
|
577250
577250
|
var code8 = path16.charCodeAt(0);
|
|
577251
|
-
var
|
|
577251
|
+
var isAbsolute27 = code8 === 47;
|
|
577252
577252
|
var start2;
|
|
577253
|
-
if (
|
|
577253
|
+
if (isAbsolute27) {
|
|
577254
577254
|
ret.root = "/";
|
|
577255
577255
|
start2 = 1;
|
|
577256
577256
|
} else {
|
|
@@ -577286,11 +577286,11 @@ var require_path_browserify = __commonJS({
|
|
|
577286
577286
|
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
577287
577287
|
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
577288
577288
|
if (end !== -1) {
|
|
577289
|
-
if (startPart === 0 &&
|
|
577289
|
+
if (startPart === 0 && isAbsolute27) ret.base = ret.name = path16.slice(1, end);
|
|
577290
577290
|
else ret.base = ret.name = path16.slice(startPart, end);
|
|
577291
577291
|
}
|
|
577292
577292
|
} else {
|
|
577293
|
-
if (startPart === 0 &&
|
|
577293
|
+
if (startPart === 0 && isAbsolute27) {
|
|
577294
577294
|
ret.name = path16.slice(1, startDot);
|
|
577295
577295
|
ret.base = path16.slice(1, end);
|
|
577296
577296
|
} else {
|
|
@@ -577300,7 +577300,7 @@ var require_path_browserify = __commonJS({
|
|
|
577300
577300
|
ret.ext = path16.slice(startDot, end);
|
|
577301
577301
|
}
|
|
577302
577302
|
if (startPart > 0) ret.dir = path16.slice(0, startPart - 1);
|
|
577303
|
-
else if (
|
|
577303
|
+
else if (isAbsolute27) ret.dir = "/";
|
|
577304
577304
|
return ret;
|
|
577305
577305
|
},
|
|
577306
577306
|
sep: "/",
|
|
@@ -617600,10 +617600,10 @@ var init_transport5 = __esm({
|
|
|
617600
617600
|
if (done)
|
|
617601
617601
|
break;
|
|
617602
617602
|
buf += decoder.decode(value2, { stream: true });
|
|
617603
|
-
let
|
|
617604
|
-
while ((
|
|
617605
|
-
const event = buf.slice(0,
|
|
617606
|
-
buf = buf.slice(
|
|
617603
|
+
let sep16;
|
|
617604
|
+
while ((sep16 = buf.indexOf("\n\n")) !== -1) {
|
|
617605
|
+
const event = buf.slice(0, sep16);
|
|
617606
|
+
buf = buf.slice(sep16 + 2);
|
|
617607
617607
|
const dataLines = [];
|
|
617608
617608
|
for (const line of event.split("\n")) {
|
|
617609
617609
|
if (line.startsWith("data:"))
|
|
@@ -633037,7 +633037,7 @@ function integrationClosureCompletionBlockers(closure) {
|
|
|
633037
633037
|
blockers.push(`${claim.label}: hardware claim lacks delivery-path evidence.`);
|
|
633038
633038
|
}
|
|
633039
633039
|
}
|
|
633040
|
-
return unique2(blockers, 8);
|
|
633040
|
+
return unique2([...blockers, ...closure.frontier.survivingBlockers], 8);
|
|
633041
633041
|
}
|
|
633042
633042
|
function buildIntegrationClosure(input) {
|
|
633043
633043
|
const ledger = input.ledger ?? void 0;
|
|
@@ -633069,7 +633069,6 @@ function buildIntegrationClosure(input) {
|
|
|
633069
633069
|
});
|
|
633070
633070
|
const pathReasons = /* @__PURE__ */ new Map();
|
|
633071
633071
|
const requiredPaths = discovery?.requiredArtifactPaths ?? [];
|
|
633072
|
-
const candidatePaths = discovery?.candidatePaths ?? [];
|
|
633073
633072
|
const addPath = (rawPath, reason) => {
|
|
633074
633073
|
const path16 = pathKey(rawPath);
|
|
633075
633074
|
if (!path16)
|
|
@@ -633099,12 +633098,30 @@ function buildIntegrationClosure(input) {
|
|
|
633099
633098
|
for (const path16 of requiredPaths) {
|
|
633100
633099
|
addPath(path16, discovery?.pathReasons?.[path16] || "explicit task artifact");
|
|
633101
633100
|
}
|
|
633102
|
-
for (const path16 of candidatePaths) {
|
|
633103
|
-
addPath(path16, discovery?.pathReasons?.[path16] || "bounded workspace lead");
|
|
633104
|
-
}
|
|
633105
633101
|
for (const path16 of input.modifiedPaths ?? []) {
|
|
633106
633102
|
addPath(path16, "modified during this run");
|
|
633107
633103
|
}
|
|
633104
|
+
const unresolvedTodos = [...input.unresolvedTodos ?? []];
|
|
633105
|
+
for (const todo of unresolvedTodos) {
|
|
633106
|
+
const todoId = nodeId("requirement", `todo:${todo.id}`);
|
|
633107
|
+
addNode({
|
|
633108
|
+
id: todoId,
|
|
633109
|
+
kind: "requirement",
|
|
633110
|
+
label: `[${todo.status}] ${clean3(todo.label, 300)}`,
|
|
633111
|
+
state: todo.status === "blocked" ? "blocked" : "open",
|
|
633112
|
+
provenance: "controller"
|
|
633113
|
+
});
|
|
633114
|
+
addEdge({
|
|
633115
|
+
id: edgeId(requirementId, "requires", todoId),
|
|
633116
|
+
from: requirementId,
|
|
633117
|
+
to: todoId,
|
|
633118
|
+
relation: "requires",
|
|
633119
|
+
state: todo.status === "blocked" ? "blocked" : "open",
|
|
633120
|
+
provenance: "controller",
|
|
633121
|
+
reason: `authoritative todo ${todo.id} remains ${todo.status}`
|
|
633122
|
+
});
|
|
633123
|
+
}
|
|
633124
|
+
const activeFailures = [...input.activeFailures ?? []];
|
|
633108
633125
|
const evidence = (ledger?.evidence ?? []).slice(-MAX_EVIDENCE);
|
|
633109
633126
|
for (const item of evidence) {
|
|
633110
633127
|
const evidenceId = nodeId("evidence", item.id);
|
|
@@ -633280,11 +633297,14 @@ function buildIntegrationClosure(input) {
|
|
|
633280
633297
|
const unresolved = ledger?.unresolved ?? [];
|
|
633281
633298
|
const discoveryBlocksCompletion = discovery?.requiresEvidence === true;
|
|
633282
633299
|
const proofGaps = unique2([
|
|
633300
|
+
...unresolvedTodos.map((todo) => `todo ${todo.id} remains ${todo.status}: ${clean3(todo.label, 220)}`),
|
|
633283
633301
|
...(discoveryBlocksCompletion ? discovery?.openDeltas ?? [] : []).map((delta) => `${delta.path}: ${delta.reason}`),
|
|
633284
633302
|
...unresolved.map((item) => item.text),
|
|
633285
633303
|
...claims.filter((claim) => claim.status !== "supported").filter(claimRequiresClosure).map((claim) => `${claim.id}: ${claim.requiredCheck}`)
|
|
633286
633304
|
], MAX_GAPS);
|
|
633287
633305
|
const blockers = unique2([
|
|
633306
|
+
...activeFailures.map((failure2) => `${failure2.id}: ${clean3(failure2.label, 240)}`),
|
|
633307
|
+
...unresolvedTodos.filter((todo) => todo.status === "blocked").map((todo) => `todo ${todo.id} is blocked: ${clean3(todo.label, 220)}`),
|
|
633288
633308
|
...discoveryBlocksCompletion ? discovery?.survivingBlockers ?? [] : [],
|
|
633289
633309
|
...discoveryBlocksCompletion ? discovery?.unresolvedQuestions ?? [] : [],
|
|
633290
633310
|
...claims.filter((claim) => claim.status === "blocked" || claim.status === "contradicted").map((claim) => `${claim.id}: ${claim.text}`)
|
|
@@ -633308,6 +633328,7 @@ function buildIntegrationClosure(input) {
|
|
|
633308
633328
|
});
|
|
633309
633329
|
}
|
|
633310
633330
|
const nextEvidence = unique2([
|
|
633331
|
+
...unresolvedTodos.map((todo) => `Resolve todo ${todo.id}: ${clean3(todo.label, 220)}`),
|
|
633311
633332
|
...claims.filter((claim) => claim.status !== "supported").filter(claimRequiresClosure).map((claim) => claim.requiredCheck),
|
|
633312
633333
|
...(discoveryBlocksCompletion ? discovery?.openDeltas ?? [] : []).map((delta) => `Inspect ${delta.path} from authoritative source: ${delta.reason}`)
|
|
633313
633334
|
], 6);
|
|
@@ -652367,12 +652388,12 @@ function numericRequestOption(request, camelName, snakeName, fallback) {
|
|
|
652367
652388
|
}
|
|
652368
652389
|
function classify(message2) {
|
|
652369
652390
|
const content = contentText(message2.content);
|
|
652370
|
-
if (message2.role === "user" || /\[CURRENT USER GOAL\]|\[ACTIVE USER STEERING\]/.test(content))
|
|
652371
|
-
return "authorityTokens";
|
|
652372
652391
|
if (/\[ADMITTED_FILE_READ|<recovered-file|\[VERIFIED[_ ]RUNTIME[_ ]FILE[_ ]READ\]|\[SHELL TRANSCRIPT\]|\[FILE CONTEXT\]/.test(content))
|
|
652373
652392
|
return "evidenceTokens";
|
|
652374
|
-
if (/\[CONTROLLER STATE v1\]|\[RECENT ACTION GROUND TRUTH\]|<task-state|\[ACTIVE CONTEXT FRAME\]|\[CONTEXT FRAME|\[RUN EVIDENCE\]/.test(content))
|
|
652393
|
+
if (/\[CANONICAL CONTEXT PROJECTION|\[OPERATIONAL WORK GRAPH|\[CONTROLLER STATE v1\]|\[RECENT ACTION GROUND TRUTH\]|<task-state|\[ACTIVE CONTEXT FRAME\]|\[CONTEXT FRAME|\[RUN EVIDENCE\]/.test(content))
|
|
652375
652394
|
return "taskAndWorkingSetTokens";
|
|
652395
|
+
if (message2.role === "user" || /\[CURRENT USER GOAL\]|\[ACTIVE USER STEERING\]/.test(content))
|
|
652396
|
+
return "authorityTokens";
|
|
652376
652397
|
return message2.role === "system" ? "stableSystemTokens" : "historyTokens";
|
|
652377
652398
|
}
|
|
652378
652399
|
function compileOutboundRequestBudget(input) {
|
|
@@ -652667,18 +652688,18 @@ function analyzeContextWindowDumpRequest(request) {
|
|
|
652667
652688
|
};
|
|
652668
652689
|
}
|
|
652669
652690
|
function contextSourceForMessage(role, text3) {
|
|
652691
|
+
if (/\[CANONICAL CONTEXT PROJECTION|\[OPERATIONAL WORK GRAPH|\[CONTROLLER STATE v1\]|\[RECENT ACTION GROUND TRUTH\]/.test(text3)) {
|
|
652692
|
+
return "current_controller_state";
|
|
652693
|
+
}
|
|
652694
|
+
if (/\[ACTIVE CONTEXT FRAME\]|Evidence already gathered this run/.test(text3)) {
|
|
652695
|
+
return "active_evidence";
|
|
652696
|
+
}
|
|
652670
652697
|
if (/\[ACTIVE USER STEERING\]/.test(text3)) {
|
|
652671
652698
|
return "active_user_steering";
|
|
652672
652699
|
}
|
|
652673
652700
|
if (/\[ACTIVE USER INTENT\]|\[CURRENT USER GOAL\]/.test(text3)) {
|
|
652674
652701
|
return "current_user_intent";
|
|
652675
652702
|
}
|
|
652676
|
-
if (/\[CONTROLLER STATE v1\]|\[RECENT ACTION GROUND TRUTH\]/.test(text3)) {
|
|
652677
|
-
return "current_controller_state";
|
|
652678
|
-
}
|
|
652679
|
-
if (/\[ACTIVE CONTEXT FRAME\]|Evidence already gathered this run/.test(text3)) {
|
|
652680
|
-
return "active_evidence";
|
|
652681
|
-
}
|
|
652682
652703
|
if (role === "tool")
|
|
652683
652704
|
return "tool_result";
|
|
652684
652705
|
if (role === "system")
|
|
@@ -653495,8 +653516,8 @@ var init_adversaryStream = __esm({
|
|
|
653495
653516
|
return;
|
|
653496
653517
|
try {
|
|
653497
653518
|
const { writeFileSync: writeFileSync125, mkdirSync: mkdirSync142, existsSync: existsSync208 } = __require("node:fs");
|
|
653498
|
-
const { dirname:
|
|
653499
|
-
const dir =
|
|
653519
|
+
const { dirname: dirname88 } = __require("node:path");
|
|
653520
|
+
const dir = dirname88(this.persistPath);
|
|
653500
653521
|
if (!existsSync208(dir))
|
|
653501
653522
|
mkdirSync142(dir, { recursive: true });
|
|
653502
653523
|
writeFileSync125(this.persistPath, JSON.stringify({ ledger: this.ledger }, null, 2));
|
|
@@ -659866,9 +659887,9 @@ var init_prompt_cache = __esm({
|
|
|
659866
659887
|
});
|
|
659867
659888
|
|
|
659868
659889
|
// packages/orchestrator/dist/git-progress.js
|
|
659869
|
-
import { existsSync as existsSync120, readFileSync as readFileSync96, statSync as statSync46 } from "node:fs";
|
|
659890
|
+
import { existsSync as existsSync120, readFileSync as readFileSync96, realpathSync, statSync as statSync46 } from "node:fs";
|
|
659870
659891
|
import { createHash as createHash62 } from "node:crypto";
|
|
659871
|
-
import {
|
|
659892
|
+
import { dirname as dirname52, isAbsolute as isAbsolute21, relative as relative20, resolve as resolve67 } from "node:path";
|
|
659872
659893
|
function isRunnerOwnedGitPath(path16) {
|
|
659873
659894
|
const normalized4 = normalizeGitPath(path16);
|
|
659874
659895
|
return RUNNER_OWNED_PREFIXES.some((prefix) => normalized4.startsWith(prefix));
|
|
@@ -659968,16 +659989,28 @@ function statusMap(entries2) {
|
|
|
659968
659989
|
function pathsFromStatus(entries2) {
|
|
659969
659990
|
return normalizePathList(entries2.map((entry) => entry.path));
|
|
659970
659991
|
}
|
|
659992
|
+
function pathWithin(root, candidate) {
|
|
659993
|
+
const rel = relative20(resolve67(root), resolve67(candidate));
|
|
659994
|
+
return rel === "" || rel !== ".." && !rel.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) && !isAbsolute21(rel);
|
|
659995
|
+
}
|
|
659971
659996
|
function normalizeMutatedPath(repoRoot, path16) {
|
|
659972
|
-
const
|
|
659973
|
-
if (!
|
|
659997
|
+
const raw = path16.trim();
|
|
659998
|
+
if (!raw)
|
|
659974
659999
|
return "";
|
|
659975
|
-
const absolute = resolve67(repoRoot,
|
|
659976
|
-
|
|
659977
|
-
|
|
659978
|
-
|
|
660000
|
+
const absolute = isAbsolute21(raw) ? resolve67(raw) : resolve67(repoRoot, raw);
|
|
660001
|
+
if (!pathWithin(repoRoot, absolute))
|
|
660002
|
+
return "";
|
|
660003
|
+
return normalizeGitPath(relative20(repoRoot, absolute));
|
|
660004
|
+
}
|
|
660005
|
+
function nearestExistingPath(path16) {
|
|
660006
|
+
let current = resolve67(path16);
|
|
660007
|
+
while (!existsSync120(current)) {
|
|
660008
|
+
const parent = dirname52(current);
|
|
660009
|
+
if (parent === current)
|
|
660010
|
+
return null;
|
|
660011
|
+
current = parent;
|
|
659979
660012
|
}
|
|
659980
|
-
return
|
|
660013
|
+
return current;
|
|
659981
660014
|
}
|
|
659982
660015
|
function pathInScope(path16, ownedFiles) {
|
|
659983
660016
|
if (ownedFiles.length === 0)
|
|
@@ -660064,6 +660097,7 @@ async function detectGitProgressBaseline(input) {
|
|
|
660064
660097
|
touchedBaselineDirtyPaths: [],
|
|
660065
660098
|
outsideOwnedScopePaths: [],
|
|
660066
660099
|
sessionId: input.sessionId,
|
|
660100
|
+
baselineProvenance: input.baselineProvenance ?? "launch",
|
|
660067
660101
|
checkpoints: [
|
|
660068
660102
|
{
|
|
660069
660103
|
id: `baseline-${input.sessionId}`,
|
|
@@ -660092,14 +660126,85 @@ async function detectGitProgressBaseline(input) {
|
|
|
660092
660126
|
touchedBaselineDirtyPaths: [],
|
|
660093
660127
|
outsideOwnedScopePaths: [],
|
|
660094
660128
|
sessionId: input.sessionId,
|
|
660129
|
+
baselineProvenance: input.baselineProvenance ?? "launch",
|
|
660095
660130
|
checkpoints: [],
|
|
660096
660131
|
error: err instanceof Error ? err.message : String(err)
|
|
660097
660132
|
};
|
|
660098
660133
|
}
|
|
660099
660134
|
}
|
|
660135
|
+
async function detectGitProgressBaselineFromPaths(input) {
|
|
660136
|
+
const workspaceRoot = resolve67(input.cwd || process.cwd());
|
|
660137
|
+
let canonicalWorkspaceRoot = workspaceRoot;
|
|
660138
|
+
try {
|
|
660139
|
+
canonicalWorkspaceRoot = realpathSync(workspaceRoot);
|
|
660140
|
+
} catch {
|
|
660141
|
+
return null;
|
|
660142
|
+
}
|
|
660143
|
+
const repoRoots = /* @__PURE__ */ new Set();
|
|
660144
|
+
for (const rawPath of input.paths) {
|
|
660145
|
+
const trimmed = rawPath.trim();
|
|
660146
|
+
if (!trimmed)
|
|
660147
|
+
continue;
|
|
660148
|
+
const target = isAbsolute21(trimmed) ? resolve67(trimmed) : resolve67(workspaceRoot, trimmed);
|
|
660149
|
+
if (!pathWithin(workspaceRoot, target))
|
|
660150
|
+
return null;
|
|
660151
|
+
const existingPath = nearestExistingPath(target);
|
|
660152
|
+
if (!existingPath)
|
|
660153
|
+
return null;
|
|
660154
|
+
let canonicalExistingPath;
|
|
660155
|
+
try {
|
|
660156
|
+
canonicalExistingPath = realpathSync(existingPath);
|
|
660157
|
+
} catch {
|
|
660158
|
+
return null;
|
|
660159
|
+
}
|
|
660160
|
+
if (!pathWithin(canonicalWorkspaceRoot, canonicalExistingPath))
|
|
660161
|
+
return null;
|
|
660162
|
+
const canonicalDirectory = statSync46(canonicalExistingPath).isDirectory() ? canonicalExistingPath : dirname52(canonicalExistingPath);
|
|
660163
|
+
try {
|
|
660164
|
+
const repoRoot = resolve67((await execFileText4("git", ["rev-parse", "--show-toplevel"], {
|
|
660165
|
+
cwd: canonicalDirectory,
|
|
660166
|
+
timeout: 5e3
|
|
660167
|
+
})).trim());
|
|
660168
|
+
let canonicalRepoRoot;
|
|
660169
|
+
try {
|
|
660170
|
+
canonicalRepoRoot = realpathSync(repoRoot);
|
|
660171
|
+
} catch {
|
|
660172
|
+
return null;
|
|
660173
|
+
}
|
|
660174
|
+
if (!pathWithin(canonicalWorkspaceRoot, canonicalRepoRoot))
|
|
660175
|
+
return null;
|
|
660176
|
+
repoRoots.add(canonicalRepoRoot);
|
|
660177
|
+
} catch {
|
|
660178
|
+
return null;
|
|
660179
|
+
}
|
|
660180
|
+
}
|
|
660181
|
+
if (repoRoots.size !== 1)
|
|
660182
|
+
return null;
|
|
660183
|
+
return detectGitProgressBaseline({
|
|
660184
|
+
cwd: [...repoRoots][0],
|
|
660185
|
+
sessionId: input.sessionId,
|
|
660186
|
+
baselineProvenance: input.baselineProvenance ?? "path_preflight"
|
|
660187
|
+
});
|
|
660188
|
+
}
|
|
660100
660189
|
async function refreshGitProgressState(state5, input) {
|
|
660101
|
-
if (!state5
|
|
660190
|
+
if (!state5)
|
|
660102
660191
|
return state5;
|
|
660192
|
+
if (!state5.enabled || !state5.available || !state5.repoRoot) {
|
|
660193
|
+
if (!input.cwd || (input.mutatedPaths?.length ?? 0) === 0)
|
|
660194
|
+
return state5;
|
|
660195
|
+
const discovered = await detectGitProgressBaselineFromPaths({
|
|
660196
|
+
cwd: input.cwd,
|
|
660197
|
+
sessionId: state5.sessionId,
|
|
660198
|
+
paths: input.mutatedPaths ?? [],
|
|
660199
|
+
baselineProvenance: "late_unknown"
|
|
660200
|
+
});
|
|
660201
|
+
if (!discovered?.enabled || !discovered.available)
|
|
660202
|
+
return state5;
|
|
660203
|
+
return refreshGitProgressState(discovered, {
|
|
660204
|
+
...input,
|
|
660205
|
+
mutatedPaths: []
|
|
660206
|
+
});
|
|
660207
|
+
}
|
|
660103
660208
|
const repoRoot = state5.repoRoot;
|
|
660104
660209
|
try {
|
|
660105
660210
|
const [statusRaw, diffStatRaw, nameStatusRaw, branchRaw, headRaw] = await Promise.all([
|
|
@@ -660202,6 +660307,7 @@ function renderGitProgressContextBlock(state5) {
|
|
|
660202
660307
|
"<git-state>",
|
|
660203
660308
|
"[GIT TRACKING — runtime-owned observe-only state]",
|
|
660204
660309
|
`repo_root=${state5.repoRoot}`,
|
|
660310
|
+
`baseline_provenance=${state5.baselineProvenance ?? "launch"}`,
|
|
660205
660311
|
`branch=${state5.branch ?? "(detached/unknown)"} head=${state5.head?.slice(0, 12) ?? "(none)"}`,
|
|
660206
660312
|
`baseline_user_dirty=${state5.baselineDirtyPaths.length} baseline_user_untracked=${state5.baselineUntrackedPaths.length}`,
|
|
660207
660313
|
`current_dirty=${state5.currentDirtyPaths.length} current_untracked=${state5.currentUntrackedPaths.length}`,
|
|
@@ -660245,6 +660351,7 @@ function summarizeGitProgressForTrajectory(state5) {
|
|
|
660245
660351
|
repoRoot: state5.repoRoot,
|
|
660246
660352
|
branch: state5.branch,
|
|
660247
660353
|
head: state5.head,
|
|
660354
|
+
baselineProvenance: state5.baselineProvenance,
|
|
660248
660355
|
baselineDirtyCount: state5.baselineDirtyPaths.length,
|
|
660249
660356
|
baselineUntrackedCount: state5.baselineUntrackedPaths.length,
|
|
660250
660357
|
currentDirtyCount: state5.currentDirtyPaths.length,
|
|
@@ -660505,7 +660612,7 @@ __export(postActionVerifier_exports, {
|
|
|
660505
660612
|
verifyShellOutcome: () => verifyShellOutcome
|
|
660506
660613
|
});
|
|
660507
660614
|
import { existsSync as existsSync122, readFileSync as readFileSync98, readdirSync as readdirSync40, statSync as statSync48 } from "node:fs";
|
|
660508
|
-
import { isAbsolute as
|
|
660615
|
+
import { isAbsolute as isAbsolute22, join as join134, resolve as resolve68 } from "node:path";
|
|
660509
660616
|
function classifyShellIntent(cmd) {
|
|
660510
660617
|
const stripped = cmd.replace(/^cd\s+\S+\s*&&\s*/, "").trim();
|
|
660511
660618
|
const tokens3 = stripped.split(/\s+/).filter(Boolean);
|
|
@@ -660588,7 +660695,7 @@ function isProjectTarget(value2, workspaceRoot) {
|
|
|
660588
660695
|
const path16 = unquotePath(value2);
|
|
660589
660696
|
if (!path16 || path16 === "/dev/null" || isEphemeralTarget(path16))
|
|
660590
660697
|
return false;
|
|
660591
|
-
if (!
|
|
660698
|
+
if (!isAbsolute22(path16))
|
|
660592
660699
|
return true;
|
|
660593
660700
|
const absolute = resolve68(path16);
|
|
660594
660701
|
const root = resolve68(workspaceRoot);
|
|
@@ -663724,7 +663831,7 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663724
663831
|
}
|
|
663725
663832
|
_recordFailureRecoveryOnWorkboard(toolName, args, result, diagnosis, count) {
|
|
663726
663833
|
if (!diagnosis.createRecoveryCard && count < 2)
|
|
663727
|
-
return;
|
|
663834
|
+
return null;
|
|
663728
663835
|
const dir = this._workboardDir();
|
|
663729
663836
|
const runId = this.currentArtifactRunId();
|
|
663730
663837
|
const actor = this.options.subAgent ? "sub-agent" : "agent";
|
|
@@ -663768,6 +663875,10 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663768
663875
|
});
|
|
663769
663876
|
}
|
|
663770
663877
|
}
|
|
663878
|
+
const persistedBoard = readActiveWorkboardSnapshot(dir, runId);
|
|
663879
|
+
if (!persistedBoard?.cards.some((card) => card.id === cardInput.id)) {
|
|
663880
|
+
return null;
|
|
663881
|
+
}
|
|
663771
663882
|
const command = typeof args["command"] === "string" ? args["command"].slice(0, 200) : void 0;
|
|
663772
663883
|
const ref = typeof args["path"] === "string" ? args["path"].slice(0, 200) : void 0;
|
|
663773
663884
|
const raw = (result.error || result.output || result.llmContent || "").toString().slice(0, 1200);
|
|
@@ -663792,7 +663903,9 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663792
663903
|
}
|
|
663793
663904
|
});
|
|
663794
663905
|
this._workboard = readActiveWorkboardSnapshot(dir, runId) ?? board;
|
|
663906
|
+
return cardInput.id ?? null;
|
|
663795
663907
|
} catch {
|
|
663908
|
+
return null;
|
|
663796
663909
|
}
|
|
663797
663910
|
}
|
|
663798
663911
|
_todoWorkboardCardId(todoId) {
|
|
@@ -663892,7 +664005,7 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663892
664005
|
schema: WORKBOARD_EVIDENCE_PREDICATE_SCHEMA,
|
|
663893
664006
|
id: `todo:${todo.id}:artifact:${index}`,
|
|
663894
664007
|
label: `observed task artifact: ${artifact}`,
|
|
663895
|
-
|
|
664008
|
+
path: artifact
|
|
663896
664009
|
});
|
|
663897
664010
|
}
|
|
663898
664011
|
}
|
|
@@ -663930,7 +664043,7 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663930
664043
|
_mirrorTodosToWorkboard(todos) {
|
|
663931
664044
|
const normalized4 = this._normalizeTodosForPrompt(todos);
|
|
663932
664045
|
const index = this._todoTreeIndex(normalized4);
|
|
663933
|
-
const activeLeaves = this._todoLeaves(normalized4, index).filter((todo) => todo.status !== "completed")
|
|
664046
|
+
const activeLeaves = this._todoLeaves(normalized4, index).filter((todo) => todo.status !== "completed");
|
|
663934
664047
|
const cards = [];
|
|
663935
664048
|
for (const todo of activeLeaves) {
|
|
663936
664049
|
const incoming = this._todoWorkboardCardInput(todo, this._todoPath(todo, index));
|
|
@@ -664479,65 +664592,35 @@ ${parts.join("\n")}
|
|
|
664479
664592
|
].filter((path16) => path16 && path16 !== ".");
|
|
664480
664593
|
if (targets.length === 0)
|
|
664481
664594
|
return null;
|
|
664482
|
-
const
|
|
664483
|
-
|
|
664484
|
-
const
|
|
664485
|
-
|
|
664486
|
-
|
|
664487
|
-
|
|
664488
|
-
|
|
664595
|
+
const activeCards = snapshot.cards.filter((card) => card.id.startsWith("todo-") && !card.supersededBy && card.status !== "completed" && card.status !== "verified");
|
|
664596
|
+
const exact = activeCards.filter((card) => {
|
|
664597
|
+
const owned = new Set((card.ownedFiles ?? []).map((path16) => this._normalizeEvidencePath(path16)).filter(Boolean));
|
|
664598
|
+
return targets.some((path16) => owned.has(path16));
|
|
664599
|
+
});
|
|
664600
|
+
if (exact.length === 1)
|
|
664601
|
+
return exact[0];
|
|
664602
|
+
if (exact.length > 1)
|
|
664489
664603
|
return null;
|
|
664490
|
-
const
|
|
664491
|
-
|
|
664492
|
-
return 4;
|
|
664493
|
-
if (card.status === "needs_changes")
|
|
664494
|
-
return 3;
|
|
664495
|
-
if (card.status === "open")
|
|
664496
|
-
return 2;
|
|
664497
|
-
if (card.status === "blocked")
|
|
664498
|
-
return 1;
|
|
664499
|
-
return 0;
|
|
664500
|
-
};
|
|
664501
|
-
let best = null;
|
|
664502
|
-
for (const card of snapshot.cards) {
|
|
664503
|
-
if (!card.id.startsWith("todo-"))
|
|
664504
|
-
continue;
|
|
664505
|
-
if (card.supersededBy)
|
|
664506
|
-
continue;
|
|
664507
|
-
if (card.status === "completed" || card.status === "verified")
|
|
664508
|
-
continue;
|
|
664509
|
-
const text3 = [
|
|
664510
|
-
card.id,
|
|
664511
|
-
card.title,
|
|
664512
|
-
card.description,
|
|
664513
|
-
...card.evidenceRequirements
|
|
664514
|
-
].join(" ").toLowerCase();
|
|
664515
|
-
let score = statusRank3(card);
|
|
664516
|
-
for (const term of terms2) {
|
|
664517
|
-
if (!text3.includes(term))
|
|
664518
|
-
continue;
|
|
664519
|
-
const fullPathHit = targets.some((path16) => path16.toLowerCase() === term);
|
|
664520
|
-
score += fullPathHit ? 10 : term.includes("/") ? 8 : 4;
|
|
664521
|
-
}
|
|
664522
|
-
if (score <= statusRank3(card))
|
|
664523
|
-
continue;
|
|
664524
|
-
if (!best || score > best.score)
|
|
664525
|
-
best = { card, score };
|
|
664526
|
-
}
|
|
664527
|
-
return best?.card ?? null;
|
|
664604
|
+
const unscopedActive = activeCards.filter((card) => card.status === "in_progress" && (card.ownedFiles?.length ?? 0) === 0);
|
|
664605
|
+
return unscopedActive.length === 1 ? unscopedActive[0] : null;
|
|
664528
664606
|
}
|
|
664529
664607
|
_workboardTodoCardForVerifier(snapshot, args, receipt2) {
|
|
664530
664608
|
const command = String(args["command"] ?? args["cmd"] ?? "").trim();
|
|
664531
664609
|
if (!command)
|
|
664532
664610
|
return null;
|
|
664533
|
-
|
|
664611
|
+
const candidates = snapshot.cards.filter((card) => {
|
|
664534
664612
|
if (!card.id.startsWith("todo-") || card.supersededBy)
|
|
664535
664613
|
return false;
|
|
664536
664614
|
if (card.status === "completed" || card.status === "verified")
|
|
664537
664615
|
return false;
|
|
664538
664616
|
const verifier = card.verifierCommand || card.evidenceRequirements.find((item) => item.startsWith("verifyCommand:"))?.replace(/^verifyCommand:\s*/, "") || "";
|
|
664539
664617
|
return verifier.length > 0 && commandReliablySatisfiesVerifyCommand(command, verifier, receipt2);
|
|
664540
|
-
})
|
|
664618
|
+
});
|
|
664619
|
+
if (candidates.length <= 1)
|
|
664620
|
+
return candidates[0] ?? null;
|
|
664621
|
+
const observed = new Set((receipt2?.observedPaths ?? []).map((path16) => this._normalizeEvidencePath(path16)).filter(Boolean));
|
|
664622
|
+
const targetBound = candidates.filter((card) => (card.ownedFiles ?? []).map((path16) => this._normalizeEvidencePath(path16)).filter(Boolean).some((path16) => observed.has(path16)));
|
|
664623
|
+
return targetBound.length === 1 ? targetBound[0] : null;
|
|
664541
664624
|
}
|
|
664542
664625
|
_workboardTargetCardId(snapshot, toolName, args, result, meta = {}) {
|
|
664543
664626
|
const byId = new Map(snapshot.cards.map((card) => [card.id, card]));
|
|
@@ -665700,7 +665783,10 @@ ${read3.content}`;
|
|
|
665700
665783
|
request[PRESERVE_MODEL_VISIBLE_HISTORY] = !this._legacyModelVisibleCompactionAllowed();
|
|
665701
665784
|
const preBudget = this._outboundRequestBudget(request);
|
|
665702
665785
|
this._lastMemoryCompilationPlanAudit = null;
|
|
665703
|
-
|
|
665786
|
+
const rawDiscoveryChars = request.messages.reduce((total, message2) => message2.role === "tool" && typeof message2.content === "string" ? total + message2.content.length : total, 0);
|
|
665787
|
+
const rawDiscoveryLimit = Math.max(16e3, Number.parseInt(process.env["OMNIUS_RAW_DISCOVERY_COMPACTION_CHARS"] || "48000", 10) || 48e3);
|
|
665788
|
+
const rawDiscoveryPressure = rawDiscoveryChars > rawDiscoveryLimit;
|
|
665789
|
+
if (this._memoryCompilationMode() !== "active" || !preBudget.compactionEligible && !rawDiscoveryPressure)
|
|
665704
665790
|
return;
|
|
665705
665791
|
const messages2 = request.messages;
|
|
665706
665792
|
const projections = this._requestCompilationCandidates({
|
|
@@ -666998,7 +667084,63 @@ ${read3.content}`;
|
|
|
666998
667084
|
break;
|
|
666999
667085
|
this._canonicalAcceptedReceipts.delete(oldest);
|
|
667000
667086
|
}
|
|
667087
|
+
this._persistCanonicalAcceptedReceipts();
|
|
667088
|
+
} catch {
|
|
667089
|
+
}
|
|
667090
|
+
}
|
|
667091
|
+
_canonicalAcceptedReceiptIndexPath() {
|
|
667092
|
+
return _pathJoin(this.omniusStateDir(), "canonical-receipts", `${this.currentArtifactRunId()}.json`);
|
|
667093
|
+
}
|
|
667094
|
+
_persistCanonicalAcceptedReceipts() {
|
|
667095
|
+
if (!this.writesUserTaskArtifacts())
|
|
667096
|
+
return;
|
|
667097
|
+
try {
|
|
667098
|
+
const path16 = this._canonicalAcceptedReceiptIndexPath();
|
|
667099
|
+
_fsMkdirSync(_pathJoin(this.omniusStateDir(), "canonical-receipts"), {
|
|
667100
|
+
recursive: true
|
|
667101
|
+
});
|
|
667102
|
+
_fsWriteFileSync(path16, `${JSON.stringify({
|
|
667103
|
+
schema: "omnius.canonical-tool-receipts.v1",
|
|
667104
|
+
runId: this.currentArtifactRunId(),
|
|
667105
|
+
taskEpoch: this._taskEpoch,
|
|
667106
|
+
receipts: [...this._canonicalAcceptedReceipts.entries()].map(([transactionId2, receipt2]) => ({ transactionId: transactionId2, ...receipt2 }))
|
|
667107
|
+
}, null, 2)}
|
|
667108
|
+
`, "utf8");
|
|
667109
|
+
} catch {
|
|
667110
|
+
}
|
|
667111
|
+
}
|
|
667112
|
+
_hydrateCanonicalAcceptedReceipts() {
|
|
667113
|
+
if (!this._resumeInterrupted || !this.writesUserTaskArtifacts())
|
|
667114
|
+
return;
|
|
667115
|
+
try {
|
|
667116
|
+
const parsed = JSON.parse(_fsReadFileSync(this._canonicalAcceptedReceiptIndexPath(), "utf8"));
|
|
667117
|
+
if (parsed["schema"] !== "omnius.canonical-tool-receipts.v1" || parsed["runId"] !== this.currentArtifactRunId() || parsed["taskEpoch"] !== this._taskEpoch || !Array.isArray(parsed["receipts"])) {
|
|
667118
|
+
return;
|
|
667119
|
+
}
|
|
667120
|
+
for (const raw of parsed["receipts"].slice(-128)) {
|
|
667121
|
+
if (!raw || typeof raw !== "object")
|
|
667122
|
+
continue;
|
|
667123
|
+
const record = raw;
|
|
667124
|
+
const transactionId2 = String(record["transactionId"] ?? "").trim();
|
|
667125
|
+
const toolName = String(record["toolName"] ?? "").trim();
|
|
667126
|
+
const artifactLocator = String(record["artifactLocator"] ?? "").trim();
|
|
667127
|
+
const evidenceId = String(record["evidenceId"] ?? "").trim();
|
|
667128
|
+
const summary = String(record["summary"] ?? "").trim();
|
|
667129
|
+
const turn = Number(record["turn"]);
|
|
667130
|
+
if (!transactionId2 || !toolName || !artifactLocator || !evidenceId || !summary || !Number.isFinite(turn)) {
|
|
667131
|
+
continue;
|
|
667132
|
+
}
|
|
667133
|
+
this._artifactStore().getManifest(artifactLocator);
|
|
667134
|
+
this._canonicalAcceptedReceipts.set(transactionId2, {
|
|
667135
|
+
toolName,
|
|
667136
|
+
artifactLocator,
|
|
667137
|
+
evidenceId,
|
|
667138
|
+
summary,
|
|
667139
|
+
turn: Math.max(0, Math.floor(turn))
|
|
667140
|
+
});
|
|
667141
|
+
}
|
|
667001
667142
|
} catch {
|
|
667143
|
+
this._canonicalAcceptedReceipts.clear();
|
|
667002
667144
|
}
|
|
667003
667145
|
}
|
|
667004
667146
|
_artifactStore() {
|
|
@@ -667307,10 +667449,21 @@ ${read3.content}`;
|
|
|
667307
667449
|
_refreshIntegrationClosure() {
|
|
667308
667450
|
const goal = this._taskState.originalGoal || this._taskState.goal || this._completionLedger?.goal || "unspecified";
|
|
667309
667451
|
const modifiedPaths = [...this._taskState.modifiedFiles.keys()].map((path16) => this._normalizeEvidencePath(path16)).filter((path16) => path16 && !path16.startsWith(".omnius/"));
|
|
667452
|
+
const todos = this._normalizeTodosForPrompt(this.readSessionTodos() ?? []);
|
|
667453
|
+
const todoIndex = this._todoTreeIndex(todos);
|
|
667454
|
+
const unresolvedTodos = this._todoLeaves(todos, todoIndex).filter((todo) => todo.status !== "completed").map((todo) => ({
|
|
667455
|
+
id: todo.id,
|
|
667456
|
+
label: todo.content,
|
|
667457
|
+
status: todo.status
|
|
667458
|
+
}));
|
|
667459
|
+
const board = this._workboard ? this._refreshWorkboardSnapshot(this._workboard) : readActiveWorkboardSnapshot(this._workboardDir(), this.currentArtifactRunId());
|
|
667460
|
+
const activeFailures = (board?.cards ?? []).filter((card) => card.id.startsWith("failure-") && !card.supersededBy && card.status !== "completed" && card.status !== "verified").map((card) => ({ id: card.id, label: card.title }));
|
|
667310
667461
|
const closure = buildIntegrationClosure({
|
|
667311
667462
|
goal,
|
|
667312
667463
|
ledger: this._completionLedger,
|
|
667313
667464
|
modifiedPaths,
|
|
667465
|
+
unresolvedTodos,
|
|
667466
|
+
activeFailures,
|
|
667314
667467
|
contractIds: this._referenceContractSelections.map((contract) => contract.id),
|
|
667315
667468
|
codeGraph: getCodeGraphDBIfReady(this.authoritativeWorkingDirectory())
|
|
667316
667469
|
});
|
|
@@ -668597,18 +668750,38 @@ Pick the SMALLEST concrete deliverable from the spec — typically the project e
|
|
|
668597
668750
|
this._gitProgress = null;
|
|
668598
668751
|
}
|
|
668599
668752
|
}
|
|
668753
|
+
async _observeGitProgressBeforeTool(input) {
|
|
668754
|
+
if (!this._gitProgress || this._gitProgress.enabled && this._gitProgress.available || input.targetPaths.length === 0 || process.env["OMNIUS_DISABLE_GIT_PROGRESS"] === "1") {
|
|
668755
|
+
return;
|
|
668756
|
+
}
|
|
668757
|
+
try {
|
|
668758
|
+
const discovered = await detectGitProgressBaselineFromPaths({
|
|
668759
|
+
cwd: this.authoritativeWorkingDirectory(),
|
|
668760
|
+
sessionId: this._sessionId,
|
|
668761
|
+
paths: input.targetPaths,
|
|
668762
|
+
baselineProvenance: "path_preflight"
|
|
668763
|
+
});
|
|
668764
|
+
if (!discovered?.enabled || !discovered.available)
|
|
668765
|
+
return;
|
|
668766
|
+
this._gitProgress = discovered;
|
|
668767
|
+
this._persistGitProgressState();
|
|
668768
|
+
this._emitGitProgressStatus(`nested repository baseline captured before ${input.toolName}`);
|
|
668769
|
+
} catch {
|
|
668770
|
+
}
|
|
668771
|
+
}
|
|
668600
668772
|
async _observeGitProgressAfterTool(input) {
|
|
668601
668773
|
if (!this._gitProgress || process.env["OMNIUS_DISABLE_GIT_PROGRESS"] === "1")
|
|
668602
668774
|
return;
|
|
668603
668775
|
try {
|
|
668604
668776
|
const contract = this._activeMutationContract();
|
|
668605
668777
|
const next = await refreshGitProgressState(this._gitProgress, {
|
|
668778
|
+
cwd: this.authoritativeWorkingDirectory(),
|
|
668606
668779
|
turn: input.turn,
|
|
668607
668780
|
actor: this.options.subAgent ? "sub_agent" : "main",
|
|
668608
668781
|
owner: contract?.ownerAgentId,
|
|
668609
668782
|
toolName: input.toolName,
|
|
668610
|
-
mutatedPaths: input.mutationPaths,
|
|
668611
|
-
ownedFiles: contract ? [...contract.ownedFiles, ...contract.ownedDirs] : void 0,
|
|
668783
|
+
mutatedPaths: input.mutationPaths.map((path16) => _pathResolve(this.authoritativeWorkingDirectory(), path16)),
|
|
668784
|
+
ownedFiles: contract ? [...contract.ownedFiles, ...contract.ownedDirs].map((path16) => _pathResolve(this.authoritativeWorkingDirectory(), path16)) : void 0,
|
|
668612
668785
|
verifierCommand: contract?.verifierCommand,
|
|
668613
668786
|
verifierFreshAfterChange: false
|
|
668614
668787
|
});
|
|
@@ -669575,15 +669748,19 @@ ${extras.join("\n")}`;
|
|
|
669575
669748
|
return null;
|
|
669576
669749
|
}
|
|
669577
669750
|
_extractToolTargetPaths(toolName, args, result) {
|
|
669578
|
-
const
|
|
669579
|
-
|
|
669580
|
-
|
|
669581
|
-
|
|
669582
|
-
|
|
669583
|
-
|
|
669751
|
+
const paths = [];
|
|
669752
|
+
const fromResult = Array.isArray(result?.mutatedFiles) ? result.mutatedFiles.filter((p2) => typeof p2 === "string" && p2.trim().length > 0) : [];
|
|
669753
|
+
paths.push(...fromResult);
|
|
669754
|
+
paths.push(...(result?.executionReceipt?.observedPaths ?? []).filter((path16) => typeof path16 === "string" && path16.trim().length > 0), ...(result?.executionReceipt?.artifactHashes ?? []).map((artifact) => artifact.path).filter((path16) => typeof path16 === "string" && path16.trim().length > 0));
|
|
669755
|
+
if (fromResult.length === 0) {
|
|
669756
|
+
if (toolName === "batch_edit" && Array.isArray(args?.["edits"])) {
|
|
669757
|
+
paths.push(...args["edits"].map((edit) => edit && typeof edit === "object" ? edit["path"] : null).filter((p3) => typeof p3 === "string" && p3.trim().length > 0));
|
|
669758
|
+
}
|
|
669759
|
+
const p2 = args?.["path"] ?? args?.["file_path"] ?? args?.["file"] ?? args?.["filename"] ?? args?.["filepath"] ?? args?.["filePath"] ?? args?.["input"] ?? args?.["target"];
|
|
669760
|
+
if (typeof p2 === "string" && p2.trim().length > 0)
|
|
669761
|
+
paths.push(p2.trim());
|
|
669584
669762
|
}
|
|
669585
|
-
|
|
669586
|
-
return typeof p2 === "string" && p2.trim().length > 0 ? [p2.trim()] : [];
|
|
669763
|
+
return [...new Set(paths.map((path16) => path16.trim()).filter(Boolean))].sort();
|
|
669587
669764
|
}
|
|
669588
669765
|
_isRealProjectMutation(toolName, result) {
|
|
669589
669766
|
if (!result || result.success === false)
|
|
@@ -671895,6 +672072,41 @@ ${contentPreview}
|
|
|
671895
672072
|
}
|
|
671896
672073
|
return targetPaths.length > 0 ? "project" : "external";
|
|
671897
672074
|
}
|
|
672075
|
+
_expireRecentFailureDurably(failure2, turn) {
|
|
672076
|
+
const expiredAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
672077
|
+
try {
|
|
672078
|
+
const dir = this._workboardDir();
|
|
672079
|
+
const runId = this.currentArtifactRunId();
|
|
672080
|
+
const board = readActiveWorkboardSnapshot(dir, runId);
|
|
672081
|
+
const card = failure2.workboardCardId ? board?.cards.find((candidate) => candidate.id === failure2.workboardCardId) : void 0;
|
|
672082
|
+
if (card && !card.supersededBy && card.status !== "completed" && card.status !== "verified") {
|
|
672083
|
+
this._workboard = updateWorkboardCard(dir, {
|
|
672084
|
+
runId,
|
|
672085
|
+
cardId: card.id,
|
|
672086
|
+
actor: "runner",
|
|
672087
|
+
updates: { supersededBy: `failure-expired:turn-${turn}` },
|
|
672088
|
+
decisionReason: "The bounded recent-failure window expired without fresh recurrence. Retire this recovery obligation without claiming verification."
|
|
672089
|
+
});
|
|
672090
|
+
}
|
|
672091
|
+
if (this._failureStore) {
|
|
672092
|
+
for (const stored of this._failureStore.listByFingerprint(failure2.patternKey)) {
|
|
672093
|
+
const context2 = stored.context ?? {};
|
|
672094
|
+
if (stored.resolved || stored.sessionId !== this._sessionId || context2["taskEpoch"] !== (failure2.taskEpoch ?? this._taskEpoch) || context2["targetKey"] !== (failure2.targetKey ?? "unscoped")) {
|
|
672095
|
+
continue;
|
|
672096
|
+
}
|
|
672097
|
+
this._failureStore.markResolved(stored.id, expiredAt);
|
|
672098
|
+
}
|
|
672099
|
+
}
|
|
672100
|
+
} catch (error) {
|
|
672101
|
+
this.emit({
|
|
672102
|
+
type: "status",
|
|
672103
|
+
visibility: "telemetry",
|
|
672104
|
+
content: `failure_lifecycle_expiry_reconciliation_failed: ${error instanceof Error ? error.message : String(error)}`.slice(0, 320),
|
|
672105
|
+
turn,
|
|
672106
|
+
timestamp: expiredAt
|
|
672107
|
+
});
|
|
672108
|
+
}
|
|
672109
|
+
}
|
|
671898
672110
|
_activeRecentFailures(turn) {
|
|
671899
672111
|
let expired = 0;
|
|
671900
672112
|
const active = this._recentFailures.filter((failure2) => {
|
|
@@ -671902,6 +672114,7 @@ ${contentPreview}
|
|
|
671902
672114
|
return false;
|
|
671903
672115
|
if (turn - failure2.turn > 10) {
|
|
671904
672116
|
failure2.status = "expired";
|
|
672117
|
+
this._expireRecentFailureDurably(failure2, turn);
|
|
671905
672118
|
expired++;
|
|
671906
672119
|
return false;
|
|
671907
672120
|
}
|
|
@@ -671949,7 +672162,7 @@ ${contentPreview}
|
|
|
671949
672162
|
try {
|
|
671950
672163
|
const targetPaths = [...new Set(failures.flatMap((failure2) => failure2.targetPaths).map((path16) => this._normalizeEvidencePath(path16)).filter(Boolean))].sort();
|
|
671951
672164
|
const board = readActiveWorkboardSnapshot(workingDir, runId);
|
|
671952
|
-
const cardIds = [...new Set(failures.map((failure2) => failure2.workboardCardId).filter((cardId) => board?.cards.some((card) => card.id === cardId && !card.supersededBy && card.status !== "verified")))];
|
|
672165
|
+
const cardIds = [...new Set(failures.map((failure2) => failure2.workboardCardId).filter((cardId) => typeof cardId === "string" && Boolean(board?.cards.some((card) => card.id === cardId && !card.supersededBy && card.status !== "verified"))))];
|
|
671953
672166
|
const failureIds = this._failureStore ? [...new Set(failures.flatMap((failure2) => this._failureStore.listByFingerprint(failure2.patternKey).filter((stored) => {
|
|
671954
672167
|
const context2 = stored.context ?? {};
|
|
671955
672168
|
return !stored.resolved && stored.sessionId === this._sessionId && stored.taskId === this._sessionId && context2["taskEpoch"] === this._taskEpoch && context2["targetKey"] === targetKey && context2["workboardCardId"] === failure2.workboardCardId;
|
|
@@ -671984,7 +672197,14 @@ ${contentPreview}
|
|
|
671984
672197
|
resolved++;
|
|
671985
672198
|
}
|
|
671986
672199
|
this._workboard = readActiveWorkboardSnapshot(workingDir, runId) ?? board;
|
|
671987
|
-
} catch {
|
|
672200
|
+
} catch (error) {
|
|
672201
|
+
this.emit({
|
|
672202
|
+
type: "status",
|
|
672203
|
+
visibility: "telemetry",
|
|
672204
|
+
content: `failure_lifecycle_resolution_deferred: ${error instanceof Error ? error.message : String(error)}`.slice(0, 320),
|
|
672205
|
+
turn: input.turn,
|
|
672206
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
672207
|
+
});
|
|
671988
672208
|
}
|
|
671989
672209
|
}
|
|
671990
672210
|
return resolved;
|
|
@@ -677269,6 +677489,7 @@ Respond with the assessment and take the selected evidence-backed action.`;
|
|
|
677269
677489
|
contextWindowSize: this.options.contextWindowSize ?? 0,
|
|
677270
677490
|
verbose: false
|
|
677271
677491
|
});
|
|
677492
|
+
this._hydrateCanonicalAcceptedReceipts();
|
|
677272
677493
|
await this._initializeGitProgressBaseline();
|
|
677273
677494
|
this._restoredTodoVerificationNote = null;
|
|
677274
677495
|
try {
|
|
@@ -681593,6 +681814,12 @@ ${cachedResult}`,
|
|
|
681593
681814
|
try {
|
|
681594
681815
|
tc.arguments = finalArgs;
|
|
681595
681816
|
const normalizedDispatchName = resolvedTool?.name ?? tc.name;
|
|
681817
|
+
const gitPreflightPaths = this._isProjectEditTool(normalizedDispatchName) ? this._extractToolTargetPaths(normalizedDispatchName, tc.arguments) : normalizedDispatchName === "shell" && shellMutationAttempt ? shellMutationAttempt.extraction.paths : [];
|
|
681818
|
+
await this._observeGitProgressBeforeTool({
|
|
681819
|
+
turn,
|
|
681820
|
+
toolName: normalizedDispatchName,
|
|
681821
|
+
targetPaths: gitPreflightPaths
|
|
681822
|
+
});
|
|
681596
681823
|
let branchEvidenceResult = null;
|
|
681597
681824
|
if (normalizedDispatchName === "file_read" && this._fileReadMode(tc.arguments) !== "extract") {
|
|
681598
681825
|
const exactReadFingerprint = this._buildToolFingerprint("file_read", tc.arguments);
|
|
@@ -681798,6 +682025,25 @@ intent=${_verifierResult.intentBucket}; scope=${_verifierResult.effectScope ?? "
|
|
|
681798
682025
|
}
|
|
681799
682026
|
}
|
|
681800
682027
|
}
|
|
682028
|
+
if (!result.success && tc.name === "shell" && /\[PERMISSION_ERROR\]/.test(result.error ?? "") && tool) {
|
|
682029
|
+
this.emit({
|
|
682030
|
+
type: "sudo_request",
|
|
682031
|
+
content: `Command requires elevated privileges: ${tc.arguments.command?.slice(0, 100) ?? ""}`,
|
|
682032
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
682033
|
+
});
|
|
682034
|
+
const pw2 = await this.waitForSudoPassword(12e4);
|
|
682035
|
+
if (pw2) {
|
|
682036
|
+
try {
|
|
682037
|
+
result = await tool.execute(tc.arguments);
|
|
682038
|
+
} catch (err) {
|
|
682039
|
+
result = {
|
|
682040
|
+
success: false,
|
|
682041
|
+
output: "",
|
|
682042
|
+
error: err instanceof Error ? err.message : String(err)
|
|
682043
|
+
};
|
|
682044
|
+
}
|
|
682045
|
+
}
|
|
682046
|
+
}
|
|
681801
682047
|
if (!fileReadSafetyChecked) {
|
|
681802
682048
|
result = await this._guardMaterializedFileReadResult({
|
|
681803
682049
|
callId: tc.id,
|
|
@@ -682402,6 +682648,7 @@ ${diagnostic}`;
|
|
|
682402
682648
|
}
|
|
682403
682649
|
}
|
|
682404
682650
|
}
|
|
682651
|
+
let failureWorkboardCardId = null;
|
|
682405
682652
|
if (!result.success && (result.error || result.output || result.llmContent)) {
|
|
682406
682653
|
const errorText = (result.error || result.output || result.llmContent || "").toString();
|
|
682407
682654
|
const diagnosis = this._diagnoseToolFailure(tc.name, tc.arguments, result);
|
|
@@ -682421,11 +682668,10 @@ ${diagnostic}`;
|
|
|
682421
682668
|
};
|
|
682422
682669
|
this._errorPatterns.set(sig, learnedPattern);
|
|
682423
682670
|
this._taskRelevantErrorPatterns.set(sig, learnedPattern);
|
|
682424
|
-
this._recordFailureRecoveryOnWorkboard(tc.name, tc.arguments, result, diagnosis, count);
|
|
682671
|
+
failureWorkboardCardId = this._recordFailureRecoveryOnWorkboard(tc.name, tc.arguments, result, diagnosis, count);
|
|
682425
682672
|
if (this._failureStore) {
|
|
682426
682673
|
try {
|
|
682427
682674
|
const failureTargets = this._extractToolTargetPaths(tc.name, tc.arguments, result).map((path16) => this._normalizeEvidencePath(path16)).filter(Boolean).sort();
|
|
682428
|
-
const failureCard = this._failureRecoveryCardInput(diagnosis, failureTargets, count);
|
|
682429
682675
|
this._failureStore.insert({
|
|
682430
682676
|
taskId: this._sessionId,
|
|
682431
682677
|
sessionId: this._sessionId,
|
|
@@ -682440,7 +682686,7 @@ ${diagnostic}`;
|
|
|
682440
682686
|
taskEpoch: this._taskEpoch,
|
|
682441
682687
|
targetPaths: failureTargets,
|
|
682442
682688
|
targetKey: failureTargets.join("|") || "unscoped",
|
|
682443
|
-
workboardCardId:
|
|
682689
|
+
...failureWorkboardCardId ? { workboardCardId: failureWorkboardCardId } : {},
|
|
682444
682690
|
diagnosis: {
|
|
682445
682691
|
kind: diagnosis.kind,
|
|
682446
682692
|
severity: diagnosis.severity,
|
|
@@ -682858,7 +683104,7 @@ ${diagnostic}`;
|
|
|
682858
683104
|
this._recentFailures.push({
|
|
682859
683105
|
tool: tc.name,
|
|
682860
683106
|
patternKey: failureDiagnosis.patternKey,
|
|
682861
|
-
workboardCardId:
|
|
683107
|
+
...failureWorkboardCardId ? { workboardCardId: failureWorkboardCardId } : {},
|
|
682862
683108
|
fingerprint: toolFingerprint,
|
|
682863
683109
|
args: tc.arguments,
|
|
682864
683110
|
error: (result.error ?? "").slice(0, 600),
|
|
@@ -682951,25 +683197,6 @@ ${diagnostic}`;
|
|
|
682951
683197
|
});
|
|
682952
683198
|
}
|
|
682953
683199
|
}
|
|
682954
|
-
if (!result.success && tc.name === "shell" && /\[PERMISSION_ERROR\]/.test(result.error ?? "")) {
|
|
682955
|
-
this.emit({
|
|
682956
|
-
type: "sudo_request",
|
|
682957
|
-
content: `Command requires elevated privileges: ${tc.arguments.command?.slice(0, 100) ?? ""}`,
|
|
682958
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
682959
|
-
});
|
|
682960
|
-
const pw2 = await this.waitForSudoPassword(12e4);
|
|
682961
|
-
if (pw2) {
|
|
682962
|
-
try {
|
|
682963
|
-
result = await tool.execute(tc.arguments);
|
|
682964
|
-
} catch (err) {
|
|
682965
|
-
result = {
|
|
682966
|
-
success: false,
|
|
682967
|
-
output: "",
|
|
682968
|
-
error: err instanceof Error ? err.message : String(err)
|
|
682969
|
-
};
|
|
682970
|
-
}
|
|
682971
|
-
}
|
|
682972
|
-
}
|
|
682973
683200
|
if (tc.name === "explore_tools" && result.success && result.output.startsWith("UNLOCK_TOOL:")) {
|
|
682974
683201
|
const unlockName = result.output.slice("UNLOCK_TOOL:".length).trim();
|
|
682975
683202
|
const existingTool = this.tools.get(unlockName);
|
|
@@ -694629,7 +694856,7 @@ var init_runEvents = __esm({
|
|
|
694629
694856
|
// packages/orchestrator/dist/adjudication.js
|
|
694630
694857
|
import { createHash as createHash66, randomUUID as randomUUID29 } from "node:crypto";
|
|
694631
694858
|
import { mkdir as mkdir26, readFile as readFile28, rename as rename7, writeFile as writeFile29 } from "node:fs/promises";
|
|
694632
|
-
import { dirname as
|
|
694859
|
+
import { dirname as dirname53, join as join136, resolve as resolve69 } from "node:path";
|
|
694633
694860
|
import { z as z20 } from "zod";
|
|
694634
694861
|
function timestamp(now2) {
|
|
694635
694862
|
return now2().toISOString();
|
|
@@ -695221,7 +695448,7 @@ async function mapConcurrent(rows, limit2, worker2) {
|
|
|
695221
695448
|
return results;
|
|
695222
695449
|
}
|
|
695223
695450
|
async function writeJsonAtomic(path16, value2) {
|
|
695224
|
-
await mkdir26(
|
|
695451
|
+
await mkdir26(dirname53(path16), { recursive: true });
|
|
695225
695452
|
const temporary = `${path16}.${process.pid}.${randomUUID29()}.tmp`;
|
|
695226
695453
|
await writeFile29(temporary, `${JSON.stringify(value2, null, 2)}
|
|
695227
695454
|
`, "utf8");
|
|
@@ -695621,7 +695848,7 @@ async function verifyAdjudicationReplay(receiptPath) {
|
|
|
695621
695848
|
} catch {
|
|
695622
695849
|
return { valid: false, issues: ["receipt_unreadable"], receipt: null };
|
|
695623
695850
|
}
|
|
695624
|
-
const directory =
|
|
695851
|
+
const directory = dirname53(receiptPath);
|
|
695625
695852
|
const readJson6 = async (name10) => {
|
|
695626
695853
|
try {
|
|
695627
695854
|
const value2 = JSON.parse(await readFile28(join136(directory, name10), "utf8"));
|
|
@@ -697358,7 +697585,7 @@ var init_config_loader = __esm({
|
|
|
697358
697585
|
// packages/orchestrator/dist/memory/stability-tracker.js
|
|
697359
697586
|
import { createHash as createHash68 } from "node:crypto";
|
|
697360
697587
|
import { existsSync as existsSync125, mkdirSync as mkdirSync74, readFileSync as readFileSync100, writeFileSync as writeFileSync66 } from "node:fs";
|
|
697361
|
-
import { dirname as
|
|
697588
|
+
import { dirname as dirname54, join as join138 } from "node:path";
|
|
697362
697589
|
function stabilityFilePath(repoRoot) {
|
|
697363
697590
|
return join138(repoRoot, ".omnius", "memory", "stability.json");
|
|
697364
697591
|
}
|
|
@@ -697375,7 +697602,7 @@ function loadStabilityIndex(repoRoot) {
|
|
|
697375
697602
|
}
|
|
697376
697603
|
function saveStabilityIndex(repoRoot, index) {
|
|
697377
697604
|
const path16 = stabilityFilePath(repoRoot);
|
|
697378
|
-
mkdirSync74(
|
|
697605
|
+
mkdirSync74(dirname54(path16), { recursive: true });
|
|
697379
697606
|
writeFileSync66(path16, JSON.stringify(index, null, 2), "utf-8");
|
|
697380
697607
|
}
|
|
697381
697608
|
function updateMemoryStability(items, options2 = {}) {
|
|
@@ -700670,7 +700897,7 @@ var init_missionSystem = __esm({
|
|
|
700670
700897
|
// packages/orchestrator/dist/context-references.js
|
|
700671
700898
|
import { readFileSync as readFileSync105, readdirSync as readdirSync42, statSync as statSync50 } from "node:fs";
|
|
700672
700899
|
import { homedir as homedir39 } from "node:os";
|
|
700673
|
-
import { join as join144, resolve as resolve70, relative as relative21, sep as
|
|
700900
|
+
import { join as join144, resolve as resolve70, relative as relative21, sep as sep11, extname as extname18 } from "node:path";
|
|
700674
700901
|
function estimateTokens8(text3) {
|
|
700675
700902
|
return Math.ceil(text3.length / CHARS_PER_TOKEN);
|
|
700676
700903
|
}
|
|
@@ -700703,12 +700930,12 @@ function removeReferenceTokens(message2, refs) {
|
|
|
700703
700930
|
return text3.trim();
|
|
700704
700931
|
}
|
|
700705
700932
|
function resolvePath4(cwd4, target, allowedRoot) {
|
|
700706
|
-
const
|
|
700707
|
-
const expanded =
|
|
700933
|
+
const isAbsolute27 = target.startsWith("/") || target.startsWith("~");
|
|
700934
|
+
const expanded = isAbsolute27 ? target.replace(/^~/, homedir39()) : join144(cwd4, target);
|
|
700708
700935
|
const resolved = resolve70(expanded);
|
|
700709
700936
|
if (allowedRoot) {
|
|
700710
700937
|
const allowed = resolve70(allowedRoot);
|
|
700711
|
-
if (!resolved.startsWith(allowed +
|
|
700938
|
+
if (!resolved.startsWith(allowed + sep11) && resolved !== allowed) {
|
|
700712
700939
|
throw new Error("path is outside the allowed workspace");
|
|
700713
700940
|
}
|
|
700714
700941
|
}
|
|
@@ -700724,7 +700951,7 @@ function ensureReferencePathAllowed(filePath) {
|
|
|
700724
700951
|
}
|
|
700725
700952
|
for (const dir of SENSITIVE_HOME_DIRS) {
|
|
700726
700953
|
const blockedDir = resolve70(join144(home3, dir));
|
|
700727
|
-
if (filePath.startsWith(blockedDir +
|
|
700954
|
+
if (filePath.startsWith(blockedDir + sep11) || filePath === blockedDir) {
|
|
700728
700955
|
throw new Error("path is a sensitive credential or internal path and cannot be attached");
|
|
700729
700956
|
}
|
|
700730
700957
|
}
|
|
@@ -702821,6 +703048,7 @@ __export(dist_exports3, {
|
|
|
702821
703048
|
detectExitCodeMisread: () => detectExitCodeMisread,
|
|
702822
703049
|
detectExplorationIntent: () => detectExplorationIntent,
|
|
702823
703050
|
detectGitProgressBaseline: () => detectGitProgressBaseline,
|
|
703051
|
+
detectGitProgressBaselineFromPaths: () => detectGitProgressBaselineFromPaths,
|
|
702824
703052
|
detectPressure: () => detectPressure,
|
|
702825
703053
|
detectTaskType: () => detectTaskType,
|
|
702826
703054
|
deterministicAdjudicationAssignments: () => deterministicAdjudicationAssignments,
|
|
@@ -703420,10 +703648,10 @@ var init_adjudication_constituent = __esm({
|
|
|
703420
703648
|
|
|
703421
703649
|
// packages/cli/src/discovery.ts
|
|
703422
703650
|
import { existsSync as existsSync128, readFileSync as readFileSync106 } from "node:fs";
|
|
703423
|
-
import { dirname as
|
|
703651
|
+
import { dirname as dirname55, resolve as resolve71 } from "node:path";
|
|
703424
703652
|
import { fileURLToPath as fileURLToPath21 } from "node:url";
|
|
703425
703653
|
function discoveryCandidates() {
|
|
703426
|
-
const here =
|
|
703654
|
+
const here = dirname55(fileURLToPath21(import.meta.url));
|
|
703427
703655
|
const configured = process.env["OMNIUS_DOCS_ROOT"]?.trim();
|
|
703428
703656
|
if (configured) {
|
|
703429
703657
|
return [configured.endsWith(".json") ? resolve71(configured) : resolve71(configured, "DISCOVERY.json")];
|
|
@@ -703761,7 +703989,7 @@ __export(init_exports, {
|
|
|
703761
703989
|
initCommand: () => initCommand
|
|
703762
703990
|
});
|
|
703763
703991
|
import { existsSync as existsSync129, lstatSync as lstatSync3, readFileSync as readFileSync107, renameSync as renameSync25, writeFileSync as writeFileSync71 } from "node:fs";
|
|
703764
|
-
import { dirname as
|
|
703992
|
+
import { dirname as dirname56, resolve as resolve72 } from "node:path";
|
|
703765
703993
|
import { randomUUID as randomUUID30 } from "node:crypto";
|
|
703766
703994
|
function mergeManagedBlock(current, start2, end, block) {
|
|
703767
703995
|
const starts = current.split(start2).length - 1;
|
|
@@ -703790,7 +704018,7 @@ function planFile(path16, start2, end, block) {
|
|
|
703790
704018
|
return { path: path16, current, next, changed: current !== next };
|
|
703791
704019
|
}
|
|
703792
704020
|
function atomicWrite2(path16, content) {
|
|
703793
|
-
const temporary = resolve72(
|
|
704021
|
+
const temporary = resolve72(dirname56(path16), `.${randomUUID30()}.omnius-tmp`);
|
|
703794
704022
|
writeFileSync71(temporary, content, { encoding: "utf8", mode: 384 });
|
|
703795
704023
|
renameSync25(temporary, path16);
|
|
703796
704024
|
}
|
|
@@ -704200,7 +704428,7 @@ import { join as join147 } from "node:path";
|
|
|
704200
704428
|
import { homedir as homedir41 } from "node:os";
|
|
704201
704429
|
import { createServer as createNetServer } from "node:net";
|
|
704202
704430
|
import { fileURLToPath as fileURLToPath22 } from "node:url";
|
|
704203
|
-
import { dirname as
|
|
704431
|
+
import { dirname as dirname57 } from "node:path";
|
|
704204
704432
|
function getDaemonPort() {
|
|
704205
704433
|
const env2 = process.env["OMNIUS_HOST"];
|
|
704206
704434
|
if (env2) {
|
|
@@ -704325,7 +704553,7 @@ async function isDaemonRunning(port2) {
|
|
|
704325
704553
|
}
|
|
704326
704554
|
function getLocalCliVersion() {
|
|
704327
704555
|
try {
|
|
704328
|
-
const here =
|
|
704556
|
+
const here = dirname57(fileURLToPath22(import.meta.url));
|
|
704329
704557
|
for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
|
|
704330
704558
|
const p2 = join147(here, rel);
|
|
704331
704559
|
if (existsSync131(p2)) {
|
|
@@ -704802,7 +705030,7 @@ function commandForEntrypoint(path16, nodeExe) {
|
|
|
704802
705030
|
async function resolveDaemonCommand(nodeExe, preferredEntrypoint) {
|
|
704803
705031
|
const candidates = [];
|
|
704804
705032
|
if (preferredEntrypoint) candidates.push(preferredEntrypoint);
|
|
704805
|
-
const thisDir =
|
|
705033
|
+
const thisDir = dirname57(fileURLToPath22(import.meta.url));
|
|
704806
705034
|
candidates.push(join147(thisDir, "index.js"));
|
|
704807
705035
|
if (process.argv[1]) candidates.push(process.argv[1]);
|
|
704808
705036
|
try {
|
|
@@ -705144,7 +705372,7 @@ import {
|
|
|
705144
705372
|
mkdirSync as mkdirSync82,
|
|
705145
705373
|
openSync as openSync9,
|
|
705146
705374
|
readFileSync as readFileSync110,
|
|
705147
|
-
realpathSync,
|
|
705375
|
+
realpathSync as realpathSync2,
|
|
705148
705376
|
renameSync as renameSync28,
|
|
705149
705377
|
unlinkSync as unlinkSync32,
|
|
705150
705378
|
writeFileSync as writeFileSync74,
|
|
@@ -705152,7 +705380,7 @@ import {
|
|
|
705152
705380
|
} from "node:fs";
|
|
705153
705381
|
import { createRequire as createRequire5 } from "node:module";
|
|
705154
705382
|
import { homedir as homedir42, tmpdir as tmpdir24 } from "node:os";
|
|
705155
|
-
import { basename as basename29, dirname as
|
|
705383
|
+
import { basename as basename29, dirname as dirname58, join as join148 } from "node:path";
|
|
705156
705384
|
import { fileURLToPath as fileURLToPath23 } from "node:url";
|
|
705157
705385
|
function trayUpdatePresentation(currentVersion, latestVersion, state5 = null) {
|
|
705158
705386
|
if (state5?.status === "running") {
|
|
@@ -705363,7 +705591,7 @@ function verifyTrayHelper() {
|
|
|
705363
705591
|
`Optional dependency systray2@${TRAY_HELPER_VERSION} is not installed; reinstall Omnius with optional dependencies enabled`
|
|
705364
705592
|
);
|
|
705365
705593
|
}
|
|
705366
|
-
const packageHelper = join148(
|
|
705594
|
+
const packageHelper = join148(dirname58(packageJson), "traybin", binName);
|
|
705367
705595
|
const cwdHelper = join148(process.cwd(), "traybin", binName);
|
|
705368
705596
|
const selectedHelper = existsSync132(cwdHelper) ? cwdHelper : packageHelper;
|
|
705369
705597
|
if (!existsSync132(selectedHelper)) throw new Error(`Native tray helper is missing: ${selectedHelper}`);
|
|
@@ -705377,7 +705605,7 @@ function verifyTrayHelper() {
|
|
|
705377
705605
|
function assetPath(kind) {
|
|
705378
705606
|
const state5 = kind === "online" ? "online" : kind === "offline" ? "offline" : "checking";
|
|
705379
705607
|
const extension3 = process.platform === "win32" ? "ico" : "png";
|
|
705380
|
-
const path16 = join148(
|
|
705608
|
+
const path16 = join148(dirname58(fileURLToPath23(import.meta.url)), "..", "assets", "tray", `omnius-${state5}.${extension3}`);
|
|
705381
705609
|
if (!existsSync132(path16)) throw new Error(`Tray icon asset is missing: ${path16}`);
|
|
705382
705610
|
return path16;
|
|
705383
705611
|
}
|
|
@@ -705482,7 +705710,7 @@ function commandForEntrypoint2(path16) {
|
|
|
705482
705710
|
}
|
|
705483
705711
|
function resolveTrayLaunchCommand() {
|
|
705484
705712
|
const candidates = [
|
|
705485
|
-
join148(
|
|
705713
|
+
join148(dirname58(fileURLToPath23(import.meta.url)), "index.js"),
|
|
705486
705714
|
process.argv[1]
|
|
705487
705715
|
];
|
|
705488
705716
|
try {
|
|
@@ -705511,7 +705739,7 @@ function installedOmniusLaunchCommand() {
|
|
|
705511
705739
|
timeout: 2e3
|
|
705512
705740
|
});
|
|
705513
705741
|
const first2 = result.stdout?.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
705514
|
-
return first2 && existsSync132(first2) ? commandForEntrypoint2(
|
|
705742
|
+
return first2 && existsSync132(first2) ? commandForEntrypoint2(realpathSync2(first2)) : null;
|
|
705515
705743
|
} catch {
|
|
705516
705744
|
return null;
|
|
705517
705745
|
}
|
|
@@ -705523,8 +705751,8 @@ function registrationIconPath(launch) {
|
|
|
705523
705751
|
const extension3 = process.platform === "win32" ? "ico" : "png";
|
|
705524
705752
|
const entrypoints = [...launch.args, launch.command].filter((candidate) => existsSync132(candidate));
|
|
705525
705753
|
for (const entrypoint of entrypoints) {
|
|
705526
|
-
const real =
|
|
705527
|
-
for (const packageRoot of [
|
|
705754
|
+
const real = realpathSync2(entrypoint);
|
|
705755
|
+
for (const packageRoot of [dirname58(real), join148(dirname58(real), "..")]) {
|
|
705528
705756
|
const candidate = join148(packageRoot, "assets", "tray", `omnius-online.${extension3}`);
|
|
705529
705757
|
if (existsSync132(candidate)) return candidate;
|
|
705530
705758
|
}
|
|
@@ -705587,7 +705815,7 @@ function writeTrayAutostart(endpoint) {
|
|
|
705587
705815
|
const launch = resolveTrayRegistrationCommand();
|
|
705588
705816
|
if (!launch) throw new Error("Could not resolve the installed Omnius CLI entrypoint");
|
|
705589
705817
|
const paths = resolveTrayPaths();
|
|
705590
|
-
mkdirSync82(
|
|
705818
|
+
mkdirSync82(dirname58(paths.autostartFile), { recursive: true });
|
|
705591
705819
|
writeFileSync74(
|
|
705592
705820
|
paths.autostartFile,
|
|
705593
705821
|
buildAutostartContent(process.platform, launch, endpoint, registrationIconPath(launch)),
|
|
@@ -707421,7 +707649,7 @@ __export(py_embed_exports, {
|
|
|
707421
707649
|
});
|
|
707422
707650
|
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
707423
707651
|
import { existsSync as existsSync135, mkdirSync as mkdirSync85, readFileSync as readFileSync113, writeFileSync as writeFileSync76 } from "node:fs";
|
|
707424
|
-
import { dirname as
|
|
707652
|
+
import { dirname as dirname59, join as join151 } from "node:path";
|
|
707425
707653
|
import { homedir as homedir43 } from "node:os";
|
|
707426
707654
|
import { fileURLToPath as fileURLToPath25 } from "node:url";
|
|
707427
707655
|
function managedAsrRuntimeRoot() {
|
|
@@ -708216,7 +708444,7 @@ var MODULE_DIR, MANAGED_ASR_ROOT, MANAGED_ASR_MODEL_ROOT, WHISPER_MODEL_IDS2, NE
|
|
|
708216
708444
|
var init_py_embed = __esm({
|
|
708217
708445
|
"packages/cli/src/api/py-embed.ts"() {
|
|
708218
708446
|
init_dist5();
|
|
708219
|
-
MODULE_DIR =
|
|
708447
|
+
MODULE_DIR = dirname59(fileURLToPath25(import.meta.url));
|
|
708220
708448
|
MANAGED_ASR_ROOT = join151(homedir43(), ".omnius", "runtimes", "asr");
|
|
708221
708449
|
MANAGED_ASR_MODEL_ROOT = join151(homedir43(), ".omnius", "models", "asr");
|
|
708222
708450
|
WHISPER_MODEL_IDS2 = /* @__PURE__ */ new Set(["tiny", "base", "small", "medium", "large-v3"]);
|
|
@@ -708610,7 +708838,7 @@ import {
|
|
|
708610
708838
|
writeFileSync as writeFileSync78,
|
|
708611
708839
|
readdirSync as readdirSync44
|
|
708612
708840
|
} from "node:fs";
|
|
708613
|
-
import { join as join153, dirname as
|
|
708841
|
+
import { join as join153, dirname as dirname60 } from "node:path";
|
|
708614
708842
|
import { homedir as homedir45 } from "node:os";
|
|
708615
708843
|
import { fileURLToPath as fileURLToPath26 } from "node:url";
|
|
708616
708844
|
import { EventEmitter as EventEmitter6 } from "node:events";
|
|
@@ -708906,7 +709134,7 @@ async function findMicCaptureCommand() {
|
|
|
708906
709134
|
return null;
|
|
708907
709135
|
}
|
|
708908
709136
|
async function findTranscribeFileScript() {
|
|
708909
|
-
const thisDir =
|
|
709137
|
+
const thisDir = dirname60(fileURLToPath26(import.meta.url));
|
|
708910
709138
|
const candidates = [
|
|
708911
709139
|
join153(thisDir, "../../../../packages/execution/scripts/transcribe-file.py"),
|
|
708912
709140
|
join153(thisDir, "../../../packages/execution/scripts/transcribe-file.py"),
|
|
@@ -709003,7 +709231,7 @@ async function transcribeFileViaWhisper(filePath, model) {
|
|
|
709003
709231
|
});
|
|
709004
709232
|
}
|
|
709005
709233
|
async function findLiveAsrScript(scriptName) {
|
|
709006
|
-
const thisDir =
|
|
709234
|
+
const thisDir = dirname60(fileURLToPath26(import.meta.url));
|
|
709007
709235
|
const candidates = [
|
|
709008
709236
|
join153(thisDir, "../../../../packages/execution/scripts", scriptName),
|
|
709009
709237
|
join153(thisDir, "../../../packages/execution/scripts", scriptName),
|
|
@@ -709820,7 +710048,7 @@ ${text3}`.slice(-2e3);
|
|
|
709820
710048
|
const req3 = createRequire12(import.meta.url);
|
|
709821
710049
|
const loaded = req3("transcribe-cli");
|
|
709822
710050
|
try {
|
|
709823
|
-
transcribeCliPackageDirs.add(
|
|
710051
|
+
transcribeCliPackageDirs.add(dirname60(req3.resolve("transcribe-cli/package.json")));
|
|
709824
710052
|
} catch {
|
|
709825
710053
|
}
|
|
709826
710054
|
return loaded;
|
|
@@ -709930,7 +710158,7 @@ ${text3}`.slice(-2e3);
|
|
|
709930
710158
|
let tcUpToDate = false;
|
|
709931
710159
|
try {
|
|
709932
710160
|
const tcPkgPath = join153(
|
|
709933
|
-
|
|
710161
|
+
dirname60(__require.resolve?.("transcribe-cli/package.json") || ""),
|
|
709934
710162
|
"package.json"
|
|
709935
710163
|
);
|
|
709936
710164
|
if (existsSync137(tcPkgPath)) {
|
|
@@ -715184,7 +715412,7 @@ import {
|
|
|
715184
715412
|
writeFileSync as writeFileSync80
|
|
715185
715413
|
} from "node:fs";
|
|
715186
715414
|
import { homedir as homedir47 } from "node:os";
|
|
715187
|
-
import { dirname as
|
|
715415
|
+
import { dirname as dirname61, join as join156 } from "node:path";
|
|
715188
715416
|
function safeSegment3(value2) {
|
|
715189
715417
|
return value2.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 180) || "session";
|
|
715190
715418
|
}
|
|
@@ -715198,7 +715426,7 @@ function acknowledgementPath(sessionId) {
|
|
|
715198
715426
|
return join156(controlDir(), `${safeSegment3(sessionId)}.ack.json`);
|
|
715199
715427
|
}
|
|
715200
715428
|
function atomicWrite3(path16, value2) {
|
|
715201
|
-
mkdirSync90(
|
|
715429
|
+
mkdirSync90(dirname61(path16), { recursive: true });
|
|
715202
715430
|
const tmp = `${path16}.tmp.${process.pid}.${randomUUID33()}`;
|
|
715203
715431
|
writeFileSync80(tmp, `${JSON.stringify(value2, null, 2)}
|
|
715204
715432
|
`, "utf8");
|
|
@@ -721353,11 +721581,11 @@ function wrapToWidth(text3, width) {
|
|
|
721353
721581
|
}
|
|
721354
721582
|
function wrapListItems(items, width) {
|
|
721355
721583
|
if (items.length === 0) return [];
|
|
721356
|
-
const
|
|
721584
|
+
const sep16 = " · ";
|
|
721357
721585
|
const lines = [];
|
|
721358
721586
|
let current = "";
|
|
721359
721587
|
for (const item of items) {
|
|
721360
|
-
const candidate = current === "" ? item : current +
|
|
721588
|
+
const candidate = current === "" ? item : current + sep16 + item;
|
|
721361
721589
|
if (visibleLength(candidate) <= width) {
|
|
721362
721590
|
current = candidate;
|
|
721363
721591
|
} else {
|
|
@@ -723046,7 +723274,7 @@ var init_internal_output = __esm({
|
|
|
723046
723274
|
// packages/cli/src/tui/terminal-links.ts
|
|
723047
723275
|
import { existsSync as existsSync142 } from "node:fs";
|
|
723048
723276
|
import { homedir as homedir48 } from "node:os";
|
|
723049
|
-
import { isAbsolute as
|
|
723277
|
+
import { isAbsolute as isAbsolute23, resolve as resolve74 } from "node:path";
|
|
723050
723278
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
723051
723279
|
function hyperlinksEnabled(options2 = {}) {
|
|
723052
723280
|
return options2.force ?? (process.stdout.isTTY ?? false);
|
|
@@ -723075,11 +723303,11 @@ function stripLineCoordinates(filePath) {
|
|
|
723075
723303
|
}
|
|
723076
723304
|
function existingFileHref(filePath, cwd4) {
|
|
723077
723305
|
const expanded = expandHome2(filePath);
|
|
723078
|
-
const direct =
|
|
723306
|
+
const direct = isAbsolute23(expanded) ? expanded : resolve74(cwd4, expanded);
|
|
723079
723307
|
if (existsSync142(direct)) return pathToFileURL2(direct).href;
|
|
723080
723308
|
const withoutCoordinates = stripLineCoordinates(expanded);
|
|
723081
723309
|
if (withoutCoordinates === expanded) return null;
|
|
723082
|
-
const target =
|
|
723310
|
+
const target = isAbsolute23(withoutCoordinates) ? withoutCoordinates : resolve74(cwd4, withoutCoordinates);
|
|
723083
723311
|
return existsSync142(target) ? pathToFileURL2(target).href : null;
|
|
723084
723312
|
}
|
|
723085
723313
|
function httpHref(target) {
|
|
@@ -723982,13 +724210,13 @@ function stripTrustTierWrapperForTui(text3, maxWrapperChars = 400) {
|
|
|
723982
724210
|
).replace(/^---[ \t]*(?:\n)?/, "").replace(/(?:\n)?---[ \t]*$/, "");
|
|
723983
724211
|
}
|
|
723984
724212
|
function wrapFooterItems(items, width) {
|
|
723985
|
-
const
|
|
724213
|
+
const sep16 = " · ";
|
|
723986
724214
|
const lines = [];
|
|
723987
724215
|
let current = "";
|
|
723988
724216
|
for (const item of items) {
|
|
723989
724217
|
const clean7 = item.replace(/\s+/g, " ").trim();
|
|
723990
724218
|
if (!clean7) continue;
|
|
723991
|
-
const candidate = current ? `${current}${
|
|
724219
|
+
const candidate = current ? `${current}${sep16}${clean7}` : clean7;
|
|
723992
724220
|
if (visibleLen(candidate) <= width) {
|
|
723993
724221
|
current = candidate;
|
|
723994
724222
|
continue;
|
|
@@ -729516,7 +729744,7 @@ var init_types3 = __esm({
|
|
|
729516
729744
|
// packages/cli/src/tui/p2p/secret-vault.ts
|
|
729517
729745
|
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes28, scryptSync as scryptSync2, createHash as createHash74 } from "node:crypto";
|
|
729518
729746
|
import { readFileSync as readFileSync122, writeFileSync as writeFileSync83, existsSync as existsSync146, mkdirSync as mkdirSync93 } from "node:fs";
|
|
729519
|
-
import { dirname as
|
|
729747
|
+
import { dirname as dirname62 } from "node:path";
|
|
729520
729748
|
var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
|
|
729521
729749
|
var init_secret_vault = __esm({
|
|
729522
729750
|
"packages/cli/src/tui/p2p/secret-vault.ts"() {
|
|
@@ -729722,7 +729950,7 @@ var init_secret_vault = __esm({
|
|
|
729722
729950
|
const encrypted = Buffer.concat([cipher.update(data, "utf8"), cipher.final()]);
|
|
729723
729951
|
const tag = cipher.getAuthTag();
|
|
729724
729952
|
const blob = Buffer.concat([salt, iv, tag, encrypted]);
|
|
729725
|
-
const dir =
|
|
729953
|
+
const dir = dirname62(this.storePath);
|
|
729726
729954
|
if (!existsSync146(dir)) mkdirSync93(dir, { recursive: true });
|
|
729727
729955
|
writeFileSync83(this.storePath, blob, { mode: 384 });
|
|
729728
729956
|
}
|
|
@@ -731401,7 +731629,7 @@ __export(omnius_directory_exports, {
|
|
|
731401
731629
|
writeTaskHandoff: () => writeTaskHandoff2
|
|
731402
731630
|
});
|
|
731403
731631
|
import { appendFileSync as appendFileSync16, cpSync as cpSync2, existsSync as existsSync148, mkdirSync as mkdirSync95, readFileSync as readFileSync124, writeFileSync as writeFileSync85, readdirSync as readdirSync48, statSync as statSync58, unlinkSync as unlinkSync37, openSync as openSync13, closeSync as closeSync13, renameSync as renameSync30, watch as fsWatch3 } from "node:fs";
|
|
731404
|
-
import { join as join162, relative as relative23, basename as basename32, dirname as
|
|
731632
|
+
import { join as join162, relative as relative23, basename as basename32, dirname as dirname63, resolve as resolve77 } from "node:path";
|
|
731405
731633
|
import { homedir as homedir50 } from "node:os";
|
|
731406
731634
|
import { createHash as createHash77 } from "node:crypto";
|
|
731407
731635
|
function isGitRoot(dir) {
|
|
@@ -731466,7 +731694,7 @@ function ensureOmniusIgnored(repoRoot) {
|
|
|
731466
731694
|
if (!gitRoot) return;
|
|
731467
731695
|
const gitignorePath = findNearestExistingGitignore(repoRoot, gitRoot);
|
|
731468
731696
|
if (!gitignorePath) return;
|
|
731469
|
-
const gitignoreDir =
|
|
731697
|
+
const gitignoreDir = dirname63(gitignorePath);
|
|
731470
731698
|
const relDir = relative23(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
|
|
731471
731699
|
const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
|
|
731472
731700
|
const content = readFileSync124(gitignorePath, "utf-8");
|
|
@@ -732098,7 +732326,7 @@ function pruneContextLedger(ledgerPath2) {
|
|
|
732098
732326
|
const lines = readFileSync124(ledgerPath2, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
732099
732327
|
if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
|
|
732100
732328
|
const kept = lines.slice(-MAX_CONTEXT_LEDGER_LINES);
|
|
732101
|
-
const archiveDir = join162(
|
|
732329
|
+
const archiveDir = join162(dirname63(ledgerPath2), "archive");
|
|
732102
732330
|
mkdirSync95(archiveDir, { recursive: true });
|
|
732103
732331
|
const archivePath = join162(
|
|
732104
732332
|
archiveDir,
|
|
@@ -733760,7 +733988,7 @@ var init_render2 = __esm({
|
|
|
733760
733988
|
|
|
733761
733989
|
// packages/prompts/dist/promptLoader.js
|
|
733762
733990
|
import { readFileSync as readFileSync127, existsSync as existsSync151 } from "node:fs";
|
|
733763
|
-
import { join as join164, dirname as
|
|
733991
|
+
import { join as join164, dirname as dirname64 } from "node:path";
|
|
733764
733992
|
import { fileURLToPath as fileURLToPath27 } from "node:url";
|
|
733765
733993
|
function resolvePromptsDir(baseDir, promptPath = "code.md") {
|
|
733766
733994
|
const devPath2 = join164(baseDir, "..", "templates");
|
|
@@ -733790,7 +734018,7 @@ var init_promptLoader2 = __esm({
|
|
|
733790
734018
|
"packages/prompts/dist/promptLoader.js"() {
|
|
733791
734019
|
"use strict";
|
|
733792
734020
|
__filename4 = fileURLToPath27(import.meta.url);
|
|
733793
|
-
__dirname5 =
|
|
734021
|
+
__dirname5 = dirname64(__filename4);
|
|
733794
734022
|
PROMPTS_DIR2 = resolvePromptsDir(__dirname5);
|
|
733795
734023
|
cache6 = /* @__PURE__ */ new Map();
|
|
733796
734024
|
}
|
|
@@ -733904,7 +734132,7 @@ var init_task_templates = __esm({
|
|
|
733904
734132
|
});
|
|
733905
734133
|
|
|
733906
734134
|
// packages/prompts/dist/index.js
|
|
733907
|
-
import { join as join165, dirname as
|
|
734135
|
+
import { join as join165, dirname as dirname65 } from "node:path";
|
|
733908
734136
|
import { fileURLToPath as fileURLToPath28 } from "node:url";
|
|
733909
734137
|
var _dir, _packageRoot;
|
|
733910
734138
|
var init_dist9 = __esm({
|
|
@@ -733914,7 +734142,7 @@ var init_dist9 = __esm({
|
|
|
733914
734142
|
init_render2();
|
|
733915
734143
|
init_task_templates();
|
|
733916
734144
|
init_render2();
|
|
733917
|
-
_dir =
|
|
734145
|
+
_dir = dirname65(fileURLToPath28(import.meta.url));
|
|
733918
734146
|
_packageRoot = join165(_dir, "..");
|
|
733919
734147
|
}
|
|
733920
734148
|
});
|
|
@@ -735307,7 +735535,7 @@ var init_braille_spinner = __esm({
|
|
|
735307
735535
|
|
|
735308
735536
|
// packages/cli/src/tui/project-context.ts
|
|
735309
735537
|
import { existsSync as existsSync153, readFileSync as readFileSync129, readdirSync as readdirSync49, mkdirSync as mkdirSync97, statSync as statSync60, writeFileSync as writeFileSync87 } from "node:fs";
|
|
735310
|
-
import { dirname as
|
|
735538
|
+
import { dirname as dirname66, join as join167, basename as basename34, resolve as resolve79 } from "node:path";
|
|
735311
735539
|
import { homedir as homedir53 } from "node:os";
|
|
735312
735540
|
function projectContextUrlSpanAt(text3, index) {
|
|
735313
735541
|
PROJECT_CONTEXT_URL_RE.lastIndex = 0;
|
|
@@ -735381,7 +735609,7 @@ function findGitDir(repoRoot) {
|
|
|
735381
735609
|
}
|
|
735382
735610
|
return gitPath;
|
|
735383
735611
|
}
|
|
735384
|
-
const parent =
|
|
735612
|
+
const parent = dirname66(dir);
|
|
735385
735613
|
if (parent === dir) return null;
|
|
735386
735614
|
dir = parent;
|
|
735387
735615
|
}
|
|
@@ -737161,7 +737389,7 @@ __export(status_bar_exports, {
|
|
|
737161
737389
|
stripSubAgentPrefix: () => stripSubAgentPrefix,
|
|
737162
737390
|
unlockFooterRedraws: () => unlockFooterRedraws
|
|
737163
737391
|
});
|
|
737164
|
-
import { basename as basename35, dirname as
|
|
737392
|
+
import { basename as basename35, dirname as dirname67 } from "node:path";
|
|
737165
737393
|
import { readFile as readFileAsync } from "node:fs/promises";
|
|
737166
737394
|
function headerButtonGlyphFg() {
|
|
737167
737395
|
const a2 = tuiAccent();
|
|
@@ -741576,7 +741804,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
741576
741804
|
if (limit2 <= 6) return value2.slice(-limit2);
|
|
741577
741805
|
const marker = "...";
|
|
741578
741806
|
const leaf = basename35(value2);
|
|
741579
|
-
const parentLeaf = basename35(
|
|
741807
|
+
const parentLeaf = basename35(dirname67(value2));
|
|
741580
741808
|
const suffix = parentLeaf && parentLeaf !== "." && parentLeaf !== leaf ? `${parentLeaf}/${leaf}` : leaf;
|
|
741581
741809
|
if (suffix.length + marker.length + 1 <= limit2) {
|
|
741582
741810
|
return `${marker}/${suffix}`;
|
|
@@ -743715,7 +743943,7 @@ __export(personaplex_exports, {
|
|
|
743715
743943
|
stopPersonaPlex: () => stopPersonaPlex
|
|
743716
743944
|
});
|
|
743717
743945
|
import { existsSync as existsSync154, writeFileSync as writeFileSync88, readFileSync as readFileSync130, mkdirSync as mkdirSync98, copyFileSync as copyFileSync5, readdirSync as readdirSync50, statSync as statSync61 } from "node:fs";
|
|
743718
|
-
import { join as join168, dirname as
|
|
743946
|
+
import { join as join168, dirname as dirname68 } from "node:path";
|
|
743719
743947
|
import { homedir as homedir54 } from "node:os";
|
|
743720
743948
|
import { spawn as spawn42 } from "node:child_process";
|
|
743721
743949
|
import { fileURLToPath as fileURLToPath29 } from "node:url";
|
|
@@ -744525,7 +744753,7 @@ function getShippedVoicesDir() {
|
|
|
744525
744753
|
// repo root
|
|
744526
744754
|
];
|
|
744527
744755
|
try {
|
|
744528
|
-
const modDir =
|
|
744756
|
+
const modDir = dirname68(fileURLToPath29(import.meta.url));
|
|
744529
744757
|
candidates.push(join168(modDir, "..", "voices", "personaplex"));
|
|
744530
744758
|
candidates.push(join168(modDir, "..", "..", "..", "voices", "personaplex"));
|
|
744531
744759
|
candidates.push(join168(modDir, "..", "..", "..", "..", "voices", "personaplex"));
|
|
@@ -752298,7 +752526,7 @@ import {
|
|
|
752298
752526
|
renameSync as renameSync31,
|
|
752299
752527
|
unlinkSync as unlinkSync40
|
|
752300
752528
|
} from "node:fs";
|
|
752301
|
-
import { dirname as
|
|
752529
|
+
import { dirname as dirname69, join as join174 } from "node:path";
|
|
752302
752530
|
import { homedir as homedir57 } from "node:os";
|
|
752303
752531
|
import { randomBytes as randomBytes31 } from "node:crypto";
|
|
752304
752532
|
function configHome() {
|
|
@@ -752314,7 +752542,7 @@ function bootstrapApiKeyFile() {
|
|
|
752314
752542
|
return fromEnv || join174(configHome(), "api.key");
|
|
752315
752543
|
}
|
|
752316
752544
|
function ensureDirFor(file) {
|
|
752317
|
-
const dir =
|
|
752545
|
+
const dir = dirname69(file);
|
|
752318
752546
|
if (!existsSync162(dir)) mkdirSync100(dir, { recursive: true });
|
|
752319
752547
|
}
|
|
752320
752548
|
function atomicWritePrivateFile(file, content) {
|
|
@@ -755489,7 +755717,7 @@ import {
|
|
|
755489
755717
|
statSync as statSync65,
|
|
755490
755718
|
writeFileSync as writeFileSync93
|
|
755491
755719
|
} from "node:fs";
|
|
755492
|
-
import { dirname as
|
|
755720
|
+
import { dirname as dirname70, join as join178, resolve as resolve82 } from "node:path";
|
|
755493
755721
|
import { platform as platform11 } from "node:os";
|
|
755494
755722
|
import { spawn as spawn44, spawnSync as spawnSync11 } from "node:child_process";
|
|
755495
755723
|
import { fileURLToPath as fileURLToPath30 } from "node:url";
|
|
@@ -755627,7 +755855,7 @@ async function runCommand(command, args, options2 = {}) {
|
|
|
755627
755855
|
});
|
|
755628
755856
|
}
|
|
755629
755857
|
function packageAssetPath(...segments) {
|
|
755630
|
-
const moduleDir =
|
|
755858
|
+
const moduleDir = dirname70(fileURLToPath30(import.meta.url));
|
|
755631
755859
|
const candidates = [
|
|
755632
755860
|
join178(moduleDir, "..", "assets", ...segments),
|
|
755633
755861
|
join178(moduleDir, "..", "..", "assets", ...segments)
|
|
@@ -755999,7 +756227,7 @@ function writeProfileMap(value2) {
|
|
|
755999
756227
|
if (Buffer.byteLength(serialized) > PROFILE_MAP_MAX_BYTES) {
|
|
756000
756228
|
throw new Error("Voicebox profile map exceeded its bounded storage limit");
|
|
756001
756229
|
}
|
|
756002
|
-
mkdirSync103(
|
|
756230
|
+
mkdirSync103(dirname70(profileMapPath()), { recursive: true });
|
|
756003
756231
|
const temporary = `${profileMapPath()}.tmp-${process.pid}-${Date.now()}`;
|
|
756004
756232
|
writeFileSync93(temporary, serialized, { mode: 384 });
|
|
756005
756233
|
renameSync32(temporary, profileMapPath());
|
|
@@ -756388,7 +756616,7 @@ import {
|
|
|
756388
756616
|
copyFileSync as copyFileSync6,
|
|
756389
756617
|
rmSync as rmSync17
|
|
756390
756618
|
} from "node:fs";
|
|
756391
|
-
import { basename as basename37, join as join179, dirname as
|
|
756619
|
+
import { basename as basename37, join as join179, dirname as dirname71, resolve as resolve83 } from "node:path";
|
|
756392
756620
|
import { homedir as homedir59, tmpdir as tmpdir26, platform as platform12 } from "node:os";
|
|
756393
756621
|
import {
|
|
756394
756622
|
spawn as nodeSpawn
|
|
@@ -756494,7 +756722,7 @@ function luxttsInferScript2() {
|
|
|
756494
756722
|
return join179(voiceDir2(), "luxtts-infer.py");
|
|
756495
756723
|
}
|
|
756496
756724
|
function resolveBundledVoiceAsset(relativePath2) {
|
|
756497
|
-
const moduleDir =
|
|
756725
|
+
const moduleDir = dirname71(fileURLToPath31(import.meta.url));
|
|
756498
756726
|
const candidates = [
|
|
756499
756727
|
// npm bundle: publish/dist/index.js -> publish/assets
|
|
756500
756728
|
join179(moduleDir, "..", "assets", relativePath2),
|
|
@@ -756594,7 +756822,7 @@ function consolidateVoiceDirs2() {
|
|
|
756594
756822
|
const c9 = join179(dir, ".omnius", "voice");
|
|
756595
756823
|
if (existsSync167(c9) && c9 !== globalVoice) candidates.add(c9);
|
|
756596
756824
|
prev = dir;
|
|
756597
|
-
dir =
|
|
756825
|
+
dir = dirname71(dir);
|
|
756598
756826
|
}
|
|
756599
756827
|
for (const root of COMMON_PROJECT_ROOTS) {
|
|
756600
756828
|
const rootDir3 = join179(homedir59(), root);
|
|
@@ -756787,21 +757015,21 @@ function insertTagAfterOpeningClause(text3, tag) {
|
|
|
756787
757015
|
return `<${tag}> ${text3}`;
|
|
756788
757016
|
}
|
|
756789
757017
|
function writeDetectTorchScript(targetPath) {
|
|
756790
|
-
const moduleDir =
|
|
757018
|
+
const moduleDir = dirname71(fileURLToPath31(import.meta.url));
|
|
756791
757019
|
const canonicalDetector = [
|
|
756792
757020
|
resolveBundledVoiceAsset("voice/detect-torch.py"),
|
|
756793
757021
|
join179(moduleDir, "..", "..", "..", "..", "scripts", "detect-torch.py")
|
|
756794
757022
|
].find((candidate) => Boolean(candidate && existsSync167(candidate)));
|
|
756795
757023
|
if (canonicalDetector) {
|
|
756796
757024
|
try {
|
|
756797
|
-
mkdirSync104(
|
|
757025
|
+
mkdirSync104(dirname71(targetPath), { recursive: true });
|
|
756798
757026
|
writeFileSync94(targetPath, readFileSync139(canonicalDetector), { mode: 493 });
|
|
756799
757027
|
return;
|
|
756800
757028
|
} catch {
|
|
756801
757029
|
}
|
|
756802
757030
|
}
|
|
756803
757031
|
try {
|
|
756804
|
-
mkdirSync104(
|
|
757032
|
+
mkdirSync104(dirname71(targetPath), { recursive: true });
|
|
756805
757033
|
} catch {
|
|
756806
757034
|
}
|
|
756807
757035
|
const script = `#!/usr/bin/env python3
|
|
@@ -761178,7 +761406,7 @@ import {
|
|
|
761178
761406
|
appendFileSync as appendFileSync18,
|
|
761179
761407
|
writeSync as writeSync5
|
|
761180
761408
|
} from "node:fs";
|
|
761181
|
-
import { basename as basename38, dirname as
|
|
761409
|
+
import { basename as basename38, dirname as dirname72, relative as relative25, join as join180 } from "node:path";
|
|
761182
761410
|
function omniusPinnedDependencyVersion(name10) {
|
|
761183
761411
|
const spec2 = OMNIUS_PINNED_DEPENDENCY_SPECS[name10];
|
|
761184
761412
|
if (!spec2) return null;
|
|
@@ -775093,7 +775321,7 @@ async function collectSponsorMediaStream(args) {
|
|
|
775093
775321
|
}
|
|
775094
775322
|
const safeName3 = basename38(artifact.filename).replace(/[^\w.-]/g, "_") || `artifact${defaultExtensionForMime(artifact.mime)}`;
|
|
775095
775323
|
const outputPath3 = join180(args.outputRoot, safeName3);
|
|
775096
|
-
mkdirSync105(
|
|
775324
|
+
mkdirSync105(dirname72(outputPath3), { recursive: true });
|
|
775097
775325
|
writeFileSync95(outputPath3, bytes3);
|
|
775098
775326
|
return { ok: true, path: outputPath3, metadata };
|
|
775099
775327
|
}
|
|
@@ -775594,14 +775822,14 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
775594
775822
|
if (models.length > 0) {
|
|
775595
775823
|
try {
|
|
775596
775824
|
const { writeFileSync: writeFileSync125, mkdirSync: mkdirSync142 } = await import("node:fs");
|
|
775597
|
-
const { join: join225, dirname:
|
|
775825
|
+
const { join: join225, dirname: dirname88 } = await import("node:path");
|
|
775598
775826
|
const cachePath2 = join225(
|
|
775599
775827
|
ctx3.repoRoot || process.cwd(),
|
|
775600
775828
|
".omnius",
|
|
775601
775829
|
"nexus",
|
|
775602
775830
|
"peer-models-cache.json"
|
|
775603
775831
|
);
|
|
775604
|
-
mkdirSync142(
|
|
775832
|
+
mkdirSync142(dirname88(cachePath2), { recursive: true });
|
|
775605
775833
|
writeFileSync125(
|
|
775606
775834
|
cachePath2,
|
|
775607
775835
|
JSON.stringify(
|
|
@@ -775677,14 +775905,14 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
775677
775905
|
);
|
|
775678
775906
|
try {
|
|
775679
775907
|
const { writeFileSync: writeFileSync125, mkdirSync: mkdirSync142 } = await import("node:fs");
|
|
775680
|
-
const { join: join225, dirname:
|
|
775908
|
+
const { join: join225, dirname: dirname88 } = await import("node:path");
|
|
775681
775909
|
const cachePath2 = join225(
|
|
775682
775910
|
ctx3.repoRoot || process.cwd(),
|
|
775683
775911
|
".omnius",
|
|
775684
775912
|
"nexus",
|
|
775685
775913
|
"peer-models-cache.json"
|
|
775686
775914
|
);
|
|
775687
|
-
mkdirSync142(
|
|
775915
|
+
mkdirSync142(dirname88(cachePath2), { recursive: true });
|
|
775688
775916
|
writeFileSync125(
|
|
775689
775917
|
cachePath2,
|
|
775690
775918
|
JSON.stringify(
|
|
@@ -776770,10 +776998,10 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
776770
776998
|
try {
|
|
776771
776999
|
const { createRequire: createRequire12 } = await import("node:module");
|
|
776772
777000
|
const { fileURLToPath: fileURLToPath38 } = await import("node:url");
|
|
776773
|
-
const { dirname:
|
|
777001
|
+
const { dirname: dirname88, join: join225 } = await import("node:path");
|
|
776774
777002
|
const { existsSync: existsSync208 } = await import("node:fs");
|
|
776775
777003
|
const req3 = createRequire12(import.meta.url);
|
|
776776
|
-
const thisDir =
|
|
777004
|
+
const thisDir = dirname88(fileURLToPath38(import.meta.url));
|
|
776777
777005
|
const candidates = [
|
|
776778
777006
|
join225(thisDir, "..", "package.json"),
|
|
776779
777007
|
join225(thisDir, "..", "..", "package.json"),
|
|
@@ -784243,7 +784471,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
784243
784471
|
|
|
784244
784472
|
// packages/cli/src/tui/promptLoader.ts
|
|
784245
784473
|
import { readFileSync as readFileSync147, existsSync as existsSync176 } from "node:fs";
|
|
784246
|
-
import { join as join188, dirname as
|
|
784474
|
+
import { join as join188, dirname as dirname74 } from "node:path";
|
|
784247
784475
|
import { fileURLToPath as fileURLToPath32 } from "node:url";
|
|
784248
784476
|
function loadPrompt3(promptPath, vars) {
|
|
784249
784477
|
let content = cache7.get(promptPath);
|
|
@@ -784262,7 +784490,7 @@ var __filename5, __dirname6, devPath, publishedPath, PROMPTS_DIR3, cache7;
|
|
|
784262
784490
|
var init_promptLoader3 = __esm({
|
|
784263
784491
|
"packages/cli/src/tui/promptLoader.ts"() {
|
|
784264
784492
|
__filename5 = fileURLToPath32(import.meta.url);
|
|
784265
|
-
__dirname6 =
|
|
784493
|
+
__dirname6 = dirname74(__filename5);
|
|
784266
784494
|
devPath = join188(__dirname6, "..", "..", "prompts");
|
|
784267
784495
|
publishedPath = join188(__dirname6, "..", "prompts");
|
|
784268
784496
|
PROMPTS_DIR3 = existsSync176(devPath) ? devPath : publishedPath;
|
|
@@ -789439,7 +789667,7 @@ import {
|
|
|
789439
789667
|
unlinkSync as unlinkSync45,
|
|
789440
789668
|
writeFileSync as writeFileSync104
|
|
789441
789669
|
} from "node:fs";
|
|
789442
|
-
import { dirname as
|
|
789670
|
+
import { dirname as dirname75, join as join193 } from "node:path";
|
|
789443
789671
|
import { randomBytes as randomBytes33 } from "node:crypto";
|
|
789444
789672
|
function finiteNonNegativeInteger(value2, name10) {
|
|
789445
789673
|
if (!Number.isSafeInteger(value2) || value2 < 0) {
|
|
@@ -789531,7 +789759,7 @@ var init_telegram_poll_health = __esm({
|
|
|
789531
789759
|
}
|
|
789532
789760
|
write(state5) {
|
|
789533
789761
|
if (!isPollHealth(state5)) throw new TypeError("Invalid Telegram poll health");
|
|
789534
|
-
mkdirSync115(
|
|
789762
|
+
mkdirSync115(dirname75(this.filePath), { recursive: true });
|
|
789535
789763
|
const temporaryPath = `${this.filePath}.${process.pid}.${randomBytes33(8).toString("hex")}.tmp`;
|
|
789536
789764
|
let fd;
|
|
789537
789765
|
try {
|
|
@@ -789543,7 +789771,7 @@ var init_telegram_poll_health = __esm({
|
|
|
789543
789771
|
fd = void 0;
|
|
789544
789772
|
renameSync36(temporaryPath, this.filePath);
|
|
789545
789773
|
try {
|
|
789546
|
-
const directoryFd = openSync15(
|
|
789774
|
+
const directoryFd = openSync15(dirname75(this.filePath), "r");
|
|
789547
789775
|
try {
|
|
789548
789776
|
fsyncSync4(directoryFd);
|
|
789549
789777
|
} finally {
|
|
@@ -789762,7 +789990,7 @@ var init_telegram_input_ownership = __esm({
|
|
|
789762
789990
|
// packages/cli/src/tui/telegram-update-spool.ts
|
|
789763
789991
|
import Database from "better-sqlite3";
|
|
789764
789992
|
import { mkdirSync as mkdirSync116 } from "node:fs";
|
|
789765
|
-
import { dirname as
|
|
789993
|
+
import { dirname as dirname76 } from "node:path";
|
|
789766
789994
|
function safeInteger2(value2, name10) {
|
|
789767
789995
|
if (!Number.isSafeInteger(value2) || value2 < 0) {
|
|
789768
789996
|
throw new TelegramUpdateEnvelopeError(
|
|
@@ -789948,7 +790176,7 @@ var init_telegram_update_spool = __esm({
|
|
|
789948
790176
|
TelegramUpdateSpool = class {
|
|
789949
790177
|
constructor(dbPath) {
|
|
789950
790178
|
this.dbPath = dbPath;
|
|
789951
|
-
mkdirSync116(
|
|
790179
|
+
mkdirSync116(dirname76(dbPath), { recursive: true });
|
|
789952
790180
|
this.db = new Database(dbPath);
|
|
789953
790181
|
this.db.pragma("journal_mode = WAL");
|
|
789954
790182
|
this.db.pragma("synchronous = FULL");
|
|
@@ -791407,7 +791635,7 @@ import {
|
|
|
791407
791635
|
unlinkSync as unlinkSync46,
|
|
791408
791636
|
writeFileSync as writeFileSync105
|
|
791409
791637
|
} from "node:fs";
|
|
791410
|
-
import { dirname as
|
|
791638
|
+
import { dirname as dirname77, join as join194, resolve as resolve89 } from "node:path";
|
|
791411
791639
|
function clip3(text3, limit2) {
|
|
791412
791640
|
const compact6 = text3.replace(/\s+/g, " ").trim();
|
|
791413
791641
|
return compact6.length <= limit2 ? compact6 : `${compact6.slice(0, Math.max(0, limit2 - 3)).trimEnd()}...`;
|
|
@@ -791538,7 +791766,7 @@ function loadTelegramOutputPatternMemory(scope) {
|
|
|
791538
791766
|
}
|
|
791539
791767
|
function saveTelegramOutputPatternMemory(scope, memory) {
|
|
791540
791768
|
const paths = telegramOutputPatternMemoryPaths(scope);
|
|
791541
|
-
mkdirSync117(
|
|
791769
|
+
mkdirSync117(dirname77(paths.json), { recursive: true });
|
|
791542
791770
|
const temporaryPath = `${paths.json}.${process.pid}.${randomBytes34(6).toString("hex")}.tmp`;
|
|
791543
791771
|
try {
|
|
791544
791772
|
writeFileSync105(temporaryPath, `${JSON.stringify(memory, null, 2)}
|
|
@@ -791557,7 +791785,7 @@ function saveTelegramOutputPatternMemory(scope, memory) {
|
|
|
791557
791785
|
}
|
|
791558
791786
|
function appendEvent(scope, event) {
|
|
791559
791787
|
const paths = telegramOutputPatternMemoryPaths(scope);
|
|
791560
|
-
mkdirSync117(
|
|
791788
|
+
mkdirSync117(dirname77(paths.events), { recursive: true });
|
|
791561
791789
|
appendFileSync22(
|
|
791562
791790
|
paths.events,
|
|
791563
791791
|
`${JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...event })}
|
|
@@ -792538,13 +792766,13 @@ import {
|
|
|
792538
792766
|
} from "node:fs";
|
|
792539
792767
|
import {
|
|
792540
792768
|
basename as basename47,
|
|
792541
|
-
dirname as
|
|
792769
|
+
dirname as dirname78,
|
|
792542
792770
|
extname as extname24,
|
|
792543
|
-
isAbsolute as
|
|
792771
|
+
isAbsolute as isAbsolute24,
|
|
792544
792772
|
join as join196,
|
|
792545
792773
|
relative as relative26,
|
|
792546
792774
|
resolve as resolve90,
|
|
792547
|
-
sep as
|
|
792775
|
+
sep as sep12
|
|
792548
792776
|
} from "node:path";
|
|
792549
792777
|
function optionalHttpsReceiptUrl(value2, label) {
|
|
792550
792778
|
if (value2 === void 0) return void 0;
|
|
@@ -792578,11 +792806,11 @@ function ledgerPath(root) {
|
|
|
792578
792806
|
return join196(resolve90(root), LEDGER_FILE2);
|
|
792579
792807
|
}
|
|
792580
792808
|
function signingKeyPath(root) {
|
|
792581
|
-
return join196(
|
|
792809
|
+
return join196(dirname78(resolve90(root)), KEY_FILE);
|
|
792582
792810
|
}
|
|
792583
792811
|
function readSigningKey(root) {
|
|
792584
792812
|
const path16 = signingKeyPath(root);
|
|
792585
|
-
mkdirSync118(
|
|
792813
|
+
mkdirSync118(dirname78(path16), { recursive: true });
|
|
792586
792814
|
if (!existsSync182(path16)) {
|
|
792587
792815
|
writeFileSync106(path16, randomBytes36(32), { mode: 384, flag: "wx" });
|
|
792588
792816
|
}
|
|
@@ -792684,7 +792912,7 @@ function assertLogicalPath(root, logicalPath2) {
|
|
|
792684
792912
|
const rootAbs = resolve90(root);
|
|
792685
792913
|
const abs = resolve90(rootAbs, logicalPath2);
|
|
792686
792914
|
const rel = relative26(rootAbs, abs);
|
|
792687
|
-
if (!logicalPath2.trim() || rel === "" || rel.startsWith("..") || resolve90(abs) === rootAbs || !abs.startsWith(rootAbs.endsWith(
|
|
792915
|
+
if (!logicalPath2.trim() || rel === "" || rel.startsWith("..") || resolve90(abs) === rootAbs || !abs.startsWith(rootAbs.endsWith(sep12) ? rootAbs : rootAbs + sep12)) {
|
|
792688
792916
|
throw new Error("Artifact path escapes the Telegram creative workspace");
|
|
792689
792917
|
}
|
|
792690
792918
|
if (basename47(abs).startsWith(".omnius-")) {
|
|
@@ -792861,7 +793089,7 @@ function registerTelegramArtifactCapability(args) {
|
|
|
792861
793089
|
}
|
|
792862
793090
|
function getTelegramArtifactCapability(root, capabilityOrArtifactId) {
|
|
792863
793091
|
const ledger = readLedger(root);
|
|
792864
|
-
const lookupPath =
|
|
793092
|
+
const lookupPath = isAbsolute24(capabilityOrArtifactId) ? relative26(resolve90(root), resolve90(capabilityOrArtifactId)).replace(
|
|
792865
793093
|
/\\/g,
|
|
792866
793094
|
"/"
|
|
792867
793095
|
) : capabilityOrArtifactId.replace(/\\/g, "/");
|
|
@@ -793086,14 +793314,14 @@ import {
|
|
|
793086
793314
|
mkdirSync as mkdirSync119,
|
|
793087
793315
|
readdirSync as readdirSync63,
|
|
793088
793316
|
readFileSync as readFileSync154,
|
|
793089
|
-
realpathSync as
|
|
793317
|
+
realpathSync as realpathSync3,
|
|
793090
793318
|
renameSync as renameSync39,
|
|
793091
793319
|
rmSync as rmSync22,
|
|
793092
793320
|
statSync as statSync70,
|
|
793093
793321
|
unlinkSync as unlinkSync48,
|
|
793094
793322
|
writeFileSync as writeFileSync107
|
|
793095
793323
|
} from "node:fs";
|
|
793096
|
-
import { basename as basename48, dirname as
|
|
793324
|
+
import { basename as basename48, dirname as dirname79, join as join197, relative as relative27, resolve as resolve91, sep as sep13 } from "node:path";
|
|
793097
793325
|
function positiveSafeInteger(value2, fallback, label) {
|
|
793098
793326
|
const resolved = value2 ?? fallback;
|
|
793099
793327
|
if (!Number.isSafeInteger(resolved) || resolved < 1) {
|
|
@@ -793112,7 +793340,7 @@ function runKey(runId) {
|
|
|
793112
793340
|
}
|
|
793113
793341
|
function isInside(root, candidate) {
|
|
793114
793342
|
const rel = relative27(root, candidate);
|
|
793115
|
-
return rel === "" || !rel.startsWith(`..${
|
|
793343
|
+
return rel === "" || !rel.startsWith(`..${sep13}`) && rel !== "..";
|
|
793116
793344
|
}
|
|
793117
793345
|
function atomicWriteJson2(path16, value2) {
|
|
793118
793346
|
const staged = `${path16}.${randomBytes37(8).toString("hex")}.tmp`;
|
|
@@ -793144,17 +793372,17 @@ function readReceipt(root) {
|
|
|
793144
793372
|
}
|
|
793145
793373
|
}
|
|
793146
793374
|
function assertDeletableRun(runsRoot, candidate) {
|
|
793147
|
-
const canonicalRuns =
|
|
793375
|
+
const canonicalRuns = realpathSync3(runsRoot);
|
|
793148
793376
|
const lexical = resolve91(candidate);
|
|
793149
|
-
if (!isInside(canonicalRuns, lexical) ||
|
|
793377
|
+
if (!isInside(canonicalRuns, lexical) || dirname79(lexical) !== canonicalRuns) {
|
|
793150
793378
|
throw new Error("Refusing to clean an artifact path outside the run root");
|
|
793151
793379
|
}
|
|
793152
793380
|
const info = lstatSync5(lexical);
|
|
793153
793381
|
if (info.isSymbolicLink() || !info.isDirectory()) {
|
|
793154
793382
|
throw new Error("Refusing to clean a non-directory or symbolic-link run path");
|
|
793155
793383
|
}
|
|
793156
|
-
const canonicalCandidate =
|
|
793157
|
-
if (
|
|
793384
|
+
const canonicalCandidate = realpathSync3(lexical);
|
|
793385
|
+
if (dirname79(canonicalCandidate) !== canonicalRuns) {
|
|
793158
793386
|
throw new Error("Refusing to clean a run directory that resolves outside its parent");
|
|
793159
793387
|
}
|
|
793160
793388
|
}
|
|
@@ -793281,7 +793509,7 @@ function usageWalk(root, current) {
|
|
|
793281
793509
|
throw new Error("Symbolic links are not allowed in Telegram artifact runs");
|
|
793282
793510
|
}
|
|
793283
793511
|
if (info.isDirectory()) {
|
|
793284
|
-
const canonical3 =
|
|
793512
|
+
const canonical3 = realpathSync3(path16);
|
|
793285
793513
|
if (!isInside(root, canonical3)) {
|
|
793286
793514
|
throw new Error("Artifact run directory resolves outside its root");
|
|
793287
793515
|
}
|
|
@@ -793302,7 +793530,7 @@ function telegramArtifactRunUsage(root) {
|
|
|
793302
793530
|
const resolved = resolve91(root);
|
|
793303
793531
|
const receipt2 = readReceipt(resolved);
|
|
793304
793532
|
if (!receipt2) throw new Error("Telegram artifact run receipt is missing or invalid");
|
|
793305
|
-
return usageWalk(
|
|
793533
|
+
return usageWalk(realpathSync3(resolved), resolved);
|
|
793306
793534
|
}
|
|
793307
793535
|
function assertTelegramArtifactRunQuota(root, additionalBytes = 0, additionalArtifacts = 0) {
|
|
793308
793536
|
if (!Number.isSafeInteger(additionalBytes) || additionalBytes < 0) {
|
|
@@ -793351,7 +793579,7 @@ import {
|
|
|
793351
793579
|
existsSync as existsSync184,
|
|
793352
793580
|
lstatSync as lstatSync6,
|
|
793353
793581
|
mkdirSync as mkdirSync120,
|
|
793354
|
-
realpathSync as
|
|
793582
|
+
realpathSync as realpathSync4,
|
|
793355
793583
|
renameSync as renameSync40,
|
|
793356
793584
|
readFileSync as readFileSync155,
|
|
793357
793585
|
rmSync as rmSync23,
|
|
@@ -793363,13 +793591,13 @@ import {
|
|
|
793363
793591
|
import { mkdir as mkdir28 } from "node:fs/promises";
|
|
793364
793592
|
import {
|
|
793365
793593
|
basename as basename49,
|
|
793366
|
-
dirname as
|
|
793594
|
+
dirname as dirname80,
|
|
793367
793595
|
extname as extname25,
|
|
793368
|
-
isAbsolute as
|
|
793596
|
+
isAbsolute as isAbsolute25,
|
|
793369
793597
|
join as join198,
|
|
793370
793598
|
relative as relative28,
|
|
793371
793599
|
resolve as resolve92,
|
|
793372
|
-
sep as
|
|
793600
|
+
sep as sep14
|
|
793373
793601
|
} from "node:path";
|
|
793374
793602
|
function telegramCreativeWorkspaceRoot(repoRoot, chatId) {
|
|
793375
793603
|
const raw = chatId === void 0 ? "unknown" : String(chatId);
|
|
@@ -793746,7 +793974,7 @@ function scopedTool(base3, root, mode, onCreatedArtifact) {
|
|
|
793746
793974
|
guarded.path.rel
|
|
793747
793975
|
);
|
|
793748
793976
|
if (!materialized.ok) return denied2(materialized.error);
|
|
793749
|
-
mkdirSync120(
|
|
793977
|
+
mkdirSync120(dirname80(guarded.path.abs), { recursive: true });
|
|
793750
793978
|
writeFileSync108(guarded.path.abs, readFileSync155(materialized.path));
|
|
793751
793979
|
materialized.cleanup?.();
|
|
793752
793980
|
restoredEditPath = guarded.path.abs;
|
|
@@ -794028,12 +794256,12 @@ function scopedArtifactTool(base3, root, kind, onCreatedArtifact) {
|
|
|
794028
794256
|
}
|
|
794029
794257
|
function ensureScopedOutputParent(root, outputPath3) {
|
|
794030
794258
|
const rootAbs = resolve92(root);
|
|
794031
|
-
const parent =
|
|
794259
|
+
const parent = dirname80(resolve92(outputPath3));
|
|
794032
794260
|
if (!isInside2(rootAbs, parent)) {
|
|
794033
794261
|
throw new Error("Output parent escapes the scoped creative workspace.");
|
|
794034
794262
|
}
|
|
794035
794263
|
let cursor = rootAbs;
|
|
794036
|
-
for (const segment of relative28(rootAbs, parent).split(
|
|
794264
|
+
for (const segment of relative28(rootAbs, parent).split(sep14).filter(Boolean)) {
|
|
794037
794265
|
cursor = join198(cursor, segment);
|
|
794038
794266
|
if (existsSync184(cursor)) {
|
|
794039
794267
|
const info = lstatSync6(cursor);
|
|
@@ -794128,7 +794356,7 @@ function guardPath(root, rawPath) {
|
|
|
794128
794356
|
};
|
|
794129
794357
|
}
|
|
794130
794358
|
const rel = relative28(rootAbs, abs) || ".";
|
|
794131
|
-
if (rel.startsWith("..") ||
|
|
794359
|
+
if (rel.startsWith("..") || isAbsolute25(rel)) {
|
|
794132
794360
|
return {
|
|
794133
794361
|
ok: false,
|
|
794134
794362
|
error: `Path escapes the public creative workspace. Use a relative path under ${rootAbs}.`
|
|
@@ -794146,7 +794374,7 @@ function guardPath(root, rawPath) {
|
|
|
794146
794374
|
function isInside2(root, path16) {
|
|
794147
794375
|
const rootAbs = resolve92(root);
|
|
794148
794376
|
const pathAbs = resolve92(path16);
|
|
794149
|
-
return pathAbs === rootAbs || pathAbs.startsWith(rootAbs.endsWith(
|
|
794377
|
+
return pathAbs === rootAbs || pathAbs.startsWith(rootAbs.endsWith(sep14) ? rootAbs : rootAbs + sep14);
|
|
794150
794378
|
}
|
|
794151
794379
|
function looksLikeLocalPath(value2) {
|
|
794152
794380
|
return value2.startsWith("/") || value2.startsWith("./") || value2.startsWith("../");
|
|
@@ -794447,7 +794675,7 @@ function safeScopedRegularFile(root, path16) {
|
|
|
794447
794675
|
error: "Scoped artifacts must be regular files, not links or directories."
|
|
794448
794676
|
};
|
|
794449
794677
|
}
|
|
794450
|
-
const canonical3 =
|
|
794678
|
+
const canonical3 = realpathSync4(path16);
|
|
794451
794679
|
if (!isInside2(lexicalRoot, canonical3)) {
|
|
794452
794680
|
return {
|
|
794453
794681
|
ok: false,
|
|
@@ -794886,7 +795114,7 @@ var init_telegram_creative_tools = __esm({
|
|
|
794886
795114
|
stage: "setup",
|
|
794887
795115
|
message: "Preparing scoped TTS audio file"
|
|
794888
795116
|
});
|
|
794889
|
-
await mkdir28(
|
|
795117
|
+
await mkdir28(dirname80(guarded.path.abs), { recursive: true });
|
|
794890
795118
|
const tts = new TtsGenerateTool();
|
|
794891
795119
|
this.emitProgress(start2, {
|
|
794892
795120
|
stage: "load",
|
|
@@ -801054,11 +801282,11 @@ import {
|
|
|
801054
801282
|
} from "node:fs";
|
|
801055
801283
|
import {
|
|
801056
801284
|
join as join203,
|
|
801057
|
-
dirname as
|
|
801285
|
+
dirname as dirname81,
|
|
801058
801286
|
resolve as resolve94,
|
|
801059
801287
|
basename as basename51,
|
|
801060
801288
|
relative as relative29,
|
|
801061
|
-
isAbsolute as
|
|
801289
|
+
isAbsolute as isAbsolute26,
|
|
801062
801290
|
extname as extname27
|
|
801063
801291
|
} from "node:path";
|
|
801064
801292
|
import { homedir as homedir62 } from "node:os";
|
|
@@ -803558,7 +803786,7 @@ function telegramCachedMediaIsVideo(entry) {
|
|
|
803558
803786
|
}
|
|
803559
803787
|
function isPathInside3(root, path16) {
|
|
803560
803788
|
const rel = relative29(resolve94(root), resolve94(path16));
|
|
803561
|
-
return rel === "" || Boolean(rel) && !rel.startsWith("..") && !
|
|
803789
|
+
return rel === "" || Boolean(rel) && !rel.startsWith("..") && !isAbsolute26(rel);
|
|
803562
803790
|
}
|
|
803563
803791
|
function extractTelegramMentionedActors(message2, text3) {
|
|
803564
803792
|
const actors = /* @__PURE__ */ new Map();
|
|
@@ -804792,7 +805020,7 @@ Telegram link integrity contract:
|
|
|
804792
805020
|
TELEGRAM_PRIVATE_COALESCE_MS = 350;
|
|
804793
805021
|
TELEGRAM_SESSION_MAX_HOLD_MS = 5e3;
|
|
804794
805022
|
TELEGRAM_PEER_BOT_COALESCE_MS = 3500;
|
|
804795
|
-
TELEGRAM_PEER_BOT_MAX_HOLD_MS =
|
|
805023
|
+
TELEGRAM_PEER_BOT_MAX_HOLD_MS = 6e4;
|
|
804796
805024
|
TELEGRAM_ADMIN_LIVE_PANEL_PAGES = [
|
|
804797
805025
|
"response",
|
|
804798
805026
|
"tasks",
|
|
@@ -807328,7 +807556,7 @@ ${context2}` : context2;
|
|
|
807328
807556
|
appendTelegramIntakeJournal(sessionKey, entry) {
|
|
807329
807557
|
const write2 = async () => {
|
|
807330
807558
|
const path16 = this.telegramIntakePath(sessionKey);
|
|
807331
|
-
await mkdirAsync(
|
|
807559
|
+
await mkdirAsync(dirname81(path16), { recursive: true });
|
|
807332
807560
|
await appendFileAsync(path16, `${JSON.stringify(entry)}
|
|
807333
807561
|
`, "utf8");
|
|
807334
807562
|
};
|
|
@@ -811266,7 +811494,7 @@ ${JSON.stringify(modelFollowupProposals, null, 2)}`,
|
|
|
811266
811494
|
if (existing) {
|
|
811267
811495
|
if (existing.mode === "ambient" || mode !== "ambient")
|
|
811268
811496
|
existing.mode = mode;
|
|
811269
|
-
if (useOverride || !existing.text || existing.text === "[non-text Telegram message]" || _TelegramBridge.isSyntheticMemoryText(existing.text)) {
|
|
811497
|
+
if (msg.sourceUpdateType === "edited_message" || useOverride || !existing.text || existing.text === "[non-text Telegram message]" || _TelegramBridge.isSyntheticMemoryText(existing.text)) {
|
|
811270
811498
|
existing.text = text3;
|
|
811271
811499
|
}
|
|
811272
811500
|
existing.speaker = existing.speaker || telegramSpeakerLabel(msg);
|
|
@@ -811541,7 +811769,7 @@ ${JSON.stringify(modelFollowupProposals, null, 2)}`,
|
|
|
811541
811769
|
return false;
|
|
811542
811770
|
});
|
|
811543
811771
|
if (matchingEntry) return { ok: true, path: matchingEntry.localPath };
|
|
811544
|
-
const creativeCandidate =
|
|
811772
|
+
const creativeCandidate = isAbsolute26(raw) ? resolve94(raw) : resolve94(creativeRoot, raw);
|
|
811545
811773
|
if (isPathInside3(creativeRoot, creativeCandidate)) {
|
|
811546
811774
|
const materialized = materializeTelegramCreativeArtifactForSend(
|
|
811547
811775
|
creativeRoot,
|
|
@@ -811680,7 +811908,7 @@ ${JSON.stringify(modelFollowupProposals, null, 2)}`,
|
|
|
811680
811908
|
const repoRoot = this.repoRoot || ".";
|
|
811681
811909
|
const creativeRoot = telegramCreativeWorkspaceRoot(repoRoot, chatId);
|
|
811682
811910
|
const raw = String(rawValue || fallbackName).trim() || fallbackName;
|
|
811683
|
-
const outputPath3 =
|
|
811911
|
+
const outputPath3 = isAbsolute26(raw) ? resolve94(raw) : resolve94(creativeRoot, raw);
|
|
811684
811912
|
if (!isPathInside3(creativeRoot, outputPath3)) {
|
|
811685
811913
|
return {
|
|
811686
811914
|
ok: false,
|
|
@@ -816062,7 +816290,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
816062
816290
|
}
|
|
816063
816291
|
try {
|
|
816064
816292
|
this.telegramUpdateSpool = new TelegramUpdateSpool(
|
|
816065
|
-
join203(
|
|
816293
|
+
join203(dirname81(healthPath), `bot-${botUserId}.updates.sqlite`)
|
|
816066
816294
|
);
|
|
816067
816295
|
const snapshot = this.telegramUpdateSpool.snapshot();
|
|
816068
816296
|
if (this.telegramDurableIntakeConfig.authoritative) {
|
|
@@ -817803,6 +818031,18 @@ ${signals || summary || "Canonical runner status reported completed."}`
|
|
|
817803
818031
|
await this.handleTelegramInterruptionSlash(msg, slashInvocation);
|
|
817804
818032
|
return;
|
|
817805
818033
|
}
|
|
818034
|
+
if (msg.sourceUpdateType === "edited_message") {
|
|
818035
|
+
const inputId2 = this.telegramInputIdForMessage(msg);
|
|
818036
|
+
const existingIntake = this.telegramIntakeRecords.get(inputId2);
|
|
818037
|
+
if (existingIntake) {
|
|
818038
|
+
this.recordTelegramUserMessage(msg, "ambient", void 0, {
|
|
818039
|
+
cognition: false
|
|
818040
|
+
});
|
|
818041
|
+
await this.consolidateTelegramEditedIntake(msg, existingIntake);
|
|
818042
|
+
releaseIngress();
|
|
818043
|
+
return;
|
|
818044
|
+
}
|
|
818045
|
+
}
|
|
817806
818046
|
const outputPatternMatch = this.consumeTelegramDurableOutputPattern(msg);
|
|
817807
818047
|
if (outputPatternMatch.ignored && outputPatternMatch.pattern) {
|
|
817808
818048
|
this.recordTelegramUserMessage(msg, "ambient", void 0, {
|
|
@@ -825424,7 +825664,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
825424
825664
|
const base3 = scopedRoot ? resolve94(scopedRoot) : resolve94(repoRoot);
|
|
825425
825665
|
const trimmed = rawPath.trim().replace(/^["']|["']$/g, "");
|
|
825426
825666
|
if (scopedRoot) {
|
|
825427
|
-
const logicalPath2 =
|
|
825667
|
+
const logicalPath2 = isAbsolute26(trimmed) ? resolve94(trimmed) : resolve94(base3, trimmed);
|
|
825428
825668
|
if (!isPathInside3(base3, logicalPath2)) {
|
|
825429
825669
|
return {
|
|
825430
825670
|
ok: false,
|
|
@@ -825438,7 +825678,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
825438
825678
|
if (!materialized.ok) return materialized;
|
|
825439
825679
|
return { ...materialized, logicalPath: logicalPath2 };
|
|
825440
825680
|
}
|
|
825441
|
-
const abs =
|
|
825681
|
+
const abs = isAbsolute26(trimmed) ? resolve94(trimmed) : resolve94(base3, trimmed);
|
|
825442
825682
|
if (!existsSync189(abs))
|
|
825443
825683
|
return { ok: false, error: `File does not exist: ${trimmed}` };
|
|
825444
825684
|
if (!statSync72(abs).isFile())
|
|
@@ -830452,7 +830692,7 @@ var init_clipboard_media = __esm({
|
|
|
830452
830692
|
|
|
830453
830693
|
// packages/cli/src/tui/interactive.ts
|
|
830454
830694
|
import { cwd } from "node:process";
|
|
830455
|
-
import { resolve as resolve96, join as join206, dirname as
|
|
830695
|
+
import { resolve as resolve96, join as join206, dirname as dirname82, extname as extname28, relative as relative30, sep as sep15 } from "node:path";
|
|
830456
830696
|
import { createRequire as createRequire9 } from "node:module";
|
|
830457
830697
|
import { fileURLToPath as fileURLToPath33 } from "node:url";
|
|
830458
830698
|
import { createHash as createHash92 } from "node:crypto";
|
|
@@ -830513,7 +830753,7 @@ function formatTimeAgo2(date) {
|
|
|
830513
830753
|
function getVersion3() {
|
|
830514
830754
|
try {
|
|
830515
830755
|
const require5 = createRequire9(import.meta.url);
|
|
830516
|
-
const thisDir =
|
|
830756
|
+
const thisDir = dirname82(fileURLToPath33(import.meta.url));
|
|
830517
830757
|
const candidates = [
|
|
830518
830758
|
join206(thisDir, "..", "package.json"),
|
|
830519
830759
|
join206(thisDir, "..", "..", "package.json"),
|
|
@@ -836954,9 +837194,9 @@ This is an independent background session started from /background.`
|
|
|
836954
837194
|
const kind = partial.slice(0, colonIndex);
|
|
836955
837195
|
const value2 = partial.slice(colonIndex + 1);
|
|
836956
837196
|
if ((kind === "file" || kind === "folder") && value2) {
|
|
836957
|
-
const
|
|
836958
|
-
const searchDir =
|
|
836959
|
-
const partialName =
|
|
837197
|
+
const isAbsolute27 = value2.startsWith("/");
|
|
837198
|
+
const searchDir = isAbsolute27 ? value2.lastIndexOf("/") > 0 ? value2.slice(0, value2.lastIndexOf("/") + 1) : "/" : repoRoot;
|
|
837199
|
+
const partialName = isAbsolute27 ? value2.slice(value2.lastIndexOf("/") + 1) : value2.includes("/") ? value2.slice(value2.lastIndexOf("/") + 1) : value2;
|
|
836960
837200
|
let entries2;
|
|
836961
837201
|
try {
|
|
836962
837202
|
entries2 = readdirSync66(searchDir);
|
|
@@ -836970,7 +837210,7 @@ This is an independent background session started from /background.`
|
|
|
836970
837210
|
try {
|
|
836971
837211
|
const st = statSync74(full);
|
|
836972
837212
|
const suffix = st.isDirectory() ? "/" : "";
|
|
836973
|
-
const display =
|
|
837213
|
+
const display = isAbsolute27 ? full : full.startsWith(repoRoot + sep15) ? full.slice(repoRoot.length + 1) : full;
|
|
836974
837214
|
completions.push(display + suffix);
|
|
836975
837215
|
} catch {
|
|
836976
837216
|
}
|
|
@@ -843497,7 +843737,7 @@ var init_project_preferences = __esm({
|
|
|
843497
843737
|
import { spawn as spawn46 } from "node:child_process";
|
|
843498
843738
|
import { existsSync as existsSync195, mkdirSync as mkdirSync130, readFileSync as readFileSync166, statSync as statSync76, writeFileSync as writeFileSync117 } from "node:fs";
|
|
843499
843739
|
import { homedir as homedir67 } from "node:os";
|
|
843500
|
-
import { dirname as
|
|
843740
|
+
import { dirname as dirname83, join as join210 } from "node:path";
|
|
843501
843741
|
import { fileURLToPath as fileURLToPath34 } from "node:url";
|
|
843502
843742
|
import { createHash as createHash94 } from "node:crypto";
|
|
843503
843743
|
function home() {
|
|
@@ -843891,7 +844131,7 @@ var MODULE_DIR2, RUNTIME_VERSION5, MODEL, PRETRAINED, MODEL_REPOSITORY, MODEL_RE
|
|
|
843891
844131
|
var init_vision_embedding_runtime = __esm({
|
|
843892
844132
|
"packages/cli/src/api/vision-embedding-runtime.ts"() {
|
|
843893
844133
|
init_dist5();
|
|
843894
|
-
MODULE_DIR2 =
|
|
844134
|
+
MODULE_DIR2 = dirname83(fileURLToPath34(import.meta.url));
|
|
843895
844135
|
RUNTIME_VERSION5 = 4;
|
|
843896
844136
|
MODEL = "ViT-B-32";
|
|
843897
844137
|
PRETRAINED = "laion2b_s34b_b79k";
|
|
@@ -844489,7 +844729,7 @@ var init_audit_log = __esm({
|
|
|
844489
844729
|
// packages/cli/src/api/disk-task-output.ts
|
|
844490
844730
|
import { open as open6 } from "node:fs/promises";
|
|
844491
844731
|
import { existsSync as existsSync198, mkdirSync as mkdirSync133, statSync as statSync77 } from "node:fs";
|
|
844492
|
-
import { dirname as
|
|
844732
|
+
import { dirname as dirname84 } from "node:path";
|
|
844493
844733
|
import * as fsConstants2 from "node:constants";
|
|
844494
844734
|
var O_NOFOLLOW2, O_APPEND2, O_CREAT2, O_WRONLY2, OPEN_FLAGS_WRITE, OPEN_MODE, DiskTaskOutput;
|
|
844495
844735
|
var init_disk_task_output = __esm({
|
|
@@ -844507,7 +844747,7 @@ var init_disk_task_output = __esm({
|
|
|
844507
844747
|
fileSize = 0;
|
|
844508
844748
|
constructor(outputPath3) {
|
|
844509
844749
|
this.path = outputPath3;
|
|
844510
|
-
mkdirSync133(
|
|
844750
|
+
mkdirSync133(dirname84(outputPath3), { recursive: true });
|
|
844511
844751
|
}
|
|
844512
844752
|
/** Queue content for async append. Non-blocking. */
|
|
844513
844753
|
append(chunk) {
|
|
@@ -868336,7 +868576,7 @@ var init_chat_followup = __esm({
|
|
|
868336
868576
|
// packages/cli/src/docker.ts
|
|
868337
868577
|
import { execSync as execSync37, spawn as spawn49 } from "node:child_process";
|
|
868338
868578
|
import { existsSync as existsSync206, mkdirSync as mkdirSync139, writeFileSync as writeFileSync122 } from "node:fs";
|
|
868339
|
-
import { join as join220, resolve as resolve101, dirname as
|
|
868579
|
+
import { join as join220, resolve as resolve101, dirname as dirname85 } from "node:path";
|
|
868340
868580
|
import { homedir as homedir72 } from "node:os";
|
|
868341
868581
|
import { fileURLToPath as fileURLToPath35 } from "node:url";
|
|
868342
868582
|
function getDockerDir() {
|
|
@@ -868347,7 +868587,7 @@ function getDockerDir() {
|
|
|
868347
868587
|
} catch {
|
|
868348
868588
|
}
|
|
868349
868589
|
try {
|
|
868350
|
-
const thisDir =
|
|
868590
|
+
const thisDir = dirname85(fileURLToPath35(import.meta.url));
|
|
868351
868591
|
return join220(thisDir, "..", "..", "..", "docker");
|
|
868352
868592
|
} catch {
|
|
868353
868593
|
}
|
|
@@ -868891,7 +869131,7 @@ import * as http5 from "node:http";
|
|
|
868891
869131
|
import * as https3 from "node:https";
|
|
868892
869132
|
import { createRequire as createRequire10 } from "node:module";
|
|
868893
869133
|
import { fileURLToPath as fileURLToPath36 } from "node:url";
|
|
868894
|
-
import { dirname as
|
|
869134
|
+
import { dirname as dirname86, join as join222, resolve as resolve102 } from "node:path";
|
|
868895
869135
|
import { homedir as homedir73 } from "node:os";
|
|
868896
869136
|
import { spawn as spawn50, execSync as execSync38 } from "node:child_process";
|
|
868897
869137
|
import {
|
|
@@ -868920,7 +869160,7 @@ function memoryDbPaths3(baseDir = process.cwd()) {
|
|
|
868920
869160
|
}
|
|
868921
869161
|
function readServerPackageIdentity() {
|
|
868922
869162
|
try {
|
|
868923
|
-
const thisDir =
|
|
869163
|
+
const thisDir = dirname86(fileURLToPath36(import.meta.url));
|
|
868924
869164
|
const candidates = [
|
|
868925
869165
|
join222(thisDir, "..", "package.json"),
|
|
868926
869166
|
join222(thisDir, "..", "..", "package.json"),
|
|
@@ -873373,7 +873613,7 @@ async function handleV1Update(req3, res, requestId) {
|
|
|
873373
873613
|
);
|
|
873374
873614
|
const fs14 = require4("node:fs");
|
|
873375
873615
|
const nodeBin = process.execPath;
|
|
873376
|
-
const nodeDir =
|
|
873616
|
+
const nodeDir = dirname86(nodeBin);
|
|
873377
873617
|
const { execSync: es } = require4("node:child_process");
|
|
873378
873618
|
const isWin2 = process.platform === "win32";
|
|
873379
873619
|
let npmBin = "";
|
|
@@ -873388,7 +873628,7 @@ async function handleV1Update(req3, res, requestId) {
|
|
|
873388
873628
|
const dir = join222(homedir73(), ".omnius");
|
|
873389
873629
|
fs14.mkdirSync(dir, { recursive: true });
|
|
873390
873630
|
const logFd = fs14.openSync(logPath3, "w");
|
|
873391
|
-
const npmPrefix =
|
|
873631
|
+
const npmPrefix = dirname86(nodeDir);
|
|
873392
873632
|
let globalBinDir = "";
|
|
873393
873633
|
try {
|
|
873394
873634
|
if (isWin2) {
|
|
@@ -881848,7 +882088,7 @@ init_typed_node_events();
|
|
|
881848
882088
|
init_dist5();
|
|
881849
882089
|
import { parseArgs as nodeParseArgs2 } from "node:util";
|
|
881850
882090
|
import { fileURLToPath as fileURLToPath37 } from "node:url";
|
|
881851
|
-
import { dirname as
|
|
882091
|
+
import { dirname as dirname87, join as join224 } from "node:path";
|
|
881852
882092
|
import { createRequire as createRequire11 } from "node:module";
|
|
881853
882093
|
|
|
881854
882094
|
// packages/cli/src/cli.ts
|
|
@@ -882017,7 +882257,7 @@ init_output();
|
|
|
882017
882257
|
function getVersion5() {
|
|
882018
882258
|
try {
|
|
882019
882259
|
const require5 = createRequire11(import.meta.url);
|
|
882020
|
-
const pkgPath = join224(
|
|
882260
|
+
const pkgPath = join224(dirname87(fileURLToPath37(import.meta.url)), "..", "package.json");
|
|
882021
882261
|
const pkg = require5(pkgPath);
|
|
882022
882262
|
return pkg.version;
|
|
882023
882263
|
} catch {
|