@kody-ade/kody-engine 0.4.655 → 0.4.657

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 +42 -1
  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.655",
18
+ version: "0.4.657",
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: {
@@ -5023,6 +5023,12 @@ async function runAgent(opts) {
5023
5023
  outcomeKind = "model_error";
5024
5024
  errorMessage2 = "Claude Code reported it is not logged in; refusing to mark agent run successful";
5025
5025
  }
5026
+ const providerApiError = outcome === "completed" && tokens.output === 0 && /^API Error:\s*\d+\b/i.test(finalText.trim());
5027
+ if (providerApiError) {
5028
+ outcome = "failed";
5029
+ outcomeKind = "model_error";
5030
+ errorMessage2 = finalText.trim();
5031
+ }
5026
5032
  if (outcome === "completed" && !sawMutatingTool) {
5027
5033
  const hasUsefulSuccess = tokens.output > 0 || finalText !== "" || Boolean(getSubmitted?.());
5028
5034
  if (!hasUsefulSuccess) {
@@ -18548,6 +18554,23 @@ function unwrapSingleOutput(value) {
18548
18554
  if (typeof wrapped !== "string") return wrapped;
18549
18555
  return parseOutput(wrapped);
18550
18556
  }
18557
+ function modelProviderFailureReason(agentResult) {
18558
+ if (agentResult?.outcome !== "failed") return void 0;
18559
+ if (agentResult.outcomeKind === "rate_limit") {
18560
+ return "Model provider rate limit prevented the run from starting";
18561
+ }
18562
+ if (agentResult.outcomeKind !== "model_error") return void 0;
18563
+ const raw = agentResult.error || agentResult.finalText;
18564
+ const encodedMessage = raw.match(/"message"\s*:\s*("(?:\\.|[^"\\])*")/)?.[1];
18565
+ if (encodedMessage) {
18566
+ try {
18567
+ const message = JSON.parse(encodedMessage);
18568
+ if (typeof message === "string" && message.trim()) return `Model provider blocked the run: ${message.trim()}`;
18569
+ } catch {
18570
+ }
18571
+ }
18572
+ return "Model provider failed before returning a result";
18573
+ }
18551
18574
  function blockInvalidContractOutput(ctx, output, error) {
18552
18575
  const reason = error instanceof Error ? error.message : String(error);
18553
18576
  ctx.output.exitCode = 64;
@@ -18578,6 +18601,24 @@ var init_parseSimpleCapabilityOutput = __esm({
18578
18601
  init_capability_contract_validation();
18579
18602
  init_capabilityResult();
18580
18603
  parseSimpleCapabilityOutput = async (ctx, profile, agentResult) => {
18604
+ const providerFailure = modelProviderFailureReason(agentResult);
18605
+ if (providerFailure) {
18606
+ ctx.output.exitCode = 1;
18607
+ ctx.output.reason = providerFailure;
18608
+ ctx.data.capabilityOutput = { status: "blocked", reason: providerFailure, summary: providerFailure };
18609
+ ctx.data.capabilityResults = [
18610
+ {
18611
+ version: 1,
18612
+ status: "blocked",
18613
+ summary: providerFailure,
18614
+ facts: {},
18615
+ artifacts: [],
18616
+ missingEvidence: [],
18617
+ blockers: [providerFailure]
18618
+ }
18619
+ ];
18620
+ return;
18621
+ }
18581
18622
  const requiredSubagents = stringList2(ctx.data.requiredSubagents);
18582
18623
  const invokedSubagents = new Set(agentResult?.invokedSubagents ?? []);
18583
18624
  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.655",
3
+ "version": "0.4.657",
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": {