@kody-ade/kody-engine 0.4.536 → 0.4.538

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.536",
18
+ version: "0.4.538",
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",
@@ -2664,10 +2664,15 @@ function createKodyApiBackendClient(env = process.env) {
2664
2664
  }
2665
2665
  async function notifyWorkflowCompleted(notification, env = process.env) {
2666
2666
  const token = await githubOidcToken(env);
2667
+ const { summary: rawSummary, ...completion } = notification;
2668
+ const summary = rawSummary?.trim();
2667
2669
  const response = await fetch(`${resolveKodyApiUrl(env)}/api/kody/engine/workflow-completed`, {
2668
2670
  method: "POST",
2669
2671
  headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
2670
- body: JSON.stringify(notification),
2672
+ body: JSON.stringify({
2673
+ ...completion,
2674
+ ...summary ? { summary: summary.slice(0, WORKFLOW_COMPLETION_SUMMARY_MAX_LENGTH) } : {}
2675
+ }),
2671
2676
  signal: AbortSignal.timeout(3e4)
2672
2677
  });
2673
2678
  if (!response.ok) throw new Error(`Kody workflow completion request failed (${response.status})`);
@@ -2705,12 +2710,13 @@ async function readPreviewContextFromKody(env = process.env) {
2705
2710
  if (!response.ok) throw new Error(`Kody preview context request failed (${response.status})`);
2706
2711
  return await response.json();
2707
2712
  }
2708
- var DEFAULT_KODY_API_URL, OIDC_AUDIENCE, cachedToken;
2713
+ var DEFAULT_KODY_API_URL, OIDC_AUDIENCE, WORKFLOW_COMPLETION_SUMMARY_MAX_LENGTH, cachedToken;
2709
2714
  var init_kody_api_client = __esm({
2710
2715
  "src/kody-api-client.ts"() {
2711
2716
  "use strict";
2712
2717
  DEFAULT_KODY_API_URL = "https://kody-dashboard-aguy.vercel.app";
2713
2718
  OIDC_AUDIENCE = "kody-api";
2719
+ WORKFLOW_COMPLETION_SUMMARY_MAX_LENGTH = 1e3;
2714
2720
  cachedToken = null;
2715
2721
  }
2716
2722
  });
@@ -22642,14 +22648,12 @@ async function runJob(job, base) {
22642
22648
  }
22643
22649
  if (valid.workflowRunId && workflowIdentity && hasGitHubActionsIdentity()) {
22644
22650
  const facts = result.workflowState?.facts ?? {};
22645
- const pr = typeof facts.pr === "number" ? facts.pr : typeof valid.cliArgs.pr === "number" ? valid.cliArgs.pr : void 0;
22646
- const headSha = typeof facts.headSha === "string" ? facts.headSha : typeof valid.cliArgs.headSha === "string" ? valid.cliArgs.headSha : void 0;
22647
22651
  await notifyWorkflowCompleted({
22648
22652
  workflowId: workflowIdentity,
22649
22653
  runId: valid.workflowRunId,
22650
22654
  status: result.workflowState?.status === "blocked" ? "blocked" : result.exitCode === 0 ? "success" : "failed",
22651
22655
  ...result.reason ? { summary: result.reason } : {},
22652
- ...pr !== void 0 || headSha !== void 0 ? { output: { ...pr !== void 0 ? { pr } : {}, ...headSha ? { headSha } : {} } } : {}
22656
+ ...Object.keys(facts).length > 0 ? { output: facts } : {}
22653
22657
  });
22654
22658
  }
22655
22659
  return result;
@@ -22768,9 +22772,10 @@ async function runCapabilityWorkflow(parent, workflow, capability, base, checkpo
22768
22772
  }
22769
22773
  return result;
22770
22774
  }
22771
- return runLinearCapabilityWorkflow(parent, workflow, capability, base);
22775
+ return runLinearCapabilityWorkflow(parent, workflow, capability, base, checkpoint);
22772
22776
  }
22773
- async function runLinearCapabilityWorkflow(parent, workflow, capability, base) {
22777
+ async function runLinearCapabilityWorkflow(parent, workflow, capability, base, checkpoint) {
22778
+ const state = initialWorkflowState(parent, workflow);
22774
22779
  let chainData = {
22775
22780
  ...base.preloadedData ?? {},
22776
22781
  runSubjectType: "workflow",
@@ -22821,6 +22826,10 @@ async function runLinearCapabilityWorkflow(parent, workflow, capability, base) {
22821
22826
  workflowContinueOn: step.continueOn ?? []
22822
22827
  }
22823
22828
  });
22829
+ mergeWorkflowResults(state, result.capabilityResults);
22830
+ if (result.capabilityOutput && typeof result.capabilityOutput === "object" && !Array.isArray(result.capabilityOutput)) {
22831
+ Object.assign(state.facts, result.capabilityOutput);
22832
+ }
22824
22833
  const outcome = workflowOutcome(result);
22825
22834
  const prUrl = result.prUrl ?? result.taskState?.core.prUrl ?? (typeof chainData.workflowPrUrl === "string" ? chainData.workflowPrUrl : void 0);
22826
22835
  chainData = {
@@ -22835,13 +22844,20 @@ async function runLinearCapabilityWorkflow(parent, workflow, capability, base) {
22835
22844
  ...parsePrNumber5(prUrl) ? { workflowPrNumber: parsePrNumber5(prUrl) } : {}
22836
22845
  };
22837
22846
  if (result.exitCode !== 0 && !canContinueWorkflow(step, outcome)) {
22847
+ state.status = result.capabilityResults?.at(-1)?.status === "blocked" ? "blocked" : "failed";
22848
+ state.blocker = result.reason ?? `workflow ${capability.slug} stopped at step ${index + 1}/${workflow.steps.length}: ${label}`;
22849
+ await checkpoint?.(state);
22838
22850
  return withWorkflowBoundaryEval(capability, {
22839
22851
  ...result,
22840
- reason: result.reason ?? `workflow ${capability.slug} stopped at step ${index + 1}/${workflow.steps.length}: ${label}`
22852
+ reason: state.blocker,
22853
+ workflowState: state
22841
22854
  });
22842
22855
  }
22843
22856
  }
22844
- return withWorkflowBoundaryEval(capability, result);
22857
+ state.status = "done";
22858
+ delete state.blocker;
22859
+ await checkpoint?.(state);
22860
+ return withWorkflowBoundaryEval(capability, { ...result, workflowState: state });
22845
22861
  }
22846
22862
  function isGraphWorkflow(workflow) {
22847
22863
  return workflow.startAt !== void 0 || workflow.steps.some((step) => step.id !== void 0 || step.next !== void 0);
@@ -22881,7 +22897,11 @@ function initialWorkflowState(parent, workflow) {
22881
22897
  ...currentStepId ? { currentStepId } : {},
22882
22898
  completedStepIds: [...prior?.completedStepIds ?? []],
22883
22899
  transitionCounts: { ...prior?.transitionCounts ?? {} },
22884
- facts: { ...parent.workflowFacts ?? {}, ...prior?.facts ?? {} },
22900
+ facts: {
22901
+ ...workflowInputContext(parent.cliArgs),
22902
+ ...parent.workflowFacts ?? {},
22903
+ ...prior?.facts ?? {}
22904
+ },
22885
22905
  evidence: { ...prior?.evidence ?? {} },
22886
22906
  artifacts: (prior?.artifacts ?? []).map((artifact) => ({ ...artifact }))
22887
22907
  };
@@ -22968,6 +22988,9 @@ async function runGraphCapabilityWorkflow(parent, workflow, capability, base, ch
22968
22988
  }
22969
22989
  });
22970
22990
  mergeWorkflowResults(state, result.capabilityResults);
22991
+ if (result.capabilityOutput && typeof result.capabilityOutput === "object" && !Array.isArray(result.capabilityOutput)) {
22992
+ Object.assign(state.facts, result.capabilityOutput);
22993
+ }
22971
22994
  const outcome = workflowOutcome(result);
22972
22995
  const prUrl = result.prUrl ?? result.taskState?.core.prUrl ?? (typeof chainData.workflowPrUrl === "string" ? chainData.workflowPrUrl : void 0);
22973
22996
  chainData = {
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.536",
4
- "description": "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
3
+ "version": "0.4.538",
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",
7
7
  "bin": {
@@ -12,29 +12,6 @@
12
12
  "templates",
13
13
  "kody.config.schema.json"
14
14
  ],
15
- "scripts": {
16
- "kody:run": "tsx bin/kody.ts",
17
- "serve": "tsx bin/kody.ts serve",
18
- "serve:vscode": "tsx bin/kody.ts serve vscode",
19
- "serve:claude": "tsx bin/kody.ts serve claude",
20
- "clean:dist": "node scripts/clean-dist.cjs",
21
- "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
22
- "check:modularity": "tsx scripts/check-script-modularity.ts",
23
- "pretest": "pnpm check:modularity",
24
- "test": "vitest run tests/unit tests/int --coverage",
25
- "posttest": "tsx scripts/check-coverage-floor.ts",
26
- "test:smoke": "vitest run tests/smoke --no-coverage",
27
- "test:e2e": "vitest run tests/e2e --no-coverage",
28
- "test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
29
- "test:all": "vitest run tests --no-coverage",
30
- "typecheck": "tsc --noEmit",
31
- "lint": "biome check",
32
- "lint:fix": "biome check --write",
33
- "format": "biome format --write",
34
- "verify:package": "node scripts/verify-package-tarball.cjs",
35
- "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",
36
- "prepublishOnly": "pnpm typecheck && pnpm test:runtime-services && pnpm build && pnpm verify:package"
37
- },
38
15
  "dependencies": {
39
16
  "@actions/cache": "^6.0.0",
40
17
  "@anthropic-ai/claude-agent-sdk": "0.2.119",
@@ -61,5 +38,27 @@
61
38
  "url": "git+https://github.com/aharonyaircohen/kody-engine.git"
62
39
  },
63
40
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
64
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
65
- }
41
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
42
+ "scripts": {
43
+ "kody:run": "tsx bin/kody.ts",
44
+ "serve": "tsx bin/kody.ts serve",
45
+ "serve:vscode": "tsx bin/kody.ts serve vscode",
46
+ "serve:claude": "tsx bin/kody.ts serve claude",
47
+ "clean:dist": "node scripts/clean-dist.cjs",
48
+ "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
49
+ "check:modularity": "tsx scripts/check-script-modularity.ts",
50
+ "pretest": "pnpm check:modularity",
51
+ "test": "vitest run tests/unit tests/int --coverage",
52
+ "posttest": "tsx scripts/check-coverage-floor.ts",
53
+ "test:smoke": "vitest run tests/smoke --no-coverage",
54
+ "test:e2e": "vitest run tests/e2e --no-coverage",
55
+ "test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
56
+ "test:all": "vitest run tests --no-coverage",
57
+ "typecheck": "tsc --noEmit",
58
+ "lint": "biome check",
59
+ "lint:fix": "biome check --write",
60
+ "format": "biome format --write",
61
+ "verify:package": "node scripts/verify-package-tarball.cjs",
62
+ "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"
63
+ }
64
+ }