@kody-ade/kody-engine 0.4.44 → 0.4.45

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 +19 -1
  2. package/package.json +1 -1
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.45",
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,
@@ -6934,6 +6950,7 @@ var parseAgentResult2 = async (ctx, profile, agentResult) => {
6934
6950
  ctx.data.agentFailureReason = parsed.failureReason;
6935
6951
  ctx.data.agentMarkerMissing = parsed.markerMissing;
6936
6952
  ctx.data.agentOutcome = agentResult.outcome;
6953
+ ctx.data.agentOutcomeKind = agentResult.outcomeKind;
6937
6954
  ctx.data.agentError = agentResult.error;
6938
6955
  const modeSeg = (ctx.args.mode ?? profile.name).replace(/-/g, "_").toUpperCase();
6939
6956
  if (parsed.done) {
@@ -9264,6 +9281,7 @@ async function runExecutable(profileName, input) {
9264
9281
  durationMs: agentResult.durationMs,
9265
9282
  outcome: agentResult.outcome === "completed" ? "ok" : "failed",
9266
9283
  meta: {
9284
+ kind: agentResult.outcomeKind,
9267
9285
  ...agentResult.tokens ? { tokens: agentResult.tokens } : {},
9268
9286
  ...typeof agentResult.messageCount === "number" ? { messageCount: agentResult.messageCount } : {},
9269
9287
  ...agentResult.error ? { error: agentResult.error } : {}
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.45",
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",