@kody-ade/kody-engine 0.4.309 → 0.4.311
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 +23 -19
- 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.311",
|
|
19
19
|
description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
|
|
20
20
|
license: "MIT",
|
|
21
21
|
type: "module",
|
|
@@ -3494,9 +3494,9 @@ async function runAgent(opts) {
|
|
|
3494
3494
|
errorMessage2 = "Claude Code reported it is not logged in; refusing to mark agent run successful";
|
|
3495
3495
|
}
|
|
3496
3496
|
if (outcome === "completed" && !sawMutatingTool) {
|
|
3497
|
-
const
|
|
3498
|
-
|
|
3499
|
-
|
|
3497
|
+
const hasUsefulSuccess = tokens.output > 0 || finalText !== "" || Boolean(getSubmitted?.());
|
|
3498
|
+
if (!hasUsefulSuccess) {
|
|
3499
|
+
const backendDead = opts.isBackendHealthy ? !await opts.isBackendHealthy() : false;
|
|
3500
3500
|
outcome = "failed";
|
|
3501
3501
|
outcomeKind = "model_error";
|
|
3502
3502
|
noWorkSuccess = true;
|
|
@@ -6009,27 +6009,30 @@ function resolveLitellmTimeoutMs() {
|
|
|
6009
6009
|
function generateLitellmConfigYaml(model) {
|
|
6010
6010
|
const apiKeyVar = model.apiKeyEnvVar ?? providerApiKeyEnvVar(model.provider);
|
|
6011
6011
|
const litellmProvider = model.litellmProvider ?? model.provider;
|
|
6012
|
-
const
|
|
6012
|
+
const modelGroups = litellmModelGroups(model);
|
|
6013
6013
|
const providerParams = model.baseURL ? [["api_base", model.baseURL]] : [];
|
|
6014
|
-
|
|
6015
|
-
"model_list:",
|
|
6014
|
+
const modelEntries = modelGroups.flatMap((modelGroup) => [
|
|
6016
6015
|
` - model_name: ${modelGroup}`,
|
|
6017
6016
|
` litellm_params:`,
|
|
6018
6017
|
` model: ${litellmProvider}/${model.model}`,
|
|
6019
6018
|
` api_key: os.environ/${apiKeyVar}`,
|
|
6020
|
-
...providerParams.map(([key, value]) => ` ${key}: ${value}`)
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6019
|
+
...providerParams.map(([key, value]) => ` ${key}: ${value}`)
|
|
6020
|
+
]);
|
|
6021
|
+
return ["model_list:", ...modelEntries, "", "litellm_settings:", " drop_params: true", ""].join("\n");
|
|
6022
|
+
}
|
|
6023
|
+
function litellmModelGroups(model) {
|
|
6024
|
+
const primary = litellmModelGroup(model);
|
|
6025
|
+
return Array.from(/* @__PURE__ */ new Set([primary, ...CLAUDE_CODE_PROXY_MODEL_ALIASES]));
|
|
6026
6026
|
}
|
|
6027
|
-
async function
|
|
6027
|
+
async function litellmServesModels(url, modelGroups) {
|
|
6028
6028
|
try {
|
|
6029
6029
|
const response = await fetch(`${url.replace(/\/+$/, "")}/v1/models`, { signal: AbortSignal.timeout(3e3) });
|
|
6030
6030
|
if (!response.ok) return false;
|
|
6031
6031
|
const payload = await response.json();
|
|
6032
|
-
|
|
6032
|
+
const served = new Set(
|
|
6033
|
+
(payload.data ?? []).map((entry) => entry.id).filter((id) => typeof id === "string")
|
|
6034
|
+
);
|
|
6035
|
+
return modelGroups.every((modelGroup) => served.has(modelGroup));
|
|
6033
6036
|
} catch {
|
|
6034
6037
|
return false;
|
|
6035
6038
|
}
|
|
@@ -6086,7 +6089,7 @@ async function startLitellmIfNeeded(model, projectDir, url = LITELLM_DEFAULT_URL
|
|
|
6086
6089
|
if (!needsLitellmProxy(model)) return null;
|
|
6087
6090
|
const cmd = resolveLitellmCommand();
|
|
6088
6091
|
let activeUrl = url.replace(/\/+$/, "");
|
|
6089
|
-
const
|
|
6092
|
+
const modelGroups = litellmModelGroups(model);
|
|
6090
6093
|
const childEnv = stripBlockingEnv({ ...process.env, ...readDotenvApiKeys(projectDir) });
|
|
6091
6094
|
let child;
|
|
6092
6095
|
let logPath;
|
|
@@ -6150,13 +6153,13 @@ ${tail}
|
|
|
6150
6153
|
};
|
|
6151
6154
|
const isHealthy = () => checkLitellmHealth(activeUrl);
|
|
6152
6155
|
if (await checkLitellmHealth(activeUrl)) {
|
|
6153
|
-
if (await
|
|
6156
|
+
if (await litellmServesModels(activeUrl, modelGroups)) {
|
|
6154
6157
|
return { url: activeUrl, kill: killChild, isHealthy, ensureHealthy };
|
|
6155
6158
|
}
|
|
6156
6159
|
const staleUrl = activeUrl;
|
|
6157
6160
|
activeUrl = await nextAvailableLitellmUrl(activeUrl);
|
|
6158
6161
|
process.stderr.write(
|
|
6159
|
-
`[kody litellm] existing proxy at ${staleUrl} does not serve ${
|
|
6162
|
+
`[kody litellm] existing proxy at ${staleUrl} does not serve ${modelGroups.join(", ")}; starting a separate proxy at ${activeUrl}
|
|
6160
6163
|
`
|
|
6161
6164
|
);
|
|
6162
6165
|
}
|
|
@@ -6220,13 +6223,14 @@ function stripBlockingEnv(env) {
|
|
|
6220
6223
|
delete out.AI_BASE_URL;
|
|
6221
6224
|
return out;
|
|
6222
6225
|
}
|
|
6223
|
-
var DEFAULT_LITELLM_STARTUP_TIMEOUT_SEC, LITELLM_HEALTH_POLL_INTERVAL_MS;
|
|
6226
|
+
var DEFAULT_LITELLM_STARTUP_TIMEOUT_SEC, LITELLM_HEALTH_POLL_INTERVAL_MS, CLAUDE_CODE_PROXY_MODEL_ALIASES;
|
|
6224
6227
|
var init_litellm = __esm({
|
|
6225
6228
|
"src/litellm.ts"() {
|
|
6226
6229
|
"use strict";
|
|
6227
6230
|
init_config();
|
|
6228
6231
|
DEFAULT_LITELLM_STARTUP_TIMEOUT_SEC = 150;
|
|
6229
6232
|
LITELLM_HEALTH_POLL_INTERVAL_MS = 2e3;
|
|
6233
|
+
CLAUDE_CODE_PROXY_MODEL_ALIASES = ["claude-haiku-4-5-20251001", "haiku"];
|
|
6230
6234
|
}
|
|
6231
6235
|
});
|
|
6232
6236
|
|
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.311",
|
|
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",
|