clawvault 3.1.0 → 3.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 (273) hide show
  1. package/README.md +422 -141
  2. package/bin/clawvault.js +10 -2
  3. package/bin/command-registration.test.js +3 -1
  4. package/bin/command-runtime.js +9 -1
  5. package/bin/register-core-commands.js +23 -28
  6. package/bin/register-maintenance-commands.js +39 -3
  7. package/bin/register-query-commands.js +58 -29
  8. package/bin/register-tailscale-commands.js +106 -0
  9. package/bin/register-task-commands.js +18 -1
  10. package/bin/register-task-commands.test.js +16 -0
  11. package/bin/register-vault-operations-commands.js +29 -1
  12. package/bin/register-workgraph-commands.js +451 -0
  13. package/dashboard/lib/graph-diff.js +104 -0
  14. package/dashboard/lib/graph-diff.test.js +75 -0
  15. package/dashboard/lib/vault-parser.js +556 -0
  16. package/dashboard/lib/vault-parser.test.js +254 -0
  17. package/dashboard/public/app.js +796 -0
  18. package/dashboard/public/index.html +52 -0
  19. package/dashboard/public/styles.css +221 -0
  20. package/dashboard/server.js +374 -0
  21. package/dist/{chunk-C7OK5WKP.js → chunk-2JQ3O2YL.js} +4 -4
  22. package/dist/{chunk-VR5NE7PZ.js → chunk-2RAZ4ZFE.js} +1 -1
  23. package/dist/{chunk-F2JEUD4J.js → chunk-4ITRXIVT.js} +5 -7
  24. package/dist/{chunk-GUKMRGM7.js → chunk-4OXMU5S2.js} +1 -1
  25. package/dist/chunk-5PJ4STIC.js +465 -0
  26. package/dist/{chunk-62YTUT6J.js → chunk-AZYOKJYC.js} +2 -2
  27. package/dist/chunk-BSJ6RIT7.js +447 -0
  28. package/dist/chunk-ECRZL5XR.js +50 -0
  29. package/dist/chunk-ERNE2FZ5.js +189 -0
  30. package/dist/{chunk-WAZ3NLWL.js → chunk-F55HGNU4.js} +0 -47
  31. package/dist/{chunk-VGLOTGAS.js → chunk-FAKNOB7Y.js} +2 -2
  32. package/dist/{chunk-QK3UCXWL.js → chunk-FHFUXL6G.js} +2 -2
  33. package/dist/chunk-GNJL4YGR.js +79 -0
  34. package/dist/chunk-HR4KN6S2.js +152 -0
  35. package/dist/{chunk-OZ7RIXTO.js → chunk-IIOU45CK.js} +1 -1
  36. package/dist/chunk-IJBFGPCS.js +33 -0
  37. package/dist/chunk-IVRIKYFE.js +520 -0
  38. package/dist/chunk-K7PNYS45.js +93 -0
  39. package/dist/chunk-MDIH26GC.js +183 -0
  40. package/dist/{chunk-LYHGEHXG.js → chunk-MFAWT5O5.js} +0 -1
  41. package/dist/{chunk-H34S76MB.js → chunk-MNPUYCHQ.js} +6 -6
  42. package/dist/chunk-NTOPJI7W.js +207 -0
  43. package/dist/{chunk-QBLMXKF2.js → chunk-OIWVQYQF.js} +1 -1
  44. package/dist/chunk-PG56HX5T.js +154 -0
  45. package/dist/{chunk-LNJA2UGL.js → chunk-PI4WMLMG.js} +7 -84
  46. package/dist/chunk-QMHPQYUV.js +363 -0
  47. package/dist/{chunk-H62BP7RI.js → chunk-QPDDIHXE.js} +209 -43
  48. package/dist/{chunk-N2AXRYLC.js → chunk-QWQ3TIKS.js} +1 -1
  49. package/dist/{chunk-3DHXQHYG.js → chunk-R2MIW5G7.js} +1 -1
  50. package/dist/{chunk-SJSFRIYS.js → chunk-S5OJEGFG.js} +2 -2
  51. package/dist/chunk-SS4B7P7V.js +99 -0
  52. package/dist/chunk-TIGW564L.js +628 -0
  53. package/dist/chunk-U67V476Y.js +35 -0
  54. package/dist/{chunk-JY6FYXIT.js → chunk-UCQAOZHW.js} +6 -11
  55. package/dist/{chunk-ITPEXLHA.js → chunk-URXDAUVH.js} +24 -5
  56. package/dist/chunk-WIOLLGAD.js +190 -0
  57. package/dist/{chunk-3WRJEKN4.js → chunk-WJVWINEM.js} +72 -8
  58. package/dist/chunk-WMGIIABP.js +15 -0
  59. package/dist/{chunk-33UGEQRT.js → chunk-X3SPPUFG.js} +151 -64
  60. package/dist/{chunk-3NSBOUT3.js → chunk-Y3TIJEBP.js} +314 -79
  61. package/dist/chunk-Y6VJKXGL.js +373 -0
  62. package/dist/{chunk-LI4O6NVK.js → chunk-YDWHS4LJ.js} +49 -9
  63. package/dist/{chunk-U55BGUAU.js → chunk-YNIPYN4F.js} +5 -5
  64. package/dist/chunk-YXQCA6B7.js +226 -0
  65. package/dist/cli/index.js +26 -22
  66. package/dist/commands/archive.js +3 -3
  67. package/dist/commands/backlog.js +3 -3
  68. package/dist/commands/blocked.js +3 -3
  69. package/dist/commands/canvas.d.ts +15 -0
  70. package/dist/commands/canvas.js +200 -0
  71. package/dist/commands/checkpoint.js +2 -2
  72. package/dist/commands/compat.js +2 -2
  73. package/dist/commands/context.js +7 -5
  74. package/dist/commands/doctor.d.ts +11 -7
  75. package/dist/commands/doctor.js +16 -14
  76. package/dist/commands/embed.js +5 -6
  77. package/dist/commands/entities.js +2 -2
  78. package/dist/commands/graph.js +3 -3
  79. package/dist/commands/inject.d.ts +1 -1
  80. package/dist/commands/inject.js +4 -5
  81. package/dist/commands/kanban.js +4 -4
  82. package/dist/commands/link.js +2 -2
  83. package/dist/commands/migrate-observations.js +4 -4
  84. package/dist/commands/observe.d.ts +0 -1
  85. package/dist/commands/observe.js +13 -12
  86. package/dist/commands/project.js +5 -5
  87. package/dist/commands/rebuild-embeddings.d.ts +21 -0
  88. package/dist/commands/rebuild-embeddings.js +91 -0
  89. package/dist/commands/rebuild.js +12 -11
  90. package/dist/commands/recover.js +3 -3
  91. package/dist/commands/reflect.js +6 -7
  92. package/dist/commands/repair-session.js +1 -1
  93. package/dist/commands/replay.js +14 -14
  94. package/dist/commands/session-recap.js +1 -1
  95. package/dist/commands/setup.d.ts +2 -89
  96. package/dist/commands/setup.js +3 -21
  97. package/dist/commands/shell-init.js +1 -1
  98. package/dist/commands/sleep.d.ts +1 -1
  99. package/dist/commands/sleep.js +18 -17
  100. package/dist/commands/status.d.ts +2 -0
  101. package/dist/commands/status.js +40 -30
  102. package/dist/commands/sync-bd.d.ts +10 -0
  103. package/dist/commands/sync-bd.js +10 -0
  104. package/dist/commands/tailscale.d.ts +52 -0
  105. package/dist/commands/tailscale.js +26 -0
  106. package/dist/commands/task.js +4 -4
  107. package/dist/commands/template.js +2 -2
  108. package/dist/commands/wake.d.ts +1 -1
  109. package/dist/commands/wake.js +11 -10
  110. package/dist/index.d.ts +334 -191
  111. package/dist/index.js +432 -108
  112. package/dist/{inject-Bzi5E-By.d.ts → inject-DYUrDqQO.d.ts} +3 -3
  113. package/dist/ledger-B7g7jhqG.d.ts +44 -0
  114. package/dist/lib/auto-linker.js +1 -1
  115. package/dist/lib/canvas-layout.d.ts +115 -0
  116. package/dist/lib/canvas-layout.js +35 -0
  117. package/dist/lib/config.d.ts +27 -3
  118. package/dist/lib/config.js +4 -2
  119. package/dist/lib/entity-index.js +1 -1
  120. package/dist/lib/project-utils.js +4 -4
  121. package/dist/lib/session-repair.js +1 -1
  122. package/dist/lib/session-utils.js +1 -1
  123. package/dist/lib/tailscale.d.ts +225 -0
  124. package/dist/lib/tailscale.js +50 -0
  125. package/dist/lib/task-utils.js +3 -3
  126. package/dist/lib/template-engine.js +1 -1
  127. package/dist/lib/webdav.d.ts +109 -0
  128. package/dist/lib/webdav.js +35 -0
  129. package/dist/plugin/index.d.ts +344 -28
  130. package/dist/plugin/index.js +3919 -227
  131. package/dist/registry-BR4326o0.d.ts +30 -0
  132. package/dist/store-CA-6sKCJ.d.ts +34 -0
  133. package/dist/thread-B9LhXNU0.d.ts +41 -0
  134. package/dist/{types-Y2_Um2Ls.d.ts → types-BbWJoC1c.d.ts} +1 -44
  135. package/dist/workgraph/index.d.ts +5 -0
  136. package/dist/workgraph/index.js +23 -0
  137. package/dist/workgraph/ledger.d.ts +2 -0
  138. package/dist/workgraph/ledger.js +25 -0
  139. package/dist/workgraph/registry.d.ts +2 -0
  140. package/dist/workgraph/registry.js +19 -0
  141. package/dist/workgraph/store.d.ts +2 -0
  142. package/dist/workgraph/store.js +25 -0
  143. package/dist/workgraph/thread.d.ts +2 -0
  144. package/dist/workgraph/thread.js +25 -0
  145. package/dist/workgraph/types.d.ts +54 -0
  146. package/dist/workgraph/types.js +7 -0
  147. package/hooks/clawvault/HOOK.md +113 -0
  148. package/hooks/clawvault/handler.js +1559 -0
  149. package/hooks/clawvault/handler.test.js +510 -0
  150. package/hooks/clawvault/openclaw.plugin.json +72 -0
  151. package/openclaw.plugin.json +235 -30
  152. package/package.json +20 -20
  153. package/dist/chunk-3RG5ZIWI.js +0 -10
  154. package/dist/chunk-3ZIH425O.js +0 -871
  155. package/dist/chunk-6U6MK36V.js +0 -205
  156. package/dist/chunk-CMB7UL7C.js +0 -327
  157. package/dist/chunk-D2H45LON.js +0 -1074
  158. package/dist/chunk-E7MFQB6D.js +0 -163
  159. package/dist/chunk-GQSLDZTS.js +0 -560
  160. package/dist/chunk-MFM6K7PU.js +0 -374
  161. package/dist/chunk-MXSSG3QU.js +0 -42
  162. package/dist/chunk-OCGVIN3L.js +0 -88
  163. package/dist/chunk-PAH27GSN.js +0 -108
  164. package/dist/chunk-YCUNCH2I.js +0 -78
  165. package/dist/cli/index.cjs +0 -8584
  166. package/dist/cli/index.d.cts +0 -5
  167. package/dist/commands/archive.cjs +0 -287
  168. package/dist/commands/archive.d.cts +0 -11
  169. package/dist/commands/backlog.cjs +0 -721
  170. package/dist/commands/backlog.d.cts +0 -53
  171. package/dist/commands/blocked.cjs +0 -204
  172. package/dist/commands/blocked.d.cts +0 -26
  173. package/dist/commands/checkpoint.cjs +0 -244
  174. package/dist/commands/checkpoint.d.cts +0 -41
  175. package/dist/commands/compat.cjs +0 -294
  176. package/dist/commands/compat.d.cts +0 -28
  177. package/dist/commands/context.cjs +0 -2990
  178. package/dist/commands/context.d.cts +0 -2
  179. package/dist/commands/doctor.cjs +0 -2986
  180. package/dist/commands/doctor.d.cts +0 -21
  181. package/dist/commands/embed.cjs +0 -232
  182. package/dist/commands/embed.d.cts +0 -17
  183. package/dist/commands/entities.cjs +0 -141
  184. package/dist/commands/entities.d.cts +0 -7
  185. package/dist/commands/graph.cjs +0 -501
  186. package/dist/commands/graph.d.cts +0 -21
  187. package/dist/commands/inject.cjs +0 -1636
  188. package/dist/commands/inject.d.cts +0 -2
  189. package/dist/commands/kanban.cjs +0 -884
  190. package/dist/commands/kanban.d.cts +0 -63
  191. package/dist/commands/link.cjs +0 -965
  192. package/dist/commands/link.d.cts +0 -11
  193. package/dist/commands/migrate-observations.cjs +0 -362
  194. package/dist/commands/migrate-observations.d.cts +0 -19
  195. package/dist/commands/observe.cjs +0 -4099
  196. package/dist/commands/observe.d.cts +0 -23
  197. package/dist/commands/project.cjs +0 -1341
  198. package/dist/commands/project.d.cts +0 -85
  199. package/dist/commands/rebuild.cjs +0 -3136
  200. package/dist/commands/rebuild.d.cts +0 -11
  201. package/dist/commands/recover.cjs +0 -361
  202. package/dist/commands/recover.d.cts +0 -38
  203. package/dist/commands/reflect.cjs +0 -1008
  204. package/dist/commands/reflect.d.cts +0 -11
  205. package/dist/commands/repair-session.cjs +0 -457
  206. package/dist/commands/repair-session.d.cts +0 -38
  207. package/dist/commands/replay.cjs +0 -4103
  208. package/dist/commands/replay.d.cts +0 -16
  209. package/dist/commands/session-recap.cjs +0 -353
  210. package/dist/commands/session-recap.d.cts +0 -27
  211. package/dist/commands/setup.cjs +0 -1278
  212. package/dist/commands/setup.d.cts +0 -99
  213. package/dist/commands/shell-init.cjs +0 -75
  214. package/dist/commands/shell-init.d.cts +0 -7
  215. package/dist/commands/sleep.cjs +0 -6029
  216. package/dist/commands/sleep.d.cts +0 -36
  217. package/dist/commands/status.cjs +0 -2737
  218. package/dist/commands/status.d.cts +0 -52
  219. package/dist/commands/task.cjs +0 -1236
  220. package/dist/commands/task.d.cts +0 -97
  221. package/dist/commands/template.cjs +0 -457
  222. package/dist/commands/template.d.cts +0 -36
  223. package/dist/commands/wake.cjs +0 -2627
  224. package/dist/commands/wake.d.cts +0 -22
  225. package/dist/context-BUGaWpyL.d.cts +0 -46
  226. package/dist/index.cjs +0 -12373
  227. package/dist/index.d.cts +0 -854
  228. package/dist/inject-Bzi5E-By.d.cts +0 -137
  229. package/dist/lib/auto-linker.cjs +0 -176
  230. package/dist/lib/auto-linker.d.cts +0 -26
  231. package/dist/lib/config.cjs +0 -78
  232. package/dist/lib/config.d.cts +0 -11
  233. package/dist/lib/entity-index.cjs +0 -84
  234. package/dist/lib/entity-index.d.cts +0 -26
  235. package/dist/lib/project-utils.cjs +0 -864
  236. package/dist/lib/project-utils.d.cts +0 -97
  237. package/dist/lib/session-repair.cjs +0 -239
  238. package/dist/lib/session-repair.d.cts +0 -110
  239. package/dist/lib/session-utils.cjs +0 -209
  240. package/dist/lib/session-utils.d.cts +0 -63
  241. package/dist/lib/task-utils.cjs +0 -1137
  242. package/dist/lib/task-utils.d.cts +0 -208
  243. package/dist/lib/template-engine.cjs +0 -47
  244. package/dist/lib/template-engine.d.cts +0 -11
  245. package/dist/plugin/index.cjs +0 -1907
  246. package/dist/plugin/index.d.cts +0 -36
  247. package/dist/plugin/inject.cjs +0 -356
  248. package/dist/plugin/inject.d.cts +0 -54
  249. package/dist/plugin/inject.d.ts +0 -54
  250. package/dist/plugin/inject.js +0 -17
  251. package/dist/plugin/observe.cjs +0 -631
  252. package/dist/plugin/observe.d.cts +0 -39
  253. package/dist/plugin/observe.d.ts +0 -39
  254. package/dist/plugin/observe.js +0 -18
  255. package/dist/plugin/templates.cjs +0 -593
  256. package/dist/plugin/templates.d.cts +0 -52
  257. package/dist/plugin/templates.d.ts +0 -52
  258. package/dist/plugin/templates.js +0 -25
  259. package/dist/plugin/types.cjs +0 -18
  260. package/dist/plugin/types.d.cts +0 -209
  261. package/dist/plugin/types.d.ts +0 -209
  262. package/dist/plugin/types.js +0 -0
  263. package/dist/plugin/vault.cjs +0 -927
  264. package/dist/plugin/vault.d.cts +0 -68
  265. package/dist/plugin/vault.d.ts +0 -68
  266. package/dist/plugin/vault.js +0 -22
  267. package/dist/types-Y2_Um2Ls.d.cts +0 -205
  268. package/templates/memory-event.md +0 -67
  269. package/templates/party.md +0 -63
  270. package/templates/primitive-registry.yaml +0 -551
  271. package/templates/run.md +0 -68
  272. package/templates/trigger.md +0 -68
  273. package/templates/workspace.md +0 -50
package/dist/index.js CHANGED
@@ -1,27 +1,45 @@
1
- import {
2
- setupCommand
3
- } from "./chunk-3ZIH425O.js";
4
- import {
5
- rebuildCommand,
6
- registerRebuildCommand
7
- } from "./chunk-VGLOTGAS.js";
8
1
  import {
9
2
  registerReplayCommand,
10
3
  replayCommand
11
- } from "./chunk-JY6FYXIT.js";
4
+ } from "./chunk-UCQAOZHW.js";
12
5
  import {
13
6
  buildSessionRecap,
14
7
  formatSessionRecapMarkdown,
15
8
  sessionRecapCommand
16
9
  } from "./chunk-ZKGY7WTT.js";
10
+ import {
11
+ setupCommand
12
+ } from "./chunk-QMHPQYUV.js";
13
+ import {
14
+ registerSyncBdCommand,
15
+ syncBdCommand
16
+ } from "./chunk-SS4B7P7V.js";
17
+ import {
18
+ migrateObservations,
19
+ migrateObservationsCommand,
20
+ registerMigrateObservationsCommand
21
+ } from "./chunk-2JQ3O2YL.js";
22
+ import {
23
+ EmbeddingCache,
24
+ cosineSimilarity,
25
+ embed,
26
+ embedBatch,
27
+ hybridSearch,
28
+ reciprocalRankFusion,
29
+ semanticSearch
30
+ } from "./chunk-PG56HX5T.js";
31
+ import {
32
+ rebuildCommand,
33
+ registerRebuildCommand
34
+ } from "./chunk-FAKNOB7Y.js";
17
35
  import {
18
36
  doctor
19
- } from "./chunk-H62BP7RI.js";
37
+ } from "./chunk-QPDDIHXE.js";
20
38
  import "./chunk-7ZRP733D.js";
21
39
  import {
22
40
  graphCommand,
23
41
  graphSummary
24
- } from "./chunk-OZ7RIXTO.js";
42
+ } from "./chunk-IIOU45CK.js";
25
43
  import {
26
44
  buildKanbanLanes,
27
45
  extractCardSlug,
@@ -31,45 +49,85 @@ import {
31
49
  kanbanCommand,
32
50
  parseKanbanMarkdown,
33
51
  syncKanbanBoard
34
- } from "./chunk-GUKMRGM7.js";
52
+ } from "./chunk-4OXMU5S2.js";
35
53
  import "./chunk-4VQTUVH7.js";
36
54
  import "./chunk-J7ZWCI2C.js";
37
55
  import {
38
- migrateObservations,
39
- migrateObservationsCommand,
40
- registerMigrateObservationsCommand
41
- } from "./chunk-C7OK5WKP.js";
56
+ registerCliCommands
57
+ } from "./chunk-IJBFGPCS.js";
42
58
  import {
43
- registerCliCommands,
44
- registerReweaveCommand,
45
- reweaveCommand
46
- } from "./chunk-YCUNCH2I.js";
59
+ registerTailscaleCommands,
60
+ registerTailscaleDiscoverCommand,
61
+ registerTailscaleServeCommand,
62
+ registerTailscaleStatusCommand,
63
+ registerTailscaleSyncCommand,
64
+ tailscaleDiscoverCommand,
65
+ tailscaleServeCommand,
66
+ tailscaleStatusCommand,
67
+ tailscaleSyncCommand
68
+ } from "./chunk-Y6VJKXGL.js";
69
+ import {
70
+ CLAWVAULT_SERVE_PATH,
71
+ DEFAULT_SERVE_PORT,
72
+ checkPeerClawVault,
73
+ compareManifests,
74
+ configureTailscaleServe,
75
+ discoverClawVaultPeers,
76
+ fetchRemoteFile,
77
+ fetchRemoteManifest,
78
+ findPeer,
79
+ generateVaultManifest,
80
+ getOnlinePeers,
81
+ getTailscaleStatus,
82
+ getTailscaleVersion,
83
+ hasTailscale,
84
+ pushFileToRemote,
85
+ resolvePeerIP,
86
+ serveVault,
87
+ stopTailscaleServe,
88
+ syncWithPeer
89
+ } from "./chunk-TIGW564L.js";
90
+ import "./chunk-IVRIKYFE.js";
47
91
  import {
48
92
  SessionWatcher,
49
93
  observeCommand,
50
94
  registerObserveCommand
51
- } from "./chunk-F2JEUD4J.js";
95
+ } from "./chunk-4ITRXIVT.js";
52
96
  import {
53
97
  parseSessionFile
54
98
  } from "./chunk-P5EPF6MB.js";
55
99
  import {
56
100
  reflectCommand,
57
101
  registerReflectCommand
58
- } from "./chunk-SJSFRIYS.js";
102
+ } from "./chunk-S5OJEGFG.js";
59
103
  import {
60
104
  runReflection
61
- } from "./chunk-H34S76MB.js";
105
+ } from "./chunk-MNPUYCHQ.js";
106
+ import {
107
+ buildContext,
108
+ contextCommand,
109
+ formatContextMarkdown,
110
+ inferContextProfile,
111
+ normalizeContextProfileInput,
112
+ registerContextCommand,
113
+ resolveContextProfile
114
+ } from "./chunk-WJVWINEM.js";
62
115
  import {
63
116
  getObserverStaleness,
64
117
  getScaledObservationThresholdBytes,
65
118
  observeActiveSessions,
66
119
  parseSessionSourceLabel
67
- } from "./chunk-LNJA2UGL.js";
120
+ } from "./chunk-PI4WMLMG.js";
68
121
  import {
69
122
  Compressor,
70
123
  Observer,
71
- Reflector
72
- } from "./chunk-3NSBOUT3.js";
124
+ Reflector,
125
+ createDefaultAdapter,
126
+ createFactExtractionAdapter,
127
+ createGeminiFlashAdapter,
128
+ createLlmFunction,
129
+ resolveFactExtractionMode
130
+ } from "./chunk-Y3TIJEBP.js";
73
131
  import {
74
132
  archiveProject,
75
133
  createProject,
@@ -78,12 +136,42 @@ import {
78
136
  listProjects,
79
137
  readProject,
80
138
  updateProject
81
- } from "./chunk-62YTUT6J.js";
139
+ } from "./chunk-AZYOKJYC.js";
82
140
  import "./chunk-HRLWZGMA.js";
141
+ import {
142
+ ClawVault,
143
+ createVault,
144
+ findVault
145
+ } from "./chunk-YDWHS4LJ.js";
146
+ import {
147
+ FactStore,
148
+ extractFactsLlm,
149
+ extractFactsRuleBased,
150
+ factId,
151
+ normalizeEntity
152
+ } from "./chunk-BSJ6RIT7.js";
153
+ import "./chunk-FHFUXL6G.js";
83
154
  import {
84
155
  embedCommand,
85
156
  registerEmbedCommand
86
- } from "./chunk-OCGVIN3L.js";
157
+ } from "./chunk-ECRZL5XR.js";
158
+ import {
159
+ loadVaultQmdConfig,
160
+ removeQmdCollection
161
+ } from "./chunk-WIOLLGAD.js";
162
+ import {
163
+ QMD_INSTALL_COMMAND,
164
+ QMD_INSTALL_URL,
165
+ QmdConfigurationError,
166
+ QmdUnavailableError,
167
+ SearchEngine,
168
+ extractTags,
169
+ extractWikiLinks,
170
+ getQmdErrorDetails,
171
+ hasQmd,
172
+ qmdEmbed,
173
+ qmdUpdate
174
+ } from "./chunk-5PJ4STIC.js";
87
175
  import {
88
176
  buildInjectionResult,
89
177
  deterministicInjectMatches,
@@ -91,11 +179,7 @@ import {
91
179
  injectCommand,
92
180
  registerInjectCommand,
93
181
  runPromptInjection
94
- } from "./chunk-U55BGUAU.js";
95
- import {
96
- requestLlmCompletion,
97
- resolveLlmProvider
98
- } from "./chunk-E7MFQB6D.js";
182
+ } from "./chunk-YNIPYN4F.js";
99
183
  import {
100
184
  SUPPORTED_CONFIG_KEYS,
101
185
  addRouteRule,
@@ -108,12 +192,21 @@ import {
108
192
  resetConfig,
109
193
  setConfigValue,
110
194
  testRouteRule
111
- } from "./chunk-ITPEXLHA.js";
112
- import "./chunk-PAH27GSN.js";
195
+ } from "./chunk-URXDAUVH.js";
196
+ import {
197
+ requestLlmCompletion,
198
+ resolveLlmProvider
199
+ } from "./chunk-YXQCA6B7.js";
200
+ import {
201
+ DEFAULT_CATEGORIES,
202
+ DEFAULT_CONFIG,
203
+ MEMORY_TYPES,
204
+ TYPE_TO_CATEGORY
205
+ } from "./chunk-2CDEETQN.js";
113
206
  import {
114
207
  archiveCommand,
115
208
  registerArchiveCommand
116
- } from "./chunk-VR5NE7PZ.js";
209
+ } from "./chunk-2RAZ4ZFE.js";
117
210
  import {
118
211
  archiveObservations
119
212
  } from "./chunk-MQUJNOHK.js";
@@ -121,7 +214,14 @@ import {
121
214
  findNearestVaultPath,
122
215
  getVaultPath,
123
216
  resolveVaultPath
124
- } from "./chunk-MXSSG3QU.js";
217
+ } from "./chunk-GNJL4YGR.js";
218
+ import {
219
+ MEMORY_GRAPH_SCHEMA_VERSION,
220
+ buildOrUpdateMemoryGraphIndex,
221
+ getMemoryGraph,
222
+ loadMemoryGraphIndex
223
+ } from "./chunk-ZZA73MFY.js";
224
+ import "./chunk-Z2XBWN7A.js";
125
225
  import {
126
226
  appendTransition,
127
227
  buildTransitionEvent,
@@ -134,8 +234,8 @@ import {
134
234
  queryTransitions,
135
235
  readAllTransitions,
136
236
  updateTask
137
- } from "./chunk-N2AXRYLC.js";
138
- import "./chunk-LYHGEHXG.js";
237
+ } from "./chunk-QWQ3TIKS.js";
238
+ import "./chunk-MFAWT5O5.js";
139
239
  import {
140
240
  buildTemplateVariables,
141
241
  renderTemplate
@@ -144,67 +244,254 @@ import {
144
244
  checkOpenClawCompatibility,
145
245
  compatCommand,
146
246
  compatibilityExitCode
147
- } from "./chunk-33UGEQRT.js";
148
- import {
149
- buildContext,
150
- contextCommand,
151
- formatContextMarkdown,
152
- inferContextProfile,
153
- normalizeContextProfileInput,
154
- registerContextCommand,
155
- resolveContextProfile
156
- } from "./chunk-3WRJEKN4.js";
157
- import {
158
- ClawVault,
159
- createVault,
160
- findVault
161
- } from "./chunk-LI4O6NVK.js";
162
- import {
163
- QMD_INSTALL_COMMAND,
164
- QMD_INSTALL_URL,
165
- QmdUnavailableError,
166
- SearchEngine,
167
- bm25RankChunks,
168
- classifyQuestion,
169
- entitySimilarity,
170
- extractDates,
171
- extractEntities,
172
- extractPreferences,
173
- extractTags,
174
- extractWikiLinks,
175
- filterSuperseded,
176
- getSupersessionInfo,
177
- hasQmd,
178
- isKnowledgeUpdate,
179
- isSuperseded,
180
- qmdEmbed,
181
- qmdUpdate,
182
- reweave,
183
- sentenceChunk,
184
- stripSupersededObservations
185
- } from "./chunk-D2H45LON.js";
186
- import {
187
- DEFAULT_CATEGORIES,
188
- DEFAULT_CONFIG,
189
- MEMORY_TYPES,
190
- TYPE_TO_CATEGORY
191
- } from "./chunk-2CDEETQN.js";
192
- import {
193
- MEMORY_GRAPH_SCHEMA_VERSION,
194
- buildOrUpdateMemoryGraphIndex,
195
- getMemoryGraph,
196
- loadMemoryGraphIndex
197
- } from "./chunk-ZZA73MFY.js";
198
- import "./chunk-QK3UCXWL.js";
199
- import "./chunk-Z2XBWN7A.js";
200
- import "./chunk-3RG5ZIWI.js";
247
+ } from "./chunk-X3SPPUFG.js";
248
+ import "./chunk-U67V476Y.js";
201
249
 
202
250
  // src/index.ts
251
+ import * as fs2 from "fs";
252
+
253
+ // src/commands/migrate.ts
203
254
  import * as fs from "fs";
255
+ import * as path from "path";
256
+ import { execFileSync } from "child_process";
257
+ function addQmdCollection(name, rootPath) {
258
+ execFileSync("qmd", ["collection", "add", name, rootPath], { stdio: "ignore" });
259
+ }
260
+ function updateVaultConfig(vaultPath, updates) {
261
+ const configPath = path.join(vaultPath, ".clawvault.json");
262
+ let config = {};
263
+ if (fs.existsSync(configPath)) {
264
+ try {
265
+ config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
266
+ } catch {
267
+ config = {};
268
+ }
269
+ }
270
+ if (updates.qmdCollection !== void 0) {
271
+ config.qmdCollection = updates.qmdCollection;
272
+ }
273
+ if (updates.qmdRoot !== void 0) {
274
+ config.qmdRoot = updates.qmdRoot;
275
+ }
276
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
277
+ }
278
+ function fixStaleCollectionName(issue, dryRun) {
279
+ const details = issue.details;
280
+ const action = {
281
+ type: "stale_collection_name",
282
+ description: `Rename collection "${details.oldName}" to "${details.newName}"`,
283
+ success: false
284
+ };
285
+ if (dryRun) {
286
+ action.success = true;
287
+ action.description += " (dry run)";
288
+ return action;
289
+ }
290
+ try {
291
+ removeQmdCollection(details.oldName);
292
+ addQmdCollection(details.newName, details.root);
293
+ action.success = true;
294
+ } catch (err) {
295
+ action.error = err?.message || "Failed to rename collection";
296
+ }
297
+ return action;
298
+ }
299
+ function fixMissingQmdCollection(issue, dryRun) {
300
+ const details = issue.details;
301
+ const action = {
302
+ type: "missing_qmd_collection",
303
+ description: `Create qmd collection "${details.collectionName}" at "${details.expectedRoot}"`,
304
+ success: false
305
+ };
306
+ if (dryRun) {
307
+ action.success = true;
308
+ action.description += " (dry run)";
309
+ return action;
310
+ }
311
+ try {
312
+ addQmdCollection(details.collectionName, details.expectedRoot);
313
+ action.success = true;
314
+ } catch (err) {
315
+ action.error = err?.message || "Failed to create collection";
316
+ }
317
+ return action;
318
+ }
319
+ function fixWrongVaultPath(issue, dryRun) {
320
+ const details = issue.details;
321
+ const action = {
322
+ type: "wrong_vault_path",
323
+ description: `Update collection "${details.collectionName}" path from "${details.currentRoot}" to "${details.expectedRoot}"`,
324
+ success: false
325
+ };
326
+ if (dryRun) {
327
+ action.success = true;
328
+ action.description += " (dry run)";
329
+ return action;
330
+ }
331
+ try {
332
+ removeQmdCollection(details.collectionName);
333
+ addQmdCollection(details.collectionName, details.expectedRoot);
334
+ action.success = true;
335
+ } catch (err) {
336
+ action.error = err?.message || "Failed to update collection path";
337
+ }
338
+ return action;
339
+ }
340
+ function fixOrphanedCollection(issue, dryRun) {
341
+ const details = issue.details;
342
+ const action = {
343
+ type: "orphaned_collection",
344
+ description: `Remove orphaned collection "${details.collectionName}"`,
345
+ success: false
346
+ };
347
+ if (dryRun) {
348
+ action.success = true;
349
+ action.description += " (dry run)";
350
+ return action;
351
+ }
352
+ try {
353
+ removeQmdCollection(details.collectionName);
354
+ action.success = true;
355
+ } catch (err) {
356
+ action.error = err?.message || "Failed to remove orphaned collection";
357
+ }
358
+ return action;
359
+ }
360
+ function fixMissingQmdConfig(issue, vaultPath, dryRun) {
361
+ const vaultConfig = loadVaultQmdConfig(vaultPath);
362
+ const action = {
363
+ type: "missing_qmd_config",
364
+ description: `Add qmdCollection="${vaultConfig.qmdCollection}" and qmdRoot="${vaultConfig.qmdRoot}" to .clawvault.json`,
365
+ success: false
366
+ };
367
+ if (dryRun) {
368
+ action.success = true;
369
+ action.description += " (dry run)";
370
+ return action;
371
+ }
372
+ try {
373
+ updateVaultConfig(vaultPath, {
374
+ qmdCollection: vaultConfig.qmdCollection,
375
+ qmdRoot: vaultConfig.qmdRoot
376
+ });
377
+ action.success = true;
378
+ } catch (err) {
379
+ action.error = err?.message || "Failed to update vault config";
380
+ }
381
+ return action;
382
+ }
383
+ function fixIssue(issue, vaultPath, dryRun) {
384
+ if (!issue.autoFixable) {
385
+ return null;
386
+ }
387
+ switch (issue.type) {
388
+ case "stale_collection_name":
389
+ return fixStaleCollectionName(issue, dryRun);
390
+ case "missing_qmd_collection":
391
+ return fixMissingQmdCollection(issue, dryRun);
392
+ case "wrong_vault_path":
393
+ return fixWrongVaultPath(issue, dryRun);
394
+ case "orphaned_collection":
395
+ return fixOrphanedCollection(issue, dryRun);
396
+ case "missing_qmd_config":
397
+ return fixMissingQmdConfig(issue, vaultPath, dryRun);
398
+ default:
399
+ return null;
400
+ }
401
+ }
402
+ async function migrate(options = {}) {
403
+ const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
404
+ const dryRun = options.dryRun ?? false;
405
+ if (!hasQmd()) {
406
+ return {
407
+ vaultPath,
408
+ issuesFound: 1,
409
+ issuesFixed: 0,
410
+ actions: [{
411
+ type: "missing_qmd_collection",
412
+ description: "qmd is not installed",
413
+ success: false,
414
+ error: `Install qmd first: ${QMD_INSTALL_COMMAND}
415
+ More info: ${QMD_INSTALL_URL}`
416
+ }],
417
+ dryRun
418
+ };
419
+ }
420
+ const report = await doctor(vaultPath);
421
+ const issues = report.migrationIssues;
422
+ const actions = [];
423
+ for (const issue of issues) {
424
+ const action = fixIssue(issue, vaultPath, dryRun);
425
+ if (action) {
426
+ actions.push(action);
427
+ }
428
+ }
429
+ const issuesFixed = actions.filter((a) => a.success).length;
430
+ return {
431
+ vaultPath,
432
+ issuesFound: issues.length,
433
+ issuesFixed,
434
+ actions,
435
+ dryRun
436
+ };
437
+ }
438
+ function formatMigrateResult(result) {
439
+ const lines = [];
440
+ lines.push("ClawVault Migration Report");
441
+ lines.push("-".repeat(30));
442
+ lines.push(`Vault: ${result.vaultPath}`);
443
+ lines.push(`Mode: ${result.dryRun ? "Dry Run" : "Live"}`);
444
+ lines.push("");
445
+ if (result.issuesFound === 0) {
446
+ lines.push("\u2713 No migration issues found. Your vault is up to date.");
447
+ return lines.join("\n");
448
+ }
449
+ lines.push(`Found ${result.issuesFound} issue(s)`);
450
+ lines.push("");
451
+ for (const action of result.actions) {
452
+ const prefix = action.success ? "\u2713" : "\u2717";
453
+ lines.push(`${prefix} ${action.description}`);
454
+ if (action.error) {
455
+ lines.push(` Error: ${action.error}`);
456
+ }
457
+ }
458
+ lines.push("");
459
+ if (result.dryRun) {
460
+ lines.push(`Would fix ${result.issuesFixed}/${result.issuesFound} issue(s).`);
461
+ lines.push("Run without --dry-run to apply changes.");
462
+ } else {
463
+ lines.push(`Fixed ${result.issuesFixed}/${result.issuesFound} issue(s).`);
464
+ if (result.issuesFixed < result.issuesFound) {
465
+ lines.push("Some issues require manual intervention.");
466
+ }
467
+ }
468
+ return lines.join("\n");
469
+ }
470
+ async function migrateCommand(options = {}) {
471
+ const result = await migrate(options);
472
+ if (options.json) {
473
+ console.log(JSON.stringify(result, null, 2));
474
+ } else {
475
+ console.log(formatMigrateResult(result));
476
+ }
477
+ return result;
478
+ }
479
+ function registerMigrateCommand(program) {
480
+ program.command("migrate").description("Auto-fix common v2\u2192v3 migration issues (stale collections, missing qmd config, wrong paths)").option("-v, --vault <path>", "Vault path").option("--dry-run", "Preview changes without applying them").option("--force", "Force migration even if no issues detected").option("--json", "Output results as JSON").action(async (rawOptions) => {
481
+ await migrateCommand({
482
+ vaultPath: rawOptions.vault,
483
+ dryRun: rawOptions.dryRun,
484
+ force: rawOptions.force,
485
+ json: rawOptions.json
486
+ });
487
+ });
488
+ }
489
+
490
+ // src/index.ts
204
491
  function readPackageVersion() {
205
492
  try {
206
493
  const pkgUrl = new URL("../package.json", import.meta.url);
207
- const pkg = JSON.parse(fs.readFileSync(pkgUrl, "utf-8"));
494
+ const pkg = JSON.parse(fs2.readFileSync(pkgUrl, "utf-8"));
208
495
  return pkg.version ?? "0.0.0";
209
496
  } catch {
210
497
  return "0.0.0";
@@ -215,15 +502,20 @@ function registerCommanderCommands(program) {
215
502
  return registerCliCommands(program);
216
503
  }
217
504
  export {
505
+ CLAWVAULT_SERVE_PATH,
218
506
  ClawVault,
219
507
  Compressor,
220
508
  DEFAULT_CATEGORIES,
221
509
  DEFAULT_CONFIG,
510
+ DEFAULT_SERVE_PORT,
511
+ EmbeddingCache,
512
+ FactStore,
222
513
  MEMORY_GRAPH_SCHEMA_VERSION,
223
514
  MEMORY_TYPES,
224
515
  Observer,
225
516
  QMD_INSTALL_COMMAND,
226
517
  QMD_INSTALL_URL,
518
+ QmdConfigurationError,
227
519
  QmdUnavailableError,
228
520
  Reflector,
229
521
  SUPPORTED_CONFIG_KEYS,
@@ -236,7 +528,6 @@ export {
236
528
  archiveCommand,
237
529
  archiveObservations,
238
530
  archiveProject,
239
- bm25RankChunks,
240
531
  buildContext,
241
532
  buildInjectionResult,
242
533
  buildKanbanLanes,
@@ -245,51 +536,66 @@ export {
245
536
  buildTemplateVariables,
246
537
  buildTransitionEvent,
247
538
  checkOpenClawCompatibility,
248
- classifyQuestion,
539
+ checkPeerClawVault,
540
+ compareManifests,
249
541
  compatCommand,
250
542
  compatibilityExitCode,
251
543
  completeTask,
544
+ configureTailscaleServe,
252
545
  contextCommand,
546
+ cosineSimilarity,
253
547
  countBlockedTransitions,
548
+ createDefaultAdapter,
549
+ createFactExtractionAdapter,
550
+ createGeminiFlashAdapter,
551
+ createLlmFunction,
254
552
  createProject,
255
553
  createVault,
256
554
  deterministicInjectMatches,
555
+ discoverClawVaultPeers,
257
556
  doctor,
557
+ embed,
558
+ embedBatch,
258
559
  embedCommand,
259
- entitySimilarity,
260
560
  extractCardSlug,
261
- extractDates,
262
- extractEntities,
263
- extractPreferences,
561
+ extractFactsLlm,
562
+ extractFactsRuleBased,
264
563
  extractTags,
265
564
  extractWikiLinks,
266
- filterSuperseded,
565
+ factId,
566
+ fetchRemoteFile,
567
+ fetchRemoteManifest,
267
568
  findNearestVaultPath,
569
+ findPeer,
268
570
  findVault,
269
571
  formatContextMarkdown,
270
572
  formatKanbanCard,
271
573
  formatSessionRecapMarkdown,
272
574
  formatTransitionsTable,
273
575
  generateKanbanMarkdown,
576
+ generateVaultManifest,
274
577
  getConfig,
275
578
  getConfigValue,
276
579
  getMemoryGraph,
277
580
  getObserverStaleness,
581
+ getOnlinePeers,
278
582
  getProjectActivity,
279
583
  getProjectTasks,
584
+ getQmdErrorDetails,
280
585
  getScaledObservationThresholdBytes,
281
- getSupersessionInfo,
586
+ getTailscaleStatus,
587
+ getTailscaleVersion,
282
588
  getVaultPath,
283
589
  graphCommand,
284
590
  graphSummary,
285
591
  hasQmd,
592
+ hasTailscale,
593
+ hybridSearch,
286
594
  importKanbanBoard,
287
595
  indexInjectableItems,
288
596
  inferContextProfile,
289
597
  injectCommand,
290
- isKnowledgeUpdate,
291
598
  isRegression,
292
- isSuperseded,
293
599
  kanbanCommand,
294
600
  listConfig,
295
601
  listDependentTasks,
@@ -298,20 +604,25 @@ export {
298
604
  listSubtasks,
299
605
  loadMemoryGraphIndex,
300
606
  matchRouteRule,
607
+ migrate,
608
+ migrateCommand,
301
609
  migrateObservations,
302
610
  migrateObservationsCommand,
303
611
  normalizeContextProfileInput,
612
+ normalizeEntity,
304
613
  observeActiveSessions,
305
614
  observeCommand,
306
615
  parseKanbanMarkdown,
307
616
  parseSessionFile,
308
617
  parseSessionSourceLabel,
618
+ pushFileToRemote,
309
619
  qmdEmbed,
310
620
  qmdUpdate,
311
621
  queryTransitions,
312
622
  readAllTransitions,
313
623
  readProject,
314
624
  rebuildCommand,
625
+ reciprocalRankFusion,
315
626
  reflectCommand,
316
627
  registerArchiveCommand,
317
628
  registerCliCommands,
@@ -319,30 +630,43 @@ export {
319
630
  registerContextCommand,
320
631
  registerEmbedCommand,
321
632
  registerInjectCommand,
633
+ registerMigrateCommand,
322
634
  registerMigrateObservationsCommand,
323
635
  registerObserveCommand,
324
636
  registerRebuildCommand,
325
637
  registerReflectCommand,
326
638
  registerReplayCommand,
327
- registerReweaveCommand,
639
+ registerSyncBdCommand,
640
+ registerTailscaleCommands,
641
+ registerTailscaleDiscoverCommand,
642
+ registerTailscaleServeCommand,
643
+ registerTailscaleStatusCommand,
644
+ registerTailscaleSyncCommand,
328
645
  removeRouteRule,
329
646
  renderTemplate,
330
647
  replayCommand,
331
648
  requestLlmCompletion,
332
649
  resetConfig,
333
650
  resolveContextProfile,
651
+ resolveFactExtractionMode,
334
652
  resolveLlmProvider,
653
+ resolvePeerIP,
335
654
  resolveVaultPath,
336
- reweave,
337
- reweaveCommand,
338
655
  runPromptInjection,
339
656
  runReflection,
340
- sentenceChunk,
657
+ semanticSearch,
658
+ serveVault,
341
659
  sessionRecapCommand,
342
660
  setConfigValue,
343
661
  setupCommand,
344
- stripSupersededObservations,
662
+ stopTailscaleServe,
663
+ syncBdCommand,
345
664
  syncKanbanBoard,
665
+ syncWithPeer,
666
+ tailscaleDiscoverCommand,
667
+ tailscaleServeCommand,
668
+ tailscaleStatusCommand,
669
+ tailscaleSyncCommand,
346
670
  testRouteRule,
347
671
  updateProject,
348
672
  updateTask