@kody-ade/kody-engine 0.4.387 → 0.4.389

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 +38 -11
  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.387",
18
+ version: "0.4.388",
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",
@@ -3912,6 +3912,14 @@ function createStateBackendFromEnv(env = process.env, client) {
3912
3912
  updatedAt,
3913
3913
  ...expectedUpdatedAt ? { expectedUpdatedAt } : {}
3914
3914
  });
3915
+ },
3916
+ async appendDailyLog(tenantId, stream, date, entry) {
3917
+ await transport.mutation(anyApi.dailyLogs.append, {
3918
+ tenantId: requireTenant(tenantId),
3919
+ stream,
3920
+ date: requireNonEmpty(date, "date"),
3921
+ entry
3922
+ });
3915
3923
  }
3916
3924
  };
3917
3925
  }
@@ -8134,6 +8142,24 @@ function flushGoalRunLogEvents(config, cwd, data) {
8134
8142
  log2.events = [];
8135
8143
  }
8136
8144
  }
8145
+ async function flushGoalRunLogEventsAsync(config, cwd, data) {
8146
+ const tenantId = config.github?.owner && config.github.repo ? `${config.github.owner}/${config.github.repo}` : process.env.GITHUB_REPOSITORY;
8147
+ const backendConfigured = Boolean(process.env.CONVEX_URL?.trim() && process.env.KODY_SERVICE_KEY?.trim() && tenantId);
8148
+ if (!backendConfigured) {
8149
+ if (process.env.GITHUB_ACTIONS === "true") throw new Error("Convex backend is required for goal run logs in GitHub Actions");
8150
+ flushGoalRunLogEvents(config, cwd, data);
8151
+ return;
8152
+ }
8153
+ const backend = createStateBackendFromEnv();
8154
+ for (const [goalId, log2] of Object.entries(goalRunLogs(data))) {
8155
+ if (log2.events.length === 0) continue;
8156
+ const enrichedEvents = log2.events.map((event) => enrichGoalRunLogEvent(config, data, log2.path, event));
8157
+ for (const event of enrichedEvents) {
8158
+ await backend.appendDailyLog(tenantId, "events", event.time.slice(0, 10), event);
8159
+ }
8160
+ log2.events = [];
8161
+ }
8162
+ }
8137
8163
  function goalRunLogPath(goalId, data) {
8138
8164
  const startedAt = goalRunStartedAt(data);
8139
8165
  const runId = goalRunId(data);
@@ -8556,6 +8582,7 @@ var init_runLog = __esm({
8556
8582
  "use strict";
8557
8583
  init_runIndex();
8558
8584
  init_stateRepo();
8585
+ init_state_backend();
8559
8586
  init_state2();
8560
8587
  LOGS_KEY = "__goalRunLogs";
8561
8588
  LOG_RUN_KEY = "__goalRunLogRunId";
@@ -11345,9 +11372,9 @@ function createNeedsFixIssue(goalId, evidence, result, cwd) {
11345
11372
  if (!match) throw new Error(`gh issue create returned unexpected output: ${out}`);
11346
11373
  return Number(match[1]);
11347
11374
  }
11348
- function flushLogs(ctx) {
11375
+ async function flushLogs(ctx) {
11349
11376
  try {
11350
- flushGoalRunLogEvents(ctx.config, ctx.cwd, ctx.data);
11377
+ await flushGoalRunLogEventsAsync(ctx.config, ctx.cwd, ctx.data);
11351
11378
  } catch (err) {
11352
11379
  process.stderr.write(
11353
11380
  `[kody capability-report] goal log persist failed (${err instanceof Error ? err.message : String(err)})
@@ -11542,7 +11569,7 @@ var init_applyCapabilityReports = __esm({
11542
11569
  },
11543
11570
  decision: { kind: "reject-evidence", nextStep: "block", reason: "goal missing in state repo" }
11544
11571
  });
11545
- flushLogs(ctx);
11572
+ await flushLogs(ctx);
11546
11573
  process.stderr.write(`[kody capability-report] goal ${goalId} missing in state repo; report skipped
11547
11574
  `);
11548
11575
  continue;
@@ -11610,7 +11637,7 @@ var init_applyCapabilityReports = __esm({
11610
11637
  };
11611
11638
  }
11612
11639
  } finally {
11613
- flushLogs(ctx);
11640
+ await flushLogs(ctx);
11614
11641
  }
11615
11642
  }
11616
11643
  };
@@ -11909,9 +11936,9 @@ function refreshReportOrFail2(ctx, goalId, state) {
11909
11936
  if (ctx.output.exitCode === 0) ctx.output.exitCode = 99;
11910
11937
  }
11911
11938
  }
11912
- function flushLogs2(ctx) {
11939
+ async function flushLogs2(ctx) {
11913
11940
  try {
11914
- flushGoalRunLogEvents(ctx.config, ctx.cwd, ctx.data);
11941
+ await flushGoalRunLogEventsAsync(ctx.config, ctx.cwd, ctx.data);
11915
11942
  } catch (err) {
11916
11943
  process.stderr.write(
11917
11944
  `[goal-manager] goal log persist failed (${err instanceof Error ? err.message : String(err)})
@@ -11933,17 +11960,17 @@ var init_commitGoalState = __esm({
11933
11960
  commitGoalState = async (ctx) => {
11934
11961
  const goal = ctx.data.goal;
11935
11962
  if (!goal) {
11936
- flushLogs2(ctx);
11963
+ await flushLogs2(ctx);
11937
11964
  return;
11938
11965
  }
11939
11966
  if (ctx.data.goalPersistChanged !== true) {
11940
11967
  refreshReportOrFail2(ctx, goal.id, goal.raw);
11941
- flushLogs2(ctx);
11968
+ await flushLogs2(ctx);
11942
11969
  return;
11943
11970
  }
11944
11971
  const updated = ctx.data.goalPersistState;
11945
11972
  if (!updated) {
11946
- flushLogs2(ctx);
11973
+ await flushLogs2(ctx);
11947
11974
  return;
11948
11975
  }
11949
11976
  try {
@@ -11955,7 +11982,7 @@ var init_commitGoalState = __esm({
11955
11982
  `
11956
11983
  );
11957
11984
  } finally {
11958
- flushLogs2(ctx);
11985
+ await flushLogs2(ctx);
11959
11986
  }
11960
11987
  };
11961
11988
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.387",
3
+ "version": "0.4.389",
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",