@kody-ade/kody-engine 0.4.354 → 0.4.356
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 +64 -10
- 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.
|
|
18
|
+
version: "0.4.356",
|
|
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",
|
|
@@ -9367,7 +9367,7 @@ function scalarFacts(facts) {
|
|
|
9367
9367
|
)
|
|
9368
9368
|
);
|
|
9369
9369
|
}
|
|
9370
|
-
function autonomyBlockReason(ctx, goalId, goal, goalState, dispatch2) {
|
|
9370
|
+
function autonomyBlockReason(ctx, goalId, goal, goalState, dispatch2, options = {}) {
|
|
9371
9371
|
if (ctx.data.jobForce === true) return null;
|
|
9372
9372
|
const selfMode = firstTrustOverride(ctx, subjectCandidates(managedModelSubjectKind(goal), goalId, goalState));
|
|
9373
9373
|
if (selfMode === "ask" || selfMode !== "auto" && goal.runWithoutApproval !== true) {
|
|
@@ -9381,7 +9381,7 @@ function autonomyBlockReason(ctx, goalId, goal, goalState, dispatch2) {
|
|
|
9381
9381
|
}
|
|
9382
9382
|
}
|
|
9383
9383
|
const targetGoal = dispatch2.action === "goal-manager" && typeof dispatch2.cliArgs.goal === "string" ? dispatch2.cliArgs.goal : null;
|
|
9384
|
-
if (targetGoal && targetGoal !== goalId) {
|
|
9384
|
+
if (targetGoal && targetGoal !== goalId && options.checkTargets !== false) {
|
|
9385
9385
|
const target = fetchGoalState(ctx.config, targetGoal, ctx.cwd);
|
|
9386
9386
|
const targetManaged = target ? managedGoalFromState(expandManagedGoalState(target)) : null;
|
|
9387
9387
|
const targetMode = targetManaged ? firstTrustOverride(ctx, subjectCandidates(managedModelSubjectKind(targetManaged), targetGoal, target)) : null;
|
|
@@ -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,
|
|
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
|
}
|
|
@@ -9690,6 +9727,17 @@ var init_advanceManagedGoal = __esm({
|
|
|
9690
9727
|
allowSameDayTargetDispatch
|
|
9691
9728
|
});
|
|
9692
9729
|
let targetResolution;
|
|
9730
|
+
const selfAutonomyBlock = decision2.kind === "dispatch" && decision2.dispatch ? autonomyBlockReason(ctx, goal.id, managed, goal.raw, decision2.dispatch, { checkTargets: false }) : null;
|
|
9731
|
+
if (selfAutonomyBlock) {
|
|
9732
|
+
restoreGoalIdFact();
|
|
9733
|
+
goal.raw = writeManagedGoalToState({ ...goal.raw, state: goal.state }, managed);
|
|
9734
|
+
const waitDecision = scheduleWaitDecision(previousScheduleState, decision2, selfAutonomyBlock);
|
|
9735
|
+
goal.raw.extra.scheduleState = waitDecision.scheduleState;
|
|
9736
|
+
ctx.data.managedGoalDecision = waitDecision;
|
|
9737
|
+
stageAutonomyBlocked(ctx.data, goal.id, managed, goal.state, waitDecision, previousScheduleState);
|
|
9738
|
+
ctx.output.reason = selfAutonomyBlock;
|
|
9739
|
+
return;
|
|
9740
|
+
}
|
|
9693
9741
|
if (decision2.kind === "dispatch" && decision2.dispatch && isGoalTargetLoop(managed)) {
|
|
9694
9742
|
targetResolution = resolveGoalLoopTarget(ctx.config, ctx.cwd, goal.id, managed, now);
|
|
9695
9743
|
decision2 = planTargetLoopSchedule({
|
|
@@ -9702,14 +9750,17 @@ var init_advanceManagedGoal = __esm({
|
|
|
9702
9750
|
}
|
|
9703
9751
|
restoreGoalIdFact();
|
|
9704
9752
|
goal.raw = writeManagedGoalToState({ ...goal.raw, state: goal.state }, managed);
|
|
9705
|
-
goal.raw.extra.scheduleState = decision2.scheduleState;
|
|
9706
|
-
ctx.data.managedGoalDecision = decision2;
|
|
9707
9753
|
const autonomyBlock = decision2.kind === "dispatch" && decision2.dispatch ? autonomyBlockReason(ctx, goal.id, managed, goal.raw, decision2.dispatch) : null;
|
|
9708
9754
|
if (autonomyBlock) {
|
|
9709
|
-
|
|
9755
|
+
const waitDecision = scheduleWaitDecision(previousScheduleState, decision2, autonomyBlock);
|
|
9756
|
+
goal.raw.extra.scheduleState = waitDecision.scheduleState;
|
|
9757
|
+
ctx.data.managedGoalDecision = waitDecision;
|
|
9758
|
+
stageAutonomyBlocked(ctx.data, goal.id, managed, goal.state, waitDecision, previousScheduleState);
|
|
9710
9759
|
ctx.output.reason = autonomyBlock;
|
|
9711
9760
|
return;
|
|
9712
9761
|
}
|
|
9762
|
+
goal.raw.extra.scheduleState = decision2.scheduleState;
|
|
9763
|
+
ctx.data.managedGoalDecision = decision2;
|
|
9713
9764
|
if (decision2.kind === "dispatch" && decision2.dispatch) {
|
|
9714
9765
|
ctx.output.nextDispatch = {
|
|
9715
9766
|
...decision2.dispatch.action ? { action: decision2.dispatch.action } : {},
|
|
@@ -9764,14 +9815,17 @@ var init_advanceManagedGoal = __esm({
|
|
|
9764
9815
|
});
|
|
9765
9816
|
restoreGoalIdFact();
|
|
9766
9817
|
goal.raw = writeManagedGoalToState({ ...goal.raw, state: goal.state }, managed);
|
|
9767
|
-
goal.raw.extra.scheduleState = decision2.scheduleState;
|
|
9768
|
-
ctx.data.managedGoalDecision = decision2;
|
|
9769
9818
|
const autonomyBlock = decision2.kind === "dispatch" && decision2.dispatch ? autonomyBlockReason(ctx, goal.id, managed, goal.raw, decision2.dispatch) : null;
|
|
9770
9819
|
if (autonomyBlock) {
|
|
9771
|
-
|
|
9820
|
+
const waitDecision = scheduleWaitDecision(previousScheduleState, decision2, autonomyBlock);
|
|
9821
|
+
goal.raw.extra.scheduleState = waitDecision.scheduleState;
|
|
9822
|
+
ctx.data.managedGoalDecision = waitDecision;
|
|
9823
|
+
stageAutonomyBlocked(ctx.data, goal.id, managed, goal.state, waitDecision, previousScheduleState);
|
|
9772
9824
|
ctx.output.reason = autonomyBlock;
|
|
9773
9825
|
return;
|
|
9774
9826
|
}
|
|
9827
|
+
goal.raw.extra.scheduleState = decision2.scheduleState;
|
|
9828
|
+
ctx.data.managedGoalDecision = decision2;
|
|
9775
9829
|
if (decision2.kind === "dispatch" && decision2.dispatch) {
|
|
9776
9830
|
ctx.output.nextDispatch = {
|
|
9777
9831
|
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.
|
|
3
|
+
"version": "0.4.356",
|
|
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",
|