@kody-ade/kody-engine 0.4.229 → 0.4.231

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 +39 -15
  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.229",
18
+ version: "0.4.231",
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",
@@ -9948,11 +9948,35 @@ var init_loadDutyState = __esm({
9948
9948
  });
9949
9949
 
9950
9950
  // src/scripts/loadGoalState.ts
9951
- var loadGoalState;
9951
+ function retryDelaysMs() {
9952
+ const raw = process.env.KODY_GOAL_STATE_RETRY_DELAYS_MS?.trim();
9953
+ if (!raw) return DEFAULT_RETRY_DELAYS_MS;
9954
+ return raw.split(",").map((part) => Number(part.trim())).filter((value) => Number.isFinite(value) && value >= 0);
9955
+ }
9956
+ function sleep(ms) {
9957
+ if (ms <= 0) return Promise.resolve();
9958
+ return new Promise((resolve7) => setTimeout(resolve7, ms));
9959
+ }
9960
+ async function fetchGoalStateWithRetry(owner, repo, goalId, cwd) {
9961
+ let state = fetchGoalState(owner, repo, goalId, cwd);
9962
+ if (state) return state;
9963
+ for (const delay of retryDelaysMs()) {
9964
+ await sleep(delay);
9965
+ state = fetchGoalState(owner, repo, goalId, cwd);
9966
+ if (state) {
9967
+ process.stdout.write(`[goal-manager] loaded goal state for ${goalId} after retry
9968
+ `);
9969
+ return state;
9970
+ }
9971
+ }
9972
+ return null;
9973
+ }
9974
+ var DEFAULT_RETRY_DELAYS_MS, loadGoalState;
9952
9975
  var init_loadGoalState = __esm({
9953
9976
  "src/scripts/loadGoalState.ts"() {
9954
9977
  "use strict";
9955
9978
  init_stateStore();
9979
+ DEFAULT_RETRY_DELAYS_MS = [250, 750, 1500, 2500];
9956
9980
  loadGoalState = async (ctx) => {
9957
9981
  const goalId = ctx.args.goal;
9958
9982
  if (typeof goalId !== "string" || goalId.length === 0) {
@@ -9976,7 +10000,7 @@ var init_loadGoalState = __esm({
9976
10000
  return;
9977
10001
  }
9978
10002
  try {
9979
- const state = fetchGoalState(owner, repo, goalId, ctx.cwd);
10003
+ const state = await fetchGoalStateWithRetry(owner, repo, goalId, ctx.cwd);
9980
10004
  if (!state) {
9981
10005
  process.stdout.write(`[goal-manager] no goal state for ${goalId} on ${owner}/${repo}; nothing to tick
9982
10006
  `);
@@ -12895,7 +12919,7 @@ var runScheduledExecutableTick;
12895
12919
  var init_runScheduledExecutableTick = __esm({
12896
12920
  "src/scripts/runScheduledExecutableTick.ts"() {
12897
12921
  "use strict";
12898
- init_dutyFolders();
12922
+ init_registry();
12899
12923
  init_jobState();
12900
12924
  init_tickShellRunner();
12901
12925
  runScheduledExecutableTick = async (ctx, profile, args) => {
@@ -12910,10 +12934,10 @@ var init_runScheduledExecutableTick = __esm({
12910
12934
  ctx.output.reason = `runScheduledExecutableTick: ctx.args.${slugArg} must be non-empty duty slug`;
12911
12935
  return;
12912
12936
  }
12913
- const duty = readDutyFolder(path37.join(ctx.cwd, jobsDir), slug);
12937
+ const duty = resolveDutyFolder(slug, path37.join(ctx.cwd, jobsDir));
12914
12938
  if (!duty) {
12915
12939
  ctx.output.exitCode = 99;
12916
- ctx.output.reason = `runScheduledExecutableTick: duty folder not found or incomplete: ${path37.join(jobsDir, slug)}`;
12940
+ ctx.output.reason = `runScheduledExecutableTick: duty folder not found or incomplete: ${slug} (searched ${jobsDir} and company store)`;
12917
12941
  return;
12918
12942
  }
12919
12943
  const shellPath = path37.join(profile.dir, shell);
@@ -13559,7 +13583,7 @@ function tryPostPr7(prNumber, body, cwd) {
13559
13583
  } catch {
13560
13584
  }
13561
13585
  }
13562
- function sleep(ms) {
13586
+ function sleep2(ms) {
13563
13587
  return new Promise((res) => setTimeout(res, ms));
13564
13588
  }
13565
13589
  var API_TIMEOUT_MS8, waitForCi;
@@ -13581,17 +13605,17 @@ var init_waitForCi = __esm({
13581
13605
  return;
13582
13606
  }
13583
13607
  const fixCiAttempts = state?.core.attempts?.["fix-ci"] ?? 0;
13584
- await sleep(initialWaitSeconds * 1e3);
13608
+ await sleep2(initialWaitSeconds * 1e3);
13585
13609
  const deadline = Date.now() + timeoutMinutes * 6e4;
13586
13610
  let lastSummary = "";
13587
13611
  while (Date.now() < deadline) {
13588
13612
  const rows = fetchChecks(prNumber, ctx.cwd);
13589
13613
  if (rows === null) {
13590
- await sleep(pollSeconds * 1e3);
13614
+ await sleep2(pollSeconds * 1e3);
13591
13615
  continue;
13592
13616
  }
13593
13617
  if (rows.length === 0) {
13594
- await sleep(pollSeconds * 1e3);
13618
+ await sleep2(pollSeconds * 1e3);
13595
13619
  continue;
13596
13620
  }
13597
13621
  const summary = summarize(rows);
@@ -13634,7 +13658,7 @@ var init_waitForCi = __esm({
13634
13658
  tryPostPr7(prNumber, `\u2705 kody waitForCi: all ${rows.length} checks green on PR #${prNumber}`, ctx.cwd);
13635
13659
  return;
13636
13660
  }
13637
- await sleep(pollSeconds * 1e3);
13661
+ await sleep2(pollSeconds * 1e3);
13638
13662
  }
13639
13663
  ctx.data.action = mkAction("CI_TIMEOUT", {
13640
13664
  reason: `CI did not complete within ${timeoutMinutes} minutes`,
@@ -17837,10 +17861,10 @@ async function waitForNextUserMessage(opts) {
17837
17861
  const remainingIdle = opts.idleTimeoutMs - (Date.now() - idleStart);
17838
17862
  const sleepMs2 = Math.max(0, Math.min(pollMs, remainingDeadline, remainingIdle));
17839
17863
  if (sleepMs2 === 0) continue;
17840
- await sleep2(sleepMs2);
17864
+ await sleep3(sleepMs2);
17841
17865
  }
17842
17866
  }
17843
- function sleep2(ms) {
17867
+ function sleep3(ms) {
17844
17868
  return new Promise((resolve7) => setTimeout(resolve7, ms));
17845
17869
  }
17846
17870
  function currentBranch(cwd) {
@@ -18455,7 +18479,7 @@ var FlyClient = class {
18455
18479
  if (res.ok) return true;
18456
18480
  } catch {
18457
18481
  }
18458
- await sleep3(intervalMs);
18482
+ await sleep4(intervalMs);
18459
18483
  }
18460
18484
  return false;
18461
18485
  }
@@ -18463,7 +18487,7 @@ var FlyClient = class {
18463
18487
  function enc(s) {
18464
18488
  return encodeURIComponent(s);
18465
18489
  }
18466
- function sleep3(ms) {
18490
+ function sleep4(ms) {
18467
18491
  return new Promise((r) => setTimeout(r, ms));
18468
18492
  }
18469
18493
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.229",
3
+ "version": "0.4.231",
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",