@kody-ade/kody-engine 0.4.354 → 0.4.355

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 +51 -8
  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.354",
18
+ version: "0.4.355",
19
19
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
20
20
  license: "MIT",
21
21
  type: "module",
@@ -9391,6 +9391,29 @@ function autonomyBlockReason(ctx, goalId, goal, goalState, dispatch2) {
9391
9391
  }
9392
9392
  return null;
9393
9393
  }
9394
+ function scheduleWaitDecision(previousScheduleState, plannedDecision, reason) {
9395
+ const at = plannedDecision.scheduleState.lastGoalTickAt;
9396
+ return {
9397
+ kind: "wait",
9398
+ reason,
9399
+ scheduleState: {
9400
+ mode: "agentLoop",
9401
+ lastGoalTickAt: previousScheduleState?.lastGoalTickAt ?? plannedDecision.scheduleState.lastGoalTickAt,
9402
+ lastDecision: { kind: "wait", reason, at },
9403
+ capabilities: previousScheduleState?.capabilities ?? unmarkPlannedCapabilityDispatch(plannedDecision.scheduleState, at)
9404
+ }
9405
+ };
9406
+ }
9407
+ function unmarkPlannedCapabilityDispatch(scheduleState, at) {
9408
+ return Object.fromEntries(
9409
+ Object.entries(scheduleState.capabilities).map(([slug2, status]) => {
9410
+ if (status.lastFiredAt !== at) return [slug2, status];
9411
+ const rest = { ...status };
9412
+ delete rest.lastFiredAt;
9413
+ return [slug2, rest];
9414
+ })
9415
+ );
9416
+ }
9394
9417
  function managedModelKind(goal) {
9395
9418
  return goal.loopTarget || goal.schedule ? "Loop" : "Goal";
9396
9419
  }
@@ -9417,7 +9440,9 @@ function firstTrustOverride(ctx, subjects) {
9417
9440
  }
9418
9441
  return null;
9419
9442
  }
9420
- function stageAutonomyBlocked(data, goalId, goal, goalState, reason) {
9443
+ function stageAutonomyBlocked(data, goalId, goal, goalState, waitDecision, previousScheduleState) {
9444
+ const reason = typeof waitDecision === "string" ? waitDecision : waitDecision.reason;
9445
+ const scheduleState = typeof waitDecision === "string" ? void 0 : waitDecision.scheduleState;
9421
9446
  stageGoalRunLogEvent(data, goalId, {
9422
9447
  source: "goal-manager",
9423
9448
  event: "goal.tick.wait",
@@ -9427,6 +9452,18 @@ function stageAutonomyBlocked(data, goalId, goal, goalState, reason) {
9427
9452
  status: "wait",
9428
9453
  reason,
9429
9454
  goal: goalRunLogSnapshot(goalId, goalState, goal),
9455
+ ...scheduleState ? {
9456
+ inspection: {
9457
+ previousScheduleState,
9458
+ scheduleState
9459
+ },
9460
+ change: {
9461
+ scheduleState: {
9462
+ previousDecision: previousScheduleState?.lastDecision,
9463
+ nextDecision: scheduleState.lastDecision
9464
+ }
9465
+ }
9466
+ } : {},
9430
9467
  decision: { kind: "wait", reason }
9431
9468
  });
9432
9469
  }
@@ -9702,14 +9739,17 @@ var init_advanceManagedGoal = __esm({
9702
9739
  }
9703
9740
  restoreGoalIdFact();
9704
9741
  goal.raw = writeManagedGoalToState({ ...goal.raw, state: goal.state }, managed);
9705
- goal.raw.extra.scheduleState = decision2.scheduleState;
9706
- ctx.data.managedGoalDecision = decision2;
9707
9742
  const autonomyBlock = decision2.kind === "dispatch" && decision2.dispatch ? autonomyBlockReason(ctx, goal.id, managed, goal.raw, decision2.dispatch) : null;
9708
9743
  if (autonomyBlock) {
9709
- stageAutonomyBlocked(ctx.data, goal.id, managed, goal.state, autonomyBlock);
9744
+ const waitDecision = scheduleWaitDecision(previousScheduleState, decision2, autonomyBlock);
9745
+ goal.raw.extra.scheduleState = waitDecision.scheduleState;
9746
+ ctx.data.managedGoalDecision = waitDecision;
9747
+ stageAutonomyBlocked(ctx.data, goal.id, managed, goal.state, waitDecision, previousScheduleState);
9710
9748
  ctx.output.reason = autonomyBlock;
9711
9749
  return;
9712
9750
  }
9751
+ goal.raw.extra.scheduleState = decision2.scheduleState;
9752
+ ctx.data.managedGoalDecision = decision2;
9713
9753
  if (decision2.kind === "dispatch" && decision2.dispatch) {
9714
9754
  ctx.output.nextDispatch = {
9715
9755
  ...decision2.dispatch.action ? { action: decision2.dispatch.action } : {},
@@ -9764,14 +9804,17 @@ var init_advanceManagedGoal = __esm({
9764
9804
  });
9765
9805
  restoreGoalIdFact();
9766
9806
  goal.raw = writeManagedGoalToState({ ...goal.raw, state: goal.state }, managed);
9767
- goal.raw.extra.scheduleState = decision2.scheduleState;
9768
- ctx.data.managedGoalDecision = decision2;
9769
9807
  const autonomyBlock = decision2.kind === "dispatch" && decision2.dispatch ? autonomyBlockReason(ctx, goal.id, managed, goal.raw, decision2.dispatch) : null;
9770
9808
  if (autonomyBlock) {
9771
- stageAutonomyBlocked(ctx.data, goal.id, managed, goal.state, autonomyBlock);
9809
+ const waitDecision = scheduleWaitDecision(previousScheduleState, decision2, autonomyBlock);
9810
+ goal.raw.extra.scheduleState = waitDecision.scheduleState;
9811
+ ctx.data.managedGoalDecision = waitDecision;
9812
+ stageAutonomyBlocked(ctx.data, goal.id, managed, goal.state, waitDecision, previousScheduleState);
9772
9813
  ctx.output.reason = autonomyBlock;
9773
9814
  return;
9774
9815
  }
9816
+ goal.raw.extra.scheduleState = decision2.scheduleState;
9817
+ ctx.data.managedGoalDecision = decision2;
9775
9818
  if (decision2.kind === "dispatch" && decision2.dispatch) {
9776
9819
  ctx.output.nextDispatch = {
9777
9820
  capability: decision2.dispatch.capability,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.354",
3
+ "version": "0.4.355",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",