@kody-ade/kody-engine 0.4.68 → 0.4.69
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 +69 -2
- package/package.json +3 -1
package/dist/bin/kody.js
CHANGED
|
@@ -864,7 +864,7 @@ var init_loadPriorArt = __esm({
|
|
|
864
864
|
// package.json
|
|
865
865
|
var package_default = {
|
|
866
866
|
name: "@kody-ade/kody-engine",
|
|
867
|
-
version: "0.4.
|
|
867
|
+
version: "0.4.69",
|
|
868
868
|
description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
|
|
869
869
|
license: "MIT",
|
|
870
870
|
type: "module",
|
|
@@ -879,6 +879,8 @@ var package_default = {
|
|
|
879
879
|
scripts: {
|
|
880
880
|
kody: "tsx bin/kody.ts",
|
|
881
881
|
build: "tsup && node scripts/copy-assets.cjs",
|
|
882
|
+
"check:modularity": "tsx scripts/check-script-modularity.ts",
|
|
883
|
+
pretest: "pnpm check:modularity",
|
|
882
884
|
test: "vitest run tests/unit tests/int --no-coverage",
|
|
883
885
|
"test:e2e": "vitest run tests/e2e --no-coverage",
|
|
884
886
|
"test:all": "vitest run tests --no-coverage",
|
|
@@ -1410,6 +1412,48 @@ async function runAgent(opts) {
|
|
|
1410
1412
|
if (line) process.stdout.write(`${line}
|
|
1411
1413
|
`);
|
|
1412
1414
|
const m = msg;
|
|
1415
|
+
if (opts.onProgress) {
|
|
1416
|
+
const blocks = m.message?.content ?? [];
|
|
1417
|
+
for (const block of blocks) {
|
|
1418
|
+
try {
|
|
1419
|
+
if (block.type === "thinking") {
|
|
1420
|
+
const t = block.thinking;
|
|
1421
|
+
if (typeof t === "string" && t.length > 0) {
|
|
1422
|
+
await opts.onProgress({ kind: "thinking", thinking: t });
|
|
1423
|
+
}
|
|
1424
|
+
} else if (block.type === "tool_use") {
|
|
1425
|
+
const b = block;
|
|
1426
|
+
await opts.onProgress({
|
|
1427
|
+
kind: "tool_use",
|
|
1428
|
+
name: b.name ?? "tool",
|
|
1429
|
+
input: b.input,
|
|
1430
|
+
id: b.id
|
|
1431
|
+
});
|
|
1432
|
+
} else if (block.type === "tool_result") {
|
|
1433
|
+
const b = block;
|
|
1434
|
+
const content = typeof b.content === "string" ? b.content : (() => {
|
|
1435
|
+
try {
|
|
1436
|
+
return JSON.stringify(b.content);
|
|
1437
|
+
} catch {
|
|
1438
|
+
return "";
|
|
1439
|
+
}
|
|
1440
|
+
})();
|
|
1441
|
+
await opts.onProgress({
|
|
1442
|
+
kind: "tool_result",
|
|
1443
|
+
toolUseId: b.tool_use_id,
|
|
1444
|
+
content,
|
|
1445
|
+
isError: b.is_error
|
|
1446
|
+
});
|
|
1447
|
+
} else if (block.type === "text") {
|
|
1448
|
+
const b = block;
|
|
1449
|
+
if (typeof b.text === "string" && b.text.length > 0) {
|
|
1450
|
+
await opts.onProgress({ kind: "text", text: b.text });
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
} catch {
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1413
1457
|
const usage = m.usage;
|
|
1414
1458
|
if (usage && typeof usage === "object") {
|
|
1415
1459
|
const i = Number(usage.input_tokens ?? 0);
|
|
@@ -1596,6 +1640,7 @@ async function runChatTurn(opts) {
|
|
|
1596
1640
|
}
|
|
1597
1641
|
const systemPrompt = opts.systemPrompt ?? CHAT_SYSTEM_PROMPT;
|
|
1598
1642
|
const prompt = buildPrompt(turns);
|
|
1643
|
+
let progressSeq = 0;
|
|
1599
1644
|
const invoke = opts.invokeAgent ?? ((p) => runAgent({
|
|
1600
1645
|
prompt: p,
|
|
1601
1646
|
model: opts.model,
|
|
@@ -1603,7 +1648,29 @@ async function runChatTurn(opts) {
|
|
|
1603
1648
|
litellmUrl: opts.litellmUrl,
|
|
1604
1649
|
verbose: opts.verbose,
|
|
1605
1650
|
quiet: opts.quiet,
|
|
1606
|
-
systemPromptAppend: systemPrompt
|
|
1651
|
+
systemPromptAppend: systemPrompt,
|
|
1652
|
+
onProgress: async (ev) => {
|
|
1653
|
+
progressSeq += 1;
|
|
1654
|
+
if (ev.kind === "thinking") {
|
|
1655
|
+
await emit(opts.sink, "chat.thinking", opts.sessionId, `think-${progressSeq}`, {
|
|
1656
|
+
text: ev.thinking
|
|
1657
|
+
});
|
|
1658
|
+
} else if (ev.kind === "tool_use") {
|
|
1659
|
+
await emit(opts.sink, "chat.tool", opts.sessionId, `tool-${progressSeq}`, {
|
|
1660
|
+
phase: "use",
|
|
1661
|
+
id: ev.id,
|
|
1662
|
+
name: ev.name,
|
|
1663
|
+
input: ev.input ?? {}
|
|
1664
|
+
});
|
|
1665
|
+
} else if (ev.kind === "tool_result") {
|
|
1666
|
+
await emit(opts.sink, "chat.tool", opts.sessionId, `tool-${progressSeq}`, {
|
|
1667
|
+
phase: "result",
|
|
1668
|
+
toolUseId: ev.toolUseId,
|
|
1669
|
+
content: ev.content,
|
|
1670
|
+
isError: ev.isError === true
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1607
1674
|
}));
|
|
1608
1675
|
let result;
|
|
1609
1676
|
try {
|
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.69",
|
|
4
4
|
"description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"kody": "tsx bin/kody.ts",
|
|
17
17
|
"build": "tsup && node scripts/copy-assets.cjs",
|
|
18
|
+
"check:modularity": "tsx scripts/check-script-modularity.ts",
|
|
19
|
+
"pretest": "pnpm check:modularity",
|
|
18
20
|
"test": "vitest run tests/unit tests/int --no-coverage",
|
|
19
21
|
"test:e2e": "vitest run tests/e2e --no-coverage",
|
|
20
22
|
"test:all": "vitest run tests --no-coverage",
|