omnius 1.0.160 → 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/dist/index.js +802 -299
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
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
|
});
|
|
@@ -21439,6 +21467,14 @@ var init_skill_tools = __esm({
|
|
|
21439
21467
|
source: {
|
|
21440
21468
|
type: "string",
|
|
21441
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."
|
|
21442
21478
|
}
|
|
21443
21479
|
},
|
|
21444
21480
|
required: []
|
|
@@ -21452,6 +21488,9 @@ var init_skill_tools = __esm({
|
|
|
21452
21488
|
const filterRaw = args["filter"] ?? args["pattern"] ?? args["query"] ?? args["search"] ?? "";
|
|
21453
21489
|
const filter2 = typeof filterRaw === "string" ? filterRaw.toLowerCase() : "";
|
|
21454
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)));
|
|
21455
21494
|
let skills = discoverSkills(this.repoRoot);
|
|
21456
21495
|
if (filter2) {
|
|
21457
21496
|
skills = skills.filter((s2) => s2.name.toLowerCase().includes(filter2) || s2.description.toLowerCase().includes(filter2) || s2.triggers.some((t2) => t2.toLowerCase().includes(filter2)));
|
|
@@ -21466,9 +21505,14 @@ var init_skill_tools = __esm({
|
|
|
21466
21505
|
durationMs: performance.now() - start2
|
|
21467
21506
|
};
|
|
21468
21507
|
}
|
|
21469
|
-
const
|
|
21470
|
-
|
|
21471
|
-
|
|
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) {
|
|
21472
21516
|
lines.push(` ${s2.name}`);
|
|
21473
21517
|
lines.push(` ${s2.description}`);
|
|
21474
21518
|
if (s2.triggers.length > 0) {
|
|
@@ -21480,6 +21524,10 @@ var init_skill_tools = __esm({
|
|
|
21480
21524
|
}
|
|
21481
21525
|
lines.push("");
|
|
21482
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
|
+
}
|
|
21483
21531
|
return {
|
|
21484
21532
|
success: true,
|
|
21485
21533
|
output: lines.join("\n"),
|
|
@@ -254257,9 +254305,9 @@ print("${sentinel}")
|
|
|
254257
254305
|
if (!this.proc || this.proc.killed) {
|
|
254258
254306
|
return { success: false, path: "" };
|
|
254259
254307
|
}
|
|
254260
|
-
const { mkdirSync:
|
|
254308
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
254261
254309
|
const sessionDir2 = join33(this.cwd, ".omnius", "rlm");
|
|
254262
|
-
|
|
254310
|
+
mkdirSync85(sessionDir2, { recursive: true });
|
|
254263
254311
|
const sessionPath2 = join33(sessionDir2, "session.json");
|
|
254264
254312
|
try {
|
|
254265
254313
|
const inspectCode = `
|
|
@@ -254283,7 +254331,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
254283
254331
|
trajectoryCount: this.trajectory.length,
|
|
254284
254332
|
subCallCount: this.subCallCount
|
|
254285
254333
|
};
|
|
254286
|
-
|
|
254334
|
+
writeFileSync77(sessionPath2, JSON.stringify(sessionData, null, 2), "utf8");
|
|
254287
254335
|
return { success: true, path: sessionPath2 };
|
|
254288
254336
|
}
|
|
254289
254337
|
} catch {
|
|
@@ -254892,7 +254940,7 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
254892
254940
|
/** Update memory scores based on task outcome. Called after task completion.
|
|
254893
254941
|
* Memories used in successful tasks get boosted. Memories present during failures get decayed. */
|
|
254894
254942
|
updateFromOutcomeSync(surfacedMemoryText, succeeded) {
|
|
254895
|
-
const { readFileSync: readFileSync113, writeFileSync:
|
|
254943
|
+
const { readFileSync: readFileSync113, writeFileSync: writeFileSync77, existsSync: existsSync138, mkdirSync: mkdirSync85 } = __require("node:fs");
|
|
254896
254944
|
const metaDir = join34(this.cwd, ".omnius", "memory", "metabolism");
|
|
254897
254945
|
const storeFile = join34(metaDir, "store.json");
|
|
254898
254946
|
if (!existsSync138(storeFile))
|
|
@@ -254923,8 +254971,8 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
254923
254971
|
updated = true;
|
|
254924
254972
|
}
|
|
254925
254973
|
if (updated) {
|
|
254926
|
-
|
|
254927
|
-
|
|
254974
|
+
mkdirSync85(metaDir, { recursive: true });
|
|
254975
|
+
writeFileSync77(storeFile, JSON.stringify(store2, null, 2));
|
|
254928
254976
|
}
|
|
254929
254977
|
}
|
|
254930
254978
|
// ── Storage ──────────────────────────────────────────────────────────
|
|
@@ -255370,7 +255418,7 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
255370
255418
|
}
|
|
255371
255419
|
/** Archive a strategy variant synchronously (for task completion path) */
|
|
255372
255420
|
archiveVariantSync(strategy, outcome, tags = []) {
|
|
255373
|
-
const { readFileSync: readFileSync113, writeFileSync:
|
|
255421
|
+
const { readFileSync: readFileSync113, writeFileSync: writeFileSync77, existsSync: existsSync138, mkdirSync: mkdirSync85 } = __require("node:fs");
|
|
255374
255422
|
const dir = join36(this.cwd, ".omnius", "arche");
|
|
255375
255423
|
const archiveFile = join36(dir, "variants.json");
|
|
255376
255424
|
let variants = [];
|
|
@@ -255391,8 +255439,8 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
255391
255439
|
});
|
|
255392
255440
|
if (variants.length > 50)
|
|
255393
255441
|
variants = variants.slice(-50);
|
|
255394
|
-
|
|
255395
|
-
|
|
255442
|
+
mkdirSync85(dir, { recursive: true });
|
|
255443
|
+
writeFileSync77(archiveFile, JSON.stringify(variants, null, 2));
|
|
255396
255444
|
}
|
|
255397
255445
|
async saveArchive(variants) {
|
|
255398
255446
|
const dir = join36(this.cwd, ".omnius", "arche");
|
|
@@ -542581,12 +542629,12 @@ var init_reflectionBuffer = __esm({
|
|
|
542581
542629
|
if (!this.persistPath)
|
|
542582
542630
|
return;
|
|
542583
542631
|
try {
|
|
542584
|
-
const { writeFileSync:
|
|
542632
|
+
const { writeFileSync: writeFileSync77, mkdirSync: mkdirSync85, existsSync: existsSync138 } = __require("node:fs");
|
|
542585
542633
|
const { join: join155 } = __require("node:path");
|
|
542586
542634
|
const dir = join155(this.persistPath, "..");
|
|
542587
542635
|
if (!existsSync138(dir))
|
|
542588
|
-
|
|
542589
|
-
|
|
542636
|
+
mkdirSync85(dir, { recursive: true });
|
|
542637
|
+
writeFileSync77(this.persistPath, JSON.stringify(this.state, null, 2));
|
|
542590
542638
|
} catch {
|
|
542591
542639
|
}
|
|
542592
542640
|
}
|
|
@@ -544754,6 +544802,274 @@ var init_failureHandoff = __esm({
|
|
|
544754
544802
|
}
|
|
544755
544803
|
});
|
|
544756
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
|
+
|
|
544757
545073
|
// packages/orchestrator/dist/preflightSnapshot.js
|
|
544758
545074
|
var preflightSnapshot_exports = {};
|
|
544759
545075
|
__export(preflightSnapshot_exports, {
|
|
@@ -546103,6 +546419,7 @@ var init_agenticRunner = __esm({
|
|
|
546103
546419
|
init_specDecomposer();
|
|
546104
546420
|
init_modelProfile();
|
|
546105
546421
|
init_failureHandoff();
|
|
546422
|
+
init_context_fabric();
|
|
546106
546423
|
TOOL_SUBSETS = {
|
|
546107
546424
|
web: ["web_search", "web_fetch", "web_crawl"],
|
|
546108
546425
|
code: [
|
|
@@ -546540,6 +546857,10 @@ var init_agenticRunner = __esm({
|
|
|
546540
546857
|
// Phase 6 — last-surface guard so we don't re-inject the same anchor on
|
|
546541
546858
|
// consecutive turns when its keywords still match.
|
|
546542
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();
|
|
546543
546864
|
/** WO-AM-10: Process pending episode embeddings in background batches */
|
|
546544
546865
|
async processPendingEmbeddings() {
|
|
546545
546866
|
if (this._pendingEmbeddings.length === 0 || !this._episodeStore)
|
|
@@ -548704,6 +549025,80 @@ ${latest.output || ""}`.trim();
|
|
|
548704
549025
|
return null;
|
|
548705
549026
|
return sections.join("\n");
|
|
548706
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
|
+
}
|
|
548707
549102
|
makePhaseSummarizer() {
|
|
548708
549103
|
if (process.env["OMNIUS_DISABLE_PHASE_SUMMARIZER"] === "1")
|
|
548709
549104
|
return null;
|
|
@@ -548762,11 +549157,11 @@ ${blob}
|
|
|
548762
549157
|
*/
|
|
548763
549158
|
surfaceAnchors(messages2) {
|
|
548764
549159
|
if (process.env["OMNIUS_DISABLE_ANCHOR_SURFACING"] === "1")
|
|
548765
|
-
return;
|
|
549160
|
+
return null;
|
|
548766
549161
|
if (!this._contextTree)
|
|
548767
|
-
return;
|
|
549162
|
+
return null;
|
|
548768
549163
|
if (messages2.length === 0)
|
|
548769
|
-
return;
|
|
549164
|
+
return null;
|
|
548770
549165
|
const tail = messages2.slice(-6);
|
|
548771
549166
|
const queryParts = [];
|
|
548772
549167
|
for (const m2 of tail) {
|
|
@@ -548778,7 +549173,7 @@ ${blob}
|
|
|
548778
549173
|
}
|
|
548779
549174
|
const query = queryParts.join(" ").slice(0, 800);
|
|
548780
549175
|
if (!query)
|
|
548781
|
-
return;
|
|
549176
|
+
return null;
|
|
548782
549177
|
const anchors = this._contextTree.findAnchorsByKeywords(query, 5);
|
|
548783
549178
|
const memexMatches = [];
|
|
548784
549179
|
if (this._memexArchive.size > 0) {
|
|
@@ -548801,7 +549196,7 @@ ${blob}
|
|
|
548801
549196
|
const newAnchors = anchors.filter((a2) => !this._lastSurfacedAnchorIds.has(a2.id)).slice(0, 3);
|
|
548802
549197
|
const newMemex = memexMatches.filter((m2) => !this._lastSurfacedAnchorIds.has(m2.id)).slice(0, 2);
|
|
548803
549198
|
if (newAnchors.length === 0 && newMemex.length === 0)
|
|
548804
|
-
return;
|
|
549199
|
+
return null;
|
|
548805
549200
|
const lines = [
|
|
548806
549201
|
`[Anchor surface] Relevant archived context for the current activity:`
|
|
548807
549202
|
];
|
|
@@ -548812,10 +549207,6 @@ ${blob}
|
|
|
548812
549207
|
lines.push(` - [memex:${m2.id}] ${m2.summary} — call memex_retrieve("${m2.id}") for full body`);
|
|
548813
549208
|
}
|
|
548814
549209
|
lines.push(`(Anchors are reminders. Pull only what you actually need; ignore otherwise.)`);
|
|
548815
|
-
messages2.push({
|
|
548816
|
-
role: "system",
|
|
548817
|
-
content: lines.join("\n")
|
|
548818
|
-
});
|
|
548819
549210
|
for (const a2 of newAnchors)
|
|
548820
549211
|
this._lastSurfacedAnchorIds.add(a2.id);
|
|
548821
549212
|
for (const m2 of newMemex)
|
|
@@ -548825,6 +549216,7 @@ ${blob}
|
|
|
548825
549216
|
content: `Anchor surface: surfaced ${newAnchors.length} anchor(s) + ${newMemex.length} memex entry(ies)`,
|
|
548826
549217
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
548827
549218
|
});
|
|
549219
|
+
return lines.join("\n");
|
|
548828
549220
|
}
|
|
548829
549221
|
microcompact(messages2, recentToolResults) {
|
|
548830
549222
|
const tier = this.options.modelTier ?? "large";
|
|
@@ -549545,6 +549937,8 @@ Respond with your assessment, then take action.`;
|
|
|
549545
549937
|
this._ephemeralSkillPackContext = "";
|
|
549546
549938
|
this._contextTree = null;
|
|
549547
549939
|
this._lastSurfacedAnchorIds.clear();
|
|
549940
|
+
this._contextLedger = new ContextLedger();
|
|
549941
|
+
this._contextFrameBuilder = new ContextFrameBuilder();
|
|
549548
549942
|
if (!this.options.disablePersistentMemory && !this._memoryInitialized) {
|
|
549549
549943
|
try {
|
|
549550
549944
|
const path12 = await import("node:path");
|
|
@@ -549890,7 +550284,14 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
549890
550284
|
maxRecentCalls: 0
|
|
549891
550285
|
});
|
|
549892
550286
|
if (failureHandoff) {
|
|
549893
|
-
|
|
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);
|
|
549894
550295
|
}
|
|
549895
550296
|
} catch {
|
|
549896
550297
|
}
|
|
@@ -551344,11 +551745,12 @@ ${memoryLines.join("\n")}`
|
|
|
551344
551745
|
}
|
|
551345
551746
|
}
|
|
551346
551747
|
}
|
|
551748
|
+
let environmentBlock = null;
|
|
551347
551749
|
if (this.options.environmentProvider) {
|
|
551348
551750
|
try {
|
|
551349
551751
|
const envStr = this.options.environmentProvider();
|
|
551350
551752
|
if (envStr) {
|
|
551351
|
-
|
|
551753
|
+
environmentBlock = envStr;
|
|
551352
551754
|
}
|
|
551353
551755
|
} catch {
|
|
551354
551756
|
}
|
|
@@ -551356,7 +551758,7 @@ ${memoryLines.join("\n")}`
|
|
|
551356
551758
|
this._lastAssistantTimestamp = Date.now();
|
|
551357
551759
|
this.proactivePrune(compacted, turn);
|
|
551358
551760
|
this.microcompact(compacted, recentToolResults);
|
|
551359
|
-
this.
|
|
551761
|
+
this._insertContextFrame(compacted, this._buildTurnContextFrame(turn, compacted, recentToolResults, environmentBlock));
|
|
551360
551762
|
const { maxOutputTokens: effectiveMaxTokens } = this.contextLimits();
|
|
551361
551763
|
const chatRequest = {
|
|
551362
551764
|
messages: compacted,
|
|
@@ -551428,31 +551830,6 @@ ${memoryLines.join("\n")}`
|
|
|
551428
551830
|
}
|
|
551429
551831
|
}
|
|
551430
551832
|
}
|
|
551431
|
-
const _injections = [];
|
|
551432
|
-
const fsBlock = this._renderFilesystemStateBlock(turn);
|
|
551433
|
-
if (fsBlock)
|
|
551434
|
-
_injections.push(fsBlock);
|
|
551435
|
-
const todoBlock = this._renderTodoStateBlock(turn);
|
|
551436
|
-
if (todoBlock)
|
|
551437
|
-
_injections.push(todoBlock);
|
|
551438
|
-
const failBlock = this._renderRecentFailuresBlock(turn);
|
|
551439
|
-
if (failBlock)
|
|
551440
|
-
_injections.push(failBlock);
|
|
551441
|
-
const churnBlock = this._renderWriteChurnBlock(turn);
|
|
551442
|
-
if (churnBlock)
|
|
551443
|
-
_injections.push(churnBlock);
|
|
551444
|
-
const knowledgeBlock = this._renderKnowledgeBlock(recentToolResults);
|
|
551445
|
-
if (knowledgeBlock)
|
|
551446
|
-
_injections.push(knowledgeBlock);
|
|
551447
|
-
if (_injections.length > 0) {
|
|
551448
|
-
const reqMsgs = chatRequest.messages;
|
|
551449
|
-
if (Array.isArray(reqMsgs)) {
|
|
551450
|
-
const insertAt = Math.max(0, reqMsgs.length - 1);
|
|
551451
|
-
for (const blk of _injections) {
|
|
551452
|
-
reqMsgs.splice(insertAt, 0, { role: "system", content: blk });
|
|
551453
|
-
}
|
|
551454
|
-
}
|
|
551455
|
-
}
|
|
551456
551833
|
let response;
|
|
551457
551834
|
try {
|
|
551458
551835
|
response = this.options.streamEnabled && this.hasStreamingSupport() ? await this.streamingRequest(chatRequest, turn) : await this.backend.chatCompletion(chatRequest);
|
|
@@ -553495,7 +553872,15 @@ Then use file_read on individual FILES inside it.`);
|
|
|
553495
553872
|
lastInjectedTurn: lastShellPivotTurn
|
|
553496
553873
|
});
|
|
553497
553874
|
if (shellPivot.shouldInject && shellPivot.content) {
|
|
553498
|
-
|
|
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);
|
|
553499
553884
|
lastShellPivotTurn = turn;
|
|
553500
553885
|
this.emit({
|
|
553501
553886
|
type: "status",
|
|
@@ -553514,7 +553899,15 @@ Then use file_read on individual FILES inside it.`);
|
|
|
553514
553899
|
maxRecentCalls: 6
|
|
553515
553900
|
});
|
|
553516
553901
|
if (runtimeHandoff) {
|
|
553517
|
-
|
|
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);
|
|
553518
553911
|
lastFailureHandoffTurn = turn;
|
|
553519
553912
|
}
|
|
553520
553913
|
}
|
|
@@ -554150,7 +554543,14 @@ ${this.options.maxTurns && this.options.maxTurns > 0 ? `You have ${this.options.
|
|
|
554150
554543
|
}
|
|
554151
554544
|
this.proactivePrune(compactedMsgs, this._taskState.toolCallCount);
|
|
554152
554545
|
this.microcompact(compactedMsgs);
|
|
554153
|
-
|
|
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));
|
|
554154
554554
|
const chatRequest = {
|
|
554155
554555
|
messages: compactedMsgs,
|
|
554156
554556
|
tools: toolDefs,
|
|
@@ -555064,10 +555464,10 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
|
|
|
555064
555464
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
555065
555465
|
});
|
|
555066
555466
|
try {
|
|
555067
|
-
const { mkdirSync:
|
|
555467
|
+
const { mkdirSync: mkdirSync85, readdirSync: readdirSync51, statSync: statSync49, unlinkSync: unlinkSync29, writeFileSync: writeFileSync77 } = __require("node:fs");
|
|
555068
555468
|
const { join: join155 } = __require("node:path");
|
|
555069
555469
|
const contextDir = join155(this._workingDirectory || process.cwd(), ".omnius", "context");
|
|
555070
|
-
|
|
555470
|
+
mkdirSync85(contextDir, { recursive: true });
|
|
555071
555471
|
const topEntities = this._temporalGraph.nodesByType("entity", 3);
|
|
555072
555472
|
const topFiles = this._temporalGraph.nodesByType("file", 3);
|
|
555073
555473
|
const topConcepts = this._temporalGraph.nodesByType("concept", 3);
|
|
@@ -555107,16 +555507,30 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
|
|
|
555107
555507
|
section("Top Files", topFiles);
|
|
555108
555508
|
section("Top Concepts", topConcepts);
|
|
555109
555509
|
lines.push("(Use file_read on this file for quick recall. See provenance JSON for full edge detail.)");
|
|
555110
|
-
const
|
|
555111
|
-
|
|
555112
|
-
|
|
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");
|
|
555113
555527
|
if (process.env["OMNIUS_DISABLE_KG_SUMMARY_PRUNE"] !== "1") {
|
|
555114
555528
|
try {
|
|
555115
555529
|
const maxAgeDays = parseInt(process.env["OMNIUS_KG_SUMMARY_MAX_AGE_DAYS"] || "7", 10) || 7;
|
|
555116
|
-
const maxFiles = parseInt(process.env["OMNIUS_KG_SUMMARY_MAX_FILES"] || "
|
|
555530
|
+
const maxFiles = parseInt(process.env["OMNIUS_KG_SUMMARY_MAX_FILES"] || "60", 10) || 60;
|
|
555117
555531
|
const cutoff = Date.now() - maxAgeDays * 24 * 60 * 60 * 1e3;
|
|
555118
|
-
const summaries = readdirSync51(
|
|
555119
|
-
const filePath = join155(
|
|
555532
|
+
const summaries = readdirSync51(kgSummaryDir).filter((name10) => name10.startsWith("kg-summary-") && name10.endsWith(".md")).map((name10) => {
|
|
555533
|
+
const filePath = join155(kgSummaryDir, name10);
|
|
555120
555534
|
const stat7 = statSync49(filePath);
|
|
555121
555535
|
return { filePath, mtimeMs: stat7.mtimeMs };
|
|
555122
555536
|
}).sort((a2, b) => b.mtimeMs - a2.mtimeMs);
|
|
@@ -555394,11 +555808,11 @@ ${errOutput}`);
|
|
|
555394
555808
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
555395
555809
|
});
|
|
555396
555810
|
try {
|
|
555397
|
-
const { mkdirSync:
|
|
555811
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = __require("node:fs");
|
|
555398
555812
|
const { join: join155 } = __require("node:path");
|
|
555399
555813
|
const resultsDir = join155(this.omniusStateDir(), "tool-results");
|
|
555400
|
-
|
|
555401
|
-
|
|
555814
|
+
mkdirSync85(resultsDir, { recursive: true });
|
|
555815
|
+
writeFileSync77(join155(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
|
|
555402
555816
|
# Turn: ${turn}
|
|
555403
555817
|
# Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
555404
555818
|
# Size: ${result.output.length} chars, ${lineCount} lines
|
|
@@ -555780,10 +556194,10 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
|
|
|
555780
556194
|
if (!this._workingDirectory)
|
|
555781
556195
|
return;
|
|
555782
556196
|
try {
|
|
555783
|
-
const { mkdirSync:
|
|
556197
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = __require("node:fs");
|
|
555784
556198
|
const { join: join155 } = __require("node:path");
|
|
555785
556199
|
const sessionDir2 = this.options.stateDir ? join155(this.omniusStateDir(), "session", this._sessionId) : join155(this._workingDirectory, ".omnius", "session", this._sessionId);
|
|
555786
|
-
|
|
556200
|
+
mkdirSync85(sessionDir2, { recursive: true });
|
|
555787
556201
|
const checkpoint = {
|
|
555788
556202
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
555789
556203
|
sessionId: this._sessionId,
|
|
@@ -555795,7 +556209,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
|
|
|
555795
556209
|
memexEntryCount: this._memexArchive.size,
|
|
555796
556210
|
fileRegistrySize: this._fileRegistry.size
|
|
555797
556211
|
};
|
|
555798
|
-
|
|
556212
|
+
writeFileSync77(join155(sessionDir2, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
|
|
555799
556213
|
} catch {
|
|
555800
556214
|
}
|
|
555801
556215
|
}
|
|
@@ -555829,10 +556243,17 @@ ${tail}`;
|
|
|
555829
556243
|
const textContent = userMsg.replace(imagePattern, "").trim();
|
|
555830
556244
|
await this.appendOffloadedImageMessage(messages2, mime, base642, textContent, turn);
|
|
555831
556245
|
} else {
|
|
555832
|
-
|
|
555833
|
-
|
|
555834
|
-
|
|
555835
|
-
|
|
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);
|
|
555836
556257
|
}
|
|
555837
556258
|
this.emit({
|
|
555838
556259
|
type: "user_interrupt",
|
|
@@ -556437,10 +556858,15 @@ ${content.slice(0, 8e3)}
|
|
|
556437
556858
|
if (this._taskState.failedApproaches.length > 0) {
|
|
556438
556859
|
goalParts.push(`**Failed approaches (do NOT repeat):** ${this._taskState.failedApproaches.slice(-3).join("; ")}`);
|
|
556439
556860
|
}
|
|
556440
|
-
|
|
556441
|
-
|
|
556442
|
-
|
|
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
|
|
556443
556867
|
});
|
|
556868
|
+
if (signal)
|
|
556869
|
+
this._contextLedger.upsert(signal);
|
|
556444
556870
|
}
|
|
556445
556871
|
if (process.env["OMNIUS_DISABLE_FAILURE_HANDOFF"] !== "1") {
|
|
556446
556872
|
try {
|
|
@@ -556452,10 +556878,15 @@ ${content.slice(0, 8e3)}
|
|
|
556452
556878
|
maxRecentCalls: 0
|
|
556453
556879
|
});
|
|
556454
556880
|
if (compactFailureHandoff) {
|
|
556455
|
-
|
|
556456
|
-
|
|
556457
|
-
|
|
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
|
|
556458
556887
|
});
|
|
556888
|
+
if (signal)
|
|
556889
|
+
this._contextLedger.upsert(signal);
|
|
556459
556890
|
}
|
|
556460
556891
|
} catch {
|
|
556461
556892
|
}
|
|
@@ -558056,12 +558487,12 @@ ${result}`
|
|
|
558056
558487
|
let resizedBase64 = null;
|
|
558057
558488
|
try {
|
|
558058
558489
|
const { execSync: execSync61 } = await import("node:child_process");
|
|
558059
|
-
const { writeFileSync:
|
|
558490
|
+
const { writeFileSync: writeFileSync77, readFileSync: readFileSync113, unlinkSync: unlinkSync29 } = await import("node:fs");
|
|
558060
558491
|
const { join: join155 } = await import("node:path");
|
|
558061
558492
|
const { tmpdir: tmpdir23 } = await import("node:os");
|
|
558062
558493
|
const tmpIn = join155(tmpdir23(), `omnius_img_in_${Date.now()}.png`);
|
|
558063
558494
|
const tmpOut = join155(tmpdir23(), `omnius_img_out_${Date.now()}.jpg`);
|
|
558064
|
-
|
|
558495
|
+
writeFileSync77(tmpIn, buffer2);
|
|
558065
558496
|
const pyBin = process.platform === "win32" ? "python" : "python3";
|
|
558066
558497
|
const escapedIn = tmpIn.replace(/\\/g, "\\\\");
|
|
558067
558498
|
const escapedOut = tmpOut.replace(/\\/g, "\\\\");
|
|
@@ -578677,7 +579108,7 @@ Assistant: ${assistant}`;
|
|
|
578677
579108
|
const prov = last2.provenance ? `
|
|
578678
579109
|
Provenance: ${last2.provenance} (file_read to expand)` : "";
|
|
578679
579110
|
const kg = `
|
|
578680
|
-
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)`;
|
|
578681
579112
|
return `<session-recap>
|
|
578682
579113
|
Project chronology (older to newer):
|
|
578683
579114
|
${chronology.join("\n")}
|
|
@@ -599464,13 +599895,13 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
599464
599895
|
try {
|
|
599465
599896
|
const { randomBytes: randomBytes29 } = await import("node:crypto");
|
|
599466
599897
|
const { homedir: homedir56 } = await import("node:os");
|
|
599467
|
-
const { mkdirSync:
|
|
599898
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
599468
599899
|
const { join: join155 } = await import("node:path");
|
|
599469
599900
|
const newKey = randomBytes29(16).toString("hex");
|
|
599470
599901
|
process.env["OMNIUS_API_KEY"] = newKey;
|
|
599471
599902
|
const dir = join155(homedir56(), ".omnius");
|
|
599472
|
-
|
|
599473
|
-
|
|
599903
|
+
mkdirSync85(dir, { recursive: true });
|
|
599904
|
+
writeFileSync77(join155(dir, "api.key"), newKey + "\n", "utf8");
|
|
599474
599905
|
renderInfo(`New API key: ${c3.bold(c3.yellow(newKey))}`);
|
|
599475
599906
|
renderInfo(
|
|
599476
599907
|
"Restart the daemon to apply if needed. Use /access any to restart quickly."
|
|
@@ -599735,11 +600166,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
599735
600166
|
);
|
|
599736
600167
|
try {
|
|
599737
600168
|
const { homedir: homedir57 } = await import("node:os");
|
|
599738
|
-
const { mkdirSync:
|
|
600169
|
+
const { mkdirSync: mkdirSync86, writeFileSync: writeFileSync78 } = await import("node:fs");
|
|
599739
600170
|
const { join: join156 } = await import("node:path");
|
|
599740
600171
|
const dir = join156(homedir57(), ".omnius");
|
|
599741
|
-
|
|
599742
|
-
|
|
600172
|
+
mkdirSync86(dir, { recursive: true });
|
|
600173
|
+
writeFileSync78(join156(dir, "api.key"), apiKey + "\n", "utf8");
|
|
599743
600174
|
} catch {
|
|
599744
600175
|
}
|
|
599745
600176
|
}
|
|
@@ -599751,11 +600182,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
599751
600182
|
const port2 = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
|
|
599752
600183
|
try {
|
|
599753
600184
|
const { homedir: homedir57 } = await import("node:os");
|
|
599754
|
-
const { mkdirSync:
|
|
600185
|
+
const { mkdirSync: mkdirSync86, writeFileSync: writeFileSync78 } = await import("node:fs");
|
|
599755
600186
|
const { join: join156 } = await import("node:path");
|
|
599756
600187
|
const dir = join156(homedir57(), ".omnius");
|
|
599757
|
-
|
|
599758
|
-
|
|
600188
|
+
mkdirSync86(dir, { recursive: true });
|
|
600189
|
+
writeFileSync78(join156(dir, "access"), `${val2}
|
|
599759
600190
|
`, "utf8");
|
|
599760
600191
|
} catch {
|
|
599761
600192
|
}
|
|
@@ -599855,11 +600286,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
599855
600286
|
);
|
|
599856
600287
|
try {
|
|
599857
600288
|
const { homedir: homedir57 } = await import("node:os");
|
|
599858
|
-
const { mkdirSync:
|
|
600289
|
+
const { mkdirSync: mkdirSync86, writeFileSync: writeFileSync78 } = await import("node:fs");
|
|
599859
600290
|
const { join: join156 } = await import("node:path");
|
|
599860
600291
|
const dir = join156(homedir57(), ".omnius");
|
|
599861
|
-
|
|
599862
|
-
|
|
600292
|
+
mkdirSync86(dir, { recursive: true });
|
|
600293
|
+
writeFileSync78(join156(dir, "api.key"), apiKey + "\n", "utf8");
|
|
599863
600294
|
} catch {
|
|
599864
600295
|
}
|
|
599865
600296
|
}
|
|
@@ -599870,12 +600301,12 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
599870
600301
|
}
|
|
599871
600302
|
const port = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
|
|
599872
600303
|
const { homedir: homedir56 } = await import("node:os");
|
|
599873
|
-
const { mkdirSync:
|
|
600304
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
599874
600305
|
const { join: join155 } = await import("node:path");
|
|
599875
600306
|
try {
|
|
599876
600307
|
const dir = join155(homedir56(), ".omnius");
|
|
599877
|
-
|
|
599878
|
-
|
|
600308
|
+
mkdirSync85(dir, { recursive: true });
|
|
600309
|
+
writeFileSync77(join155(dir, "access"), `${val}
|
|
599879
600310
|
`, "utf8");
|
|
599880
600311
|
} catch (e2) {
|
|
599881
600312
|
renderWarning(
|
|
@@ -607690,7 +608121,7 @@ async function handleVoiceMenu(ctx3, save2, hasLocal) {
|
|
|
607690
608121
|
const { basename: basename36, join: pathJoin } = await import("node:path");
|
|
607691
608122
|
const {
|
|
607692
608123
|
copyFileSync: copyFileSync5,
|
|
607693
|
-
mkdirSync:
|
|
608124
|
+
mkdirSync: mkdirSync85,
|
|
607694
608125
|
existsSync: exists2
|
|
607695
608126
|
} = await import("node:fs");
|
|
607696
608127
|
const { homedir: homedir56 } = await import("node:os");
|
|
@@ -607705,7 +608136,7 @@ async function handleVoiceMenu(ctx3, save2, hasLocal) {
|
|
|
607705
608136
|
"models",
|
|
607706
608137
|
modelName
|
|
607707
608138
|
);
|
|
607708
|
-
if (!exists2(destDir))
|
|
608139
|
+
if (!exists2(destDir)) mkdirSync85(destDir, { recursive: true });
|
|
607709
608140
|
copyFileSync5(onnxDrop.path, pathJoin(destDir, "model.onnx"));
|
|
607710
608141
|
copyFileSync5(jsonDrop.path, pathJoin(destDir, "config.json"));
|
|
607711
608142
|
const { registerCustomOnnxModel: registerCustomOnnxModel2 } = await Promise.resolve().then(() => (init_voice(), voice_exports));
|
|
@@ -609176,13 +609607,13 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
609176
609607
|
sponsors.push(...verified);
|
|
609177
609608
|
if (verified.length > 0) {
|
|
609178
609609
|
try {
|
|
609179
|
-
const { mkdirSync:
|
|
609180
|
-
|
|
609610
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = __require("node:fs");
|
|
609611
|
+
mkdirSync85(sponsorDir2, { recursive: true });
|
|
609181
609612
|
const cached = verified.map((s2) => ({
|
|
609182
609613
|
...s2,
|
|
609183
609614
|
lastVerified: Date.now()
|
|
609184
609615
|
}));
|
|
609185
|
-
|
|
609616
|
+
writeFileSync77(knownFile, JSON.stringify(cached, null, 2));
|
|
609186
609617
|
} catch {
|
|
609187
609618
|
}
|
|
609188
609619
|
}
|
|
@@ -609386,7 +609817,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
609386
609817
|
}
|
|
609387
609818
|
if (models.length > 0) {
|
|
609388
609819
|
try {
|
|
609389
|
-
const { writeFileSync:
|
|
609820
|
+
const { writeFileSync: writeFileSync77, mkdirSync: mkdirSync85 } = await import("node:fs");
|
|
609390
609821
|
const { join: join155, dirname: dirname44 } = await import("node:path");
|
|
609391
609822
|
const cachePath = join155(
|
|
609392
609823
|
ctx3.repoRoot || process.cwd(),
|
|
@@ -609394,8 +609825,8 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
609394
609825
|
"nexus",
|
|
609395
609826
|
"peer-models-cache.json"
|
|
609396
609827
|
);
|
|
609397
|
-
|
|
609398
|
-
|
|
609828
|
+
mkdirSync85(dirname44(cachePath), { recursive: true });
|
|
609829
|
+
writeFileSync77(
|
|
609399
609830
|
cachePath,
|
|
609400
609831
|
JSON.stringify(
|
|
609401
609832
|
{
|
|
@@ -609467,7 +609898,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
609467
609898
|
}));
|
|
609468
609899
|
renderWarning("Live model probe failed; using sponsor directory model advertisement.");
|
|
609469
609900
|
try {
|
|
609470
|
-
const { writeFileSync:
|
|
609901
|
+
const { writeFileSync: writeFileSync77, mkdirSync: mkdirSync85 } = await import("node:fs");
|
|
609471
609902
|
const { join: join155, dirname: dirname44 } = await import("node:path");
|
|
609472
609903
|
const cachePath = join155(
|
|
609473
609904
|
ctx3.repoRoot || process.cwd(),
|
|
@@ -609475,8 +609906,8 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
|
|
|
609475
609906
|
"nexus",
|
|
609476
609907
|
"peer-models-cache.json"
|
|
609477
609908
|
);
|
|
609478
|
-
|
|
609479
|
-
|
|
609909
|
+
mkdirSync85(dirname44(cachePath), { recursive: true });
|
|
609910
|
+
writeFileSync77(
|
|
609480
609911
|
cachePath,
|
|
609481
609912
|
JSON.stringify({
|
|
609482
609913
|
peerId,
|
|
@@ -612064,13 +612495,13 @@ var init_commands = __esm({
|
|
|
612064
612495
|
try {
|
|
612065
612496
|
const { randomBytes: randomBytes29 } = await import("node:crypto");
|
|
612066
612497
|
const { homedir: homedir56 } = await import("node:os");
|
|
612067
|
-
const { mkdirSync:
|
|
612498
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
612068
612499
|
const { join: join155 } = await import("node:path");
|
|
612069
612500
|
const apiKey = randomBytes29(16).toString("hex");
|
|
612070
612501
|
process.env["OMNIUS_API_KEY"] = apiKey;
|
|
612071
612502
|
const dir = join155(homedir56(), ".omnius");
|
|
612072
|
-
|
|
612073
|
-
|
|
612503
|
+
mkdirSync85(dir, { recursive: true });
|
|
612504
|
+
writeFileSync77(join155(dir, "api.key"), apiKey + "\n", "utf8");
|
|
612074
612505
|
renderInfo(`Generated API key: ${c3.bold(c3.yellow(apiKey))}`);
|
|
612075
612506
|
renderInfo(
|
|
612076
612507
|
"Use Authorization: Bearer <key> or click 'key' in the Web UI header to paste it."
|
|
@@ -612089,11 +612520,11 @@ var init_commands = __esm({
|
|
|
612089
612520
|
const port = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
|
|
612090
612521
|
try {
|
|
612091
612522
|
const { homedir: homedir56 } = await import("node:os");
|
|
612092
|
-
const { mkdirSync:
|
|
612523
|
+
const { mkdirSync: mkdirSync85, writeFileSync: writeFileSync77 } = await import("node:fs");
|
|
612093
612524
|
const { join: join155 } = await import("node:path");
|
|
612094
612525
|
const dir = join155(homedir56(), ".omnius");
|
|
612095
|
-
|
|
612096
|
-
|
|
612526
|
+
mkdirSync85(dir, { recursive: true });
|
|
612527
|
+
writeFileSync77(join155(dir, "access"), `${val}
|
|
612097
612528
|
`, "utf8");
|
|
612098
612529
|
} catch {
|
|
612099
612530
|
}
|
|
@@ -612256,7 +612687,7 @@ var init_commands = __esm({
|
|
|
612256
612687
|
});
|
|
612257
612688
|
|
|
612258
612689
|
// packages/cli/src/tui/project-context.ts
|
|
612259
|
-
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";
|
|
612260
612691
|
import { join as join121, basename as basename24 } from "node:path";
|
|
612261
612692
|
import { execSync as execSync54 } from "node:child_process";
|
|
612262
612693
|
import { homedir as homedir42 } from "node:os";
|
|
@@ -612489,6 +612920,8 @@ function loadPatternSuggestions(repoRoot, store2) {
|
|
|
612489
612920
|
}
|
|
612490
612921
|
}
|
|
612491
612922
|
function buildProjectContext(repoRoot, stores) {
|
|
612923
|
+
const skills = discoverSkills(repoRoot);
|
|
612924
|
+
writeCompressedSkillsArtifact(repoRoot, skills);
|
|
612492
612925
|
return {
|
|
612493
612926
|
projectInstructions: loadProjectFiles(repoRoot),
|
|
612494
612927
|
projectMap: loadProjectMap(repoRoot),
|
|
@@ -612499,9 +612932,40 @@ function buildProjectContext(repoRoot, stores) {
|
|
|
612499
612932
|
taskMemories: stores?.taskMemoryStore ? loadTaskMemories(repoRoot, stores.taskMemoryStore) : "",
|
|
612500
612933
|
failurePatterns: stores?.failureStore ? loadFailurePatterns(stores.failureStore) : "",
|
|
612501
612934
|
patternSuggestions: stores?.toolPatternStore ? loadPatternSuggestions(repoRoot, stores.toolPatternStore) : "",
|
|
612502
|
-
skillsSummary: buildSkillsSummary(
|
|
612935
|
+
skillsSummary: buildSkillsSummary(skills)
|
|
612503
612936
|
};
|
|
612504
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
|
+
}
|
|
612505
612969
|
function formatContextForPrompt(ctx3, modelTier = "large") {
|
|
612506
612970
|
const sections = [];
|
|
612507
612971
|
if (ctx3.environment) {
|
|
@@ -612741,11 +613205,11 @@ var init_realtime = __esm({
|
|
|
612741
613205
|
});
|
|
612742
613206
|
|
|
612743
613207
|
// packages/cli/src/tui/memory-paths.ts
|
|
612744
|
-
import { mkdirSync as
|
|
613208
|
+
import { mkdirSync as mkdirSync61 } from "node:fs";
|
|
612745
613209
|
import { join as join123 } from "node:path";
|
|
612746
613210
|
function omniusMemoryDbPaths(repoRoot) {
|
|
612747
613211
|
const dir = join123(repoRoot, ".omnius");
|
|
612748
|
-
|
|
613212
|
+
mkdirSync61(dir, { recursive: true });
|
|
612749
613213
|
return {
|
|
612750
613214
|
dir,
|
|
612751
613215
|
episodes: join123(dir, "episodes.db"),
|
|
@@ -613885,7 +614349,7 @@ __export(banner_exports, {
|
|
|
613885
614349
|
setBannerWriter: () => setBannerWriter,
|
|
613886
614350
|
setGridText: () => setGridText
|
|
613887
614351
|
});
|
|
613888
|
-
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";
|
|
613889
614353
|
import { join as join124 } from "node:path";
|
|
613890
614354
|
function setBannerWriter(writer) {
|
|
613891
614355
|
chromeWrite3 = writer;
|
|
@@ -614020,8 +614484,8 @@ function createSponsorBanner(sponsorName, tagline, primaryColor = 214, bgColor =
|
|
|
614020
614484
|
}
|
|
614021
614485
|
function saveBannerDesign(workDir, design) {
|
|
614022
614486
|
const dir = join124(workDir, ".omnius", "banners");
|
|
614023
|
-
|
|
614024
|
-
|
|
614487
|
+
mkdirSync62(dir, { recursive: true });
|
|
614488
|
+
writeFileSync56(join124(dir, `${design.id}.json`), JSON.stringify(design, null, 2), "utf8");
|
|
614025
614489
|
}
|
|
614026
614490
|
function loadBannerDesign(workDir, id) {
|
|
614027
614491
|
const file = join124(workDir, ".omnius", "banners", `${id}.json`);
|
|
@@ -614357,7 +614821,7 @@ var init_banner = __esm({
|
|
|
614357
614821
|
});
|
|
614358
614822
|
|
|
614359
614823
|
// packages/cli/src/tui/carousel-descriptors.ts
|
|
614360
|
-
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";
|
|
614361
614825
|
import { join as join125, basename as basename28 } from "node:path";
|
|
614362
614826
|
function loadToolProfile(repoRoot) {
|
|
614363
614827
|
const filePath = join125(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
|
|
@@ -614370,8 +614834,8 @@ function loadToolProfile(repoRoot) {
|
|
|
614370
614834
|
}
|
|
614371
614835
|
function saveToolProfile(repoRoot, profile) {
|
|
614372
614836
|
const contextDir = join125(repoRoot, OMNIUS_DIR, "context");
|
|
614373
|
-
|
|
614374
|
-
|
|
614837
|
+
mkdirSync63(contextDir, { recursive: true });
|
|
614838
|
+
writeFileSync57(join125(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
|
|
614375
614839
|
}
|
|
614376
614840
|
function categorizeToolCall(toolName) {
|
|
614377
614841
|
for (const cat2 of TOOL_CATEGORIES) {
|
|
@@ -614437,13 +614901,13 @@ function loadCachedDescriptors(repoRoot) {
|
|
|
614437
614901
|
}
|
|
614438
614902
|
function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
|
|
614439
614903
|
const contextDir = join125(repoRoot, OMNIUS_DIR, "context");
|
|
614440
|
-
|
|
614904
|
+
mkdirSync63(contextDir, { recursive: true });
|
|
614441
614905
|
const cached = {
|
|
614442
614906
|
phrases,
|
|
614443
614907
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
614444
614908
|
sourceHash
|
|
614445
614909
|
};
|
|
614446
|
-
|
|
614910
|
+
writeFileSync57(join125(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
|
|
614447
614911
|
}
|
|
614448
614912
|
function generateDescriptors(repoRoot) {
|
|
614449
614913
|
const profile = loadToolProfile(repoRoot);
|
|
@@ -615519,13 +615983,13 @@ var init_stream_renderer = __esm({
|
|
|
615519
615983
|
});
|
|
615520
615984
|
|
|
615521
615985
|
// packages/cli/src/tui/edit-history.ts
|
|
615522
|
-
import { appendFileSync as appendFileSync9, mkdirSync as
|
|
615986
|
+
import { appendFileSync as appendFileSync9, mkdirSync as mkdirSync64 } from "node:fs";
|
|
615523
615987
|
import { join as join126 } from "node:path";
|
|
615524
615988
|
function createEditHistoryLogger(repoRoot, sessionId) {
|
|
615525
615989
|
const historyDir = join126(repoRoot, ".omnius", "history");
|
|
615526
615990
|
const logPath3 = join126(historyDir, "edits.jsonl");
|
|
615527
615991
|
try {
|
|
615528
|
-
|
|
615992
|
+
mkdirSync64(historyDir, { recursive: true });
|
|
615529
615993
|
} catch {
|
|
615530
615994
|
}
|
|
615531
615995
|
function logToolCall(toolName, toolArgs, success) {
|
|
@@ -615663,7 +616127,7 @@ var init_promptLoader3 = __esm({
|
|
|
615663
616127
|
});
|
|
615664
616128
|
|
|
615665
616129
|
// packages/cli/src/tui/dream-engine.ts
|
|
615666
|
-
import { mkdirSync as
|
|
616130
|
+
import { mkdirSync as mkdirSync65, writeFileSync as writeFileSync58, readFileSync as readFileSync92, existsSync as existsSync114, readdirSync as readdirSync39 } from "node:fs";
|
|
615667
616131
|
import { join as join128, basename as basename29 } from "node:path";
|
|
615668
616132
|
import { execSync as execSync55 } from "node:child_process";
|
|
615669
616133
|
function setDreamWriteContent(fn) {
|
|
@@ -615883,8 +616347,8 @@ var init_dream_engine = __esm({
|
|
|
615883
616347
|
}
|
|
615884
616348
|
try {
|
|
615885
616349
|
const dir = join128(targetPath, "..");
|
|
615886
|
-
|
|
615887
|
-
|
|
616350
|
+
mkdirSync65(dir, { recursive: true });
|
|
616351
|
+
writeFileSync58(targetPath, content, "utf-8");
|
|
615888
616352
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
|
|
615889
616353
|
} catch (err) {
|
|
615890
616354
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
|
|
@@ -615925,7 +616389,7 @@ var init_dream_engine = __esm({
|
|
|
615925
616389
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
615926
616390
|
}
|
|
615927
616391
|
content = content.replace(oldStr, newStr);
|
|
615928
|
-
|
|
616392
|
+
writeFileSync58(targetPath, content, "utf-8");
|
|
615929
616393
|
return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start2 };
|
|
615930
616394
|
} catch (err) {
|
|
615931
616395
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
|
|
@@ -615971,8 +616435,8 @@ var init_dream_engine = __esm({
|
|
|
615971
616435
|
}
|
|
615972
616436
|
try {
|
|
615973
616437
|
const dir = join128(targetPath, "..");
|
|
615974
|
-
|
|
615975
|
-
|
|
616438
|
+
mkdirSync65(dir, { recursive: true });
|
|
616439
|
+
writeFileSync58(targetPath, content, "utf-8");
|
|
615976
616440
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
|
|
615977
616441
|
} catch (err) {
|
|
615978
616442
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
|
|
@@ -616013,7 +616477,7 @@ var init_dream_engine = __esm({
|
|
|
616013
616477
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
616014
616478
|
}
|
|
616015
616479
|
content = content.replace(oldStr, newStr);
|
|
616016
|
-
|
|
616480
|
+
writeFileSync58(targetPath, content, "utf-8");
|
|
616017
616481
|
return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start2 };
|
|
616018
616482
|
} catch (err) {
|
|
616019
616483
|
return { success: false, output: "", error: String(err), durationMs: Date.now() - start2 };
|
|
@@ -616101,7 +616565,7 @@ var init_dream_engine = __esm({
|
|
|
616101
616565
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
616102
616566
|
results: []
|
|
616103
616567
|
};
|
|
616104
|
-
|
|
616568
|
+
mkdirSync65(this.dreamsDir, { recursive: true });
|
|
616105
616569
|
this.saveDreamState();
|
|
616106
616570
|
try {
|
|
616107
616571
|
for (let cycle = 1; cycle <= totalCycles; cycle++) {
|
|
@@ -616174,7 +616638,7 @@ ${result.summary}`;
|
|
|
616174
616638
|
renderDreamContraction(cycle);
|
|
616175
616639
|
const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
|
|
616176
616640
|
const summaryPath = join128(this.dreamsDir, `cycle-${cycle}-summary.md`);
|
|
616177
|
-
|
|
616641
|
+
writeFileSync58(summaryPath, cycleSummary, "utf-8");
|
|
616178
616642
|
}
|
|
616179
616643
|
if (mode === "lucid" && !this.abortController.signal.aborted) {
|
|
616180
616644
|
this.saveVersionCheckpoint(cycle);
|
|
@@ -616836,8 +617300,8 @@ ${summaryResult}
|
|
|
616836
617300
|
*Generated by omnius autoresearch swarm*
|
|
616837
617301
|
`;
|
|
616838
617302
|
try {
|
|
616839
|
-
|
|
616840
|
-
|
|
617303
|
+
mkdirSync65(this.dreamsDir, { recursive: true });
|
|
617304
|
+
writeFileSync58(reportPath, report2, "utf-8");
|
|
616841
617305
|
} catch {
|
|
616842
617306
|
}
|
|
616843
617307
|
renderSwarmComplete(workspace);
|
|
@@ -616929,7 +617393,7 @@ ${summaryResult}
|
|
|
616929
617393
|
return { success: false, output: "", error: "todos must be an array" };
|
|
616930
617394
|
}
|
|
616931
617395
|
try {
|
|
616932
|
-
|
|
617396
|
+
writeFileSync58(todoPath3, JSON.stringify({ todos, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), "utf-8");
|
|
616933
617397
|
const summary = todos.map(
|
|
616934
617398
|
(t2, i2) => ` ${t2.status === "completed" ? "✓" : t2.status === "in_progress" ? "▶" : "◯"} ${i2 + 1}: ${t2.content || "(untitled)"}`
|
|
616935
617399
|
).join("\n");
|
|
@@ -616977,11 +617441,11 @@ ${summary}` };
|
|
|
616977
617441
|
addedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
616978
617442
|
};
|
|
616979
617443
|
notes2.push(note);
|
|
616980
|
-
|
|
617444
|
+
writeFileSync58(notesPath, JSON.stringify(notes2, null, 2), "utf-8");
|
|
616981
617445
|
return { success: true, output: `Note added: [${note.category}] ${note.content.slice(0, 80)}` };
|
|
616982
617446
|
}
|
|
616983
617447
|
if (action === "clear") {
|
|
616984
|
-
|
|
617448
|
+
writeFileSync58(notesPath, "[]", "utf-8");
|
|
616985
617449
|
return { success: true, output: "All notes cleared." };
|
|
616986
617450
|
}
|
|
616987
617451
|
if (action === "search") {
|
|
@@ -617019,7 +617483,7 @@ ${summary}` };
|
|
|
617019
617483
|
saveVersionCheckpoint(cycle) {
|
|
617020
617484
|
const checkpointDir3 = join128(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
|
|
617021
617485
|
try {
|
|
617022
|
-
|
|
617486
|
+
mkdirSync65(checkpointDir3, { recursive: true });
|
|
617023
617487
|
try {
|
|
617024
617488
|
const gitStatus = execSync55("git status --porcelain", {
|
|
617025
617489
|
cwd: this.repoRoot,
|
|
@@ -617036,10 +617500,10 @@ ${summary}` };
|
|
|
617036
617500
|
encoding: "utf-8",
|
|
617037
617501
|
timeout: 5e3
|
|
617038
617502
|
}).trim();
|
|
617039
|
-
|
|
617040
|
-
|
|
617041
|
-
|
|
617042
|
-
|
|
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(
|
|
617043
617507
|
join128(checkpointDir3, "checkpoint.json"),
|
|
617044
617508
|
JSON.stringify({
|
|
617045
617509
|
cycle,
|
|
@@ -617051,7 +617515,7 @@ ${summary}` };
|
|
|
617051
617515
|
);
|
|
617052
617516
|
renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
|
|
617053
617517
|
} catch {
|
|
617054
|
-
|
|
617518
|
+
writeFileSync58(
|
|
617055
617519
|
join128(checkpointDir3, "checkpoint.json"),
|
|
617056
617520
|
JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2),
|
|
617057
617521
|
"utf-8"
|
|
@@ -617113,7 +617577,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
|
|
|
617113
617577
|
---
|
|
617114
617578
|
*Auto-generated by omnius dream engine*
|
|
617115
617579
|
`;
|
|
617116
|
-
|
|
617580
|
+
writeFileSync58(join128(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
|
|
617117
617581
|
} catch {
|
|
617118
617582
|
}
|
|
617119
617583
|
}
|
|
@@ -617135,7 +617599,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
|
|
|
617135
617599
|
};
|
|
617136
617600
|
renderInfo("Memory consolidation starting — Phase 1: Orient → Phase 2: Gather → Phase 3: Consolidate → Phase 4: Prune");
|
|
617137
617601
|
const memoryDir = join128(this.repoRoot, ".omnius", "memory");
|
|
617138
|
-
|
|
617602
|
+
mkdirSync65(memoryDir, { recursive: true });
|
|
617139
617603
|
let prompt;
|
|
617140
617604
|
try {
|
|
617141
617605
|
prompt = loadPrompt3("tui/dream-consolidate.md", {
|
|
@@ -617201,7 +617665,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
|
|
|
617201
617665
|
durationMs
|
|
617202
617666
|
});
|
|
617203
617667
|
try {
|
|
617204
|
-
|
|
617668
|
+
writeFileSync58(
|
|
617205
617669
|
join128(memoryDir, ".last-consolidation"),
|
|
617206
617670
|
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), summary: result.summary?.slice(0, 500) }) + "\n"
|
|
617207
617671
|
);
|
|
@@ -617219,7 +617683,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
|
|
|
617219
617683
|
/** Save dream state for resume/inspection */
|
|
617220
617684
|
saveDreamState() {
|
|
617221
617685
|
try {
|
|
617222
|
-
|
|
617686
|
+
writeFileSync58(
|
|
617223
617687
|
join128(this.dreamsDir, "dream-state.json"),
|
|
617224
617688
|
JSON.stringify(this.state, null, 2) + "\n",
|
|
617225
617689
|
"utf-8"
|
|
@@ -617600,7 +618064,7 @@ var init_bless_engine = __esm({
|
|
|
617600
618064
|
});
|
|
617601
618065
|
|
|
617602
618066
|
// packages/cli/src/tui/dmn-engine.ts
|
|
617603
|
-
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";
|
|
617604
618068
|
import { join as join129, basename as basename30 } from "node:path";
|
|
617605
618069
|
function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
|
|
617606
618070
|
const competenceReport = competence.length > 0 ? competence.map((c8) => {
|
|
@@ -617708,7 +618172,7 @@ var init_dmn_engine = __esm({
|
|
|
617708
618172
|
this.repoRoot = repoRoot;
|
|
617709
618173
|
this.stateDir = join129(repoRoot, ".omnius", "dmn");
|
|
617710
618174
|
this.historyDir = join129(repoRoot, ".omnius", "dmn", "cycles");
|
|
617711
|
-
|
|
618175
|
+
mkdirSync66(this.historyDir, { recursive: true });
|
|
617712
618176
|
this.loadState();
|
|
617713
618177
|
}
|
|
617714
618178
|
config;
|
|
@@ -618372,7 +618836,7 @@ OUTPUT: Call task_complete with JSON:
|
|
|
618372
618836
|
}
|
|
618373
618837
|
saveState() {
|
|
618374
618838
|
try {
|
|
618375
|
-
|
|
618839
|
+
writeFileSync59(
|
|
618376
618840
|
join129(this.stateDir, "state.json"),
|
|
618377
618841
|
JSON.stringify(this.state, null, 2) + "\n",
|
|
618378
618842
|
"utf-8"
|
|
@@ -618383,23 +618847,62 @@ OUTPUT: Call task_complete with JSON:
|
|
|
618383
618847
|
saveCycleResult(result) {
|
|
618384
618848
|
try {
|
|
618385
618849
|
const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
|
|
618386
|
-
|
|
618850
|
+
writeFileSync59(
|
|
618387
618851
|
join129(this.historyDir, filename),
|
|
618388
618852
|
JSON.stringify(result, null, 2) + "\n",
|
|
618389
618853
|
"utf-8"
|
|
618390
618854
|
);
|
|
618391
|
-
|
|
618392
|
-
|
|
618393
|
-
|
|
618394
|
-
|
|
618395
|
-
|
|
618396
|
-
|
|
618397
|
-
|
|
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 {
|
|
618398
618886
|
}
|
|
618399
618887
|
}
|
|
618400
|
-
} catch {
|
|
618401
618888
|
}
|
|
618402
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
|
+
}
|
|
618403
618906
|
};
|
|
618404
618907
|
}
|
|
618405
618908
|
});
|
|
@@ -620175,11 +620678,11 @@ var init_telegram_stats_menu = __esm({
|
|
|
620175
620678
|
import { createCipheriv as createCipheriv4, createDecipheriv as createDecipheriv4, randomBytes as randomBytes23 } from "node:crypto";
|
|
620176
620679
|
import {
|
|
620177
620680
|
existsSync as existsSync117,
|
|
620178
|
-
mkdirSync as
|
|
620681
|
+
mkdirSync as mkdirSync67,
|
|
620179
620682
|
readFileSync as readFileSync95,
|
|
620180
620683
|
statSync as statSync42,
|
|
620181
620684
|
unlinkSync as unlinkSync22,
|
|
620182
|
-
writeFileSync as
|
|
620685
|
+
writeFileSync as writeFileSync60
|
|
620183
620686
|
} from "node:fs";
|
|
620184
620687
|
import { mkdir as mkdir19 } from "node:fs/promises";
|
|
620185
620688
|
import {
|
|
@@ -620196,7 +620699,7 @@ function telegramCreativeWorkspaceRoot(repoRoot, chatId) {
|
|
|
620196
620699
|
const raw = chatId === void 0 ? "unknown" : String(chatId);
|
|
620197
620700
|
const key = raw.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 96) || "unknown";
|
|
620198
620701
|
const root = join131(repoRoot, ".omnius", "telegram-creative", key);
|
|
620199
|
-
|
|
620702
|
+
mkdirSync67(root, { recursive: true });
|
|
620200
620703
|
return root;
|
|
620201
620704
|
}
|
|
620202
620705
|
function formatTelegramCreativeWorkspacePrompt(root) {
|
|
@@ -620348,8 +620851,8 @@ function scopedTool(base3, root, mode) {
|
|
|
620348
620851
|
if (mode === "edit" && !existsSync117(guarded.path.abs)) {
|
|
620349
620852
|
const materialized = materializeTelegramCreativeArtifactForSend(rootAbs, guarded.path.rel);
|
|
620350
620853
|
if (!materialized.ok) return denied(materialized.error);
|
|
620351
|
-
|
|
620352
|
-
|
|
620854
|
+
mkdirSync67(dirname37(guarded.path.abs), { recursive: true });
|
|
620855
|
+
writeFileSync60(guarded.path.abs, readFileSync95(materialized.path));
|
|
620353
620856
|
materialized.cleanup?.();
|
|
620354
620857
|
restoredEditPath = guarded.path.abs;
|
|
620355
620858
|
}
|
|
@@ -620437,10 +620940,10 @@ function manifestPath(root) {
|
|
|
620437
620940
|
return join131(root, MANIFEST_FILE);
|
|
620438
620941
|
}
|
|
620439
620942
|
function ensureManifest(root) {
|
|
620440
|
-
|
|
620943
|
+
mkdirSync67(root, { recursive: true });
|
|
620441
620944
|
const path12 = manifestPath(root);
|
|
620442
620945
|
if (!existsSync117(path12)) {
|
|
620443
|
-
|
|
620946
|
+
writeFileSync60(path12, JSON.stringify({ files: [], updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2) + "\n", "utf8");
|
|
620444
620947
|
}
|
|
620445
620948
|
}
|
|
620446
620949
|
function readManifest(root) {
|
|
@@ -620466,7 +620969,7 @@ function readManifest(root) {
|
|
|
620466
620969
|
}
|
|
620467
620970
|
function writeManifest(root, manifest) {
|
|
620468
620971
|
ensureManifest(root);
|
|
620469
|
-
|
|
620972
|
+
writeFileSync60(manifestPath(root), JSON.stringify(manifest, null, 2) + "\n", "utf8");
|
|
620470
620973
|
}
|
|
620471
620974
|
function manifestHas(root, relPath) {
|
|
620472
620975
|
const rel = relPath.replace(/\\/g, "/");
|
|
@@ -620490,7 +620993,7 @@ function rememberCreated(root, absPath) {
|
|
|
620490
620993
|
}
|
|
620491
620994
|
}
|
|
620492
620995
|
}
|
|
620493
|
-
|
|
620996
|
+
mkdirSync67(join131(root, OBJECTS_DIR), { recursive: true });
|
|
620494
620997
|
const data = readFileSync95(guarded.path.abs);
|
|
620495
620998
|
const prefix = randomBytes23(48);
|
|
620496
620999
|
const key = randomBytes23(32);
|
|
@@ -620500,7 +621003,7 @@ function rememberCreated(root, absPath) {
|
|
|
620500
621003
|
const tag = cipher.getAuthTag();
|
|
620501
621004
|
const storedRel = join131(OBJECTS_DIR, `${Date.now()}-${randomBytes23(12).toString("hex")}.blob`).replace(/\\/g, "/");
|
|
620502
621005
|
const storedAbs = join131(root, storedRel);
|
|
620503
|
-
|
|
621006
|
+
writeFileSync60(storedAbs, Buffer.concat([prefix, encrypted]));
|
|
620504
621007
|
try {
|
|
620505
621008
|
unlinkSync22(guarded.path.abs);
|
|
620506
621009
|
} catch {
|
|
@@ -620559,9 +621062,9 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
|
|
|
620559
621062
|
payload = Buffer.concat([decipher.update(payload), decipher.final()]);
|
|
620560
621063
|
}
|
|
620561
621064
|
const stageDir = join131(rootAbs, SEND_DIR, `${Date.now()}-${randomBytes23(8).toString("hex")}`);
|
|
620562
|
-
|
|
621065
|
+
mkdirSync67(stageDir, { recursive: true });
|
|
620563
621066
|
const staged = join131(stageDir, object.originalName || basename32(rel));
|
|
620564
|
-
|
|
621067
|
+
writeFileSync60(staged, payload);
|
|
620565
621068
|
return {
|
|
620566
621069
|
ok: true,
|
|
620567
621070
|
path: staged,
|
|
@@ -621228,7 +621731,7 @@ var init_soul_observations = __esm({
|
|
|
621228
621731
|
});
|
|
621229
621732
|
|
|
621230
621733
|
// packages/cli/src/tui/telegram-channel-dmn.ts
|
|
621231
|
-
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";
|
|
621232
621735
|
import { join as join132 } from "node:path";
|
|
621233
621736
|
import { createHash as createHash26 } from "node:crypto";
|
|
621234
621737
|
function safeFilePart(value2) {
|
|
@@ -621788,12 +622291,12 @@ ${artifact.personaContext}
|
|
|
621788
622291
|
}
|
|
621789
622292
|
function writeTelegramChannelDaydream(repoRoot, artifact) {
|
|
621790
622293
|
const dir = sessionDir(repoRoot, artifact.sessionKey);
|
|
621791
|
-
|
|
622294
|
+
mkdirSync68(dir, { recursive: true });
|
|
621792
622295
|
const base3 = `${artifact.generatedAt.replace(/[:.]/g, "-")}-${artifact.id}`;
|
|
621793
622296
|
const jsonPath = join132(dir, `${base3}.json`);
|
|
621794
622297
|
const markdownPath = join132(dir, `${base3}.md`);
|
|
621795
|
-
|
|
621796
|
-
|
|
622298
|
+
writeFileSync61(jsonPath, JSON.stringify(artifact, null, 2) + "\n", "utf8");
|
|
622299
|
+
writeFileSync61(markdownPath, formatTelegramChannelDaydreamMarkdown(artifact), "utf8");
|
|
621797
622300
|
return { dir, jsonPath, markdownPath };
|
|
621798
622301
|
}
|
|
621799
622302
|
function latestTelegramChannelDaydream(repoRoot, sessionKey) {
|
|
@@ -623546,7 +624049,7 @@ var init_vision_ingress = __esm({
|
|
|
623546
624049
|
});
|
|
623547
624050
|
|
|
623548
624051
|
// packages/cli/src/tui/telegram-bridge.ts
|
|
623549
|
-
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";
|
|
623550
624053
|
import { join as join134, resolve as resolve48, basename as basename33, relative as relative13, isAbsolute as isAbsolute8, extname as extname16 } from "node:path";
|
|
623551
624054
|
import { homedir as homedir43 } from "node:os";
|
|
623552
624055
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
@@ -626818,7 +627321,7 @@ ${message2}`)
|
|
|
626818
627321
|
appendTelegramConversationLedger(sessionKey, entry) {
|
|
626819
627322
|
if (!this.repoRoot) return;
|
|
626820
627323
|
try {
|
|
626821
|
-
|
|
627324
|
+
mkdirSync69(this.telegramConversationDir, { recursive: true });
|
|
626822
627325
|
appendFileSync10(
|
|
626823
627326
|
this.telegramConversationLedgerPath(sessionKey),
|
|
626824
627327
|
JSON.stringify({ sessionKey, ...entry }) + "\n",
|
|
@@ -627068,7 +627571,7 @@ ${mediaContext}` : ""
|
|
|
627068
627571
|
return null;
|
|
627069
627572
|
}
|
|
627070
627573
|
try {
|
|
627071
|
-
|
|
627574
|
+
mkdirSync69(resolve48(this.repoRoot, ".omnius"), { recursive: true });
|
|
627072
627575
|
const db = initDb(this.telegramSqlitePath);
|
|
627073
627576
|
db.exec(`
|
|
627074
627577
|
CREATE TABLE IF NOT EXISTS telegram_messages (
|
|
@@ -627790,7 +628293,7 @@ ${mediaContext}` : ""
|
|
|
627790
628293
|
saveTelegramConversationState(sessionKey) {
|
|
627791
628294
|
if (!this.repoRoot) return;
|
|
627792
628295
|
try {
|
|
627793
|
-
|
|
628296
|
+
mkdirSync69(this.telegramConversationDir, { recursive: true });
|
|
627794
628297
|
const participants = [...this.chatParticipants.get(sessionKey)?.values() ?? []].map((profile) => ({
|
|
627795
628298
|
...profile,
|
|
627796
628299
|
toneTags: [...profile.toneTags]
|
|
@@ -627807,7 +628310,7 @@ ${mediaContext}` : ""
|
|
|
627807
628310
|
stimulation: this.stimulation.getState(sessionKey),
|
|
627808
628311
|
reflection: this.channelReflectionState.get(sessionKey) ?? { autoFollowup: false }
|
|
627809
628312
|
};
|
|
627810
|
-
|
|
628313
|
+
writeFileSync63(this.telegramConversationPath(sessionKey), JSON.stringify(payload, null, 2) + "\n", "utf8");
|
|
627811
628314
|
} catch {
|
|
627812
628315
|
}
|
|
627813
628316
|
}
|
|
@@ -631126,7 +631629,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
631126
631629
|
this.startTelegramSubAgentWatchdog();
|
|
631127
631630
|
await this.prepareTelegramLongPolling();
|
|
631128
631631
|
try {
|
|
631129
|
-
|
|
631632
|
+
mkdirSync69(this.mediaCacheDir, { recursive: true });
|
|
631130
631633
|
} catch {
|
|
631131
631634
|
}
|
|
631132
631635
|
try {
|
|
@@ -631237,7 +631740,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
631237
631740
|
this.refreshActiveTelegramInteractionCount();
|
|
631238
631741
|
}
|
|
631239
631742
|
claimTelegramOwnerLock(lockDir, botUserId, botUsername) {
|
|
631240
|
-
|
|
631743
|
+
mkdirSync69(lockDir, { recursive: true });
|
|
631241
631744
|
const lockFile = join134(lockDir, `bot-${botUserId}.owner.lock`);
|
|
631242
631745
|
if (existsSync120(lockFile)) {
|
|
631243
631746
|
try {
|
|
@@ -631252,7 +631755,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
631252
631755
|
if (e2 instanceof Error && e2.message.startsWith("Telegram bot @")) throw e2;
|
|
631253
631756
|
}
|
|
631254
631757
|
}
|
|
631255
|
-
|
|
631758
|
+
writeFileSync63(
|
|
631256
631759
|
lockFile,
|
|
631257
631760
|
JSON.stringify({
|
|
631258
631761
|
pid: process.pid,
|
|
@@ -634071,8 +634574,8 @@ Scoped workspace: ${scopedRoot}`,
|
|
|
634071
634574
|
return join134(this.telegramToolButtonDir, `${safe}.json`);
|
|
634072
634575
|
}
|
|
634073
634576
|
writeTelegramToolButtonState(state) {
|
|
634074
|
-
|
|
634075
|
-
|
|
634577
|
+
mkdirSync69(this.telegramToolButtonDir, { recursive: true });
|
|
634578
|
+
writeFileSync63(this.telegramToolButtonPath(state.nonce), JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
634076
634579
|
}
|
|
634077
634580
|
readTelegramToolButtonState(nonce) {
|
|
634078
634581
|
try {
|
|
@@ -635959,9 +636462,9 @@ import {
|
|
|
635959
636462
|
existsSync as existsSync121,
|
|
635960
636463
|
readFileSync as readFileSync99,
|
|
635961
636464
|
readdirSync as readdirSync44,
|
|
635962
|
-
writeFileSync as
|
|
636465
|
+
writeFileSync as writeFileSync64,
|
|
635963
636466
|
renameSync as renameSync6,
|
|
635964
|
-
mkdirSync as
|
|
636467
|
+
mkdirSync as mkdirSync70,
|
|
635965
636468
|
unlinkSync as unlinkSync25,
|
|
635966
636469
|
appendFileSync as appendFileSync11
|
|
635967
636470
|
} from "node:fs";
|
|
@@ -635980,20 +636483,20 @@ function inFlightPath(id) {
|
|
|
635980
636483
|
}
|
|
635981
636484
|
function persistSession(s2) {
|
|
635982
636485
|
try {
|
|
635983
|
-
|
|
636486
|
+
mkdirSync70(sessionsDir(), { recursive: true });
|
|
635984
636487
|
const final2 = sessionPath(s2.id);
|
|
635985
636488
|
const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
|
|
635986
|
-
|
|
636489
|
+
writeFileSync64(tmp, JSON.stringify(s2, null, 2), "utf-8");
|
|
635987
636490
|
renameSync6(tmp, final2);
|
|
635988
636491
|
} catch {
|
|
635989
636492
|
}
|
|
635990
636493
|
}
|
|
635991
636494
|
function persistInFlight(j) {
|
|
635992
636495
|
try {
|
|
635993
|
-
|
|
636496
|
+
mkdirSync70(sessionsDir(), { recursive: true });
|
|
635994
636497
|
const final2 = inFlightPath(j.sessionId);
|
|
635995
636498
|
const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
|
|
635996
|
-
|
|
636499
|
+
writeFileSync64(tmp, JSON.stringify(j, null, 2), "utf-8");
|
|
635997
636500
|
renameSync6(tmp, final2);
|
|
635998
636501
|
} catch {
|
|
635999
636502
|
}
|
|
@@ -636025,7 +636528,7 @@ function loadPersistedSessions() {
|
|
|
636025
636528
|
parsed.error = "Daemon restart while subprocess was running";
|
|
636026
636529
|
parsed.completedAt = Date.now();
|
|
636027
636530
|
try {
|
|
636028
|
-
|
|
636531
|
+
writeFileSync64(fp, JSON.stringify(parsed, null, 2), "utf-8");
|
|
636029
636532
|
} catch {
|
|
636030
636533
|
}
|
|
636031
636534
|
report2.staleInFlight++;
|
|
@@ -636208,7 +636711,7 @@ function checkinPath(sessionId) {
|
|
|
636208
636711
|
}
|
|
636209
636712
|
function appendCheckin(sessionId, steering) {
|
|
636210
636713
|
try {
|
|
636211
|
-
|
|
636714
|
+
mkdirSync70(sessionsDir(), { recursive: true });
|
|
636212
636715
|
const fp = checkinPath(sessionId);
|
|
636213
636716
|
const entry = JSON.stringify({ ts: Date.now(), steering }) + "\n";
|
|
636214
636717
|
appendFileSync11(fp, entry, "utf-8");
|
|
@@ -636606,7 +637109,7 @@ __export(projects_exports, {
|
|
|
636606
637109
|
setCurrentProject: () => setCurrentProject,
|
|
636607
637110
|
unregisterProject: () => unregisterProject
|
|
636608
637111
|
});
|
|
636609
|
-
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";
|
|
636610
637113
|
import { homedir as homedir45 } from "node:os";
|
|
636611
637114
|
import { basename as basename34, join as join136, resolve as resolve49 } from "node:path";
|
|
636612
637115
|
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
@@ -636622,9 +637125,9 @@ function readAll2() {
|
|
|
636622
637125
|
}
|
|
636623
637126
|
}
|
|
636624
637127
|
function writeAll(file) {
|
|
636625
|
-
|
|
637128
|
+
mkdirSync71(OMNIUS_DIR3, { recursive: true });
|
|
636626
637129
|
const tmp = `${PROJECTS_FILE}.${randomUUID15().slice(0, 8)}.tmp`;
|
|
636627
|
-
|
|
637130
|
+
writeFileSync65(tmp, JSON.stringify(file, null, 2), "utf8");
|
|
636628
637131
|
renameSync7(tmp, PROJECTS_FILE);
|
|
636629
637132
|
}
|
|
636630
637133
|
function listProjects() {
|
|
@@ -636706,8 +637209,8 @@ function setCurrentProject(root) {
|
|
|
636706
637209
|
if (!entry) return null;
|
|
636707
637210
|
currentRoot = canonical;
|
|
636708
637211
|
try {
|
|
636709
|
-
|
|
636710
|
-
|
|
637212
|
+
mkdirSync71(OMNIUS_DIR3, { recursive: true });
|
|
637213
|
+
writeFileSync65(CURRENT_FILE, `${canonical}
|
|
636711
637214
|
`, "utf8");
|
|
636712
637215
|
} catch {
|
|
636713
637216
|
}
|
|
@@ -637597,7 +638100,7 @@ var init_access_policy = __esm({
|
|
|
637597
638100
|
|
|
637598
638101
|
// packages/cli/src/api/project-preferences.ts
|
|
637599
638102
|
import { createHash as createHash30 } from "node:crypto";
|
|
637600
|
-
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";
|
|
637601
638104
|
import { homedir as homedir46 } from "node:os";
|
|
637602
638105
|
import { join as join137, resolve as resolve50 } from "node:path";
|
|
637603
638106
|
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
@@ -637616,11 +638119,11 @@ function rootSentinelPath(root) {
|
|
|
637616
638119
|
}
|
|
637617
638120
|
function ensureDir(root) {
|
|
637618
638121
|
const dir = projectDir(root);
|
|
637619
|
-
|
|
638122
|
+
mkdirSync72(dir, { recursive: true });
|
|
637620
638123
|
const sentinel = rootSentinelPath(root);
|
|
637621
638124
|
try {
|
|
637622
638125
|
if (!existsSync123(sentinel)) {
|
|
637623
|
-
|
|
638126
|
+
writeFileSync66(sentinel, `${resolve50(root)}
|
|
637624
638127
|
`, "utf8");
|
|
637625
638128
|
}
|
|
637626
638129
|
} catch {
|
|
@@ -637649,12 +638152,12 @@ function writeProjectPreferences(root, partial) {
|
|
|
637649
638152
|
};
|
|
637650
638153
|
const file = prefsPath(root);
|
|
637651
638154
|
const tmp = `${file}.${randomUUID16().slice(0, 8)}.tmp`;
|
|
637652
|
-
|
|
638155
|
+
writeFileSync66(tmp, JSON.stringify(merged, null, 2), "utf8");
|
|
637653
638156
|
try {
|
|
637654
638157
|
renameSync8(tmp, file);
|
|
637655
638158
|
} catch (err) {
|
|
637656
638159
|
try {
|
|
637657
|
-
|
|
638160
|
+
writeFileSync66(file, JSON.stringify(merged, null, 2), "utf8");
|
|
637658
638161
|
} catch {
|
|
637659
638162
|
}
|
|
637660
638163
|
try {
|
|
@@ -638581,13 +639084,13 @@ __export(audit_log_exports, {
|
|
|
638581
639084
|
recordAudit: () => recordAudit,
|
|
638582
639085
|
sanitizeBody: () => sanitizeBody
|
|
638583
639086
|
});
|
|
638584
|
-
import { mkdirSync as
|
|
639087
|
+
import { mkdirSync as mkdirSync73, appendFileSync as appendFileSync12, readFileSync as readFileSync102, existsSync as existsSync124 } from "node:fs";
|
|
638585
639088
|
import { join as join138 } from "node:path";
|
|
638586
639089
|
function initAuditLog(omniusDir) {
|
|
638587
639090
|
auditDir = join138(omniusDir, "audit");
|
|
638588
639091
|
auditFile = join138(auditDir, "audit.jsonl");
|
|
638589
639092
|
try {
|
|
638590
|
-
|
|
639093
|
+
mkdirSync73(auditDir, { recursive: true });
|
|
638591
639094
|
initialized = true;
|
|
638592
639095
|
} catch {
|
|
638593
639096
|
}
|
|
@@ -638655,7 +639158,7 @@ var init_audit_log = __esm({
|
|
|
638655
639158
|
|
|
638656
639159
|
// packages/cli/src/api/disk-task-output.ts
|
|
638657
639160
|
import { open } from "node:fs/promises";
|
|
638658
|
-
import { existsSync as existsSync125, mkdirSync as
|
|
639161
|
+
import { existsSync as existsSync125, mkdirSync as mkdirSync74, statSync as statSync45 } from "node:fs";
|
|
638659
639162
|
import { dirname as dirname39 } from "node:path";
|
|
638660
639163
|
import * as fsConstants from "node:constants";
|
|
638661
639164
|
var O_NOFOLLOW2, O_APPEND2, O_CREAT2, O_WRONLY2, OPEN_FLAGS_WRITE, OPEN_MODE, DiskTaskOutput;
|
|
@@ -638675,7 +639178,7 @@ var init_disk_task_output = __esm({
|
|
|
638675
639178
|
fileSize = 0;
|
|
638676
639179
|
constructor(outputPath3) {
|
|
638677
639180
|
this.path = outputPath3;
|
|
638678
|
-
|
|
639181
|
+
mkdirSync74(dirname39(outputPath3), { recursive: true });
|
|
638679
639182
|
}
|
|
638680
639183
|
/** Queue content for async append. Non-blocking. */
|
|
638681
639184
|
append(chunk) {
|
|
@@ -639740,13 +640243,13 @@ __export(runtime_keys_exports, {
|
|
|
639740
640243
|
mintKey: () => mintKey,
|
|
639741
640244
|
revokeByPrefix: () => revokeByPrefix
|
|
639742
640245
|
});
|
|
639743
|
-
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";
|
|
639744
640247
|
import { join as join140 } from "node:path";
|
|
639745
640248
|
import { homedir as homedir48 } from "node:os";
|
|
639746
640249
|
import { randomBytes as randomBytes25 } from "node:crypto";
|
|
639747
640250
|
function ensureDir2() {
|
|
639748
640251
|
const dir = join140(homedir48(), ".omnius");
|
|
639749
|
-
if (!existsSync127(dir))
|
|
640252
|
+
if (!existsSync127(dir)) mkdirSync75(dir, { recursive: true });
|
|
639750
640253
|
}
|
|
639751
640254
|
function loadAll() {
|
|
639752
640255
|
if (!existsSync127(KEYS_FILE)) return [];
|
|
@@ -639761,7 +640264,7 @@ function loadAll() {
|
|
|
639761
640264
|
}
|
|
639762
640265
|
function persistAll(records) {
|
|
639763
640266
|
ensureDir2();
|
|
639764
|
-
|
|
640267
|
+
writeFileSync67(KEYS_FILE, JSON.stringify(records, null, 2), "utf-8");
|
|
639765
640268
|
try {
|
|
639766
640269
|
chmodSync3(KEYS_FILE, 384);
|
|
639767
640270
|
} catch {
|
|
@@ -639995,7 +640498,7 @@ __export(graphical_sudo_exports, {
|
|
|
639995
640498
|
runGraphicalSudo: () => runGraphicalSudo
|
|
639996
640499
|
});
|
|
639997
640500
|
import { spawn as spawn30 } from "node:child_process";
|
|
639998
|
-
import { existsSync as existsSync129, mkdirSync as
|
|
640501
|
+
import { existsSync as existsSync129, mkdirSync as mkdirSync76, writeFileSync as writeFileSync68, chmodSync as chmodSync4 } from "node:fs";
|
|
639999
640502
|
import { join as join142 } from "node:path";
|
|
640000
640503
|
import { tmpdir as tmpdir21 } from "node:os";
|
|
640001
640504
|
function detectSudoHelper() {
|
|
@@ -640019,7 +640522,7 @@ function which2(cmd) {
|
|
|
640019
640522
|
}
|
|
640020
640523
|
function ensureAskpassShim(helper, description) {
|
|
640021
640524
|
const shimDir = join142(tmpdir21(), "omnius-askpass");
|
|
640022
|
-
|
|
640525
|
+
mkdirSync76(shimDir, { recursive: true });
|
|
640023
640526
|
const shim = join142(shimDir, `${helper}.sh`);
|
|
640024
640527
|
let body;
|
|
640025
640528
|
if (helper === "zenity") {
|
|
@@ -640031,7 +640534,7 @@ exec zenity --password --title="Omnius needs sudo" --text="${description.replace
|
|
|
640031
640534
|
exec kdialog --password "${description.replace(/"/g, '\\"')}" 2>/dev/null
|
|
640032
640535
|
`;
|
|
640033
640536
|
}
|
|
640034
|
-
|
|
640537
|
+
writeFileSync68(shim, body, "utf-8");
|
|
640035
640538
|
chmodSync4(shim, 493);
|
|
640036
640539
|
return shim;
|
|
640037
640540
|
}
|
|
@@ -642622,8 +643125,8 @@ function readAimsFile(name10, fallback) {
|
|
|
642622
643125
|
}
|
|
642623
643126
|
function writeAimsFile(name10, data) {
|
|
642624
643127
|
const dir = aimsDir();
|
|
642625
|
-
const { mkdirSync:
|
|
642626
|
-
|
|
643128
|
+
const { mkdirSync: mkdirSync85, writeFileSync: wf, renameSync: rn } = __require("node:fs");
|
|
643129
|
+
mkdirSync85(dir, { recursive: true });
|
|
642627
643130
|
const finalPath = join143(dir, name10);
|
|
642628
643131
|
const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
|
|
642629
643132
|
try {
|
|
@@ -652460,11 +652963,11 @@ var init_auth_oidc = __esm({
|
|
|
652460
652963
|
});
|
|
652461
652964
|
|
|
652462
652965
|
// packages/cli/src/api/usage-tracker.ts
|
|
652463
|
-
import { mkdirSync as
|
|
652966
|
+
import { mkdirSync as mkdirSync77, readFileSync as readFileSync107, writeFileSync as writeFileSync69, existsSync as existsSync131 } from "node:fs";
|
|
652464
652967
|
import { join as join144 } from "node:path";
|
|
652465
652968
|
function initUsageTracker(omniusDir) {
|
|
652466
652969
|
const dir = join144(omniusDir, "usage");
|
|
652467
|
-
|
|
652970
|
+
mkdirSync77(dir, { recursive: true });
|
|
652468
652971
|
usageFile = join144(dir, "token-usage.json");
|
|
652469
652972
|
try {
|
|
652470
652973
|
if (existsSync131(usageFile)) {
|
|
@@ -652504,7 +653007,7 @@ function flush2() {
|
|
|
652504
653007
|
if (!initialized2 || !dirty) return;
|
|
652505
653008
|
try {
|
|
652506
653009
|
store.lastSaved = (/* @__PURE__ */ new Date()).toISOString();
|
|
652507
|
-
|
|
653010
|
+
writeFileSync69(usageFile, JSON.stringify(store, null, 2), "utf-8");
|
|
652508
653011
|
dirty = false;
|
|
652509
653012
|
} catch {
|
|
652510
653013
|
}
|
|
@@ -652532,7 +653035,7 @@ var init_usage_tracker = __esm({
|
|
|
652532
653035
|
});
|
|
652533
653036
|
|
|
652534
653037
|
// packages/cli/src/api/profiles.ts
|
|
652535
|
-
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";
|
|
652536
653039
|
import { join as join145 } from "node:path";
|
|
652537
653040
|
import { homedir as homedir51 } from "node:os";
|
|
652538
653041
|
import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv5, randomBytes as randomBytes26, scryptSync as scryptSync3 } from "node:crypto";
|
|
@@ -652596,16 +653099,16 @@ function loadProfile(name10, password, projectDir2) {
|
|
|
652596
653099
|
}
|
|
652597
653100
|
function saveProfile(profile, password, scope = "global", projectDir2) {
|
|
652598
653101
|
const dir = scope === "project" ? projectProfileDir(projectDir2) : globalProfileDir();
|
|
652599
|
-
|
|
653102
|
+
mkdirSync78(dir, { recursive: true });
|
|
652600
653103
|
const sanitized = profile.name.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
652601
653104
|
const filePath = join145(dir, `${sanitized}.json`);
|
|
652602
653105
|
profile.modified = (/* @__PURE__ */ new Date()).toISOString();
|
|
652603
653106
|
if (password) {
|
|
652604
653107
|
const encrypted = encryptProfile(profile, password);
|
|
652605
|
-
|
|
653108
|
+
writeFileSync70(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
|
|
652606
653109
|
} else {
|
|
652607
653110
|
profile.encrypted = false;
|
|
652608
|
-
|
|
653111
|
+
writeFileSync70(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
|
|
652609
653112
|
}
|
|
652610
653113
|
}
|
|
652611
653114
|
function deleteProfile(name10, scope = "global", projectDir2) {
|
|
@@ -652789,7 +653292,7 @@ var init_profiles = __esm({
|
|
|
652789
653292
|
|
|
652790
653293
|
// packages/cli/src/docker.ts
|
|
652791
653294
|
import { execSync as execSync57, spawn as spawn31 } from "node:child_process";
|
|
652792
|
-
import { existsSync as existsSync133, mkdirSync as
|
|
653295
|
+
import { existsSync as existsSync133, mkdirSync as mkdirSync79, writeFileSync as writeFileSync71 } from "node:fs";
|
|
652793
653296
|
import { join as join146, resolve as resolve51, dirname as dirname40 } from "node:path";
|
|
652794
653297
|
import { homedir as homedir52 } from "node:os";
|
|
652795
653298
|
import { fileURLToPath as fileURLToPath18 } from "node:url";
|
|
@@ -652940,7 +653443,7 @@ async function ensureOmniusImage(force = false) {
|
|
|
652940
653443
|
buildContext = dockerDir;
|
|
652941
653444
|
} else {
|
|
652942
653445
|
buildContext = join146(homedir52(), ".omnius", "docker-build");
|
|
652943
|
-
|
|
653446
|
+
mkdirSync79(buildContext, { recursive: true });
|
|
652944
653447
|
writeDockerfiles(buildContext);
|
|
652945
653448
|
}
|
|
652946
653449
|
try {
|
|
@@ -653014,8 +653517,8 @@ chown -R node:node /workspace /home/node/.omnius 2>/dev/null || true
|
|
|
653014
653517
|
if [ "$1" = "omnius" ]; then shift; exec su - node -c "cd /workspace && omnius $*"; fi
|
|
653015
653518
|
exec "$@"
|
|
653016
653519
|
`;
|
|
653017
|
-
|
|
653018
|
-
|
|
653520
|
+
writeFileSync71(join146(dir, "Dockerfile"), dockerfile);
|
|
653521
|
+
writeFileSync71(join146(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
|
|
653019
653522
|
}
|
|
653020
653523
|
function hasNvidiaGpu() {
|
|
653021
653524
|
try {
|
|
@@ -653273,7 +653776,7 @@ import { fileURLToPath as fileURLToPath19 } from "node:url";
|
|
|
653273
653776
|
import { dirname as dirname41, join as join148, resolve as resolve52 } from "node:path";
|
|
653274
653777
|
import { homedir as homedir53 } from "node:os";
|
|
653275
653778
|
import { spawn as spawn32, execSync as execSync58 } from "node:child_process";
|
|
653276
|
-
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";
|
|
653277
653780
|
import { randomBytes as randomBytes27, randomUUID as randomUUID17 } from "node:crypto";
|
|
653278
653781
|
import { createHash as createHash33 } from "node:crypto";
|
|
653279
653782
|
function memoryDbPaths3(baseDir = process.cwd()) {
|
|
@@ -654048,7 +654551,7 @@ function ollamaStream(ollamaUrl, path12, method, body, onData, onEnd, onError, t
|
|
|
654048
654551
|
function jobsDir() {
|
|
654049
654552
|
const root = resolve52(process.cwd());
|
|
654050
654553
|
const dir = join148(root, ".omnius", "jobs");
|
|
654051
|
-
|
|
654554
|
+
mkdirSync80(dir, { recursive: true });
|
|
654052
654555
|
return dir;
|
|
654053
654556
|
}
|
|
654054
654557
|
function loadJob(id) {
|
|
@@ -654393,11 +654896,11 @@ function atomicJobWrite(dir, id, job) {
|
|
|
654393
654896
|
const finalPath = join148(dir, `${id}.json`);
|
|
654394
654897
|
const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
|
|
654395
654898
|
try {
|
|
654396
|
-
|
|
654899
|
+
writeFileSync72(tmpPath, JSON.stringify(job, null, 2), "utf-8");
|
|
654397
654900
|
renameSync9(tmpPath, finalPath);
|
|
654398
654901
|
} catch {
|
|
654399
654902
|
try {
|
|
654400
|
-
|
|
654903
|
+
writeFileSync72(finalPath, JSON.stringify(job, null, 2), "utf-8");
|
|
654401
654904
|
} catch {
|
|
654402
654905
|
}
|
|
654403
654906
|
try {
|
|
@@ -655880,10 +656383,10 @@ function readUpdateState() {
|
|
|
655880
656383
|
function writeUpdateState(state) {
|
|
655881
656384
|
try {
|
|
655882
656385
|
const dir = join148(homedir53(), ".omnius");
|
|
655883
|
-
|
|
656386
|
+
mkdirSync80(dir, { recursive: true });
|
|
655884
656387
|
const finalPath = updateStateFile();
|
|
655885
656388
|
const tmpPath = `${finalPath}.tmp.${process.pid}`;
|
|
655886
|
-
|
|
656389
|
+
writeFileSync72(tmpPath, JSON.stringify(state, null, 2), "utf-8");
|
|
655887
656390
|
renameSync9(tmpPath, finalPath);
|
|
655888
656391
|
} catch {
|
|
655889
656392
|
}
|
|
@@ -656184,7 +656687,7 @@ async function handleV1Run(req2, res) {
|
|
|
656184
656687
|
cwd4 = resolve52(workingDir);
|
|
656185
656688
|
} else if (isolate) {
|
|
656186
656689
|
const wsDir = join148(dir, "..", "workspaces", id);
|
|
656187
|
-
|
|
656690
|
+
mkdirSync80(wsDir, { recursive: true });
|
|
656188
656691
|
cwd4 = wsDir;
|
|
656189
656692
|
} else {
|
|
656190
656693
|
cwd4 = resolve52(process.cwd());
|
|
@@ -657492,10 +657995,10 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
657492
657995
|
return;
|
|
657493
657996
|
}
|
|
657494
657997
|
const { tmpdir: tmpdir23 } = await import("node:os");
|
|
657495
|
-
const { writeFileSync:
|
|
657998
|
+
const { writeFileSync: writeFileSync77, unlinkSync: unlinkSync29 } = await import("node:fs");
|
|
657496
657999
|
const { join: pjoin } = await import("node:path");
|
|
657497
658000
|
const tmpPath = pjoin(tmpdir23(), `omnius-clone-upload-${Date.now()}-${safeName3}`);
|
|
657498
|
-
|
|
658001
|
+
writeFileSync77(tmpPath, buf);
|
|
657499
658002
|
try {
|
|
657500
658003
|
const ve = getVoiceEngine();
|
|
657501
658004
|
const msg = await ve.setCloneVoice(tmpPath);
|
|
@@ -658087,7 +658590,7 @@ data: ${JSON.stringify(data)}
|
|
|
658087
658590
|
}
|
|
658088
658591
|
for (const f2 of seenFiles) {
|
|
658089
658592
|
try {
|
|
658090
|
-
|
|
658593
|
+
writeFileSync72(f2, JSON.stringify({ tasks: [] }, null, 2));
|
|
658091
658594
|
deleted++;
|
|
658092
658595
|
} catch {
|
|
658093
658596
|
}
|
|
@@ -659301,11 +659804,11 @@ function setScheduledEnabled(id, enabled2) {
|
|
|
659301
659804
|
arr[target.index].enabled = enabled2;
|
|
659302
659805
|
if (Array.isArray(json?.tasks)) {
|
|
659303
659806
|
json.tasks = arr;
|
|
659304
|
-
|
|
659807
|
+
writeFileSync72(target.file, JSON.stringify(json, null, 2));
|
|
659305
659808
|
} else if (Array.isArray(json)) {
|
|
659306
|
-
|
|
659809
|
+
writeFileSync72(target.file, JSON.stringify(arr, null, 2));
|
|
659307
659810
|
} else {
|
|
659308
|
-
|
|
659811
|
+
writeFileSync72(target.file, JSON.stringify({ tasks: arr }, null, 2));
|
|
659309
659812
|
}
|
|
659310
659813
|
if (!enabled2) {
|
|
659311
659814
|
try {
|
|
@@ -659335,11 +659838,11 @@ function deleteScheduledById(id) {
|
|
|
659335
659838
|
arr.splice(target.index, 1);
|
|
659336
659839
|
if (Array.isArray(json?.tasks)) {
|
|
659337
659840
|
json.tasks = arr;
|
|
659338
|
-
|
|
659841
|
+
writeFileSync72(target.file, JSON.stringify(json, null, 2));
|
|
659339
659842
|
} else if (Array.isArray(json)) {
|
|
659340
|
-
|
|
659843
|
+
writeFileSync72(target.file, JSON.stringify(arr, null, 2));
|
|
659341
659844
|
} else {
|
|
659342
|
-
|
|
659845
|
+
writeFileSync72(target.file, JSON.stringify({ tasks: arr }, null, 2));
|
|
659343
659846
|
}
|
|
659344
659847
|
const candidates = [];
|
|
659345
659848
|
if (id) candidates.push(id);
|
|
@@ -659607,9 +660110,9 @@ function reconcileScheduledTasks(apply) {
|
|
|
659607
660110
|
const entry = { task: f2.task || `legacy ${f2.id}`, schedule: f2.cron, enabled: true };
|
|
659608
660111
|
arr.push(entry);
|
|
659609
660112
|
const toWrite = Array.isArray(json?.tasks) ? { ...json, tasks: arr } : Array.isArray(json) ? arr : { tasks: arr };
|
|
659610
|
-
|
|
659611
|
-
|
|
659612
|
-
|
|
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));
|
|
659613
660116
|
adopted.push({ file, index: arr.length - 1 });
|
|
659614
660117
|
}
|
|
659615
660118
|
} else {
|
|
@@ -659742,9 +660245,9 @@ Persistent=true
|
|
|
659742
660245
|
WantedBy=timers.target
|
|
659743
660246
|
`;
|
|
659744
660247
|
if (!dryRun) {
|
|
659745
|
-
|
|
659746
|
-
|
|
659747
|
-
|
|
660248
|
+
mkdirSync80(unitDir, { recursive: true });
|
|
660249
|
+
writeFileSync72(svc, svcText);
|
|
660250
|
+
writeFileSync72(tim, timText);
|
|
659748
660251
|
try {
|
|
659749
660252
|
const { execSync: es } = require4("node:child_process");
|
|
659750
660253
|
es("systemctl --user daemon-reload", { stdio: "pipe" });
|
|
@@ -659888,7 +660391,7 @@ function startApiServer(options2 = {}) {
|
|
|
659888
660391
|
if (!apiTestMode) try {
|
|
659889
660392
|
const dir = todoDir();
|
|
659890
660393
|
try {
|
|
659891
|
-
|
|
660394
|
+
mkdirSync80(dir, { recursive: true });
|
|
659892
660395
|
} catch {
|
|
659893
660396
|
}
|
|
659894
660397
|
const cache8 = /* @__PURE__ */ new Map();
|
|
@@ -660066,8 +660569,8 @@ function startApiServer(options2 = {}) {
|
|
|
660066
660569
|
runtimeAccessMode = requested;
|
|
660067
660570
|
try {
|
|
660068
660571
|
const dir = join148(homedir53(), ".omnius");
|
|
660069
|
-
|
|
660070
|
-
|
|
660572
|
+
mkdirSync80(dir, { recursive: true });
|
|
660573
|
+
writeFileSync72(join148(dir, "access"), `${runtimeAccessMode}
|
|
660071
660574
|
`, "utf8");
|
|
660072
660575
|
} catch {
|
|
660073
660576
|
}
|
|
@@ -660369,7 +660872,7 @@ function startApiServer(options2 = {}) {
|
|
|
660369
660872
|
return;
|
|
660370
660873
|
}
|
|
660371
660874
|
try {
|
|
660372
|
-
const { writeFileSync:
|
|
660875
|
+
const { writeFileSync: writeFileSync77, mkdirSync: mkdirSync85, existsSync: _exists, readFileSync: _rfs } = require4("node:fs");
|
|
660373
660876
|
const { join: _join } = require4("node:path");
|
|
660374
660877
|
const { homedir: _homedir } = require4("node:os");
|
|
660375
660878
|
const apiHint = JSON.stringify({
|
|
@@ -660398,8 +660901,8 @@ function startApiServer(options2 = {}) {
|
|
|
660398
660901
|
let written = 0;
|
|
660399
660902
|
for (const dir of dirSet) {
|
|
660400
660903
|
try {
|
|
660401
|
-
if (!_exists(dir))
|
|
660402
|
-
|
|
660904
|
+
if (!_exists(dir)) mkdirSync85(dir, { recursive: true });
|
|
660905
|
+
writeFileSync77(_join(dir, "api-port.json"), apiHint);
|
|
660403
660906
|
written++;
|
|
660404
660907
|
} catch {
|
|
660405
660908
|
}
|
|
@@ -660683,9 +661186,9 @@ async function handleChatAttachmentUpload(req2, res) {
|
|
|
660683
661186
|
}
|
|
660684
661187
|
const safeName3 = filename.replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 180) || `attachment-${Date.now()}.bin`;
|
|
660685
661188
|
const dir = join148(process.cwd(), ".omnius", "gui-attachments");
|
|
660686
|
-
|
|
661189
|
+
mkdirSync80(dir, { recursive: true });
|
|
660687
661190
|
const localPath = join148(dir, `${Date.now()}-${randomUUID17().slice(0, 8)}-${safeName3}`);
|
|
660688
|
-
|
|
661191
|
+
writeFileSync72(localPath, Buffer.from(base642, "base64"));
|
|
660689
661192
|
const mimeType = typeof b.mimeType === "string" ? b.mimeType : typeof b.mime_type === "string" ? b.mime_type : "";
|
|
660690
661193
|
const isImage = mimeType.toLowerCase().startsWith("image/") || /\.(png|jpe?g|gif|webp|bmp|tiff?)$/i.test(safeName3);
|
|
660691
661194
|
const sessionId = typeof b.sessionId === "string" ? b.sessionId : typeof b.session_id === "string" ? b.session_id : void 0;
|
|
@@ -661053,15 +661556,15 @@ __export(clipboard_media_exports, {
|
|
|
661053
661556
|
pasteClipboardImageToFile: () => pasteClipboardImageToFile
|
|
661054
661557
|
});
|
|
661055
661558
|
import { execFileSync as execFileSync8, execSync as execSync59 } from "node:child_process";
|
|
661056
|
-
import { mkdirSync as
|
|
661559
|
+
import { mkdirSync as mkdirSync81, readFileSync as readFileSync110, rmSync as rmSync6, writeFileSync as writeFileSync73 } from "node:fs";
|
|
661057
661560
|
import { join as join149 } from "node:path";
|
|
661058
661561
|
function pasteClipboardImageToFile(repoRoot) {
|
|
661059
661562
|
const image = readClipboardImage();
|
|
661060
661563
|
if (!image) return null;
|
|
661061
661564
|
const dir = join149(repoRoot, ".omnius", "clipboard");
|
|
661062
|
-
|
|
661565
|
+
mkdirSync81(dir, { recursive: true });
|
|
661063
661566
|
const path12 = join149(dir, `clipboard-${Date.now()}${image.ext}`);
|
|
661064
|
-
|
|
661567
|
+
writeFileSync73(path12, image.buffer);
|
|
661065
661568
|
return { path: path12, buffer: image.buffer, mime: image.mime };
|
|
661066
661569
|
}
|
|
661067
661570
|
function readClipboardImage() {
|
|
@@ -661130,11 +661633,11 @@ import { createRequire as createRequire8 } from "node:module";
|
|
|
661130
661633
|
import { fileURLToPath as fileURLToPath20 } from "node:url";
|
|
661131
661634
|
import {
|
|
661132
661635
|
readFileSync as readFileSync111,
|
|
661133
|
-
writeFileSync as
|
|
661636
|
+
writeFileSync as writeFileSync74,
|
|
661134
661637
|
appendFileSync as appendFileSync13,
|
|
661135
661638
|
rmSync as rmSync7,
|
|
661136
661639
|
readdirSync as readdirSync49,
|
|
661137
|
-
mkdirSync as
|
|
661640
|
+
mkdirSync as mkdirSync82
|
|
661138
661641
|
} from "node:fs";
|
|
661139
661642
|
import { existsSync as existsSync135 } from "node:fs";
|
|
661140
661643
|
import { execSync as execSync60 } from "node:child_process";
|
|
@@ -663975,7 +664478,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
663975
664478
|
if (existsSync135(ikFile)) {
|
|
663976
664479
|
ikState = JSON.parse(readFileSync111(ikFile, "utf8"));
|
|
663977
664480
|
} else {
|
|
663978
|
-
|
|
664481
|
+
mkdirSync82(ikDir, { recursive: true });
|
|
663979
664482
|
const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
|
|
663980
664483
|
ikState = {
|
|
663981
664484
|
self_id: `omnius-${machineId}`,
|
|
@@ -664085,7 +664588,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
664085
664588
|
}
|
|
664086
664589
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
664087
664590
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
664088
|
-
|
|
664591
|
+
writeFileSync74(ikFile, JSON.stringify(ikState, null, 2));
|
|
664089
664592
|
} catch (ikErr) {
|
|
664090
664593
|
try {
|
|
664091
664594
|
console.error("[IK-OBSERVE]", ikErr);
|
|
@@ -664141,7 +664644,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
664141
664644
|
ikState.version_history = ikState.version_history.slice(-200);
|
|
664142
664645
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
664143
664646
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
664144
|
-
|
|
664647
|
+
writeFileSync74(ikFile, JSON.stringify(ikState, null, 2));
|
|
664145
664648
|
}
|
|
664146
664649
|
} catch {
|
|
664147
664650
|
}
|
|
@@ -665739,12 +666242,12 @@ This is an independent background session started from /background.`
|
|
|
665739
666242
|
function persistHistoryLine(line) {
|
|
665740
666243
|
if (!line.trim()) return;
|
|
665741
666244
|
try {
|
|
665742
|
-
|
|
666245
|
+
mkdirSync82(HISTORY_DIR, { recursive: true });
|
|
665743
666246
|
appendFileSync13(HISTORY_FILE, line + "\n", "utf8");
|
|
665744
666247
|
if (Math.random() < 0.02) {
|
|
665745
666248
|
const all2 = readFileSync111(HISTORY_FILE, "utf8").trim().split("\n");
|
|
665746
666249
|
if (all2.length > MAX_HISTORY_LINES) {
|
|
665747
|
-
|
|
666250
|
+
writeFileSync74(
|
|
665748
666251
|
HISTORY_FILE,
|
|
665749
666252
|
all2.slice(-MAX_HISTORY_LINES).join("\n") + "\n",
|
|
665750
666253
|
"utf8"
|
|
@@ -666648,8 +667151,8 @@ Log: ${nexusLogPath}`)
|
|
|
666648
667151
|
setSessionTitle(title) {
|
|
666649
667152
|
sessionTitle = title.trim() || null;
|
|
666650
667153
|
try {
|
|
666651
|
-
|
|
666652
|
-
|
|
667154
|
+
mkdirSync82(join150(repoRoot, ".omnius"), { recursive: true });
|
|
667155
|
+
writeFileSync74(join150(repoRoot, ".omnius", "session-title"), `${sessionTitle ?? ""}
|
|
666653
667156
|
`, "utf8");
|
|
666654
667157
|
} catch {
|
|
666655
667158
|
}
|
|
@@ -669723,7 +670226,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
669723
670226
|
if (existsSync135(ikFile)) {
|
|
669724
670227
|
ikState = JSON.parse(readFileSync111(ikFile, "utf8"));
|
|
669725
670228
|
} else {
|
|
669726
|
-
|
|
670229
|
+
mkdirSync82(ikDir, { recursive: true });
|
|
669727
670230
|
ikState = {
|
|
669728
670231
|
self_id: `omnius-${Date.now().toString(36)}`,
|
|
669729
670232
|
version: 1,
|
|
@@ -669776,7 +670279,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
669776
670279
|
);
|
|
669777
670280
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
669778
670281
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
669779
|
-
|
|
670282
|
+
writeFileSync74(ikFile, JSON.stringify(ikState, null, 2));
|
|
669780
670283
|
} catch (ikErr) {
|
|
669781
670284
|
}
|
|
669782
670285
|
try {
|
|
@@ -669808,8 +670311,8 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
669808
670311
|
tags: ["general"]
|
|
669809
670312
|
});
|
|
669810
670313
|
if (variants.length > 50) variants = variants.slice(-50);
|
|
669811
|
-
|
|
669812
|
-
|
|
670314
|
+
mkdirSync82(archeDir, { recursive: true });
|
|
670315
|
+
writeFileSync74(archeFile, JSON.stringify(variants, null, 2));
|
|
669813
670316
|
} catch {
|
|
669814
670317
|
}
|
|
669815
670318
|
}
|
|
@@ -669840,7 +670343,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
669840
670343
|
updated = true;
|
|
669841
670344
|
}
|
|
669842
670345
|
if (updated) {
|
|
669843
|
-
|
|
670346
|
+
writeFileSync74(metaFile2, JSON.stringify(store2, null, 2));
|
|
669844
670347
|
}
|
|
669845
670348
|
}
|
|
669846
670349
|
} catch {
|
|
@@ -669899,7 +670402,7 @@ Rules:
|
|
|
669899
670402
|
const { initDb: initDb2 } = __require("@omnius/memory");
|
|
669900
670403
|
const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@omnius/memory");
|
|
669901
670404
|
const dbDir = join150(repoRoot, ".omnius", "memory");
|
|
669902
|
-
|
|
670405
|
+
mkdirSync82(dbDir, { recursive: true });
|
|
669903
670406
|
const db = initDb2(join150(dbDir, "structured.db"));
|
|
669904
670407
|
const memStore = new ProceduralMemoryStore2(db);
|
|
669905
670408
|
memStore.createWithEmbedding(
|
|
@@ -669948,8 +670451,8 @@ Rules:
|
|
|
669948
670451
|
accessCount: 0
|
|
669949
670452
|
});
|
|
669950
670453
|
if (store2.length > 100) store2 = store2.slice(-100);
|
|
669951
|
-
|
|
669952
|
-
|
|
670454
|
+
mkdirSync82(metaDir, { recursive: true });
|
|
670455
|
+
writeFileSync74(storeFile, JSON.stringify(store2, null, 2));
|
|
669953
670456
|
}
|
|
669954
670457
|
}
|
|
669955
670458
|
} catch {
|
|
@@ -670013,7 +670516,7 @@ Rules:
|
|
|
670013
670516
|
);
|
|
670014
670517
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
670015
670518
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
670016
|
-
|
|
670519
|
+
writeFileSync74(ikFile, JSON.stringify(ikState, null, 2));
|
|
670017
670520
|
}
|
|
670018
670521
|
const metaFile2 = join150(
|
|
670019
670522
|
repoRoot,
|
|
@@ -670041,7 +670544,7 @@ Rules:
|
|
|
670041
670544
|
(item.scores.confidence || 0.5) - 0.02
|
|
670042
670545
|
);
|
|
670043
670546
|
}
|
|
670044
|
-
|
|
670547
|
+
writeFileSync74(metaFile2, JSON.stringify(store2, null, 2));
|
|
670045
670548
|
}
|
|
670046
670549
|
try {
|
|
670047
670550
|
const archeDir = join150(repoRoot, ".omnius", "arche");
|
|
@@ -670063,8 +670566,8 @@ Rules:
|
|
|
670063
670566
|
tags: ["general"]
|
|
670064
670567
|
});
|
|
670065
670568
|
if (variants.length > 50) variants = variants.slice(-50);
|
|
670066
|
-
|
|
670067
|
-
|
|
670569
|
+
mkdirSync82(archeDir, { recursive: true });
|
|
670570
|
+
writeFileSync74(archeFile, JSON.stringify(variants, null, 2));
|
|
670068
670571
|
} catch {
|
|
670069
670572
|
}
|
|
670070
670573
|
} catch {
|
|
@@ -670166,13 +670669,13 @@ __export(run_exports, {
|
|
|
670166
670669
|
});
|
|
670167
670670
|
import { resolve as resolve54 } from "node:path";
|
|
670168
670671
|
import { spawn as spawn33 } from "node:child_process";
|
|
670169
|
-
import { mkdirSync as
|
|
670672
|
+
import { mkdirSync as mkdirSync83, writeFileSync as writeFileSync75, readFileSync as readFileSync112, readdirSync as readdirSync50, existsSync as existsSync136 } from "node:fs";
|
|
670170
670673
|
import { randomBytes as randomBytes28 } from "node:crypto";
|
|
670171
670674
|
import { join as join151 } from "node:path";
|
|
670172
670675
|
function jobsDir2(repoPath) {
|
|
670173
670676
|
const root = resolve54(repoPath ?? process.cwd());
|
|
670174
670677
|
const dir = join151(root, ".omnius", "jobs");
|
|
670175
|
-
|
|
670678
|
+
mkdirSync83(dir, { recursive: true });
|
|
670176
670679
|
return dir;
|
|
670177
670680
|
}
|
|
670178
670681
|
async function runCommand2(opts, config) {
|
|
@@ -670294,7 +670797,7 @@ async function runBackground(task, config, opts) {
|
|
|
670294
670797
|
}
|
|
670295
670798
|
});
|
|
670296
670799
|
job.pid = child.pid ?? 0;
|
|
670297
|
-
|
|
670800
|
+
writeFileSync75(join151(dir, `${id}.json`), JSON.stringify(job, null, 2));
|
|
670298
670801
|
let output = "";
|
|
670299
670802
|
child.stdout?.on("data", (chunk) => {
|
|
670300
670803
|
output += chunk.toString();
|
|
@@ -670310,7 +670813,7 @@ async function runBackground(task, config, opts) {
|
|
|
670310
670813
|
job.summary = result.summary;
|
|
670311
670814
|
job.durationMs = result.durationMs;
|
|
670312
670815
|
job.error = result.error;
|
|
670313
|
-
|
|
670816
|
+
writeFileSync75(join151(dir, `${id}.json`), JSON.stringify(job, null, 2));
|
|
670314
670817
|
} catch {
|
|
670315
670818
|
}
|
|
670316
670819
|
});
|
|
@@ -670944,7 +671447,7 @@ __export(eval_exports, {
|
|
|
670944
671447
|
evalCommand: () => evalCommand
|
|
670945
671448
|
});
|
|
670946
671449
|
import { tmpdir as tmpdir22 } from "node:os";
|
|
670947
|
-
import { mkdirSync as
|
|
671450
|
+
import { mkdirSync as mkdirSync84, writeFileSync as writeFileSync76 } from "node:fs";
|
|
670948
671451
|
import { join as join153 } from "node:path";
|
|
670949
671452
|
async function evalCommand(opts, config) {
|
|
670950
671453
|
const suiteName = opts.suite ?? "basic";
|
|
@@ -671075,8 +671578,8 @@ async function evalCommand(opts, config) {
|
|
|
671075
671578
|
}
|
|
671076
671579
|
function createTempEvalRepo() {
|
|
671077
671580
|
const dir = join153(tmpdir22(), `omnius-eval-${Date.now()}`);
|
|
671078
|
-
|
|
671079
|
-
|
|
671581
|
+
mkdirSync84(dir, { recursive: true });
|
|
671582
|
+
writeFileSync76(
|
|
671080
671583
|
join153(dir, "package.json"),
|
|
671081
671584
|
JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n",
|
|
671082
671585
|
"utf8"
|
|
@@ -671603,11 +672106,11 @@ function crashLog(label, err) {
|
|
|
671603
672106
|
const logLine = `[${timestamp}] ${label}: ${msg}
|
|
671604
672107
|
`;
|
|
671605
672108
|
try {
|
|
671606
|
-
const { appendFileSync: appendFileSync14, mkdirSync:
|
|
672109
|
+
const { appendFileSync: appendFileSync14, mkdirSync: mkdirSync85 } = __require("node:fs");
|
|
671607
672110
|
const { join: join155 } = __require("node:path");
|
|
671608
672111
|
const { homedir: homedir56 } = __require("node:os");
|
|
671609
672112
|
const logDir = join155(homedir56(), ".omnius");
|
|
671610
|
-
|
|
672113
|
+
mkdirSync85(logDir, { recursive: true });
|
|
671611
672114
|
appendFileSync14(join155(logDir, "crash.log"), logLine);
|
|
671612
672115
|
} catch {
|
|
671613
672116
|
}
|