@kanadego/dsh-heartbeat 1.7.3 → 1.8.0
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 +39 -11
- package/client.js +93 -0
- package/config/policy.json +9 -1
- package/dist/{chunk-4UE74TUB.js → chunk-63FUJLIF.js} +2 -2
- package/dist/{chunk-LLD7LUNN.js → chunk-IFTFDHZX.js} +2 -1
- package/dist/{chunk-SVP2NDRF.js → chunk-MXJPX3FM.js} +2 -2
- package/dist/chunk-RB3NLLGF.js +87 -0
- package/dist/chunk-RB3NLLGF.js.map +1 -0
- package/dist/{chunk-ON4MSU6E.js → chunk-SQJLKP7L.js} +175 -477
- package/dist/chunk-SQJLKP7L.js.map +1 -0
- package/dist/chunk-UCJR6TC7.js +163 -0
- package/dist/chunk-UCJR6TC7.js.map +1 -0
- package/dist/chunk-VIZNIQLK.js +472 -0
- package/dist/chunk-VIZNIQLK.js.map +1 -0
- package/dist/cli/index.js +138 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/{inbox-MMLHISQV.js → inbox-57NHQHY3.js} +3 -3
- package/dist/index.js +540 -81
- package/dist/index.js.map +1 -1
- package/dist/migrate-43PUK25G.js +20 -0
- package/dist/{pool-YAIBE2L5.js → pool-JQC5JWIZ.js} +3 -3
- package/dist/pool-JQC5JWIZ.js.map +1 -0
- package/dist/snapshot-ZBCSX67Y.js +15 -0
- package/dist/snapshot-ZBCSX67Y.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-ON4MSU6E.js.map +0 -1
- /package/dist/{chunk-4UE74TUB.js.map → chunk-63FUJLIF.js.map} +0 -0
- /package/dist/{chunk-LLD7LUNN.js.map → chunk-IFTFDHZX.js.map} +0 -0
- /package/dist/{chunk-SVP2NDRF.js.map → chunk-MXJPX3FM.js.map} +0 -0
- /package/dist/{inbox-MMLHISQV.js.map → inbox-57NHQHY3.js.map} +0 -0
- /package/dist/{pool-YAIBE2L5.js.map → migrate-43PUK25G.js.map} +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUNDLED_PRESET_ID,
|
|
3
3
|
adviseWander,
|
|
4
|
-
appendAuditLine,
|
|
5
4
|
appendEntry,
|
|
6
5
|
browseStatus,
|
|
7
6
|
checkWatchlist,
|
|
@@ -12,21 +11,18 @@ import {
|
|
|
12
11
|
ensureRegistered,
|
|
13
12
|
installBundledPreset,
|
|
14
13
|
ledgerFilePath,
|
|
14
|
+
listWeeklyReports,
|
|
15
15
|
loadInterests,
|
|
16
16
|
loadPolicy,
|
|
17
|
-
loadProfile,
|
|
18
17
|
loadWatchlist,
|
|
19
18
|
markDone,
|
|
20
19
|
presetStatus,
|
|
21
|
-
profileFilePath,
|
|
22
|
-
pruneAuditFile,
|
|
23
20
|
readLedger,
|
|
24
|
-
|
|
21
|
+
readWeeklyReport,
|
|
25
22
|
scanPending,
|
|
26
23
|
sendNewMessageHint,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} from "../chunk-ON4MSU6E.js";
|
|
24
|
+
weeklyDirPath
|
|
25
|
+
} from "../chunk-SQJLKP7L.js";
|
|
30
26
|
import {
|
|
31
27
|
activeSeeds,
|
|
32
28
|
addSeed,
|
|
@@ -36,12 +32,27 @@ import {
|
|
|
36
32
|
loadPool,
|
|
37
33
|
seedsFilePath,
|
|
38
34
|
surfaceSeed
|
|
39
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-MXJPX3FM.js";
|
|
36
|
+
import {
|
|
37
|
+
appendAuditLine,
|
|
38
|
+
loadProfile,
|
|
39
|
+
profileFilePath,
|
|
40
|
+
pruneAuditFile,
|
|
41
|
+
rebuildProfile,
|
|
42
|
+
shredFileSync,
|
|
43
|
+
verifyProfile
|
|
44
|
+
} from "../chunk-VIZNIQLK.js";
|
|
45
|
+
import {
|
|
46
|
+
applyMigrationEntries,
|
|
47
|
+
collectMigrationEntries,
|
|
48
|
+
decryptContainer,
|
|
49
|
+
encryptContainer
|
|
50
|
+
} from "../chunk-UCJR6TC7.js";
|
|
40
51
|
import {
|
|
41
52
|
initWorkspace,
|
|
42
53
|
loadEncryptedText,
|
|
43
54
|
writeText
|
|
44
|
-
} from "../chunk-
|
|
55
|
+
} from "../chunk-IFTFDHZX.js";
|
|
45
56
|
|
|
46
57
|
// src/cli/index.ts
|
|
47
58
|
import { spawn } from "child_process";
|
|
@@ -161,7 +172,12 @@ function usage() {
|
|
|
161
172
|
" profile export decrypted Markdown export to data/exports/",
|
|
162
173
|
" profile verify journal replay vs disk (report only)",
|
|
163
174
|
" profile rebuild [--check] rebuild materialized view from journal",
|
|
175
|
+
" profile snapshot [--force] fold the journal into a snapshot + archive shard",
|
|
164
176
|
" profile wipe wipe profile data (asks --yes)",
|
|
177
|
+
" weekly list list generated weekly reports",
|
|
178
|
+
" weekly show [file] print a report (default: newest)",
|
|
179
|
+
" migrate export [file] pack memory files into a passphrase container (passphrase: 2 stdin lines)",
|
|
180
|
+
" migrate import <file> restore a container into this workspace (passphrase: 1 stdin line)",
|
|
165
181
|
" burn [--yes] [--all] shred runtime data (settings kept unless --all)",
|
|
166
182
|
" preset status bundled agent preset: target dir + installed?",
|
|
167
183
|
" preset install [--force] install the bundled preset (never overwrites unless --force)"
|
|
@@ -178,6 +194,14 @@ function flag(argv, name) {
|
|
|
178
194
|
const i = argv.indexOf(name);
|
|
179
195
|
return i > -1 ? argv[i + 1] : void 0;
|
|
180
196
|
}
|
|
197
|
+
async function readLines(prompts) {
|
|
198
|
+
const readline = await import("readline/promises");
|
|
199
|
+
const it = readline.createInterface({ input: process.stdin });
|
|
200
|
+
const out = [];
|
|
201
|
+
for (const p of prompts) out.push((await it.question(p)).trim());
|
|
202
|
+
it.close();
|
|
203
|
+
return out;
|
|
204
|
+
}
|
|
181
205
|
async function main(argv) {
|
|
182
206
|
const [cmd, sub, ...rest] = argv;
|
|
183
207
|
if (!cmd || cmd === "help" || cmd === "--help") {
|
|
@@ -320,6 +344,31 @@ async function main(argv) {
|
|
|
320
344
|
return 1;
|
|
321
345
|
}
|
|
322
346
|
}
|
|
347
|
+
case "weekly": {
|
|
348
|
+
const reports = listWeeklyReports(guard, paths.dataDir);
|
|
349
|
+
if (sub === "list" || sub === void 0) {
|
|
350
|
+
if (reports.length === 0) console.log("(no reports yet \u2014 heartbeat generates one every 7 days)");
|
|
351
|
+
for (const r of reports) console.log(`${r.file} ${r.start.slice(0, 10)} ~ ${r.end.slice(0, 10)} [${r.source}]`);
|
|
352
|
+
return 0;
|
|
353
|
+
}
|
|
354
|
+
if (sub === "show") {
|
|
355
|
+
const file = rest[0] ?? reports[0]?.file;
|
|
356
|
+
if (!file) {
|
|
357
|
+
console.log("(no reports yet)");
|
|
358
|
+
return 1;
|
|
359
|
+
}
|
|
360
|
+
const rep = readWeeklyReport(guard, paths.dataDir, file);
|
|
361
|
+
if (!rep) {
|
|
362
|
+
console.error(`no such report: ${file} (see: weekly list; files live in ${weeklyDirPath(paths.dataDir)})`);
|
|
363
|
+
return 1;
|
|
364
|
+
}
|
|
365
|
+
console.log(`# ${rep.start.slice(0, 10)} ~ ${rep.end.slice(0, 10)} [${rep.source}]`);
|
|
366
|
+
console.log(rep.text);
|
|
367
|
+
return 0;
|
|
368
|
+
}
|
|
369
|
+
console.error(`unknown weekly subcommand: ${sub}`);
|
|
370
|
+
return 1;
|
|
371
|
+
}
|
|
323
372
|
case "logs": {
|
|
324
373
|
if (sub !== "cleanup") {
|
|
325
374
|
console.error("usage: logs cleanup [--dry-run]");
|
|
@@ -450,6 +499,23 @@ async function main(argv) {
|
|
|
450
499
|
console.log("WIPED (settings preserved; use burn for full shredding)");
|
|
451
500
|
return 0;
|
|
452
501
|
}
|
|
502
|
+
case "snapshot": {
|
|
503
|
+
const { snapshotDue, snapshotProfile, SNAPSHOT_THRESHOLD } = await import("../snapshot-ZBCSX67Y.js");
|
|
504
|
+
const { needed, lines } = snapshotDue(guard, paths.dataDir);
|
|
505
|
+
console.log(`journal ${lines} \u6761\uFF08\u9608\u503C ${SNAPSHOT_THRESHOLD}\uFF09`);
|
|
506
|
+
if (!needed && !rest.includes("--force")) {
|
|
507
|
+
console.log("\u672A\u5230\u9608\u503C\uFF0C\u672A\u6267\u884C\uFF08\u52A0 --force \u5F3A\u5236\u6298\u53E0\uFF09\u3002");
|
|
508
|
+
return 0;
|
|
509
|
+
}
|
|
510
|
+
const report = snapshotProfile(guard, paths.dataDir);
|
|
511
|
+
if (!report.ok) {
|
|
512
|
+
console.log(`\u672A\u6267\u884C\uFF1A${report.reason}`);
|
|
513
|
+
return 0;
|
|
514
|
+
}
|
|
515
|
+
console.log(`\u5DF2\u6298\u53E0 ${report.folded} \u6761 \u2192 \u5FEB\u7167\uFF08baseline ${report.baselineTs}\uFF09\uFF0C\u5F52\u6863 ${report.archiveFile}\uFF0Clive journal \u5DF2\u6E05\u7A7A\u3002`);
|
|
516
|
+
console.log("verify/rebuild \u81EA\u52A8\u4ECE\u5FEB\u7167\u57FA\u70B9\u91CD\u653E\uFF0C\u65E0\u9700\u989D\u5916\u64CD\u4F5C\u3002");
|
|
517
|
+
return 0;
|
|
518
|
+
}
|
|
453
519
|
default:
|
|
454
520
|
console.error(`unknown profile subcommand: ${sub}`);
|
|
455
521
|
return 1;
|
|
@@ -469,6 +535,68 @@ async function main(argv) {
|
|
|
469
535
|
console.log(`BURNED: ${result.burned.length} \u9879\uFF1BMISSING: ${result.missing.length} \u9879`);
|
|
470
536
|
return 0;
|
|
471
537
|
}
|
|
538
|
+
case "migrate": {
|
|
539
|
+
if (sub === "export") {
|
|
540
|
+
const defaultOut = path2.join(paths.exportsDir, `heartbeat-memory-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.hbmig`);
|
|
541
|
+
const outfile = rest[0] ?? defaultOut;
|
|
542
|
+
let outCanon;
|
|
543
|
+
try {
|
|
544
|
+
outCanon = guard.assert(outfile);
|
|
545
|
+
} catch {
|
|
546
|
+
console.error(`\u5BFC\u51FA\u6587\u4EF6\u5FC5\u987B\u843D\u5728\u63D2\u4EF6 data/ \u76EE\u5F55\u5185\uFF08\u8DEF\u5F84\u5B88\u536B\u62D2\u7EDD\uFF09\uFF1A${outfile}
|
|
547
|
+
\u9ED8\u8BA4\u4F4D\u7F6E\uFF1A${defaultOut}`);
|
|
548
|
+
return 1;
|
|
549
|
+
}
|
|
550
|
+
const [pw1, pw2] = await readLines(["\u8BBE\u7F6E\u53E3\u4EE4\uFF08\u7528\u4E8E\u52A0\u5BC6\u8FC1\u79FB\u5305\uFF09: ", "\u518D\u8F93\u5165\u4E00\u6B21\u786E\u8BA4: "]);
|
|
551
|
+
if (!pw1 || pw1 !== pw2) {
|
|
552
|
+
console.error("\u4E24\u6B21\u8F93\u5165\u4E0D\u4E00\u81F4\u6216\u4E3A\u7A7A\uFF0C\u5DF2\u53D6\u6D88\u3002");
|
|
553
|
+
return 1;
|
|
554
|
+
}
|
|
555
|
+
const { entries, progress } = collectMigrationEntries(guard, paths);
|
|
556
|
+
if (entries.length === 0) {
|
|
557
|
+
console.log("\u6CA1\u6709\u53EF\u6253\u5305\u7684\u8BB0\u5FC6\u6587\u4EF6\uFF08data/ \u662F\u7A7A\u7684\uFF09\u3002");
|
|
558
|
+
return 1;
|
|
559
|
+
}
|
|
560
|
+
fs2.mkdirSync(path2.dirname(outCanon), { recursive: true });
|
|
561
|
+
fs2.writeFileSync(outCanon, encryptContainer(entries, pw1), "utf8");
|
|
562
|
+
console.log(`\u5DF2\u6253\u5305 ${entries.length} \u4E2A\u6587\u4EF6 \u2192 ${outCanon}`);
|
|
563
|
+
console.log(` \u6253\u5305\uFF1A${progress.packed.join(", ")}`);
|
|
564
|
+
if (progress.missing.length > 0) console.log(` \u8DF3\u8FC7\uFF08\u4E0D\u5B58\u5728\uFF09\uFF1A${progress.missing.join(", ")}`);
|
|
565
|
+
console.log("\u5BB9\u5668\u662F\u53E3\u4EE4\u52A0\u5BC6\u7684\uFF0C\u53EF\u5B89\u5168\u62F7\u8D1D\u5230\u65B0\u673A\u5668\uFF1BDPAPI \u4F1A\u5728\u5BFC\u5165\u65F6\u7528\u65B0\u673A\u5668\u91CD\u65B0\u52A0\u5BC6\u3002");
|
|
566
|
+
return 0;
|
|
567
|
+
}
|
|
568
|
+
if (sub === "import") {
|
|
569
|
+
const infile = rest[0];
|
|
570
|
+
if (!infile) {
|
|
571
|
+
console.error("usage: migrate import <container-file>");
|
|
572
|
+
return 1;
|
|
573
|
+
}
|
|
574
|
+
const [pw] = await readLines(["\u8F93\u5165\u8FC1\u79FB\u5305\u53E3\u4EE4: "]);
|
|
575
|
+
let text;
|
|
576
|
+
try {
|
|
577
|
+
text = fs2.readFileSync(infile, "utf8");
|
|
578
|
+
} catch {
|
|
579
|
+
console.error(`\u8BFB\u4E0D\u5230\u8FC1\u79FB\u5305\uFF1A${infile}`);
|
|
580
|
+
return 1;
|
|
581
|
+
}
|
|
582
|
+
let files;
|
|
583
|
+
try {
|
|
584
|
+
files = decryptContainer(text, pw ?? "");
|
|
585
|
+
} catch (e) {
|
|
586
|
+
console.error(String(e instanceof Error ? e.message : e));
|
|
587
|
+
return 1;
|
|
588
|
+
}
|
|
589
|
+
const result = applyMigrationEntries(guard, paths, files.files);
|
|
590
|
+
console.log(`\u6062\u590D ${result.restored.length} \u4E2A\u6587\u4EF6\uFF1B\u5907\u4EFD ${result.backedUp.length} \u4E2A\u88AB\u8986\u76D6\u6587\u4EF6\uFF1B\u8DF3\u8FC7 ${result.skipped.length} \u4E2A\u3002`);
|
|
591
|
+
for (const r of result.restored) console.log(` \u6062\u590D: ${r}`);
|
|
592
|
+
for (const b of result.backedUp) console.log(` \u5907\u4EFD: ${b}.bak-migrate-*`);
|
|
593
|
+
if (result.skipped.length > 0) console.log(` \u8DF3\u8FC7: ${result.skipped.join(", ")}`);
|
|
594
|
+
console.log("\u91CD\u542F DSH \u540E\u751F\u6548\u3002");
|
|
595
|
+
return 0;
|
|
596
|
+
}
|
|
597
|
+
console.error(`unknown migrate subcommand: ${sub}`);
|
|
598
|
+
return 1;
|
|
599
|
+
}
|
|
472
600
|
case "sessions": {
|
|
473
601
|
const root = path2.join(os.homedir(), ".dsh", "sessions");
|
|
474
602
|
let found = 0;
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts","../../src/vault/burn-list.ts"],"sourcesContent":["// Operational CLI (design doc §14). Commands grow per module.\r\n// Run: node dist/cli/index.js <command> [args] (or via tsx in dev)\r\n\r\nimport { spawn } from 'node:child_process';\r\nimport fs from 'node:fs';\r\nimport os from 'node:os';\r\nimport path from 'node:path';\r\nimport { initWorkspace, workspace } from '../core/paths.js';\r\nimport { createPathGuard } from '../core/path-guard.js';\r\nimport { appendAuditLine, pruneAuditFile } from '../core/audit-log.js';\r\nimport { loadEncryptedText } from '../vault/vault.js';\r\nimport { loadPolicy } from '../config/load.js';\r\nimport {\r\n addSeed,\r\n archiveSeedById,\r\n gcPool,\r\n loadPool,\r\n activeSeeds,\r\n archivedSeeds,\r\n seedsFilePath,\r\n surfaceSeed,\r\n} from '../seeds/pool.js';\r\nimport {\r\n appendEntry,\r\n ledgerFilePath,\r\n markDone,\r\n readLedger,\r\n scanPending,\r\n} from '../ledger/ledger.js';\r\nimport {\r\n adviseWander,\r\n browseStatePath,\r\n browseStatus,\r\n checkWatchlist,\r\n completeWander,\r\n loadInterests,\r\n loadWatchlist,\r\n} from '../browse/browse.js';\r\nimport { ensureRegistered, sendNewMessageHint } from '../notify/notify.js';\r\nimport {\r\n loadProfile,\r\n profileFilePath,\r\n verifyProfile,\r\n rebuildProfile,\r\n} from '../profile/store.js';\r\nimport { loadProfileSchema } from '../profile/schema.js';\r\nimport { planBurn, executeBurn } from '../vault/burn-list.js';\r\nimport { writeText } from '../vault/vault.js';\r\nimport {\r\n BUNDLED_PRESET_ID,\r\n conventionalUserPresetRoot,\r\n describeInstall,\r\n installBundledPreset,\r\n presetStatus,\r\n} from '../core/preset-install.js';\r\n\r\nfunction usage(): string {\r\n return [\r\n 'usage: heartbeat <command> [args]',\r\n '',\r\n 'commands:',\r\n ' status workspace paths + policy summary',\r\n ' seeds add <text> [--tag t] [--source s] [--topic x] [--confidence n]',\r\n ' seeds list [--archived] list active (or archived) seeds',\r\n ' seeds surface <id> count a surfacing (rule 1 accounting)',\r\n ' seeds archive <id> deliberate retirement (completed)',\r\n ' seeds gc run deterministic eviction rules 1-3',\r\n ' seeds stats pool status JSON',\r\n ' ledger add <text> register an open item',\r\n ' ledger list [--pending] list entries',\r\n ' ledger done <id|substring> mark an entry done',\r\n ' ledger open open ledger.md in the default editor',\r\n ' logs cleanup [--dry-run] apply log retention now',\r\n ' browse status browse state summary (watch + wander)',\r\n ' browse dry wander adjudication with forced noon window',\r\n ' browse watch run watchlist check now (network)',\r\n ' browse done <focus> CODE-side registration after a wander visit',\r\n ' bind list list session bindings (D13)',\r\n ' bind add <sessionId> [--observe] bind a session (deliver by default)',\r\n ' bind remove <sessionId> unbind a session',\r\n ' sessions list enumerate persisted sessions (ids)',\r\n ' notify check|register|send toast channel (D12: hint only, no body)',\r\n ' profile list [--all] current valid (or all incl. expired) entries',\r\n ' profile export decrypted Markdown export to data/exports/',\r\n ' profile verify journal replay vs disk (report only)',\r\n ' profile rebuild [--check] rebuild materialized view from journal',\r\n ' profile wipe wipe profile data (asks --yes)',\r\n ' burn [--yes] [--all] shred runtime data (settings kept unless --all)',\r\n ' preset status bundled agent preset: target dir + installed?',\r\n ' preset install [--force] install the bundled preset (never overwrites unless --force)',\r\n ].join('\\n');\r\n}\r\n\r\nfunction readStdinText(): string {\r\n try {\r\n return fs.readFileSync(0, 'utf8').trim();\r\n } catch {\r\n return '';\r\n }\r\n}\r\n\r\nfunction flag(argv: string[], name: string): string | undefined {\r\n const i = argv.indexOf(name);\r\n return i > -1 ? argv[i + 1] : undefined;\r\n}\r\n\r\nexport async function main(argv: string[]): Promise<number> {\r\n const [cmd, sub, ...rest] = argv;\r\n if (!cmd || cmd === 'help' || cmd === '--help') {\r\n console.log(usage());\r\n return 0;\r\n }\r\n const paths = initWorkspace();\r\n const guard = createPathGuard(paths.dataDir);\r\n const policy = loadPolicy(guard, paths.configDir, paths.settingsDir);\r\n const seedsFile = seedsFilePath(paths.dataDir);\r\n const ledgerFile = ledgerFilePath(paths.dataDir);\r\n const decisionLog = path.join(paths.logsDir, 'heartbeat.jsonl');\r\n\r\n switch (cmd) {\r\n case 'status': {\r\n console.log(JSON.stringify({\r\n dataDir: paths.dataDir,\r\n heartbeatIntervalMin: policy.heartbeat.intervalMin,\r\n maxDailySend: policy.gate.maxDailySend,\r\n seedsMaxActive: policy.seeds.maxActive,\r\n psyEnabled: policy.profile.psyEnabled,\r\n }, null, 2));\r\n return 0;\r\n }\r\n\r\n case 'seeds': {\r\n switch (sub) {\r\n case 'add': {\r\n let text = rest[0]?.trim() ?? '';\r\n if (text === '-') text = readStdinText();\r\n if (!text) {\r\n console.error('usage: seeds add <text|-> [--tag t] [--source s] [--topic x] [--confidence n]');\r\n return 1;\r\n }\r\n const result = addSeed(guard, seedsFile, policy, {\r\n text,\r\n tag: flag(rest, '--tag') as never,\r\n source: flag(rest, '--source') as never,\r\n topic: flag(rest, '--topic'),\r\n confidence: flag(rest, '--confidence') ? Number(flag(rest, '--confidence')) : undefined,\r\n });\r\n if (result.kind === 'duplicate') {\r\n console.log(`DUPLICATE: active seed ${result.seed.id} has the same text`);\r\n return 0;\r\n }\r\n console.log(`${result.kind.toUpperCase()} ${result.seed.id}` +\r\n ` (${activeSeeds(loadPool(guard, seedsFile)).length}/${policy.seeds.maxActive})` +\r\n (result.evicted ? ` [evicted ${result.evicted.id}: ${result.evicted.retireReason}]` : ''));\r\n return 0;\r\n }\r\n case 'list': {\r\n const db = loadPool(guard, seedsFile);\r\n const items = rest.includes('--archived') ? archivedSeeds(db) : activeSeeds(db);\r\n for (const s of items) {\r\n const ageDays = Math.floor((Date.now() - Date.parse(s.bornAt)) / 86_400_000);\r\n console.log(`${s.id} [${s.tag}/${s.source}] d${ageDays} used:${s.used}` +\r\n `${s.protected ? ' *' : ''} ${s.text.slice(0, 60)}`);\r\n }\r\n if (items.length === 0) console.log('(empty)');\r\n return 0;\r\n }\r\n case 'surface': {\r\n const s = surfaceSeed(guard, seedsFile, policy, rest[0] ?? '');\r\n if (!s) {\r\n console.log('NOT_FOUND');\r\n return 1;\r\n }\r\n console.log(`SURFACED ${s.id} used:${s.used}${s.status === 'archived' ? ' -> archived (consumed)' : ''}`);\r\n return 0;\r\n }\r\n case 'archive': {\r\n const s = archiveSeedById(guard, seedsFile, rest[0] ?? '');\r\n if (!s) {\r\n console.log('NOT_FOUND');\r\n return 1;\r\n }\r\n console.log(`ARCHIVED ${s.id}`);\r\n return 0;\r\n }\r\n case 'gc': {\r\n const report = gcPool(guard, seedsFile, policy);\r\n console.log(`GC consumed:${report.consumed} expired:${report.expired} cold_bench:${report.coldBench}` +\r\n ` -> active ${report.activeAfter}/${policy.seeds.maxActive}`);\r\n return 0;\r\n }\r\n case 'stats': {\r\n const db = loadPool(guard, seedsFile);\r\n console.log(JSON.stringify({\r\n active: activeSeeds(db).length,\r\n archived: archivedSeeds(db).length,\r\n cap: policy.seeds.maxActive,\r\n seq: db.seq,\r\n }, null, 2));\r\n return 0;\r\n }\r\n default:\r\n console.error(`unknown seeds subcommand: ${sub}`);\r\n return 1;\r\n }\r\n }\r\n\r\n case 'ledger': {\r\n switch (sub) {\r\n case 'add': {\r\n let text = rest.join(' ').trim();\r\n if (text === '-') text = readStdinText();\r\n if (!text) {\r\n console.error('usage: ledger add <text|->');\r\n return 1;\r\n }\r\n const e = appendEntry(guard, ledgerFile, text);\r\n console.log(`OPEN #${e.id} ${e.text.slice(0, 60)}`);\r\n return 0;\r\n }\r\n case 'list': {\r\n const { entries } = readLedger(guard, ledgerFile);\r\n const items = rest.includes('--pending') ? scanPending(guard, ledgerFile) : entries;\r\n for (const e of items) console.log(`${e.status === 'open' ? ' ' : 'x'} #${e.id} ${e.date} ${e.text.slice(0, 60)}`);\r\n if (items.length === 0) console.log('(empty)');\r\n return 0;\r\n }\r\n case 'done': {\r\n const key = rest.join(' ').trim();\r\n if (!key) {\r\n console.error('usage: ledger done <id|substring>');\r\n return 1;\r\n }\r\n const e = markDone(guard, ledgerFile, key);\r\n if (!e) {\r\n console.log('NOT_FOUND');\r\n return 1;\r\n }\r\n console.log(`DONE #${e.id}`);\r\n return 0;\r\n }\r\n case 'open': {\r\n const f = ledgerFile;\r\n if (!fs.existsSync(f)) {\r\n console.log(`(ledger will be created at ${f})`);\r\n }\r\n spawn('cmd', ['/c', 'start', '', f], { detached: true, stdio: 'ignore' }).unref();\r\n console.log(`opened ${f}`);\r\n return 0;\r\n }\r\n default:\r\n console.error(`unknown ledger subcommand: ${sub}`);\r\n return 1;\r\n }\r\n }\r\n\r\n case 'logs': {\r\n if (sub !== 'cleanup') {\r\n console.error('usage: logs cleanup [--dry-run]');\r\n return 1;\r\n }\r\n const dry = rest.includes('--dry-run');\r\n const envPulse = path.join(paths.logsDir, 'envpulse.jsonl');\r\n const cut1 = policy.retention.envPulseHours * 3600_000;\r\n const cut2 = policy.retention.decisionLogDays * 86_400_000;\r\n if (dry) {\r\n console.log(`(dry-run) would prune ${envPulse} to ${policy.retention.envPulseHours}h` +\r\n ` and ${decisionLog} to ${policy.retention.decisionLogDays}d`);\r\n return 0;\r\n }\r\n const a = pruneAuditFile(envPulse, cut1);\r\n const b = pruneAuditFile(decisionLog, cut2);\r\n appendAuditLine(decisionLog, { event: 'retention', pruned_envpulse: a, pruned_decision: b });\r\n console.log(`PRUNED envpulse:${a} decision:${b}`);\r\n return 0;\r\n }\r\n\r\n case 'browse': {\r\n switch (sub) {\r\n case 'status': {\r\n const st = browseStatus(guard, paths);\r\n const interests = loadInterests(paths);\r\n console.log(JSON.stringify({\r\n watchTargets: loadWatchlist(paths).targets?.length ?? 0,\r\n lastCheckAt: st.last_check_at ? new Date(st.last_check_at).toISOString() : null,\r\n lastWanderAt: st.wander.last_wander_at ? new Date(st.wander.last_wander_at).toISOString() : null,\r\n focusCount: st.wander.focusCount,\r\n interestCount: interests.interests?.length ?? 0,\r\n }, null, 2));\r\n return 0;\r\n }\r\n case 'dry': {\r\n const forced = new Date();\r\n forced.setHours(12, 0, 0, 0);\r\n const advice = adviseWander(guard, paths, policy, forced);\r\n console.log(JSON.stringify(advice, null, 2));\r\n return 0;\r\n }\r\n case 'watch': {\r\n const report = await checkWatchlist(guard, paths, { throttleOk: true });\r\n console.log(JSON.stringify({ checked: report.checked, updates: report.items.length, errors: report.errors }, null, 2));\r\n for (const item of report.items) console.log(`NEWS: ${item.text}`);\r\n return 0;\r\n }\r\n case 'done': {\r\n const focus = rest.join(' ').trim();\r\n if (!focus) {\r\n console.error('usage: browse done <focus>');\r\n return 1;\r\n }\r\n const r = completeWander(guard, paths, focus);\r\n console.log(JSON.stringify(r));\r\n return 0;\r\n }\r\n default:\r\n console.error(`unknown browse subcommand: ${sub}`);\r\n return 1;\r\n }\r\n }\r\n\r\n case 'notify': {\r\n switch (sub) {\r\n case 'check':\r\n console.log(ensureRegistered(paths) ? 'REGISTERED: yes' : 'REGISTERED: no');\r\n return 0;\r\n case 'register':\r\n ensureRegistered(paths);\r\n console.log('register attempted');\r\n return 0;\r\n case 'send':\r\n console.log(sendNewMessageHint(paths) ? 'SENT' : 'FAILED');\r\n return 0;\r\n default:\r\n console.error('usage: notify check|register|send');\r\n return 1;\r\n }\r\n }\r\n\r\n case 'profile': {\r\n const doc = loadProfile(guard, profileFilePath(paths.dataDir));\r\n const all = rest.includes('--all');\r\n switch (sub) {\r\n case 'list': {\r\n let n = 0;\r\n for (const p of ['interest', 'projects', 'comm', 'psy'] as const) {\r\n for (const e of doc.partitions[p]!.entries) {\r\n if (!all && e.validTo !== null) continue;\r\n n += 1;\r\n console.log(`${e.id} [${e.partition}/${e.topic}/${e.subTopic}] ${e.temporal}` +\r\n ` conf=${e.confidence.toFixed(2)}${e.lowActivity ? ' 久未验证' : ''}${e.validTo ? ' [失效]' : ''}: ${e.content.slice(0, 60)}`);\r\n }\r\n }\r\n if (n === 0) console.log('(empty)');\r\n return 0;\r\n }\r\n case 'export': {\r\n const lines = [`# 画像导出 ${new Date().toISOString()}`, ''];\r\n for (const p of ['interest', 'projects', 'comm', 'psy'] as const) {\r\n lines.push(`## ${p}`);\r\n for (const e of doc.partitions[p]!.entries) {\r\n if (e.validTo !== null) continue;\r\n lines.push(`- [${e.topic}/${e.subTopic}] ${e.content} (conf ${e.confidence.toFixed(2)}, ${e.temporal})`);\r\n }\r\n }\r\n const out = path.join(paths.exportsDir, `profile-export-${Date.now()}.md`);\r\n writeText(guard, out, lines.join('\\n') + '\\n');\r\n console.log(`EXPORTED: ${out}`);\r\n return 0;\r\n }\r\n case 'verify': {\r\n const r = verifyProfile(guard, paths.dataDir);\r\n console.log(JSON.stringify(r, null, 2));\r\n return r.ok ? 0 : 1;\r\n }\r\n case 'rebuild': {\r\n const r = rebuildProfile(guard, paths.dataDir, { check: rest.includes('--check') });\r\n console.log(JSON.stringify(r, null, 2));\r\n return r.ok ? 0 : 1;\r\n }\r\n case 'wipe': {\r\n if (!rest.includes('--yes')) {\r\n console.log('REFUSED: add --yes to wipe profile data (profile.json/inbox/journal)');\r\n return 1;\r\n }\r\n for (const f of ['profile.json', 'profile_inbox.jsonl', 'profile_journal.jsonl']) {\r\n const abs = guard.assert(path.join(paths.dataDir, f));\r\n if (fs.existsSync(abs)) fs.rmSync(abs, { force: true });\r\n }\r\n console.log('WIPED (settings preserved; use burn for full shredding)');\r\n return 0;\r\n }\r\n default:\r\n console.error(`unknown profile subcommand: ${sub}`);\r\n return 1;\r\n }\r\n }\r\n\r\n case 'burn': {\r\n const yes = rest.includes('--yes');\r\n const all = rest.includes('--all');\r\n const plan = planBurn(guard, paths, all);\r\n console.log('预演(不会执行):' );\r\n for (const p of plan) console.log(` [${p.exists ? '存在' : '无 '}] ${p.target.file ?? p.target.dir} ${p.target.note}`);\r\n if (!yes) {\r\n console.log('\\n此操作会让心跳 agent 失忆。确认执行请加 --yes(' + (all ? '含 --all 连用户设定' : '用户设定保留') + ')');\r\n return 0;\r\n }\r\n const result = executeBurn(guard, paths, { all });\r\n console.log(`BURNED: ${result.burned.length} 项;MISSING: ${result.missing.length} 项`);\r\n return 0;\r\n }\r\n\r\n case 'sessions': {\r\n // Read-only enumeration of the host's persisted sessions (ids from the\r\n // on-disk store; titles live server-side and are not listed here).\r\n const root = path.join(os.homedir(), '.dsh', 'sessions');\r\n let found = 0;\r\n if (fs.existsSync(root)) {\r\n let own: string | null = null;\r\n try {\r\n own = (JSON.parse(loadEncryptedText(guard, path.join(paths.dataDir, 'gate.json')) ?? '{}') as { sessionId?: string }).sessionId ?? null;\r\n } catch { /* gate.json absent or unreadable */ }\r\n for (const slug of fs.readdirSync(root)) {\r\n for (const id of fs.readdirSync(path.join(root, slug))) {\r\n found += 1;\r\n const mark = id === own ? ' ← 心跳正身' : '';\r\n console.log(`${id} [${slug}]${mark}`);\r\n }\r\n }\r\n }\r\n if (found === 0) console.log('(no persisted sessions found)');\r\n return 0;\r\n }\r\n\r\n case 'bind': {\r\n const { loadBindings, addBinding, removeBinding, bindingsFilePath } = await import('../core/bindings.js');\r\n switch (sub) {\r\n case 'list': {\r\n const data = loadBindings(guard, paths.settingsDir);\r\n let own: string | null = null;\r\n try {\r\n own = (JSON.parse(loadEncryptedText(guard, path.join(paths.dataDir, 'gate.json')) ?? '{}') as { sessionId?: string }).sessionId ?? null;\r\n } catch { /* absent */ }\r\n if (own) console.log(`心跳正身: ${own}(决策轮次发生地;bind remove 它 = 重置正身)`);\r\n for (const b of data.bindings) {\r\n console.log(`${b.sessionId} deliver:${b.deliver ? '√' : '×'} observe:${b.observe ? '√' : '×'}`);\r\n }\r\n if (data.bindings.length === 0 && !own) console.log('(no bindings — expressions stay in the dedicated heartbeat session)');\r\n return 0;\r\n }\r\n case 'add': {\r\n const id = rest[0];\r\n if (!id || !id.startsWith('session-')) {\r\n console.error('usage: bind add <sessionId> [--observe] [--no-deliver] (see: sessions list)');\r\n return 1;\r\n }\r\n const observe = rest.includes('--observe') || rest.includes('--observe-only');\r\n const deliver = !rest.includes('--no-deliver') && !rest.includes('--observe-only');\r\n const b = addBinding(guard, paths.settingsDir, id, { deliver, observe });\r\n console.log(`BOUND ${b.sessionId} deliver:${b.deliver} observe:${b.observe}`);\r\n return 0;\r\n }\r\n case 'remove': {\r\n const id = rest[0];\r\n if (!id) {\r\n console.error('usage: bind remove <sessionId>');\r\n return 1;\r\n }\r\n console.log(removeBinding(guard, paths.settingsDir, id) ? `UNBOUND ${id}` : 'NOT_FOUND');\r\n // Unbinding the HOME session resets it: the next beat creates a\r\n // fresh dedicated session (the old one goes quiet after restart).\r\n try {\r\n const state = JSON.parse(loadEncryptedText(guard, path.join(paths.dataDir, 'gate.json')) ?? '{}') as { sessionId?: string };\r\n if (state.sessionId === id) {\r\n fs.rmSync(guard.assert(path.join(paths.dataDir, 'gate.json')), { force: true });\r\n console.log('注意:这是心跳正身会话。已重置——下次心跳将创建新的正身会话(旧会话不再有心跳)');\r\n appendAuditLine(paths.logsDir + '/heartbeat.jsonl', { event: 'home_reset', oldSessionId: id });\r\n }\r\n } catch { /* gate.json absent: nothing to reset */ }\r\n return 0;\r\n }\r\n default:\r\n console.error('usage: bind list | add <sessionId> | remove <sessionId>');\r\n return 1;\r\n }\r\n }\r\n\r\n case 'preset': {\r\n const id = flag(argv, '--id') ?? BUNDLED_PRESET_ID;\r\n // The plugin installs into the roster's own user root; the CLI has no\r\n // roster, so it reports/uses the conventional one ($DSH_HOME or ~/.dsh).\r\n const root = conventionalUserPresetRoot();\r\n const status = presetStatus(import.meta.url, id, root);\r\n if (sub === undefined || sub === 'status') {\r\n console.log(`preset id : ${status.id}`);\r\n console.log(`installed : ${status.installed ? 'yes' : 'no'}`);\r\n console.log(`target dir : ${status.dir}`);\r\n console.log(`bundled at : ${status.bundledDir ?? '(not found next to the plugin)'}`);\r\n if (status.installed) {\r\n console.log(\r\n `composition : ${status.compositionMatches ? 'matches the bundled template' : 'differs from the bundled template (hand-edited, or an older version)'}`,\r\n );\r\n }\r\n if (!status.installed) {\r\n console.log('hint: the plugin installs this itself on the next DSH start (installPreset=true, default);');\r\n console.log(' or run `preset install` now.');\r\n }\r\n return status.installed ? 0 : 1;\r\n }\r\n if (sub === 'install') {\r\n const result = installBundledPreset({\r\n moduleUrl: import.meta.url,\r\n id,\r\n root,\r\n force: rest.includes('--force'),\r\n });\r\n console.log(describeInstall(result));\r\n return result.action === 'error' ? 1 : 0;\r\n }\r\n console.error('usage: preset status | install [--force] [--id <presetId>]');\r\n return 1;\r\n }\r\n\r\n default:\r\n console.error(`unknown command: ${cmd}`);\r\n console.log(usage());\r\n return 1;\r\n }\r\n}\r\n\r\nif (process.argv[1] && import.meta.url === new URL(`file:///${process.argv[1].replace(/\\\\/g, '/')}`).href) {\r\n // Direct execution guard; the CLI is also importable for tests.\r\n void main(process.argv.slice(2)).then((code) => { process.exitCode = code; });\r\n}\r\n","// Burn list - SINGLE SOURCE OF TRUTH (design doc §10.10; v1 shipped two\n// hardcoded lists and one drifted). burn and uninstall --purge both consume\n// this list. Settings (data/settings/) are NOT burned by default: losing\n// memory != losing the charter/gates the user configured (--all overrides).\n\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport type { PathGuard } from '../core/path-guard.js';\nimport type { WorkspacePaths } from '../core/paths.js';\nimport { shredFileSync } from '../core/atomic-fs.js';\nimport { appendAuditLine } from '../core/audit-log.js';\n\nexport interface BurnTarget {\n /** Relative to dataDir. Files are shredded (overwrite x3) then deleted. */\n file?: string;\n /** Directories are removed recursively (no shred - content is files). */\n dir?: string;\n note: string;\n}\n\nexport const BURN_LIST: BurnTarget[] = [\n { file: 'profile.json', note: '画像物化视图' },\n { file: 'profile_inbox.jsonl', note: '观察收件箱' },\n { file: 'profile_journal.jsonl', note: '画像操作流水' },\n { file: 'profile_rhythm.json', note: '作息聚合(纯统计)' },\n { file: 'screen.json', note: '屏幕快照(加密)' },\n { file: 'screen.jpg', note: '截图(加密)' },\n { file: 'sent.json', note: '表达记录(加密)' },\n { file: 'browse.json', note: '浏览流状态(加密)' },\n { file: 'seeds.jsonl', note: '素材池(加密)' },\n { file: 'ledger.md', note: '账本(明文,人可读是设计目标)' },\n { file: 'envpulse.json', note: '环境温度计快照' },\n { file: 'gate.json', note: '闸门运行时计数' },\n { dir: 'tmp', note: '解锁临时文件(崩溃残留的解密明文是最该烧的东西)' },\n { dir: 'logs', note: '审计与决策日志' },\n { dir: 'exports', note: '导出产物' },\n];\n\nconst SETTINGS_DIR = 'settings'; // excluded unless --all\n\nexport interface BurnPlanItem {\n target: BurnTarget;\n exists: boolean;\n}\n\n/** Preview: what exists, what would be removed. No writes. */\nexport function planBurn(guard: PathGuard, paths: WorkspacePaths, all = false): BurnPlanItem[] {\n const plan: BurnPlanItem[] = [];\n for (const t of BURN_LIST) {\n const rel = t.file ?? t.dir!;\n if (!all && rel === SETTINGS_DIR) continue;\n const abs = path.join(paths.dataDir, rel);\n let exists = false;\n try {\n exists = fs.existsSync(guard.assert(abs));\n } catch {\n exists = false;\n }\n plan.push({ target: t, exists });\n }\n if (all) {\n plan.push({ target: { dir: SETTINGS_DIR, note: '用户设定(隐私宪章/闸门参数)——仅 --all 连带' }, exists: fs.existsSync(paths.settingsDir) });\n }\n return plan;\n}\n\n/**\n * Execute the burn: overwrite x3 + delete files, remove dirs. Irreversible.\n * Returns per-target results and writes a BURN_EVENT into the (recreated)\n * journal afterwards - the only trace, on purpose (transparency).\n */\nexport function executeBurn(\n guard: PathGuard,\n paths: WorkspacePaths,\n opts: { all?: boolean; shredPasses?: number } = {},\n): { burned: string[]; missing: string[] } {\n const burned: string[] = [];\n const missing: string[] = [];\n const passes = opts.shredPasses ?? 3;\n for (const t of BURN_LIST) {\n const rel = t.file ?? t.dir!;\n const abs = path.join(paths.dataDir, rel);\n let absCanon: string;\n try {\n absCanon = guard.assert(abs);\n } catch {\n missing.push(rel);\n continue;\n }\n if (t.file) {\n if (fs.existsSync(absCanon)) {\n shredFileSync(absCanon, passes);\n burned.push(rel);\n } else {\n missing.push(rel);\n }\n } else if (fs.existsSync(absCanon)) {\n fs.rmSync(absCanon, { recursive: true, force: true });\n burned.push(rel);\n } else {\n missing.push(rel);\n }\n }\n if (opts.all) {\n fs.rmSync(paths.settingsDir, { recursive: true, force: true });\n burned.push(SETTINGS_DIR);\n }\n // BURN_EVENT: recreate the journal; data dir is now re-initializable.\n appendAuditLine(guard.assert(path.join(paths.dataDir, 'profile_journal.jsonl')), {\n event: 'BURN_EVENT',\n burned: burned.length,\n missing: missing.length,\n settingsPreserved: !opts.all,\n });\n return { burned, missing };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,aAAa;AACtB,OAAOA,SAAQ;AACf,OAAO,QAAQ;AACf,OAAOC,WAAU;;;ACDjB,OAAO,QAAQ;AACf,OAAO,UAAU;AAcV,IAAM,YAA0B;AAAA,EACrC,EAAE,MAAM,gBAAgB,MAAM,uCAAS;AAAA,EACvC,EAAE,MAAM,uBAAuB,MAAM,iCAAQ;AAAA,EAC7C,EAAE,MAAM,yBAAyB,MAAM,uCAAS;AAAA,EAChD,EAAE,MAAM,uBAAuB,MAAM,yDAAY;AAAA,EACjD,EAAE,MAAM,eAAe,MAAM,mDAAW;AAAA,EACxC,EAAE,MAAM,cAAc,MAAM,uCAAS;AAAA,EACrC,EAAE,MAAM,aAAa,MAAM,mDAAW;AAAA,EACtC,EAAE,MAAM,eAAe,MAAM,yDAAY;AAAA,EACzC,EAAE,MAAM,eAAe,MAAM,6CAAU;AAAA,EACvC,EAAE,MAAM,aAAa,MAAM,6FAAkB;AAAA,EAC7C,EAAE,MAAM,iBAAiB,MAAM,6CAAU;AAAA,EACzC,EAAE,MAAM,aAAa,MAAM,6CAAU;AAAA,EACrC,EAAE,KAAK,OAAO,MAAM,mJAA2B;AAAA,EAC/C,EAAE,KAAK,QAAQ,MAAM,6CAAU;AAA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,IAAI,iBAAiB,OAAO,EAAE,EAAE;AACxC,gBAAQ,IAAI,iBAAiB,OAAO,YAAY,QAAQ,IAAI,EAAE;AAC9D,gBAAQ,IAAI,iBAAiB,OAAO,GAAG,EAAE;AACzC,gBAAQ,IAAI,iBAAiB,OAAO,cAAc,gCAAgC,EAAE;AACpF,YAAI,OAAO,WAAW;AACpB,kBAAQ;AAAA,YACN,iBAAiB,OAAO,qBAAqB,iCAAiC,sEAAsE;AAAA,UACtJ;AAAA,QACF;AACA,YAAI,CAAC,OAAO,WAAW;AACrB,kBAAQ,IAAI,4FAA4F;AACxG,kBAAQ,IAAI,oCAAoC;AAAA,QAClD;AACA,eAAO,OAAO,YAAY,IAAI;AAAA,MAChC;AACA,UAAI,QAAQ,WAAW;AACrB,cAAM,SAAS,qBAAqB;AAAA,UAClC,WAAW,YAAY;AAAA,UACvB;AAAA,UACA;AAAA,UACA,OAAO,KAAK,SAAS,SAAS;AAAA,QAChC,CAAC;AACD,gBAAQ,IAAI,gBAAgB,MAAM,CAAC;AACnC,eAAO,OAAO,WAAW,UAAU,IAAI;AAAA,MACzC;AACA,cAAQ,MAAM,4DAA4D;AAC1E,aAAO;AAAA,IACT;AAAA,IAEA;AACE,cAAQ,MAAM,oBAAoB,GAAG,EAAE;AACvC,cAAQ,IAAI,MAAM,CAAC;AACnB,aAAO;AAAA,EACX;AACF;AAEA,IAAI,QAAQ,KAAK,CAAC,KAAK,YAAY,QAAQ,IAAI,IAAI,WAAW,QAAQ,KAAK,CAAC,EAAE,QAAQ,OAAO,GAAG,CAAC,EAAE,EAAE,MAAM;AAEzG,OAAK,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS;AAAE,YAAQ,WAAW;AAAA,EAAM,CAAC;AAC9E;","names":["fs","path","fs","path"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts","../../src/vault/burn-list.ts"],"sourcesContent":["// Operational CLI (design doc §14). Commands grow per module.\r\n// Run: node dist/cli/index.js <command> [args] (or via tsx in dev)\r\n\r\nimport { spawn } from 'node:child_process';\r\nimport fs from 'node:fs';\r\nimport os from 'node:os';\r\nimport path from 'node:path';\r\nimport { initWorkspace, workspace } from '../core/paths.js';\r\nimport { createPathGuard } from '../core/path-guard.js';\r\nimport { appendAuditLine, pruneAuditFile } from '../core/audit-log.js';\r\nimport { loadEncryptedText } from '../vault/vault.js';\r\nimport { loadPolicy } from '../config/load.js';\r\nimport {\r\n addSeed,\r\n archiveSeedById,\r\n gcPool,\r\n loadPool,\r\n activeSeeds,\r\n archivedSeeds,\r\n seedsFilePath,\r\n surfaceSeed,\r\n} from '../seeds/pool.js';\r\nimport {\r\n appendEntry,\r\n ledgerFilePath,\r\n markDone,\r\n readLedger,\r\n scanPending,\r\n} from '../ledger/ledger.js';\r\nimport {\r\n adviseWander,\r\n browseStatePath,\r\n browseStatus,\r\n checkWatchlist,\r\n completeWander,\r\n loadInterests,\r\n loadWatchlist,\r\n} from '../browse/browse.js';\r\nimport { ensureRegistered, sendNewMessageHint } from '../notify/notify.js';\r\nimport {\r\n loadProfile,\r\n profileFilePath,\r\n verifyProfile,\r\n rebuildProfile,\r\n} from '../profile/store.js';\r\nimport { loadProfileSchema } from '../profile/schema.js';\r\nimport { planBurn, executeBurn } from '../vault/burn-list.js';\r\nimport {\r\n collectMigrationEntries,\r\n encryptContainer,\r\n decryptContainer,\r\n applyMigrationEntries,\r\n} from '../vault/migrate.js';\r\nimport { listWeeklyReports, readWeeklyReport, weeklyDirPath } from '../weekly/report.js';\r\nimport { writeText } from '../vault/vault.js';\r\nimport {\r\n BUNDLED_PRESET_ID,\r\n conventionalUserPresetRoot,\r\n describeInstall,\r\n installBundledPreset,\r\n presetStatus,\r\n} from '../core/preset-install.js';\r\n\r\nfunction usage(): string {\r\n return [\r\n 'usage: heartbeat <command> [args]',\r\n '',\r\n 'commands:',\r\n ' status workspace paths + policy summary',\r\n ' seeds add <text> [--tag t] [--source s] [--topic x] [--confidence n]',\r\n ' seeds list [--archived] list active (or archived) seeds',\r\n ' seeds surface <id> count a surfacing (rule 1 accounting)',\r\n ' seeds archive <id> deliberate retirement (completed)',\r\n ' seeds gc run deterministic eviction rules 1-3',\r\n ' seeds stats pool status JSON',\r\n ' ledger add <text> register an open item',\r\n ' ledger list [--pending] list entries',\r\n ' ledger done <id|substring> mark an entry done',\r\n ' ledger open open ledger.md in the default editor',\r\n ' logs cleanup [--dry-run] apply log retention now',\r\n ' browse status browse state summary (watch + wander)',\r\n ' browse dry wander adjudication with forced noon window',\r\n ' browse watch run watchlist check now (network)',\r\n ' browse done <focus> CODE-side registration after a wander visit',\r\n ' bind list list session bindings (D13)',\r\n ' bind add <sessionId> [--observe] bind a session (deliver by default)',\r\n ' bind remove <sessionId> unbind a session',\r\n ' sessions list enumerate persisted sessions (ids)',\r\n ' notify check|register|send toast channel (D12: hint only, no body)',\r\n ' profile list [--all] current valid (or all incl. expired) entries',\r\n ' profile export decrypted Markdown export to data/exports/',\r\n ' profile verify journal replay vs disk (report only)',\r\n ' profile rebuild [--check] rebuild materialized view from journal',\r\n ' profile snapshot [--force] fold the journal into a snapshot + archive shard',\r\n ' profile wipe wipe profile data (asks --yes)',\r\n ' weekly list list generated weekly reports',\r\n ' weekly show [file] print a report (default: newest)',\r\n ' migrate export [file] pack memory files into a passphrase container (passphrase: 2 stdin lines)',\r\n ' migrate import <file> restore a container into this workspace (passphrase: 1 stdin line)',\r\n ' burn [--yes] [--all] shred runtime data (settings kept unless --all)',\r\n ' preset status bundled agent preset: target dir + installed?',\r\n ' preset install [--force] install the bundled preset (never overwrites unless --force)',\r\n ].join('\\n');\r\n}\r\n\r\nfunction readStdinText(): string {\r\n try {\r\n return fs.readFileSync(0, 'utf8').trim();\r\n } catch {\r\n return '';\r\n }\r\n}\r\n\r\nfunction flag(argv: string[], name: string): string | undefined {\r\n const i = argv.indexOf(name);\r\n return i > -1 ? argv[i + 1] : undefined;\r\n}\r\n\r\n/** Read N lines from stdin (passphrase prompts for migrate). */\r\nasync function readLines(prompts: string[]): Promise<string[]> {\r\n const readline = await import('node:readline/promises');\r\n const it = readline.createInterface({ input: process.stdin });\r\n const out: string[] = [];\r\n for (const p of prompts) out.push((await it.question(p)).trim());\r\n it.close();\r\n return out;\r\n}\r\n\r\nexport async function main(argv: string[]): Promise<number> {\r\n const [cmd, sub, ...rest] = argv;\r\n if (!cmd || cmd === 'help' || cmd === '--help') {\r\n console.log(usage());\r\n return 0;\r\n }\r\n const paths = initWorkspace();\r\n const guard = createPathGuard(paths.dataDir);\r\n const policy = loadPolicy(guard, paths.configDir, paths.settingsDir);\r\n const seedsFile = seedsFilePath(paths.dataDir);\r\n const ledgerFile = ledgerFilePath(paths.dataDir);\r\n const decisionLog = path.join(paths.logsDir, 'heartbeat.jsonl');\r\n\r\n switch (cmd) {\r\n case 'status': {\r\n console.log(JSON.stringify({\r\n dataDir: paths.dataDir,\r\n heartbeatIntervalMin: policy.heartbeat.intervalMin,\r\n maxDailySend: policy.gate.maxDailySend,\r\n seedsMaxActive: policy.seeds.maxActive,\r\n psyEnabled: policy.profile.psyEnabled,\r\n }, null, 2));\r\n return 0;\r\n }\r\n\r\n case 'seeds': {\r\n switch (sub) {\r\n case 'add': {\r\n let text = rest[0]?.trim() ?? '';\r\n if (text === '-') text = readStdinText();\r\n if (!text) {\r\n console.error('usage: seeds add <text|-> [--tag t] [--source s] [--topic x] [--confidence n]');\r\n return 1;\r\n }\r\n const result = addSeed(guard, seedsFile, policy, {\r\n text,\r\n tag: flag(rest, '--tag') as never,\r\n source: flag(rest, '--source') as never,\r\n topic: flag(rest, '--topic'),\r\n confidence: flag(rest, '--confidence') ? Number(flag(rest, '--confidence')) : undefined,\r\n });\r\n if (result.kind === 'duplicate') {\r\n console.log(`DUPLICATE: active seed ${result.seed.id} has the same text`);\r\n return 0;\r\n }\r\n console.log(`${result.kind.toUpperCase()} ${result.seed.id}` +\r\n ` (${activeSeeds(loadPool(guard, seedsFile)).length}/${policy.seeds.maxActive})` +\r\n (result.evicted ? ` [evicted ${result.evicted.id}: ${result.evicted.retireReason}]` : ''));\r\n return 0;\r\n }\r\n case 'list': {\r\n const db = loadPool(guard, seedsFile);\r\n const items = rest.includes('--archived') ? archivedSeeds(db) : activeSeeds(db);\r\n for (const s of items) {\r\n const ageDays = Math.floor((Date.now() - Date.parse(s.bornAt)) / 86_400_000);\r\n console.log(`${s.id} [${s.tag}/${s.source}] d${ageDays} used:${s.used}` +\r\n `${s.protected ? ' *' : ''} ${s.text.slice(0, 60)}`);\r\n }\r\n if (items.length === 0) console.log('(empty)');\r\n return 0;\r\n }\r\n case 'surface': {\r\n const s = surfaceSeed(guard, seedsFile, policy, rest[0] ?? '');\r\n if (!s) {\r\n console.log('NOT_FOUND');\r\n return 1;\r\n }\r\n console.log(`SURFACED ${s.id} used:${s.used}${s.status === 'archived' ? ' -> archived (consumed)' : ''}`);\r\n return 0;\r\n }\r\n case 'archive': {\r\n const s = archiveSeedById(guard, seedsFile, rest[0] ?? '');\r\n if (!s) {\r\n console.log('NOT_FOUND');\r\n return 1;\r\n }\r\n console.log(`ARCHIVED ${s.id}`);\r\n return 0;\r\n }\r\n case 'gc': {\r\n const report = gcPool(guard, seedsFile, policy);\r\n console.log(`GC consumed:${report.consumed} expired:${report.expired} cold_bench:${report.coldBench}` +\r\n ` -> active ${report.activeAfter}/${policy.seeds.maxActive}`);\r\n return 0;\r\n }\r\n case 'stats': {\r\n const db = loadPool(guard, seedsFile);\r\n console.log(JSON.stringify({\r\n active: activeSeeds(db).length,\r\n archived: archivedSeeds(db).length,\r\n cap: policy.seeds.maxActive,\r\n seq: db.seq,\r\n }, null, 2));\r\n return 0;\r\n }\r\n default:\r\n console.error(`unknown seeds subcommand: ${sub}`);\r\n return 1;\r\n }\r\n }\r\n\r\n case 'ledger': {\r\n switch (sub) {\r\n case 'add': {\r\n let text = rest.join(' ').trim();\r\n if (text === '-') text = readStdinText();\r\n if (!text) {\r\n console.error('usage: ledger add <text|->');\r\n return 1;\r\n }\r\n const e = appendEntry(guard, ledgerFile, text);\r\n console.log(`OPEN #${e.id} ${e.text.slice(0, 60)}`);\r\n return 0;\r\n }\r\n case 'list': {\r\n const { entries } = readLedger(guard, ledgerFile);\r\n const items = rest.includes('--pending') ? scanPending(guard, ledgerFile) : entries;\r\n for (const e of items) console.log(`${e.status === 'open' ? ' ' : 'x'} #${e.id} ${e.date} ${e.text.slice(0, 60)}`);\r\n if (items.length === 0) console.log('(empty)');\r\n return 0;\r\n }\r\n case 'done': {\r\n const key = rest.join(' ').trim();\r\n if (!key) {\r\n console.error('usage: ledger done <id|substring>');\r\n return 1;\r\n }\r\n const e = markDone(guard, ledgerFile, key);\r\n if (!e) {\r\n console.log('NOT_FOUND');\r\n return 1;\r\n }\r\n console.log(`DONE #${e.id}`);\r\n return 0;\r\n }\r\n case 'open': {\r\n const f = ledgerFile;\r\n if (!fs.existsSync(f)) {\r\n console.log(`(ledger will be created at ${f})`);\r\n }\r\n spawn('cmd', ['/c', 'start', '', f], { detached: true, stdio: 'ignore' }).unref();\r\n console.log(`opened ${f}`);\r\n return 0;\r\n }\r\n default:\r\n console.error(`unknown ledger subcommand: ${sub}`);\r\n return 1;\r\n }\r\n }\r\n\r\n case 'weekly': {\r\n const reports = listWeeklyReports(guard, paths.dataDir);\r\n if (sub === 'list' || sub === undefined) {\r\n if (reports.length === 0) console.log('(no reports yet — heartbeat generates one every 7 days)');\r\n for (const r of reports) console.log(`${r.file} ${r.start.slice(0, 10)} ~ ${r.end.slice(0, 10)} [${r.source}]`);\r\n return 0;\r\n }\r\n if (sub === 'show') {\r\n const file = rest[0] ?? reports[0]?.file;\r\n if (!file) {\r\n console.log('(no reports yet)');\r\n return 1;\r\n }\r\n const rep = readWeeklyReport(guard, paths.dataDir, file);\r\n if (!rep) {\r\n console.error(`no such report: ${file} (see: weekly list; files live in ${weeklyDirPath(paths.dataDir)})`);\r\n return 1;\r\n }\r\n console.log(`# ${rep.start.slice(0, 10)} ~ ${rep.end.slice(0, 10)} [${rep.source}]`);\r\n console.log(rep.text);\r\n return 0;\r\n }\r\n console.error(`unknown weekly subcommand: ${sub}`);\r\n return 1;\r\n }\r\n\r\n case 'logs': {\r\n if (sub !== 'cleanup') {\r\n console.error('usage: logs cleanup [--dry-run]');\r\n return 1;\r\n }\r\n const dry = rest.includes('--dry-run');\r\n const envPulse = path.join(paths.logsDir, 'envpulse.jsonl');\r\n const cut1 = policy.retention.envPulseHours * 3600_000;\r\n const cut2 = policy.retention.decisionLogDays * 86_400_000;\r\n if (dry) {\r\n console.log(`(dry-run) would prune ${envPulse} to ${policy.retention.envPulseHours}h` +\r\n ` and ${decisionLog} to ${policy.retention.decisionLogDays}d`);\r\n return 0;\r\n }\r\n const a = pruneAuditFile(envPulse, cut1);\r\n const b = pruneAuditFile(decisionLog, cut2);\r\n appendAuditLine(decisionLog, { event: 'retention', pruned_envpulse: a, pruned_decision: b });\r\n console.log(`PRUNED envpulse:${a} decision:${b}`);\r\n return 0;\r\n }\r\n\r\n case 'browse': {\r\n switch (sub) {\r\n case 'status': {\r\n const st = browseStatus(guard, paths);\r\n const interests = loadInterests(paths);\r\n console.log(JSON.stringify({\r\n watchTargets: loadWatchlist(paths).targets?.length ?? 0,\r\n lastCheckAt: st.last_check_at ? new Date(st.last_check_at).toISOString() : null,\r\n lastWanderAt: st.wander.last_wander_at ? new Date(st.wander.last_wander_at).toISOString() : null,\r\n focusCount: st.wander.focusCount,\r\n interestCount: interests.interests?.length ?? 0,\r\n }, null, 2));\r\n return 0;\r\n }\r\n case 'dry': {\r\n const forced = new Date();\r\n forced.setHours(12, 0, 0, 0);\r\n const advice = adviseWander(guard, paths, policy, forced);\r\n console.log(JSON.stringify(advice, null, 2));\r\n return 0;\r\n }\r\n case 'watch': {\r\n const report = await checkWatchlist(guard, paths, { throttleOk: true });\r\n console.log(JSON.stringify({ checked: report.checked, updates: report.items.length, errors: report.errors }, null, 2));\r\n for (const item of report.items) console.log(`NEWS: ${item.text}`);\r\n return 0;\r\n }\r\n case 'done': {\r\n const focus = rest.join(' ').trim();\r\n if (!focus) {\r\n console.error('usage: browse done <focus>');\r\n return 1;\r\n }\r\n const r = completeWander(guard, paths, focus);\r\n console.log(JSON.stringify(r));\r\n return 0;\r\n }\r\n default:\r\n console.error(`unknown browse subcommand: ${sub}`);\r\n return 1;\r\n }\r\n }\r\n\r\n case 'notify': {\r\n switch (sub) {\r\n case 'check':\r\n console.log(ensureRegistered(paths) ? 'REGISTERED: yes' : 'REGISTERED: no');\r\n return 0;\r\n case 'register':\r\n ensureRegistered(paths);\r\n console.log('register attempted');\r\n return 0;\r\n case 'send':\r\n console.log(sendNewMessageHint(paths) ? 'SENT' : 'FAILED');\r\n return 0;\r\n default:\r\n console.error('usage: notify check|register|send');\r\n return 1;\r\n }\r\n }\r\n\r\n case 'profile': {\r\n const doc = loadProfile(guard, profileFilePath(paths.dataDir));\r\n const all = rest.includes('--all');\r\n switch (sub) {\r\n case 'list': {\r\n let n = 0;\r\n for (const p of ['interest', 'projects', 'comm', 'psy'] as const) {\r\n for (const e of doc.partitions[p]!.entries) {\r\n if (!all && e.validTo !== null) continue;\r\n n += 1;\r\n console.log(`${e.id} [${e.partition}/${e.topic}/${e.subTopic}] ${e.temporal}` +\r\n ` conf=${e.confidence.toFixed(2)}${e.lowActivity ? ' 久未验证' : ''}${e.validTo ? ' [失效]' : ''}: ${e.content.slice(0, 60)}`);\r\n }\r\n }\r\n if (n === 0) console.log('(empty)');\r\n return 0;\r\n }\r\n case 'export': {\r\n const lines = [`# 画像导出 ${new Date().toISOString()}`, ''];\r\n for (const p of ['interest', 'projects', 'comm', 'psy'] as const) {\r\n lines.push(`## ${p}`);\r\n for (const e of doc.partitions[p]!.entries) {\r\n if (e.validTo !== null) continue;\r\n lines.push(`- [${e.topic}/${e.subTopic}] ${e.content} (conf ${e.confidence.toFixed(2)}, ${e.temporal})`);\r\n }\r\n }\r\n const out = path.join(paths.exportsDir, `profile-export-${Date.now()}.md`);\r\n writeText(guard, out, lines.join('\\n') + '\\n');\r\n console.log(`EXPORTED: ${out}`);\r\n return 0;\r\n }\r\n case 'verify': {\r\n const r = verifyProfile(guard, paths.dataDir);\r\n console.log(JSON.stringify(r, null, 2));\r\n return r.ok ? 0 : 1;\r\n }\r\n case 'rebuild': {\r\n const r = rebuildProfile(guard, paths.dataDir, { check: rest.includes('--check') });\r\n console.log(JSON.stringify(r, null, 2));\r\n return r.ok ? 0 : 1;\r\n }\r\n case 'wipe': {\r\n if (!rest.includes('--yes')) {\r\n console.log('REFUSED: add --yes to wipe profile data (profile.json/inbox/journal)');\r\n return 1;\r\n }\r\n for (const f of ['profile.json', 'profile_inbox.jsonl', 'profile_journal.jsonl']) {\r\n const abs = guard.assert(path.join(paths.dataDir, f));\r\n if (fs.existsSync(abs)) fs.rmSync(abs, { force: true });\r\n }\r\n console.log('WIPED (settings preserved; use burn for full shredding)');\r\n return 0;\r\n }\r\n case 'snapshot': {\r\n const { snapshotDue, snapshotProfile, SNAPSHOT_THRESHOLD } = await import('../profile/snapshot.js');\r\n const { needed, lines } = snapshotDue(guard, paths.dataDir);\r\n console.log(`journal ${lines} 条(阈值 ${SNAPSHOT_THRESHOLD})`);\r\n if (!needed && !rest.includes('--force')) {\r\n console.log('未到阈值,未执行(加 --force 强制折叠)。');\r\n return 0;\r\n }\r\n const report = snapshotProfile(guard, paths.dataDir);\r\n if (!report.ok) {\r\n console.log(`未执行:${report.reason}`);\r\n return 0;\r\n }\r\n console.log(`已折叠 ${report.folded} 条 → 快照(baseline ${report.baselineTs}),归档 ${report.archiveFile},live journal 已清空。`);\r\n console.log('verify/rebuild 自动从快照基点重放,无需额外操作。');\r\n return 0;\r\n }\r\n default:\r\n console.error(`unknown profile subcommand: ${sub}`);\r\n return 1;\r\n }\r\n }\r\n\r\n case 'burn': {\r\n const yes = rest.includes('--yes');\r\n const all = rest.includes('--all');\r\n const plan = planBurn(guard, paths, all);\r\n console.log('预演(不会执行):' );\r\n for (const p of plan) console.log(` [${p.exists ? '存在' : '无 '}] ${p.target.file ?? p.target.dir} ${p.target.note}`);\r\n if (!yes) {\r\n console.log('\\n此操作会让心跳 agent 失忆。确认执行请加 --yes(' + (all ? '含 --all 连用户设定' : '用户设定保留') + ')');\r\n return 0;\r\n }\r\n const result = executeBurn(guard, paths, { all });\r\n console.log(`BURNED: ${result.burned.length} 项;MISSING: ${result.missing.length} 项`);\r\n return 0;\r\n }\r\n\r\n case 'migrate': {\r\n if (sub === 'export') {\r\n const defaultOut = path.join(paths.exportsDir, `heartbeat-memory-${new Date().toISOString().slice(0, 10)}.hbmig`);\r\n const outfile = rest[0] ?? defaultOut;\r\n let outCanon: string;\r\n try {\r\n outCanon = guard.assert(outfile);\r\n } catch {\r\n console.error(`导出文件必须落在插件 data/ 目录内(路径守卫拒绝):${outfile}\\n默认位置:${defaultOut}`);\r\n return 1;\r\n }\r\n const [pw1, pw2] = await readLines(['设置口令(用于加密迁移包): ', '再输入一次确认: ']);\r\n if (!pw1 || pw1 !== pw2) {\r\n console.error('两次输入不一致或为空,已取消。');\r\n return 1;\r\n }\r\n const { entries, progress } = collectMigrationEntries(guard, paths);\r\n if (entries.length === 0) {\r\n console.log('没有可打包的记忆文件(data/ 是空的)。');\r\n return 1;\r\n }\r\n fs.mkdirSync(path.dirname(outCanon), { recursive: true });\r\n fs.writeFileSync(outCanon, encryptContainer(entries, pw1), 'utf8');\r\n console.log(`已打包 ${entries.length} 个文件 → ${outCanon}`);\r\n console.log(` 打包:${progress.packed.join(', ')}`);\r\n if (progress.missing.length > 0) console.log(` 跳过(不存在):${progress.missing.join(', ')}`);\r\n console.log('容器是口令加密的,可安全拷贝到新机器;DPAPI 会在导入时用新机器重新加密。');\r\n return 0;\r\n }\r\n if (sub === 'import') {\r\n const infile = rest[0];\r\n if (!infile) {\r\n console.error('usage: migrate import <container-file>');\r\n return 1;\r\n }\r\n const [pw] = await readLines(['输入迁移包口令: ']);\r\n let text: string;\r\n try {\r\n text = fs.readFileSync(infile, 'utf8');\r\n } catch {\r\n console.error(`读不到迁移包:${infile}`);\r\n return 1;\r\n }\r\n let files;\r\n try {\r\n files = decryptContainer(text, pw ?? '');\r\n } catch (e) {\r\n console.error(String(e instanceof Error ? e.message : e));\r\n return 1;\r\n }\r\n const result = applyMigrationEntries(guard, paths, files.files);\r\n console.log(`恢复 ${result.restored.length} 个文件;备份 ${result.backedUp.length} 个被覆盖文件;跳过 ${result.skipped.length} 个。`);\r\n for (const r of result.restored) console.log(` 恢复: ${r}`);\r\n for (const b of result.backedUp) console.log(` 备份: ${b}.bak-migrate-*`);\r\n if (result.skipped.length > 0) console.log(` 跳过: ${result.skipped.join(', ')}`);\r\n console.log('重启 DSH 后生效。');\r\n return 0;\r\n }\r\n console.error(`unknown migrate subcommand: ${sub}`);\r\n return 1;\r\n }\r\n\r\n case 'sessions': {\r\n // Read-only enumeration of the host's persisted sessions (ids from the\r\n // on-disk store; titles live server-side and are not listed here).\r\n const root = path.join(os.homedir(), '.dsh', 'sessions');\r\n let found = 0;\r\n if (fs.existsSync(root)) {\r\n let own: string | null = null;\r\n try {\r\n own = (JSON.parse(loadEncryptedText(guard, path.join(paths.dataDir, 'gate.json')) ?? '{}') as { sessionId?: string }).sessionId ?? null;\r\n } catch { /* gate.json absent or unreadable */ }\r\n for (const slug of fs.readdirSync(root)) {\r\n for (const id of fs.readdirSync(path.join(root, slug))) {\r\n found += 1;\r\n const mark = id === own ? ' ← 心跳正身' : '';\r\n console.log(`${id} [${slug}]${mark}`);\r\n }\r\n }\r\n }\r\n if (found === 0) console.log('(no persisted sessions found)');\r\n return 0;\r\n }\r\n\r\n case 'bind': {\r\n const { loadBindings, addBinding, removeBinding, bindingsFilePath } = await import('../core/bindings.js');\r\n switch (sub) {\r\n case 'list': {\r\n const data = loadBindings(guard, paths.settingsDir);\r\n let own: string | null = null;\r\n try {\r\n own = (JSON.parse(loadEncryptedText(guard, path.join(paths.dataDir, 'gate.json')) ?? '{}') as { sessionId?: string }).sessionId ?? null;\r\n } catch { /* absent */ }\r\n if (own) console.log(`心跳正身: ${own}(决策轮次发生地;bind remove 它 = 重置正身)`);\r\n for (const b of data.bindings) {\r\n console.log(`${b.sessionId} deliver:${b.deliver ? '√' : '×'} observe:${b.observe ? '√' : '×'}`);\r\n }\r\n if (data.bindings.length === 0 && !own) console.log('(no bindings — expressions stay in the dedicated heartbeat session)');\r\n return 0;\r\n }\r\n case 'add': {\r\n const id = rest[0];\r\n if (!id || !id.startsWith('session-')) {\r\n console.error('usage: bind add <sessionId> [--observe] [--no-deliver] (see: sessions list)');\r\n return 1;\r\n }\r\n const observe = rest.includes('--observe') || rest.includes('--observe-only');\r\n const deliver = !rest.includes('--no-deliver') && !rest.includes('--observe-only');\r\n const b = addBinding(guard, paths.settingsDir, id, { deliver, observe });\r\n console.log(`BOUND ${b.sessionId} deliver:${b.deliver} observe:${b.observe}`);\r\n return 0;\r\n }\r\n case 'remove': {\r\n const id = rest[0];\r\n if (!id) {\r\n console.error('usage: bind remove <sessionId>');\r\n return 1;\r\n }\r\n console.log(removeBinding(guard, paths.settingsDir, id) ? `UNBOUND ${id}` : 'NOT_FOUND');\r\n // Unbinding the HOME session resets it: the next beat creates a\r\n // fresh dedicated session (the old one goes quiet after restart).\r\n try {\r\n const state = JSON.parse(loadEncryptedText(guard, path.join(paths.dataDir, 'gate.json')) ?? '{}') as { sessionId?: string };\r\n if (state.sessionId === id) {\r\n fs.rmSync(guard.assert(path.join(paths.dataDir, 'gate.json')), { force: true });\r\n console.log('注意:这是心跳正身会话。已重置——下次心跳将创建新的正身会话(旧会话不再有心跳)');\r\n appendAuditLine(paths.logsDir + '/heartbeat.jsonl', { event: 'home_reset', oldSessionId: id });\r\n }\r\n } catch { /* gate.json absent: nothing to reset */ }\r\n return 0;\r\n }\r\n default:\r\n console.error('usage: bind list | add <sessionId> | remove <sessionId>');\r\n return 1;\r\n }\r\n }\r\n\r\n case 'preset': {\r\n const id = flag(argv, '--id') ?? BUNDLED_PRESET_ID;\r\n // The plugin installs into the roster's own user root; the CLI has no\r\n // roster, so it reports/uses the conventional one ($DSH_HOME or ~/.dsh).\r\n const root = conventionalUserPresetRoot();\r\n const status = presetStatus(import.meta.url, id, root);\r\n if (sub === undefined || sub === 'status') {\r\n console.log(`preset id : ${status.id}`);\r\n console.log(`installed : ${status.installed ? 'yes' : 'no'}`);\r\n console.log(`target dir : ${status.dir}`);\r\n console.log(`bundled at : ${status.bundledDir ?? '(not found next to the plugin)'}`);\r\n if (status.installed) {\r\n console.log(\r\n `composition : ${status.compositionMatches ? 'matches the bundled template' : 'differs from the bundled template (hand-edited, or an older version)'}`,\r\n );\r\n }\r\n if (!status.installed) {\r\n console.log('hint: the plugin installs this itself on the next DSH start (installPreset=true, default);');\r\n console.log(' or run `preset install` now.');\r\n }\r\n return status.installed ? 0 : 1;\r\n }\r\n if (sub === 'install') {\r\n const result = installBundledPreset({\r\n moduleUrl: import.meta.url,\r\n id,\r\n root,\r\n force: rest.includes('--force'),\r\n });\r\n console.log(describeInstall(result));\r\n return result.action === 'error' ? 1 : 0;\r\n }\r\n console.error('usage: preset status | install [--force] [--id <presetId>]');\r\n return 1;\r\n }\r\n\r\n default:\r\n console.error(`unknown command: ${cmd}`);\r\n console.log(usage());\r\n return 1;\r\n }\r\n}\r\n\r\nif (process.argv[1] && import.meta.url === new URL(`file:///${process.argv[1].replace(/\\\\/g, '/')}`).href) {\r\n // Direct execution guard; the CLI is also importable for tests.\r\n void main(process.argv.slice(2)).then((code) => { process.exitCode = code; });\r\n}\r\n","// Burn list - SINGLE SOURCE OF TRUTH (design doc §10.10; v1 shipped two\n// hardcoded lists and one drifted). burn and uninstall --purge both consume\n// this list. Settings (data/settings/) are NOT burned by default: losing\n// memory != losing the charter/gates the user configured (--all overrides).\n\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport type { PathGuard } from '../core/path-guard.js';\nimport type { WorkspacePaths } from '../core/paths.js';\nimport { shredFileSync } from '../core/atomic-fs.js';\nimport { appendAuditLine } from '../core/audit-log.js';\n\nexport interface BurnTarget {\n /** Relative to dataDir. Files are shredded (overwrite x3) then deleted. */\n file?: string;\n /** Directories are removed recursively (no shred - content is files). */\n dir?: string;\n note: string;\n}\n\nexport const BURN_LIST: BurnTarget[] = [\n { file: 'profile.json', note: '画像物化视图' },\n { file: 'profile_inbox.jsonl', note: '观察收件箱' },\n { file: 'profile_journal.jsonl', note: '画像操作流水' },\n { file: 'profile_rhythm.json', note: '作息聚合(纯统计)' },\n { file: 'screen.json', note: '屏幕快照(加密)' },\n { file: 'screen.jpg', note: '截图(加密)' },\n { file: 'sent.json', note: '表达记录(加密)' },\n { file: 'browse.json', note: '浏览流状态(加密)' },\n { file: 'seeds.jsonl', note: '素材池(加密)' },\n { file: 'ledger.md', note: '账本(明文,人可读是设计目标)' },\n { file: 'envpulse.json', note: '环境温度计快照' },\n { file: 'gate.json', note: '闸门运行时计数' },\n { dir: 'tmp', note: '解锁临时文件(崩溃残留的解密明文是最该烧的东西)' },\n { dir: 'logs', note: '审计与决策日志' },\n { dir: 'exports', note: '导出产物' },\n];\n\nconst SETTINGS_DIR = 'settings'; // excluded unless --all\n\nexport interface BurnPlanItem {\n target: BurnTarget;\n exists: boolean;\n}\n\n/** Preview: what exists, what would be removed. No writes. */\nexport function planBurn(guard: PathGuard, paths: WorkspacePaths, all = false): BurnPlanItem[] {\n const plan: BurnPlanItem[] = [];\n for (const t of BURN_LIST) {\n const rel = t.file ?? t.dir!;\n if (!all && rel === SETTINGS_DIR) continue;\n const abs = path.join(paths.dataDir, rel);\n let exists = false;\n try {\n exists = fs.existsSync(guard.assert(abs));\n } catch {\n exists = false;\n }\n plan.push({ target: t, exists });\n }\n if (all) {\n plan.push({ target: { dir: SETTINGS_DIR, note: '用户设定(隐私宪章/闸门参数)——仅 --all 连带' }, exists: fs.existsSync(paths.settingsDir) });\n }\n return plan;\n}\n\n/**\n * Execute the burn: overwrite x3 + delete files, remove dirs. Irreversible.\n * Returns per-target results and writes a BURN_EVENT into the (recreated)\n * journal afterwards - the only trace, on purpose (transparency).\n */\nexport function executeBurn(\n guard: PathGuard,\n paths: WorkspacePaths,\n opts: { all?: boolean; shredPasses?: number } = {},\n): { burned: string[]; missing: string[] } {\n const burned: string[] = [];\n const missing: string[] = [];\n const passes = opts.shredPasses ?? 3;\n for (const t of BURN_LIST) {\n const rel = t.file ?? t.dir!;\n const abs = path.join(paths.dataDir, rel);\n let absCanon: string;\n try {\n absCanon = guard.assert(abs);\n } catch {\n missing.push(rel);\n continue;\n }\n if (t.file) {\n if (fs.existsSync(absCanon)) {\n shredFileSync(absCanon, passes);\n burned.push(rel);\n } else {\n missing.push(rel);\n }\n } else if (fs.existsSync(absCanon)) {\n fs.rmSync(absCanon, { recursive: true, force: true });\n burned.push(rel);\n } else {\n missing.push(rel);\n }\n }\n if (opts.all) {\n fs.rmSync(paths.settingsDir, { recursive: true, force: true });\n burned.push(SETTINGS_DIR);\n }\n // BURN_EVENT: recreate the journal; data dir is now re-initializable.\n appendAuditLine(guard.assert(path.join(paths.dataDir, 'profile_journal.jsonl')), {\n event: 'BURN_EVENT',\n burned: burned.length,\n missing: missing.length,\n settingsPreserved: !opts.all,\n });\n return { burned, missing };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,aAAa;AACtB,OAAOA,SAAQ;AACf,OAAO,QAAQ;AACf,OAAOC,WAAU;;;ACDjB,OAAO,QAAQ;AACf,OAAO,UAAU;AAcV,IAAM,YAA0B;AAAA,EACrC,EAAE,MAAM,gBAAgB,MAAM,uCAAS;AAAA,EACvC,EAAE,MAAM,uBAAuB,MAAM,iCAAQ;AAAA,EAC7C,EAAE,MAAM,yBAAyB,MAAM,uCAAS;AAAA,EAChD,EAAE,MAAM,uBAAuB,MAAM,yDAAY;AAAA,EACjD,EAAE,MAAM,eAAe,MAAM,mDAAW;AAAA,EACxC,EAAE,MAAM,cAAc,MAAM,uCAAS;AAAA,EACrC,EAAE,MAAM,aAAa,M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A,MACzC;AACA,cAAQ,MAAM,4DAA4D;AAC1E,aAAO;AAAA,IACT;AAAA,IAEA;AACE,cAAQ,MAAM,oBAAoB,GAAG,EAAE;AACvC,cAAQ,IAAI,MAAM,CAAC;AACnB,aAAO;AAAA,EACX;AACF;AAEA,IAAI,QAAQ,KAAK,CAAC,KAAK,YAAY,QAAQ,IAAI,IAAI,WAAW,QAAQ,KAAK,CAAC,EAAE,QAAQ,OAAO,GAAG,CAAC,EAAE,EAAE,MAAM;AAEzG,OAAK,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS;AAAE,YAAQ,WAAW;AAAA,EAAM,CAAC;AAC9E;","names":["fs","path","fs","path"]}
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
inboxFileExists,
|
|
8
8
|
inboxFilePath,
|
|
9
9
|
inboxHealthCheck
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-63FUJLIF.js";
|
|
11
|
+
import "./chunk-IFTFDHZX.js";
|
|
12
12
|
export {
|
|
13
13
|
dedupeItems,
|
|
14
14
|
inboxAppend,
|
|
@@ -19,4 +19,4 @@ export {
|
|
|
19
19
|
inboxFilePath,
|
|
20
20
|
inboxHealthCheck
|
|
21
21
|
};
|
|
22
|
-
//# sourceMappingURL=inbox-
|
|
22
|
+
//# sourceMappingURL=inbox-57NHQHY3.js.map
|