@kody-ade/kody-engine 0.4.335 → 0.4.336

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.335",
18
+ version: "0.4.336",
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,10 +1221,12 @@ 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;
1224
1225
  const fullEvent = {
1225
1226
  ts: (/* @__PURE__ */ new Date()).toISOString(),
1226
1227
  runId,
1227
- ...ev
1228
+ ...ev,
1229
+ implementation
1228
1230
  };
1229
1231
  const file = eventsPath(cwd, runId);
1230
1232
  fs3.mkdirSync(path5.dirname(file), { recursive: true });
@@ -1983,7 +1985,7 @@ function parseWorkflowStep(value) {
1983
1985
  const raw = value;
1984
1986
  const capability = stringField(raw.capability ?? raw.action);
1985
1987
  if (!capability || !isSafeSlug(capability)) return null;
1986
- const executable = stringField(raw.executable ?? raw.implementation);
1988
+ const implementation = stringField(raw.implementation ?? raw.executable);
1987
1989
  const action = stringField(raw.action);
1988
1990
  const agent = stringField(raw.agent);
1989
1991
  const reason = stringField(raw.reason);
@@ -1992,7 +1994,7 @@ function parseWorkflowStep(value) {
1992
1994
  return {
1993
1995
  capability,
1994
1996
  ...action && isSafeSlug(action) ? { action } : {},
1995
- ...executable && isSafeSlug(executable) ? { executable } : {},
1997
+ ...implementation && isSafeSlug(implementation) ? { implementation, executable: implementation } : {},
1996
1998
  ...target === "issue" || target === "pr" ? { target } : {},
1997
1999
  ...agent && isSafeSlug(agent) ? { agent } : {},
1998
2000
  ...reason ? { reason } : {},
@@ -2289,16 +2291,17 @@ function resolveCapabilityFolder(slug2, projectCapabilitiesRoot = getProjectCapa
2289
2291
  function getCapabilityActionInputs(action) {
2290
2292
  const resolved = resolveCapabilityAction(action);
2291
2293
  if (!resolved) return null;
2292
- return getProfileInputs(resolved.executable);
2294
+ return getProfileInputs(resolved.implementation);
2293
2295
  }
2294
2296
  function resolveCapabilityExecution(capability) {
2295
2297
  const firstWorkflowStep = capability.config.workflow?.steps[0];
2296
2298
  if (firstWorkflowStep) {
2297
- return { executable: firstWorkflowStep.executable ?? firstWorkflowStep.capability, cliArgs: {} };
2299
+ const implementation2 = firstWorkflowStep.implementation ?? firstWorkflowStep.executable ?? firstWorkflowStep.capability;
2300
+ return { implementation: implementation2, executable: implementation2, cliArgs: {} };
2298
2301
  }
2299
- const executable = capability.config.implementation ?? capability.config.executable ?? capability.config.implementations?.[0] ?? capability.config.executables?.[0] ?? (capability.config.role ? capability.slug : void 0) ?? (capability.config.tickScript ? "capability-tick-scripted" : "capability-tick");
2300
- const cliArgs = executableDeclaresInput(executable, "capability") ? { capability: capability.slug } : {};
2301
- return { executable, cliArgs };
2302
+ const implementation = capability.config.implementation ?? capability.config.executable ?? capability.config.implementations?.[0] ?? capability.config.executables?.[0] ?? (capability.config.role ? capability.slug : void 0) ?? (capability.config.tickScript ? "capability-tick-scripted" : "capability-tick");
2303
+ const cliArgs = executableDeclaresInput(implementation, "capability") ? { capability: capability.slug } : {};
2304
+ return { implementation, executable: implementation, cliArgs };
2302
2305
  }
2303
2306
  function executableDeclaresInput(executable, inputName) {
2304
2307
  const profilePath = resolveExecutable(executable);
@@ -2342,11 +2345,12 @@ function listFolderCapabilityActions(root, source) {
2342
2345
  if (!capability) continue;
2343
2346
  if (capability.config.internal === true || capability.config.public === false) continue;
2344
2347
  const action = capability.config.action ?? slug2;
2345
- const { executable, cliArgs } = resolveCapabilityExecution(capability);
2346
- if (hasUnresolvedExplicitImplementation(capability, executable)) continue;
2348
+ const { implementation, executable, cliArgs } = resolveCapabilityExecution(capability);
2349
+ if (hasUnresolvedExplicitImplementation(capability, implementation)) continue;
2347
2350
  out.push({
2348
2351
  action,
2349
2352
  capability: slug2,
2353
+ implementation,
2350
2354
  executable,
2351
2355
  cliArgs,
2352
2356
  source,
@@ -2373,11 +2377,12 @@ function listBuiltinCapabilityActions(root = getBuiltinCapabilitiesRoot()) {
2373
2377
  const capability = readCapabilityFolder(root, slug2);
2374
2378
  if (!capability) continue;
2375
2379
  const action = capability.config.action ?? slug2;
2376
- const executable = capability.config.implementation ?? capability.config.executable ?? slug2;
2380
+ const implementation = capability.config.implementation ?? capability.config.executable ?? slug2;
2377
2381
  out.push({
2378
2382
  action,
2379
2383
  capability: slug2,
2380
- executable,
2384
+ implementation,
2385
+ executable: implementation,
2381
2386
  cliArgs: {},
2382
2387
  source: "builtin",
2383
2388
  describe: capability.config.describe ?? capability.title,
@@ -2702,7 +2707,7 @@ function startCapability(workflowFile, name, issue, repoSlug) {
2702
2707
  function expectedDispatchTarget(capability) {
2703
2708
  const route = resolveCapabilityAction(capability);
2704
2709
  if (!route) return null;
2705
- const inputs = getProfileInputs(route.executable);
2710
+ const inputs = getProfileInputs(route.implementation);
2706
2711
  const numeric = inputs?.find((input) => input.type === "int" && input.required);
2707
2712
  if (numeric?.name === "issue") return "issue";
2708
2713
  if (numeric?.name === "pr") return "pr";
@@ -6497,7 +6502,8 @@ function runIndexRowFromJobContext(input) {
6497
6502
  action: stringValue2(input.data.jobAction) ?? void 0,
6498
6503
  capability: stringValue2(input.data.jobCapability) ?? void 0,
6499
6504
  workflow: workflow ?? void 0,
6500
- executable: stringValue2(input.data.jobExecutable) ?? input.profileName,
6505
+ implementation: stringValue2(input.data.jobImplementation) ?? stringValue2(input.data.jobExecutable) ?? input.profileName,
6506
+ executable: stringValue2(input.data.jobExecutable) ?? stringValue2(input.data.jobImplementation) ?? input.profileName,
6501
6507
  agent: stringValue2(input.data.jobAgent) ?? input.profile.agent ?? void 0,
6502
6508
  model: stringValue2(input.data.jobModel) ?? void 0,
6503
6509
  modelProvider: stringValue2(input.data.jobModelProvider) ?? void 0,
@@ -6546,7 +6552,8 @@ function runIndexRowFromGoalEvents(goalId, logPath, events) {
6546
6552
  actor: stringValue2(trigger?.githubActor) ?? stringValue2(trigger?.actor) ?? void 0,
6547
6553
  action: stringValue2(job?.action) ?? void 0,
6548
6554
  capability: stringValue2(job?.capability) ?? void 0,
6549
- executable: stringValue2(job?.executable) ?? void 0,
6555
+ implementation: stringValue2(job?.implementation) ?? stringValue2(job?.executable) ?? void 0,
6556
+ executable: stringValue2(job?.executable) ?? stringValue2(job?.implementation) ?? void 0,
6550
6557
  agent: stringValue2(job?.agent) ?? void 0,
6551
6558
  model: stringValue2(job?.model) ?? void 0,
6552
6559
  modelProvider: stringValue2(job?.modelProvider) ?? void 0,
@@ -6650,6 +6657,58 @@ var init_runIndex = __esm({
6650
6657
  }
6651
6658
  });
6652
6659
 
6660
+ // src/scripts/evaluateAgencyBoundaries.ts
6661
+ function shouldEvaluateAgencyBoundaries(data, profile) {
6662
+ return Boolean(agencyBoundaryCapabilityKind(data, profile));
6663
+ }
6664
+ function agencyBoundaryCapability(data, profile) {
6665
+ if (typeof data.jobCapability === "string" && data.jobCapability.length > 0) return data.jobCapability;
6666
+ if (typeof data.capabilitySlug === "string" && data.capabilitySlug.length > 0) return data.capabilitySlug;
6667
+ return profile.name;
6668
+ }
6669
+ function agencyBoundaryCapabilityKind(data, profile) {
6670
+ const fromJob = data.jobCapabilityKind;
6671
+ if (fromJob === "observe" || fromJob === "act" || fromJob === "verify") return fromJob;
6672
+ return profile.capabilityKind;
6673
+ }
6674
+ function collectResults(raw, agentResult) {
6675
+ const out = [];
6676
+ if (Array.isArray(raw)) {
6677
+ for (const item of raw) {
6678
+ const parsed = parseCapabilityResult(item);
6679
+ if (parsed) out.push(parsed);
6680
+ }
6681
+ }
6682
+ if (agentResult?.finalText) out.push(...parseCapabilityResultsFromText(agentResult.finalText));
6683
+ return out;
6684
+ }
6685
+ var evaluateAgencyBoundariesScript;
6686
+ var init_evaluateAgencyBoundaries = __esm({
6687
+ "src/scripts/evaluateAgencyBoundaries.ts"() {
6688
+ "use strict";
6689
+ init_agencyBoundaryEval();
6690
+ init_capabilityResult();
6691
+ evaluateAgencyBoundariesScript = async (ctx, profile, agentResult) => {
6692
+ const results = collectResults(ctx.data.capabilityResults ?? ctx.data.dutyResults, agentResult);
6693
+ const capabilityKind = agencyBoundaryCapabilityKind(ctx.data, profile);
6694
+ const capability = agencyBoundaryCapability(ctx.data, profile);
6695
+ const evalResult = evaluateAgencyBoundaries({
6696
+ capability,
6697
+ capabilityKind,
6698
+ results
6699
+ });
6700
+ ctx.data.agencyBoundaryEval = evalResult;
6701
+ process.stdout.write(`KODY_AGENCY_BOUNDARY_EVAL=${JSON.stringify(evalResult)}
6702
+ `);
6703
+ if (evalResult.status === "fail") {
6704
+ const failed = evalResult.findings.filter((finding) => finding.status === "fail").map((finding) => finding.rule);
6705
+ ctx.output.exitCode = ctx.output.exitCode === 0 ? 99 : ctx.output.exitCode;
6706
+ ctx.output.reason = ctx.output.reason ? `${ctx.output.reason}; agency boundary eval failed: ${failed.join(", ")}` : `agency boundary eval failed: ${failed.join(", ")}`;
6707
+ }
6708
+ };
6709
+ }
6710
+ });
6711
+
6653
6712
  // src/pushWithRetry.ts
6654
6713
  import { execFileSync as execFileSync6 } from "child_process";
6655
6714
  function sleepSync2(ms) {
@@ -7238,6 +7297,7 @@ function planManagedGoalTick(goal) {
7238
7297
  evidence: missing,
7239
7298
  stage: step.stage,
7240
7299
  capability: step.capability,
7300
+ implementation: step.implementation ?? step.executable,
7241
7301
  executable: step.executable,
7242
7302
  cliArgs: resolved.cliArgs,
7243
7303
  ...step.saveReport === true ? { saveReport: true } : {}
@@ -7348,6 +7408,7 @@ function asRoute(value) {
7348
7408
  evidence: raw.evidence,
7349
7409
  stage: raw.stage,
7350
7410
  capability: raw.capability,
7411
+ implementation: typeof raw.implementation === "string" ? raw.implementation : typeof raw.executable === "string" ? raw.executable : void 0,
7351
7412
  executable: typeof raw.executable === "string" ? raw.executable : void 0,
7352
7413
  args: args ?? void 0,
7353
7414
  saveReport: raw.saveReport === true,
@@ -7705,6 +7766,7 @@ function capabilityDispatchFromOutput(output) {
7705
7766
  if (!output) return void 0;
7706
7767
  const dispatch2 = pruneUndefined2({
7707
7768
  capability: stringValue3(output.capability) ?? void 0,
7769
+ implementation: stringValue3(output.implementation) ?? stringValue3(output.executable) ?? void 0,
7708
7770
  executable: stringValue3(output.executable) ?? void 0,
7709
7771
  action: stringValue3(output.action) ?? void 0
7710
7772
  });
@@ -7778,7 +7840,17 @@ function triggerContext() {
7778
7840
  pullRequest: numberValue(recordValue3(event?.pull_request)?.number),
7779
7841
  comment: numberValue(recordValue3(event?.comment)?.id),
7780
7842
  schedule: stringValue3(event?.schedule),
7781
- inputs: inputs ? pickRecord(inputs, ["issue_number", "sessionId", "message", "model", "title", "executable", "base"]) : void 0
7843
+ inputs: inputs ? pickRecord(inputs, [
7844
+ "issue_number",
7845
+ "sessionId",
7846
+ "message",
7847
+ "model",
7848
+ "title",
7849
+ "capability",
7850
+ "implementation",
7851
+ "executable",
7852
+ "base"
7853
+ ]) : void 0
7782
7854
  });
7783
7855
  return Object.keys(trigger).length > 0 ? trigger : void 0;
7784
7856
  }
@@ -7801,6 +7873,7 @@ function jobContext(data) {
7801
7873
  flavor: stringValue3(data.jobFlavor) ?? void 0,
7802
7874
  action: stringValue3(data.jobAction) ?? void 0,
7803
7875
  capability: stringValue3(data.jobCapability) ?? void 0,
7876
+ implementation: stringValue3(data.jobImplementation) ?? stringValue3(data.jobExecutable) ?? void 0,
7804
7877
  executable: stringValue3(data.jobExecutable) ?? void 0,
7805
7878
  agent: stringValue3(data.jobAgent) ?? void 0,
7806
7879
  schedule: stringValue3(data.jobSchedule) ?? void 0,
@@ -7828,6 +7901,7 @@ function dispatchContext(event, trigger, job) {
7828
7901
  target: event.target,
7829
7902
  action: dispatch2.action ?? stringValue3(job?.action),
7830
7903
  capability: dispatch2.capability ?? stringValue3(job?.capability),
7904
+ implementation: dispatch2.implementation ?? stringValue3(job?.implementation),
7831
7905
  reason: event.reason
7832
7906
  });
7833
7907
  return Object.keys(context).length > 0 ? context : void 0;
@@ -7875,6 +7949,7 @@ function routeStepForLog(step) {
7875
7949
  evidence: step.evidence,
7876
7950
  stage: step.stage,
7877
7951
  capability: step.capability,
7952
+ implementation: step.implementation ?? step.executable,
7878
7953
  executable: step.executable,
7879
7954
  args: step.args,
7880
7955
  saveReport: step.saveReport === true ? true : void 0
@@ -7948,8 +8023,8 @@ var LOGS_KEY, LOG_RUN_KEY, LOG_STARTED_KEY;
7948
8023
  var init_runLog = __esm({
7949
8024
  "src/goal/runLog.ts"() {
7950
8025
  "use strict";
7951
- init_stateRepo();
7952
8026
  init_runIndex();
8027
+ init_stateRepo();
7953
8028
  init_state2();
7954
8029
  LOGS_KEY = "__goalRunLogs";
7955
8030
  LOG_RUN_KEY = "__goalRunLogRunId";
@@ -8392,6 +8467,7 @@ function cloneRoute(route) {
8392
8467
  stage: step.stage,
8393
8468
  evidence: step.evidence,
8394
8469
  capability: step.capability,
8470
+ ...step.implementation ? { implementation: step.implementation } : step.executable ? { implementation: step.executable } : {},
8395
8471
  ...step.executable ? { executable: step.executable } : {},
8396
8472
  ...step.args ? { args: structuredClone(step.args) } : {}
8397
8473
  }));
@@ -8411,6 +8487,7 @@ function routeArray(value) {
8411
8487
  stage: raw.stage,
8412
8488
  evidence: raw.evidence,
8413
8489
  capability: raw.capability,
8490
+ implementation: typeof raw.implementation === "string" ? raw.implementation : typeof raw.executable === "string" ? raw.executable : void 0,
8414
8491
  executable: typeof raw.executable === "string" ? raw.executable : void 0,
8415
8492
  args: raw.args && typeof raw.args === "object" && !Array.isArray(raw.args) ? { ...raw.args } : void 0
8416
8493
  });
@@ -8458,9 +8535,21 @@ var init_typeDefinitions = __esm({
8458
8535
  evidence: ["planReady", "changeImplemented", "changeVerified"],
8459
8536
  capabilities: ["plan", "fix", "review"],
8460
8537
  route: [
8461
- { stage: "plan", evidence: "planReady", capability: "plan", executable: "plan" },
8462
- { stage: "implement", evidence: "changeImplemented", capability: "fix", executable: "fix" },
8463
- { stage: "review", evidence: "changeVerified", capability: "review", executable: "review" }
8538
+ { stage: "plan", evidence: "planReady", capability: "plan", implementation: "plan", executable: "plan" },
8539
+ {
8540
+ stage: "implement",
8541
+ evidence: "changeImplemented",
8542
+ capability: "fix",
8543
+ implementation: "fix",
8544
+ executable: "fix"
8545
+ },
8546
+ {
8547
+ stage: "review",
8548
+ evidence: "changeVerified",
8549
+ capability: "review",
8550
+ implementation: "review",
8551
+ executable: "review"
8552
+ }
8464
8553
  ]
8465
8554
  },
8466
8555
  maintain: {
@@ -8492,6 +8581,7 @@ var init_typeDefinitions = __esm({
8492
8581
  stage: "release",
8493
8582
  evidence: "releasePrExists",
8494
8583
  capability: "release",
8584
+ implementation: "release-prepare",
8495
8585
  executable: "release-prepare",
8496
8586
  args: { issue: { fact: "issue" }, goal: { fact: "goalId" } }
8497
8587
  },
@@ -8499,6 +8589,7 @@ var init_typeDefinitions = __esm({
8499
8589
  stage: "merge",
8500
8590
  evidence: "mainMerged",
8501
8591
  capability: "release-merge",
8592
+ implementation: "release-merge",
8502
8593
  executable: "release-merge",
8503
8594
  args: { pr: { fact: "releasePr" }, issue: { fact: "issue" }, goal: { fact: "goalId" } }
8504
8595
  },
@@ -8506,6 +8597,7 @@ var init_typeDefinitions = __esm({
8506
8597
  stage: "publish",
8507
8598
  evidence: "productionDeployed",
8508
8599
  capability: "vercel-production-deploy",
8600
+ implementation: "vercel-production-deploy",
8509
8601
  executable: "vercel-production-deploy"
8510
8602
  }
8511
8603
  ]
@@ -8519,6 +8611,7 @@ var init_typeDefinitions = __esm({
8519
8611
  stage: "verify",
8520
8612
  evidence: "checklistComplete",
8521
8613
  capability: "task-verifier",
8614
+ implementation: "task-verifier",
8522
8615
  executable: "task-verifier"
8523
8616
  }
8524
8617
  ]
@@ -10668,7 +10761,7 @@ function collectReports(raw, agentResult) {
10668
10761
  if (agentResult?.finalText) out.push(...parseCapabilityReportsFromText(agentResult.finalText));
10669
10762
  return out;
10670
10763
  }
10671
- function collectResults(raw, agentResult) {
10764
+ function collectResults2(raw, agentResult) {
10672
10765
  const out = [];
10673
10766
  if (Array.isArray(raw)) {
10674
10767
  for (const item of raw) {
@@ -10793,7 +10886,7 @@ var init_applyCapabilityReports = __esm({
10793
10886
  init_issue();
10794
10887
  applyCapabilityReports = async (ctx, _profile, agentResult) => {
10795
10888
  const reports = collectReports(ctx.data.capabilityReports, agentResult);
10796
- const results = collectResults(ctx.data.capabilityResults ?? ctx.data.dutyResults, agentResult);
10889
+ const results = collectResults2(ctx.data.capabilityResults ?? ctx.data.dutyResults, agentResult);
10797
10890
  const resultTarget = parseResultTarget(ctx.data.capabilityResultTarget);
10798
10891
  const resultGoalId = resultTarget?.id ?? (typeof ctx.args.goal === "string" && ctx.args.goal.length > 0 ? ctx.args.goal : null);
10799
10892
  const explicitEvidence = resultTarget?.evidence ?? (typeof ctx.args.evidence === "string" && ctx.args.evidence.length > 0 ? ctx.args.evidence : void 0);
@@ -13094,58 +13187,6 @@ var init_ensurePr = __esm({
13094
13187
  }
13095
13188
  });
13096
13189
 
13097
- // src/scripts/evaluateAgencyBoundaries.ts
13098
- function shouldEvaluateAgencyBoundaries(data, profile) {
13099
- return Boolean(agencyBoundaryCapabilityKind(data, profile));
13100
- }
13101
- function agencyBoundaryCapability(data, profile) {
13102
- if (typeof data.jobCapability === "string" && data.jobCapability.length > 0) return data.jobCapability;
13103
- if (typeof data.capabilitySlug === "string" && data.capabilitySlug.length > 0) return data.capabilitySlug;
13104
- return profile.name;
13105
- }
13106
- function agencyBoundaryCapabilityKind(data, profile) {
13107
- const fromJob = data.jobCapabilityKind;
13108
- if (fromJob === "observe" || fromJob === "act" || fromJob === "verify") return fromJob;
13109
- return profile.capabilityKind;
13110
- }
13111
- function collectResults2(raw, agentResult) {
13112
- const out = [];
13113
- if (Array.isArray(raw)) {
13114
- for (const item of raw) {
13115
- const parsed = parseCapabilityResult(item);
13116
- if (parsed) out.push(parsed);
13117
- }
13118
- }
13119
- if (agentResult?.finalText) out.push(...parseCapabilityResultsFromText(agentResult.finalText));
13120
- return out;
13121
- }
13122
- var evaluateAgencyBoundariesScript;
13123
- var init_evaluateAgencyBoundaries = __esm({
13124
- "src/scripts/evaluateAgencyBoundaries.ts"() {
13125
- "use strict";
13126
- init_agencyBoundaryEval();
13127
- init_capabilityResult();
13128
- evaluateAgencyBoundariesScript = async (ctx, profile, agentResult) => {
13129
- const results = collectResults2(ctx.data.capabilityResults ?? ctx.data.dutyResults, agentResult);
13130
- const capabilityKind = agencyBoundaryCapabilityKind(ctx.data, profile);
13131
- const capability = agencyBoundaryCapability(ctx.data, profile);
13132
- const evalResult = evaluateAgencyBoundaries({
13133
- capability,
13134
- capabilityKind,
13135
- results
13136
- });
13137
- ctx.data.agencyBoundaryEval = evalResult;
13138
- process.stdout.write(`KODY_AGENCY_BOUNDARY_EVAL=${JSON.stringify(evalResult)}
13139
- `);
13140
- if (evalResult.status === "fail") {
13141
- const failed = evalResult.findings.filter((finding) => finding.status === "fail").map((finding) => finding.rule);
13142
- ctx.output.exitCode = ctx.output.exitCode === 0 ? 99 : ctx.output.exitCode;
13143
- ctx.output.reason = ctx.output.reason ? `${ctx.output.reason}; agency boundary eval failed: ${failed.join(", ")}` : `agency boundary eval failed: ${failed.join(", ")}`;
13144
- }
13145
- };
13146
- }
13147
- });
13148
-
13149
13190
  // src/scripts/failOnceTaskJob.ts
13150
13191
  var failOnceTaskJob;
13151
13192
  var init_failOnceTaskJob = __esm({
@@ -19681,10 +19722,12 @@ function jobReferenceBlock(profileName, profile, data) {
19681
19722
  const jobId = typeof data.jobId === "string" && data.jobId.length > 0 ? data.jobId : null;
19682
19723
  const flavor = typeof data.jobFlavor === "string" && data.jobFlavor.length > 0 ? data.jobFlavor : null;
19683
19724
  const schedule = typeof data.jobSchedule === "string" && data.jobSchedule.length > 0 ? data.jobSchedule : null;
19684
- const isJob2 = Boolean(jobId || flavor || schedule || data.jobCapability || data.jobExecutable || data.jobWhy);
19725
+ const isJob2 = Boolean(
19726
+ jobId || flavor || schedule || data.jobCapability || data.jobImplementation || data.jobExecutable || data.jobWhy
19727
+ );
19685
19728
  if (!isJob2) return null;
19686
19729
  const capability = typeof data.jobCapability === "string" && data.jobCapability.length > 0 ? data.jobCapability : profile.executable ? profile.name : null;
19687
- const executable = typeof profile.executable === "string" && profile.executable.length > 0 ? profile.executable : typeof data.jobExecutable === "string" && data.jobExecutable.length > 0 ? data.jobExecutable : profileName;
19730
+ const implementation = typeof profile.implementation === "string" && profile.implementation.length > 0 ? profile.implementation : typeof profile.executable === "string" && profile.executable.length > 0 ? profile.executable : typeof data.jobImplementation === "string" && data.jobImplementation.length > 0 ? data.jobImplementation : typeof data.jobExecutable === "string" && data.jobExecutable.length > 0 ? data.jobExecutable : profileName;
19688
19731
  const agent = typeof profile.agent === "string" && profile.agent.length > 0 ? profile.agent : typeof data.jobAgent === "string" && data.jobAgent.length > 0 ? data.jobAgent : null;
19689
19732
  const description = profile.describe.trim();
19690
19733
  const workflow = typeof data.workflowCapability === "string" && data.workflowCapability.length > 0 ? data.workflowCapability : null;
@@ -19700,7 +19743,7 @@ function jobReferenceBlock(profileName, profile, data) {
19700
19743
  `- Flavor: ${flavor ?? "(unavailable)"}`,
19701
19744
  ...schedule ? [`- Schedule: ${schedule}`] : [],
19702
19745
  `- Capability: ${capability ?? "(none)"}`,
19703
- `- Executable: ${executable}`,
19746
+ `- Implementation: ${implementation}`,
19704
19747
  `- Agent: ${agent ?? "(none)"}`,
19705
19748
  `- Description: ${description || "(none)"}`,
19706
19749
  ...workflow ? [`- Workflow: ${workflow}`] : [],
@@ -20259,6 +20302,7 @@ function handoffToJob(handoff) {
20259
20302
  action: handoff.action ?? handoff.capability,
20260
20303
  capability: handoff.capability,
20261
20304
  workflow: handoff.workflow,
20305
+ implementation: handoff.implementation ?? handoff.executable,
20262
20306
  executable: handoff.executable,
20263
20307
  cliArgs: handoff.cliArgs,
20264
20308
  flavor: "instant",
@@ -20541,10 +20585,10 @@ var init_executor = __esm({
20541
20585
  init_registry();
20542
20586
  init_runIndex();
20543
20587
  init_runtimePaths();
20588
+ init_evaluateAgencyBoundaries();
20544
20589
  init_scripts();
20545
20590
  init_stateWorkspace();
20546
20591
  init_subagents();
20547
- init_evaluateAgencyBoundaries();
20548
20592
  init_task_artifacts();
20549
20593
  init_tools();
20550
20594
  MUTATING_POSTFLIGHTS = /* @__PURE__ */ new Set([
@@ -20689,7 +20733,8 @@ function validateJob(input) {
20689
20733
  }
20690
20734
  return {
20691
20735
  action: typeof j.action === "string" ? j.action : void 0,
20692
- executable: typeof j.executable === "string" ? j.executable : void 0,
20736
+ implementation: typeof j.implementation === "string" ? j.implementation : typeof j.executable === "string" ? j.executable : void 0,
20737
+ executable: typeof j.executable === "string" ? j.executable : typeof j.implementation === "string" ? j.implementation : void 0,
20693
20738
  capability: typeof j.capability === "string" ? j.capability : void 0,
20694
20739
  workflow: typeof j.workflow === "string" ? j.workflow : void 0,
20695
20740
  why: typeof j.why === "string" ? j.why : void 0,
@@ -20723,17 +20768,18 @@ async function runJob(job, base) {
20723
20768
  const capabilityIdentity = valid.capability ?? resolvedCapability?.capability;
20724
20769
  const capabilityContext = valid.workflow ? null : loadCapabilityContext(capabilityIdentity, base.cwd);
20725
20770
  const workflowContext = valid.workflow ? loadWorkflowContext(valid.workflow, base) : !capabilityContext && !resolvedCapability ? loadWorkflowContext(capabilityIdentity ?? action, base) : null;
20726
- const explicitExecutableOnly = valid.executable !== void 0 && (valid.action === void 0 || valid.action === valid.executable) && (valid.capability === void 0 || valid.capability === valid.executable);
20727
- if (!resolvedCapability && !capabilityContext && !workflowContext && !explicitExecutableOnly) {
20771
+ const explicitImplementation = valid.implementation ?? valid.executable;
20772
+ const explicitImplementationOnly = explicitImplementation !== void 0 && (valid.action === void 0 || valid.action === explicitImplementation) && (valid.capability === void 0 || valid.capability === explicitImplementation);
20773
+ if (!resolvedCapability && !capabilityContext && !workflowContext && !explicitImplementationOnly) {
20728
20774
  throw new InvalidJobError(
20729
20775
  `job capability/workflow not found: ${valid.workflow ?? action ?? valid.capability ?? "<none>"}`
20730
20776
  );
20731
20777
  }
20732
20778
  const workflow = capabilityContext?.config.workflow ?? workflowContext?.config.workflow;
20733
20779
  const workflowIdentity = valid.workflow ?? capabilityIdentity ?? workflowContext?.slug;
20734
- const capabilitySelectedExecutable = resolvedCapability?.executable ?? capabilityContext?.config.implementation ?? capabilityContext?.config.executable ?? capabilityContext?.config.executables?.[0] ?? (capabilityContext?.config.role ? capabilityContext.slug : void 0) ?? (capabilityContext?.config.tickScript ? "capability-tick-scripted" : void 0);
20735
- const profileName = valid.executable ?? capabilitySelectedExecutable;
20736
- if (workflow && shouldRunCapabilityWorkflow(valid, workflow, workflowIdentity, capabilitySelectedExecutable, base)) {
20780
+ const capabilitySelectedImplementation = resolvedCapability?.implementation ?? capabilityContext?.config.implementation ?? capabilityContext?.config.executable ?? capabilityContext?.config.implementations?.[0] ?? capabilityContext?.config.executables?.[0] ?? (capabilityContext?.config.role ? capabilityContext.slug : void 0) ?? (capabilityContext?.config.tickScript ? "capability-tick-scripted" : void 0);
20781
+ const profileName = explicitImplementation ?? capabilitySelectedImplementation;
20782
+ if (workflow && shouldRunCapabilityWorkflow(valid, workflow, workflowIdentity, capabilitySelectedImplementation, base)) {
20737
20783
  const workflowCapability = capabilityContext ?? workflowContext;
20738
20784
  const workflowJob = workflowContext && !valid.why ? { ...valid, why: workflowContext.body } : valid;
20739
20785
  return runCapabilityWorkflow(workflowJob, workflow, workflowCapability, base);
@@ -20769,6 +20815,7 @@ async function runCapabilityImplementationStep(valid, profileName, capabilityIde
20769
20815
  if (valid.action !== void 0 && valid.action.length > 0) preloadedData.jobAction = valid.action;
20770
20816
  if (capabilityIdentity !== void 0 && capabilityIdentity.length > 0)
20771
20817
  preloadedData.jobCapability = capabilityIdentity;
20818
+ preloadedData.jobImplementation = profileName;
20772
20819
  preloadedData.jobExecutable = profileName;
20773
20820
  if (valid.schedule !== void 0 && valid.schedule.length > 0) preloadedData.jobSchedule = valid.schedule;
20774
20821
  if (valid.saveReport === true) preloadedData.jobSaveReport = true;
@@ -20776,7 +20823,8 @@ async function runCapabilityImplementationStep(valid, profileName, capabilityIde
20776
20823
  if (capabilityContext) {
20777
20824
  preloadedData.capabilitySlug = capabilityContext.slug;
20778
20825
  preloadedData.capabilityTitle = capabilityContext.title;
20779
- if (capabilityContext.config.capabilityKind) preloadedData.jobCapabilityKind = capabilityContext.config.capabilityKind;
20826
+ if (capabilityContext.config.capabilityKind)
20827
+ preloadedData.jobCapabilityKind = capabilityContext.config.capabilityKind;
20780
20828
  preloadedData.capabilityIntent = capabilityContext.body;
20781
20829
  preloadedData.dutyIntent = capabilityContext.body;
20782
20830
  preloadedData.jobIntent = capabilityContext.body;
@@ -20799,7 +20847,7 @@ async function runCapabilityImplementationStep(valid, profileName, capabilityIde
20799
20847
  quiet: base.quiet,
20800
20848
  preloadedData: Object.keys(preloadedData).length > 0 ? preloadedData : void 0
20801
20849
  };
20802
- const shouldApplyResolvedCapabilityArgs = valid.executable === void 0 && resolvedCapability && profileName === resolvedCapability.executable;
20850
+ const shouldApplyResolvedCapabilityArgs = valid.implementation === void 0 && valid.executable === void 0 && resolvedCapability && profileName === resolvedCapability.implementation;
20803
20851
  input.cliArgs = shouldApplyResolvedCapabilityArgs ? { ...resolvedCapability.cliArgs, ...input.cliArgs } : input.cliArgs;
20804
20852
  const run = base.chain === false ? runExecutable : runExecutableChain;
20805
20853
  return run(profileName, input);
@@ -20809,8 +20857,9 @@ function shouldRunCapabilityWorkflow(job, workflow, capabilityIdentity, selected
20809
20857
  if (!capabilityIdentity) return false;
20810
20858
  const stack = Array.isArray(base.preloadedData?.workflowStack) ? base.preloadedData.workflowStack.filter((entry) => typeof entry === "string") : [];
20811
20859
  if (stack.includes(capabilityIdentity)) return false;
20812
- if (!job.executable) return true;
20813
- return job.executable === selectedExecutable || job.executable === capabilityIdentity || job.executable === job.action;
20860
+ const requestedImplementation = job.implementation ?? job.executable;
20861
+ if (!requestedImplementation) return true;
20862
+ return requestedImplementation === selectedExecutable || requestedImplementation === capabilityIdentity || requestedImplementation === job.action;
20814
20863
  }
20815
20864
  async function runCapabilityWorkflow(parent, workflow, capability, base) {
20816
20865
  let chainData = {
@@ -20912,6 +20961,7 @@ function workflowStepToJob(step, parent, chainData) {
20912
20961
  return {
20913
20962
  action,
20914
20963
  capability: step.capability,
20964
+ ...step.implementation ? { implementation: step.implementation } : {},
20915
20965
  ...step.executable ? { executable: step.executable } : {},
20916
20966
  ...composeStepWhy(parent.why, step) ? { why: composeStepWhy(parent.why, step) } : {},
20917
20967
  ...step.agent ?? parent.agent ? { agent: step.agent ?? parent.agent } : {},
@@ -21007,6 +21057,7 @@ function loadWorkflowContext(slug2, base) {
21007
21057
  function mintInstantJob(dispatch2, opts) {
21008
21058
  return {
21009
21059
  action: dispatch2.action,
21060
+ implementation: dispatch2.implementation ?? dispatch2.executable,
21010
21061
  executable: dispatch2.executable,
21011
21062
  capability: dispatch2.capability,
21012
21063
  why: opts?.why ?? dispatch2.why,
@@ -21020,6 +21071,7 @@ function mintScheduledJob(input) {
21020
21071
  return {
21021
21072
  action: input.action,
21022
21073
  capability: input.capability,
21074
+ implementation: input.implementation ?? input.executable,
21023
21075
  executable: input.executable,
21024
21076
  schedule: input.schedule,
21025
21077
  agent: input.agent,
@@ -22001,6 +22053,7 @@ function routeResult(route, cliArgs, target, why) {
22001
22053
  const result = {
22002
22054
  action: route.action,
22003
22055
  capability: route.capability,
22056
+ implementation: route.implementation,
22004
22057
  executable: route.executable,
22005
22058
  cliArgs: { ...route.cliArgs, ...cliArgs },
22006
22059
  target
@@ -22030,7 +22083,7 @@ function autoDispatch(opts) {
22030
22083
  const route2 = resolveConfiguredAction(actionName);
22031
22084
  if (!route2) return null;
22032
22085
  const base = String(inputs2?.base ?? "").trim();
22033
- const targetKey = primaryNumericInputName(route2.executable) ?? "issue";
22086
+ const targetKey = primaryNumericInputName(route2.implementation) ?? "issue";
22034
22087
  const cliArgs = { [targetKey]: n };
22035
22088
  if (base) cliArgs.base = base;
22036
22089
  return routeResult(route2, cliArgs, n);
@@ -22048,7 +22101,7 @@ function autoDispatch(opts) {
22048
22101
  if (!route2) return null;
22049
22102
  const prNum = Number(pullRequest?.number ?? event.number ?? 0);
22050
22103
  if (prNum > 0) {
22051
- const targetKey = primaryNumericInputName(route2.executable) ?? "pr";
22104
+ const targetKey = primaryNumericInputName(route2.implementation) ?? "pr";
22052
22105
  return routeResult(route2, { [targetKey]: prNum }, prNum);
22053
22106
  }
22054
22107
  }
@@ -22113,7 +22166,7 @@ function autoDispatch(opts) {
22113
22166
  );
22114
22167
  return null;
22115
22168
  }
22116
- const inputs = getProfileInputs(route.executable);
22169
+ const inputs = getProfileInputs(route.implementation);
22117
22170
  const effectiveInputs = inputs ?? [];
22118
22171
  const unknownProfile = inputs === null;
22119
22172
  const rest = extractCommentRest(afterTag, consumedFirstToken ? firstToken : null);
@@ -22230,6 +22283,7 @@ function dispatchScheduledWatches(opts) {
22230
22283
  route ? { ...route, cliArgs: route.cliArgs, target: 0 } : {
22231
22284
  action: exe.name,
22232
22285
  capability: exe.name,
22286
+ implementation: exe.name,
22233
22287
  executable: exe.name,
22234
22288
  cliArgs: {},
22235
22289
  target: 0
@@ -22585,7 +22639,7 @@ function detectPackageManager2(cwd) {
22585
22639
  return "npm";
22586
22640
  }
22587
22641
  function shouldChainScheduledWatch(match) {
22588
- return match.action === "goal-scheduler" || match.capability === "goal-scheduler" || match.executable === "goal-scheduler";
22642
+ return match.action === "goal-scheduler" || match.capability === "goal-scheduler" || match.implementation === "goal-scheduler" || match.executable === "goal-scheduler";
22589
22643
  }
22590
22644
  function shellOut(cmd, args, cwd, stream = true) {
22591
22645
  try {
@@ -22793,11 +22847,12 @@ async function runCi(argv) {
22793
22847
  cliArgs: {}
22794
22848
  };
22795
22849
  const scheduledWatchRoute = manualGoalManager || capabilityRoute || workflowRoute ? void 0 : dispatchScheduledWatches({ force: true }).find(
22796
- (match) => match.action === forceRunAction || match.executable === forceRunAction
22850
+ (match) => match.action === forceRunAction || match.capability === forceRunAction || match.implementation === forceRunAction || match.executable === forceRunAction
22797
22851
  );
22798
22852
  const route = manualGoalManager ? {
22799
22853
  action: "goal-manager",
22800
22854
  capability: "goal-manager",
22855
+ implementation: "goal-manager",
22801
22856
  executable: "goal-manager",
22802
22857
  cliArgs: forceRunCliArgs
22803
22858
  } : capabilityRoute ?? workflowRoute ?? scheduledWatchRoute;
@@ -22848,6 +22903,7 @@ async function runCi(argv) {
22848
22903
  action: route.action,
22849
22904
  capability: route.capability,
22850
22905
  workflow: route.workflow,
22906
+ implementation: route.implementation ?? route.executable,
22851
22907
  executable: route.executable,
22852
22908
  cliArgs: { ...route.cliArgs, ...forceRunCliArgs },
22853
22909
  flavor: "instant",
@@ -22965,7 +23021,7 @@ ${CI_HELP}`);
22965
23021
  };
22966
23022
  const issueNumber = dispatch2.target;
22967
23023
  process.stdout.write(
22968
- `\u2192 kody preflight (cwd=${cwd}, action=${dispatch2.action}, capability=${dispatch2.capability}, executable=${dispatch2.executable}, target=${issueNumber})
23024
+ `\u2192 kody preflight (cwd=${cwd}, action=${dispatch2.action}, capability=${dispatch2.capability}, implementation=${dispatch2.implementation}, target=${issueNumber})
22969
23025
  `
22970
23026
  );
22971
23027
  try {
@@ -22977,7 +23033,7 @@ ${CI_HELP}`);
22977
23033
  const pm = args.packageManager ?? detectPackageManager2(cwd);
22978
23034
  process.stdout.write(`\u2192 kody: package manager = ${pm}
22979
23035
  `);
22980
- const buildOnly = dispatch2.executable === "preview-build";
23036
+ const buildOnly = dispatch2.implementation === "preview-build" || dispatch2.executable === "preview-build";
22981
23037
  if (args.skipInstall || buildOnly) {
22982
23038
  process.stdout.write(`\u2192 kody: skipping dep install (${buildOnly ? "build-only executable" : "--skip-install"})
22983
23039
  `);
@@ -23008,7 +23064,7 @@ ${CI_HELP}`);
23008
23064
  postFailureTail(issueNumber, cwd, `preflight crashed: ${msg}`);
23009
23065
  return 99;
23010
23066
  }
23011
- process.stdout.write(`\u2192 kody: preflight done, handing off to kody ${dispatch2.executable}
23067
+ process.stdout.write(`\u2192 kody: preflight done, handing off to kody ${dispatch2.implementation}
23012
23068
 
23013
23069
  `);
23014
23070
  try {
@@ -23042,7 +23098,7 @@ async function runScheduledFanOut(cwd, args, opts) {
23042
23098
  );
23043
23099
  return 0;
23044
23100
  }
23045
- const names = matches.map((m) => `${m.capability}\u2192${m.executable}`).join(", ");
23101
+ const names = matches.map((m) => `${m.capability}\u2192${m.implementation}`).join(", ");
23046
23102
  process.stdout.write(`\u2192 kody: scheduled wake \u2014 firing ${matches.length} watch capability/ies: ${names}
23047
23103
  `);
23048
23104
  try {
@@ -23080,13 +23136,14 @@ async function runScheduledFanOut(cwd, args, opts) {
23080
23136
  const serial = process.env.KODY_SERIAL_WATCHES === "1";
23081
23137
  const runWatch = async (match) => {
23082
23138
  process.stdout.write(`
23083
- \u2192 kody: running watch capability \`${match.capability}\` (${match.executable})
23139
+ \u2192 kody: running watch capability \`${match.capability}\` (${match.implementation})
23084
23140
  `);
23085
23141
  try {
23086
23142
  const result = await runJob(
23087
23143
  mintScheduledJob({
23088
23144
  action: match.action,
23089
23145
  capability: match.capability,
23146
+ implementation: match.implementation,
23090
23147
  executable: match.executable,
23091
23148
  cliArgs: match.cliArgs
23092
23149
  }),
@@ -26333,12 +26390,13 @@ ${HELP_TEXT}`);
26333
26390
  return 64;
26334
26391
  }
26335
26392
  const cliArgs = { ...route.cliArgs, ...args.cliArgs ?? {} };
26336
- const skipConfig = configlessCommands.has(route.executable);
26393
+ const skipConfig = configlessCommands.has(route.implementation);
26337
26394
  try {
26338
26395
  const result = await runJob(
26339
26396
  {
26340
26397
  action: route.action,
26341
26398
  capability: route.capability,
26399
+ implementation: route.implementation,
26342
26400
  executable: route.executable,
26343
26401
  cliArgs,
26344
26402
  target: numericTarget(cliArgs),
@@ -26376,6 +26434,7 @@ ${HELP_TEXT}`);
26376
26434
  {
26377
26435
  action: executable,
26378
26436
  capability: executable,
26437
+ implementation: executable,
26379
26438
  executable,
26380
26439
  cliArgs,
26381
26440
  target: numericTarget(cliArgs),
@@ -439,6 +439,7 @@ export interface Context {
439
439
  action?: string
440
440
  capability?: string
441
441
  workflow?: string
442
+ implementation?: string
442
443
  executable?: string
443
444
  cliArgs: Record<string, unknown>
444
445
  saveReport?: boolean
@@ -451,6 +452,7 @@ export interface Context {
451
452
  action?: string
452
453
  capability?: string
453
454
  workflow?: string
455
+ implementation?: string
454
456
  executable?: string
455
457
  cliArgs: Record<string, unknown>
456
458
  saveReport?: boolean
@@ -505,6 +507,8 @@ export interface Job {
505
507
  /** Public action the user/operator invoked. Mirrors the capability action. */
506
508
  action?: string
507
509
  /** How: implementation profile selected by the capability. Not valid by itself. */
510
+ implementation?: string
511
+ /** Legacy compatibility copy of `implementation`. */
508
512
  executable?: string
509
513
  /** Why (referenced): a capability slug whose intent drives the run. */
510
514
  capability?: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.335",
3
+ "version": "0.4.336",
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",