@kody-ade/kody-engine 0.4.299 → 0.4.301
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 +83 -9
- 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.301",
|
|
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",
|
|
@@ -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}`;
|
|
@@ -14783,7 +14798,7 @@ function postWith(type, n, body, cwd) {
|
|
|
14783
14798
|
} catch {
|
|
14784
14799
|
}
|
|
14785
14800
|
}
|
|
14786
|
-
var FAILED_LABEL_SPEC, postIssueComment2;
|
|
14801
|
+
var FAILED_LABEL_SPEC, REVIEWING_LABEL_SPEC, postIssueComment2;
|
|
14787
14802
|
var init_postIssueComment = __esm({
|
|
14788
14803
|
"src/scripts/postIssueComment.ts"() {
|
|
14789
14804
|
"use strict";
|
|
@@ -14796,6 +14811,11 @@ var init_postIssueComment = __esm({
|
|
|
14796
14811
|
color: "e11d21",
|
|
14797
14812
|
description: "kody: flow failed"
|
|
14798
14813
|
};
|
|
14814
|
+
REVIEWING_LABEL_SPEC = {
|
|
14815
|
+
label: "kody:reviewing",
|
|
14816
|
+
color: "d93f0b",
|
|
14817
|
+
description: "kody: PR ready for human review"
|
|
14818
|
+
};
|
|
14799
14819
|
postIssueComment2 = async (ctx, profile) => {
|
|
14800
14820
|
if (ctx.skipAgent && ctx.output.exitCode !== void 0) return;
|
|
14801
14821
|
const targetType = ctx.data.commentTargetType;
|
|
@@ -14858,6 +14878,9 @@ var init_postIssueComment = __esm({
|
|
|
14858
14878
|
githubRepo: ctx.config.github?.repo
|
|
14859
14879
|
});
|
|
14860
14880
|
postWith(targetType, targetNumber, msg, ctx.cwd);
|
|
14881
|
+
if (!isFailure) {
|
|
14882
|
+
markPrReadyForReview(ctx, prResult);
|
|
14883
|
+
}
|
|
14861
14884
|
let exitCode = 0;
|
|
14862
14885
|
const agentDone = Boolean(ctx.data.agentDone);
|
|
14863
14886
|
const verifyOk = ctx.data.verifyOk !== false;
|
|
@@ -20279,6 +20302,13 @@ function autoDispatch(opts) {
|
|
|
20279
20302
|
const afterTag = extractAfterTag(body);
|
|
20280
20303
|
const firstTokenRaw = extractSubcommand(afterTag);
|
|
20281
20304
|
const firstToken = firstTokenRaw && POLITE_WORDS.has(firstTokenRaw) ? null : firstTokenRaw;
|
|
20305
|
+
if (isBotAuthor && firstToken) {
|
|
20306
|
+
process.stderr.write(
|
|
20307
|
+
`[kody] dispatch: rejecting bot self-dispatch comment (author=${authorLogin || authorType}, firstToken=${firstToken})
|
|
20308
|
+
`
|
|
20309
|
+
);
|
|
20310
|
+
return null;
|
|
20311
|
+
}
|
|
20282
20312
|
const aliases = opts?.config?.aliases ?? BUILTIN_ALIASES;
|
|
20283
20313
|
const aliased = firstToken ? aliases[firstToken] ?? firstToken : null;
|
|
20284
20314
|
let route = null;
|
|
@@ -20359,13 +20389,6 @@ function autoDispatchTyped(opts) {
|
|
|
20359
20389
|
if (!hasKodyMention(rawBody)) {
|
|
20360
20390
|
return { kind: "silent", reason: "comment does not mention @kody" };
|
|
20361
20391
|
}
|
|
20362
|
-
if (authorLogin === "kody-bot" || authorType === "Bot") {
|
|
20363
|
-
return { kind: "silent", reason: `bot-authored comment (${authorLogin || authorType})` };
|
|
20364
|
-
}
|
|
20365
|
-
if (!associationAllowed(event, opts?.config)) {
|
|
20366
|
-
const assoc = String(comment?.author_association ?? "").toUpperCase() || "<none>";
|
|
20367
|
-
return { kind: "silent", reason: `commenter association '${assoc}' not in access.allowedAssociations` };
|
|
20368
|
-
}
|
|
20369
20392
|
const targetNum = Number(issue?.number ?? 0);
|
|
20370
20393
|
const isPr = !!issue?.pull_request;
|
|
20371
20394
|
if (!targetNum) {
|
|
@@ -20373,6 +20396,23 @@ function autoDispatchTyped(opts) {
|
|
|
20373
20396
|
}
|
|
20374
20397
|
const afterTag = extractAfterTag(rawBody.toLowerCase());
|
|
20375
20398
|
const tokenRaw = extractSubcommand(afterTag) ?? "";
|
|
20399
|
+
if ((authorLogin === "kody-bot" || authorType === "Bot") && tokenRaw && !POLITE_WORDS.has(tokenRaw)) {
|
|
20400
|
+
return {
|
|
20401
|
+
kind: "rejected",
|
|
20402
|
+
reason: "bot_self_dispatch",
|
|
20403
|
+
token: tokenRaw,
|
|
20404
|
+
target: targetNum,
|
|
20405
|
+
isPr,
|
|
20406
|
+
author: authorLogin || authorType
|
|
20407
|
+
};
|
|
20408
|
+
}
|
|
20409
|
+
if (authorLogin === "kody-bot" || authorType === "Bot") {
|
|
20410
|
+
return { kind: "silent", reason: `bot-authored comment (${authorLogin || authorType})` };
|
|
20411
|
+
}
|
|
20412
|
+
if (!associationAllowed(event, opts?.config)) {
|
|
20413
|
+
const assoc = String(comment?.author_association ?? "").toUpperCase() || "<none>";
|
|
20414
|
+
return { kind: "silent", reason: `commenter association '${assoc}' not in access.allowedAssociations` };
|
|
20415
|
+
}
|
|
20376
20416
|
if (!tokenRaw || POLITE_WORDS.has(tokenRaw)) {
|
|
20377
20417
|
return {
|
|
20378
20418
|
kind: "silent",
|
|
@@ -20530,6 +20570,7 @@ function coerceBare(spec, value) {
|
|
|
20530
20570
|
init_gha();
|
|
20531
20571
|
init_issue();
|
|
20532
20572
|
init_job();
|
|
20573
|
+
init_lifecycleLabels();
|
|
20533
20574
|
init_registry();
|
|
20534
20575
|
|
|
20535
20576
|
// src/run-request.ts
|
|
@@ -20595,6 +20636,11 @@ function readRunRequestFromEnv(env = process.env) {
|
|
|
20595
20636
|
// src/kody-cli.ts
|
|
20596
20637
|
init_runtimePaths();
|
|
20597
20638
|
init_stateWorkspace();
|
|
20639
|
+
var FAILED_DISPATCH_LABEL = {
|
|
20640
|
+
label: "kody:failed",
|
|
20641
|
+
color: "e11d21",
|
|
20642
|
+
description: "Kody failed or rejected the run"
|
|
20643
|
+
};
|
|
20598
20644
|
var CI_HELP = `kody ci \u2014 minimal-YAML autonomous engineer (CI preflight + run)
|
|
20599
20645
|
|
|
20600
20646
|
Usage:
|
|
@@ -20866,6 +20912,7 @@ ${tail}
|
|
|
20866
20912
|
postIssueComment(issueNumber, body, cwd);
|
|
20867
20913
|
} catch {
|
|
20868
20914
|
}
|
|
20915
|
+
setKodyLabel(issueNumber, FAILED_DISPATCH_LABEL, cwd);
|
|
20869
20916
|
}
|
|
20870
20917
|
function shouldPostRunFailureTail(exitCode) {
|
|
20871
20918
|
return exitCode !== 0 && exitCode !== 1 && exitCode !== 2 && exitCode !== 3;
|
|
@@ -21022,6 +21069,33 @@ async function runCi(argv) {
|
|
|
21022
21069
|
}
|
|
21023
21070
|
if (!args.issueNumber && !autoFallback && process.env.GITHUB_EVENT_NAME) {
|
|
21024
21071
|
const outcome = autoDispatchTyped({ config: earlyConfig });
|
|
21072
|
+
if (outcome.kind === "rejected") {
|
|
21073
|
+
try {
|
|
21074
|
+
unpackAllSecrets();
|
|
21075
|
+
await resolveAuthToken();
|
|
21076
|
+
} catch {
|
|
21077
|
+
}
|
|
21078
|
+
const body = [
|
|
21079
|
+
`\u26A0\uFE0F kody rejected this trigger: bot-authored \`@kody ${outcome.token}\` comments cannot dispatch work.`,
|
|
21080
|
+
"",
|
|
21081
|
+
"Use workflow_dispatch or runExecutableChain for engine-owned continuation instead."
|
|
21082
|
+
].join("\n");
|
|
21083
|
+
try {
|
|
21084
|
+
if (outcome.isPr) postPrReviewComment(outcome.target, body, cwd);
|
|
21085
|
+
else postIssueComment(outcome.target, body, cwd);
|
|
21086
|
+
} catch (err) {
|
|
21087
|
+
process.stderr.write(
|
|
21088
|
+
`[kody] dispatch: failed to post rejected-trigger feedback: ${err instanceof Error ? err.message : String(err)}
|
|
21089
|
+
`
|
|
21090
|
+
);
|
|
21091
|
+
}
|
|
21092
|
+
setKodyLabel(outcome.target, FAILED_DISPATCH_LABEL, cwd);
|
|
21093
|
+
process.stderr.write(
|
|
21094
|
+
`[kody] dispatch: rejected bot self-dispatch by ${outcome.author} on #${outcome.target} (${outcome.token})
|
|
21095
|
+
`
|
|
21096
|
+
);
|
|
21097
|
+
return 64;
|
|
21098
|
+
}
|
|
21025
21099
|
if (outcome.kind === "unrecognized") {
|
|
21026
21100
|
try {
|
|
21027
21101
|
unpackAllSecrets();
|
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.301",
|
|
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",
|