@kody-ade/kody-engine 0.4.438 → 0.4.440

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.
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.438",
18
+ version: "0.4.440",
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",
@@ -16870,6 +16870,54 @@ var init_parseJobStateFromAgentResult = __esm({
16870
16870
  }
16871
16871
  });
16872
16872
 
16873
+ // src/scripts/parseSimpleCapabilityOutput.ts
16874
+ function parseEnvelope(text2) {
16875
+ if (!text2) return null;
16876
+ try {
16877
+ const parsed = JSON.parse(text2);
16878
+ if (!isObject(parsed) || !isObject(parsed.result)) return null;
16879
+ return { result: parsed.result };
16880
+ } catch {
16881
+ return null;
16882
+ }
16883
+ }
16884
+ function isObject(value) {
16885
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
16886
+ }
16887
+ function stringValue4(value) {
16888
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
16889
+ }
16890
+ var parseSimpleCapabilityOutput;
16891
+ var init_parseSimpleCapabilityOutput = __esm({
16892
+ "src/scripts/parseSimpleCapabilityOutput.ts"() {
16893
+ "use strict";
16894
+ parseSimpleCapabilityOutput = async (ctx, _profile, agentResult) => {
16895
+ const envelope = parseEnvelope(agentResult?.finalText);
16896
+ if (!envelope) {
16897
+ ctx.output.exitCode = 64;
16898
+ ctx.output.reason = "simple capability did not return its JSON output contract";
16899
+ return;
16900
+ }
16901
+ const result = envelope.result;
16902
+ const data = isObject(result.data) ? result.data : {};
16903
+ const summary = typeof result.summary === "string" ? result.summary : "Capability completed";
16904
+ const reason = typeof result.reason === "string" ? result.reason : summary;
16905
+ const prUrl = stringValue4(data.pullRequestUrl) ?? stringValue4(data.prUrl) ?? stringValue4(result.pullRequestUrl) ?? stringValue4(result.prUrl);
16906
+ if (prUrl) ctx.output.prUrl = prUrl;
16907
+ ctx.output.reason = reason;
16908
+ ctx.data.capabilityResults = [{
16909
+ version: 1,
16910
+ status: "changed",
16911
+ summary,
16912
+ facts: data,
16913
+ artifacts: prUrl ? [{ label: "Pull request", url: prUrl }] : [],
16914
+ missingEvidence: [],
16915
+ blockers: []
16916
+ }];
16917
+ };
16918
+ }
16919
+ });
16920
+
16873
16921
  // src/scripts/parseReproOutput.ts
16874
16922
  function extractTestPath(text2) {
16875
16923
  const m = text2.match(/^[\s>*_#`~-]*TEST_PATH[\s>*_#`~-]*\s*:\s*(.+?)\s*$/im);
@@ -17720,7 +17768,7 @@ function resolveDotted(root, path54) {
17720
17768
  if (!path54) return void 0;
17721
17769
  return path54.split(".").reduce((value, key) => recordField4(value)?.[key], root);
17722
17770
  }
17723
- function stringValue4(value) {
17771
+ function stringValue5(value) {
17724
17772
  return typeof value === "string" && value.trim() ? value.trim() : null;
17725
17773
  }
17726
17774
  function humanize(value) {
@@ -17743,16 +17791,16 @@ var init_publishReport = __esm({
17743
17791
  const stateData = recordField4(recordField4(ctx.data.nextJobState)?.data) ?? {};
17744
17792
  const data = { ...stateData, ...result?.facts ?? {} };
17745
17793
  if (publication.publishWhenFact && resolveDotted(data, publication.publishWhenFact) === void 0) return;
17746
- const slug = publication.slug ?? stringValue4(resolveDotted(data, publication.slugFact));
17794
+ const slug = publication.slug ?? stringValue5(resolveDotted(data, publication.slugFact));
17747
17795
  if (!slug || !SAFE_SLUG.test(slug)) return;
17748
- const title = publication.title ?? stringValue4(resolveDotted(data, publication.titleFact)) ?? humanize(slug);
17796
+ const title = publication.title ?? stringValue5(resolveDotted(data, publication.titleFact)) ?? humanize(slug);
17749
17797
  const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
17750
17798
  const markdown = buildRuntimeReportMarkdown({
17751
17799
  generatedAt,
17752
17800
  reportType: publication.type,
17753
17801
  reportTypeVersion: publication.version ?? 1,
17754
17802
  owner: publication.owner,
17755
- capability: stringValue4(ctx.data.jobCapability) ?? stringValue4(ctx.data.capabilitySlug) ?? "unknown",
17803
+ capability: stringValue5(ctx.data.jobCapability) ?? stringValue5(ctx.data.capabilitySlug) ?? "unknown",
17756
17804
  title,
17757
17805
  summary: result?.summary ?? title,
17758
17806
  data,
@@ -17772,7 +17820,7 @@ var init_publishReport = __esm({
17772
17820
  reportType: publication.type,
17773
17821
  reportTypeVersion: publication.version ?? 1,
17774
17822
  owner: publication.owner,
17775
- capability: stringValue4(ctx.data.jobCapability) ?? stringValue4(ctx.data.capabilitySlug) ?? "unknown"
17823
+ capability: stringValue5(ctx.data.jobCapability) ?? stringValue5(ctx.data.capabilitySlug) ?? "unknown"
17776
17824
  },
17777
17825
  generatedAt
17778
17826
  );
@@ -20581,6 +20629,7 @@ var init_scripts = __esm({
20581
20629
  init_parseAgentResult();
20582
20630
  init_parseIssueStateFromAgentResult();
20583
20631
  init_parseJobStateFromAgentResult();
20632
+ init_parseSimpleCapabilityOutput();
20584
20633
  init_parseReproOutput();
20585
20634
  init_persistArtifacts();
20586
20635
  init_persistFlowState();
@@ -20680,6 +20729,7 @@ var init_scripts = __esm({
20680
20729
  saveManagedGoalState
20681
20730
  };
20682
20731
  postflightScripts = {
20732
+ parseSimpleCapabilityOutput,
20683
20733
  parseAgentResult: parseAgentResult2,
20684
20734
  parseIssueStateFromAgentResult,
20685
20735
  parseJobStateFromAgentResult,
@@ -24663,7 +24713,7 @@ function normalizeLoopDefinition(value) {
24663
24713
  if (Object.keys(raw).some((key) => !["id", "trigger", "target", "input", "enabled"].includes(key))) return null;
24664
24714
  if (typeof raw.id !== "string" || !ID.test(raw.id)) return null;
24665
24715
  if (typeof raw.enabled !== "boolean") return null;
24666
- if (!isObject(raw.input) || !isObject(raw.trigger) || !isObject(raw.target)) return null;
24716
+ if (!isObject2(raw.input) || !isObject2(raw.trigger) || !isObject2(raw.target)) return null;
24667
24717
  const targetKind = raw.target.kind;
24668
24718
  const targetId = raw.target.id;
24669
24719
  if (targetKind !== "workflow" && targetKind !== "capability" || typeof targetId !== "string" || !ID.test(targetId)) {
@@ -24698,6 +24748,10 @@ function readLoopDefinition(cwd, id) {
24698
24748
  `);
24699
24749
  }
24700
24750
  }
24751
+ process.stderr.write(
24752
+ `[kody] simple Loop not found: ${id} (${roots.map((root) => path49.join(root, "loops", id, "loop.json")).join(", ")})
24753
+ `
24754
+ );
24701
24755
  return null;
24702
24756
  }
24703
24757
  function normalizeTrigger(raw) {
@@ -24706,7 +24760,7 @@ function normalizeTrigger(raw) {
24706
24760
  if (raw.at === void 0 && Object.keys(raw).every((key) => key === "type" || key === "every")) {
24707
24761
  return { type: "schedule", every: raw.every };
24708
24762
  }
24709
- if (isObject(raw.at) && typeof raw.at.time === "string" && typeof raw.at.timezone === "string" && Object.keys(raw.at).every((key) => key === "time" || key === "timezone") && Object.keys(raw).every((key) => key === "type" || key === "every" || key === "at")) {
24763
+ if (isObject2(raw.at) && typeof raw.at.time === "string" && typeof raw.at.timezone === "string" && Object.keys(raw.at).every((key) => key === "time" || key === "timezone") && Object.keys(raw).every((key) => key === "type" || key === "every" || key === "at")) {
24710
24764
  return { type: "schedule", every: raw.every, at: { time: raw.at.time, timezone: raw.at.timezone } };
24711
24765
  }
24712
24766
  }
@@ -24718,7 +24772,7 @@ function normalizeTrigger(raw) {
24718
24772
  }
24719
24773
  return null;
24720
24774
  }
24721
- function isObject(value) {
24775
+ function isObject2(value) {
24722
24776
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
24723
24777
  }
24724
24778
 
@@ -36,7 +36,7 @@
36
36
  "cliTools": [],
37
37
  "scripts": {
38
38
  "preflight": [{ "script": "loadSimpleCapability" }],
39
- "postflight": []
39
+ "postflight": [{ "script": "parseSimpleCapabilityOutput" }]
40
40
  },
41
41
  "inputArtifacts": [],
42
42
  "outputArtifacts": []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.438",
3
+ "version": "0.4.440",
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",