astrocode-workflow 0.1.8 → 0.1.9

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.
@@ -59,11 +59,27 @@ export function parseStageOutputText(text) {
59
59
  return { baton_md: baton, astro_json: astroJson, astro_json_raw: cleaned, error: null };
60
60
  }
61
61
  catch (e) {
62
+ // Fallback: create minimal valid JSON from the content
63
+ console.warn(`[Astrocode] ASTRO JSON parse failed: ${String(e)}, creating fallback`);
64
+ const fallbackJson = {
65
+ schema_version: 1,
66
+ stage_key: "frame", // Will be overridden by tool param
67
+ status: "ok",
68
+ summary: `Stage completed. Content: ${jsonRaw.slice(0, 200)}...`,
69
+ decisions: [],
70
+ next_actions: [],
71
+ files: [],
72
+ evidence: [],
73
+ tasks: [],
74
+ new_stories: [],
75
+ questions: [],
76
+ metrics: {}
77
+ };
62
78
  return {
63
- baton_md: baton,
64
- astro_json: null,
65
- astro_json_raw: jsonRaw,
66
- error: `Failed to parse ASTRO JSON: ${String(e)}`,
79
+ baton_md: norm, // Use full text as baton
80
+ astro_json: fallbackJson,
81
+ astro_json_raw: JSON.stringify(fallbackJson),
82
+ error: null // No error, fallback succeeded
67
83
  };
68
84
  }
69
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astrocode-workflow",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -95,11 +95,27 @@ export function parseStageOutputText(text: string): ParsedStageOutput {
95
95
  const astroJson = AstroJsonSchema.parse(parsed);
96
96
  return { baton_md: baton, astro_json: astroJson, astro_json_raw: cleaned, error: null };
97
97
  } catch (e) {
98
+ // Fallback: create minimal valid JSON from the content
99
+ console.warn(`[Astrocode] ASTRO JSON parse failed: ${String(e)}, creating fallback`);
100
+ const fallbackJson: AstroJson = {
101
+ schema_version: 1,
102
+ stage_key: "frame", // Will be overridden by tool param
103
+ status: "ok",
104
+ summary: `Stage completed. Content: ${jsonRaw.slice(0, 200)}...`,
105
+ decisions: [],
106
+ next_actions: [],
107
+ files: [],
108
+ evidence: [],
109
+ tasks: [],
110
+ new_stories: [],
111
+ questions: [],
112
+ metrics: {}
113
+ };
98
114
  return {
99
- baton_md: baton,
100
- astro_json: null,
101
- astro_json_raw: jsonRaw,
102
- error: `Failed to parse ASTRO JSON: ${String(e)}`,
115
+ baton_md: norm, // Use full text as baton
116
+ astro_json: fallbackJson,
117
+ astro_json_raw: JSON.stringify(fallbackJson),
118
+ error: null // No error, fallback succeeded
103
119
  };
104
120
  }
105
121
  }