clawvault 2.4.4 → 2.4.5

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/bin/clawvault.js +4 -0
  2. package/bin/command-registration.test.js +13 -1
  3. package/bin/help-contract.test.js +2 -0
  4. package/bin/register-config-commands.js +153 -0
  5. package/bin/register-config-route-commands.test.js +114 -0
  6. package/bin/register-resilience-commands.js +37 -2
  7. package/bin/register-resilience-commands.test.js +81 -0
  8. package/bin/register-route-commands.js +114 -0
  9. package/bin/test-helpers/cli-command-fixtures.js +10 -0
  10. package/dist/{chunk-XDCFXFGH.js → chunk-22WE3J4F.js} +1 -1
  11. package/dist/chunk-3PJIGGWV.js +49 -0
  12. package/dist/{chunk-GBIDDDSL.js → chunk-4JJL47IJ.js} +1 -1
  13. package/dist/{chunk-FDJIZKCW.js → chunk-6B3JWM7J.js} +12 -48
  14. package/dist/{chunk-SNEMCQP7.js → chunk-B3SMJZIZ.js} +1 -1
  15. package/dist/{chunk-MZZJLQNQ.js → chunk-F55HGNU4.js} +6 -0
  16. package/dist/{chunk-BMOQI62Q.js → chunk-HNMFXFYP.js} +5 -3
  17. package/dist/chunk-OIWVQYQF.js +284 -0
  18. package/dist/{chunk-FEFPBHH4.js → chunk-RXEIQ3KQ.js} +452 -22
  19. package/dist/{chunk-DHJPXGC7.js → chunk-U2ONVV7N.js} +1 -1
  20. package/dist/{chunk-IFTEGE4D.js → chunk-YIRWDQKA.js} +4 -2
  21. package/dist/commands/checkpoint.js +1 -1
  22. package/dist/commands/context.js +4 -3
  23. package/dist/commands/doctor.js +3 -2
  24. package/dist/commands/observe.js +3 -2
  25. package/dist/commands/rebuild.js +3 -2
  26. package/dist/commands/recover.d.ts +13 -1
  27. package/dist/commands/recover.js +10 -2
  28. package/dist/commands/replay.js +3 -2
  29. package/dist/commands/setup.js +3 -2
  30. package/dist/commands/sleep.js +5 -4
  31. package/dist/commands/status.js +3 -2
  32. package/dist/commands/wake.js +5 -4
  33. package/dist/index.d.ts +27 -1
  34. package/dist/index.js +36 -14
  35. package/package.json +1 -1
  36. package/dist/chunk-IWYZAXKJ.js +0 -146
@@ -1,10 +1,18 @@
1
1
  import {
2
+ checkRecoveryStatus,
3
+ formatCheckpointList,
4
+ formatRecoveryCheckStatus,
2
5
  formatRecoveryInfo,
6
+ listCheckpoints,
3
7
  recover
4
- } from "../chunk-IWYZAXKJ.js";
8
+ } from "../chunk-OIWVQYQF.js";
5
9
  import "../chunk-7ZRP733D.js";
6
- import "../chunk-MZZJLQNQ.js";
10
+ import "../chunk-F55HGNU4.js";
7
11
  export {
12
+ checkRecoveryStatus,
13
+ formatCheckpointList,
14
+ formatRecoveryCheckStatus,
8
15
  formatRecoveryInfo,
16
+ listCheckpoints,
9
17
  recover
10
18
  };
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  registerReplayCommand,
3
3
  replayCommand
4
- } from "../chunk-GBIDDDSL.js";
4
+ } from "../chunk-4JJL47IJ.js";
5
5
  import "../chunk-AHGUJG76.js";
6
- import "../chunk-FEFPBHH4.js";
6
+ import "../chunk-RXEIQ3KQ.js";
7
7
  import "../chunk-QALB2V3E.js";
8
8
  import "../chunk-MXSSG3QU.js";
9
9
  import "../chunk-DEFBIVQ3.js";
10
+ import "../chunk-3PJIGGWV.js";
10
11
  import "../chunk-FHFUXL6G.js";
11
12
  import "../chunk-NAMFB7ZA.js";
12
13
  export {
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  setupCommand
3
- } from "../chunk-IFTEGE4D.js";
4
- import "../chunk-FDJIZKCW.js";
3
+ } from "../chunk-YIRWDQKA.js";
4
+ import "../chunk-6B3JWM7J.js";
5
+ import "../chunk-3PJIGGWV.js";
5
6
  export {
6
7
  setupCommand
7
8
  };
@@ -6,18 +6,19 @@ import {
6
6
  } from "../chunk-P5EPF6MB.js";
7
7
  import {
8
8
  Observer
9
- } from "../chunk-FEFPBHH4.js";
9
+ } from "../chunk-RXEIQ3KQ.js";
10
10
  import "../chunk-QALB2V3E.js";
11
11
  import "../chunk-DEFBIVQ3.js";
12
12
  import {
13
13
  clearDirtyFlag
14
- } from "../chunk-MZZJLQNQ.js";
14
+ } from "../chunk-F55HGNU4.js";
15
15
  import {
16
16
  ClawVault
17
- } from "../chunk-BMOQI62Q.js";
17
+ } from "../chunk-HNMFXFYP.js";
18
18
  import {
19
19
  qmdUpdate
20
- } from "../chunk-FDJIZKCW.js";
20
+ } from "../chunk-6B3JWM7J.js";
21
+ import "../chunk-3PJIGGWV.js";
21
22
  import "../chunk-ZZA73MFY.js";
22
23
  import "../chunk-FHFUXL6G.js";
23
24
  import "../chunk-NAMFB7ZA.js";
@@ -7,11 +7,12 @@ import {
7
7
  } from "../chunk-7ZRP733D.js";
8
8
  import {
9
9
  ClawVault
10
- } from "../chunk-BMOQI62Q.js";
10
+ } from "../chunk-HNMFXFYP.js";
11
11
  import {
12
12
  QmdUnavailableError,
13
13
  hasQmd
14
- } from "../chunk-FDJIZKCW.js";
14
+ } from "../chunk-6B3JWM7J.js";
15
+ import "../chunk-3PJIGGWV.js";
15
16
  import {
16
17
  loadMemoryGraphIndex
17
18
  } from "../chunk-ZZA73MFY.js";
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  recover
3
- } from "../chunk-IWYZAXKJ.js";
3
+ } from "../chunk-OIWVQYQF.js";
4
4
  import "../chunk-7ZRP733D.js";
5
5
  import {
6
6
  clearDirtyFlag
7
- } from "../chunk-MZZJLQNQ.js";
7
+ } from "../chunk-F55HGNU4.js";
8
8
  import {
9
9
  ClawVault
10
- } from "../chunk-BMOQI62Q.js";
11
- import "../chunk-FDJIZKCW.js";
10
+ } from "../chunk-HNMFXFYP.js";
11
+ import "../chunk-6B3JWM7J.js";
12
+ import "../chunk-3PJIGGWV.js";
12
13
  import "../chunk-ZZA73MFY.js";
13
14
  import {
14
15
  parseObservationMarkdown
package/dist/index.d.ts CHANGED
@@ -288,6 +288,32 @@ declare function extractWikiLinks(content: string): string[];
288
288
  */
289
289
  declare function extractTags(content: string): string[];
290
290
 
291
+ declare const OBSERVE_PROVIDERS: readonly ["anthropic", "openai", "gemini"];
292
+ declare const THEMES: readonly ["neural", "minimal", "none"];
293
+ declare const CONTEXT_PROFILES: readonly ["default", "planning", "incident", "handoff", "auto"];
294
+ type ObserveProvider = (typeof OBSERVE_PROVIDERS)[number];
295
+ type Theme = (typeof THEMES)[number];
296
+ type ContextProfile = (typeof CONTEXT_PROFILES)[number];
297
+ type ManagedConfigKey = 'name' | 'categories' | 'theme' | 'observe.model' | 'observe.provider' | 'context.maxResults' | 'context.defaultProfile' | 'graph.maxHops';
298
+ interface RouteRule {
299
+ pattern: string;
300
+ target: string;
301
+ priority: number;
302
+ }
303
+ declare const SUPPORTED_CONFIG_KEYS: ManagedConfigKey[];
304
+ declare function listConfig(vaultPath: string): Record<string, unknown>;
305
+ declare function getConfigValue(vaultPath: string, key: ManagedConfigKey): unknown;
306
+ declare function setConfigValue(vaultPath: string, key: ManagedConfigKey, value: unknown): {
307
+ value: unknown;
308
+ config: Record<string, unknown>;
309
+ };
310
+ declare function resetConfig(vaultPath: string): Record<string, unknown>;
311
+ declare function listRouteRules(vaultPath: string): RouteRule[];
312
+ declare function addRouteRule(vaultPath: string, pattern: string, target: string): RouteRule;
313
+ declare function removeRouteRule(vaultPath: string, pattern: string): boolean;
314
+ declare function matchRouteRule(text: string, routes: RouteRule[]): RouteRule | null;
315
+ declare function testRouteRule(vaultPath: string, text: string): RouteRule | null;
316
+
291
317
  declare const MEMORY_GRAPH_SCHEMA_VERSION = 1;
292
318
  type NodeCategory = 'note' | 'daily' | 'observation' | 'handoff' | 'decision' | 'lesson' | 'project' | 'person' | 'commitment' | 'tag' | 'unresolved';
293
319
  type MemoryGraphNodeType = NodeCategory;
@@ -597,4 +623,4 @@ declare function runReflection(options: ReflectOptions): Promise<ReflectResult>;
597
623
  declare const VERSION: string;
598
624
  declare function registerCommanderCommands(program: Command): Command;
599
625
 
600
- export { type ArchiveObservationsOptions, type ArchiveObservationsResult, Category, ClawVault, Compressor, type CompressorOptions, Document, HandoffDocument, MEMORY_GRAPH_SCHEMA_VERSION, type MemoryGraph, type MemoryGraphEdge, type MemoryGraphEdgeType, type MemoryGraphIndex, type MemoryGraphNode, type MemoryGraphNodeType, type MemoryGraphStats, MemoryType, Observer, type ObserverCompressor, type ObserverOptions, type ObserverReflector, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdUnavailableError, type ReflectOptions, type ReflectResult, Reflector, type ReflectorOptions, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, type TransitionEvent, VERSION, VaultConfig, appendTransition, archiveObservations, buildOrUpdateMemoryGraphIndex, buildTransitionEvent, countBlockedTransitions, createVault, extractTags, extractWikiLinks, findVault, formatTransitionsTable, getMemoryGraph, hasQmd, isRegression, loadMemoryGraphIndex, parseSessionFile, qmdEmbed, qmdUpdate, queryTransitions, readAllTransitions, registerCommanderCommands, runReflection };
626
+ export { type ArchiveObservationsOptions, type ArchiveObservationsResult, Category, ClawVault, Compressor, type CompressorOptions, type ContextProfile as ConfigDefaultProfile, Document, HandoffDocument, MEMORY_GRAPH_SCHEMA_VERSION, type ManagedConfigKey, type MemoryGraph, type MemoryGraphEdge, type MemoryGraphEdgeType, type MemoryGraphIndex, type MemoryGraphNode, type MemoryGraphNodeType, type MemoryGraphStats, MemoryType, type ObserveProvider, Observer, type ObserverCompressor, type ObserverOptions, type ObserverReflector, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdUnavailableError, type ReflectOptions, type ReflectResult, Reflector, type ReflectorOptions, type RouteRule, SUPPORTED_CONFIG_KEYS, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, type Theme, type TransitionEvent, VERSION, VaultConfig, addRouteRule, appendTransition, archiveObservations, buildOrUpdateMemoryGraphIndex, buildTransitionEvent, countBlockedTransitions, createVault, extractTags, extractWikiLinks, findVault, formatTransitionsTable, getConfigValue, getMemoryGraph, hasQmd, isRegression, listConfig, listRouteRules, loadMemoryGraphIndex, matchRouteRule, parseSessionFile, qmdEmbed, qmdUpdate, queryTransitions, readAllTransitions, registerCommanderCommands, removeRouteRule, resetConfig, runReflection, setConfigValue, testRouteRule };
package/dist/index.js CHANGED
@@ -55,7 +55,7 @@ import {
55
55
  import {
56
56
  registerReplayCommand,
57
57
  replayCommand
58
- } from "./chunk-GBIDDDSL.js";
58
+ } from "./chunk-4JJL47IJ.js";
59
59
  import {
60
60
  buildSessionRecap,
61
61
  formatSessionRecapMarkdown,
@@ -63,7 +63,7 @@ import {
63
63
  } from "./chunk-ZKGY7WTT.js";
64
64
  import {
65
65
  setupCommand
66
- } from "./chunk-IFTEGE4D.js";
66
+ } from "./chunk-YIRWDQKA.js";
67
67
  import {
68
68
  runReflection
69
69
  } from "./chunk-AHGUJG76.js";
@@ -80,7 +80,7 @@ import {
80
80
  SessionWatcher,
81
81
  observeCommand,
82
82
  registerObserveCommand
83
- } from "./chunk-SNEMCQP7.js";
83
+ } from "./chunk-B3SMJZIZ.js";
84
84
  import "./chunk-HRLWZGMA.js";
85
85
  import {
86
86
  parseSessionFile
@@ -88,12 +88,22 @@ import {
88
88
  import {
89
89
  rebuildCommand,
90
90
  registerRebuildCommand
91
- } from "./chunk-DHJPXGC7.js";
91
+ } from "./chunk-U2ONVV7N.js";
92
92
  import {
93
93
  Compressor,
94
94
  Observer,
95
- Reflector
96
- } from "./chunk-FEFPBHH4.js";
95
+ Reflector,
96
+ SUPPORTED_CONFIG_KEYS,
97
+ addRouteRule,
98
+ getConfigValue,
99
+ listConfig,
100
+ listRouteRules,
101
+ matchRouteRule,
102
+ removeRouteRule,
103
+ resetConfig,
104
+ setConfigValue,
105
+ testRouteRule
106
+ } from "./chunk-RXEIQ3KQ.js";
97
107
  import {
98
108
  archiveCommand,
99
109
  registerArchiveCommand
@@ -120,27 +130,29 @@ import {
120
130
  normalizeContextProfileInput,
121
131
  registerContextCommand,
122
132
  resolveContextProfile
123
- } from "./chunk-XDCFXFGH.js";
133
+ } from "./chunk-22WE3J4F.js";
124
134
  import {
125
135
  ClawVault,
126
136
  createVault,
127
137
  findVault
128
- } from "./chunk-BMOQI62Q.js";
138
+ } from "./chunk-HNMFXFYP.js";
129
139
  import {
130
- DEFAULT_CATEGORIES,
131
- DEFAULT_CONFIG,
132
- MEMORY_TYPES,
133
140
  QMD_INSTALL_COMMAND,
134
141
  QMD_INSTALL_URL,
135
142
  QmdUnavailableError,
136
143
  SearchEngine,
137
- TYPE_TO_CATEGORY,
138
144
  extractTags,
139
145
  extractWikiLinks,
140
146
  hasQmd,
141
147
  qmdEmbed,
142
148
  qmdUpdate
143
- } from "./chunk-FDJIZKCW.js";
149
+ } from "./chunk-6B3JWM7J.js";
150
+ import {
151
+ DEFAULT_CATEGORIES,
152
+ DEFAULT_CONFIG,
153
+ MEMORY_TYPES,
154
+ TYPE_TO_CATEGORY
155
+ } from "./chunk-3PJIGGWV.js";
144
156
  import "./chunk-L3DJ36BZ.js";
145
157
  import {
146
158
  MEMORY_GRAPH_SCHEMA_VERSION,
@@ -184,10 +196,12 @@ export {
184
196
  QMD_INSTALL_URL,
185
197
  QmdUnavailableError,
186
198
  Reflector,
199
+ SUPPORTED_CONFIG_KEYS,
187
200
  SearchEngine,
188
201
  SessionWatcher,
189
202
  TYPE_TO_CATEGORY,
190
203
  VERSION,
204
+ addRouteRule,
191
205
  appendTransition,
192
206
  archiveCommand,
193
207
  archiveObservations,
@@ -217,6 +231,7 @@ export {
217
231
  formatSessionRecapMarkdown,
218
232
  formatTransitionsTable,
219
233
  generateVaultManifest,
234
+ getConfigValue,
220
235
  getMemoryGraph,
221
236
  getOnlinePeers,
222
237
  getTailscaleStatus,
@@ -228,7 +243,10 @@ export {
228
243
  hasTailscale,
229
244
  inferContextProfile,
230
245
  isRegression,
246
+ listConfig,
247
+ listRouteRules,
231
248
  loadMemoryGraphIndex,
249
+ matchRouteRule,
232
250
  migrateObservations,
233
251
  migrateObservationsCommand,
234
252
  normalizeContextProfileInput,
@@ -255,14 +273,17 @@ export {
255
273
  registerTailscaleServeCommand,
256
274
  registerTailscaleStatusCommand,
257
275
  registerTailscaleSyncCommand,
276
+ removeRouteRule,
258
277
  renderTemplate,
259
278
  replayCommand,
279
+ resetConfig,
260
280
  resolveContextProfile,
261
281
  resolvePeerIP,
262
282
  resolveVaultPath,
263
283
  runReflection,
264
284
  serveVault,
265
285
  sessionRecapCommand,
286
+ setConfigValue,
266
287
  setupCommand,
267
288
  stopTailscaleServe,
268
289
  syncBdCommand,
@@ -270,5 +291,6 @@ export {
270
291
  tailscaleDiscoverCommand,
271
292
  tailscaleServeCommand,
272
293
  tailscaleStatusCommand,
273
- tailscaleSyncCommand
294
+ tailscaleSyncCommand,
295
+ testRouteRule
274
296
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawvault",
3
- "version": "2.4.4",
3
+ "version": "2.4.5",
4
4
  "description": "Structured memory system for AI agents — typed storage, knowledge graph, context profiles, canvas dashboards, neural graph themes, and Obsidian-native task views. An elephant never forgets. 🐘",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -1,146 +0,0 @@
1
- import {
2
- formatAge
3
- } from "./chunk-7ZRP733D.js";
4
- import {
5
- checkDirtyDeath,
6
- clearDirtyFlag
7
- } from "./chunk-MZZJLQNQ.js";
8
-
9
- // src/commands/recover.ts
10
- import * as fs from "fs";
11
- import * as path from "path";
12
- async function recover(vaultPath, options = {}) {
13
- const { clearFlag = false } = options;
14
- const { died, checkpoint, deathTime } = await checkDirtyDeath(vaultPath);
15
- if (!died) {
16
- return {
17
- died: false,
18
- deathTime: null,
19
- checkpoint: null,
20
- handoffPath: null,
21
- handoffContent: null,
22
- recoveryMessage: "No context death detected. Clean startup."
23
- };
24
- }
25
- const handoffsDir = path.join(vaultPath, "handoffs");
26
- let handoffPath = null;
27
- let handoffContent = null;
28
- if (fs.existsSync(handoffsDir)) {
29
- const files = fs.readdirSync(handoffsDir).filter((f) => f.startsWith("handoff-") && f.endsWith(".md")).sort().reverse();
30
- if (files.length > 0) {
31
- handoffPath = path.join(handoffsDir, files[0]);
32
- handoffContent = fs.readFileSync(handoffPath, "utf-8");
33
- }
34
- }
35
- let message = "\u26A0\uFE0F **CONTEXT DEATH DETECTED**\n\n";
36
- message += `Your previous session died at ${deathTime}.
37
-
38
- `;
39
- if (checkpoint) {
40
- message += "**Last known state:**\n";
41
- if (checkpoint.workingOn) {
42
- message += `- Working on: ${checkpoint.workingOn}
43
- `;
44
- }
45
- if (checkpoint.focus) {
46
- message += `- Focus: ${checkpoint.focus}
47
- `;
48
- }
49
- if (checkpoint.blocked) {
50
- message += `- Blocked: ${checkpoint.blocked}
51
- `;
52
- }
53
- message += "\n";
54
- }
55
- if (handoffPath) {
56
- message += `**Last handoff:** ${path.basename(handoffPath)}
57
- `;
58
- message += "Review and resume from where you left off.\n";
59
- } else {
60
- message += "**No handoff found.** You may have lost context.\n";
61
- }
62
- if (clearFlag) {
63
- await clearDirtyFlag(vaultPath);
64
- }
65
- return {
66
- died: true,
67
- deathTime,
68
- checkpoint,
69
- handoffPath,
70
- handoffContent,
71
- recoveryMessage: message
72
- };
73
- }
74
- function formatRecoveryInfo(info, options = {}) {
75
- const { verbose = false } = options;
76
- if (!info.died) {
77
- return "\u2713 Clean startup - no context death detected.";
78
- }
79
- let output = "\n\u26A0\uFE0F CONTEXT DEATH DETECTED\n";
80
- output += "\u2550".repeat(40) + "\n\n";
81
- output += `Death time: ${info.deathTime}
82
- `;
83
- if (info.checkpoint?.timestamp) {
84
- const age = formatAge(Date.now() - new Date(info.checkpoint.timestamp).getTime());
85
- output += `Checkpoint: ${info.checkpoint.timestamp} (${age} ago)
86
- `;
87
- }
88
- output += "\n";
89
- if (info.checkpoint) {
90
- output += "Last checkpoint:\n";
91
- if (info.checkpoint.workingOn) {
92
- output += ` \u2022 Working on: ${info.checkpoint.workingOn}
93
- `;
94
- }
95
- if (info.checkpoint.focus) {
96
- output += ` \u2022 Focus: ${info.checkpoint.focus}
97
- `;
98
- }
99
- if (info.checkpoint.blocked) {
100
- output += ` \u2022 Blocked: ${info.checkpoint.blocked}
101
- `;
102
- }
103
- if (info.checkpoint.sessionKey || info.checkpoint.model || info.checkpoint.tokenEstimate !== void 0) {
104
- output += " \u2022 Session:\n";
105
- if (info.checkpoint.sessionKey) {
106
- output += ` - Key: ${info.checkpoint.sessionKey}
107
- `;
108
- }
109
- if (info.checkpoint.model) {
110
- output += ` - Model: ${info.checkpoint.model}
111
- `;
112
- }
113
- if (info.checkpoint.tokenEstimate !== void 0) {
114
- output += ` - Token estimate: ${info.checkpoint.tokenEstimate}
115
- `;
116
- }
117
- }
118
- output += "\n";
119
- } else {
120
- output += "No checkpoint data found.\n\n";
121
- }
122
- if (info.handoffPath) {
123
- output += `Last handoff: ${path.basename(info.handoffPath)}
124
- `;
125
- } else {
126
- output += "No handoff found - context may be lost.\n";
127
- }
128
- if (verbose) {
129
- if (info.checkpoint) {
130
- output += "\nCheckpoint JSON:\n";
131
- output += JSON.stringify(info.checkpoint, null, 2) + "\n";
132
- }
133
- if (info.handoffContent) {
134
- output += "\nHandoff content:\n";
135
- output += info.handoffContent.trim() + "\n";
136
- }
137
- }
138
- output += "\n" + "\u2550".repeat(40) + "\n";
139
- output += "Run `clawvault recap` to see full context.\n";
140
- return output;
141
- }
142
-
143
- export {
144
- recover,
145
- formatRecoveryInfo
146
- };