clawvault 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +54 -14
  2. package/bin/clawvault.js +0 -2
  3. package/bin/command-registration.test.js +13 -1
  4. package/bin/help-contract.test.js +14 -0
  5. package/bin/register-core-commands.js +88 -0
  6. package/bin/register-core-commands.test.js +80 -0
  7. package/bin/register-maintenance-commands.js +57 -6
  8. package/bin/register-query-commands.js +10 -28
  9. package/bin/test-helpers/cli-command-fixtures.js +1 -0
  10. package/dist/chunk-2PKBIKDH.js +130 -0
  11. package/dist/{chunk-2JQ3O2YL.js → chunk-5EFSWZO6.js} +3 -3
  12. package/dist/{chunk-77Q5CSPJ.js → chunk-7SWP5FKU.js} +33 -701
  13. package/dist/{chunk-URXDAUVH.js → chunk-AXSJIFOJ.js} +174 -1
  14. package/dist/{chunk-23YDQ3QU.js → chunk-BLQXXX7Q.js} +6 -6
  15. package/dist/chunk-CSHO3PJB.js +684 -0
  16. package/dist/{chunk-SLXOR3CC.js → chunk-DOIUYIXV.js} +2 -2
  17. package/dist/{chunk-NCKFNBHJ.js → chunk-DVOUSOR3.js} +79 -5
  18. package/dist/{chunk-CLJTREDS.js → chunk-ECGJYWNA.js} +193 -41
  19. package/dist/{chunk-BUEW6IIK.js → chunk-EL6UBSX5.js} +5 -5
  20. package/dist/{chunk-6FH3IULF.js → chunk-FZ5I2NF7.js} +1 -1
  21. package/dist/{chunk-ZN54U2OZ.js → chunk-GFCHWMGD.js} +3 -3
  22. package/dist/{chunk-GNJL4YGR.js → chunk-GJO3CFUN.js} +30 -6
  23. package/dist/chunk-H3JZIB5O.js +322 -0
  24. package/dist/chunk-HEHO7SMV.js +51 -0
  25. package/dist/{chunk-STCQGCEQ.js → chunk-HGDDW24U.js} +3 -3
  26. package/dist/chunk-J3YUXVID.js +907 -0
  27. package/dist/{chunk-Y6VJKXGL.js → chunk-KCYWJDDW.js} +1 -1
  28. package/dist/{chunk-W4SPAEE7.js → chunk-OFOCU2V4.js} +5 -4
  29. package/dist/chunk-PTWPPVC7.js +972 -0
  30. package/dist/{chunk-QSHD36LH.js → chunk-QFWERBDP.js} +2 -2
  31. package/dist/{chunk-QSRRMEYM.js → chunk-S7N7HI5E.js} +1 -1
  32. package/dist/{chunk-PBACDKKP.js → chunk-T7E764W3.js} +3 -3
  33. package/dist/chunk-TDWFBDAQ.js +1016 -0
  34. package/dist/{chunk-ESVS6K2B.js → chunk-TWMI3SNN.js} +6 -5
  35. package/dist/{chunk-2RAZ4ZFE.js → chunk-VBILES4B.js} +1 -1
  36. package/dist/{chunk-ESFLMDRB.js → chunk-VXAGOLDP.js} +3 -3
  37. package/dist/chunk-YCUVAOFC.js +158 -0
  38. package/dist/{chunk-SS4B7P7V.js → chunk-YIDV4VV2.js} +1 -1
  39. package/dist/chunk-ZKWPCBYT.js +600 -0
  40. package/dist/cli/index.js +24 -24
  41. package/dist/commands/archive.js +2 -2
  42. package/dist/commands/benchmark.d.ts +12 -0
  43. package/dist/commands/benchmark.js +12 -0
  44. package/dist/commands/context.js +6 -5
  45. package/dist/commands/doctor.d.ts +8 -3
  46. package/dist/commands/doctor.js +6 -20
  47. package/dist/commands/embed.js +5 -4
  48. package/dist/commands/entities.js +1 -1
  49. package/dist/commands/graph.js +2 -2
  50. package/dist/commands/inbox.d.ts +23 -0
  51. package/dist/commands/inbox.js +11 -0
  52. package/dist/commands/inject.d.ts +1 -1
  53. package/dist/commands/inject.js +3 -3
  54. package/dist/commands/link.js +6 -6
  55. package/dist/commands/maintain.d.ts +32 -0
  56. package/dist/commands/maintain.js +12 -0
  57. package/dist/commands/migrate-observations.js +2 -2
  58. package/dist/commands/observe.js +9 -8
  59. package/dist/commands/rebuild-embeddings.js +47 -16
  60. package/dist/commands/rebuild.js +7 -6
  61. package/dist/commands/reflect.js +5 -5
  62. package/dist/commands/replay.js +8 -7
  63. package/dist/commands/setup.js +3 -2
  64. package/dist/commands/sleep.d.ts +1 -1
  65. package/dist/commands/sleep.js +17 -15
  66. package/dist/commands/status.js +26 -24
  67. package/dist/commands/sync-bd.js +2 -2
  68. package/dist/commands/tailscale.js +2 -2
  69. package/dist/commands/wake.d.ts +1 -1
  70. package/dist/commands/wake.js +8 -7
  71. package/dist/index.d.ts +168 -16
  72. package/dist/index.js +271 -108
  73. package/dist/{inject-DYUrDqQO.d.ts → inject-DEb_jpLi.d.ts} +3 -1
  74. package/dist/lib/config.js +1 -1
  75. package/dist/{types-BbWJoC1c.d.ts → types-DslKvCaj.d.ts} +51 -1
  76. package/hooks/clawvault/HOOK.md +22 -5
  77. package/hooks/clawvault/handler.js +213 -78
  78. package/hooks/clawvault/handler.test.js +109 -43
  79. package/hooks/clawvault/integrity.js +112 -0
  80. package/hooks/clawvault/integrity.test.js +32 -0
  81. package/hooks/clawvault/openclaw.plugin.json +133 -15
  82. package/openclaw.plugin.json +126 -20
  83. package/package.json +2 -2
  84. package/bin/register-workgraph-commands.js +0 -1368
  85. package/dist/chunk-33VSQP4J.js +0 -37
  86. package/dist/chunk-4BQTQMJP.js +0 -93
  87. package/dist/chunk-EK6S23ZB.js +0 -469
  88. package/dist/chunk-GAOWA7GR.js +0 -501
  89. package/dist/chunk-GGA32J2R.js +0 -784
  90. package/dist/chunk-MM6QGW3P.js +0 -207
  91. package/dist/chunk-QVEERJSP.js +0 -152
  92. package/dist/chunk-U4O6C46S.js +0 -154
  93. package/dist/chunk-VSL7KY3M.js +0 -189
  94. package/dist/chunk-WMGIIABP.js +0 -15
  95. package/dist/commands/workgraph.d.ts +0 -124
  96. package/dist/commands/workgraph.js +0 -38
  97. package/dist/ledger-B7g7jhqG.d.ts +0 -44
  98. package/dist/registry-BR4326o0.d.ts +0 -30
  99. package/dist/store-CA-6sKCJ.d.ts +0 -34
  100. package/dist/thread-B9LhXNU0.d.ts +0 -41
  101. package/dist/workgraph/index.d.ts +0 -5
  102. package/dist/workgraph/index.js +0 -23
  103. package/dist/workgraph/ledger.d.ts +0 -2
  104. package/dist/workgraph/ledger.js +0 -25
  105. package/dist/workgraph/registry.d.ts +0 -2
  106. package/dist/workgraph/registry.js +0 -19
  107. package/dist/workgraph/store.d.ts +0 -2
  108. package/dist/workgraph/store.js +0 -25
  109. package/dist/workgraph/thread.d.ts +0 -2
  110. package/dist/workgraph/thread.js +0 -25
  111. package/dist/workgraph/types.d.ts +0 -54
  112. package/dist/workgraph/types.js +0 -7
@@ -21,10 +21,17 @@ var OBSERVER_COMPRESSION_PROVIDERS = [
21
21
  var THEMES = ["neural", "minimal", "none"];
22
22
  var CONTEXT_PROFILES = ["default", "planning", "incident", "handoff", "auto"];
23
23
  var FACT_EXTRACTION_MODES = ["off", "rule", "llm", "hybrid"];
24
+ var SEARCH_BACKENDS = ["in-process", "qmd"];
25
+ var SEARCH_EMBEDDING_PROVIDERS = ["none", "openai", "gemini", "ollama"];
26
+ var SEARCH_RERANK_PROVIDERS = ["none", "jina", "voyage", "siliconflow", "pinecone"];
27
+ var MODEL_TIERS = ["background", "default", "complex"];
24
28
  var SUPPORTED_CONFIG_KEYS = [
25
29
  "name",
26
30
  "categories",
27
31
  "theme",
32
+ "models.background",
33
+ "models.default",
34
+ "models.complex",
28
35
  "observe.model",
29
36
  "observe.provider",
30
37
  "observer.compression.provider",
@@ -37,7 +44,20 @@ var SUPPORTED_CONFIG_KEYS = [
37
44
  "graph.maxHops",
38
45
  "inject.maxResults",
39
46
  "inject.useLlm",
40
- "inject.scope"
47
+ "inject.scope",
48
+ "search.backend",
49
+ "search.qmdFallback",
50
+ "search.chunkSize",
51
+ "search.chunkOverlap",
52
+ "search.embeddings.provider",
53
+ "search.embeddings.model",
54
+ "search.embeddings.baseUrl",
55
+ "search.embeddings.apiKey",
56
+ "search.rerank.provider",
57
+ "search.rerank.model",
58
+ "search.rerank.endpoint",
59
+ "search.rerank.apiKey",
60
+ "search.rerank.weight"
41
61
  ];
42
62
  var DEFAULT_THEME = "none";
43
63
  var DEFAULT_OBSERVE_MODEL = "gemini-2.0-flash";
@@ -49,6 +69,13 @@ var DEFAULT_GRAPH_MAX_HOPS = 2;
49
69
  var DEFAULT_INJECT_MAX_RESULTS = 8;
50
70
  var DEFAULT_INJECT_USE_LLM = true;
51
71
  var DEFAULT_INJECT_SCOPE = ["global"];
72
+ var DEFAULT_SEARCH_BACKEND = "in-process";
73
+ var DEFAULT_SEARCH_QMD_FALLBACK = true;
74
+ var DEFAULT_SEARCH_CHUNK_SIZE = 700;
75
+ var DEFAULT_SEARCH_CHUNK_OVERLAP = 100;
76
+ var DEFAULT_SEARCH_EMBEDDINGS_PROVIDER = "none";
77
+ var DEFAULT_SEARCH_RERANK_PROVIDER = "none";
78
+ var DEFAULT_SEARCH_RERANK_WEIGHT = 0.6;
52
79
  function configPathFor(vaultPath) {
53
80
  return path.join(path.resolve(vaultPath), CONFIG_FILE);
54
81
  }
@@ -93,6 +120,18 @@ function asPositiveInteger(value) {
93
120
  }
94
121
  return null;
95
122
  }
123
+ function asFiniteNumber(value) {
124
+ if (typeof value === "number" && Number.isFinite(value)) {
125
+ return value;
126
+ }
127
+ if (typeof value === "string") {
128
+ const parsed = Number.parseFloat(value);
129
+ if (Number.isFinite(parsed)) {
130
+ return parsed;
131
+ }
132
+ }
133
+ return null;
134
+ }
96
135
  function asBoolean(value) {
97
136
  if (typeof value === "boolean") {
98
137
  return value;
@@ -123,6 +162,15 @@ function isContextProfile(value) {
123
162
  function isFactExtractionMode(value) {
124
163
  return typeof value === "string" && FACT_EXTRACTION_MODES.includes(value);
125
164
  }
165
+ function isSearchBackend(value) {
166
+ return typeof value === "string" && SEARCH_BACKENDS.includes(value);
167
+ }
168
+ function isSearchEmbeddingProvider(value) {
169
+ return typeof value === "string" && SEARCH_EMBEDDING_PROVIDERS.includes(value);
170
+ }
171
+ function isSearchRerankProvider(value) {
172
+ return typeof value === "string" && SEARCH_RERANK_PROVIDERS.includes(value);
173
+ }
126
174
  function normalizeRouteTarget(target) {
127
175
  const trimmed = target.trim().replace(/^\/+/, "").replace(/\/+$/, "");
128
176
  if (!trimmed) {
@@ -201,6 +249,7 @@ function withDefaults(vaultPath, config) {
201
249
  name: path.basename(resolvedPath),
202
250
  categories: [...DEFAULT_CATEGORIES],
203
251
  theme: DEFAULT_THEME,
252
+ models: {},
204
253
  observe: {
205
254
  model: DEFAULT_OBSERVE_MODEL,
206
255
  provider: DEFAULT_OBSERVE_PROVIDER
@@ -221,9 +270,30 @@ function withDefaults(vaultPath, config) {
221
270
  useLlm: DEFAULT_INJECT_USE_LLM,
222
271
  scope: [...DEFAULT_INJECT_SCOPE]
223
272
  },
273
+ search: {
274
+ backend: DEFAULT_SEARCH_BACKEND,
275
+ qmdFallback: DEFAULT_SEARCH_QMD_FALLBACK,
276
+ chunkSize: DEFAULT_SEARCH_CHUNK_SIZE,
277
+ chunkOverlap: DEFAULT_SEARCH_CHUNK_OVERLAP,
278
+ embeddings: {
279
+ provider: DEFAULT_SEARCH_EMBEDDINGS_PROVIDER
280
+ },
281
+ rerank: {
282
+ provider: DEFAULT_SEARCH_RERANK_PROVIDER,
283
+ weight: DEFAULT_SEARCH_RERANK_WEIGHT
284
+ }
285
+ },
224
286
  routes: []
225
287
  };
226
288
  const observeRecord = config.observe && typeof config.observe === "object" && !Array.isArray(config.observe) ? config.observe : {};
289
+ const modelsRecord = config.models && typeof config.models === "object" && !Array.isArray(config.models) ? config.models : {};
290
+ const normalizedModels = {};
291
+ for (const tier of MODEL_TIERS) {
292
+ const candidate = modelsRecord[tier];
293
+ if (typeof candidate === "string" && candidate.trim()) {
294
+ normalizedModels[tier] = candidate.trim();
295
+ }
296
+ }
227
297
  const contextRecord = config.context && typeof config.context === "object" && !Array.isArray(config.context) ? config.context : {};
228
298
  const observerRecord = config.observer && typeof config.observer === "object" && !Array.isArray(config.observer) ? config.observer : {};
229
299
  const compressionRecord = observerRecord.compression && typeof observerRecord.compression === "object" && !Array.isArray(observerRecord.compression) ? observerRecord.compression : {};
@@ -246,11 +316,15 @@ function withDefaults(vaultPath, config) {
246
316
  normalizedCompression.apiKey = compressionApiKey;
247
317
  }
248
318
  const injectRecord = config.inject && typeof config.inject === "object" && !Array.isArray(config.inject) ? config.inject : {};
319
+ const searchRecord = config.search && typeof config.search === "object" && !Array.isArray(config.search) ? config.search : {};
320
+ const searchEmbeddingsRecord = searchRecord.embeddings && typeof searchRecord.embeddings === "object" && !Array.isArray(searchRecord.embeddings) ? searchRecord.embeddings : {};
321
+ const searchRerankRecord = searchRecord.rerank && typeof searchRecord.rerank === "object" && !Array.isArray(searchRecord.rerank) ? searchRecord.rerank : {};
249
322
  return {
250
323
  ...config,
251
324
  name: typeof config.name === "string" && config.name.trim() ? config.name.trim() : defaults.name,
252
325
  categories: asStringArray(config.categories) ?? defaults.categories,
253
326
  theme: isTheme(config.theme) ? config.theme : defaults.theme,
327
+ models: normalizedModels,
254
328
  observe: {
255
329
  ...observeRecord,
256
330
  model: typeof observeRecord.model === "string" && observeRecord.model.trim() ? observeRecord.model.trim() : defaults.observe.model,
@@ -276,6 +350,32 @@ function withDefaults(vaultPath, config) {
276
350
  useLlm: asBoolean(injectRecord.useLlm) ?? defaults.inject.useLlm,
277
351
  scope: asStringArray(injectRecord.scope) ?? (typeof injectRecord.scope === "string" ? injectRecord.scope.split(",").map((entry) => entry.trim()).filter(Boolean) : null) ?? [...defaults.inject.scope]
278
352
  },
353
+ search: {
354
+ ...searchRecord,
355
+ backend: isSearchBackend(searchRecord.backend) ? searchRecord.backend : defaults.search.backend,
356
+ qmdFallback: asBoolean(searchRecord.qmdFallback) ?? defaults.search.qmdFallback,
357
+ chunkSize: asPositiveInteger(searchRecord.chunkSize) ?? defaults.search.chunkSize,
358
+ chunkOverlap: asPositiveInteger(searchRecord.chunkOverlap) ?? defaults.search.chunkOverlap,
359
+ embeddings: {
360
+ ...searchEmbeddingsRecord,
361
+ provider: isSearchEmbeddingProvider(searchEmbeddingsRecord.provider) ? searchEmbeddingsRecord.provider : defaults.search.embeddings.provider,
362
+ model: typeof searchEmbeddingsRecord.model === "string" && searchEmbeddingsRecord.model.trim() ? searchEmbeddingsRecord.model.trim() : void 0,
363
+ baseUrl: typeof searchEmbeddingsRecord.baseUrl === "string" && searchEmbeddingsRecord.baseUrl.trim() ? searchEmbeddingsRecord.baseUrl.trim() : void 0,
364
+ apiKey: typeof searchEmbeddingsRecord.apiKey === "string" && searchEmbeddingsRecord.apiKey.trim() ? searchEmbeddingsRecord.apiKey.trim() : void 0
365
+ },
366
+ rerank: {
367
+ ...searchRerankRecord,
368
+ provider: isSearchRerankProvider(searchRerankRecord.provider) ? searchRerankRecord.provider : defaults.search.rerank.provider,
369
+ model: typeof searchRerankRecord.model === "string" && searchRerankRecord.model.trim() ? searchRerankRecord.model.trim() : void 0,
370
+ endpoint: typeof searchRerankRecord.endpoint === "string" && searchRerankRecord.endpoint.trim() ? searchRerankRecord.endpoint.trim() : void 0,
371
+ apiKey: typeof searchRerankRecord.apiKey === "string" && searchRerankRecord.apiKey.trim() ? searchRerankRecord.apiKey.trim() : void 0,
372
+ weight: (() => {
373
+ const parsed = asFiniteNumber(searchRerankRecord.weight);
374
+ if (parsed === null) return defaults.search.rerank.weight;
375
+ return Math.max(0, Math.min(1, parsed));
376
+ })()
377
+ }
378
+ },
279
379
  routes: normalizeRoutes(config.routes)
280
380
  };
281
381
  }
@@ -309,6 +409,12 @@ function coerceManagedValue(key, value) {
309
409
  }
310
410
  return value;
311
411
  }
412
+ if (key === "models.background" || key === "models.default" || key === "models.complex") {
413
+ if (typeof value !== "string" || !value.trim()) {
414
+ throw new Error(`Config key "${key}" must be a non-empty string.`);
415
+ }
416
+ return value.trim();
417
+ }
312
418
  if (key === "observe.provider") {
313
419
  if (!isObserveProvider(value)) {
314
420
  throw new Error(`Config key "observe.provider" must be one of: ${OBSERVE_PROVIDERS.join(", ")}`);
@@ -394,6 +500,59 @@ function coerceManagedValue(key, value) {
394
500
  }
395
501
  return normalized;
396
502
  }
503
+ if (key === "search.backend") {
504
+ if (!isSearchBackend(value)) {
505
+ throw new Error(`Config key "search.backend" must be one of: ${SEARCH_BACKENDS.join(", ")}`);
506
+ }
507
+ return value;
508
+ }
509
+ if (key === "search.qmdFallback") {
510
+ const parsed = asBoolean(value);
511
+ if (parsed === null) {
512
+ throw new Error('Config key "search.qmdFallback" must be a boolean.');
513
+ }
514
+ return parsed;
515
+ }
516
+ if (key === "search.chunkSize" || key === "search.chunkOverlap") {
517
+ const parsed = asPositiveInteger(value);
518
+ if (parsed === null) {
519
+ throw new Error(`Config key "${key}" must be a positive integer.`);
520
+ }
521
+ return parsed;
522
+ }
523
+ if (key === "search.embeddings.provider") {
524
+ if (!isSearchEmbeddingProvider(value)) {
525
+ throw new Error(
526
+ `Config key "search.embeddings.provider" must be one of: ${SEARCH_EMBEDDING_PROVIDERS.join(", ")}`
527
+ );
528
+ }
529
+ return value;
530
+ }
531
+ if (key === "search.embeddings.model" || key === "search.embeddings.baseUrl" || key === "search.rerank.model" || key === "search.rerank.endpoint") {
532
+ if (typeof value !== "string" || !value.trim()) {
533
+ throw new Error(`Config key "${key}" must be a non-empty string.`);
534
+ }
535
+ return value.trim();
536
+ }
537
+ if (key === "search.embeddings.apiKey" || key === "search.rerank.apiKey") {
538
+ if (typeof value !== "string") {
539
+ throw new Error(`Config key "${key}" must be a string.`);
540
+ }
541
+ return value.trim();
542
+ }
543
+ if (key === "search.rerank.provider") {
544
+ if (!isSearchRerankProvider(value)) {
545
+ throw new Error(`Config key "search.rerank.provider" must be one of: ${SEARCH_RERANK_PROVIDERS.join(", ")}`);
546
+ }
547
+ return value;
548
+ }
549
+ if (key === "search.rerank.weight") {
550
+ const parsed = asFiniteNumber(value);
551
+ if (parsed === null || parsed < 0 || parsed > 1) {
552
+ throw new Error('Config key "search.rerank.weight" must be a number between 0 and 1.');
553
+ }
554
+ return parsed;
555
+ }
397
556
  throw new Error(`Unsupported config key: ${key}`);
398
557
  }
399
558
  function toComparablePattern(pattern) {
@@ -435,6 +594,7 @@ function resetConfig(vaultPath) {
435
594
  document.name = defaultName;
436
595
  document.categories = [...DEFAULT_CATEGORIES];
437
596
  document.theme = DEFAULT_THEME;
597
+ document.models = {};
438
598
  document.observe = {
439
599
  model: DEFAULT_OBSERVE_MODEL,
440
600
  provider: DEFAULT_OBSERVE_PROVIDER
@@ -457,6 +617,19 @@ function resetConfig(vaultPath) {
457
617
  useLlm: DEFAULT_INJECT_USE_LLM,
458
618
  scope: [...DEFAULT_INJECT_SCOPE]
459
619
  };
620
+ document.search = {
621
+ backend: DEFAULT_SEARCH_BACKEND,
622
+ qmdFallback: DEFAULT_SEARCH_QMD_FALLBACK,
623
+ chunkSize: DEFAULT_SEARCH_CHUNK_SIZE,
624
+ chunkOverlap: DEFAULT_SEARCH_CHUNK_OVERLAP,
625
+ embeddings: {
626
+ provider: DEFAULT_SEARCH_EMBEDDINGS_PROVIDER
627
+ },
628
+ rerank: {
629
+ provider: DEFAULT_SEARCH_RERANK_PROVIDER,
630
+ weight: DEFAULT_SEARCH_RERANK_WEIGHT
631
+ }
632
+ };
460
633
  document.routes = [];
461
634
  if (typeof document.lastUpdated === "string") {
462
635
  document.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
@@ -1,15 +1,15 @@
1
- import {
2
- parseSessionFile
3
- } from "./chunk-MW5C6ZQA.js";
4
1
  import {
5
2
  observeActiveSessions
6
- } from "./chunk-ESFLMDRB.js";
3
+ } from "./chunk-VXAGOLDP.js";
7
4
  import {
8
5
  Observer
9
- } from "./chunk-77Q5CSPJ.js";
6
+ } from "./chunk-7SWP5FKU.js";
10
7
  import {
11
8
  resolveVaultPath
12
- } from "./chunk-GNJL4YGR.js";
9
+ } from "./chunk-GJO3CFUN.js";
10
+ import {
11
+ parseSessionFile
12
+ } from "./chunk-MW5C6ZQA.js";
13
13
  import {
14
14
  getObservationPath
15
15
  } from "./chunk-Z2XBWN7A.js";