@kody-ade/kody-engine 0.4.649 → 0.4.651

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.649",
18
+ version: "0.4.651",
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: {
@@ -24969,18 +24969,21 @@ async function runJob(job, base) {
24969
24969
  });
24970
24970
  }
24971
24971
  if (valid.workflowRunId && workflowIdentity && base.config && result.workflowState) {
24972
- await lease?.checkpoint();
24973
- await writeWorkflowRunState(base.config, base.cwd, workflowIdentity, valid.workflowRunId, result.workflowState);
24972
+ await checkpointTerminalWorkflowState(checkpoint, result.workflowState);
24974
24973
  }
24975
24974
  if (valid.workflowRunId && workflowIdentity && hasGitHubActionsIdentity() && result.workflowState?.status !== "waiting-approval") {
24976
24975
  const facts = result.workflowState?.facts ?? {};
24976
+ const completionOutput = {
24977
+ ...facts,
24978
+ ...result.usage ? { usage: result.usage } : {}
24979
+ };
24977
24980
  await notifyWorkflowCompleted({
24978
24981
  workflowId: workflowIdentity,
24979
24982
  runId: valid.workflowRunId,
24980
24983
  ...typeof base.preloadedData?.loopId === "string" ? { loopId: base.preloadedData.loopId } : {},
24981
24984
  status: result.workflowState?.status === "blocked" ? "blocked" : result.exitCode === 0 ? "success" : "failed",
24982
24985
  ...result.reason ? { summary: result.reason } : {},
24983
- ...Object.keys(facts).length > 0 ? { output: facts } : {}
24986
+ ...Object.keys(completionOutput).length > 0 ? { output: completionOutput } : {}
24984
24987
  });
24985
24988
  }
24986
24989
  publishRunUsage(`workflow:${workflowIdentity}`, result.usage);
@@ -25118,7 +25121,7 @@ async function runCapabilityWorkflow(parent, workflow, capability, base, checkpo
25118
25121
  const state = initialWorkflowState(parent, workflow);
25119
25122
  state.status = "blocked";
25120
25123
  state.blocker = invalid;
25121
- await checkpoint?.(state);
25124
+ await checkpointTerminalWorkflowState(checkpoint, state);
25122
25125
  return { exitCode: 64, reason: invalid, workflowState: state };
25123
25126
  }
25124
25127
  return { exitCode: 64, reason: invalid };
@@ -25128,7 +25131,7 @@ async function runCapabilityWorkflow(parent, workflow, capability, base, checkpo
25128
25131
  const state = initialWorkflowState(parent, workflow);
25129
25132
  state.status = "blocked";
25130
25133
  state.blocker = resumeBlocker;
25131
- await checkpoint?.(state);
25134
+ await checkpointTerminalWorkflowState(checkpoint, state);
25132
25135
  return { exitCode: 64, reason: resumeBlocker, workflowState: state };
25133
25136
  }
25134
25137
  const result = isGraphWorkflow(workflow) ? await runGraphCapabilityWorkflow(parent, workflow, capability, base, checkpoint) : await runLinearCapabilityWorkflow(parent, workflow, capability, base, checkpoint);
@@ -25222,7 +25225,7 @@ async function runLinearCapabilityWorkflow(parent, workflow, capability, base, c
25222
25225
  if (result.exitCode !== 0 && !canContinueWorkflow(step, outcome)) {
25223
25226
  state.status = result.capabilityResults?.at(-1)?.status === "blocked" ? "blocked" : "failed";
25224
25227
  state.blocker = result.reason ?? `workflow ${capability.slug} stopped at step ${index + 1}/${workflow.steps.length}: ${label}`;
25225
- await checkpoint?.(state);
25228
+ await checkpointTerminalWorkflowState(checkpoint, state);
25226
25229
  return withWorkflowBoundaryEval(capability, {
25227
25230
  ...result,
25228
25231
  reason: state.blocker,
@@ -25232,7 +25235,7 @@ async function runLinearCapabilityWorkflow(parent, workflow, capability, base, c
25232
25235
  }
25233
25236
  state.status = "done";
25234
25237
  delete state.blocker;
25235
- await checkpoint?.(state);
25238
+ await checkpointTerminalWorkflowState(checkpoint, state);
25236
25239
  return withWorkflowBoundaryEval(capability, { ...result, workflowState: state });
25237
25240
  }
25238
25241
  function isGraphWorkflow(workflow) {
@@ -25331,7 +25334,7 @@ async function runGraphCapabilityWorkflow(parent, workflow, capability, base, ch
25331
25334
  const reason = `workflow ${capability.slug} exceeded ${maxExecutedSteps} executed steps`;
25332
25335
  state.status = "blocked";
25333
25336
  state.blocker = reason;
25334
- await checkpoint?.(state);
25337
+ await checkpointTerminalWorkflowState(checkpoint, state);
25335
25338
  return { ...result, exitCode: 64, reason, workflowState: state };
25336
25339
  }
25337
25340
  const index = workflow.steps.findIndex((step2) => step2.id === state.currentStepId);
@@ -25340,7 +25343,7 @@ async function runGraphCapabilityWorkflow(parent, workflow, capability, base, ch
25340
25343
  const reason = `workflow ${capability.slug} current step ${state.currentStepId} is missing`;
25341
25344
  state.status = "blocked";
25342
25345
  state.blocker = reason;
25343
- await checkpoint?.(state);
25346
+ await checkpointTerminalWorkflowState(checkpoint, state);
25344
25347
  return { ...result, exitCode: 64, reason, workflowState: state };
25345
25348
  }
25346
25349
  const label = step.action ?? step.capability;
@@ -25373,7 +25376,7 @@ async function runGraphCapabilityWorkflow(parent, workflow, capability, base, ch
25373
25376
  output: { status: "blocked", summary: reason },
25374
25377
  completedAt: (/* @__PURE__ */ new Date()).toISOString()
25375
25378
  };
25376
- await checkpoint?.(state);
25379
+ await checkpointTerminalWorkflowState(checkpoint, state);
25377
25380
  return { exitCode: 64, reason, workflowState: state };
25378
25381
  }
25379
25382
  beginWorkflowStep(state, step, child);
@@ -25434,7 +25437,7 @@ async function runGraphCapabilityWorkflow(parent, workflow, capability, base, ch
25434
25437
  const lastResult = result.capabilityResults?.at(-1);
25435
25438
  state.status = lastResult?.status === "blocked" ? "blocked" : "failed";
25436
25439
  state.blocker = result.reason ?? `workflow step ${step.id} failed`;
25437
- await checkpoint?.(state);
25440
+ await checkpointTerminalWorkflowState(checkpoint, state);
25438
25441
  return withWorkflowBoundaryEval(capability, { ...result, workflowState: state });
25439
25442
  }
25440
25443
  if (!step.next || step.next.length === 0) {
@@ -25445,7 +25448,7 @@ async function runGraphCapabilityWorkflow(parent, workflow, capability, base, ch
25445
25448
  const reason = `workflow step ${step.id} did not emit the structured result required by its conditions: ${resultConditionPaths.join(", ")}`;
25446
25449
  state.status = "blocked";
25447
25450
  state.blocker = reason;
25448
- await checkpoint?.(state);
25451
+ await checkpointTerminalWorkflowState(checkpoint, state);
25449
25452
  return { ...result, exitCode: 64, reason, workflowState: state };
25450
25453
  }
25451
25454
  const transition = selectWorkflowTransition(step, chainData, state.transitionCounts);
@@ -25454,7 +25457,7 @@ async function runGraphCapabilityWorkflow(parent, workflow, capability, base, ch
25454
25457
  const reason = exhausted.length > 0 ? `workflow step ${step.id} reached iteration limit: ${exhausted.join(", ")}` : `workflow step ${step.id} has no available connection`;
25455
25458
  state.status = "blocked";
25456
25459
  state.blocker = reason;
25457
- await checkpoint?.(state);
25460
+ await checkpointTerminalWorkflowState(checkpoint, state);
25458
25461
  return { ...result, exitCode: 64, reason, workflowState: state };
25459
25462
  }
25460
25463
  if (transition.maxIterations !== void 0) {
@@ -25470,7 +25473,7 @@ async function runGraphCapabilityWorkflow(parent, workflow, capability, base, ch
25470
25473
  await checkpoint?.(state);
25471
25474
  }
25472
25475
  state.status = "done";
25473
- await checkpoint?.(state);
25476
+ await checkpointTerminalWorkflowState(checkpoint, state);
25474
25477
  return withWorkflowBoundaryEval(capability, { ...result, workflowState: state });
25475
25478
  }
25476
25479
  async function completeWorkflowAtTerminal(capability, state, output, checkpoint) {
@@ -25481,7 +25484,7 @@ async function completeWorkflowAtTerminal(capability, state, output, checkpoint)
25481
25484
  const summary = result?.summary ?? (typeof output.capabilityOutput?.summary === "string" ? output.capabilityOutput.summary : "Workflow ended without a usable result");
25482
25485
  state.status = terminalFailure;
25483
25486
  state.blocker = summary;
25484
- await checkpoint?.(state);
25487
+ await checkpointTerminalWorkflowState(checkpoint, state);
25485
25488
  return withWorkflowBoundaryEval(capability, {
25486
25489
  ...output,
25487
25490
  exitCode: terminalFailure === "failed" ? 1 : 64,
@@ -25492,9 +25495,18 @@ async function completeWorkflowAtTerminal(capability, state, output, checkpoint)
25492
25495
  state.status = "done";
25493
25496
  delete state.currentStepId;
25494
25497
  delete state.blocker;
25495
- await checkpoint?.(state);
25498
+ await checkpointTerminalWorkflowState(checkpoint, state);
25496
25499
  return withWorkflowBoundaryEval(capability, { ...output, workflowState: state });
25497
25500
  }
25501
+ async function checkpointTerminalWorkflowState(checkpoint, state) {
25502
+ if (!checkpoint) return;
25503
+ try {
25504
+ await checkpoint(state);
25505
+ } catch (error) {
25506
+ process.stderr.write(`warning: failed to save terminal Workflow state: ${String(error)}
25507
+ `);
25508
+ }
25509
+ }
25498
25510
  function graphWorkflowExecutionKey(parentExecutionKey, workflowSlug, stepId, transitionCounts) {
25499
25511
  const transitionHistory = Object.entries(transitionCounts).filter(([, count]) => count > 0).sort(([left], [right]) => left.localeCompare(right)).map(([transition, count]) => `${transition}=${count}`).join(",");
25500
25512
  return [
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.649",
3
+ "version": "0.4.651",
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": {
@@ -17,6 +17,30 @@
17
17
  "docs/delivery-boundary.md",
18
18
  "kody.config.schema.json"
19
19
  ],
20
+ "scripts": {
21
+ "kody:run": "tsx bin/kody.ts",
22
+ "serve": "tsx bin/kody.ts serve",
23
+ "serve:vscode": "tsx bin/kody.ts serve vscode",
24
+ "serve:claude": "tsx bin/kody.ts serve claude",
25
+ "clean:dist": "node scripts/clean-dist.cjs",
26
+ "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
27
+ "check:modularity": "tsx scripts/check-script-modularity.ts",
28
+ "pretest": "pnpm check:modularity",
29
+ "test": "vitest run tests/unit tests/int --coverage",
30
+ "posttest": "tsx scripts/check-coverage-floor.ts",
31
+ "test:smoke": "vitest run tests/smoke --no-coverage",
32
+ "test:e2e": "vitest run tests/e2e --no-coverage",
33
+ "verify:live-release": "tsx scripts/live-release-gate.ts",
34
+ "test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
35
+ "test:all": "vitest run tests --no-coverage",
36
+ "typecheck": "tsc --noEmit",
37
+ "lint": "biome check",
38
+ "lint:fix": "biome check --write",
39
+ "format": "biome format --write",
40
+ "verify:package": "node scripts/verify-package-tarball.cjs",
41
+ "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain --build-arg KODY_ENGINE_REF=$(git rev-parse HEAD) -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner",
42
+ "prepublishOnly": "pnpm typecheck && pnpm test:runtime-services && pnpm build && pnpm verify:package"
43
+ },
20
44
  "dependencies": {
21
45
  "@actions/cache": "^6.0.0",
22
46
  "@anthropic-ai/claude-agent-sdk": "0.2.119",
@@ -39,28 +63,5 @@
39
63
  "node": ">=22"
40
64
  },
41
65
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
42
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
43
- "scripts": {
44
- "kody:run": "tsx bin/kody.ts",
45
- "serve": "tsx bin/kody.ts serve",
46
- "serve:vscode": "tsx bin/kody.ts serve vscode",
47
- "serve:claude": "tsx bin/kody.ts serve claude",
48
- "clean:dist": "node scripts/clean-dist.cjs",
49
- "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
50
- "check:modularity": "tsx scripts/check-script-modularity.ts",
51
- "pretest": "pnpm check:modularity",
52
- "test": "vitest run tests/unit tests/int --coverage",
53
- "posttest": "tsx scripts/check-coverage-floor.ts",
54
- "test:smoke": "vitest run tests/smoke --no-coverage",
55
- "test:e2e": "vitest run tests/e2e --no-coverage",
56
- "verify:live-release": "tsx scripts/live-release-gate.ts",
57
- "test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
58
- "test:all": "vitest run tests --no-coverage",
59
- "typecheck": "tsc --noEmit",
60
- "lint": "biome check",
61
- "lint:fix": "biome check --write",
62
- "format": "biome format --write",
63
- "verify:package": "node scripts/verify-package-tarball.cjs",
64
- "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain --build-arg KODY_ENGINE_REF=$(git rev-parse HEAD) -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner"
65
- }
66
- }
66
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
67
+ }