@kody-ade/kody-engine 0.4.213-live.0 → 0.4.213-live.1

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.213-live.0",
18
+ version: "0.4.213-live.1",
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",
@@ -4776,6 +4776,7 @@ var init_saveTaskState = __esm({
4776
4776
  if (ctx.output.prUrl) next.core.prUrl = ctx.output.prUrl;
4777
4777
  if (typeof ctx.data.runUrl === "string") next.core.runUrl = ctx.data.runUrl;
4778
4778
  writeTaskState(target, number, next, ctx.cwd);
4779
+ ctx.data.taskState = next;
4779
4780
  ctx.data.taskStateRendered = renderStateComment(next);
4780
4781
  };
4781
4782
  }
@@ -7072,9 +7073,9 @@ __export(job_exports, {
7072
7073
  validateJob: () => validateJob
7073
7074
  });
7074
7075
  function newJobId(flavor) {
7075
- const runId = process.env.GITHUB_RUN_ID;
7076
- if (runId) return `gh-${runId}-${process.env.GITHUB_RUN_ATTEMPT ?? "1"}`;
7077
7076
  localJobSeq += 1;
7077
+ const runId = process.env.GITHUB_RUN_ID;
7078
+ if (runId) return `gh-${runId}-${process.env.GITHUB_RUN_ATTEMPT ?? "1"}-${localJobSeq}`;
7078
7079
  return `${flavor}-${Date.now()}-${localJobSeq}`;
7079
7080
  }
7080
7081
  function validateJob(input) {
@@ -7109,7 +7110,7 @@ async function runJob(job, base) {
7109
7110
  if (!profileName) {
7110
7111
  throw new InvalidJobError("job resolves to no executable or duty");
7111
7112
  }
7112
- const preloadedData = {};
7113
+ const preloadedData = { ...base.preloadedData ?? {} };
7113
7114
  preloadedData.jobId = newJobId(valid.flavor);
7114
7115
  preloadedData.jobKey = stableJobKey(valid);
7115
7116
  preloadedData.jobFlavor = valid.flavor;
@@ -8025,7 +8026,7 @@ var init_dispatchNextTaskJob = __esm({
8025
8026
  "use strict";
8026
8027
  init_jobIdentity();
8027
8028
  init_state();
8028
- dispatchNextTaskJob = async (ctx) => {
8029
+ dispatchNextTaskJob = async (ctx, profile) => {
8029
8030
  const state = ctx.data.taskState ?? emptyState();
8030
8031
  const ids = Array.isArray(ctx.data.plannedTaskJobIds) ? ctx.data.plannedTaskJobIds.filter((id) => typeof id === "string") : void 0;
8031
8032
  const next = nextPendingTaskJob(state, ids);
@@ -8037,6 +8038,9 @@ var init_dispatchNextTaskJob = __esm({
8037
8038
  }
8038
8039
  const plannedJobs = Array.isArray(ctx.data.plannedTaskJobs) ? ctx.data.plannedTaskJobs.filter(isJob) : [];
8039
8040
  ctx.output.nextJob = plannedJobs.find((job) => stableJobKey(job) === next.id) ?? taskJobToJob(next, ctx.args.issue);
8041
+ if (typeof ctx.args.issue === "number") {
8042
+ ctx.output.afterNextJob = { executable: profile.name, cliArgs: { issue: ctx.args.issue } };
8043
+ }
8040
8044
  };
8041
8045
  }
8042
8046
  });
@@ -14088,7 +14092,9 @@ async function runExecutable(profileName, input) {
14088
14092
  prUrl: ctx.output.prUrl,
14089
14093
  reason: ctx.output.reason,
14090
14094
  nextDispatch: ctx.output.nextDispatch,
14091
- nextJob: ctx.output.nextJob
14095
+ nextJob: ctx.output.nextJob,
14096
+ afterNextJob: ctx.output.afterNextJob,
14097
+ taskState: ctx.data.taskState
14092
14098
  });
14093
14099
  } finally {
14094
14100
  clearStampedLifecycleLabels(profile, ctx);
@@ -14113,17 +14119,34 @@ async function runExecutableChain(profileName, input) {
14113
14119
  for (let hops = 1; (result.nextDispatch || result.nextJob) && hops <= MAX_CHAIN_HOPS; hops++) {
14114
14120
  if (result.nextJob) {
14115
14121
  const next2 = result.nextJob;
14122
+ const after = result.afterNextJob;
14116
14123
  const label = next2.executable ?? next2.duty ?? "unknown";
14117
14124
  process.stdout.write(`\u2192 kody: in-process job hand-off \u2192 ${label} (hop ${hops}/${MAX_CHAIN_HOPS})
14118
14125
 
14119
14126
  `);
14120
14127
  const { runJob: runJob2 } = await Promise.resolve().then(() => (init_job(), job_exports));
14121
- result = await runJob2(next2, {
14128
+ const childResult = await runJob2(next2, {
14122
14129
  cwd: input.cwd,
14123
14130
  config: input.config,
14124
14131
  verbose: input.verbose,
14125
- quiet: input.quiet
14132
+ quiet: input.quiet,
14133
+ preloadedData: input.preloadedData
14126
14134
  });
14135
+ if (after && childResult.exitCode === 0 && !childResult.nextDispatch && !childResult.nextJob && !childResult.afterNextJob) {
14136
+ process.stdout.write(`\u2192 kody: in-process return \u2192 ${after.executable} (hop ${hops}/${MAX_CHAIN_HOPS})
14137
+
14138
+ `);
14139
+ result = await runExecutable(after.executable, {
14140
+ ...input,
14141
+ cliArgs: after.cliArgs,
14142
+ preloadedData: {
14143
+ ...input.preloadedData ?? {},
14144
+ ...childResult.taskState ? { taskState: childResult.taskState } : {}
14145
+ }
14146
+ });
14147
+ } else {
14148
+ result = childResult;
14149
+ }
14127
14150
  continue;
14128
14151
  }
14129
14152
  const next = result.nextDispatch;
@@ -413,6 +413,8 @@ export interface Context {
413
413
  nextDispatch?: { executable: string; cliArgs: Record<string, unknown> }
414
414
  /** In-process hand-off to a full Job, preserving job identity in task state. */
415
415
  nextJob?: Job
416
+ /** Where to return after nextJob succeeds. Used by task-jobs to keep draining pending work. */
417
+ afterNextJob?: { executable: string; cliArgs: Record<string, unknown> }
416
418
  }
417
419
  /**
418
420
  * If a preflight script sets this to true, the executor skips the agent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.213-live.0",
3
+ "version": "0.4.213-live.1",
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",