@mndrk/agx 1.4.27 → 1.4.29

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.
@@ -29,10 +29,15 @@ function buildCloudTaskTerminalPatch({ decision, newStage, nowIso } = {}) {
29
29
  return { status: 'completed', completed_at: now };
30
30
  }
31
31
 
32
- if (d === 'done') return { status: 'completed', completed_at: now };
32
+ // NOTE: decision "done" means the CURRENT STAGE is complete, not the entire task.
33
+ // Only mark task as completed when stage reaches "done" (handled above).
34
+ // Do NOT mark completed just because decision is "done" - that prematurely
35
+ // ends tasks stuck in ideation/planning/execution.
33
36
  if (d === 'failed') return { status: 'failed', completed_at: now };
34
37
  if (d === 'blocked') return { status: 'blocked' };
35
38
 
39
+ // For "done" and "not_done" decisions, let the stage machine handle transitions.
40
+ // The task status will be updated by the orchestrator based on stage progression.
36
41
  return null;
37
42
  }
38
43
 
@@ -110,9 +110,17 @@ async function createRun({ projectSlug, taskSlug, stage, runId: explicitRunId, e
110
110
  await ensureDir(paths.root);
111
111
  await ensureDir(paths.artifacts);
112
112
 
113
- // Prevent accidental clobbering if this stage/run already exists.
113
+ // If run already exists, return handle to existing run (idempotent)
114
114
  if (await fileExists(paths.meta)) {
115
- throw new Error(`Run already exists: stage=${stage} run_id=${runId}`);
115
+ const existingMeta = await readJson(paths.meta);
116
+ return {
117
+ runId: existingMeta.run_id || runId,
118
+ paths,
119
+ projectSlug,
120
+ taskSlug,
121
+ stage,
122
+ meta: existingMeta,
123
+ };
116
124
  }
117
125
 
118
126
  const now = new Date().toISOString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mndrk/agx",
3
- "version": "1.4.27",
3
+ "version": "1.4.29",
4
4
  "description": "Autonomous AI Agent Orchestrator for Claude, Gemini, and Ollama",
5
5
  "main": "lib/index.js",
6
6
  "exports": {