@kody-ade/kody-engine 0.4.390 → 0.4.391

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 +61 -2
  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.388",
18
+ version: "0.4.390",
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",
@@ -3920,6 +3920,17 @@ function createStateBackendFromEnv(env = process.env, client) {
3920
3920
  date: requireNonEmpty(date, "date"),
3921
3921
  entry
3922
3922
  });
3923
+ },
3924
+ async saveReport(tenantId, slug, runId, title, body, meta, updatedAt) {
3925
+ await transport.mutation(anyApi.reports.save, {
3926
+ tenantId: requireTenant(tenantId),
3927
+ slug: requireNonEmpty(slug, "slug"),
3928
+ runId: requireNonEmpty(runId, "runId"),
3929
+ title,
3930
+ body,
3931
+ meta,
3932
+ updatedAt
3933
+ });
3923
3934
  }
3924
3935
  };
3925
3936
  }
@@ -3941,6 +3952,36 @@ function prepareTaskArtifactsDir(cwd, taskId) {
3941
3952
  fs10.mkdirSync(absDir, { recursive: true });
3942
3953
  return { taskId: safeId, absDir, relDir };
3943
3954
  }
3955
+ function initializeTaskArtifacts(artifacts, metadata = { taskType: "job" }) {
3956
+ const startedAt = (/* @__PURE__ */ new Date()).toISOString();
3957
+ const defaults = {
3958
+ "context.json": JSON.stringify(
3959
+ {
3960
+ taskId: artifacts.taskId,
3961
+ taskType: metadata.taskType,
3962
+ target: metadata.target ?? artifacts.taskId,
3963
+ outcome: "partial",
3964
+ exitCode: null,
3965
+ reason: "Baseline created; agent details not provided",
3966
+ prUrl: null,
3967
+ runUrl: process.env.GITHUB_RUN_URL ?? null,
3968
+ filesTouched: [],
3969
+ sessionLog: null,
3970
+ startedAt,
3971
+ finishedAt: null
3972
+ },
3973
+ null,
3974
+ 2
3975
+ ) + "\n",
3976
+ "memory-recs.json": "[]\n",
3977
+ "followups.json": "[]\n",
3978
+ "handoff-notes.md": "Baseline handoff: the agent did not provide additional notes.\n"
3979
+ };
3980
+ for (const file of TASK_ARTIFACT_FILES) {
3981
+ const full = path12.join(artifacts.absDir, file);
3982
+ if (!fs10.existsSync(full)) fs10.writeFileSync(full, defaults[file], "utf8");
3983
+ }
3984
+ }
3944
3985
  function verifyTaskArtifacts(absDir) {
3945
3986
  const missing = [];
3946
3987
  for (const name of TASK_ARTIFACT_FILES) {
@@ -17626,6 +17667,7 @@ var init_publishReport = __esm({
17626
17667
  "use strict";
17627
17668
  init_capabilityResult();
17628
17669
  init_stateRepo();
17670
+ init_state_backend();
17629
17671
  SAFE_SLUG = /^[a-z0-9][a-z0-9_-]{0,79}$/;
17630
17672
  publishReport = async (ctx, _profile, agentResult) => {
17631
17673
  const publication = parsePublication(ctx.data.reportPublication);
@@ -17651,7 +17693,19 @@ var init_publishReport = __esm({
17651
17693
  ...publication.reviewArea ? { reviewArea: publication.reviewArea } : {}
17652
17694
  });
17653
17695
  const runId = generatedAt.replace(/\.\d{3}Z$/, "Z").replace(/:/g, "-");
17654
- writeStateText(ctx.config, ctx.cwd, `reports/${slug}/runs/${runId}.md`, markdown, `chore(reports): add ${slug} run`);
17696
+ const tenantId = ctx.config.github?.owner && ctx.config.github.repo ? `${ctx.config.github.owner}/${ctx.config.github.repo}` : process.env.GITHUB_REPOSITORY;
17697
+ if (process.env.CONVEX_URL?.trim() && process.env.KODY_SERVICE_KEY?.trim() && tenantId) {
17698
+ await createStateBackendFromEnv().saveReport(tenantId, slug, runId, title, markdown, {
17699
+ reportType: publication.type,
17700
+ reportTypeVersion: publication.version ?? 1,
17701
+ owner: publication.owner,
17702
+ capability: stringValue4(ctx.data.jobCapability) ?? stringValue4(ctx.data.capabilitySlug) ?? "unknown"
17703
+ }, generatedAt);
17704
+ } else if (process.env.GITHUB_ACTIONS === "true") {
17705
+ throw new Error("Convex backend is required for reports in GitHub Actions");
17706
+ } else {
17707
+ writeStateText(ctx.config, ctx.cwd, `reports/${slug}/runs/${runId}.md`, markdown, `chore(reports): add ${slug} run`);
17708
+ }
17655
17709
  };
17656
17710
  }
17657
17711
  });
@@ -21077,6 +21131,10 @@ async function runImplementation(profileName, input) {
21077
21131
  const taskArtifacts = typeof taskTarget === "number" && Number.isFinite(taskTarget) ? (() => {
21078
21132
  const taskType = args.issue ? "issue" : "pr";
21079
21133
  const paths = prepareTaskArtifactsDir(input.cwd, taskTarget);
21134
+ initializeTaskArtifacts(paths, {
21135
+ taskType,
21136
+ target: String(taskTarget)
21137
+ });
21080
21138
  return {
21081
21139
  ...paths,
21082
21140
  taskKey: `${taskType === "issue" ? "issues" : "prs"}/${paths.taskId}`,
@@ -23166,6 +23224,7 @@ async function runChatTurn(opts) {
23166
23224
  ...prepareTaskArtifactsDir(opts.cwd, opts.sessionId),
23167
23225
  taskKey: `sessions/${opts.sessionId}`
23168
23226
  };
23227
+ initializeTaskArtifacts(taskArtifactsPaths, { taskType: "chat", target: opts.sessionId });
23169
23228
  const artifactAddendum = taskArtifactsPromptAddendum({
23170
23229
  taskId: taskArtifactsPaths.taskId,
23171
23230
  taskType: "chat",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.390",
3
+ "version": "0.4.391",
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",