@kody-ade/kody-engine 0.4.328 → 0.4.330

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 +27 -14
  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.328",
18
+ version: "0.4.330",
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",
@@ -6429,14 +6429,29 @@ function stageRunIndexFinalization(data, row) {
6429
6429
  function finalizeStagedRunIndexRows(config, cwd, data, result) {
6430
6430
  const rows = stagedRunIndexRows(data);
6431
6431
  for (const row of Object.values(rows)) {
6432
- upsertRunIndexRowBestEffort(config, cwd, {
6432
+ upsertRunIndexRowBestEffort(config, cwd, finalizedRunIndexRow(row, result));
6433
+ }
6434
+ data[STAGED_RUN_INDEX_ROWS_KEY] = {};
6435
+ }
6436
+ function finalizedRunIndexRow(row, result) {
6437
+ const target = recordValue2(row.target);
6438
+ const targetType = stringValue2(target?.type);
6439
+ const targetId = stringValue2(target?.id);
6440
+ if (row.sourceType === "goal-run-log" && row.subjectType === "loop" && targetType === "goal" && targetId && result.status === "success") {
6441
+ return {
6433
6442
  ...row,
6434
- status: result.status,
6443
+ status: "waiting",
6435
6444
  updatedAt: result.updatedAt,
6436
- summary: result.reason ?? row.summary
6437
- });
6445
+ summary: `waiting on goal ${targetId}`,
6446
+ currentStep: targetId
6447
+ };
6438
6448
  }
6439
- data[STAGED_RUN_INDEX_ROWS_KEY] = {};
6449
+ return {
6450
+ ...row,
6451
+ status: result.status,
6452
+ updatedAt: result.updatedAt,
6453
+ summary: result.reason ?? row.summary
6454
+ };
6440
6455
  }
6441
6456
  function mergeRunIndexRow(raw, row) {
6442
6457
  const parsed = parseRunIndex(raw);
@@ -6575,9 +6590,6 @@ function stagedRunIndexRows(data) {
6575
6590
  return rows;
6576
6591
  }
6577
6592
  function normalizeRunIndexRow(row) {
6578
- if ((row.status === "running" || row.status === "waiting") && (row.decision?.toLowerCase().startsWith("dispatch") || row.summary?.toLowerCase().startsWith("dispatch") || row.currentStep?.toLowerCase().includes("dispatch"))) {
6579
- return { ...row, status: "success" };
6580
- }
6581
6593
  return row;
6582
6594
  }
6583
6595
  function runSubjectType(data) {
@@ -6592,6 +6604,7 @@ function statusFromGoalEvent(event, decision) {
6592
6604
  if (status === "failure" || status === "failed" || eventName.includes("fail")) return "failed";
6593
6605
  if (status === "cancelled") return "cancelled";
6594
6606
  if (decisionKind === "blocked") return "blocked";
6607
+ if (status === "idle" || decisionKind === "idle" || eventName.includes(".idle")) return "waiting";
6595
6608
  if (status === "running" || status === "dispatch" || decisionKind === "dispatch" || eventName.includes("dispatch"))
6596
6609
  return "running";
6597
6610
  return "recorded";
@@ -8908,7 +8921,7 @@ function planTargetLoopSchedule(opts) {
8908
8921
  const preferred = opts.goal.preferredRunTime;
8909
8922
  if (preferred) {
8910
8923
  const gate = preferredRunTimeGate(preferred, now, opts.previousScheduleState, {
8911
- allowRepeatAfterCompletedTarget: opts.allowRepeatAfterCompletedTarget === true
8924
+ allowSameDayTargetDispatch: opts.allowSameDayTargetDispatch === true
8912
8925
  });
8913
8926
  if (!gate.ok) return targetLoopDecision("idle", gate.reason, at);
8914
8927
  }
@@ -9085,7 +9098,7 @@ function preferredRunTimeGate(preferred, now, previous, opts) {
9085
9098
  const lastDispatchAt = previous?.lastDecision.kind === "dispatch" ? previous.lastDecision.at : void 0;
9086
9099
  if (lastDispatchAt) {
9087
9100
  const last = zonedTimeParts(new Date(lastDispatchAt), preferred.timezone);
9088
- if (last?.date === current.date && opts?.allowRepeatAfterCompletedTarget !== true) {
9101
+ if (last?.date === current.date && opts?.allowSameDayTargetDispatch !== true) {
9089
9102
  return { ok: false, reason: `already dispatched today at preferred time ${preferred.time} ${preferred.timezone}` };
9090
9103
  }
9091
9104
  }
@@ -9377,12 +9390,12 @@ var init_advanceManagedGoal = __esm({
9377
9390
  const previousScheduleState = goal.raw.extra.scheduleState && typeof goal.raw.extra.scheduleState === "object" ? goal.raw.extra.scheduleState : void 0;
9378
9391
  const now = goalLoopNow();
9379
9392
  const activeTarget = isGoalTargetLoop(managed) ? resolveActiveGoalLoopTarget(ctx.config, ctx.cwd, goal.id, managed) : null;
9380
- const allowRepeatAfterCompletedTarget = isGoalTargetLoop(managed) && !activeTarget && previousDispatchWasTargetInstance(managed, previousScheduleState);
9393
+ const allowSameDayTargetDispatch = isGoalTargetLoop(managed) && (!!activeTarget || previousDispatchWasTargetInstance(managed, previousScheduleState));
9381
9394
  let decision2 = planTargetLoopSchedule({
9382
9395
  goal: managed,
9383
9396
  previousScheduleState,
9384
9397
  now,
9385
- allowRepeatAfterCompletedTarget
9398
+ allowSameDayTargetDispatch
9386
9399
  });
9387
9400
  let targetResolution;
9388
9401
  if (decision2.kind === "dispatch" && decision2.dispatch && isGoalTargetLoop(managed)) {
@@ -9392,7 +9405,7 @@ var init_advanceManagedGoal = __esm({
9392
9405
  previousScheduleState,
9393
9406
  now,
9394
9407
  resolvedGoalTargetId: targetResolution.targetId,
9395
- allowRepeatAfterCompletedTarget
9408
+ allowSameDayTargetDispatch
9396
9409
  });
9397
9410
  }
9398
9411
  restoreGoalIdFact();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.328",
3
+ "version": "0.4.330",
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",