omnius 1.0.363 → 1.0.365
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 +741 -216
- package/npm-shrinkwrap.json +100 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17802,15 +17802,23 @@ function relationAllowed(edge, options2) {
|
|
|
17802
17802
|
return false;
|
|
17803
17803
|
return true;
|
|
17804
17804
|
}
|
|
17805
|
+
function edgeAllowed(edge, options2, allowedSourceIds) {
|
|
17806
|
+
if (!relationAllowed(edge, options2))
|
|
17807
|
+
return false;
|
|
17808
|
+
if (!allowedSourceIds)
|
|
17809
|
+
return true;
|
|
17810
|
+
return !!edge.sourceEpisodeId && allowedSourceIds.has(edge.sourceEpisodeId);
|
|
17811
|
+
}
|
|
17805
17812
|
function selectInnerGraphCandidates(graph, candidates, options2 = {}) {
|
|
17806
17813
|
const minDegree = Math.max(1, Math.floor(options2.minDegree ?? 2));
|
|
17807
17814
|
const candidateEpisodeIds = [...new Set(candidates.map((candidate) => candidate.episode.id).filter(Boolean))];
|
|
17815
|
+
const allowedSourceIds = options2.allowedSourceEpisodeIds?.length ? new Set(options2.allowedSourceEpisodeIds) : void 0;
|
|
17808
17816
|
const candidateScore = new Map(candidates.map((candidate) => [candidate.episode.id, candidate.score ?? 0]));
|
|
17809
17817
|
const candidateTimestamp = new Map(candidates.map((candidate) => [candidate.episode.id, candidate.episode.timestamp]));
|
|
17810
17818
|
const sourceEdges = graph.currentEdgesForSourceEpisodes(candidateEpisodeIds, Math.max(1e3, candidateEpisodeIds.length * 20));
|
|
17811
17819
|
const byNode = /* @__PURE__ */ new Map();
|
|
17812
17820
|
for (const edge of sourceEdges) {
|
|
17813
|
-
if (!
|
|
17821
|
+
if (!edgeAllowed(edge, options2, allowedSourceIds))
|
|
17814
17822
|
continue;
|
|
17815
17823
|
const episodeId = edge.sourceEpisodeId;
|
|
17816
17824
|
if (!episodeId || !candidateEpisodeIds.includes(episodeId))
|
|
@@ -17828,7 +17836,7 @@ function selectInnerGraphCandidates(graph, candidates, options2 = {}) {
|
|
|
17828
17836
|
const now2 = Date.now();
|
|
17829
17837
|
const results = [];
|
|
17830
17838
|
for (const entry of byNode.values()) {
|
|
17831
|
-
const allEdges = graph.currentEdges(entry.node.id).filter((edge) =>
|
|
17839
|
+
const allEdges = graph.currentEdges(entry.node.id).filter((edge) => edgeAllowed(edge, options2, allowedSourceIds));
|
|
17832
17840
|
const degree = allEdges.length;
|
|
17833
17841
|
if (degree < minDegree)
|
|
17834
17842
|
continue;
|
|
@@ -17864,6 +17872,7 @@ function walkGraphFromSeed(graph, seed, options2 = {}) {
|
|
|
17864
17872
|
const maxVisitedNodes = Math.max(1, Math.floor(options2.maxVisitedNodes ?? 64));
|
|
17865
17873
|
const maxTraversedEdges = Math.max(1, Math.floor(options2.maxTraversedEdges ?? 160));
|
|
17866
17874
|
const maxSourceEpisodes = Math.max(1, Math.floor(options2.maxSourceEpisodes ?? 80));
|
|
17875
|
+
const allowedSourceIds = options2.allowedSourceEpisodeIds?.length ? new Set(options2.allowedSourceEpisodeIds) : void 0;
|
|
17867
17876
|
const visited = /* @__PURE__ */ new Map();
|
|
17868
17877
|
const depthByNodeId = {};
|
|
17869
17878
|
const traversed = /* @__PURE__ */ new Map();
|
|
@@ -17882,7 +17891,7 @@ function walkGraphFromSeed(graph, seed, options2 = {}) {
|
|
|
17882
17891
|
const item = queue.shift();
|
|
17883
17892
|
if (item.depth >= maxDepth)
|
|
17884
17893
|
continue;
|
|
17885
|
-
const neighbors2 = graph.neighbors(item.node.id).filter(({ edge }) =>
|
|
17894
|
+
const neighbors2 = graph.neighbors(item.node.id).filter(({ edge }) => edgeAllowed(edge, options2, allowedSourceIds)).sort((a2, b) => b.edge.confidence - a2.edge.confidence || b.node.mentionCount - a2.node.mentionCount);
|
|
17886
17895
|
for (const { node, edge } of neighbors2) {
|
|
17887
17896
|
if (traversed.size >= maxTraversedEdges)
|
|
17888
17897
|
break;
|
|
@@ -35832,11 +35841,11 @@ function deleteCustomToolDefinition(name10, scope, repoRoot) {
|
|
|
35832
35841
|
const dir = scope === "project" && repoRoot ? projectToolsDir(repoRoot) : globalToolsDir();
|
|
35833
35842
|
const filePath = join34(dir, `${name10}.json`);
|
|
35834
35843
|
if (existsSync32(filePath)) {
|
|
35835
|
-
const { unlinkSync:
|
|
35836
|
-
|
|
35844
|
+
const { unlinkSync: unlinkSync36 } = __require("node:fs");
|
|
35845
|
+
unlinkSync36(filePath);
|
|
35837
35846
|
const docsPath = toolDocsPath(name10, scope, repoRoot);
|
|
35838
35847
|
if (existsSync32(docsPath))
|
|
35839
|
-
|
|
35848
|
+
unlinkSync36(docsPath);
|
|
35840
35849
|
if (scope === "project" && repoRoot)
|
|
35841
35850
|
writeCustomToolRegistry(repoRoot);
|
|
35842
35851
|
return true;
|
|
@@ -115212,7 +115221,7 @@ var require_auto = __commonJS({
|
|
|
115212
115221
|
// ../node_modules/acme-client/src/client.js
|
|
115213
115222
|
var require_client = __commonJS({
|
|
115214
115223
|
"../node_modules/acme-client/src/client.js"(exports, module) {
|
|
115215
|
-
var { createHash:
|
|
115224
|
+
var { createHash: createHash45 } = __require("crypto");
|
|
115216
115225
|
var { getPemBodyAsB64u } = require_crypto();
|
|
115217
115226
|
var { log: log22 } = require_logger();
|
|
115218
115227
|
var HttpClient = require_http();
|
|
@@ -115523,14 +115532,14 @@ var require_client = __commonJS({
|
|
|
115523
115532
|
*/
|
|
115524
115533
|
async getChallengeKeyAuthorization(challenge) {
|
|
115525
115534
|
const jwk = this.http.getJwk();
|
|
115526
|
-
const keysum =
|
|
115535
|
+
const keysum = createHash45("sha256").update(JSON.stringify(jwk));
|
|
115527
115536
|
const thumbprint = keysum.digest("base64url");
|
|
115528
115537
|
const result = `${challenge.token}.${thumbprint}`;
|
|
115529
115538
|
if (challenge.type === "http-01") {
|
|
115530
115539
|
return result;
|
|
115531
115540
|
}
|
|
115532
115541
|
if (challenge.type === "dns-01") {
|
|
115533
|
-
return
|
|
115542
|
+
return createHash45("sha256").update(result).digest("base64url");
|
|
115534
115543
|
}
|
|
115535
115544
|
if (challenge.type === "tls-alpn-01") {
|
|
115536
115545
|
return result;
|
|
@@ -258210,7 +258219,7 @@ var require_websocket2 = __commonJS({
|
|
|
258210
258219
|
var http6 = __require("http");
|
|
258211
258220
|
var net5 = __require("net");
|
|
258212
258221
|
var tls2 = __require("tls");
|
|
258213
|
-
var { randomBytes: randomBytes30, createHash:
|
|
258222
|
+
var { randomBytes: randomBytes30, createHash: createHash45 } = __require("crypto");
|
|
258214
258223
|
var { Duplex: Duplex3, Readable } = __require("stream");
|
|
258215
258224
|
var { URL: URL3 } = __require("url");
|
|
258216
258225
|
var PerMessageDeflate3 = require_permessage_deflate2();
|
|
@@ -258870,7 +258879,7 @@ var require_websocket2 = __commonJS({
|
|
|
258870
258879
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
258871
258880
|
return;
|
|
258872
258881
|
}
|
|
258873
|
-
const digest3 =
|
|
258882
|
+
const digest3 = createHash45("sha1").update(key + GUID).digest("base64");
|
|
258874
258883
|
if (res.headers["sec-websocket-accept"] !== digest3) {
|
|
258875
258884
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
258876
258885
|
return;
|
|
@@ -259237,7 +259246,7 @@ var require_websocket_server = __commonJS({
|
|
|
259237
259246
|
var EventEmitter15 = __require("events");
|
|
259238
259247
|
var http6 = __require("http");
|
|
259239
259248
|
var { Duplex: Duplex3 } = __require("stream");
|
|
259240
|
-
var { createHash:
|
|
259249
|
+
var { createHash: createHash45 } = __require("crypto");
|
|
259241
259250
|
var extension3 = require_extension2();
|
|
259242
259251
|
var PerMessageDeflate3 = require_permessage_deflate2();
|
|
259243
259252
|
var subprotocol3 = require_subprotocol();
|
|
@@ -259538,7 +259547,7 @@ var require_websocket_server = __commonJS({
|
|
|
259538
259547
|
);
|
|
259539
259548
|
}
|
|
259540
259549
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
259541
|
-
const digest3 =
|
|
259550
|
+
const digest3 = createHash45("sha1").update(key + GUID).digest("base64");
|
|
259542
259551
|
const headers = [
|
|
259543
259552
|
"HTTP/1.1 101 Switching Protocols",
|
|
259544
259553
|
"Upgrade: websocket",
|
|
@@ -272345,13 +272354,13 @@ Justification: ${justification || "(none provided)"}`,
|
|
|
272345
272354
|
}
|
|
272346
272355
|
const snapshot = JSON.stringify(this.selfState, null, 2);
|
|
272347
272356
|
try {
|
|
272348
|
-
const { createHash:
|
|
272357
|
+
const { createHash: createHash45 } = await import("node:crypto");
|
|
272349
272358
|
const snapshotDir = join42(this.cwd, ".omnius", "identity", "snapshots");
|
|
272350
272359
|
await mkdir7(snapshotDir, { recursive: true });
|
|
272351
272360
|
const version4 = this.selfState.version;
|
|
272352
272361
|
const snapshotPath = join42(snapshotDir, `v${version4}.json`);
|
|
272353
272362
|
await writeFile12(snapshotPath, snapshot, "utf8");
|
|
272354
|
-
const hash =
|
|
272363
|
+
const hash = createHash45("sha256").update(snapshot).digest("hex");
|
|
272355
272364
|
await writeFile12(join42(this.cwd, ".omnius", "identity", "latest-hash.txt"), hash, "utf8");
|
|
272356
272365
|
let ipfsCid = "";
|
|
272357
272366
|
try {
|
|
@@ -272484,8 +272493,8 @@ New: ${newNarrative.slice(0, 200)}...`,
|
|
|
272484
272493
|
}
|
|
272485
272494
|
// ── Helpers ──────────────────────────────────────────────────────────────
|
|
272486
272495
|
createDefaultState() {
|
|
272487
|
-
const { createHash:
|
|
272488
|
-
const machineId =
|
|
272496
|
+
const { createHash: createHash45 } = __require("node:crypto");
|
|
272497
|
+
const machineId = createHash45("sha256").update(this.cwd).digest("hex").slice(0, 12);
|
|
272489
272498
|
return {
|
|
272490
272499
|
self_id: `omnius-${machineId}`,
|
|
272491
272500
|
version: 1,
|
|
@@ -272567,9 +272576,9 @@ New: ${newNarrative.slice(0, 200)}...`,
|
|
|
272567
272576
|
let cid;
|
|
272568
272577
|
if (this.selfState.version > prevVersion) {
|
|
272569
272578
|
try {
|
|
272570
|
-
const { createHash:
|
|
272579
|
+
const { createHash: createHash45 } = await import("node:crypto");
|
|
272571
272580
|
const stateJson = JSON.stringify(this.selfState);
|
|
272572
|
-
const hash =
|
|
272581
|
+
const hash = createHash45("sha256").update(stateJson).digest("hex").slice(0, 32);
|
|
272573
272582
|
const cidsPath = join42(this.cwd, ".omnius", "identity", "cids.json");
|
|
272574
272583
|
const cidsData = { latest: "", hash, version: this.selfState.version };
|
|
272575
272584
|
try {
|
|
@@ -558468,17 +558477,29 @@ function reconcileClaimsWithEvidence(ledger) {
|
|
|
558468
558477
|
const claimTerms = cleanText(claim.text, 300).toLowerCase().split(/[^a-z0-9]+/).filter((part) => part.length >= 4);
|
|
558469
558478
|
const matches = successfulEvidence.filter((entry) => {
|
|
558470
558479
|
const haystack = `${entry.toolName ?? ""} ${entry.summary}`.toLowerCase();
|
|
558471
|
-
|
|
558480
|
+
const matchingTerms = claimTerms.filter((term) => haystack.includes(term));
|
|
558481
|
+
const specificMatches = matchingTerms.filter((t2) => !GENERIC_EVIDENCE_TERMS.has(t2));
|
|
558482
|
+
return specificMatches.length >= 1 && matchingTerms.length >= 2;
|
|
558472
558483
|
});
|
|
558473
558484
|
const contradictions = failedEvidence.filter((entry) => {
|
|
558474
558485
|
const haystack = `${entry.toolName ?? ""} ${entry.summary}`.toLowerCase();
|
|
558475
|
-
|
|
558486
|
+
const matchingTerms = claimTerms.filter((term) => haystack.includes(term));
|
|
558487
|
+
const specificMatches = matchingTerms.filter((t2) => !GENERIC_EVIDENCE_TERMS.has(t2));
|
|
558488
|
+
return specificMatches.length >= 1 && matchingTerms.length >= 2;
|
|
558476
558489
|
});
|
|
558477
558490
|
if (contradictions.length > 0 && matches.length === 0) {
|
|
558478
|
-
return {
|
|
558491
|
+
return {
|
|
558492
|
+
...claim,
|
|
558493
|
+
evidenceIds: contradictions.map((entry) => entry.id),
|
|
558494
|
+
status: "contradicted"
|
|
558495
|
+
};
|
|
558479
558496
|
}
|
|
558480
558497
|
if (matches.length > 0) {
|
|
558481
|
-
return {
|
|
558498
|
+
return {
|
|
558499
|
+
...claim,
|
|
558500
|
+
evidenceIds: matches.map((entry) => entry.id),
|
|
558501
|
+
status: "supported"
|
|
558502
|
+
};
|
|
558482
558503
|
}
|
|
558483
558504
|
return { ...claim, evidenceIds: [], status: "unverified" };
|
|
558484
558505
|
});
|
|
@@ -558561,10 +558582,125 @@ function saveCompletionLedger(filePath, ledger) {
|
|
|
558561
558582
|
function loadCompletionLedger(filePath) {
|
|
558562
558583
|
return JSON.parse(readFileSync64(filePath, "utf8"));
|
|
558563
558584
|
}
|
|
558585
|
+
var GENERIC_EVIDENCE_TERMS;
|
|
558564
558586
|
var init_completionLedger = __esm({
|
|
558565
558587
|
"packages/orchestrator/dist/completionLedger.js"() {
|
|
558566
558588
|
"use strict";
|
|
558567
558589
|
init_completionContract();
|
|
558590
|
+
GENERIC_EVIDENCE_TERMS = /* @__PURE__ */ new Set([
|
|
558591
|
+
"file",
|
|
558592
|
+
"read",
|
|
558593
|
+
"write",
|
|
558594
|
+
"search",
|
|
558595
|
+
"list",
|
|
558596
|
+
"get",
|
|
558597
|
+
"find",
|
|
558598
|
+
"show",
|
|
558599
|
+
"view",
|
|
558600
|
+
"open",
|
|
558601
|
+
"close",
|
|
558602
|
+
"check",
|
|
558603
|
+
"run",
|
|
558604
|
+
"exec",
|
|
558605
|
+
"call",
|
|
558606
|
+
"result",
|
|
558607
|
+
"output",
|
|
558608
|
+
"input",
|
|
558609
|
+
"data",
|
|
558610
|
+
"info",
|
|
558611
|
+
"text",
|
|
558612
|
+
"code",
|
|
558613
|
+
"done",
|
|
558614
|
+
"work",
|
|
558615
|
+
"time",
|
|
558616
|
+
"name",
|
|
558617
|
+
"path",
|
|
558618
|
+
"size",
|
|
558619
|
+
"type",
|
|
558620
|
+
"mode",
|
|
558621
|
+
"set",
|
|
558622
|
+
"help",
|
|
558623
|
+
"test",
|
|
558624
|
+
"tests",
|
|
558625
|
+
"testing",
|
|
558626
|
+
"success",
|
|
558627
|
+
"successfully",
|
|
558628
|
+
"completed",
|
|
558629
|
+
"first",
|
|
558630
|
+
"last",
|
|
558631
|
+
"next",
|
|
558632
|
+
"prev",
|
|
558633
|
+
"page",
|
|
558634
|
+
"line",
|
|
558635
|
+
"lines",
|
|
558636
|
+
"count",
|
|
558637
|
+
"value",
|
|
558638
|
+
"values",
|
|
558639
|
+
"args",
|
|
558640
|
+
"argument",
|
|
558641
|
+
"arguments",
|
|
558642
|
+
"param",
|
|
558643
|
+
"parameter",
|
|
558644
|
+
"parameters",
|
|
558645
|
+
"error",
|
|
558646
|
+
"errors",
|
|
558647
|
+
"failed",
|
|
558648
|
+
"failure",
|
|
558649
|
+
"state",
|
|
558650
|
+
"status",
|
|
558651
|
+
"config",
|
|
558652
|
+
"configuration",
|
|
558653
|
+
"option",
|
|
558654
|
+
"options",
|
|
558655
|
+
"default",
|
|
558656
|
+
"current",
|
|
558657
|
+
"previous",
|
|
558658
|
+
"select",
|
|
558659
|
+
"filter",
|
|
558660
|
+
"limit",
|
|
558661
|
+
"match",
|
|
558662
|
+
"matches",
|
|
558663
|
+
"matching",
|
|
558664
|
+
"number",
|
|
558665
|
+
"string",
|
|
558666
|
+
"object",
|
|
558667
|
+
"array",
|
|
558668
|
+
"map",
|
|
558669
|
+
"list",
|
|
558670
|
+
"sort",
|
|
558671
|
+
"order",
|
|
558672
|
+
"group",
|
|
558673
|
+
"total",
|
|
558674
|
+
"summary",
|
|
558675
|
+
"preview",
|
|
558676
|
+
"export",
|
|
558677
|
+
"import",
|
|
558678
|
+
"format",
|
|
558679
|
+
"build",
|
|
558680
|
+
"compile",
|
|
558681
|
+
"deploy",
|
|
558682
|
+
"release",
|
|
558683
|
+
"version",
|
|
558684
|
+
"change",
|
|
558685
|
+
"changes",
|
|
558686
|
+
"update",
|
|
558687
|
+
"updates",
|
|
558688
|
+
"updated",
|
|
558689
|
+
"modify",
|
|
558690
|
+
"modified",
|
|
558691
|
+
"modification",
|
|
558692
|
+
"remove",
|
|
558693
|
+
"removed",
|
|
558694
|
+
"removal",
|
|
558695
|
+
"delete",
|
|
558696
|
+
"deleted",
|
|
558697
|
+
"add",
|
|
558698
|
+
"added",
|
|
558699
|
+
"addition",
|
|
558700
|
+
"create",
|
|
558701
|
+
"created",
|
|
558702
|
+
"creation"
|
|
558703
|
+
]);
|
|
558568
558704
|
}
|
|
558569
558705
|
});
|
|
558570
558706
|
|
|
@@ -561191,12 +561327,64 @@ var init_lesson_bank = __esm({
|
|
|
561191
561327
|
// packages/orchestrator/dist/intervention-replay.js
|
|
561192
561328
|
import { existsSync as existsSync88, mkdirSync as mkdirSync51, readFileSync as readFileSync67, writeFileSync as writeFileSync41, readdirSync as readdirSync27 } from "node:fs";
|
|
561193
561329
|
import { join as join98, dirname as dirname30 } from "node:path";
|
|
561330
|
+
import { createHash as createHash26 } from "node:crypto";
|
|
561194
561331
|
function checkpointDir2(workingDir) {
|
|
561195
561332
|
return workingDir ? join98(workingDir, ".omnius", "checkpoints") : join98(process.env["HOME"] || ".", ".omnius", "checkpoints");
|
|
561196
561333
|
}
|
|
561197
561334
|
function checkpointPath(workingDir, turn) {
|
|
561198
561335
|
return join98(checkpointDir2(workingDir), `turn-${String(turn).padStart(4, "0")}.json`);
|
|
561199
561336
|
}
|
|
561337
|
+
function sanitizeMessagesForCheckpoint(messages2) {
|
|
561338
|
+
const result = [...messages2];
|
|
561339
|
+
let lastFrameIdx = -1;
|
|
561340
|
+
for (let i2 = result.length - 1; i2 >= 0; i2--) {
|
|
561341
|
+
const m2 = result[i2];
|
|
561342
|
+
const content = typeof m2.content === "string" ? m2.content : "";
|
|
561343
|
+
if (m2.role === "system" && content.startsWith(CONTEXT_FRAME_MARKER)) {
|
|
561344
|
+
if (lastFrameIdx === -1) {
|
|
561345
|
+
lastFrameIdx = i2;
|
|
561346
|
+
} else {
|
|
561347
|
+
result.splice(i2, 1);
|
|
561348
|
+
}
|
|
561349
|
+
}
|
|
561350
|
+
}
|
|
561351
|
+
const seenSystemDigests = /* @__PURE__ */ new Set();
|
|
561352
|
+
const deduped = [];
|
|
561353
|
+
for (let i2 = 0; i2 < result.length; i2++) {
|
|
561354
|
+
const m2 = result[i2];
|
|
561355
|
+
const content = typeof m2.content === "string" ? m2.content : "";
|
|
561356
|
+
if (m2.role !== "system") {
|
|
561357
|
+
deduped.push(m2);
|
|
561358
|
+
continue;
|
|
561359
|
+
}
|
|
561360
|
+
if (content.startsWith(CONTEXT_FRAME_MARKER)) {
|
|
561361
|
+
deduped.push(m2);
|
|
561362
|
+
continue;
|
|
561363
|
+
}
|
|
561364
|
+
const digest3 = createHash26("sha1").update(content).digest("hex");
|
|
561365
|
+
if (seenSystemDigests.has(digest3))
|
|
561366
|
+
continue;
|
|
561367
|
+
seenSystemDigests.add(digest3);
|
|
561368
|
+
deduped.push(m2);
|
|
561369
|
+
}
|
|
561370
|
+
let sysChars = 0;
|
|
561371
|
+
const capped = [];
|
|
561372
|
+
for (const m2 of deduped) {
|
|
561373
|
+
if (m2.role === "system") {
|
|
561374
|
+
const content = typeof m2.content === "string" ? m2.content : "";
|
|
561375
|
+
if (content.startsWith(CONTEXT_FRAME_MARKER)) {
|
|
561376
|
+
capped.push(m2);
|
|
561377
|
+
continue;
|
|
561378
|
+
}
|
|
561379
|
+
if (sysChars + content.length > MAX_CHECKPOINT_SYSTEM_CHARS) {
|
|
561380
|
+
continue;
|
|
561381
|
+
}
|
|
561382
|
+
sysChars += content.length;
|
|
561383
|
+
}
|
|
561384
|
+
capped.push(m2);
|
|
561385
|
+
}
|
|
561386
|
+
return capped;
|
|
561387
|
+
}
|
|
561200
561388
|
function writeCheckpoint(args) {
|
|
561201
561389
|
try {
|
|
561202
561390
|
const snap = {
|
|
@@ -561241,9 +561429,12 @@ function pruneOldCheckpoints(args) {
|
|
|
561241
561429
|
}
|
|
561242
561430
|
return removed;
|
|
561243
561431
|
}
|
|
561432
|
+
var CONTEXT_FRAME_MARKER, MAX_CHECKPOINT_SYSTEM_CHARS;
|
|
561244
561433
|
var init_intervention_replay = __esm({
|
|
561245
561434
|
"packages/orchestrator/dist/intervention-replay.js"() {
|
|
561246
561435
|
"use strict";
|
|
561436
|
+
CONTEXT_FRAME_MARKER = "[ACTIVE CONTEXT FRAME]";
|
|
561437
|
+
MAX_CHECKPOINT_SYSTEM_CHARS = 8e4;
|
|
561247
561438
|
}
|
|
561248
561439
|
});
|
|
561249
561440
|
|
|
@@ -568122,7 +568313,7 @@ import { existsSync as existsSync97, readFileSync as readFileSync75, statSync as
|
|
|
568122
568313
|
import { execSync as execSync47 } from "node:child_process";
|
|
568123
568314
|
import { homedir as homedir32, platform as platform3, arch as arch2, totalmem as totalmem4, freemem as freemem3, hostname as hostname3 } from "node:os";
|
|
568124
568315
|
import { join as join107 } from "node:path";
|
|
568125
|
-
import { createHash as
|
|
568316
|
+
import { createHash as createHash27 } from "node:crypto";
|
|
568126
568317
|
function capturePreflightSnapshot(workingDir) {
|
|
568127
568318
|
const warnings = [];
|
|
568128
568319
|
const configFingerprints = {};
|
|
@@ -568293,7 +568484,7 @@ function expandPath(p2) {
|
|
|
568293
568484
|
return p2;
|
|
568294
568485
|
}
|
|
568295
568486
|
function sha2564(s2) {
|
|
568296
|
-
return
|
|
568487
|
+
return createHash27("sha256").update(s2).digest("hex").slice(0, 16);
|
|
568297
568488
|
}
|
|
568298
568489
|
function freeDiskBytes(path12 = "/tmp") {
|
|
568299
568490
|
try {
|
|
@@ -570502,9 +570693,11 @@ ${parts.join("\n")}
|
|
|
570502
570693
|
} catch {
|
|
570503
570694
|
}
|
|
570504
570695
|
}
|
|
570505
|
-
_initializeCompletionContract(task, context2) {
|
|
570506
|
-
|
|
570507
|
-
|
|
570696
|
+
_initializeCompletionContract(task, context2, actualUserGoal) {
|
|
570697
|
+
const goalText = actualUserGoal || task;
|
|
570698
|
+
const seedTexts = actualUserGoal ? [goalText] : [goalText, context2 ?? ""];
|
|
570699
|
+
this._completionContractSeedText = seedTexts.map((text2) => String(text2 || "").trim()).filter(Boolean).join("\n\n");
|
|
570700
|
+
this._completionContract = inferCompletionContractFromTexts([this._completionContractSeedText], goalText);
|
|
570508
570701
|
this._persistCompletionContract(this._completionContract);
|
|
570509
570702
|
return this._completionContract;
|
|
570510
570703
|
}
|
|
@@ -572129,7 +572322,10 @@ ${shellLines.join("\n")}` : "Commands run: none"
|
|
|
572129
572322
|
this._saveCompletionLedgerSafe();
|
|
572130
572323
|
}
|
|
572131
572324
|
try {
|
|
572132
|
-
const _audit = auditCompletionClaims(this._completionLedger.proposedClaims.map((c8) => ({
|
|
572325
|
+
const _audit = auditCompletionClaims(this._completionLedger.proposedClaims.map((c8) => ({
|
|
572326
|
+
text: c8.text,
|
|
572327
|
+
status: c8.status
|
|
572328
|
+
})));
|
|
572133
572329
|
if (!_audit.ok) {
|
|
572134
572330
|
const _checks = _audit.blockers.map((b) => `• [${b.category}] "${b.claim}" → ${b.requiredCheck}`).join("\n");
|
|
572135
572331
|
this._completionCaveat = [
|
|
@@ -574213,7 +574409,11 @@ ${blob}
|
|
|
574213
574409
|
} catch {
|
|
574214
574410
|
}
|
|
574215
574411
|
}
|
|
574216
|
-
callMetaById.set(c8.id, {
|
|
574412
|
+
callMetaById.set(c8.id, {
|
|
574413
|
+
name: name10,
|
|
574414
|
+
path: path12,
|
|
574415
|
+
argsPreview: rawArgs.slice(0, 120)
|
|
574416
|
+
});
|
|
574217
574417
|
}
|
|
574218
574418
|
}
|
|
574219
574419
|
}
|
|
@@ -574399,7 +574599,12 @@ ${blob}
|
|
|
574399
574599
|
const list = this._readCoverage.get(iv.key) ?? [];
|
|
574400
574600
|
const pruned = list.filter((cov) => !(cov.whole === iv.whole && iv.start <= cov.start && cov.end <= iv.end && cov.fingerprint !== fingerprint));
|
|
574401
574601
|
if (!pruned.some((cov) => cov.fingerprint === fingerprint)) {
|
|
574402
|
-
pruned.push({
|
|
574602
|
+
pruned.push({
|
|
574603
|
+
start: iv.start,
|
|
574604
|
+
end: iv.end,
|
|
574605
|
+
whole: iv.whole,
|
|
574606
|
+
fingerprint
|
|
574607
|
+
});
|
|
574403
574608
|
}
|
|
574404
574609
|
pruned.sort((a2, b) => b.end - b.start - (a2.end - a2.start));
|
|
574405
574610
|
this._readCoverage.set(iv.key, pruned.slice(0, 8));
|
|
@@ -574840,7 +575045,14 @@ Rewrite it now for ${ctx3.model}.`;
|
|
|
574840
575045
|
const suggestions = [];
|
|
574841
575046
|
const provided = new Set(providedKeys);
|
|
574842
575047
|
const aliasMap = {
|
|
574843
|
-
task: [
|
|
575048
|
+
task: [
|
|
575049
|
+
"prompt",
|
|
575050
|
+
"description",
|
|
575051
|
+
"message",
|
|
575052
|
+
"query",
|
|
575053
|
+
"input",
|
|
575054
|
+
"instructions"
|
|
575055
|
+
],
|
|
574844
575056
|
prompt: ["task", "message", "query", "input", "text", "instructions"],
|
|
574845
575057
|
background: ["run_in_background", "background_run", "async"],
|
|
574846
575058
|
run_in_background: ["background", "background_run", "async"],
|
|
@@ -575230,7 +575442,7 @@ Respond with your assessment, then take action.`;
|
|
|
575230
575442
|
return scored[0].result;
|
|
575231
575443
|
}
|
|
575232
575444
|
/** Run a task through the agentic loop */
|
|
575233
|
-
async run(task, context2) {
|
|
575445
|
+
async run(task, context2, actualUserGoal) {
|
|
575234
575446
|
this.aborted = false;
|
|
575235
575447
|
this._abortController = new AbortController();
|
|
575236
575448
|
this._fileWritesThisRun = 0;
|
|
@@ -575339,9 +575551,11 @@ Respond with your assessment, then take action.`;
|
|
|
575339
575551
|
this._loadResolutionMemory();
|
|
575340
575552
|
this._pauseResolve = null;
|
|
575341
575553
|
this.pendingUserMessages.length = 0;
|
|
575554
|
+
const persistentTaskGoal = cleanForStorage(actualUserGoal || "") || cleanedTask;
|
|
575555
|
+
const userGoal = persistentTaskGoal.slice(0, 500);
|
|
575342
575556
|
this._taskState = {
|
|
575343
|
-
goal:
|
|
575344
|
-
originalGoal:
|
|
575557
|
+
goal: userGoal,
|
|
575558
|
+
originalGoal: userGoal,
|
|
575345
575559
|
completedSteps: [],
|
|
575346
575560
|
pendingSteps: [],
|
|
575347
575561
|
currentStep: "",
|
|
@@ -575384,10 +575598,10 @@ Respond with your assessment, then take action.`;
|
|
|
575384
575598
|
verbose: false
|
|
575385
575599
|
});
|
|
575386
575600
|
this._hookManager.runSessionHook("session_start", this._sessionId);
|
|
575387
|
-
this._initializeCompletionContract(task, context2);
|
|
575601
|
+
this._initializeCompletionContract(task, context2, actualUserGoal);
|
|
575388
575602
|
this._completionLedger = createCompletionLedger({
|
|
575389
575603
|
runId: this._sessionId,
|
|
575390
|
-
goal:
|
|
575604
|
+
goal: userGoal
|
|
575391
575605
|
});
|
|
575392
575606
|
this._sessionStartMs = Date.now();
|
|
575393
575607
|
if (process.env["OMNIUS_DISABLE_PREFLIGHT"] !== "1") {
|
|
@@ -575538,13 +575752,27 @@ ${_notes}`;
|
|
|
575538
575752
|
}
|
|
575539
575753
|
try {
|
|
575540
575754
|
if (!this.options.subAgent) {
|
|
575541
|
-
const _imp = Math.min(9, Math.max(3, 3 + Math.floor((
|
|
575542
|
-
const _kw = String(
|
|
575543
|
-
|
|
575755
|
+
const _imp = Math.min(9, Math.max(3, 3 + Math.floor((persistentTaskGoal.length || 0) / 250)));
|
|
575756
|
+
const _kw = String(persistentTaskGoal || "").toLowerCase().match(/[a-z][a-z0-9_-]{3,}/g)?.filter((w) => ![
|
|
575757
|
+
"this",
|
|
575758
|
+
"that",
|
|
575759
|
+
"with",
|
|
575760
|
+
"from",
|
|
575761
|
+
"into",
|
|
575762
|
+
"your",
|
|
575763
|
+
"have",
|
|
575764
|
+
"will",
|
|
575765
|
+
"please"
|
|
575766
|
+
].includes(w)).slice(0, 6) ?? [];
|
|
575767
|
+
noteAfterTask({
|
|
575768
|
+
summary: `Task: ${persistentTaskGoal.slice(0, 200)}`,
|
|
575769
|
+
importance: _imp,
|
|
575770
|
+
keywords: _kw
|
|
575771
|
+
});
|
|
575544
575772
|
}
|
|
575545
575773
|
} catch {
|
|
575546
575774
|
}
|
|
575547
|
-
this._contextTree = new ContextTree(`sys-${systemPrompt.length}`,
|
|
575775
|
+
this._contextTree = new ContextTree(`sys-${systemPrompt.length}`, persistentTaskGoal.slice(0, 200));
|
|
575548
575776
|
this.emit({
|
|
575549
575777
|
type: "status",
|
|
575550
575778
|
content: `Context assembled: ${contextComposition.sections.map((s2) => `${s2.label}(${s2.tokenEstimate}t)`).join(" + ")} = ~${contextComposition.totalTokenEstimate}t`,
|
|
@@ -575567,7 +575795,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
575567
575795
|
contextFrame: {
|
|
575568
575796
|
kind: "system_prompt",
|
|
575569
575797
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
575570
|
-
taskPreview:
|
|
575798
|
+
taskPreview: persistentTaskGoal.slice(0, 240),
|
|
575571
575799
|
assembledCharCount: systemPrompt.length,
|
|
575572
575800
|
totalTokenEstimate: contextComposition.totalTokenEstimate,
|
|
575573
575801
|
sections: contextComposition.sections.map((section, order) => ({
|
|
@@ -575588,13 +575816,13 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
575588
575816
|
}
|
|
575589
575817
|
});
|
|
575590
575818
|
}
|
|
575591
|
-
const missionCompletionContract = this.buildMissionCompletionContract(
|
|
575819
|
+
const missionCompletionContract = this.buildMissionCompletionContract(persistentTaskGoal, context2);
|
|
575592
575820
|
const messages2 = [
|
|
575593
575821
|
{ role: "system", content: systemPrompt },
|
|
575594
575822
|
...missionCompletionContract ? [{ role: "system", content: missionCompletionContract }] : [],
|
|
575595
575823
|
{ role: "user", content: userContent }
|
|
575596
575824
|
];
|
|
575597
|
-
const preflightMemoryRecall = this._buildPreflightTaskMemoryRecall(
|
|
575825
|
+
const preflightMemoryRecall = this._buildPreflightTaskMemoryRecall(persistentTaskGoal);
|
|
575598
575826
|
if (preflightMemoryRecall) {
|
|
575599
575827
|
messages2.splice(messages2.length - 1, 0, {
|
|
575600
575828
|
role: "system",
|
|
@@ -575658,7 +575886,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
575658
575886
|
throw "skip-handoff-fresh";
|
|
575659
575887
|
const omniusDir = this._workingDirectory ? _pathJoin(this._workingDirectory, ".omnius") : _pathJoin(process.cwd(), ".omnius");
|
|
575660
575888
|
const chainPairs = loadMessagePairsFromLog(omniusDir, {
|
|
575661
|
-
currentTask:
|
|
575889
|
+
currentTask: persistentTaskGoal
|
|
575662
575890
|
});
|
|
575663
575891
|
if (chainPairs.length > 0) {
|
|
575664
575892
|
messages2.splice(1, 0, ...chainPairs);
|
|
@@ -575670,7 +575898,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
575670
575898
|
} else {
|
|
575671
575899
|
const prior = readTaskHandoff(omniusDir, {
|
|
575672
575900
|
currentSessionId: this._sessionId,
|
|
575673
|
-
currentTask:
|
|
575901
|
+
currentTask: persistentTaskGoal
|
|
575674
575902
|
});
|
|
575675
575903
|
if (prior) {
|
|
575676
575904
|
const handoffPair = buildHandoffMessagePair(prior);
|
|
@@ -575693,7 +575921,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
575693
575921
|
}
|
|
575694
575922
|
}
|
|
575695
575923
|
if (this._reflectionBuffer) {
|
|
575696
|
-
const reflections = this._reflectionBuffer.getRelevantReflections(
|
|
575924
|
+
const reflections = this._reflectionBuffer.getRelevantReflections(persistentTaskGoal, 3);
|
|
575697
575925
|
if (reflections.length > 0) {
|
|
575698
575926
|
const reflectionCtx = this._reflectionBuffer.formatForContext(reflections);
|
|
575699
575927
|
messages2.push({ role: "system", content: reflectionCtx });
|
|
@@ -575709,7 +575937,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
575709
575937
|
if (process.env["OMNIUS_DISABLE_FAILURE_HANDOFF"] !== "1") {
|
|
575710
575938
|
try {
|
|
575711
575939
|
const failureHandoff = buildFailureModeHandoff({
|
|
575712
|
-
taskGoal:
|
|
575940
|
+
taskGoal: persistentTaskGoal,
|
|
575713
575941
|
errorPatterns: this._errorPatterns,
|
|
575714
575942
|
toolCallLog,
|
|
575715
575943
|
taskState: this._taskState,
|
|
@@ -575914,7 +576142,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
575914
576142
|
})();
|
|
575915
576143
|
const gate = this._evaluateCompletionProvenanceGate({
|
|
575916
576144
|
summary: proposedSummary,
|
|
575917
|
-
taskGoal:
|
|
576145
|
+
taskGoal: persistentTaskGoal,
|
|
575918
576146
|
toolCallLog,
|
|
575919
576147
|
answerText: lastAssistantText
|
|
575920
576148
|
});
|
|
@@ -576062,10 +576290,11 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
576062
576290
|
const REG35_KEEP_LAST = 12;
|
|
576063
576291
|
if (turn > 0 && turn % REG35_CHECKPOINT_EVERY === 0) {
|
|
576064
576292
|
try {
|
|
576293
|
+
const sanitized = sanitizeMessagesForCheckpoint(messages2);
|
|
576065
576294
|
writeCheckpoint({
|
|
576066
576295
|
workingDir: this._workingDirectory || void 0,
|
|
576067
576296
|
turn,
|
|
576068
|
-
messages:
|
|
576297
|
+
messages: sanitized,
|
|
576069
576298
|
taskGoal: this._taskState.originalGoal || this._taskState.goal || "",
|
|
576070
576299
|
notes: `phase=${this._taskState.phase ?? "?"}, completed=${this._taskState.completedSteps?.length ?? 0}`
|
|
576071
576300
|
});
|
|
@@ -577342,8 +577571,8 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
|
|
|
577342
577571
|
if (process.env["OMNIUS_DISABLE_ADAPTIVE_RETRIEVAL"] !== "1") {
|
|
577343
577572
|
const goalForSig = (this._taskState.goal || "").slice(0, 200);
|
|
577344
577573
|
const recentTools = this._toolSequence.slice(-5).join("|");
|
|
577345
|
-
const { createHash:
|
|
577346
|
-
const sig =
|
|
577574
|
+
const { createHash: createHash45 } = await import("node:crypto");
|
|
577575
|
+
const sig = createHash45("sha256").update(`${goalForSig}::${recentTools}`).digest("hex").slice(0, 16);
|
|
577347
577576
|
if (this._lastPprSig === sig && this._lastPprMemoryLines.length > 0) {
|
|
577348
577577
|
compacted.push({
|
|
577349
577578
|
role: "system",
|
|
@@ -578394,7 +578623,11 @@ Use the saved fact to continue the promised synthesis or next concrete step, or
|
|
|
578394
578623
|
this._adversaryStream.observe({
|
|
578395
578624
|
turn,
|
|
578396
578625
|
assistantText: "",
|
|
578397
|
-
recentToolOutcomes: this._adversaryToolOutcomes.slice(-8).map((o2) => ({
|
|
578626
|
+
recentToolOutcomes: this._adversaryToolOutcomes.slice(-8).map((o2) => ({
|
|
578627
|
+
tool: o2.tool,
|
|
578628
|
+
succeeded: o2.succeeded,
|
|
578629
|
+
preview: o2.preview
|
|
578630
|
+
})),
|
|
578398
578631
|
claimsCompletion: false,
|
|
578399
578632
|
loopSignal: {
|
|
578400
578633
|
tool: tc.name,
|
|
@@ -579940,7 +580173,7 @@ Then use file_read on individual FILES inside it.`);
|
|
|
579940
580173
|
}
|
|
579941
580174
|
if (process.env["OMNIUS_DISABLE_FAILURE_HANDOFF"] !== "1" && !result.success && turn - lastFailureHandoffTurn >= 4) {
|
|
579942
580175
|
const runtimeHandoff = buildFailureModeHandoff({
|
|
579943
|
-
taskGoal:
|
|
580176
|
+
taskGoal: persistentTaskGoal,
|
|
579944
580177
|
errorPatterns: this._errorPatterns,
|
|
579945
580178
|
toolCallLog,
|
|
579946
580179
|
taskState: this._taskState,
|
|
@@ -581322,7 +581555,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581322
581555
|
};
|
|
581323
581556
|
const consolidation = {
|
|
581324
581557
|
sessionId: this._sessionId,
|
|
581325
|
-
task:
|
|
581558
|
+
task: persistentTaskGoal.slice(0, 500),
|
|
581326
581559
|
outcome: completed ? "success" : this.aborted ? "aborted" : runStatus === "incomplete_verification" ? "incomplete_verification" : "timeout",
|
|
581327
581560
|
turns: messages2.filter((m2) => m2.role === "assistant").length,
|
|
581328
581561
|
toolsUsed: [...new Set(toolCallLog.map((tc) => tc.name))],
|
|
@@ -581347,7 +581580,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581347
581580
|
fs11.mkdirSync(provenanceDir, { recursive: true });
|
|
581348
581581
|
const provenanceGraph = {
|
|
581349
581582
|
sessionId: this._sessionId,
|
|
581350
|
-
task:
|
|
581583
|
+
task: persistentTaskGoal.slice(0, 500),
|
|
581351
581584
|
outcome: consolidation.outcome,
|
|
581352
581585
|
timestamp: consolidation.timestamp,
|
|
581353
581586
|
// Full action trace — every tool call with sequence ordering
|
|
@@ -581397,7 +581630,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581397
581630
|
});
|
|
581398
581631
|
if (completed && this.tools.has("memory_write")) {
|
|
581399
581632
|
const memTool = this.tools.get("memory_write");
|
|
581400
|
-
const lessonContent = `Task "${
|
|
581633
|
+
const lessonContent = `Task "${persistentTaskGoal.slice(0, 100)}" completed successfully. Tools: ${consolidation.toolsUsed.join(", ")}. Files: ${consolidation.filesModified.slice(0, 3).join(", ")}. Duration: ${Math.round(durationMs / 1e3)}s, ${consolidation.turns} turns.`;
|
|
581401
581634
|
try {
|
|
581402
581635
|
await memTool.execute({
|
|
581403
581636
|
topic: "task_lessons",
|
|
@@ -581415,7 +581648,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581415
581648
|
const transcriptPath = _pathJoin(omniusDir, "consolidations", `${this._sessionId}.json`);
|
|
581416
581649
|
const handoff = buildTaskHandoff({
|
|
581417
581650
|
sessionId: this._sessionId,
|
|
581418
|
-
goal:
|
|
581651
|
+
goal: persistentTaskGoal,
|
|
581419
581652
|
outcome,
|
|
581420
581653
|
summary,
|
|
581421
581654
|
filesModified: consolidation.filesModified,
|
|
@@ -581439,7 +581672,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581439
581672
|
if (this._reflectionBuffer && !completed) {
|
|
581440
581673
|
try {
|
|
581441
581674
|
const reflection = this._reflectionBuffer.addReflection({
|
|
581442
|
-
taskGoal:
|
|
581675
|
+
taskGoal: persistentTaskGoal,
|
|
581443
581676
|
sessionId: this._sessionId,
|
|
581444
581677
|
turnsSpent: this._taskState.toolCallCount,
|
|
581445
581678
|
failedApproaches: this._taskState.failedApproaches,
|
|
@@ -581461,7 +581694,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581461
581694
|
}
|
|
581462
581695
|
if (this._episodeStore) {
|
|
581463
581696
|
try {
|
|
581464
|
-
const taskSummaryContent = `Task "${
|
|
581697
|
+
const taskSummaryContent = `Task "${persistentTaskGoal.slice(0, 200)}" ${completed ? "completed" : "ended"}: ${cleanForStorage(summary).slice(0, 300)}`;
|
|
581465
581698
|
if (this._crlMemoryStore) {
|
|
581466
581699
|
this._crlMemoryStore.storeCRL({
|
|
581467
581700
|
content: taskSummaryContent,
|
|
@@ -581690,7 +581923,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581690
581923
|
await this.processPendingEmbeddings();
|
|
581691
581924
|
}
|
|
581692
581925
|
this.stopEmbeddingPipeline();
|
|
581693
|
-
const gist = compressAndStore(this._episodeStore, this._sessionId,
|
|
581926
|
+
const gist = compressAndStore(this._episodeStore, this._sessionId, persistentTaskGoal, 10);
|
|
581694
581927
|
if (gist) {
|
|
581695
581928
|
this.emit({
|
|
581696
581929
|
type: "status",
|
|
@@ -581716,7 +581949,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581716
581949
|
this._taskMemoryStore.insert({
|
|
581717
581950
|
sessionId: this._sessionId,
|
|
581718
581951
|
repoRoot: process.cwd(),
|
|
581719
|
-
goal:
|
|
581952
|
+
goal: persistentTaskGoal.slice(0, 500),
|
|
581720
581953
|
constraints: [],
|
|
581721
581954
|
filesTouched: [],
|
|
581722
581955
|
patches: [],
|
|
@@ -581743,7 +581976,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581743
581976
|
}
|
|
581744
581977
|
if (this._proceduralMemoryStore && completed) {
|
|
581745
581978
|
try {
|
|
581746
|
-
const strategy = `Task "${
|
|
581979
|
+
const strategy = `Task "${persistentTaskGoal.slice(0, 100)}" completed using tools: ${(this._toolSequence || []).slice(0, 5).join(" → ")}`;
|
|
581747
581980
|
this._proceduralMemoryStore.create({
|
|
581748
581981
|
content: strategy,
|
|
581749
581982
|
category: "strategy"
|
|
@@ -581778,7 +582011,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581778
582011
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
581779
582012
|
});
|
|
581780
582013
|
try {
|
|
581781
|
-
const { mkdirSync: mkdirSync106, readdirSync: readdirSync59, statSync: statSync59, unlinkSync:
|
|
582014
|
+
const { mkdirSync: mkdirSync106, readdirSync: readdirSync59, statSync: statSync59, unlinkSync: unlinkSync36, writeFileSync: writeFileSync91 } = __require("node:fs");
|
|
581782
582015
|
const { join: join179 } = __require("node:path");
|
|
581783
582016
|
const contextDir = join179(this._workingDirectory || process.cwd(), ".omnius", "context");
|
|
581784
582017
|
mkdirSync106(contextDir, { recursive: true });
|
|
@@ -581858,7 +582091,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581858
582091
|
}
|
|
581859
582092
|
for (const filePath of toDelete) {
|
|
581860
582093
|
try {
|
|
581861
|
-
|
|
582094
|
+
unlinkSync36(filePath);
|
|
581862
582095
|
} catch {
|
|
581863
582096
|
}
|
|
581864
582097
|
}
|
|
@@ -581899,7 +582132,7 @@ ${this._completionCaveat}` : this._completionCaveat;
|
|
|
581899
582132
|
// CLEAN task — this file is the prerequisite for ALL future RL/RFT
|
|
581900
582133
|
// training. Storing the scaffolded version would teach future models
|
|
581901
582134
|
// to reproduce signpost text as part of their task understanding.
|
|
581902
|
-
task:
|
|
582135
|
+
task: persistentTaskGoal.slice(0, 1e3),
|
|
581903
582136
|
outcome: completed ? "pass" : this.aborted ? "aborted" : runStatus === "incomplete_verification" ? "incomplete_verification" : "timeout",
|
|
581904
582137
|
model: this.backend.model ?? "unknown",
|
|
581905
582138
|
modelTier: this.options.modelTier ?? "large",
|
|
@@ -583425,7 +583658,11 @@ ${trimmedNew}`;
|
|
|
583425
583658
|
this._adversaryStream.observe({
|
|
583426
583659
|
turn,
|
|
583427
583660
|
assistantText,
|
|
583428
|
-
recentToolOutcomes: this._adversaryToolOutcomes.slice(-8).map((o2) => ({
|
|
583661
|
+
recentToolOutcomes: this._adversaryToolOutcomes.slice(-8).map((o2) => ({
|
|
583662
|
+
tool: o2.tool,
|
|
583663
|
+
succeeded: o2.succeeded,
|
|
583664
|
+
preview: o2.preview
|
|
583665
|
+
})),
|
|
583429
583666
|
claimsCompletion: /task.?complete|all tests pass|\bdone\b|\bcomplete(d)?\b/i.test(assistantText)
|
|
583430
583667
|
});
|
|
583431
583668
|
void this._adversaryStream.tick().catch(() => {
|
|
@@ -585160,7 +585397,7 @@ ${result}`
|
|
|
585160
585397
|
let resizedBase64 = null;
|
|
585161
585398
|
try {
|
|
585162
585399
|
const { execSync: execSync63 } = await import("node:child_process");
|
|
585163
|
-
const { writeFileSync: writeFileSync91, readFileSync: readFileSync133, unlinkSync:
|
|
585400
|
+
const { writeFileSync: writeFileSync91, readFileSync: readFileSync133, unlinkSync: unlinkSync36 } = await import("node:fs");
|
|
585164
585401
|
const { join: join179 } = await import("node:path");
|
|
585165
585402
|
const { tmpdir: tmpdir24 } = await import("node:os");
|
|
585166
585403
|
const tmpIn = join179(tmpdir24(), `omnius_img_in_${Date.now()}.png`);
|
|
@@ -585173,11 +585410,11 @@ ${result}`
|
|
|
585173
585410
|
const resizedBuf = readFileSync133(tmpOut);
|
|
585174
585411
|
resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
|
|
585175
585412
|
try {
|
|
585176
|
-
|
|
585413
|
+
unlinkSync36(tmpIn);
|
|
585177
585414
|
} catch {
|
|
585178
585415
|
}
|
|
585179
585416
|
try {
|
|
585180
|
-
|
|
585417
|
+
unlinkSync36(tmpOut);
|
|
585181
585418
|
} catch {
|
|
585182
585419
|
}
|
|
585183
585420
|
} catch {
|
|
@@ -588250,7 +588487,7 @@ var init_composite_scorer = __esm({
|
|
|
588250
588487
|
});
|
|
588251
588488
|
|
|
588252
588489
|
// packages/orchestrator/dist/memory/materialization-policy.js
|
|
588253
|
-
import { createHash as
|
|
588490
|
+
import { createHash as createHash28 } from "node:crypto";
|
|
588254
588491
|
function materializeMemoryItems(items, options2 = {}) {
|
|
588255
588492
|
const config = options2.config ?? DEFAULT_WEIGHTING_CONFIG;
|
|
588256
588493
|
const sorted = [...items].sort((a2, b) => b.weight - a2.weight || a2.id.localeCompare(b.id));
|
|
@@ -588488,7 +588725,7 @@ function estimateTokens4(text2) {
|
|
|
588488
588725
|
return Math.max(1, Math.ceil(text2.length / 4));
|
|
588489
588726
|
}
|
|
588490
588727
|
function hashText(text2) {
|
|
588491
|
-
return
|
|
588728
|
+
return createHash28("sha256").update(text2).digest("hex");
|
|
588492
588729
|
}
|
|
588493
588730
|
var init_materialization_policy = __esm({
|
|
588494
588731
|
"packages/orchestrator/dist/memory/materialization-policy.js"() {
|
|
@@ -588652,7 +588889,7 @@ var init_config_loader = __esm({
|
|
|
588652
588889
|
});
|
|
588653
588890
|
|
|
588654
588891
|
// packages/orchestrator/dist/memory/stability-tracker.js
|
|
588655
|
-
import { createHash as
|
|
588892
|
+
import { createHash as createHash29 } from "node:crypto";
|
|
588656
588893
|
import { existsSync as existsSync101, mkdirSync as mkdirSync56, readFileSync as readFileSync78, writeFileSync as writeFileSync47 } from "node:fs";
|
|
588657
588894
|
import { dirname as dirname35, join as join111 } from "node:path";
|
|
588658
588895
|
function stabilityFilePath(repoRoot) {
|
|
@@ -588716,7 +588953,7 @@ function computeStabilityHash(item) {
|
|
|
588716
588953
|
item.scope.name,
|
|
588717
588954
|
item.topicKey
|
|
588718
588955
|
].join("|");
|
|
588719
|
-
return
|
|
588956
|
+
return createHash29("sha256").update(normalized).digest("hex");
|
|
588720
588957
|
}
|
|
588721
588958
|
function normalizeContent2(content) {
|
|
588722
588959
|
return content.replace(/\s+/g, " ").trim();
|
|
@@ -592131,10 +592368,10 @@ var init_project_arc = __esm({
|
|
|
592131
592368
|
});
|
|
592132
592369
|
|
|
592133
592370
|
// packages/orchestrator/dist/dedup-gate.js
|
|
592134
|
-
import { createHash as
|
|
592371
|
+
import { createHash as createHash30 } from "node:crypto";
|
|
592135
592372
|
function fingerprintCall(name10, args) {
|
|
592136
592373
|
const canon = canonicalize(args);
|
|
592137
|
-
return
|
|
592374
|
+
return createHash30("sha1").update(`${name10}\0${canon}`).digest("hex").slice(0, 16);
|
|
592138
592375
|
}
|
|
592139
592376
|
function canonicalize(value2) {
|
|
592140
592377
|
if (value2 === null || typeof value2 !== "object")
|
|
@@ -596419,7 +596656,7 @@ var require_websocket3 = __commonJS({
|
|
|
596419
596656
|
var http6 = __require("http");
|
|
596420
596657
|
var net5 = __require("net");
|
|
596421
596658
|
var tls2 = __require("tls");
|
|
596422
|
-
var { randomBytes: randomBytes30, createHash:
|
|
596659
|
+
var { randomBytes: randomBytes30, createHash: createHash45 } = __require("crypto");
|
|
596423
596660
|
var { Duplex: Duplex3, Readable } = __require("stream");
|
|
596424
596661
|
var { URL: URL3 } = __require("url");
|
|
596425
596662
|
var PerMessageDeflate3 = require_permessage_deflate3();
|
|
@@ -597079,7 +597316,7 @@ var require_websocket3 = __commonJS({
|
|
|
597079
597316
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
597080
597317
|
return;
|
|
597081
597318
|
}
|
|
597082
|
-
const digest3 =
|
|
597319
|
+
const digest3 = createHash45("sha1").update(key + GUID).digest("base64");
|
|
597083
597320
|
if (res.headers["sec-websocket-accept"] !== digest3) {
|
|
597084
597321
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
597085
597322
|
return;
|
|
@@ -597446,7 +597683,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
597446
597683
|
var EventEmitter15 = __require("events");
|
|
597447
597684
|
var http6 = __require("http");
|
|
597448
597685
|
var { Duplex: Duplex3 } = __require("stream");
|
|
597449
|
-
var { createHash:
|
|
597686
|
+
var { createHash: createHash45 } = __require("crypto");
|
|
597450
597687
|
var extension3 = require_extension3();
|
|
597451
597688
|
var PerMessageDeflate3 = require_permessage_deflate3();
|
|
597452
597689
|
var subprotocol3 = require_subprotocol2();
|
|
@@ -597747,7 +597984,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
597747
597984
|
);
|
|
597748
597985
|
}
|
|
597749
597986
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
597750
|
-
const digest3 =
|
|
597987
|
+
const digest3 = createHash45("sha1").update(key + GUID).digest("base64");
|
|
597751
597988
|
const headers = [
|
|
597752
597989
|
"HTTP/1.1 101 Switching Protocols",
|
|
597753
597990
|
"Upgrade: websocket",
|
|
@@ -604143,14 +604380,14 @@ var init_voice_session = __esm({
|
|
|
604143
604380
|
});
|
|
604144
604381
|
|
|
604145
604382
|
// packages/cli/src/tui/scoped-personality.ts
|
|
604146
|
-
import { createHash as
|
|
604383
|
+
import { createHash as createHash31 } from "node:crypto";
|
|
604147
604384
|
import { appendFileSync as appendFileSync9, existsSync as existsSync107, mkdirSync as mkdirSync64, readFileSync as readFileSync85, writeFileSync as writeFileSync54 } from "node:fs";
|
|
604148
604385
|
import { join as join121, resolve as resolve50 } from "node:path";
|
|
604149
604386
|
function safeName(input) {
|
|
604150
604387
|
return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
|
|
604151
604388
|
}
|
|
604152
604389
|
function scopeHash(scope) {
|
|
604153
|
-
return
|
|
604390
|
+
return createHash31("sha1").update(`${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
|
|
604154
604391
|
}
|
|
604155
604392
|
function scopedPersonalityDir(repoRoot, kind) {
|
|
604156
604393
|
return resolve50(repoRoot, ".omnius", "scoped-personality", kind);
|
|
@@ -604522,7 +604759,7 @@ var init_scoped_personality = __esm({
|
|
|
604522
604759
|
});
|
|
604523
604760
|
|
|
604524
604761
|
// packages/cli/src/tui/voice-soul.ts
|
|
604525
|
-
import { createHash as
|
|
604762
|
+
import { createHash as createHash32 } from "node:crypto";
|
|
604526
604763
|
import { existsSync as existsSync108, readdirSync as readdirSync35, readFileSync as readFileSync86 } from "node:fs";
|
|
604527
604764
|
import { basename as basename21, join as join122, resolve as resolve51 } from "node:path";
|
|
604528
604765
|
function compactText(text2, limit) {
|
|
@@ -604537,7 +604774,7 @@ function blockText(text2, limit) {
|
|
|
604537
604774
|
... [truncated]`;
|
|
604538
604775
|
}
|
|
604539
604776
|
function scopeStateKey(scope, surface) {
|
|
604540
|
-
return
|
|
604777
|
+
return createHash32("sha1").update(`${surface}:${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
|
|
604541
604778
|
}
|
|
604542
604779
|
function safeName2(input) {
|
|
604543
604780
|
return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
|
|
@@ -607181,7 +607418,7 @@ var init_types3 = __esm({
|
|
|
607181
607418
|
});
|
|
607182
607419
|
|
|
607183
607420
|
// packages/cli/src/tui/p2p/secret-vault.ts
|
|
607184
|
-
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes22, scryptSync as scryptSync2, createHash as
|
|
607421
|
+
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes22, scryptSync as scryptSync2, createHash as createHash33 } from "node:crypto";
|
|
607185
607422
|
import { readFileSync as readFileSync88, writeFileSync as writeFileSync56, existsSync as existsSync110, mkdirSync as mkdirSync66 } from "node:fs";
|
|
607186
607423
|
import { dirname as dirname38 } from "node:path";
|
|
607187
607424
|
var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
|
|
@@ -607426,7 +607663,7 @@ var init_secret_vault = __esm({
|
|
|
607426
607663
|
/** Generate a deterministic fingerprint of vault contents (for sync verification) */
|
|
607427
607664
|
fingerprint() {
|
|
607428
607665
|
const names = Array.from(this.secrets.keys()).sort();
|
|
607429
|
-
const hash =
|
|
607666
|
+
const hash = createHash33("sha256");
|
|
607430
607667
|
for (const name10 of names) {
|
|
607431
607668
|
hash.update(name10 + ":");
|
|
607432
607669
|
hash.update(this.secrets.get(name10).value);
|
|
@@ -607441,7 +607678,7 @@ var init_secret_vault = __esm({
|
|
|
607441
607678
|
// packages/cli/src/tui/p2p/peer-mesh.ts
|
|
607442
607679
|
import { EventEmitter as EventEmitter9 } from "node:events";
|
|
607443
607680
|
import { createServer as createServer6 } from "node:http";
|
|
607444
|
-
import { randomBytes as randomBytes23, createHash as
|
|
607681
|
+
import { randomBytes as randomBytes23, createHash as createHash34, generateKeyPairSync } from "node:crypto";
|
|
607445
607682
|
var PING_INTERVAL_MS, PEER_TIMEOUT_MS, GOSSIP_INTERVAL_MS, MAX_PEERS, PeerMesh;
|
|
607446
607683
|
var init_peer_mesh = __esm({
|
|
607447
607684
|
"packages/cli/src/tui/p2p/peer-mesh.ts"() {
|
|
@@ -607458,7 +607695,7 @@ var init_peer_mesh = __esm({
|
|
|
607458
607695
|
const { publicKey: publicKey2, privateKey } = generateKeyPairSync("ed25519");
|
|
607459
607696
|
this.publicKey = publicKey2.export({ type: "spki", format: "der" });
|
|
607460
607697
|
this.privateKey = privateKey.export({ type: "pkcs8", format: "der" });
|
|
607461
|
-
this.peerId =
|
|
607698
|
+
this.peerId = createHash34("sha256").update(this.publicKey).digest("base64url").slice(0, 22);
|
|
607462
607699
|
this.capabilities = options2.capabilities;
|
|
607463
607700
|
this.displayName = options2.displayName;
|
|
607464
607701
|
this._authKey = options2.authKey ?? randomBytes23(24).toString("base64url");
|
|
@@ -608823,7 +609060,7 @@ __export(omnius_directory_exports, {
|
|
|
608823
609060
|
import { appendFileSync as appendFileSync10, cpSync as cpSync2, existsSync as existsSync112, mkdirSync as mkdirSync68, readFileSync as readFileSync90, writeFileSync as writeFileSync58, readdirSync as readdirSync38, statSync as statSync41, unlinkSync as unlinkSync21, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync9, watch as fsWatch2 } from "node:fs";
|
|
608824
609061
|
import { join as join126, relative as relative12, basename as basename22, dirname as dirname39, resolve as resolve52 } from "node:path";
|
|
608825
609062
|
import { homedir as homedir38 } from "node:os";
|
|
608826
|
-
import { createHash as
|
|
609063
|
+
import { createHash as createHash36 } from "node:crypto";
|
|
608827
609064
|
function isGitRoot(dir) {
|
|
608828
609065
|
const gitPath = join126(dir, ".git");
|
|
608829
609066
|
if (!existsSync112(gitPath)) return false;
|
|
@@ -609277,7 +609514,7 @@ function buildHandoffPrompt(repoRoot) {
|
|
|
609277
609514
|
return lines.join("\n");
|
|
609278
609515
|
}
|
|
609279
609516
|
function computeDedupeHash(task, savedAt) {
|
|
609280
|
-
return
|
|
609517
|
+
return createHash36("sha256").update(`${task}|${savedAt}`).digest("hex").slice(0, 16);
|
|
609281
609518
|
}
|
|
609282
609519
|
function generateSessionId() {
|
|
609283
609520
|
const timestamp = Date.now().toString(36);
|
|
@@ -633754,7 +633991,7 @@ __export(commands_exports, {
|
|
|
633754
633991
|
});
|
|
633755
633992
|
import * as nodeOs from "node:os";
|
|
633756
633993
|
import { execSync as nodeExecSync, spawn as nodeSpawn2 } from "node:child_process";
|
|
633757
|
-
import { createHash as
|
|
633994
|
+
import { createHash as createHash37 } from "node:crypto";
|
|
633758
633995
|
import {
|
|
633759
633996
|
existsSync as existsSync132,
|
|
633760
633997
|
readFileSync as readFileSync106,
|
|
@@ -645879,7 +646116,7 @@ async function collectSponsorMediaStream(args) {
|
|
|
645879
646116
|
};
|
|
645880
646117
|
}
|
|
645881
646118
|
if (artifact.sha256) {
|
|
645882
|
-
const sha =
|
|
646119
|
+
const sha = createHash37("sha256").update(bytes).digest("hex");
|
|
645883
646120
|
if (sha !== artifact.sha256)
|
|
645884
646121
|
return { ok: false, error: `Artifact hash mismatch for ${artifactId}` };
|
|
645885
646122
|
}
|
|
@@ -660342,9 +660579,16 @@ var init_soul_observations = __esm({
|
|
|
660342
660579
|
});
|
|
660343
660580
|
|
|
660344
660581
|
// packages/cli/src/tui/telegram-channel-dmn.ts
|
|
660345
|
-
import {
|
|
660582
|
+
import {
|
|
660583
|
+
existsSync as existsSync144,
|
|
660584
|
+
mkdirSync as mkdirSync88,
|
|
660585
|
+
readdirSync as readdirSync52,
|
|
660586
|
+
readFileSync as readFileSync117,
|
|
660587
|
+
writeFileSync as writeFileSync76,
|
|
660588
|
+
unlinkSync as unlinkSync31
|
|
660589
|
+
} from "node:fs";
|
|
660346
660590
|
import { join as join156 } from "node:path";
|
|
660347
|
-
import { createHash as
|
|
660591
|
+
import { createHash as createHash38 } from "node:crypto";
|
|
660348
660592
|
function safeFilePart(value2) {
|
|
660349
660593
|
return value2.replace(/[^A-Za-z0-9_.-]+/g, "_").slice(0, 80) || "telegram";
|
|
660350
660594
|
}
|
|
@@ -660352,7 +660596,7 @@ function daydreamRoot(repoRoot) {
|
|
|
660352
660596
|
return join156(repoRoot, ".omnius", "telegram-daydreams");
|
|
660353
660597
|
}
|
|
660354
660598
|
function sessionDir(repoRoot, sessionKey) {
|
|
660355
|
-
const hash =
|
|
660599
|
+
const hash = createHash38("sha1").update(sessionKey).digest("hex").slice(0, 20);
|
|
660356
660600
|
return join156(daydreamRoot(repoRoot), safeFilePart(hash));
|
|
660357
660601
|
}
|
|
660358
660602
|
function compactLine2(value2, max = 220) {
|
|
@@ -660363,7 +660607,9 @@ function isoFromMs(value2) {
|
|
|
660363
660607
|
return value2 ? new Date(value2).toISOString() : void 0;
|
|
660364
660608
|
}
|
|
660365
660609
|
function topParticipants(input) {
|
|
660366
|
-
return [...input.participants].sort(
|
|
660610
|
+
return [...input.participants].sort(
|
|
660611
|
+
(a2, b) => b.messageCount - a2.messageCount || b.lastSeenTs - a2.lastSeenTs
|
|
660612
|
+
).slice(0, 8);
|
|
660367
660613
|
}
|
|
660368
660614
|
function recentUserMessages(input) {
|
|
660369
660615
|
return input.history.filter((entry) => entry.role === "user" && entry.text.trim()).slice(-18);
|
|
@@ -660375,7 +660621,9 @@ function buildRelationshipSignals(input) {
|
|
|
660375
660621
|
const tones = participant.toneTags.length ? ` tones=${participant.toneTags.slice(0, 5).join(",")}` : "";
|
|
660376
660622
|
const direct = participant.directAddressCount ? ` direct-addresses=${participant.directAddressCount}` : "";
|
|
660377
660623
|
const replies = participant.replyCount ? ` replies=${participant.replyCount}` : "";
|
|
660378
|
-
signals.push(
|
|
660624
|
+
signals.push(
|
|
660625
|
+
`${label}: messages=${participant.messageCount}${direct}${replies}${tones}; last="${compactLine2(participant.lastMessage, 160)}"`
|
|
660626
|
+
);
|
|
660379
660627
|
}
|
|
660380
660628
|
return signals;
|
|
660381
660629
|
}
|
|
@@ -660384,12 +660632,28 @@ function buildContextEngineeringNotes(input) {
|
|
|
660384
660632
|
const recent = recentUserMessages(input);
|
|
660385
660633
|
const replied = recent.filter((entry) => entry.replyToMessageId);
|
|
660386
660634
|
const media = recent.filter((entry) => entry.mediaSummary);
|
|
660387
|
-
const speakers = new Set(
|
|
660388
|
-
|
|
660389
|
-
|
|
660390
|
-
|
|
660391
|
-
|
|
660392
|
-
|
|
660635
|
+
const speakers = new Set(
|
|
660636
|
+
recent.map((entry) => entry.speaker || entry.username || "unknown")
|
|
660637
|
+
);
|
|
660638
|
+
notes.push(
|
|
660639
|
+
`Keep the next prompt anchored to ${speakers.size} active participant(s) and ${recent.length} recent user message(s).`
|
|
660640
|
+
);
|
|
660641
|
+
if (replied.length > 0)
|
|
660642
|
+
notes.push(
|
|
660643
|
+
`Preserve ${replied.length} reply relationship(s) explicitly; pronouns like this/that likely refer to replied-to content.`
|
|
660644
|
+
);
|
|
660645
|
+
if (media.length > 0)
|
|
660646
|
+
notes.push(
|
|
660647
|
+
`Recent media appears in the room; keep paths as tool-only context and avoid exposing local paths in visible Telegram replies.`
|
|
660648
|
+
);
|
|
660649
|
+
if (input.memoryCards.length > 0)
|
|
660650
|
+
notes.push(
|
|
660651
|
+
`Use existing scoped memory cards before claiming prior context is unavailable.`
|
|
660652
|
+
);
|
|
660653
|
+
if (input.stimulationContext)
|
|
660654
|
+
notes.push(
|
|
660655
|
+
"Route decisions should consider the stimulation state but must still infer reply need from the live thread."
|
|
660656
|
+
);
|
|
660393
660657
|
return notes;
|
|
660394
660658
|
}
|
|
660395
660659
|
function buildOpenQuestions(input) {
|
|
@@ -660398,9 +660662,15 @@ function buildOpenQuestions(input) {
|
|
|
660398
660662
|
for (const entry of recent.slice(-10)) {
|
|
660399
660663
|
const text2 = compactLine2(entry.text, 180);
|
|
660400
660664
|
if (/[??]\s*$/.test(text2)) {
|
|
660401
|
-
questions.push(
|
|
660402
|
-
|
|
660403
|
-
|
|
660665
|
+
questions.push(
|
|
660666
|
+
`${entry.speaker || entry.username || "user"} asked: ${text2}`
|
|
660667
|
+
);
|
|
660668
|
+
} else if (/\b(unclear|not sure|maybe|wonder|how do we|what if|why|need to)\b/i.test(
|
|
660669
|
+
text2
|
|
660670
|
+
)) {
|
|
660671
|
+
questions.push(
|
|
660672
|
+
`${entry.speaker || entry.username || "user"} left an unresolved thread: ${text2}`
|
|
660673
|
+
);
|
|
660404
660674
|
}
|
|
660405
660675
|
}
|
|
660406
660676
|
return questions.slice(-6);
|
|
@@ -660437,7 +660707,7 @@ function buildReplyOpportunities(input, openQuestions) {
|
|
|
660437
660707
|
return opportunities;
|
|
660438
660708
|
}
|
|
660439
660709
|
function daydreamOpportunityId(input, trigger) {
|
|
660440
|
-
return
|
|
660710
|
+
return createHash38("sha1").update(`${input.sessionKey}:${input.generatedAtMs}:${trigger}`).digest("hex").slice(0, 16);
|
|
660441
660711
|
}
|
|
660442
660712
|
function clamp0112(value2) {
|
|
660443
660713
|
if (!Number.isFinite(value2)) return 0;
|
|
@@ -660449,8 +660719,15 @@ function messageLabel(entry) {
|
|
|
660449
660719
|
function pushStimulationSignal(signals, signal, source, weight) {
|
|
660450
660720
|
const cleanSignal = compactLine2(signal, 120);
|
|
660451
660721
|
const cleanSource = compactLine2(source, 180);
|
|
660452
|
-
if (!cleanSignal || signals.some(
|
|
660453
|
-
|
|
660722
|
+
if (!cleanSignal || signals.some(
|
|
660723
|
+
(entry) => entry.signal === cleanSignal && entry.source === cleanSource
|
|
660724
|
+
))
|
|
660725
|
+
return;
|
|
660726
|
+
signals.push({
|
|
660727
|
+
signal: cleanSignal,
|
|
660728
|
+
source: cleanSource,
|
|
660729
|
+
weight: clamp0112(weight)
|
|
660730
|
+
});
|
|
660454
660731
|
}
|
|
660455
660732
|
function buildMetaAnalysisSignals(input) {
|
|
660456
660733
|
const chatLabel = input.chatTitle || input.chatId;
|
|
@@ -660467,39 +660744,91 @@ function buildHumanStimulationSignals(input) {
|
|
|
660467
660744
|
const participants = topParticipants(input);
|
|
660468
660745
|
const last2 = recent[recent.length - 1];
|
|
660469
660746
|
if (input.stimulationContext) {
|
|
660470
|
-
pushStimulationSignal(
|
|
660747
|
+
pushStimulationSignal(
|
|
660748
|
+
signals,
|
|
660749
|
+
"idle stimulation snapshot available",
|
|
660750
|
+
input.stimulationContext.split("\n").slice(0, 2).join(" / "),
|
|
660751
|
+
0.42
|
|
660752
|
+
);
|
|
660471
660753
|
}
|
|
660472
660754
|
if (participants.length > 1) {
|
|
660473
|
-
pushStimulationSignal(
|
|
660755
|
+
pushStimulationSignal(
|
|
660756
|
+
signals,
|
|
660757
|
+
"multi-person social context",
|
|
660758
|
+
`${participants.length} active participant profiles`,
|
|
660759
|
+
0.58
|
|
660760
|
+
);
|
|
660474
660761
|
}
|
|
660475
660762
|
for (const participant of participants.slice(0, 5)) {
|
|
660476
660763
|
if (participant.directAddressCount > 0) {
|
|
660477
|
-
pushStimulationSignal(
|
|
660764
|
+
pushStimulationSignal(
|
|
660765
|
+
signals,
|
|
660766
|
+
"direct agent address history",
|
|
660767
|
+
`${participant.username || participant.firstName}: ${participant.directAddressCount} direct address(es)`,
|
|
660768
|
+
0.74
|
|
660769
|
+
);
|
|
660478
660770
|
}
|
|
660479
660771
|
if (participant.replyCount > 0) {
|
|
660480
|
-
pushStimulationSignal(
|
|
660772
|
+
pushStimulationSignal(
|
|
660773
|
+
signals,
|
|
660774
|
+
"reply-chain salience",
|
|
660775
|
+
`${participant.username || participant.firstName}: ${participant.replyCount} reply relationship(s)`,
|
|
660776
|
+
0.68
|
|
660777
|
+
);
|
|
660481
660778
|
}
|
|
660482
660779
|
if (participant.toneTags.includes("frustrated") || participant.toneTags.includes("technical")) {
|
|
660483
|
-
pushStimulationSignal(
|
|
660780
|
+
pushStimulationSignal(
|
|
660781
|
+
signals,
|
|
660782
|
+
"high-specificity user state",
|
|
660783
|
+
`${participant.username || participant.firstName}: tones=${participant.toneTags.slice(0, 5).join(",")}`,
|
|
660784
|
+
0.61
|
|
660785
|
+
);
|
|
660484
660786
|
}
|
|
660485
660787
|
}
|
|
660486
660788
|
for (const entry of recent.slice(-8)) {
|
|
660487
660789
|
const text2 = compactLine2(entry.text, 160);
|
|
660488
660790
|
if (/[??]\s*$/.test(text2)) {
|
|
660489
|
-
pushStimulationSignal(
|
|
660791
|
+
pushStimulationSignal(
|
|
660792
|
+
signals,
|
|
660793
|
+
"open question",
|
|
660794
|
+
`${messageLabel(entry)}: ${text2}`,
|
|
660795
|
+
0.7
|
|
660796
|
+
);
|
|
660490
660797
|
}
|
|
660491
|
-
if (/\b(wonder|curious|why|how|what if|not sure|maybe|confused|unclear)\b/i.test(
|
|
660492
|
-
|
|
660798
|
+
if (/\b(wonder|curious|why|how|what if|not sure|maybe|confused|unclear)\b/i.test(
|
|
660799
|
+
text2
|
|
660800
|
+
)) {
|
|
660801
|
+
pushStimulationSignal(
|
|
660802
|
+
signals,
|
|
660803
|
+
"curiosity or uncertainty cue",
|
|
660804
|
+
`${messageLabel(entry)}: ${text2}`,
|
|
660805
|
+
0.64
|
|
660806
|
+
);
|
|
660493
660807
|
}
|
|
660494
660808
|
if (entry.mediaSummary) {
|
|
660495
|
-
pushStimulationSignal(
|
|
660809
|
+
pushStimulationSignal(
|
|
660810
|
+
signals,
|
|
660811
|
+
"multimodal memory cue",
|
|
660812
|
+
`${messageLabel(entry)}: ${entry.mediaSummary}`,
|
|
660813
|
+
0.66
|
|
660814
|
+
);
|
|
660496
660815
|
}
|
|
660497
660816
|
if (entry.replyToMessageId) {
|
|
660498
|
-
pushStimulationSignal(
|
|
660817
|
+
pushStimulationSignal(
|
|
660818
|
+
signals,
|
|
660819
|
+
"explicit reply dependency",
|
|
660820
|
+
`${messageLabel(entry)} replied to message ${entry.replyToMessageId}`,
|
|
660821
|
+
0.72
|
|
660822
|
+
);
|
|
660499
660823
|
}
|
|
660500
660824
|
}
|
|
660501
660825
|
if (last2 && /\b(omnius|bot|agent)\b/i.test(last2.text)) {
|
|
660502
|
-
pushStimulationSignal(
|
|
660826
|
+
pushStimulationSignal(
|
|
660827
|
+
signals,
|
|
660828
|
+
"agent-name mention",
|
|
660829
|
+
`${messageLabel(last2)}: ${compactLine2(last2.text, 160)}`,
|
|
660830
|
+
0.57
|
|
660831
|
+
);
|
|
660503
660832
|
}
|
|
660504
660833
|
return signals.sort((a2, b) => b.weight - a2.weight).slice(0, 12);
|
|
660505
660834
|
}
|
|
@@ -660512,7 +660841,9 @@ function buildCuriosityThreads(input, openQuestions, stimulationSignals) {
|
|
|
660512
660841
|
const threads = [];
|
|
660513
660842
|
const recent = recentUserMessages(input);
|
|
660514
660843
|
const sourceEntries = recent.filter(
|
|
660515
|
-
(entry) => /[??]\s*$/.test(entry.text) || /\b(wonder|curious|why|how do we|what if|not sure|maybe|need to|unclear|confused)\b/i.test(
|
|
660844
|
+
(entry) => /[??]\s*$/.test(entry.text) || /\b(wonder|curious|why|how do we|what if|not sure|maybe|need to|unclear|confused)\b/i.test(
|
|
660845
|
+
entry.text
|
|
660846
|
+
) || entry.mediaSummary
|
|
660516
660847
|
);
|
|
660517
660848
|
for (const entry of sourceEntries.slice(-6)) {
|
|
660518
660849
|
const text2 = compactLine2(entry.text, 220);
|
|
@@ -660529,7 +660860,10 @@ function buildCuriosityThreads(input, openQuestions, stimulationSignals) {
|
|
|
660529
660860
|
});
|
|
660530
660861
|
}
|
|
660531
660862
|
for (const question of openQuestions.slice(-4)) {
|
|
660532
|
-
if (threads.some(
|
|
660863
|
+
if (threads.some(
|
|
660864
|
+
(thread) => question.includes(thread.title) || thread.question.includes(question)
|
|
660865
|
+
))
|
|
660866
|
+
continue;
|
|
660533
660867
|
threads.push({
|
|
660534
660868
|
title: titleFromText(question),
|
|
660535
660869
|
question,
|
|
@@ -660600,13 +660934,19 @@ function buildScopedExplorationTools(input) {
|
|
|
660600
660934
|
}
|
|
660601
660935
|
function participantForThread(input, thread) {
|
|
660602
660936
|
const sourceIds = new Set(thread.sourceMessages);
|
|
660603
|
-
const sourceMessage = input.history.find(
|
|
660937
|
+
const sourceMessage = input.history.find(
|
|
660938
|
+
(entry) => typeof entry.messageId === "number" && sourceIds.has(entry.messageId)
|
|
660939
|
+
);
|
|
660604
660940
|
if (sourceMessage?.username) {
|
|
660605
|
-
return input.participants.find(
|
|
660941
|
+
return input.participants.find(
|
|
660942
|
+
(participant) => participant.username === sourceMessage.username
|
|
660943
|
+
);
|
|
660606
660944
|
}
|
|
660607
660945
|
if (sourceMessage?.speaker) {
|
|
660608
660946
|
const clean5 = sourceMessage.speaker.replace(/^@/, "");
|
|
660609
|
-
return input.participants.find(
|
|
660947
|
+
return input.participants.find(
|
|
660948
|
+
(participant) => participant.username === clean5 || participant.firstName === sourceMessage.speaker
|
|
660949
|
+
);
|
|
660610
660950
|
}
|
|
660611
660951
|
return topParticipants(input)[0];
|
|
660612
660952
|
}
|
|
@@ -660637,9 +660977,17 @@ function buildOutreachPlans(input, curiosityThreads) {
|
|
|
660637
660977
|
return plans.slice(0, 8);
|
|
660638
660978
|
}
|
|
660639
660979
|
function personaDirectiveLines(personaContext) {
|
|
660640
|
-
const lines = (personaContext || "").split("\n").map((line) => compactLine2(line.replace(/^[-#*\s]+/, ""), 180)).filter(
|
|
660980
|
+
const lines = (personaContext || "").split("\n").map((line) => compactLine2(line.replace(/^[-#*\s]+/, ""), 180)).filter(
|
|
660981
|
+
(line) => line && !/^```/.test(line) && !/^Scope:/.test(line) && !/^Updated:/.test(line)
|
|
660982
|
+
).filter(
|
|
660983
|
+
(line) => !/Scoped Personality Profile|Scoped Personality Driver|Messages observed/i.test(
|
|
660984
|
+
line
|
|
660985
|
+
)
|
|
660986
|
+
);
|
|
660641
660987
|
const selected = lines.filter(
|
|
660642
|
-
(line) => /\b(prefer|use|track|mirror|answer|do not|avoid|boundary|relationship|tone|style|guidance)\b/i.test(
|
|
660988
|
+
(line) => /\b(prefer|use|track|mirror|answer|do not|avoid|boundary|relationship|tone|style|guidance)\b/i.test(
|
|
660989
|
+
line
|
|
660990
|
+
)
|
|
660643
660991
|
).slice(0, 8);
|
|
660644
660992
|
if (selected.length > 0) return selected;
|
|
660645
660993
|
return [
|
|
@@ -660655,7 +661003,8 @@ function buildPersonaSteering(input) {
|
|
|
660655
661003
|
"Maintain high curiosity during private analysis while keeping visible public replies low-intrusion.",
|
|
660656
661004
|
"Use scoped tool evidence before follow-up; do not turn curiosity into unsolicited claims."
|
|
660657
661005
|
]) {
|
|
660658
|
-
if (!directives.some((line) => line === required))
|
|
661006
|
+
if (!directives.some((line) => line === required))
|
|
661007
|
+
directives.push(required);
|
|
660659
661008
|
}
|
|
660660
661009
|
return {
|
|
660661
661010
|
source: input.personaContext ? "scoped-personality document" : "default Telegram daydream steering",
|
|
@@ -660731,7 +661080,11 @@ function buildTelegramChannelDaydream(input, corpus, extraction, extractionCommi
|
|
|
660731
661080
|
const relationshipSignals = buildRelationshipSignals(input);
|
|
660732
661081
|
const contextEngineeringNotes = buildContextEngineeringNotes(input);
|
|
660733
661082
|
const openQuestions = buildOpenQuestions(input);
|
|
660734
|
-
const curiosityThreads = buildCuriosityThreads(
|
|
661083
|
+
const curiosityThreads = buildCuriosityThreads(
|
|
661084
|
+
input,
|
|
661085
|
+
openQuestions,
|
|
661086
|
+
humanStimulationSignals
|
|
661087
|
+
);
|
|
660735
661088
|
const scopedExplorationTools = buildScopedExplorationTools(input);
|
|
660736
661089
|
const outreachPlans = buildOutreachPlans(input, curiosityThreads);
|
|
660737
661090
|
const personaSteering = buildPersonaSteering(input);
|
|
@@ -660753,11 +661106,13 @@ function buildTelegramChannelDaydream(input, corpus, extraction, extractionCommi
|
|
|
660753
661106
|
kind: "memory_card",
|
|
660754
661107
|
rationale: "Promote repeated user/channel patterns into scoped memory cards rather than raw transcript clutter."
|
|
660755
661108
|
} : null
|
|
660756
|
-
].filter(
|
|
661109
|
+
].filter(
|
|
661110
|
+
(entry) => Boolean(entry)
|
|
661111
|
+
);
|
|
660757
661112
|
const seed = `${input.sessionKey}:${input.generatedAtMs}:${input.history.length}`;
|
|
660758
661113
|
return {
|
|
660759
661114
|
version: 3,
|
|
660760
|
-
id:
|
|
661115
|
+
id: createHash38("sha1").update(seed).digest("hex").slice(0, 16),
|
|
660761
661116
|
sessionKey: input.sessionKey,
|
|
660762
661117
|
chatId: input.chatId,
|
|
660763
661118
|
chatTitle: input.chatTitle,
|
|
@@ -660795,7 +661150,10 @@ function buildTelegramChannelDaydream(input, corpus, extraction, extractionCommi
|
|
|
660795
661150
|
};
|
|
660796
661151
|
}
|
|
660797
661152
|
function formatTelegramChannelDaydreamMarkdown(artifact) {
|
|
660798
|
-
const section = (title, lines) => [
|
|
661153
|
+
const section = (title, lines) => [
|
|
661154
|
+
`## ${title}`,
|
|
661155
|
+
lines.length ? lines.map((line) => `- ${line}`).join("\n") : "- None"
|
|
661156
|
+
].join("\n");
|
|
660799
661157
|
return [
|
|
660800
661158
|
`# Telegram Channel Daydream ${artifact.id}`,
|
|
660801
661159
|
"",
|
|
@@ -660816,51 +661174,71 @@ function formatTelegramChannelDaydreamMarkdown(artifact) {
|
|
|
660816
661174
|
Selected seed: ${artifact.selectedSeed.nodeText} (${artifact.selectedSeed.nodeType}, degree ${artifact.selectedSeed.degree})` : "",
|
|
660817
661175
|
"",
|
|
660818
661176
|
"## Tags",
|
|
660819
|
-
artifact.tagging.length ? artifact.tagging.map(
|
|
661177
|
+
artifact.tagging.length ? artifact.tagging.map(
|
|
661178
|
+
(item) => `- ${item.label} [${item.kind}] confidence=${item.confidence.toFixed(2)}${item.sourceMessageIds.length ? ` messages=${item.sourceMessageIds.join(", ")}` : ""}`
|
|
661179
|
+
).join("\n") : "- None",
|
|
660820
661180
|
"",
|
|
660821
661181
|
"## Summaries",
|
|
660822
|
-
artifact.summation.length ? artifact.summation.map(
|
|
661182
|
+
artifact.summation.length ? artifact.summation.map(
|
|
661183
|
+
(item) => `- ${item.title} [${item.scope}] confidence=${item.confidence.toFixed(2)}
|
|
660823
661184
|
${item.text}${item.sourceMessageIds.length ? `
|
|
660824
|
-
messages=${item.sourceMessageIds.join(", ")}` : ""}`
|
|
661185
|
+
messages=${item.sourceMessageIds.join(", ")}` : ""}`
|
|
661186
|
+
).join("\n") : "- None",
|
|
660825
661187
|
"",
|
|
660826
661188
|
"## Titles",
|
|
660827
|
-
artifact.titling.length ? artifact.titling.map(
|
|
661189
|
+
artifact.titling.length ? artifact.titling.map(
|
|
661190
|
+
(item) => `- ${item.title} -> ${item.target} confidence=${item.confidence.toFixed(2)}`
|
|
661191
|
+
).join("\n") : "- None",
|
|
660828
661192
|
"",
|
|
660829
661193
|
"## Extractions",
|
|
660830
|
-
artifact.extraction.length ? artifact.extraction.map(
|
|
661194
|
+
artifact.extraction.length ? artifact.extraction.map(
|
|
661195
|
+
(item) => `- ${item.kind}: ${item.text} confidence=${item.confidence.toFixed(2)}${item.sourceMessageIds.length ? ` messages=${item.sourceMessageIds.join(", ")}` : ""}`
|
|
661196
|
+
).join("\n") : "- None",
|
|
660831
661197
|
"",
|
|
660832
661198
|
"## Links",
|
|
660833
|
-
artifact.linking.length ? artifact.linking.map(
|
|
661199
|
+
artifact.linking.length ? artifact.linking.map(
|
|
661200
|
+
(item) => `- ${item.srcNodeText} --${item.relation}--> ${item.dstNodeText} confidence=${item.confidence.toFixed(2)}
|
|
660834
661201
|
${item.fact}${item.sourceMessageIds.length ? `
|
|
660835
|
-
messages=${item.sourceMessageIds.join(", ")}` : ""}`
|
|
661202
|
+
messages=${item.sourceMessageIds.join(", ")}` : ""}`
|
|
661203
|
+
).join("\n") : "- None",
|
|
660836
661204
|
"",
|
|
660837
661205
|
"## Extraction Followups",
|
|
660838
|
-
artifact.extractionFollowups.length ? artifact.extractionFollowups.map(
|
|
660839
|
-
|
|
661206
|
+
artifact.extractionFollowups.length ? artifact.extractionFollowups.map(
|
|
661207
|
+
(item) => `- ${item.target}${item.replyToMessageId ? ` reply_to=${item.replyToMessageId}` : ""} confidence=${item.confidence.toFixed(2)}
|
|
661208
|
+
${item.text || item.rationale}`
|
|
661209
|
+
).join("\n") : "- None",
|
|
660840
661210
|
"",
|
|
660841
661211
|
section("Meta-Analysis Signals", artifact.metaAnalysisSignals),
|
|
660842
661212
|
"",
|
|
660843
661213
|
"## Human Stimulation Signals",
|
|
660844
|
-
artifact.humanStimulationSignals.length ? artifact.humanStimulationSignals.map(
|
|
661214
|
+
artifact.humanStimulationSignals.length ? artifact.humanStimulationSignals.map(
|
|
661215
|
+
(item) => `- ${item.signal}: ${item.source} (weight ${item.weight.toFixed(2)})`
|
|
661216
|
+
).join("\n") : "- None",
|
|
660845
661217
|
"",
|
|
660846
661218
|
"## Curiosity Threads",
|
|
660847
|
-
artifact.curiosityThreads.length ? artifact.curiosityThreads.map(
|
|
661219
|
+
artifact.curiosityThreads.length ? artifact.curiosityThreads.map(
|
|
661220
|
+
(item) => `- ${item.title}
|
|
660848
661221
|
- question: ${item.question}
|
|
660849
661222
|
- rationale: ${item.rationale}
|
|
660850
661223
|
- intensity: ${item.intensity.toFixed(2)}${item.sourceMessages.length ? `
|
|
660851
|
-
- source messages: ${item.sourceMessages.join(", ")}` : ""}`
|
|
661224
|
+
- source messages: ${item.sourceMessages.join(", ")}` : ""}`
|
|
661225
|
+
).join("\n") : "- None",
|
|
660852
661226
|
"",
|
|
660853
661227
|
"## Scoped Exploration Tool Suite",
|
|
660854
|
-
artifact.scopedExplorationTools.length ? artifact.scopedExplorationTools.map(
|
|
661228
|
+
artifact.scopedExplorationTools.length ? artifact.scopedExplorationTools.map(
|
|
661229
|
+
(item) => `- ${item.name} [${item.visibility}]
|
|
660855
661230
|
- scope: ${item.scope}
|
|
660856
|
-
- use: ${item.use}`
|
|
661231
|
+
- use: ${item.use}`
|
|
661232
|
+
).join("\n") : "- None",
|
|
660857
661233
|
"",
|
|
660858
661234
|
"## Outreach Plans",
|
|
660859
|
-
artifact.outreachPlans.length ? artifact.outreachPlans.map(
|
|
661235
|
+
artifact.outreachPlans.length ? artifact.outreachPlans.map(
|
|
661236
|
+
(item) => `- ${item.target}${item.recipient ? ` -> ${item.recipient}` : ""} [${item.gate}]
|
|
660860
661237
|
- trigger: ${item.trigger}
|
|
660861
661238
|
- purpose: ${item.purpose}
|
|
660862
661239
|
- draft intent: ${item.draftIntent}
|
|
660863
|
-
- confidence: ${item.confidence.toFixed(2)}`
|
|
661240
|
+
- confidence: ${item.confidence.toFixed(2)}`
|
|
661241
|
+
).join("\n") : "- None",
|
|
660864
661242
|
"",
|
|
660865
661243
|
"## Persona Steering",
|
|
660866
661244
|
`Source: ${artifact.personaSteering.source}`,
|
|
@@ -660873,15 +661251,19 @@ Selected seed: ${artifact.selectedSeed.nodeText} (${artifact.selectedSeed.nodeTy
|
|
|
660873
661251
|
section("Open Questions", artifact.openQuestions),
|
|
660874
661252
|
"",
|
|
660875
661253
|
"## Reply Opportunities",
|
|
660876
|
-
artifact.replyOpportunities.length ? artifact.replyOpportunities.map(
|
|
661254
|
+
artifact.replyOpportunities.length ? artifact.replyOpportunities.map(
|
|
661255
|
+
(item) => `- ${item.trigger}
|
|
660877
661256
|
- id: ${item.id}
|
|
660878
661257
|
- lifecycle: ${item.lifecycle}${item.lifecycleUpdatedAt ? ` at ${item.lifecycleUpdatedAt}` : ""}
|
|
660879
661258
|
- rationale: ${item.rationale}
|
|
660880
661259
|
- tone: ${item.suggestedTone}
|
|
660881
|
-
- confidence: ${item.confidence.toFixed(2)}`
|
|
661260
|
+
- confidence: ${item.confidence.toFixed(2)}`
|
|
661261
|
+
).join("\n") : "- None",
|
|
660882
661262
|
"",
|
|
660883
661263
|
"## Memory Proposals",
|
|
660884
|
-
artifact.memoryProposals.length ? artifact.memoryProposals.map(
|
|
661264
|
+
artifact.memoryProposals.length ? artifact.memoryProposals.map(
|
|
661265
|
+
(item) => `- ${item.title}: ${item.rationale}${item.sourceMessages.length ? ` (messages ${item.sourceMessages.join(", ")})` : ""}`
|
|
661266
|
+
).join("\n") : "- None",
|
|
660885
661267
|
"",
|
|
660886
661268
|
"## Artifact Proposals",
|
|
660887
661269
|
artifact.artifactProposals.length ? artifact.artifactProposals.map((item) => `- ${item.title} [${item.kind}]: ${item.rationale}`).join("\n") : "- None",
|
|
@@ -660889,17 +661271,65 @@ Selected seed: ${artifact.selectedSeed.nodeText} (${artifact.selectedSeed.nodeTy
|
|
|
660889
661271
|
## Stimulation Snapshot
|
|
660890
661272
|
|
|
660891
661273
|
\`\`\`text
|
|
660892
|
-
${artifact.stimulationContext}
|
|
661274
|
+
${artifact.stimulationContext.slice(0, 3e3)}
|
|
660893
661275
|
\`\`\`` : "",
|
|
660894
661276
|
artifact.personaContext ? `
|
|
660895
661277
|
## Persona Snapshot
|
|
660896
661278
|
|
|
660897
661279
|
\`\`\`text
|
|
660898
|
-
${artifact.personaContext}
|
|
661280
|
+
${artifact.personaContext.slice(0, 3e3)}
|
|
660899
661281
|
\`\`\`` : "",
|
|
660900
661282
|
""
|
|
660901
661283
|
].join("\n");
|
|
660902
661284
|
}
|
|
661285
|
+
function daydreamExtractionFailed(artifact) {
|
|
661286
|
+
const hasStructuredExtraction = artifact.tagging.length > 0 || artifact.summation.length > 0 || artifact.titling.length > 0 || artifact.extraction.length > 0 || artifact.linking.length > 0 || artifact.extractionFollowups.length > 0;
|
|
661287
|
+
if (hasStructuredExtraction) return false;
|
|
661288
|
+
return artifact.corpus.fallbacks.some(
|
|
661289
|
+
(fallback) => /structured extraction unavailable|timeout|no valid json|backend unavailable/i.test(
|
|
661290
|
+
fallback
|
|
661291
|
+
)
|
|
661292
|
+
);
|
|
661293
|
+
}
|
|
661294
|
+
function formatTelegramChannelDaydreamMetadataMarkdown(artifact) {
|
|
661295
|
+
return [
|
|
661296
|
+
`# Telegram Channel Daydream ${artifact.id}`,
|
|
661297
|
+
"",
|
|
661298
|
+
`Generated: ${artifact.generatedAt}`,
|
|
661299
|
+
`Session: ${artifact.sessionKey}`,
|
|
661300
|
+
`Chat: ${artifact.chatTitle || artifact.chatId} (${artifact.chatType})`,
|
|
661301
|
+
"Mode: metadata-only; structured extraction did not complete.",
|
|
661302
|
+
"",
|
|
661303
|
+
"## Reflection Corpus",
|
|
661304
|
+
artifact.corpus.stats ? [
|
|
661305
|
+
`- retained messages: ${artifact.corpus.stats.retainedMessages}`,
|
|
661306
|
+
`- candidate episodes: ${artifact.corpus.stats.candidateEpisodes}`,
|
|
661307
|
+
`- selected episodes: ${artifact.corpus.stats.selectedEpisodes}`,
|
|
661308
|
+
`- graph walk: ${artifact.corpus.stats.graphNodesVisited} node(s), ${artifact.corpus.stats.graphEdgesTraversed} edge(s)`
|
|
661309
|
+
].join("\n") : "- Not available",
|
|
661310
|
+
artifact.corpus.fallbacks.length ? `- fallbacks: ${artifact.corpus.fallbacks.join("; ")}` : "- fallbacks: none",
|
|
661311
|
+
"",
|
|
661312
|
+
"## Context Notes",
|
|
661313
|
+
artifact.contextEngineeringNotes.length ? artifact.contextEngineeringNotes.map((line) => `- ${line}`).join("\n") : "- None",
|
|
661314
|
+
""
|
|
661315
|
+
].join("\n");
|
|
661316
|
+
}
|
|
661317
|
+
function pruneTelegramChannelDaydreams(repoRoot, sessionKey, keep = DAYDREAM_ARTIFACT_RETENTION_LIMIT) {
|
|
661318
|
+
const dir = sessionDir(repoRoot, sessionKey);
|
|
661319
|
+
if (!existsSync144(dir)) return 0;
|
|
661320
|
+
const files = readdirSync52(dir).filter((f2) => f2.endsWith(".json") || f2.endsWith(".md")).sort();
|
|
661321
|
+
if (files.length <= keep * 2) return 0;
|
|
661322
|
+
const toRemove = files.slice(0, files.length - keep * 2);
|
|
661323
|
+
let removed = 0;
|
|
661324
|
+
for (const file of toRemove) {
|
|
661325
|
+
try {
|
|
661326
|
+
unlinkSync31(join156(dir, file));
|
|
661327
|
+
removed++;
|
|
661328
|
+
} catch {
|
|
661329
|
+
}
|
|
661330
|
+
}
|
|
661331
|
+
return removed;
|
|
661332
|
+
}
|
|
660903
661333
|
function writeTelegramChannelDaydream(repoRoot, artifact) {
|
|
660904
661334
|
const dir = sessionDir(repoRoot, artifact.sessionKey);
|
|
660905
661335
|
mkdirSync88(dir, { recursive: true });
|
|
@@ -660907,7 +661337,12 @@ function writeTelegramChannelDaydream(repoRoot, artifact) {
|
|
|
660907
661337
|
const jsonPath = join156(dir, `${base3}.json`);
|
|
660908
661338
|
const markdownPath = join156(dir, `${base3}.md`);
|
|
660909
661339
|
writeFileSync76(jsonPath, JSON.stringify(artifact, null, 2) + "\n", "utf8");
|
|
660910
|
-
writeFileSync76(
|
|
661340
|
+
writeFileSync76(
|
|
661341
|
+
markdownPath,
|
|
661342
|
+
daydreamExtractionFailed(artifact) ? formatTelegramChannelDaydreamMetadataMarkdown(artifact) : formatTelegramChannelDaydreamMarkdown(artifact),
|
|
661343
|
+
"utf8"
|
|
661344
|
+
);
|
|
661345
|
+
pruneTelegramChannelDaydreams(repoRoot, artifact.sessionKey);
|
|
660911
661346
|
return { dir, jsonPath, markdownPath };
|
|
660912
661347
|
}
|
|
660913
661348
|
function latestTelegramChannelDaydream(repoRoot, sessionKey) {
|
|
@@ -660916,7 +661351,9 @@ function latestTelegramChannelDaydream(repoRoot, sessionKey) {
|
|
|
660916
661351
|
const files = readdirSync52(dir).filter((file) => file.endsWith(".json")).sort();
|
|
660917
661352
|
for (const file of files.reverse()) {
|
|
660918
661353
|
try {
|
|
660919
|
-
return JSON.parse(
|
|
661354
|
+
return JSON.parse(
|
|
661355
|
+
readFileSync117(join156(dir, file), "utf8")
|
|
661356
|
+
);
|
|
660920
661357
|
} catch {
|
|
660921
661358
|
}
|
|
660922
661359
|
}
|
|
@@ -660931,25 +661368,39 @@ function formatTelegramChannelDaydreamContext(artifact) {
|
|
|
660931
661368
|
artifact.corpus?.stats ? `Corpus: ${artifact.corpus.stats.selectedEpisodes} selected episode(s), ${artifact.corpus.stats.graphNodesVisited} graph node(s), search limit ${artifact.corpus.stats.vectorSearchLimitUsed}` : "",
|
|
660932
661369
|
artifact.selectedSeed ? `Selected seed: ${artifact.selectedSeed.nodeText} (degree ${artifact.selectedSeed.degree})` : "",
|
|
660933
661370
|
artifact.tagging?.length ? `Tags:
|
|
660934
|
-
${artifact.tagging.slice(0, 8).map(
|
|
661371
|
+
${artifact.tagging.slice(0, 8).map(
|
|
661372
|
+
(item) => `- ${item.label} [${item.kind}] (${item.confidence.toFixed(2)})`
|
|
661373
|
+
).join("\n")}` : "",
|
|
660935
661374
|
artifact.summation?.length ? `Summaries:
|
|
660936
661375
|
${artifact.summation.slice(0, 4).map((item) => `- ${item.title}: ${item.text}`).join("\n")}` : "",
|
|
660937
661376
|
artifact.extraction?.length ? `Extracted items:
|
|
660938
|
-
${artifact.extraction.slice(0, 6).map(
|
|
661377
|
+
${artifact.extraction.slice(0, 6).map(
|
|
661378
|
+
(item) => `- ${item.kind}: ${item.text}${item.sourceMessageIds.length ? ` (messages ${item.sourceMessageIds.join(", ")})` : ""}`
|
|
661379
|
+
).join("\n")}` : "",
|
|
660939
661380
|
artifact.linking?.length ? `Graph links:
|
|
660940
|
-
${artifact.linking.slice(0, 5).map(
|
|
661381
|
+
${artifact.linking.slice(0, 5).map(
|
|
661382
|
+
(item) => `- ${item.srcNodeText} --${item.relation}--> ${item.dstNodeText}`
|
|
661383
|
+
).join("\n")}` : "",
|
|
660941
661384
|
artifact.extractionFollowups?.length ? `Extraction followups:
|
|
660942
|
-
${artifact.extractionFollowups.slice(0, 4).map(
|
|
661385
|
+
${artifact.extractionFollowups.slice(0, 4).map(
|
|
661386
|
+
(item) => `- ${item.target}${item.replyToMessageId ? ` reply_to=${item.replyToMessageId}` : ""}: ${item.text || item.rationale}`
|
|
661387
|
+
).join("\n")}` : "",
|
|
660943
661388
|
artifact.metaAnalysisSignals?.length ? `Meta-analysis signals:
|
|
660944
661389
|
${artifact.metaAnalysisSignals.slice(0, 4).map((line) => `- ${line}`).join("\n")}` : "",
|
|
660945
661390
|
artifact.humanStimulationSignals?.length ? `Human stimulation signals:
|
|
660946
|
-
${artifact.humanStimulationSignals.slice(0, 5).map(
|
|
661391
|
+
${artifact.humanStimulationSignals.slice(0, 5).map(
|
|
661392
|
+
(item) => `- ${item.signal}: ${item.source} (weight ${item.weight.toFixed(2)})`
|
|
661393
|
+
).join("\n")}` : "",
|
|
660947
661394
|
artifact.curiosityThreads?.length ? `Curiosity threads:
|
|
660948
|
-
${artifact.curiosityThreads.slice(0, 4).map(
|
|
661395
|
+
${artifact.curiosityThreads.slice(0, 4).map(
|
|
661396
|
+
(item) => `- ${item.question} (intensity ${item.intensity.toFixed(2)})`
|
|
661397
|
+
).join("\n")}` : "",
|
|
660949
661398
|
artifact.scopedExplorationTools?.length ? `Scoped exploration tools:
|
|
660950
661399
|
${artifact.scopedExplorationTools.slice(0, 6).map((item) => `- ${item.name}: ${item.scope}; ${item.use}`).join("\n")}` : "",
|
|
660951
661400
|
artifact.outreachPlans?.length ? `Outreach plans:
|
|
660952
|
-
${artifact.outreachPlans.slice(0, 4).map(
|
|
661401
|
+
${artifact.outreachPlans.slice(0, 4).map(
|
|
661402
|
+
(item) => `- ${item.target}${item.recipient ? ` -> ${item.recipient}` : ""}: ${item.trigger} (gate ${item.gate}; confidence ${item.confidence.toFixed(2)})`
|
|
661403
|
+
).join("\n")}` : "",
|
|
660953
661404
|
artifact.personaSteering?.directives?.length ? `Persona steering:
|
|
660954
661405
|
${artifact.personaSteering.directives.slice(0, 5).map((line) => `- ${line}`).join("\n")}` : "",
|
|
660955
661406
|
artifact.relationshipSignals.length ? `Relationship signals:
|
|
@@ -660959,23 +661410,27 @@ ${artifact.contextEngineeringNotes.slice(0, 5).map((line) => `- ${line}`).join("
|
|
|
660959
661410
|
artifact.openQuestions.length ? `Open questions:
|
|
660960
661411
|
${artifact.openQuestions.slice(0, 4).map((line) => `- ${line}`).join("\n")}` : "",
|
|
660961
661412
|
artifact.replyOpportunities.length ? `Possible reply opportunities:
|
|
660962
|
-
${artifact.replyOpportunities.slice(0, 3).map(
|
|
661413
|
+
${artifact.replyOpportunities.slice(0, 3).map(
|
|
661414
|
+
(item) => `- ${item.id} [${item.lifecycle}] ${item.trigger} (confidence ${item.confidence.toFixed(2)}; ${item.suggestedTone})`
|
|
661415
|
+
).join("\n")}` : ""
|
|
660963
661416
|
].filter(Boolean);
|
|
660964
661417
|
return lines.join("\n");
|
|
660965
661418
|
}
|
|
661419
|
+
var DAYDREAM_ARTIFACT_RETENTION_LIMIT;
|
|
660966
661420
|
var init_telegram_channel_dmn = __esm({
|
|
660967
661421
|
"packages/cli/src/tui/telegram-channel-dmn.ts"() {
|
|
660968
661422
|
"use strict";
|
|
661423
|
+
DAYDREAM_ARTIFACT_RETENTION_LIMIT = 48;
|
|
660969
661424
|
}
|
|
660970
661425
|
});
|
|
660971
661426
|
|
|
660972
661427
|
// packages/cli/src/tui/telegram-reflection-corpus.ts
|
|
660973
|
-
import { createHash as
|
|
661428
|
+
import { createHash as createHash39 } from "node:crypto";
|
|
660974
661429
|
function telegramReflectionMemoryDbPaths(repoRoot) {
|
|
660975
661430
|
return omniusMemoryDbPaths(repoRoot);
|
|
660976
661431
|
}
|
|
660977
661432
|
function stableHash2(value2, length4 = 16) {
|
|
660978
|
-
return
|
|
661433
|
+
return createHash39("sha1").update(value2).digest("hex").slice(0, length4);
|
|
660979
661434
|
}
|
|
660980
661435
|
function clean3(value2) {
|
|
660981
661436
|
return String(value2 ?? "").replace(/\s+/g, " ").trim();
|
|
@@ -661251,7 +661706,8 @@ async function buildTelegramReflectionCorpus(options2) {
|
|
|
661251
661706
|
maxDepth: 2,
|
|
661252
661707
|
maxVisitedNodes: 72,
|
|
661253
661708
|
maxTraversedEdges: 180,
|
|
661254
|
-
maxSourceEpisodes: 100
|
|
661709
|
+
maxSourceEpisodes: 100,
|
|
661710
|
+
allowedSourceEpisodeIds: candidateEpisodes.map((episode) => episode.id)
|
|
661255
661711
|
}
|
|
661256
661712
|
);
|
|
661257
661713
|
if (graphWalk.seed) {
|
|
@@ -661265,7 +661721,8 @@ async function buildTelegramReflectionCorpus(options2) {
|
|
|
661265
661721
|
maxDepth: 3,
|
|
661266
661722
|
maxVisitedNodes: 96,
|
|
661267
661723
|
maxTraversedEdges: 240,
|
|
661268
|
-
maxSourceEpisodes: 120
|
|
661724
|
+
maxSourceEpisodes: 120,
|
|
661725
|
+
allowedSourceEpisodeIds: candidateEpisodes.map((episode) => episode.id)
|
|
661269
661726
|
}
|
|
661270
661727
|
);
|
|
661271
661728
|
if (deeper.seed && deeper.sourceEpisodeIds.length >= graphWalk.sourceEpisodeIds.length) graphWalk = deeper;
|
|
@@ -661705,7 +662162,7 @@ var init_telegram_reflection_extraction = __esm({
|
|
|
661705
662162
|
});
|
|
661706
662163
|
|
|
661707
662164
|
// packages/cli/src/tui/telegram-social-state-types.ts
|
|
661708
|
-
import { createHash as
|
|
662165
|
+
import { createHash as createHash40 } from "node:crypto";
|
|
661709
662166
|
function telegramSocialActorKey(actor) {
|
|
661710
662167
|
if (!actor) return "unknown";
|
|
661711
662168
|
if (typeof actor.userId === "number") return `user:${actor.userId}`;
|
|
@@ -661738,7 +662195,7 @@ function appendUnique(items, value2, max) {
|
|
|
661738
662195
|
return next.slice(-max);
|
|
661739
662196
|
}
|
|
661740
662197
|
function hashTelegramSocialId(parts) {
|
|
661741
|
-
return
|
|
662198
|
+
return createHash40("sha1").update(parts.map((part) => String(part ?? "")).join(":")).digest("hex").slice(0, 16);
|
|
661742
662199
|
}
|
|
661743
662200
|
function cleanUsername(value2) {
|
|
661744
662201
|
if (typeof value2 !== "string") return void 0;
|
|
@@ -662549,7 +663006,7 @@ __export(vision_ingress_exports, {
|
|
|
662549
663006
|
runVisionIngress: () => runVisionIngress
|
|
662550
663007
|
});
|
|
662551
663008
|
import { execFileSync as execFileSync10 } from "node:child_process";
|
|
662552
|
-
import { existsSync as existsSync145, readFileSync as readFileSync118, unlinkSync as
|
|
663009
|
+
import { existsSync as existsSync145, readFileSync as readFileSync118, unlinkSync as unlinkSync32 } from "node:fs";
|
|
662553
663010
|
import { join as join157 } from "node:path";
|
|
662554
663011
|
function isTesseractAvailable() {
|
|
662555
663012
|
try {
|
|
@@ -662607,7 +663064,7 @@ function advancedOcr(imagePath) {
|
|
|
662607
663064
|
const text2 = readFileSync118(txtFile, "utf-8").trim();
|
|
662608
663065
|
if (text2.length > 0) results.push(text2);
|
|
662609
663066
|
try {
|
|
662610
|
-
|
|
663067
|
+
unlinkSync32(txtFile);
|
|
662611
663068
|
} catch {
|
|
662612
663069
|
}
|
|
662613
663070
|
}
|
|
@@ -662735,7 +663192,7 @@ var init_vision_ingress = __esm({
|
|
|
662735
663192
|
import {
|
|
662736
663193
|
mkdirSync as mkdirSync89,
|
|
662737
663194
|
existsSync as existsSync146,
|
|
662738
|
-
unlinkSync as
|
|
663195
|
+
unlinkSync as unlinkSync33,
|
|
662739
663196
|
readdirSync as readdirSync53,
|
|
662740
663197
|
statSync as statSync50,
|
|
662741
663198
|
statfsSync as statfsSync7,
|
|
@@ -662753,7 +663210,7 @@ import {
|
|
|
662753
663210
|
} from "node:path";
|
|
662754
663211
|
import { homedir as homedir51 } from "node:os";
|
|
662755
663212
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
662756
|
-
import { createHash as
|
|
663213
|
+
import { createHash as createHash41, randomBytes as randomBytes26, randomInt } from "node:crypto";
|
|
662757
663214
|
function formatModelBytes(bytes) {
|
|
662758
663215
|
if (!Number.isFinite(bytes) || bytes <= 0) return "0 B";
|
|
662759
663216
|
const units = ["B", "KB", "MB", "GB", "TB"];
|
|
@@ -662765,6 +663222,20 @@ function formatModelBytes(bytes) {
|
|
|
662765
663222
|
}
|
|
662766
663223
|
return `${value2 >= 10 || unit === 0 ? value2.toFixed(0) : value2.toFixed(1)} ${units[unit]}`;
|
|
662767
663224
|
}
|
|
663225
|
+
function telegramMediaContextEvidenceTools(mediaContext) {
|
|
663226
|
+
const tools = [];
|
|
663227
|
+
if (/\[Vision analysis of image|Moondream|auxiliary_vision|vision model/i.test(
|
|
663228
|
+
mediaContext
|
|
663229
|
+
))
|
|
663230
|
+
tools.push("vision_ingress");
|
|
663231
|
+
if (/\[OCR Text from image|ocr_image_advanced|Advanced text extraction|OCR:/i.test(
|
|
663232
|
+
mediaContext
|
|
663233
|
+
))
|
|
663234
|
+
tools.push("ocr_ingress");
|
|
663235
|
+
if (/voice message transcribed|transcription/i.test(mediaContext))
|
|
663236
|
+
tools.push("transcribe_ingress");
|
|
663237
|
+
return tools;
|
|
663238
|
+
}
|
|
662768
663239
|
function cleanTelegramDecisionNote(value2, maxLength = 260) {
|
|
662769
663240
|
if (typeof value2 !== "string") return void 0;
|
|
662770
663241
|
const clean5 = stripTelegramHiddenThinking(value2).replace(/\s+/g, " ").trim();
|
|
@@ -664019,7 +664490,7 @@ function buildTelegramRuntimeContext(now2 = /* @__PURE__ */ new Date(), repoRoot
|
|
|
664019
664490
|
].filter(Boolean).join("\n");
|
|
664020
664491
|
}
|
|
664021
664492
|
function telegramSessionIdFromKey(sessionKey) {
|
|
664022
|
-
return `telegram-${
|
|
664493
|
+
return `telegram-${createHash41("sha1").update(sessionKey).digest("hex").slice(0, 16)}`;
|
|
664023
664494
|
}
|
|
664024
664495
|
function normalizeTelegramSubAgentLimit(value2) {
|
|
664025
664496
|
const parsed = typeof value2 === "number" ? value2 : typeof value2 === "string" && value2.trim() ? Number(value2.trim()) : TELEGRAM_SUB_AGENT_DEFAULT_LIMIT;
|
|
@@ -664060,7 +664531,11 @@ function formatTelegramProgressEvent(event) {
|
|
|
664060
664531
|
if (event.type === "tool_result") {
|
|
664061
664532
|
const preview = sanitizeTelegramProgressText(event.content || "", 1500);
|
|
664062
664533
|
if (isTelegramInternalStatusText(preview)) return null;
|
|
664063
|
-
return toolResultBlock(
|
|
664534
|
+
return toolResultBlock(
|
|
664535
|
+
event.toolName || "tool",
|
|
664536
|
+
Boolean(event.success),
|
|
664537
|
+
preview
|
|
664538
|
+
);
|
|
664064
664539
|
}
|
|
664065
664540
|
if (event.type === "status") {
|
|
664066
664541
|
if (isCodebaseMemoryStatus(event.content || "")) {
|
|
@@ -665705,7 +666180,7 @@ Telegram link integrity contract:
|
|
|
665705
666180
|
upload: { limit: 20, windowMs: 60 * 6e4 },
|
|
665706
666181
|
reminder: { limit: 20, windowMs: 24 * 60 * 6e4 }
|
|
665707
666182
|
};
|
|
665708
|
-
TelegramBridge = class {
|
|
666183
|
+
TelegramBridge = class _TelegramBridge {
|
|
665709
666184
|
constructor(botToken, onMessage, agentConfig, repoRoot, toolPolicyConfig) {
|
|
665710
666185
|
this.botToken = botToken;
|
|
665711
666186
|
this.onMessage = onMessage;
|
|
@@ -666179,7 +666654,7 @@ Telegram link integrity contract:
|
|
|
666179
666654
|
return !!this.adminAuthChallenge && this.adminAuthChallenge.expiresAtMs > Date.now();
|
|
666180
666655
|
}
|
|
666181
666656
|
hashAdminAuthCode(code8) {
|
|
666182
|
-
return
|
|
666657
|
+
return createHash41("sha256").update(`omnius-telegram-admin:${code8.trim()}`).digest("hex");
|
|
666183
666658
|
}
|
|
666184
666659
|
viewIdForMessage(msg) {
|
|
666185
666660
|
return `telegram-${this.sessionKeyForMessage(msg).replace(/[^A-Za-z0-9_-]/g, "-")}`;
|
|
@@ -666939,7 +667414,7 @@ ${message2}`)
|
|
|
666939
667414
|
if (isGroup) {
|
|
666940
667415
|
this.markLastTelegramUserMessageMode(msg, "steering");
|
|
666941
667416
|
} else {
|
|
666942
|
-
this.recordTelegramUserMessage(msg, "steering"
|
|
667417
|
+
this.recordTelegramUserMessage(msg, "steering");
|
|
666943
667418
|
}
|
|
666944
667419
|
this.enqueueTelegramSubAgentContext(
|
|
666945
667420
|
sessionKey,
|
|
@@ -668241,11 +668716,11 @@ ${mediaContext}` : ""
|
|
|
668241
668716
|
return payload;
|
|
668242
668717
|
}
|
|
668243
668718
|
telegramConversationPath(sessionKey) {
|
|
668244
|
-
const safe =
|
|
668719
|
+
const safe = createHash41("sha1").update(sessionKey).digest("hex").slice(0, 20);
|
|
668245
668720
|
return join158(this.telegramConversationDir, `${safe}.json`);
|
|
668246
668721
|
}
|
|
668247
668722
|
telegramConversationLedgerPath(sessionKey) {
|
|
668248
|
-
const safe =
|
|
668723
|
+
const safe = createHash41("sha1").update(sessionKey).digest("hex").slice(0, 20);
|
|
668249
668724
|
return join158(this.telegramConversationDir, `${safe}.events.jsonl`);
|
|
668250
668725
|
}
|
|
668251
668726
|
telegramDb() {
|
|
@@ -668478,7 +668953,7 @@ ${mediaContext}` : ""
|
|
|
668478
668953
|
relationships: Array.isArray(raw.relationships) ? raw.relationships.slice(0, TELEGRAM_ASSOCIATIVE_RELATION_LIMIT).map((fact) => this.normalizeTelegramAssociativeFact(fact)) : [],
|
|
668479
668954
|
actions: Array.isArray(raw.actions) ? raw.actions.slice(-TELEGRAM_ASSOCIATIVE_ACTION_LIMIT).map((action) => ({
|
|
668480
668955
|
id: String(
|
|
668481
|
-
action.id ||
|
|
668956
|
+
action.id || createHash41("sha1").update(JSON.stringify(action)).digest("hex").slice(0, 12)
|
|
668482
668957
|
),
|
|
668483
668958
|
ts: typeof action.ts === "number" ? action.ts : Date.now(),
|
|
668484
668959
|
role: action.role === "assistant" ? "assistant" : "user",
|
|
@@ -668497,7 +668972,7 @@ ${mediaContext}` : ""
|
|
|
668497
668972
|
const now2 = Date.now();
|
|
668498
668973
|
return {
|
|
668499
668974
|
id: String(
|
|
668500
|
-
raw.id ||
|
|
668975
|
+
raw.id || createHash41("sha1").update(text2 || String(now2)).digest("hex").slice(0, 12)
|
|
668501
668976
|
),
|
|
668502
668977
|
text: text2,
|
|
668503
668978
|
tags: Array.isArray(raw.tags) ? raw.tags.map(String).slice(0, 16) : [],
|
|
@@ -668954,7 +669429,7 @@ ${mediaContext}` : ""
|
|
|
668954
669429
|
telegramHistoryBackfillMessageId(sessionKey, entry, index) {
|
|
668955
669430
|
if (typeof entry.messageId === "number" && Number.isFinite(entry.messageId))
|
|
668956
669431
|
return entry.messageId;
|
|
668957
|
-
const digest3 =
|
|
669432
|
+
const digest3 = createHash41("sha1").update(
|
|
668958
669433
|
`${sessionKey}:${index}:${entry.role}:${entry.ts ?? ""}:${entry.text}`
|
|
668959
669434
|
).digest("hex").slice(0, 8);
|
|
668960
669435
|
return -Number.parseInt(digest3, 16);
|
|
@@ -669711,7 +670186,11 @@ ${mediaContext}` : ""
|
|
|
669711
670186
|
recordTelegramUserMessage(msg, mode, textOverride) {
|
|
669712
670187
|
const sessionKey = this.sessionKeyForMessage(msg);
|
|
669713
670188
|
const mediaSummary = summarizeTelegramMessageAttachments(msg);
|
|
669714
|
-
const
|
|
670189
|
+
const overrideText = (textOverride ?? "").trim();
|
|
670190
|
+
const useOverride = textOverride !== void 0 && !_TelegramBridge.isSyntheticMemoryText(overrideText);
|
|
670191
|
+
const text2 = normalizeTelegramOutboundLinks(
|
|
670192
|
+
(useOverride ? overrideText : msg.text ?? "").trim()
|
|
670193
|
+
) || mediaSummary || "[non-text Telegram message]";
|
|
669715
670194
|
this.ensureTelegramConversationLoaded(sessionKey);
|
|
669716
670195
|
const history = this.chatHistory.get(sessionKey) ?? [];
|
|
669717
670196
|
const existing = Number.isFinite(msg.messageId) ? history.find(
|
|
@@ -669720,7 +670199,7 @@ ${mediaContext}` : ""
|
|
|
669720
670199
|
if (existing) {
|
|
669721
670200
|
if (existing.mode === "ambient" || mode !== "ambient")
|
|
669722
670201
|
existing.mode = mode;
|
|
669723
|
-
if (
|
|
670202
|
+
if (useOverride || !existing.text || existing.text === "[non-text Telegram message]" || _TelegramBridge.isSyntheticMemoryText(existing.text)) {
|
|
669724
670203
|
existing.text = text2;
|
|
669725
670204
|
}
|
|
669726
670205
|
existing.speaker = existing.speaker || telegramSpeakerLabel(msg);
|
|
@@ -670132,11 +670611,13 @@ ${mediaContext}` : ""
|
|
|
670132
670611
|
this.chatParticipants.set(sessionKey, participants);
|
|
670133
670612
|
}
|
|
670134
670613
|
updateTelegramAssociativeMemory(sessionKey, entry) {
|
|
670614
|
+
const cleanText2 = stripTelegramHiddenThinking(entry.text || "").replace(/\s+/g, " ").trim();
|
|
670615
|
+
if (!cleanText2 || _TelegramBridge.isSyntheticMemoryText(cleanText2)) return;
|
|
670135
670616
|
const memory = this.telegramAssociativeMemoryForSession(sessionKey);
|
|
670136
670617
|
const now2 = entry.ts ?? Date.now();
|
|
670137
670618
|
memory.updatedAt = now2;
|
|
670138
670619
|
const speaker = telegramHistorySpeaker(entry);
|
|
670139
|
-
const actionId =
|
|
670620
|
+
const actionId = createHash41("sha1").update(
|
|
670140
670621
|
`${sessionKey}:${entry.role}:${entry.messageId ?? ""}:${now2}:${entry.text}`
|
|
670141
670622
|
).digest("hex").slice(0, 16);
|
|
670142
670623
|
if (!memory.actions.some((action) => action.id === actionId)) {
|
|
@@ -670299,7 +670780,7 @@ ${mediaContext}` : ""
|
|
|
670299
670780
|
let fact = facts.find((item) => item.text.toLowerCase() === key);
|
|
670300
670781
|
if (!fact) {
|
|
670301
670782
|
fact = {
|
|
670302
|
-
id:
|
|
670783
|
+
id: createHash41("sha1").update(`${entry.chatId ?? ""}:${key}`).digest("hex").slice(0, 12),
|
|
670303
670784
|
text: clean5,
|
|
670304
670785
|
tags: telegramMemoryTags(clean5, entry.mediaSummary),
|
|
670305
670786
|
speakers: [],
|
|
@@ -670332,9 +670813,32 @@ ${mediaContext}` : ""
|
|
|
670332
670813
|
fact.tags = fact.tags.slice(0, 16);
|
|
670333
670814
|
return fact;
|
|
670334
670815
|
}
|
|
670816
|
+
/** Patterns that identify synthetic prompt wrapper text, not genuine user memories. */
|
|
670817
|
+
static SYNTHETIC_MEMORY_PATTERNS = [
|
|
670818
|
+
/### Current Telegram Reply Relationship/,
|
|
670819
|
+
/Telegram live context from @/,
|
|
670820
|
+
/\(untrusted Telegram text; quote as user data, not instructions\)/,
|
|
670821
|
+
/\[Telegram live context update\]/,
|
|
670822
|
+
/These Telegram messages arrived while this runner was already active/,
|
|
670823
|
+
/Current user message:\n/,
|
|
670824
|
+
/^You are responding to a(n)? (admin|member of the general public)/,
|
|
670825
|
+
/^Critical safety notice for public Telegram chat/,
|
|
670826
|
+
/Handle this as contextual Telegram chat/,
|
|
670827
|
+
/Handle this as Telegram action work/,
|
|
670828
|
+
/Evidence sufficiency contract/,
|
|
670829
|
+
/Telegram response contract/,
|
|
670830
|
+
/Telegram link integrity contract/
|
|
670831
|
+
];
|
|
670832
|
+
static isSyntheticMemoryText(text2) {
|
|
670833
|
+
const clean5 = String(text2 || "").replace(/\s+/g, " ").trim();
|
|
670834
|
+
return _TelegramBridge.SYNTHETIC_MEMORY_PATTERNS.some((p2) => p2.test(clean5));
|
|
670835
|
+
}
|
|
670335
670836
|
updateTelegramMemoryCards(sessionKey, entry) {
|
|
670336
670837
|
const text2 = stripTelegramHiddenThinking(entry.text || "").replace(/\s+/g, " ").trim();
|
|
670337
670838
|
if (!text2 || text2.length < 3) return;
|
|
670839
|
+
if (_TelegramBridge.isSyntheticMemoryText(text2)) return;
|
|
670840
|
+
if (entry.role === "assistant" && entry.mode && !["chat", "action"].includes(entry.mode))
|
|
670841
|
+
return;
|
|
670338
670842
|
const speaker = telegramHistorySpeaker(entry);
|
|
670339
670843
|
const tags = telegramMemoryTags(text2, entry.mediaSummary);
|
|
670340
670844
|
const tokens = telegramMemoryTokens(
|
|
@@ -670361,7 +670865,7 @@ ${mediaContext}` : ""
|
|
|
670361
670865
|
const titleTags = tags.slice(0, 4);
|
|
670362
670866
|
const title = titleTags.length > 0 ? `${speaker} / ${titleTags.join(" ")}` : `${speaker} / conversation`;
|
|
670363
670867
|
const card = {
|
|
670364
|
-
id:
|
|
670868
|
+
id: createHash41("sha1").update(`${sessionKey}:${now2}:${speaker}:${text2}`).digest("hex").slice(0, 12),
|
|
670365
670869
|
title,
|
|
670366
670870
|
notes: [],
|
|
670367
670871
|
tags: [],
|
|
@@ -673276,7 +673780,7 @@ ${list}` : "No shared group target is currently known for this sender. Ask in th
|
|
|
673276
673780
|
}
|
|
673277
673781
|
telegramRunnerStateDir(sessionKey) {
|
|
673278
673782
|
if (!this.repoRoot) return void 0;
|
|
673279
|
-
const safe =
|
|
673783
|
+
const safe = createHash41("sha1").update(sessionKey).digest("hex").slice(0, 20);
|
|
673280
673784
|
return join158(this.repoRoot, ".omnius", "telegram-runner-state", safe);
|
|
673281
673785
|
}
|
|
673282
673786
|
buildTelegramAdminOverviewContext(currentSessionKey) {
|
|
@@ -673733,7 +674237,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
673733
674237
|
if (prior.pid !== process.pid) return;
|
|
673734
674238
|
} catch {
|
|
673735
674239
|
}
|
|
673736
|
-
|
|
674240
|
+
unlinkSync33(lockFile);
|
|
673737
674241
|
} catch {
|
|
673738
674242
|
}
|
|
673739
674243
|
}
|
|
@@ -675975,7 +676479,8 @@ ${conversationStream}`
|
|
|
675975
676479
|
`tool: ${event.toolName}(${argsPreview})`
|
|
675976
676480
|
);
|
|
675977
676481
|
} else if (event.type === "tool_result" && event.toolName) {
|
|
675978
|
-
if (event.success)
|
|
676482
|
+
if (event.success)
|
|
676483
|
+
subAgent.successfulToolNamesThisRun.add(event.toolName);
|
|
675979
676484
|
const preview = (event.content || "").slice(0, 140);
|
|
675980
676485
|
this.subAgentViewCallbacks?.onWrite(
|
|
675981
676486
|
subAgent.viewId,
|
|
@@ -676183,7 +676688,7 @@ ${creativeWorkspace}` : ""}`;
|
|
|
676183
676688
|
toolContext: ctx3
|
|
676184
676689
|
}
|
|
676185
676690
|
},
|
|
676186
|
-
() => runner.run(userPrompt, systemCtx)
|
|
676691
|
+
() => runner.run(userPrompt, systemCtx, msg.text)
|
|
676187
676692
|
);
|
|
676188
676693
|
subAgent.runnerCompleted = result.completed;
|
|
676189
676694
|
subAgent.runnerStatus = result.status;
|
|
@@ -676194,7 +676699,7 @@ ${creativeWorkspace}` : ""}`;
|
|
|
676194
676699
|
if (result.status === "incomplete_verification") {
|
|
676195
676700
|
subAgent.completionBoundarySeen = false;
|
|
676196
676701
|
}
|
|
676197
|
-
|
|
676702
|
+
const finalResponse = selectTelegramFinalResponse({
|
|
676198
676703
|
visibleReplyText: subAgent.visibleReplyText,
|
|
676199
676704
|
assistantText: subAgent.assistantText,
|
|
676200
676705
|
streamText: subAgent.streamText,
|
|
@@ -676202,6 +676707,26 @@ ${creativeWorkspace}` : ""}`;
|
|
|
676202
676707
|
summary: result.summary,
|
|
676203
676708
|
completionBoundarySeen: subAgent.completionBoundarySeen
|
|
676204
676709
|
});
|
|
676710
|
+
const scrutinyText = [finalResponse, result.summary].filter(Boolean).join("\n");
|
|
676711
|
+
const violations = auditPerceptionClaims(scrutinyText, {
|
|
676712
|
+
toolsUsed: [
|
|
676713
|
+
...subAgent.successfulToolNamesThisRun,
|
|
676714
|
+
...telegramMediaContextEvidenceTools(mediaContext)
|
|
676715
|
+
]
|
|
676716
|
+
});
|
|
676717
|
+
if (violations.length > 0) {
|
|
676718
|
+
this.subAgentViewCallbacks?.onWrite(
|
|
676719
|
+
subAgent.viewId,
|
|
676720
|
+
confabulationDirective(violations)
|
|
676721
|
+
);
|
|
676722
|
+
const needed = [...new Set(violations.map((v) => v.requiredTool))].join(
|
|
676723
|
+
"; "
|
|
676724
|
+
);
|
|
676725
|
+
return finalResponse ? `${finalResponse}
|
|
676726
|
+
|
|
676727
|
+
Verification note: I have not actually run ${needed} for the unsupported action claim above.` : `I have not actually run ${needed} yet, so I cannot verify that claim.`;
|
|
676728
|
+
}
|
|
676729
|
+
return finalResponse;
|
|
676205
676730
|
}
|
|
676206
676731
|
telegramScopedMemoryPrefix(chatId) {
|
|
676207
676732
|
const raw = chatId === void 0 ? "unknown" : String(chatId);
|
|
@@ -680160,7 +680685,7 @@ ${text2}`.trim()
|
|
|
680160
680685
|
for (const [key, entry] of this.mediaCache) {
|
|
680161
680686
|
if (now2 - entry.cachedAt > MEDIA_CACHE_TTL_MS) {
|
|
680162
680687
|
try {
|
|
680163
|
-
|
|
680688
|
+
unlinkSync33(entry.localPath);
|
|
680164
680689
|
} catch {
|
|
680165
680690
|
}
|
|
680166
680691
|
this.mediaCache.delete(key);
|
|
@@ -683486,14 +684011,14 @@ var init_access_policy = __esm({
|
|
|
683486
684011
|
});
|
|
683487
684012
|
|
|
683488
684013
|
// packages/cli/src/api/project-preferences.ts
|
|
683489
|
-
import { createHash as
|
|
683490
|
-
import { existsSync as existsSync148, mkdirSync as mkdirSync91, readFileSync as readFileSync121, renameSync as renameSync13, writeFileSync as writeFileSync80, unlinkSync as
|
|
684014
|
+
import { createHash as createHash42 } from "node:crypto";
|
|
684015
|
+
import { existsSync as existsSync148, mkdirSync as mkdirSync91, readFileSync as readFileSync121, renameSync as renameSync13, writeFileSync as writeFileSync80, unlinkSync as unlinkSync34 } from "node:fs";
|
|
683491
684016
|
import { homedir as homedir53 } from "node:os";
|
|
683492
684017
|
import { join as join160, resolve as resolve64 } from "node:path";
|
|
683493
684018
|
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
683494
684019
|
function projectKey(root) {
|
|
683495
684020
|
const canonical = resolve64(root);
|
|
683496
|
-
return
|
|
684021
|
+
return createHash42("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
683497
684022
|
}
|
|
683498
684023
|
function projectDir(root) {
|
|
683499
684024
|
return join160(PROJECTS_DIR, projectKey(root));
|
|
@@ -683548,7 +684073,7 @@ function writeProjectPreferences(root, partial) {
|
|
|
683548
684073
|
} catch {
|
|
683549
684074
|
}
|
|
683550
684075
|
try {
|
|
683551
|
-
|
|
684076
|
+
unlinkSync34(tmp);
|
|
683552
684077
|
} catch {
|
|
683553
684078
|
}
|
|
683554
684079
|
throw err;
|
|
@@ -683559,7 +684084,7 @@ function deleteProjectPreferences(root) {
|
|
|
683559
684084
|
try {
|
|
683560
684085
|
const file = prefsPath(root);
|
|
683561
684086
|
if (!existsSync148(file)) return false;
|
|
683562
|
-
|
|
684087
|
+
unlinkSync34(file);
|
|
683563
684088
|
return true;
|
|
683564
684089
|
} catch {
|
|
683565
684090
|
return false;
|
|
@@ -683787,7 +684312,7 @@ var init_disk_task_output = __esm({
|
|
|
683787
684312
|
});
|
|
683788
684313
|
|
|
683789
684314
|
// packages/cli/src/api/http.ts
|
|
683790
|
-
import { createHash as
|
|
684315
|
+
import { createHash as createHash43 } from "node:crypto";
|
|
683791
684316
|
function problemDetails(opts) {
|
|
683792
684317
|
const p2 = {
|
|
683793
684318
|
type: opts.type ?? "about:blank",
|
|
@@ -683850,7 +684375,7 @@ function paginated(items, page2, total) {
|
|
|
683850
684375
|
}
|
|
683851
684376
|
function computeEtag(payload) {
|
|
683852
684377
|
const json = typeof payload === "string" ? payload : JSON.stringify(payload);
|
|
683853
|
-
const hash =
|
|
684378
|
+
const hash = createHash43("sha1").update(json).digest("hex").slice(0, 16);
|
|
683854
684379
|
return `W/"${hash}"`;
|
|
683855
684380
|
}
|
|
683856
684381
|
function checkNotModified(req3, res, etag) {
|
|
@@ -701761,14 +702286,14 @@ import {
|
|
|
701761
702286
|
existsSync as existsSync160,
|
|
701762
702287
|
watch as fsWatch4,
|
|
701763
702288
|
renameSync as renameSync15,
|
|
701764
|
-
unlinkSync as
|
|
702289
|
+
unlinkSync as unlinkSync35,
|
|
701765
702290
|
statSync as statSync56,
|
|
701766
702291
|
openSync as openSync6,
|
|
701767
702292
|
readSync as readSync2,
|
|
701768
702293
|
closeSync as closeSync6
|
|
701769
702294
|
} from "node:fs";
|
|
701770
702295
|
import { randomBytes as randomBytes28, randomUUID as randomUUID21, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
701771
|
-
import { createHash as
|
|
702296
|
+
import { createHash as createHash44 } from "node:crypto";
|
|
701772
702297
|
function memoryDbPaths3(baseDir = process.cwd()) {
|
|
701773
702298
|
const dir = join172(baseDir, ".omnius");
|
|
701774
702299
|
return {
|
|
@@ -703096,13 +703621,13 @@ function pruneOldJobs() {
|
|
|
703096
703621
|
const ts = ageRef ? Date.parse(ageRef) : NaN;
|
|
703097
703622
|
if (Number.isFinite(ts) && ts < cutoffMs) {
|
|
703098
703623
|
try {
|
|
703099
|
-
|
|
703624
|
+
unlinkSync35(path12);
|
|
703100
703625
|
} catch {
|
|
703101
703626
|
}
|
|
703102
703627
|
const outFile = path12.replace(/\.json$/, ".output");
|
|
703103
703628
|
if (existsSync160(outFile)) {
|
|
703104
703629
|
try {
|
|
703105
|
-
|
|
703630
|
+
unlinkSync35(outFile);
|
|
703106
703631
|
} catch {
|
|
703107
703632
|
}
|
|
703108
703633
|
}
|
|
@@ -703112,7 +703637,7 @@ function pruneOldJobs() {
|
|
|
703112
703637
|
}
|
|
703113
703638
|
} catch {
|
|
703114
703639
|
try {
|
|
703115
|
-
|
|
703640
|
+
unlinkSync35(path12);
|
|
703116
703641
|
pruned++;
|
|
703117
703642
|
} catch {
|
|
703118
703643
|
}
|
|
@@ -703424,7 +703949,7 @@ function atomicJobWrite(dir, id, job) {
|
|
|
703424
703949
|
} catch {
|
|
703425
703950
|
}
|
|
703426
703951
|
try {
|
|
703427
|
-
|
|
703952
|
+
unlinkSync35(tmpPath);
|
|
703428
703953
|
} catch {
|
|
703429
703954
|
}
|
|
703430
703955
|
}
|
|
@@ -707602,7 +708127,7 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
|
|
|
707602
708127
|
return;
|
|
707603
708128
|
}
|
|
707604
708129
|
const { tmpdir: tmpdir24 } = await import("node:os");
|
|
707605
|
-
const { writeFileSync: writeFileSync91, unlinkSync:
|
|
708130
|
+
const { writeFileSync: writeFileSync91, unlinkSync: unlinkSync36 } = await import("node:fs");
|
|
707606
708131
|
const { join: pjoin } = await import("node:path");
|
|
707607
708132
|
const tmpPath = pjoin(
|
|
707608
708133
|
tmpdir24(),
|
|
@@ -707620,7 +708145,7 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
|
|
|
707620
708145
|
});
|
|
707621
708146
|
} finally {
|
|
707622
708147
|
try {
|
|
707623
|
-
|
|
708148
|
+
unlinkSync36(tmpPath);
|
|
707624
708149
|
} catch {
|
|
707625
708150
|
}
|
|
707626
708151
|
}
|
|
@@ -710038,7 +710563,7 @@ function listScheduledTasks() {
|
|
|
710038
710563
|
);
|
|
710039
710564
|
const enabled2 = typeof t2?.enabled === "boolean" ? t2.enabled : true;
|
|
710040
710565
|
const realId = typeof t2?.id === "string" && t2.id ? t2.id : null;
|
|
710041
|
-
const fallbackId =
|
|
710566
|
+
const fallbackId = createHash44("sha1").update(`${file}#${i2}`).digest("hex").slice(0, 16);
|
|
710042
710567
|
const uid = realId || fallbackId;
|
|
710043
710568
|
const key = `${uid}`;
|
|
710044
710569
|
if (seen.has(key)) return;
|
|
@@ -710176,8 +710701,8 @@ function deleteScheduledById(id) {
|
|
|
710176
710701
|
if (typeof entry?.id === "string" && entry.id && !candidates.includes(entry.id))
|
|
710177
710702
|
candidates.push(entry.id);
|
|
710178
710703
|
try {
|
|
710179
|
-
const { createHash:
|
|
710180
|
-
const fallback =
|
|
710704
|
+
const { createHash: createHash45 } = require4("node:crypto");
|
|
710705
|
+
const fallback = createHash45("sha1").update(`${target.file}#${target.index}`).digest("hex").slice(0, 16);
|
|
710181
710706
|
if (!candidates.includes(fallback)) candidates.push(fallback);
|
|
710182
710707
|
} catch {
|
|
710183
710708
|
}
|
|
@@ -710863,8 +711388,8 @@ function startApiServer(options2 = {}) {
|
|
|
710863
711388
|
job.startedAt ?? job.completedAt ?? 0
|
|
710864
711389
|
).getTime();
|
|
710865
711390
|
if (jobTime > 0 && jobTime < cutoff && job.status !== "running") {
|
|
710866
|
-
const { unlinkSync:
|
|
710867
|
-
|
|
711391
|
+
const { unlinkSync: unlinkSync36 } = require4("node:fs");
|
|
711392
|
+
unlinkSync36(jobPath);
|
|
710868
711393
|
}
|
|
710869
711394
|
} catch {
|
|
710870
711395
|
}
|
|
@@ -721730,13 +722255,13 @@ ${taskInput}`;
|
|
|
721730
722255
|
writeContent(() => renderError(errMsg));
|
|
721731
722256
|
if (failureStore) {
|
|
721732
722257
|
try {
|
|
721733
|
-
const { createHash:
|
|
722258
|
+
const { createHash: createHash45 } = await import("node:crypto");
|
|
721734
722259
|
failureStore.insert({
|
|
721735
722260
|
taskId: "",
|
|
721736
722261
|
sessionId: `${Date.now()}`,
|
|
721737
722262
|
repoRoot,
|
|
721738
722263
|
failureType: "runtime-error",
|
|
721739
|
-
fingerprint:
|
|
722264
|
+
fingerprint: createHash45("sha256").update(errMsg.slice(0, 200)).digest("hex").slice(0, 16),
|
|
721740
722265
|
filePath: null,
|
|
721741
722266
|
errorMessage: errMsg.slice(0, 500),
|
|
721742
722267
|
context: null,
|