@kody-ade/kody-engine 0.4.654 → 0.4.656

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 +36 -5
  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.654",
18
+ version: "0.4.656",
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
  repository: {
@@ -18546,11 +18546,24 @@ function unwrapSingleOutput(value) {
18546
18546
  if (!isObject2(value) || Object.keys(value).length !== 1 || !Object.hasOwn(value, "output")) return void 0;
18547
18547
  const wrapped = value.output;
18548
18548
  if (typeof wrapped !== "string") return wrapped;
18549
- try {
18550
- return JSON.parse(wrapped);
18551
- } catch {
18552
- return void 0;
18549
+ return parseOutput(wrapped);
18550
+ }
18551
+ function modelProviderFailureReason(agentResult) {
18552
+ if (agentResult?.outcome !== "failed") return void 0;
18553
+ if (agentResult.outcomeKind === "rate_limit") {
18554
+ return "Model provider rate limit prevented the run from starting";
18555
+ }
18556
+ if (agentResult.outcomeKind !== "model_error") return void 0;
18557
+ const raw = agentResult.error || agentResult.finalText;
18558
+ const encodedMessage = raw.match(/"message"\s*:\s*("(?:\\.|[^"\\])*")/)?.[1];
18559
+ if (encodedMessage) {
18560
+ try {
18561
+ const message = JSON.parse(encodedMessage);
18562
+ if (typeof message === "string" && message.trim()) return `Model provider blocked the run: ${message.trim()}`;
18563
+ } catch {
18564
+ }
18553
18565
  }
18566
+ return "Model provider failed before returning a result";
18554
18567
  }
18555
18568
  function blockInvalidContractOutput(ctx, output, error) {
18556
18569
  const reason = error instanceof Error ? error.message : String(error);
@@ -18582,6 +18595,24 @@ var init_parseSimpleCapabilityOutput = __esm({
18582
18595
  init_capability_contract_validation();
18583
18596
  init_capabilityResult();
18584
18597
  parseSimpleCapabilityOutput = async (ctx, profile, agentResult) => {
18598
+ const providerFailure = modelProviderFailureReason(agentResult);
18599
+ if (providerFailure) {
18600
+ ctx.output.exitCode = 1;
18601
+ ctx.output.reason = providerFailure;
18602
+ ctx.data.capabilityOutput = { status: "blocked", reason: providerFailure, summary: providerFailure };
18603
+ ctx.data.capabilityResults = [
18604
+ {
18605
+ version: 1,
18606
+ status: "blocked",
18607
+ summary: providerFailure,
18608
+ facts: {},
18609
+ artifacts: [],
18610
+ missingEvidence: [],
18611
+ blockers: [providerFailure]
18612
+ }
18613
+ ];
18614
+ return;
18615
+ }
18585
18616
  const requiredSubagents = stringList2(ctx.data.requiredSubagents);
18586
18617
  const invokedSubagents = new Set(agentResult?.invokedSubagents ?? []);
18587
18618
  const missingSubagents = requiredSubagents.filter((name) => !invokedSubagents.has(name));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.654",
3
+ "version": "0.4.656",
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
  "repository": {