@kody-ade/kody-engine 0.4.423 → 0.4.424

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 +17 -6
  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.423",
18
+ version: "0.4.424",
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",
@@ -2447,17 +2447,17 @@ function createStateBackendFromEnv(env = process.env, client) {
2447
2447
  });
2448
2448
  return Array.isArray(result) ? result : [];
2449
2449
  },
2450
- async getAgencyState(tenantId2, definitionId) {
2450
+ async getAgencyState(tenantId2, definitionId2) {
2451
2451
  const result = await transport.query(anyApi.agencyModel.getState, {
2452
2452
  tenantId: requireTenant(tenantId2),
2453
- definitionId: requireNonEmpty(definitionId, "definitionId")
2453
+ definitionId: requireNonEmpty(definitionId2, "definitionId")
2454
2454
  });
2455
2455
  return result ?? null;
2456
2456
  },
2457
- async putAgencyState(tenantId2, definitionId, kind, schemaVersion, data, updatedAt) {
2457
+ async putAgencyState(tenantId2, definitionId2, kind, schemaVersion, data, updatedAt) {
2458
2458
  await transport.mutation(anyApi.agencyModel.putState, {
2459
2459
  tenantId: requireTenant(tenantId2),
2460
- definitionId: requireNonEmpty(definitionId, "definitionId"),
2460
+ definitionId: requireNonEmpty(definitionId2, "definitionId"),
2461
2461
  kind,
2462
2462
  schemaVersion,
2463
2463
  data,
@@ -13018,6 +13018,13 @@ function goalProgressFromOutputs(definition, outputs) {
13018
13018
  );
13019
13019
  return required2.filter((key) => satisfied.has(key)).length / required2.length;
13020
13020
  }
13021
+ function definitionId(document) {
13022
+ const data = document.data;
13023
+ if (typeof data.id !== "string" || !data.id.trim()) {
13024
+ throw new Error(`Agency Definition is missing id: ${document.recordId}`);
13025
+ }
13026
+ return data.id;
13027
+ }
13021
13028
  function parseState(document, definition, kind) {
13022
13029
  if (!document) return null;
13023
13030
  if (document.schemaVersion !== 1) throw new Error(`Unsupported Agency State schema: ${document.schemaVersion}`);
@@ -13111,7 +13118,11 @@ var init_agencyModelRepository = __esm({
13111
13118
  const ordered = [...documents].sort(
13112
13119
  (left, right) => left.createdAt.localeCompare(right.createdAt) || left.recordId.localeCompare(right.recordId)
13113
13120
  );
13114
- for (const document of ordered) addDefinition(catalog, document);
13121
+ const latest = /* @__PURE__ */ new Map();
13122
+ for (const document of ordered) {
13123
+ latest.set(`${document.kind}:${definitionId(document)}`, document);
13124
+ }
13125
+ for (const document of latest.values()) addDefinition(catalog, document);
13115
13126
  validateRelationships(catalog);
13116
13127
  return catalog;
13117
13128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.423",
3
+ "version": "0.4.424",
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",