@kody-ade/kody-engine 0.4.403 → 0.4.404
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 +40 -63
- 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.404",
|
|
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",
|
|
@@ -22042,6 +22042,7 @@ function createSessionStore(opts) {
|
|
|
22042
22042
|
};
|
|
22043
22043
|
return {
|
|
22044
22044
|
backend: "convex",
|
|
22045
|
+
readMode: async () => (await read()).conversation.runtime?.kind === "live" ? "interactive" : "one-shot",
|
|
22045
22046
|
readActiveAgent: async () => (await read()).conversation.activeAgent,
|
|
22046
22047
|
readTurns: async () => currentEpochTurns(await read()),
|
|
22047
22048
|
appendTurn: async (turn) => {
|
|
@@ -22586,20 +22587,6 @@ import posixPath3 from "path/posix";
|
|
|
22586
22587
|
function sessionFilePath(cwd, sessionId) {
|
|
22587
22588
|
return path16.join(cwd, ".kody-engine", "runtime", "sessions", `${sessionId}.jsonl`);
|
|
22588
22589
|
}
|
|
22589
|
-
function readMeta(file) {
|
|
22590
|
-
if (!fs15.existsSync(file)) return null;
|
|
22591
|
-
const raw = fs15.readFileSync(file, "utf-8");
|
|
22592
|
-
const firstLine2 = raw.split("\n", 1)[0]?.trim();
|
|
22593
|
-
if (!firstLine2) return null;
|
|
22594
|
-
try {
|
|
22595
|
-
const parsed = JSON.parse(firstLine2);
|
|
22596
|
-
if (parsed.type !== "meta") return null;
|
|
22597
|
-
if (parsed.mode !== "one-shot" && parsed.mode !== "interactive") return null;
|
|
22598
|
-
return parsed;
|
|
22599
|
-
} catch {
|
|
22600
|
-
return null;
|
|
22601
|
-
}
|
|
22602
|
-
}
|
|
22603
22590
|
function readSession(file) {
|
|
22604
22591
|
if (!fs15.existsSync(file)) return [];
|
|
22605
22592
|
const raw = fs15.readFileSync(file, "utf-8").trim();
|
|
@@ -22617,29 +22604,6 @@ function readSession(file) {
|
|
|
22617
22604
|
}
|
|
22618
22605
|
return turns;
|
|
22619
22606
|
}
|
|
22620
|
-
function appendTurn(file, turn) {
|
|
22621
|
-
fs15.mkdirSync(path16.dirname(file), { recursive: true });
|
|
22622
|
-
const line = JSON.stringify({
|
|
22623
|
-
role: turn.role,
|
|
22624
|
-
content: turn.content,
|
|
22625
|
-
timestamp: turn.timestamp,
|
|
22626
|
-
toolCalls: turn.toolCalls ?? []
|
|
22627
|
-
});
|
|
22628
|
-
fs15.appendFileSync(file, `${line}
|
|
22629
|
-
`);
|
|
22630
|
-
}
|
|
22631
|
-
function seedInitialMessage(file, message) {
|
|
22632
|
-
if (!message.trim()) return false;
|
|
22633
|
-
const turns = readSession(file);
|
|
22634
|
-
const lastUser = [...turns].reverse().find((t) => t.role === "user");
|
|
22635
|
-
if (lastUser && lastUser.content === message) return false;
|
|
22636
|
-
appendTurn(file, {
|
|
22637
|
-
role: "user",
|
|
22638
|
-
content: message,
|
|
22639
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
22640
|
-
});
|
|
22641
|
-
return true;
|
|
22642
|
-
}
|
|
22643
22607
|
|
|
22644
22608
|
// src/servers/brain-serve.ts
|
|
22645
22609
|
init_config();
|
|
@@ -25066,7 +25030,6 @@ async function loadConfigSafe() {
|
|
|
25066
25030
|
}
|
|
25067
25031
|
|
|
25068
25032
|
// src/chat-cli.ts
|
|
25069
|
-
import * as fs49 from "fs";
|
|
25070
25033
|
import * as path49 from "path";
|
|
25071
25034
|
|
|
25072
25035
|
// src/chat/inbox.ts
|
|
@@ -25396,15 +25359,27 @@ ${CHAT_HELP}`);
|
|
|
25396
25359
|
process.stdout.write(`\u2192 kody:chat: litellm proxy ready (url=${litellm?.url ?? "skipped"})
|
|
25397
25360
|
`);
|
|
25398
25361
|
const sessionFile = sessionFilePath(cwd, sessionId);
|
|
25399
|
-
|
|
25362
|
+
const store = createSessionStore({ sessionId, sessionFile });
|
|
25363
|
+
if (args.initMessage) {
|
|
25364
|
+
await store.appendTurn({
|
|
25365
|
+
role: "user",
|
|
25366
|
+
content: args.initMessage,
|
|
25367
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
25368
|
+
});
|
|
25369
|
+
}
|
|
25400
25370
|
const sink = buildSink(cwd, sessionId, args.dashboardUrl);
|
|
25401
|
-
const
|
|
25402
|
-
|
|
25403
|
-
|
|
25404
|
-
|
|
25405
|
-
|
|
25371
|
+
const mode = await store.readMode();
|
|
25372
|
+
const meta = {
|
|
25373
|
+
type: "meta",
|
|
25374
|
+
mode,
|
|
25375
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
25376
|
+
...process.env.KODY_IDLE_EXIT_MS ? { idleExitMs: Number(process.env.KODY_IDLE_EXIT_MS) } : {},
|
|
25377
|
+
...process.env.KODY_HARD_CAP_MS ? { hardCapMs: Number(process.env.KODY_HARD_CAP_MS) } : {}
|
|
25378
|
+
};
|
|
25379
|
+
process.stdout.write(`\u2192 kody:chat: canonical conversation mode=${mode}
|
|
25380
|
+
`);
|
|
25406
25381
|
try {
|
|
25407
|
-
if (
|
|
25382
|
+
if (mode === "interactive") {
|
|
25408
25383
|
const result2 = await runInteractiveMode({
|
|
25409
25384
|
sessionId,
|
|
25410
25385
|
cwd,
|
|
@@ -25415,6 +25390,7 @@ ${CHAT_HELP}`);
|
|
|
25415
25390
|
verbose: args.verbose,
|
|
25416
25391
|
quiet: args.quiet,
|
|
25417
25392
|
config,
|
|
25393
|
+
store,
|
|
25418
25394
|
...reasoningEffort ? { reasoningEffort } : {}
|
|
25419
25395
|
});
|
|
25420
25396
|
return result2.exitCode;
|
|
@@ -25429,6 +25405,7 @@ ${CHAT_HELP}`);
|
|
|
25429
25405
|
verbose: args.verbose,
|
|
25430
25406
|
quiet: args.quiet,
|
|
25431
25407
|
config,
|
|
25408
|
+
store,
|
|
25432
25409
|
...reasoningEffort ? { reasoningEffort } : {}
|
|
25433
25410
|
});
|
|
25434
25411
|
return result.exitCode;
|
|
@@ -25446,7 +25423,7 @@ init_config();
|
|
|
25446
25423
|
// src/definition-hydration.ts
|
|
25447
25424
|
init_state_backend();
|
|
25448
25425
|
import { createHash as createHash5 } from "crypto";
|
|
25449
|
-
import * as
|
|
25426
|
+
import * as fs49 from "fs";
|
|
25450
25427
|
import * as path50 from "path";
|
|
25451
25428
|
var SLUG_RE2 = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
25452
25429
|
function assertSafeDefinitionPath(filePath) {
|
|
@@ -25481,32 +25458,32 @@ function writeDefinition(root, kind, definition) {
|
|
|
25481
25458
|
if (kind === "agent") {
|
|
25482
25459
|
const raw = bundle.files["agent.md"];
|
|
25483
25460
|
if (typeof raw !== "string") throw new Error(`agent definition ${definition.slug} is missing agent.md`);
|
|
25484
|
-
|
|
25461
|
+
fs49.writeFileSync(path50.join(root, "agents", `${definition.slug}.md`), raw, "utf8");
|
|
25485
25462
|
return;
|
|
25486
25463
|
}
|
|
25487
25464
|
if (kind === "goal") {
|
|
25488
25465
|
const goalRoot = path50.join(root, "goals", definition.slug);
|
|
25489
25466
|
for (const [filePath, contents] of Object.entries(bundle.files)) {
|
|
25490
25467
|
const target = path50.join(goalRoot, filePath);
|
|
25491
|
-
|
|
25492
|
-
|
|
25468
|
+
fs49.mkdirSync(path50.dirname(target), { recursive: true });
|
|
25469
|
+
fs49.writeFileSync(target, contents, "utf8");
|
|
25493
25470
|
}
|
|
25494
25471
|
return;
|
|
25495
25472
|
}
|
|
25496
25473
|
const capabilityRoot = path50.join(root, "capabilities", definition.slug);
|
|
25497
25474
|
for (const [filePath, contents] of Object.entries(bundle.files)) {
|
|
25498
25475
|
const target = path50.join(capabilityRoot, filePath);
|
|
25499
|
-
|
|
25500
|
-
|
|
25476
|
+
fs49.mkdirSync(path50.dirname(target), { recursive: true });
|
|
25477
|
+
fs49.writeFileSync(target, contents, "utf8");
|
|
25501
25478
|
}
|
|
25502
25479
|
}
|
|
25503
25480
|
async function hydrateDefinitions(options) {
|
|
25504
25481
|
const root = path50.join(options.cwd, ".kody-engine", "definitions");
|
|
25505
25482
|
const staging = `${root}.tmp-${process.pid}-${Date.now()}`;
|
|
25506
|
-
|
|
25507
|
-
|
|
25508
|
-
|
|
25509
|
-
|
|
25483
|
+
fs49.rmSync(staging, { recursive: true, force: true });
|
|
25484
|
+
fs49.mkdirSync(path50.join(staging, "agents"), { recursive: true });
|
|
25485
|
+
fs49.mkdirSync(path50.join(staging, "capabilities"), { recursive: true });
|
|
25486
|
+
fs49.mkdirSync(path50.join(staging, "goals"), { recursive: true });
|
|
25510
25487
|
try {
|
|
25511
25488
|
const [capabilities, agents, goals] = await Promise.all([
|
|
25512
25489
|
options.backend.listDefinitions(options.tenantId, "capability"),
|
|
@@ -25532,13 +25509,13 @@ async function hydrateDefinitions(options) {
|
|
|
25532
25509
|
hydratedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
25533
25510
|
versions: Object.fromEntries(Object.entries(versions).sort(([left], [right]) => left.localeCompare(right)))
|
|
25534
25511
|
};
|
|
25535
|
-
|
|
25512
|
+
fs49.writeFileSync(path50.join(staging, "manifest.json"), `${JSON.stringify(manifest, null, 2)}
|
|
25536
25513
|
`, "utf8");
|
|
25537
|
-
|
|
25538
|
-
|
|
25514
|
+
fs49.rmSync(root, { recursive: true, force: true });
|
|
25515
|
+
fs49.renameSync(staging, root);
|
|
25539
25516
|
return { root, tenantId: options.tenantId, versions: manifest.versions };
|
|
25540
25517
|
} catch (error) {
|
|
25541
|
-
|
|
25518
|
+
fs49.rmSync(staging, { recursive: true, force: true });
|
|
25542
25519
|
throw error;
|
|
25543
25520
|
}
|
|
25544
25521
|
}
|
|
@@ -26397,7 +26374,7 @@ async function poolServe() {
|
|
|
26397
26374
|
|
|
26398
26375
|
// src/servers/runner-serve.ts
|
|
26399
26376
|
import { spawn as spawn9 } from "child_process";
|
|
26400
|
-
import * as
|
|
26377
|
+
import * as fs50 from "fs";
|
|
26401
26378
|
import { createServer as createServer6 } from "http";
|
|
26402
26379
|
var DEFAULT_PORT2 = 8080;
|
|
26403
26380
|
var DEFAULT_WORKDIR = "/workspace/repo";
|
|
@@ -26532,8 +26509,8 @@ async function defaultRunJob(job) {
|
|
|
26532
26509
|
const workdir = process.env.RUNNER_WORKDIR ?? DEFAULT_WORKDIR;
|
|
26533
26510
|
const branch = job.ref ?? "main";
|
|
26534
26511
|
const authUrl = `https://x-access-token:${job.githubToken}@github.com/${job.repo}.git`;
|
|
26535
|
-
|
|
26536
|
-
|
|
26512
|
+
fs50.rmSync(workdir, { recursive: true, force: true });
|
|
26513
|
+
fs50.mkdirSync(workdir, { recursive: true });
|
|
26537
26514
|
const allSecrets = typeof job.allSecrets === "string" ? job.allSecrets : JSON.stringify(job.allSecrets ?? {});
|
|
26538
26515
|
const target = job.runRequest.target;
|
|
26539
26516
|
const interactive = target.type === "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.404",
|
|
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",
|