@kal-elsam/kairo-runtime 0.23.1 → 0.23.2
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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,29 @@ Historical entries below may reference the legacy `@kal-elsam/harness` package n
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
## 0.23.2 — 2026-09-18 (Kairo Runtime)
|
|
9
|
+
|
|
10
|
+
Patch release.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Routing eligibility (`checkCandidate`, shared by real execution
|
|
15
|
+
routing, ASK routing, and the FIT widget) and ASK's own ordering
|
|
16
|
+
only ever read the primary (5h) quota window — a provider whose
|
|
17
|
+
weekly window was nearly exhausted still got picked first and was
|
|
18
|
+
never excluded, as long as its 5h window looked healthy. Now takes
|
|
19
|
+
the worse of the two windows everywhere, fail-closed, matching the
|
|
20
|
+
same principle already applied to OpenCode Go's own windows.
|
|
21
|
+
- `askCodex`/`askClaude` (the ASK-mode question path) used a fixed 30s
|
|
22
|
+
deadline from process start. Codex's ASK path always uses the
|
|
23
|
+
provider's single default model regardless of question complexity
|
|
24
|
+
(no effort-based tiering for Codex today), so a heavier default
|
|
25
|
+
model plus a cold sandboxed `codex exec` start can genuinely exceed
|
|
26
|
+
30s with real quota to spare — a real, slow answer, not a hang. Both
|
|
27
|
+
ask calls now reset their timeout on every real stdout/stderr chunk
|
|
28
|
+
instead, never an absolute one, so only a genuine hang still times
|
|
29
|
+
out.
|
|
30
|
+
|
|
8
31
|
## 0.23.1 — 2026-09-18 (Kairo Runtime)
|
|
9
32
|
|
|
10
33
|
Patch release.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kal-elsam/kairo-runtime",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.2",
|
|
4
4
|
"description": "Kairo Runtime — local agent operating system for Codex, Cursor, Claude, Pi, Engram, and Graphify.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/Kal-elSam/harness#readme",
|
|
@@ -118,9 +118,21 @@ function findAdapter(adapterId, adapters) {
|
|
|
118
118
|
return adapters.find((adapter) => adapter.id === baseId) ?? null;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* The WORST remaining headroom across both real windows (5h "primary" and
|
|
123
|
+
* weekly "secondary") — never just the primary one. A provider whose
|
|
124
|
+
* weekly quota is nearly gone must be treated that way everywhere
|
|
125
|
+
* (exclusion AND ordering) even while its 5h window still looks healthy;
|
|
126
|
+
* otherwise Kairo keeps routing to it, burning through the one budget
|
|
127
|
+
* that's actually about to run out. Mirrors the same fail-closed
|
|
128
|
+
* principle checkCandidate already applies to OpenCode Go's windows (any
|
|
129
|
+
* one window being real trouble is real trouble, full stop).
|
|
130
|
+
* @param {object|null} usageEntry - a codex/claude usage-probe result (primary/secondary windows)
|
|
131
|
+
*/
|
|
122
132
|
function remainingPercent(usageEntry) {
|
|
123
|
-
|
|
133
|
+
const known = [usageEntry?.primary?.remainingPercent, usageEntry?.secondary?.remainingPercent]
|
|
134
|
+
.filter((value) => typeof value === "number");
|
|
135
|
+
return known.length > 0 ? Math.min(...known) : null;
|
|
124
136
|
}
|
|
125
137
|
|
|
126
138
|
// Below this real remaining-quota percentage, a provider is treated as
|
|
@@ -37,6 +37,32 @@ function unknown(error) {
|
|
|
37
37
|
return { status: "error", answer: null, error: String(error) };
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Resets on every real stdout/stderr chunk from the child, never an
|
|
42
|
+
* absolute deadline from process start — the same real distinction
|
|
43
|
+
* execution-adapters/opencode.js's own idle timeout draws: a real, live
|
|
44
|
+
* answer that's just taking a while (a heavier reasoning model, a cold
|
|
45
|
+
* sandbox start) must never be killed for merely being slow, only a
|
|
46
|
+
* process that's produced nothing at all for `timeoutMs` really looks
|
|
47
|
+
* hung. A single-shot ask call, so this stays local rather than reusing
|
|
48
|
+
* run-supervisor.js's own detached-run mechanism.
|
|
49
|
+
* @param {import("node:child_process").ChildProcess} child
|
|
50
|
+
* @param {number} timeoutMs
|
|
51
|
+
* @param {() => void} onIdle
|
|
52
|
+
* @returns {() => void} call to clear the timer once the call finishes
|
|
53
|
+
*/
|
|
54
|
+
function armIdleTimeout(child, timeoutMs, onIdle) {
|
|
55
|
+
let handle = null;
|
|
56
|
+
const reset = () => {
|
|
57
|
+
if (handle) clearTimeout(handle);
|
|
58
|
+
handle = setTimeout(onIdle, timeoutMs);
|
|
59
|
+
};
|
|
60
|
+
child.stdout?.on("data", reset);
|
|
61
|
+
child.stderr?.on("data", reset);
|
|
62
|
+
reset();
|
|
63
|
+
return () => { if (handle) clearTimeout(handle); };
|
|
64
|
+
}
|
|
65
|
+
|
|
40
66
|
/** @param {{question:string, model:string|null, cwd:string, spawn:Function, timeoutMs:number, env:object}} args */
|
|
41
67
|
function askClaude({ question, model, cwd, spawn, timeoutMs, env }) {
|
|
42
68
|
// --restricted: removes Bash/code-execution tools and WebFetch, ignores
|
|
@@ -57,11 +83,11 @@ function askClaude({ question, model, cwd, spawn, timeoutMs, env }) {
|
|
|
57
83
|
}
|
|
58
84
|
let stdout = "";
|
|
59
85
|
let finished = false;
|
|
60
|
-
const
|
|
86
|
+
const clearIdleTimer = armIdleTimeout(child, timeoutMs, () => finish(unknown(`claude -p idle-timed out after ${timeoutMs}ms with no output`)));
|
|
61
87
|
function finish(result) {
|
|
62
88
|
if (finished) return;
|
|
63
89
|
finished = true;
|
|
64
|
-
|
|
90
|
+
clearIdleTimer();
|
|
65
91
|
try { child.kill?.(); } catch { /* best effort */ }
|
|
66
92
|
resolve(result);
|
|
67
93
|
}
|
|
@@ -106,11 +132,11 @@ async function askCodex({ question, model, cwd, spawn, timeoutMs, env }) {
|
|
|
106
132
|
return;
|
|
107
133
|
}
|
|
108
134
|
let finished = false;
|
|
109
|
-
const
|
|
135
|
+
const clearIdleTimer = armIdleTimeout(child, timeoutMs, () => finish(unknown(`codex exec idle-timed out after ${timeoutMs}ms with no output`)));
|
|
110
136
|
function finish(result) {
|
|
111
137
|
if (finished) return;
|
|
112
138
|
finished = true;
|
|
113
|
-
|
|
139
|
+
clearIdleTimer();
|
|
114
140
|
try { child.kill?.(); } catch { /* best effort */ }
|
|
115
141
|
resolve(result);
|
|
116
142
|
}
|
|
@@ -89,7 +89,7 @@ export async function readCodexModels({
|
|
|
89
89
|
child.once?.("close", () => { if (!finished) finish(unknown("codex app-server closed before model list")); });
|
|
90
90
|
|
|
91
91
|
writeRequest(child, 1, "initialize", {
|
|
92
|
-
clientInfo: { name: "kairo", title: "Kairo", version: "0.23.
|
|
92
|
+
clientInfo: { name: "kairo", title: "Kairo", version: "0.23.2" },
|
|
93
93
|
capabilities: {}
|
|
94
94
|
});
|
|
95
95
|
});
|
|
@@ -151,7 +151,7 @@ export async function readCodexUsage({
|
|
|
151
151
|
child.once?.("close", () => { if (!finished) finish(unknown("codex app-server closed before rate limits")); });
|
|
152
152
|
|
|
153
153
|
writeRequest(child, 1, "initialize", {
|
|
154
|
-
clientInfo: { name: "kairo", title: "Kairo", version: "0.23.
|
|
154
|
+
clientInfo: { name: "kairo", title: "Kairo", version: "0.23.2" },
|
|
155
155
|
capabilities: {}
|
|
156
156
|
});
|
|
157
157
|
});
|