@kody-ade/kody-engine 0.4.390 → 0.4.392
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 +67 -14
- 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.
|
|
18
|
+
version: "0.4.391",
|
|
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
|
-
|
|
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
|
});
|
|
@@ -17774,22 +17828,16 @@ var init_requireDeliveryArtifacts = __esm({
|
|
|
17774
17828
|
if (!prSummary) missing.push("PR_SUMMARY");
|
|
17775
17829
|
if (missing.length === 0) return;
|
|
17776
17830
|
const reason = `agent omitted required delivery artifacts: ${missing.join(", ")}`;
|
|
17777
|
-
ctx.
|
|
17778
|
-
ctx.data.
|
|
17779
|
-
ctx.data.agentMissingArtifacts = missing;
|
|
17780
|
-
ctx.data.agentFailureReason = reason;
|
|
17831
|
+
const target = typeof ctx.args.issue === "number" ? `issue #${ctx.args.issue}` : typeof ctx.args.pr === "number" ? `PR #${ctx.args.pr}` : "task";
|
|
17832
|
+
if (!commitMessage) ctx.data.commitMessage = `chore: update ${target}`;
|
|
17781
17833
|
if (!prSummary) {
|
|
17782
17834
|
const fallback = fallbackSummary(String(ctx.data.agentFinalText ?? ""));
|
|
17835
|
+
ctx.data.prSummary = fallback || `Automated changes for ${target}.`;
|
|
17783
17836
|
if (fallback) ctx.data.agentFallbackSummary = fallback;
|
|
17784
17837
|
}
|
|
17785
|
-
|
|
17786
|
-
|
|
17787
|
-
|
|
17788
|
-
type: action.type.replace(/_COMPLETED$/, "_FAILED"),
|
|
17789
|
-
payload: { reason, downgradedFrom: action.type },
|
|
17790
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
17791
|
-
};
|
|
17792
|
-
}
|
|
17838
|
+
ctx.data.agentResultIncomplete = true;
|
|
17839
|
+
ctx.data.agentMissingArtifacts = missing;
|
|
17840
|
+
ctx.data.agentFailureReason = reason;
|
|
17793
17841
|
};
|
|
17794
17842
|
}
|
|
17795
17843
|
});
|
|
@@ -21077,6 +21125,10 @@ async function runImplementation(profileName, input) {
|
|
|
21077
21125
|
const taskArtifacts = typeof taskTarget === "number" && Number.isFinite(taskTarget) ? (() => {
|
|
21078
21126
|
const taskType = args.issue ? "issue" : "pr";
|
|
21079
21127
|
const paths = prepareTaskArtifactsDir(input.cwd, taskTarget);
|
|
21128
|
+
initializeTaskArtifacts(paths, {
|
|
21129
|
+
taskType,
|
|
21130
|
+
target: String(taskTarget)
|
|
21131
|
+
});
|
|
21080
21132
|
return {
|
|
21081
21133
|
...paths,
|
|
21082
21134
|
taskKey: `${taskType === "issue" ? "issues" : "prs"}/${paths.taskId}`,
|
|
@@ -23166,6 +23218,7 @@ async function runChatTurn(opts) {
|
|
|
23166
23218
|
...prepareTaskArtifactsDir(opts.cwd, opts.sessionId),
|
|
23167
23219
|
taskKey: `sessions/${opts.sessionId}`
|
|
23168
23220
|
};
|
|
23221
|
+
initializeTaskArtifacts(taskArtifactsPaths, { taskType: "chat", target: opts.sessionId });
|
|
23169
23222
|
const artifactAddendum = taskArtifactsPromptAddendum({
|
|
23170
23223
|
taskId: taskArtifactsPaths.taskId,
|
|
23171
23224
|
taskType: "chat",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kody-ade/kody-engine",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.392",
|
|
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",
|