@kody-ade/kody-engine 0.3.51 → 0.3.52

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
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@kody-ade/kody-engine",
6
- version: "0.3.51",
6
+ version: "0.3.52",
7
7
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
8
8
  license: "MIT",
9
9
  type: "module",
@@ -1313,6 +1313,12 @@ function parseScriptList(p, key, raw) {
1313
1313
  if (r.with && typeof r.with === "object") {
1314
1314
  entry.with = r.with;
1315
1315
  }
1316
+ if (typeof r.timeoutSec === "number" && r.timeoutSec > 0) {
1317
+ if (!hasShell) {
1318
+ throw new ProfileError(p, `scripts.${key}[${i}] "timeoutSec" only applies to shell entries`);
1319
+ }
1320
+ entry.timeoutSec = r.timeoutSec;
1321
+ }
1316
1322
  out.push(entry);
1317
1323
  }
1318
1324
  return out;
@@ -6725,7 +6731,17 @@ function finish(out) {
6725
6731
  `);
6726
6732
  return out;
6727
6733
  }
6728
- var SHELL_TIMEOUT_MS = 3e5;
6734
+ var DEFAULT_SHELL_TIMEOUT_MS = 3e5;
6735
+ function resolveShellTimeoutMs(entry) {
6736
+ if (typeof entry.timeoutSec === "number" && entry.timeoutSec > 0) {
6737
+ return Math.floor(entry.timeoutSec * 1e3);
6738
+ }
6739
+ const envSec = Number(process.env.KODY_SHELL_TIMEOUT_SEC);
6740
+ if (Number.isFinite(envSec) && envSec > 0) {
6741
+ return Math.floor(envSec * 1e3);
6742
+ }
6743
+ return DEFAULT_SHELL_TIMEOUT_MS;
6744
+ }
6729
6745
  function runShellEntry(entry, ctx, profile) {
6730
6746
  const shellName = entry.shell;
6731
6747
  const shellPath = path21.join(profile.dir, shellName);
@@ -6744,12 +6760,13 @@ function runShellEntry(entry, ctx, profile) {
6744
6760
  for (const [k, v] of flattenConfig(ctx.config)) {
6745
6761
  env[`KODY_CFG_${k}`] = v;
6746
6762
  }
6763
+ const timeoutMs = resolveShellTimeoutMs(entry);
6747
6764
  const r = spawnSync("bash", [shellPath, ...positional], {
6748
6765
  cwd: ctx.cwd,
6749
6766
  encoding: "utf-8",
6750
6767
  env,
6751
6768
  stdio: ["pipe", "pipe", "pipe"],
6752
- timeout: SHELL_TIMEOUT_MS
6769
+ timeout: timeoutMs
6753
6770
  });
6754
6771
  const stdout = r.stdout ?? "";
6755
6772
  const stderr = r.stderr ?? "";
@@ -6763,6 +6780,18 @@ function runShellEntry(entry, ctx, profile) {
6763
6780
  if (prUrlMatch?.[1]) ctx.output.prUrl = prUrlMatch[1].trim();
6764
6781
  const reasonMatch = stdout.match(/^KODY_REASON=(.+)$/m);
6765
6782
  if (reasonMatch?.[1]) ctx.output.reason = reasonMatch[1].trim();
6783
+ const timedOut = r.status === null && r.signal !== null;
6784
+ if (timedOut) {
6785
+ ctx.skipAgent = true;
6786
+ const seconds = Math.round(timeoutMs / 1e3);
6787
+ if (ctx.output.exitCode === void 0 || ctx.output.exitCode === 0) {
6788
+ ctx.output.exitCode = 124;
6789
+ }
6790
+ if (!ctx.output.reason) {
6791
+ ctx.output.reason = `shell '${shellName}' timed out after ${seconds}s (signal=${r.signal})`;
6792
+ }
6793
+ return;
6794
+ }
6766
6795
  const exit = r.status ?? -1;
6767
6796
  if (exit !== 0) {
6768
6797
  ctx.skipAgent = true;
@@ -185,6 +185,14 @@ export interface ScriptEntry {
185
185
  * dispatcher script can be reused with different `next` targets.
186
186
  */
187
187
  with?: Record<string, string | number | boolean>
188
+ /**
189
+ * Optional shell-script timeout in seconds. Only honored on `shell` entries.
190
+ * Falls back to `KODY_SHELL_TIMEOUT_SEC` env var, then the 300s default.
191
+ * Long-running shells (release publish, large repo verify) should declare
192
+ * a higher value rather than relying on the default and getting SIGKILLed
193
+ * with an opaque "exited -1".
194
+ */
195
+ timeoutSec?: number
188
196
  }
189
197
 
190
198
  export interface OutputContract {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.3.51",
3
+ "version": "0.3.52",
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",