@kody-ade/kody-engine 0.4.352 → 0.4.353

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.352",
18
+ version: "0.4.353",
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",
@@ -9800,8 +9800,9 @@ var init_advanceManagedGoal = __esm({
9800
9800
  workflow: decision.workflow,
9801
9801
  cliArgs: decision.cliArgs,
9802
9802
  workflowFacts: scalarFacts(managed.facts),
9803
+ evidence: decision.evidence,
9803
9804
  ...decision.saveReport === true ? { saveReport: true } : {},
9804
- resultTarget: { type: "goal", id: goal.id, evidence: decision.evidence }
9805
+ resultTarget: { type: "goal", id: goal.id }
9805
9806
  };
9806
9807
  ctx.output.reason = `dispatch workflow ${decision.workflow} for ${decision.evidence}`;
9807
9808
  return;
@@ -9809,9 +9810,10 @@ var init_advanceManagedGoal = __esm({
9809
9810
  ctx.output.nextDispatch = {
9810
9811
  capability: decision.capability,
9811
9812
  cliArgs: decision.cliArgs,
9813
+ evidence: decision.evidence,
9812
9814
  ...decision.implementation ? { implementation: decision.implementation } : {},
9813
9815
  ...decision.saveReport === true ? { saveReport: true } : {},
9814
- resultTarget: { type: "goal", id: goal.id, evidence: decision.evidence }
9816
+ resultTarget: { type: "goal", id: goal.id }
9815
9817
  };
9816
9818
  ctx.output.reason = `dispatch ${decision.capability} for ${decision.evidence}`;
9817
9819
  };
@@ -10950,6 +10952,12 @@ function parseResultTarget(raw) {
10950
10952
  ...evidence ? { evidence } : {}
10951
10953
  };
10952
10954
  }
10955
+ function parseEvidenceContext(raw) {
10956
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
10957
+ const context = raw;
10958
+ const evidence = typeof context.evidence === "string" && context.evidence.trim().length > 0 ? context.evidence.trim() : void 0;
10959
+ return evidence ? { evidence } : null;
10960
+ }
10953
10961
  function collectGoalCapabilityEvidence(reports, results, fallbackGoalId, explicitEvidence) {
10954
10962
  const items = [];
10955
10963
  for (const report of reports) {
@@ -11054,8 +11062,9 @@ var init_applyCapabilityReports = __esm({
11054
11062
  const reports = collectReports(ctx.data.capabilityReports, agentResult);
11055
11063
  const results = collectResults2(ctx.data.capabilityResults, agentResult);
11056
11064
  const resultTarget = parseResultTarget(ctx.data.capabilityResultTarget);
11065
+ const evidenceContext = parseEvidenceContext(ctx.data.capabilityEvidence);
11057
11066
  const resultGoalId = resultTarget?.id ?? (typeof ctx.args.goal === "string" && ctx.args.goal.length > 0 ? ctx.args.goal : null);
11058
- const explicitEvidence = resultTarget?.evidence ?? (typeof ctx.args.evidence === "string" && ctx.args.evidence.length > 0 ? ctx.args.evidence : void 0);
11067
+ const explicitEvidence = evidenceContext?.evidence ?? resultTarget?.evidence ?? (typeof ctx.args.evidence === "string" && ctx.args.evidence.length > 0 ? ctx.args.evidence : void 0);
11059
11068
  const evidenceItems = collectGoalCapabilityEvidence(reports, results, resultGoalId, explicitEvidence);
11060
11069
  if (evidenceItems.length === 0) return;
11061
11070
  const evidenceByGoal = groupGoalEvidence(evidenceItems);
@@ -20483,6 +20492,7 @@ function handoffToJob(handoff) {
20483
20492
  implementation: handoff.implementation,
20484
20493
  cliArgs: handoff.cliArgs,
20485
20494
  workflowFacts: handoff.workflowFacts,
20495
+ evidence: handoff.evidence,
20486
20496
  flavor: "instant",
20487
20497
  saveReport: handoff.saveReport === true,
20488
20498
  resultTarget: handoff.resultTarget
@@ -20828,6 +20838,7 @@ function validateJob(input) {
20828
20838
  target: typeof j.target === "number" ? j.target : void 0,
20829
20839
  cliArgs: j.cliArgs ?? {},
20830
20840
  workflowFacts: j.workflowFacts && typeof j.workflowFacts === "object" && !Array.isArray(j.workflowFacts) ? j.workflowFacts : void 0,
20841
+ evidence: parseJobEvidence(j),
20831
20842
  flavor: j.flavor,
20832
20843
  force: j.force === true,
20833
20844
  saveReport: j.saveReport === true,
@@ -20839,13 +20850,18 @@ function parseCapabilityResultTarget(raw) {
20839
20850
  const target = raw;
20840
20851
  if (target.type !== "goal") return void 0;
20841
20852
  if (typeof target.id !== "string" || target.id.trim().length === 0) return void 0;
20842
- const evidence = typeof target.evidence === "string" && target.evidence.trim().length > 0 ? target.evidence.trim() : void 0;
20843
20853
  return {
20844
20854
  type: "goal",
20845
- id: target.id.trim(),
20846
- ...evidence ? { evidence } : {}
20855
+ id: target.id.trim()
20847
20856
  };
20848
20857
  }
20858
+ function parseJobEvidence(job) {
20859
+ if (typeof job.evidence === "string" && job.evidence.trim().length > 0) return job.evidence.trim();
20860
+ const target = job.resultTarget;
20861
+ if (!target || typeof target !== "object" || Array.isArray(target)) return void 0;
20862
+ const evidence = target.evidence;
20863
+ return typeof evidence === "string" && evidence.trim().length > 0 ? evidence.trim() : void 0;
20864
+ }
20849
20865
  async function runJob(job, base) {
20850
20866
  const valid = validateJob(job);
20851
20867
  const action = valid.action ?? valid.capability;
@@ -20905,6 +20921,7 @@ async function runCapabilityImplementationStep(valid, profileName, capabilityIde
20905
20921
  if (valid.schedule !== void 0 && valid.schedule.length > 0) preloadedData.jobSchedule = valid.schedule;
20906
20922
  if (valid.saveReport === true) preloadedData.jobSaveReport = true;
20907
20923
  if (valid.force === true) preloadedData.jobForce = true;
20924
+ if (valid.evidence) preloadedData.capabilityEvidence = { evidence: valid.evidence };
20908
20925
  if (valid.resultTarget) preloadedData.capabilityResultTarget = valid.resultTarget;
20909
20926
  if (capabilityContext) {
20910
20927
  preloadedData.capabilitySlug = capabilityContext.slug;
@@ -20964,7 +20981,7 @@ async function runCapabilityWorkflow(parent, workflow, capability, base) {
20964
20981
  ]
20965
20982
  };
20966
20983
  let result = { exitCode: 0 };
20967
- const startIndex = workflowResumeStartIndex(workflow.steps, parent.resultTarget?.evidence);
20984
+ const startIndex = workflowResumeStartIndex(workflow.steps, parent.evidence);
20968
20985
  for (let index = startIndex; index < workflow.steps.length; index++) {
20969
20986
  const step = workflow.steps[index];
20970
20987
  const label = step.action ?? step.capability;
@@ -21054,9 +21071,11 @@ function workflowStepToJob(step, parent, chainData) {
21054
21071
  ...parent.schedule ? { schedule: parent.schedule } : {},
21055
21072
  ...typeof target === "number" ? { target } : {},
21056
21073
  cliArgs,
21074
+ ...step.evidence ? { evidence: step.evidence } : parent.evidence ? { evidence: parent.evidence } : {},
21057
21075
  flavor: parent.flavor,
21058
21076
  force: parent.force,
21059
- saveReport: step.saveReport === true || parent.saveReport === true
21077
+ saveReport: step.saveReport === true || parent.saveReport === true,
21078
+ ...parent.resultTarget ? { resultTarget: parent.resultTarget } : {}
21060
21079
  };
21061
21080
  }
21062
21081
  function shouldRunWorkflowStep(step, data) {
@@ -401,7 +401,6 @@ export interface OutputContract {
401
401
  export interface CapabilityResultTarget {
402
402
  type: "goal"
403
403
  id: string
404
- evidence?: string
405
404
  }
406
405
 
407
406
  // ────────────────────────────────────────────────────────────────────────────
@@ -439,6 +438,7 @@ export interface Context {
439
438
  implementation?: string
440
439
  cliArgs: Record<string, unknown>
441
440
  workflowFacts?: Record<string, unknown>
441
+ evidence?: string
442
442
  saveReport?: boolean
443
443
  resultTarget?: CapabilityResultTarget
444
444
  }
@@ -452,6 +452,7 @@ export interface Context {
452
452
  implementation?: string
453
453
  cliArgs: Record<string, unknown>
454
454
  workflowFacts?: Record<string, unknown>
455
+ evidence?: string
455
456
  saveReport?: boolean
456
457
  resultTarget?: CapabilityResultTarget
457
458
  }
@@ -521,6 +522,8 @@ export interface Job {
521
522
  cliArgs: Record<string, unknown>
522
523
  /** Internal workflow resume context. Not passed to capability CLI args. */
523
524
  workflowFacts?: Record<string, unknown>
525
+ /** Evidence this capability run is expected to report, independent of who consumes it. */
526
+ evidence?: string
524
527
  /** Run once now ("instant") or on the schedule ("scheduled"). */
525
528
  flavor: JobFlavor
526
529
  /** 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.352",
3
+ "version": "0.4.353",
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",