clawvault 2.4.6 → 2.4.7
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/bin/clawvault.js +5 -0
- package/bin/command-registration.test.js +1 -1
- package/bin/help-contract.test.js +1 -0
- package/bin/register-config-route-commands.test.js +8 -1
- package/bin/register-core-commands.js +3 -3
- package/bin/register-project-commands.js +209 -0
- package/bin/register-project-commands.test.js +201 -0
- package/bin/register-query-commands.js +40 -0
- package/bin/register-task-commands.js +2 -18
- package/bin/register-task-commands.test.js +3 -4
- package/bin/test-helpers/cli-command-fixtures.js +5 -0
- package/dist/{chunk-3PJIGGWV.js → chunk-2CDEETQN.js} +1 -0
- package/dist/{chunk-FD2ZA65C.js → chunk-2RK2AG32.js} +5 -5
- package/dist/chunk-5GZFTAL7.js +340 -0
- package/dist/{chunk-P2ZH6AN5.js → chunk-6RQPD7X6.js} +3 -4
- package/dist/{chunk-HNMFXFYP.js → chunk-7OHQFMJK.js} +2 -1
- package/dist/{chunk-FKQJB6XC.js → chunk-C3PF7WBA.js} +2 -2
- package/dist/{chunk-JXY6T5R7.js → chunk-FW465EEA.js} +1 -1
- package/dist/{chunk-BI6SGGZP.js → chunk-G3OQJ2NQ.js} +1 -1
- package/dist/chunk-GSD4ALSI.js +724 -0
- package/dist/{chunk-6QLRSPLZ.js → chunk-IOALNTAN.js} +268 -47
- package/dist/chunk-ITPEXLHA.js +528 -0
- package/dist/{chunk-LLN5SPGL.js → chunk-J5EMBUPK.js} +1 -1
- package/dist/chunk-K3CDT7IH.js +122 -0
- package/dist/{chunk-AHGUJG76.js → chunk-KCCHROBR.js} +13 -69
- package/dist/{chunk-JTO7NZLS.js → chunk-LMCC5OC7.js} +2 -2
- package/dist/{chunk-QALB2V3E.js → chunk-MQUJNOHK.js} +1 -1
- package/dist/{chunk-H6WQUUNK.js → chunk-TMZMN7OS.js} +334 -457
- package/dist/{chunk-HVTTYDCJ.js → chunk-VR5NE7PZ.js} +1 -1
- package/dist/{chunk-22WE3J4F.js → chunk-WIICLBNF.js} +35 -4
- package/dist/chunk-YCVDVI5B.js +273 -0
- package/dist/{chunk-NAMFB7ZA.js → chunk-Z2XBWN7A.js} +0 -2
- package/dist/commands/archive.js +3 -3
- package/dist/commands/backlog.js +1 -1
- package/dist/commands/blocked.js +1 -1
- package/dist/commands/canvas.d.ts +1 -14
- package/dist/commands/canvas.js +123 -1543
- package/dist/commands/context.js +5 -6
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/inject.d.ts +2 -0
- package/dist/commands/inject.js +14 -0
- package/dist/commands/kanban.js +2 -2
- package/dist/commands/migrate-observations.js +2 -2
- package/dist/commands/observe.js +8 -6
- package/dist/commands/project.d.ts +85 -0
- package/dist/commands/project.js +411 -0
- package/dist/commands/rebuild.js +7 -5
- package/dist/commands/reflect.js +5 -4
- package/dist/commands/replay.js +10 -7
- package/dist/commands/setup.d.ts +1 -1
- package/dist/commands/setup.js +2 -2
- package/dist/commands/sleep.d.ts +1 -1
- package/dist/commands/sleep.js +11 -8
- package/dist/commands/status.js +2 -2
- package/dist/commands/task.d.ts +2 -2
- package/dist/commands/task.js +11 -301
- package/dist/commands/wake.d.ts +1 -1
- package/dist/commands/wake.js +4 -4
- package/dist/index.d.ts +75 -107
- package/dist/index.js +78 -36
- package/dist/inject-x65KXWPk.d.ts +137 -0
- package/dist/lib/project-utils.d.ts +97 -0
- package/dist/lib/project-utils.js +19 -0
- package/dist/lib/task-utils.d.ts +8 -3
- package/dist/lib/task-utils.js +1 -1
- package/dist/{types-DMU3SuAV.d.ts → types-jjuYN2Xn.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-L3DJ36BZ.js +0 -40
- package/dist/chunk-UMMCYTJV.js +0 -105
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
requestLlmCompletion,
|
|
3
|
+
resolveLlmProvider
|
|
4
|
+
} from "./chunk-K3CDT7IH.js";
|
|
1
5
|
import {
|
|
2
6
|
archiveObservations
|
|
3
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MQUJNOHK.js";
|
|
4
8
|
import {
|
|
5
9
|
normalizeObservationContent,
|
|
6
10
|
parseObservationMarkdown
|
|
@@ -12,7 +16,7 @@ import {
|
|
|
12
16
|
getReflectionsRoot,
|
|
13
17
|
listObservationFiles,
|
|
14
18
|
parseDateKey
|
|
15
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Z2XBWN7A.js";
|
|
16
20
|
|
|
17
21
|
// src/observer/reflection-service.ts
|
|
18
22
|
import * as fs from "fs";
|
|
@@ -208,73 +212,8 @@ function promoteWeekRecords(records) {
|
|
|
208
212
|
}
|
|
209
213
|
return promoted;
|
|
210
214
|
}
|
|
211
|
-
function resolveProvider() {
|
|
212
|
-
if (process.env.CLAWVAULT_NO_LLM) return null;
|
|
213
|
-
if (process.env.ANTHROPIC_API_KEY) return "anthropic";
|
|
214
|
-
if (process.env.OPENAI_API_KEY) return "openai";
|
|
215
|
-
if (process.env.GEMINI_API_KEY) return "gemini";
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
async function callOpenAI(prompt, model) {
|
|
219
|
-
const apiKey = process.env.OPENAI_API_KEY;
|
|
220
|
-
if (!apiKey) return "";
|
|
221
|
-
const response = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
222
|
-
method: "POST",
|
|
223
|
-
headers: {
|
|
224
|
-
"content-type": "application/json",
|
|
225
|
-
authorization: `Bearer ${apiKey}`
|
|
226
|
-
},
|
|
227
|
-
body: JSON.stringify({
|
|
228
|
-
model: model ?? "gpt-4o-mini",
|
|
229
|
-
temperature: 0.1,
|
|
230
|
-
messages: [{ role: "user", content: prompt }]
|
|
231
|
-
})
|
|
232
|
-
});
|
|
233
|
-
if (!response.ok) return "";
|
|
234
|
-
const payload = await response.json();
|
|
235
|
-
return payload.choices?.[0]?.message?.content?.trim() ?? "";
|
|
236
|
-
}
|
|
237
|
-
async function callAnthropic(prompt, model) {
|
|
238
|
-
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
239
|
-
if (!apiKey) return "";
|
|
240
|
-
const response = await fetch("https://api.anthropic.com/v1/messages", {
|
|
241
|
-
method: "POST",
|
|
242
|
-
headers: {
|
|
243
|
-
"content-type": "application/json",
|
|
244
|
-
"x-api-key": apiKey,
|
|
245
|
-
"anthropic-version": "2023-06-01"
|
|
246
|
-
},
|
|
247
|
-
body: JSON.stringify({
|
|
248
|
-
model: model ?? "claude-3-5-haiku-latest",
|
|
249
|
-
max_tokens: 1200,
|
|
250
|
-
temperature: 0.1,
|
|
251
|
-
messages: [{ role: "user", content: prompt }]
|
|
252
|
-
})
|
|
253
|
-
});
|
|
254
|
-
if (!response.ok) return "";
|
|
255
|
-
const payload = await response.json();
|
|
256
|
-
return payload.content?.filter((entry) => entry.type === "text" && entry.text).map((entry) => entry.text).join("\n").trim() ?? "";
|
|
257
|
-
}
|
|
258
|
-
async function callGemini(prompt, model) {
|
|
259
|
-
const apiKey = process.env.GEMINI_API_KEY;
|
|
260
|
-
if (!apiKey) return "";
|
|
261
|
-
const response = await fetch(
|
|
262
|
-
`https://generativelanguage.googleapis.com/v1beta/models/${model ?? "gemini-2.0-flash"}:generateContent?key=${apiKey}`,
|
|
263
|
-
{
|
|
264
|
-
method: "POST",
|
|
265
|
-
headers: { "content-type": "application/json" },
|
|
266
|
-
body: JSON.stringify({
|
|
267
|
-
contents: [{ parts: [{ text: prompt }] }],
|
|
268
|
-
generationConfig: { temperature: 0.1, maxOutputTokens: 1200 }
|
|
269
|
-
})
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
if (!response.ok) return "";
|
|
273
|
-
const payload = await response.json();
|
|
274
|
-
return payload.candidates?.[0]?.content?.parts?.[0]?.text?.trim() ?? "";
|
|
275
|
-
}
|
|
276
215
|
async function maybeGenerateLlmReflection(weekKey, sections) {
|
|
277
|
-
const provider =
|
|
216
|
+
const provider = resolveLlmProvider();
|
|
278
217
|
if (!provider) {
|
|
279
218
|
return null;
|
|
280
219
|
}
|
|
@@ -293,7 +232,12 @@ async function maybeGenerateLlmReflection(weekKey, sections) {
|
|
|
293
232
|
renderReflectionMarkdown(weekKey, sections)
|
|
294
233
|
].join("\n");
|
|
295
234
|
try {
|
|
296
|
-
const output =
|
|
235
|
+
const output = await requestLlmCompletion({
|
|
236
|
+
provider,
|
|
237
|
+
prompt,
|
|
238
|
+
temperature: 0.1,
|
|
239
|
+
maxTokens: 1200
|
|
240
|
+
});
|
|
297
241
|
if (!output.trim()) {
|
|
298
242
|
return null;
|
|
299
243
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Observer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TMZMN7OS.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveVaultPath
|
|
6
6
|
} from "./chunk-MXSSG3QU.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getLegacyObservationPath,
|
|
9
9
|
getObservationPath,
|
|
10
10
|
listRawTranscriptFiles
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Z2XBWN7A.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/rebuild.ts
|
|
14
14
|
import * as fs from "fs";
|