@kody-ade/kody-engine 0.2.48 → 0.2.50

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/kody2.js +48 -26
  2. package/package.json +1 -1
package/dist/bin/kody2.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@kody-ade/kody-engine",
6
- version: "0.2.48",
6
+ version: "0.2.50",
7
7
  description: "kody2 \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
8
8
  license: "MIT",
9
9
  type: "module",
@@ -1209,7 +1209,7 @@ var advanceFlow = async (ctx, profile) => {
1209
1209
  );
1210
1210
  }
1211
1211
  }
1212
- const body = `@kody2 orchestrate --flow ${flow.name}`;
1212
+ const body = "@kody2 orchestrate";
1213
1213
  try {
1214
1214
  execFileSync3("gh", ["issue", "comment", String(flow.issueNumber), "--body", body], {
1215
1215
  timeout: API_TIMEOUT_MS2,
@@ -2810,26 +2810,40 @@ function reactToTriggerComment(cwd) {
2810
2810
  const repo = process.env.GITHUB_REPOSITORY;
2811
2811
  if (!commentId || !repo) return;
2812
2812
  const token = process.env.KODY_TOKEN?.trim() || process.env.GH_TOKEN || process.env.GITHUB_TOKEN;
2813
+ const args = [
2814
+ "api",
2815
+ "-X",
2816
+ "POST",
2817
+ "-H",
2818
+ "Accept: application/vnd.github+json",
2819
+ `/repos/${repo}/issues/comments/${commentId}/reactions`,
2820
+ "-f",
2821
+ "content=eyes"
2822
+ ];
2823
+ const opts = {
2824
+ cwd,
2825
+ env: { ...process.env, GH_TOKEN: token ?? process.env.GH_TOKEN ?? "" },
2826
+ stdio: "pipe",
2827
+ timeout: 15e3
2828
+ };
2829
+ let lastErr = null;
2830
+ for (let attempt = 0; attempt < 3; attempt++) {
2831
+ if (attempt > 0) sleepMs(attempt === 1 ? 500 : 1500);
2832
+ try {
2833
+ execFileSync11("gh", args, opts);
2834
+ return;
2835
+ } catch (err) {
2836
+ lastErr = err;
2837
+ }
2838
+ }
2839
+ process.stderr.write(
2840
+ `[kody2] \u{1F440} reaction failed after 3 attempts on comment ${commentId}: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}
2841
+ `
2842
+ );
2843
+ }
2844
+ function sleepMs(ms) {
2813
2845
  try {
2814
- execFileSync11(
2815
- "gh",
2816
- [
2817
- "api",
2818
- "-X",
2819
- "POST",
2820
- "-H",
2821
- "Accept: application/vnd.github+json",
2822
- `/repos/${repo}/issues/comments/${commentId}/reactions`,
2823
- "-f",
2824
- "content=eyes"
2825
- ],
2826
- {
2827
- cwd,
2828
- env: { ...process.env, GH_TOKEN: token ?? process.env.GH_TOKEN ?? "" },
2829
- stdio: "pipe",
2830
- timeout: 15e3
2831
- }
2832
- );
2846
+ execFileSync11("sleep", [(ms / 1e3).toString()], { stdio: "ignore", timeout: ms + 1e3 });
2833
2847
  } catch {
2834
2848
  }
2835
2849
  }
@@ -3556,19 +3570,27 @@ var postPlanComment = async (ctx) => {
3556
3570
  const targetNumber = Number(ctx.data.commentTargetNumber ?? 0);
3557
3571
  const plan = ctx.data.prSummary?.trim();
3558
3572
  if (targetType !== "issue" || !targetNumber || !plan) return;
3559
- const body = renderPlanComment(targetNumber, plan);
3573
+ const flowActive = Boolean(ctx.data.taskState?.flow);
3574
+ const body = renderPlanComment(targetNumber, plan, { flowActive });
3560
3575
  try {
3561
3576
  postIssueComment(targetNumber, body, ctx.cwd);
3562
3577
  } catch {
3563
3578
  }
3564
3579
  };
3565
- function renderPlanComment(issueNumber, plan) {
3566
- return `## Plan for issue #${issueNumber}
3580
+ function renderPlanComment(issueNumber, plan, opts) {
3581
+ const head = `## Plan for issue #${issueNumber}
3582
+
3583
+ ${plan}`;
3584
+ if (opts?.flowActive) {
3585
+ return `${head}
3567
3586
 
3568
- ${plan}
3587
+ ---
3588
+ _Orchestrator will advance to the next step automatically._`;
3589
+ }
3590
+ return `${head}
3569
3591
 
3570
3592
  ---
3571
- Comment \`@kody2 run\` to execute this plan.`;
3593
+ Comment \`kody2 run\` (prefixed with \`@\`) to execute this plan.`;
3572
3594
  }
3573
3595
 
3574
3596
  // src/scripts/postResearchComment.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.2.48",
3
+ "version": "0.2.50",
4
4
  "description": "kody2 — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",