@kody-ade/kody-engine 0.4.593 → 0.4.594
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 +28 -2
- 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.594",
|
|
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",
|
|
@@ -4220,6 +4220,12 @@ async function runAgent(opts) {
|
|
|
4220
4220
|
let sawTerminalSuccess = false;
|
|
4221
4221
|
let sawLoginRequired = false;
|
|
4222
4222
|
let noWorkSuccess = false;
|
|
4223
|
+
const sdkAbortController = opts.stopOnRateLimit ? new AbortController() : opts.abortController;
|
|
4224
|
+
const forwardOwnerAbort = () => sdkAbortController?.abort(opts.abortController?.signal.reason);
|
|
4225
|
+
if (opts.stopOnRateLimit && opts.abortController) {
|
|
4226
|
+
if (opts.abortController.signal.aborted) forwardOwnerAbort();
|
|
4227
|
+
else opts.abortController.signal.addEventListener("abort", forwardOwnerAbort, { once: true });
|
|
4228
|
+
}
|
|
4223
4229
|
try {
|
|
4224
4230
|
const queryOptions = {
|
|
4225
4231
|
model: opts.litellmUrl ? litellmModelGroup(opts.model) : opts.model.model,
|
|
@@ -4378,7 +4384,7 @@ async function runAgent(opts) {
|
|
|
4378
4384
|
};
|
|
4379
4385
|
}
|
|
4380
4386
|
queryOptions.settingSources = opts.settingSources ?? ["project", "local"];
|
|
4381
|
-
if (
|
|
4387
|
+
if (sdkAbortController) queryOptions.abortController = sdkAbortController;
|
|
4382
4388
|
const stableBinary = ensureStableClaudeBinary();
|
|
4383
4389
|
if (stableBinary) {
|
|
4384
4390
|
const sdkBinaryPathOption = ["pathToClaudeCode", "Exec", "utable"].join("");
|
|
@@ -4441,6 +4447,22 @@ async function runAgent(opts) {
|
|
|
4441
4447
|
`);
|
|
4442
4448
|
}
|
|
4443
4449
|
const m = msg;
|
|
4450
|
+
if (opts.stopOnRateLimit && m.type === "system" && m.subtype === "api_retry" && Number(m.error_status) === 429) {
|
|
4451
|
+
outcome = "failed";
|
|
4452
|
+
outcomeKind = "rate_limit";
|
|
4453
|
+
errorMessage2 = "model rate limited (429)";
|
|
4454
|
+
sdkAbortController?.abort(new Error(errorMessage2));
|
|
4455
|
+
if (typeof iterator.return === "function") {
|
|
4456
|
+
try {
|
|
4457
|
+
await Promise.race([
|
|
4458
|
+
iterator.return(void 0).catch(() => void 0),
|
|
4459
|
+
new Promise((resolve24) => setTimeout(resolve24, 1e3).unref())
|
|
4460
|
+
]);
|
|
4461
|
+
} catch {
|
|
4462
|
+
}
|
|
4463
|
+
}
|
|
4464
|
+
break;
|
|
4465
|
+
}
|
|
4444
4466
|
if (opts.onProgress) {
|
|
4445
4467
|
const blocks = m.message?.content ?? [];
|
|
4446
4468
|
for (const block of blocks) {
|
|
@@ -4533,6 +4555,9 @@ async function runAgent(opts) {
|
|
|
4533
4555
|
errorMessage2 = e instanceof Error ? e.message : String(e);
|
|
4534
4556
|
}
|
|
4535
4557
|
} finally {
|
|
4558
|
+
if (opts.stopOnRateLimit && opts.abortController) {
|
|
4559
|
+
opts.abortController.signal.removeEventListener("abort", forwardOwnerAbort);
|
|
4560
|
+
}
|
|
4536
4561
|
try {
|
|
4537
4562
|
fullLog.end();
|
|
4538
4563
|
} catch {
|
|
@@ -22466,6 +22491,7 @@ async function runImplementation(profileName, input) {
|
|
|
22466
22491
|
verbose: input.verbose,
|
|
22467
22492
|
quiet: input.quiet,
|
|
22468
22493
|
abortController: input.abortController,
|
|
22494
|
+
stopOnRateLimit: candidateIndex < modelCandidates.length - 1,
|
|
22469
22495
|
deadlineAtMs: input.deadlineAtMs,
|
|
22470
22496
|
ndjsonDir,
|
|
22471
22497
|
additionalDirectories: agentTaskArtifacts ? [agentTaskArtifacts.absDir] : void 0,
|
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.594",
|
|
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",
|