@kody-ade/kody-engine 0.4.598 → 0.4.600
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 +43 -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.600",
|
|
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",
|
|
@@ -861,8 +861,30 @@ function createOutputContractPostWriteHook(contract) {
|
|
|
861
861
|
};
|
|
862
862
|
}
|
|
863
863
|
function createOutputContractStopHook(contract) {
|
|
864
|
-
return async () => {
|
|
864
|
+
return async (input = {}) => {
|
|
865
865
|
if (!fs4.existsSync(contract.path)) {
|
|
866
|
+
const message = input.last_assistant_message;
|
|
867
|
+
if (typeof message === "string" && message.trim()) {
|
|
868
|
+
let value;
|
|
869
|
+
try {
|
|
870
|
+
value = JSON.parse(message);
|
|
871
|
+
} catch {
|
|
872
|
+
value = void 0;
|
|
873
|
+
}
|
|
874
|
+
if (value !== void 0) {
|
|
875
|
+
try {
|
|
876
|
+
validateCapabilityContractOutput(contract.schema, value);
|
|
877
|
+
fs4.mkdirSync(path5.dirname(contract.path), { recursive: true });
|
|
878
|
+
fs4.writeFileSync(contract.path, JSON.stringify(value), { mode: 384 });
|
|
879
|
+
return {};
|
|
880
|
+
} catch (error2) {
|
|
881
|
+
return {
|
|
882
|
+
decision: "block",
|
|
883
|
+
reason: `The final JSON response does not match its required contract: ${error2 instanceof Error ? error2.message : String(error2)}. Return one corrected JSON value and finish.`
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
866
888
|
return {
|
|
867
889
|
decision: "block",
|
|
868
890
|
reason: "Continue the Journey from the current page and complete the next unresolved user outcome. Do not write the result merely because you paused; write it only after the Journey passes, fails, or cannot safely continue."
|
|
@@ -18335,16 +18357,22 @@ function browserOrigin(raw) {
|
|
|
18335
18357
|
}
|
|
18336
18358
|
return parsed.origin;
|
|
18337
18359
|
}
|
|
18338
|
-
async function githubJson(url, token) {
|
|
18339
|
-
const
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
|
|
18360
|
+
async function githubJson(url, token, checkName) {
|
|
18361
|
+
const retryDelaysMs2 = [250, 750];
|
|
18362
|
+
for (let attempt = 0; attempt <= retryDelaysMs2.length; attempt += 1) {
|
|
18363
|
+
const response = await fetch(url, {
|
|
18364
|
+
headers: {
|
|
18365
|
+
Accept: "application/vnd.github+json",
|
|
18366
|
+
Authorization: `Bearer ${token}`,
|
|
18367
|
+
"X-GitHub-Api-Version": "2022-11-28"
|
|
18368
|
+
}
|
|
18369
|
+
});
|
|
18370
|
+
if (response.ok) return await response.json();
|
|
18371
|
+
const canRetry = response.status >= 500 && response.status <= 599 && attempt < retryDelaysMs2.length;
|
|
18372
|
+
if (!canRetry) throw new Error(`GitHub ${checkName} check returned ${response.status}`);
|
|
18373
|
+
await new Promise((resolve24) => setTimeout(resolve24, retryDelaysMs2[attempt]));
|
|
18374
|
+
}
|
|
18375
|
+
throw new Error(`GitHub ${checkName} check failed`);
|
|
18348
18376
|
}
|
|
18349
18377
|
function writeKodyStorageState(input) {
|
|
18350
18378
|
const directory = fs48.mkdtempSync(path45.join(os7.tmpdir(), "kody-browser-auth-"));
|
|
@@ -18451,10 +18479,11 @@ async function prepareKodyRepositoryBrowserAuth(ctx, profile, input) {
|
|
|
18451
18479
|
try {
|
|
18452
18480
|
const requested = githubRepositoryParts(repositoryUrl);
|
|
18453
18481
|
const [user, repository] = await Promise.all([
|
|
18454
|
-
githubJson("https://api.github.com/user", credential.value),
|
|
18482
|
+
githubJson("https://api.github.com/user", credential.value, "user"),
|
|
18455
18483
|
githubJson(
|
|
18456
18484
|
`https://api.github.com/repos/${encodeURIComponent(requested.owner)}/${encodeURIComponent(requested.repo)}`,
|
|
18457
|
-
credential.value
|
|
18485
|
+
credential.value,
|
|
18486
|
+
"repository"
|
|
18458
18487
|
)
|
|
18459
18488
|
]);
|
|
18460
18489
|
const [owner, repo] = repository.full_name.split("/");
|
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.600",
|
|
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",
|