@kody-ade/kody-engine 0.4.647 → 0.4.649
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
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.649",
|
|
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
|
repository: {
|
|
@@ -7397,11 +7397,14 @@ function addTokenBreakdown(left, right) {
|
|
|
7397
7397
|
function createRunUsage(tokens, costUsd, details = {}) {
|
|
7398
7398
|
if (!tokens && costUsd === void 0 && details.turns === void 0) return void 0;
|
|
7399
7399
|
const normalizedTokens = tokenBreakdown(tokens);
|
|
7400
|
+
const hasBillableUsage = normalizedTokens.total > 0 || safeNumber(costUsd) > 0;
|
|
7401
|
+
const measurement = details.outcome === "failed" && !hasBillableUsage ? "unknown" : "reported";
|
|
7400
7402
|
const modelUsage = {
|
|
7401
7403
|
tokens: normalizedTokens,
|
|
7402
7404
|
costUsd: safeNumber(costUsd),
|
|
7403
7405
|
agentRuns: 1,
|
|
7404
|
-
turns: safeNumber(details.turns)
|
|
7406
|
+
turns: safeNumber(details.turns),
|
|
7407
|
+
measurement
|
|
7405
7408
|
};
|
|
7406
7409
|
const reportedModels = Object.entries(details.modelUsage ?? {});
|
|
7407
7410
|
const byModel = reportedModels.length > 0 ? Object.fromEntries(
|
|
@@ -7418,7 +7421,8 @@ function createRunUsage(tokens, costUsd, details = {}) {
|
|
|
7418
7421
|
tokens: modelTokens,
|
|
7419
7422
|
costUsd: safeNumber(usage.costUSD),
|
|
7420
7423
|
agentRuns: 1,
|
|
7421
|
-
turns: reportedModels.length === 1 ? safeNumber(details.turns) : 0
|
|
7424
|
+
turns: reportedModels.length === 1 ? safeNumber(details.turns) : 0,
|
|
7425
|
+
measurement
|
|
7422
7426
|
}
|
|
7423
7427
|
];
|
|
7424
7428
|
})
|
|
@@ -7444,13 +7448,27 @@ function isModelRunUsage(value) {
|
|
|
7444
7448
|
usage.turns
|
|
7445
7449
|
].every((number) => typeof number === "number" && Number.isFinite(number) && number >= 0);
|
|
7446
7450
|
}
|
|
7451
|
+
function isUsageMeasurement(value) {
|
|
7452
|
+
return value === "reported" || value === "partial" || value === "unknown";
|
|
7453
|
+
}
|
|
7454
|
+
function mergeMeasurement(left, right) {
|
|
7455
|
+
const normalizedLeft = left ?? "reported";
|
|
7456
|
+
const normalizedRight = right ?? "reported";
|
|
7457
|
+
if (normalizedLeft === normalizedRight) return normalizedLeft;
|
|
7458
|
+
return "partial";
|
|
7459
|
+
}
|
|
7447
7460
|
function parseRunUsage(value) {
|
|
7448
7461
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
7449
7462
|
const usage = value;
|
|
7450
7463
|
if (usage.version !== 1 || !isModelRunUsage(usage)) return void 0;
|
|
7451
7464
|
if (!usage.byModel || typeof usage.byModel !== "object" || Array.isArray(usage.byModel)) return void 0;
|
|
7452
7465
|
if (!Object.values(usage.byModel).every(isModelRunUsage)) return void 0;
|
|
7453
|
-
|
|
7466
|
+
const normalized = structuredClone(usage);
|
|
7467
|
+
normalized.measurement = isUsageMeasurement(usage.measurement) ? usage.measurement : "reported";
|
|
7468
|
+
for (const [model, modelUsage] of Object.entries(normalized.byModel)) {
|
|
7469
|
+
modelUsage.measurement = isUsageMeasurement(usage.byModel[model]?.measurement) ? usage.byModel[model].measurement : "reported";
|
|
7470
|
+
}
|
|
7471
|
+
return normalized;
|
|
7454
7472
|
}
|
|
7455
7473
|
function mergeRunUsage(left, right) {
|
|
7456
7474
|
if (!left) return right ? structuredClone(right) : void 0;
|
|
@@ -7468,7 +7486,8 @@ function mergeRunUsage(left, right) {
|
|
|
7468
7486
|
tokens: addTokenBreakdown(first.tokens, second.tokens),
|
|
7469
7487
|
costUsd: first.costUsd + second.costUsd,
|
|
7470
7488
|
agentRuns: first.agentRuns + second.agentRuns,
|
|
7471
|
-
turns: first.turns + second.turns
|
|
7489
|
+
turns: first.turns + second.turns,
|
|
7490
|
+
measurement: mergeMeasurement(first.measurement, second.measurement)
|
|
7472
7491
|
};
|
|
7473
7492
|
}
|
|
7474
7493
|
}
|
|
@@ -7478,6 +7497,7 @@ function mergeRunUsage(left, right) {
|
|
|
7478
7497
|
costUsd: left.costUsd + right.costUsd,
|
|
7479
7498
|
agentRuns: left.agentRuns + right.agentRuns,
|
|
7480
7499
|
turns: left.turns + right.turns,
|
|
7500
|
+
measurement: mergeMeasurement(left.measurement, right.measurement),
|
|
7481
7501
|
byModel
|
|
7482
7502
|
};
|
|
7483
7503
|
}
|
|
@@ -7487,12 +7507,14 @@ function formatRunUsageMarker(subject, usage) {
|
|
|
7487
7507
|
function appendRunUsageSummary(summaryPath, subject, usage) {
|
|
7488
7508
|
if (!summaryPath) return;
|
|
7489
7509
|
const tokens = usage.tokens;
|
|
7510
|
+
const tokenLine = usage.measurement === "unknown" ? "- **Tokens:** usage unknown (provider did not report billable usage)" : `- **${usage.measurement === "partial" ? "Known tokens" : "Tokens"}:** ${tokens.input.toLocaleString()} input / ${tokens.cacheRead.toLocaleString()} cache-read / ${tokens.cacheCreate.toLocaleString()} cache-create / ${tokens.output.toLocaleString()} output / ${tokens.total.toLocaleString()} total${usage.measurement === "partial" ? "; some child usage is unknown" : ""}`;
|
|
7511
|
+
const costLine = usage.measurement === "unknown" ? "- **Provider-reported cost:** unknown" : `- **Provider-reported cost:** $${usage.costUsd.toFixed(4)}${usage.measurement === "partial" ? " known; some child cost is unknown" : ""}`;
|
|
7490
7512
|
const lines = [
|
|
7491
7513
|
`### Kody usage - ${subject}`,
|
|
7492
7514
|
"",
|
|
7493
|
-
|
|
7515
|
+
tokenLine,
|
|
7494
7516
|
`- **Agent work:** ${usage.agentRuns.toLocaleString()} runs / ${usage.turns.toLocaleString()} turns`,
|
|
7495
|
-
|
|
7517
|
+
costLine,
|
|
7496
7518
|
""
|
|
7497
7519
|
];
|
|
7498
7520
|
try {
|
|
@@ -19485,7 +19507,7 @@ async function prepareEmailPasswordBrowserAuth(ctx, profile, input) {
|
|
|
19485
19507
|
const response = await fetch(`${origin}/api/auth/sign-in/email`, {
|
|
19486
19508
|
method: "POST",
|
|
19487
19509
|
headers: { "content-type": "application/json", origin },
|
|
19488
|
-
body: JSON.stringify({ email: input.login, password: password.value })
|
|
19510
|
+
body: JSON.stringify({ email: input.login, password: password.value, callbackURL: "/chat" })
|
|
19489
19511
|
});
|
|
19490
19512
|
if (!response.ok) throw new Error(`app login returned ${response.status}`);
|
|
19491
19513
|
const headers = response.headers;
|
|
@@ -23888,7 +23910,8 @@ async function runImplementation(profileName, input) {
|
|
|
23888
23910
|
ctx.output.usage = createRunUsage(agentResult.tokens, agentResult.costUsd, {
|
|
23889
23911
|
model: `${model.provider}/${model.model}`,
|
|
23890
23912
|
turns: agentResult.turns,
|
|
23891
|
-
modelUsage: agentResult.modelUsage
|
|
23913
|
+
modelUsage: agentResult.modelUsage,
|
|
23914
|
+
outcome: agentResult.outcome
|
|
23892
23915
|
});
|
|
23893
23916
|
emitEvent(input.cwd, {
|
|
23894
23917
|
implementation: profileName,
|
|
File without changes
|
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.649",
|
|
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
|
"repository": {
|
|
@@ -17,30 +17,6 @@
|
|
|
17
17
|
"docs/delivery-boundary.md",
|
|
18
18
|
"kody.config.schema.json"
|
|
19
19
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"kody:run": "tsx bin/kody.ts",
|
|
22
|
-
"serve": "tsx bin/kody.ts serve",
|
|
23
|
-
"serve:vscode": "tsx bin/kody.ts serve vscode",
|
|
24
|
-
"serve:claude": "tsx bin/kody.ts serve claude",
|
|
25
|
-
"clean:dist": "node scripts/clean-dist.cjs",
|
|
26
|
-
"build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
|
|
27
|
-
"check:modularity": "tsx scripts/check-script-modularity.ts",
|
|
28
|
-
"pretest": "pnpm check:modularity",
|
|
29
|
-
"test": "vitest run tests/unit tests/int --coverage",
|
|
30
|
-
"posttest": "tsx scripts/check-coverage-floor.ts",
|
|
31
|
-
"test:smoke": "vitest run tests/smoke --no-coverage",
|
|
32
|
-
"test:e2e": "vitest run tests/e2e --no-coverage",
|
|
33
|
-
"verify:live-release": "tsx scripts/live-release-gate.ts",
|
|
34
|
-
"test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
|
|
35
|
-
"test:all": "vitest run tests --no-coverage",
|
|
36
|
-
"typecheck": "tsc --noEmit",
|
|
37
|
-
"lint": "biome check",
|
|
38
|
-
"lint:fix": "biome check --write",
|
|
39
|
-
"format": "biome format --write",
|
|
40
|
-
"verify:package": "node scripts/verify-package-tarball.cjs",
|
|
41
|
-
"brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain --build-arg KODY_ENGINE_REF=$(git rev-parse HEAD) -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner",
|
|
42
|
-
"prepublishOnly": "pnpm typecheck && pnpm test:runtime-services && pnpm build && pnpm verify:package"
|
|
43
|
-
},
|
|
44
20
|
"dependencies": {
|
|
45
21
|
"@actions/cache": "^6.0.0",
|
|
46
22
|
"@anthropic-ai/claude-agent-sdk": "0.2.119",
|
|
@@ -63,5 +39,28 @@
|
|
|
63
39
|
"node": ">=22"
|
|
64
40
|
},
|
|
65
41
|
"homepage": "https://github.com/aharonyaircohen/kody-engine",
|
|
66
|
-
"bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
|
|
67
|
-
|
|
42
|
+
"bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"kody:run": "tsx bin/kody.ts",
|
|
45
|
+
"serve": "tsx bin/kody.ts serve",
|
|
46
|
+
"serve:vscode": "tsx bin/kody.ts serve vscode",
|
|
47
|
+
"serve:claude": "tsx bin/kody.ts serve claude",
|
|
48
|
+
"clean:dist": "node scripts/clean-dist.cjs",
|
|
49
|
+
"build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
|
|
50
|
+
"check:modularity": "tsx scripts/check-script-modularity.ts",
|
|
51
|
+
"pretest": "pnpm check:modularity",
|
|
52
|
+
"test": "vitest run tests/unit tests/int --coverage",
|
|
53
|
+
"posttest": "tsx scripts/check-coverage-floor.ts",
|
|
54
|
+
"test:smoke": "vitest run tests/smoke --no-coverage",
|
|
55
|
+
"test:e2e": "vitest run tests/e2e --no-coverage",
|
|
56
|
+
"verify:live-release": "tsx scripts/live-release-gate.ts",
|
|
57
|
+
"test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
|
|
58
|
+
"test:all": "vitest run tests --no-coverage",
|
|
59
|
+
"typecheck": "tsc --noEmit",
|
|
60
|
+
"lint": "biome check",
|
|
61
|
+
"lint:fix": "biome check --write",
|
|
62
|
+
"format": "biome format --write",
|
|
63
|
+
"verify:package": "node scripts/verify-package-tarball.cjs",
|
|
64
|
+
"brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain --build-arg KODY_ENGINE_REF=$(git rev-parse HEAD) -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner"
|
|
65
|
+
}
|
|
66
|
+
}
|