trantor 0.18.73 → 0.18.74
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/.claude-plugin/plugin.json +1 -1
- package/bin/retire.mjs +5 -1
- package/lib/balances.mjs +10 -4
- package/lib/classify-failure.mjs +5 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trantor",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.74",
|
|
4
4
|
"description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + crew orchestration for independent AI coding agents (Claude, Codex, Gemini, Kimi, DeepSeek)",
|
|
5
5
|
"mcpServers": {
|
|
6
6
|
"relay": {
|
package/bin/retire.mjs
CHANGED
|
@@ -37,7 +37,11 @@ async function contractsFor(session) {
|
|
|
37
37
|
|
|
38
38
|
const panes = collectPanes({ turnInFlight, sessionProcessState, hostId: host }).filter(p => !isRetired(p.sid));
|
|
39
39
|
for (const p of panes) p.openContracts = await contractsFor(`${host}:${p.project}`);
|
|
40
|
-
|
|
40
|
+
// #8017: the operator names projects to keep open whatever their idle age.
|
|
41
|
+
const keep = new Set(String(flag("--keep") || "").split(",").map(s => s.trim()).filter(Boolean));
|
|
42
|
+
const decided = panes.map(p => keep.has(p.project)
|
|
43
|
+
? { ...retireDecision(p, { hours }), retire: false, reason: "kept by the operator (--keep)" }
|
|
44
|
+
: retireDecision(p, { hours }));
|
|
41
45
|
const due = decided.filter(d => d.retire);
|
|
42
46
|
|
|
43
47
|
if (JSON_OUT) {
|
package/lib/balances.mjs
CHANGED
|
@@ -80,12 +80,18 @@ export const ADAPTERS = [
|
|
|
80
80
|
provider: "openrouter", label: "OpenRouter", kind: "prepaid", match: ["openrouter"], envKeys: ["OPENROUTER_API_KEY"],
|
|
81
81
|
async fetch(key) {
|
|
82
82
|
const d = (await getJSON("https://openrouter.ai/api/v1/key", key)).data || {};
|
|
83
|
-
// limit_remaining is
|
|
84
|
-
// is unreliable (usage is lifetime). null limit_remaining + null limit ⇒ unlimited key.
|
|
83
|
+
// #9805: /key limit_remaining is this KEY's spending cap, not the account; the balance is /credits.
|
|
85
84
|
const unlimited = d.limit_remaining == null && d.limit == null;
|
|
86
|
-
const
|
|
85
|
+
const keyRemaining = num(d.limit_remaining) != null ? num(d.limit_remaining)
|
|
87
86
|
: (num(d.limit) != null ? Math.max(0, num(d.limit) - (num(d.usage) || 0)) : null);
|
|
88
|
-
|
|
87
|
+
let account = null;
|
|
88
|
+
try {
|
|
89
|
+
const c = (await getJSON("https://openrouter.ai/api/v1/credits", key)).data || {};
|
|
90
|
+
if (num(c.total_credits) != null) account = num(c.total_credits) - (num(c.total_usage) || 0);
|
|
91
|
+
} catch { /* /credits unreachable: fall back to the key cap, labelled as such */ }
|
|
92
|
+
const remaining = account != null ? account : keyRemaining;
|
|
93
|
+
return { remaining, currency: "USD", usage: num(d.usage), limit: num(d.limit), unlimited,
|
|
94
|
+
source: account != null ? "account" : "key-cap", keyRemaining };
|
|
89
95
|
},
|
|
90
96
|
},
|
|
91
97
|
{
|
package/lib/classify-failure.mjs
CHANGED
|
@@ -139,10 +139,13 @@ export function providerRejected(errText) {
|
|
|
139
139
|
export const BILLING_RE = /requires more credits|can only afford|http 402|insufficient balance|payment required/i;
|
|
140
140
|
|
|
141
141
|
/** #9724: a billing rejection on a clean exit is the provider refusing the turn. Same doctrine as
|
|
142
|
-
* looksLikeAuthDeath: a shipped commit (realWork, checked by the runner via git) is a live turn
|
|
142
|
+
* looksLikeAuthDeath: a shipped commit (realWork, checked by the runner via git) is a live turn,
|
|
143
|
+
* and only output short enough to be JUST the error counts (#9812: a turn that ran `git log` over
|
|
144
|
+
* 58fc5e2 quoted the phrases and parked a healthy kimi). */
|
|
143
145
|
export function looksLikeBillingDeath(ownText, realWork = false) {
|
|
144
146
|
if (realWork) return false;
|
|
145
|
-
|
|
147
|
+
const t = String(ownText || "");
|
|
148
|
+
return t.length < OWN_OUTPUT_ANSWER_MIN && BILLING_RE.test(t);
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
/** #9724/#8234: a usage record that RESOLVED (the #8234 lookup found the session's record) to all
|