omnius 1.0.692 → 1.0.694
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 +565 -302
- package/docs/DISCOVERY.json +81 -1
- package/docs/DISCOVERY.md +3 -1
- package/docs/work-orders/runtime-health-remediation/TRACKER.md +35 -1
- package/docs/work-orders/runtime-health-remediation/WO-23-long-horizon-control-plane-reconciliation.md +154 -0
- package/docs/work-orders/runtime-health-remediation/WO-24-telegram-logical-request-variant-identity.md +65 -0
- package/npm-shrinkwrap.json +54 -21
- 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);
|
|
@@ -662595,6 +662702,15 @@ function classifyThinkOutcome(raw) {
|
|
|
662595
662702
|
}
|
|
662596
662703
|
return null;
|
|
662597
662704
|
}
|
|
662705
|
+
function logicalRequestVariantId(logicalRequestId, variant) {
|
|
662706
|
+
return `ollama:${variant}:${_createHash("sha256").update(`${logicalRequestId}\0${variant}`).digest("hex").slice(0, 24)}`;
|
|
662707
|
+
}
|
|
662708
|
+
function withLogicalRequestVariant(request, variant) {
|
|
662709
|
+
return request.logicalRequestId ? {
|
|
662710
|
+
...request,
|
|
662711
|
+
logicalRequestId: logicalRequestVariantId(request.logicalRequestId, variant)
|
|
662712
|
+
} : request;
|
|
662713
|
+
}
|
|
662598
662714
|
var PRESERVE_MODEL_VISIBLE_HISTORY, TOOL_SUBSETS, TOOL_AUTO_DEMOTE_TURNS, LEGACY_ACTION_REASON_KEYS, CLAIM_TASK_STOPWORDS, TASK_COMPLETE_CLOSEOUT_DESCRIPTION, SYSTEM_PROMPT_COMMON, SYSTEM_PROMPT, SYSTEM_PROMPT_MEDIUM, SYSTEM_PROMPT_SMALL, VISUAL_TOOLS, AUDIO_TOOLS, SOCIAL_TOOLS, SPATIAL_TOOLS, CODE_TOOLS, AgenticRunner, BROKER_QUEUE_DEADLINE_ERROR, InferenceHttpError, OllamaAgenticBackend;
|
|
662599
662715
|
var init_agenticRunner = __esm({
|
|
662600
662716
|
"packages/orchestrator/dist/agenticRunner.js"() {
|
|
@@ -663724,7 +663840,7 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663724
663840
|
}
|
|
663725
663841
|
_recordFailureRecoveryOnWorkboard(toolName, args, result, diagnosis, count) {
|
|
663726
663842
|
if (!diagnosis.createRecoveryCard && count < 2)
|
|
663727
|
-
return;
|
|
663843
|
+
return null;
|
|
663728
663844
|
const dir = this._workboardDir();
|
|
663729
663845
|
const runId = this.currentArtifactRunId();
|
|
663730
663846
|
const actor = this.options.subAgent ? "sub-agent" : "agent";
|
|
@@ -663768,6 +663884,10 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663768
663884
|
});
|
|
663769
663885
|
}
|
|
663770
663886
|
}
|
|
663887
|
+
const persistedBoard = readActiveWorkboardSnapshot(dir, runId);
|
|
663888
|
+
if (!persistedBoard?.cards.some((card) => card.id === cardInput.id)) {
|
|
663889
|
+
return null;
|
|
663890
|
+
}
|
|
663771
663891
|
const command = typeof args["command"] === "string" ? args["command"].slice(0, 200) : void 0;
|
|
663772
663892
|
const ref = typeof args["path"] === "string" ? args["path"].slice(0, 200) : void 0;
|
|
663773
663893
|
const raw = (result.error || result.output || result.llmContent || "").toString().slice(0, 1200);
|
|
@@ -663792,7 +663912,9 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663792
663912
|
}
|
|
663793
663913
|
});
|
|
663794
663914
|
this._workboard = readActiveWorkboardSnapshot(dir, runId) ?? board;
|
|
663915
|
+
return cardInput.id ?? null;
|
|
663795
663916
|
} catch {
|
|
663917
|
+
return null;
|
|
663796
663918
|
}
|
|
663797
663919
|
}
|
|
663798
663920
|
_todoWorkboardCardId(todoId) {
|
|
@@ -663892,7 +664014,7 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663892
664014
|
schema: WORKBOARD_EVIDENCE_PREDICATE_SCHEMA,
|
|
663893
664015
|
id: `todo:${todo.id}:artifact:${index}`,
|
|
663894
664016
|
label: `observed task artifact: ${artifact}`,
|
|
663895
|
-
|
|
664017
|
+
path: artifact
|
|
663896
664018
|
});
|
|
663897
664019
|
}
|
|
663898
664020
|
}
|
|
@@ -663930,7 +664052,7 @@ ${loadPrompt("agentic/system-small.md")}`;
|
|
|
663930
664052
|
_mirrorTodosToWorkboard(todos) {
|
|
663931
664053
|
const normalized4 = this._normalizeTodosForPrompt(todos);
|
|
663932
664054
|
const index = this._todoTreeIndex(normalized4);
|
|
663933
|
-
const activeLeaves = this._todoLeaves(normalized4, index).filter((todo) => todo.status !== "completed")
|
|
664055
|
+
const activeLeaves = this._todoLeaves(normalized4, index).filter((todo) => todo.status !== "completed");
|
|
663934
664056
|
const cards = [];
|
|
663935
664057
|
for (const todo of activeLeaves) {
|
|
663936
664058
|
const incoming = this._todoWorkboardCardInput(todo, this._todoPath(todo, index));
|
|
@@ -664479,65 +664601,35 @@ ${parts.join("\n")}
|
|
|
664479
664601
|
].filter((path16) => path16 && path16 !== ".");
|
|
664480
664602
|
if (targets.length === 0)
|
|
664481
664603
|
return null;
|
|
664482
|
-
const
|
|
664483
|
-
|
|
664484
|
-
const
|
|
664485
|
-
|
|
664486
|
-
|
|
664487
|
-
|
|
664488
|
-
|
|
664604
|
+
const activeCards = snapshot.cards.filter((card) => card.id.startsWith("todo-") && !card.supersededBy && card.status !== "completed" && card.status !== "verified");
|
|
664605
|
+
const exact = activeCards.filter((card) => {
|
|
664606
|
+
const owned = new Set((card.ownedFiles ?? []).map((path16) => this._normalizeEvidencePath(path16)).filter(Boolean));
|
|
664607
|
+
return targets.some((path16) => owned.has(path16));
|
|
664608
|
+
});
|
|
664609
|
+
if (exact.length === 1)
|
|
664610
|
+
return exact[0];
|
|
664611
|
+
if (exact.length > 1)
|
|
664489
664612
|
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;
|
|
664613
|
+
const unscopedActive = activeCards.filter((card) => card.status === "in_progress" && (card.ownedFiles?.length ?? 0) === 0);
|
|
664614
|
+
return unscopedActive.length === 1 ? unscopedActive[0] : null;
|
|
664528
664615
|
}
|
|
664529
664616
|
_workboardTodoCardForVerifier(snapshot, args, receipt2) {
|
|
664530
664617
|
const command = String(args["command"] ?? args["cmd"] ?? "").trim();
|
|
664531
664618
|
if (!command)
|
|
664532
664619
|
return null;
|
|
664533
|
-
|
|
664620
|
+
const candidates = snapshot.cards.filter((card) => {
|
|
664534
664621
|
if (!card.id.startsWith("todo-") || card.supersededBy)
|
|
664535
664622
|
return false;
|
|
664536
664623
|
if (card.status === "completed" || card.status === "verified")
|
|
664537
664624
|
return false;
|
|
664538
664625
|
const verifier = card.verifierCommand || card.evidenceRequirements.find((item) => item.startsWith("verifyCommand:"))?.replace(/^verifyCommand:\s*/, "") || "";
|
|
664539
664626
|
return verifier.length > 0 && commandReliablySatisfiesVerifyCommand(command, verifier, receipt2);
|
|
664540
|
-
})
|
|
664627
|
+
});
|
|
664628
|
+
if (candidates.length <= 1)
|
|
664629
|
+
return candidates[0] ?? null;
|
|
664630
|
+
const observed = new Set((receipt2?.observedPaths ?? []).map((path16) => this._normalizeEvidencePath(path16)).filter(Boolean));
|
|
664631
|
+
const targetBound = candidates.filter((card) => (card.ownedFiles ?? []).map((path16) => this._normalizeEvidencePath(path16)).filter(Boolean).some((path16) => observed.has(path16)));
|
|
664632
|
+
return targetBound.length === 1 ? targetBound[0] : null;
|
|
664541
664633
|
}
|
|
664542
664634
|
_workboardTargetCardId(snapshot, toolName, args, result, meta = {}) {
|
|
664543
664635
|
const byId = new Map(snapshot.cards.map((card) => [card.id, card]));
|
|
@@ -665700,7 +665792,10 @@ ${read3.content}`;
|
|
|
665700
665792
|
request[PRESERVE_MODEL_VISIBLE_HISTORY] = !this._legacyModelVisibleCompactionAllowed();
|
|
665701
665793
|
const preBudget = this._outboundRequestBudget(request);
|
|
665702
665794
|
this._lastMemoryCompilationPlanAudit = null;
|
|
665703
|
-
|
|
665795
|
+
const rawDiscoveryChars = request.messages.reduce((total, message2) => message2.role === "tool" && typeof message2.content === "string" ? total + message2.content.length : total, 0);
|
|
665796
|
+
const rawDiscoveryLimit = Math.max(16e3, Number.parseInt(process.env["OMNIUS_RAW_DISCOVERY_COMPACTION_CHARS"] || "48000", 10) || 48e3);
|
|
665797
|
+
const rawDiscoveryPressure = rawDiscoveryChars > rawDiscoveryLimit;
|
|
665798
|
+
if (this._memoryCompilationMode() !== "active" || !preBudget.compactionEligible && !rawDiscoveryPressure)
|
|
665704
665799
|
return;
|
|
665705
665800
|
const messages2 = request.messages;
|
|
665706
665801
|
const projections = this._requestCompilationCandidates({
|
|
@@ -666998,7 +667093,63 @@ ${read3.content}`;
|
|
|
666998
667093
|
break;
|
|
666999
667094
|
this._canonicalAcceptedReceipts.delete(oldest);
|
|
667000
667095
|
}
|
|
667096
|
+
this._persistCanonicalAcceptedReceipts();
|
|
667097
|
+
} catch {
|
|
667098
|
+
}
|
|
667099
|
+
}
|
|
667100
|
+
_canonicalAcceptedReceiptIndexPath() {
|
|
667101
|
+
return _pathJoin(this.omniusStateDir(), "canonical-receipts", `${this.currentArtifactRunId()}.json`);
|
|
667102
|
+
}
|
|
667103
|
+
_persistCanonicalAcceptedReceipts() {
|
|
667104
|
+
if (!this.writesUserTaskArtifacts())
|
|
667105
|
+
return;
|
|
667106
|
+
try {
|
|
667107
|
+
const path16 = this._canonicalAcceptedReceiptIndexPath();
|
|
667108
|
+
_fsMkdirSync(_pathJoin(this.omniusStateDir(), "canonical-receipts"), {
|
|
667109
|
+
recursive: true
|
|
667110
|
+
});
|
|
667111
|
+
_fsWriteFileSync(path16, `${JSON.stringify({
|
|
667112
|
+
schema: "omnius.canonical-tool-receipts.v1",
|
|
667113
|
+
runId: this.currentArtifactRunId(),
|
|
667114
|
+
taskEpoch: this._taskEpoch,
|
|
667115
|
+
receipts: [...this._canonicalAcceptedReceipts.entries()].map(([transactionId2, receipt2]) => ({ transactionId: transactionId2, ...receipt2 }))
|
|
667116
|
+
}, null, 2)}
|
|
667117
|
+
`, "utf8");
|
|
667118
|
+
} catch {
|
|
667119
|
+
}
|
|
667120
|
+
}
|
|
667121
|
+
_hydrateCanonicalAcceptedReceipts() {
|
|
667122
|
+
if (!this._resumeInterrupted || !this.writesUserTaskArtifacts())
|
|
667123
|
+
return;
|
|
667124
|
+
try {
|
|
667125
|
+
const parsed = JSON.parse(_fsReadFileSync(this._canonicalAcceptedReceiptIndexPath(), "utf8"));
|
|
667126
|
+
if (parsed["schema"] !== "omnius.canonical-tool-receipts.v1" || parsed["runId"] !== this.currentArtifactRunId() || parsed["taskEpoch"] !== this._taskEpoch || !Array.isArray(parsed["receipts"])) {
|
|
667127
|
+
return;
|
|
667128
|
+
}
|
|
667129
|
+
for (const raw of parsed["receipts"].slice(-128)) {
|
|
667130
|
+
if (!raw || typeof raw !== "object")
|
|
667131
|
+
continue;
|
|
667132
|
+
const record = raw;
|
|
667133
|
+
const transactionId2 = String(record["transactionId"] ?? "").trim();
|
|
667134
|
+
const toolName = String(record["toolName"] ?? "").trim();
|
|
667135
|
+
const artifactLocator = String(record["artifactLocator"] ?? "").trim();
|
|
667136
|
+
const evidenceId = String(record["evidenceId"] ?? "").trim();
|
|
667137
|
+
const summary = String(record["summary"] ?? "").trim();
|
|
667138
|
+
const turn = Number(record["turn"]);
|
|
667139
|
+
if (!transactionId2 || !toolName || !artifactLocator || !evidenceId || !summary || !Number.isFinite(turn)) {
|
|
667140
|
+
continue;
|
|
667141
|
+
}
|
|
667142
|
+
this._artifactStore().getManifest(artifactLocator);
|
|
667143
|
+
this._canonicalAcceptedReceipts.set(transactionId2, {
|
|
667144
|
+
toolName,
|
|
667145
|
+
artifactLocator,
|
|
667146
|
+
evidenceId,
|
|
667147
|
+
summary,
|
|
667148
|
+
turn: Math.max(0, Math.floor(turn))
|
|
667149
|
+
});
|
|
667150
|
+
}
|
|
667001
667151
|
} catch {
|
|
667152
|
+
this._canonicalAcceptedReceipts.clear();
|
|
667002
667153
|
}
|
|
667003
667154
|
}
|
|
667004
667155
|
_artifactStore() {
|
|
@@ -667307,10 +667458,21 @@ ${read3.content}`;
|
|
|
667307
667458
|
_refreshIntegrationClosure() {
|
|
667308
667459
|
const goal = this._taskState.originalGoal || this._taskState.goal || this._completionLedger?.goal || "unspecified";
|
|
667309
667460
|
const modifiedPaths = [...this._taskState.modifiedFiles.keys()].map((path16) => this._normalizeEvidencePath(path16)).filter((path16) => path16 && !path16.startsWith(".omnius/"));
|
|
667461
|
+
const todos = this._normalizeTodosForPrompt(this.readSessionTodos() ?? []);
|
|
667462
|
+
const todoIndex = this._todoTreeIndex(todos);
|
|
667463
|
+
const unresolvedTodos = this._todoLeaves(todos, todoIndex).filter((todo) => todo.status !== "completed").map((todo) => ({
|
|
667464
|
+
id: todo.id,
|
|
667465
|
+
label: todo.content,
|
|
667466
|
+
status: todo.status
|
|
667467
|
+
}));
|
|
667468
|
+
const board = this._workboard ? this._refreshWorkboardSnapshot(this._workboard) : readActiveWorkboardSnapshot(this._workboardDir(), this.currentArtifactRunId());
|
|
667469
|
+
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
667470
|
const closure = buildIntegrationClosure({
|
|
667311
667471
|
goal,
|
|
667312
667472
|
ledger: this._completionLedger,
|
|
667313
667473
|
modifiedPaths,
|
|
667474
|
+
unresolvedTodos,
|
|
667475
|
+
activeFailures,
|
|
667314
667476
|
contractIds: this._referenceContractSelections.map((contract) => contract.id),
|
|
667315
667477
|
codeGraph: getCodeGraphDBIfReady(this.authoritativeWorkingDirectory())
|
|
667316
667478
|
});
|
|
@@ -668597,18 +668759,38 @@ Pick the SMALLEST concrete deliverable from the spec — typically the project e
|
|
|
668597
668759
|
this._gitProgress = null;
|
|
668598
668760
|
}
|
|
668599
668761
|
}
|
|
668762
|
+
async _observeGitProgressBeforeTool(input) {
|
|
668763
|
+
if (!this._gitProgress || this._gitProgress.enabled && this._gitProgress.available || input.targetPaths.length === 0 || process.env["OMNIUS_DISABLE_GIT_PROGRESS"] === "1") {
|
|
668764
|
+
return;
|
|
668765
|
+
}
|
|
668766
|
+
try {
|
|
668767
|
+
const discovered = await detectGitProgressBaselineFromPaths({
|
|
668768
|
+
cwd: this.authoritativeWorkingDirectory(),
|
|
668769
|
+
sessionId: this._sessionId,
|
|
668770
|
+
paths: input.targetPaths,
|
|
668771
|
+
baselineProvenance: "path_preflight"
|
|
668772
|
+
});
|
|
668773
|
+
if (!discovered?.enabled || !discovered.available)
|
|
668774
|
+
return;
|
|
668775
|
+
this._gitProgress = discovered;
|
|
668776
|
+
this._persistGitProgressState();
|
|
668777
|
+
this._emitGitProgressStatus(`nested repository baseline captured before ${input.toolName}`);
|
|
668778
|
+
} catch {
|
|
668779
|
+
}
|
|
668780
|
+
}
|
|
668600
668781
|
async _observeGitProgressAfterTool(input) {
|
|
668601
668782
|
if (!this._gitProgress || process.env["OMNIUS_DISABLE_GIT_PROGRESS"] === "1")
|
|
668602
668783
|
return;
|
|
668603
668784
|
try {
|
|
668604
668785
|
const contract = this._activeMutationContract();
|
|
668605
668786
|
const next = await refreshGitProgressState(this._gitProgress, {
|
|
668787
|
+
cwd: this.authoritativeWorkingDirectory(),
|
|
668606
668788
|
turn: input.turn,
|
|
668607
668789
|
actor: this.options.subAgent ? "sub_agent" : "main",
|
|
668608
668790
|
owner: contract?.ownerAgentId,
|
|
668609
668791
|
toolName: input.toolName,
|
|
668610
|
-
mutatedPaths: input.mutationPaths,
|
|
668611
|
-
ownedFiles: contract ? [...contract.ownedFiles, ...contract.ownedDirs] : void 0,
|
|
668792
|
+
mutatedPaths: input.mutationPaths.map((path16) => _pathResolve(this.authoritativeWorkingDirectory(), path16)),
|
|
668793
|
+
ownedFiles: contract ? [...contract.ownedFiles, ...contract.ownedDirs].map((path16) => _pathResolve(this.authoritativeWorkingDirectory(), path16)) : void 0,
|
|
668612
668794
|
verifierCommand: contract?.verifierCommand,
|
|
668613
668795
|
verifierFreshAfterChange: false
|
|
668614
668796
|
});
|
|
@@ -669575,15 +669757,19 @@ ${extras.join("\n")}`;
|
|
|
669575
669757
|
return null;
|
|
669576
669758
|
}
|
|
669577
669759
|
_extractToolTargetPaths(toolName, args, result) {
|
|
669578
|
-
const
|
|
669579
|
-
|
|
669580
|
-
|
|
669581
|
-
|
|
669582
|
-
|
|
669583
|
-
|
|
669760
|
+
const paths = [];
|
|
669761
|
+
const fromResult = Array.isArray(result?.mutatedFiles) ? result.mutatedFiles.filter((p2) => typeof p2 === "string" && p2.trim().length > 0) : [];
|
|
669762
|
+
paths.push(...fromResult);
|
|
669763
|
+
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));
|
|
669764
|
+
if (fromResult.length === 0) {
|
|
669765
|
+
if (toolName === "batch_edit" && Array.isArray(args?.["edits"])) {
|
|
669766
|
+
paths.push(...args["edits"].map((edit) => edit && typeof edit === "object" ? edit["path"] : null).filter((p3) => typeof p3 === "string" && p3.trim().length > 0));
|
|
669767
|
+
}
|
|
669768
|
+
const p2 = args?.["path"] ?? args?.["file_path"] ?? args?.["file"] ?? args?.["filename"] ?? args?.["filepath"] ?? args?.["filePath"] ?? args?.["input"] ?? args?.["target"];
|
|
669769
|
+
if (typeof p2 === "string" && p2.trim().length > 0)
|
|
669770
|
+
paths.push(p2.trim());
|
|
669584
669771
|
}
|
|
669585
|
-
|
|
669586
|
-
return typeof p2 === "string" && p2.trim().length > 0 ? [p2.trim()] : [];
|
|
669772
|
+
return [...new Set(paths.map((path16) => path16.trim()).filter(Boolean))].sort();
|
|
669587
669773
|
}
|
|
669588
669774
|
_isRealProjectMutation(toolName, result) {
|
|
669589
669775
|
if (!result || result.success === false)
|
|
@@ -671895,6 +672081,41 @@ ${contentPreview}
|
|
|
671895
672081
|
}
|
|
671896
672082
|
return targetPaths.length > 0 ? "project" : "external";
|
|
671897
672083
|
}
|
|
672084
|
+
_expireRecentFailureDurably(failure2, turn) {
|
|
672085
|
+
const expiredAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
672086
|
+
try {
|
|
672087
|
+
const dir = this._workboardDir();
|
|
672088
|
+
const runId = this.currentArtifactRunId();
|
|
672089
|
+
const board = readActiveWorkboardSnapshot(dir, runId);
|
|
672090
|
+
const card = failure2.workboardCardId ? board?.cards.find((candidate) => candidate.id === failure2.workboardCardId) : void 0;
|
|
672091
|
+
if (card && !card.supersededBy && card.status !== "completed" && card.status !== "verified") {
|
|
672092
|
+
this._workboard = updateWorkboardCard(dir, {
|
|
672093
|
+
runId,
|
|
672094
|
+
cardId: card.id,
|
|
672095
|
+
actor: "runner",
|
|
672096
|
+
updates: { supersededBy: `failure-expired:turn-${turn}` },
|
|
672097
|
+
decisionReason: "The bounded recent-failure window expired without fresh recurrence. Retire this recovery obligation without claiming verification."
|
|
672098
|
+
});
|
|
672099
|
+
}
|
|
672100
|
+
if (this._failureStore) {
|
|
672101
|
+
for (const stored of this._failureStore.listByFingerprint(failure2.patternKey)) {
|
|
672102
|
+
const context2 = stored.context ?? {};
|
|
672103
|
+
if (stored.resolved || stored.sessionId !== this._sessionId || context2["taskEpoch"] !== (failure2.taskEpoch ?? this._taskEpoch) || context2["targetKey"] !== (failure2.targetKey ?? "unscoped")) {
|
|
672104
|
+
continue;
|
|
672105
|
+
}
|
|
672106
|
+
this._failureStore.markResolved(stored.id, expiredAt);
|
|
672107
|
+
}
|
|
672108
|
+
}
|
|
672109
|
+
} catch (error) {
|
|
672110
|
+
this.emit({
|
|
672111
|
+
type: "status",
|
|
672112
|
+
visibility: "telemetry",
|
|
672113
|
+
content: `failure_lifecycle_expiry_reconciliation_failed: ${error instanceof Error ? error.message : String(error)}`.slice(0, 320),
|
|
672114
|
+
turn,
|
|
672115
|
+
timestamp: expiredAt
|
|
672116
|
+
});
|
|
672117
|
+
}
|
|
672118
|
+
}
|
|
671898
672119
|
_activeRecentFailures(turn) {
|
|
671899
672120
|
let expired = 0;
|
|
671900
672121
|
const active = this._recentFailures.filter((failure2) => {
|
|
@@ -671902,6 +672123,7 @@ ${contentPreview}
|
|
|
671902
672123
|
return false;
|
|
671903
672124
|
if (turn - failure2.turn > 10) {
|
|
671904
672125
|
failure2.status = "expired";
|
|
672126
|
+
this._expireRecentFailureDurably(failure2, turn);
|
|
671905
672127
|
expired++;
|
|
671906
672128
|
return false;
|
|
671907
672129
|
}
|
|
@@ -671949,7 +672171,7 @@ ${contentPreview}
|
|
|
671949
672171
|
try {
|
|
671950
672172
|
const targetPaths = [...new Set(failures.flatMap((failure2) => failure2.targetPaths).map((path16) => this._normalizeEvidencePath(path16)).filter(Boolean))].sort();
|
|
671951
672173
|
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")))];
|
|
672174
|
+
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
672175
|
const failureIds = this._failureStore ? [...new Set(failures.flatMap((failure2) => this._failureStore.listByFingerprint(failure2.patternKey).filter((stored) => {
|
|
671954
672176
|
const context2 = stored.context ?? {};
|
|
671955
672177
|
return !stored.resolved && stored.sessionId === this._sessionId && stored.taskId === this._sessionId && context2["taskEpoch"] === this._taskEpoch && context2["targetKey"] === targetKey && context2["workboardCardId"] === failure2.workboardCardId;
|
|
@@ -671984,7 +672206,14 @@ ${contentPreview}
|
|
|
671984
672206
|
resolved++;
|
|
671985
672207
|
}
|
|
671986
672208
|
this._workboard = readActiveWorkboardSnapshot(workingDir, runId) ?? board;
|
|
671987
|
-
} catch {
|
|
672209
|
+
} catch (error) {
|
|
672210
|
+
this.emit({
|
|
672211
|
+
type: "status",
|
|
672212
|
+
visibility: "telemetry",
|
|
672213
|
+
content: `failure_lifecycle_resolution_deferred: ${error instanceof Error ? error.message : String(error)}`.slice(0, 320),
|
|
672214
|
+
turn: input.turn,
|
|
672215
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
672216
|
+
});
|
|
671988
672217
|
}
|
|
671989
672218
|
}
|
|
671990
672219
|
return resolved;
|
|
@@ -677269,6 +677498,7 @@ Respond with the assessment and take the selected evidence-backed action.`;
|
|
|
677269
677498
|
contextWindowSize: this.options.contextWindowSize ?? 0,
|
|
677270
677499
|
verbose: false
|
|
677271
677500
|
});
|
|
677501
|
+
this._hydrateCanonicalAcceptedReceipts();
|
|
677272
677502
|
await this._initializeGitProgressBaseline();
|
|
677273
677503
|
this._restoredTodoVerificationNote = null;
|
|
677274
677504
|
try {
|
|
@@ -681593,6 +681823,12 @@ ${cachedResult}`,
|
|
|
681593
681823
|
try {
|
|
681594
681824
|
tc.arguments = finalArgs;
|
|
681595
681825
|
const normalizedDispatchName = resolvedTool?.name ?? tc.name;
|
|
681826
|
+
const gitPreflightPaths = this._isProjectEditTool(normalizedDispatchName) ? this._extractToolTargetPaths(normalizedDispatchName, tc.arguments) : normalizedDispatchName === "shell" && shellMutationAttempt ? shellMutationAttempt.extraction.paths : [];
|
|
681827
|
+
await this._observeGitProgressBeforeTool({
|
|
681828
|
+
turn,
|
|
681829
|
+
toolName: normalizedDispatchName,
|
|
681830
|
+
targetPaths: gitPreflightPaths
|
|
681831
|
+
});
|
|
681596
681832
|
let branchEvidenceResult = null;
|
|
681597
681833
|
if (normalizedDispatchName === "file_read" && this._fileReadMode(tc.arguments) !== "extract") {
|
|
681598
681834
|
const exactReadFingerprint = this._buildToolFingerprint("file_read", tc.arguments);
|
|
@@ -681798,6 +682034,25 @@ intent=${_verifierResult.intentBucket}; scope=${_verifierResult.effectScope ?? "
|
|
|
681798
682034
|
}
|
|
681799
682035
|
}
|
|
681800
682036
|
}
|
|
682037
|
+
if (!result.success && tc.name === "shell" && /\[PERMISSION_ERROR\]/.test(result.error ?? "") && tool) {
|
|
682038
|
+
this.emit({
|
|
682039
|
+
type: "sudo_request",
|
|
682040
|
+
content: `Command requires elevated privileges: ${tc.arguments.command?.slice(0, 100) ?? ""}`,
|
|
682041
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
682042
|
+
});
|
|
682043
|
+
const pw2 = await this.waitForSudoPassword(12e4);
|
|
682044
|
+
if (pw2) {
|
|
682045
|
+
try {
|
|
682046
|
+
result = await tool.execute(tc.arguments);
|
|
682047
|
+
} catch (err) {
|
|
682048
|
+
result = {
|
|
682049
|
+
success: false,
|
|
682050
|
+
output: "",
|
|
682051
|
+
error: err instanceof Error ? err.message : String(err)
|
|
682052
|
+
};
|
|
682053
|
+
}
|
|
682054
|
+
}
|
|
682055
|
+
}
|
|
681801
682056
|
if (!fileReadSafetyChecked) {
|
|
681802
682057
|
result = await this._guardMaterializedFileReadResult({
|
|
681803
682058
|
callId: tc.id,
|
|
@@ -682402,6 +682657,7 @@ ${diagnostic}`;
|
|
|
682402
682657
|
}
|
|
682403
682658
|
}
|
|
682404
682659
|
}
|
|
682660
|
+
let failureWorkboardCardId = null;
|
|
682405
682661
|
if (!result.success && (result.error || result.output || result.llmContent)) {
|
|
682406
682662
|
const errorText = (result.error || result.output || result.llmContent || "").toString();
|
|
682407
682663
|
const diagnosis = this._diagnoseToolFailure(tc.name, tc.arguments, result);
|
|
@@ -682421,11 +682677,10 @@ ${diagnostic}`;
|
|
|
682421
682677
|
};
|
|
682422
682678
|
this._errorPatterns.set(sig, learnedPattern);
|
|
682423
682679
|
this._taskRelevantErrorPatterns.set(sig, learnedPattern);
|
|
682424
|
-
this._recordFailureRecoveryOnWorkboard(tc.name, tc.arguments, result, diagnosis, count);
|
|
682680
|
+
failureWorkboardCardId = this._recordFailureRecoveryOnWorkboard(tc.name, tc.arguments, result, diagnosis, count);
|
|
682425
682681
|
if (this._failureStore) {
|
|
682426
682682
|
try {
|
|
682427
682683
|
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
682684
|
this._failureStore.insert({
|
|
682430
682685
|
taskId: this._sessionId,
|
|
682431
682686
|
sessionId: this._sessionId,
|
|
@@ -682440,7 +682695,7 @@ ${diagnostic}`;
|
|
|
682440
682695
|
taskEpoch: this._taskEpoch,
|
|
682441
682696
|
targetPaths: failureTargets,
|
|
682442
682697
|
targetKey: failureTargets.join("|") || "unscoped",
|
|
682443
|
-
workboardCardId:
|
|
682698
|
+
...failureWorkboardCardId ? { workboardCardId: failureWorkboardCardId } : {},
|
|
682444
682699
|
diagnosis: {
|
|
682445
682700
|
kind: diagnosis.kind,
|
|
682446
682701
|
severity: diagnosis.severity,
|
|
@@ -682858,7 +683113,7 @@ ${diagnostic}`;
|
|
|
682858
683113
|
this._recentFailures.push({
|
|
682859
683114
|
tool: tc.name,
|
|
682860
683115
|
patternKey: failureDiagnosis.patternKey,
|
|
682861
|
-
workboardCardId:
|
|
683116
|
+
...failureWorkboardCardId ? { workboardCardId: failureWorkboardCardId } : {},
|
|
682862
683117
|
fingerprint: toolFingerprint,
|
|
682863
683118
|
args: tc.arguments,
|
|
682864
683119
|
error: (result.error ?? "").slice(0, 600),
|
|
@@ -682951,25 +683206,6 @@ ${diagnostic}`;
|
|
|
682951
683206
|
});
|
|
682952
683207
|
}
|
|
682953
683208
|
}
|
|
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
683209
|
if (tc.name === "explore_tools" && result.success && result.output.startsWith("UNLOCK_TOOL:")) {
|
|
682974
683210
|
const unlockName = result.output.slice("UNLOCK_TOOL:".length).trim();
|
|
682975
683211
|
const existingTool = this.tools.get(unlockName);
|
|
@@ -692377,7 +692613,8 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
|
|
|
692377
692613
|
const shouldRetryThinkGuard = outcome !== null && effectiveThink === true && (justSuppressed || outcome === "empty_after_strip" || outcome === "unclosed_think");
|
|
692378
692614
|
if (shouldProbeNativeOnEmpty) {
|
|
692379
692615
|
try {
|
|
692380
|
-
const
|
|
692616
|
+
const nativeRecoveryRequest = withLogicalRequestVariant(request, "native-empty-recovery");
|
|
692617
|
+
const _native = await this.nativeOllamaChatCompletion(nativeRecoveryRequest, {
|
|
692381
692618
|
// Keep recovery on the pool endpoint that already admitted and
|
|
692382
692619
|
// warmed this request. Falling back to the broker/base URL can
|
|
692383
692620
|
// cold-load a second copy of a large model while the admitted
|
|
@@ -692420,13 +692657,8 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
|
|
|
692420
692657
|
retryBody["num_ctx"] = reqNumCtx;
|
|
692421
692658
|
}
|
|
692422
692659
|
try {
|
|
692423
|
-
const
|
|
692424
|
-
|
|
692425
|
-
headers: this.authHeaders(request),
|
|
692426
|
-
body: JSON.stringify(retryBody)
|
|
692427
|
-
};
|
|
692428
|
-
if (combinedAbortSignal)
|
|
692429
|
-
retryOpts.signal = combinedAbortSignal;
|
|
692660
|
+
const openAiRetryRequest = withLogicalRequestVariant(request, "openai-empty-retry");
|
|
692661
|
+
const retryOpts = this.brokerRequestOptions(openAiRetryRequest, retryBody, combinedAbortSignal);
|
|
692430
692662
|
const retryResp = await fetch(this.providerRequestUrl(requestBaseUrl, "chat"), retryOpts);
|
|
692431
692663
|
if (retryResp.ok) {
|
|
692432
692664
|
const retryData = await retryResp.json();
|
|
@@ -694629,7 +694861,7 @@ var init_runEvents = __esm({
|
|
|
694629
694861
|
// packages/orchestrator/dist/adjudication.js
|
|
694630
694862
|
import { createHash as createHash66, randomUUID as randomUUID29 } from "node:crypto";
|
|
694631
694863
|
import { mkdir as mkdir26, readFile as readFile28, rename as rename7, writeFile as writeFile29 } from "node:fs/promises";
|
|
694632
|
-
import { dirname as
|
|
694864
|
+
import { dirname as dirname53, join as join136, resolve as resolve69 } from "node:path";
|
|
694633
694865
|
import { z as z20 } from "zod";
|
|
694634
694866
|
function timestamp(now2) {
|
|
694635
694867
|
return now2().toISOString();
|
|
@@ -695221,7 +695453,7 @@ async function mapConcurrent(rows, limit2, worker2) {
|
|
|
695221
695453
|
return results;
|
|
695222
695454
|
}
|
|
695223
695455
|
async function writeJsonAtomic(path16, value2) {
|
|
695224
|
-
await mkdir26(
|
|
695456
|
+
await mkdir26(dirname53(path16), { recursive: true });
|
|
695225
695457
|
const temporary = `${path16}.${process.pid}.${randomUUID29()}.tmp`;
|
|
695226
695458
|
await writeFile29(temporary, `${JSON.stringify(value2, null, 2)}
|
|
695227
695459
|
`, "utf8");
|
|
@@ -695621,7 +695853,7 @@ async function verifyAdjudicationReplay(receiptPath) {
|
|
|
695621
695853
|
} catch {
|
|
695622
695854
|
return { valid: false, issues: ["receipt_unreadable"], receipt: null };
|
|
695623
695855
|
}
|
|
695624
|
-
const directory =
|
|
695856
|
+
const directory = dirname53(receiptPath);
|
|
695625
695857
|
const readJson6 = async (name10) => {
|
|
695626
695858
|
try {
|
|
695627
695859
|
const value2 = JSON.parse(await readFile28(join136(directory, name10), "utf8"));
|
|
@@ -697358,7 +697590,7 @@ var init_config_loader = __esm({
|
|
|
697358
697590
|
// packages/orchestrator/dist/memory/stability-tracker.js
|
|
697359
697591
|
import { createHash as createHash68 } from "node:crypto";
|
|
697360
697592
|
import { existsSync as existsSync125, mkdirSync as mkdirSync74, readFileSync as readFileSync100, writeFileSync as writeFileSync66 } from "node:fs";
|
|
697361
|
-
import { dirname as
|
|
697593
|
+
import { dirname as dirname54, join as join138 } from "node:path";
|
|
697362
697594
|
function stabilityFilePath(repoRoot) {
|
|
697363
697595
|
return join138(repoRoot, ".omnius", "memory", "stability.json");
|
|
697364
697596
|
}
|
|
@@ -697375,7 +697607,7 @@ function loadStabilityIndex(repoRoot) {
|
|
|
697375
697607
|
}
|
|
697376
697608
|
function saveStabilityIndex(repoRoot, index) {
|
|
697377
697609
|
const path16 = stabilityFilePath(repoRoot);
|
|
697378
|
-
mkdirSync74(
|
|
697610
|
+
mkdirSync74(dirname54(path16), { recursive: true });
|
|
697379
697611
|
writeFileSync66(path16, JSON.stringify(index, null, 2), "utf-8");
|
|
697380
697612
|
}
|
|
697381
697613
|
function updateMemoryStability(items, options2 = {}) {
|
|
@@ -700670,7 +700902,7 @@ var init_missionSystem = __esm({
|
|
|
700670
700902
|
// packages/orchestrator/dist/context-references.js
|
|
700671
700903
|
import { readFileSync as readFileSync105, readdirSync as readdirSync42, statSync as statSync50 } from "node:fs";
|
|
700672
700904
|
import { homedir as homedir39 } from "node:os";
|
|
700673
|
-
import { join as join144, resolve as resolve70, relative as relative21, sep as
|
|
700905
|
+
import { join as join144, resolve as resolve70, relative as relative21, sep as sep11, extname as extname18 } from "node:path";
|
|
700674
700906
|
function estimateTokens8(text3) {
|
|
700675
700907
|
return Math.ceil(text3.length / CHARS_PER_TOKEN);
|
|
700676
700908
|
}
|
|
@@ -700703,12 +700935,12 @@ function removeReferenceTokens(message2, refs) {
|
|
|
700703
700935
|
return text3.trim();
|
|
700704
700936
|
}
|
|
700705
700937
|
function resolvePath4(cwd4, target, allowedRoot) {
|
|
700706
|
-
const
|
|
700707
|
-
const expanded =
|
|
700938
|
+
const isAbsolute27 = target.startsWith("/") || target.startsWith("~");
|
|
700939
|
+
const expanded = isAbsolute27 ? target.replace(/^~/, homedir39()) : join144(cwd4, target);
|
|
700708
700940
|
const resolved = resolve70(expanded);
|
|
700709
700941
|
if (allowedRoot) {
|
|
700710
700942
|
const allowed = resolve70(allowedRoot);
|
|
700711
|
-
if (!resolved.startsWith(allowed +
|
|
700943
|
+
if (!resolved.startsWith(allowed + sep11) && resolved !== allowed) {
|
|
700712
700944
|
throw new Error("path is outside the allowed workspace");
|
|
700713
700945
|
}
|
|
700714
700946
|
}
|
|
@@ -700724,7 +700956,7 @@ function ensureReferencePathAllowed(filePath) {
|
|
|
700724
700956
|
}
|
|
700725
700957
|
for (const dir of SENSITIVE_HOME_DIRS) {
|
|
700726
700958
|
const blockedDir = resolve70(join144(home3, dir));
|
|
700727
|
-
if (filePath.startsWith(blockedDir +
|
|
700959
|
+
if (filePath.startsWith(blockedDir + sep11) || filePath === blockedDir) {
|
|
700728
700960
|
throw new Error("path is a sensitive credential or internal path and cannot be attached");
|
|
700729
700961
|
}
|
|
700730
700962
|
}
|
|
@@ -702821,6 +703053,7 @@ __export(dist_exports3, {
|
|
|
702821
703053
|
detectExitCodeMisread: () => detectExitCodeMisread,
|
|
702822
703054
|
detectExplorationIntent: () => detectExplorationIntent,
|
|
702823
703055
|
detectGitProgressBaseline: () => detectGitProgressBaseline,
|
|
703056
|
+
detectGitProgressBaselineFromPaths: () => detectGitProgressBaselineFromPaths,
|
|
702824
703057
|
detectPressure: () => detectPressure,
|
|
702825
703058
|
detectTaskType: () => detectTaskType,
|
|
702826
703059
|
deterministicAdjudicationAssignments: () => deterministicAdjudicationAssignments,
|
|
@@ -703420,10 +703653,10 @@ var init_adjudication_constituent = __esm({
|
|
|
703420
703653
|
|
|
703421
703654
|
// packages/cli/src/discovery.ts
|
|
703422
703655
|
import { existsSync as existsSync128, readFileSync as readFileSync106 } from "node:fs";
|
|
703423
|
-
import { dirname as
|
|
703656
|
+
import { dirname as dirname55, resolve as resolve71 } from "node:path";
|
|
703424
703657
|
import { fileURLToPath as fileURLToPath21 } from "node:url";
|
|
703425
703658
|
function discoveryCandidates() {
|
|
703426
|
-
const here =
|
|
703659
|
+
const here = dirname55(fileURLToPath21(import.meta.url));
|
|
703427
703660
|
const configured = process.env["OMNIUS_DOCS_ROOT"]?.trim();
|
|
703428
703661
|
if (configured) {
|
|
703429
703662
|
return [configured.endsWith(".json") ? resolve71(configured) : resolve71(configured, "DISCOVERY.json")];
|
|
@@ -703761,7 +703994,7 @@ __export(init_exports, {
|
|
|
703761
703994
|
initCommand: () => initCommand
|
|
703762
703995
|
});
|
|
703763
703996
|
import { existsSync as existsSync129, lstatSync as lstatSync3, readFileSync as readFileSync107, renameSync as renameSync25, writeFileSync as writeFileSync71 } from "node:fs";
|
|
703764
|
-
import { dirname as
|
|
703997
|
+
import { dirname as dirname56, resolve as resolve72 } from "node:path";
|
|
703765
703998
|
import { randomUUID as randomUUID30 } from "node:crypto";
|
|
703766
703999
|
function mergeManagedBlock(current, start2, end, block) {
|
|
703767
704000
|
const starts = current.split(start2).length - 1;
|
|
@@ -703790,7 +704023,7 @@ function planFile(path16, start2, end, block) {
|
|
|
703790
704023
|
return { path: path16, current, next, changed: current !== next };
|
|
703791
704024
|
}
|
|
703792
704025
|
function atomicWrite2(path16, content) {
|
|
703793
|
-
const temporary = resolve72(
|
|
704026
|
+
const temporary = resolve72(dirname56(path16), `.${randomUUID30()}.omnius-tmp`);
|
|
703794
704027
|
writeFileSync71(temporary, content, { encoding: "utf8", mode: 384 });
|
|
703795
704028
|
renameSync25(temporary, path16);
|
|
703796
704029
|
}
|
|
@@ -704200,7 +704433,7 @@ import { join as join147 } from "node:path";
|
|
|
704200
704433
|
import { homedir as homedir41 } from "node:os";
|
|
704201
704434
|
import { createServer as createNetServer } from "node:net";
|
|
704202
704435
|
import { fileURLToPath as fileURLToPath22 } from "node:url";
|
|
704203
|
-
import { dirname as
|
|
704436
|
+
import { dirname as dirname57 } from "node:path";
|
|
704204
704437
|
function getDaemonPort() {
|
|
704205
704438
|
const env2 = process.env["OMNIUS_HOST"];
|
|
704206
704439
|
if (env2) {
|
|
@@ -704325,7 +704558,7 @@ async function isDaemonRunning(port2) {
|
|
|
704325
704558
|
}
|
|
704326
704559
|
function getLocalCliVersion() {
|
|
704327
704560
|
try {
|
|
704328
|
-
const here =
|
|
704561
|
+
const here = dirname57(fileURLToPath22(import.meta.url));
|
|
704329
704562
|
for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
|
|
704330
704563
|
const p2 = join147(here, rel);
|
|
704331
704564
|
if (existsSync131(p2)) {
|
|
@@ -704802,7 +705035,7 @@ function commandForEntrypoint(path16, nodeExe) {
|
|
|
704802
705035
|
async function resolveDaemonCommand(nodeExe, preferredEntrypoint) {
|
|
704803
705036
|
const candidates = [];
|
|
704804
705037
|
if (preferredEntrypoint) candidates.push(preferredEntrypoint);
|
|
704805
|
-
const thisDir =
|
|
705038
|
+
const thisDir = dirname57(fileURLToPath22(import.meta.url));
|
|
704806
705039
|
candidates.push(join147(thisDir, "index.js"));
|
|
704807
705040
|
if (process.argv[1]) candidates.push(process.argv[1]);
|
|
704808
705041
|
try {
|
|
@@ -705144,7 +705377,7 @@ import {
|
|
|
705144
705377
|
mkdirSync as mkdirSync82,
|
|
705145
705378
|
openSync as openSync9,
|
|
705146
705379
|
readFileSync as readFileSync110,
|
|
705147
|
-
realpathSync,
|
|
705380
|
+
realpathSync as realpathSync2,
|
|
705148
705381
|
renameSync as renameSync28,
|
|
705149
705382
|
unlinkSync as unlinkSync32,
|
|
705150
705383
|
writeFileSync as writeFileSync74,
|
|
@@ -705152,7 +705385,7 @@ import {
|
|
|
705152
705385
|
} from "node:fs";
|
|
705153
705386
|
import { createRequire as createRequire5 } from "node:module";
|
|
705154
705387
|
import { homedir as homedir42, tmpdir as tmpdir24 } from "node:os";
|
|
705155
|
-
import { basename as basename29, dirname as
|
|
705388
|
+
import { basename as basename29, dirname as dirname58, join as join148 } from "node:path";
|
|
705156
705389
|
import { fileURLToPath as fileURLToPath23 } from "node:url";
|
|
705157
705390
|
function trayUpdatePresentation(currentVersion, latestVersion, state5 = null) {
|
|
705158
705391
|
if (state5?.status === "running") {
|
|
@@ -705363,7 +705596,7 @@ function verifyTrayHelper() {
|
|
|
705363
705596
|
`Optional dependency systray2@${TRAY_HELPER_VERSION} is not installed; reinstall Omnius with optional dependencies enabled`
|
|
705364
705597
|
);
|
|
705365
705598
|
}
|
|
705366
|
-
const packageHelper = join148(
|
|
705599
|
+
const packageHelper = join148(dirname58(packageJson), "traybin", binName);
|
|
705367
705600
|
const cwdHelper = join148(process.cwd(), "traybin", binName);
|
|
705368
705601
|
const selectedHelper = existsSync132(cwdHelper) ? cwdHelper : packageHelper;
|
|
705369
705602
|
if (!existsSync132(selectedHelper)) throw new Error(`Native tray helper is missing: ${selectedHelper}`);
|
|
@@ -705377,7 +705610,7 @@ function verifyTrayHelper() {
|
|
|
705377
705610
|
function assetPath(kind) {
|
|
705378
705611
|
const state5 = kind === "online" ? "online" : kind === "offline" ? "offline" : "checking";
|
|
705379
705612
|
const extension3 = process.platform === "win32" ? "ico" : "png";
|
|
705380
|
-
const path16 = join148(
|
|
705613
|
+
const path16 = join148(dirname58(fileURLToPath23(import.meta.url)), "..", "assets", "tray", `omnius-${state5}.${extension3}`);
|
|
705381
705614
|
if (!existsSync132(path16)) throw new Error(`Tray icon asset is missing: ${path16}`);
|
|
705382
705615
|
return path16;
|
|
705383
705616
|
}
|
|
@@ -705482,7 +705715,7 @@ function commandForEntrypoint2(path16) {
|
|
|
705482
705715
|
}
|
|
705483
705716
|
function resolveTrayLaunchCommand() {
|
|
705484
705717
|
const candidates = [
|
|
705485
|
-
join148(
|
|
705718
|
+
join148(dirname58(fileURLToPath23(import.meta.url)), "index.js"),
|
|
705486
705719
|
process.argv[1]
|
|
705487
705720
|
];
|
|
705488
705721
|
try {
|
|
@@ -705511,7 +705744,7 @@ function installedOmniusLaunchCommand() {
|
|
|
705511
705744
|
timeout: 2e3
|
|
705512
705745
|
});
|
|
705513
705746
|
const first2 = result.stdout?.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
705514
|
-
return first2 && existsSync132(first2) ? commandForEntrypoint2(
|
|
705747
|
+
return first2 && existsSync132(first2) ? commandForEntrypoint2(realpathSync2(first2)) : null;
|
|
705515
705748
|
} catch {
|
|
705516
705749
|
return null;
|
|
705517
705750
|
}
|
|
@@ -705523,8 +705756,8 @@ function registrationIconPath(launch) {
|
|
|
705523
705756
|
const extension3 = process.platform === "win32" ? "ico" : "png";
|
|
705524
705757
|
const entrypoints = [...launch.args, launch.command].filter((candidate) => existsSync132(candidate));
|
|
705525
705758
|
for (const entrypoint of entrypoints) {
|
|
705526
|
-
const real =
|
|
705527
|
-
for (const packageRoot of [
|
|
705759
|
+
const real = realpathSync2(entrypoint);
|
|
705760
|
+
for (const packageRoot of [dirname58(real), join148(dirname58(real), "..")]) {
|
|
705528
705761
|
const candidate = join148(packageRoot, "assets", "tray", `omnius-online.${extension3}`);
|
|
705529
705762
|
if (existsSync132(candidate)) return candidate;
|
|
705530
705763
|
}
|
|
@@ -705587,7 +705820,7 @@ function writeTrayAutostart(endpoint) {
|
|
|
705587
705820
|
const launch = resolveTrayRegistrationCommand();
|
|
705588
705821
|
if (!launch) throw new Error("Could not resolve the installed Omnius CLI entrypoint");
|
|
705589
705822
|
const paths = resolveTrayPaths();
|
|
705590
|
-
mkdirSync82(
|
|
705823
|
+
mkdirSync82(dirname58(paths.autostartFile), { recursive: true });
|
|
705591
705824
|
writeFileSync74(
|
|
705592
705825
|
paths.autostartFile,
|
|
705593
705826
|
buildAutostartContent(process.platform, launch, endpoint, registrationIconPath(launch)),
|
|
@@ -707421,7 +707654,7 @@ __export(py_embed_exports, {
|
|
|
707421
707654
|
});
|
|
707422
707655
|
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
707423
707656
|
import { existsSync as existsSync135, mkdirSync as mkdirSync85, readFileSync as readFileSync113, writeFileSync as writeFileSync76 } from "node:fs";
|
|
707424
|
-
import { dirname as
|
|
707657
|
+
import { dirname as dirname59, join as join151 } from "node:path";
|
|
707425
707658
|
import { homedir as homedir43 } from "node:os";
|
|
707426
707659
|
import { fileURLToPath as fileURLToPath25 } from "node:url";
|
|
707427
707660
|
function managedAsrRuntimeRoot() {
|
|
@@ -708216,7 +708449,7 @@ var MODULE_DIR, MANAGED_ASR_ROOT, MANAGED_ASR_MODEL_ROOT, WHISPER_MODEL_IDS2, NE
|
|
|
708216
708449
|
var init_py_embed = __esm({
|
|
708217
708450
|
"packages/cli/src/api/py-embed.ts"() {
|
|
708218
708451
|
init_dist5();
|
|
708219
|
-
MODULE_DIR =
|
|
708452
|
+
MODULE_DIR = dirname59(fileURLToPath25(import.meta.url));
|
|
708220
708453
|
MANAGED_ASR_ROOT = join151(homedir43(), ".omnius", "runtimes", "asr");
|
|
708221
708454
|
MANAGED_ASR_MODEL_ROOT = join151(homedir43(), ".omnius", "models", "asr");
|
|
708222
708455
|
WHISPER_MODEL_IDS2 = /* @__PURE__ */ new Set(["tiny", "base", "small", "medium", "large-v3"]);
|
|
@@ -708610,7 +708843,7 @@ import {
|
|
|
708610
708843
|
writeFileSync as writeFileSync78,
|
|
708611
708844
|
readdirSync as readdirSync44
|
|
708612
708845
|
} from "node:fs";
|
|
708613
|
-
import { join as join153, dirname as
|
|
708846
|
+
import { join as join153, dirname as dirname60 } from "node:path";
|
|
708614
708847
|
import { homedir as homedir45 } from "node:os";
|
|
708615
708848
|
import { fileURLToPath as fileURLToPath26 } from "node:url";
|
|
708616
708849
|
import { EventEmitter as EventEmitter6 } from "node:events";
|
|
@@ -708906,7 +709139,7 @@ async function findMicCaptureCommand() {
|
|
|
708906
709139
|
return null;
|
|
708907
709140
|
}
|
|
708908
709141
|
async function findTranscribeFileScript() {
|
|
708909
|
-
const thisDir =
|
|
709142
|
+
const thisDir = dirname60(fileURLToPath26(import.meta.url));
|
|
708910
709143
|
const candidates = [
|
|
708911
709144
|
join153(thisDir, "../../../../packages/execution/scripts/transcribe-file.py"),
|
|
708912
709145
|
join153(thisDir, "../../../packages/execution/scripts/transcribe-file.py"),
|
|
@@ -709003,7 +709236,7 @@ async function transcribeFileViaWhisper(filePath, model) {
|
|
|
709003
709236
|
});
|
|
709004
709237
|
}
|
|
709005
709238
|
async function findLiveAsrScript(scriptName) {
|
|
709006
|
-
const thisDir =
|
|
709239
|
+
const thisDir = dirname60(fileURLToPath26(import.meta.url));
|
|
709007
709240
|
const candidates = [
|
|
709008
709241
|
join153(thisDir, "../../../../packages/execution/scripts", scriptName),
|
|
709009
709242
|
join153(thisDir, "../../../packages/execution/scripts", scriptName),
|
|
@@ -709820,7 +710053,7 @@ ${text3}`.slice(-2e3);
|
|
|
709820
710053
|
const req3 = createRequire12(import.meta.url);
|
|
709821
710054
|
const loaded = req3("transcribe-cli");
|
|
709822
710055
|
try {
|
|
709823
|
-
transcribeCliPackageDirs.add(
|
|
710056
|
+
transcribeCliPackageDirs.add(dirname60(req3.resolve("transcribe-cli/package.json")));
|
|
709824
710057
|
} catch {
|
|
709825
710058
|
}
|
|
709826
710059
|
return loaded;
|
|
@@ -709930,7 +710163,7 @@ ${text3}`.slice(-2e3);
|
|
|
709930
710163
|
let tcUpToDate = false;
|
|
709931
710164
|
try {
|
|
709932
710165
|
const tcPkgPath = join153(
|
|
709933
|
-
|
|
710166
|
+
dirname60(__require.resolve?.("transcribe-cli/package.json") || ""),
|
|
709934
710167
|
"package.json"
|
|
709935
710168
|
);
|
|
709936
710169
|
if (existsSync137(tcPkgPath)) {
|
|
@@ -715184,7 +715417,7 @@ import {
|
|
|
715184
715417
|
writeFileSync as writeFileSync80
|
|
715185
715418
|
} from "node:fs";
|
|
715186
715419
|
import { homedir as homedir47 } from "node:os";
|
|
715187
|
-
import { dirname as
|
|
715420
|
+
import { dirname as dirname61, join as join156 } from "node:path";
|
|
715188
715421
|
function safeSegment3(value2) {
|
|
715189
715422
|
return value2.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 180) || "session";
|
|
715190
715423
|
}
|
|
@@ -715198,7 +715431,7 @@ function acknowledgementPath(sessionId) {
|
|
|
715198
715431
|
return join156(controlDir(), `${safeSegment3(sessionId)}.ack.json`);
|
|
715199
715432
|
}
|
|
715200
715433
|
function atomicWrite3(path16, value2) {
|
|
715201
|
-
mkdirSync90(
|
|
715434
|
+
mkdirSync90(dirname61(path16), { recursive: true });
|
|
715202
715435
|
const tmp = `${path16}.tmp.${process.pid}.${randomUUID33()}`;
|
|
715203
715436
|
writeFileSync80(tmp, `${JSON.stringify(value2, null, 2)}
|
|
715204
715437
|
`, "utf8");
|
|
@@ -721353,11 +721586,11 @@ function wrapToWidth(text3, width) {
|
|
|
721353
721586
|
}
|
|
721354
721587
|
function wrapListItems(items, width) {
|
|
721355
721588
|
if (items.length === 0) return [];
|
|
721356
|
-
const
|
|
721589
|
+
const sep16 = " · ";
|
|
721357
721590
|
const lines = [];
|
|
721358
721591
|
let current = "";
|
|
721359
721592
|
for (const item of items) {
|
|
721360
|
-
const candidate = current === "" ? item : current +
|
|
721593
|
+
const candidate = current === "" ? item : current + sep16 + item;
|
|
721361
721594
|
if (visibleLength(candidate) <= width) {
|
|
721362
721595
|
current = candidate;
|
|
721363
721596
|
} else {
|
|
@@ -723046,7 +723279,7 @@ var init_internal_output = __esm({
|
|
|
723046
723279
|
// packages/cli/src/tui/terminal-links.ts
|
|
723047
723280
|
import { existsSync as existsSync142 } from "node:fs";
|
|
723048
723281
|
import { homedir as homedir48 } from "node:os";
|
|
723049
|
-
import { isAbsolute as
|
|
723282
|
+
import { isAbsolute as isAbsolute23, resolve as resolve74 } from "node:path";
|
|
723050
723283
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
723051
723284
|
function hyperlinksEnabled(options2 = {}) {
|
|
723052
723285
|
return options2.force ?? (process.stdout.isTTY ?? false);
|
|
@@ -723075,11 +723308,11 @@ function stripLineCoordinates(filePath) {
|
|
|
723075
723308
|
}
|
|
723076
723309
|
function existingFileHref(filePath, cwd4) {
|
|
723077
723310
|
const expanded = expandHome2(filePath);
|
|
723078
|
-
const direct =
|
|
723311
|
+
const direct = isAbsolute23(expanded) ? expanded : resolve74(cwd4, expanded);
|
|
723079
723312
|
if (existsSync142(direct)) return pathToFileURL2(direct).href;
|
|
723080
723313
|
const withoutCoordinates = stripLineCoordinates(expanded);
|
|
723081
723314
|
if (withoutCoordinates === expanded) return null;
|
|
723082
|
-
const target =
|
|
723315
|
+
const target = isAbsolute23(withoutCoordinates) ? withoutCoordinates : resolve74(cwd4, withoutCoordinates);
|
|
723083
723316
|
return existsSync142(target) ? pathToFileURL2(target).href : null;
|
|
723084
723317
|
}
|
|
723085
723318
|
function httpHref(target) {
|
|
@@ -723982,13 +724215,13 @@ function stripTrustTierWrapperForTui(text3, maxWrapperChars = 400) {
|
|
|
723982
724215
|
).replace(/^---[ \t]*(?:\n)?/, "").replace(/(?:\n)?---[ \t]*$/, "");
|
|
723983
724216
|
}
|
|
723984
724217
|
function wrapFooterItems(items, width) {
|
|
723985
|
-
const
|
|
724218
|
+
const sep16 = " · ";
|
|
723986
724219
|
const lines = [];
|
|
723987
724220
|
let current = "";
|
|
723988
724221
|
for (const item of items) {
|
|
723989
724222
|
const clean7 = item.replace(/\s+/g, " ").trim();
|
|
723990
724223
|
if (!clean7) continue;
|
|
723991
|
-
const candidate = current ? `${current}${
|
|
724224
|
+
const candidate = current ? `${current}${sep16}${clean7}` : clean7;
|
|
723992
724225
|
if (visibleLen(candidate) <= width) {
|
|
723993
724226
|
current = candidate;
|
|
723994
724227
|
continue;
|
|
@@ -729516,7 +729749,7 @@ var init_types3 = __esm({
|
|
|
729516
729749
|
// packages/cli/src/tui/p2p/secret-vault.ts
|
|
729517
729750
|
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes28, scryptSync as scryptSync2, createHash as createHash74 } from "node:crypto";
|
|
729518
729751
|
import { readFileSync as readFileSync122, writeFileSync as writeFileSync83, existsSync as existsSync146, mkdirSync as mkdirSync93 } from "node:fs";
|
|
729519
|
-
import { dirname as
|
|
729752
|
+
import { dirname as dirname62 } from "node:path";
|
|
729520
729753
|
var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
|
|
729521
729754
|
var init_secret_vault = __esm({
|
|
729522
729755
|
"packages/cli/src/tui/p2p/secret-vault.ts"() {
|
|
@@ -729722,7 +729955,7 @@ var init_secret_vault = __esm({
|
|
|
729722
729955
|
const encrypted = Buffer.concat([cipher.update(data, "utf8"), cipher.final()]);
|
|
729723
729956
|
const tag = cipher.getAuthTag();
|
|
729724
729957
|
const blob = Buffer.concat([salt, iv, tag, encrypted]);
|
|
729725
|
-
const dir =
|
|
729958
|
+
const dir = dirname62(this.storePath);
|
|
729726
729959
|
if (!existsSync146(dir)) mkdirSync93(dir, { recursive: true });
|
|
729727
729960
|
writeFileSync83(this.storePath, blob, { mode: 384 });
|
|
729728
729961
|
}
|
|
@@ -731401,7 +731634,7 @@ __export(omnius_directory_exports, {
|
|
|
731401
731634
|
writeTaskHandoff: () => writeTaskHandoff2
|
|
731402
731635
|
});
|
|
731403
731636
|
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
|
|
731637
|
+
import { join as join162, relative as relative23, basename as basename32, dirname as dirname63, resolve as resolve77 } from "node:path";
|
|
731405
731638
|
import { homedir as homedir50 } from "node:os";
|
|
731406
731639
|
import { createHash as createHash77 } from "node:crypto";
|
|
731407
731640
|
function isGitRoot(dir) {
|
|
@@ -731466,7 +731699,7 @@ function ensureOmniusIgnored(repoRoot) {
|
|
|
731466
731699
|
if (!gitRoot) return;
|
|
731467
731700
|
const gitignorePath = findNearestExistingGitignore(repoRoot, gitRoot);
|
|
731468
731701
|
if (!gitignorePath) return;
|
|
731469
|
-
const gitignoreDir =
|
|
731702
|
+
const gitignoreDir = dirname63(gitignorePath);
|
|
731470
731703
|
const relDir = relative23(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
|
|
731471
731704
|
const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
|
|
731472
731705
|
const content = readFileSync124(gitignorePath, "utf-8");
|
|
@@ -732098,7 +732331,7 @@ function pruneContextLedger(ledgerPath2) {
|
|
|
732098
732331
|
const lines = readFileSync124(ledgerPath2, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
732099
732332
|
if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
|
|
732100
732333
|
const kept = lines.slice(-MAX_CONTEXT_LEDGER_LINES);
|
|
732101
|
-
const archiveDir = join162(
|
|
732334
|
+
const archiveDir = join162(dirname63(ledgerPath2), "archive");
|
|
732102
732335
|
mkdirSync95(archiveDir, { recursive: true });
|
|
732103
732336
|
const archivePath = join162(
|
|
732104
732337
|
archiveDir,
|
|
@@ -733760,7 +733993,7 @@ var init_render2 = __esm({
|
|
|
733760
733993
|
|
|
733761
733994
|
// packages/prompts/dist/promptLoader.js
|
|
733762
733995
|
import { readFileSync as readFileSync127, existsSync as existsSync151 } from "node:fs";
|
|
733763
|
-
import { join as join164, dirname as
|
|
733996
|
+
import { join as join164, dirname as dirname64 } from "node:path";
|
|
733764
733997
|
import { fileURLToPath as fileURLToPath27 } from "node:url";
|
|
733765
733998
|
function resolvePromptsDir(baseDir, promptPath = "code.md") {
|
|
733766
733999
|
const devPath2 = join164(baseDir, "..", "templates");
|
|
@@ -733790,7 +734023,7 @@ var init_promptLoader2 = __esm({
|
|
|
733790
734023
|
"packages/prompts/dist/promptLoader.js"() {
|
|
733791
734024
|
"use strict";
|
|
733792
734025
|
__filename4 = fileURLToPath27(import.meta.url);
|
|
733793
|
-
__dirname5 =
|
|
734026
|
+
__dirname5 = dirname64(__filename4);
|
|
733794
734027
|
PROMPTS_DIR2 = resolvePromptsDir(__dirname5);
|
|
733795
734028
|
cache6 = /* @__PURE__ */ new Map();
|
|
733796
734029
|
}
|
|
@@ -733904,7 +734137,7 @@ var init_task_templates = __esm({
|
|
|
733904
734137
|
});
|
|
733905
734138
|
|
|
733906
734139
|
// packages/prompts/dist/index.js
|
|
733907
|
-
import { join as join165, dirname as
|
|
734140
|
+
import { join as join165, dirname as dirname65 } from "node:path";
|
|
733908
734141
|
import { fileURLToPath as fileURLToPath28 } from "node:url";
|
|
733909
734142
|
var _dir, _packageRoot;
|
|
733910
734143
|
var init_dist9 = __esm({
|
|
@@ -733914,7 +734147,7 @@ var init_dist9 = __esm({
|
|
|
733914
734147
|
init_render2();
|
|
733915
734148
|
init_task_templates();
|
|
733916
734149
|
init_render2();
|
|
733917
|
-
_dir =
|
|
734150
|
+
_dir = dirname65(fileURLToPath28(import.meta.url));
|
|
733918
734151
|
_packageRoot = join165(_dir, "..");
|
|
733919
734152
|
}
|
|
733920
734153
|
});
|
|
@@ -735307,7 +735540,7 @@ var init_braille_spinner = __esm({
|
|
|
735307
735540
|
|
|
735308
735541
|
// packages/cli/src/tui/project-context.ts
|
|
735309
735542
|
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
|
|
735543
|
+
import { dirname as dirname66, join as join167, basename as basename34, resolve as resolve79 } from "node:path";
|
|
735311
735544
|
import { homedir as homedir53 } from "node:os";
|
|
735312
735545
|
function projectContextUrlSpanAt(text3, index) {
|
|
735313
735546
|
PROJECT_CONTEXT_URL_RE.lastIndex = 0;
|
|
@@ -735381,7 +735614,7 @@ function findGitDir(repoRoot) {
|
|
|
735381
735614
|
}
|
|
735382
735615
|
return gitPath;
|
|
735383
735616
|
}
|
|
735384
|
-
const parent =
|
|
735617
|
+
const parent = dirname66(dir);
|
|
735385
735618
|
if (parent === dir) return null;
|
|
735386
735619
|
dir = parent;
|
|
735387
735620
|
}
|
|
@@ -737161,7 +737394,7 @@ __export(status_bar_exports, {
|
|
|
737161
737394
|
stripSubAgentPrefix: () => stripSubAgentPrefix,
|
|
737162
737395
|
unlockFooterRedraws: () => unlockFooterRedraws
|
|
737163
737396
|
});
|
|
737164
|
-
import { basename as basename35, dirname as
|
|
737397
|
+
import { basename as basename35, dirname as dirname67 } from "node:path";
|
|
737165
737398
|
import { readFile as readFileAsync } from "node:fs/promises";
|
|
737166
737399
|
function headerButtonGlyphFg() {
|
|
737167
737400
|
const a2 = tuiAccent();
|
|
@@ -741576,7 +741809,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
741576
741809
|
if (limit2 <= 6) return value2.slice(-limit2);
|
|
741577
741810
|
const marker = "...";
|
|
741578
741811
|
const leaf = basename35(value2);
|
|
741579
|
-
const parentLeaf = basename35(
|
|
741812
|
+
const parentLeaf = basename35(dirname67(value2));
|
|
741580
741813
|
const suffix = parentLeaf && parentLeaf !== "." && parentLeaf !== leaf ? `${parentLeaf}/${leaf}` : leaf;
|
|
741581
741814
|
if (suffix.length + marker.length + 1 <= limit2) {
|
|
741582
741815
|
return `${marker}/${suffix}`;
|
|
@@ -743715,7 +743948,7 @@ __export(personaplex_exports, {
|
|
|
743715
743948
|
stopPersonaPlex: () => stopPersonaPlex
|
|
743716
743949
|
});
|
|
743717
743950
|
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
|
|
743951
|
+
import { join as join168, dirname as dirname68 } from "node:path";
|
|
743719
743952
|
import { homedir as homedir54 } from "node:os";
|
|
743720
743953
|
import { spawn as spawn42 } from "node:child_process";
|
|
743721
743954
|
import { fileURLToPath as fileURLToPath29 } from "node:url";
|
|
@@ -744525,7 +744758,7 @@ function getShippedVoicesDir() {
|
|
|
744525
744758
|
// repo root
|
|
744526
744759
|
];
|
|
744527
744760
|
try {
|
|
744528
|
-
const modDir =
|
|
744761
|
+
const modDir = dirname68(fileURLToPath29(import.meta.url));
|
|
744529
744762
|
candidates.push(join168(modDir, "..", "voices", "personaplex"));
|
|
744530
744763
|
candidates.push(join168(modDir, "..", "..", "..", "voices", "personaplex"));
|
|
744531
744764
|
candidates.push(join168(modDir, "..", "..", "..", "..", "voices", "personaplex"));
|
|
@@ -752298,7 +752531,7 @@ import {
|
|
|
752298
752531
|
renameSync as renameSync31,
|
|
752299
752532
|
unlinkSync as unlinkSync40
|
|
752300
752533
|
} from "node:fs";
|
|
752301
|
-
import { dirname as
|
|
752534
|
+
import { dirname as dirname69, join as join174 } from "node:path";
|
|
752302
752535
|
import { homedir as homedir57 } from "node:os";
|
|
752303
752536
|
import { randomBytes as randomBytes31 } from "node:crypto";
|
|
752304
752537
|
function configHome() {
|
|
@@ -752314,7 +752547,7 @@ function bootstrapApiKeyFile() {
|
|
|
752314
752547
|
return fromEnv || join174(configHome(), "api.key");
|
|
752315
752548
|
}
|
|
752316
752549
|
function ensureDirFor(file) {
|
|
752317
|
-
const dir =
|
|
752550
|
+
const dir = dirname69(file);
|
|
752318
752551
|
if (!existsSync162(dir)) mkdirSync100(dir, { recursive: true });
|
|
752319
752552
|
}
|
|
752320
752553
|
function atomicWritePrivateFile(file, content) {
|
|
@@ -755489,7 +755722,7 @@ import {
|
|
|
755489
755722
|
statSync as statSync65,
|
|
755490
755723
|
writeFileSync as writeFileSync93
|
|
755491
755724
|
} from "node:fs";
|
|
755492
|
-
import { dirname as
|
|
755725
|
+
import { dirname as dirname70, join as join178, resolve as resolve82 } from "node:path";
|
|
755493
755726
|
import { platform as platform11 } from "node:os";
|
|
755494
755727
|
import { spawn as spawn44, spawnSync as spawnSync11 } from "node:child_process";
|
|
755495
755728
|
import { fileURLToPath as fileURLToPath30 } from "node:url";
|
|
@@ -755627,7 +755860,7 @@ async function runCommand(command, args, options2 = {}) {
|
|
|
755627
755860
|
});
|
|
755628
755861
|
}
|
|
755629
755862
|
function packageAssetPath(...segments) {
|
|
755630
|
-
const moduleDir =
|
|
755863
|
+
const moduleDir = dirname70(fileURLToPath30(import.meta.url));
|
|
755631
755864
|
const candidates = [
|
|
755632
755865
|
join178(moduleDir, "..", "assets", ...segments),
|
|
755633
755866
|
join178(moduleDir, "..", "..", "assets", ...segments)
|
|
@@ -755999,7 +756232,7 @@ function writeProfileMap(value2) {
|
|
|
755999
756232
|
if (Buffer.byteLength(serialized) > PROFILE_MAP_MAX_BYTES) {
|
|
756000
756233
|
throw new Error("Voicebox profile map exceeded its bounded storage limit");
|
|
756001
756234
|
}
|
|
756002
|
-
mkdirSync103(
|
|
756235
|
+
mkdirSync103(dirname70(profileMapPath()), { recursive: true });
|
|
756003
756236
|
const temporary = `${profileMapPath()}.tmp-${process.pid}-${Date.now()}`;
|
|
756004
756237
|
writeFileSync93(temporary, serialized, { mode: 384 });
|
|
756005
756238
|
renameSync32(temporary, profileMapPath());
|
|
@@ -756388,7 +756621,7 @@ import {
|
|
|
756388
756621
|
copyFileSync as copyFileSync6,
|
|
756389
756622
|
rmSync as rmSync17
|
|
756390
756623
|
} from "node:fs";
|
|
756391
|
-
import { basename as basename37, join as join179, dirname as
|
|
756624
|
+
import { basename as basename37, join as join179, dirname as dirname71, resolve as resolve83 } from "node:path";
|
|
756392
756625
|
import { homedir as homedir59, tmpdir as tmpdir26, platform as platform12 } from "node:os";
|
|
756393
756626
|
import {
|
|
756394
756627
|
spawn as nodeSpawn
|
|
@@ -756494,7 +756727,7 @@ function luxttsInferScript2() {
|
|
|
756494
756727
|
return join179(voiceDir2(), "luxtts-infer.py");
|
|
756495
756728
|
}
|
|
756496
756729
|
function resolveBundledVoiceAsset(relativePath2) {
|
|
756497
|
-
const moduleDir =
|
|
756730
|
+
const moduleDir = dirname71(fileURLToPath31(import.meta.url));
|
|
756498
756731
|
const candidates = [
|
|
756499
756732
|
// npm bundle: publish/dist/index.js -> publish/assets
|
|
756500
756733
|
join179(moduleDir, "..", "assets", relativePath2),
|
|
@@ -756594,7 +756827,7 @@ function consolidateVoiceDirs2() {
|
|
|
756594
756827
|
const c9 = join179(dir, ".omnius", "voice");
|
|
756595
756828
|
if (existsSync167(c9) && c9 !== globalVoice) candidates.add(c9);
|
|
756596
756829
|
prev = dir;
|
|
756597
|
-
dir =
|
|
756830
|
+
dir = dirname71(dir);
|
|
756598
756831
|
}
|
|
756599
756832
|
for (const root of COMMON_PROJECT_ROOTS) {
|
|
756600
756833
|
const rootDir3 = join179(homedir59(), root);
|
|
@@ -756787,21 +757020,21 @@ function insertTagAfterOpeningClause(text3, tag) {
|
|
|
756787
757020
|
return `<${tag}> ${text3}`;
|
|
756788
757021
|
}
|
|
756789
757022
|
function writeDetectTorchScript(targetPath) {
|
|
756790
|
-
const moduleDir =
|
|
757023
|
+
const moduleDir = dirname71(fileURLToPath31(import.meta.url));
|
|
756791
757024
|
const canonicalDetector = [
|
|
756792
757025
|
resolveBundledVoiceAsset("voice/detect-torch.py"),
|
|
756793
757026
|
join179(moduleDir, "..", "..", "..", "..", "scripts", "detect-torch.py")
|
|
756794
757027
|
].find((candidate) => Boolean(candidate && existsSync167(candidate)));
|
|
756795
757028
|
if (canonicalDetector) {
|
|
756796
757029
|
try {
|
|
756797
|
-
mkdirSync104(
|
|
757030
|
+
mkdirSync104(dirname71(targetPath), { recursive: true });
|
|
756798
757031
|
writeFileSync94(targetPath, readFileSync139(canonicalDetector), { mode: 493 });
|
|
756799
757032
|
return;
|
|
756800
757033
|
} catch {
|
|
756801
757034
|
}
|
|
756802
757035
|
}
|
|
756803
757036
|
try {
|
|
756804
|
-
mkdirSync104(
|
|
757037
|
+
mkdirSync104(dirname71(targetPath), { recursive: true });
|
|
756805
757038
|
} catch {
|
|
756806
757039
|
}
|
|
756807
757040
|
const script = `#!/usr/bin/env python3
|
|
@@ -761178,7 +761411,7 @@ import {
|
|
|
761178
761411
|
appendFileSync as appendFileSync18,
|
|
761179
761412
|
writeSync as writeSync5
|
|
761180
761413
|
} from "node:fs";
|
|
761181
|
-
import { basename as basename38, dirname as
|
|
761414
|
+
import { basename as basename38, dirname as dirname72, relative as relative25, join as join180 } from "node:path";
|
|
761182
761415
|
function omniusPinnedDependencyVersion(name10) {
|
|
761183
761416
|
const spec2 = OMNIUS_PINNED_DEPENDENCY_SPECS[name10];
|
|
761184
761417
|
if (!spec2) return null;
|
|
@@ -775093,7 +775326,7 @@ async function collectSponsorMediaStream(args) {
|
|
|
775093
775326
|
}
|
|
775094
775327
|
const safeName3 = basename38(artifact.filename).replace(/[^\w.-]/g, "_") || `artifact${defaultExtensionForMime(artifact.mime)}`;
|
|
775095
775328
|
const outputPath3 = join180(args.outputRoot, safeName3);
|
|
775096
|
-
mkdirSync105(
|
|
775329
|
+
mkdirSync105(dirname72(outputPath3), { recursive: true });
|
|
775097
775330
|
writeFileSync95(outputPath3, bytes3);
|
|
775098
775331
|
return { ok: true, path: outputPath3, metadata };
|
|
775099
775332
|
}
|
|
@@ -775594,14 +775827,14 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
775594
775827
|
if (models.length > 0) {
|
|
775595
775828
|
try {
|
|
775596
775829
|
const { writeFileSync: writeFileSync125, mkdirSync: mkdirSync142 } = await import("node:fs");
|
|
775597
|
-
const { join: join225, dirname:
|
|
775830
|
+
const { join: join225, dirname: dirname88 } = await import("node:path");
|
|
775598
775831
|
const cachePath2 = join225(
|
|
775599
775832
|
ctx3.repoRoot || process.cwd(),
|
|
775600
775833
|
".omnius",
|
|
775601
775834
|
"nexus",
|
|
775602
775835
|
"peer-models-cache.json"
|
|
775603
775836
|
);
|
|
775604
|
-
mkdirSync142(
|
|
775837
|
+
mkdirSync142(dirname88(cachePath2), { recursive: true });
|
|
775605
775838
|
writeFileSync125(
|
|
775606
775839
|
cachePath2,
|
|
775607
775840
|
JSON.stringify(
|
|
@@ -775677,14 +775910,14 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
775677
775910
|
);
|
|
775678
775911
|
try {
|
|
775679
775912
|
const { writeFileSync: writeFileSync125, mkdirSync: mkdirSync142 } = await import("node:fs");
|
|
775680
|
-
const { join: join225, dirname:
|
|
775913
|
+
const { join: join225, dirname: dirname88 } = await import("node:path");
|
|
775681
775914
|
const cachePath2 = join225(
|
|
775682
775915
|
ctx3.repoRoot || process.cwd(),
|
|
775683
775916
|
".omnius",
|
|
775684
775917
|
"nexus",
|
|
775685
775918
|
"peer-models-cache.json"
|
|
775686
775919
|
);
|
|
775687
|
-
mkdirSync142(
|
|
775920
|
+
mkdirSync142(dirname88(cachePath2), { recursive: true });
|
|
775688
775921
|
writeFileSync125(
|
|
775689
775922
|
cachePath2,
|
|
775690
775923
|
JSON.stringify(
|
|
@@ -776770,10 +777003,10 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
776770
777003
|
try {
|
|
776771
777004
|
const { createRequire: createRequire12 } = await import("node:module");
|
|
776772
777005
|
const { fileURLToPath: fileURLToPath38 } = await import("node:url");
|
|
776773
|
-
const { dirname:
|
|
777006
|
+
const { dirname: dirname88, join: join225 } = await import("node:path");
|
|
776774
777007
|
const { existsSync: existsSync208 } = await import("node:fs");
|
|
776775
777008
|
const req3 = createRequire12(import.meta.url);
|
|
776776
|
-
const thisDir =
|
|
777009
|
+
const thisDir = dirname88(fileURLToPath38(import.meta.url));
|
|
776777
777010
|
const candidates = [
|
|
776778
777011
|
join225(thisDir, "..", "package.json"),
|
|
776779
777012
|
join225(thisDir, "..", "..", "package.json"),
|
|
@@ -784243,7 +784476,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
784243
784476
|
|
|
784244
784477
|
// packages/cli/src/tui/promptLoader.ts
|
|
784245
784478
|
import { readFileSync as readFileSync147, existsSync as existsSync176 } from "node:fs";
|
|
784246
|
-
import { join as join188, dirname as
|
|
784479
|
+
import { join as join188, dirname as dirname74 } from "node:path";
|
|
784247
784480
|
import { fileURLToPath as fileURLToPath32 } from "node:url";
|
|
784248
784481
|
function loadPrompt3(promptPath, vars) {
|
|
784249
784482
|
let content = cache7.get(promptPath);
|
|
@@ -784262,7 +784495,7 @@ var __filename5, __dirname6, devPath, publishedPath, PROMPTS_DIR3, cache7;
|
|
|
784262
784495
|
var init_promptLoader3 = __esm({
|
|
784263
784496
|
"packages/cli/src/tui/promptLoader.ts"() {
|
|
784264
784497
|
__filename5 = fileURLToPath32(import.meta.url);
|
|
784265
|
-
__dirname6 =
|
|
784498
|
+
__dirname6 = dirname74(__filename5);
|
|
784266
784499
|
devPath = join188(__dirname6, "..", "..", "prompts");
|
|
784267
784500
|
publishedPath = join188(__dirname6, "..", "prompts");
|
|
784268
784501
|
PROMPTS_DIR3 = existsSync176(devPath) ? devPath : publishedPath;
|
|
@@ -789439,7 +789672,7 @@ import {
|
|
|
789439
789672
|
unlinkSync as unlinkSync45,
|
|
789440
789673
|
writeFileSync as writeFileSync104
|
|
789441
789674
|
} from "node:fs";
|
|
789442
|
-
import { dirname as
|
|
789675
|
+
import { dirname as dirname75, join as join193 } from "node:path";
|
|
789443
789676
|
import { randomBytes as randomBytes33 } from "node:crypto";
|
|
789444
789677
|
function finiteNonNegativeInteger(value2, name10) {
|
|
789445
789678
|
if (!Number.isSafeInteger(value2) || value2 < 0) {
|
|
@@ -789531,7 +789764,7 @@ var init_telegram_poll_health = __esm({
|
|
|
789531
789764
|
}
|
|
789532
789765
|
write(state5) {
|
|
789533
789766
|
if (!isPollHealth(state5)) throw new TypeError("Invalid Telegram poll health");
|
|
789534
|
-
mkdirSync115(
|
|
789767
|
+
mkdirSync115(dirname75(this.filePath), { recursive: true });
|
|
789535
789768
|
const temporaryPath = `${this.filePath}.${process.pid}.${randomBytes33(8).toString("hex")}.tmp`;
|
|
789536
789769
|
let fd;
|
|
789537
789770
|
try {
|
|
@@ -789543,7 +789776,7 @@ var init_telegram_poll_health = __esm({
|
|
|
789543
789776
|
fd = void 0;
|
|
789544
789777
|
renameSync36(temporaryPath, this.filePath);
|
|
789545
789778
|
try {
|
|
789546
|
-
const directoryFd = openSync15(
|
|
789779
|
+
const directoryFd = openSync15(dirname75(this.filePath), "r");
|
|
789547
789780
|
try {
|
|
789548
789781
|
fsyncSync4(directoryFd);
|
|
789549
789782
|
} finally {
|
|
@@ -789762,7 +789995,7 @@ var init_telegram_input_ownership = __esm({
|
|
|
789762
789995
|
// packages/cli/src/tui/telegram-update-spool.ts
|
|
789763
789996
|
import Database from "better-sqlite3";
|
|
789764
789997
|
import { mkdirSync as mkdirSync116 } from "node:fs";
|
|
789765
|
-
import { dirname as
|
|
789998
|
+
import { dirname as dirname76 } from "node:path";
|
|
789766
789999
|
function safeInteger2(value2, name10) {
|
|
789767
790000
|
if (!Number.isSafeInteger(value2) || value2 < 0) {
|
|
789768
790001
|
throw new TelegramUpdateEnvelopeError(
|
|
@@ -789948,7 +790181,7 @@ var init_telegram_update_spool = __esm({
|
|
|
789948
790181
|
TelegramUpdateSpool = class {
|
|
789949
790182
|
constructor(dbPath) {
|
|
789950
790183
|
this.dbPath = dbPath;
|
|
789951
|
-
mkdirSync116(
|
|
790184
|
+
mkdirSync116(dirname76(dbPath), { recursive: true });
|
|
789952
790185
|
this.db = new Database(dbPath);
|
|
789953
790186
|
this.db.pragma("journal_mode = WAL");
|
|
789954
790187
|
this.db.pragma("synchronous = FULL");
|
|
@@ -791407,7 +791640,7 @@ import {
|
|
|
791407
791640
|
unlinkSync as unlinkSync46,
|
|
791408
791641
|
writeFileSync as writeFileSync105
|
|
791409
791642
|
} from "node:fs";
|
|
791410
|
-
import { dirname as
|
|
791643
|
+
import { dirname as dirname77, join as join194, resolve as resolve89 } from "node:path";
|
|
791411
791644
|
function clip3(text3, limit2) {
|
|
791412
791645
|
const compact6 = text3.replace(/\s+/g, " ").trim();
|
|
791413
791646
|
return compact6.length <= limit2 ? compact6 : `${compact6.slice(0, Math.max(0, limit2 - 3)).trimEnd()}...`;
|
|
@@ -791538,7 +791771,7 @@ function loadTelegramOutputPatternMemory(scope) {
|
|
|
791538
791771
|
}
|
|
791539
791772
|
function saveTelegramOutputPatternMemory(scope, memory) {
|
|
791540
791773
|
const paths = telegramOutputPatternMemoryPaths(scope);
|
|
791541
|
-
mkdirSync117(
|
|
791774
|
+
mkdirSync117(dirname77(paths.json), { recursive: true });
|
|
791542
791775
|
const temporaryPath = `${paths.json}.${process.pid}.${randomBytes34(6).toString("hex")}.tmp`;
|
|
791543
791776
|
try {
|
|
791544
791777
|
writeFileSync105(temporaryPath, `${JSON.stringify(memory, null, 2)}
|
|
@@ -791557,7 +791790,7 @@ function saveTelegramOutputPatternMemory(scope, memory) {
|
|
|
791557
791790
|
}
|
|
791558
791791
|
function appendEvent(scope, event) {
|
|
791559
791792
|
const paths = telegramOutputPatternMemoryPaths(scope);
|
|
791560
|
-
mkdirSync117(
|
|
791793
|
+
mkdirSync117(dirname77(paths.events), { recursive: true });
|
|
791561
791794
|
appendFileSync22(
|
|
791562
791795
|
paths.events,
|
|
791563
791796
|
`${JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...event })}
|
|
@@ -792538,13 +792771,13 @@ import {
|
|
|
792538
792771
|
} from "node:fs";
|
|
792539
792772
|
import {
|
|
792540
792773
|
basename as basename47,
|
|
792541
|
-
dirname as
|
|
792774
|
+
dirname as dirname78,
|
|
792542
792775
|
extname as extname24,
|
|
792543
|
-
isAbsolute as
|
|
792776
|
+
isAbsolute as isAbsolute24,
|
|
792544
792777
|
join as join196,
|
|
792545
792778
|
relative as relative26,
|
|
792546
792779
|
resolve as resolve90,
|
|
792547
|
-
sep as
|
|
792780
|
+
sep as sep12
|
|
792548
792781
|
} from "node:path";
|
|
792549
792782
|
function optionalHttpsReceiptUrl(value2, label) {
|
|
792550
792783
|
if (value2 === void 0) return void 0;
|
|
@@ -792578,11 +792811,11 @@ function ledgerPath(root) {
|
|
|
792578
792811
|
return join196(resolve90(root), LEDGER_FILE2);
|
|
792579
792812
|
}
|
|
792580
792813
|
function signingKeyPath(root) {
|
|
792581
|
-
return join196(
|
|
792814
|
+
return join196(dirname78(resolve90(root)), KEY_FILE);
|
|
792582
792815
|
}
|
|
792583
792816
|
function readSigningKey(root) {
|
|
792584
792817
|
const path16 = signingKeyPath(root);
|
|
792585
|
-
mkdirSync118(
|
|
792818
|
+
mkdirSync118(dirname78(path16), { recursive: true });
|
|
792586
792819
|
if (!existsSync182(path16)) {
|
|
792587
792820
|
writeFileSync106(path16, randomBytes36(32), { mode: 384, flag: "wx" });
|
|
792588
792821
|
}
|
|
@@ -792684,7 +792917,7 @@ function assertLogicalPath(root, logicalPath2) {
|
|
|
792684
792917
|
const rootAbs = resolve90(root);
|
|
792685
792918
|
const abs = resolve90(rootAbs, logicalPath2);
|
|
792686
792919
|
const rel = relative26(rootAbs, abs);
|
|
792687
|
-
if (!logicalPath2.trim() || rel === "" || rel.startsWith("..") || resolve90(abs) === rootAbs || !abs.startsWith(rootAbs.endsWith(
|
|
792920
|
+
if (!logicalPath2.trim() || rel === "" || rel.startsWith("..") || resolve90(abs) === rootAbs || !abs.startsWith(rootAbs.endsWith(sep12) ? rootAbs : rootAbs + sep12)) {
|
|
792688
792921
|
throw new Error("Artifact path escapes the Telegram creative workspace");
|
|
792689
792922
|
}
|
|
792690
792923
|
if (basename47(abs).startsWith(".omnius-")) {
|
|
@@ -792861,7 +793094,7 @@ function registerTelegramArtifactCapability(args) {
|
|
|
792861
793094
|
}
|
|
792862
793095
|
function getTelegramArtifactCapability(root, capabilityOrArtifactId) {
|
|
792863
793096
|
const ledger = readLedger(root);
|
|
792864
|
-
const lookupPath =
|
|
793097
|
+
const lookupPath = isAbsolute24(capabilityOrArtifactId) ? relative26(resolve90(root), resolve90(capabilityOrArtifactId)).replace(
|
|
792865
793098
|
/\\/g,
|
|
792866
793099
|
"/"
|
|
792867
793100
|
) : capabilityOrArtifactId.replace(/\\/g, "/");
|
|
@@ -793086,14 +793319,14 @@ import {
|
|
|
793086
793319
|
mkdirSync as mkdirSync119,
|
|
793087
793320
|
readdirSync as readdirSync63,
|
|
793088
793321
|
readFileSync as readFileSync154,
|
|
793089
|
-
realpathSync as
|
|
793322
|
+
realpathSync as realpathSync3,
|
|
793090
793323
|
renameSync as renameSync39,
|
|
793091
793324
|
rmSync as rmSync22,
|
|
793092
793325
|
statSync as statSync70,
|
|
793093
793326
|
unlinkSync as unlinkSync48,
|
|
793094
793327
|
writeFileSync as writeFileSync107
|
|
793095
793328
|
} from "node:fs";
|
|
793096
|
-
import { basename as basename48, dirname as
|
|
793329
|
+
import { basename as basename48, dirname as dirname79, join as join197, relative as relative27, resolve as resolve91, sep as sep13 } from "node:path";
|
|
793097
793330
|
function positiveSafeInteger(value2, fallback, label) {
|
|
793098
793331
|
const resolved = value2 ?? fallback;
|
|
793099
793332
|
if (!Number.isSafeInteger(resolved) || resolved < 1) {
|
|
@@ -793112,7 +793345,7 @@ function runKey(runId) {
|
|
|
793112
793345
|
}
|
|
793113
793346
|
function isInside(root, candidate) {
|
|
793114
793347
|
const rel = relative27(root, candidate);
|
|
793115
|
-
return rel === "" || !rel.startsWith(`..${
|
|
793348
|
+
return rel === "" || !rel.startsWith(`..${sep13}`) && rel !== "..";
|
|
793116
793349
|
}
|
|
793117
793350
|
function atomicWriteJson2(path16, value2) {
|
|
793118
793351
|
const staged = `${path16}.${randomBytes37(8).toString("hex")}.tmp`;
|
|
@@ -793144,17 +793377,17 @@ function readReceipt(root) {
|
|
|
793144
793377
|
}
|
|
793145
793378
|
}
|
|
793146
793379
|
function assertDeletableRun(runsRoot, candidate) {
|
|
793147
|
-
const canonicalRuns =
|
|
793380
|
+
const canonicalRuns = realpathSync3(runsRoot);
|
|
793148
793381
|
const lexical = resolve91(candidate);
|
|
793149
|
-
if (!isInside(canonicalRuns, lexical) ||
|
|
793382
|
+
if (!isInside(canonicalRuns, lexical) || dirname79(lexical) !== canonicalRuns) {
|
|
793150
793383
|
throw new Error("Refusing to clean an artifact path outside the run root");
|
|
793151
793384
|
}
|
|
793152
793385
|
const info = lstatSync5(lexical);
|
|
793153
793386
|
if (info.isSymbolicLink() || !info.isDirectory()) {
|
|
793154
793387
|
throw new Error("Refusing to clean a non-directory or symbolic-link run path");
|
|
793155
793388
|
}
|
|
793156
|
-
const canonicalCandidate =
|
|
793157
|
-
if (
|
|
793389
|
+
const canonicalCandidate = realpathSync3(lexical);
|
|
793390
|
+
if (dirname79(canonicalCandidate) !== canonicalRuns) {
|
|
793158
793391
|
throw new Error("Refusing to clean a run directory that resolves outside its parent");
|
|
793159
793392
|
}
|
|
793160
793393
|
}
|
|
@@ -793281,7 +793514,7 @@ function usageWalk(root, current) {
|
|
|
793281
793514
|
throw new Error("Symbolic links are not allowed in Telegram artifact runs");
|
|
793282
793515
|
}
|
|
793283
793516
|
if (info.isDirectory()) {
|
|
793284
|
-
const canonical3 =
|
|
793517
|
+
const canonical3 = realpathSync3(path16);
|
|
793285
793518
|
if (!isInside(root, canonical3)) {
|
|
793286
793519
|
throw new Error("Artifact run directory resolves outside its root");
|
|
793287
793520
|
}
|
|
@@ -793302,7 +793535,7 @@ function telegramArtifactRunUsage(root) {
|
|
|
793302
793535
|
const resolved = resolve91(root);
|
|
793303
793536
|
const receipt2 = readReceipt(resolved);
|
|
793304
793537
|
if (!receipt2) throw new Error("Telegram artifact run receipt is missing or invalid");
|
|
793305
|
-
return usageWalk(
|
|
793538
|
+
return usageWalk(realpathSync3(resolved), resolved);
|
|
793306
793539
|
}
|
|
793307
793540
|
function assertTelegramArtifactRunQuota(root, additionalBytes = 0, additionalArtifacts = 0) {
|
|
793308
793541
|
if (!Number.isSafeInteger(additionalBytes) || additionalBytes < 0) {
|
|
@@ -793351,7 +793584,7 @@ import {
|
|
|
793351
793584
|
existsSync as existsSync184,
|
|
793352
793585
|
lstatSync as lstatSync6,
|
|
793353
793586
|
mkdirSync as mkdirSync120,
|
|
793354
|
-
realpathSync as
|
|
793587
|
+
realpathSync as realpathSync4,
|
|
793355
793588
|
renameSync as renameSync40,
|
|
793356
793589
|
readFileSync as readFileSync155,
|
|
793357
793590
|
rmSync as rmSync23,
|
|
@@ -793363,13 +793596,13 @@ import {
|
|
|
793363
793596
|
import { mkdir as mkdir28 } from "node:fs/promises";
|
|
793364
793597
|
import {
|
|
793365
793598
|
basename as basename49,
|
|
793366
|
-
dirname as
|
|
793599
|
+
dirname as dirname80,
|
|
793367
793600
|
extname as extname25,
|
|
793368
|
-
isAbsolute as
|
|
793601
|
+
isAbsolute as isAbsolute25,
|
|
793369
793602
|
join as join198,
|
|
793370
793603
|
relative as relative28,
|
|
793371
793604
|
resolve as resolve92,
|
|
793372
|
-
sep as
|
|
793605
|
+
sep as sep14
|
|
793373
793606
|
} from "node:path";
|
|
793374
793607
|
function telegramCreativeWorkspaceRoot(repoRoot, chatId) {
|
|
793375
793608
|
const raw = chatId === void 0 ? "unknown" : String(chatId);
|
|
@@ -793746,7 +793979,7 @@ function scopedTool(base3, root, mode, onCreatedArtifact) {
|
|
|
793746
793979
|
guarded.path.rel
|
|
793747
793980
|
);
|
|
793748
793981
|
if (!materialized.ok) return denied2(materialized.error);
|
|
793749
|
-
mkdirSync120(
|
|
793982
|
+
mkdirSync120(dirname80(guarded.path.abs), { recursive: true });
|
|
793750
793983
|
writeFileSync108(guarded.path.abs, readFileSync155(materialized.path));
|
|
793751
793984
|
materialized.cleanup?.();
|
|
793752
793985
|
restoredEditPath = guarded.path.abs;
|
|
@@ -794028,12 +794261,12 @@ function scopedArtifactTool(base3, root, kind, onCreatedArtifact) {
|
|
|
794028
794261
|
}
|
|
794029
794262
|
function ensureScopedOutputParent(root, outputPath3) {
|
|
794030
794263
|
const rootAbs = resolve92(root);
|
|
794031
|
-
const parent =
|
|
794264
|
+
const parent = dirname80(resolve92(outputPath3));
|
|
794032
794265
|
if (!isInside2(rootAbs, parent)) {
|
|
794033
794266
|
throw new Error("Output parent escapes the scoped creative workspace.");
|
|
794034
794267
|
}
|
|
794035
794268
|
let cursor = rootAbs;
|
|
794036
|
-
for (const segment of relative28(rootAbs, parent).split(
|
|
794269
|
+
for (const segment of relative28(rootAbs, parent).split(sep14).filter(Boolean)) {
|
|
794037
794270
|
cursor = join198(cursor, segment);
|
|
794038
794271
|
if (existsSync184(cursor)) {
|
|
794039
794272
|
const info = lstatSync6(cursor);
|
|
@@ -794128,7 +794361,7 @@ function guardPath(root, rawPath) {
|
|
|
794128
794361
|
};
|
|
794129
794362
|
}
|
|
794130
794363
|
const rel = relative28(rootAbs, abs) || ".";
|
|
794131
|
-
if (rel.startsWith("..") ||
|
|
794364
|
+
if (rel.startsWith("..") || isAbsolute25(rel)) {
|
|
794132
794365
|
return {
|
|
794133
794366
|
ok: false,
|
|
794134
794367
|
error: `Path escapes the public creative workspace. Use a relative path under ${rootAbs}.`
|
|
@@ -794146,7 +794379,7 @@ function guardPath(root, rawPath) {
|
|
|
794146
794379
|
function isInside2(root, path16) {
|
|
794147
794380
|
const rootAbs = resolve92(root);
|
|
794148
794381
|
const pathAbs = resolve92(path16);
|
|
794149
|
-
return pathAbs === rootAbs || pathAbs.startsWith(rootAbs.endsWith(
|
|
794382
|
+
return pathAbs === rootAbs || pathAbs.startsWith(rootAbs.endsWith(sep14) ? rootAbs : rootAbs + sep14);
|
|
794150
794383
|
}
|
|
794151
794384
|
function looksLikeLocalPath(value2) {
|
|
794152
794385
|
return value2.startsWith("/") || value2.startsWith("./") || value2.startsWith("../");
|
|
@@ -794447,7 +794680,7 @@ function safeScopedRegularFile(root, path16) {
|
|
|
794447
794680
|
error: "Scoped artifacts must be regular files, not links or directories."
|
|
794448
794681
|
};
|
|
794449
794682
|
}
|
|
794450
|
-
const canonical3 =
|
|
794683
|
+
const canonical3 = realpathSync4(path16);
|
|
794451
794684
|
if (!isInside2(lexicalRoot, canonical3)) {
|
|
794452
794685
|
return {
|
|
794453
794686
|
ok: false,
|
|
@@ -794886,7 +795119,7 @@ var init_telegram_creative_tools = __esm({
|
|
|
794886
795119
|
stage: "setup",
|
|
794887
795120
|
message: "Preparing scoped TTS audio file"
|
|
794888
795121
|
});
|
|
794889
|
-
await mkdir28(
|
|
795122
|
+
await mkdir28(dirname80(guarded.path.abs), { recursive: true });
|
|
794890
795123
|
const tts = new TtsGenerateTool();
|
|
794891
795124
|
this.emitProgress(start2, {
|
|
794892
795125
|
stage: "load",
|
|
@@ -801054,11 +801287,11 @@ import {
|
|
|
801054
801287
|
} from "node:fs";
|
|
801055
801288
|
import {
|
|
801056
801289
|
join as join203,
|
|
801057
|
-
dirname as
|
|
801290
|
+
dirname as dirname81,
|
|
801058
801291
|
resolve as resolve94,
|
|
801059
801292
|
basename as basename51,
|
|
801060
801293
|
relative as relative29,
|
|
801061
|
-
isAbsolute as
|
|
801294
|
+
isAbsolute as isAbsolute26,
|
|
801062
801295
|
extname as extname27
|
|
801063
801296
|
} from "node:path";
|
|
801064
801297
|
import { homedir as homedir62 } from "node:os";
|
|
@@ -801529,6 +801762,9 @@ function telegramStreamFailureAllowsUnaryFallback(err) {
|
|
|
801529
801762
|
text3
|
|
801530
801763
|
);
|
|
801531
801764
|
}
|
|
801765
|
+
function telegramUnaryCompatibilityLogicalRequestId(streamLogicalRequestId) {
|
|
801766
|
+
return `telegram:unary-compat:${createHash91("sha256").update(streamLogicalRequestId).digest("hex").slice(0, 24)}`;
|
|
801767
|
+
}
|
|
801532
801768
|
function telegramRouterErrorText(err) {
|
|
801533
801769
|
return err instanceof Error ? err.message : String(err);
|
|
801534
801770
|
}
|
|
@@ -803558,7 +803794,7 @@ function telegramCachedMediaIsVideo(entry) {
|
|
|
803558
803794
|
}
|
|
803559
803795
|
function isPathInside3(root, path16) {
|
|
803560
803796
|
const rel = relative29(resolve94(root), resolve94(path16));
|
|
803561
|
-
return rel === "" || Boolean(rel) && !rel.startsWith("..") && !
|
|
803797
|
+
return rel === "" || Boolean(rel) && !rel.startsWith("..") && !isAbsolute26(rel);
|
|
803562
803798
|
}
|
|
803563
803799
|
function extractTelegramMentionedActors(message2, text3) {
|
|
803564
803800
|
const actors = /* @__PURE__ */ new Map();
|
|
@@ -804792,7 +805028,7 @@ Telegram link integrity contract:
|
|
|
804792
805028
|
TELEGRAM_PRIVATE_COALESCE_MS = 350;
|
|
804793
805029
|
TELEGRAM_SESSION_MAX_HOLD_MS = 5e3;
|
|
804794
805030
|
TELEGRAM_PEER_BOT_COALESCE_MS = 3500;
|
|
804795
|
-
TELEGRAM_PEER_BOT_MAX_HOLD_MS =
|
|
805031
|
+
TELEGRAM_PEER_BOT_MAX_HOLD_MS = 6e4;
|
|
804796
805032
|
TELEGRAM_ADMIN_LIVE_PANEL_PAGES = [
|
|
804797
805033
|
"response",
|
|
804798
805034
|
"tasks",
|
|
@@ -807328,7 +807564,7 @@ ${context2}` : context2;
|
|
|
807328
807564
|
appendTelegramIntakeJournal(sessionKey, entry) {
|
|
807329
807565
|
const write2 = async () => {
|
|
807330
807566
|
const path16 = this.telegramIntakePath(sessionKey);
|
|
807331
|
-
await mkdirAsync(
|
|
807567
|
+
await mkdirAsync(dirname81(path16), { recursive: true });
|
|
807332
807568
|
await appendFileAsync(path16, `${JSON.stringify(entry)}
|
|
807333
807569
|
`, "utf8");
|
|
807334
807570
|
};
|
|
@@ -810902,7 +811138,14 @@ ${JSON.stringify(modelFollowupProposals, null, 2)}`,
|
|
|
810902
811138
|
],
|
|
810903
811139
|
tools: [],
|
|
810904
811140
|
temperature: 0.2,
|
|
810905
|
-
|
|
811141
|
+
// The contract permits up to 700 characters of message text plus
|
|
811142
|
+
// evidence IDs and decision metadata. A 300-token ceiling can end
|
|
811143
|
+
// at `finish=length` before a complete JSON object exists.
|
|
811144
|
+
maxTokens: 1024,
|
|
811145
|
+
// Ollama's OpenAI-compatible renderer can spend the full token
|
|
811146
|
+
// budget in hidden reasoning even with think:false. Native chat
|
|
811147
|
+
// enforces direct-answer mode and avoids an empty-stream fallback.
|
|
811148
|
+
preferNativeOllamaChat: this.agentConfig.backendType === "ollama",
|
|
810906
811149
|
timeoutMs: Math.min(
|
|
810907
811150
|
Math.max(this.agentConfig.timeoutMs ?? 3e4, 5e3),
|
|
810908
811151
|
2e4
|
|
@@ -811266,7 +811509,7 @@ ${JSON.stringify(modelFollowupProposals, null, 2)}`,
|
|
|
811266
811509
|
if (existing) {
|
|
811267
811510
|
if (existing.mode === "ambient" || mode !== "ambient")
|
|
811268
811511
|
existing.mode = mode;
|
|
811269
|
-
if (useOverride || !existing.text || existing.text === "[non-text Telegram message]" || _TelegramBridge.isSyntheticMemoryText(existing.text)) {
|
|
811512
|
+
if (msg.sourceUpdateType === "edited_message" || useOverride || !existing.text || existing.text === "[non-text Telegram message]" || _TelegramBridge.isSyntheticMemoryText(existing.text)) {
|
|
811270
811513
|
existing.text = text3;
|
|
811271
811514
|
}
|
|
811272
811515
|
existing.speaker = existing.speaker || telegramSpeakerLabel(msg);
|
|
@@ -811541,7 +811784,7 @@ ${JSON.stringify(modelFollowupProposals, null, 2)}`,
|
|
|
811541
811784
|
return false;
|
|
811542
811785
|
});
|
|
811543
811786
|
if (matchingEntry) return { ok: true, path: matchingEntry.localPath };
|
|
811544
|
-
const creativeCandidate =
|
|
811787
|
+
const creativeCandidate = isAbsolute26(raw) ? resolve94(raw) : resolve94(creativeRoot, raw);
|
|
811545
811788
|
if (isPathInside3(creativeRoot, creativeCandidate)) {
|
|
811546
811789
|
const materialized = materializeTelegramCreativeArtifactForSend(
|
|
811547
811790
|
creativeRoot,
|
|
@@ -811680,7 +811923,7 @@ ${JSON.stringify(modelFollowupProposals, null, 2)}`,
|
|
|
811680
811923
|
const repoRoot = this.repoRoot || ".";
|
|
811681
811924
|
const creativeRoot = telegramCreativeWorkspaceRoot(repoRoot, chatId);
|
|
811682
811925
|
const raw = String(rawValue || fallbackName).trim() || fallbackName;
|
|
811683
|
-
const outputPath3 =
|
|
811926
|
+
const outputPath3 = isAbsolute26(raw) ? resolve94(raw) : resolve94(creativeRoot, raw);
|
|
811684
811927
|
if (!isPathInside3(creativeRoot, outputPath3)) {
|
|
811685
811928
|
return {
|
|
811686
811929
|
ok: false,
|
|
@@ -813591,7 +813834,15 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
|
813591
813834
|
id2,
|
|
813592
813835
|
`stream protocol did not return a usable contract; using one unary compatibility request: ${streamErr instanceof Error ? streamErr.message : String(streamErr)}`
|
|
813593
813836
|
);
|
|
813594
|
-
|
|
813837
|
+
const unaryCompatibilityRequest = {
|
|
813838
|
+
...requestWithCtx,
|
|
813839
|
+
logicalRequestId: telegramUnaryCompatibilityLogicalRequestId(
|
|
813840
|
+
logicalRequestId
|
|
813841
|
+
)
|
|
813842
|
+
};
|
|
813843
|
+
result = await backend.chatCompletion(
|
|
813844
|
+
unaryCompatibilityRequest
|
|
813845
|
+
);
|
|
813595
813846
|
this.updateTelegramInferenceFinal(id2, result);
|
|
813596
813847
|
this.tuiWrite(
|
|
813597
813848
|
() => renderTelegramSubAgentEvent(
|
|
@@ -816062,7 +816313,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
816062
816313
|
}
|
|
816063
816314
|
try {
|
|
816064
816315
|
this.telegramUpdateSpool = new TelegramUpdateSpool(
|
|
816065
|
-
join203(
|
|
816316
|
+
join203(dirname81(healthPath), `bot-${botUserId}.updates.sqlite`)
|
|
816066
816317
|
);
|
|
816067
816318
|
const snapshot = this.telegramUpdateSpool.snapshot();
|
|
816068
816319
|
if (this.telegramDurableIntakeConfig.authoritative) {
|
|
@@ -817803,6 +818054,18 @@ ${signals || summary || "Canonical runner status reported completed."}`
|
|
|
817803
818054
|
await this.handleTelegramInterruptionSlash(msg, slashInvocation);
|
|
817804
818055
|
return;
|
|
817805
818056
|
}
|
|
818057
|
+
if (msg.sourceUpdateType === "edited_message") {
|
|
818058
|
+
const inputId2 = this.telegramInputIdForMessage(msg);
|
|
818059
|
+
const existingIntake = this.telegramIntakeRecords.get(inputId2);
|
|
818060
|
+
if (existingIntake) {
|
|
818061
|
+
this.recordTelegramUserMessage(msg, "ambient", void 0, {
|
|
818062
|
+
cognition: false
|
|
818063
|
+
});
|
|
818064
|
+
await this.consolidateTelegramEditedIntake(msg, existingIntake);
|
|
818065
|
+
releaseIngress();
|
|
818066
|
+
return;
|
|
818067
|
+
}
|
|
818068
|
+
}
|
|
817806
818069
|
const outputPatternMatch = this.consumeTelegramDurableOutputPattern(msg);
|
|
817807
818070
|
if (outputPatternMatch.ignored && outputPatternMatch.pattern) {
|
|
817808
818071
|
this.recordTelegramUserMessage(msg, "ambient", void 0, {
|
|
@@ -825424,7 +825687,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
825424
825687
|
const base3 = scopedRoot ? resolve94(scopedRoot) : resolve94(repoRoot);
|
|
825425
825688
|
const trimmed = rawPath.trim().replace(/^["']|["']$/g, "");
|
|
825426
825689
|
if (scopedRoot) {
|
|
825427
|
-
const logicalPath2 =
|
|
825690
|
+
const logicalPath2 = isAbsolute26(trimmed) ? resolve94(trimmed) : resolve94(base3, trimmed);
|
|
825428
825691
|
if (!isPathInside3(base3, logicalPath2)) {
|
|
825429
825692
|
return {
|
|
825430
825693
|
ok: false,
|
|
@@ -825438,7 +825701,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
825438
825701
|
if (!materialized.ok) return materialized;
|
|
825439
825702
|
return { ...materialized, logicalPath: logicalPath2 };
|
|
825440
825703
|
}
|
|
825441
|
-
const abs =
|
|
825704
|
+
const abs = isAbsolute26(trimmed) ? resolve94(trimmed) : resolve94(base3, trimmed);
|
|
825442
825705
|
if (!existsSync189(abs))
|
|
825443
825706
|
return { ok: false, error: `File does not exist: ${trimmed}` };
|
|
825444
825707
|
if (!statSync72(abs).isFile())
|
|
@@ -830452,7 +830715,7 @@ var init_clipboard_media = __esm({
|
|
|
830452
830715
|
|
|
830453
830716
|
// packages/cli/src/tui/interactive.ts
|
|
830454
830717
|
import { cwd } from "node:process";
|
|
830455
|
-
import { resolve as resolve96, join as join206, dirname as
|
|
830718
|
+
import { resolve as resolve96, join as join206, dirname as dirname82, extname as extname28, relative as relative30, sep as sep15 } from "node:path";
|
|
830456
830719
|
import { createRequire as createRequire9 } from "node:module";
|
|
830457
830720
|
import { fileURLToPath as fileURLToPath33 } from "node:url";
|
|
830458
830721
|
import { createHash as createHash92 } from "node:crypto";
|
|
@@ -830513,7 +830776,7 @@ function formatTimeAgo2(date) {
|
|
|
830513
830776
|
function getVersion3() {
|
|
830514
830777
|
try {
|
|
830515
830778
|
const require5 = createRequire9(import.meta.url);
|
|
830516
|
-
const thisDir =
|
|
830779
|
+
const thisDir = dirname82(fileURLToPath33(import.meta.url));
|
|
830517
830780
|
const candidates = [
|
|
830518
830781
|
join206(thisDir, "..", "package.json"),
|
|
830519
830782
|
join206(thisDir, "..", "..", "package.json"),
|
|
@@ -836954,9 +837217,9 @@ This is an independent background session started from /background.`
|
|
|
836954
837217
|
const kind = partial.slice(0, colonIndex);
|
|
836955
837218
|
const value2 = partial.slice(colonIndex + 1);
|
|
836956
837219
|
if ((kind === "file" || kind === "folder") && value2) {
|
|
836957
|
-
const
|
|
836958
|
-
const searchDir =
|
|
836959
|
-
const partialName =
|
|
837220
|
+
const isAbsolute27 = value2.startsWith("/");
|
|
837221
|
+
const searchDir = isAbsolute27 ? value2.lastIndexOf("/") > 0 ? value2.slice(0, value2.lastIndexOf("/") + 1) : "/" : repoRoot;
|
|
837222
|
+
const partialName = isAbsolute27 ? value2.slice(value2.lastIndexOf("/") + 1) : value2.includes("/") ? value2.slice(value2.lastIndexOf("/") + 1) : value2;
|
|
836960
837223
|
let entries2;
|
|
836961
837224
|
try {
|
|
836962
837225
|
entries2 = readdirSync66(searchDir);
|
|
@@ -836970,7 +837233,7 @@ This is an independent background session started from /background.`
|
|
|
836970
837233
|
try {
|
|
836971
837234
|
const st = statSync74(full);
|
|
836972
837235
|
const suffix = st.isDirectory() ? "/" : "";
|
|
836973
|
-
const display =
|
|
837236
|
+
const display = isAbsolute27 ? full : full.startsWith(repoRoot + sep15) ? full.slice(repoRoot.length + 1) : full;
|
|
836974
837237
|
completions.push(display + suffix);
|
|
836975
837238
|
} catch {
|
|
836976
837239
|
}
|
|
@@ -843497,7 +843760,7 @@ var init_project_preferences = __esm({
|
|
|
843497
843760
|
import { spawn as spawn46 } from "node:child_process";
|
|
843498
843761
|
import { existsSync as existsSync195, mkdirSync as mkdirSync130, readFileSync as readFileSync166, statSync as statSync76, writeFileSync as writeFileSync117 } from "node:fs";
|
|
843499
843762
|
import { homedir as homedir67 } from "node:os";
|
|
843500
|
-
import { dirname as
|
|
843763
|
+
import { dirname as dirname83, join as join210 } from "node:path";
|
|
843501
843764
|
import { fileURLToPath as fileURLToPath34 } from "node:url";
|
|
843502
843765
|
import { createHash as createHash94 } from "node:crypto";
|
|
843503
843766
|
function home() {
|
|
@@ -843891,7 +844154,7 @@ var MODULE_DIR2, RUNTIME_VERSION5, MODEL, PRETRAINED, MODEL_REPOSITORY, MODEL_RE
|
|
|
843891
844154
|
var init_vision_embedding_runtime = __esm({
|
|
843892
844155
|
"packages/cli/src/api/vision-embedding-runtime.ts"() {
|
|
843893
844156
|
init_dist5();
|
|
843894
|
-
MODULE_DIR2 =
|
|
844157
|
+
MODULE_DIR2 = dirname83(fileURLToPath34(import.meta.url));
|
|
843895
844158
|
RUNTIME_VERSION5 = 4;
|
|
843896
844159
|
MODEL = "ViT-B-32";
|
|
843897
844160
|
PRETRAINED = "laion2b_s34b_b79k";
|
|
@@ -844489,7 +844752,7 @@ var init_audit_log = __esm({
|
|
|
844489
844752
|
// packages/cli/src/api/disk-task-output.ts
|
|
844490
844753
|
import { open as open6 } from "node:fs/promises";
|
|
844491
844754
|
import { existsSync as existsSync198, mkdirSync as mkdirSync133, statSync as statSync77 } from "node:fs";
|
|
844492
|
-
import { dirname as
|
|
844755
|
+
import { dirname as dirname84 } from "node:path";
|
|
844493
844756
|
import * as fsConstants2 from "node:constants";
|
|
844494
844757
|
var O_NOFOLLOW2, O_APPEND2, O_CREAT2, O_WRONLY2, OPEN_FLAGS_WRITE, OPEN_MODE, DiskTaskOutput;
|
|
844495
844758
|
var init_disk_task_output = __esm({
|
|
@@ -844507,7 +844770,7 @@ var init_disk_task_output = __esm({
|
|
|
844507
844770
|
fileSize = 0;
|
|
844508
844771
|
constructor(outputPath3) {
|
|
844509
844772
|
this.path = outputPath3;
|
|
844510
|
-
mkdirSync133(
|
|
844773
|
+
mkdirSync133(dirname84(outputPath3), { recursive: true });
|
|
844511
844774
|
}
|
|
844512
844775
|
/** Queue content for async append. Non-blocking. */
|
|
844513
844776
|
append(chunk) {
|
|
@@ -868336,7 +868599,7 @@ var init_chat_followup = __esm({
|
|
|
868336
868599
|
// packages/cli/src/docker.ts
|
|
868337
868600
|
import { execSync as execSync37, spawn as spawn49 } from "node:child_process";
|
|
868338
868601
|
import { existsSync as existsSync206, mkdirSync as mkdirSync139, writeFileSync as writeFileSync122 } from "node:fs";
|
|
868339
|
-
import { join as join220, resolve as resolve101, dirname as
|
|
868602
|
+
import { join as join220, resolve as resolve101, dirname as dirname85 } from "node:path";
|
|
868340
868603
|
import { homedir as homedir72 } from "node:os";
|
|
868341
868604
|
import { fileURLToPath as fileURLToPath35 } from "node:url";
|
|
868342
868605
|
function getDockerDir() {
|
|
@@ -868347,7 +868610,7 @@ function getDockerDir() {
|
|
|
868347
868610
|
} catch {
|
|
868348
868611
|
}
|
|
868349
868612
|
try {
|
|
868350
|
-
const thisDir =
|
|
868613
|
+
const thisDir = dirname85(fileURLToPath35(import.meta.url));
|
|
868351
868614
|
return join220(thisDir, "..", "..", "..", "docker");
|
|
868352
868615
|
} catch {
|
|
868353
868616
|
}
|
|
@@ -868891,7 +869154,7 @@ import * as http5 from "node:http";
|
|
|
868891
869154
|
import * as https3 from "node:https";
|
|
868892
869155
|
import { createRequire as createRequire10 } from "node:module";
|
|
868893
869156
|
import { fileURLToPath as fileURLToPath36 } from "node:url";
|
|
868894
|
-
import { dirname as
|
|
869157
|
+
import { dirname as dirname86, join as join222, resolve as resolve102 } from "node:path";
|
|
868895
869158
|
import { homedir as homedir73 } from "node:os";
|
|
868896
869159
|
import { spawn as spawn50, execSync as execSync38 } from "node:child_process";
|
|
868897
869160
|
import {
|
|
@@ -868920,7 +869183,7 @@ function memoryDbPaths3(baseDir = process.cwd()) {
|
|
|
868920
869183
|
}
|
|
868921
869184
|
function readServerPackageIdentity() {
|
|
868922
869185
|
try {
|
|
868923
|
-
const thisDir =
|
|
869186
|
+
const thisDir = dirname86(fileURLToPath36(import.meta.url));
|
|
868924
869187
|
const candidates = [
|
|
868925
869188
|
join222(thisDir, "..", "package.json"),
|
|
868926
869189
|
join222(thisDir, "..", "..", "package.json"),
|
|
@@ -873373,7 +873636,7 @@ async function handleV1Update(req3, res, requestId) {
|
|
|
873373
873636
|
);
|
|
873374
873637
|
const fs14 = require4("node:fs");
|
|
873375
873638
|
const nodeBin = process.execPath;
|
|
873376
|
-
const nodeDir =
|
|
873639
|
+
const nodeDir = dirname86(nodeBin);
|
|
873377
873640
|
const { execSync: es } = require4("node:child_process");
|
|
873378
873641
|
const isWin2 = process.platform === "win32";
|
|
873379
873642
|
let npmBin = "";
|
|
@@ -873388,7 +873651,7 @@ async function handleV1Update(req3, res, requestId) {
|
|
|
873388
873651
|
const dir = join222(homedir73(), ".omnius");
|
|
873389
873652
|
fs14.mkdirSync(dir, { recursive: true });
|
|
873390
873653
|
const logFd = fs14.openSync(logPath3, "w");
|
|
873391
|
-
const npmPrefix =
|
|
873654
|
+
const npmPrefix = dirname86(nodeDir);
|
|
873392
873655
|
let globalBinDir = "";
|
|
873393
873656
|
try {
|
|
873394
873657
|
if (isWin2) {
|
|
@@ -881848,7 +882111,7 @@ init_typed_node_events();
|
|
|
881848
882111
|
init_dist5();
|
|
881849
882112
|
import { parseArgs as nodeParseArgs2 } from "node:util";
|
|
881850
882113
|
import { fileURLToPath as fileURLToPath37 } from "node:url";
|
|
881851
|
-
import { dirname as
|
|
882114
|
+
import { dirname as dirname87, join as join224 } from "node:path";
|
|
881852
882115
|
import { createRequire as createRequire11 } from "node:module";
|
|
881853
882116
|
|
|
881854
882117
|
// packages/cli/src/cli.ts
|
|
@@ -882017,7 +882280,7 @@ init_output();
|
|
|
882017
882280
|
function getVersion5() {
|
|
882018
882281
|
try {
|
|
882019
882282
|
const require5 = createRequire11(import.meta.url);
|
|
882020
|
-
const pkgPath = join224(
|
|
882283
|
+
const pkgPath = join224(dirname87(fileURLToPath37(import.meta.url)), "..", "package.json");
|
|
882021
882284
|
const pkg = require5(pkgPath);
|
|
882022
882285
|
return pkg.version;
|
|
882023
882286
|
} catch {
|