@kody-ade/kody-engine 0.4.312 → 0.4.314

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 +150 -83
  2. package/package.json +24 -25
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.312",
18
+ version: "0.4.314",
19
19
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
20
20
  license: "MIT",
21
21
  type: "module",
@@ -501,7 +501,11 @@ function normalizeStatePath(raw, field = "statePath") {
501
501
  function normalizeStateBranch(raw, field = "state.branch") {
502
502
  const value = raw?.trim() || STATE_BRANCH;
503
503
  if (!value) throw new Error(`kody.config.json: ${field} must not be empty`);
504
- if (value.startsWith("/") || value.endsWith("/") || value.includes("\\") || value.includes("..") || value.includes("@{") || /[\x00-\x20\x7f~^:?*\[]/.test(value)) {
504
+ const hasInvalidChar = [...value].some((char) => {
505
+ const code = char.charCodeAt(0);
506
+ return code <= 32 || code === 127 || "~^:?*[".includes(char);
507
+ });
508
+ if (value.startsWith("/") || value.endsWith("/") || value.includes("\\") || value.includes("..") || value.includes("@{") || hasInvalidChar) {
505
509
  throw new Error(`kody.config.json: ${field} contains an invalid branch`);
506
510
  }
507
511
  for (const part of value.split("/")) {
@@ -1557,9 +1561,7 @@ var init_submitMcp = __esm({
1557
1561
  INPUT_SCHEMA2 = {
1558
1562
  cursor: z.string().describe('The next cursor value (e.g. "idle"). Must be a non-empty string.'),
1559
1563
  data: z.record(z.string(), z.unknown()).describe("The next `data` object. Carry forward prior data and mutate only what you acted on this tick."),
1560
- done: z.boolean().describe(
1561
- "true only if this capability is permanently finished; evergreen capabilities stay false."
1562
- )
1564
+ done: z.boolean().describe("true only if this capability is permanently finished; evergreen capabilities stay false.")
1563
1565
  };
1564
1566
  }
1565
1567
  });
@@ -1922,7 +1924,7 @@ function parseCapabilityConfig(raw) {
1922
1924
  stage: stringField(raw.stage),
1923
1925
  readsFrom: stringList(raw.readsFrom ?? raw.reads_from),
1924
1926
  writesTo: stringList(raw.writesTo ?? raw.writes_to),
1925
- workflow: parseWorkflow(raw.workflow)
1927
+ workflow: parseCapabilityWorkflow(raw.workflow)
1926
1928
  };
1927
1929
  }
1928
1930
  function parseCapabilityToolMode(raw) {
@@ -1963,7 +1965,7 @@ function stringList(value) {
1963
1965
  }
1964
1966
  return [];
1965
1967
  }
1966
- function parseWorkflow(value) {
1968
+ function parseCapabilityWorkflow(value) {
1967
1969
  const stepsRaw = Array.isArray(value) ? value : value && typeof value === "object" && Array.isArray(value.steps) ? value.steps : [];
1968
1970
  const steps = stepsRaw.map(parseWorkflowStep).filter((step) => step !== null);
1969
1971
  return steps.length > 0 ? { steps } : void 0;
@@ -7597,9 +7599,9 @@ function listGoalStateIds(config, cwd) {
7597
7599
  var init_stateStore = __esm({
7598
7600
  "src/goal/stateStore.ts"() {
7599
7601
  "use strict";
7602
+ init_companyStore();
7600
7603
  init_stateRepo();
7601
7604
  init_managedTodoState();
7602
- init_companyStore();
7603
7605
  }
7604
7606
  });
7605
7607
 
@@ -9217,7 +9219,13 @@ function writeCompanyIntent(config, cwd, intent, message = `chore(intents): upda
9217
9219
  }
9218
9220
  function appendCompanyIntentDecision(config, cwd, intentId, entry) {
9219
9221
  assertIntentId(intentId);
9220
- appendStateLine(config, cwd, `intents/${intentId}/decisions.jsonl`, JSON.stringify(entry), `chore(intents): log ${intentId} decision`);
9222
+ appendStateLine(
9223
+ config,
9224
+ cwd,
9225
+ `intents/${intentId}/decisions.jsonl`,
9226
+ JSON.stringify(entry),
9227
+ `chore(intents): log ${intentId} decision`
9228
+ );
9221
9229
  }
9222
9230
  function listCompanyPortfolio(config, cwd) {
9223
9231
  const goals = [];
@@ -9267,7 +9275,11 @@ function normalizeReleasePolicy(raw) {
9267
9275
  cadence: oneOf2(raw.cadence, ["manual", "1d", "1w"], "manual"),
9268
9276
  qaDepth: oneOf2(raw.qaDepth, ["light", "standard", "strict"], "standard"),
9269
9277
  blockerLevel: oneOf2(raw.blockerLevel, ["low", "standard", "strict"], "standard"),
9270
- approval: oneOf2(raw.approval, ["none", "before-production", "before-risky-actions"], "before-risky-actions")
9278
+ approval: oneOf2(
9279
+ raw.approval,
9280
+ ["none", "before-production", "before-risky-actions"],
9281
+ "before-risky-actions"
9282
+ )
9271
9283
  };
9272
9284
  }
9273
9285
  function normalizeAutomationPolicy(raw) {
@@ -9303,13 +9315,25 @@ function applyAction(config, cwd, action) {
9303
9315
  if (action.kind === "createManagedGoal") {
9304
9316
  const existing = fetchGoalState(config, action.id, cwd);
9305
9317
  if (existing) return applied(action, false, "goal already exists");
9306
- writeCompanyGoalState(config, cwd, action.id, buildManagedGoalState(action), `chore(goals): create ${action.id} from intent ${action.intentId}`);
9318
+ writeCompanyGoalState(
9319
+ config,
9320
+ cwd,
9321
+ action.id,
9322
+ buildManagedGoalState(action),
9323
+ `chore(goals): create ${action.id} from intent ${action.intentId}`
9324
+ );
9307
9325
  return applied(action, true, action.reason, action.id);
9308
9326
  }
9309
9327
  if (action.kind === "createAgentLoop") {
9310
9328
  const existing = fetchGoalState(config, action.id, cwd);
9311
9329
  if (existing) return applied(action, false, "loop already exists");
9312
- writeCompanyGoalState(config, cwd, action.id, buildAgentLoopState(action), `chore(goals): create loop ${action.id} from intent ${action.intentId}`);
9330
+ writeCompanyGoalState(
9331
+ config,
9332
+ cwd,
9333
+ action.id,
9334
+ buildAgentLoopState(action),
9335
+ `chore(goals): create loop ${action.id} from intent ${action.intentId}`
9336
+ );
9313
9337
  return applied(action, true, action.reason, action.id);
9314
9338
  }
9315
9339
  if (action.kind === "setGoalLifecycle") {
@@ -9327,7 +9351,13 @@ function applyAction(config, cwd, action) {
9327
9351
  lifecycleChangeReason: action.reason
9328
9352
  }
9329
9353
  };
9330
- writeCompanyGoalState(config, cwd, action.id, next, `chore(goals): ${action.state} ${action.id} from intent ${action.intentId}`);
9354
+ writeCompanyGoalState(
9355
+ config,
9356
+ cwd,
9357
+ action.id,
9358
+ next,
9359
+ `chore(goals): ${action.state} ${action.id} from intent ${action.intentId}`
9360
+ );
9331
9361
  return applied(action, true, action.reason, action.id);
9332
9362
  }
9333
9363
  if (action.kind === "updateIntentPortfolio") {
@@ -9388,8 +9418,8 @@ var init_applyAgencyArchitectDecision = __esm({
9388
9418
  "use strict";
9389
9419
  init_agencyArchitectDecision();
9390
9420
  init_companyIntent();
9391
- init_stateStore();
9392
9421
  init_state2();
9422
+ init_stateStore();
9393
9423
  applyAgencyArchitectDecision = async (ctx) => {
9394
9424
  const decision = ctx.data.agencyArchitectDecision;
9395
9425
  if (!decision || !Array.isArray(decision.actions)) return;
@@ -9929,6 +9959,16 @@ function completeSatisfiedManagedGoal(state) {
9929
9959
  if (decision.kind !== "done") return state;
9930
9960
  return writeManagedGoalToState({ ...state, state: "done" }, managed);
9931
9961
  }
9962
+ function shouldResumeManagedGoal(state) {
9963
+ if (state.state !== "active") return false;
9964
+ const managed = managedGoalFromState(state);
9965
+ if (!managed) return false;
9966
+ if (managed.blockers.length > 0) return false;
9967
+ const missing = managed.destination.evidence.find((evidence) => managed.facts[evidence] !== true);
9968
+ if (!missing) return false;
9969
+ const step = managed.route.find((candidate) => candidate.evidence === missing);
9970
+ return Boolean(step && managed.capabilities.includes(step.capability));
9971
+ }
9932
9972
  function snapshotFromState2(goalId, state) {
9933
9973
  const managed = managedGoalFromState(state);
9934
9974
  return managed ? goalRunLogSnapshot(goalId, state.state, managed) : null;
@@ -10076,6 +10116,13 @@ var init_applyCapabilityReports = __esm({
10076
10116
  putGoalState(ctx.config, goalId, nextForOutput, describeMessage(goalId, goalEvidence), ctx.cwd);
10077
10117
  }
10078
10118
  refreshReportOrFail(ctx, goalId, nextForOutput, goalEvidence);
10119
+ if (changed && ctx.output.exitCode === 0 && !ctx.output.nextDispatch && shouldResumeManagedGoal(nextForOutput)) {
10120
+ ctx.output.nextDispatch = {
10121
+ action: "goal-manager",
10122
+ executable: "goal-manager",
10123
+ cliArgs: { goal: goalId }
10124
+ };
10125
+ }
10079
10126
  } finally {
10080
10127
  flushLogs(ctx);
10081
10128
  }
@@ -10497,9 +10544,7 @@ function formatCapabilityReference(data, profileName) {
10497
10544
  const capabilitySchedule = pickToken(data, "capabilitySchedule", "jobSchedule");
10498
10545
  const lines = ["# Capability reference", ""];
10499
10546
  if (capabilitySlug) {
10500
- lines.push(
10501
- `- Capability: \`${capabilitySlug}\`${capabilityTitle ? ` \u2014 *${capabilityTitle}*` : ""}`
10502
- );
10547
+ lines.push(`- Capability: \`${capabilitySlug}\`${capabilityTitle ? ` \u2014 *${capabilityTitle}*` : ""}`);
10503
10548
  }
10504
10549
  if (executableSlug) {
10505
10550
  lines.push(`- Executable: \`${executableSlug}\``);
@@ -10785,7 +10830,11 @@ function parseFallbackFindingsJson(text) {
10785
10830
  try {
10786
10831
  const parsed = JSON.parse(raw);
10787
10832
  if (!parsed || !Array.isArray(parsed.findings)) {
10788
- return { markdown: removeFence(text, match).trim(), data: null, jsonError: "fallback JSON missing 'findings' array" };
10833
+ return {
10834
+ markdown: removeFence(text, match).trim(),
10835
+ data: null,
10836
+ jsonError: "fallback JSON missing 'findings' array"
10837
+ };
10789
10838
  }
10790
10839
  return {
10791
10840
  markdown: removeFence(text, match).trim(),
@@ -11791,9 +11840,7 @@ var init_dispatchCapabilityFileTicks = __esm({
11791
11840
  ctx.data.jobTickResults = [];
11792
11841
  ctx.output.exitCode = 0;
11793
11842
  ctx.output.reason = "capability scheduling is owned by goals and loops";
11794
- process.stdout.write(
11795
- "[jobs] no flat capability fan-out; goals and loops own scheduled capability decisions\n"
11796
- );
11843
+ process.stdout.write("[jobs] no flat capability fan-out; goals and loops own scheduled capability decisions\n");
11797
11844
  };
11798
11845
  }
11799
11846
  });
@@ -14575,7 +14622,9 @@ function parseAgentFactoryBundle(raw) {
14575
14622
  try {
14576
14623
  parsed = JSON.parse(jsonText);
14577
14624
  } catch (err) {
14578
- throw new Error(`openAgentFactoryStatePr: PR_SUMMARY must be valid JSON: ${err instanceof Error ? err.message : String(err)}`);
14625
+ throw new Error(
14626
+ `openAgentFactoryStatePr: PR_SUMMARY must be valid JSON: ${err instanceof Error ? err.message : String(err)}`
14627
+ );
14579
14628
  }
14580
14629
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
14581
14630
  throw new Error("openAgentFactoryStatePr: PR_SUMMARY must be a JSON object");
@@ -14663,7 +14712,9 @@ function ghJson(args, cwd, input) {
14663
14712
  try {
14664
14713
  return JSON.parse(raw);
14665
14714
  } catch (err) {
14666
- throw new Error(`openAgentFactoryStatePr: gh api returned invalid JSON: ${err instanceof Error ? err.message : String(err)}`);
14715
+ throw new Error(
14716
+ `openAgentFactoryStatePr: gh api returned invalid JSON: ${err instanceof Error ? err.message : String(err)}`
14717
+ );
14667
14718
  }
14668
14719
  }
14669
14720
  function renderPullRequestBody(ctx, bundle, files) {
@@ -14716,21 +14767,26 @@ var init_openAgentFactoryStatePr = __esm({
14716
14767
  const stateRepo = parseStateRepo(ctx.config);
14717
14768
  const baseBranch = "main";
14718
14769
  const branch = buildAgentFactoryBranchName(issueNumber, bundle.title);
14719
- const baseRef = ghJson(["api", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/ref/heads/${baseBranch}`], ctx.cwd);
14720
- const baseSha = requireString2(baseRef.object?.sha, `state repo ${stateRepo.owner}/${stateRepo.repo} ${baseBranch} ref sha`);
14770
+ const baseRef = ghJson(
14771
+ ["api", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/ref/heads/${baseBranch}`],
14772
+ ctx.cwd
14773
+ );
14774
+ const baseSha = requireString2(
14775
+ baseRef.object?.sha,
14776
+ `state repo ${stateRepo.owner}/${stateRepo.repo} ${baseBranch} ref sha`
14777
+ );
14721
14778
  const baseCommit = ghJson(
14722
14779
  ["api", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/commits/${baseSha}`],
14723
14780
  ctx.cwd
14724
14781
  );
14725
- const baseTreeSha = requireString2(baseCommit.tree?.sha, `state repo ${stateRepo.owner}/${stateRepo.repo} base tree sha`);
14726
- ghJson(
14727
- ["api", "--method", "POST", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/refs`, "--input", "-"],
14728
- ctx.cwd,
14729
- {
14730
- ref: `refs/heads/${branch}`,
14731
- sha: baseSha
14732
- }
14782
+ const baseTreeSha = requireString2(
14783
+ baseCommit.tree?.sha,
14784
+ `state repo ${stateRepo.owner}/${stateRepo.repo} base tree sha`
14733
14785
  );
14786
+ ghJson(["api", "--method", "POST", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/refs`, "--input", "-"], ctx.cwd, {
14787
+ ref: `refs/heads/${branch}`,
14788
+ sha: baseSha
14789
+ });
14734
14790
  const tree = ghJson(
14735
14791
  ["api", "--method", "POST", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/trees`, "--input", "-"],
14736
14792
  ctx.cwd,
@@ -14756,7 +14812,14 @@ var init_openAgentFactoryStatePr = __esm({
14756
14812
  );
14757
14813
  const commitSha = requireString2(commit.sha, "created commit sha");
14758
14814
  ghJson(
14759
- ["api", "--method", "PATCH", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/refs/heads/${branch}`, "--input", "-"],
14815
+ [
14816
+ "api",
14817
+ "--method",
14818
+ "PATCH",
14819
+ `/repos/${stateRepo.owner}/${stateRepo.repo}/git/refs/heads/${branch}`,
14820
+ "--input",
14821
+ "-"
14822
+ ],
14760
14823
  ctx.cwd,
14761
14824
  {
14762
14825
  sha: commitSha,
@@ -14908,10 +14971,43 @@ QA_REPORT_POSTED=${created.url} (verdict: ${verdict})
14908
14971
  }
14909
14972
  });
14910
14973
 
14911
- // src/scripts/parseAgentResult.ts
14974
+ // src/scripts/parseAgencyArchitectDecision.ts
14912
14975
  function makeAction2(type, payload) {
14913
14976
  return { type, payload, timestamp: (/* @__PURE__ */ new Date()).toISOString() };
14914
14977
  }
14978
+ var parseAgencyArchitectDecision;
14979
+ var init_parseAgencyArchitectDecision = __esm({
14980
+ "src/scripts/parseAgencyArchitectDecision.ts"() {
14981
+ "use strict";
14982
+ init_agencyArchitectDecision();
14983
+ parseAgencyArchitectDecision = async (ctx, _profile, agentResult) => {
14984
+ if (!agentResult) {
14985
+ ctx.data.agencyArchitectDecision = { summary: "", actions: [] };
14986
+ ctx.data.action = makeAction2("AGENCY_ARCHITECT_NOT_RUN", { reason: "no agent result" });
14987
+ return;
14988
+ }
14989
+ try {
14990
+ const decision = parseAgencyArchitectDecisionText(agentResult.finalText);
14991
+ ctx.data.agencyArchitectDecision = decision;
14992
+ ctx.data.action = makeAction2("AGENCY_ARCHITECT_DECIDED", {
14993
+ summary: decision.summary,
14994
+ actionCount: decision.actions.length
14995
+ });
14996
+ } catch (err) {
14997
+ const reason = err instanceof Error ? err.message : String(err);
14998
+ ctx.data.agencyArchitectDecisionError = reason;
14999
+ ctx.data.action = makeAction2("AGENCY_ARCHITECT_FAILED", { reason });
15000
+ ctx.output.exitCode = 1;
15001
+ ctx.output.reason = reason;
15002
+ }
15003
+ };
15004
+ }
15005
+ });
15006
+
15007
+ // src/scripts/parseAgentResult.ts
15008
+ function makeAction3(type, payload) {
15009
+ return { type, payload, timestamp: (/* @__PURE__ */ new Date()).toISOString() };
15010
+ }
14915
15011
  var parseAgentResult2;
14916
15012
  var init_parseAgentResult = __esm({
14917
15013
  "src/scripts/parseAgentResult.ts"() {
@@ -14920,7 +15016,7 @@ var init_parseAgentResult = __esm({
14920
15016
  parseAgentResult2 = async (ctx, profile, agentResult) => {
14921
15017
  if (!agentResult) {
14922
15018
  ctx.data.agentDone = false;
14923
- ctx.data.action = makeAction2("AGENT_NOT_RUN", { reason: "no agent result" });
15019
+ ctx.data.action = makeAction3("AGENT_NOT_RUN", { reason: "no agent result" });
14924
15020
  return;
14925
15021
  }
14926
15022
  const parsed = parseAgentResult(agentResult.finalText);
@@ -14937,46 +15033,13 @@ var init_parseAgentResult = __esm({
14937
15033
  ctx.data.agentError = agentResult.error;
14938
15034
  const modeSeg = (ctx.args.mode ?? profile.name).replace(/-/g, "_").toUpperCase();
14939
15035
  if (parsed.done) {
14940
- ctx.data.action = makeAction2(`${modeSeg}_COMPLETED`, {
15036
+ ctx.data.action = makeAction3(`${modeSeg}_COMPLETED`, {
14941
15037
  commitMessage: parsed.commitMessage
14942
15038
  });
14943
15039
  } else {
14944
15040
  const isGenericNoOutput = parsed.failureReason === "agent produced no final message";
14945
15041
  const reason = isGenericNoOutput && agentResult.error ? `agent SDK error: ${agentResult.error}` : parsed.failureReason || agentResult.error || "unknown failure";
14946
- ctx.data.action = makeAction2(`${modeSeg}_FAILED`, { reason });
14947
- }
14948
- };
14949
- }
14950
- });
14951
-
14952
- // src/scripts/parseAgencyArchitectDecision.ts
14953
- function makeAction3(type, payload) {
14954
- return { type, payload, timestamp: (/* @__PURE__ */ new Date()).toISOString() };
14955
- }
14956
- var parseAgencyArchitectDecision;
14957
- var init_parseAgencyArchitectDecision = __esm({
14958
- "src/scripts/parseAgencyArchitectDecision.ts"() {
14959
- "use strict";
14960
- init_agencyArchitectDecision();
14961
- parseAgencyArchitectDecision = async (ctx, _profile, agentResult) => {
14962
- if (!agentResult) {
14963
- ctx.data.agencyArchitectDecision = { summary: "", actions: [] };
14964
- ctx.data.action = makeAction3("AGENCY_ARCHITECT_NOT_RUN", { reason: "no agent result" });
14965
- return;
14966
- }
14967
- try {
14968
- const decision = parseAgencyArchitectDecisionText(agentResult.finalText);
14969
- ctx.data.agencyArchitectDecision = decision;
14970
- ctx.data.action = makeAction3("AGENCY_ARCHITECT_DECIDED", {
14971
- summary: decision.summary,
14972
- actionCount: decision.actions.length
14973
- });
14974
- } catch (err) {
14975
- const reason = err instanceof Error ? err.message : String(err);
14976
- ctx.data.agencyArchitectDecisionError = reason;
14977
- ctx.data.action = makeAction3("AGENCY_ARCHITECT_FAILED", { reason });
14978
- ctx.output.exitCode = 1;
14979
- ctx.output.reason = reason;
15042
+ ctx.data.action = makeAction3(`${modeSeg}_FAILED`, { reason });
14980
15043
  }
14981
15044
  };
14982
15045
  }
@@ -18163,8 +18226,8 @@ var init_scripts = __esm({
18163
18226
  init_advanceManagedGoal();
18164
18227
  init_appendCompanyActivity();
18165
18228
  init_appendCompanyIntentDecision();
18166
- init_applyCapabilityReports();
18167
18229
  init_applyAgencyArchitectDecision();
18230
+ init_applyCapabilityReports();
18168
18231
  init_buildSyntheticPlugin();
18169
18232
  init_checkCoverageWithRetry();
18170
18233
  init_classifyByLabel();
@@ -18211,8 +18274,8 @@ var init_scripts = __esm({
18211
18274
  init_notifyTerminal();
18212
18275
  init_openAgentFactoryStatePr();
18213
18276
  init_openQaIssue();
18214
- init_parseAgentResult();
18215
18277
  init_parseAgencyArchitectDecision();
18278
+ init_parseAgentResult();
18216
18279
  init_parseIssueStateFromAgentResult();
18217
18280
  init_parseJobStateFromAgentResult();
18218
18281
  init_parseReproOutput();
@@ -18643,7 +18706,7 @@ async function runExecutable(profileName, input) {
18643
18706
  });
18644
18707
  if (out.prUrl) process.stdout.write(`PR_URL=${out.prUrl}
18645
18708
  `);
18646
- else if (out.reason) process.stdout.write(`PR_URL=FAILED: ${out.reason}
18709
+ else if (out.exitCode !== 0 && out.reason) process.stdout.write(`PR_URL=FAILED: ${out.reason}
18647
18710
  `);
18648
18711
  return out;
18649
18712
  };
@@ -19418,12 +19481,15 @@ function normalizeWorkflowDefinition(value) {
19418
19481
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
19419
19482
  const raw = value;
19420
19483
  const name = typeof raw.name === "string" ? raw.name.trim() : "";
19421
- const capabilities = normalizeWorkflowCapabilities(raw.capabilities);
19484
+ const workflow = parseCapabilityWorkflow({ steps: raw.steps });
19485
+ const steps = workflow?.steps;
19486
+ const capabilities = steps ? steps.map((step) => step.capability) : normalizeWorkflowCapabilities(raw.capabilities);
19422
19487
  if (!name || capabilities.length === 0) return null;
19423
19488
  return {
19424
19489
  version: 1,
19425
19490
  name,
19426
19491
  capabilities,
19492
+ ...steps ? { steps } : {},
19427
19493
  ...typeof raw.createdAt === "string" ? { createdAt: raw.createdAt } : {},
19428
19494
  ...typeof raw.updatedAt === "string" ? { updatedAt: raw.updatedAt } : {}
19429
19495
  };
@@ -19465,7 +19531,7 @@ function normalizeWorkflowCapabilities(value) {
19465
19531
  }
19466
19532
  function workflowDefinitionToConfig(workflow) {
19467
19533
  return {
19468
- steps: workflow.capabilities.map((capability) => ({ capability }))
19534
+ steps: workflow.steps ?? workflow.capabilities.map((capability) => ({ capability }))
19469
19535
  };
19470
19536
  }
19471
19537
  function readCompanyStoreWorkflowDefinition(id) {
@@ -19486,6 +19552,7 @@ var WORKFLOW_ID_PATTERN, CAPABILITY_ID_PATTERN;
19486
19552
  var init_workflowDefinitions = __esm({
19487
19553
  "src/workflowDefinitions.ts"() {
19488
19554
  "use strict";
19555
+ init_capabilityFolders();
19489
19556
  init_companyStore();
19490
19557
  init_stateRepo();
19491
19558
  WORKFLOW_ID_PATTERN = /^[a-z0-9][a-z0-9_-]{0,79}$/;
@@ -19691,7 +19758,7 @@ async function runCapabilityWorkflow(parent, workflow, capability, base) {
19691
19758
  }
19692
19759
  });
19693
19760
  const outcome = workflowOutcome(result);
19694
- const prUrl = result.taskState?.core.prUrl ?? (typeof chainData.workflowPrUrl === "string" ? chainData.workflowPrUrl : void 0);
19761
+ const prUrl = result.prUrl ?? result.taskState?.core.prUrl ?? (typeof chainData.workflowPrUrl === "string" ? chainData.workflowPrUrl : void 0);
19695
19762
  chainData = {
19696
19763
  ...chainData,
19697
19764
  ...result.taskState ? { taskState: result.taskState } : {},
@@ -20723,6 +20790,7 @@ async function mintAppInstallationToken(creds) {
20723
20790
  }
20724
20791
 
20725
20792
  // src/kody-cli.ts
20793
+ init_companyStore();
20726
20794
  init_config();
20727
20795
 
20728
20796
  // src/dispatch.ts
@@ -21153,7 +21221,6 @@ init_gha();
21153
21221
  init_issue();
21154
21222
  init_job();
21155
21223
  init_lifecycleLabels();
21156
- init_companyStore();
21157
21224
  init_registry();
21158
21225
 
21159
21226
  // src/run-request.ts
@@ -23301,10 +23368,10 @@ async function emit2(sink, type, sessionId, suffix, payload) {
23301
23368
  }
23302
23369
 
23303
23370
  // src/chat-cli.ts
23371
+ init_companyStore();
23304
23372
  init_config();
23305
23373
  init_litellm();
23306
23374
  init_stateWorkspace();
23307
- init_companyStore();
23308
23375
  var DEFAULT_MODEL2 = "claude/claude-haiku-4-5-20251001";
23309
23376
  var CHAT_HELP = `kody chat \u2014 dashboard-driven chat session
23310
23377
 
@@ -23565,6 +23632,9 @@ async function runCapabilityFallbackTick(deps) {
23565
23632
  // src/servers/pool-serve.ts
23566
23633
  init_keys();
23567
23634
 
23635
+ // src/pool/registry.ts
23636
+ init_stateRepoVault();
23637
+
23568
23638
  // src/pool/fly.ts
23569
23639
  var FLY_API_BASE = "https://api.machines.dev/v1";
23570
23640
  var POOL_METADATA_KEY = "kody_pool";
@@ -23929,7 +23999,6 @@ function isSuspendedWithIp(m) {
23929
23999
  }
23930
24000
 
23931
24001
  // src/pool/registry.ts
23932
- init_stateRepoVault();
23933
24002
  var POOL_MIN_VAULT_KEY = "POOL_MIN";
23934
24003
  var POOL_MIN_MAX = 10;
23935
24004
  function parsePoolMin(raw, dflt) {
@@ -24238,9 +24307,7 @@ async function poolServe() {
24238
24307
  activeRepos: () => registry.activeRepos(),
24239
24308
  claim: (owner, repo, req) => registry.claim(owner, repo, req),
24240
24309
  log
24241
- }).catch(
24242
- (err) => log(`capability fallback tick failed: ${err instanceof Error ? err.message : String(err)}`)
24243
- );
24310
+ }).catch((err) => log(`capability fallback tick failed: ${err instanceof Error ? err.message : String(err)}`));
24244
24311
  }, capabilityTickMs) : null;
24245
24312
  const server = createServer5(async (req, res) => {
24246
24313
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.312",
3
+ "version": "0.4.314",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,28 +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:all": "vitest run tests --no-coverage",
29
- "typecheck": "tsc --noEmit",
30
- "lint": "biome check",
31
- "lint:fix": "biome check --write",
32
- "format": "biome format --write",
33
- "verify:package": "node scripts/verify-package-tarball.cjs",
34
- "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner",
35
- "prepublishOnly": "pnpm typecheck && vitest run tests/unit tests/int --no-coverage && pnpm build && pnpm verify:package"
36
- },
37
15
  "dependencies": {
38
16
  "@actions/cache": "^6.0.0",
39
17
  "@anthropic-ai/claude-agent-sdk": "0.2.119",
@@ -57,5 +35,26 @@
57
35
  "url": "git+https://github.com/aharonyaircohen/kody-engine.git"
58
36
  },
59
37
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
60
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
61
- }
38
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
39
+ "scripts": {
40
+ "kody:run": "tsx bin/kody.ts",
41
+ "serve": "tsx bin/kody.ts serve",
42
+ "serve:vscode": "tsx bin/kody.ts serve vscode",
43
+ "serve:claude": "tsx bin/kody.ts serve claude",
44
+ "clean:dist": "node scripts/clean-dist.cjs",
45
+ "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
46
+ "check:modularity": "tsx scripts/check-script-modularity.ts",
47
+ "pretest": "pnpm check:modularity",
48
+ "test": "vitest run tests/unit tests/int --coverage",
49
+ "posttest": "tsx scripts/check-coverage-floor.ts",
50
+ "test:smoke": "vitest run tests/smoke --no-coverage",
51
+ "test:e2e": "vitest run tests/e2e --no-coverage",
52
+ "test:all": "vitest run tests --no-coverage",
53
+ "typecheck": "tsc --noEmit",
54
+ "lint": "biome check",
55
+ "lint:fix": "biome check --write",
56
+ "format": "biome format --write",
57
+ "verify:package": "node scripts/verify-package-tarball.cjs",
58
+ "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner"
59
+ }
60
+ }