clawvault 2.1.2 → 2.2.1

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 (55) hide show
  1. package/bin/command-registration.test.js +6 -1
  2. package/bin/help-contract.test.js +2 -0
  3. package/bin/register-core-commands.js +14 -4
  4. package/bin/register-maintenance-commands.js +111 -0
  5. package/bin/register-query-commands.js +32 -1
  6. package/bin/register-session-lifecycle-commands.js +2 -0
  7. package/dist/{chunk-5MQB7B37.js → chunk-2HM7ZI4X.js} +268 -434
  8. package/dist/chunk-73P7XCQM.js +104 -0
  9. package/dist/{chunk-MIIXBNO3.js → chunk-FDJIZKCW.js} +12 -1
  10. package/dist/chunk-GJEGPO7U.js +49 -0
  11. package/dist/chunk-GQVYQCY5.js +396 -0
  12. package/dist/{chunk-TXO34J3O.js → chunk-H7JW4L7H.js} +1 -1
  13. package/dist/{chunk-TBVI4N53.js → chunk-I5X6J4FX.js} +120 -95
  14. package/dist/chunk-K6XHCUFL.js +123 -0
  15. package/dist/chunk-L6NB43WV.js +472 -0
  16. package/dist/{chunk-FEQ2CQ3Y.js → chunk-LB6P4CD5.js} +20 -7
  17. package/dist/chunk-MGDEINGP.js +99 -0
  18. package/dist/chunk-MQUJNOHK.js +58 -0
  19. package/dist/{chunk-QFBKWDYR.js → chunk-OTQW3OMC.js} +91 -12
  20. package/dist/chunk-P5EPF6MB.js +182 -0
  21. package/dist/chunk-VR5NE7PZ.js +45 -0
  22. package/dist/{chunk-PIJGYMQZ.js → chunk-W463YRED.js} +1 -1
  23. package/dist/chunk-WZI3OAE5.js +111 -0
  24. package/dist/chunk-Z2XBWN7A.js +247 -0
  25. package/dist/{chunk-O5V7SD5C.js → chunk-ZZA73MFY.js} +1 -1
  26. package/dist/commands/archive.d.ts +11 -0
  27. package/dist/commands/archive.js +11 -0
  28. package/dist/commands/context.d.ts +1 -1
  29. package/dist/commands/context.js +6 -4
  30. package/dist/commands/doctor.js +6 -6
  31. package/dist/commands/graph.js +2 -2
  32. package/dist/commands/link.js +1 -1
  33. package/dist/commands/migrate-observations.d.ts +19 -0
  34. package/dist/commands/migrate-observations.js +13 -0
  35. package/dist/commands/observe.js +5 -2
  36. package/dist/commands/rebuild.d.ts +11 -0
  37. package/dist/commands/rebuild.js +12 -0
  38. package/dist/commands/reflect.d.ts +11 -0
  39. package/dist/commands/reflect.js +13 -0
  40. package/dist/commands/replay.d.ts +16 -0
  41. package/dist/commands/replay.js +14 -0
  42. package/dist/commands/setup.js +2 -2
  43. package/dist/commands/sleep.d.ts +1 -0
  44. package/dist/commands/sleep.js +29 -6
  45. package/dist/commands/status.js +6 -6
  46. package/dist/commands/sync-bd.d.ts +10 -0
  47. package/dist/commands/sync-bd.js +9 -0
  48. package/dist/commands/wake.js +53 -35
  49. package/dist/{context-COo8oq1k.d.ts → context-BUGaWpyL.d.ts} +1 -0
  50. package/dist/index.d.ts +56 -20
  51. package/dist/index.js +67 -16
  52. package/hooks/clawvault/HOOK.md +3 -2
  53. package/hooks/clawvault/handler.js +51 -0
  54. package/hooks/clawvault/handler.test.js +20 -0
  55. package/package.json +2 -2
@@ -0,0 +1,247 @@
1
+ // src/lib/ledger.ts
2
+ import * as fs from "fs";
3
+ import * as path from "path";
4
+ var DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
5
+ var YEAR_RE = /^\d{4}$/;
6
+ var MONTH_RE = /^(0[1-9]|1[0-2])$/;
7
+ var DAY_FILE_RE = /^(0[1-9]|[12]\d|3[01])\.md$/;
8
+ var RAW_DAY_FILE_RE = /^(0[1-9]|[12]\d|3[01])\.jsonl$/;
9
+ function normalizeDateKey(date) {
10
+ if (typeof date === "string") {
11
+ if (!DATE_RE.test(date)) {
12
+ throw new Error(`Invalid date key: ${date}`);
13
+ }
14
+ return date;
15
+ }
16
+ return date.toISOString().slice(0, 10);
17
+ }
18
+ function ensureDir(dirPath) {
19
+ fs.mkdirSync(dirPath, { recursive: true });
20
+ }
21
+ function walkThreeLevelDateTree(rootPath, extension) {
22
+ if (!fs.existsSync(rootPath)) {
23
+ return [];
24
+ }
25
+ const results = [];
26
+ for (const yearEntry of fs.readdirSync(rootPath, { withFileTypes: true })) {
27
+ if (!yearEntry.isDirectory() || !YEAR_RE.test(yearEntry.name)) continue;
28
+ const yearDir = path.join(rootPath, yearEntry.name);
29
+ for (const monthEntry of fs.readdirSync(yearDir, { withFileTypes: true })) {
30
+ if (!monthEntry.isDirectory() || !MONTH_RE.test(monthEntry.name)) continue;
31
+ const monthDir = path.join(yearDir, monthEntry.name);
32
+ for (const dayEntry of fs.readdirSync(monthDir, { withFileTypes: true })) {
33
+ if (!dayEntry.isFile()) continue;
34
+ const matches = extension === ".md" ? DAY_FILE_RE.test(dayEntry.name) : RAW_DAY_FILE_RE.test(dayEntry.name);
35
+ if (!matches) continue;
36
+ const day = dayEntry.name.slice(0, extension.length * -1);
37
+ const date = `${yearEntry.name}-${monthEntry.name}-${day}`;
38
+ if (!DATE_RE.test(date)) continue;
39
+ results.push({
40
+ date,
41
+ absolutePath: path.join(monthDir, dayEntry.name)
42
+ });
43
+ }
44
+ }
45
+ }
46
+ return results;
47
+ }
48
+ function inDateRange(date, fromDate, toDate) {
49
+ if (fromDate && date < fromDate) {
50
+ return false;
51
+ }
52
+ if (toDate && date > toDate) {
53
+ return false;
54
+ }
55
+ return true;
56
+ }
57
+ function toDateKey(date) {
58
+ return date.toISOString().slice(0, 10);
59
+ }
60
+ function parseDateKey(date) {
61
+ if (!DATE_RE.test(date)) {
62
+ return null;
63
+ }
64
+ const parsed = /* @__PURE__ */ new Date(`${date}T00:00:00.000Z`);
65
+ return Number.isNaN(parsed.getTime()) ? null : parsed;
66
+ }
67
+ function getLedgerRoot(vaultPath) {
68
+ return path.join(path.resolve(vaultPath), "ledger");
69
+ }
70
+ function getRawRoot(vaultPath) {
71
+ return path.join(getLedgerRoot(vaultPath), "raw");
72
+ }
73
+ function getRawSourceDir(vaultPath, source) {
74
+ return path.join(getRawRoot(vaultPath), source);
75
+ }
76
+ function getObservationsRoot(vaultPath) {
77
+ return path.join(getLedgerRoot(vaultPath), "observations");
78
+ }
79
+ function getReflectionsRoot(vaultPath) {
80
+ return path.join(getLedgerRoot(vaultPath), "reflections");
81
+ }
82
+ function getArchiveObservationsRoot(vaultPath) {
83
+ return path.join(getLedgerRoot(vaultPath), "archive", "observations");
84
+ }
85
+ function getLegacyObservationsRoot(vaultPath) {
86
+ return path.join(path.resolve(vaultPath), "observations");
87
+ }
88
+ function getObservationPath(vaultPath, date) {
89
+ const dateKey = normalizeDateKey(date);
90
+ const [year, month, day] = dateKey.split("-");
91
+ return path.join(getObservationsRoot(vaultPath), year, month, `${day}.md`);
92
+ }
93
+ function getArchiveObservationPath(vaultPath, date) {
94
+ const dateKey = normalizeDateKey(date);
95
+ const [year, month, day] = dateKey.split("-");
96
+ return path.join(getArchiveObservationsRoot(vaultPath), year, month, `${day}.md`);
97
+ }
98
+ function getLegacyObservationPath(vaultPath, date) {
99
+ const dateKey = normalizeDateKey(date);
100
+ return path.join(getLegacyObservationsRoot(vaultPath), `${dateKey}.md`);
101
+ }
102
+ function getRawTranscriptPath(vaultPath, source, date) {
103
+ const dateKey = normalizeDateKey(date);
104
+ const [year, month, day] = dateKey.split("-");
105
+ return path.join(getRawSourceDir(vaultPath, source), year, month, `${day}.jsonl`);
106
+ }
107
+ function ensureLedgerStructure(vaultPath) {
108
+ const root = getLedgerRoot(vaultPath);
109
+ const rawRoot = getRawRoot(vaultPath);
110
+ ensureDir(root);
111
+ ensureDir(rawRoot);
112
+ for (const source of ["openclaw", "chatgpt", "claude", "opencode"]) {
113
+ ensureDir(path.join(rawRoot, source));
114
+ }
115
+ ensureDir(getObservationsRoot(vaultPath));
116
+ ensureDir(getReflectionsRoot(vaultPath));
117
+ ensureDir(getArchiveObservationsRoot(vaultPath));
118
+ }
119
+ function listLedgerObservationFiles(vaultPath, options = {}) {
120
+ return walkThreeLevelDateTree(getObservationsRoot(vaultPath), ".md").filter((entry) => inDateRange(entry.date, options.fromDate, options.toDate)).map((entry) => ({
121
+ date: entry.date,
122
+ path: entry.absolutePath,
123
+ location: "ledger"
124
+ })).sort((left, right) => left.date.localeCompare(right.date));
125
+ }
126
+ function listArchiveObservationFiles(vaultPath, options = {}) {
127
+ return walkThreeLevelDateTree(getArchiveObservationsRoot(vaultPath), ".md").filter((entry) => inDateRange(entry.date, options.fromDate, options.toDate)).map((entry) => ({
128
+ date: entry.date,
129
+ path: entry.absolutePath,
130
+ location: "archive"
131
+ })).sort((left, right) => left.date.localeCompare(right.date));
132
+ }
133
+ function listLegacyObservationFiles(vaultPath, options = {}) {
134
+ const legacyRoot = getLegacyObservationsRoot(vaultPath);
135
+ if (!fs.existsSync(legacyRoot)) {
136
+ return [];
137
+ }
138
+ return fs.readdirSync(legacyRoot, { withFileTypes: true }).filter((entry) => entry.isFile() && DATE_RE.test(entry.name.replace(/\.md$/, "")) && entry.name.endsWith(".md")).map((entry) => {
139
+ const date = entry.name.replace(/\.md$/, "");
140
+ return {
141
+ date,
142
+ path: path.join(legacyRoot, entry.name),
143
+ location: "legacy"
144
+ };
145
+ }).filter((entry) => inDateRange(entry.date, options.fromDate, options.toDate)).sort((left, right) => left.date.localeCompare(right.date));
146
+ }
147
+ function listObservationFiles(vaultPath, options = {}) {
148
+ const includeLegacy = options.includeLegacy ?? true;
149
+ const includeArchive = options.includeArchive ?? false;
150
+ const dedupeByDate = options.dedupeByDate ?? true;
151
+ const files = [
152
+ ...listLedgerObservationFiles(vaultPath, options),
153
+ ...includeLegacy ? listLegacyObservationFiles(vaultPath, options) : [],
154
+ ...includeArchive ? listArchiveObservationFiles(vaultPath, options) : []
155
+ ];
156
+ if (!dedupeByDate) {
157
+ return files.sort((left, right) => left.date.localeCompare(right.date));
158
+ }
159
+ const byDate = /* @__PURE__ */ new Map();
160
+ const locationRank = {
161
+ ledger: 3,
162
+ legacy: 2,
163
+ archive: 1
164
+ };
165
+ for (const file of files) {
166
+ const existing = byDate.get(file.date);
167
+ if (!existing || locationRank[file.location] > locationRank[existing.location]) {
168
+ byDate.set(file.date, file);
169
+ }
170
+ }
171
+ return [...byDate.values()].sort((left, right) => left.date.localeCompare(right.date));
172
+ }
173
+ function listRawTranscriptFiles(vaultPath, options = {}) {
174
+ const rawRoot = getRawRoot(vaultPath);
175
+ if (!fs.existsSync(rawRoot)) {
176
+ return [];
177
+ }
178
+ const sources = options.source ? [options.source] : fs.readdirSync(rawRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
179
+ const files = [];
180
+ for (const source of sources) {
181
+ const sourceRoot = path.join(rawRoot, source);
182
+ const datedFiles = walkThreeLevelDateTree(sourceRoot, ".jsonl");
183
+ for (const entry of datedFiles) {
184
+ if (!inDateRange(entry.date, options.fromDate, options.toDate)) {
185
+ continue;
186
+ }
187
+ files.push({
188
+ source,
189
+ date: entry.date,
190
+ path: entry.absolutePath
191
+ });
192
+ }
193
+ }
194
+ return files.sort(
195
+ (left, right) => left.date === right.date ? left.path.localeCompare(right.path) : left.date.localeCompare(right.date)
196
+ );
197
+ }
198
+ function getIsoWeekMonday(date) {
199
+ const normalized = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
200
+ const day = normalized.getUTCDay() || 7;
201
+ normalized.setUTCDate(normalized.getUTCDate() - day + 1);
202
+ return normalized;
203
+ }
204
+ function getIsoWeek(date) {
205
+ const monday = getIsoWeekMonday(date);
206
+ const thursday = new Date(monday);
207
+ thursday.setUTCDate(monday.getUTCDate() + 3);
208
+ const isoYear = thursday.getUTCFullYear();
209
+ const firstThursday = new Date(Date.UTC(isoYear, 0, 4));
210
+ const firstWeekMonday = getIsoWeekMonday(firstThursday);
211
+ const diffMs = monday.getTime() - firstWeekMonday.getTime();
212
+ const week = Math.floor(diffMs / (7 * 24 * 60 * 60 * 1e3)) + 1;
213
+ return { year: isoYear, week };
214
+ }
215
+ function formatIsoWeekKey(input) {
216
+ const weekInfo = input instanceof Date ? getIsoWeek(input) : input;
217
+ return `${weekInfo.year}-W${String(weekInfo.week).padStart(2, "0")}`;
218
+ }
219
+ function getIsoWeekRange(year, week) {
220
+ const januaryFourth = new Date(Date.UTC(year, 0, 4));
221
+ const firstWeekMonday = getIsoWeekMonday(januaryFourth);
222
+ const start = new Date(firstWeekMonday);
223
+ start.setUTCDate(firstWeekMonday.getUTCDate() + (week - 1) * 7);
224
+ const end = new Date(start);
225
+ end.setUTCDate(start.getUTCDate() + 6);
226
+ return { start, end };
227
+ }
228
+ function ensureParentDir(filePath) {
229
+ ensureDir(path.dirname(filePath));
230
+ }
231
+
232
+ export {
233
+ toDateKey,
234
+ parseDateKey,
235
+ getReflectionsRoot,
236
+ getObservationPath,
237
+ getArchiveObservationPath,
238
+ getLegacyObservationPath,
239
+ getRawTranscriptPath,
240
+ ensureLedgerStructure,
241
+ listObservationFiles,
242
+ listRawTranscriptFiles,
243
+ getIsoWeek,
244
+ formatIsoWeekKey,
245
+ getIsoWeekRange,
246
+ ensureParentDir
247
+ };
@@ -346,7 +346,7 @@ async function buildOrUpdateMemoryGraphIndex(vaultPathInput, options = {}) {
346
346
  const existing = options.forceFull ? null : loadMemoryGraphIndex(vaultPath);
347
347
  const markdownFiles = await glob("**/*.md", {
348
348
  cwd: vaultPath,
349
- ignore: ["**/node_modules/**", "**/.git/**", "**/.obsidian/**", "**/.trash/**"]
349
+ ignore: ["**/node_modules/**", "**/.git/**", "**/.obsidian/**", "**/.trash/**", "**/ledger/archive/**"]
350
350
  });
351
351
  const normalizedFiles = markdownFiles.map(normalizeRelativePath).sort((a, b) => a.localeCompare(b));
352
352
  const registry = buildNoteRegistry(normalizedFiles);
@@ -0,0 +1,11 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface ArchiveCommandOptions {
4
+ vaultPath?: string;
5
+ olderThan?: number;
6
+ dryRun?: boolean;
7
+ }
8
+ declare function archiveCommand(options: ArchiveCommandOptions): Promise<void>;
9
+ declare function registerArchiveCommand(program: Command): void;
10
+
11
+ export { type ArchiveCommandOptions, archiveCommand, registerArchiveCommand };
@@ -0,0 +1,11 @@
1
+ import {
2
+ archiveCommand,
3
+ registerArchiveCommand
4
+ } from "../chunk-VR5NE7PZ.js";
5
+ import "../chunk-MQUJNOHK.js";
6
+ import "../chunk-Z2XBWN7A.js";
7
+ import "../chunk-MXSSG3QU.js";
8
+ export {
9
+ archiveCommand,
10
+ registerArchiveCommand
11
+ };
@@ -1,2 +1,2 @@
1
1
  import 'commander';
2
- export { C as ContextEntry, a as ContextFormat, b as ContextOptions, c as ContextProfile, e as ContextProfileOption, f as ContextResult, g as buildContext, h as contextCommand, i as formatContextMarkdown, r as registerContextCommand } from '../context-COo8oq1k.js';
2
+ export { C as ContextEntry, a as ContextFormat, b as ContextOptions, c as ContextProfile, e as ContextProfileOption, f as ContextResult, g as buildContext, h as contextCommand, i as formatContextMarkdown, r as registerContextCommand } from '../context-BUGaWpyL.js';
@@ -3,10 +3,12 @@ import {
3
3
  contextCommand,
4
4
  formatContextMarkdown,
5
5
  registerContextCommand
6
- } from "../chunk-TBVI4N53.js";
7
- import "../chunk-QFBKWDYR.js";
8
- import "../chunk-MIIXBNO3.js";
9
- import "../chunk-O5V7SD5C.js";
6
+ } from "../chunk-I5X6J4FX.js";
7
+ import "../chunk-K6XHCUFL.js";
8
+ import "../chunk-Z2XBWN7A.js";
9
+ import "../chunk-OTQW3OMC.js";
10
+ import "../chunk-FDJIZKCW.js";
11
+ import "../chunk-ZZA73MFY.js";
10
12
  export {
11
13
  buildContext,
12
14
  contextCommand,
@@ -1,3 +1,6 @@
1
+ import {
2
+ scanVaultLinks
3
+ } from "../chunk-4VQTUVH7.js";
1
4
  import {
2
5
  formatAge
3
6
  } from "../chunk-7ZRP733D.js";
@@ -7,17 +10,14 @@ import {
7
10
  import {
8
11
  ClawVault,
9
12
  findVault
10
- } from "../chunk-QFBKWDYR.js";
13
+ } from "../chunk-OTQW3OMC.js";
11
14
  import {
12
15
  hasQmd
13
- } from "../chunk-MIIXBNO3.js";
14
- import {
15
- scanVaultLinks
16
- } from "../chunk-4VQTUVH7.js";
16
+ } from "../chunk-FDJIZKCW.js";
17
17
  import "../chunk-J7ZWCI2C.js";
18
18
  import {
19
19
  loadMemoryGraphIndex
20
- } from "../chunk-O5V7SD5C.js";
20
+ } from "../chunk-ZZA73MFY.js";
21
21
 
22
22
  // src/commands/doctor.ts
23
23
  import * as fs from "fs";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  graphCommand,
3
3
  graphSummary
4
- } from "../chunk-TXO34J3O.js";
5
- import "../chunk-O5V7SD5C.js";
4
+ } from "../chunk-H7JW4L7H.js";
5
+ import "../chunk-ZZA73MFY.js";
6
6
  import "../chunk-MXSSG3QU.js";
7
7
  export {
8
8
  graphCommand,
@@ -13,7 +13,7 @@ import {
13
13
  } from "../chunk-J7ZWCI2C.js";
14
14
  import {
15
15
  buildOrUpdateMemoryGraphIndex
16
- } from "../chunk-O5V7SD5C.js";
16
+ } from "../chunk-ZZA73MFY.js";
17
17
  import {
18
18
  resolveVaultPath
19
19
  } from "../chunk-MXSSG3QU.js";
@@ -0,0 +1,19 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface MigrateObservationsOptions {
4
+ vaultPath?: string;
5
+ dryRun?: boolean;
6
+ }
7
+ interface MigrateObservationsResult {
8
+ scanned: number;
9
+ migrated: number;
10
+ backups: number;
11
+ dryRun: boolean;
12
+ }
13
+ declare function migrateObservations(vaultPath: string, options?: {
14
+ dryRun?: boolean;
15
+ }): MigrateObservationsResult;
16
+ declare function migrateObservationsCommand(options: MigrateObservationsOptions): Promise<void>;
17
+ declare function registerMigrateObservationsCommand(program: Command): void;
18
+
19
+ export { type MigrateObservationsOptions, type MigrateObservationsResult, migrateObservations, migrateObservationsCommand, registerMigrateObservationsCommand };
@@ -0,0 +1,13 @@
1
+ import {
2
+ migrateObservations,
3
+ migrateObservationsCommand,
4
+ registerMigrateObservationsCommand
5
+ } from "../chunk-WZI3OAE5.js";
6
+ import "../chunk-K6XHCUFL.js";
7
+ import "../chunk-Z2XBWN7A.js";
8
+ import "../chunk-MXSSG3QU.js";
9
+ export {
10
+ migrateObservations,
11
+ migrateObservationsCommand,
12
+ registerMigrateObservationsCommand
13
+ };
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  observeCommand,
3
3
  registerObserveCommand
4
- } from "../chunk-FEQ2CQ3Y.js";
4
+ } from "../chunk-LB6P4CD5.js";
5
+ import "../chunk-P5EPF6MB.js";
5
6
  import "../chunk-HRLWZGMA.js";
6
- import "../chunk-5MQB7B37.js";
7
+ import "../chunk-2HM7ZI4X.js";
8
+ import "../chunk-K6XHCUFL.js";
9
+ import "../chunk-Z2XBWN7A.js";
7
10
  import "../chunk-MXSSG3QU.js";
8
11
  export {
9
12
  observeCommand,
@@ -0,0 +1,11 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface RebuildCommandOptions {
4
+ vaultPath?: string;
5
+ from?: string;
6
+ to?: string;
7
+ }
8
+ declare function rebuildCommand(options: RebuildCommandOptions): Promise<void>;
9
+ declare function registerRebuildCommand(program: Command): void;
10
+
11
+ export { type RebuildCommandOptions, rebuildCommand, registerRebuildCommand };
@@ -0,0 +1,12 @@
1
+ import {
2
+ rebuildCommand,
3
+ registerRebuildCommand
4
+ } from "../chunk-73P7XCQM.js";
5
+ import "../chunk-2HM7ZI4X.js";
6
+ import "../chunk-K6XHCUFL.js";
7
+ import "../chunk-Z2XBWN7A.js";
8
+ import "../chunk-MXSSG3QU.js";
9
+ export {
10
+ rebuildCommand,
11
+ registerRebuildCommand
12
+ };
@@ -0,0 +1,11 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface ReflectCommandOptions {
4
+ vaultPath?: string;
5
+ days?: number;
6
+ dryRun?: boolean;
7
+ }
8
+ declare function reflectCommand(options: ReflectCommandOptions): Promise<void>;
9
+ declare function registerReflectCommand(program: Command): void;
10
+
11
+ export { type ReflectCommandOptions, reflectCommand, registerReflectCommand };
@@ -0,0 +1,13 @@
1
+ import {
2
+ reflectCommand,
3
+ registerReflectCommand
4
+ } from "../chunk-GJEGPO7U.js";
5
+ import "../chunk-GQVYQCY5.js";
6
+ import "../chunk-MQUJNOHK.js";
7
+ import "../chunk-K6XHCUFL.js";
8
+ import "../chunk-Z2XBWN7A.js";
9
+ import "../chunk-MXSSG3QU.js";
10
+ export {
11
+ reflectCommand,
12
+ registerReflectCommand
13
+ };
@@ -0,0 +1,16 @@
1
+ import { Command } from 'commander';
2
+
3
+ type ReplaySource = 'chatgpt' | 'claude' | 'opencode' | 'openclaw';
4
+
5
+ interface ReplayCommandOptions {
6
+ source: ReplaySource;
7
+ inputPath: string;
8
+ from?: string;
9
+ to?: string;
10
+ dryRun?: boolean;
11
+ vaultPath?: string;
12
+ }
13
+ declare function replayCommand(options: ReplayCommandOptions): Promise<void>;
14
+ declare function registerReplayCommand(program: Command): void;
15
+
16
+ export { type ReplayCommandOptions, registerReplayCommand, replayCommand };
@@ -0,0 +1,14 @@
1
+ import {
2
+ registerReplayCommand,
3
+ replayCommand
4
+ } from "../chunk-L6NB43WV.js";
5
+ import "../chunk-2HM7ZI4X.js";
6
+ import "../chunk-GQVYQCY5.js";
7
+ import "../chunk-MQUJNOHK.js";
8
+ import "../chunk-K6XHCUFL.js";
9
+ import "../chunk-Z2XBWN7A.js";
10
+ import "../chunk-MXSSG3QU.js";
11
+ export {
12
+ registerReplayCommand,
13
+ replayCommand
14
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  setupCommand
3
- } from "../chunk-PIJGYMQZ.js";
4
- import "../chunk-MIIXBNO3.js";
3
+ } from "../chunk-W463YRED.js";
4
+ import "../chunk-FDJIZKCW.js";
5
5
  export {
6
6
  setupCommand
7
7
  };
@@ -13,6 +13,7 @@ interface SleepOptions {
13
13
  index?: boolean;
14
14
  git?: boolean;
15
15
  sessionTranscript?: string;
16
+ reflect?: boolean;
16
17
  prompt?: PromptFn;
17
18
  cwd?: string;
18
19
  }
@@ -1,17 +1,25 @@
1
1
  import {
2
- Observer,
3
2
  parseSessionFile
4
- } from "../chunk-5MQB7B37.js";
3
+ } from "../chunk-P5EPF6MB.js";
4
+ import {
5
+ Observer
6
+ } from "../chunk-2HM7ZI4X.js";
7
+ import {
8
+ runReflection
9
+ } from "../chunk-GQVYQCY5.js";
10
+ import "../chunk-MQUJNOHK.js";
5
11
  import {
6
12
  clearDirtyFlag
7
13
  } from "../chunk-MZZJLQNQ.js";
14
+ import "../chunk-K6XHCUFL.js";
15
+ import "../chunk-Z2XBWN7A.js";
8
16
  import {
9
17
  ClawVault
10
- } from "../chunk-QFBKWDYR.js";
18
+ } from "../chunk-OTQW3OMC.js";
11
19
  import {
12
20
  qmdUpdate
13
- } from "../chunk-MIIXBNO3.js";
14
- import "../chunk-O5V7SD5C.js";
21
+ } from "../chunk-FDJIZKCW.js";
22
+ import "../chunk-ZZA73MFY.js";
15
23
 
16
24
  // src/commands/sleep.ts
17
25
  import * as fs from "fs";
@@ -177,12 +185,27 @@ async function sleep(options) {
177
185
  if (transcriptPath) {
178
186
  const observer = new Observer(vault.getPath());
179
187
  const messages = parseSessionFile(transcriptPath);
180
- await observer.processMessages(messages);
188
+ const transcriptStat = fs.statSync(transcriptPath);
189
+ await observer.processMessages(messages, {
190
+ source: "openclaw",
191
+ transcriptId: path.basename(transcriptPath),
192
+ timestamp: transcriptStat.mtime
193
+ });
181
194
  const { routingSummary } = await observer.flush();
182
195
  observationRoutingSummary = routingSummary || void 0;
183
196
  }
184
197
  } catch {
185
198
  }
199
+ if (options.reflect) {
200
+ try {
201
+ await runReflection({
202
+ vaultPath: vault.getPath(),
203
+ days: 14,
204
+ dryRun: false
205
+ });
206
+ } catch {
207
+ }
208
+ }
186
209
  return { handoff, document, git, observationRoutingSummary };
187
210
  }
188
211
  export {
@@ -1,20 +1,20 @@
1
+ import {
2
+ scanVaultLinks
3
+ } from "../chunk-4VQTUVH7.js";
1
4
  import {
2
5
  formatAge
3
6
  } from "../chunk-7ZRP733D.js";
4
7
  import {
5
8
  ClawVault
6
- } from "../chunk-QFBKWDYR.js";
9
+ } from "../chunk-OTQW3OMC.js";
7
10
  import {
8
11
  QmdUnavailableError,
9
12
  hasQmd
10
- } from "../chunk-MIIXBNO3.js";
11
- import {
12
- scanVaultLinks
13
- } from "../chunk-4VQTUVH7.js";
13
+ } from "../chunk-FDJIZKCW.js";
14
14
  import "../chunk-J7ZWCI2C.js";
15
15
  import {
16
16
  loadMemoryGraphIndex
17
- } from "../chunk-O5V7SD5C.js";
17
+ } from "../chunk-ZZA73MFY.js";
18
18
 
19
19
  // src/commands/status.ts
20
20
  import * as fs from "fs";
@@ -0,0 +1,10 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface SyncBdCommandOptions {
4
+ vaultPath?: string;
5
+ dryRun?: boolean;
6
+ }
7
+ declare function syncBdCommand(options: SyncBdCommandOptions): Promise<void>;
8
+ declare function registerSyncBdCommand(program: Command): void;
9
+
10
+ export { type SyncBdCommandOptions, registerSyncBdCommand, syncBdCommand };
@@ -0,0 +1,9 @@
1
+ import {
2
+ registerSyncBdCommand,
3
+ syncBdCommand
4
+ } from "../chunk-MGDEINGP.js";
5
+ import "../chunk-MXSSG3QU.js";
6
+ export {
7
+ registerSyncBdCommand,
8
+ syncBdCommand
9
+ };