clawvault 2.6.1 → 2.6.4
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.
- package/README.md +352 -20
- package/bin/clawvault.js +8 -2
- package/bin/command-runtime.js +9 -1
- package/bin/register-maintenance-commands.js +19 -0
- package/bin/register-query-commands.js +58 -6
- package/bin/register-workgraph-commands.js +451 -0
- package/dist/{chunk-VXEOHTSL.js → chunk-2JQ3O2YL.js} +1 -1
- package/dist/{chunk-VR5NE7PZ.js → chunk-2RAZ4ZFE.js} +1 -1
- package/dist/chunk-2ZDO52B4.js +52 -0
- package/dist/chunk-4BQTQMJP.js +93 -0
- package/dist/{chunk-MAKNAHAW.js → chunk-5PJ4STIC.js} +98 -8
- package/dist/{chunk-IEVLHNLU.js → chunk-627Q3QWK.js} +3 -3
- package/dist/{chunk-R6SXNSFD.js → chunk-6NYYDNNG.js} +3 -3
- package/dist/chunk-ECRZL5XR.js +50 -0
- package/dist/chunk-GNJL4YGR.js +79 -0
- package/dist/{chunk-OZ7RIXTO.js → chunk-IIOU45CK.js} +1 -1
- package/dist/chunk-L4HSSQ6T.js +152 -0
- package/dist/{chunk-XAVB4GB4.js → chunk-LIGHWOH6.js} +1 -1
- package/dist/{chunk-PBEE567J.js → chunk-LUBZXECN.js} +2 -2
- package/dist/{chunk-UEOUADMO.js → chunk-MFL6EEPF.js} +204 -35
- package/dist/chunk-MM6QGW3P.js +207 -0
- package/dist/{chunk-T76H47ZS.js → chunk-MNPUYCHQ.js} +1 -1
- package/dist/{chunk-TLGBDTYT.js → chunk-MPOSMDMU.js} +6 -6
- package/dist/{chunk-RVYA52PY.js → chunk-NJYJL5AA.js} +1 -1
- package/dist/{chunk-Q2J5YTUF.js → chunk-OQGYFZ4A.js} +669 -33
- package/dist/{chunk-ME37YNW3.js → chunk-P7SY3D4E.js} +3 -3
- package/dist/chunk-RHISK3SZ.js +189 -0
- package/dist/{chunk-3BTHWPMB.js → chunk-S5OJEGFG.js} +2 -2
- package/dist/{chunk-MGDEINGP.js → chunk-SS4B7P7V.js} +1 -1
- package/dist/chunk-U4O6C46S.js +154 -0
- package/dist/{chunk-ITPEXLHA.js → chunk-URXDAUVH.js} +24 -5
- package/dist/chunk-WIOLLGAD.js +190 -0
- package/dist/chunk-WMGIIABP.js +15 -0
- package/dist/{chunk-QVMXF7FY.js → chunk-X3SPPUFG.js} +50 -0
- package/dist/{chunk-THRJVD4L.js → chunk-Y6VJKXGL.js} +1 -1
- package/dist/{chunk-KL4NAOMO.js → chunk-YDWHS4LJ.js} +49 -9
- package/dist/{chunk-4VRIMU4O.js → chunk-YNIPYN4F.js} +4 -4
- package/dist/{chunk-HIHOUSXS.js → chunk-YXQCA6B7.js} +105 -1
- package/dist/cli/index.js +18 -16
- package/dist/commands/archive.js +3 -2
- package/dist/commands/backlog.js +1 -0
- package/dist/commands/blocked.js +1 -0
- package/dist/commands/canvas.js +1 -0
- package/dist/commands/checkpoint.js +1 -0
- package/dist/commands/compat.js +2 -1
- package/dist/commands/context.js +5 -3
- package/dist/commands/doctor.d.ts +10 -1
- package/dist/commands/doctor.js +11 -8
- package/dist/commands/embed.js +5 -3
- package/dist/commands/entities.js +2 -1
- package/dist/commands/graph.js +3 -2
- package/dist/commands/inject.d.ts +1 -1
- package/dist/commands/inject.js +4 -3
- package/dist/commands/kanban.js +1 -0
- package/dist/commands/link.js +2 -1
- package/dist/commands/migrate-observations.js +3 -2
- package/dist/commands/observe.js +8 -6
- package/dist/commands/project.js +1 -0
- package/dist/commands/rebuild-embeddings.d.ts +21 -0
- package/dist/commands/rebuild-embeddings.js +91 -0
- package/dist/commands/rebuild.js +6 -4
- package/dist/commands/recover.js +1 -0
- package/dist/commands/reflect.js +5 -4
- package/dist/commands/repair-session.js +1 -0
- package/dist/commands/replay.js +7 -6
- package/dist/commands/session-recap.js +1 -0
- package/dist/commands/setup.js +3 -2
- package/dist/commands/shell-init.js +2 -0
- package/dist/commands/sleep.d.ts +1 -1
- package/dist/commands/sleep.js +8 -6
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +35 -24
- package/dist/commands/sync-bd.js +3 -2
- package/dist/commands/tailscale.js +3 -2
- package/dist/commands/task.js +1 -0
- package/dist/commands/template.js +1 -0
- package/dist/commands/wake.d.ts +1 -1
- package/dist/commands/wake.js +4 -2
- package/dist/index.d.ts +333 -10
- package/dist/index.js +320 -33
- package/dist/{inject-x65KXWPk.d.ts → inject-DYUrDqQO.d.ts} +2 -2
- package/dist/ledger-B7g7jhqG.d.ts +44 -0
- package/dist/lib/auto-linker.js +1 -0
- package/dist/lib/canvas-layout.js +1 -0
- package/dist/lib/config.d.ts +27 -3
- package/dist/lib/config.js +4 -1
- package/dist/lib/entity-index.js +1 -0
- package/dist/lib/project-utils.js +1 -0
- package/dist/lib/session-repair.js +1 -0
- package/dist/lib/session-utils.js +1 -0
- package/dist/lib/tailscale.js +1 -0
- package/dist/lib/task-utils.js +1 -0
- package/dist/lib/template-engine.js +1 -0
- package/dist/lib/webdav.js +1 -0
- package/dist/onnxruntime_binding-5QEF3SUC.node +0 -0
- package/dist/onnxruntime_binding-BKPKNEGC.node +0 -0
- package/dist/onnxruntime_binding-FMOXGIUT.node +0 -0
- package/dist/onnxruntime_binding-OI2KMXC5.node +0 -0
- package/dist/onnxruntime_binding-UX44MLAZ.node +0 -0
- package/dist/onnxruntime_binding-Y2W7N7WY.node +0 -0
- package/dist/registry-BR4326o0.d.ts +30 -0
- package/dist/store-CA-6sKCJ.d.ts +34 -0
- package/dist/thread-B9LhXNU0.d.ts +41 -0
- package/dist/transformers.node-A2ZRORSQ.js +46775 -0
- package/dist/{types-C74wgGL1.d.ts → types-BbWJoC1c.d.ts} +1 -1
- package/dist/workgraph/index.d.ts +5 -0
- package/dist/workgraph/index.js +23 -0
- package/dist/workgraph/ledger.d.ts +2 -0
- package/dist/workgraph/ledger.js +25 -0
- package/dist/workgraph/registry.d.ts +2 -0
- package/dist/workgraph/registry.js +19 -0
- package/dist/workgraph/store.d.ts +2 -0
- package/dist/workgraph/store.js +25 -0
- package/dist/workgraph/thread.d.ts +2 -0
- package/dist/workgraph/thread.js +25 -0
- package/dist/workgraph/types.d.ts +54 -0
- package/dist/workgraph/types.js +7 -0
- package/hooks/clawvault/HOOK.md +34 -4
- package/hooks/clawvault/handler.js +751 -8
- package/hooks/clawvault/handler.test.js +247 -0
- package/hooks/clawvault/openclaw.plugin.json +72 -0
- package/openclaw.plugin.json +84 -0
- package/package.json +8 -4
- package/dist/chunk-4QYGFWRM.js +0 -88
- package/dist/chunk-MXSSG3QU.js +0 -42
package/dist/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerReplayCommand,
|
|
3
|
+
replayCommand
|
|
4
|
+
} from "./chunk-6NYYDNNG.js";
|
|
1
5
|
import {
|
|
2
6
|
buildSessionRecap,
|
|
3
7
|
formatSessionRecapMarkdown,
|
|
@@ -5,32 +9,37 @@ import {
|
|
|
5
9
|
} from "./chunk-ZKGY7WTT.js";
|
|
6
10
|
import {
|
|
7
11
|
setupCommand
|
|
8
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NJYJL5AA.js";
|
|
9
13
|
import {
|
|
10
14
|
registerSyncBdCommand,
|
|
11
15
|
syncBdCommand
|
|
12
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SS4B7P7V.js";
|
|
13
17
|
import {
|
|
14
18
|
migrateObservations,
|
|
15
19
|
migrateObservationsCommand,
|
|
16
20
|
registerMigrateObservationsCommand
|
|
17
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-2JQ3O2YL.js";
|
|
22
|
+
import {
|
|
23
|
+
EmbeddingCache,
|
|
24
|
+
cosineSimilarity,
|
|
25
|
+
embed,
|
|
26
|
+
embedBatch,
|
|
27
|
+
hybridSearch,
|
|
28
|
+
reciprocalRankFusion,
|
|
29
|
+
semanticSearch
|
|
30
|
+
} from "./chunk-U4O6C46S.js";
|
|
18
31
|
import {
|
|
19
32
|
rebuildCommand,
|
|
20
33
|
registerRebuildCommand
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import {
|
|
23
|
-
registerReplayCommand,
|
|
24
|
-
replayCommand
|
|
25
|
-
} from "./chunk-R6SXNSFD.js";
|
|
34
|
+
} from "./chunk-LUBZXECN.js";
|
|
26
35
|
import {
|
|
27
36
|
doctor
|
|
28
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-MFL6EEPF.js";
|
|
29
38
|
import "./chunk-7ZRP733D.js";
|
|
30
39
|
import {
|
|
31
40
|
graphCommand,
|
|
32
41
|
graphSummary
|
|
33
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-IIOU45CK.js";
|
|
34
43
|
import {
|
|
35
44
|
buildKanbanLanes,
|
|
36
45
|
extractCardSlug,
|
|
@@ -45,7 +54,7 @@ import "./chunk-4VQTUVH7.js";
|
|
|
45
54
|
import "./chunk-J7ZWCI2C.js";
|
|
46
55
|
import {
|
|
47
56
|
registerCliCommands
|
|
48
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-MPOSMDMU.js";
|
|
49
58
|
import {
|
|
50
59
|
registerTailscaleCommands,
|
|
51
60
|
registerTailscaleDiscoverCommand,
|
|
@@ -56,7 +65,7 @@ import {
|
|
|
56
65
|
tailscaleServeCommand,
|
|
57
66
|
tailscaleStatusCommand,
|
|
58
67
|
tailscaleSyncCommand
|
|
59
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-Y6VJKXGL.js";
|
|
60
69
|
import {
|
|
61
70
|
CLAWVAULT_SERVE_PATH,
|
|
62
71
|
DEFAULT_SERVE_PORT,
|
|
@@ -83,17 +92,17 @@ import {
|
|
|
83
92
|
SessionWatcher,
|
|
84
93
|
observeCommand,
|
|
85
94
|
registerObserveCommand
|
|
86
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-P7SY3D4E.js";
|
|
87
96
|
import {
|
|
88
97
|
parseSessionFile
|
|
89
98
|
} from "./chunk-P5EPF6MB.js";
|
|
90
99
|
import {
|
|
91
100
|
reflectCommand,
|
|
92
101
|
registerReflectCommand
|
|
93
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-S5OJEGFG.js";
|
|
94
103
|
import {
|
|
95
104
|
runReflection
|
|
96
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-MNPUYCHQ.js";
|
|
97
106
|
import {
|
|
98
107
|
buildContext,
|
|
99
108
|
contextCommand,
|
|
@@ -102,19 +111,28 @@ import {
|
|
|
102
111
|
normalizeContextProfileInput,
|
|
103
112
|
registerContextCommand,
|
|
104
113
|
resolveContextProfile
|
|
105
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-LIGHWOH6.js";
|
|
106
115
|
import {
|
|
107
116
|
getObserverStaleness,
|
|
108
117
|
getScaledObservationThresholdBytes,
|
|
109
118
|
observeActiveSessions,
|
|
110
119
|
parseSessionSourceLabel
|
|
111
|
-
} from "./chunk-
|
|
112
|
-
import "./chunk-HRLWZGMA.js";
|
|
120
|
+
} from "./chunk-627Q3QWK.js";
|
|
113
121
|
import {
|
|
114
122
|
Compressor,
|
|
123
|
+
FactStore,
|
|
115
124
|
Observer,
|
|
116
|
-
Reflector
|
|
117
|
-
|
|
125
|
+
Reflector,
|
|
126
|
+
createDefaultAdapter,
|
|
127
|
+
createFactExtractionAdapter,
|
|
128
|
+
createGeminiFlashAdapter,
|
|
129
|
+
createLlmFunction,
|
|
130
|
+
extractFactsLlm,
|
|
131
|
+
extractFactsRuleBased,
|
|
132
|
+
factId,
|
|
133
|
+
normalizeEntity,
|
|
134
|
+
resolveFactExtractionMode
|
|
135
|
+
} from "./chunk-OQGYFZ4A.js";
|
|
118
136
|
import {
|
|
119
137
|
archiveProject,
|
|
120
138
|
createProject,
|
|
@@ -124,27 +142,34 @@ import {
|
|
|
124
142
|
readProject,
|
|
125
143
|
updateProject
|
|
126
144
|
} from "./chunk-AZYOKJYC.js";
|
|
145
|
+
import "./chunk-HRLWZGMA.js";
|
|
127
146
|
import {
|
|
128
147
|
ClawVault,
|
|
129
148
|
createVault,
|
|
130
149
|
findVault
|
|
131
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-YDWHS4LJ.js";
|
|
132
151
|
import "./chunk-FHFUXL6G.js";
|
|
133
152
|
import {
|
|
134
153
|
embedCommand,
|
|
135
154
|
registerEmbedCommand
|
|
136
|
-
} from "./chunk-
|
|
155
|
+
} from "./chunk-ECRZL5XR.js";
|
|
156
|
+
import {
|
|
157
|
+
loadVaultQmdConfig,
|
|
158
|
+
removeQmdCollection
|
|
159
|
+
} from "./chunk-WIOLLGAD.js";
|
|
137
160
|
import {
|
|
138
161
|
QMD_INSTALL_COMMAND,
|
|
139
162
|
QMD_INSTALL_URL,
|
|
163
|
+
QmdConfigurationError,
|
|
140
164
|
QmdUnavailableError,
|
|
141
165
|
SearchEngine,
|
|
142
166
|
extractTags,
|
|
143
167
|
extractWikiLinks,
|
|
168
|
+
getQmdErrorDetails,
|
|
144
169
|
hasQmd,
|
|
145
170
|
qmdEmbed,
|
|
146
171
|
qmdUpdate
|
|
147
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-5PJ4STIC.js";
|
|
148
173
|
import {
|
|
149
174
|
buildInjectionResult,
|
|
150
175
|
deterministicInjectMatches,
|
|
@@ -152,11 +177,7 @@ import {
|
|
|
152
177
|
injectCommand,
|
|
153
178
|
registerInjectCommand,
|
|
154
179
|
runPromptInjection
|
|
155
|
-
} from "./chunk-
|
|
156
|
-
import {
|
|
157
|
-
requestLlmCompletion,
|
|
158
|
-
resolveLlmProvider
|
|
159
|
-
} from "./chunk-HIHOUSXS.js";
|
|
180
|
+
} from "./chunk-YNIPYN4F.js";
|
|
160
181
|
import {
|
|
161
182
|
SUPPORTED_CONFIG_KEYS,
|
|
162
183
|
addRouteRule,
|
|
@@ -169,7 +190,11 @@ import {
|
|
|
169
190
|
resetConfig,
|
|
170
191
|
setConfigValue,
|
|
171
192
|
testRouteRule
|
|
172
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-URXDAUVH.js";
|
|
194
|
+
import {
|
|
195
|
+
requestLlmCompletion,
|
|
196
|
+
resolveLlmProvider
|
|
197
|
+
} from "./chunk-YXQCA6B7.js";
|
|
173
198
|
import {
|
|
174
199
|
DEFAULT_CATEGORIES,
|
|
175
200
|
DEFAULT_CONFIG,
|
|
@@ -179,7 +204,7 @@ import {
|
|
|
179
204
|
import {
|
|
180
205
|
archiveCommand,
|
|
181
206
|
registerArchiveCommand
|
|
182
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-2RAZ4ZFE.js";
|
|
183
208
|
import {
|
|
184
209
|
archiveObservations
|
|
185
210
|
} from "./chunk-MQUJNOHK.js";
|
|
@@ -187,7 +212,7 @@ import {
|
|
|
187
212
|
findNearestVaultPath,
|
|
188
213
|
getVaultPath,
|
|
189
214
|
resolveVaultPath
|
|
190
|
-
} from "./chunk-
|
|
215
|
+
} from "./chunk-GNJL4YGR.js";
|
|
191
216
|
import {
|
|
192
217
|
MEMORY_GRAPH_SCHEMA_VERSION,
|
|
193
218
|
buildOrUpdateMemoryGraphIndex,
|
|
@@ -217,14 +242,254 @@ import {
|
|
|
217
242
|
checkOpenClawCompatibility,
|
|
218
243
|
compatCommand,
|
|
219
244
|
compatibilityExitCode
|
|
220
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-X3SPPUFG.js";
|
|
246
|
+
import "./chunk-2ZDO52B4.js";
|
|
221
247
|
|
|
222
248
|
// src/index.ts
|
|
249
|
+
import * as fs2 from "fs";
|
|
250
|
+
|
|
251
|
+
// src/commands/migrate.ts
|
|
223
252
|
import * as fs from "fs";
|
|
253
|
+
import * as path from "path";
|
|
254
|
+
import { execFileSync } from "child_process";
|
|
255
|
+
function addQmdCollection(name, rootPath) {
|
|
256
|
+
execFileSync("qmd", ["collection", "add", name, rootPath], { stdio: "ignore" });
|
|
257
|
+
}
|
|
258
|
+
function updateVaultConfig(vaultPath, updates) {
|
|
259
|
+
const configPath = path.join(vaultPath, ".clawvault.json");
|
|
260
|
+
let config = {};
|
|
261
|
+
if (fs.existsSync(configPath)) {
|
|
262
|
+
try {
|
|
263
|
+
config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
264
|
+
} catch {
|
|
265
|
+
config = {};
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (updates.qmdCollection !== void 0) {
|
|
269
|
+
config.qmdCollection = updates.qmdCollection;
|
|
270
|
+
}
|
|
271
|
+
if (updates.qmdRoot !== void 0) {
|
|
272
|
+
config.qmdRoot = updates.qmdRoot;
|
|
273
|
+
}
|
|
274
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
275
|
+
}
|
|
276
|
+
function fixStaleCollectionName(issue, dryRun) {
|
|
277
|
+
const details = issue.details;
|
|
278
|
+
const action = {
|
|
279
|
+
type: "stale_collection_name",
|
|
280
|
+
description: `Rename collection "${details.oldName}" to "${details.newName}"`,
|
|
281
|
+
success: false
|
|
282
|
+
};
|
|
283
|
+
if (dryRun) {
|
|
284
|
+
action.success = true;
|
|
285
|
+
action.description += " (dry run)";
|
|
286
|
+
return action;
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
removeQmdCollection(details.oldName);
|
|
290
|
+
addQmdCollection(details.newName, details.root);
|
|
291
|
+
action.success = true;
|
|
292
|
+
} catch (err) {
|
|
293
|
+
action.error = err?.message || "Failed to rename collection";
|
|
294
|
+
}
|
|
295
|
+
return action;
|
|
296
|
+
}
|
|
297
|
+
function fixMissingQmdCollection(issue, dryRun) {
|
|
298
|
+
const details = issue.details;
|
|
299
|
+
const action = {
|
|
300
|
+
type: "missing_qmd_collection",
|
|
301
|
+
description: `Create qmd collection "${details.collectionName}" at "${details.expectedRoot}"`,
|
|
302
|
+
success: false
|
|
303
|
+
};
|
|
304
|
+
if (dryRun) {
|
|
305
|
+
action.success = true;
|
|
306
|
+
action.description += " (dry run)";
|
|
307
|
+
return action;
|
|
308
|
+
}
|
|
309
|
+
try {
|
|
310
|
+
addQmdCollection(details.collectionName, details.expectedRoot);
|
|
311
|
+
action.success = true;
|
|
312
|
+
} catch (err) {
|
|
313
|
+
action.error = err?.message || "Failed to create collection";
|
|
314
|
+
}
|
|
315
|
+
return action;
|
|
316
|
+
}
|
|
317
|
+
function fixWrongVaultPath(issue, dryRun) {
|
|
318
|
+
const details = issue.details;
|
|
319
|
+
const action = {
|
|
320
|
+
type: "wrong_vault_path",
|
|
321
|
+
description: `Update collection "${details.collectionName}" path from "${details.currentRoot}" to "${details.expectedRoot}"`,
|
|
322
|
+
success: false
|
|
323
|
+
};
|
|
324
|
+
if (dryRun) {
|
|
325
|
+
action.success = true;
|
|
326
|
+
action.description += " (dry run)";
|
|
327
|
+
return action;
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
removeQmdCollection(details.collectionName);
|
|
331
|
+
addQmdCollection(details.collectionName, details.expectedRoot);
|
|
332
|
+
action.success = true;
|
|
333
|
+
} catch (err) {
|
|
334
|
+
action.error = err?.message || "Failed to update collection path";
|
|
335
|
+
}
|
|
336
|
+
return action;
|
|
337
|
+
}
|
|
338
|
+
function fixOrphanedCollection(issue, dryRun) {
|
|
339
|
+
const details = issue.details;
|
|
340
|
+
const action = {
|
|
341
|
+
type: "orphaned_collection",
|
|
342
|
+
description: `Remove orphaned collection "${details.collectionName}"`,
|
|
343
|
+
success: false
|
|
344
|
+
};
|
|
345
|
+
if (dryRun) {
|
|
346
|
+
action.success = true;
|
|
347
|
+
action.description += " (dry run)";
|
|
348
|
+
return action;
|
|
349
|
+
}
|
|
350
|
+
try {
|
|
351
|
+
removeQmdCollection(details.collectionName);
|
|
352
|
+
action.success = true;
|
|
353
|
+
} catch (err) {
|
|
354
|
+
action.error = err?.message || "Failed to remove orphaned collection";
|
|
355
|
+
}
|
|
356
|
+
return action;
|
|
357
|
+
}
|
|
358
|
+
function fixMissingQmdConfig(issue, vaultPath, dryRun) {
|
|
359
|
+
const vaultConfig = loadVaultQmdConfig(vaultPath);
|
|
360
|
+
const action = {
|
|
361
|
+
type: "missing_qmd_config",
|
|
362
|
+
description: `Add qmdCollection="${vaultConfig.qmdCollection}" and qmdRoot="${vaultConfig.qmdRoot}" to .clawvault.json`,
|
|
363
|
+
success: false
|
|
364
|
+
};
|
|
365
|
+
if (dryRun) {
|
|
366
|
+
action.success = true;
|
|
367
|
+
action.description += " (dry run)";
|
|
368
|
+
return action;
|
|
369
|
+
}
|
|
370
|
+
try {
|
|
371
|
+
updateVaultConfig(vaultPath, {
|
|
372
|
+
qmdCollection: vaultConfig.qmdCollection,
|
|
373
|
+
qmdRoot: vaultConfig.qmdRoot
|
|
374
|
+
});
|
|
375
|
+
action.success = true;
|
|
376
|
+
} catch (err) {
|
|
377
|
+
action.error = err?.message || "Failed to update vault config";
|
|
378
|
+
}
|
|
379
|
+
return action;
|
|
380
|
+
}
|
|
381
|
+
function fixIssue(issue, vaultPath, dryRun) {
|
|
382
|
+
if (!issue.autoFixable) {
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
switch (issue.type) {
|
|
386
|
+
case "stale_collection_name":
|
|
387
|
+
return fixStaleCollectionName(issue, dryRun);
|
|
388
|
+
case "missing_qmd_collection":
|
|
389
|
+
return fixMissingQmdCollection(issue, dryRun);
|
|
390
|
+
case "wrong_vault_path":
|
|
391
|
+
return fixWrongVaultPath(issue, dryRun);
|
|
392
|
+
case "orphaned_collection":
|
|
393
|
+
return fixOrphanedCollection(issue, dryRun);
|
|
394
|
+
case "missing_qmd_config":
|
|
395
|
+
return fixMissingQmdConfig(issue, vaultPath, dryRun);
|
|
396
|
+
default:
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
async function migrate(options = {}) {
|
|
401
|
+
const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
|
|
402
|
+
const dryRun = options.dryRun ?? false;
|
|
403
|
+
if (!hasQmd()) {
|
|
404
|
+
return {
|
|
405
|
+
vaultPath,
|
|
406
|
+
issuesFound: 1,
|
|
407
|
+
issuesFixed: 0,
|
|
408
|
+
actions: [{
|
|
409
|
+
type: "missing_qmd_collection",
|
|
410
|
+
description: "qmd is not installed",
|
|
411
|
+
success: false,
|
|
412
|
+
error: `Install qmd first: ${QMD_INSTALL_COMMAND}
|
|
413
|
+
More info: ${QMD_INSTALL_URL}`
|
|
414
|
+
}],
|
|
415
|
+
dryRun
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
const report = await doctor(vaultPath);
|
|
419
|
+
const issues = report.migrationIssues;
|
|
420
|
+
const actions = [];
|
|
421
|
+
for (const issue of issues) {
|
|
422
|
+
const action = fixIssue(issue, vaultPath, dryRun);
|
|
423
|
+
if (action) {
|
|
424
|
+
actions.push(action);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const issuesFixed = actions.filter((a) => a.success).length;
|
|
428
|
+
return {
|
|
429
|
+
vaultPath,
|
|
430
|
+
issuesFound: issues.length,
|
|
431
|
+
issuesFixed,
|
|
432
|
+
actions,
|
|
433
|
+
dryRun
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
function formatMigrateResult(result) {
|
|
437
|
+
const lines = [];
|
|
438
|
+
lines.push("ClawVault Migration Report");
|
|
439
|
+
lines.push("-".repeat(30));
|
|
440
|
+
lines.push(`Vault: ${result.vaultPath}`);
|
|
441
|
+
lines.push(`Mode: ${result.dryRun ? "Dry Run" : "Live"}`);
|
|
442
|
+
lines.push("");
|
|
443
|
+
if (result.issuesFound === 0) {
|
|
444
|
+
lines.push("\u2713 No migration issues found. Your vault is up to date.");
|
|
445
|
+
return lines.join("\n");
|
|
446
|
+
}
|
|
447
|
+
lines.push(`Found ${result.issuesFound} issue(s)`);
|
|
448
|
+
lines.push("");
|
|
449
|
+
for (const action of result.actions) {
|
|
450
|
+
const prefix = action.success ? "\u2713" : "\u2717";
|
|
451
|
+
lines.push(`${prefix} ${action.description}`);
|
|
452
|
+
if (action.error) {
|
|
453
|
+
lines.push(` Error: ${action.error}`);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
lines.push("");
|
|
457
|
+
if (result.dryRun) {
|
|
458
|
+
lines.push(`Would fix ${result.issuesFixed}/${result.issuesFound} issue(s).`);
|
|
459
|
+
lines.push("Run without --dry-run to apply changes.");
|
|
460
|
+
} else {
|
|
461
|
+
lines.push(`Fixed ${result.issuesFixed}/${result.issuesFound} issue(s).`);
|
|
462
|
+
if (result.issuesFixed < result.issuesFound) {
|
|
463
|
+
lines.push("Some issues require manual intervention.");
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return lines.join("\n");
|
|
467
|
+
}
|
|
468
|
+
async function migrateCommand(options = {}) {
|
|
469
|
+
const result = await migrate(options);
|
|
470
|
+
if (options.json) {
|
|
471
|
+
console.log(JSON.stringify(result, null, 2));
|
|
472
|
+
} else {
|
|
473
|
+
console.log(formatMigrateResult(result));
|
|
474
|
+
}
|
|
475
|
+
return result;
|
|
476
|
+
}
|
|
477
|
+
function registerMigrateCommand(program) {
|
|
478
|
+
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) => {
|
|
479
|
+
await migrateCommand({
|
|
480
|
+
vaultPath: rawOptions.vault,
|
|
481
|
+
dryRun: rawOptions.dryRun,
|
|
482
|
+
force: rawOptions.force,
|
|
483
|
+
json: rawOptions.json
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// src/index.ts
|
|
224
489
|
function readPackageVersion() {
|
|
225
490
|
try {
|
|
226
491
|
const pkgUrl = new URL("../package.json", import.meta.url);
|
|
227
|
-
const pkg = JSON.parse(
|
|
492
|
+
const pkg = JSON.parse(fs2.readFileSync(pkgUrl, "utf-8"));
|
|
228
493
|
return pkg.version ?? "0.0.0";
|
|
229
494
|
} catch {
|
|
230
495
|
return "0.0.0";
|
|
@@ -241,11 +506,14 @@ export {
|
|
|
241
506
|
DEFAULT_CATEGORIES,
|
|
242
507
|
DEFAULT_CONFIG,
|
|
243
508
|
DEFAULT_SERVE_PORT,
|
|
509
|
+
EmbeddingCache,
|
|
510
|
+
FactStore,
|
|
244
511
|
MEMORY_GRAPH_SCHEMA_VERSION,
|
|
245
512
|
MEMORY_TYPES,
|
|
246
513
|
Observer,
|
|
247
514
|
QMD_INSTALL_COMMAND,
|
|
248
515
|
QMD_INSTALL_URL,
|
|
516
|
+
QmdConfigurationError,
|
|
249
517
|
QmdUnavailableError,
|
|
250
518
|
Reflector,
|
|
251
519
|
SUPPORTED_CONFIG_KEYS,
|
|
@@ -273,16 +541,26 @@ export {
|
|
|
273
541
|
completeTask,
|
|
274
542
|
configureTailscaleServe,
|
|
275
543
|
contextCommand,
|
|
544
|
+
cosineSimilarity,
|
|
276
545
|
countBlockedTransitions,
|
|
546
|
+
createDefaultAdapter,
|
|
547
|
+
createFactExtractionAdapter,
|
|
548
|
+
createGeminiFlashAdapter,
|
|
549
|
+
createLlmFunction,
|
|
277
550
|
createProject,
|
|
278
551
|
createVault,
|
|
279
552
|
deterministicInjectMatches,
|
|
280
553
|
discoverClawVaultPeers,
|
|
281
554
|
doctor,
|
|
555
|
+
embed,
|
|
556
|
+
embedBatch,
|
|
282
557
|
embedCommand,
|
|
283
558
|
extractCardSlug,
|
|
559
|
+
extractFactsLlm,
|
|
560
|
+
extractFactsRuleBased,
|
|
284
561
|
extractTags,
|
|
285
562
|
extractWikiLinks,
|
|
563
|
+
factId,
|
|
286
564
|
fetchRemoteFile,
|
|
287
565
|
fetchRemoteManifest,
|
|
288
566
|
findNearestVaultPath,
|
|
@@ -301,6 +579,7 @@ export {
|
|
|
301
579
|
getOnlinePeers,
|
|
302
580
|
getProjectActivity,
|
|
303
581
|
getProjectTasks,
|
|
582
|
+
getQmdErrorDetails,
|
|
304
583
|
getScaledObservationThresholdBytes,
|
|
305
584
|
getTailscaleStatus,
|
|
306
585
|
getTailscaleVersion,
|
|
@@ -309,6 +588,7 @@ export {
|
|
|
309
588
|
graphSummary,
|
|
310
589
|
hasQmd,
|
|
311
590
|
hasTailscale,
|
|
591
|
+
hybridSearch,
|
|
312
592
|
importKanbanBoard,
|
|
313
593
|
indexInjectableItems,
|
|
314
594
|
inferContextProfile,
|
|
@@ -322,9 +602,12 @@ export {
|
|
|
322
602
|
listSubtasks,
|
|
323
603
|
loadMemoryGraphIndex,
|
|
324
604
|
matchRouteRule,
|
|
605
|
+
migrate,
|
|
606
|
+
migrateCommand,
|
|
325
607
|
migrateObservations,
|
|
326
608
|
migrateObservationsCommand,
|
|
327
609
|
normalizeContextProfileInput,
|
|
610
|
+
normalizeEntity,
|
|
328
611
|
observeActiveSessions,
|
|
329
612
|
observeCommand,
|
|
330
613
|
parseKanbanMarkdown,
|
|
@@ -337,6 +620,7 @@ export {
|
|
|
337
620
|
readAllTransitions,
|
|
338
621
|
readProject,
|
|
339
622
|
rebuildCommand,
|
|
623
|
+
reciprocalRankFusion,
|
|
340
624
|
reflectCommand,
|
|
341
625
|
registerArchiveCommand,
|
|
342
626
|
registerCliCommands,
|
|
@@ -344,6 +628,7 @@ export {
|
|
|
344
628
|
registerContextCommand,
|
|
345
629
|
registerEmbedCommand,
|
|
346
630
|
registerInjectCommand,
|
|
631
|
+
registerMigrateCommand,
|
|
347
632
|
registerMigrateObservationsCommand,
|
|
348
633
|
registerObserveCommand,
|
|
349
634
|
registerRebuildCommand,
|
|
@@ -361,11 +646,13 @@ export {
|
|
|
361
646
|
requestLlmCompletion,
|
|
362
647
|
resetConfig,
|
|
363
648
|
resolveContextProfile,
|
|
649
|
+
resolveFactExtractionMode,
|
|
364
650
|
resolveLlmProvider,
|
|
365
651
|
resolvePeerIP,
|
|
366
652
|
resolveVaultPath,
|
|
367
653
|
runPromptInjection,
|
|
368
654
|
runReflection,
|
|
655
|
+
semanticSearch,
|
|
369
656
|
serveVault,
|
|
370
657
|
sessionRecapCommand,
|
|
371
658
|
setConfigValue,
|
|
@@ -57,7 +57,7 @@ declare function getMemoryGraph(vaultPath: string, options?: {
|
|
|
57
57
|
refresh?: boolean;
|
|
58
58
|
}): Promise<MemoryGraph>;
|
|
59
59
|
|
|
60
|
-
type LlmProvider = 'anthropic' | 'openai' | 'gemini';
|
|
60
|
+
type LlmProvider = 'anthropic' | 'openai' | 'gemini' | 'xai' | 'openclaw';
|
|
61
61
|
interface LlmCompletionOptions {
|
|
62
62
|
prompt: string;
|
|
63
63
|
provider?: LlmProvider | null;
|
|
@@ -134,4 +134,4 @@ declare function buildInjectionResult(message: string, options: InjectCommandOpt
|
|
|
134
134
|
declare function injectCommand(message: string, options: InjectCommandOptions): Promise<void>;
|
|
135
135
|
declare function registerInjectCommand(program: Command): void;
|
|
136
136
|
|
|
137
|
-
export { runPromptInjection as A, type InjectCommandOptions as I, type
|
|
137
|
+
export { runPromptInjection as A, type InjectCommandOptions as I, type LlmProvider as L, MEMORY_GRAPH_SCHEMA_VERSION as M, type InjectFormat as a, type InjectMatch as b, type InjectMatchReason as c, type InjectMatchSource as d, type InjectResult as e, type InjectRuntimeOptions as f, type InjectSourceCategory as g, type InjectableItem as h, type LlmCompletionOptions as i, type MemoryGraph as j, type MemoryGraphEdge as k, type MemoryGraphEdgeType as l, type MemoryGraphIndex as m, type MemoryGraphNode as n, type MemoryGraphNodeType as o, type MemoryGraphStats as p, buildInjectionResult as q, buildOrUpdateMemoryGraphIndex as r, deterministicInjectMatches as s, getMemoryGraph as t, indexInjectableItems as u, injectCommand as v, loadMemoryGraphIndex as w, registerInjectCommand as x, requestLlmCompletion as y, resolveLlmProvider as z };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { LedgerEntry, LedgerOp } from './workgraph/types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Append-only event ledger.
|
|
5
|
+
*
|
|
6
|
+
* Every mutation to the workgraph is logged here. This is the source of truth
|
|
7
|
+
* for coordination: who claimed what, when, and what's available.
|
|
8
|
+
*
|
|
9
|
+
* Format: one JSON object per line (.jsonl) in `.clawvault/ledger.jsonl`.
|
|
10
|
+
* Agents read the ledger to know the state of the world.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
declare function ledgerPath(vaultPath: string): string;
|
|
14
|
+
declare function append(vaultPath: string, actor: string, op: LedgerOp, target: string, type?: string, data?: Record<string, unknown>): LedgerEntry;
|
|
15
|
+
declare function readAll(vaultPath: string): LedgerEntry[];
|
|
16
|
+
declare function readSince(vaultPath: string, since: string): LedgerEntry[];
|
|
17
|
+
/** Get the current owner of a target (last claim without a subsequent release/done). */
|
|
18
|
+
declare function currentOwner(vaultPath: string, target: string): string | null;
|
|
19
|
+
/** Check if a target is currently claimed by any agent. */
|
|
20
|
+
declare function isClaimed(vaultPath: string, target: string): boolean;
|
|
21
|
+
/** Get all entries for a specific target. */
|
|
22
|
+
declare function historyOf(vaultPath: string, target: string): LedgerEntry[];
|
|
23
|
+
/** Get all entries by a specific actor. */
|
|
24
|
+
declare function activityOf(vaultPath: string, actor: string): LedgerEntry[];
|
|
25
|
+
/** Get all currently claimed targets and their owners. */
|
|
26
|
+
declare function allClaims(vaultPath: string): Map<string, string>;
|
|
27
|
+
/** Get recent ledger entries (last N). */
|
|
28
|
+
declare function recent(vaultPath: string, count?: number): LedgerEntry[];
|
|
29
|
+
|
|
30
|
+
declare const ledger_activityOf: typeof activityOf;
|
|
31
|
+
declare const ledger_allClaims: typeof allClaims;
|
|
32
|
+
declare const ledger_append: typeof append;
|
|
33
|
+
declare const ledger_currentOwner: typeof currentOwner;
|
|
34
|
+
declare const ledger_historyOf: typeof historyOf;
|
|
35
|
+
declare const ledger_isClaimed: typeof isClaimed;
|
|
36
|
+
declare const ledger_ledgerPath: typeof ledgerPath;
|
|
37
|
+
declare const ledger_readAll: typeof readAll;
|
|
38
|
+
declare const ledger_readSince: typeof readSince;
|
|
39
|
+
declare const ledger_recent: typeof recent;
|
|
40
|
+
declare namespace ledger {
|
|
41
|
+
export { ledger_activityOf as activityOf, ledger_allClaims as allClaims, ledger_append as append, ledger_currentOwner as currentOwner, ledger_historyOf as historyOf, ledger_isClaimed as isClaimed, ledger_ledgerPath as ledgerPath, ledger_readAll as readAll, ledger_readSince as readSince, ledger_recent as recent };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { activityOf as a, allClaims as b, append as c, currentOwner as d, ledgerPath as e, readSince as f, recent as g, historyOf as h, isClaimed as i, ledger as l, readAll as r };
|
package/dist/lib/auto-linker.js
CHANGED
package/dist/lib/config.d.ts
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
|
+
interface AgentVaultsConfig {
|
|
2
|
+
[agentName: string]: string;
|
|
3
|
+
}
|
|
4
|
+
interface PluginConfig {
|
|
5
|
+
vaultPath?: string;
|
|
6
|
+
agentVaults?: AgentVaultsConfig;
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
9
|
* Get the vault path from CLAWVAULT_PATH env var or throw
|
|
3
10
|
*/
|
|
4
11
|
declare function getVaultPath(): string;
|
|
5
12
|
declare function findNearestVaultPath(startPath?: string): string | null;
|
|
6
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Resolve vault path for a specific agent from agentVaults config
|
|
15
|
+
*/
|
|
16
|
+
declare function resolveAgentVaultPath(agentVaults: AgentVaultsConfig | undefined, agentId: string | undefined): string | null;
|
|
17
|
+
interface ResolveVaultPathOptions {
|
|
7
18
|
explicitPath?: string;
|
|
8
19
|
cwd?: string;
|
|
9
|
-
|
|
20
|
+
agentId?: string;
|
|
21
|
+
pluginConfig?: PluginConfig;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolve vault path with support for per-agent vault paths.
|
|
25
|
+
*
|
|
26
|
+
* Resolution order:
|
|
27
|
+
* 1. Explicit path (--vault flag)
|
|
28
|
+
* 2. Per-agent vault from agentVaults config (if agentId provided)
|
|
29
|
+
* 3. Plugin config vaultPath (fallback for all agents)
|
|
30
|
+
* 4. CLAWVAULT_PATH environment variable
|
|
31
|
+
* 5. Walk up from cwd to find nearest vault
|
|
32
|
+
*/
|
|
33
|
+
declare function resolveVaultPath(options?: ResolveVaultPathOptions): string;
|
|
10
34
|
|
|
11
|
-
export { findNearestVaultPath, getVaultPath, resolveVaultPath };
|
|
35
|
+
export { type AgentVaultsConfig, type PluginConfig, type ResolveVaultPathOptions, findNearestVaultPath, getVaultPath, resolveAgentVaultPath, resolveVaultPath };
|
package/dist/lib/config.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findNearestVaultPath,
|
|
3
3
|
getVaultPath,
|
|
4
|
+
resolveAgentVaultPath,
|
|
4
5
|
resolveVaultPath
|
|
5
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-GNJL4YGR.js";
|
|
7
|
+
import "../chunk-2ZDO52B4.js";
|
|
6
8
|
export {
|
|
7
9
|
findNearestVaultPath,
|
|
8
10
|
getVaultPath,
|
|
11
|
+
resolveAgentVaultPath,
|
|
9
12
|
resolveVaultPath
|
|
10
13
|
};
|