@kody-ade/kody-engine 0.4.335 → 0.4.337
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 +179 -112
- package/dist/executables/types.ts +4 -0
- package/package.json +1 -1
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.
|
|
18
|
+
version: "0.4.337",
|
|
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
|
|
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
|
-
...
|
|
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.
|
|
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
|
-
|
|
2299
|
+
const implementation2 = firstWorkflowStep.implementation ?? firstWorkflowStep.executable ?? firstWorkflowStep.capability;
|
|
2300
|
+
return { implementation: implementation2, executable: implementation2, cliArgs: {} };
|
|
2298
2301
|
}
|
|
2299
|
-
const
|
|
2300
|
-
const cliArgs = executableDeclaresInput(
|
|
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,
|
|
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
|
|
2380
|
+
const implementation = capability.config.implementation ?? capability.config.executable ?? slug2;
|
|
2377
2381
|
out.push({
|
|
2378
2382
|
action,
|
|
2379
2383
|
capability: slug2,
|
|
2380
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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, [
|
|
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
|
-
{
|
|
8463
|
-
|
|
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
|
|
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 =
|
|
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({
|
|
@@ -15349,10 +15390,10 @@ function parseAgentFactoryBundle(raw) {
|
|
|
15349
15390
|
modelCreatorContractsUsed: value.modelCreatorContractsUsed
|
|
15350
15391
|
};
|
|
15351
15392
|
}
|
|
15352
|
-
function
|
|
15393
|
+
function buildStatePrBranchName(sourceLabel, issueNumber, title, now = Date.now()) {
|
|
15353
15394
|
const slug2 = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48).replace(/-+$/g, "");
|
|
15354
15395
|
const suffix = slug2 ? `-${slug2}` : "";
|
|
15355
|
-
return
|
|
15396
|
+
return `${sourceLabel}/issue-${issueNumber}-${now.toString(36)}${suffix}`;
|
|
15356
15397
|
}
|
|
15357
15398
|
function normalizeBundleFiles(ctx, bundle) {
|
|
15358
15399
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -15408,6 +15449,13 @@ function requireString2(value, label) {
|
|
|
15408
15449
|
}
|
|
15409
15450
|
return value;
|
|
15410
15451
|
}
|
|
15452
|
+
function creatorSourceLabel(ctx, profileName) {
|
|
15453
|
+
const capability = typeof ctx.data.jobCapability === "string" ? ctx.data.jobCapability.trim() : "";
|
|
15454
|
+
const implementation = typeof ctx.data.jobImplementation === "string" ? ctx.data.jobImplementation.trim() : "";
|
|
15455
|
+
const executable = typeof ctx.data.jobExecutable === "string" ? ctx.data.jobExecutable.trim() : "";
|
|
15456
|
+
const profile = typeof profileName === "string" ? profileName.trim() : "";
|
|
15457
|
+
return capability || implementation || executable || profile || "agent-factory";
|
|
15458
|
+
}
|
|
15411
15459
|
function ghJson(args, cwd, input) {
|
|
15412
15460
|
const raw = gh(args, input === void 0 ? { cwd } : { cwd, input: JSON.stringify(input) });
|
|
15413
15461
|
if (!raw) return {};
|
|
@@ -15419,10 +15467,10 @@ function ghJson(args, cwd, input) {
|
|
|
15419
15467
|
);
|
|
15420
15468
|
}
|
|
15421
15469
|
}
|
|
15422
|
-
function renderPullRequestBody(ctx, bundle, files) {
|
|
15470
|
+
function renderPullRequestBody(ctx, bundle, files, sourceLabel) {
|
|
15423
15471
|
const issueNumber = readIssueNumber(ctx);
|
|
15424
15472
|
return [
|
|
15425
|
-
|
|
15473
|
+
`${sourceLabel} generated Kody agency model changes for review.`,
|
|
15426
15474
|
"",
|
|
15427
15475
|
`Source issue: ${ctx.config.github.owner}/${ctx.config.github.repo}#${issueNumber}`,
|
|
15428
15476
|
"",
|
|
@@ -15437,9 +15485,9 @@ function renderPullRequestBody(ctx, bundle, files) {
|
|
|
15437
15485
|
"Generated definitions are inactive until this state-repo PR is reviewed and merged."
|
|
15438
15486
|
].join("\n");
|
|
15439
15487
|
}
|
|
15440
|
-
function renderIssueComment(owner, repo, prUrl, bundle) {
|
|
15488
|
+
function renderIssueComment(owner, repo, prUrl, bundle, sourceLabel) {
|
|
15441
15489
|
return [
|
|
15442
|
-
|
|
15490
|
+
`${sourceLabel} opened a state-repo review PR: ${prUrl}`,
|
|
15443
15491
|
"",
|
|
15444
15492
|
`State repo: ${owner}/${repo}`,
|
|
15445
15493
|
"",
|
|
@@ -15453,7 +15501,7 @@ var init_openAgentFactoryStatePr = __esm({
|
|
|
15453
15501
|
"use strict";
|
|
15454
15502
|
init_issue();
|
|
15455
15503
|
init_stateRepo();
|
|
15456
|
-
openAgentFactoryStatePr = async (ctx,
|
|
15504
|
+
openAgentFactoryStatePr = async (ctx, profile, agentResult) => {
|
|
15457
15505
|
if (agentResult?.outcome !== "completed") {
|
|
15458
15506
|
throw new Error(`openAgentFactoryStatePr: agent did not complete: ${agentResult?.error ?? "unknown failure"}`);
|
|
15459
15507
|
}
|
|
@@ -15464,11 +15512,12 @@ var init_openAgentFactoryStatePr = __esm({
|
|
|
15464
15512
|
throw new Error("openAgentFactoryStatePr: config.state.repo and config.state.path are required");
|
|
15465
15513
|
}
|
|
15466
15514
|
const issueNumber = readIssueNumber(ctx);
|
|
15515
|
+
const sourceLabel = creatorSourceLabel(ctx, profile.name);
|
|
15467
15516
|
const bundle = parseAgentFactoryBundle(String(ctx.data.prSummary ?? ""));
|
|
15468
15517
|
const normalizedFiles = normalizeBundleFiles(ctx, bundle);
|
|
15469
15518
|
const stateRepo = parseStateRepo(ctx.config);
|
|
15470
15519
|
const baseBranch = "main";
|
|
15471
|
-
const branch =
|
|
15520
|
+
const branch = buildStatePrBranchName(sourceLabel, issueNumber, bundle.title);
|
|
15472
15521
|
const baseRef = ghJson(
|
|
15473
15522
|
["api", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/ref/heads/${baseBranch}`],
|
|
15474
15523
|
ctx.cwd
|
|
@@ -15507,7 +15556,7 @@ var init_openAgentFactoryStatePr = __esm({
|
|
|
15507
15556
|
["api", "--method", "POST", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/commits`, "--input", "-"],
|
|
15508
15557
|
ctx.cwd,
|
|
15509
15558
|
{
|
|
15510
|
-
message:
|
|
15559
|
+
message: `${sourceLabel}: ${bundle.title}`,
|
|
15511
15560
|
tree: treeSha,
|
|
15512
15561
|
parents: [baseSha]
|
|
15513
15562
|
}
|
|
@@ -15532,16 +15581,16 @@ var init_openAgentFactoryStatePr = __esm({
|
|
|
15532
15581
|
["api", "--method", "POST", `/repos/${stateRepo.owner}/${stateRepo.repo}/pulls`, "--input", "-"],
|
|
15533
15582
|
ctx.cwd,
|
|
15534
15583
|
{
|
|
15535
|
-
title:
|
|
15584
|
+
title: `${sourceLabel}: ${bundle.title}`,
|
|
15536
15585
|
head: branch,
|
|
15537
15586
|
base: baseBranch,
|
|
15538
|
-
body: renderPullRequestBody(ctx, bundle, normalizedFiles)
|
|
15587
|
+
body: renderPullRequestBody(ctx, bundle, normalizedFiles, sourceLabel)
|
|
15539
15588
|
}
|
|
15540
15589
|
);
|
|
15541
15590
|
const prUrl = requireString2(pr.html_url, "created pull request url");
|
|
15542
15591
|
gh(["issue", "comment", String(issueNumber), "--body-file", "-"], {
|
|
15543
15592
|
cwd: ctx.cwd,
|
|
15544
|
-
input: renderIssueComment(stateRepo.owner, stateRepo.repo, prUrl, bundle)
|
|
15593
|
+
input: renderIssueComment(stateRepo.owner, stateRepo.repo, prUrl, bundle, sourceLabel)
|
|
15545
15594
|
});
|
|
15546
15595
|
ctx.data.agentFactoryStatePr = {
|
|
15547
15596
|
repo: `${stateRepo.owner}/${stateRepo.repo}`,
|
|
@@ -19681,10 +19730,12 @@ function jobReferenceBlock(profileName, profile, data) {
|
|
|
19681
19730
|
const jobId = typeof data.jobId === "string" && data.jobId.length > 0 ? data.jobId : null;
|
|
19682
19731
|
const flavor = typeof data.jobFlavor === "string" && data.jobFlavor.length > 0 ? data.jobFlavor : null;
|
|
19683
19732
|
const schedule = typeof data.jobSchedule === "string" && data.jobSchedule.length > 0 ? data.jobSchedule : null;
|
|
19684
|
-
const isJob2 = Boolean(
|
|
19733
|
+
const isJob2 = Boolean(
|
|
19734
|
+
jobId || flavor || schedule || data.jobCapability || data.jobImplementation || data.jobExecutable || data.jobWhy
|
|
19735
|
+
);
|
|
19685
19736
|
if (!isJob2) return null;
|
|
19686
19737
|
const capability = typeof data.jobCapability === "string" && data.jobCapability.length > 0 ? data.jobCapability : profile.executable ? profile.name : null;
|
|
19687
|
-
const
|
|
19738
|
+
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
19739
|
const agent = typeof profile.agent === "string" && profile.agent.length > 0 ? profile.agent : typeof data.jobAgent === "string" && data.jobAgent.length > 0 ? data.jobAgent : null;
|
|
19689
19740
|
const description = profile.describe.trim();
|
|
19690
19741
|
const workflow = typeof data.workflowCapability === "string" && data.workflowCapability.length > 0 ? data.workflowCapability : null;
|
|
@@ -19700,7 +19751,7 @@ function jobReferenceBlock(profileName, profile, data) {
|
|
|
19700
19751
|
`- Flavor: ${flavor ?? "(unavailable)"}`,
|
|
19701
19752
|
...schedule ? [`- Schedule: ${schedule}`] : [],
|
|
19702
19753
|
`- Capability: ${capability ?? "(none)"}`,
|
|
19703
|
-
`-
|
|
19754
|
+
`- Implementation: ${implementation}`,
|
|
19704
19755
|
`- Agent: ${agent ?? "(none)"}`,
|
|
19705
19756
|
`- Description: ${description || "(none)"}`,
|
|
19706
19757
|
...workflow ? [`- Workflow: ${workflow}`] : [],
|
|
@@ -20259,6 +20310,7 @@ function handoffToJob(handoff) {
|
|
|
20259
20310
|
action: handoff.action ?? handoff.capability,
|
|
20260
20311
|
capability: handoff.capability,
|
|
20261
20312
|
workflow: handoff.workflow,
|
|
20313
|
+
implementation: handoff.implementation ?? handoff.executable,
|
|
20262
20314
|
executable: handoff.executable,
|
|
20263
20315
|
cliArgs: handoff.cliArgs,
|
|
20264
20316
|
flavor: "instant",
|
|
@@ -20541,10 +20593,10 @@ var init_executor = __esm({
|
|
|
20541
20593
|
init_registry();
|
|
20542
20594
|
init_runIndex();
|
|
20543
20595
|
init_runtimePaths();
|
|
20596
|
+
init_evaluateAgencyBoundaries();
|
|
20544
20597
|
init_scripts();
|
|
20545
20598
|
init_stateWorkspace();
|
|
20546
20599
|
init_subagents();
|
|
20547
|
-
init_evaluateAgencyBoundaries();
|
|
20548
20600
|
init_task_artifacts();
|
|
20549
20601
|
init_tools();
|
|
20550
20602
|
MUTATING_POSTFLIGHTS = /* @__PURE__ */ new Set([
|
|
@@ -20689,7 +20741,8 @@ function validateJob(input) {
|
|
|
20689
20741
|
}
|
|
20690
20742
|
return {
|
|
20691
20743
|
action: typeof j.action === "string" ? j.action : void 0,
|
|
20692
|
-
|
|
20744
|
+
implementation: typeof j.implementation === "string" ? j.implementation : typeof j.executable === "string" ? j.executable : void 0,
|
|
20745
|
+
executable: typeof j.executable === "string" ? j.executable : typeof j.implementation === "string" ? j.implementation : void 0,
|
|
20693
20746
|
capability: typeof j.capability === "string" ? j.capability : void 0,
|
|
20694
20747
|
workflow: typeof j.workflow === "string" ? j.workflow : void 0,
|
|
20695
20748
|
why: typeof j.why === "string" ? j.why : void 0,
|
|
@@ -20723,17 +20776,18 @@ async function runJob(job, base) {
|
|
|
20723
20776
|
const capabilityIdentity = valid.capability ?? resolvedCapability?.capability;
|
|
20724
20777
|
const capabilityContext = valid.workflow ? null : loadCapabilityContext(capabilityIdentity, base.cwd);
|
|
20725
20778
|
const workflowContext = valid.workflow ? loadWorkflowContext(valid.workflow, base) : !capabilityContext && !resolvedCapability ? loadWorkflowContext(capabilityIdentity ?? action, base) : null;
|
|
20726
|
-
const
|
|
20727
|
-
|
|
20779
|
+
const explicitImplementation = valid.implementation ?? valid.executable;
|
|
20780
|
+
const explicitImplementationOnly = explicitImplementation !== void 0 && (valid.action === void 0 || valid.action === explicitImplementation) && (valid.capability === void 0 || valid.capability === explicitImplementation);
|
|
20781
|
+
if (!resolvedCapability && !capabilityContext && !workflowContext && !explicitImplementationOnly) {
|
|
20728
20782
|
throw new InvalidJobError(
|
|
20729
20783
|
`job capability/workflow not found: ${valid.workflow ?? action ?? valid.capability ?? "<none>"}`
|
|
20730
20784
|
);
|
|
20731
20785
|
}
|
|
20732
20786
|
const workflow = capabilityContext?.config.workflow ?? workflowContext?.config.workflow;
|
|
20733
20787
|
const workflowIdentity = valid.workflow ?? capabilityIdentity ?? workflowContext?.slug;
|
|
20734
|
-
const
|
|
20735
|
-
const profileName =
|
|
20736
|
-
if (workflow && shouldRunCapabilityWorkflow(valid, workflow, workflowIdentity,
|
|
20788
|
+
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);
|
|
20789
|
+
const profileName = explicitImplementation ?? capabilitySelectedImplementation;
|
|
20790
|
+
if (workflow && shouldRunCapabilityWorkflow(valid, workflow, workflowIdentity, capabilitySelectedImplementation, base)) {
|
|
20737
20791
|
const workflowCapability = capabilityContext ?? workflowContext;
|
|
20738
20792
|
const workflowJob = workflowContext && !valid.why ? { ...valid, why: workflowContext.body } : valid;
|
|
20739
20793
|
return runCapabilityWorkflow(workflowJob, workflow, workflowCapability, base);
|
|
@@ -20769,6 +20823,7 @@ async function runCapabilityImplementationStep(valid, profileName, capabilityIde
|
|
|
20769
20823
|
if (valid.action !== void 0 && valid.action.length > 0) preloadedData.jobAction = valid.action;
|
|
20770
20824
|
if (capabilityIdentity !== void 0 && capabilityIdentity.length > 0)
|
|
20771
20825
|
preloadedData.jobCapability = capabilityIdentity;
|
|
20826
|
+
preloadedData.jobImplementation = profileName;
|
|
20772
20827
|
preloadedData.jobExecutable = profileName;
|
|
20773
20828
|
if (valid.schedule !== void 0 && valid.schedule.length > 0) preloadedData.jobSchedule = valid.schedule;
|
|
20774
20829
|
if (valid.saveReport === true) preloadedData.jobSaveReport = true;
|
|
@@ -20776,7 +20831,8 @@ async function runCapabilityImplementationStep(valid, profileName, capabilityIde
|
|
|
20776
20831
|
if (capabilityContext) {
|
|
20777
20832
|
preloadedData.capabilitySlug = capabilityContext.slug;
|
|
20778
20833
|
preloadedData.capabilityTitle = capabilityContext.title;
|
|
20779
|
-
if (capabilityContext.config.capabilityKind)
|
|
20834
|
+
if (capabilityContext.config.capabilityKind)
|
|
20835
|
+
preloadedData.jobCapabilityKind = capabilityContext.config.capabilityKind;
|
|
20780
20836
|
preloadedData.capabilityIntent = capabilityContext.body;
|
|
20781
20837
|
preloadedData.dutyIntent = capabilityContext.body;
|
|
20782
20838
|
preloadedData.jobIntent = capabilityContext.body;
|
|
@@ -20799,7 +20855,7 @@ async function runCapabilityImplementationStep(valid, profileName, capabilityIde
|
|
|
20799
20855
|
quiet: base.quiet,
|
|
20800
20856
|
preloadedData: Object.keys(preloadedData).length > 0 ? preloadedData : void 0
|
|
20801
20857
|
};
|
|
20802
|
-
const shouldApplyResolvedCapabilityArgs = valid.executable === void 0 && resolvedCapability && profileName === resolvedCapability.
|
|
20858
|
+
const shouldApplyResolvedCapabilityArgs = valid.implementation === void 0 && valid.executable === void 0 && resolvedCapability && profileName === resolvedCapability.implementation;
|
|
20803
20859
|
input.cliArgs = shouldApplyResolvedCapabilityArgs ? { ...resolvedCapability.cliArgs, ...input.cliArgs } : input.cliArgs;
|
|
20804
20860
|
const run = base.chain === false ? runExecutable : runExecutableChain;
|
|
20805
20861
|
return run(profileName, input);
|
|
@@ -20809,8 +20865,9 @@ function shouldRunCapabilityWorkflow(job, workflow, capabilityIdentity, selected
|
|
|
20809
20865
|
if (!capabilityIdentity) return false;
|
|
20810
20866
|
const stack = Array.isArray(base.preloadedData?.workflowStack) ? base.preloadedData.workflowStack.filter((entry) => typeof entry === "string") : [];
|
|
20811
20867
|
if (stack.includes(capabilityIdentity)) return false;
|
|
20812
|
-
|
|
20813
|
-
|
|
20868
|
+
const requestedImplementation = job.implementation ?? job.executable;
|
|
20869
|
+
if (!requestedImplementation) return true;
|
|
20870
|
+
return requestedImplementation === selectedExecutable || requestedImplementation === capabilityIdentity || requestedImplementation === job.action;
|
|
20814
20871
|
}
|
|
20815
20872
|
async function runCapabilityWorkflow(parent, workflow, capability, base) {
|
|
20816
20873
|
let chainData = {
|
|
@@ -20912,6 +20969,7 @@ function workflowStepToJob(step, parent, chainData) {
|
|
|
20912
20969
|
return {
|
|
20913
20970
|
action,
|
|
20914
20971
|
capability: step.capability,
|
|
20972
|
+
...step.implementation ? { implementation: step.implementation } : {},
|
|
20915
20973
|
...step.executable ? { executable: step.executable } : {},
|
|
20916
20974
|
...composeStepWhy(parent.why, step) ? { why: composeStepWhy(parent.why, step) } : {},
|
|
20917
20975
|
...step.agent ?? parent.agent ? { agent: step.agent ?? parent.agent } : {},
|
|
@@ -21007,6 +21065,7 @@ function loadWorkflowContext(slug2, base) {
|
|
|
21007
21065
|
function mintInstantJob(dispatch2, opts) {
|
|
21008
21066
|
return {
|
|
21009
21067
|
action: dispatch2.action,
|
|
21068
|
+
implementation: dispatch2.implementation ?? dispatch2.executable,
|
|
21010
21069
|
executable: dispatch2.executable,
|
|
21011
21070
|
capability: dispatch2.capability,
|
|
21012
21071
|
why: opts?.why ?? dispatch2.why,
|
|
@@ -21020,6 +21079,7 @@ function mintScheduledJob(input) {
|
|
|
21020
21079
|
return {
|
|
21021
21080
|
action: input.action,
|
|
21022
21081
|
capability: input.capability,
|
|
21082
|
+
implementation: input.implementation ?? input.executable,
|
|
21023
21083
|
executable: input.executable,
|
|
21024
21084
|
schedule: input.schedule,
|
|
21025
21085
|
agent: input.agent,
|
|
@@ -22001,6 +22061,7 @@ function routeResult(route, cliArgs, target, why) {
|
|
|
22001
22061
|
const result = {
|
|
22002
22062
|
action: route.action,
|
|
22003
22063
|
capability: route.capability,
|
|
22064
|
+
implementation: route.implementation,
|
|
22004
22065
|
executable: route.executable,
|
|
22005
22066
|
cliArgs: { ...route.cliArgs, ...cliArgs },
|
|
22006
22067
|
target
|
|
@@ -22030,7 +22091,7 @@ function autoDispatch(opts) {
|
|
|
22030
22091
|
const route2 = resolveConfiguredAction(actionName);
|
|
22031
22092
|
if (!route2) return null;
|
|
22032
22093
|
const base = String(inputs2?.base ?? "").trim();
|
|
22033
|
-
const targetKey = primaryNumericInputName(route2.
|
|
22094
|
+
const targetKey = primaryNumericInputName(route2.implementation) ?? "issue";
|
|
22034
22095
|
const cliArgs = { [targetKey]: n };
|
|
22035
22096
|
if (base) cliArgs.base = base;
|
|
22036
22097
|
return routeResult(route2, cliArgs, n);
|
|
@@ -22048,7 +22109,7 @@ function autoDispatch(opts) {
|
|
|
22048
22109
|
if (!route2) return null;
|
|
22049
22110
|
const prNum = Number(pullRequest?.number ?? event.number ?? 0);
|
|
22050
22111
|
if (prNum > 0) {
|
|
22051
|
-
const targetKey = primaryNumericInputName(route2.
|
|
22112
|
+
const targetKey = primaryNumericInputName(route2.implementation) ?? "pr";
|
|
22052
22113
|
return routeResult(route2, { [targetKey]: prNum }, prNum);
|
|
22053
22114
|
}
|
|
22054
22115
|
}
|
|
@@ -22113,7 +22174,7 @@ function autoDispatch(opts) {
|
|
|
22113
22174
|
);
|
|
22114
22175
|
return null;
|
|
22115
22176
|
}
|
|
22116
|
-
const inputs = getProfileInputs(route.
|
|
22177
|
+
const inputs = getProfileInputs(route.implementation);
|
|
22117
22178
|
const effectiveInputs = inputs ?? [];
|
|
22118
22179
|
const unknownProfile = inputs === null;
|
|
22119
22180
|
const rest = extractCommentRest(afterTag, consumedFirstToken ? firstToken : null);
|
|
@@ -22230,6 +22291,7 @@ function dispatchScheduledWatches(opts) {
|
|
|
22230
22291
|
route ? { ...route, cliArgs: route.cliArgs, target: 0 } : {
|
|
22231
22292
|
action: exe.name,
|
|
22232
22293
|
capability: exe.name,
|
|
22294
|
+
implementation: exe.name,
|
|
22233
22295
|
executable: exe.name,
|
|
22234
22296
|
cliArgs: {},
|
|
22235
22297
|
target: 0
|
|
@@ -22585,7 +22647,7 @@ function detectPackageManager2(cwd) {
|
|
|
22585
22647
|
return "npm";
|
|
22586
22648
|
}
|
|
22587
22649
|
function shouldChainScheduledWatch(match) {
|
|
22588
|
-
return match.action === "goal-scheduler" || match.capability === "goal-scheduler" || match.executable === "goal-scheduler";
|
|
22650
|
+
return match.action === "goal-scheduler" || match.capability === "goal-scheduler" || match.implementation === "goal-scheduler" || match.executable === "goal-scheduler";
|
|
22589
22651
|
}
|
|
22590
22652
|
function shellOut(cmd, args, cwd, stream = true) {
|
|
22591
22653
|
try {
|
|
@@ -22793,11 +22855,12 @@ async function runCi(argv) {
|
|
|
22793
22855
|
cliArgs: {}
|
|
22794
22856
|
};
|
|
22795
22857
|
const scheduledWatchRoute = manualGoalManager || capabilityRoute || workflowRoute ? void 0 : dispatchScheduledWatches({ force: true }).find(
|
|
22796
|
-
(match) => match.action === forceRunAction || match.executable === forceRunAction
|
|
22858
|
+
(match) => match.action === forceRunAction || match.capability === forceRunAction || match.implementation === forceRunAction || match.executable === forceRunAction
|
|
22797
22859
|
);
|
|
22798
22860
|
const route = manualGoalManager ? {
|
|
22799
22861
|
action: "goal-manager",
|
|
22800
22862
|
capability: "goal-manager",
|
|
22863
|
+
implementation: "goal-manager",
|
|
22801
22864
|
executable: "goal-manager",
|
|
22802
22865
|
cliArgs: forceRunCliArgs
|
|
22803
22866
|
} : capabilityRoute ?? workflowRoute ?? scheduledWatchRoute;
|
|
@@ -22848,6 +22911,7 @@ async function runCi(argv) {
|
|
|
22848
22911
|
action: route.action,
|
|
22849
22912
|
capability: route.capability,
|
|
22850
22913
|
workflow: route.workflow,
|
|
22914
|
+
implementation: route.implementation ?? route.executable,
|
|
22851
22915
|
executable: route.executable,
|
|
22852
22916
|
cliArgs: { ...route.cliArgs, ...forceRunCliArgs },
|
|
22853
22917
|
flavor: "instant",
|
|
@@ -22965,7 +23029,7 @@ ${CI_HELP}`);
|
|
|
22965
23029
|
};
|
|
22966
23030
|
const issueNumber = dispatch2.target;
|
|
22967
23031
|
process.stdout.write(
|
|
22968
|
-
`\u2192 kody preflight (cwd=${cwd}, action=${dispatch2.action}, capability=${dispatch2.capability},
|
|
23032
|
+
`\u2192 kody preflight (cwd=${cwd}, action=${dispatch2.action}, capability=${dispatch2.capability}, implementation=${dispatch2.implementation}, target=${issueNumber})
|
|
22969
23033
|
`
|
|
22970
23034
|
);
|
|
22971
23035
|
try {
|
|
@@ -22977,7 +23041,7 @@ ${CI_HELP}`);
|
|
|
22977
23041
|
const pm = args.packageManager ?? detectPackageManager2(cwd);
|
|
22978
23042
|
process.stdout.write(`\u2192 kody: package manager = ${pm}
|
|
22979
23043
|
`);
|
|
22980
|
-
const buildOnly = dispatch2.executable === "preview-build";
|
|
23044
|
+
const buildOnly = dispatch2.implementation === "preview-build" || dispatch2.executable === "preview-build";
|
|
22981
23045
|
if (args.skipInstall || buildOnly) {
|
|
22982
23046
|
process.stdout.write(`\u2192 kody: skipping dep install (${buildOnly ? "build-only executable" : "--skip-install"})
|
|
22983
23047
|
`);
|
|
@@ -23008,7 +23072,7 @@ ${CI_HELP}`);
|
|
|
23008
23072
|
postFailureTail(issueNumber, cwd, `preflight crashed: ${msg}`);
|
|
23009
23073
|
return 99;
|
|
23010
23074
|
}
|
|
23011
|
-
process.stdout.write(`\u2192 kody: preflight done, handing off to kody ${dispatch2.
|
|
23075
|
+
process.stdout.write(`\u2192 kody: preflight done, handing off to kody ${dispatch2.implementation}
|
|
23012
23076
|
|
|
23013
23077
|
`);
|
|
23014
23078
|
try {
|
|
@@ -23042,7 +23106,7 @@ async function runScheduledFanOut(cwd, args, opts) {
|
|
|
23042
23106
|
);
|
|
23043
23107
|
return 0;
|
|
23044
23108
|
}
|
|
23045
|
-
const names = matches.map((m) => `${m.capability}\u2192${m.
|
|
23109
|
+
const names = matches.map((m) => `${m.capability}\u2192${m.implementation}`).join(", ");
|
|
23046
23110
|
process.stdout.write(`\u2192 kody: scheduled wake \u2014 firing ${matches.length} watch capability/ies: ${names}
|
|
23047
23111
|
`);
|
|
23048
23112
|
try {
|
|
@@ -23080,13 +23144,14 @@ async function runScheduledFanOut(cwd, args, opts) {
|
|
|
23080
23144
|
const serial = process.env.KODY_SERIAL_WATCHES === "1";
|
|
23081
23145
|
const runWatch = async (match) => {
|
|
23082
23146
|
process.stdout.write(`
|
|
23083
|
-
\u2192 kody: running watch capability \`${match.capability}\` (${match.
|
|
23147
|
+
\u2192 kody: running watch capability \`${match.capability}\` (${match.implementation})
|
|
23084
23148
|
`);
|
|
23085
23149
|
try {
|
|
23086
23150
|
const result = await runJob(
|
|
23087
23151
|
mintScheduledJob({
|
|
23088
23152
|
action: match.action,
|
|
23089
23153
|
capability: match.capability,
|
|
23154
|
+
implementation: match.implementation,
|
|
23090
23155
|
executable: match.executable,
|
|
23091
23156
|
cliArgs: match.cliArgs
|
|
23092
23157
|
}),
|
|
@@ -26333,12 +26398,13 @@ ${HELP_TEXT}`);
|
|
|
26333
26398
|
return 64;
|
|
26334
26399
|
}
|
|
26335
26400
|
const cliArgs = { ...route.cliArgs, ...args.cliArgs ?? {} };
|
|
26336
|
-
const skipConfig = configlessCommands.has(route.
|
|
26401
|
+
const skipConfig = configlessCommands.has(route.implementation);
|
|
26337
26402
|
try {
|
|
26338
26403
|
const result = await runJob(
|
|
26339
26404
|
{
|
|
26340
26405
|
action: route.action,
|
|
26341
26406
|
capability: route.capability,
|
|
26407
|
+
implementation: route.implementation,
|
|
26342
26408
|
executable: route.executable,
|
|
26343
26409
|
cliArgs,
|
|
26344
26410
|
target: numericTarget(cliArgs),
|
|
@@ -26376,6 +26442,7 @@ ${HELP_TEXT}`);
|
|
|
26376
26442
|
{
|
|
26377
26443
|
action: executable,
|
|
26378
26444
|
capability: executable,
|
|
26445
|
+
implementation: executable,
|
|
26379
26446
|
executable,
|
|
26380
26447
|
cliArgs,
|
|
26381
26448
|
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.
|
|
3
|
+
"version": "0.4.337",
|
|
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",
|