@kody-ade/kody-engine 0.4.405 → 0.4.407
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 +24 -13
- 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.407",
|
|
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",
|
|
@@ -1885,9 +1885,13 @@ var init_capabilityFolders = __esm({
|
|
|
1885
1885
|
import * as fs5 from "fs";
|
|
1886
1886
|
import * as path6 from "path";
|
|
1887
1887
|
function definitionsRoot(cwd = process.cwd()) {
|
|
1888
|
+
const override = process.env.KODY_DEFINITIONS_ROOT?.trim();
|
|
1889
|
+
const overrideCwd = process.env.KODY_DEFINITIONS_ROOT_CWD?.trim();
|
|
1890
|
+
if (override && overrideCwd && path6.resolve(cwd) === path6.resolve(overrideCwd)) {
|
|
1891
|
+
return path6.resolve(override);
|
|
1892
|
+
}
|
|
1888
1893
|
const hydrated = path6.join(cwd, ".kody-engine", "definitions");
|
|
1889
1894
|
if (fs5.existsSync(hydrated)) return hydrated;
|
|
1890
|
-
const override = process.env.KODY_DEFINITIONS_ROOT?.trim();
|
|
1891
1895
|
return override ? path6.resolve(override) : hydrated;
|
|
1892
1896
|
}
|
|
1893
1897
|
function capabilitiesRoot(cwd = process.cwd()) {
|
|
@@ -1939,8 +1943,10 @@ function getBuiltinCapabilitiesRoot() {
|
|
|
1939
1943
|
return candidates[0];
|
|
1940
1944
|
}
|
|
1941
1945
|
function getImplementationRoots() {
|
|
1942
|
-
|
|
1943
|
-
|
|
1946
|
+
return getImplementationRootsForCwd(process.cwd());
|
|
1947
|
+
}
|
|
1948
|
+
function getImplementationRootsForCwd(cwd) {
|
|
1949
|
+
return [capabilitiesRoot(cwd), getImplementationsRoot()];
|
|
1944
1950
|
}
|
|
1945
1951
|
function getCapabilityRoots(projectCapabilitiesRoot = getProjectCapabilitiesRoot()) {
|
|
1946
1952
|
return [projectCapabilitiesRoot, getBuiltinCapabilitiesRoot()];
|
|
@@ -2013,18 +2019,18 @@ function getCapabilityActionInputs(action, projectCapabilitiesRoot = getProjectC
|
|
|
2013
2019
|
if (!resolved) return null;
|
|
2014
2020
|
return getProfileInputs(resolved.implementation);
|
|
2015
2021
|
}
|
|
2016
|
-
function resolveCapabilityExecution(capability) {
|
|
2022
|
+
function resolveCapabilityExecution(capability, cwd = process.cwd()) {
|
|
2017
2023
|
const firstWorkflowStep = capability.config.workflow?.steps[0];
|
|
2018
2024
|
if (firstWorkflowStep) {
|
|
2019
2025
|
const implementation2 = firstWorkflowStep.implementation ?? firstWorkflowStep.capability;
|
|
2020
2026
|
return { implementation: implementation2, cliArgs: {} };
|
|
2021
2027
|
}
|
|
2022
2028
|
const implementation = capability.config.implementation ?? capability.config.implementations?.[0] ?? (capability.config.role ? capability.slug : void 0) ?? (capability.config.tickScript ? "capability-tick-scripted" : "capability-tick");
|
|
2023
|
-
const cliArgs = implementationDeclaresInput(implementation, "capability") ? { capability: capability.slug } : {};
|
|
2029
|
+
const cliArgs = implementationDeclaresInput(implementation, "capability", cwd) ? { capability: capability.slug } : {};
|
|
2024
2030
|
return { implementation, cliArgs };
|
|
2025
2031
|
}
|
|
2026
|
-
function implementationDeclaresInput(implementation, inputName) {
|
|
2027
|
-
const profilePath = resolveImplementation(implementation);
|
|
2032
|
+
function implementationDeclaresInput(implementation, inputName, cwd = process.cwd()) {
|
|
2033
|
+
const profilePath = resolveImplementation(implementation, getImplementationRootsForCwd(cwd));
|
|
2028
2034
|
if (!profilePath) return false;
|
|
2029
2035
|
try {
|
|
2030
2036
|
const raw = JSON.parse(fs6.readFileSync(profilePath, "utf-8"));
|
|
@@ -2220,6 +2226,10 @@ function requireTenant(tenantId2) {
|
|
|
2220
2226
|
if (!/^[^/\s]+\/[^/\s]+$/.test(value)) throw new Error("tenantId must be an owner/repository pair");
|
|
2221
2227
|
return value;
|
|
2222
2228
|
}
|
|
2229
|
+
function requireChatTenant(tenantId2) {
|
|
2230
|
+
const value = tenantId2.trim();
|
|
2231
|
+
return value === "global" ? value : requireTenant(value);
|
|
2232
|
+
}
|
|
2223
2233
|
function requireNonEmpty(value, name) {
|
|
2224
2234
|
const normalized = value.trim();
|
|
2225
2235
|
if (!normalized) throw new Error(`${name} must not be empty`);
|
|
@@ -2302,7 +2312,7 @@ function createStateBackendFromEnv(env = process.env, client) {
|
|
|
2302
2312
|
},
|
|
2303
2313
|
async appendChatEvent(tenantId2, sessionId, event) {
|
|
2304
2314
|
await transport.mutation(anyApi.chatEvents.append, {
|
|
2305
|
-
tenantId:
|
|
2315
|
+
tenantId: requireChatTenant(tenantId2),
|
|
2306
2316
|
sessionId: requireNonEmpty(sessionId, "sessionId"),
|
|
2307
2317
|
event
|
|
2308
2318
|
});
|
|
@@ -9281,7 +9291,7 @@ async function planGoalCapabilitySchedule(opts) {
|
|
|
9281
9291
|
}
|
|
9282
9292
|
};
|
|
9283
9293
|
}
|
|
9284
|
-
const dispatch2 = capabilityDispatch(capability);
|
|
9294
|
+
const dispatch2 = capabilityDispatch(capability, opts.cwd);
|
|
9285
9295
|
statuses[due.slug] = markCapabilitySelected(statuses[due.slug], now);
|
|
9286
9296
|
return {
|
|
9287
9297
|
kind: "dispatch",
|
|
@@ -9341,8 +9351,8 @@ async function describeCapabilitySchedule(capability, slug, backend, previous) {
|
|
|
9341
9351
|
lastFiredAt
|
|
9342
9352
|
};
|
|
9343
9353
|
}
|
|
9344
|
-
function capabilityDispatch(capability) {
|
|
9345
|
-
const { implementation, cliArgs } = resolveCapabilityExecution(capability);
|
|
9354
|
+
function capabilityDispatch(capability, cwd) {
|
|
9355
|
+
const { implementation, cliArgs } = resolveCapabilityExecution(capability, cwd);
|
|
9346
9356
|
return { capability: capability.slug, implementation, cliArgs };
|
|
9347
9357
|
}
|
|
9348
9358
|
function compareOldestLastFired(a, b) {
|
|
@@ -24342,6 +24352,7 @@ async function handleChatTurn(req, res, chatId, opts) {
|
|
|
24342
24352
|
const storeRepoUrl = strField(body, "storeRepoUrl");
|
|
24343
24353
|
const storeRef = strField(body, "storeRef");
|
|
24344
24354
|
const runtime = strField(body, "runtime");
|
|
24355
|
+
const conversationId = strField(body, "conversationId") || chatId;
|
|
24345
24356
|
const allowCrossRepo = boolField(body, "allowCrossRepo");
|
|
24346
24357
|
const agentIdentity = agentIdentityField(body);
|
|
24347
24358
|
let turnDriver = opts.driver;
|
|
@@ -24383,7 +24394,7 @@ async function handleChatTurn(req, res, chatId, opts) {
|
|
|
24383
24394
|
const stateToken = repoToken || envGithubToken();
|
|
24384
24395
|
const sessionFile = sessionFilePath(agentCwd, chatId);
|
|
24385
24396
|
const sessionStore = opts.createStore({
|
|
24386
|
-
sessionId:
|
|
24397
|
+
sessionId: conversationId,
|
|
24387
24398
|
sessionFile,
|
|
24388
24399
|
...repo ? { tenantId: repo } : {}
|
|
24389
24400
|
});
|
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.407",
|
|
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",
|