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

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.1",
18
+ version: "0.4.213",
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",
@@ -3149,7 +3149,7 @@ function nextPendingTaskJob(state, ids) {
3149
3149
  const keys = ids && ids.length > 0 ? ids : Object.keys(jobs);
3150
3150
  for (const key of keys) {
3151
3151
  const job = jobs[key];
3152
- if (job?.status === "pending") return job;
3152
+ if (job && job.status !== "succeeded") return job;
3153
3153
  }
3154
3154
  return null;
3155
3155
  }
@@ -8349,6 +8349,35 @@ var init_ensurePr = __esm({
8349
8349
  }
8350
8350
  });
8351
8351
 
8352
+ // src/scripts/failOnceTaskJob.ts
8353
+ var failOnceTaskJob;
8354
+ var init_failOnceTaskJob = __esm({
8355
+ "src/scripts/failOnceTaskJob.ts"() {
8356
+ "use strict";
8357
+ init_jobIdentity();
8358
+ failOnceTaskJob = async (ctx, profile) => {
8359
+ ctx.skipAgent = true;
8360
+ const issue = typeof ctx.args.issue === "number" ? ctx.args.issue : void 0;
8361
+ const fallbackJob = {
8362
+ executable: profile.name,
8363
+ flavor: "instant",
8364
+ ...typeof issue === "number" ? { target: issue, cliArgs: { issue } } : { cliArgs: {} }
8365
+ };
8366
+ const jobKey = typeof ctx.data.jobKey === "string" ? ctx.data.jobKey : stableJobKey(fallbackJob);
8367
+ const state = ctx.data.taskState;
8368
+ const runs = state?.jobs?.[jobKey]?.runs ?? [];
8369
+ const hasFailedBefore = runs.some((run) => run.status === "failed");
8370
+ if (!hasFailedBefore) {
8371
+ ctx.output.exitCode = 1;
8372
+ ctx.output.reason = "intentional first-attempt failure for task job live test";
8373
+ return;
8374
+ }
8375
+ ctx.output.exitCode = 0;
8376
+ ctx.output.reason = "task job live test succeeded after prior failure";
8377
+ };
8378
+ }
8379
+ });
8380
+
8352
8381
  // src/scripts/finalizeGoal.ts
8353
8382
  function prIssueNumbers(pr) {
8354
8383
  const nums = new Set(extractClosesIssues(pr.body));
@@ -13416,6 +13445,7 @@ var init_scripts = __esm({
13416
13445
  init_dispatchNextTask();
13417
13446
  init_dispatchNextTaskJob();
13418
13447
  init_ensurePr();
13448
+ init_failOnceTaskJob();
13419
13449
  init_finalizeGoal();
13420
13450
  init_finalizeTerminal();
13421
13451
  init_finishFlow();
@@ -13573,6 +13603,7 @@ var init_scripts = __esm({
13573
13603
  notifyTerminal,
13574
13604
  openQaIssue,
13575
13605
  createQaGoal,
13606
+ failOnceTaskJob,
13576
13607
  recordOutcome,
13577
13608
  mergeReleasePr,
13578
13609
  waitForCi,
@@ -14116,6 +14147,10 @@ async function runExecutable(profileName, input) {
14116
14147
  }
14117
14148
  async function runExecutableChain(profileName, input) {
14118
14149
  let result = await runExecutable(profileName, input);
14150
+ let chainData = {
14151
+ ...input.preloadedData ?? {},
14152
+ ...result.taskState ? { taskState: result.taskState } : {}
14153
+ };
14119
14154
  for (let hops = 1; (result.nextDispatch || result.nextJob) && hops <= MAX_CHAIN_HOPS; hops++) {
14120
14155
  if (result.nextJob) {
14121
14156
  const next2 = result.nextJob;
@@ -14130,22 +14165,31 @@ async function runExecutableChain(profileName, input) {
14130
14165
  config: input.config,
14131
14166
  verbose: input.verbose,
14132
14167
  quiet: input.quiet,
14133
- preloadedData: input.preloadedData
14168
+ preloadedData: chainData
14134
14169
  });
14135
14170
  if (after && childResult.exitCode === 0 && !childResult.nextDispatch && !childResult.nextJob && !childResult.afterNextJob) {
14171
+ chainData = {
14172
+ ...chainData,
14173
+ ...childResult.taskState ? { taskState: childResult.taskState } : {}
14174
+ };
14136
14175
  process.stdout.write(`\u2192 kody: in-process return \u2192 ${after.executable} (hop ${hops}/${MAX_CHAIN_HOPS})
14137
14176
 
14138
14177
  `);
14139
14178
  result = await runExecutable(after.executable, {
14140
14179
  ...input,
14141
14180
  cliArgs: after.cliArgs,
14142
- preloadedData: {
14143
- ...input.preloadedData ?? {},
14144
- ...childResult.taskState ? { taskState: childResult.taskState } : {}
14145
- }
14181
+ preloadedData: chainData
14146
14182
  });
14183
+ chainData = {
14184
+ ...chainData,
14185
+ ...result.taskState ? { taskState: result.taskState } : {}
14186
+ };
14147
14187
  } else {
14148
14188
  result = childResult;
14189
+ chainData = {
14190
+ ...chainData,
14191
+ ...result.taskState ? { taskState: result.taskState } : {}
14192
+ };
14149
14193
  }
14150
14194
  continue;
14151
14195
  }
@@ -14153,7 +14197,11 @@ async function runExecutableChain(profileName, input) {
14153
14197
  process.stdout.write(`\u2192 kody: in-process hand-off \u2192 ${next.executable} (hop ${hops}/${MAX_CHAIN_HOPS})
14154
14198
 
14155
14199
  `);
14156
- result = await runExecutable(next.executable, { ...input, cliArgs: next.cliArgs });
14200
+ result = await runExecutable(next.executable, { ...input, cliArgs: next.cliArgs, preloadedData: chainData });
14201
+ chainData = {
14202
+ ...chainData,
14203
+ ...result.taskState ? { taskState: result.taskState } : {}
14204
+ };
14157
14205
  }
14158
14206
  if (result.nextDispatch || result.nextJob) {
14159
14207
  const pending = result.nextDispatch?.executable ?? result.nextJob?.executable ?? result.nextJob?.duty ?? "unknown";
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "task-job-fail-once",
3
+ "role": "utility",
4
+ "describe": "Live-test executable that fails the first planned job attempt and succeeds on rerun.",
5
+ "kind": "oneshot",
6
+ "inputs": [
7
+ {
8
+ "name": "issue",
9
+ "flag": "--issue",
10
+ "type": "int",
11
+ "required": true,
12
+ "describe": "GitHub issue number that owns the task state."
13
+ }
14
+ ],
15
+ "claudeCode": {
16
+ "model": "inherit",
17
+ "permissionMode": "default",
18
+ "maxTurns": 0,
19
+ "maxThinkingTokens": null,
20
+ "systemPromptAppend": null,
21
+ "tools": [],
22
+ "hooks": [],
23
+ "skills": [],
24
+ "commands": [],
25
+ "subagents": [],
26
+ "plugins": [],
27
+ "mcpServers": []
28
+ },
29
+ "cliTools": [],
30
+ "inputArtifacts": [],
31
+ "outputArtifacts": [],
32
+ "scripts": {
33
+ "preflight": [
34
+ { "script": "loadIssueContext" },
35
+ { "script": "loadTaskState" },
36
+ { "script": "skipAgent" }
37
+ ],
38
+ "postflight": [
39
+ { "script": "failOnceTaskJob" },
40
+ { "script": "recordOutcome" },
41
+ { "script": "saveTaskState" }
42
+ ]
43
+ }
44
+ }
@@ -0,0 +1 @@
1
+ This executable is script-only.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.213-live.1",
3
+ "version": "0.4.213",
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",