@kody-ade/kody-engine 0.4.347 → 0.4.348

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
@@ -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.347",
18
+ version: "0.4.348",
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",
@@ -1221,12 +1221,10 @@ function emitEvent(cwd, ev) {
1221
1221
  if (process.env.KODY_EVENTS === "0") return;
1222
1222
  try {
1223
1223
  const runId = resolveRunId();
1224
- const implementation = typeof ev.implementation === "string" ? ev.implementation : ev.executable;
1225
1224
  const fullEvent = {
1226
1225
  ts: (/* @__PURE__ */ new Date()).toISOString(),
1227
1226
  runId,
1228
- ...ev,
1229
- implementation
1227
+ ...ev
1230
1228
  };
1231
1229
  const file = eventsPath(cwd, runId);
1232
1230
  fs3.mkdirSync(path5.dirname(file), { recursive: true });
@@ -1405,7 +1403,7 @@ function verifyToolDefinition(opts) {
1405
1403
  const attempt = state.attempts;
1406
1404
  if (attempt > state.maxAttempts) {
1407
1405
  emitEvent(opts.cwd, {
1408
- executable: opts.executable,
1406
+ implementation: opts.implementation,
1409
1407
  kind: "error",
1410
1408
  name: "verify_tool",
1411
1409
  outcome: "failed",
@@ -1428,7 +1426,7 @@ function verifyToolDefinition(opts) {
1428
1426
  const result = await runVerify2(opts.config, opts.cwd);
1429
1427
  const durationMs = Date.now() - startedAt;
1430
1428
  emitEvent(opts.cwd, {
1431
- executable: opts.executable,
1429
+ implementation: opts.implementation,
1432
1430
  kind: "postflight",
1433
1431
  name: `verify_attempt_${attempt}`,
1434
1432
  durationMs,
@@ -2258,7 +2256,7 @@ function listCapabilityActions(projectCapabilitiesRoot = getProjectCapabilitiesR
2258
2256
  const seen = /* @__PURE__ */ new Set();
2259
2257
  const out = [];
2260
2258
  const add = (action) => {
2261
- if (!isSafeName(action.action) || !isSafeName(action.capability) || !isSafeName(action.executable)) return;
2259
+ if (!isSafeName(action.action) || !isSafeName(action.capability) || !isSafeName(action.implementation)) return;
2262
2260
  if (seen.has(action.action)) return;
2263
2261
  seen.add(action.action);
2264
2262
  out.push(action);
@@ -2295,14 +2293,14 @@ function resolveCapabilityExecution(capability) {
2295
2293
  const firstWorkflowStep = capability.config.workflow?.steps[0];
2296
2294
  if (firstWorkflowStep) {
2297
2295
  const implementation2 = firstWorkflowStep.implementation ?? firstWorkflowStep.capability;
2298
- return { implementation: implementation2, executable: implementation2, cliArgs: {} };
2296
+ return { implementation: implementation2, cliArgs: {} };
2299
2297
  }
2300
2298
  const implementation = capability.config.implementation ?? capability.config.implementations?.[0] ?? (capability.config.role ? capability.slug : void 0) ?? (capability.config.tickScript ? "capability-tick-scripted" : "capability-tick");
2301
- const cliArgs = executableDeclaresInput(implementation, "capability") ? { capability: capability.slug } : {};
2302
- return { implementation, executable: implementation, cliArgs };
2299
+ const cliArgs = implementationDeclaresInput(implementation, "capability") ? { capability: capability.slug } : {};
2300
+ return { implementation, cliArgs };
2303
2301
  }
2304
- function executableDeclaresInput(executable, inputName) {
2305
- const profilePath = resolveExecutable(executable);
2302
+ function implementationDeclaresInput(implementation, inputName) {
2303
+ const profilePath = resolveExecutable(implementation);
2306
2304
  if (!profilePath) return false;
2307
2305
  try {
2308
2306
  const raw = JSON.parse(fs6.readFileSync(profilePath, "utf-8"));
@@ -2343,13 +2341,12 @@ function listFolderCapabilityActions(root, source) {
2343
2341
  if (!capability) continue;
2344
2342
  if (capability.config.internal === true || capability.config.public === false) continue;
2345
2343
  const action = capability.config.action ?? slug2;
2346
- const { implementation, executable, cliArgs } = resolveCapabilityExecution(capability);
2344
+ const { implementation, cliArgs } = resolveCapabilityExecution(capability);
2347
2345
  if (hasUnresolvedExplicitImplementation(capability, implementation)) continue;
2348
2346
  out.push({
2349
2347
  action,
2350
2348
  capability: slug2,
2351
2349
  implementation,
2352
- executable,
2353
2350
  cliArgs,
2354
2351
  source,
2355
2352
  describe: capability.config.describe ?? capability.title,
@@ -2359,13 +2356,13 @@ function listFolderCapabilityActions(root, source) {
2359
2356
  }
2360
2357
  return out.sort((a, b) => a.action.localeCompare(b.action));
2361
2358
  }
2362
- function hasUnresolvedExplicitImplementation(capability, executable) {
2359
+ function hasUnresolvedExplicitImplementation(capability, implementation) {
2363
2360
  const config = capability.config;
2364
2361
  const hasExplicitImplementation = Boolean(config.implementation) || (config.implementations?.length ?? 0) > 0;
2365
2362
  if (!hasExplicitImplementation) return false;
2366
2363
  if (config.workflow?.steps.length) return false;
2367
2364
  if (config.role && PUBLIC_EXECUTABLE_ROLES.has(config.role)) return false;
2368
- return resolveExecutable(executable) === null;
2365
+ return resolveExecutable(implementation) === null;
2369
2366
  }
2370
2367
  function listBuiltinCapabilityActions(root = getBuiltinCapabilitiesRoot()) {
2371
2368
  if (!fs6.existsSync(root) || !fs6.statSync(root).isDirectory()) return [];
@@ -2380,7 +2377,6 @@ function listBuiltinCapabilityActions(root = getBuiltinCapabilitiesRoot()) {
2380
2377
  action,
2381
2378
  capability: slug2,
2382
2379
  implementation,
2383
- executable: implementation,
2384
2380
  cliArgs: {},
2385
2381
  source: "builtin",
2386
2382
  describe: capability.config.describe ?? capability.title,
@@ -2896,25 +2892,6 @@ function capabilityToolDefinitions(opts) {
2896
2892
  return { content: [{ type: "text", text }] };
2897
2893
  }
2898
2894
  };
2899
- const dispatchTool = {
2900
- name: "dispatch_workflow",
2901
- description: "Legacy alias for start_capability. Dispatches a kody.yml workflow_dispatch run for a capability action against an issue. Prefer start_capability({name:'run', issue:<n>}). Returns {ok} or {ok:false,error}.",
2902
- inputSchema: {
2903
- capability: z3.string().min(1).optional().describe("Capability action to run (e.g. 'run')."),
2904
- executable: z3.string().min(1).optional().describe("Deprecated alias for capability."),
2905
- issueNumber: z3.number().int().positive().describe("Issue (or PR) number forwarded as issue_number.")
2906
- },
2907
- handler: async (args) => {
2908
- const capability = String(args.capability ?? args.executable ?? "");
2909
- const issueNumber = Number(args.issueNumber);
2910
- if (isDispatchGated(capability, readCapabilityTrustMode(opts.state, opts.repoSlug, opts.capabilitySlug))) {
2911
- return { content: [{ type: "text", text: trustRefusal(opts.capabilitySlug) }] };
2912
- }
2913
- const result = startCapability(workflowFile, capability, issueNumber, opts.repoSlug);
2914
- const text = result.ok ? `Dispatched capability \`${capability}\` on #${issueNumber} via workflow_dispatch.` : `Dispatch failed for capability \`${capability}\` on #${issueNumber}: ${result.error}`;
2915
- return { content: [{ type: "text", text }] };
2916
- }
2917
- };
2918
2895
  const cmsTools = dashboardCmsToolDefinitions({
2919
2896
  repoSlug: opts.repoSlug,
2920
2897
  assertWriteAllowed: () => assertCmsWriteAllowed(opts)
@@ -2931,7 +2908,6 @@ function capabilityToolDefinitions(opts) {
2931
2908
  ensureIssueTool,
2932
2909
  ensureCommentTool,
2933
2910
  startCapabilityTool,
2934
- dispatchTool,
2935
2911
  ...cmsTools
2936
2912
  ];
2937
2913
  }
@@ -2981,7 +2957,6 @@ var init_capabilityMcp = __esm({
2981
2957
  "ensure_issue",
2982
2958
  "ensure_comment",
2983
2959
  "start_capability",
2984
- "dispatch_workflow",
2985
2960
  ...DASHBOARD_CMS_MCP_TOOL_NAMES
2986
2961
  ];
2987
2962
  }
@@ -3244,7 +3219,7 @@ async function runAgent(opts) {
3244
3219
  const verifyServer = buildVerifyMcpServer2({
3245
3220
  config: opts.verifyConfig,
3246
3221
  cwd: opts.cwd,
3247
- executable: opts.executableName ?? "agent",
3222
+ implementation: opts.implementationName ?? "agent",
3248
3223
  maxAttempts: typeof opts.verifyToolMaxAttempts === "number" && opts.verifyToolMaxAttempts > 0 ? opts.verifyToolMaxAttempts : void 0
3249
3224
  });
3250
3225
  mcpEntries.push(["kody-verify", verifyServer]);
@@ -4966,15 +4941,21 @@ function normalizeTaskState(parsed) {
4966
4941
  if (parsed?.schemaVersion !== 1) {
4967
4942
  throw new CorruptStateError(`unexpected schemaVersion: ${JSON.stringify(parsed?.schemaVersion)}`);
4968
4943
  }
4969
- const raw = parsed;
4970
- const legacyCurrent = typeof raw.core?.currentExecutable === "string" ? raw.core.currentExecutable : void 0;
4971
- const currentImplementation = typeof parsed.core?.currentImplementation === "string" ? parsed.core.currentImplementation : legacyCurrent ?? null;
4972
- const implementations = parsed.implementations && typeof parsed.implementations === "object" ? parsed.implementations : raw.executables && typeof raw.executables === "object" && !Array.isArray(raw.executables) ? raw.executables : {};
4973
- const coreWithoutLegacy = { ...parsed.core ?? {} };
4974
- delete coreWithoutLegacy.currentExecutable;
4944
+ const currentImplementation = typeof parsed.core?.currentImplementation === "string" ? parsed.core.currentImplementation : null;
4945
+ const implementations = parsed.implementations && typeof parsed.implementations === "object" ? parsed.implementations : {};
4946
+ const parsedCore = parsed.core ?? emptyState().core;
4947
+ const core = {
4948
+ phase: parsedCore.phase,
4949
+ status: parsedCore.status,
4950
+ lastOutcome: parsedCore.lastOutcome,
4951
+ attempts: parsedCore.attempts,
4952
+ ...parsedCore.prUrl ? { prUrl: parsedCore.prUrl } : {},
4953
+ ...parsedCore.runUrl ? { runUrl: parsedCore.runUrl } : {},
4954
+ ...parsedCore.ranAsAgent !== void 0 ? { ranAsAgent: parsedCore.ranAsAgent } : {}
4955
+ };
4975
4956
  return {
4976
4957
  schemaVersion: 1,
4977
- core: { ...emptyState().core, ...coreWithoutLegacy, currentImplementation },
4958
+ core: { ...emptyState().core, ...core, currentImplementation },
4978
4959
  implementations,
4979
4960
  artifacts: parsed.artifacts && typeof parsed.artifacts === "object" ? parsed.artifacts : {},
4980
4961
  jobs: normalizeJobs(parsed.jobs),
@@ -5118,7 +5099,7 @@ function normalizeJobs(input) {
5118
5099
  for (const [key, value] of Object.entries(input)) {
5119
5100
  if (!value || typeof value !== "object" || Array.isArray(value)) continue;
5120
5101
  const raw = value;
5121
- const implementation = typeof raw.implementation === "string" ? raw.implementation : typeof raw.executable === "string" ? raw.executable : void 0;
5102
+ const implementation = typeof raw.implementation === "string" ? raw.implementation : void 0;
5122
5103
  if (typeof raw.id !== "string" || typeof implementation !== "string") continue;
5123
5104
  if (!isStatus(raw.status)) continue;
5124
5105
  out[key] = {
@@ -5147,7 +5128,7 @@ function normalizeHistory(input) {
5147
5128
  for (const value of input) {
5148
5129
  if (!value || typeof value !== "object" || Array.isArray(value)) continue;
5149
5130
  const raw = value;
5150
- const implementation = typeof raw.implementation === "string" ? raw.implementation : typeof raw.executable === "string" ? raw.executable : void 0;
5131
+ const implementation = typeof raw.implementation === "string" ? raw.implementation : void 0;
5151
5132
  if (typeof raw.timestamp !== "string" || typeof implementation !== "string" || typeof raw.action !== "string") {
5152
5133
  continue;
5153
5134
  }
@@ -5847,7 +5828,7 @@ async function runContainerLoop(profile, ctx, input) {
5847
5828
  preloadedData: preloadedSnapshot
5848
5829
  });
5849
5830
  emitEvent(input.cwd, {
5850
- executable: profile.name,
5831
+ implementation: profile.name,
5851
5832
  kind: "container_child",
5852
5833
  name: child.exec,
5853
5834
  durationMs: Date.now() - childStartedAt,
@@ -5856,7 +5837,7 @@ async function runContainerLoop(profile, ctx, input) {
5856
5837
  });
5857
5838
  } catch (err) {
5858
5839
  emitEvent(input.cwd, {
5859
- executable: profile.name,
5840
+ implementation: profile.name,
5860
5841
  kind: "container_child",
5861
5842
  name: child.exec,
5862
5843
  durationMs: Date.now() - childStartedAt,
@@ -6529,7 +6510,6 @@ function runIndexRowFromJobContext(input) {
6529
6510
  capability: stringValue2(input.data.jobCapability) ?? void 0,
6530
6511
  workflow: workflow ?? void 0,
6531
6512
  implementation: stringValue2(input.data.jobImplementation) ?? input.profileName,
6532
- executable: stringValue2(input.data.jobImplementation) ?? input.profileName,
6533
6513
  agent: stringValue2(input.data.jobAgent) ?? input.profile.agent ?? void 0,
6534
6514
  model: stringValue2(input.data.jobModel) ?? void 0,
6535
6515
  modelProvider: stringValue2(input.data.jobModelProvider) ?? void 0,
@@ -6579,7 +6559,6 @@ function runIndexRowFromGoalEvents(goalId, logPath, events) {
6579
6559
  action: stringValue2(job?.action) ?? void 0,
6580
6560
  capability: stringValue2(job?.capability) ?? void 0,
6581
6561
  implementation: stringValue2(job?.implementation) ?? void 0,
6582
- executable: stringValue2(job?.implementation) ?? void 0,
6583
6562
  agent: stringValue2(job?.agent) ?? void 0,
6584
6563
  model: stringValue2(job?.model) ?? void 0,
6585
6564
  modelProvider: stringValue2(job?.modelProvider) ?? void 0,
@@ -7790,8 +7769,7 @@ function capabilityDispatchFromOutput(output) {
7790
7769
  if (!output) return void 0;
7791
7770
  const dispatch2 = pruneUndefined2({
7792
7771
  capability: stringValue3(output.capability) ?? void 0,
7793
- implementation: stringValue3(output.implementation) ?? stringValue3(output.executable) ?? void 0,
7794
- executable: stringValue3(output.executable) ?? void 0,
7772
+ implementation: stringValue3(output.implementation) ?? void 0,
7795
7773
  action: stringValue3(output.action) ?? void 0
7796
7774
  });
7797
7775
  return Object.keys(dispatch2).length > 0 ? dispatch2 : void 0;
@@ -7872,7 +7850,6 @@ function triggerContext() {
7872
7850
  "title",
7873
7851
  "capability",
7874
7852
  "implementation",
7875
- "executable",
7876
7853
  "base"
7877
7854
  ]) : void 0
7878
7855
  });
@@ -7898,7 +7875,6 @@ function jobContext(data) {
7898
7875
  action: stringValue3(data.jobAction) ?? void 0,
7899
7876
  capability: stringValue3(data.jobCapability) ?? void 0,
7900
7877
  implementation: stringValue3(data.jobImplementation) ?? void 0,
7901
- executable: stringValue3(data.jobImplementation) ?? void 0,
7902
7878
  agent: stringValue3(data.jobAgent) ?? void 0,
7903
7879
  schedule: stringValue3(data.jobSchedule) ?? void 0,
7904
7880
  target: data.jobTarget ?? void 0,
@@ -9034,7 +9010,7 @@ function planTargetLoopSchedule(opts) {
9034
9010
  if (!gate.ok) return targetLoopDecision("idle", gate.reason, at);
9035
9011
  }
9036
9012
  const dispatchTargetId = target.type === "goal" && opts.resolvedGoalTargetId?.trim() ? opts.resolvedGoalTargetId.trim() : targetId;
9037
- const dispatch2 = target.type === "goal" ? { action: "goal-manager", executable: "goal-manager", cliArgs: { goal: dispatchTargetId } } : { workflow: targetId, cliArgs: {} };
9013
+ const dispatch2 = target.type === "goal" ? { action: "goal-manager", implementation: "goal-manager", cliArgs: { goal: dispatchTargetId } } : { workflow: targetId, cliArgs: {} };
9038
9014
  return {
9039
9015
  kind: "dispatch",
9040
9016
  reason: `dispatch ${target.type} ${target.type === "goal" ? dispatchTargetId : targetId}`,
@@ -9049,7 +9025,7 @@ function planTargetLoopSchedule(opts) {
9049
9025
  ...dispatch2.action ? { action: dispatch2.action } : {},
9050
9026
  ...dispatch2.capability ? { capability: dispatch2.capability } : {},
9051
9027
  ...dispatch2.workflow ? { workflow: dispatch2.workflow } : {},
9052
- ...dispatch2.executable ? { executable: dispatch2.executable } : {},
9028
+ ...dispatch2.implementation ? { implementation: dispatch2.implementation } : {},
9053
9029
  reason: preferred ? `preferred time ${preferred.time} ${preferred.timezone}` : "ready target loop tick",
9054
9030
  at
9055
9031
  },
@@ -9119,7 +9095,7 @@ async function planGoalCapabilitySchedule(opts) {
9119
9095
  lastDecision: {
9120
9096
  kind: "dispatch",
9121
9097
  capability: due.slug,
9122
- executable: dispatch2.executable,
9098
+ implementation: dispatch2.implementation,
9123
9099
  reason: due.reason,
9124
9100
  at
9125
9101
  },
@@ -9168,8 +9144,8 @@ async function describeCapabilitySchedule(capability, slug2, backend, previous)
9168
9144
  };
9169
9145
  }
9170
9146
  function capabilityDispatch(capability) {
9171
- const { executable, cliArgs } = resolveCapabilityExecution(capability);
9172
- return { capability: capability.slug, executable, cliArgs };
9147
+ const { implementation, cliArgs } = resolveCapabilityExecution(capability);
9148
+ return { capability: capability.slug, implementation, cliArgs };
9173
9149
  }
9174
9150
  function compareOldestLastFired(a, b) {
9175
9151
  const aTime = validIso(a.lastFiredAt) ? Date.parse(a.lastFiredAt) : Number.NEGATIVE_INFINITY;
@@ -9525,7 +9501,7 @@ var init_advanceManagedGoal = __esm({
9525
9501
  ...decision2.dispatch.action ? { action: decision2.dispatch.action } : {},
9526
9502
  ...decision2.dispatch.capability ? { capability: decision2.dispatch.capability } : {},
9527
9503
  ...decision2.dispatch.workflow ? { workflow: decision2.dispatch.workflow } : {},
9528
- ...decision2.dispatch.executable ? { executable: decision2.dispatch.executable } : {},
9504
+ ...decision2.dispatch.implementation ? { implementation: decision2.dispatch.implementation } : {},
9529
9505
  cliArgs: decision2.dispatch.cliArgs
9530
9506
  };
9531
9507
  }
@@ -9579,7 +9555,7 @@ var init_advanceManagedGoal = __esm({
9579
9555
  if (decision2.kind === "dispatch" && decision2.dispatch) {
9580
9556
  ctx.output.nextDispatch = {
9581
9557
  capability: decision2.dispatch.capability,
9582
- executable: decision2.dispatch.executable,
9558
+ implementation: decision2.dispatch.implementation,
9583
9559
  cliArgs: decision2.dispatch.cliArgs,
9584
9560
  ...goal.raw.extra.saveReport === true ? { saveReport: true } : {}
9585
9561
  };
@@ -9851,7 +9827,7 @@ function parseRouteStep(value) {
9851
9827
  stage: requiredString(input.stage, "route.stage"),
9852
9828
  evidence: requiredString(input.evidence, "route.evidence"),
9853
9829
  capability: slug(input.capability, "route.capability"),
9854
- ...typeof input.executable === "string" && input.executable.trim() ? { executable: input.executable.trim() } : {},
9830
+ ...typeof input.implementation === "string" && input.implementation.trim() ? { implementation: input.implementation.trim() } : {},
9855
9831
  ...record(input.args) ? { args: record(input.args) } : {}
9856
9832
  };
9857
9833
  }
@@ -10990,7 +10966,7 @@ var init_applyCapabilityReports = __esm({
10990
10966
  if (changed && ctx.output.exitCode === 0 && !ctx.output.nextDispatch && shouldResumeManagedGoal(goalId, nextForOutput)) {
10991
10967
  ctx.output.nextDispatch = {
10992
10968
  action: "goal-manager",
10993
- executable: "goal-manager",
10969
+ implementation: "goal-manager",
10994
10970
  cliArgs: { goal: goalId }
10995
10971
  };
10996
10972
  }
@@ -19782,11 +19758,11 @@ function jobReferenceBlock(profileName, profile, data) {
19782
19758
  async function runExecutable(profileName, input) {
19783
19759
  const stageStartedAt = Date.now();
19784
19760
  let finishRunIndex = null;
19785
- emitEvent(input.cwd, { executable: profileName, kind: "stage_start" });
19761
+ emitEvent(input.cwd, { implementation: profileName, kind: "stage_start" });
19786
19762
  const finishAndEnd = (out) => {
19787
19763
  finishRunIndex?.(out);
19788
19764
  emitEvent(input.cwd, {
19789
- executable: profileName,
19765
+ implementation: profileName,
19790
19766
  kind: "stage_end",
19791
19767
  durationMs: Date.now() - stageStartedAt,
19792
19768
  outcome: out.exitCode === 0 ? "ok" : "failed",
@@ -19995,7 +19971,7 @@ async function runExecutable(profileName, input) {
19995
19971
  capabilityRepoSlug: config.github?.owner && config.github?.repo ? `${config.github.owner}/${config.github.repo}` : process.env.GITHUB_REPOSITORY?.trim() || void 0,
19996
19972
  verifyToolMaxAttempts: profile.claudeCode.verifyAttempts ?? null,
19997
19973
  verifyConfig: profile.claudeCode.enableVerifyTool ? config : void 0,
19998
- executableName: profileName,
19974
+ implementationName: profileName,
19999
19975
  settingSources: profile.claudeCode.settingSources
20000
19976
  });
20001
19977
  };
@@ -20005,7 +19981,7 @@ async function runExecutable(profileName, input) {
20005
19981
  const preLabel = entry.script ?? entry.shell ?? "<unknown>";
20006
19982
  if (!shouldRun(entry, ctx)) {
20007
19983
  emitEvent(input.cwd, {
20008
- executable: profileName,
19984
+ implementation: profileName,
20009
19985
  kind: "preflight",
20010
19986
  name: preLabel,
20011
19987
  outcome: "skipped"
@@ -20016,7 +19992,7 @@ async function runExecutable(profileName, input) {
20016
19992
  if (entry.shell) {
20017
19993
  await runShellEntry(entry, ctx, profile);
20018
19994
  emitEvent(input.cwd, {
20019
- executable: profileName,
19995
+ implementation: profileName,
20020
19996
  kind: "preflight",
20021
19997
  name: preLabel,
20022
19998
  durationMs: Date.now() - t0,
@@ -20027,7 +20003,7 @@ async function runExecutable(profileName, input) {
20027
20003
  if (!fn) return finishAndEnd({ exitCode: 99, reason: `preflight script not registered: ${entry.script}` });
20028
20004
  await fn(ctx, profile, entry.with);
20029
20005
  emitEvent(input.cwd, {
20030
- executable: profileName,
20006
+ implementation: profileName,
20031
20007
  kind: "preflight",
20032
20008
  name: preLabel,
20033
20009
  durationMs: Date.now() - t0,
@@ -20050,7 +20026,7 @@ async function runExecutable(profileName, input) {
20050
20026
  reason: "composePrompt did not produce a prompt (ctx.data.prompt missing)"
20051
20027
  });
20052
20028
  }
20053
- emitEvent(input.cwd, { executable: profileName, kind: "agent_start" });
20029
+ emitEvent(input.cwd, { implementation: profileName, kind: "agent_start" });
20054
20030
  try {
20055
20031
  agentResult = await invokeAgent(prompt);
20056
20032
  } catch (err) {
@@ -20060,7 +20036,7 @@ async function runExecutable(profileName, input) {
20060
20036
  });
20061
20037
  }
20062
20038
  emitEvent(input.cwd, {
20063
- executable: profileName,
20039
+ implementation: profileName,
20064
20040
  kind: "agent_end",
20065
20041
  durationMs: agentResult.durationMs,
20066
20042
  outcome: agentResult.outcome === "completed" ? "ok" : "failed",
@@ -20087,7 +20063,7 @@ async function runExecutable(profileName, input) {
20087
20063
  `
20088
20064
  );
20089
20065
  emitEvent(input.cwd, {
20090
- executable: profileName,
20066
+ implementation: profileName,
20091
20067
  kind: "postflight",
20092
20068
  name: entryLabel,
20093
20069
  outcome: "skipped"
@@ -20106,7 +20082,7 @@ async function runExecutable(profileName, input) {
20106
20082
  `);
20107
20083
  }
20108
20084
  emitEvent(input.cwd, {
20109
- executable: profileName,
20085
+ implementation: profileName,
20110
20086
  kind: "postflight",
20111
20087
  name: entryLabel,
20112
20088
  outcome: "skipped"
@@ -20142,7 +20118,7 @@ async function runExecutable(profileName, input) {
20142
20118
  file,
20143
20119
  JSON.stringify(
20144
20120
  {
20145
- executable: profileName,
20121
+ implementation: profileName,
20146
20122
  postflight: label,
20147
20123
  message: msg,
20148
20124
  stack: err instanceof Error ? err.stack : void 0,
@@ -20159,7 +20135,7 @@ async function runExecutable(profileName, input) {
20159
20135
  if (ctx.output.exitCode === 0) ctx.output.exitCode = 99;
20160
20136
  }
20161
20137
  emitEvent(input.cwd, {
20162
- executable: profileName,
20138
+ implementation: profileName,
20163
20139
  kind: "postflight",
20164
20140
  name: label,
20165
20141
  durationMs: Date.now() - t0,
@@ -20261,7 +20237,7 @@ async function runExecutableChain(profileName, input) {
20261
20237
  if (!afterJob) {
20262
20238
  return {
20263
20239
  exitCode: 99,
20264
- reason: `in-process return missing capability/action for ${after.executable ?? "unknown"}`
20240
+ reason: `in-process return missing capability/action for ${handoffLabel(after)}`
20265
20241
  };
20266
20242
  }
20267
20243
  process.stdout.write(
@@ -20295,7 +20271,7 @@ async function runExecutableChain(profileName, input) {
20295
20271
  if (!nextJob) {
20296
20272
  return {
20297
20273
  exitCode: 99,
20298
- reason: `in-process hand-off missing capability/action for ${next.executable ?? "unknown"}`
20274
+ reason: `in-process hand-off missing capability/action for ${handoffLabel(next)}`
20299
20275
  };
20300
20276
  }
20301
20277
  process.stdout.write(
@@ -20317,7 +20293,7 @@ async function runExecutableChain(profileName, input) {
20317
20293
  };
20318
20294
  }
20319
20295
  if (result.nextDispatch || result.nextJob) {
20320
- const pending = result.nextDispatch?.executable ?? result.nextDispatch?.workflow ?? result.nextJob?.implementation ?? result.nextJob?.workflow ?? result.nextJob?.capability ?? "unknown";
20296
+ const pending = result.nextDispatch?.implementation ?? result.nextDispatch?.workflow ?? result.nextDispatch?.action ?? result.nextDispatch?.capability ?? result.nextJob?.implementation ?? result.nextJob?.workflow ?? result.nextJob?.capability ?? "unknown";
20321
20297
  process.stderr.write(`[kody] in-process hand-off cap (${MAX_CHAIN_HOPS}) reached; not running ${pending}
20322
20298
  `);
20323
20299
  }
@@ -20330,13 +20306,16 @@ function handoffToJob(handoff) {
20330
20306
  action: handoff.action ?? handoff.capability,
20331
20307
  capability: handoff.capability,
20332
20308
  workflow: handoff.workflow,
20333
- implementation: handoff.implementation ?? handoff.executable,
20309
+ implementation: handoff.implementation,
20334
20310
  cliArgs: handoff.cliArgs,
20335
20311
  flavor: "instant",
20336
20312
  saveReport: handoff.saveReport === true,
20337
20313
  resultTarget: handoff.resultTarget
20338
20314
  };
20339
20315
  }
20316
+ function handoffLabel(handoff) {
20317
+ return handoff.implementation ?? handoff.workflow ?? handoff.action ?? handoff.capability ?? "unknown";
20318
+ }
20340
20319
  function clearStampedLifecycleLabels(profile, ctx) {
20341
20320
  const target = ctx.args.issue ?? ctx.args.pr;
20342
20321
  if (typeof target !== "number" || !Number.isFinite(target)) return;
@@ -21080,7 +21059,7 @@ function loadWorkflowContext(slug2, base) {
21080
21059
  function mintInstantJob(dispatch2, opts) {
21081
21060
  return {
21082
21061
  action: dispatch2.action,
21083
- implementation: dispatch2.implementation ?? dispatch2.executable,
21062
+ implementation: dispatch2.implementation,
21084
21063
  capability: dispatch2.capability,
21085
21064
  why: opts?.why ?? dispatch2.why,
21086
21065
  agent: opts?.agent ?? DEFAULT_INSTANT_AGENT,
@@ -22053,8 +22032,8 @@ function cronMatchesInWindow(spec, end, windowSec) {
22053
22032
  // src/dispatch.ts
22054
22033
  init_registry();
22055
22034
  var POLITE_WORDS = /* @__PURE__ */ new Set(["please", "kindly", "hi", "hey", "hello", "thanks", "thank", "plz", "pls", "yo"]);
22056
- function primaryNumericInputName(executable) {
22057
- const inputs = getProfileInputs(executable);
22035
+ function primaryNumericInputName(implementation) {
22036
+ const inputs = getProfileInputs(implementation);
22058
22037
  if (!inputs) return null;
22059
22038
  const intInput = inputs.find((i) => i.type === "int" && i.required);
22060
22039
  return intInput?.name ?? null;
@@ -22075,7 +22054,6 @@ function routeResult(route, cliArgs, target, why) {
22075
22054
  action: route.action,
22076
22055
  capability: route.capability,
22077
22056
  implementation: route.implementation,
22078
- executable: route.executable,
22079
22057
  cliArgs: { ...route.cliArgs, ...cliArgs },
22080
22058
  target
22081
22059
  };
@@ -22305,7 +22283,6 @@ function dispatchScheduledWatches(opts) {
22305
22283
  action: exe.name,
22306
22284
  capability: exe.name,
22307
22285
  implementation: exe.name,
22308
- executable: exe.name,
22309
22286
  cliArgs: {},
22310
22287
  target: 0
22311
22288
  }
@@ -22660,7 +22637,7 @@ function detectPackageManager2(cwd) {
22660
22637
  return "npm";
22661
22638
  }
22662
22639
  function shouldChainScheduledWatch(match) {
22663
- return match.action === "goal-scheduler" || match.capability === "goal-scheduler" || match.implementation === "goal-scheduler" || match.executable === "goal-scheduler";
22640
+ return match.action === "goal-scheduler" || match.capability === "goal-scheduler" || match.implementation === "goal-scheduler";
22664
22641
  }
22665
22642
  function shellOut(cmd, args, cwd, stream = true) {
22666
22643
  try {
@@ -22844,7 +22821,7 @@ async function runCi(argv) {
22844
22821
  applyCompanyStoreRuntimeConfig(inputs);
22845
22822
  const issueInput = parseInt(String(inputs?.issue_number ?? ""), 10);
22846
22823
  const sessionInput = String(inputs?.sessionId ?? "");
22847
- const capabilityInput = String(inputs?.capability ?? inputs?.executable ?? "").trim();
22824
+ const capabilityInput = String(inputs?.capability ?? "").trim();
22848
22825
  const messageInput = String(inputs?.message ?? "").trim();
22849
22826
  const noTarget = !sessionInput && !(Number.isFinite(issueInput) && issueInput > 0);
22850
22827
  if (noTarget && capabilityInput) {
@@ -22868,13 +22845,12 @@ async function runCi(argv) {
22868
22845
  cliArgs: {}
22869
22846
  };
22870
22847
  const scheduledWatchRoute = manualGoalManager || capabilityRoute || workflowRoute ? void 0 : dispatchScheduledWatches({ force: true }).find(
22871
- (match) => match.action === forceRunAction || match.capability === forceRunAction || match.implementation === forceRunAction || match.executable === forceRunAction
22848
+ (match) => match.action === forceRunAction || match.capability === forceRunAction || match.implementation === forceRunAction
22872
22849
  );
22873
22850
  const route = manualGoalManager ? {
22874
22851
  action: "goal-manager",
22875
22852
  capability: "goal-manager",
22876
22853
  implementation: "goal-manager",
22877
- executable: "goal-manager",
22878
22854
  cliArgs: forceRunCliArgs
22879
22855
  } : capabilityRoute ?? workflowRoute ?? scheduledWatchRoute;
22880
22856
  if (!route) {
@@ -22882,7 +22858,7 @@ async function runCi(argv) {
22882
22858
  `);
22883
22859
  return 64;
22884
22860
  }
22885
- if (route.executable === "goal-manager" && typeof forceRunCliArgs.goal !== "string") {
22861
+ if (route.implementation === "goal-manager" && typeof forceRunCliArgs.goal !== "string") {
22886
22862
  process.stderr.write("[kody] manual goal-manager run requires message goal id\n");
22887
22863
  return 64;
22888
22864
  }
@@ -23053,7 +23029,7 @@ ${CI_HELP}`);
23053
23029
  const pm = args.packageManager ?? detectPackageManager2(cwd);
23054
23030
  process.stdout.write(`\u2192 kody: package manager = ${pm}
23055
23031
  `);
23056
- const buildOnly = dispatch2.implementation === "preview-build" || dispatch2.executable === "preview-build";
23032
+ const buildOnly = dispatch2.implementation === "preview-build";
23057
23033
  if (args.skipInstall || buildOnly) {
23058
23034
  process.stdout.write(`\u2192 kody: skipping dep install (${buildOnly ? "build-only executable" : "--skip-install"})
23059
23035
  `);
@@ -23163,7 +23139,7 @@ async function runScheduledFanOut(cwd, args, opts) {
23163
23139
  mintScheduledJob({
23164
23140
  action: match.action,
23165
23141
  capability: match.capability,
23166
- implementation: match.implementation ?? match.executable,
23142
+ implementation: match.implementation,
23167
23143
  cliArgs: match.cliArgs
23168
23144
  }),
23169
23145
  {
@@ -24264,7 +24240,7 @@ async function mcpHttpServer() {
24264
24240
  verifyToolDefinition({
24265
24241
  config,
24266
24242
  cwd: process.cwd(),
24267
- executable: "mcp-http"
24243
+ implementation: "mcp-http"
24268
24244
  })
24269
24245
  ]
24270
24246
  },
@@ -26021,7 +25997,7 @@ function summarizeRun(events) {
26021
25997
  const durationMs = new Date(endedAt).getTime() - new Date(startedAt).getTime();
26022
25998
  const exitCodeRaw = lastEnd?.meta?.exitCode;
26023
25999
  const exitCode = typeof exitCodeRaw === "number" ? exitCodeRaw : null;
26024
- const executables = Array.from(new Set(sorted.map((e) => e.executable)));
26000
+ const implementations = Array.from(new Set(sorted.map((e) => e.implementation)));
26025
26001
  let tIn = 0;
26026
26002
  let tOut = 0;
26027
26003
  let tCacheR = 0;
@@ -26039,7 +26015,7 @@ function summarizeRun(events) {
26039
26015
  startedAt,
26040
26016
  endedAt,
26041
26017
  durationMs,
26042
- executables,
26018
+ implementations,
26043
26019
  exitCode,
26044
26020
  ok: exitCode === 0,
26045
26021
  totalInputTokens: tIn,
@@ -26047,15 +26023,15 @@ function summarizeRun(events) {
26047
26023
  totalCacheReadTokens: tCacheR
26048
26024
  };
26049
26025
  }
26050
- function rollupByExecutable(events) {
26051
- const byExec = /* @__PURE__ */ new Map();
26026
+ function rollupByImplementation(events) {
26027
+ const byImplementation = /* @__PURE__ */ new Map();
26052
26028
  for (const ev of events) {
26053
26029
  if (ev.kind !== "stage_end") continue;
26054
- if (!byExec.has(ev.executable)) byExec.set(ev.executable, []);
26055
- byExec.get(ev.executable).push(ev);
26030
+ if (!byImplementation.has(ev.implementation)) byImplementation.set(ev.implementation, []);
26031
+ byImplementation.get(ev.implementation).push(ev);
26056
26032
  }
26057
26033
  const rollups = [];
26058
- for (const [executable, stageEnds] of byExec) {
26034
+ for (const [implementation, stageEnds] of byImplementation) {
26059
26035
  const durations = stageEnds.map((e) => e.durationMs ?? 0).filter((d) => d > 0).sort((a, b) => a - b);
26060
26036
  const ok = stageEnds.filter((e) => e.outcome === "ok").length;
26061
26037
  const failed = stageEnds.filter((e) => e.outcome === "failed").length;
@@ -26065,7 +26041,7 @@ function rollupByExecutable(events) {
26065
26041
  let tCacheC = 0;
26066
26042
  for (const ev of events) {
26067
26043
  if (ev.kind !== "agent_end") continue;
26068
- if (ev.executable !== executable) continue;
26044
+ if (ev.implementation !== implementation) continue;
26069
26045
  const tokens = ev.meta?.tokens;
26070
26046
  if (tokens) {
26071
26047
  tIn += Number(tokens.input ?? 0);
@@ -26076,7 +26052,7 @@ function rollupByExecutable(events) {
26076
26052
  }
26077
26053
  const mean = durations.length > 0 ? durations.reduce((s, n) => s + n, 0) / durations.length : 0;
26078
26054
  rollups.push({
26079
- executable,
26055
+ implementation,
26080
26056
  agentRuns: stageEnds.length,
26081
26057
  ok,
26082
26058
  failed,
@@ -26116,13 +26092,13 @@ async function runStats(argv) {
26116
26092
  process.stdout.write("no runs in the requested window\n");
26117
26093
  return 0;
26118
26094
  }
26119
- const byExec = rollupByExecutable(allEvents);
26095
+ const byImplementation = rollupByImplementation(allEvents);
26120
26096
  if (opts.asJson) {
26121
- process.stdout.write(`${JSON.stringify({ agentRuns: runSummaries, byExecutable: byExec }, null, 2)}
26097
+ process.stdout.write(`${JSON.stringify({ agentRuns: runSummaries, byImplementation }, null, 2)}
26122
26098
  `);
26123
26099
  return 0;
26124
26100
  }
26125
- printReport(runSummaries, byExec);
26101
+ printReport(runSummaries, byImplementation);
26126
26102
  return 0;
26127
26103
  }
26128
26104
  function printReport(agentRuns, rollups) {
@@ -26150,9 +26126,9 @@ Kody run statistics \u2014 ${totalRuns} runs
26150
26126
  `
26151
26127
  );
26152
26128
  process.stdout.write(`
26153
- Per-executable (stage_end events)
26129
+ Per-implementation (stage_end events)
26154
26130
  `);
26155
- const headers = ["executable", "runs", "ok", "failed", "p50", "p95", "mean", "tok-in", "tok-out", "cache-r"];
26131
+ const headers = ["implementation", "runs", "ok", "failed", "p50", "p95", "mean", "tok-in", "tok-out", "cache-r"];
26156
26132
  const widths = [22, 6, 6, 7, 9, 9, 9, 10, 10, 10];
26157
26133
  process.stdout.write(`${headers.map((h, i) => h.padEnd(widths[i])).join("")}
26158
26134
  `);
@@ -26160,7 +26136,7 @@ Per-executable (stage_end events)
26160
26136
  `);
26161
26137
  for (const r of rollups) {
26162
26138
  const row = [
26163
- r.executable,
26139
+ r.implementation,
26164
26140
  String(r.agentRuns),
26165
26141
  String(r.ok),
26166
26142
  String(r.failed),
@@ -437,7 +437,6 @@ export interface Context {
437
437
  capability?: string
438
438
  workflow?: string
439
439
  implementation?: string
440
- executable?: string
441
440
  cliArgs: Record<string, unknown>
442
441
  saveReport?: boolean
443
442
  resultTarget?: CapabilityResultTarget
@@ -450,7 +449,6 @@ export interface Context {
450
449
  capability?: string
451
450
  workflow?: string
452
451
  implementation?: string
453
- executable?: string
454
452
  cliArgs: Record<string, unknown>
455
453
  saveReport?: boolean
456
454
  resultTarget?: CapabilityResultTarget
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.347",
3
+ "version": "0.4.348",
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,28 +12,6 @@
12
12
  "templates",
13
13
  "kody.config.schema.json"
14
14
  ],
15
- "scripts": {
16
- "kody:run": "tsx bin/kody.ts",
17
- "serve": "tsx bin/kody.ts serve",
18
- "serve:vscode": "tsx bin/kody.ts serve vscode",
19
- "serve:claude": "tsx bin/kody.ts serve claude",
20
- "clean:dist": "node scripts/clean-dist.cjs",
21
- "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
22
- "check:modularity": "tsx scripts/check-script-modularity.ts",
23
- "pretest": "pnpm check:modularity",
24
- "test": "vitest run tests/unit tests/int --coverage",
25
- "posttest": "tsx scripts/check-coverage-floor.ts",
26
- "test:smoke": "vitest run tests/smoke --no-coverage",
27
- "test:e2e": "vitest run tests/e2e --no-coverage",
28
- "test:all": "vitest run tests --no-coverage",
29
- "typecheck": "tsc --noEmit",
30
- "lint": "biome check",
31
- "lint:fix": "biome check --write",
32
- "format": "biome format --write",
33
- "verify:package": "node scripts/verify-package-tarball.cjs",
34
- "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner",
35
- "prepublishOnly": "pnpm typecheck && vitest run tests/unit tests/int --no-coverage && pnpm build && pnpm verify:package"
36
- },
37
15
  "dependencies": {
38
16
  "@actions/cache": "^6.0.0",
39
17
  "@anthropic-ai/claude-agent-sdk": "0.2.119",
@@ -57,5 +35,26 @@
57
35
  "url": "git+https://github.com/aharonyaircohen/kody-engine.git"
58
36
  },
59
37
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
60
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
61
- }
38
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
39
+ "scripts": {
40
+ "kody:run": "tsx bin/kody.ts",
41
+ "serve": "tsx bin/kody.ts serve",
42
+ "serve:vscode": "tsx bin/kody.ts serve vscode",
43
+ "serve:claude": "tsx bin/kody.ts serve claude",
44
+ "clean:dist": "node scripts/clean-dist.cjs",
45
+ "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
46
+ "check:modularity": "tsx scripts/check-script-modularity.ts",
47
+ "pretest": "pnpm check:modularity",
48
+ "test": "vitest run tests/unit tests/int --coverage",
49
+ "posttest": "tsx scripts/check-coverage-floor.ts",
50
+ "test:smoke": "vitest run tests/smoke --no-coverage",
51
+ "test:e2e": "vitest run tests/e2e --no-coverage",
52
+ "test:all": "vitest run tests --no-coverage",
53
+ "typecheck": "tsc --noEmit",
54
+ "lint": "biome check",
55
+ "lint:fix": "biome check --write",
56
+ "format": "biome format --write",
57
+ "verify:package": "node scripts/verify-package-tarball.cjs",
58
+ "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner"
59
+ }
60
+ }