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.
Files changed (69) hide show
  1. package/bin/clawvault.js +5 -0
  2. package/bin/command-registration.test.js +1 -1
  3. package/bin/help-contract.test.js +1 -0
  4. package/bin/register-config-route-commands.test.js +8 -1
  5. package/bin/register-core-commands.js +3 -3
  6. package/bin/register-project-commands.js +209 -0
  7. package/bin/register-project-commands.test.js +201 -0
  8. package/bin/register-query-commands.js +40 -0
  9. package/bin/register-task-commands.js +2 -18
  10. package/bin/register-task-commands.test.js +3 -4
  11. package/bin/test-helpers/cli-command-fixtures.js +5 -0
  12. package/dist/{chunk-3PJIGGWV.js → chunk-2CDEETQN.js} +1 -0
  13. package/dist/{chunk-FD2ZA65C.js → chunk-2RK2AG32.js} +5 -5
  14. package/dist/chunk-5GZFTAL7.js +340 -0
  15. package/dist/{chunk-P2ZH6AN5.js → chunk-6RQPD7X6.js} +3 -4
  16. package/dist/{chunk-HNMFXFYP.js → chunk-7OHQFMJK.js} +2 -1
  17. package/dist/{chunk-FKQJB6XC.js → chunk-C3PF7WBA.js} +2 -2
  18. package/dist/{chunk-JXY6T5R7.js → chunk-FW465EEA.js} +1 -1
  19. package/dist/{chunk-BI6SGGZP.js → chunk-G3OQJ2NQ.js} +1 -1
  20. package/dist/chunk-GSD4ALSI.js +724 -0
  21. package/dist/{chunk-6QLRSPLZ.js → chunk-IOALNTAN.js} +268 -47
  22. package/dist/chunk-ITPEXLHA.js +528 -0
  23. package/dist/{chunk-LLN5SPGL.js → chunk-J5EMBUPK.js} +1 -1
  24. package/dist/chunk-K3CDT7IH.js +122 -0
  25. package/dist/{chunk-AHGUJG76.js → chunk-KCCHROBR.js} +13 -69
  26. package/dist/{chunk-JTO7NZLS.js → chunk-LMCC5OC7.js} +2 -2
  27. package/dist/{chunk-QALB2V3E.js → chunk-MQUJNOHK.js} +1 -1
  28. package/dist/{chunk-H6WQUUNK.js → chunk-TMZMN7OS.js} +334 -457
  29. package/dist/{chunk-HVTTYDCJ.js → chunk-VR5NE7PZ.js} +1 -1
  30. package/dist/{chunk-22WE3J4F.js → chunk-WIICLBNF.js} +35 -4
  31. package/dist/chunk-YCVDVI5B.js +273 -0
  32. package/dist/{chunk-NAMFB7ZA.js → chunk-Z2XBWN7A.js} +0 -2
  33. package/dist/commands/archive.js +3 -3
  34. package/dist/commands/backlog.js +1 -1
  35. package/dist/commands/blocked.js +1 -1
  36. package/dist/commands/canvas.d.ts +1 -14
  37. package/dist/commands/canvas.js +123 -1543
  38. package/dist/commands/context.js +5 -6
  39. package/dist/commands/doctor.js +2 -2
  40. package/dist/commands/inject.d.ts +2 -0
  41. package/dist/commands/inject.js +14 -0
  42. package/dist/commands/kanban.js +2 -2
  43. package/dist/commands/migrate-observations.js +2 -2
  44. package/dist/commands/observe.js +8 -6
  45. package/dist/commands/project.d.ts +85 -0
  46. package/dist/commands/project.js +411 -0
  47. package/dist/commands/rebuild.js +7 -5
  48. package/dist/commands/reflect.js +5 -4
  49. package/dist/commands/replay.js +10 -7
  50. package/dist/commands/setup.d.ts +1 -1
  51. package/dist/commands/setup.js +2 -2
  52. package/dist/commands/sleep.d.ts +1 -1
  53. package/dist/commands/sleep.js +11 -8
  54. package/dist/commands/status.js +2 -2
  55. package/dist/commands/task.d.ts +2 -2
  56. package/dist/commands/task.js +11 -301
  57. package/dist/commands/wake.d.ts +1 -1
  58. package/dist/commands/wake.js +4 -4
  59. package/dist/index.d.ts +75 -107
  60. package/dist/index.js +78 -36
  61. package/dist/inject-x65KXWPk.d.ts +137 -0
  62. package/dist/lib/project-utils.d.ts +97 -0
  63. package/dist/lib/project-utils.js +19 -0
  64. package/dist/lib/task-utils.d.ts +8 -3
  65. package/dist/lib/task-utils.js +1 -1
  66. package/dist/{types-DMU3SuAV.d.ts → types-jjuYN2Xn.d.ts} +1 -1
  67. package/package.json +2 -2
  68. package/dist/chunk-L3DJ36BZ.js +0 -40
  69. 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-QALB2V3E.js";
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-NAMFB7ZA.js";
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 = resolveProvider();
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 = provider === "anthropic" ? await callAnthropic(prompt) : provider === "gemini" ? await callGemini(prompt) : await callOpenAI(prompt);
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-H6WQUUNK.js";
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-NAMFB7ZA.js";
11
+ } from "./chunk-Z2XBWN7A.js";
12
12
 
13
13
  // src/commands/rebuild.ts
14
14
  import * as fs from "fs";
@@ -2,7 +2,7 @@ import {
2
2
  ensureParentDir,
3
3
  getArchiveObservationPath,
4
4
  listObservationFiles
5
- } from "./chunk-NAMFB7ZA.js";
5
+ } from "./chunk-Z2XBWN7A.js";
6
6
 
7
7
  // src/observer/archive.ts
8
8
  import * as fs from "fs";