@kody-ade/kody-engine 0.4.529 → 0.4.530
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.530",
|
|
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",
|
|
@@ -7509,8 +7509,19 @@ var init_litellm = __esm({
|
|
|
7509
7509
|
async function upsertRunIndexRowBestEffortAsync(config, _cwd, row) {
|
|
7510
7510
|
if (!row) return;
|
|
7511
7511
|
const tenantId2 = tenantIdForRun(config);
|
|
7512
|
-
if (!tenantId2)
|
|
7513
|
-
|
|
7512
|
+
if (!tenantId2) return;
|
|
7513
|
+
try {
|
|
7514
|
+
await createStateBackendFromEnv().saveAgencyRun(
|
|
7515
|
+
tenantId2,
|
|
7516
|
+
row.id,
|
|
7517
|
+
row.subjectType,
|
|
7518
|
+
row.subjectId,
|
|
7519
|
+
row,
|
|
7520
|
+
row.updatedAt
|
|
7521
|
+
);
|
|
7522
|
+
} catch {
|
|
7523
|
+
process.stderr.write("\u2192 kody: run index persistence unavailable; continuing\n");
|
|
7524
|
+
}
|
|
7514
7525
|
}
|
|
7515
7526
|
function stageRunIndexFinalization(data, row) {
|
|
7516
7527
|
if (!row) return;
|
|
@@ -23020,7 +23031,9 @@ function capabilityStepInput(input, target, targetNumber) {
|
|
|
23020
23031
|
if (!target || targetNumber === void 0) return input;
|
|
23021
23032
|
const routing = { [target]: targetNumber };
|
|
23022
23033
|
if (input && typeof input === "object" && !Array.isArray(input)) {
|
|
23023
|
-
|
|
23034
|
+
const context = { ...input };
|
|
23035
|
+
delete context[target === "pr" ? "issue" : "pr"];
|
|
23036
|
+
return { ...context, ...routing };
|
|
23024
23037
|
}
|
|
23025
23038
|
return input === void 0 ? routing : { request: input, ...routing };
|
|
23026
23039
|
}
|
|
@@ -23871,6 +23884,28 @@ var CHAT_SYSTEM_PROMPT = [
|
|
|
23871
23884
|
"Do not invent file paths, commit SHAs, line numbers, or command output. If you",
|
|
23872
23885
|
"cite something concrete, you must have just read or run it in this session."
|
|
23873
23886
|
].join("\n");
|
|
23887
|
+
var HOST_CHAT_SYSTEM_PROMPT = [
|
|
23888
|
+
"You are Kody, a general-purpose assistant running on the machine hosting Brain.",
|
|
23889
|
+
"Reply to the user's latest message using the full conversation as context.",
|
|
23890
|
+
"Keep replies short and simple, and use plain terms rather than jargon.",
|
|
23891
|
+
"",
|
|
23892
|
+
"# Your environment and capabilities",
|
|
23893
|
+
"You can work across the host environment available to this process. You are not",
|
|
23894
|
+
"limited to a repository or an opened project. Start from the current working",
|
|
23895
|
+
"directory, and use `pwd`, `uname`, and other real commands before describing",
|
|
23896
|
+
"the machine. Read, Edit, Write, Glob, Grep, and Bash can inspect and change",
|
|
23897
|
+
"files or run programs with the same permissions as the Brain host user.",
|
|
23898
|
+
"",
|
|
23899
|
+
"Do not assume a repository exists. When a task concerns a project, first locate",
|
|
23900
|
+
"the relevant directory from the user's words and the machine's actual filesystem.",
|
|
23901
|
+
"Never print secrets or credential values. Be careful with destructive operations",
|
|
23902
|
+
"and explain their effect before running them.",
|
|
23903
|
+
"",
|
|
23904
|
+
"# Ground answers in the machine",
|
|
23905
|
+
"Use the real filesystem, process state, and command output before making claims",
|
|
23906
|
+
"about this host. If the request is ambiguous and choosing a target could modify",
|
|
23907
|
+
"the wrong data, ask a direct clarification before acting."
|
|
23908
|
+
].join("\n");
|
|
23874
23909
|
var OPENAI_CHAT_SYSTEM_PROMPT = [
|
|
23875
23910
|
"You are Kody, an AI assistant for the Kody Operations Dashboard. Reply to the",
|
|
23876
23911
|
"user's latest message using the full conversation below as context. Keep replies",
|
|
@@ -23931,8 +23966,14 @@ function buildImplementationCatalog() {
|
|
|
23931
23966
|
function shouldWriteTaskArtifacts(driver) {
|
|
23932
23967
|
return driver !== "codex-app-server";
|
|
23933
23968
|
}
|
|
23969
|
+
function resolveChatSystemPrompt(input) {
|
|
23970
|
+
return input.systemPrompt ?? readSystemPromptOverride(input.cwd) ?? (input.workspaceKind === "host" ? HOST_CHAT_SYSTEM_PROMPT : input.protocol === "openai" ? OPENAI_CHAT_SYSTEM_PROMPT : CHAT_SYSTEM_PROMPT);
|
|
23971
|
+
}
|
|
23934
23972
|
async function runChatTurn(opts) {
|
|
23935
|
-
const store = opts.store ?? createSessionStore({
|
|
23973
|
+
const store = opts.store ?? createSessionStore({
|
|
23974
|
+
sessionId: opts.sessionId,
|
|
23975
|
+
sessionFile: opts.sessionFile
|
|
23976
|
+
});
|
|
23936
23977
|
const turns = await store.readTurns();
|
|
23937
23978
|
if (turns.length === 0) {
|
|
23938
23979
|
const error = "session file is empty \u2014 nothing to reply to";
|
|
@@ -23946,7 +23987,12 @@ async function runChatTurn(opts) {
|
|
|
23946
23987
|
return { exitCode: 64, error };
|
|
23947
23988
|
}
|
|
23948
23989
|
const { turns: promptTurns, imagePaths } = prepareAttachments(turns, opts.cwd, opts.sessionId);
|
|
23949
|
-
const basePrompt =
|
|
23990
|
+
const basePrompt = resolveChatSystemPrompt({
|
|
23991
|
+
cwd: opts.cwd,
|
|
23992
|
+
protocol: opts.model.protocol,
|
|
23993
|
+
workspaceKind: opts.workspaceKind,
|
|
23994
|
+
systemPrompt: opts.systemPrompt
|
|
23995
|
+
});
|
|
23950
23996
|
const activeAgent = await store.readActiveAgent();
|
|
23951
23997
|
const agentIdentityBlock = readAgentIdentityBlock(opts.cwd, opts.agentIdentity ?? { slug: activeAgent.slug });
|
|
23952
23998
|
const catalog = buildImplementationCatalog();
|
|
@@ -23954,7 +24000,10 @@ async function runChatTurn(opts) {
|
|
|
23954
24000
|
...prepareTaskArtifactsDir(opts.cwd, opts.sessionId),
|
|
23955
24001
|
taskKey: `sessions/${opts.sessionId}`
|
|
23956
24002
|
};
|
|
23957
|
-
initializeTaskArtifacts(taskArtifactsPaths, {
|
|
24003
|
+
initializeTaskArtifacts(taskArtifactsPaths, {
|
|
24004
|
+
taskType: "chat",
|
|
24005
|
+
target: opts.sessionId
|
|
24006
|
+
});
|
|
23958
24007
|
const artifactAddendum = shouldWriteTaskArtifacts(opts.driver) ? taskArtifactsPromptAddendum({
|
|
23959
24008
|
taskId: taskArtifactsPaths.taskId,
|
|
23960
24009
|
taskType: "chat",
|
|
@@ -24089,7 +24138,9 @@ async function runChatTurn(opts) {
|
|
|
24089
24138
|
content: reply,
|
|
24090
24139
|
timestamp: now
|
|
24091
24140
|
});
|
|
24092
|
-
await emit(opts.sink, "chat.done", opts.sessionId, "done", {
|
|
24141
|
+
await emit(opts.sink, "chat.done", opts.sessionId, "done", {
|
|
24142
|
+
sessionId: opts.sessionId
|
|
24143
|
+
});
|
|
24093
24144
|
try {
|
|
24094
24145
|
const missing = verifyTaskArtifacts(taskArtifactsPaths.absDir);
|
|
24095
24146
|
if (missing.length > 0) {
|
|
@@ -24158,7 +24209,9 @@ async function runOpenAIChatTurn(args) {
|
|
|
24158
24209
|
content: reply,
|
|
24159
24210
|
timestamp: now
|
|
24160
24211
|
});
|
|
24161
|
-
await emit(opts.sink, "chat.done", opts.sessionId, "done", {
|
|
24212
|
+
await emit(opts.sink, "chat.done", opts.sessionId, "done", {
|
|
24213
|
+
sessionId: opts.sessionId
|
|
24214
|
+
});
|
|
24162
24215
|
return { exitCode: 0, reply };
|
|
24163
24216
|
} catch (err) {
|
|
24164
24217
|
const error = err instanceof Error ? err.message : String(err);
|
|
@@ -26294,7 +26347,9 @@ async function handleChatTurn(req, res, chatId, opts) {
|
|
|
26294
26347
|
try {
|
|
26295
26348
|
turnDriver = resolveBrainDriver(runtime);
|
|
26296
26349
|
} catch (err) {
|
|
26297
|
-
sendJson(res, 400, {
|
|
26350
|
+
sendJson(res, 400, {
|
|
26351
|
+
error: err instanceof Error ? err.message : String(err)
|
|
26352
|
+
});
|
|
26298
26353
|
return;
|
|
26299
26354
|
}
|
|
26300
26355
|
}
|
|
@@ -26357,6 +26412,7 @@ async function handleChatTurn(req, res, chatId, opts) {
|
|
|
26357
26412
|
sessionId: chatId,
|
|
26358
26413
|
sessionFile,
|
|
26359
26414
|
cwd: agentCwd,
|
|
26415
|
+
workspaceKind: repo ? "repository" : "host",
|
|
26360
26416
|
model: opts.model,
|
|
26361
26417
|
litellmUrl: opts.litellmUrl,
|
|
26362
26418
|
sink,
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kody-ade/kody-engine",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "kody
|
|
3
|
+
"version": "0.4.530",
|
|
4
|
+
"description": "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -12,6 +12,29 @@
|
|
|
12
12
|
"templates",
|
|
13
13
|
"kody.config.schema.json"
|
|
14
14
|
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"kody:run": "tsx bin/kody.ts",
|
|
17
|
+
"serve": "tsx bin/kody.ts serve",
|
|
18
|
+
"serve:vscode": "tsx bin/kody.ts serve vscode",
|
|
19
|
+
"serve:claude": "tsx bin/kody.ts serve claude",
|
|
20
|
+
"clean:dist": "node scripts/clean-dist.cjs",
|
|
21
|
+
"build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
|
|
22
|
+
"check:modularity": "tsx scripts/check-script-modularity.ts",
|
|
23
|
+
"pretest": "pnpm check:modularity",
|
|
24
|
+
"test": "vitest run tests/unit tests/int --coverage",
|
|
25
|
+
"posttest": "tsx scripts/check-coverage-floor.ts",
|
|
26
|
+
"test:smoke": "vitest run tests/smoke --no-coverage",
|
|
27
|
+
"test:e2e": "vitest run tests/e2e --no-coverage",
|
|
28
|
+
"test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
|
|
29
|
+
"test:all": "vitest run tests --no-coverage",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"lint": "biome check",
|
|
32
|
+
"lint:fix": "biome check --write",
|
|
33
|
+
"format": "biome format --write",
|
|
34
|
+
"verify:package": "node scripts/verify-package-tarball.cjs",
|
|
35
|
+
"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",
|
|
36
|
+
"prepublishOnly": "pnpm typecheck && pnpm test:runtime-services && pnpm build && pnpm verify:package"
|
|
37
|
+
},
|
|
15
38
|
"dependencies": {
|
|
16
39
|
"@actions/cache": "^6.0.0",
|
|
17
40
|
"@anthropic-ai/claude-agent-sdk": "0.2.119",
|
|
@@ -38,27 +61,5 @@
|
|
|
38
61
|
"url": "git+https://github.com/aharonyaircohen/kody-engine.git"
|
|
39
62
|
},
|
|
40
63
|
"homepage": "https://github.com/aharonyaircohen/kody-engine",
|
|
41
|
-
"bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
|
|
42
|
-
|
|
43
|
-
"kody:run": "tsx bin/kody.ts",
|
|
44
|
-
"serve": "tsx bin/kody.ts serve",
|
|
45
|
-
"serve:vscode": "tsx bin/kody.ts serve vscode",
|
|
46
|
-
"serve:claude": "tsx bin/kody.ts serve claude",
|
|
47
|
-
"clean:dist": "node scripts/clean-dist.cjs",
|
|
48
|
-
"build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
|
|
49
|
-
"check:modularity": "tsx scripts/check-script-modularity.ts",
|
|
50
|
-
"pretest": "pnpm check:modularity",
|
|
51
|
-
"test": "vitest run tests/unit tests/int --coverage",
|
|
52
|
-
"posttest": "tsx scripts/check-coverage-floor.ts",
|
|
53
|
-
"test:smoke": "vitest run tests/smoke --no-coverage",
|
|
54
|
-
"test:e2e": "vitest run tests/e2e --no-coverage",
|
|
55
|
-
"test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
|
|
56
|
-
"test:all": "vitest run tests --no-coverage",
|
|
57
|
-
"typecheck": "tsc --noEmit",
|
|
58
|
-
"lint": "biome check",
|
|
59
|
-
"lint:fix": "biome check --write",
|
|
60
|
-
"format": "biome format --write",
|
|
61
|
-
"verify:package": "node scripts/verify-package-tarball.cjs",
|
|
62
|
-
"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"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
64
|
+
"bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
|
|
65
|
+
}
|