@kody-ade/kody-engine 0.4.256 → 0.4.257

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.
Files changed (2) hide show
  1. package/dist/bin/kody.js +233 -147
  2. 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.256",
18
+ version: "0.4.257",
19
19
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative agentAction profiles.",
20
20
  license: "MIT",
21
21
  type: "module",
@@ -3069,9 +3069,9 @@ function parseAgentResponsibilityReportsFromText(text) {
3069
3069
  function parseAgentResponsibilityReport(raw) {
3070
3070
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
3071
3071
  const obj = raw;
3072
- const target = parseTarget(obj.target);
3072
+ const target = parseAgentResponsibilityReportTarget(obj.target);
3073
3073
  if (!target) return null;
3074
- const evidence = parseBooleanRecord(obj.evidence);
3074
+ const evidence = parseAgentResponsibilityReportEvidence(obj.evidence);
3075
3075
  const facts = parseFacts(obj.facts);
3076
3076
  if (!evidence && !facts) return null;
3077
3077
  return {
@@ -3080,36 +3080,14 @@ function parseAgentResponsibilityReport(raw) {
3080
3080
  ...facts ? { facts } : {}
3081
3081
  };
3082
3082
  }
3083
- function applyAgentResponsibilityReportToGoalState(state, report) {
3084
- const priorFacts = parseFacts(state.extra.facts) ?? {};
3085
- const nextFacts = { ...priorFacts };
3086
- for (const [key, value] of Object.entries(report.facts ?? {})) {
3087
- if (CONTROL_FACT_KEYS.has(key)) continue;
3088
- nextFacts[key] = value;
3089
- }
3090
- for (const [key, value] of Object.entries(report.evidence ?? {})) {
3091
- nextFacts[key] = value;
3092
- }
3093
- const pending = nextFacts.pendingEvidence;
3094
- if (typeof pending === "string" && Object.hasOwn(report.evidence ?? {}, pending)) {
3095
- delete nextFacts.pendingEvidence;
3096
- }
3097
- return {
3098
- ...state,
3099
- extra: {
3100
- ...state.extra,
3101
- facts: nextFacts
3102
- }
3103
- };
3104
- }
3105
- function parseTarget(raw) {
3083
+ function parseAgentResponsibilityReportTarget(raw) {
3106
3084
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
3107
3085
  const target = raw;
3108
3086
  if (target.type !== "goal" && target.type !== "task" && target.type !== "agentResponsibility") return null;
3109
3087
  if (typeof target.id !== "string" || target.id.trim().length === 0) return null;
3110
3088
  return { type: target.type, id: target.id.trim() };
3111
3089
  }
3112
- function parseBooleanRecord(raw) {
3090
+ function parseAgentResponsibilityReportEvidence(raw) {
3113
3091
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
3114
3092
  const out = {};
3115
3093
  for (const [key, value] of Object.entries(raw)) {
@@ -3158,6 +3136,10 @@ function parseAgentResponsibilityResult(raw) {
3158
3136
  if (!isAgentResponsibilityResultStatus(obj.status)) return null;
3159
3137
  const summary = typeof obj.summary === "string" ? obj.summary.trim() : "";
3160
3138
  if (!summary) return null;
3139
+ const target = obj.target === void 0 ? void 0 : parseAgentResponsibilityReportTarget(obj.target);
3140
+ if (obj.target !== void 0 && !target) return null;
3141
+ const evidence = obj.evidence === void 0 ? void 0 : parseAgentResponsibilityReportEvidence(obj.evidence);
3142
+ if (obj.evidence !== void 0 && !evidence) return null;
3161
3143
  const facts = parseFacts2(obj.facts);
3162
3144
  if (!facts) return null;
3163
3145
  const artifacts = parseArtifacts(obj.artifacts);
@@ -3168,51 +3150,16 @@ function parseAgentResponsibilityResult(raw) {
3168
3150
  if (!blockers) return null;
3169
3151
  return {
3170
3152
  version: 1,
3153
+ ...target ? { target } : {},
3171
3154
  status: obj.status,
3172
3155
  summary,
3156
+ ...evidence ? { evidence } : {},
3173
3157
  facts,
3174
3158
  artifacts,
3175
3159
  missingEvidence,
3176
3160
  blockers
3177
3161
  };
3178
3162
  }
3179
- function applyAgentResponsibilityResultToObjectiveState(state, result, evidenceOverride) {
3180
- const priorFacts = parseFacts2(state.extra.facts) ?? {};
3181
- const nextFacts = { ...priorFacts };
3182
- for (const [key, value] of Object.entries(result.facts)) {
3183
- if (CONTROL_FACT_KEYS2.has(key)) continue;
3184
- nextFacts[key] = value;
3185
- }
3186
- const evidence = evidenceOverride || (typeof nextFacts.pendingEvidence === "string" ? nextFacts.pendingEvidence : "");
3187
- if (evidence) {
3188
- if (result.status === "pass") nextFacts[evidence] = true;
3189
- if (result.status === "fail" || result.status === "blocked") nextFacts[evidence] = false;
3190
- if ((result.status === "pass" || result.status === "fail" || result.status === "blocked") && nextFacts.pendingEvidence === evidence) {
3191
- delete nextFacts.pendingEvidence;
3192
- }
3193
- }
3194
- const blockers = parseStringArray(state.extra.blockers) ?? [];
3195
- const resultBlockers = result.blockers.length > 0 || result.status !== "fail" && result.status !== "blocked" ? result.blockers : [result.summary];
3196
- for (const blocker of resultBlockers) {
3197
- if (!blockers.includes(blocker)) blockers.push(blocker);
3198
- }
3199
- return {
3200
- ...state,
3201
- extra: {
3202
- ...state.extra,
3203
- facts: nextFacts,
3204
- blockers,
3205
- lastAgentResponsibilityResult: {
3206
- status: result.status,
3207
- summary: result.summary,
3208
- facts: result.facts,
3209
- artifacts: result.artifacts,
3210
- missingEvidence: result.missingEvidence,
3211
- blockers: result.blockers
3212
- }
3213
- }
3214
- };
3215
- }
3216
3163
  function isAgentResponsibilityResultStatus(value) {
3217
3164
  return typeof value === "string" && STATUSES.has(value);
3218
3165
  }
@@ -3263,6 +3210,7 @@ var RESULT_LINE, STATUSES, CONTROL_FACT_KEYS2;
3263
3210
  var init_agent_responsibilityResult = __esm({
3264
3211
  "src/agent-responsibilityResult.ts"() {
3265
3212
  "use strict";
3213
+ init_agent_responsibilityReport();
3266
3214
  RESULT_LINE = /^KODY_AGENT_RESPONSIBILITY_RESULT=(.+)$/gm;
3267
3215
  STATUSES = /* @__PURE__ */ new Set(["pass", "fail", "blocked", "changed", "noop"]);
3268
3216
  CONTROL_FACT_KEYS2 = /* @__PURE__ */ new Set(["blockers", "destination", "agent-responsibilities", "route", "stage", "state"]);
@@ -8122,6 +8070,174 @@ var init_appendCompanyIntentDecision = __esm({
8122
8070
  }
8123
8071
  });
8124
8072
 
8073
+ // src/agent-responsibilityEvidence.ts
8074
+ function agentResponsibilityReportToEvidence(report) {
8075
+ if (report.target.type !== "goal") return null;
8076
+ const evidence = report.evidence ?? {};
8077
+ const values = Object.values(evidence);
8078
+ const status = values.some((value) => value === false) ? "fail" : values.length > 0 || report.facts ? "changed" : "noop";
8079
+ return {
8080
+ version: 1,
8081
+ target: { type: "goal", id: report.target.id },
8082
+ status,
8083
+ summary: "responsibility reported goal evidence",
8084
+ evidence,
8085
+ facts: report.facts ?? {},
8086
+ artifacts: [],
8087
+ missingEvidence: [],
8088
+ blockers: [],
8089
+ sources: ["report"]
8090
+ };
8091
+ }
8092
+ function agentResponsibilityResultToEvidence(result, fallbackGoalId, explicitEvidence) {
8093
+ const targetId = result.target?.type === "goal" ? result.target.id : fallbackGoalId;
8094
+ if (!targetId) return null;
8095
+ return {
8096
+ version: 1,
8097
+ target: { type: "goal", id: targetId },
8098
+ status: result.status,
8099
+ summary: result.summary,
8100
+ evidence: result.evidence,
8101
+ explicitEvidence,
8102
+ facts: result.facts,
8103
+ artifacts: result.artifacts,
8104
+ missingEvidence: result.missingEvidence,
8105
+ blockers: result.blockers,
8106
+ sources: ["result"]
8107
+ };
8108
+ }
8109
+ function mergeResponsibilityEvidence(items) {
8110
+ const reports = items.filter((item) => item.sources.includes("report") && !item.sources.includes("result"));
8111
+ const results = items.filter((item) => item.sources.includes("result"));
8112
+ const usedReports = /* @__PURE__ */ new Set();
8113
+ const merged = [];
8114
+ for (const result of results) {
8115
+ const reportIndex = reports.findIndex(
8116
+ (report, index) => !usedReports.has(index) && evidenceMatches(report, result, reports)
8117
+ );
8118
+ if (reportIndex >= 0) {
8119
+ usedReports.add(reportIndex);
8120
+ merged.push(mergeReportAndResult(reports[reportIndex], result));
8121
+ } else {
8122
+ merged.push(result);
8123
+ }
8124
+ }
8125
+ for (let i = 0; i < reports.length; i += 1) {
8126
+ if (!usedReports.has(i)) merged.push(reports[i]);
8127
+ }
8128
+ return merged;
8129
+ }
8130
+ function applyAgentResponsibilityEvidenceToGoalState(state, evidence) {
8131
+ const priorFacts = parseFacts3(state.extra.facts) ?? {};
8132
+ const nextFacts = { ...priorFacts };
8133
+ for (const [key, value] of Object.entries(evidence.facts)) {
8134
+ if (CONTROL_FACT_KEYS3.has(key)) continue;
8135
+ nextFacts[key] = value;
8136
+ }
8137
+ for (const [key, value] of Object.entries(evidence.evidence ?? {})) {
8138
+ nextFacts[key] = value;
8139
+ }
8140
+ const pending = typeof nextFacts.pendingEvidence === "string" ? nextFacts.pendingEvidence : "";
8141
+ const statusEvidence = evidence.explicitEvidence || pending;
8142
+ const hasPendingEvidenceValue = pending ? Object.hasOwn(evidence.evidence ?? {}, pending) : false;
8143
+ const terminalStatus = evidence.status === "pass" || evidence.status === "fail" || evidence.status === "blocked";
8144
+ if (statusEvidence && !Object.hasOwn(evidence.evidence ?? {}, statusEvidence)) {
8145
+ if (evidence.status === "pass") nextFacts[statusEvidence] = true;
8146
+ if (evidence.status === "fail" || evidence.status === "blocked") nextFacts[statusEvidence] = false;
8147
+ }
8148
+ if (pending && (hasPendingEvidenceValue || statusEvidence === pending && terminalStatus)) {
8149
+ delete nextFacts.pendingEvidence;
8150
+ }
8151
+ const blockers = parseStringArray3(state.extra.blockers) ?? [];
8152
+ const evidenceBlockers = evidence.blockers.length > 0 || evidence.status !== "fail" && evidence.status !== "blocked" ? evidence.blockers : [evidence.summary];
8153
+ for (const blocker of evidenceBlockers) {
8154
+ if (!blockers.includes(blocker)) blockers.push(blocker);
8155
+ }
8156
+ const nextExtra = {
8157
+ ...state.extra,
8158
+ facts: nextFacts
8159
+ };
8160
+ if (blockers.length > 0 || Array.isArray(state.extra.blockers)) {
8161
+ nextExtra.blockers = blockers;
8162
+ }
8163
+ return {
8164
+ ...state,
8165
+ extra: nextExtra
8166
+ };
8167
+ }
8168
+ function evidenceMatches(report, result, allReports) {
8169
+ if (report.target.id !== result.target.id) return false;
8170
+ if (result.explicitEvidence && Object.hasOwn(report.evidence ?? {}, result.explicitEvidence)) return true;
8171
+ const resultEvidenceKeys = Object.keys(result.evidence ?? {});
8172
+ if (resultEvidenceKeys.length > 0 && resultEvidenceKeys.some((key) => Object.hasOwn(report.evidence ?? {}, key))) {
8173
+ return true;
8174
+ }
8175
+ return !result.explicitEvidence && resultEvidenceKeys.length === 0 && allReports.filter((item) => item.target.id === result.target.id).length === 1;
8176
+ }
8177
+ function mergeReportAndResult(report, result) {
8178
+ return {
8179
+ ...result,
8180
+ evidence: mergeOptionalRecords(report.evidence, result.evidence),
8181
+ facts: { ...report.facts, ...result.facts },
8182
+ artifacts: uniqueArtifacts([...report.artifacts, ...result.artifacts]),
8183
+ missingEvidence: uniqueStrings([...report.missingEvidence, ...result.missingEvidence]),
8184
+ blockers: uniqueStrings([...report.blockers, ...result.blockers]),
8185
+ sources: uniqueSources([...report.sources, ...result.sources])
8186
+ };
8187
+ }
8188
+ function mergeOptionalRecords(left, right) {
8189
+ const merged = { ...left ?? {}, ...right ?? {} };
8190
+ return Object.keys(merged).length > 0 ? merged : void 0;
8191
+ }
8192
+ function uniqueStrings(values) {
8193
+ return [...new Set(values)].sort();
8194
+ }
8195
+ function uniqueSources(values) {
8196
+ const order = ["report", "result"];
8197
+ const set = new Set(values);
8198
+ return order.filter((source) => set.has(source));
8199
+ }
8200
+ function uniqueArtifacts(artifacts) {
8201
+ const seen = /* @__PURE__ */ new Set();
8202
+ const out = [];
8203
+ for (const artifact of artifacts) {
8204
+ const key = `${artifact.label}
8205
+ ${artifact.url ?? ""}
8206
+ ${artifact.path ?? ""}`;
8207
+ if (seen.has(key)) continue;
8208
+ seen.add(key);
8209
+ out.push(artifact);
8210
+ }
8211
+ return out;
8212
+ }
8213
+ function parseFacts3(raw) {
8214
+ if (raw === void 0) return {};
8215
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
8216
+ const facts = {};
8217
+ for (const [key, value] of Object.entries(raw)) {
8218
+ if (!key.trim()) return null;
8219
+ if (CONTROL_FACT_KEYS3.has(key)) continue;
8220
+ facts[key] = value;
8221
+ }
8222
+ return facts;
8223
+ }
8224
+ function parseStringArray3(raw) {
8225
+ if (!Array.isArray(raw)) return null;
8226
+ const out = [];
8227
+ for (const item of raw) {
8228
+ if (typeof item !== "string") return null;
8229
+ out.push(item);
8230
+ }
8231
+ return out;
8232
+ }
8233
+ var CONTROL_FACT_KEYS3;
8234
+ var init_agent_responsibilityEvidence = __esm({
8235
+ "src/agent-responsibilityEvidence.ts"() {
8236
+ "use strict";
8237
+ CONTROL_FACT_KEYS3 = /* @__PURE__ */ new Set(["blockers", "destination", "agent-responsibilities", "route", "stage", "state"]);
8238
+ }
8239
+ });
8240
+
8125
8241
  // src/scripts/applyAgentResponsibilityReports.ts
8126
8242
  function flushLogs(ctx) {
8127
8243
  try {
@@ -8155,13 +8271,24 @@ function collectResults(raw, agentResult) {
8155
8271
  if (agentResult?.finalText) out.push(...parseAgentResponsibilityResultsFromText(agentResult.finalText));
8156
8272
  return out;
8157
8273
  }
8158
- function groupGoalReports(reports) {
8159
- const grouped = /* @__PURE__ */ new Map();
8274
+ function collectGoalResponsibilityEvidence(reports, results, fallbackGoalId, explicitEvidence) {
8275
+ const items = [];
8160
8276
  for (const report of reports) {
8161
- if (report.target.type !== "goal") continue;
8162
- const list = grouped.get(report.target.id) ?? [];
8163
- list.push(report);
8164
- grouped.set(report.target.id, list);
8277
+ const evidence = agentResponsibilityReportToEvidence(report);
8278
+ if (evidence) items.push(evidence);
8279
+ }
8280
+ for (const result of results) {
8281
+ const evidence = agentResponsibilityResultToEvidence(result, fallbackGoalId, explicitEvidence);
8282
+ if (evidence) items.push(evidence);
8283
+ }
8284
+ return mergeResponsibilityEvidence(items);
8285
+ }
8286
+ function groupGoalEvidence(evidenceItems) {
8287
+ const grouped = /* @__PURE__ */ new Map();
8288
+ for (const evidence of evidenceItems) {
8289
+ const list = grouped.get(evidence.target.id) ?? [];
8290
+ list.push(evidence);
8291
+ grouped.set(evidence.target.id, list);
8165
8292
  }
8166
8293
  return grouped;
8167
8294
  }
@@ -8178,30 +8305,17 @@ function snapshotFromState(goalId, state) {
8178
8305
  const managed = managedGoalFromState(state);
8179
8306
  return managed ? goalRunLogSnapshot(goalId, state.state, managed) : null;
8180
8307
  }
8181
- function responsibilityReportOutput(report, goalAfter) {
8182
- const evidence = report.evidence ?? {};
8183
- const values = Object.values(evidence);
8184
- const status = values.some((value) => value === false) ? "fail" : values.length > 0 || report.facts ? "changed" : "noop";
8185
- return {
8186
- kind: "report",
8187
- status,
8188
- summary: "responsibility reported goal evidence",
8189
- evidence,
8190
- facts: report.facts ?? {},
8191
- artifacts: [],
8192
- missingEvidence: stringArrayField(goalAfter, "missingEvidence"),
8193
- blockers: stringArrayField(goalAfter, "blockers")
8194
- };
8195
- }
8196
- function responsibilityResultOutput(result) {
8308
+ function responsibilityEvidenceOutput(evidence) {
8197
8309
  return {
8198
- kind: "result",
8199
- status: result.status,
8200
- summary: result.summary,
8201
- facts: result.facts,
8202
- artifacts: result.artifacts,
8203
- missingEvidence: result.missingEvidence,
8204
- blockers: result.blockers
8310
+ kind: "responsibility-evidence",
8311
+ sources: evidence.sources,
8312
+ status: evidence.status,
8313
+ summary: evidence.summary,
8314
+ evidence: evidence.evidence ?? {},
8315
+ facts: evidence.facts,
8316
+ artifacts: evidence.artifacts,
8317
+ missingEvidence: evidence.missingEvidence,
8318
+ blockers: evidence.blockers
8205
8319
  };
8206
8320
  }
8207
8321
  function evidenceInspection(goalBefore, goalAfter, responsibilityOutput, explicitEvidence) {
@@ -8244,16 +8358,15 @@ function stringArrayField(record2, key) {
8244
8358
  const value = record2?.[key];
8245
8359
  return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : [];
8246
8360
  }
8247
- function describeMessage(goalId, reports, results) {
8248
- const pieces = [];
8249
- if (reports && reports.length > 0) pieces.push(`report=${reports.length}`);
8250
- if (results.length > 0) pieces.push(`result=${results.map((result) => result.status).join(",")}`);
8361
+ function describeMessage(goalId, evidenceItems) {
8362
+ const pieces = evidenceItems.map((evidence) => `${evidence.sources.join("+")}:${evidence.status}`);
8251
8363
  return `Apply agentResponsibility output to ${goalId}${pieces.length > 0 ? ` (${pieces.join("; ")})` : ""}`;
8252
8364
  }
8253
8365
  var applyAgentResponsibilityReports;
8254
8366
  var init_applyAgentResponsibilityReports = __esm({
8255
8367
  "src/scripts/applyAgentResponsibilityReports.ts"() {
8256
8368
  "use strict";
8369
+ init_agent_responsibilityEvidence();
8257
8370
  init_agent_responsibilityReport();
8258
8371
  init_agent_responsibilityResult();
8259
8372
  init_manager();
@@ -8264,11 +8377,11 @@ var init_applyAgentResponsibilityReports = __esm({
8264
8377
  const reports = collectReports(ctx.data.agentResponsibilityReports, agentResult);
8265
8378
  const results = collectResults(ctx.data.dutyResults, agentResult);
8266
8379
  const resultGoalId = typeof ctx.args.goal === "string" && ctx.args.goal.length > 0 ? ctx.args.goal : null;
8267
- if (reports.length === 0 && (results.length === 0 || !resultGoalId)) return;
8268
- const reportsByGoal = groupGoalReports(reports);
8269
- const goalIds = new Set(reportsByGoal.keys());
8270
- if (results.length > 0 && resultGoalId) goalIds.add(resultGoalId);
8271
- for (const goalId of goalIds) {
8380
+ const explicitEvidence = typeof ctx.args.evidence === "string" && ctx.args.evidence.length > 0 ? ctx.args.evidence : void 0;
8381
+ const evidenceItems = collectGoalResponsibilityEvidence(reports, results, resultGoalId, explicitEvidence);
8382
+ if (evidenceItems.length === 0) return;
8383
+ const evidenceByGoal = groupGoalEvidence(evidenceItems);
8384
+ for (const [goalId, goalEvidence] of evidenceByGoal) {
8272
8385
  const prior = fetchGoalState(ctx.config, goalId, ctx.cwd);
8273
8386
  if (!prior) {
8274
8387
  stageGoalRunLogEvent(ctx.data, goalId, {
@@ -8278,8 +8391,9 @@ var init_applyAgentResponsibilityReports = __esm({
8278
8391
  reason: "goal missing in state repo",
8279
8392
  inspection: {
8280
8393
  responsibilityOutput: {
8281
- reports: reportsByGoal.get(goalId)?.length ?? 0,
8282
- results: goalId === resultGoalId ? results.length : 0
8394
+ kind: "responsibility-evidence",
8395
+ count: goalEvidence.length,
8396
+ items: goalEvidence.map(responsibilityEvidenceOutput)
8283
8397
  },
8284
8398
  missingEvidence: [],
8285
8399
  blockers: ["goal missing in state repo"]
@@ -8292,54 +8406,32 @@ var init_applyAgentResponsibilityReports = __esm({
8292
8406
  continue;
8293
8407
  }
8294
8408
  let next = prior;
8295
- for (const report of reportsByGoal.get(goalId) ?? []) {
8409
+ for (const evidence of goalEvidence) {
8296
8410
  const beforeSnapshot = snapshotFromState(goalId, next);
8297
- next = applyAgentResponsibilityReportToGoalState(next, report);
8411
+ next = applyAgentResponsibilityEvidenceToGoalState(next, evidence);
8298
8412
  const afterSnapshot = snapshotFromState(goalId, next);
8299
8413
  const change = goalRunLogChange(beforeSnapshot, afterSnapshot);
8300
- const output = responsibilityReportOutput(report, afterSnapshot);
8414
+ const output = responsibilityEvidenceOutput(evidence);
8301
8415
  stageGoalRunLogEvent(ctx.data, goalId, {
8302
8416
  source: "goal-loop",
8303
8417
  event: change ? "goal.evidence.applied" : "goal.evidence.unchanged",
8304
8418
  goalState: next.state,
8305
- evidenceValues: report.evidence,
8306
- facts: report.facts,
8419
+ evidence: evidence.explicitEvidence,
8420
+ evidenceValues: evidence.evidence,
8421
+ status: evidence.status,
8422
+ reason: evidence.summary,
8423
+ facts: evidence.facts,
8424
+ artifacts: evidence.artifacts,
8307
8425
  goal: afterSnapshot ?? void 0,
8308
- inspection: evidenceInspection(beforeSnapshot, afterSnapshot, output),
8426
+ inspection: evidenceInspection(beforeSnapshot, afterSnapshot, output, evidence.explicitEvidence),
8309
8427
  decision: {
8310
8428
  ...evidenceDecision(change, afterSnapshot, output),
8311
- evidence: report.evidence
8429
+ evidence: evidence.explicitEvidence,
8430
+ evidenceValues: evidence.evidence
8312
8431
  },
8313
8432
  change
8314
8433
  });
8315
8434
  }
8316
- if (goalId === resultGoalId) {
8317
- const evidence = typeof ctx.args.evidence === "string" && ctx.args.evidence.length > 0 ? ctx.args.evidence : void 0;
8318
- for (const result of results) {
8319
- const beforeSnapshot = snapshotFromState(goalId, next);
8320
- next = applyAgentResponsibilityResultToObjectiveState(next, result, evidence);
8321
- const afterSnapshot = snapshotFromState(goalId, next);
8322
- const change = goalRunLogChange(beforeSnapshot, afterSnapshot);
8323
- const output = responsibilityResultOutput(result);
8324
- stageGoalRunLogEvent(ctx.data, goalId, {
8325
- source: "goal-loop",
8326
- event: change ? "goal.evidence.applied" : "goal.evidence.unchanged",
8327
- goalState: next.state,
8328
- evidence,
8329
- status: result.status,
8330
- reason: result.summary,
8331
- facts: result.facts,
8332
- artifacts: result.artifacts,
8333
- goal: afterSnapshot ?? beforeSnapshot ?? void 0,
8334
- inspection: evidenceInspection(beforeSnapshot, afterSnapshot, output, evidence),
8335
- decision: {
8336
- ...evidenceDecision(change, afterSnapshot, output),
8337
- evidence
8338
- },
8339
- change
8340
- });
8341
- }
8342
- }
8343
8435
  const beforeCompletionSnapshot = snapshotFromState(goalId, next);
8344
8436
  next = completeSatisfiedManagedGoal(next);
8345
8437
  const afterCompletionSnapshot = snapshotFromState(goalId, next);
@@ -8364,13 +8456,7 @@ var init_applyAgentResponsibilityReports = __esm({
8364
8456
  flushLogs(ctx);
8365
8457
  continue;
8366
8458
  }
8367
- putGoalState(
8368
- ctx.config,
8369
- goalId,
8370
- { ...next, updatedAt: nowIso() },
8371
- describeMessage(goalId, reportsByGoal.get(goalId), results),
8372
- ctx.cwd
8373
- );
8459
+ putGoalState(ctx.config, goalId, { ...next, updatedAt: nowIso() }, describeMessage(goalId, goalEvidence), ctx.cwd);
8374
8460
  flushLogs(ctx);
8375
8461
  }
8376
8462
  };
@@ -21604,7 +21690,7 @@ async function runnerServe() {
21604
21690
  init_config();
21605
21691
  init_litellm();
21606
21692
  import { spawn as spawn9 } from "child_process";
21607
- function parseTarget2(positional) {
21693
+ function parseTarget(positional) {
21608
21694
  if (!Array.isArray(positional) || positional.length === 0) return "none";
21609
21695
  const first = String(positional[0]).toLowerCase();
21610
21696
  if (first === "vscode" || first === "code") return "vscode";
@@ -21619,7 +21705,7 @@ function buildProxyEnv(url) {
21619
21705
  };
21620
21706
  }
21621
21707
  async function serve(opts) {
21622
- const target = parseTarget2(opts.args);
21708
+ const target = parseTarget(opts.args);
21623
21709
  const model = parseProviderModel(opts.config.agent.model);
21624
21710
  const usesProxy = needsLitellmProxy(model);
21625
21711
  let handle = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.256",
3
+ "version": "0.4.257",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative agentAction profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",