@kody-ade/kody-engine 0.4.443 → 0.4.444

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 (2) hide show
  1. package/dist/bin/kody.js +19 -4
  2. package/package.json +1 -1
package/dist/bin/kody.js CHANGED
@@ -15,7 +15,7 @@ var init_package = __esm({
15
15
  "package.json"() {
16
16
  package_default = {
17
17
  name: "@kody-ade/kody-engine",
18
- version: "0.4.443",
18
+ version: "0.4.444",
19
19
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
20
20
  license: "MIT",
21
21
  type: "module",
@@ -16833,12 +16833,27 @@ var init_parseJobStateFromAgentResult = __esm({
16833
16833
  // src/scripts/parseSimpleCapabilityOutput.ts
16834
16834
  function parseOutput(text2) {
16835
16835
  if (!text2) return void 0;
16836
- const candidate = text2.match(/```(?:json)?\s*([\s\S]*?)\s*```/i)?.[1] ?? text2;
16837
16836
  try {
16838
- return JSON.parse(candidate);
16837
+ return JSON.parse(text2);
16839
16838
  } catch {
16840
- return void 0;
16841
16839
  }
16840
+ const fences = [...text2.matchAll(/```([a-z0-9_-]+)?\s*([\s\S]*?)\s*```/gi)];
16841
+ const jsonFences = fences.filter((match) => match[1]?.toLowerCase() === "json");
16842
+ const labelledOutput = parseSingleJsonCandidate(jsonFences.map((match) => match[2]));
16843
+ if (labelledOutput.found) return labelledOutput.value;
16844
+ const plainOutput = parseSingleJsonCandidate(fences.filter((match) => !match[1]).map((match) => match[2]));
16845
+ return plainOutput.found ? plainOutput.value : void 0;
16846
+ }
16847
+ function parseSingleJsonCandidate(candidates) {
16848
+ const parsed = [];
16849
+ for (const candidate of candidates) {
16850
+ if (!candidate) continue;
16851
+ try {
16852
+ parsed.push(JSON.parse(candidate));
16853
+ } catch {
16854
+ }
16855
+ }
16856
+ return parsed.length === 1 ? { found: true, value: parsed[0] } : { found: false };
16842
16857
  }
16843
16858
  function isObject(value) {
16844
16859
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.443",
3
+ "version": "0.4.444",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",