doer-agent 0.8.0 → 0.8.1

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.
@@ -187,6 +187,35 @@ export async function listAgentNotesLocal(workspaceRoot) {
187
187
  });
188
188
  return notes;
189
189
  }
190
+ export async function listAgentNotePatchesLocal(workspaceRoot, limit = 10) {
191
+ const rootAbs = workspacePath(workspaceRoot, PATCHES_ROOT);
192
+ const patches = [];
193
+ async function visit(absDir, relDir) {
194
+ const rows = await readdir(absDir, { withFileTypes: true }).catch(() => []);
195
+ await Promise.all(rows.map(async (row) => {
196
+ const childAbs = path.join(absDir, row.name);
197
+ const childRel = path.posix.join(relDir, row.name);
198
+ if (row.isDirectory()) {
199
+ await visit(childAbs, childRel);
200
+ return;
201
+ }
202
+ if (!row.isFile() || !row.name.endsWith(".patch")) {
203
+ return;
204
+ }
205
+ const entry = await stat(childAbs);
206
+ patches.push({
207
+ id: childRel,
208
+ path: childRel,
209
+ name: row.name,
210
+ size: entry.size,
211
+ mtimeMs: entry.mtimeMs,
212
+ });
213
+ }));
214
+ }
215
+ await visit(rootAbs, PATCHES_ROOT);
216
+ patches.sort((a, b) => b.mtimeMs - a.mtimeMs || b.path.localeCompare(a.path));
217
+ return patches.slice(0, Math.max(0, Math.trunc(limit)));
218
+ }
190
219
  export async function getAgentNoteLocal(workspaceRoot, noteId) {
191
220
  const id = sanitizeNoteId(noteId);
192
221
  const content = await readTextIfExists(workspacePath(workspaceRoot, noteRelPath(id)));
@@ -1,9 +1,10 @@
1
1
  import { StringCodec } from "nats";
2
- import { agentNotesCapabilitiesLocal, createAgentNoteLocal, deleteAgentNoteLocal, getAgentNoteLocal, listAgentNotesLocal, renameAgentNoteLocal, saveAgentNoteLocal, } from "./agent-notes-local.js";
2
+ import { agentNotesCapabilitiesLocal, createAgentNoteLocal, deleteAgentNoteLocal, listAgentNotePatchesLocal, getAgentNoteLocal, listAgentNotesLocal, renameAgentNoteLocal, saveAgentNoteLocal, } from "./agent-notes-local.js";
3
3
  const notesRpcCodec = StringCodec();
4
4
  function parseAction(value) {
5
5
  if (value === "capabilities" ||
6
6
  value === "list" ||
7
+ value === "listPatches" ||
7
8
  value === "get" ||
8
9
  value === "create" ||
9
10
  value === "save" ||
@@ -24,6 +25,10 @@ async function executeNotesRpc(workspaceRoot, request) {
24
25
  if (action === "list") {
25
26
  return { ok: true, action, notes: await listAgentNotesLocal(workspaceRoot) };
26
27
  }
28
+ if (action === "listPatches") {
29
+ const limit = typeof request.limit === "number" && Number.isFinite(request.limit) ? request.limit : 10;
30
+ return { ok: true, action, patches: await listAgentNotePatchesLocal(workspaceRoot, limit) };
31
+ }
27
32
  if (action === "get") {
28
33
  const notes = await listAgentNotesLocal(workspaceRoot);
29
34
  const noteId = stringValue(request.noteId) || notes[0]?.id || "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doer-agent",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Reverse-polling agent runtime for doer",
5
5
  "type": "module",
6
6
  "main": "dist/agent.js",