omnius 1.0.159 → 1.0.161
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/.aiwg/addons/omnius-docs/README.md +5 -0
- package/.aiwg/addons/omnius-docs/manifest.json +32 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-docs/SKILL.md +48 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-ops-docs/SKILL.md +32 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-realtime-docs/SKILL.md +30 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-sponsor-docs/SKILL.md +31 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-telegram-docs/SKILL.md +30 -0
- package/.aiwg/addons/omnius-rest-docs/README.md +7 -0
- package/.aiwg/addons/omnius-rest-docs/manifest.json +24 -0
- package/.aiwg/addons/omnius-rest-docs/skills/omnius-rest-docs/SKILL.md +72 -0
- package/README.md +115 -5011
- package/dist/index.js +1353 -363
- package/docs/.vitepress/config.mts +108 -0
- package/docs/agent-memory/INDEX.md +38 -0
- package/docs/agent-memory/index.md +14 -0
- package/docs/architecture/overview.md +30 -0
- package/docs/getting-started/first-run.md +38 -0
- package/docs/getting-started/install.md +58 -0
- package/docs/getting-started/model-providers.md +48 -0
- package/docs/guides/media-generation.md +88 -0
- package/docs/guides/realtime.md +138 -0
- package/docs/guides/sponsor-and-cohere.md +123 -0
- package/docs/guides/telegram.md +95 -0
- package/docs/guides/tui-workflows.md +48 -0
- package/docs/index.md +30 -0
- package/docs/operations/runtime-hygiene.md +75 -0
- package/docs/operations/security-and-remote-access.md +70 -0
- package/docs/reference/configuration.md +45 -0
- package/docs/reference/rest-api.md +225 -0
- package/docs/reference/slash-commands.md +2095 -0
- package/docs/rest/INDEX.md +129 -0
- package/docs/rest/QUICKREF.md +125 -0
- package/docs/rest/REST-DOCS-MANIFEST.json +27 -0
- package/docs/rest/auth-and-scopes.md +101 -0
- package/docs/rest/endpoints/aims.md +26 -0
- package/docs/rest/endpoints/aiwg.md +44 -0
- package/docs/rest/endpoints/chat.md +101 -0
- package/docs/rest/endpoints/config.md +53 -0
- package/docs/rest/endpoints/events.md +63 -0
- package/docs/rest/endpoints/files.md +18 -0
- package/docs/rest/endpoints/memory.md +42 -0
- package/docs/rest/endpoints/run.md +52 -0
- package/docs/rest/endpoints/skills.md +41 -0
- package/docs/rest/endpoints/tools.md +62 -0
- package/docs/rest/endpoints/voice-vision.md +80 -0
- package/docs/rest/errors-pagination-etags.md +84 -0
- package/docs/rest/examples/curl.md +84 -0
- package/docs/rest/examples/openai-sdk.md +59 -0
- package/docs/rest/openapi-source.md +36 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -9624,14 +9624,17 @@ var init_list_directory = __esm({
|
|
|
9624
9624
|
const fullPath = resolve11(this.workingDir, dirPath);
|
|
9625
9625
|
const entries = readdirSync5(fullPath, { withFileTypes: true });
|
|
9626
9626
|
const visible = entries.filter((e2) => !EXCLUDED.has(e2.name));
|
|
9627
|
-
const
|
|
9627
|
+
const collapsed = this.collapseGeneratedContextEntries(visible, fullPath, dirPath);
|
|
9628
|
+
const limited = collapsed.entries.slice(0, MAX_ENTRIES);
|
|
9628
9629
|
const dirs = [];
|
|
9629
9630
|
const files = [];
|
|
9630
|
-
const lines =
|
|
9631
|
+
const lines = [...collapsed.syntheticLines];
|
|
9632
|
+
for (const entry of limited) {
|
|
9631
9633
|
const relPath = dirPath === "." ? entry.name : join17(dirPath, entry.name);
|
|
9632
9634
|
if (entry.isDirectory()) {
|
|
9633
9635
|
dirs.push(relPath);
|
|
9634
|
-
|
|
9636
|
+
lines.push(`d ${relPath}/`);
|
|
9637
|
+
continue;
|
|
9635
9638
|
}
|
|
9636
9639
|
let size = 0;
|
|
9637
9640
|
try {
|
|
@@ -9639,8 +9642,8 @@ var init_list_directory = __esm({
|
|
|
9639
9642
|
} catch {
|
|
9640
9643
|
}
|
|
9641
9644
|
files.push(relPath);
|
|
9642
|
-
|
|
9643
|
-
}
|
|
9645
|
+
lines.push(`f ${relPath} ${size}`);
|
|
9646
|
+
}
|
|
9644
9647
|
if (dirs.length > 0 || files.length > 0) {
|
|
9645
9648
|
lines.push("");
|
|
9646
9649
|
lines.push("Next steps — use these exact paths:");
|
|
@@ -9673,6 +9676,31 @@ var init_list_directory = __esm({
|
|
|
9673
9676
|
};
|
|
9674
9677
|
}
|
|
9675
9678
|
}
|
|
9679
|
+
collapseGeneratedContextEntries(entries, fullPath, dirPath) {
|
|
9680
|
+
const normalized = dirPath.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
9681
|
+
if (normalized !== ".omnius/context" && normalized !== ".omnius/context/kg-summary") {
|
|
9682
|
+
return { entries, syntheticLines: [] };
|
|
9683
|
+
}
|
|
9684
|
+
const kgSummaries = entries.filter((entry) => entry.isFile() && entry.name.startsWith("kg-summary-") && entry.name.endsWith(".md"));
|
|
9685
|
+
if (kgSummaries.length <= 8) {
|
|
9686
|
+
return { entries, syntheticLines: [] };
|
|
9687
|
+
}
|
|
9688
|
+
let totalBytes = 0;
|
|
9689
|
+
for (const entry of kgSummaries) {
|
|
9690
|
+
try {
|
|
9691
|
+
totalBytes += statSync6(join17(fullPath, entry.name)).size;
|
|
9692
|
+
} catch {
|
|
9693
|
+
}
|
|
9694
|
+
}
|
|
9695
|
+
const latest = [...kgSummaries].sort((a2, b) => a2.name.localeCompare(b.name)).at(-1)?.name;
|
|
9696
|
+
const latestPath = normalized === ".omnius/context/kg-summary" ? join17(dirPath, "latest.md") : latest ? join17(dirPath, latest) : join17(dirPath, "kg-summary-latest.md");
|
|
9697
|
+
const remaining = entries.filter((entry) => !kgSummaries.includes(entry));
|
|
9698
|
+
const syntheticLines = [
|
|
9699
|
+
`g ${dirPath}/kg-summary-*.md ${kgSummaries.length} generated summaries collapsed, ${totalBytes} bytes`,
|
|
9700
|
+
` latest generated summary: file_read("${latestPath}")`
|
|
9701
|
+
];
|
|
9702
|
+
return { entries: remaining, syntheticLines };
|
|
9703
|
+
}
|
|
9676
9704
|
};
|
|
9677
9705
|
}
|
|
9678
9706
|
});
|
|
@@ -20856,6 +20884,7 @@ import { existsSync as existsSync24, readdirSync as readdirSync10, readFileSync
|
|
|
20856
20884
|
import { join as join27, basename as basename4, dirname as dirname5 } from "node:path";
|
|
20857
20885
|
import { homedir as homedir8 } from "node:os";
|
|
20858
20886
|
import { execSync as execSync14 } from "node:child_process";
|
|
20887
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
20859
20888
|
function getAiwgPaths() {
|
|
20860
20889
|
const dataDir = join27(homedir8(), ".local", "share", "ai-writing-guide");
|
|
20861
20890
|
return {
|
|
@@ -20910,6 +20939,24 @@ function findAiwgPackageRoot() {
|
|
|
20910
20939
|
_cachedAiwgPkgRoot = null;
|
|
20911
20940
|
return null;
|
|
20912
20941
|
}
|
|
20942
|
+
function hasBundledOmniusDocs(root) {
|
|
20943
|
+
return existsSync24(join27(root, ".aiwg", "addons", "omnius-docs", "skills", "omnius-docs", "SKILL.md")) && existsSync24(join27(root, ".aiwg", "addons", "omnius-rest-docs", "skills", "omnius-rest-docs", "SKILL.md")) && existsSync24(join27(root, "docs", "agent-memory", "INDEX.md"));
|
|
20944
|
+
}
|
|
20945
|
+
function findBundledOmniusDocsRoot() {
|
|
20946
|
+
const envRoot = process.env["OMNIUS_DOCS_ROOT"];
|
|
20947
|
+
if (envRoot && hasBundledOmniusDocs(envRoot))
|
|
20948
|
+
return envRoot;
|
|
20949
|
+
let current = dirname5(fileURLToPath2(import.meta.url));
|
|
20950
|
+
for (let depth = 0; depth < 8; depth++) {
|
|
20951
|
+
if (hasBundledOmniusDocs(current))
|
|
20952
|
+
return current;
|
|
20953
|
+
const parent = dirname5(current);
|
|
20954
|
+
if (parent === current)
|
|
20955
|
+
break;
|
|
20956
|
+
current = parent;
|
|
20957
|
+
}
|
|
20958
|
+
return null;
|
|
20959
|
+
}
|
|
20913
20960
|
function discoverSkills(repoRoot) {
|
|
20914
20961
|
const skills = /* @__PURE__ */ new Map();
|
|
20915
20962
|
const { frameworksDir, addonsDir, pluginsDir } = getAiwgPaths();
|
|
@@ -20953,9 +21000,29 @@ function discoverSkills(repoRoot) {
|
|
|
20953
21000
|
loadComponent(join27(pluginsDir, plugin), `plugin:${plugin}`);
|
|
20954
21001
|
}
|
|
20955
21002
|
}
|
|
21003
|
+
const bundledDocsRoot = findBundledOmniusDocsRoot();
|
|
21004
|
+
if (bundledDocsRoot) {
|
|
21005
|
+
const bundledAddons = join27(bundledDocsRoot, ".aiwg", "addons");
|
|
21006
|
+
for (const addon of safeReaddir2(bundledAddons, true)) {
|
|
21007
|
+
if (addon !== "omnius-docs" && addon !== "omnius-rest-docs")
|
|
21008
|
+
continue;
|
|
21009
|
+
loadComponent(join27(bundledAddons, addon), `bundled-addon:${addon}`);
|
|
21010
|
+
}
|
|
21011
|
+
}
|
|
20956
21012
|
const projectAiwg = join27(repoRoot, ".aiwg");
|
|
20957
21013
|
loadSkillsFromDir(join27(projectAiwg, "skills"), "project", skills);
|
|
20958
21014
|
loadCommandsFromDir(join27(projectAiwg, "commands"), "project", skills);
|
|
21015
|
+
for (const [kind, sourcePrefix] of [
|
|
21016
|
+
["addons", "project-addon"],
|
|
21017
|
+
["extensions", "project-extension"],
|
|
21018
|
+
["frameworks", "project-framework"],
|
|
21019
|
+
["plugins", "project-plugin"]
|
|
21020
|
+
]) {
|
|
21021
|
+
const bundleRoot = join27(projectAiwg, kind);
|
|
21022
|
+
for (const bundle of safeReaddir2(bundleRoot, true)) {
|
|
21023
|
+
loadComponent(join27(bundleRoot, bundle), `${sourcePrefix}:${bundle}`);
|
|
21024
|
+
}
|
|
21025
|
+
}
|
|
20959
21026
|
const projectOmniusSkills = join27(repoRoot, ".omnius", "skills");
|
|
20960
21027
|
loadSkillsFromDir(projectOmniusSkills, "local", skills);
|
|
20961
21028
|
return Array.from(skills.values());
|
|
@@ -21400,6 +21467,14 @@ var init_skill_tools = __esm({
|
|
|
21400
21467
|
source: {
|
|
21401
21468
|
type: "string",
|
|
21402
21469
|
description: "Optional source filter (e.g. 'framework:sdlc-complete', 'addon:ralph', 'project', 'local')"
|
|
21470
|
+
},
|
|
21471
|
+
limit: {
|
|
21472
|
+
type: "number",
|
|
21473
|
+
description: "Maximum skills to list. Defaults to 30. Ignored when all=true."
|
|
21474
|
+
},
|
|
21475
|
+
all: {
|
|
21476
|
+
type: "boolean",
|
|
21477
|
+
description: "Return every matching skill instead of the default compressed top 30."
|
|
21403
21478
|
}
|
|
21404
21479
|
},
|
|
21405
21480
|
required: []
|
|
@@ -21413,6 +21488,9 @@ var init_skill_tools = __esm({
|
|
|
21413
21488
|
const filterRaw = args["filter"] ?? args["pattern"] ?? args["query"] ?? args["search"] ?? "";
|
|
21414
21489
|
const filter2 = typeof filterRaw === "string" ? filterRaw.toLowerCase() : "";
|
|
21415
21490
|
const sourceFilter = typeof args["source"] === "string" ? args["source"] : "";
|
|
21491
|
+
const showAll = args["all"] === true;
|
|
21492
|
+
const limitRaw = typeof args["limit"] === "number" ? args["limit"] : 30;
|
|
21493
|
+
const limit = showAll ? Number.POSITIVE_INFINITY : Math.max(1, Math.min(200, Math.floor(limitRaw)));
|
|
21416
21494
|
let skills = discoverSkills(this.repoRoot);
|
|
21417
21495
|
if (filter2) {
|
|
21418
21496
|
skills = skills.filter((s2) => s2.name.toLowerCase().includes(filter2) || s2.description.toLowerCase().includes(filter2) || s2.triggers.some((t2) => t2.toLowerCase().includes(filter2)));
|
|
@@ -21427,9 +21505,14 @@ var init_skill_tools = __esm({
|
|
|
21427
21505
|
durationMs: performance.now() - start2
|
|
21428
21506
|
};
|
|
21429
21507
|
}
|
|
21430
|
-
const
|
|
21431
|
-
|
|
21432
|
-
|
|
21508
|
+
const total = skills.length;
|
|
21509
|
+
const listed = skills.slice(0, limit);
|
|
21510
|
+
const lines = [
|
|
21511
|
+
showAll || listed.length === total ? `Found ${total} skills:
|
|
21512
|
+
` : `Found ${total} skills. Showing ${listed.length}; pass {"all": true} or a narrower filter to expand.
|
|
21513
|
+
`
|
|
21514
|
+
];
|
|
21515
|
+
for (const s2 of listed) {
|
|
21433
21516
|
lines.push(` ${s2.name}`);
|
|
21434
21517
|
lines.push(` ${s2.description}`);
|
|
21435
21518
|
if (s2.triggers.length > 0) {
|
|
@@ -21441,6 +21524,10 @@ var init_skill_tools = __esm({
|
|
|
21441
21524
|
}
|
|
21442
21525
|
lines.push("");
|
|
21443
21526
|
}
|
|
21527
|
+
if (!showAll && listed.length < total) {
|
|
21528
|
+
lines.push(`... ${total - listed.length} more skills omitted by default context budget.`);
|
|
21529
|
+
lines.push(`Use skill_list with a filter/source, limit, or all=true when those omitted skills are actually needed.`);
|
|
21530
|
+
}
|
|
21444
21531
|
return {
|
|
21445
21532
|
success: true,
|
|
21446
21533
|
output: lines.join("\n"),
|
|
@@ -91796,7 +91883,7 @@ var require_axios = __commonJS({
|
|
|
91796
91883
|
var isNumber2 = typeOfTest("number");
|
|
91797
91884
|
var isObject = (thing) => thing !== null && typeof thing === "object";
|
|
91798
91885
|
var isBoolean = (thing) => thing === true || thing === false;
|
|
91799
|
-
var
|
|
91886
|
+
var isPlainObject2 = (val) => {
|
|
91800
91887
|
if (kindOf(val) !== "object") {
|
|
91801
91888
|
return false;
|
|
91802
91889
|
}
|
|
@@ -91901,9 +91988,9 @@ var require_axios = __commonJS({
|
|
|
91901
91988
|
return;
|
|
91902
91989
|
}
|
|
91903
91990
|
const targetKey = caseless && findKey(result, key) || key;
|
|
91904
|
-
if (
|
|
91991
|
+
if (isPlainObject2(result[targetKey]) && isPlainObject2(val)) {
|
|
91905
91992
|
result[targetKey] = merge2(result[targetKey], val);
|
|
91906
|
-
} else if (
|
|
91993
|
+
} else if (isPlainObject2(val)) {
|
|
91907
91994
|
result[targetKey] = merge2({}, val);
|
|
91908
91995
|
} else if (isArray(val)) {
|
|
91909
91996
|
result[targetKey] = val.slice();
|
|
@@ -92137,7 +92224,7 @@ var require_axios = __commonJS({
|
|
|
92137
92224
|
isNumber: isNumber2,
|
|
92138
92225
|
isBoolean,
|
|
92139
92226
|
isObject,
|
|
92140
|
-
isPlainObject,
|
|
92227
|
+
isPlainObject: isPlainObject2,
|
|
92141
92228
|
isEmptyObject,
|
|
92142
92229
|
isReadableStream,
|
|
92143
92230
|
isRequest,
|
|
@@ -225156,7 +225243,7 @@ var require_defaults = __commonJS({
|
|
|
225156
225243
|
var require_Utility = __commonJS({
|
|
225157
225244
|
"../node_modules/xmlbuilder/lib/Utility.js"(exports, module) {
|
|
225158
225245
|
(function() {
|
|
225159
|
-
var assign, getValue, isArray, isEmpty, isFunction, isObject,
|
|
225246
|
+
var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject2, slice2 = [].slice, hasProp = {}.hasOwnProperty;
|
|
225160
225247
|
assign = function() {
|
|
225161
225248
|
var i2, key, len, source, sources, target;
|
|
225162
225249
|
target = arguments[0], sources = 2 <= arguments.length ? slice2.call(arguments, 1) : [];
|
|
@@ -225201,7 +225288,7 @@ var require_Utility = __commonJS({
|
|
|
225201
225288
|
return true;
|
|
225202
225289
|
}
|
|
225203
225290
|
};
|
|
225204
|
-
|
|
225291
|
+
isPlainObject2 = function(val) {
|
|
225205
225292
|
var ctor, proto;
|
|
225206
225293
|
return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && typeof ctor === "function" && ctor instanceof ctor && Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object);
|
|
225207
225294
|
};
|
|
@@ -225217,7 +225304,7 @@ var require_Utility = __commonJS({
|
|
|
225217
225304
|
module.exports.isObject = isObject;
|
|
225218
225305
|
module.exports.isArray = isArray;
|
|
225219
225306
|
module.exports.isEmpty = isEmpty;
|
|
225220
|
-
module.exports.isPlainObject =
|
|
225307
|
+
module.exports.isPlainObject = isPlainObject2;
|
|
225221
225308
|
module.exports.getValue = getValue;
|
|
225222
225309
|
}).call(exports);
|
|
225223
225310
|
}
|
|
@@ -228031,7 +228118,7 @@ var require_XMLStringWriter = __commonJS({
|
|
|
228031
228118
|
var require_XMLDocument = __commonJS({
|
|
228032
228119
|
"../node_modules/xmlbuilder/lib/XMLDocument.js"(exports, module) {
|
|
228033
228120
|
(function() {
|
|
228034
|
-
var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier,
|
|
228121
|
+
var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject2, extend = function(child, parent) {
|
|
228035
228122
|
for (var key in parent) {
|
|
228036
228123
|
if (hasProp.call(parent, key)) child[key] = parent[key];
|
|
228037
228124
|
}
|
|
@@ -228043,7 +228130,7 @@ var require_XMLDocument = __commonJS({
|
|
|
228043
228130
|
child.__super__ = parent.prototype;
|
|
228044
228131
|
return child;
|
|
228045
228132
|
}, hasProp = {}.hasOwnProperty;
|
|
228046
|
-
|
|
228133
|
+
isPlainObject2 = require_Utility().isPlainObject;
|
|
228047
228134
|
XMLDOMImplementation = require_XMLDOMImplementation();
|
|
228048
228135
|
XMLDOMConfiguration = require_XMLDOMConfiguration();
|
|
228049
228136
|
XMLNode = require_XMLNode();
|
|
@@ -228153,7 +228240,7 @@ var require_XMLDocument = __commonJS({
|
|
|
228153
228240
|
writerOptions = {};
|
|
228154
228241
|
if (!writer) {
|
|
228155
228242
|
writer = this.options.writer;
|
|
228156
|
-
} else if (
|
|
228243
|
+
} else if (isPlainObject2(writer)) {
|
|
228157
228244
|
writerOptions = writer;
|
|
228158
228245
|
writer = this.options.writer;
|
|
228159
228246
|
}
|
|
@@ -228238,8 +228325,8 @@ var require_XMLDocument = __commonJS({
|
|
|
228238
228325
|
var require_XMLDocumentCB = __commonJS({
|
|
228239
228326
|
"../node_modules/xmlbuilder/lib/XMLDocumentCB.js"(exports, module) {
|
|
228240
228327
|
(function() {
|
|
228241
|
-
var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject,
|
|
228242
|
-
ref = require_Utility(), isObject = ref.isObject, isFunction = ref.isFunction,
|
|
228328
|
+
var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject2, ref, hasProp = {}.hasOwnProperty;
|
|
228329
|
+
ref = require_Utility(), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject2 = ref.isPlainObject, getValue = ref.getValue;
|
|
228243
228330
|
NodeType = require_NodeType();
|
|
228244
228331
|
XMLDocument = require_XMLDocument();
|
|
228245
228332
|
XMLElement = require_XMLElement();
|
|
@@ -228267,7 +228354,7 @@ var require_XMLDocumentCB = __commonJS({
|
|
|
228267
228354
|
writerOptions = {};
|
|
228268
228355
|
if (!options2.writer) {
|
|
228269
228356
|
options2.writer = new XMLStringWriter();
|
|
228270
|
-
} else if (
|
|
228357
|
+
} else if (isPlainObject2(options2.writer)) {
|
|
228271
228358
|
writerOptions = options2.writer;
|
|
228272
228359
|
options2.writer = new XMLStringWriter();
|
|
228273
228360
|
}
|
|
@@ -247631,8 +247718,8 @@ var require_fill_range = __commonJS({
|
|
|
247631
247718
|
var util2 = __require("util");
|
|
247632
247719
|
var toRegexRange = require_to_regex_range();
|
|
247633
247720
|
var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
247634
|
-
var transform = (
|
|
247635
|
-
return (value2) =>
|
|
247721
|
+
var transform = (toNumber2) => {
|
|
247722
|
+
return (value2) => toNumber2 === true ? Number(value2) : String(value2);
|
|
247636
247723
|
};
|
|
247637
247724
|
var isValidValue = (value2) => {
|
|
247638
247725
|
return typeof value2 === "number" || typeof value2 === "string" && value2 !== "";
|
|
@@ -247652,13 +247739,13 @@ var require_fill_range = __commonJS({
|
|
|
247652
247739
|
}
|
|
247653
247740
|
return options2.stringify === true;
|
|
247654
247741
|
};
|
|
247655
|
-
var pad = (input, maxLength,
|
|
247742
|
+
var pad = (input, maxLength, toNumber2) => {
|
|
247656
247743
|
if (maxLength > 0) {
|
|
247657
247744
|
let dash = input[0] === "-" ? "-" : "";
|
|
247658
247745
|
if (dash) input = input.slice(1);
|
|
247659
247746
|
input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
|
|
247660
247747
|
}
|
|
247661
|
-
if (
|
|
247748
|
+
if (toNumber2 === false) {
|
|
247662
247749
|
return String(input);
|
|
247663
247750
|
}
|
|
247664
247751
|
return input;
|
|
@@ -247741,8 +247828,8 @@ var require_fill_range = __commonJS({
|
|
|
247741
247828
|
step = Math.max(Math.abs(step), 1);
|
|
247742
247829
|
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
|
247743
247830
|
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
|
247744
|
-
let
|
|
247745
|
-
let format3 = options2.transform || transform(
|
|
247831
|
+
let toNumber2 = padded === false && stringify2(start2, end, options2) === false;
|
|
247832
|
+
let format3 = options2.transform || transform(toNumber2);
|
|
247746
247833
|
if (options2.toRegex && step === 1) {
|
|
247747
247834
|
return toRange(toMaxLen(start2, maxLen), toMaxLen(end, maxLen), true, options2);
|
|
247748
247835
|
}
|
|
@@ -247754,7 +247841,7 @@ var require_fill_range = __commonJS({
|
|
|
247754
247841
|
if (options2.toRegex === true && step > 1) {
|
|
247755
247842
|
push(a2);
|
|
247756
247843
|
} else {
|
|
247757
|
-
range.push(pad(format3(a2, index), maxLen,
|
|
247844
|
+
range.push(pad(format3(a2, index), maxLen, toNumber2));
|
|
247758
247845
|
}
|
|
247759
247846
|
a2 = descending ? a2 - step : a2 + step;
|
|
247760
247847
|
index++;
|
|
@@ -252908,9 +252995,9 @@ var init_src107 = __esm({
|
|
|
252908
252995
|
// ../node_modules/steno/lib/index.js
|
|
252909
252996
|
import { rename as rename3, writeFile as writeFile10 } from "node:fs/promises";
|
|
252910
252997
|
import { basename as basename6, dirname as dirname8, join as join31 } from "node:path";
|
|
252911
|
-
import { fileURLToPath as
|
|
252998
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
252912
252999
|
function getTempFilename(file) {
|
|
252913
|
-
const f2 = file instanceof URL ?
|
|
253000
|
+
const f2 = file instanceof URL ? fileURLToPath3(file) : file.toString();
|
|
252914
253001
|
return join31(dirname8(f2), `.${basename6(f2)}.tmp`);
|
|
252915
253002
|
}
|
|
252916
253003
|
async function retryAsyncOperation(fn, maxRetries, delayMs) {
|
|
@@ -254218,9 +254305,9 @@ print("${sentinel}")
|
|
|
254218
254305
|
if (!this.proc || this.proc.killed) {
|
|
254219
254306
|
return { success: false, path: "" };
|
|
254220
254307
|
}
|
|
254221
|
-
const { mkdirSync:
|
|
254308
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
254222
254309
|
const sessionDir2 = join33(this.cwd, ".omnius", "rlm");
|
|
254223
|
-
|
|
254310
|
+
mkdirSync85(sessionDir2, { recursive: true });
|
|
254224
254311
|
const sessionPath2 = join33(sessionDir2, "session.json");
|
|
254225
254312
|
try {
|
|
254226
254313
|
const inspectCode = `
|
|
@@ -254244,7 +254331,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
254244
254331
|
trajectoryCount: this.trajectory.length,
|
|
254245
254332
|
subCallCount: this.subCallCount
|
|
254246
254333
|
};
|
|
254247
|
-
|
|
254334
|
+
writeFileSync77(sessionPath2, JSON.stringify(sessionData, null, 2), "utf8");
|
|
254248
254335
|
return { success: true, path: sessionPath2 };
|
|
254249
254336
|
}
|
|
254250
254337
|
} catch {
|
|
@@ -254853,7 +254940,7 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
254853
254940
|
/** Update memory scores based on task outcome. Called after task completion.
|
|
254854
254941
|
* Memories used in successful tasks get boosted. Memories present during failures get decayed. */
|
|
254855
254942
|
updateFromOutcomeSync(surfacedMemoryText, succeeded) {
|
|
254856
|
-
const { readFileSync: readFileSync113, writeFileSync:
|
|
254943
|
+
const { readFileSync: readFileSync113, writeFileSync: writeFileSync77, existsSync: existsSync138, mkdirSync: mkdirSync85 } = __require("node:fs");
|
|
254857
254944
|
const metaDir = join34(this.cwd, ".omnius", "memory", "metabolism");
|
|
254858
254945
|
const storeFile = join34(metaDir, "store.json");
|
|
254859
254946
|
if (!existsSync138(storeFile))
|
|
@@ -254884,8 +254971,8 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
254884
254971
|
updated = true;
|
|
254885
254972
|
}
|
|
254886
254973
|
if (updated) {
|
|
254887
|
-
|
|
254888
|
-
|
|
254974
|
+
mkdirSync85(metaDir, { recursive: true });
|
|
254975
|
+
writeFileSync77(storeFile, JSON.stringify(store2, null, 2));
|
|
254889
254976
|
}
|
|
254890
254977
|
}
|
|
254891
254978
|
// ── Storage ──────────────────────────────────────────────────────────
|
|
@@ -255331,7 +255418,7 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
255331
255418
|
}
|
|
255332
255419
|
/** Archive a strategy variant synchronously (for task completion path) */
|
|
255333
255420
|
archiveVariantSync(strategy, outcome, tags = []) {
|
|
255334
|
-
const { readFileSync: readFileSync113, writeFileSync:
|
|
255421
|
+
const { readFileSync: readFileSync113, writeFileSync: writeFileSync77, existsSync: existsSync138, mkdirSync: mkdirSync85 } = __require("node:fs");
|
|
255335
255422
|
const dir = join36(this.cwd, ".omnius", "arche");
|
|
255336
255423
|
const archiveFile = join36(dir, "variants.json");
|
|
255337
255424
|
let variants = [];
|
|
@@ -255352,8 +255439,8 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
255352
255439
|
});
|
|
255353
255440
|
if (variants.length > 50)
|
|
255354
255441
|
variants = variants.slice(-50);
|
|
255355
|
-
|
|
255356
|
-
|
|
255442
|
+
mkdirSync85(dir, { recursive: true });
|
|
255443
|
+
writeFileSync77(archiveFile, JSON.stringify(variants, null, 2));
|
|
255357
255444
|
}
|
|
255358
255445
|
async saveArchive(variants) {
|
|
255359
255446
|
const dir = join36(this.cwd, ".omnius", "arche");
|
|
@@ -263698,7 +263785,7 @@ __export(vision_exports, {
|
|
|
263698
263785
|
import { readFileSync as readFileSync23, existsSync as existsSync31, statSync as statSync14, unlinkSync as unlinkSync5, writeFileSync as writeFileSync14 } from "node:fs";
|
|
263699
263786
|
import { execSync as execSync16, spawn as spawn11, spawnSync as spawnSync3 } from "node:child_process";
|
|
263700
263787
|
import { resolve as resolve22, extname as extname6, basename as basename7, dirname as dirname9, join as join42 } from "node:path";
|
|
263701
|
-
import { fileURLToPath as
|
|
263788
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
263702
263789
|
async function probeStation(endpoint) {
|
|
263703
263790
|
try {
|
|
263704
263791
|
const healthUrl = endpoint.replace(/\/v1\/?$/, "/health");
|
|
@@ -263726,7 +263813,7 @@ function findStationBinary() {
|
|
|
263726
263813
|
const omniusVenvBin = isWin2 ? join42(venvBase, "Scripts", "moondream-station.exe") : join42(venvBase, "bin", "moondream-station");
|
|
263727
263814
|
if (existsSync31(omniusVenvBin))
|
|
263728
263815
|
return omniusVenvBin;
|
|
263729
|
-
const thisDir = dirname9(
|
|
263816
|
+
const thisDir = dirname9(fileURLToPath4(import.meta.url));
|
|
263730
263817
|
const pyBin = isWin2 ? "Scripts/python.exe" : "bin/python";
|
|
263731
263818
|
const localVenvPaths = [
|
|
263732
263819
|
resolve22(thisDir, `../../../../.moondream-venv/${pyBin}`),
|
|
@@ -263763,7 +263850,7 @@ async function autoLaunchStation(port = 2020) {
|
|
|
263763
263850
|
const pythonBin = findStationBinary();
|
|
263764
263851
|
if (!pythonBin)
|
|
263765
263852
|
return false;
|
|
263766
|
-
const thisDir = dirname9(
|
|
263853
|
+
const thisDir = dirname9(fileURLToPath4(import.meta.url));
|
|
263767
263854
|
const launcherScript = resolve22(thisDir, "../../scripts/start-moondream.py");
|
|
263768
263855
|
if (!existsSync31(launcherScript))
|
|
263769
263856
|
return false;
|
|
@@ -265352,10 +265439,10 @@ ${text}`,
|
|
|
265352
265439
|
import { existsSync as existsSync34, statSync as statSync17 } from "node:fs";
|
|
265353
265440
|
import { resolve as resolve25, basename as basename10, dirname as dirname10, join as join45 } from "node:path";
|
|
265354
265441
|
import { execSync as execSync20 } from "node:child_process";
|
|
265355
|
-
import { fileURLToPath as
|
|
265442
|
+
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
265356
265443
|
import { homedir as homedir12, tmpdir as tmpdir8 } from "node:os";
|
|
265357
265444
|
function findOcrScript() {
|
|
265358
|
-
const thisDir = dirname10(
|
|
265445
|
+
const thisDir = dirname10(fileURLToPath5(import.meta.url));
|
|
265359
265446
|
const devPath3 = resolve25(thisDir, "../../scripts/ocr-advanced.py");
|
|
265360
265447
|
if (existsSync34(devPath3))
|
|
265361
265448
|
return devPath3;
|
|
@@ -265656,7 +265743,7 @@ Note: Advanced Python pipeline not available — install pytesseract, opencv-pyt
|
|
|
265656
265743
|
import { execSync as execSync21, spawn as spawn12 } from "node:child_process";
|
|
265657
265744
|
import { copyFileSync, existsSync as existsSync35, mkdirSync as mkdirSync13, readFileSync as readFileSync26 } from "node:fs";
|
|
265658
265745
|
import { basename as basename11, dirname as dirname11, join as join46, resolve as resolve26 } from "node:path";
|
|
265659
|
-
import { fileURLToPath as
|
|
265746
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
265660
265747
|
function findScrapeScript() {
|
|
265661
265748
|
const candidates = [
|
|
265662
265749
|
// Published npm package: dist/scripts/web_scrape.py
|
|
@@ -265810,7 +265897,7 @@ var init_browser_action = __esm({
|
|
|
265810
265897
|
"use strict";
|
|
265811
265898
|
init_dom_summary();
|
|
265812
265899
|
init_network_egress_policy();
|
|
265813
|
-
__dirname3 = dirname11(
|
|
265900
|
+
__dirname3 = dirname11(fileURLToPath6(import.meta.url));
|
|
265814
265901
|
DEFAULT_PORT = 8130;
|
|
265815
265902
|
SCRAPE_SCRIPT = findScrapeScript();
|
|
265816
265903
|
BASE_URL = `http://localhost:${DEFAULT_PORT}`;
|
|
@@ -266173,9 +266260,9 @@ var init_browser_action = __esm({
|
|
|
266173
266260
|
import { execSync as execSync22, spawn as spawn13 } from "node:child_process";
|
|
266174
266261
|
import { existsSync as existsSync36, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, appendFileSync, copyFileSync as copyFileSync2 } from "node:fs";
|
|
266175
266262
|
import { join as join47, resolve as resolve27, dirname as dirname12 } from "node:path";
|
|
266176
|
-
import { fileURLToPath as
|
|
266263
|
+
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
266177
266264
|
function findAutoresearchScript(scriptName) {
|
|
266178
|
-
const thisDir = dirname12(
|
|
266265
|
+
const thisDir = dirname12(fileURLToPath7(import.meta.url));
|
|
266179
266266
|
const devPath3 = resolve27(thisDir, "../../scripts", scriptName);
|
|
266180
266267
|
if (existsSync36(devPath3))
|
|
266181
266268
|
return devPath3;
|
|
@@ -522366,11 +522453,11 @@ import { execSync as execSync40, spawnSync as spawnSync6 } from "node:child_proc
|
|
|
522366
522453
|
import { existsSync as existsSync51, mkdirSync as mkdirSync25, writeFileSync as writeFileSync23, readFileSync as readFileSync38, unlinkSync as unlinkSync11 } from "node:fs";
|
|
522367
522454
|
import { dirname as dirname15, join as join67, resolve as resolve34 } from "node:path";
|
|
522368
522455
|
import { tmpdir as tmpdir17, homedir as homedir21 } from "node:os";
|
|
522369
|
-
import { fileURLToPath as
|
|
522456
|
+
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
522370
522457
|
function _findNemotronScript() {
|
|
522371
522458
|
const candidates = [];
|
|
522372
522459
|
try {
|
|
522373
|
-
const here = dirname15(
|
|
522460
|
+
const here = dirname15(fileURLToPath8(import.meta.url));
|
|
522374
522461
|
candidates.push(resolve34(here, "../../scripts/live-nemotron.py"));
|
|
522375
522462
|
candidates.push(resolve34(here, "../../../scripts/live-nemotron.py"));
|
|
522376
522463
|
} catch {
|
|
@@ -526320,7 +526407,7 @@ Topic: ${segments.slice(0, 5).map((s2) => s2.text).join(" ").slice(0, 300)}`,
|
|
|
526320
526407
|
import { existsSync as existsSync58, readFileSync as readFileSync44, statSync as statSync25 } from "node:fs";
|
|
526321
526408
|
import { spawn as spawn19 } from "node:child_process";
|
|
526322
526409
|
import { resolve as resolve36, dirname as dirname18, join as join73, basename as basename16 } from "node:path";
|
|
526323
|
-
import { fileURLToPath as
|
|
526410
|
+
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
526324
526411
|
import { homedir as homedir25 } from "node:os";
|
|
526325
526412
|
function loadConfig2() {
|
|
526326
526413
|
if (!existsSync58(CONFIG_PATH))
|
|
@@ -526343,7 +526430,7 @@ async function probeSidecar(port) {
|
|
|
526343
526430
|
}
|
|
526344
526431
|
}
|
|
526345
526432
|
function findLauncherScript() {
|
|
526346
|
-
const here = dirname18(
|
|
526433
|
+
const here = dirname18(fileURLToPath9(import.meta.url));
|
|
526347
526434
|
const candidates = [
|
|
526348
526435
|
resolve36(here, "../../scripts/start-video-scan.py"),
|
|
526349
526436
|
resolve36(here, "../scripts/start-video-scan.py")
|
|
@@ -526571,7 +526658,7 @@ Format OK: ${r2.format_ok}`;
|
|
|
526571
526658
|
import { existsSync as existsSync59, readFileSync as readFileSync45 } from "node:fs";
|
|
526572
526659
|
import { spawn as spawn20 } from "node:child_process";
|
|
526573
526660
|
import { resolve as resolve37, dirname as dirname19, join as join74, basename as basename17 } from "node:path";
|
|
526574
|
-
import { fileURLToPath as
|
|
526661
|
+
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
526575
526662
|
import { homedir as homedir26 } from "node:os";
|
|
526576
526663
|
function loadConfig3() {
|
|
526577
526664
|
if (!existsSync59(CONFIG_PATH2))
|
|
@@ -526594,7 +526681,7 @@ async function probeSidecar2(port) {
|
|
|
526594
526681
|
}
|
|
526595
526682
|
}
|
|
526596
526683
|
function findLauncherScript2() {
|
|
526597
|
-
const here = dirname19(
|
|
526684
|
+
const here = dirname19(fileURLToPath10(import.meta.url));
|
|
526598
526685
|
const candidates = [
|
|
526599
526686
|
resolve37(here, "../../scripts/start-lance.py"),
|
|
526600
526687
|
resolve37(here, "../scripts/start-lance.py")
|
|
@@ -528913,7 +529000,7 @@ var init_dist6 = __esm({
|
|
|
528913
529000
|
// packages/orchestrator/dist/promptLoader.js
|
|
528914
529001
|
import { readFileSync as readFileSync49, existsSync as existsSync63 } from "node:fs";
|
|
528915
529002
|
import { join as join77, dirname as dirname21 } from "node:path";
|
|
528916
|
-
import { fileURLToPath as
|
|
529003
|
+
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
528917
529004
|
function loadPrompt(promptPath, vars) {
|
|
528918
529005
|
let content = cache5.get(promptPath);
|
|
528919
529006
|
if (content === void 0) {
|
|
@@ -528932,7 +529019,7 @@ var __filename3, __dirname4, PROMPTS_DIR, cache5;
|
|
|
528932
529019
|
var init_promptLoader = __esm({
|
|
528933
529020
|
"packages/orchestrator/dist/promptLoader.js"() {
|
|
528934
529021
|
"use strict";
|
|
528935
|
-
__filename3 =
|
|
529022
|
+
__filename3 = fileURLToPath11(import.meta.url);
|
|
528936
529023
|
__dirname4 = dirname21(__filename3);
|
|
528937
529024
|
PROMPTS_DIR = join77(__dirname4, "..", "prompts");
|
|
528938
529025
|
cache5 = /* @__PURE__ */ new Map();
|
|
@@ -532148,7 +532235,7 @@ var init_personality = __esm({
|
|
|
532148
532235
|
// packages/orchestrator/dist/critic.js
|
|
532149
532236
|
function buildForceProgressBlockMessage(call, hits) {
|
|
532150
532237
|
const argPreview = JSON.stringify(call.args ?? {}).slice(0, 200);
|
|
532151
|
-
return `[FORCED PROGRESS BLOCK — duplicate ${call.tool} call skipped; this is not a tool failure. You have called ${call.tool}(${argPreview}) ${hits} times with identical arguments. The runtime did not re-run the tool; it is returning the
|
|
532238
|
+
return `[FORCED PROGRESS BLOCK — duplicate ${call.tool} call skipped; this is not a tool failure. You have called ${call.tool}(${argPreview}) ${hits} times with identical arguments. The runtime did not re-run the tool; it is returning the prior result below so you can proceed without retrying.
|
|
532152
532239
|
|
|
532153
532240
|
Progress is REQUIRED before this tool will run again with the same arguments. To proceed, do one of these:
|
|
532154
532241
|
• file_write or file_edit to make progress, OR
|
|
@@ -532157,7 +532244,7 @@ Progress is REQUIRED before this tool will run again with the same arguments. To
|
|
|
532157
532244
|
• Call a different tool or use different arguments.]`;
|
|
532158
532245
|
}
|
|
532159
532246
|
function buildCachedResultEnvelope(result) {
|
|
532160
|
-
return `[CACHED RESULT — you already have this information from a prior
|
|
532247
|
+
return `[CACHED RESULT — you already have this information from a prior identical call. Do NOT call this tool again with the same arguments.]
|
|
532161
532248
|
${result}`;
|
|
532162
532249
|
}
|
|
532163
532250
|
function evaluate(inputs) {
|
|
@@ -532170,7 +532257,8 @@ function evaluate(inputs) {
|
|
|
532170
532257
|
cachedResult: cached ? buildCachedResultEnvelope(cached.result) : null
|
|
532171
532258
|
};
|
|
532172
532259
|
}
|
|
532173
|
-
|
|
532260
|
+
const cacheEligible = isReadLike || proposedCall.tool === "shell";
|
|
532261
|
+
if (cacheEligible) {
|
|
532174
532262
|
const cached = recentToolResults.get(fingerprint);
|
|
532175
532263
|
if (cached !== void 0) {
|
|
532176
532264
|
const hits = (dedupHitCount.get(fingerprint) ?? 0) + 1;
|
|
@@ -542541,12 +542629,12 @@ var init_reflectionBuffer = __esm({
|
|
|
542541
542629
|
if (!this.persistPath)
|
|
542542
542630
|
return;
|
|
542543
542631
|
try {
|
|
542544
|
-
const { writeFileSync:
|
|
542632
|
+
const { writeFileSync: writeFileSync77, mkdirSync: mkdirSync85, existsSync: existsSync138 } = __require("node:fs");
|
|
542545
542633
|
const { join: join155 } = __require("node:path");
|
|
542546
542634
|
const dir = join155(this.persistPath, "..");
|
|
542547
542635
|
if (!existsSync138(dir))
|
|
542548
|
-
|
|
542549
|
-
|
|
542636
|
+
mkdirSync85(dir, { recursive: true });
|
|
542637
|
+
writeFileSync77(this.persistPath, JSON.stringify(this.state, null, 2));
|
|
542550
542638
|
} catch {
|
|
542551
542639
|
}
|
|
542552
542640
|
}
|
|
@@ -544478,6 +544566,510 @@ var init_modelProfile = __esm({
|
|
|
544478
544566
|
}
|
|
544479
544567
|
});
|
|
544480
544568
|
|
|
544569
|
+
// packages/orchestrator/dist/failureHandoff.js
|
|
544570
|
+
function isPlainObject(value2) {
|
|
544571
|
+
return !!value2 && typeof value2 === "object" && !Array.isArray(value2);
|
|
544572
|
+
}
|
|
544573
|
+
function toEntries(patterns) {
|
|
544574
|
+
if (!patterns)
|
|
544575
|
+
return [];
|
|
544576
|
+
if (patterns instanceof Map)
|
|
544577
|
+
return Array.from(patterns.entries());
|
|
544578
|
+
if (isPlainObject(patterns))
|
|
544579
|
+
return Object.entries(patterns);
|
|
544580
|
+
return [];
|
|
544581
|
+
}
|
|
544582
|
+
function toNumber(value2, fallback = 0) {
|
|
544583
|
+
return typeof value2 === "number" && Number.isFinite(value2) ? value2 : fallback;
|
|
544584
|
+
}
|
|
544585
|
+
function toOptionalNumber(value2) {
|
|
544586
|
+
return typeof value2 === "number" && Number.isFinite(value2) ? value2 : void 0;
|
|
544587
|
+
}
|
|
544588
|
+
function cleanInline(value2, max = 220) {
|
|
544589
|
+
if (typeof value2 !== "string")
|
|
544590
|
+
return "";
|
|
544591
|
+
const normalized = value2.split("\n").map((line) => line.trim()).filter(Boolean).join(" ");
|
|
544592
|
+
return normalized.length > max ? `${normalized.slice(0, max - 3)}...` : normalized;
|
|
544593
|
+
}
|
|
544594
|
+
function normalizeModifiedFiles(modifiedFiles) {
|
|
544595
|
+
if (!modifiedFiles)
|
|
544596
|
+
return [];
|
|
544597
|
+
if (modifiedFiles instanceof Map)
|
|
544598
|
+
return Array.from(modifiedFiles.entries());
|
|
544599
|
+
if (Array.isArray(modifiedFiles))
|
|
544600
|
+
return modifiedFiles;
|
|
544601
|
+
if (isPlainObject(modifiedFiles))
|
|
544602
|
+
return Object.entries(modifiedFiles);
|
|
544603
|
+
return [];
|
|
544604
|
+
}
|
|
544605
|
+
function recordEntry(merged, entry) {
|
|
544606
|
+
const existing = merged.get(entry.signature);
|
|
544607
|
+
if (!existing || entry.count > existing.count) {
|
|
544608
|
+
merged.set(entry.signature, entry);
|
|
544609
|
+
return;
|
|
544610
|
+
}
|
|
544611
|
+
if (existing.guidance.length === 0 && entry.guidance.length > 0) {
|
|
544612
|
+
merged.set(entry.signature, { ...existing, guidance: entry.guidance });
|
|
544613
|
+
}
|
|
544614
|
+
}
|
|
544615
|
+
function normalizeFailurePatterns(patterns) {
|
|
544616
|
+
const merged = /* @__PURE__ */ new Map();
|
|
544617
|
+
for (const [signature, raw] of toEntries(patterns)) {
|
|
544618
|
+
if (signature === "patterns" && isPlainObject(raw)) {
|
|
544619
|
+
for (const legacyRaw of Object.values(raw)) {
|
|
544620
|
+
if (!isPlainObject(legacyRaw))
|
|
544621
|
+
continue;
|
|
544622
|
+
const legacyId = cleanInline(legacyRaw["id"], 120);
|
|
544623
|
+
const pattern = cleanInline(legacyRaw["pattern"], 220);
|
|
544624
|
+
const cause = cleanInline(legacyRaw["cause"], 220);
|
|
544625
|
+
const solution = cleanInline(legacyRaw["solution"], 260);
|
|
544626
|
+
const legacySignature = legacyId || pattern;
|
|
544627
|
+
if (!legacySignature)
|
|
544628
|
+
continue;
|
|
544629
|
+
const guidanceParts = [cause, solution].filter(Boolean);
|
|
544630
|
+
recordEntry(merged, {
|
|
544631
|
+
signature: legacySignature,
|
|
544632
|
+
count: toNumber(legacyRaw["count"], 1),
|
|
544633
|
+
guidance: guidanceParts.length > 0 ? guidanceParts.join(" ") : pattern,
|
|
544634
|
+
lastSeen: toOptionalNumber(legacyRaw["lastSeen"]),
|
|
544635
|
+
source: "legacy"
|
|
544636
|
+
});
|
|
544637
|
+
}
|
|
544638
|
+
continue;
|
|
544639
|
+
}
|
|
544640
|
+
if (!isPlainObject(raw))
|
|
544641
|
+
continue;
|
|
544642
|
+
const count = toNumber(raw["count"], 0);
|
|
544643
|
+
if (count <= 0)
|
|
544644
|
+
continue;
|
|
544645
|
+
recordEntry(merged, {
|
|
544646
|
+
signature,
|
|
544647
|
+
count,
|
|
544648
|
+
guidance: cleanInline(raw["guidance"], 300),
|
|
544649
|
+
tool: cleanInline(raw["tool"], 80) || void 0,
|
|
544650
|
+
errorType: cleanInline(raw["errorType"], 80) || void 0,
|
|
544651
|
+
lastSeen: toOptionalNumber(raw["lastSeen"]),
|
|
544652
|
+
source: "direct"
|
|
544653
|
+
});
|
|
544654
|
+
}
|
|
544655
|
+
return Array.from(merged.values()).sort((a2, b) => {
|
|
544656
|
+
if (b.count !== a2.count)
|
|
544657
|
+
return b.count - a2.count;
|
|
544658
|
+
return a2.signature.localeCompare(b.signature);
|
|
544659
|
+
});
|
|
544660
|
+
}
|
|
544661
|
+
function buildFailureModeHandoff(input) {
|
|
544662
|
+
const patterns = normalizeFailurePatterns(input.errorPatterns).slice(0, input.maxPatterns ?? 10);
|
|
544663
|
+
const toolCalls = input.toolCallLog ?? [];
|
|
544664
|
+
const maxRecentCalls = input.maxRecentCalls ?? 8;
|
|
544665
|
+
const recentCalls = maxRecentCalls > 0 ? toolCalls.slice(-maxRecentCalls) : [];
|
|
544666
|
+
const failedCalls = toolCalls.filter((call) => call.success === false);
|
|
544667
|
+
const modified = normalizeModifiedFiles(input.taskState?.modifiedFiles);
|
|
544668
|
+
const failedApproaches = input.taskState?.failedApproaches ?? [];
|
|
544669
|
+
const completedSteps = input.taskState?.completedSteps ?? [];
|
|
544670
|
+
const pendingSteps = input.taskState?.pendingSteps ?? [];
|
|
544671
|
+
const currentStep = cleanInline(input.taskState?.currentStep, 180);
|
|
544672
|
+
const nextAction = cleanInline(input.taskState?.nextAction, 180);
|
|
544673
|
+
const goal = cleanInline(input.taskGoal || input.taskState?.goal || input.taskState?.originalGoal || "", 260);
|
|
544674
|
+
if (patterns.length === 0 && recentCalls.length === 0 && modified.length === 0 && failedApproaches.length === 0 && !goal) {
|
|
544675
|
+
return null;
|
|
544676
|
+
}
|
|
544677
|
+
const lines = ["[FAILURE-MODE INTAKE]"];
|
|
544678
|
+
if (goal)
|
|
544679
|
+
lines.push(`Goal: ${goal}`);
|
|
544680
|
+
if (patterns.length > 0) {
|
|
544681
|
+
lines.push("Top persisted failure modes:");
|
|
544682
|
+
for (const p2 of patterns) {
|
|
544683
|
+
const guidance = p2.guidance ? ` - ${p2.guidance}` : "";
|
|
544684
|
+
lines.push(`- ${p2.signature} x${p2.count}${guidance}`);
|
|
544685
|
+
}
|
|
544686
|
+
}
|
|
544687
|
+
if (recentCalls.length > 0) {
|
|
544688
|
+
const total = toolCalls.length;
|
|
544689
|
+
const failed = failedCalls.length;
|
|
544690
|
+
const mutations = toolCalls.filter((call) => call.mutated || (call.mutatedFiles?.length ?? 0) > 0).length;
|
|
544691
|
+
lines.push(`Current run: ${total} tool calls, ${failed} failed, ${mutations} mutation calls.`);
|
|
544692
|
+
const lastFailure = failedCalls[failedCalls.length - 1];
|
|
544693
|
+
if (lastFailure) {
|
|
544694
|
+
const preview = cleanInline(lastFailure.outputPreview, 240);
|
|
544695
|
+
lines.push(`Last raw failure: ${lastFailure.name}${preview ? ` - ${preview}` : ""}`);
|
|
544696
|
+
}
|
|
544697
|
+
}
|
|
544698
|
+
if (modified.length > 0) {
|
|
544699
|
+
lines.push(`Files touched: ${modified.slice(-8).map(([path12, action]) => `${path12} (${action})`).join(", ")}`);
|
|
544700
|
+
} else {
|
|
544701
|
+
lines.push("Files touched: none recorded.");
|
|
544702
|
+
}
|
|
544703
|
+
if (completedSteps.length > 0) {
|
|
544704
|
+
lines.push(`Recent completed steps: ${completedSteps.slice(-4).join("; ")}`);
|
|
544705
|
+
}
|
|
544706
|
+
if (currentStep)
|
|
544707
|
+
lines.push(`Current step: ${currentStep}`);
|
|
544708
|
+
if (failedApproaches.length > 0) {
|
|
544709
|
+
lines.push(`Failed approaches: ${failedApproaches.slice(-4).join("; ")}`);
|
|
544710
|
+
}
|
|
544711
|
+
if (pendingSteps.length > 0) {
|
|
544712
|
+
lines.push(`Remaining work: ${pendingSteps.slice(0, 5).join("; ")}`);
|
|
544713
|
+
} else if (nextAction) {
|
|
544714
|
+
lines.push(`Next action: ${nextAction}`);
|
|
544715
|
+
}
|
|
544716
|
+
lines.push("Operating rule: base the next move on the raw failure/output state above; do not repeat the same failed approach unchanged.");
|
|
544717
|
+
lines.push("[/FAILURE-MODE INTAKE]");
|
|
544718
|
+
return lines.join("\n");
|
|
544719
|
+
}
|
|
544720
|
+
function computeCommitProgressGate(input) {
|
|
544721
|
+
const cooldown = input.cooldownTurns ?? 4;
|
|
544722
|
+
if (typeof input.lastInjectedTurn === "number" && input.lastInjectedTurn >= 0 && input.turn - input.lastInjectedTurn < cooldown) {
|
|
544723
|
+
return { shouldInject: false };
|
|
544724
|
+
}
|
|
544725
|
+
const touched = normalizeModifiedFiles(input.taskState?.modifiedFiles);
|
|
544726
|
+
const mutationCalls = input.toolCallLog.filter((call) => call.mutated || (call.mutatedFiles?.length ?? 0) > 0);
|
|
544727
|
+
if (touched.length > 0 || mutationCalls.length > 0) {
|
|
544728
|
+
return { shouldInject: false };
|
|
544729
|
+
}
|
|
544730
|
+
const successfulDiscovery = input.toolCallLog.filter((call) => call.success === true && DISCOVERY_TOOLS.has(call.name));
|
|
544731
|
+
if (successfulDiscovery.length < 3)
|
|
544732
|
+
return { shouldInject: false };
|
|
544733
|
+
const lastTools = input.toolCallLog.slice(-5).map((call) => `${call.name}:${call.success === false ? "failed" : "ok"}`).join(", ");
|
|
544734
|
+
return {
|
|
544735
|
+
shouldInject: true,
|
|
544736
|
+
content: [
|
|
544737
|
+
"[PROGRESS GATE - evidence gathered, no files changed]",
|
|
544738
|
+
`Successful discovery calls: ${successfulDiscovery.length}. Files touched: none recorded.`,
|
|
544739
|
+
lastTools ? `Recent tools: ${lastTools}.` : "",
|
|
544740
|
+
"If the current task requires a repo change, make the smallest direct edit now. If no edit is required, or a blocker prevents one, state that explicitly in the next action instead of doing generic discovery.",
|
|
544741
|
+
"[/PROGRESS GATE]"
|
|
544742
|
+
].filter(Boolean).join("\n")
|
|
544743
|
+
};
|
|
544744
|
+
}
|
|
544745
|
+
function computeShellFailurePivot(input) {
|
|
544746
|
+
const cooldown = input.cooldownTurns ?? 3;
|
|
544747
|
+
if (typeof input.lastInjectedTurn === "number" && input.lastInjectedTurn >= 0 && input.turn - input.lastInjectedTurn < cooldown) {
|
|
544748
|
+
return { shouldInject: false };
|
|
544749
|
+
}
|
|
544750
|
+
const recentShellFailures = input.toolCallLog.slice(-4).filter((call) => call.name === "shell" && call.success === false);
|
|
544751
|
+
if (recentShellFailures.length < 2)
|
|
544752
|
+
return { shouldInject: false };
|
|
544753
|
+
const raw = recentShellFailures.map((call) => cleanInline(call.outputPreview, 220)).filter(Boolean).slice(-2);
|
|
544754
|
+
return {
|
|
544755
|
+
shouldInject: true,
|
|
544756
|
+
content: [
|
|
544757
|
+
"[SHELL FAILURE PIVOT - raw output repeated]",
|
|
544758
|
+
`Recent failed shell calls: ${recentShellFailures.length}.`,
|
|
544759
|
+
raw.length > 0 ? `Raw failure preview: ${raw.join(" | ")}` : "",
|
|
544760
|
+
"Switch approach before issuing another shell command with similar intent. Prefer a direct file/tool action when it can make progress, or run one simpler command that isolates a single missing fact.",
|
|
544761
|
+
"[/SHELL FAILURE PIVOT]"
|
|
544762
|
+
].filter(Boolean).join("\n")
|
|
544763
|
+
};
|
|
544764
|
+
}
|
|
544765
|
+
function computeNoProgressCompletionGate(input) {
|
|
544766
|
+
const touched = normalizeModifiedFiles(input.taskState?.modifiedFiles);
|
|
544767
|
+
const mutationCalls = input.toolCallLog.filter((call) => call.mutated || (call.mutatedFiles?.length ?? 0) > 0);
|
|
544768
|
+
if (touched.length > 0 || mutationCalls.length > 0) {
|
|
544769
|
+
return { shouldInject: false };
|
|
544770
|
+
}
|
|
544771
|
+
const successfulDiscovery = input.toolCallLog.filter((call) => call.success === true && DISCOVERY_TOOLS.has(call.name));
|
|
544772
|
+
if (successfulDiscovery.length < 3)
|
|
544773
|
+
return { shouldInject: false };
|
|
544774
|
+
const summary = (input.summary ?? "").trim();
|
|
544775
|
+
if (summary.startsWith("BLOCKED:") || summary.startsWith("NO FILE CHANGES REQUIRED:")) {
|
|
544776
|
+
return { shouldInject: false };
|
|
544777
|
+
}
|
|
544778
|
+
return {
|
|
544779
|
+
shouldInject: true,
|
|
544780
|
+
content: [
|
|
544781
|
+
"[TASK_COMPLETE HELD - no recorded deliverable]",
|
|
544782
|
+
`This run has ${successfulDiscovery.length} successful discovery calls and no recorded file mutations.`,
|
|
544783
|
+
"If the requested work truly needs no file change, retry task_complete with summary starting `NO FILE CHANGES REQUIRED:` and explain the evidence. If you are blocked, retry with `BLOCKED:` and the blocker. Otherwise make the smallest direct change before completing.",
|
|
544784
|
+
"[/TASK_COMPLETE HELD]"
|
|
544785
|
+
].join("\n")
|
|
544786
|
+
};
|
|
544787
|
+
}
|
|
544788
|
+
var DISCOVERY_TOOLS;
|
|
544789
|
+
var init_failureHandoff = __esm({
|
|
544790
|
+
"packages/orchestrator/dist/failureHandoff.js"() {
|
|
544791
|
+
"use strict";
|
|
544792
|
+
DISCOVERY_TOOLS = /* @__PURE__ */ new Set([
|
|
544793
|
+
"file_read",
|
|
544794
|
+
"grep_search",
|
|
544795
|
+
"find_files",
|
|
544796
|
+
"list_directory",
|
|
544797
|
+
"file_explore",
|
|
544798
|
+
"memory_read",
|
|
544799
|
+
"working_notes",
|
|
544800
|
+
"memex_retrieve"
|
|
544801
|
+
]);
|
|
544802
|
+
}
|
|
544803
|
+
});
|
|
544804
|
+
|
|
544805
|
+
// packages/orchestrator/dist/context-fabric.js
|
|
544806
|
+
function estimateTokens(text) {
|
|
544807
|
+
return Math.ceil(text.length / 4);
|
|
544808
|
+
}
|
|
544809
|
+
function normalizeSignalContent(content) {
|
|
544810
|
+
return content.replace(/\r\n/g, "\n").split("\n").map((line) => line.trimEnd()).join("\n").trim();
|
|
544811
|
+
}
|
|
544812
|
+
function truncateText(text, maxChars) {
|
|
544813
|
+
if (text.length <= maxChars)
|
|
544814
|
+
return { text, truncated: false };
|
|
544815
|
+
if (maxChars <= 40)
|
|
544816
|
+
return { text: text.slice(0, maxChars), truncated: true };
|
|
544817
|
+
return {
|
|
544818
|
+
text: `${text.slice(0, maxChars - 36).trimEnd()}
|
|
544819
|
+
... [truncated by context fabric]`,
|
|
544820
|
+
truncated: true
|
|
544821
|
+
};
|
|
544822
|
+
}
|
|
544823
|
+
function signalFromBlock(kind, source, content, options2 = {}) {
|
|
544824
|
+
const normalized = normalizeSignalContent(content ?? "");
|
|
544825
|
+
if (!normalized)
|
|
544826
|
+
return null;
|
|
544827
|
+
return {
|
|
544828
|
+
id: options2.id ?? source,
|
|
544829
|
+
kind,
|
|
544830
|
+
source,
|
|
544831
|
+
content: normalized,
|
|
544832
|
+
priority: options2.priority,
|
|
544833
|
+
createdTurn: options2.createdTurn,
|
|
544834
|
+
ttlTurns: options2.ttlTurns,
|
|
544835
|
+
dedupeKey: options2.dedupeKey,
|
|
544836
|
+
tags: options2.tags,
|
|
544837
|
+
metadata: options2.metadata
|
|
544838
|
+
};
|
|
544839
|
+
}
|
|
544840
|
+
var KIND_ORDER, KIND_LABELS, DEFAULT_KIND_CHAR_BUDGET, ContextLedger, ContextFrameBuilder;
|
|
544841
|
+
var init_context_fabric = __esm({
|
|
544842
|
+
"packages/orchestrator/dist/context-fabric.js"() {
|
|
544843
|
+
"use strict";
|
|
544844
|
+
KIND_ORDER = [
|
|
544845
|
+
"goal",
|
|
544846
|
+
"user_steering",
|
|
544847
|
+
"task_state",
|
|
544848
|
+
"known_files",
|
|
544849
|
+
"recent_failure",
|
|
544850
|
+
"tool_cache",
|
|
544851
|
+
"skill_manifest",
|
|
544852
|
+
"memory",
|
|
544853
|
+
"session_history",
|
|
544854
|
+
"anchor",
|
|
544855
|
+
"handoff",
|
|
544856
|
+
"environment",
|
|
544857
|
+
"compaction_summary"
|
|
544858
|
+
];
|
|
544859
|
+
KIND_LABELS = {
|
|
544860
|
+
goal: "Goal",
|
|
544861
|
+
user_steering: "User Steering",
|
|
544862
|
+
task_state: "Task State",
|
|
544863
|
+
known_files: "Known Files",
|
|
544864
|
+
recent_failure: "Recent Failures",
|
|
544865
|
+
tool_cache: "Tool Cache",
|
|
544866
|
+
skill_manifest: "Skill Manifest",
|
|
544867
|
+
memory: "Memory",
|
|
544868
|
+
session_history: "Session History",
|
|
544869
|
+
anchor: "Relevant Anchors",
|
|
544870
|
+
handoff: "Handoff",
|
|
544871
|
+
environment: "Environment",
|
|
544872
|
+
compaction_summary: "Compaction Summary"
|
|
544873
|
+
};
|
|
544874
|
+
DEFAULT_KIND_CHAR_BUDGET = {
|
|
544875
|
+
goal: 900,
|
|
544876
|
+
user_steering: 1400,
|
|
544877
|
+
task_state: 1800,
|
|
544878
|
+
known_files: 2400,
|
|
544879
|
+
recent_failure: 2600,
|
|
544880
|
+
tool_cache: 2200,
|
|
544881
|
+
skill_manifest: 900,
|
|
544882
|
+
memory: 1500,
|
|
544883
|
+
session_history: 1400,
|
|
544884
|
+
anchor: 1100,
|
|
544885
|
+
handoff: 1600,
|
|
544886
|
+
environment: 900,
|
|
544887
|
+
compaction_summary: 1200
|
|
544888
|
+
};
|
|
544889
|
+
ContextLedger = class {
|
|
544890
|
+
signals = /* @__PURE__ */ new Map();
|
|
544891
|
+
sequence = 0;
|
|
544892
|
+
upsert(signal) {
|
|
544893
|
+
const content = normalizeSignalContent(signal.content);
|
|
544894
|
+
if (!content)
|
|
544895
|
+
return;
|
|
544896
|
+
const key = signal.dedupeKey || `${signal.kind}:${signal.id}`;
|
|
544897
|
+
const incoming = {
|
|
544898
|
+
...signal,
|
|
544899
|
+
content,
|
|
544900
|
+
key,
|
|
544901
|
+
priority: signal.priority ?? 0,
|
|
544902
|
+
createdTurn: signal.createdTurn ?? 0,
|
|
544903
|
+
sequence: ++this.sequence
|
|
544904
|
+
};
|
|
544905
|
+
const existing = this.signals.get(key);
|
|
544906
|
+
if (!existing) {
|
|
544907
|
+
this.signals.set(key, incoming);
|
|
544908
|
+
return;
|
|
544909
|
+
}
|
|
544910
|
+
const shouldReplace = incoming.createdTurn > existing.createdTurn || incoming.createdTurn === existing.createdTurn && incoming.priority >= existing.priority || incoming.priority > existing.priority;
|
|
544911
|
+
if (shouldReplace) {
|
|
544912
|
+
this.signals.set(key, {
|
|
544913
|
+
...existing,
|
|
544914
|
+
...incoming,
|
|
544915
|
+
tags: [.../* @__PURE__ */ new Set([...existing.tags ?? [], ...incoming.tags ?? []])],
|
|
544916
|
+
metadata: { ...existing.metadata ?? {}, ...incoming.metadata ?? {} }
|
|
544917
|
+
});
|
|
544918
|
+
}
|
|
544919
|
+
}
|
|
544920
|
+
upsertMany(signals) {
|
|
544921
|
+
for (const signal of signals)
|
|
544922
|
+
this.upsert(signal);
|
|
544923
|
+
}
|
|
544924
|
+
removeWhere(predicate) {
|
|
544925
|
+
let removed = 0;
|
|
544926
|
+
for (const [key, signal] of this.signals.entries()) {
|
|
544927
|
+
if (predicate(signal)) {
|
|
544928
|
+
this.signals.delete(key);
|
|
544929
|
+
removed++;
|
|
544930
|
+
}
|
|
544931
|
+
}
|
|
544932
|
+
return removed;
|
|
544933
|
+
}
|
|
544934
|
+
clearSource(source) {
|
|
544935
|
+
return this.removeWhere((signal) => signal.source === source);
|
|
544936
|
+
}
|
|
544937
|
+
clearSources(prefix) {
|
|
544938
|
+
return this.removeWhere((signal) => signal.source.startsWith(prefix));
|
|
544939
|
+
}
|
|
544940
|
+
prune(turn) {
|
|
544941
|
+
return this.removeWhere((signal) => {
|
|
544942
|
+
if (signal.ttlTurns === void 0)
|
|
544943
|
+
return false;
|
|
544944
|
+
const created = signal.createdTurn ?? 0;
|
|
544945
|
+
return turn - created > signal.ttlTurns;
|
|
544946
|
+
});
|
|
544947
|
+
}
|
|
544948
|
+
values() {
|
|
544949
|
+
return [...this.signals.values()].map(({ key: _key, sequence: _sequence, ...signal }) => ({
|
|
544950
|
+
...signal
|
|
544951
|
+
}));
|
|
544952
|
+
}
|
|
544953
|
+
size() {
|
|
544954
|
+
return this.signals.size;
|
|
544955
|
+
}
|
|
544956
|
+
};
|
|
544957
|
+
ContextFrameBuilder = class {
|
|
544958
|
+
build(signals, options2 = {}) {
|
|
544959
|
+
const maxChars = Math.max(1200, options2.maxChars ?? 1e4);
|
|
544960
|
+
const budgets = { ...DEFAULT_KIND_CHAR_BUDGET, ...options2.kindCharBudget ?? {} };
|
|
544961
|
+
const sanitized = signals.map((signal) => ({ ...signal, content: normalizeSignalContent(signal.content) })).filter((signal) => signal.content.length > 0);
|
|
544962
|
+
const byKind = /* @__PURE__ */ new Map();
|
|
544963
|
+
for (const signal of sanitized) {
|
|
544964
|
+
const bucket = byKind.get(signal.kind) ?? [];
|
|
544965
|
+
bucket.push(signal);
|
|
544966
|
+
byKind.set(signal.kind, bucket);
|
|
544967
|
+
}
|
|
544968
|
+
const included = [];
|
|
544969
|
+
const dropped = [];
|
|
544970
|
+
const sectionLines = [];
|
|
544971
|
+
const sectionDiagnostics = [];
|
|
544972
|
+
let truncatedSignals = 0;
|
|
544973
|
+
for (const kind of KIND_ORDER) {
|
|
544974
|
+
const bucket = byKind.get(kind);
|
|
544975
|
+
if (!bucket || bucket.length === 0)
|
|
544976
|
+
continue;
|
|
544977
|
+
const sorted = [...bucket].sort((a2, b) => {
|
|
544978
|
+
const pa = a2.priority ?? 0;
|
|
544979
|
+
const pb = b.priority ?? 0;
|
|
544980
|
+
if (pa !== pb)
|
|
544981
|
+
return pb - pa;
|
|
544982
|
+
const ta = a2.createdTurn ?? 0;
|
|
544983
|
+
const tb = b.createdTurn ?? 0;
|
|
544984
|
+
if (ta !== tb)
|
|
544985
|
+
return tb - ta;
|
|
544986
|
+
return a2.source.localeCompare(b.source) || a2.id.localeCompare(b.id);
|
|
544987
|
+
});
|
|
544988
|
+
const budget = Math.max(200, budgets[kind]);
|
|
544989
|
+
const body = [];
|
|
544990
|
+
let chars = 0;
|
|
544991
|
+
let used = 0;
|
|
544992
|
+
for (const signal of sorted) {
|
|
544993
|
+
const prefix = sorted.length > 1 ? `- ${signal.content}` : signal.content;
|
|
544994
|
+
const remaining = budget - chars;
|
|
544995
|
+
if (remaining <= 80) {
|
|
544996
|
+
dropped.push(signal);
|
|
544997
|
+
continue;
|
|
544998
|
+
}
|
|
544999
|
+
const rendered = truncateText(prefix, remaining);
|
|
545000
|
+
if (rendered.truncated)
|
|
545001
|
+
truncatedSignals++;
|
|
545002
|
+
body.push(rendered.text);
|
|
545003
|
+
chars += rendered.text.length + 1;
|
|
545004
|
+
included.push(signal);
|
|
545005
|
+
used++;
|
|
545006
|
+
if (rendered.truncated) {
|
|
545007
|
+
for (const rest of sorted.slice(sorted.indexOf(signal) + 1))
|
|
545008
|
+
dropped.push(rest);
|
|
545009
|
+
break;
|
|
545010
|
+
}
|
|
545011
|
+
}
|
|
545012
|
+
if (body.length === 0)
|
|
545013
|
+
continue;
|
|
545014
|
+
const label = KIND_LABELS[kind];
|
|
545015
|
+
sectionLines.push(`## ${label}`);
|
|
545016
|
+
sectionLines.push(body.join("\n"));
|
|
545017
|
+
sectionDiagnostics.push({ kind, label, signals: used, chars });
|
|
545018
|
+
}
|
|
545019
|
+
const header = [
|
|
545020
|
+
"[ACTIVE CONTEXT FRAME]",
|
|
545021
|
+
options2.turn !== void 0 ? `turn: ${options2.turn}` : null,
|
|
545022
|
+
"Scope: runtime state for the next action. Treat this as the single merged context intake; do not re-read or re-emit it unless state changes."
|
|
545023
|
+
].filter(Boolean);
|
|
545024
|
+
let content = [...header, "", ...sectionLines].join("\n").trim();
|
|
545025
|
+
if (sectionLines.length === 0) {
|
|
545026
|
+
return {
|
|
545027
|
+
content: null,
|
|
545028
|
+
diagnostics: {
|
|
545029
|
+
includedSignals: 0,
|
|
545030
|
+
droppedSignals: sanitized.length,
|
|
545031
|
+
truncatedSignals: 0,
|
|
545032
|
+
estimatedTokens: 0,
|
|
545033
|
+
totalChars: 0,
|
|
545034
|
+
sections: []
|
|
545035
|
+
},
|
|
545036
|
+
included: [],
|
|
545037
|
+
dropped: sanitized
|
|
545038
|
+
};
|
|
545039
|
+
}
|
|
545040
|
+
if (content.length > maxChars) {
|
|
545041
|
+
const truncated = truncateText(content, maxChars);
|
|
545042
|
+
content = truncated.text;
|
|
545043
|
+
if (truncated.truncated)
|
|
545044
|
+
truncatedSignals++;
|
|
545045
|
+
for (const signal of sanitized) {
|
|
545046
|
+
if (!included.includes(signal) && !dropped.includes(signal))
|
|
545047
|
+
dropped.push(signal);
|
|
545048
|
+
}
|
|
545049
|
+
}
|
|
545050
|
+
if (options2.includeDiagnostics) {
|
|
545051
|
+
content += `
|
|
545052
|
+
|
|
545053
|
+
context_fabric: included=${included.length} dropped=${dropped.length} truncated=${truncatedSignals} est_tokens=${estimateTokens(content)}`;
|
|
545054
|
+
}
|
|
545055
|
+
return {
|
|
545056
|
+
content,
|
|
545057
|
+
diagnostics: {
|
|
545058
|
+
includedSignals: included.length,
|
|
545059
|
+
droppedSignals: dropped.length,
|
|
545060
|
+
truncatedSignals,
|
|
545061
|
+
estimatedTokens: estimateTokens(content),
|
|
545062
|
+
totalChars: content.length,
|
|
545063
|
+
sections: sectionDiagnostics
|
|
545064
|
+
},
|
|
545065
|
+
included,
|
|
545066
|
+
dropped
|
|
545067
|
+
};
|
|
545068
|
+
}
|
|
545069
|
+
};
|
|
545070
|
+
}
|
|
545071
|
+
});
|
|
545072
|
+
|
|
544481
545073
|
// packages/orchestrator/dist/preflightSnapshot.js
|
|
544482
545074
|
var preflightSnapshot_exports = {};
|
|
544483
545075
|
__export(preflightSnapshot_exports, {
|
|
@@ -545826,6 +546418,8 @@ var init_agenticRunner = __esm({
|
|
|
545826
546418
|
init_streaming_executor();
|
|
545827
546419
|
init_specDecomposer();
|
|
545828
546420
|
init_modelProfile();
|
|
546421
|
+
init_failureHandoff();
|
|
546422
|
+
init_context_fabric();
|
|
545829
546423
|
TOOL_SUBSETS = {
|
|
545830
546424
|
web: ["web_search", "web_fetch", "web_crawl"],
|
|
545831
546425
|
code: [
|
|
@@ -546263,6 +546857,10 @@ var init_agenticRunner = __esm({
|
|
|
546263
546857
|
// Phase 6 — last-surface guard so we don't re-inject the same anchor on
|
|
546264
546858
|
// consecutive turns when its keywords still match.
|
|
546265
546859
|
_lastSurfacedAnchorIds = /* @__PURE__ */ new Set();
|
|
546860
|
+
// Context Fabric — all transient runtime guidance is merged through this
|
|
546861
|
+
// ledger and emitted as one bounded frame before each model call.
|
|
546862
|
+
_contextLedger = new ContextLedger();
|
|
546863
|
+
_contextFrameBuilder = new ContextFrameBuilder();
|
|
546266
546864
|
/** WO-AM-10: Process pending episode embeddings in background batches */
|
|
546267
546865
|
async processPendingEmbeddings() {
|
|
546268
546866
|
if (this._pendingEmbeddings.length === 0 || !this._episodeStore)
|
|
@@ -548427,6 +549025,80 @@ ${latest.output || ""}`.trim();
|
|
|
548427
549025
|
return null;
|
|
548428
549026
|
return sections.join("\n");
|
|
548429
549027
|
}
|
|
549028
|
+
_insertContextFrame(messages2, frame) {
|
|
549029
|
+
if (!frame)
|
|
549030
|
+
return;
|
|
549031
|
+
const insertAt = Math.max(0, messages2.length - 1);
|
|
549032
|
+
messages2.splice(insertAt, 0, { role: "system", content: frame });
|
|
549033
|
+
}
|
|
549034
|
+
_buildTurnContextFrame(turn, messages2, recentToolResults, environmentBlock) {
|
|
549035
|
+
this._contextLedger.clearSources("turn.");
|
|
549036
|
+
this._contextLedger.prune(turn);
|
|
549037
|
+
const signals = [
|
|
549038
|
+
signalFromBlock("goal", "run.goal", this._taskState.goal ? `Active task: ${this._taskState.goal}` : null, {
|
|
549039
|
+
id: "active-task",
|
|
549040
|
+
dedupeKey: "run.goal",
|
|
549041
|
+
priority: 100,
|
|
549042
|
+
createdTurn: turn
|
|
549043
|
+
}),
|
|
549044
|
+
signalFromBlock("known_files", "turn.files", this._renderFilesystemStateBlock(turn), {
|
|
549045
|
+
id: "filesystem-state",
|
|
549046
|
+
dedupeKey: "turn.files",
|
|
549047
|
+
priority: 70,
|
|
549048
|
+
createdTurn: turn,
|
|
549049
|
+
ttlTurns: 1
|
|
549050
|
+
}),
|
|
549051
|
+
signalFromBlock("task_state", "turn.todos", this._renderTodoStateBlock(turn), {
|
|
549052
|
+
id: "todo-state",
|
|
549053
|
+
dedupeKey: "turn.todos",
|
|
549054
|
+
priority: 80,
|
|
549055
|
+
createdTurn: turn,
|
|
549056
|
+
ttlTurns: 1
|
|
549057
|
+
}),
|
|
549058
|
+
signalFromBlock("recent_failure", "turn.failures", this._renderRecentFailuresBlock(turn), {
|
|
549059
|
+
id: "recent-failures",
|
|
549060
|
+
dedupeKey: "turn.failures",
|
|
549061
|
+
priority: 95,
|
|
549062
|
+
createdTurn: turn,
|
|
549063
|
+
ttlTurns: 1
|
|
549064
|
+
}),
|
|
549065
|
+
signalFromBlock("recent_failure", "turn.churn", this._renderWriteChurnBlock(turn), {
|
|
549066
|
+
id: "write-churn",
|
|
549067
|
+
dedupeKey: "turn.churn",
|
|
549068
|
+
priority: 75,
|
|
549069
|
+
createdTurn: turn,
|
|
549070
|
+
ttlTurns: 1
|
|
549071
|
+
}),
|
|
549072
|
+
signalFromBlock("tool_cache", "turn.tool-cache", recentToolResults ? this._renderKnowledgeBlock(recentToolResults) : null, {
|
|
549073
|
+
id: "tool-cache",
|
|
549074
|
+
dedupeKey: "turn.tool-cache",
|
|
549075
|
+
priority: 65,
|
|
549076
|
+
createdTurn: turn,
|
|
549077
|
+
ttlTurns: 1
|
|
549078
|
+
}),
|
|
549079
|
+
signalFromBlock("anchor", "turn.anchors", this.surfaceAnchors(messages2), {
|
|
549080
|
+
id: "anchors",
|
|
549081
|
+
dedupeKey: "turn.anchors",
|
|
549082
|
+
priority: 50,
|
|
549083
|
+
createdTurn: turn,
|
|
549084
|
+
ttlTurns: 1
|
|
549085
|
+
}),
|
|
549086
|
+
signalFromBlock("environment", "turn.environment", environmentBlock, {
|
|
549087
|
+
id: "environment",
|
|
549088
|
+
dedupeKey: "turn.environment",
|
|
549089
|
+
priority: 35,
|
|
549090
|
+
createdTurn: turn,
|
|
549091
|
+
ttlTurns: 1
|
|
549092
|
+
})
|
|
549093
|
+
];
|
|
549094
|
+
this._contextLedger.upsertMany(signals.filter(Boolean));
|
|
549095
|
+
const frame = this._contextFrameBuilder.build(this._contextLedger.values(), {
|
|
549096
|
+
turn,
|
|
549097
|
+
maxChars: 1e4,
|
|
549098
|
+
includeDiagnostics: process.env["OMNIUS_CONTEXT_FABRIC_DIAGNOSTICS"] === "1"
|
|
549099
|
+
});
|
|
549100
|
+
return frame.content;
|
|
549101
|
+
}
|
|
548430
549102
|
makePhaseSummarizer() {
|
|
548431
549103
|
if (process.env["OMNIUS_DISABLE_PHASE_SUMMARIZER"] === "1")
|
|
548432
549104
|
return null;
|
|
@@ -548485,11 +549157,11 @@ ${blob}
|
|
|
548485
549157
|
*/
|
|
548486
549158
|
surfaceAnchors(messages2) {
|
|
548487
549159
|
if (process.env["OMNIUS_DISABLE_ANCHOR_SURFACING"] === "1")
|
|
548488
|
-
return;
|
|
549160
|
+
return null;
|
|
548489
549161
|
if (!this._contextTree)
|
|
548490
|
-
return;
|
|
549162
|
+
return null;
|
|
548491
549163
|
if (messages2.length === 0)
|
|
548492
|
-
return;
|
|
549164
|
+
return null;
|
|
548493
549165
|
const tail = messages2.slice(-6);
|
|
548494
549166
|
const queryParts = [];
|
|
548495
549167
|
for (const m2 of tail) {
|
|
@@ -548501,7 +549173,7 @@ ${blob}
|
|
|
548501
549173
|
}
|
|
548502
549174
|
const query = queryParts.join(" ").slice(0, 800);
|
|
548503
549175
|
if (!query)
|
|
548504
|
-
return;
|
|
549176
|
+
return null;
|
|
548505
549177
|
const anchors = this._contextTree.findAnchorsByKeywords(query, 5);
|
|
548506
549178
|
const memexMatches = [];
|
|
548507
549179
|
if (this._memexArchive.size > 0) {
|
|
@@ -548524,7 +549196,7 @@ ${blob}
|
|
|
548524
549196
|
const newAnchors = anchors.filter((a2) => !this._lastSurfacedAnchorIds.has(a2.id)).slice(0, 3);
|
|
548525
549197
|
const newMemex = memexMatches.filter((m2) => !this._lastSurfacedAnchorIds.has(m2.id)).slice(0, 2);
|
|
548526
549198
|
if (newAnchors.length === 0 && newMemex.length === 0)
|
|
548527
|
-
return;
|
|
549199
|
+
return null;
|
|
548528
549200
|
const lines = [
|
|
548529
549201
|
`[Anchor surface] Relevant archived context for the current activity:`
|
|
548530
549202
|
];
|
|
@@ -548535,10 +549207,6 @@ ${blob}
|
|
|
548535
549207
|
lines.push(` - [memex:${m2.id}] ${m2.summary} — call memex_retrieve("${m2.id}") for full body`);
|
|
548536
549208
|
}
|
|
548537
549209
|
lines.push(`(Anchors are reminders. Pull only what you actually need; ignore otherwise.)`);
|
|
548538
|
-
messages2.push({
|
|
548539
|
-
role: "system",
|
|
548540
|
-
content: lines.join("\n")
|
|
548541
|
-
});
|
|
548542
549210
|
for (const a2 of newAnchors)
|
|
548543
549211
|
this._lastSurfacedAnchorIds.add(a2.id);
|
|
548544
549212
|
for (const m2 of newMemex)
|
|
@@ -548548,6 +549216,7 @@ ${blob}
|
|
|
548548
549216
|
content: `Anchor surface: surfaced ${newAnchors.length} anchor(s) + ${newMemex.length} memex entry(ies)`,
|
|
548549
549217
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
548550
549218
|
});
|
|
549219
|
+
return lines.join("\n");
|
|
548551
549220
|
}
|
|
548552
549221
|
microcompact(messages2, recentToolResults) {
|
|
548553
549222
|
const tier = this.options.modelTier ?? "large";
|
|
@@ -548717,6 +549386,24 @@ ${blob}
|
|
|
548717
549386
|
return "undefined";
|
|
548718
549387
|
return value2;
|
|
548719
549388
|
}
|
|
549389
|
+
_buildShellCacheResult(args, result) {
|
|
549390
|
+
const command = String(args["command"] ?? args["cmd"] ?? "").slice(0, 800);
|
|
549391
|
+
const status = result.success ? "success" : "failure";
|
|
549392
|
+
const error = String(result.error ?? "").trim();
|
|
549393
|
+
const output = String(result.output ?? "").trim();
|
|
549394
|
+
const lines = [
|
|
549395
|
+
"[SHELL RESULT CACHE]",
|
|
549396
|
+
`status: ${status}`,
|
|
549397
|
+
command ? `command: ${command}` : "",
|
|
549398
|
+
error ? "error:" : "",
|
|
549399
|
+
error ? error.slice(0, 3e3) : "",
|
|
549400
|
+
output ? "output:" : "",
|
|
549401
|
+
output ? output.slice(0, 5e3) : ""
|
|
549402
|
+
].filter(Boolean);
|
|
549403
|
+
const body = lines.join("\n");
|
|
549404
|
+
return body.length > 8e3 ? `${body.slice(0, 8e3)}
|
|
549405
|
+
... [shell cache payload truncated; full output was already captured by the original tool result/log packet if applicable]` : body;
|
|
549406
|
+
}
|
|
548720
549407
|
_isStatefulBrowserTool(name10) {
|
|
548721
549408
|
return name10 === "playwright_browser" || name10 === "browser_action";
|
|
548722
549409
|
}
|
|
@@ -549250,6 +549937,8 @@ Respond with your assessment, then take action.`;
|
|
|
549250
549937
|
this._ephemeralSkillPackContext = "";
|
|
549251
549938
|
this._contextTree = null;
|
|
549252
549939
|
this._lastSurfacedAnchorIds.clear();
|
|
549940
|
+
this._contextLedger = new ContextLedger();
|
|
549941
|
+
this._contextFrameBuilder = new ContextFrameBuilder();
|
|
549253
549942
|
if (!this.options.disablePersistentMemory && !this._memoryInitialized) {
|
|
549254
549943
|
try {
|
|
549255
549944
|
const path12 = await import("node:path");
|
|
@@ -549292,10 +549981,16 @@ Respond with your assessment, then take action.`;
|
|
|
549292
549981
|
try {
|
|
549293
549982
|
if (fs11.existsSync(patternsFile)) {
|
|
549294
549983
|
const saved = JSON.parse(fs11.readFileSync(patternsFile, "utf8"));
|
|
549295
|
-
for (const
|
|
549296
|
-
const existing = this._errorPatterns.get(
|
|
549297
|
-
if (!existing ||
|
|
549298
|
-
this._errorPatterns.set(
|
|
549984
|
+
for (const pattern of normalizeFailurePatterns(saved)) {
|
|
549985
|
+
const existing = this._errorPatterns.get(pattern.signature);
|
|
549986
|
+
if (!existing || pattern.count > (existing.count ?? 0)) {
|
|
549987
|
+
this._errorPatterns.set(pattern.signature, {
|
|
549988
|
+
count: pattern.count,
|
|
549989
|
+
guidance: pattern.guidance,
|
|
549990
|
+
lastSeen: pattern.lastSeen,
|
|
549991
|
+
tool: pattern.tool,
|
|
549992
|
+
errorType: pattern.errorType
|
|
549993
|
+
});
|
|
549299
549994
|
}
|
|
549300
549995
|
}
|
|
549301
549996
|
}
|
|
@@ -549578,6 +550273,29 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
549578
550273
|
}
|
|
549579
550274
|
} catch {
|
|
549580
550275
|
}
|
|
550276
|
+
if (process.env["OMNIUS_DISABLE_FAILURE_HANDOFF"] !== "1") {
|
|
550277
|
+
try {
|
|
550278
|
+
const failureHandoff = buildFailureModeHandoff({
|
|
550279
|
+
taskGoal: cleanedTask,
|
|
550280
|
+
errorPatterns: this._errorPatterns,
|
|
550281
|
+
toolCallLog,
|
|
550282
|
+
taskState: this._taskState,
|
|
550283
|
+
maxPatterns: 10,
|
|
550284
|
+
maxRecentCalls: 0
|
|
550285
|
+
});
|
|
550286
|
+
if (failureHandoff) {
|
|
550287
|
+
const signal = signalFromBlock("handoff", "run.failure-handoff", failureHandoff, {
|
|
550288
|
+
id: "failure-mode-handoff",
|
|
550289
|
+
dedupeKey: "run.failure-handoff",
|
|
550290
|
+
priority: 85,
|
|
550291
|
+
createdTurn: 0
|
|
550292
|
+
});
|
|
550293
|
+
if (signal)
|
|
550294
|
+
this._contextLedger.upsert(signal);
|
|
550295
|
+
}
|
|
550296
|
+
} catch {
|
|
550297
|
+
}
|
|
550298
|
+
}
|
|
549581
550299
|
let toolDefs = await this.buildToolDefinitions();
|
|
549582
550300
|
const baseInstructions = getSystemPromptForTier(this.options.modelTier);
|
|
549583
550301
|
this.checkPromptToolParity(baseInstructions, toolDefs);
|
|
@@ -549635,6 +550353,9 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
549635
550353
|
let consecutiveEmptyResponses = 0;
|
|
549636
550354
|
let sameToolFailStreak = 0;
|
|
549637
550355
|
let sameToolFailName = null;
|
|
550356
|
+
let lastFailureHandoffTurn = -1;
|
|
550357
|
+
let lastCommitGateTurn = -1;
|
|
550358
|
+
let lastShellPivotTurn = -1;
|
|
549638
550359
|
const recentToolResults = /* @__PURE__ */ new Map();
|
|
549639
550360
|
const dedupHitCount = /* @__PURE__ */ new Map();
|
|
549640
550361
|
const DEDUP_ESCALATION_THRESHOLD = 3;
|
|
@@ -549690,6 +550411,26 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
549690
550411
|
}
|
|
549691
550412
|
return false;
|
|
549692
550413
|
};
|
|
550414
|
+
const holdNoProgressTaskComplete = (args, turn) => {
|
|
550415
|
+
if (process.env["OMNIUS_DISABLE_PROGRESS_GATES"] === "1")
|
|
550416
|
+
return false;
|
|
550417
|
+
const proposedSummary = extractTaskCompleteSummary(args);
|
|
550418
|
+
const gate = computeNoProgressCompletionGate({
|
|
550419
|
+
summary: proposedSummary,
|
|
550420
|
+
toolCallLog,
|
|
550421
|
+
taskState: this._taskState
|
|
550422
|
+
});
|
|
550423
|
+
if (!gate.shouldInject || !gate.content)
|
|
550424
|
+
return false;
|
|
550425
|
+
messages2.push({ role: "system", content: gate.content });
|
|
550426
|
+
this.emit({
|
|
550427
|
+
type: "status",
|
|
550428
|
+
content: "task_complete held: discovery happened but no deliverable or explicit blocker is recorded",
|
|
550429
|
+
turn,
|
|
550430
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
550431
|
+
});
|
|
550432
|
+
return true;
|
|
550433
|
+
};
|
|
549693
550434
|
const turnCap = this.options.maxTurns && this.options.maxTurns > 0 ? this.options.maxTurns : Number.MAX_SAFE_INTEGER;
|
|
549694
550435
|
for (let turn = 0; turn < turnCap; turn++) {
|
|
549695
550436
|
clearTurnState(this._appState);
|
|
@@ -551004,11 +551745,12 @@ ${memoryLines.join("\n")}`
|
|
|
551004
551745
|
}
|
|
551005
551746
|
}
|
|
551006
551747
|
}
|
|
551748
|
+
let environmentBlock = null;
|
|
551007
551749
|
if (this.options.environmentProvider) {
|
|
551008
551750
|
try {
|
|
551009
551751
|
const envStr = this.options.environmentProvider();
|
|
551010
551752
|
if (envStr) {
|
|
551011
|
-
|
|
551753
|
+
environmentBlock = envStr;
|
|
551012
551754
|
}
|
|
551013
551755
|
} catch {
|
|
551014
551756
|
}
|
|
@@ -551016,7 +551758,7 @@ ${memoryLines.join("\n")}`
|
|
|
551016
551758
|
this._lastAssistantTimestamp = Date.now();
|
|
551017
551759
|
this.proactivePrune(compacted, turn);
|
|
551018
551760
|
this.microcompact(compacted, recentToolResults);
|
|
551019
|
-
this.
|
|
551761
|
+
this._insertContextFrame(compacted, this._buildTurnContextFrame(turn, compacted, recentToolResults, environmentBlock));
|
|
551020
551762
|
const { maxOutputTokens: effectiveMaxTokens } = this.contextLimits();
|
|
551021
551763
|
const chatRequest = {
|
|
551022
551764
|
messages: compacted,
|
|
@@ -551088,31 +551830,6 @@ ${memoryLines.join("\n")}`
|
|
|
551088
551830
|
}
|
|
551089
551831
|
}
|
|
551090
551832
|
}
|
|
551091
|
-
const _injections = [];
|
|
551092
|
-
const fsBlock = this._renderFilesystemStateBlock(turn);
|
|
551093
|
-
if (fsBlock)
|
|
551094
|
-
_injections.push(fsBlock);
|
|
551095
|
-
const todoBlock = this._renderTodoStateBlock(turn);
|
|
551096
|
-
if (todoBlock)
|
|
551097
|
-
_injections.push(todoBlock);
|
|
551098
|
-
const failBlock = this._renderRecentFailuresBlock(turn);
|
|
551099
|
-
if (failBlock)
|
|
551100
|
-
_injections.push(failBlock);
|
|
551101
|
-
const churnBlock = this._renderWriteChurnBlock(turn);
|
|
551102
|
-
if (churnBlock)
|
|
551103
|
-
_injections.push(churnBlock);
|
|
551104
|
-
const knowledgeBlock = this._renderKnowledgeBlock(recentToolResults);
|
|
551105
|
-
if (knowledgeBlock)
|
|
551106
|
-
_injections.push(knowledgeBlock);
|
|
551107
|
-
if (_injections.length > 0) {
|
|
551108
|
-
const reqMsgs = chatRequest.messages;
|
|
551109
|
-
if (Array.isArray(reqMsgs)) {
|
|
551110
|
-
const insertAt = Math.max(0, reqMsgs.length - 1);
|
|
551111
|
-
for (const blk of _injections) {
|
|
551112
|
-
reqMsgs.splice(insertAt, 0, { role: "system", content: blk });
|
|
551113
|
-
}
|
|
551114
|
-
}
|
|
551115
|
-
}
|
|
551116
551833
|
let response;
|
|
551117
551834
|
try {
|
|
551118
551835
|
response = this.options.streamEnabled && this.hasStreamingSupport() ? await this.streamingRequest(chatRequest, turn) : await this.backend.chatCompletion(chatRequest);
|
|
@@ -551705,6 +552422,15 @@ ${memoryLines.join("\n")}`
|
|
|
551705
552422
|
if (observerRedundantBlock) {
|
|
551706
552423
|
this._littlemanRedundantBlocks.delete(toolFingerprint);
|
|
551707
552424
|
}
|
|
552425
|
+
const markSyntheticToolLog = (outputPreview) => {
|
|
552426
|
+
const lastLog = toolCallLog[_toolLogTailIdx];
|
|
552427
|
+
if (!lastLog)
|
|
552428
|
+
return;
|
|
552429
|
+
lastLog.success = true;
|
|
552430
|
+
lastLog.mutated = false;
|
|
552431
|
+
lastLog.mutatedFiles = [];
|
|
552432
|
+
lastLog.outputPreview = outputPreview.slice(0, 100);
|
|
552433
|
+
};
|
|
551708
552434
|
{
|
|
551709
552435
|
const _reflStem = buildStem(tc.name, tc.arguments ?? {});
|
|
551710
552436
|
if (!this._reflectionsInjectedThisTurn.has(_reflStem)) {
|
|
@@ -551773,6 +552499,7 @@ ${memoryLines.join("\n")}`
|
|
|
551773
552499
|
const blockMsg = criticDecision.cachedResult ? `[BLOCKED — this tool+args already succeeded. Re-served from cache:]
|
|
551774
552500
|
|
|
551775
552501
|
${criticDecision.cachedResult.slice(0, 500)}` : `[BLOCKED — the observer confirmed this tool already succeeded with these arguments on a prior turn. Do NOT re-run. Use your prior findings to proceed.]`;
|
|
552502
|
+
markSyntheticToolLog(blockMsg);
|
|
551776
552503
|
this.emit({
|
|
551777
552504
|
type: "tool_result",
|
|
551778
552505
|
toolName: tc.name,
|
|
@@ -551820,6 +552547,9 @@ ${criticDecision.cachedResult.slice(0, 500)}` : `[BLOCKED — the observer confi
|
|
|
551820
552547
|
`;
|
|
551821
552548
|
const truncatedCache = criticDecision.cachedResult.length > 500 ? criticDecision.cachedResult.slice(0, 500) + `
|
|
551822
552549
|
... [${criticDecision.cachedResult.length - 500} chars omitted — same as before]` : criticDecision.cachedResult;
|
|
552550
|
+
markSyntheticToolLog(`${criticDecision.blockMessage}
|
|
552551
|
+
|
|
552552
|
+
${truncatedCache}`);
|
|
551823
552553
|
return {
|
|
551824
552554
|
tc,
|
|
551825
552555
|
output: `${criticDecision.blockMessage}
|
|
@@ -551849,6 +552579,7 @@ ${header}${truncatedCache}`
|
|
|
551849
552579
|
const truncatedCache = criticDecision.cachedResult.length > 500 ? criticDecision.cachedResult.slice(0, 500) + `
|
|
551850
552580
|
... [${criticDecision.cachedResult.length - 500} chars omitted — same as before]` : criticDecision.cachedResult;
|
|
551851
552581
|
const dedupOutput = header + truncatedCache;
|
|
552582
|
+
markSyntheticToolLog(dedupOutput);
|
|
551852
552583
|
this.emit({
|
|
551853
552584
|
type: "tool_result",
|
|
551854
552585
|
toolName: tc.name,
|
|
@@ -552689,9 +553420,9 @@ Respond with EXACTLY this structure before your next tool call:
|
|
|
552689
553420
|
}
|
|
552690
553421
|
}
|
|
552691
553422
|
}
|
|
552692
|
-
if (isReadLike && result.success) {
|
|
553423
|
+
if (isReadLike && result.success || tc.name === "shell") {
|
|
552693
553424
|
recentToolResults.set(toolFingerprint, {
|
|
552694
|
-
result: (result.output ?? "").slice(0, 2e3),
|
|
553425
|
+
result: tc.name === "shell" ? this._buildShellCacheResult(tc.arguments, result) : (result.output ?? "").slice(0, 2e3),
|
|
552695
553426
|
compacted: false
|
|
552696
553427
|
});
|
|
552697
553428
|
if (recentToolResults.size > 500) {
|
|
@@ -552706,6 +553437,12 @@ Respond with EXACTLY this structure before your next tool call:
|
|
|
552706
553437
|
if (isFileMutation && dedupHitCount.size > 0) {
|
|
552707
553438
|
dedupHitCount.clear();
|
|
552708
553439
|
}
|
|
553440
|
+
if (isFileMutation && recentToolResults.size > 0) {
|
|
553441
|
+
for (const key of Array.from(recentToolResults.keys())) {
|
|
553442
|
+
if (key.startsWith("shell:"))
|
|
553443
|
+
recentToolResults.delete(key);
|
|
553444
|
+
}
|
|
553445
|
+
}
|
|
552709
553446
|
if (isFileMutation) {
|
|
552710
553447
|
this._fileWritesSinceLastWorldState += Math.max(1, realMutationPaths.length);
|
|
552711
553448
|
this._fileWritesThisRun += Math.max(1, realMutationPaths.length);
|
|
@@ -553112,6 +553849,68 @@ Then use file_read on individual FILES inside it.`);
|
|
|
553112
553849
|
} else if (!isEisdir) {
|
|
553113
553850
|
this._consecutiveEnoent = 0;
|
|
553114
553851
|
}
|
|
553852
|
+
if (process.env["OMNIUS_DISABLE_PROGRESS_GATES"] !== "1") {
|
|
553853
|
+
const commitGate = computeCommitProgressGate({
|
|
553854
|
+
toolCallLog,
|
|
553855
|
+
taskState: this._taskState,
|
|
553856
|
+
turn,
|
|
553857
|
+
lastInjectedTurn: lastCommitGateTurn
|
|
553858
|
+
});
|
|
553859
|
+
if (commitGate.shouldInject && commitGate.content) {
|
|
553860
|
+
messages2.push({ role: "system", content: commitGate.content });
|
|
553861
|
+
lastCommitGateTurn = turn;
|
|
553862
|
+
this.emit({
|
|
553863
|
+
type: "status",
|
|
553864
|
+
content: "Progress gate injected: discovery succeeded but no file changes are recorded",
|
|
553865
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
553866
|
+
});
|
|
553867
|
+
}
|
|
553868
|
+
const shellPivot = computeShellFailurePivot({
|
|
553869
|
+
toolCallLog,
|
|
553870
|
+
taskState: this._taskState,
|
|
553871
|
+
turn,
|
|
553872
|
+
lastInjectedTurn: lastShellPivotTurn
|
|
553873
|
+
});
|
|
553874
|
+
if (shellPivot.shouldInject && shellPivot.content) {
|
|
553875
|
+
const signal = signalFromBlock("recent_failure", "runtime.shell-pivot", shellPivot.content, {
|
|
553876
|
+
id: "shell-pivot",
|
|
553877
|
+
dedupeKey: "runtime.shell-pivot",
|
|
553878
|
+
priority: 98,
|
|
553879
|
+
createdTurn: turn,
|
|
553880
|
+
ttlTurns: 4
|
|
553881
|
+
});
|
|
553882
|
+
if (signal)
|
|
553883
|
+
this._contextLedger.upsert(signal);
|
|
553884
|
+
lastShellPivotTurn = turn;
|
|
553885
|
+
this.emit({
|
|
553886
|
+
type: "status",
|
|
553887
|
+
content: "Shell failure pivot injected from recent raw shell failures",
|
|
553888
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
553889
|
+
});
|
|
553890
|
+
}
|
|
553891
|
+
}
|
|
553892
|
+
if (process.env["OMNIUS_DISABLE_FAILURE_HANDOFF"] !== "1" && !result.success && turn - lastFailureHandoffTurn >= 4) {
|
|
553893
|
+
const runtimeHandoff = buildFailureModeHandoff({
|
|
553894
|
+
taskGoal: cleanedTask,
|
|
553895
|
+
errorPatterns: this._errorPatterns,
|
|
553896
|
+
toolCallLog,
|
|
553897
|
+
taskState: this._taskState,
|
|
553898
|
+
maxPatterns: 5,
|
|
553899
|
+
maxRecentCalls: 6
|
|
553900
|
+
});
|
|
553901
|
+
if (runtimeHandoff) {
|
|
553902
|
+
const signal = signalFromBlock("handoff", "runtime.failure-handoff", runtimeHandoff, {
|
|
553903
|
+
id: "runtime-failure-handoff",
|
|
553904
|
+
dedupeKey: "runtime.failure-handoff",
|
|
553905
|
+
priority: 90,
|
|
553906
|
+
createdTurn: turn,
|
|
553907
|
+
ttlTurns: 4
|
|
553908
|
+
});
|
|
553909
|
+
if (signal)
|
|
553910
|
+
this._contextLedger.upsert(signal);
|
|
553911
|
+
lastFailureHandoffTurn = turn;
|
|
553912
|
+
}
|
|
553913
|
+
}
|
|
553115
553914
|
return { tc, output };
|
|
553116
553915
|
};
|
|
553117
553916
|
const rawToolCalls = msg.toolCalls;
|
|
@@ -553171,6 +553970,9 @@ ${sr.result.output}`;
|
|
|
553171
553970
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
553172
553971
|
});
|
|
553173
553972
|
} else {
|
|
553973
|
+
if (holdNoProgressTaskComplete(matchTc.arguments, turn)) {
|
|
553974
|
+
continue;
|
|
553975
|
+
}
|
|
553174
553976
|
const _bp1 = await this._runBackwardPassReview(turn);
|
|
553175
553977
|
if (_bp1 && !_bp1.proceed && _bp1.feedback) {
|
|
553176
553978
|
messages2.push({ role: "system", content: _bp1.feedback });
|
|
@@ -553212,6 +554014,9 @@ ${sr.result.output}`;
|
|
|
553212
554014
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
553213
554015
|
});
|
|
553214
554016
|
} else {
|
|
554017
|
+
if (holdNoProgressTaskComplete(r2.tc.arguments, turn)) {
|
|
554018
|
+
continue;
|
|
554019
|
+
}
|
|
553215
554020
|
const _bp2 = await this._runBackwardPassReview(turn);
|
|
553216
554021
|
if (_bp2 && !_bp2.proceed && _bp2.feedback) {
|
|
553217
554022
|
messages2.push({ role: "system", content: _bp2.feedback });
|
|
@@ -553288,6 +554093,9 @@ ${sr.result.output}`;
|
|
|
553288
554093
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
553289
554094
|
});
|
|
553290
554095
|
} else {
|
|
554096
|
+
if (holdNoProgressTaskComplete(r2.tc.arguments, turn)) {
|
|
554097
|
+
continue;
|
|
554098
|
+
}
|
|
553291
554099
|
const _bp3 = await this._runBackwardPassReview(turn);
|
|
553292
554100
|
if (_bp3 && !_bp3.proceed && _bp3.feedback) {
|
|
553293
554101
|
messages2.push({ role: "system", content: _bp3.feedback });
|
|
@@ -553735,7 +554543,14 @@ ${this.options.maxTurns && this.options.maxTurns > 0 ? `You have ${this.options.
|
|
|
553735
554543
|
}
|
|
553736
554544
|
this.proactivePrune(compactedMsgs, this._taskState.toolCallCount);
|
|
553737
554545
|
this.microcompact(compactedMsgs);
|
|
553738
|
-
|
|
554546
|
+
let bfEnvironmentBlock = null;
|
|
554547
|
+
if (this.options.environmentProvider) {
|
|
554548
|
+
try {
|
|
554549
|
+
bfEnvironmentBlock = this.options.environmentProvider() || null;
|
|
554550
|
+
} catch {
|
|
554551
|
+
}
|
|
554552
|
+
}
|
|
554553
|
+
this._insertContextFrame(compactedMsgs, this._buildTurnContextFrame(turn, compactedMsgs, void 0, bfEnvironmentBlock));
|
|
553739
554554
|
const chatRequest = {
|
|
553740
554555
|
messages: compactedMsgs,
|
|
553741
554556
|
tools: toolDefs,
|
|
@@ -554026,6 +554841,9 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
|
|
|
554026
554841
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
554027
554842
|
});
|
|
554028
554843
|
} else {
|
|
554844
|
+
if (holdNoProgressTaskComplete(tc.arguments, turn)) {
|
|
554845
|
+
continue;
|
|
554846
|
+
}
|
|
554029
554847
|
const _bp4 = await this._runBackwardPassReview(turn);
|
|
554030
554848
|
if (_bp4 && !_bp4.proceed && _bp4.feedback) {
|
|
554031
554849
|
messages2.push({ role: "system", content: _bp4.feedback });
|
|
@@ -554076,6 +554894,23 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
|
|
|
554076
554894
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
554077
554895
|
});
|
|
554078
554896
|
} else {
|
|
554897
|
+
if (process.env["OMNIUS_DISABLE_PROGRESS_GATES"] !== "1") {
|
|
554898
|
+
const gate = computeNoProgressCompletionGate({
|
|
554899
|
+
summary: content,
|
|
554900
|
+
toolCallLog,
|
|
554901
|
+
taskState: this._taskState
|
|
554902
|
+
});
|
|
554903
|
+
if (gate.shouldInject && gate.content) {
|
|
554904
|
+
messages2.push({ role: "system", content: gate.content });
|
|
554905
|
+
this.emit({
|
|
554906
|
+
type: "status",
|
|
554907
|
+
content: "text completion held: discovery happened but no deliverable or explicit blocker is recorded",
|
|
554908
|
+
turn,
|
|
554909
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
554910
|
+
});
|
|
554911
|
+
continue;
|
|
554912
|
+
}
|
|
554913
|
+
}
|
|
554079
554914
|
completed = true;
|
|
554080
554915
|
summary = content;
|
|
554081
554916
|
break;
|
|
@@ -554629,10 +555464,10 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
|
|
|
554629
555464
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
554630
555465
|
});
|
|
554631
555466
|
try {
|
|
554632
|
-
const { mkdirSync:
|
|
555467
|
+
const { mkdirSync: mkdirSync85, readdirSync: readdirSync51, statSync: statSync49, unlinkSync: unlinkSync29, writeFileSync: writeFileSync77 } = __require("node:fs");
|
|
554633
555468
|
const { join: join155 } = __require("node:path");
|
|
554634
555469
|
const contextDir = join155(this._workingDirectory || process.cwd(), ".omnius", "context");
|
|
554635
|
-
|
|
555470
|
+
mkdirSync85(contextDir, { recursive: true });
|
|
554636
555471
|
const topEntities = this._temporalGraph.nodesByType("entity", 3);
|
|
554637
555472
|
const topFiles = this._temporalGraph.nodesByType("file", 3);
|
|
554638
555473
|
const topConcepts = this._temporalGraph.nodesByType("concept", 3);
|
|
@@ -554672,9 +555507,57 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
|
|
|
554672
555507
|
section("Top Files", topFiles);
|
|
554673
555508
|
section("Top Concepts", topConcepts);
|
|
554674
555509
|
lines.push("(Use file_read on this file for quick recall. See provenance JSON for full edge detail.)");
|
|
554675
|
-
const
|
|
554676
|
-
|
|
554677
|
-
|
|
555510
|
+
const kgSummaryDir = join155(contextDir, "kg-summary");
|
|
555511
|
+
mkdirSync85(kgSummaryDir, { recursive: true });
|
|
555512
|
+
const summaryFilename = `kg-summary-${this._sessionId}.md`;
|
|
555513
|
+
const outPath = join155(kgSummaryDir, summaryFilename);
|
|
555514
|
+
writeFileSync77(outPath, lines.join("\n"), "utf-8");
|
|
555515
|
+
writeFileSync77(join155(kgSummaryDir, "latest.md"), lines.join("\n"), "utf-8");
|
|
555516
|
+
writeFileSync77(join155(contextDir, `kg-summary-latest.md`), [
|
|
555517
|
+
"Latest KG summary moved to `.omnius/context/kg-summary/latest.md`.",
|
|
555518
|
+
"",
|
|
555519
|
+
lines.join("\n")
|
|
555520
|
+
].join("\n"), "utf-8");
|
|
555521
|
+
writeFileSync77(join155(kgSummaryDir, "index.json"), JSON.stringify({
|
|
555522
|
+
schema: "omnius.kg-summary-index.v1",
|
|
555523
|
+
latest: "latest.md",
|
|
555524
|
+
latestSessionFile: summaryFilename,
|
|
555525
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
555526
|
+
}, null, 2) + "\n", "utf-8");
|
|
555527
|
+
if (process.env["OMNIUS_DISABLE_KG_SUMMARY_PRUNE"] !== "1") {
|
|
555528
|
+
try {
|
|
555529
|
+
const maxAgeDays = parseInt(process.env["OMNIUS_KG_SUMMARY_MAX_AGE_DAYS"] || "7", 10) || 7;
|
|
555530
|
+
const maxFiles = parseInt(process.env["OMNIUS_KG_SUMMARY_MAX_FILES"] || "60", 10) || 60;
|
|
555531
|
+
const cutoff = Date.now() - maxAgeDays * 24 * 60 * 60 * 1e3;
|
|
555532
|
+
const summaries = readdirSync51(kgSummaryDir).filter((name10) => name10.startsWith("kg-summary-") && name10.endsWith(".md")).map((name10) => {
|
|
555533
|
+
const filePath = join155(kgSummaryDir, name10);
|
|
555534
|
+
const stat7 = statSync49(filePath);
|
|
555535
|
+
return { filePath, mtimeMs: stat7.mtimeMs };
|
|
555536
|
+
}).sort((a2, b) => b.mtimeMs - a2.mtimeMs);
|
|
555537
|
+
const toDelete = /* @__PURE__ */ new Set();
|
|
555538
|
+
for (const entry of summaries) {
|
|
555539
|
+
if (entry.mtimeMs < cutoff)
|
|
555540
|
+
toDelete.add(entry.filePath);
|
|
555541
|
+
}
|
|
555542
|
+
for (const entry of summaries.slice(maxFiles)) {
|
|
555543
|
+
toDelete.add(entry.filePath);
|
|
555544
|
+
}
|
|
555545
|
+
for (const filePath of toDelete) {
|
|
555546
|
+
try {
|
|
555547
|
+
unlinkSync29(filePath);
|
|
555548
|
+
} catch {
|
|
555549
|
+
}
|
|
555550
|
+
}
|
|
555551
|
+
if (toDelete.size > 0) {
|
|
555552
|
+
this.emit({
|
|
555553
|
+
type: "status",
|
|
555554
|
+
content: `Knowledge graph summaries pruned: ${toDelete.size} old file(s) removed`,
|
|
555555
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
555556
|
+
});
|
|
555557
|
+
}
|
|
555558
|
+
} catch {
|
|
555559
|
+
}
|
|
555560
|
+
}
|
|
554678
555561
|
} catch {
|
|
554679
555562
|
}
|
|
554680
555563
|
}
|
|
@@ -554925,11 +555808,11 @@ ${errOutput}`);
|
|
|
554925
555808
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
554926
555809
|
});
|
|
554927
555810
|
try {
|
|
554928
|
-
const { mkdirSync:
|
|
555811
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = __require("node:fs");
|
|
554929
555812
|
const { join: join155 } = __require("node:path");
|
|
554930
555813
|
const resultsDir = join155(this.omniusStateDir(), "tool-results");
|
|
554931
|
-
|
|
554932
|
-
|
|
555814
|
+
mkdirSync85(resultsDir, { recursive: true });
|
|
555815
|
+
writeFileSync77(join155(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
|
|
554933
555816
|
# Turn: ${turn}
|
|
554934
555817
|
# Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
554935
555818
|
# Size: ${result.output.length} chars, ${lineCount} lines
|
|
@@ -555311,10 +556194,10 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
|
|
|
555311
556194
|
if (!this._workingDirectory)
|
|
555312
556195
|
return;
|
|
555313
556196
|
try {
|
|
555314
|
-
const { mkdirSync:
|
|
556197
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = __require("node:fs");
|
|
555315
556198
|
const { join: join155 } = __require("node:path");
|
|
555316
556199
|
const sessionDir2 = this.options.stateDir ? join155(this.omniusStateDir(), "session", this._sessionId) : join155(this._workingDirectory, ".omnius", "session", this._sessionId);
|
|
555317
|
-
|
|
556200
|
+
mkdirSync85(sessionDir2, { recursive: true });
|
|
555318
556201
|
const checkpoint = {
|
|
555319
556202
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
555320
556203
|
sessionId: this._sessionId,
|
|
@@ -555326,7 +556209,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
|
|
|
555326
556209
|
memexEntryCount: this._memexArchive.size,
|
|
555327
556210
|
fileRegistrySize: this._fileRegistry.size
|
|
555328
556211
|
};
|
|
555329
|
-
|
|
556212
|
+
writeFileSync77(join155(sessionDir2, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
|
|
555330
556213
|
} catch {
|
|
555331
556214
|
}
|
|
555332
556215
|
}
|
|
@@ -555360,10 +556243,17 @@ ${tail}`;
|
|
|
555360
556243
|
const textContent = userMsg.replace(imagePattern, "").trim();
|
|
555361
556244
|
await this.appendOffloadedImageMessage(messages2, mime, base642, textContent, turn);
|
|
555362
556245
|
} else {
|
|
555363
|
-
|
|
555364
|
-
|
|
555365
|
-
|
|
555366
|
-
|
|
556246
|
+
const steeringPacket = this.formatInjectedUserMessage(userMsg);
|
|
556247
|
+
const steeringHash = _createHash("sha256").update(steeringPacket).digest("hex").slice(0, 16);
|
|
556248
|
+
const signal = signalFromBlock("user_steering", "user.steering", steeringPacket, {
|
|
556249
|
+
id: `steering-${turn}-${steeringHash}`,
|
|
556250
|
+
dedupeKey: `user.steering:${steeringHash}`,
|
|
556251
|
+
priority: 110,
|
|
556252
|
+
createdTurn: turn,
|
|
556253
|
+
ttlTurns: 20
|
|
556254
|
+
});
|
|
556255
|
+
if (signal)
|
|
556256
|
+
this._contextLedger.upsert(signal);
|
|
555367
556257
|
}
|
|
555368
556258
|
this.emit({
|
|
555369
556259
|
type: "user_interrupt",
|
|
@@ -555968,10 +556858,38 @@ ${content.slice(0, 8e3)}
|
|
|
555968
556858
|
if (this._taskState.failedApproaches.length > 0) {
|
|
555969
556859
|
goalParts.push(`**Failed approaches (do NOT repeat):** ${this._taskState.failedApproaches.slice(-3).join("; ")}`);
|
|
555970
556860
|
}
|
|
555971
|
-
|
|
555972
|
-
|
|
555973
|
-
|
|
556861
|
+
const signal = signalFromBlock("compaction_summary", "runtime.compaction-goal", goalParts.join("\n"), {
|
|
556862
|
+
id: "compaction-goal",
|
|
556863
|
+
dedupeKey: "runtime.compaction-goal",
|
|
556864
|
+
priority: 90,
|
|
556865
|
+
createdTurn: this._taskState.toolCallCount,
|
|
556866
|
+
ttlTurns: 8
|
|
555974
556867
|
});
|
|
556868
|
+
if (signal)
|
|
556869
|
+
this._contextLedger.upsert(signal);
|
|
556870
|
+
}
|
|
556871
|
+
if (process.env["OMNIUS_DISABLE_FAILURE_HANDOFF"] !== "1") {
|
|
556872
|
+
try {
|
|
556873
|
+
const compactFailureHandoff = buildFailureModeHandoff({
|
|
556874
|
+
taskGoal: this._taskState.goal,
|
|
556875
|
+
errorPatterns: this._errorPatterns,
|
|
556876
|
+
taskState: this._taskState,
|
|
556877
|
+
maxPatterns: 6,
|
|
556878
|
+
maxRecentCalls: 0
|
|
556879
|
+
});
|
|
556880
|
+
if (compactFailureHandoff) {
|
|
556881
|
+
const signal = signalFromBlock("handoff", "runtime.compaction-failure-handoff", compactFailureHandoff, {
|
|
556882
|
+
id: "compaction-failure-handoff",
|
|
556883
|
+
dedupeKey: "runtime.compaction-failure-handoff",
|
|
556884
|
+
priority: 88,
|
|
556885
|
+
createdTurn: this._taskState.toolCallCount,
|
|
556886
|
+
ttlTurns: 8
|
|
556887
|
+
});
|
|
556888
|
+
if (signal)
|
|
556889
|
+
this._contextLedger.upsert(signal);
|
|
556890
|
+
}
|
|
556891
|
+
} catch {
|
|
556892
|
+
}
|
|
555975
556893
|
}
|
|
555976
556894
|
const ctxWindow = this.options.contextWindowSize;
|
|
555977
556895
|
if (ctxWindow > 0) {
|
|
@@ -557569,12 +558487,12 @@ ${result}`
|
|
|
557569
558487
|
let resizedBase64 = null;
|
|
557570
558488
|
try {
|
|
557571
558489
|
const { execSync: execSync61 } = await import("node:child_process");
|
|
557572
|
-
const { writeFileSync:
|
|
558490
|
+
const { writeFileSync: writeFileSync77, readFileSync: readFileSync113, unlinkSync: unlinkSync29 } = await import("node:fs");
|
|
557573
558491
|
const { join: join155 } = await import("node:path");
|
|
557574
558492
|
const { tmpdir: tmpdir23 } = await import("node:os");
|
|
557575
558493
|
const tmpIn = join155(tmpdir23(), `omnius_img_in_${Date.now()}.png`);
|
|
557576
558494
|
const tmpOut = join155(tmpdir23(), `omnius_img_out_${Date.now()}.jpg`);
|
|
557577
|
-
|
|
558495
|
+
writeFileSync77(tmpIn, buffer2);
|
|
557578
558496
|
const pyBin = process.platform === "win32" ? "python" : "python3";
|
|
557579
558497
|
const escapedIn = tmpIn.replace(/\\/g, "\\\\");
|
|
557580
558498
|
const escapedOut = tmpOut.replace(/\\/g, "\\\\");
|
|
@@ -563466,7 +564384,7 @@ import { spawn as spawn24, execSync as execSync47 } from "node:child_process";
|
|
|
563466
564384
|
import { accessSync, constants, existsSync as existsSync87, mkdirSync as mkdirSync48, writeFileSync as writeFileSync43, readdirSync as readdirSync28 } from "node:fs";
|
|
563467
564385
|
import { join as join102, dirname as dirname27 } from "node:path";
|
|
563468
564386
|
import { homedir as homedir32 } from "node:os";
|
|
563469
|
-
import { fileURLToPath as
|
|
564387
|
+
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
563470
564388
|
import { EventEmitter as EventEmitter6 } from "node:events";
|
|
563471
564389
|
import { createInterface as createInterface2 } from "node:readline";
|
|
563472
564390
|
function isAudioPath(path12) {
|
|
@@ -563548,7 +564466,7 @@ function findMicCaptureCommand() {
|
|
|
563548
564466
|
return null;
|
|
563549
564467
|
}
|
|
563550
564468
|
function findTranscribeFileScript() {
|
|
563551
|
-
const thisDir = dirname27(
|
|
564469
|
+
const thisDir = dirname27(fileURLToPath12(import.meta.url));
|
|
563552
564470
|
const candidates = [
|
|
563553
564471
|
join102(thisDir, "../../../../packages/execution/scripts/transcribe-file.py"),
|
|
563554
564472
|
join102(thisDir, "../../../packages/execution/scripts/transcribe-file.py"),
|
|
@@ -563633,7 +564551,7 @@ async function transcribeFileViaWhisper(filePath, model) {
|
|
|
563633
564551
|
});
|
|
563634
564552
|
}
|
|
563635
564553
|
function findLiveWhisperScript() {
|
|
563636
|
-
const thisDir = dirname27(
|
|
564554
|
+
const thisDir = dirname27(fileURLToPath12(import.meta.url));
|
|
563637
564555
|
const candidates = [
|
|
563638
564556
|
join102(thisDir, "../../../../packages/execution/scripts/live-whisper.py"),
|
|
563639
564557
|
join102(thisDir, "../../../packages/execution/scripts/live-whisper.py"),
|
|
@@ -577183,7 +578101,7 @@ var init_render2 = __esm({
|
|
|
577183
578101
|
// packages/prompts/dist/promptLoader.js
|
|
577184
578102
|
import { readFileSync as readFileSync74, existsSync as existsSync93 } from "node:fs";
|
|
577185
578103
|
import { join as join108, dirname as dirname29 } from "node:path";
|
|
577186
|
-
import { fileURLToPath as
|
|
578104
|
+
import { fileURLToPath as fileURLToPath13 } from "node:url";
|
|
577187
578105
|
function loadPrompt2(promptPath, vars) {
|
|
577188
578106
|
let content = cache6.get(promptPath);
|
|
577189
578107
|
if (content === void 0) {
|
|
@@ -577202,7 +578120,7 @@ var __filename4, __dirname5, devPath, publishedPath, PROMPTS_DIR2, cache6;
|
|
|
577202
578120
|
var init_promptLoader2 = __esm({
|
|
577203
578121
|
"packages/prompts/dist/promptLoader.js"() {
|
|
577204
578122
|
"use strict";
|
|
577205
|
-
__filename4 =
|
|
578123
|
+
__filename4 = fileURLToPath13(import.meta.url);
|
|
577206
578124
|
__dirname5 = dirname29(__filename4);
|
|
577207
578125
|
devPath = join108(__dirname5, "..", "templates");
|
|
577208
578126
|
publishedPath = join108(__dirname5, "..", "prompts", "templates");
|
|
@@ -577318,7 +578236,7 @@ var init_task_templates = __esm({
|
|
|
577318
578236
|
|
|
577319
578237
|
// packages/prompts/dist/index.js
|
|
577320
578238
|
import { join as join109, dirname as dirname30 } from "node:path";
|
|
577321
|
-
import { fileURLToPath as
|
|
578239
|
+
import { fileURLToPath as fileURLToPath14 } from "node:url";
|
|
577322
578240
|
var _dir, _packageRoot;
|
|
577323
578241
|
var init_dist9 = __esm({
|
|
577324
578242
|
"packages/prompts/dist/index.js"() {
|
|
@@ -577327,7 +578245,7 @@ var init_dist9 = __esm({
|
|
|
577327
578245
|
init_render2();
|
|
577328
578246
|
init_task_templates();
|
|
577329
578247
|
init_render2();
|
|
577330
|
-
_dir = dirname30(
|
|
578248
|
+
_dir = dirname30(fileURLToPath14(import.meta.url));
|
|
577331
578249
|
_packageRoot = join109(_dir, "..");
|
|
577332
578250
|
}
|
|
577333
578251
|
});
|
|
@@ -578190,7 +579108,7 @@ Assistant: ${assistant}`;
|
|
|
578190
579108
|
const prov = last2.provenance ? `
|
|
578191
579109
|
Provenance: ${last2.provenance} (file_read to expand)` : "";
|
|
578192
579110
|
const kg = `
|
|
578193
|
-
KG summary: .omnius/context/kg-summary
|
|
579111
|
+
KG summary: .omnius/context/kg-summary/latest.md (file_read to expand; legacy pointer: .omnius/context/kg-summary-latest.md)`;
|
|
578194
579112
|
return `<session-recap>
|
|
578195
579113
|
Project chronology (older to newer):
|
|
578196
579114
|
${chronology.join("\n")}
|
|
@@ -584689,7 +585607,7 @@ import { existsSync as existsSync96, writeFileSync as writeFileSync49, readFileS
|
|
|
584689
585607
|
import { join as join112, dirname as dirname32 } from "node:path";
|
|
584690
585608
|
import { homedir as homedir36 } from "node:os";
|
|
584691
585609
|
import { execSync as execSync50, spawn as spawn27 } from "node:child_process";
|
|
584692
|
-
import { fileURLToPath as
|
|
585610
|
+
import { fileURLToPath as fileURLToPath15 } from "node:url";
|
|
584693
585611
|
function execAsync(cmd, opts = {}) {
|
|
584694
585612
|
return new Promise((resolve57, reject) => {
|
|
584695
585613
|
const child = spawn27("bash", ["-c", cmd], {
|
|
@@ -585500,7 +586418,7 @@ function getShippedVoicesDir() {
|
|
|
585500
586418
|
// repo root
|
|
585501
586419
|
];
|
|
585502
586420
|
try {
|
|
585503
|
-
const modDir = dirname32(
|
|
586421
|
+
const modDir = dirname32(fileURLToPath15(import.meta.url));
|
|
585504
586422
|
candidates.push(join112(modDir, "..", "..", "..", "voices", "personaplex"));
|
|
585505
586423
|
candidates.push(join112(modDir, "..", "..", "..", "..", "voices", "personaplex"));
|
|
585506
586424
|
} catch {
|
|
@@ -592424,7 +593342,7 @@ import { spawn as spawn29 } from "node:child_process";
|
|
|
592424
593342
|
import { existsSync as existsSync103, readFileSync as readFileSync82, writeFileSync as writeFileSync51, mkdirSync as mkdirSync56, unlinkSync as unlinkSync19, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
|
|
592425
593343
|
import { join as join117 } from "node:path";
|
|
592426
593344
|
import { homedir as homedir39 } from "node:os";
|
|
592427
|
-
import { fileURLToPath as
|
|
593345
|
+
import { fileURLToPath as fileURLToPath16 } from "node:url";
|
|
592428
593346
|
import { dirname as dirname33 } from "node:path";
|
|
592429
593347
|
function getDaemonPort() {
|
|
592430
593348
|
const env2 = process.env["OMNIUS_HOST"];
|
|
@@ -592490,7 +593408,7 @@ async function resolveDaemonCommand(nodeExe) {
|
|
|
592490
593408
|
if (first2) candidates.push(first2);
|
|
592491
593409
|
} catch {
|
|
592492
593410
|
}
|
|
592493
|
-
const thisDir = dirname33(
|
|
593411
|
+
const thisDir = dirname33(fileURLToPath16(import.meta.url));
|
|
592494
593412
|
candidates.push(join117(thisDir, "index.js"));
|
|
592495
593413
|
const seen = /* @__PURE__ */ new Set();
|
|
592496
593414
|
for (const candidate of candidates) {
|
|
@@ -598977,13 +599895,13 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
598977
599895
|
try {
|
|
598978
599896
|
const { randomBytes: randomBytes29 } = await import("node:crypto");
|
|
598979
599897
|
const { homedir: homedir56 } = await import("node:os");
|
|
598980
|
-
const { mkdirSync:
|
|
599898
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
598981
599899
|
const { join: join155 } = await import("node:path");
|
|
598982
599900
|
const newKey = randomBytes29(16).toString("hex");
|
|
598983
599901
|
process.env["OMNIUS_API_KEY"] = newKey;
|
|
598984
599902
|
const dir = join155(homedir56(), ".omnius");
|
|
598985
|
-
|
|
598986
|
-
|
|
599903
|
+
mkdirSync85(dir, { recursive: true });
|
|
599904
|
+
writeFileSync77(join155(dir, "api.key"), newKey + "\n", "utf8");
|
|
598987
599905
|
renderInfo(`New API key: ${c3.bold(c3.yellow(newKey))}`);
|
|
598988
599906
|
renderInfo(
|
|
598989
599907
|
"Restart the daemon to apply if needed. Use /access any to restart quickly."
|
|
@@ -599248,11 +600166,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
599248
600166
|
);
|
|
599249
600167
|
try {
|
|
599250
600168
|
const { homedir: homedir57 } = await import("node:os");
|
|
599251
|
-
const { mkdirSync:
|
|
600169
|
+
const { mkdirSync: mkdirSync86, writeFileSync: writeFileSync78 } = await import("node:fs");
|
|
599252
600170
|
const { join: join156 } = await import("node:path");
|
|
599253
600171
|
const dir = join156(homedir57(), ".omnius");
|
|
599254
|
-
|
|
599255
|
-
|
|
600172
|
+
mkdirSync86(dir, { recursive: true });
|
|
600173
|
+
writeFileSync78(join156(dir, "api.key"), apiKey + "\n", "utf8");
|
|
599256
600174
|
} catch {
|
|
599257
600175
|
}
|
|
599258
600176
|
}
|
|
@@ -599264,11 +600182,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
599264
600182
|
const port2 = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
|
|
599265
600183
|
try {
|
|
599266
600184
|
const { homedir: homedir57 } = await import("node:os");
|
|
599267
|
-
const { mkdirSync:
|
|
600185
|
+
const { mkdirSync: mkdirSync86, writeFileSync: writeFileSync78 } = await import("node:fs");
|
|
599268
600186
|
const { join: join156 } = await import("node:path");
|
|
599269
600187
|
const dir = join156(homedir57(), ".omnius");
|
|
599270
|
-
|
|
599271
|
-
|
|
600188
|
+
mkdirSync86(dir, { recursive: true });
|
|
600189
|
+
writeFileSync78(join156(dir, "access"), `${val2}
|
|
599272
600190
|
`, "utf8");
|
|
599273
600191
|
} catch {
|
|
599274
600192
|
}
|
|
@@ -599368,11 +600286,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
599368
600286
|
);
|
|
599369
600287
|
try {
|
|
599370
600288
|
const { homedir: homedir57 } = await import("node:os");
|
|
599371
|
-
const { mkdirSync:
|
|
600289
|
+
const { mkdirSync: mkdirSync86, writeFileSync: writeFileSync78 } = await import("node:fs");
|
|
599372
600290
|
const { join: join156 } = await import("node:path");
|
|
599373
600291
|
const dir = join156(homedir57(), ".omnius");
|
|
599374
|
-
|
|
599375
|
-
|
|
600292
|
+
mkdirSync86(dir, { recursive: true });
|
|
600293
|
+
writeFileSync78(join156(dir, "api.key"), apiKey + "\n", "utf8");
|
|
599376
600294
|
} catch {
|
|
599377
600295
|
}
|
|
599378
600296
|
}
|
|
@@ -599383,12 +600301,12 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
599383
600301
|
}
|
|
599384
600302
|
const port = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
|
|
599385
600303
|
const { homedir: homedir56 } = await import("node:os");
|
|
599386
|
-
const { mkdirSync:
|
|
600304
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
599387
600305
|
const { join: join155 } = await import("node:path");
|
|
599388
600306
|
try {
|
|
599389
600307
|
const dir = join155(homedir56(), ".omnius");
|
|
599390
|
-
|
|
599391
|
-
|
|
600308
|
+
mkdirSync85(dir, { recursive: true });
|
|
600309
|
+
writeFileSync77(join155(dir, "access"), `${val}
|
|
599392
600310
|
`, "utf8");
|
|
599393
600311
|
} catch (e2) {
|
|
599394
600312
|
renderWarning(
|
|
@@ -607203,7 +608121,7 @@ async function handleVoiceMenu(ctx3, save2, hasLocal) {
|
|
|
607203
608121
|
const { basename: basename36, join: pathJoin } = await import("node:path");
|
|
607204
608122
|
const {
|
|
607205
608123
|
copyFileSync: copyFileSync5,
|
|
607206
|
-
mkdirSync:
|
|
608124
|
+
mkdirSync: mkdirSync85,
|
|
607207
608125
|
existsSync: exists2
|
|
607208
608126
|
} = await import("node:fs");
|
|
607209
608127
|
const { homedir: homedir56 } = await import("node:os");
|
|
@@ -607218,7 +608136,7 @@ async function handleVoiceMenu(ctx3, save2, hasLocal) {
|
|
|
607218
608136
|
"models",
|
|
607219
608137
|
modelName
|
|
607220
608138
|
);
|
|
607221
|
-
if (!exists2(destDir))
|
|
608139
|
+
if (!exists2(destDir)) mkdirSync85(destDir, { recursive: true });
|
|
607222
608140
|
copyFileSync5(onnxDrop.path, pathJoin(destDir, "model.onnx"));
|
|
607223
608141
|
copyFileSync5(jsonDrop.path, pathJoin(destDir, "config.json"));
|
|
607224
608142
|
const { registerCustomOnnxModel: registerCustomOnnxModel2 } = await Promise.resolve().then(() => (init_voice(), voice_exports));
|
|
@@ -608689,13 +609607,13 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
608689
609607
|
sponsors.push(...verified);
|
|
608690
609608
|
if (verified.length > 0) {
|
|
608691
609609
|
try {
|
|
608692
|
-
const { mkdirSync:
|
|
608693
|
-
|
|
609610
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = __require("node:fs");
|
|
609611
|
+
mkdirSync85(sponsorDir2, { recursive: true });
|
|
608694
609612
|
const cached = verified.map((s2) => ({
|
|
608695
609613
|
...s2,
|
|
608696
609614
|
lastVerified: Date.now()
|
|
608697
609615
|
}));
|
|
608698
|
-
|
|
609616
|
+
writeFileSync77(knownFile, JSON.stringify(cached, null, 2));
|
|
608699
609617
|
} catch {
|
|
608700
609618
|
}
|
|
608701
609619
|
}
|
|
@@ -608899,7 +609817,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
608899
609817
|
}
|
|
608900
609818
|
if (models.length > 0) {
|
|
608901
609819
|
try {
|
|
608902
|
-
const { writeFileSync:
|
|
609820
|
+
const { writeFileSync: writeFileSync77, mkdirSync: mkdirSync85 } = await import("node:fs");
|
|
608903
609821
|
const { join: join155, dirname: dirname44 } = await import("node:path");
|
|
608904
609822
|
const cachePath = join155(
|
|
608905
609823
|
ctx3.repoRoot || process.cwd(),
|
|
@@ -608907,8 +609825,8 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
608907
609825
|
"nexus",
|
|
608908
609826
|
"peer-models-cache.json"
|
|
608909
609827
|
);
|
|
608910
|
-
|
|
608911
|
-
|
|
609828
|
+
mkdirSync85(dirname44(cachePath), { recursive: true });
|
|
609829
|
+
writeFileSync77(
|
|
608912
609830
|
cachePath,
|
|
608913
609831
|
JSON.stringify(
|
|
608914
609832
|
{
|
|
@@ -608980,7 +609898,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
608980
609898
|
}));
|
|
608981
609899
|
renderWarning("Live model probe failed; using sponsor directory model advertisement.");
|
|
608982
609900
|
try {
|
|
608983
|
-
const { writeFileSync:
|
|
609901
|
+
const { writeFileSync: writeFileSync77, mkdirSync: mkdirSync85 } = await import("node:fs");
|
|
608984
609902
|
const { join: join155, dirname: dirname44 } = await import("node:path");
|
|
608985
609903
|
const cachePath = join155(
|
|
608986
609904
|
ctx3.repoRoot || process.cwd(),
|
|
@@ -608988,8 +609906,8 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
608988
609906
|
"nexus",
|
|
608989
609907
|
"peer-models-cache.json"
|
|
608990
609908
|
);
|
|
608991
|
-
|
|
608992
|
-
|
|
609909
|
+
mkdirSync85(dirname44(cachePath), { recursive: true });
|
|
609910
|
+
writeFileSync77(
|
|
608993
609911
|
cachePath,
|
|
608994
609912
|
JSON.stringify({
|
|
608995
609913
|
peerId,
|
|
@@ -609920,11 +610838,11 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
609920
610838
|
let currentVersion = "0.0.0";
|
|
609921
610839
|
try {
|
|
609922
610840
|
const { createRequire: createRequire10 } = await import("node:module");
|
|
609923
|
-
const { fileURLToPath:
|
|
610841
|
+
const { fileURLToPath: fileURLToPath22 } = await import("node:url");
|
|
609924
610842
|
const { dirname: dirname44, join: join155 } = await import("node:path");
|
|
609925
610843
|
const { existsSync: existsSync138 } = await import("node:fs");
|
|
609926
610844
|
const req2 = createRequire10(import.meta.url);
|
|
609927
|
-
const thisDir = dirname44(
|
|
610845
|
+
const thisDir = dirname44(fileURLToPath22(import.meta.url));
|
|
609928
610846
|
const candidates = [
|
|
609929
610847
|
join155(thisDir, "..", "package.json"),
|
|
609930
610848
|
join155(thisDir, "..", "..", "package.json"),
|
|
@@ -611554,10 +612472,10 @@ var init_commands = __esm({
|
|
|
611554
612472
|
}
|
|
611555
612473
|
try {
|
|
611556
612474
|
const { createRequire: createRequire10 } = await import("node:module");
|
|
611557
|
-
const { fileURLToPath:
|
|
612475
|
+
const { fileURLToPath: fileURLToPath22 } = await import("node:url");
|
|
611558
612476
|
const { dirname: pathDirname, join: pathJoin } = await import("node:path");
|
|
611559
612477
|
const localRequire = createRequire10(import.meta.url);
|
|
611560
|
-
const here = pathDirname(
|
|
612478
|
+
const here = pathDirname(fileURLToPath22(import.meta.url));
|
|
611561
612479
|
let version4 = "?";
|
|
611562
612480
|
for (const up of ["..", "../..", "../../.."]) {
|
|
611563
612481
|
try {
|
|
@@ -611577,13 +612495,13 @@ var init_commands = __esm({
|
|
|
611577
612495
|
try {
|
|
611578
612496
|
const { randomBytes: randomBytes29 } = await import("node:crypto");
|
|
611579
612497
|
const { homedir: homedir56 } = await import("node:os");
|
|
611580
|
-
const { mkdirSync:
|
|
612498
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
611581
612499
|
const { join: join155 } = await import("node:path");
|
|
611582
612500
|
const apiKey = randomBytes29(16).toString("hex");
|
|
611583
612501
|
process.env["OMNIUS_API_KEY"] = apiKey;
|
|
611584
612502
|
const dir = join155(homedir56(), ".omnius");
|
|
611585
|
-
|
|
611586
|
-
|
|
612503
|
+
mkdirSync85(dir, { recursive: true });
|
|
612504
|
+
writeFileSync77(join155(dir, "api.key"), apiKey + "\n", "utf8");
|
|
611587
612505
|
renderInfo(`Generated API key: ${c3.bold(c3.yellow(apiKey))}`);
|
|
611588
612506
|
renderInfo(
|
|
611589
612507
|
"Use Authorization: Bearer <key> or click 'key' in the Web UI header to paste it."
|
|
@@ -611602,11 +612520,11 @@ var init_commands = __esm({
|
|
|
611602
612520
|
const port = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
|
|
611603
612521
|
try {
|
|
611604
612522
|
const { homedir: homedir56 } = await import("node:os");
|
|
611605
|
-
const { mkdirSync:
|
|
612523
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
611606
612524
|
const { join: join155 } = await import("node:path");
|
|
611607
612525
|
const dir = join155(homedir56(), ".omnius");
|
|
611608
|
-
|
|
611609
|
-
|
|
612526
|
+
mkdirSync85(dir, { recursive: true });
|
|
612527
|
+
writeFileSync77(join155(dir, "access"), `${val}
|
|
611610
612528
|
`, "utf8");
|
|
611611
612529
|
} catch {
|
|
611612
612530
|
}
|
|
@@ -611769,7 +612687,7 @@ var init_commands = __esm({
|
|
|
611769
612687
|
});
|
|
611770
612688
|
|
|
611771
612689
|
// packages/cli/src/tui/project-context.ts
|
|
611772
|
-
import { existsSync as existsSync108, readFileSync as readFileSync87, readdirSync as readdirSync36 } from "node:fs";
|
|
612690
|
+
import { existsSync as existsSync108, readFileSync as readFileSync87, readdirSync as readdirSync36, mkdirSync as mkdirSync60, writeFileSync as writeFileSync55 } from "node:fs";
|
|
611773
612691
|
import { join as join121, basename as basename24 } from "node:path";
|
|
611774
612692
|
import { execSync as execSync54 } from "node:child_process";
|
|
611775
612693
|
import { homedir as homedir42 } from "node:os";
|
|
@@ -612002,6 +612920,8 @@ function loadPatternSuggestions(repoRoot, store2) {
|
|
|
612002
612920
|
}
|
|
612003
612921
|
}
|
|
612004
612922
|
function buildProjectContext(repoRoot, stores) {
|
|
612923
|
+
const skills = discoverSkills(repoRoot);
|
|
612924
|
+
writeCompressedSkillsArtifact(repoRoot, skills);
|
|
612005
612925
|
return {
|
|
612006
612926
|
projectInstructions: loadProjectFiles(repoRoot),
|
|
612007
612927
|
projectMap: loadProjectMap(repoRoot),
|
|
@@ -612012,9 +612932,40 @@ function buildProjectContext(repoRoot, stores) {
|
|
|
612012
612932
|
taskMemories: stores?.taskMemoryStore ? loadTaskMemories(repoRoot, stores.taskMemoryStore) : "",
|
|
612013
612933
|
failurePatterns: stores?.failureStore ? loadFailurePatterns(stores.failureStore) : "",
|
|
612014
612934
|
patternSuggestions: stores?.toolPatternStore ? loadPatternSuggestions(repoRoot, stores.toolPatternStore) : "",
|
|
612015
|
-
skillsSummary: buildSkillsSummary(
|
|
612935
|
+
skillsSummary: buildSkillsSummary(skills)
|
|
612016
612936
|
};
|
|
612017
612937
|
}
|
|
612938
|
+
function writeCompressedSkillsArtifact(repoRoot, skills) {
|
|
612939
|
+
try {
|
|
612940
|
+
const contextDir = join121(repoRoot, OMNIUS_DIR, "context");
|
|
612941
|
+
mkdirSync60(contextDir, { recursive: true });
|
|
612942
|
+
const bySource = /* @__PURE__ */ new Map();
|
|
612943
|
+
for (const skill of skills) bySource.set(skill.source, (bySource.get(skill.source) ?? 0) + 1);
|
|
612944
|
+
const top = skills.slice(0, 30).map((skill) => ({
|
|
612945
|
+
name: skill.name,
|
|
612946
|
+
source: skill.source,
|
|
612947
|
+
description: skill.description.slice(0, 220),
|
|
612948
|
+
triggers: skill.triggers.slice(0, 4)
|
|
612949
|
+
}));
|
|
612950
|
+
writeFileSync55(
|
|
612951
|
+
join121(contextDir, "skills-compressed.json"),
|
|
612952
|
+
JSON.stringify(
|
|
612953
|
+
{
|
|
612954
|
+
schema: "omnius.skills-compressed.v1",
|
|
612955
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
612956
|
+
totalSkills: skills.length,
|
|
612957
|
+
sourceCounts: Object.fromEntries([...bySource.entries()].sort((a2, b) => a2[0].localeCompare(b[0]))),
|
|
612958
|
+
defaultLimit: 30,
|
|
612959
|
+
skills: top
|
|
612960
|
+
},
|
|
612961
|
+
null,
|
|
612962
|
+
2
|
|
612963
|
+
) + "\n",
|
|
612964
|
+
"utf-8"
|
|
612965
|
+
);
|
|
612966
|
+
} catch {
|
|
612967
|
+
}
|
|
612968
|
+
}
|
|
612018
612969
|
function formatContextForPrompt(ctx3, modelTier = "large") {
|
|
612019
612970
|
const sections = [];
|
|
612020
612971
|
if (ctx3.environment) {
|
|
@@ -612254,11 +613205,11 @@ var init_realtime = __esm({
|
|
|
612254
613205
|
});
|
|
612255
613206
|
|
|
612256
613207
|
// packages/cli/src/tui/memory-paths.ts
|
|
612257
|
-
import { mkdirSync as
|
|
613208
|
+
import { mkdirSync as mkdirSync61 } from "node:fs";
|
|
612258
613209
|
import { join as join123 } from "node:path";
|
|
612259
613210
|
function omniusMemoryDbPaths(repoRoot) {
|
|
612260
613211
|
const dir = join123(repoRoot, ".omnius");
|
|
612261
|
-
|
|
613212
|
+
mkdirSync61(dir, { recursive: true });
|
|
612262
613213
|
return {
|
|
612263
613214
|
dir,
|
|
612264
613215
|
episodes: join123(dir, "episodes.db"),
|
|
@@ -613398,7 +614349,7 @@ __export(banner_exports, {
|
|
|
613398
614349
|
setBannerWriter: () => setBannerWriter,
|
|
613399
614350
|
setGridText: () => setGridText
|
|
613400
614351
|
});
|
|
613401
|
-
import { existsSync as existsSync111, readFileSync as readFileSync89, writeFileSync as
|
|
614352
|
+
import { existsSync as existsSync111, readFileSync as readFileSync89, writeFileSync as writeFileSync56, mkdirSync as mkdirSync62 } from "node:fs";
|
|
613402
614353
|
import { join as join124 } from "node:path";
|
|
613403
614354
|
function setBannerWriter(writer) {
|
|
613404
614355
|
chromeWrite3 = writer;
|
|
@@ -613533,8 +614484,8 @@ function createSponsorBanner(sponsorName, tagline, primaryColor = 214, bgColor =
|
|
|
613533
614484
|
}
|
|
613534
614485
|
function saveBannerDesign(workDir, design) {
|
|
613535
614486
|
const dir = join124(workDir, ".omnius", "banners");
|
|
613536
|
-
|
|
613537
|
-
|
|
614487
|
+
mkdirSync62(dir, { recursive: true });
|
|
614488
|
+
writeFileSync56(join124(dir, `${design.id}.json`), JSON.stringify(design, null, 2), "utf8");
|
|
613538
614489
|
}
|
|
613539
614490
|
function loadBannerDesign(workDir, id) {
|
|
613540
614491
|
const file = join124(workDir, ".omnius", "banners", `${id}.json`);
|
|
@@ -613870,7 +614821,7 @@ var init_banner = __esm({
|
|
|
613870
614821
|
});
|
|
613871
614822
|
|
|
613872
614823
|
// packages/cli/src/tui/carousel-descriptors.ts
|
|
613873
|
-
import { existsSync as existsSync112, readFileSync as readFileSync90, writeFileSync as
|
|
614824
|
+
import { existsSync as existsSync112, readFileSync as readFileSync90, writeFileSync as writeFileSync57, mkdirSync as mkdirSync63, readdirSync as readdirSync38 } from "node:fs";
|
|
613874
614825
|
import { join as join125, basename as basename28 } from "node:path";
|
|
613875
614826
|
function loadToolProfile(repoRoot) {
|
|
613876
614827
|
const filePath = join125(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
|
|
@@ -613883,8 +614834,8 @@ function loadToolProfile(repoRoot) {
|
|
|
613883
614834
|
}
|
|
613884
614835
|
function saveToolProfile(repoRoot, profile) {
|
|
613885
614836
|
const contextDir = join125(repoRoot, OMNIUS_DIR, "context");
|
|
613886
|
-
|
|
613887
|
-
|
|
614837
|
+
mkdirSync63(contextDir, { recursive: true });
|
|
614838
|
+
writeFileSync57(join125(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
|
|
613888
614839
|
}
|
|
613889
614840
|
function categorizeToolCall(toolName) {
|
|
613890
614841
|
for (const cat2 of TOOL_CATEGORIES) {
|
|
@@ -613950,13 +614901,13 @@ function loadCachedDescriptors(repoRoot) {
|
|
|
613950
614901
|
}
|
|
613951
614902
|
function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
|
|
613952
614903
|
const contextDir = join125(repoRoot, OMNIUS_DIR, "context");
|
|
613953
|
-
|
|
614904
|
+
mkdirSync63(contextDir, { recursive: true });
|
|
613954
614905
|
const cached = {
|
|
613955
614906
|
phrases,
|
|
613956
614907
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
613957
614908
|
sourceHash
|
|
613958
614909
|
};
|
|
613959
|
-
|
|
614910
|
+
writeFileSync57(join125(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
|
|
613960
614911
|
}
|
|
613961
614912
|
function generateDescriptors(repoRoot) {
|
|
613962
614913
|
const profile = loadToolProfile(repoRoot);
|
|
@@ -615032,13 +615983,13 @@ var init_stream_renderer = __esm({
|
|
|
615032
615983
|
});
|
|
615033
615984
|
|
|
615034
615985
|
// packages/cli/src/tui/edit-history.ts
|
|
615035
|
-
import { appendFileSync as appendFileSync9, mkdirSync as
|
|
615986
|
+
import { appendFileSync as appendFileSync9, mkdirSync as mkdirSync64 } from "node:fs";
|
|
615036
615987
|
import { join as join126 } from "node:path";
|
|
615037
615988
|
function createEditHistoryLogger(repoRoot, sessionId) {
|
|
615038
615989
|
const historyDir = join126(repoRoot, ".omnius", "history");
|
|
615039
615990
|
const logPath3 = join126(historyDir, "edits.jsonl");
|
|
615040
615991
|
try {
|
|
615041
|
-
|
|
615992
|
+
mkdirSync64(historyDir, { recursive: true });
|
|
615042
615993
|
} catch {
|
|
615043
615994
|
}
|
|
615044
615995
|
function logToolCall(toolName, toolArgs, success) {
|
|
@@ -615148,7 +616099,7 @@ var init_edit_history = __esm({
|
|
|
615148
616099
|
// packages/cli/src/tui/promptLoader.ts
|
|
615149
616100
|
import { readFileSync as readFileSync91, existsSync as existsSync113 } from "node:fs";
|
|
615150
616101
|
import { join as join127, dirname as dirname36 } from "node:path";
|
|
615151
|
-
import { fileURLToPath as
|
|
616102
|
+
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
615152
616103
|
function loadPrompt3(promptPath, vars) {
|
|
615153
616104
|
let content = cache7.get(promptPath);
|
|
615154
616105
|
if (content === void 0) {
|
|
@@ -615166,7 +616117,7 @@ var __filename5, __dirname6, devPath2, publishedPath2, PROMPTS_DIR3, cache7;
|
|
|
615166
616117
|
var init_promptLoader3 = __esm({
|
|
615167
616118
|
"packages/cli/src/tui/promptLoader.ts"() {
|
|
615168
616119
|
"use strict";
|
|
615169
|
-
__filename5 =
|
|
616120
|
+
__filename5 = fileURLToPath17(import.meta.url);
|
|
615170
616121
|
__dirname6 = dirname36(__filename5);
|
|
615171
616122
|
devPath2 = join127(__dirname6, "..", "..", "prompts");
|
|
615172
616123
|
publishedPath2 = join127(__dirname6, "..", "prompts");
|
|
@@ -615176,7 +616127,7 @@ var init_promptLoader3 = __esm({
|
|
|
615176
616127
|
});
|
|
615177
616128
|
|
|
615178
616129
|
// packages/cli/src/tui/dream-engine.ts
|
|
615179
|
-
import { mkdirSync as
|
|
616130
|
+
import { mkdirSync as mkdirSync65, writeFileSync as writeFileSync58, readFileSync as readFileSync92, existsSync as existsSync114, readdirSync as readdirSync39 } from "node:fs";
|
|
615180
616131
|
import { join as join128, basename as basename29 } from "node:path";
|
|
615181
616132
|
import { execSync as execSync55 } from "node:child_process";
|
|
615182
616133
|
function setDreamWriteContent(fn) {
|
|
@@ -615396,8 +616347,8 @@ var init_dream_engine = __esm({
|
|
|
615396
616347
|
}
|
|
615397
616348
|
try {
|
|
615398
616349
|
const dir = join128(targetPath, "..");
|
|
615399
|
-
|
|
615400
|
-
|
|
616350
|
+
mkdirSync65(dir, { recursive: true });
|
|
616351
|
+
writeFileSync58(targetPath, content, "utf-8");
|
|
615401
616352
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
|
|
615402
616353
|
} catch (err) {
|
|
615403
616354
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
|
|
@@ -615438,7 +616389,7 @@ var init_dream_engine = __esm({
|
|
|
615438
616389
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
615439
616390
|
}
|
|
615440
616391
|
content = content.replace(oldStr, newStr);
|
|
615441
|
-
|
|
616392
|
+
writeFileSync58(targetPath, content, "utf-8");
|
|
615442
616393
|
return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start2 };
|
|
615443
616394
|
} catch (err) {
|
|
615444
616395
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
|
|
@@ -615484,8 +616435,8 @@ var init_dream_engine = __esm({
|
|
|
615484
616435
|
}
|
|
615485
616436
|
try {
|
|
615486
616437
|
const dir = join128(targetPath, "..");
|
|
615487
|
-
|
|
615488
|
-
|
|
616438
|
+
mkdirSync65(dir, { recursive: true });
|
|
616439
|
+
writeFileSync58(targetPath, content, "utf-8");
|
|
615489
616440
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
|
|
615490
616441
|
} catch (err) {
|
|
615491
616442
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
|
|
@@ -615526,7 +616477,7 @@ var init_dream_engine = __esm({
|
|
|
615526
616477
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
615527
616478
|
}
|
|
615528
616479
|
content = content.replace(oldStr, newStr);
|
|
615529
|
-
|
|
616480
|
+
writeFileSync58(targetPath, content, "utf-8");
|
|
615530
616481
|
return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start2 };
|
|
615531
616482
|
} catch (err) {
|
|
615532
616483
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
|
|
@@ -615614,7 +616565,7 @@ var init_dream_engine = __esm({
|
|
|
615614
616565
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
615615
616566
|
results: []
|
|
615616
616567
|
};
|
|
615617
|
-
|
|
616568
|
+
mkdirSync65(this.dreamsDir, { recursive: true });
|
|
615618
616569
|
this.saveDreamState();
|
|
615619
616570
|
try {
|
|
615620
616571
|
for (let cycle = 1; cycle <= totalCycles; cycle++) {
|
|
@@ -615687,7 +616638,7 @@ ${result.summary}`;
|
|
|
615687
616638
|
renderDreamContraction(cycle);
|
|
615688
616639
|
const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
|
|
615689
616640
|
const summaryPath = join128(this.dreamsDir, `cycle-${cycle}-summary.md`);
|
|
615690
|
-
|
|
616641
|
+
writeFileSync58(summaryPath, cycleSummary, "utf-8");
|
|
615691
616642
|
}
|
|
615692
616643
|
if (mode === "lucid" && !this.abortController.signal.aborted) {
|
|
615693
616644
|
this.saveVersionCheckpoint(cycle);
|
|
@@ -616349,8 +617300,8 @@ ${summaryResult}
|
|
|
616349
617300
|
*Generated by omnius autoresearch swarm*
|
|
616350
617301
|
`;
|
|
616351
617302
|
try {
|
|
616352
|
-
|
|
616353
|
-
|
|
617303
|
+
mkdirSync65(this.dreamsDir, { recursive: true });
|
|
617304
|
+
writeFileSync58(reportPath, report2, "utf-8");
|
|
616354
617305
|
} catch {
|
|
616355
617306
|
}
|
|
616356
617307
|
renderSwarmComplete(workspace);
|
|
@@ -616442,7 +617393,7 @@ ${summaryResult}
|
|
|
616442
617393
|
return { success: false, output: "", error: "todos must be an array" };
|
|
616443
617394
|
}
|
|
616444
617395
|
try {
|
|
616445
|
-
|
|
617396
|
+
writeFileSync58(todoPath3, JSON.stringify({ todos, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), "utf-8");
|
|
616446
617397
|
const summary = todos.map(
|
|
616447
617398
|
(t2, i2) => ` ${t2.status === "completed" ? "✓" : t2.status === "in_progress" ? "▶" : "◯"} ${i2 + 1}: ${t2.content || "(untitled)"}`
|
|
616448
617399
|
).join("\n");
|
|
@@ -616490,11 +617441,11 @@ ${summary}` };
|
|
|
616490
617441
|
addedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
616491
617442
|
};
|
|
616492
617443
|
notes2.push(note);
|
|
616493
|
-
|
|
617444
|
+
writeFileSync58(notesPath, JSON.stringify(notes2, null, 2), "utf-8");
|
|
616494
617445
|
return { success: true, output: `Note added: [${note.category}] ${note.content.slice(0, 80)}` };
|
|
616495
617446
|
}
|
|
616496
617447
|
if (action === "clear") {
|
|
616497
|
-
|
|
617448
|
+
writeFileSync58(notesPath, "[]", "utf-8");
|
|
616498
617449
|
return { success: true, output: "All notes cleared." };
|
|
616499
617450
|
}
|
|
616500
617451
|
if (action === "search") {
|
|
@@ -616532,7 +617483,7 @@ ${summary}` };
|
|
|
616532
617483
|
saveVersionCheckpoint(cycle) {
|
|
616533
617484
|
const checkpointDir3 = join128(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
|
|
616534
617485
|
try {
|
|
616535
|
-
|
|
617486
|
+
mkdirSync65(checkpointDir3, { recursive: true });
|
|
616536
617487
|
try {
|
|
616537
617488
|
const gitStatus = execSync55("git status --porcelain", {
|
|
616538
617489
|
cwd: this.repoRoot,
|
|
@@ -616549,10 +617500,10 @@ ${summary}` };
|
|
|
616549
617500
|
encoding: "utf-8",
|
|
616550
617501
|
timeout: 5e3
|
|
616551
617502
|
}).trim();
|
|
616552
|
-
|
|
616553
|
-
|
|
616554
|
-
|
|
616555
|
-
|
|
617503
|
+
writeFileSync58(join128(checkpointDir3, "git-status.txt"), gitStatus, "utf-8");
|
|
617504
|
+
writeFileSync58(join128(checkpointDir3, "git-diff.patch"), gitDiff, "utf-8");
|
|
617505
|
+
writeFileSync58(join128(checkpointDir3, "git-hash.txt"), gitHash, "utf-8");
|
|
617506
|
+
writeFileSync58(
|
|
616556
617507
|
join128(checkpointDir3, "checkpoint.json"),
|
|
616557
617508
|
JSON.stringify({
|
|
616558
617509
|
cycle,
|
|
@@ -616564,7 +617515,7 @@ ${summary}` };
|
|
|
616564
617515
|
);
|
|
616565
617516
|
renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
|
|
616566
617517
|
} catch {
|
|
616567
|
-
|
|
617518
|
+
writeFileSync58(
|
|
616568
617519
|
join128(checkpointDir3, "checkpoint.json"),
|
|
616569
617520
|
JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2),
|
|
616570
617521
|
"utf-8"
|
|
@@ -616626,7 +617577,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
|
|
|
616626
617577
|
---
|
|
616627
617578
|
*Auto-generated by omnius dream engine*
|
|
616628
617579
|
`;
|
|
616629
|
-
|
|
617580
|
+
writeFileSync58(join128(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
|
|
616630
617581
|
} catch {
|
|
616631
617582
|
}
|
|
616632
617583
|
}
|
|
@@ -616648,7 +617599,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
|
|
|
616648
617599
|
};
|
|
616649
617600
|
renderInfo("Memory consolidation starting — Phase 1: Orient → Phase 2: Gather → Phase 3: Consolidate → Phase 4: Prune");
|
|
616650
617601
|
const memoryDir = join128(this.repoRoot, ".omnius", "memory");
|
|
616651
|
-
|
|
617602
|
+
mkdirSync65(memoryDir, { recursive: true });
|
|
616652
617603
|
let prompt;
|
|
616653
617604
|
try {
|
|
616654
617605
|
prompt = loadPrompt3("tui/dream-consolidate.md", {
|
|
@@ -616714,7 +617665,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
|
|
|
616714
617665
|
durationMs
|
|
616715
617666
|
});
|
|
616716
617667
|
try {
|
|
616717
|
-
|
|
617668
|
+
writeFileSync58(
|
|
616718
617669
|
join128(memoryDir, ".last-consolidation"),
|
|
616719
617670
|
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), summary: result.summary?.slice(0, 500) }) + "\n"
|
|
616720
617671
|
);
|
|
@@ -616732,7 +617683,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
|
|
|
616732
617683
|
/** Save dream state for resume/inspection */
|
|
616733
617684
|
saveDreamState() {
|
|
616734
617685
|
try {
|
|
616735
|
-
|
|
617686
|
+
writeFileSync58(
|
|
616736
617687
|
join128(this.dreamsDir, "dream-state.json"),
|
|
616737
617688
|
JSON.stringify(this.state, null, 2) + "\n",
|
|
616738
617689
|
"utf-8"
|
|
@@ -617113,7 +618064,7 @@ var init_bless_engine = __esm({
|
|
|
617113
618064
|
});
|
|
617114
618065
|
|
|
617115
618066
|
// packages/cli/src/tui/dmn-engine.ts
|
|
617116
|
-
import { existsSync as existsSync115, readFileSync as readFileSync93, writeFileSync as
|
|
618067
|
+
import { existsSync as existsSync115, readFileSync as readFileSync93, writeFileSync as writeFileSync59, mkdirSync as mkdirSync66, readdirSync as readdirSync40, unlinkSync as unlinkSync21 } from "node:fs";
|
|
617117
618068
|
import { join as join129, basename as basename30 } from "node:path";
|
|
617118
618069
|
function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
|
|
617119
618070
|
const competenceReport = competence.length > 0 ? competence.map((c8) => {
|
|
@@ -617221,7 +618172,7 @@ var init_dmn_engine = __esm({
|
|
|
617221
618172
|
this.repoRoot = repoRoot;
|
|
617222
618173
|
this.stateDir = join129(repoRoot, ".omnius", "dmn");
|
|
617223
618174
|
this.historyDir = join129(repoRoot, ".omnius", "dmn", "cycles");
|
|
617224
|
-
|
|
618175
|
+
mkdirSync66(this.historyDir, { recursive: true });
|
|
617225
618176
|
this.loadState();
|
|
617226
618177
|
}
|
|
617227
618178
|
config;
|
|
@@ -617885,7 +618836,7 @@ OUTPUT: Call task_complete with JSON:
|
|
|
617885
618836
|
}
|
|
617886
618837
|
saveState() {
|
|
617887
618838
|
try {
|
|
617888
|
-
|
|
618839
|
+
writeFileSync59(
|
|
617889
618840
|
join129(this.stateDir, "state.json"),
|
|
617890
618841
|
JSON.stringify(this.state, null, 2) + "\n",
|
|
617891
618842
|
"utf-8"
|
|
@@ -617896,23 +618847,62 @@ OUTPUT: Call task_complete with JSON:
|
|
|
617896
618847
|
saveCycleResult(result) {
|
|
617897
618848
|
try {
|
|
617898
618849
|
const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
|
|
617899
|
-
|
|
618850
|
+
writeFileSync59(
|
|
617900
618851
|
join129(this.historyDir, filename),
|
|
617901
618852
|
JSON.stringify(result, null, 2) + "\n",
|
|
617902
618853
|
"utf-8"
|
|
617903
618854
|
);
|
|
617904
|
-
|
|
617905
|
-
|
|
617906
|
-
|
|
617907
|
-
|
|
617908
|
-
|
|
617909
|
-
|
|
617910
|
-
|
|
618855
|
+
this.pruneCycleHistory();
|
|
618856
|
+
} catch {
|
|
618857
|
+
}
|
|
618858
|
+
}
|
|
618859
|
+
pruneCycleHistory() {
|
|
618860
|
+
const files = readdirSync40(this.historyDir).filter((f2) => f2.startsWith("cycle-") && f2.endsWith(".json")).sort();
|
|
618861
|
+
if (files.length <= 2) return;
|
|
618862
|
+
const keep = /* @__PURE__ */ new Set([files[0], files[files.length - 1]]);
|
|
618863
|
+
const latestByFingerprint = /* @__PURE__ */ new Map();
|
|
618864
|
+
for (const file of files) {
|
|
618865
|
+
try {
|
|
618866
|
+
const parsed = JSON.parse(readFileSync93(join129(this.historyDir, file), "utf-8"));
|
|
618867
|
+
latestByFingerprint.set(this.fingerprintCycle(parsed), file);
|
|
618868
|
+
} catch {
|
|
618869
|
+
keep.add(file);
|
|
618870
|
+
}
|
|
618871
|
+
}
|
|
618872
|
+
for (const file of latestByFingerprint.values()) keep.add(file);
|
|
618873
|
+
const maxFiles = 50;
|
|
618874
|
+
if (keep.size > maxFiles) {
|
|
618875
|
+
const protectedFiles = /* @__PURE__ */ new Set([files[0], files[files.length - 1]]);
|
|
618876
|
+
const removableKeepers = [...keep].filter((file) => !protectedFiles.has(file)).sort();
|
|
618877
|
+
for (const file of removableKeepers.slice(0, keep.size - maxFiles)) {
|
|
618878
|
+
keep.delete(file);
|
|
618879
|
+
}
|
|
618880
|
+
}
|
|
618881
|
+
for (const file of files) {
|
|
618882
|
+
if (!keep.has(file)) {
|
|
618883
|
+
try {
|
|
618884
|
+
unlinkSync21(join129(this.historyDir, file));
|
|
618885
|
+
} catch {
|
|
617911
618886
|
}
|
|
617912
618887
|
}
|
|
617913
|
-
} catch {
|
|
617914
618888
|
}
|
|
617915
618889
|
}
|
|
618890
|
+
fingerprintCycle(result) {
|
|
618891
|
+
const selected = result.selectedTask ? [
|
|
618892
|
+
result.selectedTask.category,
|
|
618893
|
+
result.selectedTask.task,
|
|
618894
|
+
result.selectedTask.rationale,
|
|
618895
|
+
result.selectedTask.provenance.join("|")
|
|
618896
|
+
].join(" ") : "null-selection";
|
|
618897
|
+
const normalized = cleanForStorage(`${selected}
|
|
618898
|
+
${result.reasoning}`).toLowerCase().replace(/\d+/g, "#").replace(/\s+/g, " ").trim().slice(0, 1200);
|
|
618899
|
+
let hash = 2166136261;
|
|
618900
|
+
for (let i2 = 0; i2 < normalized.length; i2++) {
|
|
618901
|
+
hash ^= normalized.charCodeAt(i2);
|
|
618902
|
+
hash = Math.imul(hash, 16777619);
|
|
618903
|
+
}
|
|
618904
|
+
return (hash >>> 0).toString(16);
|
|
618905
|
+
}
|
|
617916
618906
|
};
|
|
617917
618907
|
}
|
|
617918
618908
|
});
|
|
@@ -619688,11 +620678,11 @@ var init_telegram_stats_menu = __esm({
|
|
|
619688
620678
|
import { createCipheriv as createCipheriv4, createDecipheriv as createDecipheriv4, randomBytes as randomBytes23 } from "node:crypto";
|
|
619689
620679
|
import {
|
|
619690
620680
|
existsSync as existsSync117,
|
|
619691
|
-
mkdirSync as
|
|
620681
|
+
mkdirSync as mkdirSync67,
|
|
619692
620682
|
readFileSync as readFileSync95,
|
|
619693
620683
|
statSync as statSync42,
|
|
619694
620684
|
unlinkSync as unlinkSync22,
|
|
619695
|
-
writeFileSync as
|
|
620685
|
+
writeFileSync as writeFileSync60
|
|
619696
620686
|
} from "node:fs";
|
|
619697
620687
|
import { mkdir as mkdir19 } from "node:fs/promises";
|
|
619698
620688
|
import {
|
|
@@ -619709,7 +620699,7 @@ function telegramCreativeWorkspaceRoot(repoRoot, chatId) {
|
|
|
619709
620699
|
const raw = chatId === void 0 ? "unknown" : String(chatId);
|
|
619710
620700
|
const key = raw.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 96) || "unknown";
|
|
619711
620701
|
const root = join131(repoRoot, ".omnius", "telegram-creative", key);
|
|
619712
|
-
|
|
620702
|
+
mkdirSync67(root, { recursive: true });
|
|
619713
620703
|
return root;
|
|
619714
620704
|
}
|
|
619715
620705
|
function formatTelegramCreativeWorkspacePrompt(root) {
|
|
@@ -619861,8 +620851,8 @@ function scopedTool(base3, root, mode) {
|
|
|
619861
620851
|
if (mode === "edit" && !existsSync117(guarded.path.abs)) {
|
|
619862
620852
|
const materialized = materializeTelegramCreativeArtifactForSend(rootAbs, guarded.path.rel);
|
|
619863
620853
|
if (!materialized.ok) return denied(materialized.error);
|
|
619864
|
-
|
|
619865
|
-
|
|
620854
|
+
mkdirSync67(dirname37(guarded.path.abs), { recursive: true });
|
|
620855
|
+
writeFileSync60(guarded.path.abs, readFileSync95(materialized.path));
|
|
619866
620856
|
materialized.cleanup?.();
|
|
619867
620857
|
restoredEditPath = guarded.path.abs;
|
|
619868
620858
|
}
|
|
@@ -619950,10 +620940,10 @@ function manifestPath(root) {
|
|
|
619950
620940
|
return join131(root, MANIFEST_FILE);
|
|
619951
620941
|
}
|
|
619952
620942
|
function ensureManifest(root) {
|
|
619953
|
-
|
|
620943
|
+
mkdirSync67(root, { recursive: true });
|
|
619954
620944
|
const path12 = manifestPath(root);
|
|
619955
620945
|
if (!existsSync117(path12)) {
|
|
619956
|
-
|
|
620946
|
+
writeFileSync60(path12, JSON.stringify({ files: [], updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2) + "\n", "utf8");
|
|
619957
620947
|
}
|
|
619958
620948
|
}
|
|
619959
620949
|
function readManifest(root) {
|
|
@@ -619979,7 +620969,7 @@ function readManifest(root) {
|
|
|
619979
620969
|
}
|
|
619980
620970
|
function writeManifest(root, manifest) {
|
|
619981
620971
|
ensureManifest(root);
|
|
619982
|
-
|
|
620972
|
+
writeFileSync60(manifestPath(root), JSON.stringify(manifest, null, 2) + "\n", "utf8");
|
|
619983
620973
|
}
|
|
619984
620974
|
function manifestHas(root, relPath) {
|
|
619985
620975
|
const rel = relPath.replace(/\\/g, "/");
|
|
@@ -620003,7 +620993,7 @@ function rememberCreated(root, absPath) {
|
|
|
620003
620993
|
}
|
|
620004
620994
|
}
|
|
620005
620995
|
}
|
|
620006
|
-
|
|
620996
|
+
mkdirSync67(join131(root, OBJECTS_DIR), { recursive: true });
|
|
620007
620997
|
const data = readFileSync95(guarded.path.abs);
|
|
620008
620998
|
const prefix = randomBytes23(48);
|
|
620009
620999
|
const key = randomBytes23(32);
|
|
@@ -620013,7 +621003,7 @@ function rememberCreated(root, absPath) {
|
|
|
620013
621003
|
const tag = cipher.getAuthTag();
|
|
620014
621004
|
const storedRel = join131(OBJECTS_DIR, `${Date.now()}-${randomBytes23(12).toString("hex")}.blob`).replace(/\\/g, "/");
|
|
620015
621005
|
const storedAbs = join131(root, storedRel);
|
|
620016
|
-
|
|
621006
|
+
writeFileSync60(storedAbs, Buffer.concat([prefix, encrypted]));
|
|
620017
621007
|
try {
|
|
620018
621008
|
unlinkSync22(guarded.path.abs);
|
|
620019
621009
|
} catch {
|
|
@@ -620072,9 +621062,9 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
|
|
|
620072
621062
|
payload = Buffer.concat([decipher.update(payload), decipher.final()]);
|
|
620073
621063
|
}
|
|
620074
621064
|
const stageDir = join131(rootAbs, SEND_DIR, `${Date.now()}-${randomBytes23(8).toString("hex")}`);
|
|
620075
|
-
|
|
621065
|
+
mkdirSync67(stageDir, { recursive: true });
|
|
620076
621066
|
const staged = join131(stageDir, object.originalName || basename32(rel));
|
|
620077
|
-
|
|
621067
|
+
writeFileSync60(staged, payload);
|
|
620078
621068
|
return {
|
|
620079
621069
|
ok: true,
|
|
620080
621070
|
path: staged,
|
|
@@ -620741,7 +621731,7 @@ var init_soul_observations = __esm({
|
|
|
620741
621731
|
});
|
|
620742
621732
|
|
|
620743
621733
|
// packages/cli/src/tui/telegram-channel-dmn.ts
|
|
620744
|
-
import { existsSync as existsSync118, mkdirSync as
|
|
621734
|
+
import { existsSync as existsSync118, mkdirSync as mkdirSync68, readdirSync as readdirSync42, readFileSync as readFileSync96, writeFileSync as writeFileSync61 } from "node:fs";
|
|
620745
621735
|
import { join as join132 } from "node:path";
|
|
620746
621736
|
import { createHash as createHash26 } from "node:crypto";
|
|
620747
621737
|
function safeFilePart(value2) {
|
|
@@ -621301,12 +622291,12 @@ ${artifact.personaContext}
|
|
|
621301
622291
|
}
|
|
621302
622292
|
function writeTelegramChannelDaydream(repoRoot, artifact) {
|
|
621303
622293
|
const dir = sessionDir(repoRoot, artifact.sessionKey);
|
|
621304
|
-
|
|
622294
|
+
mkdirSync68(dir, { recursive: true });
|
|
621305
622295
|
const base3 = `${artifact.generatedAt.replace(/[:.]/g, "-")}-${artifact.id}`;
|
|
621306
622296
|
const jsonPath = join132(dir, `${base3}.json`);
|
|
621307
622297
|
const markdownPath = join132(dir, `${base3}.md`);
|
|
621308
|
-
|
|
621309
|
-
|
|
622298
|
+
writeFileSync61(jsonPath, JSON.stringify(artifact, null, 2) + "\n", "utf8");
|
|
622299
|
+
writeFileSync61(markdownPath, formatTelegramChannelDaydreamMarkdown(artifact), "utf8");
|
|
621310
622300
|
return { dir, jsonPath, markdownPath };
|
|
621311
622301
|
}
|
|
621312
622302
|
function latestTelegramChannelDaydream(repoRoot, sessionKey) {
|
|
@@ -623059,7 +624049,7 @@ var init_vision_ingress = __esm({
|
|
|
623059
624049
|
});
|
|
623060
624050
|
|
|
623061
624051
|
// packages/cli/src/tui/telegram-bridge.ts
|
|
623062
|
-
import { mkdirSync as
|
|
624052
|
+
import { mkdirSync as mkdirSync69, existsSync as existsSync120, unlinkSync as unlinkSync24, readdirSync as readdirSync43, statSync as statSync43, statfsSync as statfsSync5, readFileSync as readFileSync98, writeFileSync as writeFileSync63, appendFileSync as appendFileSync10 } from "node:fs";
|
|
623063
624053
|
import { join as join134, resolve as resolve48, basename as basename33, relative as relative13, isAbsolute as isAbsolute8, extname as extname16 } from "node:path";
|
|
623064
624054
|
import { homedir as homedir43 } from "node:os";
|
|
623065
624055
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
@@ -626331,7 +627321,7 @@ ${message2}`)
|
|
|
626331
627321
|
appendTelegramConversationLedger(sessionKey, entry) {
|
|
626332
627322
|
if (!this.repoRoot) return;
|
|
626333
627323
|
try {
|
|
626334
|
-
|
|
627324
|
+
mkdirSync69(this.telegramConversationDir, { recursive: true });
|
|
626335
627325
|
appendFileSync10(
|
|
626336
627326
|
this.telegramConversationLedgerPath(sessionKey),
|
|
626337
627327
|
JSON.stringify({ sessionKey, ...entry }) + "\n",
|
|
@@ -626581,7 +627571,7 @@ ${mediaContext}` : ""
|
|
|
626581
627571
|
return null;
|
|
626582
627572
|
}
|
|
626583
627573
|
try {
|
|
626584
|
-
|
|
627574
|
+
mkdirSync69(resolve48(this.repoRoot, ".omnius"), { recursive: true });
|
|
626585
627575
|
const db = initDb(this.telegramSqlitePath);
|
|
626586
627576
|
db.exec(`
|
|
626587
627577
|
CREATE TABLE IF NOT EXISTS telegram_messages (
|
|
@@ -627303,7 +628293,7 @@ ${mediaContext}` : ""
|
|
|
627303
628293
|
saveTelegramConversationState(sessionKey) {
|
|
627304
628294
|
if (!this.repoRoot) return;
|
|
627305
628295
|
try {
|
|
627306
|
-
|
|
628296
|
+
mkdirSync69(this.telegramConversationDir, { recursive: true });
|
|
627307
628297
|
const participants = [...this.chatParticipants.get(sessionKey)?.values() ?? []].map((profile) => ({
|
|
627308
628298
|
...profile,
|
|
627309
628299
|
toneTags: [...profile.toneTags]
|
|
@@ -627320,7 +628310,7 @@ ${mediaContext}` : ""
|
|
|
627320
628310
|
stimulation: this.stimulation.getState(sessionKey),
|
|
627321
628311
|
reflection: this.channelReflectionState.get(sessionKey) ?? { autoFollowup: false }
|
|
627322
628312
|
};
|
|
627323
|
-
|
|
628313
|
+
writeFileSync63(this.telegramConversationPath(sessionKey), JSON.stringify(payload, null, 2) + "\n", "utf8");
|
|
627324
628314
|
} catch {
|
|
627325
628315
|
}
|
|
627326
628316
|
}
|
|
@@ -630639,7 +631629,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
630639
631629
|
this.startTelegramSubAgentWatchdog();
|
|
630640
631630
|
await this.prepareTelegramLongPolling();
|
|
630641
631631
|
try {
|
|
630642
|
-
|
|
631632
|
+
mkdirSync69(this.mediaCacheDir, { recursive: true });
|
|
630643
631633
|
} catch {
|
|
630644
631634
|
}
|
|
630645
631635
|
try {
|
|
@@ -630750,7 +631740,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
630750
631740
|
this.refreshActiveTelegramInteractionCount();
|
|
630751
631741
|
}
|
|
630752
631742
|
claimTelegramOwnerLock(lockDir, botUserId, botUsername) {
|
|
630753
|
-
|
|
631743
|
+
mkdirSync69(lockDir, { recursive: true });
|
|
630754
631744
|
const lockFile = join134(lockDir, `bot-${botUserId}.owner.lock`);
|
|
630755
631745
|
if (existsSync120(lockFile)) {
|
|
630756
631746
|
try {
|
|
@@ -630765,7 +631755,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
630765
631755
|
if (e2 instanceof Error && e2.message.startsWith("Telegram bot @")) throw e2;
|
|
630766
631756
|
}
|
|
630767
631757
|
}
|
|
630768
|
-
|
|
631758
|
+
writeFileSync63(
|
|
630769
631759
|
lockFile,
|
|
630770
631760
|
JSON.stringify({
|
|
630771
631761
|
pid: process.pid,
|
|
@@ -633584,8 +634574,8 @@ Scoped workspace: ${scopedRoot}`,
|
|
|
633584
634574
|
return join134(this.telegramToolButtonDir, `${safe}.json`);
|
|
633585
634575
|
}
|
|
633586
634576
|
writeTelegramToolButtonState(state) {
|
|
633587
|
-
|
|
633588
|
-
|
|
634577
|
+
mkdirSync69(this.telegramToolButtonDir, { recursive: true });
|
|
634578
|
+
writeFileSync63(this.telegramToolButtonPath(state.nonce), JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
633589
634579
|
}
|
|
633590
634580
|
readTelegramToolButtonState(nonce) {
|
|
633591
634581
|
try {
|
|
@@ -635472,9 +636462,9 @@ import {
|
|
|
635472
636462
|
existsSync as existsSync121,
|
|
635473
636463
|
readFileSync as readFileSync99,
|
|
635474
636464
|
readdirSync as readdirSync44,
|
|
635475
|
-
writeFileSync as
|
|
636465
|
+
writeFileSync as writeFileSync64,
|
|
635476
636466
|
renameSync as renameSync6,
|
|
635477
|
-
mkdirSync as
|
|
636467
|
+
mkdirSync as mkdirSync70,
|
|
635478
636468
|
unlinkSync as unlinkSync25,
|
|
635479
636469
|
appendFileSync as appendFileSync11
|
|
635480
636470
|
} from "node:fs";
|
|
@@ -635493,20 +636483,20 @@ function inFlightPath(id) {
|
|
|
635493
636483
|
}
|
|
635494
636484
|
function persistSession(s2) {
|
|
635495
636485
|
try {
|
|
635496
|
-
|
|
636486
|
+
mkdirSync70(sessionsDir(), { recursive: true });
|
|
635497
636487
|
const final2 = sessionPath(s2.id);
|
|
635498
636488
|
const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
|
|
635499
|
-
|
|
636489
|
+
writeFileSync64(tmp, JSON.stringify(s2, null, 2), "utf-8");
|
|
635500
636490
|
renameSync6(tmp, final2);
|
|
635501
636491
|
} catch {
|
|
635502
636492
|
}
|
|
635503
636493
|
}
|
|
635504
636494
|
function persistInFlight(j) {
|
|
635505
636495
|
try {
|
|
635506
|
-
|
|
636496
|
+
mkdirSync70(sessionsDir(), { recursive: true });
|
|
635507
636497
|
const final2 = inFlightPath(j.sessionId);
|
|
635508
636498
|
const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
|
|
635509
|
-
|
|
636499
|
+
writeFileSync64(tmp, JSON.stringify(j, null, 2), "utf-8");
|
|
635510
636500
|
renameSync6(tmp, final2);
|
|
635511
636501
|
} catch {
|
|
635512
636502
|
}
|
|
@@ -635538,7 +636528,7 @@ function loadPersistedSessions() {
|
|
|
635538
636528
|
parsed.error = "Daemon restart while subprocess was running";
|
|
635539
636529
|
parsed.completedAt = Date.now();
|
|
635540
636530
|
try {
|
|
635541
|
-
|
|
636531
|
+
writeFileSync64(fp, JSON.stringify(parsed, null, 2), "utf-8");
|
|
635542
636532
|
} catch {
|
|
635543
636533
|
}
|
|
635544
636534
|
report2.staleInFlight++;
|
|
@@ -635721,7 +636711,7 @@ function checkinPath(sessionId) {
|
|
|
635721
636711
|
}
|
|
635722
636712
|
function appendCheckin(sessionId, steering) {
|
|
635723
636713
|
try {
|
|
635724
|
-
|
|
636714
|
+
mkdirSync70(sessionsDir(), { recursive: true });
|
|
635725
636715
|
const fp = checkinPath(sessionId);
|
|
635726
636716
|
const entry = JSON.stringify({ ts: Date.now(), steering }) + "\n";
|
|
635727
636717
|
appendFileSync11(fp, entry, "utf-8");
|
|
@@ -636119,7 +637109,7 @@ __export(projects_exports, {
|
|
|
636119
637109
|
setCurrentProject: () => setCurrentProject,
|
|
636120
637110
|
unregisterProject: () => unregisterProject
|
|
636121
637111
|
});
|
|
636122
|
-
import { readFileSync as readFileSync100, writeFileSync as
|
|
637112
|
+
import { readFileSync as readFileSync100, writeFileSync as writeFileSync65, mkdirSync as mkdirSync71, existsSync as existsSync122, statSync as statSync44, renameSync as renameSync7 } from "node:fs";
|
|
636123
637113
|
import { homedir as homedir45 } from "node:os";
|
|
636124
637114
|
import { basename as basename34, join as join136, resolve as resolve49 } from "node:path";
|
|
636125
637115
|
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
@@ -636135,9 +637125,9 @@ function readAll2() {
|
|
|
636135
637125
|
}
|
|
636136
637126
|
}
|
|
636137
637127
|
function writeAll(file) {
|
|
636138
|
-
|
|
637128
|
+
mkdirSync71(OMNIUS_DIR3, { recursive: true });
|
|
636139
637129
|
const tmp = `${PROJECTS_FILE}.${randomUUID15().slice(0, 8)}.tmp`;
|
|
636140
|
-
|
|
637130
|
+
writeFileSync65(tmp, JSON.stringify(file, null, 2), "utf8");
|
|
636141
637131
|
renameSync7(tmp, PROJECTS_FILE);
|
|
636142
637132
|
}
|
|
636143
637133
|
function listProjects() {
|
|
@@ -636219,8 +637209,8 @@ function setCurrentProject(root) {
|
|
|
636219
637209
|
if (!entry) return null;
|
|
636220
637210
|
currentRoot = canonical;
|
|
636221
637211
|
try {
|
|
636222
|
-
|
|
636223
|
-
|
|
637212
|
+
mkdirSync71(OMNIUS_DIR3, { recursive: true });
|
|
637213
|
+
writeFileSync65(CURRENT_FILE, `${canonical}
|
|
636224
637214
|
`, "utf8");
|
|
636225
637215
|
} catch {
|
|
636226
637216
|
}
|
|
@@ -637110,7 +638100,7 @@ var init_access_policy = __esm({
|
|
|
637110
638100
|
|
|
637111
638101
|
// packages/cli/src/api/project-preferences.ts
|
|
637112
638102
|
import { createHash as createHash30 } from "node:crypto";
|
|
637113
|
-
import { existsSync as existsSync123, mkdirSync as
|
|
638103
|
+
import { existsSync as existsSync123, mkdirSync as mkdirSync72, readFileSync as readFileSync101, renameSync as renameSync8, writeFileSync as writeFileSync66, unlinkSync as unlinkSync26 } from "node:fs";
|
|
637114
638104
|
import { homedir as homedir46 } from "node:os";
|
|
637115
638105
|
import { join as join137, resolve as resolve50 } from "node:path";
|
|
637116
638106
|
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
@@ -637129,11 +638119,11 @@ function rootSentinelPath(root) {
|
|
|
637129
638119
|
}
|
|
637130
638120
|
function ensureDir(root) {
|
|
637131
638121
|
const dir = projectDir(root);
|
|
637132
|
-
|
|
638122
|
+
mkdirSync72(dir, { recursive: true });
|
|
637133
638123
|
const sentinel = rootSentinelPath(root);
|
|
637134
638124
|
try {
|
|
637135
638125
|
if (!existsSync123(sentinel)) {
|
|
637136
|
-
|
|
638126
|
+
writeFileSync66(sentinel, `${resolve50(root)}
|
|
637137
638127
|
`, "utf8");
|
|
637138
638128
|
}
|
|
637139
638129
|
} catch {
|
|
@@ -637162,12 +638152,12 @@ function writeProjectPreferences(root, partial) {
|
|
|
637162
638152
|
};
|
|
637163
638153
|
const file = prefsPath(root);
|
|
637164
638154
|
const tmp = `${file}.${randomUUID16().slice(0, 8)}.tmp`;
|
|
637165
|
-
|
|
638155
|
+
writeFileSync66(tmp, JSON.stringify(merged, null, 2), "utf8");
|
|
637166
638156
|
try {
|
|
637167
638157
|
renameSync8(tmp, file);
|
|
637168
638158
|
} catch (err) {
|
|
637169
638159
|
try {
|
|
637170
|
-
|
|
638160
|
+
writeFileSync66(file, JSON.stringify(merged, null, 2), "utf8");
|
|
637171
638161
|
} catch {
|
|
637172
638162
|
}
|
|
637173
638163
|
try {
|
|
@@ -638094,13 +639084,13 @@ __export(audit_log_exports, {
|
|
|
638094
639084
|
recordAudit: () => recordAudit,
|
|
638095
639085
|
sanitizeBody: () => sanitizeBody
|
|
638096
639086
|
});
|
|
638097
|
-
import { mkdirSync as
|
|
639087
|
+
import { mkdirSync as mkdirSync73, appendFileSync as appendFileSync12, readFileSync as readFileSync102, existsSync as existsSync124 } from "node:fs";
|
|
638098
639088
|
import { join as join138 } from "node:path";
|
|
638099
639089
|
function initAuditLog(omniusDir) {
|
|
638100
639090
|
auditDir = join138(omniusDir, "audit");
|
|
638101
639091
|
auditFile = join138(auditDir, "audit.jsonl");
|
|
638102
639092
|
try {
|
|
638103
|
-
|
|
639093
|
+
mkdirSync73(auditDir, { recursive: true });
|
|
638104
639094
|
initialized = true;
|
|
638105
639095
|
} catch {
|
|
638106
639096
|
}
|
|
@@ -638168,7 +639158,7 @@ var init_audit_log = __esm({
|
|
|
638168
639158
|
|
|
638169
639159
|
// packages/cli/src/api/disk-task-output.ts
|
|
638170
639160
|
import { open } from "node:fs/promises";
|
|
638171
|
-
import { existsSync as existsSync125, mkdirSync as
|
|
639161
|
+
import { existsSync as existsSync125, mkdirSync as mkdirSync74, statSync as statSync45 } from "node:fs";
|
|
638172
639162
|
import { dirname as dirname39 } from "node:path";
|
|
638173
639163
|
import * as fsConstants from "node:constants";
|
|
638174
639164
|
var O_NOFOLLOW2, O_APPEND2, O_CREAT2, O_WRONLY2, OPEN_FLAGS_WRITE, OPEN_MODE, DiskTaskOutput;
|
|
@@ -638188,7 +639178,7 @@ var init_disk_task_output = __esm({
|
|
|
638188
639178
|
fileSize = 0;
|
|
638189
639179
|
constructor(outputPath3) {
|
|
638190
639180
|
this.path = outputPath3;
|
|
638191
|
-
|
|
639181
|
+
mkdirSync74(dirname39(outputPath3), { recursive: true });
|
|
638192
639182
|
}
|
|
638193
639183
|
/** Queue content for async append. Non-blocking. */
|
|
638194
639184
|
append(chunk) {
|
|
@@ -639253,13 +640243,13 @@ __export(runtime_keys_exports, {
|
|
|
639253
640243
|
mintKey: () => mintKey,
|
|
639254
640244
|
revokeByPrefix: () => revokeByPrefix
|
|
639255
640245
|
});
|
|
639256
|
-
import { existsSync as existsSync127, readFileSync as readFileSync104, writeFileSync as
|
|
640246
|
+
import { existsSync as existsSync127, readFileSync as readFileSync104, writeFileSync as writeFileSync67, mkdirSync as mkdirSync75, chmodSync as chmodSync3 } from "node:fs";
|
|
639257
640247
|
import { join as join140 } from "node:path";
|
|
639258
640248
|
import { homedir as homedir48 } from "node:os";
|
|
639259
640249
|
import { randomBytes as randomBytes25 } from "node:crypto";
|
|
639260
640250
|
function ensureDir2() {
|
|
639261
640251
|
const dir = join140(homedir48(), ".omnius");
|
|
639262
|
-
if (!existsSync127(dir))
|
|
640252
|
+
if (!existsSync127(dir)) mkdirSync75(dir, { recursive: true });
|
|
639263
640253
|
}
|
|
639264
640254
|
function loadAll() {
|
|
639265
640255
|
if (!existsSync127(KEYS_FILE)) return [];
|
|
@@ -639274,7 +640264,7 @@ function loadAll() {
|
|
|
639274
640264
|
}
|
|
639275
640265
|
function persistAll(records) {
|
|
639276
640266
|
ensureDir2();
|
|
639277
|
-
|
|
640267
|
+
writeFileSync67(KEYS_FILE, JSON.stringify(records, null, 2), "utf-8");
|
|
639278
640268
|
try {
|
|
639279
640269
|
chmodSync3(KEYS_FILE, 384);
|
|
639280
640270
|
} catch {
|
|
@@ -639508,7 +640498,7 @@ __export(graphical_sudo_exports, {
|
|
|
639508
640498
|
runGraphicalSudo: () => runGraphicalSudo
|
|
639509
640499
|
});
|
|
639510
640500
|
import { spawn as spawn30 } from "node:child_process";
|
|
639511
|
-
import { existsSync as existsSync129, mkdirSync as
|
|
640501
|
+
import { existsSync as existsSync129, mkdirSync as mkdirSync76, writeFileSync as writeFileSync68, chmodSync as chmodSync4 } from "node:fs";
|
|
639512
640502
|
import { join as join142 } from "node:path";
|
|
639513
640503
|
import { tmpdir as tmpdir21 } from "node:os";
|
|
639514
640504
|
function detectSudoHelper() {
|
|
@@ -639532,7 +640522,7 @@ function which2(cmd) {
|
|
|
639532
640522
|
}
|
|
639533
640523
|
function ensureAskpassShim(helper, description) {
|
|
639534
640524
|
const shimDir = join142(tmpdir21(), "omnius-askpass");
|
|
639535
|
-
|
|
640525
|
+
mkdirSync76(shimDir, { recursive: true });
|
|
639536
640526
|
const shim = join142(shimDir, `${helper}.sh`);
|
|
639537
640527
|
let body;
|
|
639538
640528
|
if (helper === "zenity") {
|
|
@@ -639544,7 +640534,7 @@ exec zenity --password --title="Omnius needs sudo" --text="${description.replace
|
|
|
639544
640534
|
exec kdialog --password "${description.replace(/"/g, '\\"')}" 2>/dev/null
|
|
639545
640535
|
`;
|
|
639546
640536
|
}
|
|
639547
|
-
|
|
640537
|
+
writeFileSync68(shim, body, "utf-8");
|
|
639548
640538
|
chmodSync4(shim, 493);
|
|
639549
640539
|
return shim;
|
|
639550
640540
|
}
|
|
@@ -642135,8 +643125,8 @@ function readAimsFile(name10, fallback) {
|
|
|
642135
643125
|
}
|
|
642136
643126
|
function writeAimsFile(name10, data) {
|
|
642137
643127
|
const dir = aimsDir();
|
|
642138
|
-
const { mkdirSync:
|
|
642139
|
-
|
|
643128
|
+
const { mkdirSync: mkdirSync85, writeFileSync: wf, renameSync: rn } = __require("node:fs");
|
|
643129
|
+
mkdirSync85(dir, { recursive: true });
|
|
642140
643130
|
const finalPath = join143(dir, name10);
|
|
642141
643131
|
const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
|
|
642142
643132
|
try {
|
|
@@ -651973,11 +652963,11 @@ var init_auth_oidc = __esm({
|
|
|
651973
652963
|
});
|
|
651974
652964
|
|
|
651975
652965
|
// packages/cli/src/api/usage-tracker.ts
|
|
651976
|
-
import { mkdirSync as
|
|
652966
|
+
import { mkdirSync as mkdirSync77, readFileSync as readFileSync107, writeFileSync as writeFileSync69, existsSync as existsSync131 } from "node:fs";
|
|
651977
652967
|
import { join as join144 } from "node:path";
|
|
651978
652968
|
function initUsageTracker(omniusDir) {
|
|
651979
652969
|
const dir = join144(omniusDir, "usage");
|
|
651980
|
-
|
|
652970
|
+
mkdirSync77(dir, { recursive: true });
|
|
651981
652971
|
usageFile = join144(dir, "token-usage.json");
|
|
651982
652972
|
try {
|
|
651983
652973
|
if (existsSync131(usageFile)) {
|
|
@@ -652017,7 +653007,7 @@ function flush2() {
|
|
|
652017
653007
|
if (!initialized2 || !dirty) return;
|
|
652018
653008
|
try {
|
|
652019
653009
|
store.lastSaved = (/* @__PURE__ */ new Date()).toISOString();
|
|
652020
|
-
|
|
653010
|
+
writeFileSync69(usageFile, JSON.stringify(store, null, 2), "utf-8");
|
|
652021
653011
|
dirty = false;
|
|
652022
653012
|
} catch {
|
|
652023
653013
|
}
|
|
@@ -652045,7 +653035,7 @@ var init_usage_tracker = __esm({
|
|
|
652045
653035
|
});
|
|
652046
653036
|
|
|
652047
653037
|
// packages/cli/src/api/profiles.ts
|
|
652048
|
-
import { existsSync as existsSync132, readFileSync as readFileSync108, writeFileSync as
|
|
653038
|
+
import { existsSync as existsSync132, readFileSync as readFileSync108, writeFileSync as writeFileSync70, mkdirSync as mkdirSync78, readdirSync as readdirSync47, unlinkSync as unlinkSync27 } from "node:fs";
|
|
652049
653039
|
import { join as join145 } from "node:path";
|
|
652050
653040
|
import { homedir as homedir51 } from "node:os";
|
|
652051
653041
|
import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv5, randomBytes as randomBytes26, scryptSync as scryptSync3 } from "node:crypto";
|
|
@@ -652109,16 +653099,16 @@ function loadProfile(name10, password, projectDir2) {
|
|
|
652109
653099
|
}
|
|
652110
653100
|
function saveProfile(profile, password, scope = "global", projectDir2) {
|
|
652111
653101
|
const dir = scope === "project" ? projectProfileDir(projectDir2) : globalProfileDir();
|
|
652112
|
-
|
|
653102
|
+
mkdirSync78(dir, { recursive: true });
|
|
652113
653103
|
const sanitized = profile.name.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
652114
653104
|
const filePath = join145(dir, `${sanitized}.json`);
|
|
652115
653105
|
profile.modified = (/* @__PURE__ */ new Date()).toISOString();
|
|
652116
653106
|
if (password) {
|
|
652117
653107
|
const encrypted = encryptProfile(profile, password);
|
|
652118
|
-
|
|
653108
|
+
writeFileSync70(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
|
|
652119
653109
|
} else {
|
|
652120
653110
|
profile.encrypted = false;
|
|
652121
|
-
|
|
653111
|
+
writeFileSync70(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
|
|
652122
653112
|
}
|
|
652123
653113
|
}
|
|
652124
653114
|
function deleteProfile(name10, scope = "global", projectDir2) {
|
|
@@ -652302,10 +653292,10 @@ var init_profiles = __esm({
|
|
|
652302
653292
|
|
|
652303
653293
|
// packages/cli/src/docker.ts
|
|
652304
653294
|
import { execSync as execSync57, spawn as spawn31 } from "node:child_process";
|
|
652305
|
-
import { existsSync as existsSync133, mkdirSync as
|
|
653295
|
+
import { existsSync as existsSync133, mkdirSync as mkdirSync79, writeFileSync as writeFileSync71 } from "node:fs";
|
|
652306
653296
|
import { join as join146, resolve as resolve51, dirname as dirname40 } from "node:path";
|
|
652307
653297
|
import { homedir as homedir52 } from "node:os";
|
|
652308
|
-
import { fileURLToPath as
|
|
653298
|
+
import { fileURLToPath as fileURLToPath18 } from "node:url";
|
|
652309
653299
|
function getDockerDir() {
|
|
652310
653300
|
try {
|
|
652311
653301
|
if (typeof __dirname !== "undefined") {
|
|
@@ -652314,7 +653304,7 @@ function getDockerDir() {
|
|
|
652314
653304
|
} catch {
|
|
652315
653305
|
}
|
|
652316
653306
|
try {
|
|
652317
|
-
const thisDir = dirname40(
|
|
653307
|
+
const thisDir = dirname40(fileURLToPath18(import.meta.url));
|
|
652318
653308
|
return join146(thisDir, "..", "..", "..", "docker");
|
|
652319
653309
|
} catch {
|
|
652320
653310
|
}
|
|
@@ -652453,7 +653443,7 @@ async function ensureOmniusImage(force = false) {
|
|
|
652453
653443
|
buildContext = dockerDir;
|
|
652454
653444
|
} else {
|
|
652455
653445
|
buildContext = join146(homedir52(), ".omnius", "docker-build");
|
|
652456
|
-
|
|
653446
|
+
mkdirSync79(buildContext, { recursive: true });
|
|
652457
653447
|
writeDockerfiles(buildContext);
|
|
652458
653448
|
}
|
|
652459
653449
|
try {
|
|
@@ -652527,8 +653517,8 @@ chown -R node:node /workspace /home/node/.omnius 2>/dev/null || true
|
|
|
652527
653517
|
if [ "$1" = "omnius" ]; then shift; exec su - node -c "cd /workspace && omnius $*"; fi
|
|
652528
653518
|
exec "$@"
|
|
652529
653519
|
`;
|
|
652530
|
-
|
|
652531
|
-
|
|
653520
|
+
writeFileSync71(join146(dir, "Dockerfile"), dockerfile);
|
|
653521
|
+
writeFileSync71(join146(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
|
|
652532
653522
|
}
|
|
652533
653523
|
function hasNvidiaGpu() {
|
|
652534
653524
|
try {
|
|
@@ -652782,11 +653772,11 @@ __export(serve_exports, {
|
|
|
652782
653772
|
import * as http5 from "node:http";
|
|
652783
653773
|
import * as https3 from "node:https";
|
|
652784
653774
|
import { createRequire as createRequire7 } from "node:module";
|
|
652785
|
-
import { fileURLToPath as
|
|
653775
|
+
import { fileURLToPath as fileURLToPath19 } from "node:url";
|
|
652786
653776
|
import { dirname as dirname41, join as join148, resolve as resolve52 } from "node:path";
|
|
652787
653777
|
import { homedir as homedir53 } from "node:os";
|
|
652788
653778
|
import { spawn as spawn32, execSync as execSync58 } from "node:child_process";
|
|
652789
|
-
import { mkdirSync as
|
|
653779
|
+
import { mkdirSync as mkdirSync80, writeFileSync as writeFileSync72, readFileSync as readFileSync109, readdirSync as readdirSync48, existsSync as existsSync134, watch as fsWatch4, renameSync as renameSync9, unlinkSync as unlinkSync28 } from "node:fs";
|
|
652790
653780
|
import { randomBytes as randomBytes27, randomUUID as randomUUID17 } from "node:crypto";
|
|
652791
653781
|
import { createHash as createHash33 } from "node:crypto";
|
|
652792
653782
|
function memoryDbPaths3(baseDir = process.cwd()) {
|
|
@@ -652799,7 +653789,7 @@ function memoryDbPaths3(baseDir = process.cwd()) {
|
|
|
652799
653789
|
}
|
|
652800
653790
|
function getVersion3() {
|
|
652801
653791
|
try {
|
|
652802
|
-
const thisDir = dirname41(
|
|
653792
|
+
const thisDir = dirname41(fileURLToPath19(import.meta.url));
|
|
652803
653793
|
const candidates = [
|
|
652804
653794
|
join148(thisDir, "..", "package.json"),
|
|
652805
653795
|
join148(thisDir, "..", "..", "package.json"),
|
|
@@ -653561,7 +654551,7 @@ function ollamaStream(ollamaUrl, path12, method, body, onData, onEnd, onError, t
|
|
|
653561
654551
|
function jobsDir() {
|
|
653562
654552
|
const root = resolve52(process.cwd());
|
|
653563
654553
|
const dir = join148(root, ".omnius", "jobs");
|
|
653564
|
-
|
|
654554
|
+
mkdirSync80(dir, { recursive: true });
|
|
653565
654555
|
return dir;
|
|
653566
654556
|
}
|
|
653567
654557
|
function loadJob(id) {
|
|
@@ -653906,11 +654896,11 @@ function atomicJobWrite(dir, id, job) {
|
|
|
653906
654896
|
const finalPath = join148(dir, `${id}.json`);
|
|
653907
654897
|
const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
|
|
653908
654898
|
try {
|
|
653909
|
-
|
|
654899
|
+
writeFileSync72(tmpPath, JSON.stringify(job, null, 2), "utf-8");
|
|
653910
654900
|
renameSync9(tmpPath, finalPath);
|
|
653911
654901
|
} catch {
|
|
653912
654902
|
try {
|
|
653913
|
-
|
|
654903
|
+
writeFileSync72(finalPath, JSON.stringify(job, null, 2), "utf-8");
|
|
653914
654904
|
} catch {
|
|
653915
654905
|
}
|
|
653916
654906
|
try {
|
|
@@ -655393,10 +656383,10 @@ function readUpdateState() {
|
|
|
655393
656383
|
function writeUpdateState(state) {
|
|
655394
656384
|
try {
|
|
655395
656385
|
const dir = join148(homedir53(), ".omnius");
|
|
655396
|
-
|
|
656386
|
+
mkdirSync80(dir, { recursive: true });
|
|
655397
656387
|
const finalPath = updateStateFile();
|
|
655398
656388
|
const tmpPath = `${finalPath}.tmp.${process.pid}`;
|
|
655399
|
-
|
|
656389
|
+
writeFileSync72(tmpPath, JSON.stringify(state, null, 2), "utf-8");
|
|
655400
656390
|
renameSync9(tmpPath, finalPath);
|
|
655401
656391
|
} catch {
|
|
655402
656392
|
}
|
|
@@ -655697,7 +656687,7 @@ async function handleV1Run(req2, res) {
|
|
|
655697
656687
|
cwd4 = resolve52(workingDir);
|
|
655698
656688
|
} else if (isolate) {
|
|
655699
656689
|
const wsDir = join148(dir, "..", "workspaces", id);
|
|
655700
|
-
|
|
656690
|
+
mkdirSync80(wsDir, { recursive: true });
|
|
655701
656691
|
cwd4 = wsDir;
|
|
655702
656692
|
} else {
|
|
655703
656693
|
cwd4 = resolve52(process.cwd());
|
|
@@ -657005,10 +657995,10 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
657005
657995
|
return;
|
|
657006
657996
|
}
|
|
657007
657997
|
const { tmpdir: tmpdir23 } = await import("node:os");
|
|
657008
|
-
const { writeFileSync:
|
|
657998
|
+
const { writeFileSync: writeFileSync77, unlinkSync: unlinkSync29 } = await import("node:fs");
|
|
657009
657999
|
const { join: pjoin } = await import("node:path");
|
|
657010
658000
|
const tmpPath = pjoin(tmpdir23(), `omnius-clone-upload-${Date.now()}-${safeName3}`);
|
|
657011
|
-
|
|
658001
|
+
writeFileSync77(tmpPath, buf);
|
|
657012
658002
|
try {
|
|
657013
658003
|
const ve = getVoiceEngine();
|
|
657014
658004
|
const msg = await ve.setCloneVoice(tmpPath);
|
|
@@ -657600,7 +658590,7 @@ data: ${JSON.stringify(data)}
|
|
|
657600
658590
|
}
|
|
657601
658591
|
for (const f2 of seenFiles) {
|
|
657602
658592
|
try {
|
|
657603
|
-
|
|
658593
|
+
writeFileSync72(f2, JSON.stringify({ tasks: [] }, null, 2));
|
|
657604
658594
|
deleted++;
|
|
657605
658595
|
} catch {
|
|
657606
658596
|
}
|
|
@@ -658814,11 +659804,11 @@ function setScheduledEnabled(id, enabled2) {
|
|
|
658814
659804
|
arr[target.index].enabled = enabled2;
|
|
658815
659805
|
if (Array.isArray(json?.tasks)) {
|
|
658816
659806
|
json.tasks = arr;
|
|
658817
|
-
|
|
659807
|
+
writeFileSync72(target.file, JSON.stringify(json, null, 2));
|
|
658818
659808
|
} else if (Array.isArray(json)) {
|
|
658819
|
-
|
|
659809
|
+
writeFileSync72(target.file, JSON.stringify(arr, null, 2));
|
|
658820
659810
|
} else {
|
|
658821
|
-
|
|
659811
|
+
writeFileSync72(target.file, JSON.stringify({ tasks: arr }, null, 2));
|
|
658822
659812
|
}
|
|
658823
659813
|
if (!enabled2) {
|
|
658824
659814
|
try {
|
|
@@ -658848,11 +659838,11 @@ function deleteScheduledById(id) {
|
|
|
658848
659838
|
arr.splice(target.index, 1);
|
|
658849
659839
|
if (Array.isArray(json?.tasks)) {
|
|
658850
659840
|
json.tasks = arr;
|
|
658851
|
-
|
|
659841
|
+
writeFileSync72(target.file, JSON.stringify(json, null, 2));
|
|
658852
659842
|
} else if (Array.isArray(json)) {
|
|
658853
|
-
|
|
659843
|
+
writeFileSync72(target.file, JSON.stringify(arr, null, 2));
|
|
658854
659844
|
} else {
|
|
658855
|
-
|
|
659845
|
+
writeFileSync72(target.file, JSON.stringify({ tasks: arr }, null, 2));
|
|
658856
659846
|
}
|
|
658857
659847
|
const candidates = [];
|
|
658858
659848
|
if (id) candidates.push(id);
|
|
@@ -659120,9 +660110,9 @@ function reconcileScheduledTasks(apply) {
|
|
|
659120
660110
|
const entry = { task: f2.task || `legacy ${f2.id}`, schedule: f2.cron, enabled: true };
|
|
659121
660111
|
arr.push(entry);
|
|
659122
660112
|
const toWrite = Array.isArray(json?.tasks) ? { ...json, tasks: arr } : Array.isArray(json) ? arr : { tasks: arr };
|
|
659123
|
-
|
|
659124
|
-
|
|
659125
|
-
|
|
660113
|
+
mkdirSync80(join148(wdir, ".omnius", "scheduled"), { recursive: true });
|
|
660114
|
+
mkdirSync80(join148(wdir, ".omnius", "scheduled", "logs"), { recursive: true });
|
|
660115
|
+
writeFileSync72(file, JSON.stringify(toWrite, null, 2));
|
|
659126
660116
|
adopted.push({ file, index: arr.length - 1 });
|
|
659127
660117
|
}
|
|
659128
660118
|
} else {
|
|
@@ -659255,9 +660245,9 @@ Persistent=true
|
|
|
659255
660245
|
WantedBy=timers.target
|
|
659256
660246
|
`;
|
|
659257
660247
|
if (!dryRun) {
|
|
659258
|
-
|
|
659259
|
-
|
|
659260
|
-
|
|
660248
|
+
mkdirSync80(unitDir, { recursive: true });
|
|
660249
|
+
writeFileSync72(svc, svcText);
|
|
660250
|
+
writeFileSync72(tim, timText);
|
|
659261
660251
|
try {
|
|
659262
660252
|
const { execSync: es } = require4("node:child_process");
|
|
659263
660253
|
es("systemctl --user daemon-reload", { stdio: "pipe" });
|
|
@@ -659401,7 +660391,7 @@ function startApiServer(options2 = {}) {
|
|
|
659401
660391
|
if (!apiTestMode) try {
|
|
659402
660392
|
const dir = todoDir();
|
|
659403
660393
|
try {
|
|
659404
|
-
|
|
660394
|
+
mkdirSync80(dir, { recursive: true });
|
|
659405
660395
|
} catch {
|
|
659406
660396
|
}
|
|
659407
660397
|
const cache8 = /* @__PURE__ */ new Map();
|
|
@@ -659579,8 +660569,8 @@ function startApiServer(options2 = {}) {
|
|
|
659579
660569
|
runtimeAccessMode = requested;
|
|
659580
660570
|
try {
|
|
659581
660571
|
const dir = join148(homedir53(), ".omnius");
|
|
659582
|
-
|
|
659583
|
-
|
|
660572
|
+
mkdirSync80(dir, { recursive: true });
|
|
660573
|
+
writeFileSync72(join148(dir, "access"), `${runtimeAccessMode}
|
|
659584
660574
|
`, "utf8");
|
|
659585
660575
|
} catch {
|
|
659586
660576
|
}
|
|
@@ -659882,7 +660872,7 @@ function startApiServer(options2 = {}) {
|
|
|
659882
660872
|
return;
|
|
659883
660873
|
}
|
|
659884
660874
|
try {
|
|
659885
|
-
const { writeFileSync:
|
|
660875
|
+
const { writeFileSync: writeFileSync77, mkdirSync: mkdirSync85, existsSync: _exists, readFileSync: _rfs } = require4("node:fs");
|
|
659886
660876
|
const { join: _join } = require4("node:path");
|
|
659887
660877
|
const { homedir: _homedir } = require4("node:os");
|
|
659888
660878
|
const apiHint = JSON.stringify({
|
|
@@ -659911,8 +660901,8 @@ function startApiServer(options2 = {}) {
|
|
|
659911
660901
|
let written = 0;
|
|
659912
660902
|
for (const dir of dirSet) {
|
|
659913
660903
|
try {
|
|
659914
|
-
if (!_exists(dir))
|
|
659915
|
-
|
|
660904
|
+
if (!_exists(dir)) mkdirSync85(dir, { recursive: true });
|
|
660905
|
+
writeFileSync77(_join(dir, "api-port.json"), apiHint);
|
|
659916
660906
|
written++;
|
|
659917
660907
|
} catch {
|
|
659918
660908
|
}
|
|
@@ -660196,9 +661186,9 @@ async function handleChatAttachmentUpload(req2, res) {
|
|
|
660196
661186
|
}
|
|
660197
661187
|
const safeName3 = filename.replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 180) || `attachment-${Date.now()}.bin`;
|
|
660198
661188
|
const dir = join148(process.cwd(), ".omnius", "gui-attachments");
|
|
660199
|
-
|
|
661189
|
+
mkdirSync80(dir, { recursive: true });
|
|
660200
661190
|
const localPath = join148(dir, `${Date.now()}-${randomUUID17().slice(0, 8)}-${safeName3}`);
|
|
660201
|
-
|
|
661191
|
+
writeFileSync72(localPath, Buffer.from(base642, "base64"));
|
|
660202
661192
|
const mimeType = typeof b.mimeType === "string" ? b.mimeType : typeof b.mime_type === "string" ? b.mime_type : "";
|
|
660203
661193
|
const isImage = mimeType.toLowerCase().startsWith("image/") || /\.(png|jpe?g|gif|webp|bmp|tiff?)$/i.test(safeName3);
|
|
660204
661194
|
const sessionId = typeof b.sessionId === "string" ? b.sessionId : typeof b.session_id === "string" ? b.session_id : void 0;
|
|
@@ -660566,15 +661556,15 @@ __export(clipboard_media_exports, {
|
|
|
660566
661556
|
pasteClipboardImageToFile: () => pasteClipboardImageToFile
|
|
660567
661557
|
});
|
|
660568
661558
|
import { execFileSync as execFileSync8, execSync as execSync59 } from "node:child_process";
|
|
660569
|
-
import { mkdirSync as
|
|
661559
|
+
import { mkdirSync as mkdirSync81, readFileSync as readFileSync110, rmSync as rmSync6, writeFileSync as writeFileSync73 } from "node:fs";
|
|
660570
661560
|
import { join as join149 } from "node:path";
|
|
660571
661561
|
function pasteClipboardImageToFile(repoRoot) {
|
|
660572
661562
|
const image = readClipboardImage();
|
|
660573
661563
|
if (!image) return null;
|
|
660574
661564
|
const dir = join149(repoRoot, ".omnius", "clipboard");
|
|
660575
|
-
|
|
661565
|
+
mkdirSync81(dir, { recursive: true });
|
|
660576
661566
|
const path12 = join149(dir, `clipboard-${Date.now()}${image.ext}`);
|
|
660577
|
-
|
|
661567
|
+
writeFileSync73(path12, image.buffer);
|
|
660578
661568
|
return { path: path12, buffer: image.buffer, mime: image.mime };
|
|
660579
661569
|
}
|
|
660580
661570
|
function readClipboardImage() {
|
|
@@ -660640,14 +661630,14 @@ var init_clipboard_media = __esm({
|
|
|
660640
661630
|
import { cwd } from "node:process";
|
|
660641
661631
|
import { resolve as resolve53, join as join150, dirname as dirname42, extname as extname17, relative as relative14 } from "node:path";
|
|
660642
661632
|
import { createRequire as createRequire8 } from "node:module";
|
|
660643
|
-
import { fileURLToPath as
|
|
661633
|
+
import { fileURLToPath as fileURLToPath20 } from "node:url";
|
|
660644
661634
|
import {
|
|
660645
661635
|
readFileSync as readFileSync111,
|
|
660646
|
-
writeFileSync as
|
|
661636
|
+
writeFileSync as writeFileSync74,
|
|
660647
661637
|
appendFileSync as appendFileSync13,
|
|
660648
661638
|
rmSync as rmSync7,
|
|
660649
661639
|
readdirSync as readdirSync49,
|
|
660650
|
-
mkdirSync as
|
|
661640
|
+
mkdirSync as mkdirSync82
|
|
660651
661641
|
} from "node:fs";
|
|
660652
661642
|
import { existsSync as existsSync135 } from "node:fs";
|
|
660653
661643
|
import { execSync as execSync60 } from "node:child_process";
|
|
@@ -660665,7 +661655,7 @@ function formatTimeAgo2(date) {
|
|
|
660665
661655
|
function getVersion4() {
|
|
660666
661656
|
try {
|
|
660667
661657
|
const require5 = createRequire8(import.meta.url);
|
|
660668
|
-
const thisDir = dirname42(
|
|
661658
|
+
const thisDir = dirname42(fileURLToPath20(import.meta.url));
|
|
660669
661659
|
const candidates = [
|
|
660670
661660
|
join150(thisDir, "..", "package.json"),
|
|
660671
661661
|
join150(thisDir, "..", "..", "package.json"),
|
|
@@ -663488,7 +664478,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
663488
664478
|
if (existsSync135(ikFile)) {
|
|
663489
664479
|
ikState = JSON.parse(readFileSync111(ikFile, "utf8"));
|
|
663490
664480
|
} else {
|
|
663491
|
-
|
|
664481
|
+
mkdirSync82(ikDir, { recursive: true });
|
|
663492
664482
|
const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
|
|
663493
664483
|
ikState = {
|
|
663494
664484
|
self_id: `omnius-${machineId}`,
|
|
@@ -663598,7 +664588,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
663598
664588
|
}
|
|
663599
664589
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
663600
664590
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
663601
|
-
|
|
664591
|
+
writeFileSync74(ikFile, JSON.stringify(ikState, null, 2));
|
|
663602
664592
|
} catch (ikErr) {
|
|
663603
664593
|
try {
|
|
663604
664594
|
console.error("[IK-OBSERVE]", ikErr);
|
|
@@ -663654,7 +664644,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
663654
664644
|
ikState.version_history = ikState.version_history.slice(-200);
|
|
663655
664645
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
663656
664646
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
663657
|
-
|
|
664647
|
+
writeFileSync74(ikFile, JSON.stringify(ikState, null, 2));
|
|
663658
664648
|
}
|
|
663659
664649
|
} catch {
|
|
663660
664650
|
}
|
|
@@ -665252,12 +666242,12 @@ This is an independent background session started from /background.`
|
|
|
665252
666242
|
function persistHistoryLine(line) {
|
|
665253
666243
|
if (!line.trim()) return;
|
|
665254
666244
|
try {
|
|
665255
|
-
|
|
666245
|
+
mkdirSync82(HISTORY_DIR, { recursive: true });
|
|
665256
666246
|
appendFileSync13(HISTORY_FILE, line + "\n", "utf8");
|
|
665257
666247
|
if (Math.random() < 0.02) {
|
|
665258
666248
|
const all2 = readFileSync111(HISTORY_FILE, "utf8").trim().split("\n");
|
|
665259
666249
|
if (all2.length > MAX_HISTORY_LINES) {
|
|
665260
|
-
|
|
666250
|
+
writeFileSync74(
|
|
665261
666251
|
HISTORY_FILE,
|
|
665262
666252
|
all2.slice(-MAX_HISTORY_LINES).join("\n") + "\n",
|
|
665263
666253
|
"utf8"
|
|
@@ -666161,8 +667151,8 @@ Log: ${nexusLogPath}`)
|
|
|
666161
667151
|
setSessionTitle(title) {
|
|
666162
667152
|
sessionTitle = title.trim() || null;
|
|
666163
667153
|
try {
|
|
666164
|
-
|
|
666165
|
-
|
|
667154
|
+
mkdirSync82(join150(repoRoot, ".omnius"), { recursive: true });
|
|
667155
|
+
writeFileSync74(join150(repoRoot, ".omnius", "session-title"), `${sessionTitle ?? ""}
|
|
666166
667156
|
`, "utf8");
|
|
666167
667157
|
} catch {
|
|
666168
667158
|
}
|
|
@@ -669236,7 +670226,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
669236
670226
|
if (existsSync135(ikFile)) {
|
|
669237
670227
|
ikState = JSON.parse(readFileSync111(ikFile, "utf8"));
|
|
669238
670228
|
} else {
|
|
669239
|
-
|
|
670229
|
+
mkdirSync82(ikDir, { recursive: true });
|
|
669240
670230
|
ikState = {
|
|
669241
670231
|
self_id: `omnius-${Date.now().toString(36)}`,
|
|
669242
670232
|
version: 1,
|
|
@@ -669289,7 +670279,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
669289
670279
|
);
|
|
669290
670280
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
669291
670281
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
669292
|
-
|
|
670282
|
+
writeFileSync74(ikFile, JSON.stringify(ikState, null, 2));
|
|
669293
670283
|
} catch (ikErr) {
|
|
669294
670284
|
}
|
|
669295
670285
|
try {
|
|
@@ -669321,8 +670311,8 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
669321
670311
|
tags: ["general"]
|
|
669322
670312
|
});
|
|
669323
670313
|
if (variants.length > 50) variants = variants.slice(-50);
|
|
669324
|
-
|
|
669325
|
-
|
|
670314
|
+
mkdirSync82(archeDir, { recursive: true });
|
|
670315
|
+
writeFileSync74(archeFile, JSON.stringify(variants, null, 2));
|
|
669326
670316
|
} catch {
|
|
669327
670317
|
}
|
|
669328
670318
|
}
|
|
@@ -669353,7 +670343,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
669353
670343
|
updated = true;
|
|
669354
670344
|
}
|
|
669355
670345
|
if (updated) {
|
|
669356
|
-
|
|
670346
|
+
writeFileSync74(metaFile2, JSON.stringify(store2, null, 2));
|
|
669357
670347
|
}
|
|
669358
670348
|
}
|
|
669359
670349
|
} catch {
|
|
@@ -669412,7 +670402,7 @@ Rules:
|
|
|
669412
670402
|
const { initDb: initDb2 } = __require("@omnius/memory");
|
|
669413
670403
|
const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@omnius/memory");
|
|
669414
670404
|
const dbDir = join150(repoRoot, ".omnius", "memory");
|
|
669415
|
-
|
|
670405
|
+
mkdirSync82(dbDir, { recursive: true });
|
|
669416
670406
|
const db = initDb2(join150(dbDir, "structured.db"));
|
|
669417
670407
|
const memStore = new ProceduralMemoryStore2(db);
|
|
669418
670408
|
memStore.createWithEmbedding(
|
|
@@ -669461,8 +670451,8 @@ Rules:
|
|
|
669461
670451
|
accessCount: 0
|
|
669462
670452
|
});
|
|
669463
670453
|
if (store2.length > 100) store2 = store2.slice(-100);
|
|
669464
|
-
|
|
669465
|
-
|
|
670454
|
+
mkdirSync82(metaDir, { recursive: true });
|
|
670455
|
+
writeFileSync74(storeFile, JSON.stringify(store2, null, 2));
|
|
669466
670456
|
}
|
|
669467
670457
|
}
|
|
669468
670458
|
} catch {
|
|
@@ -669526,7 +670516,7 @@ Rules:
|
|
|
669526
670516
|
);
|
|
669527
670517
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
669528
670518
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
669529
|
-
|
|
670519
|
+
writeFileSync74(ikFile, JSON.stringify(ikState, null, 2));
|
|
669530
670520
|
}
|
|
669531
670521
|
const metaFile2 = join150(
|
|
669532
670522
|
repoRoot,
|
|
@@ -669554,7 +670544,7 @@ Rules:
|
|
|
669554
670544
|
(item.scores.confidence || 0.5) - 0.02
|
|
669555
670545
|
);
|
|
669556
670546
|
}
|
|
669557
|
-
|
|
670547
|
+
writeFileSync74(metaFile2, JSON.stringify(store2, null, 2));
|
|
669558
670548
|
}
|
|
669559
670549
|
try {
|
|
669560
670550
|
const archeDir = join150(repoRoot, ".omnius", "arche");
|
|
@@ -669576,8 +670566,8 @@ Rules:
|
|
|
669576
670566
|
tags: ["general"]
|
|
669577
670567
|
});
|
|
669578
670568
|
if (variants.length > 50) variants = variants.slice(-50);
|
|
669579
|
-
|
|
669580
|
-
|
|
670569
|
+
mkdirSync82(archeDir, { recursive: true });
|
|
670570
|
+
writeFileSync74(archeFile, JSON.stringify(variants, null, 2));
|
|
669581
670571
|
} catch {
|
|
669582
670572
|
}
|
|
669583
670573
|
} catch {
|
|
@@ -669679,13 +670669,13 @@ __export(run_exports, {
|
|
|
669679
670669
|
});
|
|
669680
670670
|
import { resolve as resolve54 } from "node:path";
|
|
669681
670671
|
import { spawn as spawn33 } from "node:child_process";
|
|
669682
|
-
import { mkdirSync as
|
|
670672
|
+
import { mkdirSync as mkdirSync83, writeFileSync as writeFileSync75, readFileSync as readFileSync112, readdirSync as readdirSync50, existsSync as existsSync136 } from "node:fs";
|
|
669683
670673
|
import { randomBytes as randomBytes28 } from "node:crypto";
|
|
669684
670674
|
import { join as join151 } from "node:path";
|
|
669685
670675
|
function jobsDir2(repoPath) {
|
|
669686
670676
|
const root = resolve54(repoPath ?? process.cwd());
|
|
669687
670677
|
const dir = join151(root, ".omnius", "jobs");
|
|
669688
|
-
|
|
670678
|
+
mkdirSync83(dir, { recursive: true });
|
|
669689
670679
|
return dir;
|
|
669690
670680
|
}
|
|
669691
670681
|
async function runCommand2(opts, config) {
|
|
@@ -669807,7 +670797,7 @@ async function runBackground(task, config, opts) {
|
|
|
669807
670797
|
}
|
|
669808
670798
|
});
|
|
669809
670799
|
job.pid = child.pid ?? 0;
|
|
669810
|
-
|
|
670800
|
+
writeFileSync75(join151(dir, `${id}.json`), JSON.stringify(job, null, 2));
|
|
669811
670801
|
let output = "";
|
|
669812
670802
|
child.stdout?.on("data", (chunk) => {
|
|
669813
670803
|
output += chunk.toString();
|
|
@@ -669823,7 +670813,7 @@ async function runBackground(task, config, opts) {
|
|
|
669823
670813
|
job.summary = result.summary;
|
|
669824
670814
|
job.durationMs = result.durationMs;
|
|
669825
670815
|
job.error = result.error;
|
|
669826
|
-
|
|
670816
|
+
writeFileSync75(join151(dir, `${id}.json`), JSON.stringify(job, null, 2));
|
|
669827
670817
|
} catch {
|
|
669828
670818
|
}
|
|
669829
670819
|
});
|
|
@@ -670457,7 +671447,7 @@ __export(eval_exports, {
|
|
|
670457
671447
|
evalCommand: () => evalCommand
|
|
670458
671448
|
});
|
|
670459
671449
|
import { tmpdir as tmpdir22 } from "node:os";
|
|
670460
|
-
import { mkdirSync as
|
|
671450
|
+
import { mkdirSync as mkdirSync84, writeFileSync as writeFileSync76 } from "node:fs";
|
|
670461
671451
|
import { join as join153 } from "node:path";
|
|
670462
671452
|
async function evalCommand(opts, config) {
|
|
670463
671453
|
const suiteName = opts.suite ?? "basic";
|
|
@@ -670588,8 +671578,8 @@ async function evalCommand(opts, config) {
|
|
|
670588
671578
|
}
|
|
670589
671579
|
function createTempEvalRepo() {
|
|
670590
671580
|
const dir = join153(tmpdir22(), `omnius-eval-${Date.now()}`);
|
|
670591
|
-
|
|
670592
|
-
|
|
671581
|
+
mkdirSync84(dir, { recursive: true });
|
|
671582
|
+
writeFileSync76(
|
|
670593
671583
|
join153(dir, "package.json"),
|
|
670594
671584
|
JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n",
|
|
670595
671585
|
"utf8"
|
|
@@ -670653,7 +671643,7 @@ init_updater();
|
|
|
670653
671643
|
init_typed_node_events();
|
|
670654
671644
|
import { createRequire as createRequire9 } from "node:module";
|
|
670655
671645
|
import { parseArgs as nodeParseArgs2 } from "node:util";
|
|
670656
|
-
import { fileURLToPath as
|
|
671646
|
+
import { fileURLToPath as fileURLToPath21 } from "node:url";
|
|
670657
671647
|
import { dirname as dirname43, join as join154 } from "node:path";
|
|
670658
671648
|
|
|
670659
671649
|
// packages/cli/src/cli.ts
|
|
@@ -670802,7 +671792,7 @@ try {
|
|
|
670802
671792
|
function getVersion5() {
|
|
670803
671793
|
try {
|
|
670804
671794
|
const require5 = createRequire9(import.meta.url);
|
|
670805
|
-
const pkgPath = join154(dirname43(
|
|
671795
|
+
const pkgPath = join154(dirname43(fileURLToPath21(import.meta.url)), "..", "package.json");
|
|
670806
671796
|
const pkg = require5(pkgPath);
|
|
670807
671797
|
return pkg.version;
|
|
670808
671798
|
} catch {
|
|
@@ -671116,11 +672106,11 @@ function crashLog(label, err) {
|
|
|
671116
672106
|
const logLine = `[${timestamp}] ${label}: ${msg}
|
|
671117
672107
|
`;
|
|
671118
672108
|
try {
|
|
671119
|
-
const { appendFileSync: appendFileSync14, mkdirSync:
|
|
672109
|
+
const { appendFileSync: appendFileSync14, mkdirSync: mkdirSync85 } = __require("node:fs");
|
|
671120
672110
|
const { join: join155 } = __require("node:path");
|
|
671121
672111
|
const { homedir: homedir56 } = __require("node:os");
|
|
671122
672112
|
const logDir = join155(homedir56(), ".omnius");
|
|
671123
|
-
|
|
672113
|
+
mkdirSync85(logDir, { recursive: true });
|
|
671124
672114
|
appendFileSync14(join155(logDir, "crash.log"), logLine);
|
|
671125
672115
|
} catch {
|
|
671126
672116
|
}
|