@poncho-ai/harness 0.37.0 → 0.37.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @poncho-ai/harness@0.37.0 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
2
+ > @poncho-ai/harness@0.37.1 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
3
3
  > node scripts/embed-docs.js && tsup src/index.ts --format esm --dts
4
4
 
5
5
  [embed-docs] Generated poncho-docs.ts with 4 topics
@@ -10,7 +10,7 @@
10
10
  ESM Build start
11
11
  ESM dist/index.js 389.90 KB
12
12
  ESM dist/isolate-TCWTUVG4.js 47.34 KB
13
- ESM ⚡️ Build success in 206ms
13
+ ESM ⚡️ Build success in 211ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 7213ms
15
+ DTS ⚡️ Build success in 6845ms
16
16
  DTS dist/index.d.ts 56.62 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @poncho-ai/harness
2
2
 
3
+ ## 0.37.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`fb61a62`](https://github.com/cesr/poncho-ai/commit/fb61a6259367f0a62d0acd7a20ef2fae93013819) Thanks [@cesr](https://github.com/cesr)! - fix: migration script now discovers and migrates all agent directories instead of only the first one
8
+
3
9
  ## 0.37.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/harness",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "Agent execution runtime - conversation loop, tool dispatch, streaming",
5
5
  "repository": {
6
6
  "type": "git",
@@ -106,30 +106,26 @@ async function readJsonSafe(filePath) {
106
106
  }
107
107
  }
108
108
 
109
- async function findAgentDir(workingDir) {
109
+ async function findAgentDirs(workingDir) {
110
110
  const ponchoDir = resolve(workingDir, ".poncho");
111
+ const results = [];
111
112
  try {
112
113
  const entries = await readdir(ponchoDir, { withFileTypes: true });
113
114
  for (const e of entries) {
114
115
  if (e.isDirectory() && !e.name.startsWith(".")) {
115
- return { dir: resolve(ponchoDir, e.name), id: e.name };
116
+ results.push({ dir: resolve(ponchoDir, e.name), id: e.name });
116
117
  }
117
118
  }
118
119
  } catch { /* no .poncho dir */ }
119
- return undefined;
120
+ return results;
120
121
  }
121
122
 
122
123
  // ---------------------------------------------------------------------------
123
124
  // Read from local
124
125
  // ---------------------------------------------------------------------------
125
126
 
126
- async function readLocal(workingDir) {
127
- const agent = await findAgentDir(workingDir);
128
- if (!agent) {
129
- console.error("No .poncho agent directory found in", workingDir);
130
- process.exit(1);
131
- }
132
- console.log(`Found local agent: ${agent.id} at ${agent.dir}`);
127
+ async function readLocalAgent(agent) {
128
+ console.log(` Reading agent: ${agent.id} at ${agent.dir}`);
133
129
 
134
130
  const data = { agentId: agent.id, conversations: [], memories: [], todos: [], reminders: [] };
135
131
 
@@ -189,6 +185,29 @@ async function readLocal(workingDir) {
189
185
  return data;
190
186
  }
191
187
 
188
+ async function readLocal(workingDir) {
189
+ const agents = await findAgentDirs(workingDir);
190
+ if (agents.length === 0) {
191
+ console.error("No .poncho agent directory found in", workingDir);
192
+ process.exit(1);
193
+ }
194
+
195
+ // If --agent-id is specified, filter to that agent
196
+ const filtered = AGENT_ID ? agents.filter((a) => a.id === AGENT_ID) : agents;
197
+ if (filtered.length === 0) {
198
+ console.error(`Agent "${AGENT_ID}" not found. Available agents: ${agents.map((a) => a.id).join(", ")}`);
199
+ process.exit(1);
200
+ }
201
+
202
+ console.log(`Found ${filtered.length} agent(s) to migrate`);
203
+
204
+ const results = [];
205
+ for (const agent of filtered) {
206
+ results.push(await readLocalAgent(agent));
207
+ }
208
+ return results;
209
+ }
210
+
192
211
  // ---------------------------------------------------------------------------
193
212
  // Read from Upstash
194
213
  // ---------------------------------------------------------------------------
@@ -323,9 +342,12 @@ async function readUpstash(agentId) {
323
342
  async function readFromEngine(sourceProvider, agentId) {
324
343
  if (!agentId) {
325
344
  // Try to detect from .poncho directory
326
- const agent = await findAgentDir(WORKING_DIR);
327
- if (agent) agentId = agent.id;
328
- else {
345
+ const agents = await findAgentDirs(WORKING_DIR);
346
+ if (agents.length === 1) agentId = agents[0].id;
347
+ else if (agents.length > 1) {
348
+ console.error(`Multiple agents found: ${agents.map((a) => a.id).join(", ")}. Use --agent-id to specify one.`);
349
+ process.exit(1);
350
+ } else {
329
351
  console.error("--agent-id is required for engine source (or run from a project with .poncho/)");
330
352
  process.exit(1);
331
353
  }
@@ -513,40 +535,43 @@ async function main() {
513
535
  console.log(`Working dir: ${WORKING_DIR}`);
514
536
  if (DRY_RUN) console.log("(dry run — no data will be written)\n");
515
537
 
516
- // Read source
517
- let data;
538
+ // Read source — local returns an array (one per agent), others return a single object
539
+ let dataList;
518
540
  if (SOURCE === "local") {
519
- data = await readLocal(WORKING_DIR);
541
+ dataList = await readLocal(WORKING_DIR);
520
542
  } else if (SOURCE === "upstash") {
521
- data = await readUpstash(AGENT_ID);
543
+ dataList = [await readUpstash(AGENT_ID)];
522
544
  } else if (SOURCE === "sqlite" || SOURCE === "postgresql") {
523
- data = await readFromEngine(SOURCE, AGENT_ID);
545
+ dataList = [await readFromEngine(SOURCE, AGENT_ID)];
524
546
  } else {
525
547
  console.error(`Unknown source: ${SOURCE}. Use "local", "upstash", "sqlite", or "postgresql".`);
526
548
  process.exit(1);
527
549
  }
528
550
 
529
- console.log(`\nRead from ${SOURCE}:`);
530
- console.log(` Conversations: ${data.conversations.length}`);
531
- console.log(` Memories: ${data.memories?.length ?? 0}`);
532
- console.log(` Todo lists: ${data.todos.length}`);
533
- console.log(` Reminders: ${data.reminders.length}`);
534
- if (data.vfsFiles?.length) console.log(` VFS files: ${data.vfsFiles.length}`);
551
+ for (const data of dataList) {
552
+ console.log(`\nAgent: ${data.agentId}`);
553
+ console.log(` Read from ${SOURCE}:`);
554
+ console.log(` Conversations: ${data.conversations.length}`);
555
+ console.log(` Memories: ${data.memories?.length ?? 0}`);
556
+ console.log(` Todo lists: ${data.todos.length}`);
557
+ console.log(` Reminders: ${data.reminders.length}`);
558
+ if (data.vfsFiles?.length) console.log(` VFS files: ${data.vfsFiles.length}`);
559
+
560
+ if (data.conversations.length === 0 && !data.memories?.length && data.todos.length === 0 && data.reminders.length === 0 && !data.vfsFiles?.length) {
561
+ console.log(" Nothing to migrate for this agent.");
562
+ continue;
563
+ }
535
564
 
536
- if (data.conversations.length === 0 && !data.memories?.length && data.todos.length === 0 && data.reminders.length === 0 && !data.vfsFiles?.length) {
537
- console.log("\nNothing to migrate.");
538
- process.exit(0);
539
- }
565
+ const result = await writeToEngine(data);
540
566
 
541
- // Write to target
542
- const result = await writeToEngine(data);
567
+ console.log(` ${DRY_RUN ? "Would import" : "Imported"} to ${TARGET}:`);
568
+ console.log(` Conversations: ${result.convCount}`);
569
+ console.log(` Memories: ${result.memoryCount}`);
570
+ console.log(` Todos: ${result.todoCount}`);
571
+ console.log(` Reminders: ${result.reminderCount}`);
572
+ if (result.vfsCount) console.log(` VFS files: ${result.vfsCount}`);
573
+ }
543
574
 
544
- console.log(`\n${DRY_RUN ? "Would import" : "Imported"} to ${TARGET}:`);
545
- console.log(` Conversations: ${result.convCount}`);
546
- console.log(` Memories: ${result.memoryCount}`);
547
- console.log(` Todos: ${result.todoCount}`);
548
- console.log(` Reminders: ${result.reminderCount}`);
549
- if (result.vfsCount) console.log(` VFS files: ${result.vfsCount}`);
550
575
  console.log("\nDone!");
551
576
  }
552
577