engine7 7.1.138 → 7.1.140
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/README.md +3 -1
- package/dist/bg-worker.mjs +133 -127
- package/dist/cli.mjs +4351 -3210
- package/dist/cpu-router-worker.mjs +604 -8
- package/dist/device-connectors/reader +0 -0
- package/dist/engine-startup.mjs +9016 -6578
- package/dist/main.mjs +8993 -6554
- package/dist/optional-deps.json +78 -0
- package/dist/recall-worker.mjs +57 -53
- package/dist/sqlite-maintenance-worker.mjs +16 -18
- package/dist/topics-worker.mjs +56 -52
- package/dist/travel-authority.mjs +38 -23
- package/dist/travel-console.mjs +122 -67
- package/dist/travel-controller.mjs +230 -49
- package/dist/travel-data.mjs +655 -359
- package/dist/travel-gateway.mjs +1505 -740
- package/dist/travel-host.mjs +3255 -2166
- package/dist/travel-node-data.mjs +609 -289
- package/dist/travel-node.mjs +1374 -637
- package/dist/travel-pairing.mjs +1545 -773
- package/dist/travel-resource.mjs +23 -16
- package/dist/travel-retire.mjs +52 -37
- package/dist/web-console.mjs +1695 -260
- package/package.json +13 -8
- package/scripts/verify-cpu-router-package.mjs +14 -1
- package/templates/config.template.json +14 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"//": "按需依赖清单(1115 dmg 瘦身)——填表即按需:①这里加一条 ②调用 loadOptionalModule('<key>') ③build.mjs 会把它拷进 dist/optional-deps.json、安装器 build-resources 据此从 payload 裁掉 → 自动按需。integrity 🔴 必须取版本端点 fetch(registry/<name>/<version>).dist.integrity(或仓内 package-lock 同条目)——npm view 根端点有陈旧缓存坑(1115 实踩 onnxruntime-common 差一字符)。🔴 mem7 全链(lancedb/apache-arrow/sqlite)是产品核心永远装机内置,永远不许填进来(1115 翀哥定调)。",
|
|
3
|
+
"cc-runtime": {
|
|
4
|
+
"label": "CC 运行时",
|
|
5
|
+
"main": {
|
|
6
|
+
"name": "@anthropic-ai/claude-agent-sdk",
|
|
7
|
+
"version": "0.3.317",
|
|
8
|
+
"integrity": "sha512-qoRB5svuBNXm5N5miBj3RS2JyA7daGcdOCopQIdJXMxaYREIvR7P1FFiFhSLwIjh61D9ir8f/8OFm5LyDJspEA=="
|
|
9
|
+
},
|
|
10
|
+
"platform": {
|
|
11
|
+
"darwin-x64": {
|
|
12
|
+
"name": "@anthropic-ai/claude-agent-sdk-darwin-x64",
|
|
13
|
+
"version": "0.3.317",
|
|
14
|
+
"integrity": "sha512-GAmOMLr3g3nEQDFcYux5u/duNNXMvJxIBjowgAVp7ndPRbTHpv+jU0JVSa9LdvEycT4ssEvTR/R6eqQ1raBKbw=="
|
|
15
|
+
},
|
|
16
|
+
"darwin-arm64": {
|
|
17
|
+
"name": "@anthropic-ai/claude-agent-sdk-darwin-arm64",
|
|
18
|
+
"version": "0.3.317",
|
|
19
|
+
"integrity": "sha512-SSXvZ04MpfA0hLfGrP9SBTNOgw2p2TsmJAUjr6GA5bM9LVLRLX6pmiIAaTtpaPhslK+zd6Nf5taU/XRldPyUBg=="
|
|
20
|
+
},
|
|
21
|
+
"win32-x64": {
|
|
22
|
+
"name": "@anthropic-ai/claude-agent-sdk-win32-x64",
|
|
23
|
+
"version": "0.3.317",
|
|
24
|
+
"integrity": "sha512-BPxd/DV67LOmPFcq9zrxvs0siTejMGuZDI4sisjFNTssl/Qqma26BXGdHejQlqJqksuzurx+MPq4Jxtzx5UIZw=="
|
|
25
|
+
},
|
|
26
|
+
"linux-x64": {
|
|
27
|
+
"name": "@anthropic-ai/claude-agent-sdk-linux-x64",
|
|
28
|
+
"version": "0.3.317",
|
|
29
|
+
"integrity": "sha512-cjbMfYdESAafCCedRETVIB+rF9HM9hpix/490p0YRccvBhc3uwYuvMQGEHJ9Z+rZujdy49+2lAxq0PZmiCZKjQ=="
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"cpu-router": {
|
|
34
|
+
"label": "CPU 路由器推理引擎",
|
|
35
|
+
"main": {
|
|
36
|
+
"name": "onnxruntime-node",
|
|
37
|
+
"version": "1.19.2",
|
|
38
|
+
"integrity": "sha512-9eHMP/HKbbeUcqte1JYzaaRC8JPn7ojWeCeoyShO86TOR97OCyIyAIOGX3V95ErjslVhJRXY8Em/caIUc0hm1Q=="
|
|
39
|
+
},
|
|
40
|
+
"extra": [
|
|
41
|
+
{
|
|
42
|
+
"name": "onnxruntime-common",
|
|
43
|
+
"version": "1.19.2",
|
|
44
|
+
"integrity": "sha512-a4R7wYEVFbZBlp0BfhpbFWqe4opCor3KM+5Wm22Az3NGDcQMiU2hfG/0MfnBs+1ZrlSGmlgWeMcXQkDk1UFb8Q=="
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"ffmpeg": {
|
|
49
|
+
"label": "ffmpeg",
|
|
50
|
+
"main": {
|
|
51
|
+
"name": "@ffmpeg-installer/ffmpeg",
|
|
52
|
+
"version": "1.1.0",
|
|
53
|
+
"integrity": "sha512-Uq4rmwkdGxIa9A6Bd/VqqYbT7zqh1GrT5/rFwCwKM70b42W5gIjWeVETq6SdcL0zXqDtY081Ws/iJWhr1+xvQg=="
|
|
54
|
+
},
|
|
55
|
+
"platform": {
|
|
56
|
+
"darwin-x64": {
|
|
57
|
+
"name": "@ffmpeg-installer/darwin-x64",
|
|
58
|
+
"version": "4.1.0",
|
|
59
|
+
"integrity": "sha512-Z4EyG3cIFjdhlY8wI9aLUXuH8nVt7E9SlMVZtWvSPnm2sm37/yC2CwjUzyCQbJbySnef1tQwGG2Sx+uWhd9IAw=="
|
|
60
|
+
},
|
|
61
|
+
"darwin-arm64": {
|
|
62
|
+
"name": "@ffmpeg-installer/darwin-arm64",
|
|
63
|
+
"version": "4.1.5",
|
|
64
|
+
"integrity": "sha512-hYyTiP63mXz7wSQfuqfFwfLOfwwFChUedeCVKkBtl/cliaTM7/ePI9bVzfZ2c+dWu3TqCwLDRWNSJ5pqZl8otA=="
|
|
65
|
+
},
|
|
66
|
+
"win32-x64": {
|
|
67
|
+
"name": "@ffmpeg-installer/win32-x64",
|
|
68
|
+
"version": "4.1.0",
|
|
69
|
+
"integrity": "sha512-Drt5u2vzDnIONf4ZEkKtFlbvwj6rI3kxw1Ck9fpudmtgaZIHD4ucsWB2lCZBXRxJgXR+2IMSti+4rtM4C4rXgg=="
|
|
70
|
+
},
|
|
71
|
+
"linux-x64": {
|
|
72
|
+
"name": "@ffmpeg-installer/linux-x64",
|
|
73
|
+
"version": "4.1.0",
|
|
74
|
+
"integrity": "sha512-Y5BWhGLU/WpQjOArNIgXD3z5mxxdV8c41C+U15nsE5yF8tVcdCGet5zPs5Zy3Ta6bU7haGpIzryutqCGQA/W8A=="
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
package/dist/recall-worker.mjs
CHANGED
|
@@ -1206,14 +1206,9 @@ import {
|
|
|
1206
1206
|
fstatSync as fstatSync3,
|
|
1207
1207
|
fsyncSync as fsyncSync3,
|
|
1208
1208
|
readSync,
|
|
1209
|
-
writeSync as writeSync2,
|
|
1210
1209
|
lstatSync as lstatSync4,
|
|
1211
1210
|
realpathSync as realpathSync2,
|
|
1212
|
-
mkdirSync as mkdirSync4
|
|
1213
|
-
readFileSync as readFileSync4,
|
|
1214
|
-
writeFileSync as writeFileSync2,
|
|
1215
|
-
linkSync,
|
|
1216
|
-
unlinkSync as unlinkSync2
|
|
1211
|
+
mkdirSync as mkdirSync4
|
|
1217
1212
|
} from "node:fs";
|
|
1218
1213
|
import { join as join3, dirname as dirname2, resolve as resolve2 } from "node:path";
|
|
1219
1214
|
function assertPrivateDirectory2(path7) {
|
|
@@ -1255,18 +1250,19 @@ function preparePrivateDirectory(path7) {
|
|
|
1255
1250
|
}
|
|
1256
1251
|
assertPrivateDirectory2(path7);
|
|
1257
1252
|
}
|
|
1258
|
-
var PUBLICATION_CHUNK_BYTES, MAGIC, noFollow;
|
|
1253
|
+
var PUBLICATION_CHUNK_BYTES, MAGIC, INLINE_BYTES, noFollow;
|
|
1259
1254
|
var init_publication_objects = __esm({
|
|
1260
1255
|
"src/continuity/publication-objects.ts"() {
|
|
1261
1256
|
"use strict";
|
|
1262
1257
|
PUBLICATION_CHUNK_BYTES = 1024 * 1024;
|
|
1263
1258
|
MAGIC = Buffer.from("E7P1");
|
|
1259
|
+
INLINE_BYTES = 64 * 1024;
|
|
1264
1260
|
noFollow = constants4.O_NOFOLLOW ?? 0;
|
|
1265
1261
|
}
|
|
1266
1262
|
});
|
|
1267
1263
|
|
|
1268
1264
|
// src/continuity/mem7-replication.ts
|
|
1269
|
-
import { closeSync as closeSync5, fsyncSync as fsyncSync4, lstatSync as lstatSync5, openSync as openSync5, writeFileSync as
|
|
1265
|
+
import { closeSync as closeSync5, fsyncSync as fsyncSync4, lstatSync as lstatSync5, openSync as openSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
1270
1266
|
import { dirname as dirname3, join as join4 } from "node:path";
|
|
1271
1267
|
function normalize2(value) {
|
|
1272
1268
|
if (!value || !/^[a-f0-9]{64}$/.test(value.schemaHash)) throw new Error("REPLICATION_REGISTRATION_INVALID");
|
|
@@ -1299,7 +1295,7 @@ function ensureMem7ReplicationRegistration(stateDir2, input) {
|
|
|
1299
1295
|
const file = location(stateDir2);
|
|
1300
1296
|
preparePrivateDirectory(dirname3(file));
|
|
1301
1297
|
try {
|
|
1302
|
-
|
|
1298
|
+
writeFileSync2(file, JSON.stringify(registration), { mode: 384, flag: "wx", flush: true });
|
|
1303
1299
|
} catch (error) {
|
|
1304
1300
|
if (error.code !== "EEXIST") throw error;
|
|
1305
1301
|
if (JSON.stringify(readMem7ReplicationRegistration(stateDir2)) !== JSON.stringify(registration)) throw new Error("REPLICATION_REGISTRATION_MISMATCH");
|
|
@@ -3635,7 +3631,7 @@ var init_prompt_render = __esm({
|
|
|
3635
3631
|
|
|
3636
3632
|
// src/mem7/core/change-feed.ts
|
|
3637
3633
|
import { createHash as createHash5, randomUUID as randomUUID3 } from "node:crypto";
|
|
3638
|
-
import { existsSync as existsSync3, readFileSync as
|
|
3634
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4, renameSync as renameSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
3639
3635
|
function isBusyError(error) {
|
|
3640
3636
|
if (!error || typeof error !== "object") return false;
|
|
3641
3637
|
if (error.errcode === 5) return true;
|
|
@@ -3801,7 +3797,7 @@ CREATE INDEX idx_memory_dependency_slot ON memory_dependencies(scope_id,slot_id)
|
|
|
3801
3797
|
let ledger = {};
|
|
3802
3798
|
if (ledgerPath) {
|
|
3803
3799
|
try {
|
|
3804
|
-
ledger = JSON.parse(
|
|
3800
|
+
ledger = JSON.parse(readFileSync4(ledgerPath, "utf8"))?.heals ?? {};
|
|
3805
3801
|
} catch {
|
|
3806
3802
|
}
|
|
3807
3803
|
if (Number.isFinite(ledger[key3])) {
|
|
@@ -3826,11 +3822,11 @@ CREATE INDEX idx_memory_dependency_slot ON memory_dependencies(scope_id,slot_id)
|
|
|
3826
3822
|
retained[key3] = now2;
|
|
3827
3823
|
const temp = `${ledgerPath}.${randomUUID3()}.tmp`;
|
|
3828
3824
|
try {
|
|
3829
|
-
|
|
3825
|
+
writeFileSync3(temp, JSON.stringify({ version: 1, heals: retained }));
|
|
3830
3826
|
renameSync2(temp, ledgerPath);
|
|
3831
3827
|
} catch (error) {
|
|
3832
3828
|
try {
|
|
3833
|
-
if (existsSync3(temp))
|
|
3829
|
+
if (existsSync3(temp)) unlinkSync2(temp);
|
|
3834
3830
|
} catch {
|
|
3835
3831
|
}
|
|
3836
3832
|
console.warn(`[mem7] \u7F3A\u53E3\u81EA\u6108\u8D26\u672C\u5199\u5165\u5931\u8D25\uFF08\u672C\u8FDB\u7A0B\u5185\u4ECD\u53BB\u91CD\uFF0C\u91CD\u542F\u540E\u53EF\u80FD\u591A\u6CBB\u4E00\u6B21\uFF0C\u5E42\u7B49\u65E0\u5BB3\uFF09\uFF1A${error.message}`);
|
|
@@ -4950,12 +4946,20 @@ CREATE TABLE memory_tombstones (
|
|
|
4950
4946
|
has(scope, kind, id) {
|
|
4951
4947
|
return Boolean(this.db.prepare("SELECT 1 FROM memory_tombstones WHERE scope_id=? AND target_kind=? AND target_id=?").get(scopeId(scope), kind, id));
|
|
4952
4948
|
}
|
|
4949
|
+
/** 1117:deep-recall 的引用只存 scopeId 字符串(无 scope 对象),同判定按 id 直查。 */
|
|
4950
|
+
hasByScopeId(scopeIdValue, kind, id) {
|
|
4951
|
+
return Boolean(this.db.prepare("SELECT 1 FROM memory_tombstones WHERE scope_id=? AND target_kind=? AND target_id=?").get(scopeIdValue, kind, id));
|
|
4952
|
+
}
|
|
4953
4953
|
any(scope) {
|
|
4954
4954
|
return Boolean(this.db.prepare("SELECT 1 FROM memory_tombstones WHERE scope_id=? LIMIT 1").get(scopeId(scope)));
|
|
4955
4955
|
}
|
|
4956
4956
|
anyForOwner(ownerId) {
|
|
4957
4957
|
return Boolean(this.db.prepare("SELECT 1 FROM memory_tombstones t JOIN memory_scopes s ON s.scope_id=t.scope_id WHERE s.owner_id=? LIMIT 1").get(ownerId));
|
|
4958
4958
|
}
|
|
4959
|
+
/** 1117:撤回校验的快速门——墓碑可挂在任意 scope(如旧 default 池)下,不看 owner。 */
|
|
4960
|
+
exists() {
|
|
4961
|
+
return Boolean(this.db.prepare("SELECT 1 FROM memory_tombstones LIMIT 1").get());
|
|
4962
|
+
}
|
|
4959
4963
|
deleteSource(scope, sourceId, expectedVersion, requestKey, reason) {
|
|
4960
4964
|
if (!requestKey || !reason.trim()) throw new Error("INVALID_DELETE_REQUEST");
|
|
4961
4965
|
this.transaction(() => {
|
|
@@ -5682,7 +5686,7 @@ var init_ingest = __esm({
|
|
|
5682
5686
|
|
|
5683
5687
|
// src/mem7/core/legacy-recovery.ts
|
|
5684
5688
|
import { createHash as createHash11 } from "node:crypto";
|
|
5685
|
-
import { readFileSync as
|
|
5689
|
+
import { readFileSync as readFileSync5, realpathSync as realpathSync3, statSync } from "node:fs";
|
|
5686
5690
|
import { isAbsolute, join as join6, relative, resolve as resolve3, sep } from "node:path";
|
|
5687
5691
|
function sessionCandidates(files, mapping) {
|
|
5688
5692
|
const candidates = /* @__PURE__ */ new Map();
|
|
@@ -5692,7 +5696,7 @@ function sessionCandidates(files, mapping) {
|
|
|
5692
5696
|
rejected++;
|
|
5693
5697
|
continue;
|
|
5694
5698
|
}
|
|
5695
|
-
const bytes =
|
|
5699
|
+
const bytes = readFileSync5(file);
|
|
5696
5700
|
const records = [];
|
|
5697
5701
|
let header;
|
|
5698
5702
|
let invalid = false;
|
|
@@ -5938,7 +5942,7 @@ function recoverLegacyProjections(db, store, input, apply = false) {
|
|
|
5938
5942
|
gap("projection_kind_or_owner_unverified");
|
|
5939
5943
|
continue;
|
|
5940
5944
|
}
|
|
5941
|
-
const bytes =
|
|
5945
|
+
const bytes = readFileSync5(canonical2);
|
|
5942
5946
|
const text2 = bytes.toString("utf8").replace(/\r\n/g, "\n");
|
|
5943
5947
|
const fileHash = hash3(bytes);
|
|
5944
5948
|
const entries = [...text2.matchAll(/<!-- entry:([^\s<>]+) -->([\s\S]*?)<!-- \/entry:\1 -->/g)];
|
|
@@ -6008,7 +6012,7 @@ function recoverLegacyProjections(db, store, input, apply = false) {
|
|
|
6008
6012
|
if (!apply || !candidates.length) return report;
|
|
6009
6013
|
for (const file of new Set(candidates.map((candidate) => candidate.file))) {
|
|
6010
6014
|
const candidate = candidates.find((candidate2) => candidate2.file === file);
|
|
6011
|
-
if (hash3(
|
|
6015
|
+
if (hash3(readFileSync5(file)) !== candidate.fileHash) throw new Error("LEGACY_PROJECTION_CHANGED_DURING_RECOVERY");
|
|
6012
6016
|
if (realpathSync3(store.mem7RootPath()) !== root) throw new Error("LEGACY_PROJECTION_COPY_REQUIRED");
|
|
6013
6017
|
}
|
|
6014
6018
|
store.transaction(() => {
|
|
@@ -7251,7 +7255,7 @@ var init_job_runner = __esm({
|
|
|
7251
7255
|
});
|
|
7252
7256
|
|
|
7253
7257
|
// src/mem7/core/episode.ts
|
|
7254
|
-
import { readFileSync as
|
|
7258
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
7255
7259
|
import { join as join7, dirname as dirname4 } from "node:path";
|
|
7256
7260
|
import { fileURLToPath } from "node:url";
|
|
7257
7261
|
var PROMPT;
|
|
@@ -7260,7 +7264,7 @@ var init_episode = __esm({
|
|
|
7260
7264
|
"use strict";
|
|
7261
7265
|
init_prompt_render();
|
|
7262
7266
|
init_job_runner();
|
|
7263
|
-
PROMPT =
|
|
7267
|
+
PROMPT = readFileSync6(join7(dirname4(fileURLToPath(import.meta.url)), "prompts", "episode.md"), "utf8");
|
|
7264
7268
|
}
|
|
7265
7269
|
});
|
|
7266
7270
|
|
|
@@ -7399,7 +7403,7 @@ var init_types = __esm({
|
|
|
7399
7403
|
|
|
7400
7404
|
// src/memory/topics-cleaning/materials.ts
|
|
7401
7405
|
import { createHash as createHash14, randomUUID as randomUUID5 } from "node:crypto";
|
|
7402
|
-
import { existsSync as existsSync4, lstatSync as lstatSync6, mkdirSync as mkdirSync6, readFileSync as
|
|
7406
|
+
import { existsSync as existsSync4, lstatSync as lstatSync6, mkdirSync as mkdirSync6, readFileSync as readFileSync7, renameSync as renameSync3, writeFileSync as writeFileSync4 } from "node:fs";
|
|
7403
7407
|
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute2, join as join8, relative as relative2, resolve as resolve4, sep as sep2 } from "node:path";
|
|
7404
7408
|
function canonical(value) {
|
|
7405
7409
|
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
@@ -7427,11 +7431,11 @@ function unlinked(path7) {
|
|
|
7427
7431
|
}
|
|
7428
7432
|
}
|
|
7429
7433
|
function readJson(path7) {
|
|
7430
|
-
return JSON.parse(
|
|
7434
|
+
return JSON.parse(readFileSync7(unlinked(path7), "utf8").replace(/^\uFEFF/, ""));
|
|
7431
7435
|
}
|
|
7432
7436
|
function rawBytes(snapshot, record) {
|
|
7433
7437
|
if (!/^[a-f0-9]{64}$/.test(record.sha256)) throw new Error("INVALID_OBJECT_REFERENCE");
|
|
7434
|
-
const bytes =
|
|
7438
|
+
const bytes = readFileSync7(unlinked(join8(snapshot.bundle, "objects", record.sha256)));
|
|
7435
7439
|
if (bytes.length !== record.bytes || digest3(bytes) !== record.sha256) throw new Error("OBJECT_HASH_MISMATCH");
|
|
7436
7440
|
return bytes;
|
|
7437
7441
|
}
|
|
@@ -7574,7 +7578,7 @@ function verifyCleaned(bundle, output) {
|
|
|
7574
7578
|
if (canonical(expected) !== canonical(manifest.items)) throw new Error("CLEANED_SELECTION_MISMATCH");
|
|
7575
7579
|
let fragments = 0;
|
|
7576
7580
|
for (const item of manifest.items) for (const f of item.fragments) {
|
|
7577
|
-
const bytes =
|
|
7581
|
+
const bytes = readFileSync7(unlinked(join8(output, f.file)));
|
|
7578
7582
|
if (digest3(bytes) !== f.digest || !bytes.equals(Buffer.from(materials.get(item.originalHash).text.slice(f.start, f.end)))) throw new Error("CLEANED_FRAGMENT_MISMATCH");
|
|
7579
7583
|
fragments++;
|
|
7580
7584
|
}
|
|
@@ -7831,7 +7835,7 @@ var init_historical_recall = __esm({
|
|
|
7831
7835
|
|
|
7832
7836
|
// src/memory/topics-history/cutoff.ts
|
|
7833
7837
|
import { DatabaseSync as DatabaseSync4 } from "node:sqlite";
|
|
7834
|
-
import { existsSync as existsSync5, readFileSync as
|
|
7838
|
+
import { existsSync as existsSync5, readFileSync as readFileSync8, readdirSync } from "node:fs";
|
|
7835
7839
|
import { join as join9 } from "node:path";
|
|
7836
7840
|
function mem7StartDate(b) {
|
|
7837
7841
|
if (!b.stateDir) return null;
|
|
@@ -7862,7 +7866,7 @@ function mem7StartDate(b) {
|
|
|
7862
7866
|
const files = existsSync5(dir) ? readdirSync(dir).filter((name) => /^episode-\d{4}-\d{2}-\d{2}\.md$/.test(name)).sort() : [];
|
|
7863
7867
|
for (const name of files) {
|
|
7864
7868
|
let found = false;
|
|
7865
|
-
const text2 =
|
|
7869
|
+
const text2 = readFileSync8(unlinked(join9(dir, name)), "utf8");
|
|
7866
7870
|
for (const entry of text2.matchAll(/<!-- entry:([^\s<>]+) -->([\s\S]*?)<!-- \/entry:\1 -->/g)) {
|
|
7867
7871
|
const owner = /^\*\*owner_id\*\*:\s*(\S+)/m.exec(entry[2])?.[1];
|
|
7868
7872
|
if (owner !== b.userId) continue;
|
|
@@ -7922,7 +7926,7 @@ var init_cutoff = __esm({
|
|
|
7922
7926
|
});
|
|
7923
7927
|
|
|
7924
7928
|
// src/continuity/runtime-replication.ts
|
|
7925
|
-
import { constants as constants5, lstatSync as lstatSync7, realpathSync as realpathSync4, mkdirSync as mkdirSync7, openSync as openSync6, closeSync as closeSync6, fstatSync as fstatSync4, readFileSync as
|
|
7929
|
+
import { constants as constants5, lstatSync as lstatSync7, realpathSync as realpathSync4, mkdirSync as mkdirSync7, openSync as openSync6, closeSync as closeSync6, fstatSync as fstatSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync5, fsyncSync as fsyncSync5 } from "node:fs";
|
|
7926
7930
|
import { basename as basename3, dirname as dirname6, join as join10, resolve as resolve5 } from "node:path";
|
|
7927
7931
|
function isReplicationFailure(error) {
|
|
7928
7932
|
return error instanceof Error && /^(?:REPLICATION_|TRAVEL_|CHECKPOINT_BUSY)/.test(error.message);
|
|
@@ -7965,7 +7969,7 @@ function readRuntimeReplicationRegistration(stateDir2, component, key3) {
|
|
|
7965
7969
|
try {
|
|
7966
7970
|
const info = fstatSync4(fd);
|
|
7967
7971
|
if (!info.isFile() || info.size > 4096 || realpathSync4(file) !== resolve5(file) || process.platform !== "win32" && (info.mode & 63 || info.uid !== process.getuid())) throw new Error();
|
|
7968
|
-
return normalize3(JSON.parse(
|
|
7972
|
+
return normalize3(JSON.parse(readFileSync9(fd, "utf8")));
|
|
7969
7973
|
} catch (error) {
|
|
7970
7974
|
throw new Error("REPLICATION_REGISTRATION_INVALID", { cause: error });
|
|
7971
7975
|
} finally {
|
|
@@ -8021,7 +8025,7 @@ function enrollRuntimeReplication(db, stateDir2, component, binding, key3) {
|
|
|
8021
8025
|
mkdirSync7(dirname6(file), { mode: 448, recursive: true });
|
|
8022
8026
|
directory(dirname6(file));
|
|
8023
8027
|
try {
|
|
8024
|
-
|
|
8028
|
+
writeFileSync5(file, JSON.stringify(input), { mode: 384, flag: "wx", flush: true });
|
|
8025
8029
|
} catch (error) {
|
|
8026
8030
|
if (error.code !== "EEXIST") throw error;
|
|
8027
8031
|
if (JSON.stringify(readRuntimeReplicationRegistration(stateDir2, component, key3)) !== JSON.stringify(input)) throw new Error("REPLICATION_REGISTRATION_MISMATCH");
|
|
@@ -8609,7 +8613,7 @@ __export(topics_history_exports, {
|
|
|
8609
8613
|
topicsScope: () => topicsScope
|
|
8610
8614
|
});
|
|
8611
8615
|
import { DatabaseSync as DatabaseSync7 } from "node:sqlite";
|
|
8612
|
-
import { existsSync as existsSync6, mkdirSync as mkdirSync8, readFileSync as
|
|
8616
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync8, readFileSync as readFileSync10, renameSync as renameSync4, writeFileSync as writeFileSync6, promises as fs2 } from "node:fs";
|
|
8613
8617
|
import { join as join13, resolve as resolve7 } from "node:path";
|
|
8614
8618
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
8615
8619
|
function topicQueryYear(query, options = {}) {
|
|
@@ -8738,7 +8742,7 @@ ${body}` };
|
|
|
8738
8742
|
function readSource(b, ref) {
|
|
8739
8743
|
validateRef(b, ref);
|
|
8740
8744
|
if (forgotten(b, ref.sourcePath)) throw new Error("HISTORY_REFERENCE_UNAVAILABLE");
|
|
8741
|
-
const bytes =
|
|
8745
|
+
const bytes = readFileSync10(unlinked(join13(resolve7(b.topicsDir), ref.sourcePath)));
|
|
8742
8746
|
if (digest3(bytes) !== ref.originalHash) throw new Error("HISTORY_REFERENCE_UNAVAILABLE");
|
|
8743
8747
|
const text2 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
8744
8748
|
if (ref.end > text2.length) throw new Error("INVALID_HISTORY_REFERENCE");
|
|
@@ -8787,7 +8791,7 @@ function forgetTopicHistory(b, ref) {
|
|
|
8787
8791
|
getTopicHistory(b, ref);
|
|
8788
8792
|
const dir = join13(topicsHistoryRoot(b), "forgotten");
|
|
8789
8793
|
mkdirSync8(unlinked(dir), { recursive: true });
|
|
8790
|
-
|
|
8794
|
+
writeFileSync6(unlinked(join13(dir, `${digest3(ref.sourcePath)}.json`)), JSON.stringify({ sourcePath: ref.sourcePath, originalHash: ref.originalHash, forgottenAt: (/* @__PURE__ */ new Date()).toISOString() }));
|
|
8791
8795
|
}
|
|
8792
8796
|
function safeParagraphs(text2) {
|
|
8793
8797
|
const out = [];
|
|
@@ -8803,7 +8807,7 @@ function safeParagraphs(text2) {
|
|
|
8803
8807
|
}
|
|
8804
8808
|
function fallbackTopicHits(b, sourcePath) {
|
|
8805
8809
|
if (!safeRelative(sourcePath) || forgotten(b, sourcePath)) return [];
|
|
8806
|
-
const bytes =
|
|
8810
|
+
const bytes = readFileSync10(unlinked(join13(resolve7(b.topicsDir), sourcePath))), text2 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
8807
8811
|
const out = [];
|
|
8808
8812
|
const before = mem7StartDate(b);
|
|
8809
8813
|
for (const paragraph of safeParagraphs(text2)) {
|
|
@@ -8888,12 +8892,12 @@ ${aliases.join(" ")}`);
|
|
|
8888
8892
|
db.exec("COMMIT");
|
|
8889
8893
|
if (db.prepare("PRAGMA integrity_check").get().integrity_check !== "ok") throw new Error("HISTORY_INDEX_INVALID");
|
|
8890
8894
|
const count = db.prepare("SELECT count(*) AS n FROM entries").get().n;
|
|
8891
|
-
|
|
8895
|
+
writeFileSync6(join13(dir, "manifest.json"), JSON.stringify(seal({ version, snapshotDigest: snapshot.manifest.digest, cleaningDigest: manifest.digest, entries: count, createdAt: Date.now() })));
|
|
8892
8896
|
} finally {
|
|
8893
8897
|
db.close();
|
|
8894
8898
|
}
|
|
8895
8899
|
const pointer = join13(root, `.current-${version}.json`);
|
|
8896
|
-
|
|
8900
|
+
writeFileSync6(pointer, JSON.stringify({ version }));
|
|
8897
8901
|
renameSync4(pointer, join13(root, "current.json"));
|
|
8898
8902
|
return version;
|
|
8899
8903
|
}
|
|
@@ -11222,7 +11226,7 @@ var init_retire_graph_audits = __esm({
|
|
|
11222
11226
|
|
|
11223
11227
|
// src/mem7/core/store.ts
|
|
11224
11228
|
import { DatabaseSync as DatabaseSync8 } from "node:sqlite";
|
|
11225
|
-
import { mkdirSync as mkdirSync9, readFileSync as
|
|
11229
|
+
import { mkdirSync as mkdirSync9, readFileSync as readFileSync11, writeFileSync as writeFileSync7, renameSync as renameSync5, existsSync as existsSync7, readdirSync as readdirSync3, lstatSync as lstatSync8, unlinkSync as unlinkSync3 } from "node:fs";
|
|
11226
11230
|
import { join as join14, relative as relative3 } from "node:path";
|
|
11227
11231
|
import { createHash as createHash19, randomUUID as randomUUID10 } from "node:crypto";
|
|
11228
11232
|
function contentHash(text2) {
|
|
@@ -11715,7 +11719,7 @@ CREATE TABLE IF NOT EXISTS cluster_members (
|
|
|
11715
11719
|
let existingBlocks = "";
|
|
11716
11720
|
let count;
|
|
11717
11721
|
if (existsSync7(file)) {
|
|
11718
|
-
const text2 =
|
|
11722
|
+
const text2 = readFileSync11(file, "utf8");
|
|
11719
11723
|
const fmEnd = text2.indexOf("\n---", 3);
|
|
11720
11724
|
const split = fmEnd >= 0 ? fmEnd + 4 : text2.length;
|
|
11721
11725
|
head = text2.slice(0, split);
|
|
@@ -11772,7 +11776,7 @@ CREATE TABLE IF NOT EXISTS cluster_members (
|
|
|
11772
11776
|
let existingBlocks = "";
|
|
11773
11777
|
let count;
|
|
11774
11778
|
if (existsSync7(file)) {
|
|
11775
|
-
const text2 =
|
|
11779
|
+
const text2 = readFileSync11(file, "utf8");
|
|
11776
11780
|
const fmEnd = text2.indexOf("\n---", 3);
|
|
11777
11781
|
const split = fmEnd >= 0 ? fmEnd + 4 : text2.length;
|
|
11778
11782
|
head = text2.slice(0, split);
|
|
@@ -11820,11 +11824,11 @@ CREATE TABLE IF NOT EXISTS cluster_members (
|
|
|
11820
11824
|
assertRuntimeAuthority(this.stateDir, "WRITE");
|
|
11821
11825
|
const temporary = `${file}.${randomUUID10()}.tmp`;
|
|
11822
11826
|
try {
|
|
11823
|
-
|
|
11827
|
+
writeFileSync7(temporary, content, "utf8");
|
|
11824
11828
|
assertRuntimeAuthority(this.stateDir, "WRITE");
|
|
11825
11829
|
renameSync5(temporary, file);
|
|
11826
11830
|
} finally {
|
|
11827
|
-
if (existsSync7(temporary))
|
|
11831
|
+
if (existsSync7(temporary)) unlinkSync3(temporary);
|
|
11828
11832
|
}
|
|
11829
11833
|
}
|
|
11830
11834
|
recordProjection(scope, kind, id, file, content, body, expectedVersion) {
|
|
@@ -11867,7 +11871,7 @@ CREATE TABLE IF NOT EXISTS cluster_members (
|
|
|
11867
11871
|
let max = 0;
|
|
11868
11872
|
if (existsSync7(file)) {
|
|
11869
11873
|
const re = new RegExp(`${prefix}_${dateStr.replace(/-/g, "")}_(\\d+)`, "g");
|
|
11870
|
-
for (const m of
|
|
11874
|
+
for (const m of readFileSync11(file, "utf8").matchAll(re)) max = Math.max(max, Number(m[1]));
|
|
11871
11875
|
}
|
|
11872
11876
|
return max;
|
|
11873
11877
|
}
|
|
@@ -12090,7 +12094,7 @@ ${e.outcome}
|
|
|
12090
12094
|
for (const f of files) {
|
|
12091
12095
|
let text2;
|
|
12092
12096
|
try {
|
|
12093
|
-
text2 =
|
|
12097
|
+
text2 = readFileSync11(join14(dir, f), "utf8");
|
|
12094
12098
|
} catch {
|
|
12095
12099
|
continue;
|
|
12096
12100
|
}
|
|
@@ -12124,7 +12128,7 @@ ${e.outcome}
|
|
|
12124
12128
|
for (const d of dirs) {
|
|
12125
12129
|
let text2;
|
|
12126
12130
|
try {
|
|
12127
|
-
text2 =
|
|
12131
|
+
text2 = readFileSync11(join14(base, d, "SKILL.md"), "utf8");
|
|
12128
12132
|
} catch {
|
|
12129
12133
|
continue;
|
|
12130
12134
|
}
|
|
@@ -12189,7 +12193,7 @@ ${e.outcome}
|
|
|
12189
12193
|
let text2;
|
|
12190
12194
|
const file = join14(this.root, this.ownerProjectionPath("users", ownerId, scope), "user.md");
|
|
12191
12195
|
try {
|
|
12192
|
-
text2 =
|
|
12196
|
+
text2 = readFileSync11(file, "utf8");
|
|
12193
12197
|
} catch {
|
|
12194
12198
|
return null;
|
|
12195
12199
|
}
|
|
@@ -12761,7 +12765,7 @@ ${e.outcome}
|
|
|
12761
12765
|
if (!/^foresight-\d{4}-\d{2}-\d{2}\.md$/.test(f)) continue;
|
|
12762
12766
|
let content;
|
|
12763
12767
|
try {
|
|
12764
|
-
content =
|
|
12768
|
+
content = readFileSync11(join14(dir, f), "utf8");
|
|
12765
12769
|
} catch {
|
|
12766
12770
|
continue;
|
|
12767
12771
|
}
|
|
@@ -13019,7 +13023,7 @@ var init_rerank = __esm({
|
|
|
13019
13023
|
});
|
|
13020
13024
|
|
|
13021
13025
|
// src/mem7/core/rank/arank.ts
|
|
13022
|
-
import { readFileSync as
|
|
13026
|
+
import { readFileSync as readFileSync12 } from "node:fs";
|
|
13023
13027
|
import { join as join15, dirname as dirname7 } from "node:path";
|
|
13024
13028
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
13025
13029
|
async function arank(input, opts) {
|
|
@@ -13093,9 +13097,9 @@ var init_arank = __esm({
|
|
|
13093
13097
|
init_rerank();
|
|
13094
13098
|
init_read_guard();
|
|
13095
13099
|
PROMPT_DIR = join15(dirname7(fileURLToPath2(import.meta.url)), "prompts");
|
|
13096
|
-
EPISODIC_PROMPT =
|
|
13097
|
-
CASE_PROMPT =
|
|
13098
|
-
SKILL_PROMPT =
|
|
13100
|
+
EPISODIC_PROMPT = readFileSync12(join15(PROMPT_DIR, "episodic-rerank.md"), "utf8");
|
|
13101
|
+
CASE_PROMPT = readFileSync12(join15(PROMPT_DIR, "case-rerank.md"), "utf8");
|
|
13102
|
+
SKILL_PROMPT = readFileSync12(join15(PROMPT_DIR, "skill-rerank.md"), "utf8");
|
|
13099
13103
|
DEFAULT_RANK_CONFIG = { fusionMode: "rrf", rrfK: 60, vaSaturationK: 5, vaAlpha: 0.7 };
|
|
13100
13104
|
REGISTRY = {
|
|
13101
13105
|
case: { modes: ["rrf", "lr", "vector_anchored"], prompt: CASE_PROMPT, itemType: "case" },
|
|
@@ -13697,7 +13701,7 @@ var init_rerank_bridge = __esm({
|
|
|
13697
13701
|
});
|
|
13698
13702
|
|
|
13699
13703
|
// src/mem7/core/rank/agentic.ts
|
|
13700
|
-
import { readFileSync as
|
|
13704
|
+
import { readFileSync as readFileSync13 } from "node:fs";
|
|
13701
13705
|
import { join as join16, dirname as dirname8 } from "node:path";
|
|
13702
13706
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
13703
13707
|
async function llmJson(provider, model, prompt, temperature, assertCurrent) {
|
|
@@ -13846,9 +13850,9 @@ var init_agentic = __esm({
|
|
|
13846
13850
|
init_read_guard();
|
|
13847
13851
|
init_fusion();
|
|
13848
13852
|
PROMPT_DIR2 = join16(dirname8(fileURLToPath3(import.meta.url)), "prompts");
|
|
13849
|
-
SUFFICIENCY_PROMPT =
|
|
13850
|
-
MULTI_QUERY_PROMPT =
|
|
13851
|
-
REFINED_QUERY_PROMPT =
|
|
13853
|
+
SUFFICIENCY_PROMPT = readFileSync13(join16(PROMPT_DIR2, "sufficiency.md"), "utf8");
|
|
13854
|
+
MULTI_QUERY_PROMPT = readFileSync13(join16(PROMPT_DIR2, "multi-query.md"), "utf8");
|
|
13855
|
+
REFINED_QUERY_PROMPT = readFileSync13(join16(PROMPT_DIR2, "refined-query.md"), "utf8");
|
|
13852
13856
|
}
|
|
13853
13857
|
});
|
|
13854
13858
|
|
|
@@ -19907,7 +19911,7 @@ init_dates();
|
|
|
19907
19911
|
init_topics_history();
|
|
19908
19912
|
init_vectors();
|
|
19909
19913
|
import { DatabaseSync as DatabaseSync16 } from "node:sqlite";
|
|
19910
|
-
import { existsSync as existsSync11, writeFileSync as
|
|
19914
|
+
import { existsSync as existsSync11, writeFileSync as writeFileSync9 } from "node:fs";
|
|
19911
19915
|
import { join as join22 } from "node:path";
|
|
19912
19916
|
|
|
19913
19917
|
// src/memory/topics-history/import-backups.ts
|
|
@@ -362,14 +362,9 @@ import {
|
|
|
362
362
|
fstatSync as fstatSync3,
|
|
363
363
|
fsyncSync as fsyncSync3,
|
|
364
364
|
readSync,
|
|
365
|
-
writeSync as writeSync2,
|
|
366
365
|
lstatSync as lstatSync4,
|
|
367
366
|
realpathSync as realpathSync2,
|
|
368
|
-
mkdirSync as mkdirSync4
|
|
369
|
-
readFileSync as readFileSync4,
|
|
370
|
-
writeFileSync as writeFileSync2,
|
|
371
|
-
linkSync,
|
|
372
|
-
unlinkSync as unlinkSync2
|
|
367
|
+
mkdirSync as mkdirSync4
|
|
373
368
|
} from "node:fs";
|
|
374
369
|
import { join as join3, dirname as dirname2, resolve as resolve2 } from "node:path";
|
|
375
370
|
function assertPrivateDirectory2(path2) {
|
|
@@ -377,12 +372,13 @@ function assertPrivateDirectory2(path2) {
|
|
|
377
372
|
if (!info.isDirectory() || info.isSymbolicLink() || realpathSync2(path2) !== resolve2(path2) || process.platform !== "win32" && (info.mode & 63 || info.uid !== process.getuid()))
|
|
378
373
|
throw new Error("PUBLICATION_PRIVATE_DIRECTORY_REQUIRED");
|
|
379
374
|
}
|
|
380
|
-
var PUBLICATION_CHUNK_BYTES, MAGIC, noFollow;
|
|
375
|
+
var PUBLICATION_CHUNK_BYTES, MAGIC, INLINE_BYTES, noFollow;
|
|
381
376
|
var init_publication_objects = __esm({
|
|
382
377
|
"src/continuity/publication-objects.ts"() {
|
|
383
378
|
"use strict";
|
|
384
379
|
PUBLICATION_CHUNK_BYTES = 1024 * 1024;
|
|
385
380
|
MAGIC = Buffer.from("E7P1");
|
|
381
|
+
INLINE_BYTES = 64 * 1024;
|
|
386
382
|
noFollow = constants3.O_NOFOLLOW ?? 0;
|
|
387
383
|
}
|
|
388
384
|
});
|
|
@@ -500,7 +496,7 @@ var init_sqlite_replication = __esm({
|
|
|
500
496
|
});
|
|
501
497
|
|
|
502
498
|
// src/continuity/mem7-replication.ts
|
|
503
|
-
import { closeSync as closeSync5, fsyncSync as fsyncSync4, lstatSync as lstatSync5, openSync as openSync5, writeFileSync as
|
|
499
|
+
import { closeSync as closeSync5, fsyncSync as fsyncSync4, lstatSync as lstatSync5, openSync as openSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
504
500
|
import { dirname as dirname3, join as join4 } from "node:path";
|
|
505
501
|
function normalize2(value) {
|
|
506
502
|
if (!value || !/^[a-f0-9]{64}$/.test(value.schemaHash)) throw new Error("REPLICATION_REGISTRATION_INVALID");
|
|
@@ -536,7 +532,7 @@ var init_mem7_replication = __esm({
|
|
|
536
532
|
});
|
|
537
533
|
|
|
538
534
|
// src/continuity/runtime-replication.ts
|
|
539
|
-
import { constants as constants4, lstatSync as lstatSync6, realpathSync as realpathSync3, mkdirSync as mkdirSync5, openSync as openSync6, closeSync as closeSync6, fstatSync as fstatSync4, readFileSync as
|
|
535
|
+
import { constants as constants4, lstatSync as lstatSync6, realpathSync as realpathSync3, mkdirSync as mkdirSync5, openSync as openSync6, closeSync as closeSync6, fstatSync as fstatSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3, fsyncSync as fsyncSync5 } from "node:fs";
|
|
540
536
|
import { basename as basename2, dirname as dirname4, join as join5, resolve as resolve3 } from "node:path";
|
|
541
537
|
function checkKey(component, key) {
|
|
542
538
|
if (component === "topics-vectors" && typeof key === "string" && /^[a-f0-9]{64}$/.test(key)) return;
|
|
@@ -592,7 +588,7 @@ function readRuntimeReplicationRegistration(stateDir, component, key) {
|
|
|
592
588
|
try {
|
|
593
589
|
const info = fstatSync4(fd);
|
|
594
590
|
if (!info.isFile() || info.size > 4096 || realpathSync3(file) !== resolve3(file) || process.platform !== "win32" && (info.mode & 63 || info.uid !== process.getuid())) throw new Error();
|
|
595
|
-
return normalize3(JSON.parse(
|
|
591
|
+
return normalize3(JSON.parse(readFileSync4(fd, "utf8")));
|
|
596
592
|
} catch (error) {
|
|
597
593
|
throw new Error("REPLICATION_REGISTRATION_INVALID", { cause: error });
|
|
598
594
|
} finally {
|
|
@@ -634,7 +630,7 @@ var init_runtime_replication = __esm({
|
|
|
634
630
|
|
|
635
631
|
// src/memory/topics-cleaning/materials.ts
|
|
636
632
|
import { createHash as createHash2, randomUUID as randomUUID3 } from "node:crypto";
|
|
637
|
-
import { existsSync as existsSync2, lstatSync as lstatSync8, mkdirSync as mkdirSync6, readFileSync as
|
|
633
|
+
import { existsSync as existsSync2, lstatSync as lstatSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync5, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
638
634
|
import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute2, join as join7, relative as relative2, resolve as resolve7, sep as sep2 } from "node:path";
|
|
639
635
|
function canonical(value) {
|
|
640
636
|
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
@@ -658,7 +654,7 @@ function unlinked(path2) {
|
|
|
658
654
|
}
|
|
659
655
|
}
|
|
660
656
|
function readJson(path2) {
|
|
661
|
-
return JSON.parse(
|
|
657
|
+
return JSON.parse(readFileSync5(unlinked(path2), "utf8").replace(/^\uFEFF/, ""));
|
|
662
658
|
}
|
|
663
659
|
var digest;
|
|
664
660
|
var init_materials = __esm({
|
|
@@ -1062,7 +1058,7 @@ var init_dependencies = __esm({
|
|
|
1062
1058
|
|
|
1063
1059
|
// src/mem7/core/change-feed.ts
|
|
1064
1060
|
import { createHash as createHash3, randomUUID as randomUUID4 } from "node:crypto";
|
|
1065
|
-
import { existsSync as existsSync3, readFileSync as
|
|
1061
|
+
import { existsSync as existsSync3, readFileSync as readFileSync6, renameSync as renameSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync5 } from "node:fs";
|
|
1066
1062
|
function isBusyError(error) {
|
|
1067
1063
|
if (!error || typeof error !== "object") return false;
|
|
1068
1064
|
if (error.errcode === 5) return true;
|
|
@@ -1202,7 +1198,7 @@ var init_change_feed = __esm({
|
|
|
1202
1198
|
let ledger = {};
|
|
1203
1199
|
if (ledgerPath) {
|
|
1204
1200
|
try {
|
|
1205
|
-
ledger = JSON.parse(
|
|
1201
|
+
ledger = JSON.parse(readFileSync6(ledgerPath, "utf8"))?.heals ?? {};
|
|
1206
1202
|
} catch {
|
|
1207
1203
|
}
|
|
1208
1204
|
if (Number.isFinite(ledger[key])) {
|
|
@@ -1227,11 +1223,11 @@ var init_change_feed = __esm({
|
|
|
1227
1223
|
retained[key] = now2;
|
|
1228
1224
|
const temp = `${ledgerPath}.${randomUUID4()}.tmp`;
|
|
1229
1225
|
try {
|
|
1230
|
-
|
|
1226
|
+
writeFileSync5(temp, JSON.stringify({ version: 1, heals: retained }));
|
|
1231
1227
|
renameSync3(temp, ledgerPath);
|
|
1232
1228
|
} catch (error) {
|
|
1233
1229
|
try {
|
|
1234
|
-
if (existsSync3(temp))
|
|
1230
|
+
if (existsSync3(temp)) unlinkSync2(temp);
|
|
1235
1231
|
} catch {
|
|
1236
1232
|
}
|
|
1237
1233
|
console.warn(`[mem7] \u7F3A\u53E3\u81EA\u6108\u8D26\u672C\u5199\u5165\u5931\u8D25\uFF08\u672C\u8FDB\u7A0B\u5185\u4ECD\u53BB\u91CD\uFF0C\u91CD\u542F\u540E\u53EF\u80FD\u591A\u6CBB\u4E00\u6B21\uFF0C\u5E42\u7B49\u65E0\u5BB3\uFF09\uFF1A${error.message}`);
|
|
@@ -1509,7 +1505,7 @@ var init_job_runner = __esm({
|
|
|
1509
1505
|
});
|
|
1510
1506
|
|
|
1511
1507
|
// src/mem7/core/episode.ts
|
|
1512
|
-
import { readFileSync as
|
|
1508
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
1513
1509
|
import { join as join8, dirname as dirname7 } from "node:path";
|
|
1514
1510
|
import { fileURLToPath } from "node:url";
|
|
1515
1511
|
var PROMPT;
|
|
@@ -1518,7 +1514,7 @@ var init_episode = __esm({
|
|
|
1518
1514
|
"use strict";
|
|
1519
1515
|
init_prompt_render();
|
|
1520
1516
|
init_job_runner();
|
|
1521
|
-
PROMPT =
|
|
1517
|
+
PROMPT = readFileSync7(join8(dirname7(fileURLToPath(import.meta.url)), "prompts", "episode.md"), "utf8");
|
|
1522
1518
|
}
|
|
1523
1519
|
});
|
|
1524
1520
|
|
|
@@ -2192,6 +2188,8 @@ init_schema_migrations();
|
|
|
2192
2188
|
// src/continuity/inventory.ts
|
|
2193
2189
|
import { isAbsolute, join as join6, relative, resolve as resolve5, sep } from "node:path";
|
|
2194
2190
|
var STATE = new Set(`workspace agents auth configs cron media mem7 memory runtime session-memory steer tasks teams todos tools topics topics-history .everos .calendar calendar proactive skills prompts goals.json goal-events.jsonl SESSION-STATE.md install-identity.json license.json report-failures.jsonl report-state.json service-suggestions.json weixin cc-driver engines.json settings.json onboarding.json onboarding-tips.json remote-watchers.json plans telegram state`.split(" "));
|
|
2191
|
+
var CORE_DIRECTORIES = new Set(`agents auth configs cron mem7 memory runtime session-memory steer tasks teams todos tools .everos .calendar calendar .proactive proactive skills prompts .nudge hooks inner-voice goals plans private scripts state .voice-chat .desktopBuddy body`.split(" "));
|
|
2192
|
+
var CORE_OMITTED = new Set(`media images videos audio content content-library docs output outputs dogfood-output backup backups topics-history node_modules .venvs venv .venv asr .cache cache caches tmp temp .playwright-mcp lancedb`.split(" "));
|
|
2195
2193
|
function isWithin(root, candidate) {
|
|
2196
2194
|
const rel = relative(resolve5(root), resolve5(candidate));
|
|
2197
2195
|
return !rel || !rel.startsWith(".." + sep) && rel !== ".." && !isAbsolute(rel);
|