@kody-ade/kody-engine 0.4.298 → 0.4.300
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 +54 -15
- 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.300",
|
|
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",
|
|
@@ -5539,11 +5539,11 @@ async function runContainerLoop(profile, ctx, input) {
|
|
|
5539
5539
|
const priorState = readContainerState(ctx, child, reader);
|
|
5540
5540
|
if (priorState.core?.prUrl) knownPrUrl = priorState.core.prUrl;
|
|
5541
5541
|
const priorAction = priorState.executables?.[child.exec]?.lastAction;
|
|
5542
|
-
let
|
|
5542
|
+
let actionType2;
|
|
5543
5543
|
if (priorAction && /_COMPLETED$/i.test(priorAction.type)) {
|
|
5544
5544
|
process.stderr.write(`[kody container] skipping ${child.exec}: already completed (${priorAction.type})
|
|
5545
5545
|
`);
|
|
5546
|
-
|
|
5546
|
+
actionType2 = priorAction.type;
|
|
5547
5547
|
} else {
|
|
5548
5548
|
let cliArgs;
|
|
5549
5549
|
if (child.target === "pr") {
|
|
@@ -5634,12 +5634,12 @@ async function runContainerLoop(profile, ctx, input) {
|
|
|
5634
5634
|
const nextChildAction = next.executables?.[child.exec]?.lastAction;
|
|
5635
5635
|
const childWrote = nextAttempts > priorAttempts && nextChildAction != null;
|
|
5636
5636
|
if (childWrote && nextChildAction) {
|
|
5637
|
-
|
|
5637
|
+
actionType2 = nextChildAction.type;
|
|
5638
5638
|
} else {
|
|
5639
5639
|
const childTag = child.exec.toUpperCase().replace(/-/g, "_");
|
|
5640
|
-
|
|
5640
|
+
actionType2 = childOut.exitCode === 0 ? `${childTag}_COMPLETED` : `${childTag}_FAILED`;
|
|
5641
5641
|
const synthetic = {
|
|
5642
|
-
type:
|
|
5642
|
+
type: actionType2,
|
|
5643
5643
|
payload: {
|
|
5644
5644
|
synthesized: true,
|
|
5645
5645
|
child: child.exec,
|
|
@@ -5670,16 +5670,16 @@ async function runContainerLoop(profile, ctx, input) {
|
|
|
5670
5670
|
}
|
|
5671
5671
|
ctx.data.taskState = next;
|
|
5672
5672
|
}
|
|
5673
|
-
const route = child.next[
|
|
5673
|
+
const route = child.next[actionType2] ?? child.next["*"];
|
|
5674
5674
|
if (!route) {
|
|
5675
|
-
const reason = `no route for action "${
|
|
5675
|
+
const reason = `no route for action "${actionType2}" from child "${child.exec}"`;
|
|
5676
5676
|
process.stderr.write(`[kody container] aborting: ${reason}
|
|
5677
5677
|
`);
|
|
5678
5678
|
ctx.output.exitCode = 1;
|
|
5679
5679
|
ctx.output.reason = reason;
|
|
5680
5680
|
return;
|
|
5681
5681
|
}
|
|
5682
|
-
process.stderr.write(`[kody container] outcome ${
|
|
5682
|
+
process.stderr.write(`[kody container] outcome ${actionType2}: dispatching to ${route}
|
|
5683
5683
|
`);
|
|
5684
5684
|
if (route === "done") {
|
|
5685
5685
|
ctx.output.exitCode = 0;
|
|
@@ -5687,7 +5687,7 @@ async function runContainerLoop(profile, ctx, input) {
|
|
|
5687
5687
|
}
|
|
5688
5688
|
if (route === "abort") {
|
|
5689
5689
|
ctx.output.exitCode = 1;
|
|
5690
|
-
ctx.output.reason = `container aborted by route from "${child.exec}" on ${
|
|
5690
|
+
ctx.output.reason = `container aborted by route from "${child.exec}" on ${actionType2}`;
|
|
5691
5691
|
return;
|
|
5692
5692
|
}
|
|
5693
5693
|
const nextIdx = children.findIndex((c) => c.exec === route);
|
|
@@ -14720,6 +14720,21 @@ function markRunFailed(ctx) {
|
|
|
14720
14720
|
setKodyLabel(targetNumber, FAILED_LABEL_SPEC, ctx.cwd);
|
|
14721
14721
|
}
|
|
14722
14722
|
}
|
|
14723
|
+
function markPrReadyForReview(ctx, prResult) {
|
|
14724
|
+
if (prResult?.kind !== "created" && prResult?.kind !== "updated") return;
|
|
14725
|
+
const targets = /* @__PURE__ */ new Set();
|
|
14726
|
+
const issueNumber = ctx.args.issue;
|
|
14727
|
+
if (typeof issueNumber === "number" && Number.isFinite(issueNumber)) {
|
|
14728
|
+
targets.add(issueNumber);
|
|
14729
|
+
}
|
|
14730
|
+
const targetNumber = Number(ctx.data.commentTargetNumber ?? 0);
|
|
14731
|
+
if (targetNumber > 0) targets.add(targetNumber);
|
|
14732
|
+
const prNumber = prResult.number ?? parsePrNumber(prResult.url);
|
|
14733
|
+
if (prNumber) targets.add(prNumber);
|
|
14734
|
+
for (const target of targets) {
|
|
14735
|
+
setKodyLabel(target, REVIEWING_LABEL_SPEC, ctx.cwd);
|
|
14736
|
+
}
|
|
14737
|
+
}
|
|
14723
14738
|
function computeFailureSuffix(input) {
|
|
14724
14739
|
if (input.prResult?.kind === "created") return ` \u2014 draft PR: ${input.prResult.url}`;
|
|
14725
14740
|
if (input.prResult?.kind === "updated") return ` \u2014 PR: ${input.prResult.url}`;
|
|
@@ -14761,6 +14776,21 @@ function actionFailureReason2(action) {
|
|
|
14761
14776
|
const reason = payload.reason;
|
|
14762
14777
|
return typeof reason === "string" ? reason : "";
|
|
14763
14778
|
}
|
|
14779
|
+
function actionType(action) {
|
|
14780
|
+
if (!action || typeof action !== "object" || Array.isArray(action)) return "";
|
|
14781
|
+
const type = action.type;
|
|
14782
|
+
return typeof type === "string" ? type : "";
|
|
14783
|
+
}
|
|
14784
|
+
function continuableParentLabel(ctx) {
|
|
14785
|
+
const workflowCapability = typeof ctx.data.workflowCapability === "string" && ctx.data.workflowCapability.trim() ? ctx.data.workflowCapability.trim() : "";
|
|
14786
|
+
const workflowContinueOn = Array.isArray(ctx.data.workflowContinueOn) ? ctx.data.workflowContinueOn.filter((entry) => typeof entry === "string") : [];
|
|
14787
|
+
const currentActionType = actionType(ctx.data.action);
|
|
14788
|
+
if (workflowCapability && currentActionType && workflowContinueOn.includes(currentActionType)) {
|
|
14789
|
+
return `${workflowCapability} workflow`;
|
|
14790
|
+
}
|
|
14791
|
+
const containerParent = process.env.KODY_CONTAINER_PARENT;
|
|
14792
|
+
return containerParent ? `${containerParent} container` : "";
|
|
14793
|
+
}
|
|
14764
14794
|
function postWith(type, n, body, cwd) {
|
|
14765
14795
|
try {
|
|
14766
14796
|
if (type === "issue") postIssueComment(n, body, cwd);
|
|
@@ -14768,7 +14798,7 @@ function postWith(type, n, body, cwd) {
|
|
|
14768
14798
|
} catch {
|
|
14769
14799
|
}
|
|
14770
14800
|
}
|
|
14771
|
-
var FAILED_LABEL_SPEC, postIssueComment2;
|
|
14801
|
+
var FAILED_LABEL_SPEC, REVIEWING_LABEL_SPEC, postIssueComment2;
|
|
14772
14802
|
var init_postIssueComment = __esm({
|
|
14773
14803
|
"src/scripts/postIssueComment.ts"() {
|
|
14774
14804
|
"use strict";
|
|
@@ -14781,6 +14811,11 @@ var init_postIssueComment = __esm({
|
|
|
14781
14811
|
color: "e11d21",
|
|
14782
14812
|
description: "kody: flow failed"
|
|
14783
14813
|
};
|
|
14814
|
+
REVIEWING_LABEL_SPEC = {
|
|
14815
|
+
label: "kody:reviewing",
|
|
14816
|
+
color: "d93f0b",
|
|
14817
|
+
description: "kody: PR ready for human review"
|
|
14818
|
+
};
|
|
14784
14819
|
postIssueComment2 = async (ctx, profile) => {
|
|
14785
14820
|
if (ctx.skipAgent && ctx.output.exitCode !== void 0) return;
|
|
14786
14821
|
const targetType = ctx.data.commentTargetType;
|
|
@@ -14799,12 +14834,12 @@ var init_postIssueComment = __esm({
|
|
|
14799
14834
|
return;
|
|
14800
14835
|
}
|
|
14801
14836
|
const reason = specific;
|
|
14802
|
-
const
|
|
14803
|
-
if (
|
|
14837
|
+
const continuableParent = continuableParentLabel(ctx);
|
|
14838
|
+
if (continuableParent) {
|
|
14804
14839
|
postWith(
|
|
14805
14840
|
targetType,
|
|
14806
14841
|
targetNumber,
|
|
14807
|
-
`\u2139\uFE0F kody ${profile.name}: ${truncate(reason, 1200)} \u2014 ${
|
|
14842
|
+
`\u2139\uFE0F kody ${profile.name}: ${truncate(reason, 1200)} \u2014 ${continuableParent} will route to the next stage`,
|
|
14808
14843
|
ctx.cwd
|
|
14809
14844
|
);
|
|
14810
14845
|
ctx.output.exitCode = 3;
|
|
@@ -14843,6 +14878,9 @@ var init_postIssueComment = __esm({
|
|
|
14843
14878
|
githubRepo: ctx.config.github?.repo
|
|
14844
14879
|
});
|
|
14845
14880
|
postWith(targetType, targetNumber, msg, ctx.cwd);
|
|
14881
|
+
if (!isFailure) {
|
|
14882
|
+
markPrReadyForReview(ctx, prResult);
|
|
14883
|
+
}
|
|
14846
14884
|
let exitCode = 0;
|
|
14847
14885
|
const agentDone = Boolean(ctx.data.agentDone);
|
|
14848
14886
|
const verifyOk = ctx.data.verifyOk !== false;
|
|
@@ -19066,7 +19104,8 @@ async function runCapabilityWorkflow(parent, workflow, capability, base) {
|
|
|
19066
19104
|
...chainData,
|
|
19067
19105
|
workflowStep: label,
|
|
19068
19106
|
workflowStepIndex: index + 1,
|
|
19069
|
-
workflowStepReason: step.reason
|
|
19107
|
+
workflowStepReason: step.reason,
|
|
19108
|
+
workflowContinueOn: step.continueOn ?? []
|
|
19070
19109
|
}
|
|
19071
19110
|
});
|
|
19072
19111
|
const outcome = workflowOutcome(result);
|
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.300",
|
|
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",
|