@kody-ade/kody-engine 0.4.351 → 0.4.352
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 +33 -4
- package/dist/implementations/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.352",
|
|
19
19
|
description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
|
|
20
20
|
license: "MIT",
|
|
21
21
|
type: "module",
|
|
@@ -1983,15 +1983,19 @@ function parseWorkflowStep(value) {
|
|
|
1983
1983
|
if (!capability || !isSafeSlug(capability)) return null;
|
|
1984
1984
|
const implementation = stringField(raw.implementation);
|
|
1985
1985
|
const action = stringField(raw.action);
|
|
1986
|
+
const evidence = stringField(raw.evidence);
|
|
1986
1987
|
const agent = stringField(raw.agent);
|
|
1987
1988
|
const reason = stringField(raw.reason);
|
|
1988
1989
|
const target = stringField(raw.target);
|
|
1990
|
+
const targetFact = stringField(raw.targetFact ?? raw.target_fact);
|
|
1989
1991
|
const cliArgs = raw.cliArgs;
|
|
1990
1992
|
return {
|
|
1991
1993
|
capability,
|
|
1992
1994
|
...action && isSafeSlug(action) ? { action } : {},
|
|
1993
1995
|
...implementation && isSafeSlug(implementation) ? { implementation } : {},
|
|
1996
|
+
...evidence ? { evidence } : {},
|
|
1994
1997
|
...target === "issue" || target === "pr" ? { target } : {},
|
|
1998
|
+
...targetFact ? { targetFact } : {},
|
|
1995
1999
|
...agent && isSafeSlug(agent) ? { agent } : {},
|
|
1996
2000
|
...reason ? { reason } : {},
|
|
1997
2001
|
...cliArgs && typeof cliArgs === "object" && !Array.isArray(cliArgs) ? { cliArgs } : {},
|
|
@@ -9324,6 +9328,13 @@ var init_goalCapabilityScheduling = __esm({
|
|
|
9324
9328
|
});
|
|
9325
9329
|
|
|
9326
9330
|
// src/scripts/advanceManagedGoal.ts
|
|
9331
|
+
function scalarFacts(facts) {
|
|
9332
|
+
return Object.fromEntries(
|
|
9333
|
+
Object.entries(facts).filter(
|
|
9334
|
+
([key, value]) => key !== "pendingEvidence" && (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
|
|
9335
|
+
)
|
|
9336
|
+
);
|
|
9337
|
+
}
|
|
9327
9338
|
function autonomyBlockReason(ctx, goalId, goal, dispatch2) {
|
|
9328
9339
|
if (ctx.data.jobForce === true) return null;
|
|
9329
9340
|
if (goal.runWithoutApproval !== true) {
|
|
@@ -9788,8 +9799,9 @@ var init_advanceManagedGoal = __esm({
|
|
|
9788
9799
|
ctx.output.nextDispatch = {
|
|
9789
9800
|
workflow: decision.workflow,
|
|
9790
9801
|
cliArgs: decision.cliArgs,
|
|
9802
|
+
workflowFacts: scalarFacts(managed.facts),
|
|
9791
9803
|
...decision.saveReport === true ? { saveReport: true } : {},
|
|
9792
|
-
resultTarget: { type: "goal", id: goal.id }
|
|
9804
|
+
resultTarget: { type: "goal", id: goal.id, evidence: decision.evidence }
|
|
9793
9805
|
};
|
|
9794
9806
|
ctx.output.reason = `dispatch workflow ${decision.workflow} for ${decision.evidence}`;
|
|
9795
9807
|
return;
|
|
@@ -20470,6 +20482,7 @@ function handoffToJob(handoff) {
|
|
|
20470
20482
|
workflow: handoff.workflow,
|
|
20471
20483
|
implementation: handoff.implementation,
|
|
20472
20484
|
cliArgs: handoff.cliArgs,
|
|
20485
|
+
workflowFacts: handoff.workflowFacts,
|
|
20473
20486
|
flavor: "instant",
|
|
20474
20487
|
saveReport: handoff.saveReport === true,
|
|
20475
20488
|
resultTarget: handoff.resultTarget
|
|
@@ -20814,6 +20827,7 @@ function validateJob(input) {
|
|
|
20814
20827
|
schedule: typeof j.schedule === "string" ? j.schedule : void 0,
|
|
20815
20828
|
target: typeof j.target === "number" ? j.target : void 0,
|
|
20816
20829
|
cliArgs: j.cliArgs ?? {},
|
|
20830
|
+
workflowFacts: j.workflowFacts && typeof j.workflowFacts === "object" && !Array.isArray(j.workflowFacts) ? j.workflowFacts : void 0,
|
|
20817
20831
|
flavor: j.flavor,
|
|
20818
20832
|
force: j.force === true,
|
|
20819
20833
|
saveReport: j.saveReport === true,
|
|
@@ -20943,13 +20957,15 @@ async function runCapabilityWorkflow(parent, workflow, capability, base) {
|
|
|
20943
20957
|
workflowTitle: capability.title,
|
|
20944
20958
|
workflowStepCount: workflow.steps.length,
|
|
20945
20959
|
workflowIssueNumber: workflowIssueNumber(parent),
|
|
20960
|
+
workflowFacts: parent.workflowFacts ?? {},
|
|
20946
20961
|
workflowStack: [
|
|
20947
20962
|
...Array.isArray(base.preloadedData?.workflowStack) ? base.preloadedData.workflowStack.filter((entry) => typeof entry === "string") : [],
|
|
20948
20963
|
capability.slug
|
|
20949
20964
|
]
|
|
20950
20965
|
};
|
|
20951
20966
|
let result = { exitCode: 0 };
|
|
20952
|
-
|
|
20967
|
+
const startIndex = workflowResumeStartIndex(workflow.steps, parent.resultTarget?.evidence);
|
|
20968
|
+
for (let index = startIndex; index < workflow.steps.length; index++) {
|
|
20953
20969
|
const step = workflow.steps[index];
|
|
20954
20970
|
const label = step.action ?? step.capability;
|
|
20955
20971
|
if (!shouldRunWorkflowStep(step, chainData)) {
|
|
@@ -21081,10 +21097,23 @@ function valueMatches(actual, expected) {
|
|
|
21081
21097
|
return actual === expected;
|
|
21082
21098
|
}
|
|
21083
21099
|
function workflowStepTargetNumber(step, parent, chainData) {
|
|
21084
|
-
if (step.target === "pr")
|
|
21100
|
+
if (step.target === "pr")
|
|
21101
|
+
return workflowPrNumber(chainData) ?? workflowTargetFactNumber(step, chainData) ?? targetFromCliArgs(step.cliArgs ?? {});
|
|
21085
21102
|
if (step.target === "issue") return workflowIssueNumber(parent);
|
|
21086
21103
|
return typeof parent.target === "number" ? parent.target : targetFromCliArgs({ ...parent.cliArgs, ...step.cliArgs ?? {} });
|
|
21087
21104
|
}
|
|
21105
|
+
function workflowResumeStartIndex(steps, evidence) {
|
|
21106
|
+
if (!evidence) return 0;
|
|
21107
|
+
const index = steps.findIndex((step) => step.evidence === evidence);
|
|
21108
|
+
return index >= 0 ? index : 0;
|
|
21109
|
+
}
|
|
21110
|
+
function workflowTargetFactNumber(step, data) {
|
|
21111
|
+
if (!step.targetFact) return void 0;
|
|
21112
|
+
const facts = data.workflowFacts;
|
|
21113
|
+
if (!facts || typeof facts !== "object" || Array.isArray(facts)) return void 0;
|
|
21114
|
+
const value = facts[step.targetFact];
|
|
21115
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
21116
|
+
}
|
|
21088
21117
|
function workflowIssueNumber(parent) {
|
|
21089
21118
|
return typeof parent.target === "number" ? parent.target : targetFromCliArgs(parent.cliArgs);
|
|
21090
21119
|
}
|
|
@@ -438,6 +438,7 @@ export interface Context {
|
|
|
438
438
|
workflow?: string
|
|
439
439
|
implementation?: string
|
|
440
440
|
cliArgs: Record<string, unknown>
|
|
441
|
+
workflowFacts?: Record<string, unknown>
|
|
441
442
|
saveReport?: boolean
|
|
442
443
|
resultTarget?: CapabilityResultTarget
|
|
443
444
|
}
|
|
@@ -450,6 +451,7 @@ export interface Context {
|
|
|
450
451
|
workflow?: string
|
|
451
452
|
implementation?: string
|
|
452
453
|
cliArgs: Record<string, unknown>
|
|
454
|
+
workflowFacts?: Record<string, unknown>
|
|
453
455
|
saveReport?: boolean
|
|
454
456
|
resultTarget?: CapabilityResultTarget
|
|
455
457
|
}
|
|
@@ -517,6 +519,8 @@ export interface Job {
|
|
|
517
519
|
target?: number
|
|
518
520
|
/** Args passed through to the implementation (mirrors DispatchResult.cliArgs). */
|
|
519
521
|
cliArgs: Record<string, unknown>
|
|
522
|
+
/** Internal workflow resume context. Not passed to capability CLI args. */
|
|
523
|
+
workflowFacts?: Record<string, unknown>
|
|
520
524
|
/** Run once now ("instant") or on the schedule ("scheduled"). */
|
|
521
525
|
flavor: JobFlavor
|
|
522
526
|
/** Manual force-run (bypass cadence) for a scheduled job. */
|
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.352",
|
|
4
4
|
"description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|