@kody-ade/kody-engine 0.4.300 → 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.
Files changed (2) hide show
  1. package/dist/bin/kody.js +59 -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.300",
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",
@@ -20302,6 +20302,13 @@ function autoDispatch(opts) {
20302
20302
  const afterTag = extractAfterTag(body);
20303
20303
  const firstTokenRaw = extractSubcommand(afterTag);
20304
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
+ }
20305
20312
  const aliases = opts?.config?.aliases ?? BUILTIN_ALIASES;
20306
20313
  const aliased = firstToken ? aliases[firstToken] ?? firstToken : null;
20307
20314
  let route = null;
@@ -20382,13 +20389,6 @@ function autoDispatchTyped(opts) {
20382
20389
  if (!hasKodyMention(rawBody)) {
20383
20390
  return { kind: "silent", reason: "comment does not mention @kody" };
20384
20391
  }
20385
- if (authorLogin === "kody-bot" || authorType === "Bot") {
20386
- return { kind: "silent", reason: `bot-authored comment (${authorLogin || authorType})` };
20387
- }
20388
- if (!associationAllowed(event, opts?.config)) {
20389
- const assoc = String(comment?.author_association ?? "").toUpperCase() || "<none>";
20390
- return { kind: "silent", reason: `commenter association '${assoc}' not in access.allowedAssociations` };
20391
- }
20392
20392
  const targetNum = Number(issue?.number ?? 0);
20393
20393
  const isPr = !!issue?.pull_request;
20394
20394
  if (!targetNum) {
@@ -20396,6 +20396,23 @@ function autoDispatchTyped(opts) {
20396
20396
  }
20397
20397
  const afterTag = extractAfterTag(rawBody.toLowerCase());
20398
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
+ }
20399
20416
  if (!tokenRaw || POLITE_WORDS.has(tokenRaw)) {
20400
20417
  return {
20401
20418
  kind: "silent",
@@ -20553,6 +20570,7 @@ function coerceBare(spec, value) {
20553
20570
  init_gha();
20554
20571
  init_issue();
20555
20572
  init_job();
20573
+ init_lifecycleLabels();
20556
20574
  init_registry();
20557
20575
 
20558
20576
  // src/run-request.ts
@@ -20618,6 +20636,11 @@ function readRunRequestFromEnv(env = process.env) {
20618
20636
  // src/kody-cli.ts
20619
20637
  init_runtimePaths();
20620
20638
  init_stateWorkspace();
20639
+ var FAILED_DISPATCH_LABEL = {
20640
+ label: "kody:failed",
20641
+ color: "e11d21",
20642
+ description: "Kody failed or rejected the run"
20643
+ };
20621
20644
  var CI_HELP = `kody ci \u2014 minimal-YAML autonomous engineer (CI preflight + run)
20622
20645
 
20623
20646
  Usage:
@@ -20889,6 +20912,7 @@ ${tail}
20889
20912
  postIssueComment(issueNumber, body, cwd);
20890
20913
  } catch {
20891
20914
  }
20915
+ setKodyLabel(issueNumber, FAILED_DISPATCH_LABEL, cwd);
20892
20916
  }
20893
20917
  function shouldPostRunFailureTail(exitCode) {
20894
20918
  return exitCode !== 0 && exitCode !== 1 && exitCode !== 2 && exitCode !== 3;
@@ -21045,6 +21069,33 @@ async function runCi(argv) {
21045
21069
  }
21046
21070
  if (!args.issueNumber && !autoFallback && process.env.GITHUB_EVENT_NAME) {
21047
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
+ }
21048
21099
  if (outcome.kind === "unrecognized") {
21049
21100
  try {
21050
21101
  unpackAllSecrets();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.300",
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",