clawvault 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -14
- package/bin/clawvault.js +0 -2
- package/bin/command-registration.test.js +13 -1
- package/bin/help-contract.test.js +14 -0
- package/bin/register-core-commands.js +88 -0
- package/bin/register-core-commands.test.js +80 -0
- package/bin/register-maintenance-commands.js +57 -6
- package/bin/register-query-commands.js +10 -28
- package/bin/test-helpers/cli-command-fixtures.js +1 -0
- package/dist/chunk-2PKBIKDH.js +130 -0
- package/dist/{chunk-2JQ3O2YL.js → chunk-5EFSWZO6.js} +3 -3
- package/dist/{chunk-77Q5CSPJ.js → chunk-7SWP5FKU.js} +33 -701
- package/dist/{chunk-URXDAUVH.js → chunk-AXSJIFOJ.js} +174 -1
- package/dist/{chunk-23YDQ3QU.js → chunk-BLQXXX7Q.js} +6 -6
- package/dist/chunk-CSHO3PJB.js +684 -0
- package/dist/{chunk-SLXOR3CC.js → chunk-DOIUYIXV.js} +2 -2
- package/dist/{chunk-NCKFNBHJ.js → chunk-DVOUSOR3.js} +79 -5
- package/dist/{chunk-CLJTREDS.js → chunk-ECGJYWNA.js} +193 -41
- package/dist/{chunk-BUEW6IIK.js → chunk-EL6UBSX5.js} +5 -5
- package/dist/{chunk-6FH3IULF.js → chunk-FZ5I2NF7.js} +1 -1
- package/dist/{chunk-ZN54U2OZ.js → chunk-GFCHWMGD.js} +3 -3
- package/dist/{chunk-GNJL4YGR.js → chunk-GJO3CFUN.js} +30 -6
- package/dist/chunk-H3JZIB5O.js +322 -0
- package/dist/chunk-HEHO7SMV.js +51 -0
- package/dist/{chunk-STCQGCEQ.js → chunk-HGDDW24U.js} +3 -3
- package/dist/chunk-J3YUXVID.js +907 -0
- package/dist/{chunk-Y6VJKXGL.js → chunk-KCYWJDDW.js} +1 -1
- package/dist/{chunk-W4SPAEE7.js → chunk-OFOCU2V4.js} +5 -4
- package/dist/chunk-PTWPPVC7.js +972 -0
- package/dist/{chunk-QSHD36LH.js → chunk-QFWERBDP.js} +2 -2
- package/dist/{chunk-QSRRMEYM.js → chunk-S7N7HI5E.js} +1 -1
- package/dist/{chunk-PBACDKKP.js → chunk-T7E764W3.js} +3 -3
- package/dist/chunk-TDWFBDAQ.js +1016 -0
- package/dist/{chunk-ESVS6K2B.js → chunk-TWMI3SNN.js} +6 -5
- package/dist/{chunk-2RAZ4ZFE.js → chunk-VBILES4B.js} +1 -1
- package/dist/{chunk-ESFLMDRB.js → chunk-VXAGOLDP.js} +3 -3
- package/dist/chunk-YCUVAOFC.js +158 -0
- package/dist/{chunk-SS4B7P7V.js → chunk-YIDV4VV2.js} +1 -1
- package/dist/chunk-ZKWPCBYT.js +600 -0
- package/dist/cli/index.js +24 -24
- package/dist/commands/archive.js +2 -2
- package/dist/commands/benchmark.d.ts +12 -0
- package/dist/commands/benchmark.js +12 -0
- package/dist/commands/context.js +6 -5
- package/dist/commands/doctor.d.ts +8 -3
- package/dist/commands/doctor.js +6 -20
- package/dist/commands/embed.js +5 -4
- package/dist/commands/entities.js +1 -1
- package/dist/commands/graph.js +2 -2
- package/dist/commands/inbox.d.ts +23 -0
- package/dist/commands/inbox.js +11 -0
- package/dist/commands/inject.d.ts +1 -1
- package/dist/commands/inject.js +3 -3
- package/dist/commands/link.js +6 -6
- package/dist/commands/maintain.d.ts +32 -0
- package/dist/commands/maintain.js +12 -0
- package/dist/commands/migrate-observations.js +2 -2
- package/dist/commands/observe.js +9 -8
- package/dist/commands/rebuild-embeddings.js +47 -16
- package/dist/commands/rebuild.js +7 -6
- package/dist/commands/reflect.js +5 -5
- package/dist/commands/replay.js +8 -7
- package/dist/commands/setup.js +3 -2
- package/dist/commands/sleep.d.ts +1 -1
- package/dist/commands/sleep.js +17 -15
- package/dist/commands/status.js +26 -24
- package/dist/commands/sync-bd.js +2 -2
- package/dist/commands/tailscale.js +2 -2
- package/dist/commands/wake.d.ts +1 -1
- package/dist/commands/wake.js +8 -7
- package/dist/index.d.ts +168 -16
- package/dist/index.js +271 -108
- package/dist/{inject-DYUrDqQO.d.ts → inject-DEb_jpLi.d.ts} +3 -1
- package/dist/lib/config.js +1 -1
- package/dist/{types-BbWJoC1c.d.ts → types-DslKvCaj.d.ts} +51 -1
- package/hooks/clawvault/HOOK.md +22 -5
- package/hooks/clawvault/handler.js +213 -78
- package/hooks/clawvault/handler.test.js +109 -43
- package/hooks/clawvault/integrity.js +112 -0
- package/hooks/clawvault/integrity.test.js +32 -0
- package/hooks/clawvault/openclaw.plugin.json +133 -15
- package/openclaw.plugin.json +126 -20
- package/package.json +2 -2
- package/bin/register-workgraph-commands.js +0 -1368
- package/dist/chunk-33VSQP4J.js +0 -37
- package/dist/chunk-4BQTQMJP.js +0 -93
- package/dist/chunk-EK6S23ZB.js +0 -469
- package/dist/chunk-GAOWA7GR.js +0 -501
- package/dist/chunk-GGA32J2R.js +0 -784
- package/dist/chunk-MM6QGW3P.js +0 -207
- package/dist/chunk-QVEERJSP.js +0 -152
- package/dist/chunk-U4O6C46S.js +0 -154
- package/dist/chunk-VSL7KY3M.js +0 -189
- package/dist/chunk-WMGIIABP.js +0 -15
- package/dist/commands/workgraph.d.ts +0 -124
- package/dist/commands/workgraph.js +0 -38
- package/dist/ledger-B7g7jhqG.d.ts +0 -44
- package/dist/registry-BR4326o0.d.ts +0 -30
- package/dist/store-CA-6sKCJ.d.ts +0 -34
- package/dist/thread-B9LhXNU0.d.ts +0 -41
- package/dist/workgraph/index.d.ts +0 -5
- package/dist/workgraph/index.js +0 -23
- package/dist/workgraph/ledger.d.ts +0 -2
- package/dist/workgraph/ledger.js +0 -25
- package/dist/workgraph/registry.d.ts +0 -2
- package/dist/workgraph/registry.js +0 -19
- package/dist/workgraph/store.d.ts +0 -2
- package/dist/workgraph/store.js +0 -25
- package/dist/workgraph/thread.d.ts +0 -2
- package/dist/workgraph/thread.js +0 -25
- package/dist/workgraph/types.d.ts +0 -54
- package/dist/workgraph/types.js +0 -7
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeObservationContent,
|
|
3
|
-
parseObservationMarkdown
|
|
4
|
-
} from "./chunk-FHFUXL6G.js";
|
|
5
1
|
import {
|
|
6
2
|
requestLlmCompletion,
|
|
7
3
|
resolveLlmProvider
|
|
8
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DVOUSOR3.js";
|
|
9
5
|
import {
|
|
10
6
|
archiveObservations
|
|
11
7
|
} from "./chunk-MQUJNOHK.js";
|
|
8
|
+
import {
|
|
9
|
+
normalizeObservationContent,
|
|
10
|
+
parseObservationMarkdown
|
|
11
|
+
} from "./chunk-FHFUXL6G.js";
|
|
12
12
|
import {
|
|
13
13
|
formatIsoWeekKey,
|
|
14
14
|
getIsoWeek,
|
|
@@ -235,6 +235,7 @@ async function maybeGenerateLlmReflection(weekKey, sections) {
|
|
|
235
235
|
const output = await requestLlmCompletion({
|
|
236
236
|
provider,
|
|
237
237
|
prompt,
|
|
238
|
+
tier: "default",
|
|
238
239
|
temperature: 0.1,
|
|
239
240
|
maxTokens: 1200
|
|
240
241
|
});
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerTailscaleCommands
|
|
3
|
+
} from "./chunk-KCYWJDDW.js";
|
|
4
|
+
import {
|
|
5
|
+
registerReflectCommand
|
|
6
|
+
} from "./chunk-DOIUYIXV.js";
|
|
7
|
+
import {
|
|
8
|
+
registerInjectCommand
|
|
9
|
+
} from "./chunk-OFOCU2V4.js";
|
|
10
|
+
import {
|
|
11
|
+
registerMaintainCommand
|
|
12
|
+
} from "./chunk-TDWFBDAQ.js";
|
|
13
|
+
import {
|
|
14
|
+
registerObserveCommand
|
|
15
|
+
} from "./chunk-BLQXXX7Q.js";
|
|
16
|
+
import {
|
|
17
|
+
registerContextCommand
|
|
18
|
+
} from "./chunk-GFCHWMGD.js";
|
|
19
|
+
import {
|
|
20
|
+
ClawVault
|
|
21
|
+
} from "./chunk-ECGJYWNA.js";
|
|
22
|
+
import {
|
|
23
|
+
registerEmbedCommand
|
|
24
|
+
} from "./chunk-T7E764W3.js";
|
|
25
|
+
import {
|
|
26
|
+
registerInboxCommand
|
|
27
|
+
} from "./chunk-HEHO7SMV.js";
|
|
28
|
+
import {
|
|
29
|
+
resolveVaultPath
|
|
30
|
+
} from "./chunk-GJO3CFUN.js";
|
|
31
|
+
import {
|
|
32
|
+
registerBenchmarkCommand
|
|
33
|
+
} from "./chunk-ZKWPCBYT.js";
|
|
34
|
+
|
|
35
|
+
// src/commands/patch.ts
|
|
36
|
+
function normalizeSectionHeading(heading) {
|
|
37
|
+
const trimmed = heading.trim();
|
|
38
|
+
if (!trimmed) {
|
|
39
|
+
throw new Error("Section heading cannot be empty.");
|
|
40
|
+
}
|
|
41
|
+
if (trimmed.startsWith("#")) {
|
|
42
|
+
return trimmed;
|
|
43
|
+
}
|
|
44
|
+
return `## ${trimmed}`;
|
|
45
|
+
}
|
|
46
|
+
function buildSectionAppendText(heading, content) {
|
|
47
|
+
const headingLine = normalizeSectionHeading(heading);
|
|
48
|
+
return `
|
|
49
|
+
${headingLine}
|
|
50
|
+
${content}`;
|
|
51
|
+
}
|
|
52
|
+
function isSectionNotFoundError(error) {
|
|
53
|
+
return error instanceof Error && error.message.startsWith("Section not found:");
|
|
54
|
+
}
|
|
55
|
+
function resolvePatchOptions(idOrPath, options) {
|
|
56
|
+
const appendSelected = typeof options.append === "string";
|
|
57
|
+
const replaceSelected = typeof options.replace === "string" || typeof options.with === "string";
|
|
58
|
+
const sectionSelected = typeof options.section === "string" || typeof options.content === "string";
|
|
59
|
+
const selectedModeCount = [appendSelected, replaceSelected, sectionSelected].filter(Boolean).length;
|
|
60
|
+
if (selectedModeCount !== 1) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
"Select exactly one patch mode: --append, --replace with --with, or --section with --content."
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (appendSelected) {
|
|
66
|
+
return {
|
|
67
|
+
idOrPath,
|
|
68
|
+
mode: "append",
|
|
69
|
+
append: options.append
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (replaceSelected) {
|
|
73
|
+
if (typeof options.replace !== "string" || typeof options.with !== "string") {
|
|
74
|
+
throw new Error("Replace mode requires both --replace and --with.");
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
idOrPath,
|
|
78
|
+
mode: "replace",
|
|
79
|
+
replace: options.replace,
|
|
80
|
+
with: options.with
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (typeof options.section !== "string" || typeof options.content !== "string") {
|
|
84
|
+
throw new Error("Section mode requires both --section and --content.");
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
idOrPath,
|
|
88
|
+
mode: "content",
|
|
89
|
+
section: options.section,
|
|
90
|
+
content: options.content
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
async function runSectionUpsert(vault, idOrPath, section, content) {
|
|
94
|
+
try {
|
|
95
|
+
return await vault.patch({
|
|
96
|
+
idOrPath,
|
|
97
|
+
mode: "content",
|
|
98
|
+
section,
|
|
99
|
+
content
|
|
100
|
+
});
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (!isSectionNotFoundError(error)) {
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
return vault.patch({
|
|
106
|
+
idOrPath,
|
|
107
|
+
mode: "append",
|
|
108
|
+
append: buildSectionAppendText(section, content)
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function patchCommand(idOrPath, options) {
|
|
113
|
+
const patchOptions = resolvePatchOptions(idOrPath, options);
|
|
114
|
+
const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
|
|
115
|
+
const vault = new ClawVault(vaultPath);
|
|
116
|
+
await vault.load();
|
|
117
|
+
if (patchOptions.mode === "content") {
|
|
118
|
+
return runSectionUpsert(
|
|
119
|
+
vault,
|
|
120
|
+
patchOptions.idOrPath,
|
|
121
|
+
patchOptions.section,
|
|
122
|
+
patchOptions.content
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return vault.patch(patchOptions);
|
|
126
|
+
}
|
|
127
|
+
function registerPatchCommand(program) {
|
|
128
|
+
program.command("patch <path>").description("Patch an existing memory document").option("--append <content>", "Append text to the end of a document").option("--replace <old>", "Text to find for replacement").option("--with <new>", "Replacement text used with --replace").option("--section <heading>", "Markdown heading to upsert").option("--content <body>", "Section body content used with --section").option("-v, --vault <path>", "Vault path").action(async (pathArg, rawOptions) => {
|
|
129
|
+
const doc = await patchCommand(pathArg, {
|
|
130
|
+
vaultPath: rawOptions.vault,
|
|
131
|
+
append: rawOptions.append,
|
|
132
|
+
replace: rawOptions.replace,
|
|
133
|
+
with: rawOptions.with,
|
|
134
|
+
section: rawOptions.section,
|
|
135
|
+
content: rawOptions.content
|
|
136
|
+
});
|
|
137
|
+
console.log(`Patched: ${doc.id}`);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// src/cli/index.ts
|
|
142
|
+
function registerCliCommands(program) {
|
|
143
|
+
registerBenchmarkCommand(program);
|
|
144
|
+
registerContextCommand(program);
|
|
145
|
+
registerInjectCommand(program);
|
|
146
|
+
registerObserveCommand(program);
|
|
147
|
+
registerReflectCommand(program);
|
|
148
|
+
registerEmbedCommand(program);
|
|
149
|
+
registerInboxCommand(program);
|
|
150
|
+
registerMaintainCommand(program);
|
|
151
|
+
registerPatchCommand(program);
|
|
152
|
+
registerTailscaleCommands(program);
|
|
153
|
+
return program;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export {
|
|
157
|
+
registerCliCommands
|
|
158
|
+
};
|