@kody-ade/kody-engine 0.4.326 → 0.4.327

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 +41 -10
  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.326",
18
+ version: "0.4.327",
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",
@@ -6421,6 +6421,23 @@ function upsertRunIndexRowBestEffort(config, cwd, row) {
6421
6421
  `);
6422
6422
  }
6423
6423
  }
6424
+ function stageRunIndexFinalization(data, row) {
6425
+ if (!row) return;
6426
+ const rows = stagedRunIndexRows(data);
6427
+ rows[row.id] = row;
6428
+ }
6429
+ function finalizeStagedRunIndexRows(config, cwd, data, result) {
6430
+ const rows = stagedRunIndexRows(data);
6431
+ for (const row of Object.values(rows)) {
6432
+ upsertRunIndexRowBestEffort(config, cwd, {
6433
+ ...row,
6434
+ status: result.status,
6435
+ updatedAt: result.updatedAt,
6436
+ summary: result.reason ?? row.summary
6437
+ });
6438
+ }
6439
+ data[STAGED_RUN_INDEX_ROWS_KEY] = {};
6440
+ }
6424
6441
  function mergeRunIndexRow(raw, row) {
6425
6442
  const parsed = parseRunIndex(raw);
6426
6443
  const runs = [row, ...parsed.runs.filter((existing) => existing.id !== row.id)].slice(0, MAX_RUNS);
@@ -6548,6 +6565,15 @@ function isRunIndexRow(value) {
6548
6565
  function isRunSubjectType(value) {
6549
6566
  return value === "goal" || value === "loop" || value === "workflow";
6550
6567
  }
6568
+ function stagedRunIndexRows(data) {
6569
+ const value = data[STAGED_RUN_INDEX_ROWS_KEY];
6570
+ if (value && typeof value === "object" && !Array.isArray(value)) {
6571
+ return value;
6572
+ }
6573
+ const rows = {};
6574
+ data[STAGED_RUN_INDEX_ROWS_KEY] = rows;
6575
+ return rows;
6576
+ }
6551
6577
  function normalizeRunIndexRow(row) {
6552
6578
  if ((row.status === "running" || row.status === "waiting") && (row.decision?.toLowerCase().startsWith("dispatch") || row.summary?.toLowerCase().startsWith("dispatch") || row.currentStep?.toLowerCase().includes("dispatch"))) {
6553
6579
  return { ...row, status: "success" };
@@ -6566,8 +6592,8 @@ function statusFromGoalEvent(event, decision) {
6566
6592
  if (status === "failure" || status === "failed" || eventName.includes("fail")) return "failed";
6567
6593
  if (status === "cancelled") return "cancelled";
6568
6594
  if (decisionKind === "blocked") return "blocked";
6569
- if (status === "dispatch" || decisionKind === "dispatch" || eventName.includes("dispatch")) return "success";
6570
- if (status === "running") return "running";
6595
+ if (status === "running" || status === "dispatch" || decisionKind === "dispatch" || eventName.includes("dispatch"))
6596
+ return "running";
6571
6597
  return "recorded";
6572
6598
  }
6573
6599
  function triggerKindFromEnv() {
@@ -6600,13 +6626,14 @@ function pruneUndefined(input) {
6600
6626
  }
6601
6627
  return input;
6602
6628
  }
6603
- var RUN_INDEX_PATH, MAX_RUNS;
6629
+ var RUN_INDEX_PATH, MAX_RUNS, STAGED_RUN_INDEX_ROWS_KEY;
6604
6630
  var init_runIndex = __esm({
6605
6631
  "src/runIndex.ts"() {
6606
6632
  "use strict";
6607
6633
  init_stateRepo();
6608
6634
  RUN_INDEX_PATH = "runs/index.json";
6609
6635
  MAX_RUNS = 200;
6636
+ STAGED_RUN_INDEX_ROWS_KEY = "__stagedRunIndexRows";
6610
6637
  }
6611
6638
  });
6612
6639
 
@@ -7492,11 +7519,9 @@ function flushGoalRunLogEvents(config, cwd, data) {
7492
7519
  const lines = `${enrichedEvents.map((event) => JSON.stringify(event)).join("\n")}
7493
7520
  `;
7494
7521
  appendStateLine(config, cwd, log2.path, lines, `chore(goal-logs): append ${goalId}`);
7495
- upsertRunIndexRowBestEffort(
7496
- config,
7497
- cwd,
7498
- runIndexRowFromGoalEvents(goalId, log2.path, enrichedEvents)
7499
- );
7522
+ const row = runIndexRowFromGoalEvents(goalId, log2.path, enrichedEvents);
7523
+ upsertRunIndexRowBestEffort(config, cwd, row);
7524
+ stageRunIndexFinalization(data, row);
7500
7525
  log2.events = [];
7501
7526
  }
7502
7527
  }
@@ -19455,6 +19480,7 @@ async function runExecutable(profileName, input) {
19455
19480
  );
19456
19481
  finishRunIndex = (out) => {
19457
19482
  const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
19483
+ const status = statusFromExitCode(out.exitCode);
19458
19484
  upsertRunIndexRowBestEffort(
19459
19485
  config,
19460
19486
  input.cwd,
@@ -19462,12 +19488,17 @@ async function runExecutable(profileName, input) {
19462
19488
  data: ctx.data,
19463
19489
  profileName,
19464
19490
  profile,
19465
- status: statusFromExitCode(out.exitCode),
19491
+ status,
19466
19492
  startedAt: runIndexStartedAt,
19467
19493
  updatedAt: finishedAt,
19468
19494
  reason: out.reason
19469
19495
  })
19470
19496
  );
19497
+ finalizeStagedRunIndexRows(config, input.cwd, ctx.data, {
19498
+ status,
19499
+ updatedAt: finishedAt,
19500
+ reason: out.reason
19501
+ });
19471
19502
  };
19472
19503
  }
19473
19504
  const taskTarget = args.issue ?? args.pr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.326",
3
+ "version": "0.4.327",
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",