clawvault 3.0.0 → 3.2.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.
- package/README.md +352 -20
- package/bin/clawvault.js +8 -2
- package/bin/command-registration.test.js +3 -1
- package/bin/command-runtime.js +9 -1
- package/bin/register-core-commands.js +23 -10
- package/bin/register-maintenance-commands.js +39 -3
- package/bin/register-query-commands.js +58 -29
- package/bin/register-task-commands.js +18 -1
- package/bin/register-task-commands.test.js +16 -0
- package/bin/register-vault-operations-commands.js +29 -1
- package/bin/register-workgraph-commands.js +1368 -0
- package/dashboard/lib/graph-diff.js +104 -0
- package/dashboard/lib/graph-diff.test.js +75 -0
- package/dashboard/lib/vault-parser.js +556 -0
- package/dashboard/lib/vault-parser.test.js +254 -0
- package/dashboard/public/app.js +796 -0
- package/dashboard/public/index.html +52 -0
- package/dashboard/public/styles.css +221 -0
- package/dashboard/server.js +374 -0
- package/dist/{chunk-F2JEUD4J.js → chunk-23YDQ3QU.js} +6 -8
- package/dist/{chunk-C7OK5WKP.js → chunk-2JQ3O2YL.js} +4 -4
- package/dist/{chunk-VR5NE7PZ.js → chunk-2RAZ4ZFE.js} +1 -1
- package/dist/chunk-2ZDO52B4.js +52 -0
- package/dist/{chunk-ZZA73MFY.js → chunk-33DOSHTA.js} +176 -36
- package/dist/chunk-33VSQP4J.js +37 -0
- package/dist/chunk-4BQTQMJP.js +93 -0
- package/dist/{chunk-GUKMRGM7.js → chunk-4OXMU5S2.js} +1 -1
- package/dist/{chunk-62YTUT6J.js → chunk-4PY655YM.js} +15 -3
- package/dist/chunk-6FH3IULF.js +352 -0
- package/dist/{chunk-3NSBOUT3.js → chunk-77Q5CSPJ.js} +404 -80
- package/dist/{chunk-4VQTUVH7.js → chunk-7YZWHM36.js} +52 -26
- package/dist/chunk-BSJ6RIT7.js +447 -0
- package/dist/chunk-BUEW6IIK.js +364 -0
- package/dist/{chunk-WGRQ6HDV.js → chunk-CLJTREDS.js} +74 -14
- package/dist/chunk-EK6S23ZB.js +469 -0
- package/dist/{chunk-LNJA2UGL.js → chunk-ESFLMDRB.js} +9 -86
- package/dist/{chunk-H34S76MB.js → chunk-ESVS6K2B.js} +6 -6
- package/dist/{chunk-WAZ3NLWL.js → chunk-F55HGNU4.js} +0 -47
- package/dist/{chunk-QK3UCXWL.js → chunk-FHFUXL6G.js} +2 -2
- package/dist/{chunk-YKTA5JOJ.js → chunk-GAOWA7GR.js} +212 -46
- package/dist/chunk-GGA32J2R.js +784 -0
- package/dist/chunk-GNJL4YGR.js +79 -0
- package/dist/chunk-MDIH26GC.js +183 -0
- package/dist/{chunk-LYHGEHXG.js → chunk-MFAWT5O5.js} +0 -1
- package/dist/chunk-MM6QGW3P.js +207 -0
- package/dist/{chunk-P5EPF6MB.js → chunk-MW5C6ZQA.js} +110 -13
- package/dist/chunk-NCKFNBHJ.js +257 -0
- package/dist/{chunk-QBLMXKF2.js → chunk-OIWVQYQF.js} +1 -1
- package/dist/{chunk-42MXU7A6.js → chunk-P62WHA27.js} +58 -47
- package/dist/chunk-PBACDKKP.js +66 -0
- package/dist/{chunk-VGLOTGAS.js → chunk-QSHD36LH.js} +2 -2
- package/dist/{chunk-OZ7RIXTO.js → chunk-QSRRMEYM.js} +2 -2
- package/dist/chunk-QVEERJSP.js +152 -0
- package/dist/{chunk-N2AXRYLC.js → chunk-QWQ3TIKS.js} +1 -1
- package/dist/{chunk-3DHXQHYG.js → chunk-R2MIW5G7.js} +1 -1
- package/dist/{chunk-SJSFRIYS.js → chunk-SLXOR3CC.js} +2 -2
- package/dist/chunk-SS4B7P7V.js +99 -0
- package/dist/{chunk-JY6FYXIT.js → chunk-STCQGCEQ.js} +6 -11
- package/dist/chunk-U4O6C46S.js +154 -0
- package/dist/{chunk-ITPEXLHA.js → chunk-URXDAUVH.js} +24 -5
- package/dist/chunk-VSL7KY3M.js +189 -0
- package/dist/{chunk-U55BGUAU.js → chunk-W4SPAEE7.js} +6 -6
- package/dist/chunk-WMGIIABP.js +15 -0
- package/dist/{chunk-3D6BCTP6.js → chunk-X3SPPUFG.js} +51 -39
- package/dist/{chunk-THRJVD4L.js → chunk-Y6VJKXGL.js} +1 -1
- package/dist/{chunk-ZVVFWOLW.js → chunk-ZN54U2OZ.js} +123 -10
- package/dist/cli/index.js +32 -25
- package/dist/commands/archive.js +3 -3
- package/dist/commands/backlog.js +3 -3
- package/dist/commands/blocked.js +3 -3
- package/dist/commands/canvas.d.ts +15 -0
- package/dist/commands/canvas.js +200 -0
- package/dist/commands/checkpoint.js +2 -2
- package/dist/commands/compat.js +2 -2
- package/dist/commands/context.js +8 -6
- package/dist/commands/doctor.d.ts +11 -7
- package/dist/commands/doctor.js +18 -16
- package/dist/commands/embed.js +5 -6
- package/dist/commands/entities.js +2 -2
- package/dist/commands/graph.js +4 -4
- package/dist/commands/inject.d.ts +1 -1
- package/dist/commands/inject.js +5 -6
- package/dist/commands/kanban.js +4 -4
- package/dist/commands/link.js +5 -5
- package/dist/commands/migrate-observations.js +4 -4
- package/dist/commands/observe.d.ts +0 -1
- package/dist/commands/observe.js +14 -13
- package/dist/commands/project.js +5 -5
- package/dist/commands/rebuild-embeddings.d.ts +21 -0
- package/dist/commands/rebuild-embeddings.js +91 -0
- package/dist/commands/rebuild.js +12 -11
- package/dist/commands/recover.js +3 -3
- package/dist/commands/reflect.js +6 -7
- package/dist/commands/repair-session.js +1 -1
- package/dist/commands/replay.js +14 -14
- package/dist/commands/session-recap.js +1 -1
- package/dist/commands/setup.d.ts +2 -90
- package/dist/commands/setup.js +3 -21
- package/dist/commands/shell-init.js +1 -1
- package/dist/commands/sleep.d.ts +1 -1
- package/dist/commands/sleep.js +20 -19
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +57 -35
- package/dist/commands/sync-bd.d.ts +10 -0
- package/dist/commands/sync-bd.js +10 -0
- package/dist/commands/tailscale.js +3 -3
- package/dist/commands/task.js +4 -4
- package/dist/commands/template.js +2 -2
- package/dist/commands/wake.d.ts +1 -1
- package/dist/commands/wake.js +11 -10
- package/dist/commands/workgraph.d.ts +124 -0
- package/dist/commands/workgraph.js +38 -0
- package/dist/index.d.ts +337 -191
- package/dist/index.js +387 -118
- package/dist/{inject-Bzi5E-By.d.cts → inject-DYUrDqQO.d.ts} +3 -3
- package/dist/ledger-B7g7jhqG.d.ts +44 -0
- package/dist/lib/auto-linker.js +2 -2
- package/dist/lib/canvas-layout.d.ts +100 -16
- package/dist/lib/canvas-layout.js +21 -78
- package/dist/lib/config.d.ts +27 -3
- package/dist/lib/config.js +4 -2
- package/dist/lib/entity-index.js +1 -1
- package/dist/lib/project-utils.js +4 -4
- package/dist/lib/session-repair.js +1 -1
- package/dist/lib/session-utils.js +1 -1
- package/dist/lib/tailscale.js +1 -1
- package/dist/lib/task-utils.js +3 -3
- package/dist/lib/template-engine.js +1 -1
- package/dist/lib/webdav.js +1 -1
- 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/openclaw-plugin.d.ts +8 -0
- package/dist/openclaw-plugin.js +14 -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-Y2_Um2Ls.d.cts → types-BbWJoC1c.d.ts} +1 -44
- 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 +760 -78
- package/hooks/clawvault/handler.test.js +235 -79
- package/hooks/clawvault/openclaw.plugin.json +72 -0
- package/openclaw.plugin.json +65 -38
- package/package.json +15 -18
- package/dist/chunk-3RG5ZIWI.js +0 -10
- package/dist/chunk-6U6MK36V.js +0 -205
- package/dist/chunk-7R7O6STJ.js +0 -88
- package/dist/chunk-CMB7UL7C.js +0 -327
- package/dist/chunk-DEFFDRVP.js +0 -938
- package/dist/chunk-E7MFQB6D.js +0 -163
- package/dist/chunk-GAJV4IGR.js +0 -82
- package/dist/chunk-GQSLDZTS.js +0 -560
- package/dist/chunk-K234IDRJ.js +0 -1073
- package/dist/chunk-MFM6K7PU.js +0 -374
- package/dist/chunk-MXSSG3QU.js +0 -42
- package/dist/chunk-PAH27GSN.js +0 -108
- package/dist/cli/index.cjs +0 -10033
- package/dist/cli/index.d.cts +0 -5
- package/dist/commands/archive.cjs +0 -287
- package/dist/commands/archive.d.cts +0 -11
- package/dist/commands/backlog.cjs +0 -721
- package/dist/commands/backlog.d.cts +0 -53
- package/dist/commands/blocked.cjs +0 -204
- package/dist/commands/blocked.d.cts +0 -26
- package/dist/commands/checkpoint.cjs +0 -244
- package/dist/commands/checkpoint.d.cts +0 -41
- package/dist/commands/compat.cjs +0 -369
- package/dist/commands/compat.d.cts +0 -28
- package/dist/commands/context.cjs +0 -2989
- package/dist/commands/context.d.cts +0 -2
- package/dist/commands/doctor.cjs +0 -3062
- package/dist/commands/doctor.d.cts +0 -21
- package/dist/commands/embed.cjs +0 -232
- package/dist/commands/embed.d.cts +0 -17
- package/dist/commands/entities.cjs +0 -141
- package/dist/commands/entities.d.cts +0 -7
- package/dist/commands/graph.cjs +0 -501
- package/dist/commands/graph.d.cts +0 -21
- package/dist/commands/inject.cjs +0 -1636
- package/dist/commands/inject.d.cts +0 -2
- package/dist/commands/kanban.cjs +0 -884
- package/dist/commands/kanban.d.cts +0 -63
- package/dist/commands/link.cjs +0 -965
- package/dist/commands/link.d.cts +0 -11
- package/dist/commands/migrate-observations.cjs +0 -362
- package/dist/commands/migrate-observations.d.cts +0 -19
- package/dist/commands/observe.cjs +0 -4099
- package/dist/commands/observe.d.cts +0 -23
- package/dist/commands/project.cjs +0 -1341
- package/dist/commands/project.d.cts +0 -85
- package/dist/commands/rebuild.cjs +0 -3136
- package/dist/commands/rebuild.d.cts +0 -11
- package/dist/commands/recover.cjs +0 -361
- package/dist/commands/recover.d.cts +0 -38
- package/dist/commands/reflect.cjs +0 -1008
- package/dist/commands/reflect.d.cts +0 -11
- package/dist/commands/repair-session.cjs +0 -457
- package/dist/commands/repair-session.d.cts +0 -38
- package/dist/commands/replay.cjs +0 -4103
- package/dist/commands/replay.d.cts +0 -16
- package/dist/commands/session-recap.cjs +0 -353
- package/dist/commands/session-recap.d.cts +0 -27
- package/dist/commands/setup.cjs +0 -1345
- package/dist/commands/setup.d.cts +0 -100
- package/dist/commands/shell-init.cjs +0 -75
- package/dist/commands/shell-init.d.cts +0 -7
- package/dist/commands/sleep.cjs +0 -6028
- package/dist/commands/sleep.d.cts +0 -36
- package/dist/commands/status.cjs +0 -2736
- package/dist/commands/status.d.cts +0 -52
- package/dist/commands/tailscale.cjs +0 -1532
- package/dist/commands/tailscale.d.cts +0 -52
- package/dist/commands/task.cjs +0 -1236
- package/dist/commands/task.d.cts +0 -97
- package/dist/commands/template.cjs +0 -457
- package/dist/commands/template.d.cts +0 -36
- package/dist/commands/wake.cjs +0 -2626
- package/dist/commands/wake.d.cts +0 -22
- package/dist/context-BUGaWpyL.d.cts +0 -46
- package/dist/index.cjs +0 -14526
- package/dist/index.d.cts +0 -858
- package/dist/inject-Bzi5E-By.d.ts +0 -137
- package/dist/lib/auto-linker.cjs +0 -176
- package/dist/lib/auto-linker.d.cts +0 -26
- package/dist/lib/canvas-layout.cjs +0 -136
- package/dist/lib/canvas-layout.d.cts +0 -31
- package/dist/lib/config.cjs +0 -78
- package/dist/lib/config.d.cts +0 -11
- package/dist/lib/entity-index.cjs +0 -84
- package/dist/lib/entity-index.d.cts +0 -26
- package/dist/lib/project-utils.cjs +0 -864
- package/dist/lib/project-utils.d.cts +0 -97
- package/dist/lib/session-repair.cjs +0 -239
- package/dist/lib/session-repair.d.cts +0 -110
- package/dist/lib/session-utils.cjs +0 -209
- package/dist/lib/session-utils.d.cts +0 -63
- package/dist/lib/tailscale.cjs +0 -1183
- package/dist/lib/tailscale.d.cts +0 -225
- package/dist/lib/task-utils.cjs +0 -1137
- package/dist/lib/task-utils.d.cts +0 -208
- package/dist/lib/template-engine.cjs +0 -47
- package/dist/lib/template-engine.d.cts +0 -11
- package/dist/lib/webdav.cjs +0 -568
- package/dist/lib/webdav.d.cts +0 -109
- package/dist/plugin/index.cjs +0 -1907
- package/dist/plugin/index.d.cts +0 -36
- package/dist/plugin/index.d.ts +0 -36
- package/dist/plugin/index.js +0 -572
- package/dist/plugin/inject.cjs +0 -356
- package/dist/plugin/inject.d.cts +0 -54
- package/dist/plugin/inject.d.ts +0 -54
- package/dist/plugin/inject.js +0 -17
- package/dist/plugin/observe.cjs +0 -631
- package/dist/plugin/observe.d.cts +0 -39
- package/dist/plugin/observe.d.ts +0 -39
- package/dist/plugin/observe.js +0 -18
- package/dist/plugin/templates.cjs +0 -593
- package/dist/plugin/templates.d.cts +0 -52
- package/dist/plugin/templates.d.ts +0 -52
- package/dist/plugin/templates.js +0 -25
- package/dist/plugin/types.cjs +0 -18
- package/dist/plugin/types.d.cts +0 -209
- package/dist/plugin/types.d.ts +0 -209
- package/dist/plugin/types.js +0 -0
- package/dist/plugin/vault.cjs +0 -927
- package/dist/plugin/vault.d.cts +0 -68
- package/dist/plugin/vault.d.ts +0 -68
- package/dist/plugin/vault.js +0 -22
- package/dist/types-Y2_Um2Ls.d.ts +0 -205
- package/templates/memory-event.md +0 -67
- package/templates/party.md +0 -63
- package/templates/primitive-registry.yaml +0 -551
- package/templates/run.md +0 -68
- package/templates/trigger.md +0 -68
- package/templates/workspace.md +0 -50
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __glob = (map) => (path) => {
|
|
14
|
+
var fn = map[path];
|
|
15
|
+
if (fn) return fn();
|
|
16
|
+
throw new Error("Module not found in bundle: " + path);
|
|
17
|
+
};
|
|
18
|
+
var __esm = (fn, res) => function __init() {
|
|
19
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
20
|
+
};
|
|
21
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
22
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
23
|
+
};
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
38
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
39
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
40
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
41
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
42
|
+
mod
|
|
43
|
+
));
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
__require,
|
|
47
|
+
__glob,
|
|
48
|
+
__esm,
|
|
49
|
+
__commonJS,
|
|
50
|
+
__export,
|
|
51
|
+
__toESM
|
|
52
|
+
};
|
|
@@ -1,11 +1,123 @@
|
|
|
1
1
|
// src/lib/memory-graph.ts
|
|
2
2
|
import * as fs from "fs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as path2 from "path";
|
|
4
4
|
import matter from "gray-matter";
|
|
5
5
|
import { glob } from "glob";
|
|
6
|
+
|
|
7
|
+
// src/lib/wiki-links.ts
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
function stripInlineCode(line) {
|
|
10
|
+
let result = "";
|
|
11
|
+
let cursor = 0;
|
|
12
|
+
while (cursor < line.length) {
|
|
13
|
+
if (line[cursor] !== "`") {
|
|
14
|
+
result += line[cursor];
|
|
15
|
+
cursor += 1;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
let fenceLength = 1;
|
|
19
|
+
while (cursor + fenceLength < line.length && line[cursor + fenceLength] === "`") {
|
|
20
|
+
fenceLength += 1;
|
|
21
|
+
}
|
|
22
|
+
const fence = "`".repeat(fenceLength);
|
|
23
|
+
const closeIndex = line.indexOf(fence, cursor + fenceLength);
|
|
24
|
+
if (closeIndex === -1) {
|
|
25
|
+
result += fence;
|
|
26
|
+
cursor += fenceLength;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
cursor = closeIndex + fenceLength;
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
function parseFence(line) {
|
|
34
|
+
const match = line.match(/^[ \t]{0,3}(`{3,}|~{3,})/);
|
|
35
|
+
if (!match) return null;
|
|
36
|
+
const marker = match[1][0];
|
|
37
|
+
if (marker !== "`" && marker !== "~") return null;
|
|
38
|
+
return { marker, length: match[1].length };
|
|
39
|
+
}
|
|
40
|
+
function isFenceClose(line, fence) {
|
|
41
|
+
const re = new RegExp(`^[ \\t]{0,3}${fence.marker}{${fence.length},}[ \\t]*$`);
|
|
42
|
+
return re.test(line);
|
|
43
|
+
}
|
|
44
|
+
function stripMarkdownCode(markdownContent) {
|
|
45
|
+
const lines = markdownContent.split("\n");
|
|
46
|
+
const visibleLines = [];
|
|
47
|
+
let activeFence = null;
|
|
48
|
+
for (const line of lines) {
|
|
49
|
+
if (activeFence) {
|
|
50
|
+
if (isFenceClose(line, activeFence)) {
|
|
51
|
+
activeFence = null;
|
|
52
|
+
}
|
|
53
|
+
visibleLines.push("");
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const openingFence = parseFence(line);
|
|
57
|
+
if (openingFence) {
|
|
58
|
+
activeFence = openingFence;
|
|
59
|
+
visibleLines.push("");
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (/^(?: {4}|\t)/.test(line)) {
|
|
63
|
+
visibleLines.push("");
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
visibleLines.push(stripInlineCode(line));
|
|
67
|
+
}
|
|
68
|
+
return visibleLines.join("\n");
|
|
69
|
+
}
|
|
70
|
+
function extractRawWikiLinks(markdownContent) {
|
|
71
|
+
const content = stripMarkdownCode(markdownContent);
|
|
72
|
+
const links = [];
|
|
73
|
+
let cursor = 0;
|
|
74
|
+
while (cursor < content.length) {
|
|
75
|
+
const start = content.indexOf("[[", cursor);
|
|
76
|
+
if (start === -1) break;
|
|
77
|
+
const end = content.indexOf("]]", start + 2);
|
|
78
|
+
if (end === -1) break;
|
|
79
|
+
const candidate = content.slice(start + 2, end).trim();
|
|
80
|
+
if (candidate) {
|
|
81
|
+
links.push(candidate);
|
|
82
|
+
}
|
|
83
|
+
cursor = end + 2;
|
|
84
|
+
}
|
|
85
|
+
return links;
|
|
86
|
+
}
|
|
87
|
+
function normalizeWikiLinkTarget(rawTarget) {
|
|
88
|
+
let value = rawTarget.trim();
|
|
89
|
+
if (!value) return "";
|
|
90
|
+
if (value.startsWith("[[") && value.endsWith("]]")) {
|
|
91
|
+
value = value.slice(2, -2).trim();
|
|
92
|
+
}
|
|
93
|
+
const pipeIndex = value.indexOf("|");
|
|
94
|
+
if (pipeIndex >= 0) {
|
|
95
|
+
value = value.slice(0, pipeIndex);
|
|
96
|
+
}
|
|
97
|
+
if (value.startsWith("#")) {
|
|
98
|
+
return "";
|
|
99
|
+
}
|
|
100
|
+
const hashIndex = value.indexOf("#");
|
|
101
|
+
if (hashIndex >= 0) {
|
|
102
|
+
value = value.slice(0, hashIndex);
|
|
103
|
+
}
|
|
104
|
+
value = value.trim().replace(/\\/g, "/").replace(/^\/+/, "");
|
|
105
|
+
if (!value) return "";
|
|
106
|
+
value = value.split("/").map((segment) => segment.trim()).join("/");
|
|
107
|
+
const normalizedPath = path.posix.normalize(value);
|
|
108
|
+
if (!normalizedPath || normalizedPath === ".") {
|
|
109
|
+
return "";
|
|
110
|
+
}
|
|
111
|
+
value = normalizedPath;
|
|
112
|
+
if (value.toLowerCase().endsWith(".md")) {
|
|
113
|
+
value = value.slice(0, -3);
|
|
114
|
+
}
|
|
115
|
+
return value.trim();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/lib/memory-graph.ts
|
|
6
119
|
var MEMORY_GRAPH_SCHEMA_VERSION = 1;
|
|
7
|
-
var GRAPH_INDEX_RELATIVE_PATH =
|
|
8
|
-
var WIKI_LINK_RE = /\[\[([^\]]+)\]\]/g;
|
|
120
|
+
var GRAPH_INDEX_RELATIVE_PATH = path2.join(".clawvault", "graph-index.json");
|
|
9
121
|
var HASH_TAG_RE = /(^|\s)#([\w-]+)/g;
|
|
10
122
|
var FRONTMATTER_RELATION_FIELDS = [
|
|
11
123
|
"related",
|
|
@@ -19,7 +131,7 @@ var FRONTMATTER_RELATION_FIELDS = [
|
|
|
19
131
|
"links"
|
|
20
132
|
];
|
|
21
133
|
function normalizeRelativePath(value) {
|
|
22
|
-
return value.split(
|
|
134
|
+
return value.split(path2.sep).join("/").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
23
135
|
}
|
|
24
136
|
function toNoteKey(relativePath) {
|
|
25
137
|
const normalized = normalizeRelativePath(relativePath);
|
|
@@ -57,31 +169,14 @@ function inferNodeType(relativePath, frontmatter) {
|
|
|
57
169
|
return "note";
|
|
58
170
|
}
|
|
59
171
|
function ensureClawvaultDir(vaultPath) {
|
|
60
|
-
const dirPath =
|
|
172
|
+
const dirPath = path2.join(vaultPath, ".clawvault");
|
|
61
173
|
if (!fs.existsSync(dirPath)) {
|
|
62
174
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
63
175
|
}
|
|
64
176
|
return dirPath;
|
|
65
177
|
}
|
|
66
178
|
function getGraphIndexPath(vaultPath) {
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
function normalizeWikiTarget(target) {
|
|
70
|
-
let value = target.trim();
|
|
71
|
-
if (!value) return "";
|
|
72
|
-
const pipeIndex = value.indexOf("|");
|
|
73
|
-
if (pipeIndex >= 0) {
|
|
74
|
-
value = value.slice(0, pipeIndex);
|
|
75
|
-
}
|
|
76
|
-
const hashIndex = value.indexOf("#");
|
|
77
|
-
if (hashIndex >= 0) {
|
|
78
|
-
value = value.slice(0, hashIndex);
|
|
79
|
-
}
|
|
80
|
-
value = value.trim().replace(/\\/g, "/").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
81
|
-
if (value.toLowerCase().endsWith(".md")) {
|
|
82
|
-
value = value.slice(0, -3);
|
|
83
|
-
}
|
|
84
|
-
return value.trim();
|
|
179
|
+
return path2.join(vaultPath, GRAPH_INDEX_RELATIVE_PATH);
|
|
85
180
|
}
|
|
86
181
|
function collectTags(frontmatter, markdownContent) {
|
|
87
182
|
const tags = /* @__PURE__ */ new Set();
|
|
@@ -105,14 +200,15 @@ function collectTags(frontmatter, markdownContent) {
|
|
|
105
200
|
}
|
|
106
201
|
function extractWikiTargets(markdownContent) {
|
|
107
202
|
const targets = /* @__PURE__ */ new Set();
|
|
108
|
-
for (const
|
|
109
|
-
const candidate = match[1];
|
|
110
|
-
if (!candidate) continue;
|
|
203
|
+
for (const candidate of extractRawWikiLinks(markdownContent)) {
|
|
111
204
|
const normalized = normalizeWikiTarget(candidate);
|
|
112
205
|
if (normalized) targets.add(normalized);
|
|
113
206
|
}
|
|
114
207
|
return [...targets];
|
|
115
208
|
}
|
|
209
|
+
function normalizeWikiTarget(target) {
|
|
210
|
+
return normalizeWikiLinkTarget(target);
|
|
211
|
+
}
|
|
116
212
|
function toStringArray(value) {
|
|
117
213
|
if (typeof value === "string") {
|
|
118
214
|
return value.split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
@@ -150,15 +246,57 @@ function buildNoteRegistry(relativePaths) {
|
|
|
150
246
|
}
|
|
151
247
|
return { byLowerPath, byLowerBasename };
|
|
152
248
|
}
|
|
153
|
-
function
|
|
249
|
+
function normalizeLookupPath(candidate) {
|
|
250
|
+
const normalized = normalizeWikiTarget(candidate);
|
|
251
|
+
if (!normalized) return "";
|
|
252
|
+
const resolved = path2.posix.normalize(normalized).replace(/^\/+/, "");
|
|
253
|
+
if (!resolved || resolved === "." || resolved.startsWith("../")) {
|
|
254
|
+
return "";
|
|
255
|
+
}
|
|
256
|
+
return resolved;
|
|
257
|
+
}
|
|
258
|
+
function buildTargetLookupCandidates(target, sourceNoteKey) {
|
|
259
|
+
const candidates = [];
|
|
260
|
+
const sourceDir = path2.posix.dirname(sourceNoteKey);
|
|
261
|
+
const hasSourceDir = sourceDir !== ".";
|
|
262
|
+
const isRelativeTarget = target.startsWith("./") || target.startsWith("../");
|
|
263
|
+
const addCandidate = (candidate) => {
|
|
264
|
+
const normalized = normalizeLookupPath(candidate);
|
|
265
|
+
if (!normalized || candidates.includes(normalized)) return;
|
|
266
|
+
candidates.push(normalized);
|
|
267
|
+
};
|
|
268
|
+
if (isRelativeTarget) {
|
|
269
|
+
if (hasSourceDir) {
|
|
270
|
+
addCandidate(path2.posix.join(sourceDir, target));
|
|
271
|
+
} else {
|
|
272
|
+
addCandidate(target);
|
|
273
|
+
}
|
|
274
|
+
if (target.startsWith("./")) {
|
|
275
|
+
addCandidate(target.slice(2));
|
|
276
|
+
}
|
|
277
|
+
return candidates;
|
|
278
|
+
}
|
|
279
|
+
if (!target.includes("/")) {
|
|
280
|
+
if (hasSourceDir) {
|
|
281
|
+
addCandidate(`${sourceDir}/${target}`);
|
|
282
|
+
}
|
|
283
|
+
addCandidate(target);
|
|
284
|
+
return candidates;
|
|
285
|
+
}
|
|
286
|
+
addCandidate(target);
|
|
287
|
+
return candidates;
|
|
288
|
+
}
|
|
289
|
+
function resolveTargetNodeId(rawTarget, registry, sourceNoteKey) {
|
|
154
290
|
const normalized = normalizeWikiTarget(rawTarget);
|
|
155
291
|
if (!normalized) {
|
|
156
292
|
return toUnresolvedNodeId(rawTarget);
|
|
157
293
|
}
|
|
158
294
|
const lowerTarget = normalized.toLowerCase();
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
295
|
+
for (const candidate of buildTargetLookupCandidates(normalized, sourceNoteKey)) {
|
|
296
|
+
const direct = registry.byLowerPath.get(candidate.toLowerCase());
|
|
297
|
+
if (direct) {
|
|
298
|
+
return toNoteNodeId(direct);
|
|
299
|
+
}
|
|
162
300
|
}
|
|
163
301
|
if (!normalized.includes("/")) {
|
|
164
302
|
const basenameMatches = registry.byLowerBasename.get(lowerTarget) ?? [];
|
|
@@ -186,7 +324,7 @@ function buildFragmentNode(id, title, type, category, pathValue, tags, missing,
|
|
|
186
324
|
};
|
|
187
325
|
}
|
|
188
326
|
function parseFileFragment(vaultPath, relativePath, mtimeMs, registry) {
|
|
189
|
-
const absolutePath =
|
|
327
|
+
const absolutePath = path2.join(vaultPath, relativePath);
|
|
190
328
|
const raw = fs.readFileSync(absolutePath, "utf-8");
|
|
191
329
|
const parsed = matter(raw);
|
|
192
330
|
const frontmatter = parsed.data ?? {};
|
|
@@ -225,7 +363,7 @@ function parseFileFragment(vaultPath, relativePath, mtimeMs, registry) {
|
|
|
225
363
|
}
|
|
226
364
|
const wikiTargets = extractWikiTargets(parsed.content);
|
|
227
365
|
for (const target of wikiTargets) {
|
|
228
|
-
const targetNodeId = resolveTargetNodeId(target, registry);
|
|
366
|
+
const targetNodeId = resolveTargetNodeId(target, registry, noteKey);
|
|
229
367
|
if (targetNodeId.startsWith("unresolved:") && !nodes.has(targetNodeId)) {
|
|
230
368
|
nodes.set(
|
|
231
369
|
targetNodeId,
|
|
@@ -241,7 +379,7 @@ function parseFileFragment(vaultPath, relativePath, mtimeMs, registry) {
|
|
|
241
379
|
});
|
|
242
380
|
}
|
|
243
381
|
for (const relation of extractFrontmatterRelations(frontmatter)) {
|
|
244
|
-
const targetNodeId = resolveTargetNodeId(relation.target, registry);
|
|
382
|
+
const targetNodeId = resolveTargetNodeId(relation.target, registry, noteKey);
|
|
245
383
|
if (targetNodeId.startsWith("unresolved:") && !nodes.has(targetNodeId)) {
|
|
246
384
|
nodes.set(
|
|
247
385
|
targetNodeId,
|
|
@@ -326,7 +464,7 @@ function isValidIndex(index) {
|
|
|
326
464
|
return typed.schemaVersion === MEMORY_GRAPH_SCHEMA_VERSION && typeof typed.vaultPath === "string" && typeof typed.generatedAt === "string" && Boolean(typed.files && typeof typed.files === "object") && Boolean(typed.graph && typeof typed.graph === "object");
|
|
327
465
|
}
|
|
328
466
|
function loadMemoryGraphIndex(vaultPath) {
|
|
329
|
-
const indexPath = getGraphIndexPath(
|
|
467
|
+
const indexPath = getGraphIndexPath(path2.resolve(vaultPath));
|
|
330
468
|
if (!fs.existsSync(indexPath)) {
|
|
331
469
|
return null;
|
|
332
470
|
}
|
|
@@ -341,7 +479,7 @@ function loadMemoryGraphIndex(vaultPath) {
|
|
|
341
479
|
}
|
|
342
480
|
}
|
|
343
481
|
async function buildOrUpdateMemoryGraphIndex(vaultPathInput, options = {}) {
|
|
344
|
-
const vaultPath =
|
|
482
|
+
const vaultPath = path2.resolve(vaultPathInput);
|
|
345
483
|
ensureClawvaultDir(vaultPath);
|
|
346
484
|
const existing = options.forceFull ? null : loadMemoryGraphIndex(vaultPath);
|
|
347
485
|
const markdownFiles = await glob("**/*.md", {
|
|
@@ -354,7 +492,7 @@ async function buildOrUpdateMemoryGraphIndex(vaultPathInput, options = {}) {
|
|
|
354
492
|
const existingFragments = existing?.files ?? {};
|
|
355
493
|
const currentFileSet = new Set(normalizedFiles);
|
|
356
494
|
for (const relativePath of normalizedFiles) {
|
|
357
|
-
const absolutePath =
|
|
495
|
+
const absolutePath = path2.join(vaultPath, relativePath);
|
|
358
496
|
const stat = fs.statSync(absolutePath);
|
|
359
497
|
const existingFragment = existingFragments[relativePath];
|
|
360
498
|
if (!options.forceFull && existingFragment && existingFragment.mtimeMs === stat.mtimeMs) {
|
|
@@ -391,6 +529,8 @@ async function getMemoryGraph(vaultPath, options = {}) {
|
|
|
391
529
|
}
|
|
392
530
|
|
|
393
531
|
export {
|
|
532
|
+
extractRawWikiLinks,
|
|
533
|
+
normalizeWikiLinkTarget,
|
|
394
534
|
MEMORY_GRAPH_SCHEMA_VERSION,
|
|
395
535
|
loadMemoryGraphIndex,
|
|
396
536
|
buildOrUpdateMemoryGraphIndex,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerTailscaleCommands
|
|
3
|
+
} from "./chunk-Y6VJKXGL.js";
|
|
4
|
+
import {
|
|
5
|
+
registerWorkgraphCommands
|
|
6
|
+
} from "./chunk-GGA32J2R.js";
|
|
7
|
+
import {
|
|
8
|
+
registerObserveCommand
|
|
9
|
+
} from "./chunk-23YDQ3QU.js";
|
|
10
|
+
import {
|
|
11
|
+
registerReflectCommand
|
|
12
|
+
} from "./chunk-SLXOR3CC.js";
|
|
13
|
+
import {
|
|
14
|
+
registerContextCommand
|
|
15
|
+
} from "./chunk-ZN54U2OZ.js";
|
|
16
|
+
import {
|
|
17
|
+
registerEmbedCommand
|
|
18
|
+
} from "./chunk-PBACDKKP.js";
|
|
19
|
+
import {
|
|
20
|
+
registerInjectCommand
|
|
21
|
+
} from "./chunk-W4SPAEE7.js";
|
|
22
|
+
|
|
23
|
+
// src/cli/index.ts
|
|
24
|
+
function registerCliCommands(program) {
|
|
25
|
+
registerContextCommand(program);
|
|
26
|
+
registerInjectCommand(program);
|
|
27
|
+
registerObserveCommand(program);
|
|
28
|
+
registerReflectCommand(program);
|
|
29
|
+
registerEmbedCommand(program);
|
|
30
|
+
registerTailscaleCommands(program);
|
|
31
|
+
registerWorkgraphCommands(program);
|
|
32
|
+
return program;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
registerCliCommands
|
|
37
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-2ZDO52B4.js";
|
|
4
|
+
|
|
5
|
+
// src/workgraph/ledger.ts
|
|
6
|
+
var ledger_exports = {};
|
|
7
|
+
__export(ledger_exports, {
|
|
8
|
+
activityOf: () => activityOf,
|
|
9
|
+
allClaims: () => allClaims,
|
|
10
|
+
append: () => append,
|
|
11
|
+
currentOwner: () => currentOwner,
|
|
12
|
+
historyOf: () => historyOf,
|
|
13
|
+
isClaimed: () => isClaimed,
|
|
14
|
+
ledgerPath: () => ledgerPath,
|
|
15
|
+
readAll: () => readAll,
|
|
16
|
+
readSince: () => readSince,
|
|
17
|
+
recent: () => recent
|
|
18
|
+
});
|
|
19
|
+
import fs from "fs";
|
|
20
|
+
import path from "path";
|
|
21
|
+
var LEDGER_FILE = ".clawvault/ledger.jsonl";
|
|
22
|
+
function ledgerPath(vaultPath) {
|
|
23
|
+
return path.join(vaultPath, LEDGER_FILE);
|
|
24
|
+
}
|
|
25
|
+
function append(vaultPath, actor, op, target, type, data) {
|
|
26
|
+
const entry = {
|
|
27
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
28
|
+
actor,
|
|
29
|
+
op,
|
|
30
|
+
target,
|
|
31
|
+
...type ? { type } : {},
|
|
32
|
+
...data && Object.keys(data).length > 0 ? { data } : {}
|
|
33
|
+
};
|
|
34
|
+
const lPath = ledgerPath(vaultPath);
|
|
35
|
+
const dir = path.dirname(lPath);
|
|
36
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
37
|
+
fs.appendFileSync(lPath, JSON.stringify(entry) + "\n", "utf-8");
|
|
38
|
+
return entry;
|
|
39
|
+
}
|
|
40
|
+
function readAll(vaultPath) {
|
|
41
|
+
const lPath = ledgerPath(vaultPath);
|
|
42
|
+
if (!fs.existsSync(lPath)) return [];
|
|
43
|
+
const lines = fs.readFileSync(lPath, "utf-8").split("\n").filter(Boolean);
|
|
44
|
+
return lines.map((line) => JSON.parse(line));
|
|
45
|
+
}
|
|
46
|
+
function readSince(vaultPath, since) {
|
|
47
|
+
return readAll(vaultPath).filter((e) => e.ts >= since);
|
|
48
|
+
}
|
|
49
|
+
function currentOwner(vaultPath, target) {
|
|
50
|
+
const entries = readAll(vaultPath).filter((e) => e.target === target);
|
|
51
|
+
let owner = null;
|
|
52
|
+
for (const e of entries) {
|
|
53
|
+
if (e.op === "claim") owner = e.actor;
|
|
54
|
+
if (e.op === "release" || e.op === "done" || e.op === "cancel") owner = null;
|
|
55
|
+
}
|
|
56
|
+
return owner;
|
|
57
|
+
}
|
|
58
|
+
function isClaimed(vaultPath, target) {
|
|
59
|
+
return currentOwner(vaultPath, target) !== null;
|
|
60
|
+
}
|
|
61
|
+
function historyOf(vaultPath, target) {
|
|
62
|
+
return readAll(vaultPath).filter((e) => e.target === target);
|
|
63
|
+
}
|
|
64
|
+
function activityOf(vaultPath, actor) {
|
|
65
|
+
return readAll(vaultPath).filter((e) => e.actor === actor);
|
|
66
|
+
}
|
|
67
|
+
function allClaims(vaultPath) {
|
|
68
|
+
const claims = /* @__PURE__ */ new Map();
|
|
69
|
+
const entries = readAll(vaultPath);
|
|
70
|
+
for (const e of entries) {
|
|
71
|
+
if (e.op === "claim") claims.set(e.target, e.actor);
|
|
72
|
+
if (e.op === "release" || e.op === "done" || e.op === "cancel") claims.delete(e.target);
|
|
73
|
+
}
|
|
74
|
+
return claims;
|
|
75
|
+
}
|
|
76
|
+
function recent(vaultPath, count = 20) {
|
|
77
|
+
const all = readAll(vaultPath);
|
|
78
|
+
return all.slice(-count);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
ledgerPath,
|
|
83
|
+
append,
|
|
84
|
+
readAll,
|
|
85
|
+
readSince,
|
|
86
|
+
currentOwner,
|
|
87
|
+
isClaimed,
|
|
88
|
+
historyOf,
|
|
89
|
+
activityOf,
|
|
90
|
+
allClaims,
|
|
91
|
+
recent,
|
|
92
|
+
ledger_exports
|
|
93
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listTasks,
|
|
3
3
|
slugify
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QWQ3TIKS.js";
|
|
5
5
|
import {
|
|
6
6
|
loadSchemaTemplateDefinition,
|
|
7
7
|
renderDocumentFromTemplate
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MFAWT5O5.js";
|
|
9
9
|
|
|
10
10
|
// src/lib/project-utils.ts
|
|
11
11
|
import * as fs from "fs";
|
|
@@ -18,6 +18,18 @@ function extractTitle(content) {
|
|
|
18
18
|
function isDateSlug(slug) {
|
|
19
19
|
return /^\d{4}-\d{2}-\d{2}$/.test(slug);
|
|
20
20
|
}
|
|
21
|
+
function buildProjectSlug(title) {
|
|
22
|
+
const direct = slugify(title);
|
|
23
|
+
if (direct) {
|
|
24
|
+
return direct;
|
|
25
|
+
}
|
|
26
|
+
let hash = 0;
|
|
27
|
+
for (const char of title) {
|
|
28
|
+
hash = (hash << 5) - hash + char.charCodeAt(0);
|
|
29
|
+
hash |= 0;
|
|
30
|
+
}
|
|
31
|
+
return `project-${Math.abs(hash).toString(36)}`;
|
|
32
|
+
}
|
|
21
33
|
function normalizeStringArray(value) {
|
|
22
34
|
return value.map((item) => item.trim()).filter(Boolean);
|
|
23
35
|
}
|
|
@@ -242,7 +254,7 @@ function readProject(vaultPath, slug) {
|
|
|
242
254
|
}
|
|
243
255
|
function createProject(vaultPath, title, options = {}) {
|
|
244
256
|
ensureProjectsDir(vaultPath);
|
|
245
|
-
const slug =
|
|
257
|
+
const slug = buildProjectSlug(title);
|
|
246
258
|
const projectPath = getProjectPath(vaultPath, slug);
|
|
247
259
|
if (fs.existsSync(projectPath)) {
|
|
248
260
|
throw new Error(`Project already exists: ${slug}`);
|