@kody-ade/kody-engine 0.4.44 → 0.4.46

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@kody-ade/kody-engine",
6
- version: "0.4.44",
6
+ version: "0.4.46",
7
7
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
8
8
  license: "MIT",
9
9
  type: "module",
@@ -390,6 +390,16 @@ function formatBytes(bytes) {
390
390
  }
391
391
 
392
392
  // src/agent.ts
393
+ function classifySubtype(subtype) {
394
+ if (!subtype) return "generic_failed";
395
+ const lower = subtype.toLowerCase();
396
+ if (lower === "success") return "ok";
397
+ if (lower.includes("max_turns") || lower.includes("max-turns")) return "out_of_turns";
398
+ if (lower.includes("rate_limit") || lower.includes("rate-limit")) return "rate_limit";
399
+ if (lower.includes("tool")) return "tool_error";
400
+ if (lower.includes("error")) return "model_error";
401
+ return "generic_failed";
402
+ }
393
403
  var DEFAULT_ALLOWED_TOOLS = ["Bash", "Edit", "Read", "Write", "Glob", "Grep"];
394
404
  var DEFAULT_TURN_TIMEOUT_MS = 3e5;
395
405
  function resolveTurnTimeoutMs(opts) {
@@ -426,6 +436,7 @@ async function runAgent(opts) {
426
436
  }
427
437
  const resultTexts = [];
428
438
  let outcome = "failed";
439
+ let outcomeKind = "generic_failed";
429
440
  let errorMessage;
430
441
  const tokens = { input: 0, output: 0, cacheRead: 0, cacheCreate: 0 };
431
442
  let messageCount = 0;
@@ -489,6 +500,7 @@ async function runAgent(opts) {
489
500
  }
490
501
  if (timedOut) {
491
502
  outcome = "failed";
503
+ outcomeKind = "stalled";
492
504
  errorMessage = `agent stalled: no SDK message in ${Math.round(turnTimeoutMs / 1e3)}s`;
493
505
  if (typeof iterator.return === "function") {
494
506
  try {
@@ -526,16 +538,19 @@ async function runAgent(opts) {
526
538
  if (m.type === "result") {
527
539
  if (m.subtype === "success") {
528
540
  outcome = "completed";
541
+ outcomeKind = "ok";
529
542
  const text = (typeof m.result === "string" ? m.result : "").trim();
530
543
  if (text) resultTexts.push(text);
531
544
  } else {
532
545
  outcome = "failed";
546
+ outcomeKind = classifySubtype(m.subtype);
533
547
  errorMessage = `result subtype: ${m.subtype ?? "unknown"}`;
534
548
  }
535
549
  }
536
550
  }
537
551
  } catch (e) {
538
552
  outcome = "failed";
553
+ outcomeKind = "model_error";
539
554
  errorMessage = e instanceof Error ? e.message : String(e);
540
555
  } finally {
541
556
  try {
@@ -550,6 +565,7 @@ async function runAgent(opts) {
550
565
  const finalText = resultTexts.join("\n\n---\n\n");
551
566
  return {
552
567
  outcome,
568
+ outcomeKind,
553
569
  finalText,
554
570
  error: errorMessage,
555
571
  ndjsonPath,
@@ -3812,14 +3828,6 @@ function markPrReady(prNumber, cwd) {
3812
3828
  return fail(err);
3813
3829
  }
3814
3830
  }
3815
- function fetchDefaultBranch(cwd) {
3816
- try {
3817
- const out = gh(["api", "repos/{owner}/{repo}", "--jq", ".default_branch"], { cwd });
3818
- return { ok: true, value: out.trim() };
3819
- } catch (err) {
3820
- return fail(err);
3821
- }
3822
- }
3823
3831
 
3824
3832
  // src/goal/phase.ts
3825
3833
  function derivePhase(snap) {
@@ -3843,15 +3851,6 @@ function pickNextDispatchable(snap) {
3843
3851
  var deriveGoalPhase = async (ctx) => {
3844
3852
  const goal = ctx.data.goal;
3845
3853
  if (!goal) return;
3846
- const defaultBranchResult = fetchDefaultBranch(ctx.cwd);
3847
- if (defaultBranchResult.ok && defaultBranchResult.value) {
3848
- goal.defaultBranch = defaultBranchResult.value;
3849
- } else if (defaultBranchResult.error) {
3850
- process.stderr.write(
3851
- `[goal-tick] deriveGoalPhase: fetchDefaultBranch failed (${defaultBranchResult.error}); falling back to ${goal.defaultBranch}
3852
- `
3853
- );
3854
- }
3855
3854
  const issues = listGoalIssues(goal.id, ctx.cwd);
3856
3855
  if (!issues.ok) {
3857
3856
  process.stderr.write(`[goal-tick] deriveGoalPhase: list issues failed: ${issues.error}
@@ -6934,6 +6933,7 @@ var parseAgentResult2 = async (ctx, profile, agentResult) => {
6934
6933
  ctx.data.agentFailureReason = parsed.failureReason;
6935
6934
  ctx.data.agentMarkerMissing = parsed.markerMissing;
6936
6935
  ctx.data.agentOutcome = agentResult.outcome;
6936
+ ctx.data.agentOutcomeKind = agentResult.outcomeKind;
6937
6937
  ctx.data.agentError = agentResult.error;
6938
6938
  const modeSeg = (ctx.args.mode ?? profile.name).replace(/-/g, "_").toUpperCase();
6939
6939
  if (parsed.done) {
@@ -7975,9 +7975,10 @@ function tryPost(issueNumber, body, cwd) {
7975
7975
  }
7976
7976
  function resolveBaseOverride(value) {
7977
7977
  if (!value) return null;
7978
- if (/^\d+-[a-z0-9-]+$/.test(value)) return value;
7979
- if (/^goal-[a-z0-9-]+$/.test(value)) return value;
7980
- return null;
7978
+ if (value.length > 200) return null;
7979
+ if (value.includes("..")) return null;
7980
+ if (!/^[a-z0-9][a-z0-9/._-]*$/.test(value)) return null;
7981
+ return value;
7981
7982
  }
7982
7983
 
7983
7984
  // src/scripts/runTickScript.ts
@@ -9264,6 +9265,7 @@ async function runExecutable(profileName, input) {
9264
9265
  durationMs: agentResult.durationMs,
9265
9266
  outcome: agentResult.outcome === "completed" ? "ok" : "failed",
9266
9267
  meta: {
9268
+ kind: agentResult.outcomeKind,
9267
9269
  ...agentResult.tokens ? { tokens: agentResult.tokens } : {},
9268
9270
  ...typeof agentResult.messageCount === "number" ? { messageCount: agentResult.messageCount } : {},
9269
9271
  ...agentResult.error ? { error: agentResult.error } : {}
@@ -10722,7 +10724,7 @@ ${HELP_TEXT}`);
10722
10724
  }
10723
10725
  }
10724
10726
  const cwd = args.cwd ?? process.cwd();
10725
- const configlessCommands = /* @__PURE__ */ new Set(["init", "goal-tick", "goal-scheduler"]);
10727
+ const configlessCommands = /* @__PURE__ */ new Set(["init", "goal-scheduler"]);
10726
10728
  const skipConfig = configlessCommands.has(args.executableName ?? "");
10727
10729
  try {
10728
10730
  const result = await runExecutable(args.executableName, {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.44",
3
+ "version": "0.4.46",
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",
@@ -12,6 +12,18 @@
12
12
  "templates",
13
13
  "kody.config.schema.json"
14
14
  ],
15
+ "scripts": {
16
+ "kody": "tsx bin/kody.ts",
17
+ "build": "tsup && node scripts/copy-assets.cjs",
18
+ "test": "vitest run tests/unit tests/int --no-coverage",
19
+ "test:e2e": "vitest run tests/e2e --no-coverage",
20
+ "test:all": "vitest run tests --no-coverage",
21
+ "typecheck": "tsc --noEmit",
22
+ "lint": "biome check",
23
+ "lint:fix": "biome check --write",
24
+ "format": "biome format --write",
25
+ "prepublishOnly": "pnpm build"
26
+ },
15
27
  "dependencies": {
16
28
  "@actions/cache": "^6.0.0",
17
29
  "@anthropic-ai/claude-agent-sdk": "0.2.119"
@@ -32,16 +44,5 @@
32
44
  "url": "git+https://github.com/aharonyaircohen/kody-engine.git"
33
45
  },
34
46
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
35
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
36
- "scripts": {
37
- "kody": "tsx bin/kody.ts",
38
- "build": "tsup && node scripts/copy-assets.cjs",
39
- "test": "vitest run tests/unit tests/int --no-coverage",
40
- "test:e2e": "vitest run tests/e2e --no-coverage",
41
- "test:all": "vitest run tests --no-coverage",
42
- "typecheck": "tsc --noEmit",
43
- "lint": "biome check",
44
- "lint:fix": "biome check --write",
45
- "format": "biome format --write"
46
- }
47
- }
47
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
48
+ }