@kanadego/dsh-heartbeat 1.9.1 → 1.9.2

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.
Files changed (36) hide show
  1. package/README.md +27 -5
  2. package/cordis.patch.yml +18 -39
  3. package/dist/{chunk-BQCXYE7N.js → chunk-3MDBU6WY.js} +2 -2
  4. package/dist/{chunk-HT57FOEF.js → chunk-AJ5HLAL7.js} +34 -11
  5. package/dist/chunk-AJ5HLAL7.js.map +1 -0
  6. package/dist/{chunk-OYVNWB5G.js → chunk-CUOSICYJ.js} +2 -2
  7. package/dist/{chunk-WRJCINZ7.js → chunk-IG6YMUHW.js} +4 -4
  8. package/dist/{chunk-KOOQOMQY.js → chunk-JDH2LDFS.js} +2 -2
  9. package/dist/chunk-K5Y6JP2B.js +399 -0
  10. package/dist/chunk-K5Y6JP2B.js.map +1 -0
  11. package/dist/{chunk-QOQ7EPZZ.js → chunk-KB5SMG3F.js} +3 -3
  12. package/dist/{chunk-2NB4QILF.js → chunk-XFNCTOW7.js} +2 -2
  13. package/dist/cli/index.js +9 -9
  14. package/dist/{inbox-JLT5G7TL.js → inbox-P26DDMWC.js} +3 -3
  15. package/dist/index.d.ts +33 -0
  16. package/dist/index.js +104 -20
  17. package/dist/index.js.map +1 -1
  18. package/dist/{migrate-WDVFHUP7.js → migrate-D4VKAKYT.js} +3 -3
  19. package/dist/{orchestrator-2ZLU7RGE.js → orchestrator-EUTZ3KG6.js} +10 -8
  20. package/dist/{pool-B34NTH6D.js → pool-UTXQJJ5C.js} +3 -3
  21. package/dist/{snapshot-JQDJ346Z.js → snapshot-K5VHETTK.js} +4 -4
  22. package/package.json +83 -83
  23. package/dist/chunk-7TW6DD6Q.js +0 -208
  24. package/dist/chunk-7TW6DD6Q.js.map +0 -1
  25. package/dist/chunk-HT57FOEF.js.map +0 -1
  26. /package/dist/{chunk-BQCXYE7N.js.map → chunk-3MDBU6WY.js.map} +0 -0
  27. /package/dist/{chunk-OYVNWB5G.js.map → chunk-CUOSICYJ.js.map} +0 -0
  28. /package/dist/{chunk-WRJCINZ7.js.map → chunk-IG6YMUHW.js.map} +0 -0
  29. /package/dist/{chunk-KOOQOMQY.js.map → chunk-JDH2LDFS.js.map} +0 -0
  30. /package/dist/{chunk-QOQ7EPZZ.js.map → chunk-KB5SMG3F.js.map} +0 -0
  31. /package/dist/{chunk-2NB4QILF.js.map → chunk-XFNCTOW7.js.map} +0 -0
  32. /package/dist/{inbox-JLT5G7TL.js.map → inbox-P26DDMWC.js.map} +0 -0
  33. /package/dist/{migrate-WDVFHUP7.js.map → migrate-D4VKAKYT.js.map} +0 -0
  34. /package/dist/{orchestrator-2ZLU7RGE.js.map → orchestrator-EUTZ3KG6.js.map} +0 -0
  35. /package/dist/{pool-B34NTH6D.js.map → pool-UTXQJJ5C.js.map} +0 -0
  36. /package/dist/{snapshot-JQDJ346Z.js.map → snapshot-K5VHETTK.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  readText,
4
4
  saveJson,
5
5
  writeText
6
- } from "./chunk-7TW6DD6Q.js";
6
+ } from "./chunk-K5Y6JP2B.js";
7
7
  import {
8
8
  atomicWriteFileSync
9
9
  } from "./chunk-WRUTATW4.js";
@@ -477,4 +477,4 @@ export {
477
477
  verifyProfile,
478
478
  rebuildProfile
479
479
  };
480
- //# sourceMappingURL=chunk-OYVNWB5G.js.map
480
+ //# sourceMappingURL=chunk-CUOSICYJ.js.map
@@ -3,10 +3,10 @@ import {
3
3
  loadPool,
4
4
  normalizeCategory,
5
5
  seedsFilePath
6
- } from "./chunk-KOOQOMQY.js";
6
+ } from "./chunk-JDH2LDFS.js";
7
7
  import {
8
8
  appendAuditLine
9
- } from "./chunk-OYVNWB5G.js";
9
+ } from "./chunk-CUOSICYJ.js";
10
10
  import {
11
11
  loadEncryptedText,
12
12
  loadJson,
@@ -15,7 +15,7 @@ import {
15
15
  saveJson,
16
16
  workspace,
17
17
  writeText
18
- } from "./chunk-7TW6DD6Q.js";
18
+ } from "./chunk-K5Y6JP2B.js";
19
19
  import {
20
20
  atomicWriteJsonSync
21
21
  } from "./chunk-WRUTATW4.js";
@@ -566,4 +566,4 @@ export {
566
566
  buildWeeklyPrompt,
567
567
  renderTemplateReport
568
568
  };
569
- //# sourceMappingURL=chunk-WRJCINZ7.js.map
569
+ //# sourceMappingURL=chunk-IG6YMUHW.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  loadEncryptedText,
6
6
  saveEncryptedText
7
- } from "./chunk-7TW6DD6Q.js";
7
+ } from "./chunk-K5Y6JP2B.js";
8
8
 
9
9
  // src/seeds/pool.ts
10
10
  import path from "path";
@@ -314,4 +314,4 @@ export {
314
314
  restoreSeed,
315
315
  deleteSeed
316
316
  };
317
- //# sourceMappingURL=chunk-KOOQOMQY.js.map
317
+ //# sourceMappingURL=chunk-JDH2LDFS.js.map
@@ -0,0 +1,399 @@
1
+ import {
2
+ burnFileSync
3
+ } from "./chunk-WRUTATW4.js";
4
+
5
+ // src/core/paths.ts
6
+ import fs2 from "fs";
7
+ import os from "os";
8
+ import path2 from "path";
9
+ import { fileURLToPath } from "url";
10
+
11
+ // src/core/data-relocate.ts
12
+ import fs from "fs";
13
+ import path from "path";
14
+ import { createHash } from "crypto";
15
+ var SKELETON_DIRS = ["settings", "logs", "tmp", "exports"];
16
+ var SCRATCH_DIR = "tmp";
17
+ var MAGIC = Buffer.from("KHBV1", "ascii");
18
+ function hasPayload(dir) {
19
+ if (!fs.existsSync(dir)) return false;
20
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
21
+ if (!entry.isDirectory()) return true;
22
+ if (!SKELETON_DIRS.includes(entry.name)) return true;
23
+ if (entry.name === SCRATCH_DIR) continue;
24
+ if (fs.readdirSync(path.join(dir, entry.name)).length > 0) return true;
25
+ }
26
+ return false;
27
+ }
28
+ function walk(dir, prefix = "", out = []) {
29
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
30
+ const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
31
+ if (entry.isDirectory()) {
32
+ if (!prefix && entry.name === SCRATCH_DIR) continue;
33
+ walk(path.join(dir, entry.name), rel, out);
34
+ } else if (entry.isFile()) {
35
+ out.push(rel);
36
+ }
37
+ }
38
+ return out.sort();
39
+ }
40
+ function copyTree(src, dst) {
41
+ const scratch = path.resolve(path.join(src, SCRATCH_DIR));
42
+ fs.cpSync(src, dst, {
43
+ recursive: true,
44
+ force: true,
45
+ preserveTimestamps: true,
46
+ filter: (from) => path.resolve(from) !== scratch
47
+ });
48
+ }
49
+ function removeTree(dir) {
50
+ fs.rmSync(dir, { recursive: true, force: true });
51
+ }
52
+ function sha256(file) {
53
+ return createHash("sha256").update(fs.readFileSync(file)).digest("hex");
54
+ }
55
+ function isEncryptedFile(file) {
56
+ const fd = fs.openSync(file, "r");
57
+ try {
58
+ const head = Buffer.alloc(MAGIC.length);
59
+ const read = fs.readSync(fd, head, 0, MAGIC.length, 0);
60
+ return read === MAGIC.length && head.equals(MAGIC);
61
+ } finally {
62
+ fs.closeSync(fd);
63
+ }
64
+ }
65
+ function parsesAsJson(file) {
66
+ if (isEncryptedFile(file)) return true;
67
+ const text = fs.readFileSync(file, "utf8");
68
+ try {
69
+ if (file.endsWith(".jsonl")) {
70
+ for (const line of text.split("\n")) if (line.trim()) JSON.parse(line);
71
+ return true;
72
+ }
73
+ JSON.parse(text);
74
+ return true;
75
+ } catch {
76
+ return false;
77
+ }
78
+ }
79
+ function verifyTrees(srcDir, dstDir) {
80
+ const problems = [];
81
+ const warnings = [];
82
+ let files = 0;
83
+ let bytes = 0;
84
+ if (!fs.existsSync(dstDir)) {
85
+ return { ok: false, files: 0, bytes: 0, problems: [`copy missing: ${dstDir}`], warnings };
86
+ }
87
+ const expected = walk(srcDir);
88
+ const actual = walk(dstDir);
89
+ const actualSet = new Set(actual);
90
+ const expectedSet = new Set(expected);
91
+ for (const rel of expected) if (!actualSet.has(rel)) problems.push(`missing: ${rel}`);
92
+ for (const rel of actual) if (!expectedSet.has(rel)) problems.push(`unexpected: ${rel}`);
93
+ for (const rel of expected) {
94
+ const from = path.join(srcDir, rel);
95
+ const to = path.join(dstDir, rel);
96
+ if (!fs.existsSync(to)) continue;
97
+ const sizeFrom = fs.statSync(from).size;
98
+ const sizeTo = fs.statSync(to).size;
99
+ files += 1;
100
+ bytes += sizeFrom;
101
+ if (sizeFrom !== sizeTo) {
102
+ problems.push(`size differs: ${rel} (${sizeFrom} -> ${sizeTo})`);
103
+ continue;
104
+ }
105
+ if (sha256(from) !== sha256(to)) {
106
+ problems.push(`content differs: ${rel}`);
107
+ continue;
108
+ }
109
+ if (/\.(json|jsonl)$/i.test(rel) && !parsesAsJson(to)) warnings.push(`unparseable: ${rel}`);
110
+ }
111
+ return { ok: problems.length === 0, files, bytes, problems, warnings };
112
+ }
113
+ function stamp(now) {
114
+ const d = new Date(now);
115
+ const pad = (n) => String(n).padStart(2, "0");
116
+ return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
117
+ }
118
+ function errorText(error) {
119
+ return error instanceof Error ? error.message : String(error);
120
+ }
121
+ function relocateDataDir(opts) {
122
+ const srcDir = path.resolve(opts.srcDir);
123
+ const dstDir = path.resolve(opts.dstDir);
124
+ if (!fs.existsSync(srcDir)) return { action: "skipped", reason: "source-missing" };
125
+ if (!hasPayload(srcDir)) return { action: "skipped", reason: "no-payload" };
126
+ if (hasPayload(dstDir)) return { action: "skipped", reason: "destination-exists" };
127
+ const suffix = stamp(opts.now ?? Date.now());
128
+ const backupDir = `${srcDir}.bak-relocate-${suffix}`;
129
+ const stagingDir = `${dstDir}.staging-${suffix}`;
130
+ try {
131
+ copyTree(srcDir, backupDir);
132
+ } catch (error) {
133
+ return { action: "failed", stage: "backup", problems: [errorText(error)], backupDir: null };
134
+ }
135
+ try {
136
+ copyTree(srcDir, stagingDir);
137
+ } catch (error) {
138
+ return { action: "failed", stage: "copy", problems: [errorText(error)], backupDir };
139
+ }
140
+ const verified = verifyTrees(srcDir, stagingDir);
141
+ if (!verified.ok) {
142
+ try {
143
+ removeTree(stagingDir);
144
+ } catch {
145
+ }
146
+ return { action: "failed", stage: "verify", problems: verified.problems, backupDir };
147
+ }
148
+ try {
149
+ if (fs.existsSync(dstDir)) removeTree(dstDir);
150
+ fs.renameSync(stagingDir, dstDir);
151
+ } catch (error) {
152
+ try {
153
+ removeTree(stagingDir);
154
+ } catch {
155
+ }
156
+ return { action: "failed", stage: "commit", problems: [errorText(error)], backupDir };
157
+ }
158
+ const leftovers = [];
159
+ try {
160
+ removeTree(srcDir);
161
+ } catch {
162
+ leftovers.push(srcDir);
163
+ }
164
+ try {
165
+ removeTree(backupDir);
166
+ } catch {
167
+ leftovers.push(backupDir);
168
+ }
169
+ return {
170
+ action: "relocated",
171
+ srcDir,
172
+ dstDir,
173
+ backupDir,
174
+ files: verified.files,
175
+ bytes: verified.bytes,
176
+ warnings: verified.warnings,
177
+ leftovers
178
+ };
179
+ }
180
+
181
+ // src/core/paths.ts
182
+ var resolved = null;
183
+ function findPackageRoot(startFile) {
184
+ let dir = path2.dirname(path2.resolve(startFile));
185
+ for (; ; ) {
186
+ if (fs2.existsSync(path2.join(dir, "package.json"))) return dir;
187
+ const parent = path2.dirname(dir);
188
+ if (parent === dir) throw new Error("package.json not found above " + startFile);
189
+ dir = parent;
190
+ }
191
+ }
192
+ function packageRoot() {
193
+ return findPackageRoot(fileURLToPath(import.meta.url));
194
+ }
195
+ function defaultDataDir(env = process.env, home = os.homedir()) {
196
+ const override = env.DSH_HOME?.trim();
197
+ const root = override && override.length > 0 ? override : path2.join(home, ".dsh");
198
+ return path2.join(root, "heartbeat-data");
199
+ }
200
+ function initWorkspace(config = {}) {
201
+ if (resolved) return resolved;
202
+ const root = packageRoot();
203
+ const explicit = process.env.HEARTBEAT_DATA_DIR || config.dataDir;
204
+ const homeDir = path2.resolve(defaultDataDir());
205
+ const legacyDir = path2.join(root, "data");
206
+ let dataDir;
207
+ let relocation;
208
+ if (explicit) {
209
+ dataDir = path2.resolve(explicit);
210
+ } else if (hasPayload(homeDir)) {
211
+ dataDir = homeDir;
212
+ } else if (hasPayload(legacyDir)) {
213
+ relocation = relocateDataDir({ srcDir: legacyDir, dstDir: homeDir });
214
+ dataDir = relocation.action === "relocated" ? homeDir : legacyDir;
215
+ } else {
216
+ dataDir = homeDir;
217
+ }
218
+ const paths = {
219
+ dataDir,
220
+ settingsDir: path2.join(dataDir, "settings"),
221
+ logsDir: path2.join(dataDir, "logs"),
222
+ tmpDir: path2.join(dataDir, "tmp"),
223
+ exportsDir: path2.join(dataDir, "exports"),
224
+ packageRoot: root,
225
+ configDir: path2.join(root, "config"),
226
+ assetsDir: path2.join(root, "assets"),
227
+ ...relocation ? { relocation } : {}
228
+ };
229
+ for (const dir of [
230
+ paths.dataDir,
231
+ paths.settingsDir,
232
+ paths.logsDir,
233
+ paths.tmpDir,
234
+ paths.exportsDir
235
+ ]) {
236
+ fs2.mkdirSync(dir, { recursive: true });
237
+ }
238
+ resolved = paths;
239
+ return paths;
240
+ }
241
+ function workspace() {
242
+ if (!resolved) throw new Error("workspace not initialized: call initWorkspace() first");
243
+ return resolved;
244
+ }
245
+
246
+ // src/vault/vault.ts
247
+ import fs3 from "fs";
248
+ import path3 from "path";
249
+ import { spawnSync } from "child_process";
250
+ import { randomUUID } from "crypto";
251
+ var MAGIC2 = Buffer.from("KHBV1", "ascii");
252
+ var VAULT_TIMEOUT_MS = 3e4;
253
+ var cachedScriptPath = null;
254
+ function vaultScriptPath() {
255
+ if (cachedScriptPath) return cachedScriptPath;
256
+ const script = path3.join(workspace().assetsDir, "vault.ps1");
257
+ if (!fs3.existsSync(script)) throw new Error(`vault script missing: ${script}`);
258
+ cachedScriptPath = script;
259
+ return script;
260
+ }
261
+ function tmpPlainName(target) {
262
+ return path3.join(workspace().tmpDir, `.${path3.basename(target)}.${randomUUID().slice(0, 8)}.plain`);
263
+ }
264
+ function tmpEncName(target) {
265
+ return path3.join(workspace().tmpDir, `.${path3.basename(target)}.${randomUUID().slice(0, 8)}.enc`);
266
+ }
267
+ function runVault(guard, args) {
268
+ const r = spawnSync(
269
+ "powershell.exe",
270
+ ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", vaultScriptPath(), ...args],
271
+ { timeout: VAULT_TIMEOUT_MS, encoding: "utf8" }
272
+ );
273
+ if (r.error) throw new Error(`vault spawn failed: ${String(r.error)}`);
274
+ if (r.status !== 0) {
275
+ const detail = (r.stderr || r.stdout || "").trim().split("\n").slice(-3).join("; ");
276
+ throw new Error(`vault ${args[0]} failed (exit ${r.status}): ${detail}`);
277
+ }
278
+ }
279
+ function isEncrypted(file) {
280
+ if (!fs3.existsSync(file)) return false;
281
+ const fd = fs3.openSync(file, "r");
282
+ try {
283
+ const hdr = Buffer.alloc(MAGIC2.length);
284
+ const read = fs3.readSync(fd, hdr, 0, hdr.length, 0);
285
+ return read === MAGIC2.length && hdr.equals(MAGIC2);
286
+ } finally {
287
+ fs3.closeSync(fd);
288
+ }
289
+ }
290
+ function loadJson(guard, file) {
291
+ const f = guard.assert(file);
292
+ if (!fs3.existsSync(f)) return null;
293
+ if (!isEncrypted(f)) {
294
+ try {
295
+ return JSON.parse(fs3.readFileSync(f, "utf8"));
296
+ } catch {
297
+ return null;
298
+ }
299
+ }
300
+ const tmp = tmpPlainName(f);
301
+ try {
302
+ runVault(guard, ["unprotect", "-InFile", f, "-OutFile", tmp]);
303
+ return JSON.parse(fs3.readFileSync(tmp, "utf8"));
304
+ } finally {
305
+ burnFileSync(tmp);
306
+ }
307
+ }
308
+ function saveJson(guard, file, value) {
309
+ const f = guard.assert(file);
310
+ fs3.mkdirSync(path3.dirname(f), { recursive: true });
311
+ const plain = tmpPlainName(f);
312
+ const enc = tmpEncName(f);
313
+ try {
314
+ fs3.writeFileSync(plain, JSON.stringify(value, null, 2), "utf8");
315
+ runVault(guard, ["protect", "-InFile", plain, "-OutFile", enc]);
316
+ fs3.renameSync(enc, f);
317
+ } finally {
318
+ burnFileSync(plain);
319
+ fs3.rmSync(enc, { force: true });
320
+ }
321
+ }
322
+ function readText(guard, file, fallback = "") {
323
+ const f = guard.assert(file);
324
+ try {
325
+ return fs3.readFileSync(f, "utf8");
326
+ } catch {
327
+ return fallback;
328
+ }
329
+ }
330
+ function writeText(guard, file, content) {
331
+ const f = guard.assert(file);
332
+ fs3.mkdirSync(path3.dirname(f), { recursive: true });
333
+ const tmp = tmpPlainName(f);
334
+ try {
335
+ fs3.writeFileSync(tmp, content, "utf8");
336
+ fs3.renameSync(tmp, f);
337
+ } finally {
338
+ burnFileSync(tmp);
339
+ }
340
+ }
341
+ function loadEncryptedText(guard, file) {
342
+ const f = guard.assert(file);
343
+ if (!fs3.existsSync(f)) return null;
344
+ if (!isEncrypted(f)) return fs3.readFileSync(f, "utf8");
345
+ const tmp = tmpPlainName(f);
346
+ try {
347
+ runVault(guard, ["unprotect", "-InFile", f, "-OutFile", tmp]);
348
+ return fs3.readFileSync(tmp, "utf8");
349
+ } finally {
350
+ burnFileSync(tmp);
351
+ }
352
+ }
353
+ function saveEncryptedText(guard, file, content) {
354
+ const f = guard.assert(file);
355
+ fs3.mkdirSync(path3.dirname(f), { recursive: true });
356
+ const plain = tmpPlainName(f);
357
+ const enc = tmpEncName(f);
358
+ try {
359
+ fs3.writeFileSync(plain, content, "utf8");
360
+ runVault(guard, ["protect", "-InFile", plain, "-OutFile", enc]);
361
+ fs3.renameSync(enc, f);
362
+ } finally {
363
+ burnFileSync(plain);
364
+ fs3.rmSync(enc, { force: true });
365
+ }
366
+ }
367
+ function encryptFile(guard, inFile, outFile) {
368
+ const inPath = guard.assert(inFile);
369
+ const outPath = guard.assert(outFile);
370
+ fs3.mkdirSync(path3.dirname(outPath), { recursive: true });
371
+ const enc = tmpEncName(outPath);
372
+ try {
373
+ runVault(guard, ["protect", "-InFile", inPath, "-OutFile", enc]);
374
+ fs3.renameSync(enc, outPath);
375
+ } finally {
376
+ fs3.rmSync(enc, { force: true });
377
+ }
378
+ }
379
+ function decryptFile(guard, inFile, outFile) {
380
+ const inPath = guard.assert(inFile);
381
+ const outPath = guard.assert(outFile);
382
+ fs3.mkdirSync(path3.dirname(outPath), { recursive: true });
383
+ runVault(guard, ["unprotect", "-InFile", inPath, "-OutFile", outPath]);
384
+ }
385
+
386
+ export {
387
+ initWorkspace,
388
+ workspace,
389
+ isEncrypted,
390
+ loadJson,
391
+ saveJson,
392
+ readText,
393
+ writeText,
394
+ loadEncryptedText,
395
+ saveEncryptedText,
396
+ encryptFile,
397
+ decryptFile
398
+ };
399
+ //# sourceMappingURL=chunk-K5Y6JP2B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/paths.ts","../src/core/data-relocate.ts","../src/vault/vault.ts"],"sourcesContent":["// Workspace/data directory resolution and package asset location.\n//\n// The data dir is the ONLY directory the plugin writes to at runtime\n// (requirement 8). Resolution order: env override > plugin config > default\n// (`$DSH_HOME/heartbeat-data`) — with a legacy fallback to `packageRoot()/data`\n// for installs that predate v1.9.2, which is relocated out of the package on\n// first sight (issue #2: a reinstall replaced the package dir and took the\n// user's data with it). All fs writes must go through the path guard created\n// from this dir (see core/path-guard.ts).\n\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { hasPayload, relocateDataDir, type RelocateResult } from './data-relocate.js';\n\nexport interface WorkspacePaths {\n /** Guard boundary and the only writable tree at runtime. */\n dataDir: string;\n settingsDir: string;\n logsDir: string;\n tmpDir: string;\n exportsDir: string;\n /** Package root (where package.json lives). Read-only at runtime. */\n packageRoot: string;\n configDir: string;\n assetsDir: string;\n /**\n * Set only when a legacy package-local data dir was found: the outcome of\n * the one-time relocation. Absent for explicit dirs and fresh installs.\n */\n relocation?: RelocateResult;\n}\n\nexport interface WorkspaceConfigInput {\n dataDir?: string | null;\n}\n\nlet resolved: WorkspacePaths | null = null;\n\n/** Walk up from a module file to the directory containing package.json. */\nexport function findPackageRoot(startFile: string): string {\n let dir = path.dirname(path.resolve(startFile));\n for (;;) {\n if (fs.existsSync(path.join(dir, 'package.json'))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) throw new Error('package.json not found above ' + startFile);\n dir = parent;\n }\n}\n\nexport function packageRoot(): string {\n return findPackageRoot(fileURLToPath(import.meta.url));\n}\n\n/**\n * Default data dir: `$DSH_HOME/heartbeat-data` (or `~/.dsh/heartbeat-data`).\n * Deliberately outside the package tree — reinstalling or upgrading the plugin\n * replaces that directory and must not touch user data (issue #2).\n */\nexport function defaultDataDir(\n env: NodeJS.ProcessEnv = process.env,\n home: string = os.homedir(),\n): string {\n const override = env.DSH_HOME?.trim();\n const root = override && override.length > 0 ? override : path.join(home, '.dsh');\n return path.join(root, 'heartbeat-data');\n}\n\n/**\n * Resolve and create the workspace layout. Idempotent; must be called once\n * from the plugin entry before any fs write happens.\n */\nexport function initWorkspace(config: WorkspaceConfigInput = {}): WorkspacePaths {\n if (resolved) return resolved;\n const root = packageRoot();\n const explicit = process.env.HEARTBEAT_DATA_DIR || config.dataDir;\n const homeDir = path.resolve(defaultDataDir());\n const legacyDir = path.join(root, 'data');\n let dataDir: string;\n let relocation: RelocateResult | undefined;\n if (explicit) {\n // Explicit configuration always wins, and never moves anything.\n dataDir = path.resolve(explicit);\n } else if (hasPayload(homeDir)) {\n // Already on the new home (a previous run, or a reinstall that kept it).\n dataDir = homeDir;\n } else if (hasPayload(legacyDir)) {\n // Pre-v1.9.2 install: the data lived inside the package. Move it out, and\n // keep serving the legacy tree unless the move verified end to end.\n relocation = relocateDataDir({ srcDir: legacyDir, dstDir: homeDir });\n dataDir = relocation.action === 'relocated' ? homeDir : legacyDir;\n } else {\n dataDir = homeDir;\n }\n const paths: WorkspacePaths = {\n dataDir,\n settingsDir: path.join(dataDir, 'settings'),\n logsDir: path.join(dataDir, 'logs'),\n tmpDir: path.join(dataDir, 'tmp'),\n exportsDir: path.join(dataDir, 'exports'),\n packageRoot: root,\n configDir: path.join(root, 'config'),\n assetsDir: path.join(root, 'assets'),\n ...(relocation ? { relocation } : {}),\n };\n // Bootstrap creation happens before the guard exists; creating exactly one\n // directory tree at a known location is the safe window for this.\n for (const dir of [\n paths.dataDir,\n paths.settingsDir,\n paths.logsDir,\n paths.tmpDir,\n paths.exportsDir,\n ]) {\n fs.mkdirSync(dir, { recursive: true });\n }\n resolved = paths;\n return paths;\n}\n\n/** Access already-initialized paths. Throws if initWorkspace was not called. */\nexport function workspace(): WorkspacePaths {\n if (!resolved) throw new Error('workspace not initialized: call initWorkspace() first');\n return resolved;\n}\n\n/** Test-only: forget the resolved singleton so a later init re-resolves. */\nexport function resetWorkspaceForTest(): void {\n resolved = null;\n}\n","// One-time relocation of the data dir out of the package tree (issue #2).\n//\n// Installs created before v1.9.2 defaulted to `packageRoot()/data`, and every\n// `dsh plugin add` / upgrade replaces the package directory wholesale — so a\n// reinstall deleted the profile, the gate and the ledger, which the original\n// design meant to keep until an explicit CLI `burn`. The default now lives at\n// `$DSH_HOME/heartbeat-data`; this module moves an existing package-local tree\n// there.\n//\n// Safety order — a failure at any point leaves the original untouched:\n// 1. copy src -> backup (kept until the move is verified and committed)\n// 2. copy src -> dst.staging-<stamp>\n// 3. verify staging against src: same file list, same size + sha256, and\n// every plaintext .json/.jsonl still parses\n// 4. rename staging -> dst (same volume, atomic)\n// 5. only then delete src and the backup\n// The caller keeps using `src` unless the result is `relocated`.\n\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { createHash } from 'node:crypto';\n\n/** Directories the bootstrap always creates: their presence alone is no payload. */\nconst SKELETON_DIRS = ['settings', 'logs', 'tmp', 'exports'];\n/** Scratch space (decrypt windows, downloads): never copied, never verified. */\nconst SCRATCH_DIR = 'tmp';\nconst MAGIC = Buffer.from('KHBV1', 'ascii');\n\nexport interface RelocateOptions {\n srcDir: string;\n dstDir: string;\n /** Injectable clock, so tests get deterministic backup/staging names. */\n now?: number;\n}\n\nexport type RelocateResult =\n | {\n action: 'relocated';\n /** Package-local tree the data came from (now deleted). */\n srcDir: string;\n dstDir: string;\n backupDir: string;\n files: number;\n bytes: number;\n /** Plaintext JSON/JSONL that does not parse (verified byte-identical). */\n warnings: string[];\n /** Paths that could not be deleted after the move (cosmetic leftovers). */\n leftovers: string[];\n }\n | { action: 'skipped'; reason: 'source-missing' | 'no-payload' | 'destination-exists' }\n | {\n action: 'failed';\n stage: 'backup' | 'copy' | 'verify' | 'commit';\n problems: string[];\n /** Null when the backup itself could not be created. */\n backupDir: string | null;\n };\n\nexport interface VerifyResult {\n /** Byte-for-byte the same file list, sizes and contents. */\n ok: boolean;\n files: number;\n bytes: number;\n problems: string[];\n /**\n * Plaintext JSON/JSONL files that do not parse. They are reported but do not\n * fail the move: an identical copy of a file that was already damaged is\n * still byte-for-byte the user's data, and refusing to relocate would strand\n * the data dir in the package forever.\n */\n warnings: string[];\n}\n\n/**\n * True when a data dir holds real user data. An empty bootstrap skeleton\n * (`settings/ logs/ tmp/ exports/`, all empty) does not count — otherwise a\n * freshly created default dir would shadow a legacy tree with actual data.\n */\nexport function hasPayload(dir: string): boolean {\n if (!fs.existsSync(dir)) return false;\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n if (!entry.isDirectory()) return true;\n if (!SKELETON_DIRS.includes(entry.name)) return true;\n if (entry.name === SCRATCH_DIR) continue;\n if (fs.readdirSync(path.join(dir, entry.name)).length > 0) return true;\n }\n return false;\n}\n\n/** Every file under `dir` (relative, `/`-separated, sorted), excluding tmp/. */\nfunction walk(dir: string, prefix = '', out: string[] = []): string[] {\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const rel = prefix ? `${prefix}/${entry.name}` : entry.name;\n if (entry.isDirectory()) {\n if (!prefix && entry.name === SCRATCH_DIR) continue;\n walk(path.join(dir, entry.name), rel, out);\n } else if (entry.isFile()) {\n out.push(rel);\n }\n }\n return out.sort();\n}\n\nfunction copyTree(src: string, dst: string): void {\n const scratch = path.resolve(path.join(src, SCRATCH_DIR));\n fs.cpSync(src, dst, {\n recursive: true,\n force: true,\n preserveTimestamps: true,\n filter: (from) => path.resolve(from) !== scratch,\n });\n}\n\nfunction removeTree(dir: string): void {\n fs.rmSync(dir, { recursive: true, force: true });\n}\n\nfunction sha256(file: string): string {\n return createHash('sha256').update(fs.readFileSync(file)).digest('hex');\n}\n\n/** KHBV1 header check (local copy: importing vault here would cycle through paths). */\nfunction isEncryptedFile(file: string): boolean {\n const fd = fs.openSync(file, 'r');\n try {\n const head = Buffer.alloc(MAGIC.length);\n const read = fs.readSync(fd, head, 0, MAGIC.length, 0);\n return read === MAGIC.length && head.equals(MAGIC);\n } finally {\n fs.closeSync(fd);\n }\n}\n\n/**\n * Schema-free readability check: an encrypted container is opaque here (its\n * bytes were already compared by hash), a plaintext .json/.jsonl must still\n * parse — that is what catches a half-written or truncated copy.\n */\nfunction parsesAsJson(file: string): boolean {\n if (isEncryptedFile(file)) return true;\n const text = fs.readFileSync(file, 'utf8');\n try {\n if (file.endsWith('.jsonl')) {\n for (const line of text.split('\\n')) if (line.trim()) JSON.parse(line);\n return true;\n }\n JSON.parse(text);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Compare a copy against its source: identical file list, identical size and\n * content (the hard gate), plus a readability report on the plaintext\n * JSON/JSONL in the copy (warnings only — see VerifyResult).\n */\nexport function verifyTrees(srcDir: string, dstDir: string): VerifyResult {\n const problems: string[] = [];\n const warnings: string[] = [];\n let files = 0;\n let bytes = 0;\n if (!fs.existsSync(dstDir)) {\n return { ok: false, files: 0, bytes: 0, problems: [`copy missing: ${dstDir}`], warnings };\n }\n const expected = walk(srcDir);\n const actual = walk(dstDir);\n const actualSet = new Set(actual);\n const expectedSet = new Set(expected);\n for (const rel of expected) if (!actualSet.has(rel)) problems.push(`missing: ${rel}`);\n for (const rel of actual) if (!expectedSet.has(rel)) problems.push(`unexpected: ${rel}`);\n for (const rel of expected) {\n const from = path.join(srcDir, rel);\n const to = path.join(dstDir, rel);\n if (!fs.existsSync(to)) continue; // already reported above\n const sizeFrom = fs.statSync(from).size;\n const sizeTo = fs.statSync(to).size;\n files += 1;\n bytes += sizeFrom;\n if (sizeFrom !== sizeTo) {\n problems.push(`size differs: ${rel} (${sizeFrom} -> ${sizeTo})`);\n continue;\n }\n if (sha256(from) !== sha256(to)) {\n problems.push(`content differs: ${rel}`);\n continue;\n }\n if (/\\.(json|jsonl)$/i.test(rel) && !parsesAsJson(to)) warnings.push(`unparseable: ${rel}`);\n }\n return { ok: problems.length === 0, files, bytes, problems, warnings };\n}\n\nfunction stamp(now: number): string {\n const d = new Date(now);\n const pad = (n: number): string => String(n).padStart(2, '0');\n return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;\n}\n\nfunction errorText(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/**\n * Move a package-local data dir to its new home. Never throws: every failure\n * is reported as `failed` with the original tree left in place.\n */\nexport function relocateDataDir(opts: RelocateOptions): RelocateResult {\n const srcDir = path.resolve(opts.srcDir);\n const dstDir = path.resolve(opts.dstDir);\n if (!fs.existsSync(srcDir)) return { action: 'skipped', reason: 'source-missing' };\n if (!hasPayload(srcDir)) return { action: 'skipped', reason: 'no-payload' };\n if (hasPayload(dstDir)) return { action: 'skipped', reason: 'destination-exists' };\n\n const suffix = stamp(opts.now ?? Date.now());\n const backupDir = `${srcDir}.bak-relocate-${suffix}`;\n const stagingDir = `${dstDir}.staging-${suffix}`;\n\n // 1. backup first — the user asked for a copy that outlives a failed move.\n try {\n copyTree(srcDir, backupDir);\n } catch (error) {\n return { action: 'failed', stage: 'backup', problems: [errorText(error)], backupDir: null };\n }\n\n // 2. copy to a staging dir beside the destination (same volume → atomic rename).\n try {\n copyTree(srcDir, stagingDir);\n } catch (error) {\n return { action: 'failed', stage: 'copy', problems: [errorText(error)], backupDir };\n }\n\n // 3. verify before anything is deleted or published.\n const verified = verifyTrees(srcDir, stagingDir);\n if (!verified.ok) {\n try {\n removeTree(stagingDir);\n } catch {\n // A stranded staging dir is harmless: the next run overwrites it.\n }\n return { action: 'failed', stage: 'verify', problems: verified.problems, backupDir };\n }\n\n // 4. publish: the destination may hold an empty skeleton from an earlier\n // bootstrap, which is not payload (checked above), so clear it and rename.\n try {\n if (fs.existsSync(dstDir)) removeTree(dstDir);\n fs.renameSync(stagingDir, dstDir);\n } catch (error) {\n try {\n removeTree(stagingDir);\n } catch {\n // best effort\n }\n return { action: 'failed', stage: 'commit', problems: [errorText(error)], backupDir };\n }\n\n // 5. the new tree is live; the originals go last. A leftover only wastes\n // space — the destination already wins on the next resolve.\n const leftovers: string[] = [];\n try {\n removeTree(srcDir);\n } catch {\n leftovers.push(srcDir);\n }\n try {\n removeTree(backupDir);\n } catch {\n leftovers.push(backupDir);\n }\n\n return {\n action: 'relocated',\n srcDir,\n dstDir,\n backupDir,\n files: verified.files,\n bytes: verified.bytes,\n warnings: verified.warnings,\n leftovers,\n };\n}\n","// Transparent encryption read/write layer (port of v1 lib/vault.mjs).\n//\n// Mechanism: Node <-> vault.ps1 hand off through temp files (plain text\n// windows are millisecond-scale). v2 hardening over v1:\n// - plaintext temp files live ONLY under data/tmp (never beside targets);\n// - every path passes the workspace guard before reaching PowerShell;\n// - encrypted output lands via same-volume rename (atomic replace).\n// Encryption failure is fail-closed: throw, never fall back to plaintext.\n\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { spawnSync } from 'node:child_process';\nimport { randomUUID } from 'node:crypto';\nimport type { PathGuard } from '../core/path-guard.js';\nimport { workspace } from '../core/paths.js';\nimport { burnFileSync } from '../core/atomic-fs.js';\n\nconst MAGIC = Buffer.from('KHBV1', 'ascii');\nconst VAULT_TIMEOUT_MS = 30_000;\n\nlet cachedScriptPath: string | null = null;\n\nfunction vaultScriptPath(): string {\n if (cachedScriptPath) return cachedScriptPath;\n const script = path.join(workspace().assetsDir, 'vault.ps1');\n if (!fs.existsSync(script)) throw new Error(`vault script missing: ${script}`);\n cachedScriptPath = script;\n return script;\n}\n\nfunction tmpPlainName(target: string): string {\n return path.join(workspace().tmpDir, `.${path.basename(target)}.${randomUUID().slice(0, 8)}.plain`);\n}\n\nfunction tmpEncName(target: string): string {\n return path.join(workspace().tmpDir, `.${path.basename(target)}.${randomUUID().slice(0, 8)}.enc`);\n}\n\nfunction runVault(guard: PathGuard, args: string[]): void {\n const r = spawnSync(\n 'powershell.exe',\n ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', vaultScriptPath(), ...args],\n { timeout: VAULT_TIMEOUT_MS, encoding: 'utf8' },\n );\n if (r.error) throw new Error(`vault spawn failed: ${String(r.error)}`);\n if (r.status !== 0) {\n const detail = (r.stderr || r.stdout || '').trim().split('\\n').slice(-3).join('; ');\n throw new Error(`vault ${args[0]} failed (exit ${r.status}): ${detail}`);\n }\n}\n\n/** KHBV1 header check without reading the whole file. */\nexport function isEncrypted(file: string): boolean {\n if (!fs.existsSync(file)) return false;\n const fd = fs.openSync(file, 'r');\n try {\n const hdr = Buffer.alloc(MAGIC.length);\n const read = fs.readSync(fd, hdr, 0, hdr.length, 0);\n return read === MAGIC.length && hdr.equals(MAGIC);\n } finally {\n fs.closeSync(fd);\n }\n}\n\n/**\n * Read JSON: encrypted files are decrypted to a data/tmp plaintext window\n * that is shredded immediately after parse; plaintext stays compatible.\n */\nexport function loadJson<T>(guard: PathGuard, file: string): T | null {\n const f = guard.assert(file);\n if (!fs.existsSync(f)) return null;\n if (!isEncrypted(f)) {\n try {\n return JSON.parse(fs.readFileSync(f, 'utf8')) as T;\n } catch {\n return null;\n }\n }\n const tmp = tmpPlainName(f);\n try {\n runVault(guard, ['unprotect', '-InFile', f, '-OutFile', tmp]);\n return JSON.parse(fs.readFileSync(tmp, 'utf8')) as T;\n } finally {\n burnFileSync(tmp);\n }\n}\n\n/** Write JSON: plaintext window in data/tmp -> DPAPI encrypt -> atomic rename into place. */\nexport function saveJson(guard: PathGuard, file: string, value: unknown): void {\n const f = guard.assert(file);\n fs.mkdirSync(path.dirname(f), { recursive: true });\n const plain = tmpPlainName(f);\n const enc = tmpEncName(f);\n try {\n fs.writeFileSync(plain, JSON.stringify(value, null, 2), 'utf8');\n runVault(guard, ['protect', '-InFile', plain, '-OutFile', enc]);\n fs.renameSync(enc, f);\n } finally {\n burnFileSync(plain);\n fs.rmSync(enc, { force: true });\n }\n}\n\n/** Read a plaintext UTF-8 text file (ledger etc.), with fallback. */\nexport function readText(guard: PathGuard, file: string, fallback = ''): string {\n const f = guard.assert(file);\n try {\n return fs.readFileSync(f, 'utf8');\n } catch {\n return fallback;\n }\n}\n\n/** Write a plaintext UTF-8 text file atomically (ledger etc.). */\nexport function writeText(guard: PathGuard, file: string, content: string): void {\n const f = guard.assert(file);\n fs.mkdirSync(path.dirname(f), { recursive: true });\n const tmp = tmpPlainName(f);\n try {\n fs.writeFileSync(tmp, content, 'utf8');\n fs.renameSync(tmp, f);\n } finally {\n burnFileSync(tmp);\n }\n}\n\n/** Read an encrypted UTF-8 text file (e.g. seeds.jsonl). Missing -> null. */\nexport function loadEncryptedText(guard: PathGuard, file: string): string | null {\n const f = guard.assert(file);\n if (!fs.existsSync(f)) return null;\n if (!isEncrypted(f)) return fs.readFileSync(f, 'utf8');\n const tmp = tmpPlainName(f);\n try {\n runVault(guard, ['unprotect', '-InFile', f, '-OutFile', tmp]);\n return fs.readFileSync(tmp, 'utf8');\n } finally {\n burnFileSync(tmp);\n }\n}\n\n/** Write an encrypted UTF-8 text file atomically. */\nexport function saveEncryptedText(guard: PathGuard, file: string, content: string): void {\n const f = guard.assert(file);\n fs.mkdirSync(path.dirname(f), { recursive: true });\n const plain = tmpPlainName(f);\n const enc = tmpEncName(f);\n try {\n fs.writeFileSync(plain, content, 'utf8');\n runVault(guard, ['protect', '-InFile', plain, '-OutFile', enc]);\n fs.renameSync(enc, f);\n } finally {\n burnFileSync(plain);\n fs.rmSync(enc, { force: true });\n }\n}\n\n/** Encrypt any binary file (e.g. screenshot): inFile -> encrypted outFile. */\nexport function encryptFile(guard: PathGuard, inFile: string, outFile: string): void {\n const inPath = guard.assert(inFile);\n const outPath = guard.assert(outFile);\n fs.mkdirSync(path.dirname(outPath), { recursive: true });\n const enc = tmpEncName(outPath);\n try {\n runVault(guard, ['protect', '-InFile', inPath, '-OutFile', enc]);\n fs.renameSync(enc, outPath);\n } finally {\n fs.rmSync(enc, { force: true });\n }\n}\n\n/**\n * Decrypt an encrypted file to a plaintext output (caller must place the\n * output under data/tmp and delete it after use; \"use then burn\" discipline).\n */\nexport function decryptFile(guard: PathGuard, inFile: string, outFile: string): void {\n const inPath = guard.assert(inFile);\n const outPath = guard.assert(outFile);\n fs.mkdirSync(path.dirname(outPath), { recursive: true });\n runVault(guard, ['unprotect', '-InFile', inPath, '-OutFile', outPath]);\n}\n"],"mappings":";;;;;AAUA,OAAOA,SAAQ;AACf,OAAO,QAAQ;AACf,OAAOC,WAAU;AACjB,SAAS,qBAAqB;;;ACK9B,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAG3B,IAAM,gBAAgB,CAAC,YAAY,QAAQ,OAAO,SAAS;AAE3D,IAAM,cAAc;AACpB,IAAM,QAAQ,OAAO,KAAK,SAAS,OAAO;AAoDnC,SAAS,WAAW,KAAsB;AAC/C,MAAI,CAAC,GAAG,WAAW,GAAG,EAAG,QAAO;AAChC,aAAW,SAAS,GAAG,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC,GAAG;AAChE,QAAI,CAAC,MAAM,YAAY,EAAG,QAAO;AACjC,QAAI,CAAC,cAAc,SAAS,MAAM,IAAI,EAAG,QAAO;AAChD,QAAI,MAAM,SAAS,YAAa;AAChC,QAAI,GAAG,YAAY,KAAK,KAAK,KAAK,MAAM,IAAI,CAAC,EAAE,SAAS,EAAG,QAAO;AAAA,EACpE;AACA,SAAO;AACT;AAGA,SAAS,KAAK,KAAa,SAAS,IAAI,MAAgB,CAAC,GAAa;AACpE,aAAW,SAAS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,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;AACvD,WAAS,OAAO,CAAC,aAAa,WAAW,QAAQ,YAAY,OAAO,CAAC;AACvE;","names":["fs","path","path","fs","fs","path","MAGIC","path","fs"]}
@@ -4,10 +4,10 @@ import {
4
4
  journalFilePath,
5
5
  replayJournal,
6
6
  snapshotFilePath
7
- } from "./chunk-OYVNWB5G.js";
7
+ } from "./chunk-CUOSICYJ.js";
8
8
  import {
9
9
  saveJson
10
- } from "./chunk-7TW6DD6Q.js";
10
+ } from "./chunk-K5Y6JP2B.js";
11
11
 
12
12
  // src/profile/snapshot.ts
13
13
  import fs from "fs";
@@ -84,4 +84,4 @@ export {
84
84
  snapshotProfile,
85
85
  snapshotIfDue
86
86
  };
87
- //# sourceMappingURL=chunk-QOQ7EPZZ.js.map
87
+ //# sourceMappingURL=chunk-KB5SMG3F.js.map
@@ -2,7 +2,7 @@ import {
2
2
  isEncrypted,
3
3
  loadEncryptedText,
4
4
  saveEncryptedText
5
- } from "./chunk-7TW6DD6Q.js";
5
+ } from "./chunk-K5Y6JP2B.js";
6
6
 
7
7
  // src/vault/migrate.ts
8
8
  import fs from "fs";
@@ -212,4 +212,4 @@ export {
212
212
  decryptContainer,
213
213
  applyMigrationEntries
214
214
  };
215
- //# sourceMappingURL=chunk-2NB4QILF.js.map
215
+ //# sourceMappingURL=chunk-XFNCTOW7.js.map
package/dist/cli/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  collectMigrationEntries,
4
4
  decryptContainer,
5
5
  encryptContainer
6
- } from "../chunk-2NB4QILF.js";
6
+ } from "../chunk-XFNCTOW7.js";
7
7
  import {
8
8
  BUNDLED_PRESET_ID,
9
9
  conventionalUserPresetRoot,
@@ -28,7 +28,7 @@ import {
28
28
  scanPending,
29
29
  sendNewMessageHint,
30
30
  weeklyDirPath
31
- } from "../chunk-WRJCINZ7.js";
31
+ } from "../chunk-IG6YMUHW.js";
32
32
  import {
33
33
  activeSeeds,
34
34
  addSeed,
@@ -38,7 +38,7 @@ import {
38
38
  loadPool,
39
39
  seedsFilePath,
40
40
  surfaceSeed
41
- } from "../chunk-KOOQOMQY.js";
41
+ } from "../chunk-JDH2LDFS.js";
42
42
  import "../chunk-IV2ZWQA3.js";
43
43
  import {
44
44
  appendAuditLine,
@@ -47,11 +47,11 @@ import {
47
47
  pruneAuditFile,
48
48
  rebuildProfile,
49
49
  verifyProfile
50
- } from "../chunk-OYVNWB5G.js";
50
+ } from "../chunk-CUOSICYJ.js";
51
51
  import {
52
52
  initWorkspace,
53
53
  writeText
54
- } from "../chunk-7TW6DD6Q.js";
54
+ } from "../chunk-K5Y6JP2B.js";
55
55
  import {
56
56
  atomicWriteFileSync,
57
57
  shredFileSync
@@ -532,7 +532,7 @@ async function verbProfile(c) {
532
532
  return 0;
533
533
  }
534
534
  case "snapshot": {
535
- const { snapshotDue, snapshotProfile, SNAPSHOT_THRESHOLD } = await import("../snapshot-JQDJ346Z.js");
535
+ const { snapshotDue, snapshotProfile, SNAPSHOT_THRESHOLD } = await import("../snapshot-K5VHETTK.js");
536
536
  const { needed, lines } = snapshotDue(guard, paths.dataDir);
537
537
  console.log(`journal ${lines} \u6761\uFF08\u9608\u503C ${SNAPSHOT_THRESHOLD}\uFF09`);
538
538
  if (!needed && !rest.includes("--force")) {
@@ -637,7 +637,7 @@ async function verbSessions(c) {
637
637
  const root = path2.join(os.homedir(), ".dsh", "sessions");
638
638
  let found = 0;
639
639
  if (fs2.existsSync(root)) {
640
- const { homeSessionId } = await import("../orchestrator-2ZLU7RGE.js");
640
+ const { homeSessionId } = await import("../orchestrator-EUTZ3KG6.js");
641
641
  const own = homeSessionId(guard, paths);
642
642
  for (const slug of fs2.readdirSync(root)) {
643
643
  for (const id of fs2.readdirSync(path2.join(root, slug))) {
@@ -656,7 +656,7 @@ async function verbBind(c) {
656
656
  switch (sub) {
657
657
  case "list": {
658
658
  const data = loadBindings(guard, paths.settingsDir);
659
- const { homeSessionId } = await import("../orchestrator-2ZLU7RGE.js");
659
+ const { homeSessionId } = await import("../orchestrator-EUTZ3KG6.js");
660
660
  const own = homeSessionId(guard, paths);
661
661
  if (own) console.log(`\u5FC3\u8DF3\u6B63\u8EAB: ${own}\uFF08\u51B3\u7B56\u8F6E\u6B21\u53D1\u751F\u5730\uFF1Bbind remove \u5B83 = \u91CD\u7F6E\u6B63\u8EAB\uFF09`);
662
662
  for (const b of data.bindings) {
@@ -684,7 +684,7 @@ async function verbBind(c) {
684
684
  return 1;
685
685
  }
686
686
  console.log(removeBinding(guard, paths.settingsDir, id) ? `UNBOUND ${id}` : "NOT_FOUND");
687
- const { resetHomeSession } = await import("../orchestrator-2ZLU7RGE.js");
687
+ const { resetHomeSession } = await import("../orchestrator-EUTZ3KG6.js");
688
688
  if (resetHomeSession(guard, paths, id)) {
689
689
  console.log("\u6CE8\u610F\uFF1A\u8FD9\u662F\u5FC3\u8DF3\u6B63\u8EAB\u4F1A\u8BDD\u3002\u5DF2\u91CD\u7F6E\u2014\u2014\u4E0B\u6B21\u5FC3\u8DF3\u5C06\u521B\u5EFA\u65B0\u7684\u6B63\u8EAB\u4F1A\u8BDD\uFF08\u65E7\u4F1A\u8BDD\u4E0D\u518D\u6709\u5FC3\u8DF3\uFF09");
690
690
  }
@@ -7,9 +7,9 @@ import {
7
7
  inboxFileExists,
8
8
  inboxFilePath,
9
9
  inboxHealthCheck
10
- } from "./chunk-BQCXYE7N.js";
10
+ } from "./chunk-3MDBU6WY.js";
11
11
  import "./chunk-IV2ZWQA3.js";
12
- import "./chunk-7TW6DD6Q.js";
12
+ import "./chunk-K5Y6JP2B.js";
13
13
  import "./chunk-WRUTATW4.js";
14
14
  export {
15
15
  dedupeItems,
@@ -21,4 +21,4 @@ export {
21
21
  inboxFilePath,
22
22
  inboxHealthCheck
23
23
  };
24
- //# sourceMappingURL=inbox-JLT5G7TL.js.map
24
+ //# sourceMappingURL=inbox-P26DDMWC.js.map