@kody-ade/kody-engine 0.4.603 → 0.4.605
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 +68 -5
- package/package.json +1 -1
- package/templates/kody.yml +1 -0
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.605",
|
|
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",
|
|
@@ -18385,7 +18385,8 @@ function writeKodyStorageState(input) {
|
|
|
18385
18385
|
repo: input.repo,
|
|
18386
18386
|
token: input.token,
|
|
18387
18387
|
addedAt: now,
|
|
18388
|
-
isLogin: true
|
|
18388
|
+
isLogin: true,
|
|
18389
|
+
...input.user ? { user: input.user } : {}
|
|
18389
18390
|
};
|
|
18390
18391
|
const unresolvedUser = { login: "", avatar_url: "", id: 0 };
|
|
18391
18392
|
const auth = {
|
|
@@ -18393,7 +18394,7 @@ function writeKodyStorageState(input) {
|
|
|
18393
18394
|
owner: input.owner,
|
|
18394
18395
|
repo: input.repo,
|
|
18395
18396
|
token: input.token,
|
|
18396
|
-
user: unresolvedUser,
|
|
18397
|
+
user: input.user ?? unresolvedUser,
|
|
18397
18398
|
loggedInAt: now,
|
|
18398
18399
|
repos: [repoEntry],
|
|
18399
18400
|
currentRepoIndex: 0
|
|
@@ -18408,7 +18409,7 @@ function writeKodyStorageState(input) {
|
|
|
18408
18409
|
]
|
|
18409
18410
|
};
|
|
18410
18411
|
fs48.writeFileSync(file, JSON.stringify(storageState), { mode: 384 });
|
|
18411
|
-
return { directory, file };
|
|
18412
|
+
return { directory, file, auth };
|
|
18412
18413
|
}
|
|
18413
18414
|
function parseSetCookie(value, hostname) {
|
|
18414
18415
|
const parts = value.split(";").map((part) => part.trim());
|
|
@@ -18458,6 +18459,58 @@ function currentStorageStatePath(args) {
|
|
|
18458
18459
|
}
|
|
18459
18460
|
return void 0;
|
|
18460
18461
|
}
|
|
18462
|
+
function browserSessionCookieHeader(profile, targetUrl) {
|
|
18463
|
+
const playwright = profile.claudeCode.mcpServers.find((server) => server.name === "playwright");
|
|
18464
|
+
const storagePath = currentStorageStatePath(playwright?.args ?? []);
|
|
18465
|
+
if (!storagePath || !fs48.existsSync(storagePath)) return void 0;
|
|
18466
|
+
const hostname = new URL(targetUrl).hostname;
|
|
18467
|
+
const state = JSON.parse(fs48.readFileSync(storagePath, "utf-8"));
|
|
18468
|
+
const cookies = (state.cookies ?? []).filter((cookie) => {
|
|
18469
|
+
const domain = cookie.domain.replace(/^\./, "");
|
|
18470
|
+
return hostname === domain || hostname.endsWith(`.${domain}`);
|
|
18471
|
+
});
|
|
18472
|
+
if (cookies.length === 0) return void 0;
|
|
18473
|
+
return cookies.map((cookie) => `${cookie.name}=${String(cookie.value)}`).join("; ");
|
|
18474
|
+
}
|
|
18475
|
+
async function saveAccountRepositoryAuth(targetUrl, cookie, auth) {
|
|
18476
|
+
const origin = browserOrigin(targetUrl);
|
|
18477
|
+
const response = await fetch(`${origin}/api/kody/account/repositories`, {
|
|
18478
|
+
method: "PUT",
|
|
18479
|
+
headers: { "content-type": "application/json", cookie, origin },
|
|
18480
|
+
body: JSON.stringify({ auth })
|
|
18481
|
+
});
|
|
18482
|
+
if (!response.ok) throw new Error(`app repository setup returned ${response.status}`);
|
|
18483
|
+
}
|
|
18484
|
+
async function prepareAccountCredentials(ctx, profile, input) {
|
|
18485
|
+
const cookie = browserSessionCookieHeader(profile, input.targetUrl);
|
|
18486
|
+
if (!cookie) {
|
|
18487
|
+
appendAuthMessage(ctx, "Auth: QA account credentials could not be prepared because the app session is missing.");
|
|
18488
|
+
return false;
|
|
18489
|
+
}
|
|
18490
|
+
const origin = browserOrigin(input.targetUrl);
|
|
18491
|
+
for (const name of input.names) {
|
|
18492
|
+
if (!/^[A-Z][A-Z0-9_]{0,127}$/.test(name)) {
|
|
18493
|
+
appendAuthMessage(ctx, "Auth: QA account credentials contain an invalid credential name.");
|
|
18494
|
+
return false;
|
|
18495
|
+
}
|
|
18496
|
+
const credential = await resolveRuntimeSecret(name, ctx);
|
|
18497
|
+
if (!credential.value) {
|
|
18498
|
+
appendAuthMessage(ctx, `Auth: QA account setup is incomplete because no \`${name}\` secret was found.`);
|
|
18499
|
+
return false;
|
|
18500
|
+
}
|
|
18501
|
+
const response = await fetch(`${origin}/api/kody/account/credentials`, {
|
|
18502
|
+
method: "PUT",
|
|
18503
|
+
headers: { "content-type": "application/json", cookie, origin },
|
|
18504
|
+
body: JSON.stringify({ name, value: credential.value })
|
|
18505
|
+
});
|
|
18506
|
+
if (!response.ok) {
|
|
18507
|
+
appendAuthMessage(ctx, `Auth: QA account credential setup returned ${response.status}.`);
|
|
18508
|
+
return false;
|
|
18509
|
+
}
|
|
18510
|
+
}
|
|
18511
|
+
appendAuthMessage(ctx, "Auth: the QA account's required model credentials are already prepared by the engine.");
|
|
18512
|
+
return true;
|
|
18513
|
+
}
|
|
18461
18514
|
function mergeStorageStates(existingPath, nextPath) {
|
|
18462
18515
|
if (existingPath === nextPath || !fs48.existsSync(existingPath)) return;
|
|
18463
18516
|
const existing = JSON.parse(fs48.readFileSync(existingPath, "utf-8"));
|
|
@@ -18558,13 +18611,17 @@ async function prepareKodyRepositoryBrowserAuth(ctx, profile, input) {
|
|
|
18558
18611
|
);
|
|
18559
18612
|
const [owner, repo] = repository.full_name.split("/");
|
|
18560
18613
|
if (!owner || !repo) throw new Error("GitHub returned incomplete repository data");
|
|
18614
|
+
const appCookie = browserSessionCookieHeader(profile, input.targetUrl);
|
|
18615
|
+
const user = appCookie ? await githubJson("https://api.github.com/user", credential.value, "user") : void 0;
|
|
18561
18616
|
state = writeKodyStorageState({
|
|
18562
18617
|
origin: browserOrigin(input.targetUrl),
|
|
18563
18618
|
repoUrl: `https://github.com/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`,
|
|
18564
18619
|
owner,
|
|
18565
18620
|
repo,
|
|
18566
|
-
token: credential.value
|
|
18621
|
+
token: credential.value,
|
|
18622
|
+
user
|
|
18567
18623
|
});
|
|
18624
|
+
if (appCookie) await saveAccountRepositoryAuth(input.targetUrl, appCookie, state.auth);
|
|
18568
18625
|
configurePlaywright(profile, state.file);
|
|
18569
18626
|
const authDirectory = state.directory;
|
|
18570
18627
|
registerRuntimeCleanup(ctx, () => {
|
|
@@ -18845,6 +18902,12 @@ var init_prepareSimpleCapabilityRuntime = __esm({
|
|
|
18845
18902
|
login: String(ctx.data.qaLogin ?? ""),
|
|
18846
18903
|
targetUrl
|
|
18847
18904
|
});
|
|
18905
|
+
if (requirements.qaAccountCredentials?.length) {
|
|
18906
|
+
await prepareAccountCredentials(ctx, profile, {
|
|
18907
|
+
names: requirements.qaAccountCredentials,
|
|
18908
|
+
targetUrl
|
|
18909
|
+
});
|
|
18910
|
+
}
|
|
18848
18911
|
}
|
|
18849
18912
|
if (requirements.githubTestToken) {
|
|
18850
18913
|
const capabilityInput = ctx.data.capabilityInput && typeof ctx.data.capabilityInput === "object" && !Array.isArray(ctx.data.capabilityInput) ? ctx.data.capabilityInput : {};
|
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.605",
|
|
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",
|
package/templates/kody.yml
CHANGED
|
@@ -82,6 +82,7 @@ jobs:
|
|
|
82
82
|
GH_PAT: ${{ secrets.GH_PAT }}
|
|
83
83
|
KODY_TOKEN: ${{ secrets.KODY_TOKEN }}
|
|
84
84
|
E2E_GITHUB_TOKEN: ${{ secrets.E2E_GITHUB_TOKEN }}
|
|
85
|
+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|
|
85
86
|
KODY_APP_ID: ${{ secrets.KODY_APP_ID }}
|
|
86
87
|
KODY_APP_PRIVATE_KEY: ${{ secrets.KODY_APP_PRIVATE_KEY }}
|
|
87
88
|
SESSION_ID: ${{ inputs.sessionId }}
|