@hyperwindmill/caretaker-cli 0.23.0 → 0.24.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.
Files changed (46) hide show
  1. package/dist/cli/web/scheduler/memory_extract.d.ts +55 -0
  2. package/dist/cli/web/scheduler/memory_extract.d.ts.map +1 -0
  3. package/dist/cli/web/scheduler/memory_extract.js +112 -0
  4. package/dist/cli/web/scheduler/memory_sweep.d.ts +68 -0
  5. package/dist/cli/web/scheduler/memory_sweep.d.ts.map +1 -0
  6. package/dist/cli/web/scheduler/memory_sweep.js +329 -0
  7. package/dist/cli/web/scheduler/task_review.d.ts +3 -0
  8. package/dist/cli/web/scheduler/task_review.d.ts.map +1 -1
  9. package/dist/cli/web/scheduler/task_review.js +1 -0
  10. package/dist/cli/web/scheduler/task_strategy.d.ts.map +1 -1
  11. package/dist/cli/web/scheduler/task_strategy.js +4 -0
  12. package/dist/cli/web/scheduler.d.ts.map +1 -1
  13. package/dist/cli/web/scheduler.js +5 -0
  14. package/dist/cli/web/server.d.ts.map +1 -1
  15. package/dist/cli/web/server.js +6 -1
  16. package/dist/harness/claude_code_runner.d.ts.map +1 -1
  17. package/dist/harness/claude_code_runner.js +5 -0
  18. package/dist/harness/loop.d.ts +9 -0
  19. package/dist/harness/loop.d.ts.map +1 -1
  20. package/dist/harness/loop.js +10 -0
  21. package/dist/harness/memory_recall.d.ts +23 -0
  22. package/dist/harness/memory_recall.d.ts.map +1 -0
  23. package/dist/harness/memory_recall.js +70 -0
  24. package/dist/harness/tools/builtin/index.d.ts +2 -1
  25. package/dist/harness/tools/builtin/index.d.ts.map +1 -1
  26. package/dist/harness/tools/builtin/index.js +4 -1
  27. package/dist/harness/tools/builtin/memory_tools.d.ts +3 -0
  28. package/dist/harness/tools/builtin/memory_tools.d.ts.map +1 -0
  29. package/dist/harness/tools/builtin/memory_tools.js +60 -0
  30. package/dist/harness/tools/resolve.d.ts.map +1 -1
  31. package/dist/harness/tools/resolve.js +15 -0
  32. package/dist/harness/tools/types.d.ts +6 -0
  33. package/dist/harness/tools/types.d.ts.map +1 -1
  34. package/dist/lib/project_resolve.d.ts +5 -0
  35. package/dist/lib/project_resolve.d.ts.map +1 -0
  36. package/dist/lib/project_resolve.js +23 -0
  37. package/dist/mcp/builtin_server.d.ts +1 -0
  38. package/dist/mcp/builtin_server.d.ts.map +1 -1
  39. package/dist/mcp/builtin_server.js +6 -5
  40. package/dist/store/db.d.ts +66 -0
  41. package/dist/store/db.d.ts.map +1 -1
  42. package/dist/store/db.js +68 -0
  43. package/dist/tui/agents.js +5 -2
  44. package/dist/webview/standalone.js +557 -415
  45. package/dist/webview/standalone.js.map +4 -4
  46. package/package.json +3 -3
package/dist/store/db.js CHANGED
@@ -149,3 +149,71 @@ export async function deleteTask(taskId) {
149
149
  await runQuery(`DELETE FROM task_messages WHERE taskId = '${taskId}'`);
150
150
  await runQuery(`DELETE FROM tasks WHERE id = '${taskId}'`);
151
151
  }
152
+ export async function getSessionDigest(sessionId) {
153
+ if (!safeId(sessionId))
154
+ return null;
155
+ try {
156
+ const rows = (await runQuery(`SELECT * FROM session_digests WHERE id = '${sessionId}'`));
157
+ return rows[0] || null;
158
+ }
159
+ catch {
160
+ return null;
161
+ }
162
+ }
163
+ export async function listSessionDigests() {
164
+ try {
165
+ return (await runQuery('SELECT * FROM session_digests'));
166
+ }
167
+ catch {
168
+ return [];
169
+ }
170
+ }
171
+ export async function saveSessionDigest(d) {
172
+ if (!safeId(d.id))
173
+ throw new Error(`Invalid session id: ${d.id}`);
174
+ // Delete + insert = upsert; summary goes through JSON.stringify, so quotes
175
+ // and newlines never touch the interpolated SQL string.
176
+ await runQuery(`DELETE FROM session_digests WHERE id = '${d.id}'`);
177
+ await runQuery(`INSERT INTO session_digests ${JSON.stringify({ ...d, updatedAt: new Date().toISOString() })}`);
178
+ }
179
+ export async function deleteSessionDigest(sessionId) {
180
+ if (!safeId(sessionId))
181
+ return;
182
+ await runQuery(`DELETE FROM session_digests WHERE id = '${sessionId}'`);
183
+ }
184
+ export async function saveMemory(m) {
185
+ if (!safeId(m.id))
186
+ throw new Error(`Invalid memory id: ${m.id}`);
187
+ // Insert-only: memories are append-only; there is deliberately no upsert.
188
+ await runQuery(`INSERT INTO memories ${JSON.stringify(m)}`);
189
+ }
190
+ export async function listMemories() {
191
+ try {
192
+ return (await runQuery('SELECT * FROM memories'));
193
+ }
194
+ catch {
195
+ return [];
196
+ }
197
+ }
198
+ export async function deleteMemory(id) {
199
+ if (!safeId(id))
200
+ return;
201
+ await runQuery(`DELETE FROM memories WHERE id = '${id}'`);
202
+ }
203
+ /** Recall event: memory_read delivered this memory to an agent. Delete +
204
+ * insert (saveSessionDigest pattern — the store has no UPDATE). No-op on
205
+ * unknown ids: a stale id in a prelude block is not an error. */
206
+ export async function bumpMemoryRecall(id) {
207
+ if (!safeId(id))
208
+ return;
209
+ const rows = (await runQuery(`SELECT * FROM memories WHERE id = '${id}'`));
210
+ const m = rows[0];
211
+ if (!m)
212
+ return;
213
+ await runQuery(`DELETE FROM memories WHERE id = '${id}'`);
214
+ await runQuery(`INSERT INTO memories ${JSON.stringify({
215
+ ...m,
216
+ recallCount: (m.recallCount ?? 0) + 1,
217
+ lastRecalledAt: new Date().toISOString(),
218
+ })}`);
219
+ }
@@ -257,8 +257,11 @@ const NAMESPACE_DESCRIPTIONS = {
257
257
  mcp__email__: 'List the configured email accounts and send mail',
258
258
  };
259
259
  /** The picker's tool list: one synthetic entry per `mcp__<ns>__` namespace in
260
- * place of its individual tools, everything else as-is. */
261
- function namespacedToolList(tools) {
260
+ * place of its individual tools, everything else as-is. Hidden tools
261
+ * (memory_read) are harness infrastructure, auto-included by
262
+ * resolveAgentTools behind their own gate — never a picker choice. */
263
+ function namespacedToolList(allTools) {
264
+ const tools = allTools.filter((t) => !t.hidden);
262
265
  const namespaces = [
263
266
  ...new Set(tools.map((t) => /^mcp__[a-z]+__/.exec(t.name)?.[0]).filter((p) => !!p)),
264
267
  ];