@kody-ade/kody-engine 0.4.439 → 0.4.441

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.439",
18
+ version: "0.4.441",
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,55 @@ 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
+ const candidate = text2.trim().match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i)?.[1] ?? text2;
16877
+ try {
16878
+ const parsed = JSON.parse(candidate);
16879
+ if (!isObject(parsed) || !isObject(parsed.result)) return null;
16880
+ return { result: parsed.result };
16881
+ } catch {
16882
+ return null;
16883
+ }
16884
+ }
16885
+ function isObject(value) {
16886
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
16887
+ }
16888
+ function stringValue4(value) {
16889
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
16890
+ }
16891
+ var parseSimpleCapabilityOutput;
16892
+ var init_parseSimpleCapabilityOutput = __esm({
16893
+ "src/scripts/parseSimpleCapabilityOutput.ts"() {
16894
+ "use strict";
16895
+ parseSimpleCapabilityOutput = async (ctx, _profile, agentResult) => {
16896
+ const envelope = parseEnvelope(agentResult?.finalText);
16897
+ if (!envelope) {
16898
+ ctx.output.exitCode = 64;
16899
+ ctx.output.reason = "simple capability did not return its JSON output contract";
16900
+ return;
16901
+ }
16902
+ const result = envelope.result;
16903
+ const data = isObject(result.data) ? result.data : {};
16904
+ const summary = typeof result.summary === "string" ? result.summary : "Capability completed";
16905
+ const reason = typeof result.reason === "string" ? result.reason : summary;
16906
+ const prUrl = stringValue4(data.pullRequestUrl) ?? stringValue4(data.prUrl) ?? stringValue4(result.pullRequestUrl) ?? stringValue4(result.prUrl);
16907
+ if (prUrl) ctx.output.prUrl = prUrl;
16908
+ ctx.output.reason = reason;
16909
+ ctx.data.capabilityResults = [{
16910
+ version: 1,
16911
+ status: "changed",
16912
+ summary,
16913
+ facts: data,
16914
+ artifacts: prUrl ? [{ label: "Pull request", url: prUrl }] : [],
16915
+ missingEvidence: [],
16916
+ blockers: []
16917
+ }];
16918
+ };
16919
+ }
16920
+ });
16921
+
16873
16922
  // src/scripts/parseReproOutput.ts
16874
16923
  function extractTestPath(text2) {
16875
16924
  const m = text2.match(/^[\s>*_#`~-]*TEST_PATH[\s>*_#`~-]*\s*:\s*(.+?)\s*$/im);
@@ -17720,7 +17769,7 @@ function resolveDotted(root, path54) {
17720
17769
  if (!path54) return void 0;
17721
17770
  return path54.split(".").reduce((value, key) => recordField4(value)?.[key], root);
17722
17771
  }
17723
- function stringValue4(value) {
17772
+ function stringValue5(value) {
17724
17773
  return typeof value === "string" && value.trim() ? value.trim() : null;
17725
17774
  }
17726
17775
  function humanize(value) {
@@ -17743,16 +17792,16 @@ var init_publishReport = __esm({
17743
17792
  const stateData = recordField4(recordField4(ctx.data.nextJobState)?.data) ?? {};
17744
17793
  const data = { ...stateData, ...result?.facts ?? {} };
17745
17794
  if (publication.publishWhenFact && resolveDotted(data, publication.publishWhenFact) === void 0) return;
17746
- const slug = publication.slug ?? stringValue4(resolveDotted(data, publication.slugFact));
17795
+ const slug = publication.slug ?? stringValue5(resolveDotted(data, publication.slugFact));
17747
17796
  if (!slug || !SAFE_SLUG.test(slug)) return;
17748
- const title = publication.title ?? stringValue4(resolveDotted(data, publication.titleFact)) ?? humanize(slug);
17797
+ const title = publication.title ?? stringValue5(resolveDotted(data, publication.titleFact)) ?? humanize(slug);
17749
17798
  const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
17750
17799
  const markdown = buildRuntimeReportMarkdown({
17751
17800
  generatedAt,
17752
17801
  reportType: publication.type,
17753
17802
  reportTypeVersion: publication.version ?? 1,
17754
17803
  owner: publication.owner,
17755
- capability: stringValue4(ctx.data.jobCapability) ?? stringValue4(ctx.data.capabilitySlug) ?? "unknown",
17804
+ capability: stringValue5(ctx.data.jobCapability) ?? stringValue5(ctx.data.capabilitySlug) ?? "unknown",
17756
17805
  title,
17757
17806
  summary: result?.summary ?? title,
17758
17807
  data,
@@ -17772,7 +17821,7 @@ var init_publishReport = __esm({
17772
17821
  reportType: publication.type,
17773
17822
  reportTypeVersion: publication.version ?? 1,
17774
17823
  owner: publication.owner,
17775
- capability: stringValue4(ctx.data.jobCapability) ?? stringValue4(ctx.data.capabilitySlug) ?? "unknown"
17824
+ capability: stringValue5(ctx.data.jobCapability) ?? stringValue5(ctx.data.capabilitySlug) ?? "unknown"
17776
17825
  },
17777
17826
  generatedAt
17778
17827
  );
@@ -20581,6 +20630,7 @@ var init_scripts = __esm({
20581
20630
  init_parseAgentResult();
20582
20631
  init_parseIssueStateFromAgentResult();
20583
20632
  init_parseJobStateFromAgentResult();
20633
+ init_parseSimpleCapabilityOutput();
20584
20634
  init_parseReproOutput();
20585
20635
  init_persistArtifacts();
20586
20636
  init_persistFlowState();
@@ -20680,6 +20730,7 @@ var init_scripts = __esm({
20680
20730
  saveManagedGoalState
20681
20731
  };
20682
20732
  postflightScripts = {
20733
+ parseSimpleCapabilityOutput,
20683
20734
  parseAgentResult: parseAgentResult2,
20684
20735
  parseIssueStateFromAgentResult,
20685
20736
  parseJobStateFromAgentResult,
@@ -24663,7 +24714,7 @@ function normalizeLoopDefinition(value) {
24663
24714
  if (Object.keys(raw).some((key) => !["id", "trigger", "target", "input", "enabled"].includes(key))) return null;
24664
24715
  if (typeof raw.id !== "string" || !ID.test(raw.id)) return null;
24665
24716
  if (typeof raw.enabled !== "boolean") return null;
24666
- if (!isObject(raw.input) || !isObject(raw.trigger) || !isObject(raw.target)) return null;
24717
+ if (!isObject2(raw.input) || !isObject2(raw.trigger) || !isObject2(raw.target)) return null;
24667
24718
  const targetKind = raw.target.kind;
24668
24719
  const targetId = raw.target.id;
24669
24720
  if (targetKind !== "workflow" && targetKind !== "capability" || typeof targetId !== "string" || !ID.test(targetId)) {
@@ -24710,7 +24761,7 @@ function normalizeTrigger(raw) {
24710
24761
  if (raw.at === void 0 && Object.keys(raw).every((key) => key === "type" || key === "every")) {
24711
24762
  return { type: "schedule", every: raw.every };
24712
24763
  }
24713
- 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")) {
24764
+ 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")) {
24714
24765
  return { type: "schedule", every: raw.every, at: { time: raw.at.time, timezone: raw.at.timezone } };
24715
24766
  }
24716
24767
  }
@@ -24722,7 +24773,7 @@ function normalizeTrigger(raw) {
24722
24773
  }
24723
24774
  return null;
24724
24775
  }
24725
- function isObject(value) {
24776
+ function isObject2(value) {
24726
24777
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
24727
24778
  }
24728
24779
 
@@ -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.439",
3
+ "version": "0.4.441",
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",