clawvault 2.6.0 → 3.0.0-beta.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 (232) hide show
  1. package/bin/command-registration.test.js +1 -3
  2. package/bin/register-core-commands.js +10 -23
  3. package/bin/register-maintenance-commands.js +3 -20
  4. package/bin/register-query-commands.js +23 -0
  5. package/bin/register-task-commands.js +1 -18
  6. package/bin/register-task-commands.test.js +0 -16
  7. package/bin/register-vault-operations-commands.js +1 -29
  8. package/dist/{chunk-QVMXF7FY.js → chunk-3D6BCTP6.js} +39 -1
  9. package/dist/{chunk-R2MIW5G7.js → chunk-3DHXQHYG.js} +1 -1
  10. package/dist/{chunk-Q2J5YTUF.js → chunk-3NSBOUT3.js} +73 -36
  11. package/dist/chunk-3RG5ZIWI.js +10 -0
  12. package/dist/{chunk-AZYOKJYC.js → chunk-62YTUT6J.js} +2 -2
  13. package/dist/chunk-6U6MK36V.js +205 -0
  14. package/dist/{chunk-4QYGFWRM.js → chunk-7R7O6STJ.js} +4 -4
  15. package/dist/{chunk-VXEOHTSL.js → chunk-C7OK5WKP.js} +4 -4
  16. package/dist/chunk-CMB7UL7C.js +327 -0
  17. package/dist/chunk-DEFFDRVP.js +938 -0
  18. package/dist/{chunk-K3CDT7IH.js → chunk-E7MFQB6D.js} +61 -20
  19. package/dist/{chunk-ME37YNW3.js → chunk-F2JEUD4J.js} +6 -4
  20. package/dist/chunk-GAJV4IGR.js +82 -0
  21. package/dist/chunk-GQSLDZTS.js +560 -0
  22. package/dist/{chunk-4OXMU5S2.js → chunk-GUKMRGM7.js} +1 -1
  23. package/dist/{chunk-YOSEUUNB.js → chunk-H34S76MB.js} +6 -6
  24. package/dist/{chunk-4TE4JMLA.js → chunk-JY6FYXIT.js} +10 -5
  25. package/dist/chunk-K234IDRJ.js +1073 -0
  26. package/dist/{chunk-IEVLHNLU.js → chunk-LNJA2UGL.js} +86 -9
  27. package/dist/{chunk-MFAWT5O5.js → chunk-LYHGEHXG.js} +1 -0
  28. package/dist/chunk-MFM6K7PU.js +374 -0
  29. package/dist/{chunk-QWQ3TIKS.js → chunk-N2AXRYLC.js} +1 -1
  30. package/dist/chunk-PAH27GSN.js +108 -0
  31. package/dist/{chunk-OIWVQYQF.js → chunk-QBLMXKF2.js} +1 -1
  32. package/dist/{chunk-FHFUXL6G.js → chunk-QK3UCXWL.js} +2 -2
  33. package/dist/{chunk-2YDBJS7M.js → chunk-SJSFRIYS.js} +1 -1
  34. package/dist/{chunk-GSD4ALSI.js → chunk-U55BGUAU.js} +2 -2
  35. package/dist/{chunk-PBEE567J.js → chunk-VGLOTGAS.js} +1 -1
  36. package/dist/{chunk-F55HGNU4.js → chunk-WAZ3NLWL.js} +47 -0
  37. package/dist/{chunk-KL4NAOMO.js → chunk-WGRQ6HDV.js} +1 -1
  38. package/dist/{chunk-UEOUADMO.js → chunk-YKTA5JOJ.js} +13 -10
  39. package/dist/{chunk-XAVB4GB4.js → chunk-ZVVFWOLW.js} +4 -4
  40. package/dist/cli/index.cjs +10033 -0
  41. package/dist/cli/index.d.cts +5 -0
  42. package/dist/cli/index.js +20 -18
  43. package/dist/commands/archive.cjs +287 -0
  44. package/dist/commands/archive.d.cts +11 -0
  45. package/dist/commands/archive.js +1 -0
  46. package/dist/commands/backlog.cjs +721 -0
  47. package/dist/commands/backlog.d.cts +53 -0
  48. package/dist/commands/backlog.js +3 -2
  49. package/dist/commands/blocked.cjs +204 -0
  50. package/dist/commands/blocked.d.cts +26 -0
  51. package/dist/commands/blocked.js +3 -2
  52. package/dist/commands/checkpoint.cjs +244 -0
  53. package/dist/commands/checkpoint.d.cts +41 -0
  54. package/dist/commands/checkpoint.js +2 -1
  55. package/dist/commands/compat.cjs +369 -0
  56. package/dist/commands/compat.d.cts +28 -0
  57. package/dist/commands/compat.js +2 -1
  58. package/dist/commands/context.cjs +2989 -0
  59. package/dist/commands/context.d.cts +2 -0
  60. package/dist/commands/context.js +5 -4
  61. package/dist/commands/doctor.cjs +3062 -0
  62. package/dist/commands/doctor.d.cts +21 -0
  63. package/dist/commands/doctor.d.ts +6 -1
  64. package/dist/commands/doctor.js +13 -11
  65. package/dist/commands/embed.cjs +232 -0
  66. package/dist/commands/embed.d.cts +17 -0
  67. package/dist/commands/embed.js +5 -2
  68. package/dist/commands/entities.cjs +141 -0
  69. package/dist/commands/entities.d.cts +7 -0
  70. package/dist/commands/entities.js +1 -0
  71. package/dist/commands/graph.cjs +501 -0
  72. package/dist/commands/graph.d.cts +21 -0
  73. package/dist/commands/graph.js +1 -0
  74. package/dist/commands/inject.cjs +1636 -0
  75. package/dist/commands/inject.d.cts +2 -0
  76. package/dist/commands/inject.d.ts +1 -1
  77. package/dist/commands/inject.js +4 -2
  78. package/dist/commands/kanban.cjs +884 -0
  79. package/dist/commands/kanban.d.cts +63 -0
  80. package/dist/commands/kanban.js +4 -3
  81. package/dist/commands/link.cjs +965 -0
  82. package/dist/commands/link.d.cts +11 -0
  83. package/dist/commands/link.js +1 -0
  84. package/dist/commands/migrate-observations.cjs +362 -0
  85. package/dist/commands/migrate-observations.d.cts +19 -0
  86. package/dist/commands/migrate-observations.js +3 -2
  87. package/dist/commands/observe.cjs +4099 -0
  88. package/dist/commands/observe.d.cts +23 -0
  89. package/dist/commands/observe.d.ts +1 -0
  90. package/dist/commands/observe.js +11 -9
  91. package/dist/commands/project.cjs +1341 -0
  92. package/dist/commands/project.d.cts +85 -0
  93. package/dist/commands/project.js +5 -4
  94. package/dist/commands/rebuild.cjs +3136 -0
  95. package/dist/commands/rebuild.d.cts +11 -0
  96. package/dist/commands/rebuild.js +10 -8
  97. package/dist/commands/recover.cjs +361 -0
  98. package/dist/commands/recover.d.cts +38 -0
  99. package/dist/commands/recover.js +3 -2
  100. package/dist/commands/reflect.cjs +1008 -0
  101. package/dist/commands/reflect.d.cts +11 -0
  102. package/dist/commands/reflect.js +6 -4
  103. package/dist/commands/repair-session.cjs +457 -0
  104. package/dist/commands/repair-session.d.cts +38 -0
  105. package/dist/commands/repair-session.js +1 -0
  106. package/dist/commands/replay.cjs +4103 -0
  107. package/dist/commands/replay.d.cts +16 -0
  108. package/dist/commands/replay.js +12 -10
  109. package/dist/commands/session-recap.cjs +353 -0
  110. package/dist/commands/session-recap.d.cts +27 -0
  111. package/dist/commands/session-recap.js +1 -0
  112. package/dist/commands/setup.cjs +1345 -0
  113. package/dist/commands/setup.d.cts +100 -0
  114. package/dist/commands/setup.d.ts +90 -2
  115. package/dist/commands/setup.js +21 -2
  116. package/dist/commands/shell-init.cjs +75 -0
  117. package/dist/commands/shell-init.d.cts +7 -0
  118. package/dist/commands/shell-init.js +2 -0
  119. package/dist/commands/sleep.cjs +6028 -0
  120. package/dist/commands/sleep.d.cts +36 -0
  121. package/dist/commands/sleep.d.ts +1 -1
  122. package/dist/commands/sleep.js +17 -15
  123. package/dist/commands/status.cjs +2736 -0
  124. package/dist/commands/status.d.cts +52 -0
  125. package/dist/commands/status.js +12 -10
  126. package/dist/commands/tailscale.cjs +1532 -0
  127. package/dist/commands/tailscale.d.cts +52 -0
  128. package/dist/commands/tailscale.js +1 -0
  129. package/dist/commands/task.cjs +1236 -0
  130. package/dist/commands/task.d.cts +97 -0
  131. package/dist/commands/task.js +4 -3
  132. package/dist/commands/template.cjs +457 -0
  133. package/dist/commands/template.d.cts +36 -0
  134. package/dist/commands/template.js +2 -1
  135. package/dist/commands/wake.cjs +2626 -0
  136. package/dist/commands/wake.d.cts +22 -0
  137. package/dist/commands/wake.d.ts +1 -1
  138. package/dist/commands/wake.js +12 -11
  139. package/dist/context-BUGaWpyL.d.cts +46 -0
  140. package/dist/index.cjs +14526 -0
  141. package/dist/index.d.cts +858 -0
  142. package/dist/index.d.ts +192 -7
  143. package/dist/index.js +101 -75
  144. package/dist/{inject-x65KXWPk.d.ts → inject-Bzi5E-By.d.cts} +1 -1
  145. package/dist/inject-Bzi5E-By.d.ts +137 -0
  146. package/dist/lib/auto-linker.cjs +176 -0
  147. package/dist/lib/auto-linker.d.cts +26 -0
  148. package/dist/lib/auto-linker.js +1 -0
  149. package/dist/lib/canvas-layout.cjs +136 -0
  150. package/dist/lib/canvas-layout.d.cts +31 -0
  151. package/dist/lib/canvas-layout.d.ts +16 -100
  152. package/dist/lib/canvas-layout.js +78 -20
  153. package/dist/lib/config.cjs +78 -0
  154. package/dist/lib/config.d.cts +11 -0
  155. package/dist/lib/config.js +1 -0
  156. package/dist/lib/entity-index.cjs +84 -0
  157. package/dist/lib/entity-index.d.cts +26 -0
  158. package/dist/lib/entity-index.js +1 -0
  159. package/dist/lib/project-utils.cjs +864 -0
  160. package/dist/lib/project-utils.d.cts +97 -0
  161. package/dist/lib/project-utils.js +4 -3
  162. package/dist/lib/session-repair.cjs +239 -0
  163. package/dist/lib/session-repair.d.cts +110 -0
  164. package/dist/lib/session-repair.js +1 -0
  165. package/dist/lib/session-utils.cjs +209 -0
  166. package/dist/lib/session-utils.d.cts +63 -0
  167. package/dist/lib/session-utils.js +1 -0
  168. package/dist/lib/tailscale.cjs +1183 -0
  169. package/dist/lib/tailscale.d.cts +225 -0
  170. package/dist/lib/tailscale.js +1 -0
  171. package/dist/lib/task-utils.cjs +1137 -0
  172. package/dist/lib/task-utils.d.cts +208 -0
  173. package/dist/lib/task-utils.js +3 -2
  174. package/dist/lib/template-engine.cjs +47 -0
  175. package/dist/lib/template-engine.d.cts +11 -0
  176. package/dist/lib/template-engine.js +1 -0
  177. package/dist/lib/webdav.cjs +568 -0
  178. package/dist/lib/webdav.d.cts +109 -0
  179. package/dist/lib/webdav.js +1 -0
  180. package/dist/plugin/index.cjs +1907 -0
  181. package/dist/plugin/index.d.cts +36 -0
  182. package/dist/plugin/index.d.ts +36 -0
  183. package/dist/plugin/index.js +572 -0
  184. package/dist/plugin/inject.cjs +356 -0
  185. package/dist/plugin/inject.d.cts +54 -0
  186. package/dist/plugin/inject.d.ts +54 -0
  187. package/dist/plugin/inject.js +17 -0
  188. package/dist/plugin/observe.cjs +631 -0
  189. package/dist/plugin/observe.d.cts +39 -0
  190. package/dist/plugin/observe.d.ts +39 -0
  191. package/dist/plugin/observe.js +18 -0
  192. package/dist/plugin/templates.cjs +593 -0
  193. package/dist/plugin/templates.d.cts +52 -0
  194. package/dist/plugin/templates.d.ts +52 -0
  195. package/dist/plugin/templates.js +25 -0
  196. package/dist/plugin/types.cjs +18 -0
  197. package/dist/plugin/types.d.cts +209 -0
  198. package/dist/plugin/types.d.ts +209 -0
  199. package/dist/plugin/types.js +0 -0
  200. package/dist/plugin/vault.cjs +927 -0
  201. package/dist/plugin/vault.d.cts +68 -0
  202. package/dist/plugin/vault.d.ts +68 -0
  203. package/dist/plugin/vault.js +22 -0
  204. package/dist/{types-C74wgGL1.d.ts → types-Y2_Um2Ls.d.cts} +44 -1
  205. package/dist/types-Y2_Um2Ls.d.ts +205 -0
  206. package/hooks/clawvault/handler.js +70 -7
  207. package/hooks/clawvault/handler.test.js +91 -0
  208. package/openclaw.plugin.json +56 -0
  209. package/package.json +16 -6
  210. package/templates/memory-event.md +67 -0
  211. package/templates/party.md +63 -0
  212. package/templates/primitive-registry.yaml +551 -0
  213. package/templates/run.md +68 -0
  214. package/templates/trigger.md +68 -0
  215. package/templates/workspace.md +50 -0
  216. package/dashboard/lib/graph-diff.js +0 -104
  217. package/dashboard/lib/graph-diff.test.js +0 -75
  218. package/dashboard/lib/vault-parser.js +0 -556
  219. package/dashboard/lib/vault-parser.test.js +0 -254
  220. package/dashboard/public/app.js +0 -796
  221. package/dashboard/public/index.html +0 -52
  222. package/dashboard/public/styles.css +0 -221
  223. package/dashboard/server.js +0 -374
  224. package/dist/chunk-HA5M6KJB.js +0 -33
  225. package/dist/chunk-MAKNAHAW.js +0 -375
  226. package/dist/chunk-MDIH26GC.js +0 -183
  227. package/dist/chunk-MGDEINGP.js +0 -99
  228. package/dist/chunk-RVYA52PY.js +0 -363
  229. package/dist/commands/canvas.d.ts +0 -15
  230. package/dist/commands/canvas.js +0 -199
  231. package/dist/commands/sync-bd.d.ts +0 -10
  232. package/dist/commands/sync-bd.js +0 -9
@@ -83,8 +83,7 @@ describe('CLI command registration modules', () => {
83
83
  'sync',
84
84
  'reindex',
85
85
  'remember',
86
- 'shell-init',
87
- 'dashboard'
86
+ 'shell-init'
88
87
  ]));
89
88
  });
90
89
 
@@ -130,7 +129,6 @@ describe('CLI command registration modules', () => {
130
129
  'archive',
131
130
  'migrate-observations',
132
131
  'replay',
133
- 'sync-bd',
134
132
  'checkpoint',
135
133
  'recover',
136
134
  'status',
@@ -19,7 +19,6 @@ export function registerCoreCommands(
19
19
  .option('--no-tasks', 'Skip tasks/ and backlog/ directories')
20
20
  .option('--no-graph', 'Skip initial graph build')
21
21
  .option('--categories <list>', 'Comma-separated list of custom categories to create')
22
- .option('--canvas', 'Generate a vault status canvas dashboard on init')
23
22
  .option('--theme <style>', 'Graph color theme to apply (neural, minimal, none) (default: none)', 'none')
24
23
  .option('--minimal', 'Create minimal vault (memory categories only, no tasks/bases/graph)')
25
24
  .action(async (vaultPath, options) => {
@@ -81,8 +80,14 @@ export function registerCoreCommands(
81
80
  '**/*.md'
82
81
  ]);
83
82
  console.log(chalk.green('✓ qmd collection created'));
84
- } catch {
85
- console.log(chalk.yellow('⚠ qmd collection may already exist'));
83
+ } catch (err) {
84
+ if (err instanceof QmdUnavailableError || err?.message?.includes('ENOENT') || err?.message?.includes('ERR_MODULE_NOT_FOUND')) {
85
+ console.log(chalk.yellow('⚠ qmd not available — skipping semantic search setup'));
86
+ console.log(chalk.dim(' Install qmd for semantic search: npm install -g github:tobi/qmd'));
87
+ console.log(chalk.dim(' Vault initialized successfully without qmd.'));
88
+ } else {
89
+ console.log(chalk.yellow('⚠ qmd collection may already exist'));
90
+ }
86
91
  }
87
92
 
88
93
  // Apply theme if requested
@@ -92,7 +97,6 @@ export function registerCoreCommands(
92
97
  await setupCommand({
93
98
  graphColors: true,
94
99
  bases: false,
95
- canvas: false,
96
100
  theme: options.theme,
97
101
  vault: resolvedPath
98
102
  });
@@ -101,22 +105,6 @@ export function registerCoreCommands(
101
105
  }
102
106
  }
103
107
 
104
- // Generate canvas if requested
105
- if (options.canvas) {
106
- try {
107
- const { setupCommand } = await import('../dist/commands/setup.js');
108
- await setupCommand({
109
- graphColors: false,
110
- bases: false,
111
- canvas: true,
112
- theme: 'none',
113
- vault: resolvedPath
114
- });
115
- } catch {
116
- console.log(chalk.yellow(`⚠ Could not generate canvas`));
117
- }
118
- }
119
-
120
108
  console.log(chalk.green('\n✅ ClawVault ready!\n'));
121
109
  console.log(' ' + chalk.bold('Try these:'));
122
110
  console.log(chalk.dim(' clawvault capture "my first thought" # quick capture'));
@@ -140,9 +128,8 @@ export function registerCoreCommands(
140
128
  .option('--no-graph-colors', 'Skip graph color configuration')
141
129
  .option('--bases', 'Generate Obsidian Bases views for task management')
142
130
  .option('--no-bases', 'Skip Bases file generation')
143
- .option('--canvas', 'Generate vault status canvas dashboard')
144
- .option('--no-canvas', 'Skip canvas generation')
145
131
  .option('--theme <style>', 'Graph color theme (neural, minimal, none) (default: neural)', 'neural')
132
+ .option('--from <path>', 'Import from existing agent memory directory (MEMORY.md, memory/*.md, etc)')
146
133
  .option('--force', 'Overwrite existing configuration files')
147
134
  .option('-v, --vault <path>', 'Vault path')
148
135
  .action(async (options) => {
@@ -151,8 +138,8 @@ export function registerCoreCommands(
151
138
  await setupCommand({
152
139
  graphColors: options.graphColors,
153
140
  bases: options.bases,
154
- canvas: options.canvas,
155
141
  theme: options.theme,
142
+ from: options.from,
156
143
  force: options.force,
157
144
  vault: options.vault
158
145
  });
@@ -26,8 +26,8 @@ export function registerMaintenanceCommands(program, { chalk }) {
26
26
 
27
27
  console.log(chalk.cyan('\n🩺 ClawVault Health Check\n'));
28
28
  console.log(chalk.dim(`Vault: ${report.vaultPath}`));
29
- console.log(chalk.dim(`qmd collection: ${report.qmdCollection}`));
30
- console.log(chalk.dim(`qmd root: ${report.qmdRoot}`));
29
+ if (report.qmdCollection) console.log(chalk.dim(`qmd collection: ${report.qmdCollection}`));
30
+ if (report.qmdRoot) console.log(chalk.dim(`qmd root: ${report.qmdRoot}`));
31
31
  console.log();
32
32
 
33
33
  for (const check of report.checks) {
@@ -36,7 +36,7 @@ export function registerMaintenanceCommands(program, { chalk }) {
36
36
  : check.status === 'warn'
37
37
  ? chalk.yellow('⚠')
38
38
  : chalk.red('✗');
39
- const line = `${check.label}: ${check.detail}`;
39
+ const line = check.detail ? `${check.label}: ${check.detail}` : check.label;
40
40
  const renderedLine = check.status === 'ok'
41
41
  ? chalk.green(line)
42
42
  : check.status === 'warn'
@@ -262,21 +262,4 @@ export function registerMaintenanceCommands(program, { chalk }) {
262
262
  });
263
263
 
264
264
  // === SYNC-BD ===
265
- program
266
- .command('sync-bd')
267
- .description('Sync active Beads tasks into views/now.md (optional)')
268
- .option('--dry-run', 'Show sync output without writing')
269
- .option('-v, --vault <path>', 'Vault path')
270
- .action(async (options) => {
271
- try {
272
- const { syncBdCommand } = await import('../dist/commands/sync-bd.js');
273
- await syncBdCommand({
274
- vaultPath: options.vault,
275
- dryRun: options.dryRun
276
- });
277
- } catch (err) {
278
- console.error(chalk.red(`Error: ${err.message}`));
279
- process.exit(1);
280
- }
281
- });
282
265
  }
@@ -292,6 +292,29 @@ export function registerQueryCommands(
292
292
  }
293
293
  });
294
294
 
295
+ // === REWEAVE ===
296
+ program
297
+ .command('reweave')
298
+ .description('Backward memory consolidation — detect and mark superseded observations')
299
+ .option('--since <date>', 'Only check observations since this date (YYYY-MM-DD)')
300
+ .option('--dry-run', 'Show what would be superseded without writing')
301
+ .option('--threshold <n>', 'Entity similarity threshold (0-1, default 0.3)', '0.3')
302
+ .option('-v, --vault <path>', 'Vault path')
303
+ .action(async (options) => {
304
+ try {
305
+ const { reweaveCommand } = await import('../dist/commands/reweave.js');
306
+ await reweaveCommand({
307
+ vaultPath: resolveVaultPath(options.vault),
308
+ since: options.since,
309
+ dryRun: options.dryRun,
310
+ threshold: parseFloat(options.threshold),
311
+ });
312
+ } catch (err) {
313
+ console.error(chalk.red(`Error: ${err.message}`));
314
+ process.exit(1);
315
+ }
316
+ });
317
+
295
318
  // === SESSION-RECAP ===
296
319
  program
297
320
  .command('session-recap <sessionKey>')
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Task tracking command registrations for ClawVault
3
- * Registers task, backlog, blocked, and canvas commands
3
+ * Registers task, backlog, and blocked commands
4
4
  */
5
5
 
6
6
  function parseCsvList(value) {
@@ -328,21 +328,4 @@ export function registerTaskCommands(
328
328
  });
329
329
 
330
330
  // === CANVAS ===
331
- program
332
- .command('canvas')
333
- .description('Generate an Obsidian canvas dashboard file')
334
- .option('-v, --vault <path>', 'Vault path (default: find nearest)')
335
- .option('--output <path>', 'Output file path (default: dashboard.canvas)')
336
- .action(async (options) => {
337
- try {
338
- const vaultPath = resolveVaultPath(options.vault);
339
- const { canvasCommand } = await import('../dist/commands/canvas.js');
340
- await canvasCommand(vaultPath, {
341
- output: options.output
342
- });
343
- } catch (err) {
344
- console.error(chalk.red(`Error: ${err.message}`));
345
- process.exit(1);
346
- }
347
- });
348
331
  }
@@ -50,20 +50,4 @@ describe('register-task-commands', () => {
50
50
  ]));
51
51
  });
52
52
 
53
- it('adds simplified canvas flags', () => {
54
- const program = new Command();
55
- registerTaskCommands(program, {
56
- chalk: chalkStub,
57
- resolveVaultPath: stubResolveVaultPath
58
- });
59
-
60
- const canvasCommand = program.commands.find((command) => command.name() === 'canvas');
61
- expect(canvasCommand).toBeDefined();
62
-
63
- const optionFlags = canvasCommand?.options.map((option) => option.flags) ?? [];
64
- expect(optionFlags).toEqual(expect.arrayContaining([
65
- '-v, --vault <path>',
66
- '--output <path>'
67
- ]));
68
- });
69
53
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Vault operation command registrations (browse/sync/reindex/remember/shell-init/dashboard).
2
+ * Vault operation command registrations (browse/sync/reindex/remember/shell-init).
3
3
  */
4
4
 
5
5
  import { validatePathWithinBase } from './command-runtime.js';
@@ -269,32 +269,4 @@ export function registerVaultOperationsCommands(
269
269
  }
270
270
  });
271
271
 
272
- // === DASHBOARD ===
273
- program
274
- .command('dashboard')
275
- .description('Run the local vault graph dashboard server')
276
- .option('-p, --port <port>', 'Dashboard port (default: 3377)', '3377')
277
- .option('-v, --vault <path>', 'Vault path')
278
- .action(async (options) => {
279
- try {
280
- const parsedPort = Number.parseInt(options.port, 10);
281
- if (Number.isNaN(parsedPort)) {
282
- console.error(chalk.red(`Error: Invalid port: ${options.port}`));
283
- process.exit(1);
284
- }
285
-
286
- const vaultPath = options.vault
287
- ? path.resolve(options.vault)
288
- : resolveVaultPath(undefined);
289
-
290
- const { startDashboard } = await import('../dashboard/server.js');
291
- await startDashboard({
292
- port: parsedPort,
293
- vaultPath
294
- });
295
- } catch (err) {
296
- console.error(chalk.red(`Error: ${err.message}`));
297
- process.exit(1);
298
- }
299
- });
300
272
  }
@@ -24,6 +24,19 @@ function findPackageRoot() {
24
24
  }
25
25
  return path.dirname(fileURLToPath(import.meta.url));
26
26
  }
27
+ function resolveOpenClawHooksDir() {
28
+ const candidates = [
29
+ path.join(process.env.HOME || "", ".openclaw", "hooks", "clawvault"),
30
+ path.join(process.env.OPENCLAW_HOME || "", "hooks", "clawvault"),
31
+ path.join(process.env.OPENCLAW_STATE_DIR || "", "hooks", "clawvault")
32
+ ].filter((p) => p && !p.startsWith(path.sep + "hooks"));
33
+ for (const candidate of candidates) {
34
+ if (fs.existsSync(candidate)) {
35
+ return candidate;
36
+ }
37
+ }
38
+ return null;
39
+ }
27
40
  function resolveProjectFile(relativePath, baseDir) {
28
41
  if (baseDir) {
29
42
  return path.resolve(baseDir, relativePath);
@@ -32,6 +45,20 @@ function resolveProjectFile(relativePath, baseDir) {
32
45
  if (fs.existsSync(fromCwd)) {
33
46
  return fromCwd;
34
47
  }
48
+ if (relativePath.startsWith("hooks/clawvault/")) {
49
+ const hooksDir = resolveOpenClawHooksDir();
50
+ if (hooksDir) {
51
+ const hookRelative = relativePath.replace("hooks/clawvault/", "");
52
+ const fromHooks = path.resolve(hooksDir, hookRelative);
53
+ if (fs.existsSync(fromHooks)) {
54
+ return fromHooks;
55
+ }
56
+ const fromNestedHooks = path.resolve(hooksDir, "hooks", "clawvault", hookRelative);
57
+ if (fs.existsSync(fromNestedHooks)) {
58
+ return fromNestedHooks;
59
+ }
60
+ }
61
+ }
35
62
  return path.resolve(findPackageRoot(), relativePath);
36
63
  }
37
64
  function checkOpenClawCli() {
@@ -63,7 +90,18 @@ function checkOpenClawCli() {
63
90
  return { label: "openclaw CLI available", status: "ok" };
64
91
  }
65
92
  function checkPackageHookRegistration(options) {
66
- const packageRaw = readOptionalFile(resolveProjectFile("package.json", options.baseDir));
93
+ let packageRaw = readOptionalFile(resolveProjectFile("package.json", options.baseDir));
94
+ if (packageRaw && !options.baseDir) {
95
+ try {
96
+ const parsed = JSON.parse(packageRaw);
97
+ if (!parsed.openclaw?.hooks) {
98
+ const fallbackPath = path.resolve(findPackageRoot(), "package.json");
99
+ const fallbackRaw = readOptionalFile(fallbackPath);
100
+ if (fallbackRaw) packageRaw = fallbackRaw;
101
+ }
102
+ } catch {
103
+ }
104
+ }
67
105
  if (!packageRaw) {
68
106
  return {
69
107
  label: "package hook registration",
@@ -8,7 +8,7 @@ import {
8
8
  queryTransitions,
9
9
  readTask,
10
10
  updateTask
11
- } from "./chunk-QWQ3TIKS.js";
11
+ } from "./chunk-N2AXRYLC.js";
12
12
 
13
13
  // src/commands/task.ts
14
14
  function taskAdd(vaultPath, title, options = {}) {
@@ -1,6 +1,21 @@
1
1
  import {
2
2
  listProjects
3
- } from "./chunk-AZYOKJYC.js";
3
+ } from "./chunk-62YTUT6J.js";
4
+ import {
5
+ listConfig,
6
+ listRouteRules,
7
+ matchRouteRule
8
+ } from "./chunk-ITPEXLHA.js";
9
+ import {
10
+ resolveClaudeOAuthToken
11
+ } from "./chunk-PAH27GSN.js";
12
+ import {
13
+ createBacklogItem,
14
+ listBacklogItems,
15
+ listTasks,
16
+ updateBacklogItem,
17
+ updateTask
18
+ } from "./chunk-N2AXRYLC.js";
4
19
  import {
5
20
  DATE_HEADING_RE,
6
21
  inferObservationType,
@@ -9,12 +24,7 @@ import {
9
24
  parseObservationMarkdown,
10
25
  renderObservationMarkdown,
11
26
  renderScoredObservationLine
12
- } from "./chunk-FHFUXL6G.js";
13
- import {
14
- listConfig,
15
- listRouteRules,
16
- matchRouteRule
17
- } from "./chunk-ITPEXLHA.js";
27
+ } from "./chunk-QK3UCXWL.js";
18
28
  import {
19
29
  ensureLedgerStructure,
20
30
  ensureParentDir,
@@ -23,19 +33,12 @@ import {
23
33
  getRawTranscriptPath,
24
34
  toDateKey
25
35
  } from "./chunk-Z2XBWN7A.js";
26
- import {
27
- createBacklogItem,
28
- listBacklogItems,
29
- listTasks,
30
- updateBacklogItem,
31
- updateTask
32
- } from "./chunk-QWQ3TIKS.js";
33
36
 
34
37
  // src/observer/compressor.ts
35
38
  var OPENAI_BASE_URL = "https://api.openai.com/v1";
36
39
  var OLLAMA_BASE_URL = "http://localhost:11434/v1";
37
40
  var DEFAULT_PROVIDER_MODELS = {
38
- anthropic: "claude-3-5-haiku-latest",
41
+ anthropic: "claude-haiku-4-5",
39
42
  openai: "gpt-4o-mini",
40
43
  gemini: "gemini-2.0-flash",
41
44
  "openai-compatible": "gpt-4o-mini",
@@ -69,7 +72,7 @@ var Compressor = class {
69
72
  return existingObservations.trim();
70
73
  }
71
74
  const prompt = this.buildPrompt(cleanedMessages, existingObservations);
72
- const backend = this.resolveProvider();
75
+ const backend = await this.resolveProvider();
73
76
  if (backend) {
74
77
  try {
75
78
  const llmOutput = backend.provider === "anthropic" ? await this.callAnthropic(prompt, backend) : backend.provider === "gemini" ? await this.callGemini(prompt, backend) : backend.provider === "openai" ? await this.callOpenAI(prompt, backend) : await this.callOpenAICompatible(prompt, backend);
@@ -83,16 +86,16 @@ var Compressor = class {
83
86
  const fallback = this.fallbackCompression(cleanedMessages);
84
87
  return this.mergeObservations(existingObservations, fallback);
85
88
  }
86
- resolveProvider() {
89
+ async resolveProvider() {
87
90
  if (process.env.CLAWVAULT_NO_LLM) return null;
88
91
  if (this.provider) {
89
92
  const configured = this.resolveConfiguredProvider(this.provider);
90
93
  if (configured) {
91
94
  return configured;
92
95
  }
93
- return this.resolveProviderFromEnv(false);
96
+ return await this.resolveProviderFromEnv(false);
94
97
  }
95
- return this.resolveProviderFromEnv(true);
98
+ return await this.resolveProviderFromEnv(true);
96
99
  }
97
100
  resolveConfiguredProvider(provider) {
98
101
  const model = this.resolveModel(provider);
@@ -138,14 +141,21 @@ var Compressor = class {
138
141
  baseUrl: this.resolveBaseUrl(provider)
139
142
  };
140
143
  }
141
- resolveProviderFromEnv(allowConfiguredModel) {
144
+ async resolveProviderFromEnv(allowConfiguredModel) {
145
+ const anthropicModel = allowConfiguredModel ? this.resolveModel("anthropic") : DEFAULT_PROVIDER_MODELS.anthropic;
146
+ const oauthEnvToken = this.readEnvValue("ANTHROPIC_OAUTH_TOKEN");
147
+ if (oauthEnvToken) {
148
+ return { provider: "anthropic", model: anthropicModel, apiKey: oauthEnvToken, isOAuth: true };
149
+ }
142
150
  const anthropicApiKey = this.readEnvValue("ANTHROPIC_API_KEY");
143
151
  if (anthropicApiKey) {
144
- return {
145
- provider: "anthropic",
146
- model: allowConfiguredModel ? this.resolveModel("anthropic") : DEFAULT_PROVIDER_MODELS.anthropic,
147
- apiKey: anthropicApiKey
148
- };
152
+ return { provider: "anthropic", model: anthropicModel, apiKey: anthropicApiKey };
153
+ }
154
+ if (this.readEnvValue("CLAWVAULT_CLAUDE_AUTH")) {
155
+ const oauthToken = await resolveClaudeOAuthToken();
156
+ if (oauthToken) {
157
+ return { provider: "anthropic", model: anthropicModel, apiKey: oauthToken, isOAuth: true };
158
+ }
149
159
  }
150
160
  const openAiApiKey = this.readEnvValue("OPENAI_API_KEY");
151
161
  if (openAiApiKey) {
@@ -215,6 +225,17 @@ var Compressor = class {
215
225
  "- Confidence c reflects extraction certainty, not importance.",
216
226
  "- Preserve source tags when present (e.g., [main], [telegram-dm], [discord], [telegram-group]).",
217
227
  "",
228
+ "PREFERENCE & PERSONAL CONTEXT EXTRACTION (critical for personalization):",
229
+ "- Emit [preference] for ANY personal detail that reveals tastes, habits, equipment, or context:",
230
+ ' * Explicit: "I prefer X", "I like Y", "I always use Z"',
231
+ ' * Ownership: "my Sony A7R IV", "I have a...", "I use...", "I own..."',
232
+ ' * Habits/routines: "I usually...", "every morning I...", "I tend to..."',
233
+ " * Interests: topics the user is enthusiastic about, hobbies mentioned in passing",
234
+ " * Constraints: dietary restrictions, allergies, phobias, limitations",
235
+ ` * Goals: "I'm trying to...", "I want to learn..."`,
236
+ "- These are HIGH VALUE observations (i >= 0.60) \u2014 they enable personalized responses.",
237
+ "- When in doubt between [preference] and [task], choose [preference] if it describes a lasting trait.",
238
+ "",
218
239
  "TASK EXTRACTION (required):",
219
240
  `- Emit [todo] for explicit TODO phrasing: "TODO:", "we need to", "don't forget", "remember to", "make sure to".`,
220
241
  `- Emit [task] for commitments/action intent: "I'll", "I will", "let me", "going to", "plan to", "should".`,
@@ -293,19 +314,35 @@ var Compressor = class {
293
314
  if (!backend.apiKey) {
294
315
  return "";
295
316
  }
317
+ const isOAuth = backend.isOAuth || backend.apiKey.includes("sk-ant-oat");
318
+ const headers = isOAuth ? {
319
+ "content-type": "application/json",
320
+ "authorization": `Bearer ${backend.apiKey}`,
321
+ "anthropic-version": "2023-06-01",
322
+ "anthropic-beta": "claude-code-20250219,oauth-2025-04-20",
323
+ "x-app": "cli",
324
+ "user-agent": "claude-cli/1.0.0 (external, cli)"
325
+ } : {
326
+ "content-type": "application/json",
327
+ "x-api-key": backend.apiKey,
328
+ "anthropic-version": "2023-06-01"
329
+ };
330
+ const body = isOAuth ? {
331
+ model: backend.model,
332
+ temperature: 0.1,
333
+ max_tokens: 1400,
334
+ system: [{ type: "text", text: "You are Claude Code, Anthropic's official CLI for Claude." }],
335
+ messages: [{ role: "user", content: prompt }]
336
+ } : {
337
+ model: backend.model,
338
+ temperature: 0.1,
339
+ max_tokens: 1400,
340
+ messages: [{ role: "user", content: prompt }]
341
+ };
296
342
  const response = await this.fetchImpl("https://api.anthropic.com/v1/messages", {
297
343
  method: "POST",
298
- headers: {
299
- "content-type": "application/json",
300
- "x-api-key": backend.apiKey,
301
- "anthropic-version": "2023-06-01"
302
- },
303
- body: JSON.stringify({
304
- model: backend.model,
305
- temperature: 0.1,
306
- max_tokens: 1400,
307
- messages: [{ role: "user", content: prompt }]
308
- })
344
+ headers,
345
+ body: JSON.stringify(body)
309
346
  });
310
347
  if (!response.ok) {
311
348
  throw new Error(`Anthropic request failed (${response.status})`);
@@ -0,0 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ export {
9
+ __require
10
+ };
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  listTasks,
3
3
  slugify
4
- } from "./chunk-QWQ3TIKS.js";
4
+ } from "./chunk-N2AXRYLC.js";
5
5
  import {
6
6
  loadSchemaTemplateDefinition,
7
7
  renderDocumentFromTemplate
8
- } from "./chunk-MFAWT5O5.js";
8
+ } from "./chunk-LYHGEHXG.js";
9
9
 
10
10
  // src/lib/project-utils.ts
11
11
  import * as fs from "fs";