@chibitek/chibi 0.1.190 → 0.1.192
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/assets/TerminalPanel-DFuMZ0ql.css +1 -0
- package/dist/assets/TerminalPanel-PcPGVxjJ.js +10 -0
- package/dist/assets/{abnfDiagram-O67JEVCF-Bz3wlNsQ.js → abnfDiagram-O67JEVCF-CrdtKXgW.js} +1 -1
- package/dist/assets/{arc-CX0dJSa0.js → arc-DZp6zTLS.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-APIM9yGf.js → architectureDiagram-NJMV4G6O-By4YaF8p.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-DNmNNaVY.js → blockDiagram-BEXU5L5S-b9XT0BEX.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-CAPPUeMU.js → c4Diagram-YGBWAQC7-ClDc6UCa.js} +1 -1
- package/dist/assets/channel-CP6zTF5h.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-DfCDsQgU.js → chunk-2Q5K7J3B-D8FDC39i.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-vdffwGmy.js → chunk-3FUC2YCW-_Lb0IVFX.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-BazIL_2e.js → chunk-5VM5RSS4-f7re7-dy.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-GpKjNZ-V.js → chunk-GTNCS2PH-Cl4oAWQ1.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-BuRq21LZ.js → chunk-GWA4HPMP-CLO3k8zE.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-CqNGOyHV.js → chunk-JWPE2WC7-kXWDfQP-.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-B1DpzVCP.js → chunk-NETBCI7D-DPtewwHN.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-DcH1Euc6.js → chunk-WEXAMYUT-B17lA9FX.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-M1JLd_cm.js → chunk-XXDRQBXY-B6RbRjkG.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-C8mBZ7i2.js → classDiagram-v2-NBCMYWYE-BrZPolTO.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-Cr3TqHDz.js → cose-bilkent-JH36ORCC-DAvSQrfJ.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-BKPr6l0I.js → cynefin-OW5HDTMX-BBEKoW-B.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-Cbg5mrIM.js → cynefinDiagram-VND7K2PF-DTeD9b7A.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-9I9X1J3r.js → dagre-6A5THRUB-7Lem_oJB.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-B43b8pqQ.js → diagram-22UHCM2B-BBMu1DQ4.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-CIehgEkZ.js → diagram-3UASUU5V-wTBd45sT.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-gx8nkXLZ.js → diagram-ATOU4E4O-DejXVMcb.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-BZzWgYHa.js → diagram-CDSNMT55-CqYId1m8.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-BqoCqkZD.js → diagram-MLGK6HIB-DrOnQ-Zt.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-Bsc7x0UT.js → diagram-MPIPVDR6-CHDvidFk.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-8HjdD_s8.js → ebnfDiagram-ZINNZB2B-BzwpPn5m.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-bmxiEFtT.js → elk-276RUBZZ-E1HDqzYH.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-BU-sRLe3.js → erDiagram-OPXOYQCR-D5E6uaT3.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-D45vn40U.js → flowDiagram-KWPJA3E3-R1exlkB4.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-CArB98Hu.js → ganttDiagram-FUAMR5RP-B5kjMGRd.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-fPB1k-W7.js → gitGraphDiagram-X574FWY7-BqkJtDvq.js} +1 -1
- package/dist/assets/index-DBOyvapT.css +1 -0
- package/dist/assets/{index-QsXeEMxJ.js → index-D_WPT1i-.js} +172 -171
- package/dist/assets/{index-u1wvoacp.js → index-DvEhLbPJ.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-ZRVWXAr4.js → infoDiagram-VRGFBTTK-LXwGqqoO.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-DOaurRbX.js → ishikawaDiagram-OU5B5YK6-D_E17iEV.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-Ca9B-09w.js → journeyDiagram-ZHPQQLJL-BkKKJrLR.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-CA2XswEJ.js → kanban-definition-PNTS6WVX-y6rjCvyW.js} +1 -1
- package/dist/assets/{linear-B-F7icip.js → linear-BYdFcAFG.js} +1 -1
- package/dist/assets/{mermaid.core-ymtCpbZ5.js → mermaid.core-BZnTzEV7.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-02vIazCi.js → mindmap-definition-NLK3R4M7-HPM-ymN0.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-DRb7Pn72.js → pegDiagram-GJSIUBJH-X2YHQQDC.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-B2YwP3S_.js → pieDiagram-5QR66LMP-FQ47RvEb.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-CbR573mu.js → quadrantDiagram-O4NWA36T-CZok45i-.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-CqHuDCnM.js → railroadDiagram-XR7U4H2S-CkzgSbiA.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-BSeC-H1j.js → requirementDiagram-PLB6GJNP-B96vOB2k.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-BMFuhoh1.js → sankeyDiagram-IPEJSGJF-C3OzzNBk.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-DRT_EI9u.js → sequenceDiagram-PO4LG4MO-UEjwqc9C.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BLFT4fV7.js → sizeCapture-INFHLROL-CYlsATAn.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-C8vB_69H.js → stateDiagram-v2-GCMORJYK-i3kPrA1F.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-T6BBolT8.js → swimlanes-2SLR337P-CwxGl-A-.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-BxG6JDb-.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-DjdjBRQV.js → timeline-definition-EJHVYXUP-B-CIp72A.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-CDGccZMN.js → usecaseDiagram-POWQR4AR-CvI2j7z-.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-CgYSihtW.js → vennDiagram-UO4OBE2U--l2Nr666.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-Bub5ScM8.js → wardleyDiagram-VNRHLVJA-C_WERxNO.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-DK5iMX67.js → xychartDiagram-PMCCYNJV-VoRUD4V6.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-server/container-mcp.js +84 -81
- package/dist-server/drivers/agents-proxy.js +81 -81
- package/dist-server/index.js +2115 -1577
- package/dist-server/openmausbot.js +611 -606
- package/dist-server/pair-cli.js +611 -606
- package/dist-server/server/config.js +1 -1
- package/dist-server/server/engine-failover.js +20 -7
- package/dist-server/server/engine-failure.js +5 -5
- package/dist-server/server/engine-tiers.js +12 -42
- package/dist-server/server/hermes-reply-failure.js +27 -0
- package/dist-server/server/index.js +26 -23
- package/dist-server/server/ladder-order.js +74 -0
- package/dist-server/server/model-levels/chibitek-rankings.js +8 -3
- package/dist-server/server/model-levels/index.js +3 -0
- package/dist-server/server/nexus-memory/backoff.js +68 -0
- package/dist-server/server/nexus-memory/client.js +55 -11
- package/dist-server/server/nexus-memory/index.js +6 -29
- package/dist-server/server/paw/nexus-sync.js +160 -0
- package/dist-server/server/paw/service.js +25 -3
- package/dist-server/server/paw/sync.js +19 -30
- package/dist-server/server/remote-desktop.js +1 -0
- package/dist-server/server/routes/terminal.js +72 -0
- package/dist-server/server/terminal-places.js +63 -0
- package/dist-server/server/terminal.js +124 -0
- package/dist-server/server/vault/store.js +8 -4
- package/dist-server/shared/approval-mode.js +12 -2
- package/dist-server/shared/engine-choices.js +14 -0
- package/dist-server/shared/engine-tiers.js +14 -8
- package/dist-server/shared/harness-weights.js +33 -0
- package/dist-server/shared/vault-api-providers.js +16 -2
- package/dist-server/shared/vault.js +3 -2
- package/dist-server/vps-container-mcp.js +84 -81
- package/package.json +1 -1
- package/skills/build-paw/SKILL.md +53 -0
- package/skills/build-paw/VENDORED.md +4 -0
- package/skills/build-paw/manifest.json +10 -2
- package/skills/build-paw/references/roles.md +134 -0
- package/skills/build-paw/references/wiring.md +77 -0
- package/dist/assets/channel-CnfDal05.js +0 -1
- package/dist/assets/index-CI0vGAif.css +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-BIY4fGCv.js +0 -8
- package/dist-server/server/session-fallback.js +0 -76
- package/skills/icm-workspace-builder/SKILL.md +0 -154
- package/skills/icm-workspace-builder/VENDORED.md +0 -14
- package/skills/icm-workspace-builder/manifest.json +0 -15
- package/skills/icm-workspace-builder/references/interview.md +0 -39
- package/skills/icm-workspace-builder/references/templates.md +0 -147
- package/skills/icm-workspace-builder/references/wiring.md +0 -69
|
@@ -265,7 +265,7 @@ const featureConfigSchema = z.object({
|
|
|
265
265
|
/** Team Rooms (docs/chibitek/team-room-plan.md). On unless explicitly
|
|
266
266
|
* set to false; every room action still needs Atomic's Chibitek sign-in
|
|
267
267
|
* (Settings > General > Basics); see teamRoomsEnabled. */
|
|
268
|
-
teamRooms: z.boolean().optional(),
|
|
268
|
+
teamRooms: z.boolean().optional(), terminal: z.boolean().optional(), localTerminal: z.boolean().optional(), // Last two: the Computer panel Terminal tab, and its shell on this computer, which needs `terminal` too (docs/computer-terminal.md).
|
|
269
269
|
/** Claude bots also load the MCP servers and connectors from this
|
|
270
270
|
* machine's own Claude Code setup (Plugins → MCP servers switch). Off by
|
|
271
271
|
* default: each extra tool costs tokens on every model call. */
|
|
@@ -33,12 +33,24 @@
|
|
|
33
33
|
// startTurn (server/index.ts); everything here is pure bookkeeping.
|
|
34
34
|
import { newEventId } from "./contracts.js";
|
|
35
35
|
import { classifyEngineFailure, isCredentialDead, mayBeReplyFailure, replyEngineFailure, statedReset } from "./engine-failure.js";
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
import { hermesReplyFailure } from "./hermes-reply-failure.js";
|
|
37
|
+
/** The two-try cap: at most this many engines do work in one turn, the
|
|
38
|
+
* first and one switch. A failed attempt counts toward it when the engine
|
|
39
|
+
* ran (a usage limit, a stall, an error no pattern recognises). When the
|
|
40
|
+
* second such engine fails too, the turn stops with its one plain line
|
|
41
|
+
* rather than walking the rest of the ladder. */
|
|
41
42
|
export const MAX_ENGINES_PER_TURN = 2;
|
|
43
|
+
/** However many engines were passed over, a turn never tries more than this. */
|
|
44
|
+
export const MAX_ENGINES_WALKED = 8;
|
|
45
|
+
/** Whether a turn has used up its tries. An engine that failed only because
|
|
46
|
+
* its account needs the person (a sign-in, an expired key) did no work, so
|
|
47
|
+
* it does not count: the turn walks past it to the next engine rather than
|
|
48
|
+
* stopping on an error while a ready engine is one rung away (Erick,
|
|
49
|
+
* 2026-11-14). `needsPerson` reads the resting store. */
|
|
50
|
+
export function triesSpent(tried, needsPerson) {
|
|
51
|
+
const all = [...tried];
|
|
52
|
+
return all.length >= MAX_ENGINES_WALKED || all.filter((instanceId) => !needsPerson(instanceId)).length >= MAX_ENGINES_PER_TURN;
|
|
53
|
+
}
|
|
42
54
|
const accountOf = (engine) => engine.snapshot.account?.email ?? engine.snapshot.account?.organization;
|
|
43
55
|
/** Another instance of the same engine on the same account (or on none): it
|
|
44
56
|
* sends a model down the route a failure just broke (two OpenCode instances
|
|
@@ -115,7 +127,8 @@ export class FailoverGate {
|
|
|
115
127
|
turn.held.push(event);
|
|
116
128
|
return [];
|
|
117
129
|
}
|
|
118
|
-
|
|
130
|
+
// Hermes's terminal copy has no fixed head but arrives whole, in one chunk.
|
|
131
|
+
if (!turn.said && !turn.tools && (mayBeReplyFailure(turn.pendingText + event.delta) || hermesReplyFailure(turn.pendingText + event.delta) !== null)) {
|
|
119
132
|
turn.pending.push(event);
|
|
120
133
|
turn.pendingText += event.delta;
|
|
121
134
|
return [];
|
|
@@ -138,7 +151,7 @@ export class FailoverGate {
|
|
|
138
151
|
if (event.itemType !== "assistant_text")
|
|
139
152
|
return [event];
|
|
140
153
|
if (!event.synthetic) {
|
|
141
|
-
const failure = turn.said || turn.tools ? null : replyEngineFailure(event.text, this.now());
|
|
154
|
+
const failure = turn.said || turn.tools ? null : (replyEngineFailure(event.text, this.now()) ?? hermesReplyFailure(event.text, this.now()));
|
|
142
155
|
if (failure) {
|
|
143
156
|
turn.held.push(...turn.pending, event);
|
|
144
157
|
turn.pending = [];
|
|
@@ -60,7 +60,7 @@ const USAGE_LIMITED = [
|
|
|
60
60
|
/\bplan limit\b|\blimit (?:of|for) your (?:plan|subscription)\b/i,
|
|
61
61
|
// Anthropic API: "Your credit balance is too low to access the Anthropic API."
|
|
62
62
|
// xAI: "Your team ... has either used all available credits or reached its monthly spending limit."
|
|
63
|
-
/\bcredit balance (?:is )?too low\b|\binsufficient (?:credits?|balance|funds)\b|\b(?:out|run out) of credits\b/i,
|
|
63
|
+
/\bcredit balance (?:is )?too low\b|\binsufficient (?:\w+ )?(?:credits?|balance|funds)\b|\b(?:out|run out) of credits\b/i,
|
|
64
64
|
/\bused all (?:available |of your )?credits\b|\bno credits? (?:left|remaining)\b|\bspending limit\b/i,
|
|
65
65
|
/\bexhausted your (?:\w+ )?quota\b/i,
|
|
66
66
|
/\bquota\b[^.]{0,60}\b(?:exceeded|exhausted|reached|used up)\b|\b(?:exceeded|exhausted|reached)\b[^.]{0,40}\bquota\b/i,
|
|
@@ -165,10 +165,10 @@ const REPLY_FAILURE = [
|
|
|
165
165
|
/^billing or credits exhausted\b|^usage limit reached\b[\s\S]*\b(?:quota|limit will reset|resets? (?:in|at|on))\b/i, // the second: a quota page as the reply (2026-10-26)
|
|
166
166
|
// A bare "HTTP 402:" at the head counts only with the provider's own
|
|
167
167
|
// billing words after it.
|
|
168
|
-
/^(?:(?:api )?error:\s*)?http 402:[\s\S]*\b(?:positive balance|insufficient (?:balance|credits?|funds)|add (?:credits|balance|funds)|top-?up|credits? (?:exhausted|depleted))\b/i,
|
|
168
|
+
/^(?:(?:api )?error:\s*)?http 402:[\s\S]*\b(?:positive balance|insufficient (?:\w+ )?(?:balance|credits?|funds)|add (?:credits|balance|funds)|top-?up|credits? (?:exhausted|depleted))\b/i,
|
|
169
169
|
];
|
|
170
170
|
/** A reply this long is an answer whatever it starts with. */
|
|
171
|
-
const REPLY_FAILURE_MAX_CHARS = 2_000;
|
|
171
|
+
export const REPLY_FAILURE_MAX_CHARS = 2_000;
|
|
172
172
|
/** A usage limit, expired login or provider outage an agent delivered as its reply, or null (the caller checks no tools ran). */
|
|
173
173
|
export function replyEngineFailure(text, now = Date.now()) {
|
|
174
174
|
const reply = text.trim();
|
|
@@ -384,9 +384,9 @@ const RESET_READERS = [
|
|
|
384
384
|
}
|
|
385
385
|
},
|
|
386
386
|
// "try again in 2 days 4 hours 12 minutes", "resets in 37m", "Please
|
|
387
|
-
// retry in 41.5s", "resets in 2d 4h 30m".
|
|
387
|
+
// retry in 41.5s", "resets in 2d 4h 30m", Hermes's "resets in ~127h".
|
|
388
388
|
function* relative(text, now) {
|
|
389
|
-
for (const m of text.matchAll(new RegExp(String.raw `${RESET_WORD}\s+in\s
|
|
389
|
+
for (const m of text.matchAll(new RegExp(String.raw `${RESET_WORD}\s+in\s+~?\s*(${DURATION})`, "gi"))) {
|
|
390
390
|
const total = durationMs(m[1]);
|
|
391
391
|
if (total > 0)
|
|
392
392
|
yield { at: now + total, phrase: m[0] };
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
// snapshot cache, so the server wires it to the live registry and the tests
|
|
5
5
|
// drive it with plain candidates.
|
|
6
6
|
import { BOT_TIERS, CHIBI_DEFAULT_RUNG, DEFAULT_LADDERS, DEFAULT_TIER_CLASSES, MODEL_CLASSES, classBelow, isBotTier, rungAccounts, toModelClass } from "../shared/engine-tiers.js";
|
|
7
|
-
import { modelHost } from "../shared/engine-choices.js";
|
|
8
7
|
export { DEFAULT_LADDERS };
|
|
9
|
-
import {
|
|
8
|
+
import { expandAnySubscription, orderRungs } from "./ladder-order.js";
|
|
10
9
|
import { ATOMIC_ENGINE_INSTANCE, engineIntent, freeCandidate, localModel, modelBilling, modelProvider, paidCandidate, perTokenModel } from "./harness-import/engine-policy.js";
|
|
11
10
|
/** Engines a tier tries first, whatever the class catalog order says: Chibi
|
|
12
11
|
* runs on Claude (Erick, 2026-10-13: open-weight models broke its
|
|
@@ -17,37 +16,8 @@ import { ATOMIC_ENGINE_INSTANCE, engineIntent, freeCandidate, localModel, modelB
|
|
|
17
16
|
const TIER_PREFERRED_DRIVERS = {
|
|
18
17
|
orchestrator: ["claudeAgent"],
|
|
19
18
|
};
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
* other subscription the person may have comes first, so those plans get
|
|
23
|
-
* used (Erick, 2026-10-23). */
|
|
24
|
-
const FRONTIER_PROVIDERS = new Set(["claude", "chatgpt"]);
|
|
25
|
-
const FRONTIER_RUNGS = 2;
|
|
26
|
-
/** The plan a rung is paid from: the subscription provider whose harness the
|
|
27
|
-
* engine is, else the host its model comes from on a harness that reaches
|
|
28
|
-
* several (Nous Portal on Hermes, OpenCode Go), else the engine itself. */
|
|
29
|
-
const rungProvider = (entry) => subscriptionProviderForDriver(entry.engine)?.id ?? (entry.model ? modelHost(entry.engine, { id: entry.model }) : undefined) ?? entry.engine;
|
|
30
|
-
/** A generated ladder's order: the first FRONTIER_RUNGS Claude or ChatGPT
|
|
31
|
-
* rungs, then every other provider round-robin (each provider's best rung
|
|
32
|
-
* in the class first, one rung per provider per round), then the remaining
|
|
33
|
-
* Claude and ChatGPT rungs. Order within each provider is kept. */
|
|
34
|
-
function spreadProviders(rungs) {
|
|
35
|
-
const frontier = rungs.filter((entry) => FRONTIER_PROVIDERS.has(rungProvider(entry)));
|
|
36
|
-
const others = new Map();
|
|
37
|
-
for (const entry of rungs) {
|
|
38
|
-
const provider = rungProvider(entry);
|
|
39
|
-
if (!FRONTIER_PROVIDERS.has(provider))
|
|
40
|
-
others.set(provider, [...others.get(provider) ?? [], entry]);
|
|
41
|
-
}
|
|
42
|
-
const rounds = [];
|
|
43
|
-
const longest = Math.max(0, ...[...others.values()].map((group) => group.length));
|
|
44
|
-
for (let round = 0; round < longest; round++) {
|
|
45
|
-
for (const group of others.values())
|
|
46
|
-
if (group[round])
|
|
47
|
-
rounds.push(group[round]);
|
|
48
|
-
}
|
|
49
|
-
return [...frontier.slice(0, FRONTIER_RUNGS), ...rounds, ...frontier.slice(FRONTIER_RUNGS)];
|
|
50
|
-
}
|
|
19
|
+
/** How many of a tier's preferred rungs keep the top of its generated ladder. */
|
|
20
|
+
const PREFERRED_RUNGS = 2;
|
|
51
21
|
/** Every engine that runs a model of the class, the models in the order
|
|
52
22
|
* given (cheapest per task, then per token, then fastest), each model's
|
|
53
23
|
* engines in catalog order. */
|
|
@@ -67,14 +37,13 @@ function classRungs(models, modelClass) {
|
|
|
67
37
|
}
|
|
68
38
|
return out;
|
|
69
39
|
}
|
|
70
|
-
/** One class's generated rungs: classRungs
|
|
71
|
-
* (spreadProviders). */
|
|
40
|
+
/** One class's generated rungs: classRungs in harness-aware order (orderRungs). */
|
|
72
41
|
export function classLadder(models, modelClass) {
|
|
73
|
-
return
|
|
42
|
+
return orderRungs(classRungs(models, modelClass));
|
|
74
43
|
}
|
|
75
44
|
/** The ladders a refresh generates: each tier asks for its class, and its
|
|
76
|
-
* ladder is every model in that class
|
|
77
|
-
*
|
|
45
|
+
* ladder is every model in that class in harness-aware order (orderRungs)
|
|
46
|
+
* after the tier's first PREFERRED_RUNGS preferred rungs. Subscriptions still
|
|
78
47
|
* come before API keys when it is walked (resolveLadder). Falls back to the
|
|
79
48
|
* hand-written ladder for a tier whose class has no model. */
|
|
80
49
|
export function generateLadders(models, classes) {
|
|
@@ -83,6 +52,7 @@ export function generateLadders(models, classes) {
|
|
|
83
52
|
const rungs = classRungs(models, classes[tier]);
|
|
84
53
|
const drivers = TIER_PREFERRED_DRIVERS[tier] ?? [];
|
|
85
54
|
const preferred = [...(tier === "orchestrator" && classes[tier] === CHIBI_DEFAULT_RUNG.modelClass ? [{ ...CHIBI_DEFAULT_RUNG }] : []), ...rungs.filter((entry) => drivers.includes(entry.engine)), ...drivers.map((engine) => ({ engine }))];
|
|
55
|
+
const pinned = Math.min(PREFERRED_RUNGS, preferred.length);
|
|
86
56
|
const ordered = [...preferred, ...rungs].filter((entry) => {
|
|
87
57
|
const key = entryKey(entry);
|
|
88
58
|
if (seen.has(key))
|
|
@@ -90,7 +60,7 @@ export function generateLadders(models, classes) {
|
|
|
90
60
|
seen.add(key);
|
|
91
61
|
return true;
|
|
92
62
|
});
|
|
93
|
-
return [tier, rungs.length ?
|
|
63
|
+
return [tier, rungs.length ? [...ordered.slice(0, pinned), ...orderRungs(ordered.slice(pinned))].slice(0, MAX_LADDER_LENGTH) : DEFAULT_LADDERS[tier].map((entry) => ({ ...entry }))];
|
|
94
64
|
}));
|
|
95
65
|
}
|
|
96
66
|
/** The ladder a bot's turns walk for the class they ask for: the tier's own
|
|
@@ -100,7 +70,7 @@ export function generateLadders(models, classes) {
|
|
|
100
70
|
* still join it when it is walked (resolveLadder). */
|
|
101
71
|
export function ladderForClass(modelClass, tierClass, tierLadder, models) {
|
|
102
72
|
if (modelClass === tierClass)
|
|
103
|
-
return tierLadder
|
|
73
|
+
return expandAnySubscription(tierLadder, models);
|
|
104
74
|
return classLadder(models, modelClass).slice(0, MAX_LADDER_LENGTH);
|
|
105
75
|
}
|
|
106
76
|
export const MAX_LADDER_LENGTH = 24;
|
|
@@ -120,7 +90,7 @@ export function parseLadderEntry(value) {
|
|
|
120
90
|
const modelClass = toModelClass(raw.modelClass) ?? toModelClass(raw.level);
|
|
121
91
|
if (modelClass)
|
|
122
92
|
entry.modelClass = modelClass;
|
|
123
|
-
return raw.anyAccount === true ? { ...entry
|
|
93
|
+
return { ...entry, ...(raw.anyAccount === true ? { anyAccount: true } : {}), ...(raw.anySubscription === true && entry.model ? { anySubscription: true } : {}) };
|
|
124
94
|
}
|
|
125
95
|
const entryKey = (entry) => `${entry.engine}\u0000${(entry.model ?? "").toLowerCase()}`;
|
|
126
96
|
/** A ladder as stored, or undefined when the value is not a list. Invalid
|
|
@@ -286,7 +256,7 @@ export function resolveLadder(ladder, stored, context) {
|
|
|
286
256
|
const storedFirst = (a, b) => Number(b.instanceId === stored.instanceId) - Number(a.instanceId === stored.instanceId);
|
|
287
257
|
for (const [step, entry] of ladder.entries()) {
|
|
288
258
|
const matching = context.candidates.filter((candidate) => !keyBased(candidate) && !freeCandidate(candidate) && matchesEngine(entry, candidate));
|
|
289
|
-
for (const candidate of rungAccounts(entry, matching.sort(storedFirst), context.refuse)) {
|
|
259
|
+
for (const candidate of rungAccounts(entry, matching.sort(storedFirst), (account) => context.refuse?.(account) ?? (engineHealth(account) === "ready" ? undefined : "signed-out"), context.own)) {
|
|
290
260
|
const band = perTokenModel(candidate, entryModel(entry, candidate)) ? "key" : "subscription";
|
|
291
261
|
(band === "key" ? key : subscription).push({ step, entry, candidate, band, index: context.candidates.indexOf(candidate) });
|
|
292
262
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Hermes Agent's terminal copy once its retries and own fallbacks are spent
|
|
2
|
+
// (agent/turn_failure_copy.py), sent as the turn's only reply with a normal
|
|
3
|
+
// end_turn. It leads with the provider's label, so it cannot be held by head;
|
|
4
|
+
// it arrives as one chunk (2026-10-17: "ChatGPT or Codex Subscription
|
|
5
|
+
// rate-limited every one of 3 attempts — its usage limit resets in ~127h.
|
|
6
|
+
// ... add a backup provider with `hermes fallback add`."). Anchored to the
|
|
7
|
+
// whole lead sentence, and to the /retry or /model next step it always gives.
|
|
8
|
+
import { classifyEngineFailure, isCredentialDead, REPLY_FAILURE_MAX_CHARS } from "./engine-failure.js";
|
|
9
|
+
const LABEL = "[^\\n]{1,80}?";
|
|
10
|
+
const EXHAUSTED = new RegExp(`^${LABEL} (?:rate-limited every one of \\d+ attempts|reported it was overloaded on all \\d+ attempts|returned a server error on all \\d+ attempts|didn[’']t respond in time on any of \\d+ attempts|didn[’']t answer after \\d+ attempts|sent back an empty or broken reply \\d+ times)\\b[\\s\\S]*(?:/retry|/model)`, "i");
|
|
11
|
+
const MODEL_MISSING = /^Model '[^'\n]{1,200}' isn[’']t available on [^\n]{1,80}\. Pick a different model with \/model\b/i;
|
|
12
|
+
const REJECTED = new RegExp(`^${LABEL} rejected the request and retrying won[’']t help\\.`, "i");
|
|
13
|
+
const AUTH = new RegExp(`^${LABEL} rejected your (?:sign-in|API key), so the model can[’']t be reached\\.`, "i");
|
|
14
|
+
/** The failure a whole Hermes reply reports, or null for anything else (the caller checks no tools ran). */
|
|
15
|
+
export function hermesReplyFailure(text, now = Date.now()) {
|
|
16
|
+
const reply = text.trim();
|
|
17
|
+
if (!reply || reply.length > REPLY_FAILURE_MAX_CHARS)
|
|
18
|
+
return null;
|
|
19
|
+
if (AUTH.test(reply))
|
|
20
|
+
return { kind: "auth_failed", ...(isCredentialDead(reply) ? { permanent: true } : {}) };
|
|
21
|
+
if (!EXHAUSTED.test(reply) && !MODEL_MISSING.test(reply) && !REJECTED.test(reply))
|
|
22
|
+
return null;
|
|
23
|
+
// "Provider said: HTTP 429: The usage limit has been reached" is a usage
|
|
24
|
+
// limit with its reset; a server error or a missing model is not.
|
|
25
|
+
const failure = classifyEngineFailure(reply, now);
|
|
26
|
+
return failure && failure.kind !== "auth_failed" ? failure : { kind: "provider_error" };
|
|
27
|
+
}
|
|
@@ -91,7 +91,6 @@ import { ledgerCost } from "./model-prices.js";
|
|
|
91
91
|
import { checkProviderKey, openAiTeamHeaders, PROVIDER_KEY_KINDS } from "./provider-key-check.js";
|
|
92
92
|
import { assertWithinBudget, noteSpend, spendAlertText, spendState, takeSpendAlert } from "./spend.js";
|
|
93
93
|
import { fleetAvailable, fleetRequest, fleetSocketPath } from "./fleet-client.js";
|
|
94
|
-
import { entitled } from "./enterprise.js";
|
|
95
94
|
import { HOSTED_CONTRACT_HEADER, HOSTED_CONTRACT_METADATA, HOSTED_CONTRACT_VERSION } from "./hosted-contract.js";
|
|
96
95
|
import { describeSpawnFailure, execCli } from "./procs.js";
|
|
97
96
|
import { blockedTarget, buildNotification, buildSpendNotification, summarize } from "./notify.js";
|
|
@@ -235,7 +234,7 @@ import { autoPinMayYield, autoPinMovedLine, parseSurface, resolveSurface, surfac
|
|
|
235
234
|
import { PendingTurnCancellations, ProviderTurnGenerationRegistry, RetiredTurnRegistry, guardTurnDispatch, isTurnAdmissionBlocked, isTurnEventQuarantined, } from "./turn-dispatch-guard.js";
|
|
236
235
|
import { createGracefulShutdown } from "./graceful-shutdown.js";
|
|
237
236
|
import { acquireDataDirLeaseForProcess } from "./data-dir-lease.js";
|
|
238
|
-
import { createWorkspaceAccess, describeEdition, editionStatus, hostedWorkspaceConfiguration, hostedWorkspaceConfigured, editionForMembers, LICENSE_WARN_DAYS, licenseWarning, sharedWorkspaceFullAccessConfigured, loadEnterpriseLayer, workspaceMembership } from "./enterprise.js";
|
|
237
|
+
import { createWorkspaceAccess, describeEdition, entitled, editionStatus, hostedWorkspaceConfiguration, hostedWorkspaceConfigured, editionForMembers, LICENSE_WARN_DAYS, licenseWarning, sharedWorkspaceFullAccessConfigured, loadEnterpriseLayer, workspaceMembership } from "./enterprise.js";
|
|
239
238
|
import { environmentDescriptor, loadEnvironmentId, serverVersion } from "./environment.js";
|
|
240
239
|
import { WorkspaceBackupMaintenance } from "./workspace-backup-maintenance.js";
|
|
241
240
|
import { createWorkspaceBackupRoutes, isWorkspaceBackupSessionControl } from "./workspace-backup-http.js";
|
|
@@ -322,7 +321,7 @@ import { createNexusMemoryRoutes } from "./routes/nexus-memory.js";
|
|
|
322
321
|
import { createBoardRoutes } from "./routes/board.js";
|
|
323
322
|
import { readBoardFromNexus } from "./board/nexus-board.js";
|
|
324
323
|
import { LocalModelInventory, localModePlacement, machineMemory } from "./local-models-mode.js";
|
|
325
|
-
import { eventBase, restTime, FailoverGate, MAX_ENGINES_PER_TURN, continuationNote, restingLine, restingOnRoute, sameRoute } from "./engine-failover.js";
|
|
324
|
+
import { eventBase, restTime, FailoverGate, MAX_ENGINES_PER_TURN, triesSpent, continuationNote, restingLine, restingOnRoute, sameRoute } from "./engine-failover.js";
|
|
326
325
|
import { connectionRunOutPolicy, finalizeConnectionCapPick, finalizeNewTurnPlacement, pauseKeyBandForRunOut } from "./connection-cap-failover.js";
|
|
327
326
|
import { TURN_ERROR_CATEGORIES } from "../shared/runtime-events.js";
|
|
328
327
|
import { EngineProbes, PROBE_PROMPT, isProbeThread, probeThreadId } from "./engine-probe.js";
|
|
@@ -332,6 +331,7 @@ import { createJevClient } from "./jev/client.js";
|
|
|
332
331
|
import { jevRoute } from "./jev/key.js";
|
|
333
332
|
import { createJevRoutes } from "./routes/jev.js";
|
|
334
333
|
import { createDictationRoutes } from "./routes/dictation.js";
|
|
334
|
+
import { closeTerminals, terminalFeatures, terminalRoutes } from "./terminal-places.js";
|
|
335
335
|
import { createWatchAlongRoutes } from "./routes/watch-along.js";
|
|
336
336
|
import { watchAlongAccess } from "./watch-along/access.js";
|
|
337
337
|
import { killSwitchInputs, managedLayer, RemoteFlags, switchLayer } from "./watch-along/kill-switches.js";
|
|
@@ -2452,7 +2452,7 @@ const paw = new PawService({
|
|
|
2452
2452
|
const response = await fetch(url, { signal: AbortSignal.timeout(15_000) });
|
|
2453
2453
|
return response.ok ? await response.text() : null;
|
|
2454
2454
|
},
|
|
2455
|
-
localSource: () => cfg.paw?.localSource,
|
|
2455
|
+
localSource: () => cfg.paw?.localSource, nexus: () => nexusMemory.getClient(),
|
|
2456
2456
|
});
|
|
2457
2457
|
try {
|
|
2458
2458
|
if (await paw.ensure({ chibitek: cfg.onboarding?.setup?.chibitek === true }))
|
|
@@ -3095,7 +3095,7 @@ function ladderTurnEngineChoice(profile, projected, threadId, needs, runOn, subs
|
|
|
3095
3095
|
const plan = enginePlan(profile, threadId, tier);
|
|
3096
3096
|
const { ladder } = plan;
|
|
3097
3097
|
const computer = turnComputer(projected, threadId, runOn);
|
|
3098
|
-
const context = { candidates, needsDelegation: needsDelegation(tier, profile), computer, refuse: engineTierRefusal(projected), resting: engineResting,
|
|
3098
|
+
const context = { candidates, needsDelegation: needsDelegation(tier, profile), computer, refuse: engineTierRefusal(projected), resting: engineResting, own: profile.modelSelection.instanceId,
|
|
3099
3099
|
keyBandPaused: subscriptionsOnly || keyBandPausedFor(threadId), includeFree: engineTiersIncludeFree(cfg.engineTiers), clientData: handlesClientData(profile) };
|
|
3100
3100
|
const local = (resolution) => localModeTurn(resolution, { tier, context, needs, prefer: [projected.modelSelection.instanceId] });
|
|
3101
3101
|
const wider = (tried, modelClass) => resolveFailover({
|
|
@@ -3380,7 +3380,7 @@ const probeEnvMs = (name) => {
|
|
|
3380
3380
|
const value = Number(process.env[name]);
|
|
3381
3381
|
return Number.isFinite(value) && value > 0 ? value : undefined;
|
|
3382
3382
|
};
|
|
3383
|
-
const engineRests = new EngineRestStore(DATA_DIR, undefined, { probeBaseMs: probeEnvMs("OMB_ENGINE_PROBE_BASE_MS") });
|
|
3383
|
+
const engineRests = new EngineRestStore(DATA_DIR, undefined, { probeBaseMs: probeEnvMs("OMB_ENGINE_PROBE_BASE_MS") }), needsPerson = (instanceId) => engineRests.active().some((entry) => entry.instanceId === instanceId && entry.needsSignIn === true); // needsPerson: a failed sign-in or expired key, which does not use up a turn's try (triesSpent)
|
|
3384
3384
|
// Atomic Engine runs on the person's Atomic accounts (server/atomic-engine-accounts.ts).
|
|
3385
3385
|
// An account resting here (its limit was hit through another engine) shares its
|
|
3386
3386
|
// quota with the engine, so the engine is told when it is back. A stall is that
|
|
@@ -3726,11 +3726,11 @@ function engineFailover(turn, completion) {
|
|
|
3726
3726
|
});
|
|
3727
3727
|
}
|
|
3728
3728
|
retireFailedAttempt(turn.botId, turn.threadId, turn.generation, failedOwner, completion);
|
|
3729
|
-
const
|
|
3730
|
-
if (!reportFreeFallback(profile, turn.threadId, choice.selection,
|
|
3729
|
+
const what = `${engineLabel(candidates, moved)} ${failure.kind === "auth_failed" ? "needs signing in again in Settings > Engines" : `failed (${failure.kind})`}`;
|
|
3730
|
+
if (!reportFreeFallback(profile, turn.threadId, choice.selection, what))
|
|
3731
3731
|
reportIncident({
|
|
3732
|
-
kind: "engine-fallback", bot: profile, threadId: turn.threadId, notifyChief: true,
|
|
3733
|
-
detail: `${
|
|
3732
|
+
kind: "engine-fallback", bot: profile, threadId: turn.threadId, notifyChief: true, dedupeKey: `${moved.instanceId}:${failure.kind}`,
|
|
3733
|
+
detail: `${what}; the turn continued on ${engineLabel(candidates, choice.selection)}`,
|
|
3734
3734
|
});
|
|
3735
3735
|
console.error(`[omb-failover] thread=${turn.threadId} ${failure.kind}: ${moved.instanceId} -> ${choice.selection.instanceId} (attempt ${attempt})`);
|
|
3736
3736
|
// No turnId: the failed provider turn is retired, and its id would hide
|
|
@@ -3804,7 +3804,7 @@ function roomEngineFailover(turn, completion, room, profile, candidates, failedC
|
|
|
3804
3804
|
console.error(`[omb-failover] room thread=${turn.threadId} ${failure.kind}: ${room.selection.instanceId} -> ${choice.selection.instanceId} (attempt ${attempt})`);
|
|
3805
3805
|
if (!reportFreeFallback(profile, turn.threadId, choice.selection, `${failedLabel} failed (${failure.kind})`) && !failure.permanent) {
|
|
3806
3806
|
reportIncident({
|
|
3807
|
-
kind: "engine-fallback", bot: profile, threadId: turn.threadId,
|
|
3807
|
+
kind: "engine-fallback", bot: profile, threadId: turn.threadId, dedupeKey: `${room.selection.instanceId}:${failure.kind}`,
|
|
3808
3808
|
detail: `${failedLabel} failed (${failure.kind}); the room turn continued on ${replacementLabel}`,
|
|
3809
3809
|
});
|
|
3810
3810
|
}
|
|
@@ -3834,7 +3834,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3834
3834
|
// provider on its side of the personal line; with none left it stops with
|
|
3835
3835
|
// its one line.
|
|
3836
3836
|
const subscriptionMove = isSubscriptionBot(profile)
|
|
3837
|
-
? tried
|
|
3837
|
+
? triesSpent(tried, needsPerson) || !projected
|
|
3838
3838
|
? { line: subscriptionLine(profile, candidates) }
|
|
3839
3839
|
: subscriptionPlacement({ profile, projected, candidates, tried: new Set([...tried, turn.instanceId]), auto: attempt.persist, modelClass: neededClass })
|
|
3840
3840
|
: undefined;
|
|
@@ -3846,7 +3846,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3846
3846
|
const personalMove = subscriptionMove?.choice
|
|
3847
3847
|
? { choice: { selection: subscriptionMove.choice.selection, candidate: subscriptionMove.choice.candidate, step: 0, band: "subscription" }, line: "" }
|
|
3848
3848
|
: personalTurn
|
|
3849
|
-
? tried
|
|
3849
|
+
? triesSpent(tried, needsPerson) || !projected
|
|
3850
3850
|
? { line: personalLine(candidates, false) }
|
|
3851
3851
|
: personalPlacement({ profile, projected, candidates, tried, needs: { tools: true, vision: attempt.vision }, modelClass: neededClass, computer })
|
|
3852
3852
|
: undefined;
|
|
@@ -3855,11 +3855,11 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3855
3855
|
// Every bot, pinned or not and of any tier, falls to the next subscription
|
|
3856
3856
|
// the person has, in any class, before a pay-per-use key (resolveFailover).
|
|
3857
3857
|
const resting = (candidate, model) => engineResting(candidate, model) || (model === attempt.selection.model && !!failedCandidate && sameRoute(candidate, failedCandidate));
|
|
3858
|
-
const resolution = personalMove || tried
|
|
3858
|
+
const resolution = personalMove || triesSpent(tried, needsPerson) || !projected ? { skipped: [] } : resolveFailover({
|
|
3859
3859
|
ladder: plan.ladder,
|
|
3860
3860
|
classLadder: (modelClass) => classLadder(classedModels(), modelClass),
|
|
3861
3861
|
failed: attempt.selection,
|
|
3862
|
-
context: { candidates, needsDelegation: needsDelegation(tier, profile), computer, refuse: engineTierRefusal(projected), resting,
|
|
3862
|
+
context: { candidates, needsDelegation: needsDelegation(tier, profile), computer, refuse: engineTierRefusal(projected), resting, own: profile.modelSelection.instanceId,
|
|
3863
3863
|
keyBandPaused: keyBandPausedFor(turn.threadId), includeFree: engineTiersIncludeFree(cfg.engineTiers), clientData: handlesClientData(profile) },
|
|
3864
3864
|
tried,
|
|
3865
3865
|
modelClass: neededClass,
|
|
@@ -3879,7 +3879,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3879
3879
|
return finalizeConnectionCapPick({
|
|
3880
3880
|
choice, subscriptionLine: subscriptionMove?.line, failureKind: turn.failure?.kind,
|
|
3881
3881
|
pausedUntil: payPerUse.pausedUntil(), skipped: resolution.skipped, payPerUsePausedLine, restingNamed,
|
|
3882
|
-
failedInstanceId: turn.instanceId, alreadyTried: attempt.tried, triedCount: tried.
|
|
3882
|
+
failedInstanceId: turn.instanceId, alreadyTried: attempt.tried, triedCount: [...tried].filter((instanceId) => !needsPerson(instanceId)).length,
|
|
3883
3883
|
cannotDrive: cannotDriveNamed(candidates, resolution.skipped, computer),
|
|
3884
3884
|
policy: connectionRunOutPolicy(cfg.engineTiers), paidApproved: Boolean(payPerUse.current()?.keptGoingAt),
|
|
3885
3885
|
local: Boolean(placed.local), currentLabel: engineLabel(candidates, attempt.selection),
|
|
@@ -4059,7 +4059,7 @@ function engineTierRefusal(bot, options = {}) {
|
|
|
4059
4059
|
// A subscription bot never leaves its provider (server/subscription-bots.ts).
|
|
4060
4060
|
if (!providerAllows(bot, candidate, subscriptionFacts))
|
|
4061
4061
|
return "provider";
|
|
4062
|
-
if (candidate.instanceId !== bot.modelSelection.instanceId && modelSwitchNeedsAsk(mode, from, candidate.driverKind))
|
|
4062
|
+
if (candidate.instanceId !== bot.modelSelection.instanceId && modelSwitchNeedsAsk(mode, from, candidate.driverKind, godModeCovers(bot)))
|
|
4063
4063
|
return "approval";
|
|
4064
4064
|
return undefined;
|
|
4065
4065
|
};
|
|
@@ -8573,6 +8573,7 @@ function wakeDelegationSource(source, threadId, targetName, failureReason, routi
|
|
|
8573
8573
|
// with a link to the broken thread and retry_thread to act on it. The person
|
|
8574
8574
|
// reads one place. Policy in server/incidents.ts.
|
|
8575
8575
|
const incidentLedger = new IncidentLedger();
|
|
8576
|
+
const engineFallbackLedger = new IncidentLedger({ hardLimit: 1 }); // by Chief, engine and cause: one bad provider is one report an hour
|
|
8576
8577
|
/** What the broken thread was about: the last line the person (or the
|
|
8577
8578
|
* requester) sent there, and the last thing the bot said. */
|
|
8578
8579
|
function incidentContext(threadId) {
|
|
@@ -8616,13 +8617,13 @@ function reportIncident(input) {
|
|
|
8616
8617
|
detail: redactSecretsInText(input.detail),
|
|
8617
8618
|
...incidentContext(threadId),
|
|
8618
8619
|
};
|
|
8620
|
+
// The Private Bot's failures go to the person only: never into Chibi's Team incidents thread, where its request and reply would be quoted.
|
|
8621
|
+
const chief = isPersonalBot(bot) ? undefined : chiefForBot(store.bots, bot);
|
|
8622
|
+
if (chief && input.dedupeKey && engineFallbackLedger.note(`${chief.id}:${input.dedupeKey}`).muted)
|
|
8623
|
+
return;
|
|
8619
8624
|
const count = incidentLedger.note(threadId);
|
|
8620
|
-
// a crash loop is one incident, not a storm
|
|
8621
8625
|
if (count.muted)
|
|
8622
|
-
return;
|
|
8623
|
-
// The Private Bot's failures go to the person only: never into Chibi's
|
|
8624
|
-
// Team incidents thread, where its request and reply would be quoted.
|
|
8625
|
-
const chief = isPersonalBot(bot) ? undefined : chiefForBot(store.bots, bot);
|
|
8626
|
+
return; // a crash loop is one incident, not a storm
|
|
8626
8627
|
// A run that could not start and a failed routine have already buzzed
|
|
8627
8628
|
// the person (turn-failed, routine-failed) by the time they get here; a
|
|
8628
8629
|
// failure or stall mid-run has not. One notification per failure, never two.
|
|
@@ -14486,7 +14487,7 @@ function configStatus() {
|
|
|
14486
14487
|
features: {
|
|
14487
14488
|
skillAuthoring: skillAuthoringEnabled(cfg),
|
|
14488
14489
|
showToolCalls: showToolCallsEnabled(cfg),
|
|
14489
|
-
browser: builtInBrowserEnabled(cfg),
|
|
14490
|
+
browser: builtInBrowserEnabled(cfg), ...terminalFeatures(cfg),
|
|
14490
14491
|
// Maintainer-only escape hatch, not a Settings toggle: the desktop
|
|
14491
14492
|
// shell and the Settings UI read it so they offer nothing this server
|
|
14492
14493
|
// would refuse.
|
|
@@ -15273,6 +15274,7 @@ ROUTES.push(createJevRoutes({
|
|
|
15273
15274
|
hipaa: () => workspaceHipaa().enabled,
|
|
15274
15275
|
fromBot: (req) => authorizedInternalCapability(req.headers.authorization) !== null,
|
|
15275
15276
|
}));
|
|
15277
|
+
ROUTES.push(terminalRoutes({ cfg: () => cfg, dataDir: DATA_DIR, hasBot: (id) => Boolean(store.bot(id)), localVmContainer: (id) => localVmTargetForBot(id).containerName }));
|
|
15276
15278
|
// [dictation] Atomic Dictation's auto-correct and the Administrator's HIPAA
|
|
15277
15279
|
// switch (docs/chibitek/dictation.md, server/routes/dictation.ts).
|
|
15278
15280
|
let dictationIntelligence = null;
|
|
@@ -25414,6 +25416,7 @@ const gracefulShutdown = createGracefulShutdown({
|
|
|
25414
25416
|
sharedComputers.close();
|
|
25415
25417
|
sharedComputerControl.close();
|
|
25416
25418
|
browserLive.closeAll();
|
|
25419
|
+
closeTerminals();
|
|
25417
25420
|
for (const idle of localVmIdles.values())
|
|
25418
25421
|
idle.cancel();
|
|
25419
25422
|
vps.closeAllVpsDesktopTunnels();
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// The order of a generated ladder and the "Any subscription" rung
|
|
2
|
+
// (docs/chibitek/engine-tiers.md, "Harness-aware order"). Pure: the server
|
|
3
|
+
// hands it the graded catalog, the tests plain rungs.
|
|
4
|
+
import { modelHost } from "../shared/engine-choices.js";
|
|
5
|
+
import { harnessWeight } from "../shared/harness-weights.js";
|
|
6
|
+
import { subscriptionProviderForDriver } from "../shared/subscription-bots.js";
|
|
7
|
+
/** Weights from the published rankings document, when it carries any. */
|
|
8
|
+
let published;
|
|
9
|
+
export function setPublishedHarnessWeights(weights) {
|
|
10
|
+
published = weights;
|
|
11
|
+
}
|
|
12
|
+
export const rungWeight = (entry) => harnessWeight(entry.engine, published);
|
|
13
|
+
/** The plan a rung is paid from: the subscription provider whose harness the
|
|
14
|
+
* engine is, else the host its model comes from on a harness that reaches
|
|
15
|
+
* several (Nous Portal on Hermes, OpenCode Go), else the engine itself. */
|
|
16
|
+
export const rungProvider = (entry) => subscriptionProviderForDriver(entry.engine)?.id ?? (entry.model ? modelHost(entry.engine, { id: entry.model }) : undefined) ?? entry.engine;
|
|
17
|
+
/** A generated ladder's order. No provider has a reserved place (Erick,
|
|
18
|
+
* 2026-11-13). Rungs are sorted by harness weight, the model's rank in the
|
|
19
|
+
* class deciding between equal harnesses; then every provider takes one
|
|
20
|
+
* rung per round, so each plan a person has gets used before any provider's
|
|
21
|
+
* second model. */
|
|
22
|
+
export function orderRungs(rungs) {
|
|
23
|
+
const ranked = rungs.map((entry, rank) => ({ entry, rank })).sort((a, b) => rungWeight(b.entry) - rungWeight(a.entry) || a.rank - b.rank);
|
|
24
|
+
const providers = new Map();
|
|
25
|
+
for (const { entry } of ranked) {
|
|
26
|
+
const provider = rungProvider(entry);
|
|
27
|
+
providers.set(provider, [...providers.get(provider) ?? [], entry]);
|
|
28
|
+
}
|
|
29
|
+
const out = [];
|
|
30
|
+
const longest = Math.max(0, ...[...providers.values()].map((group) => group.length));
|
|
31
|
+
for (let round = 0; round < longest; round++) {
|
|
32
|
+
for (const group of providers.values())
|
|
33
|
+
if (group[round])
|
|
34
|
+
out.push(group[round]);
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
const sameRung = (a, b) => a.engine === b.engine && (a.model ?? "") === (b.model ?? "");
|
|
39
|
+
/** Every engine that runs the model a rung names, the rung's own first,
|
|
40
|
+
* the others by harness weight; undefined when the catalog does not know
|
|
41
|
+
* the model on that engine. */
|
|
42
|
+
export function modelRuns(entry, models) {
|
|
43
|
+
if (!entry.model)
|
|
44
|
+
return undefined;
|
|
45
|
+
const model = models.find((item) => item.runs.some((run) => run.driverKind === entry.engine && run.model === entry.model));
|
|
46
|
+
if (!model)
|
|
47
|
+
return undefined;
|
|
48
|
+
const others = model.runs.filter((run) => !(run.driverKind === entry.engine && run.model === entry.model))
|
|
49
|
+
.map((run) => ({ engine: run.driverKind, model: run.model, modelClass: entry.modelClass ?? model.modelClass, anyAccount: true }));
|
|
50
|
+
return [{ engine: entry.engine, model: entry.model, modelClass: entry.modelClass ?? model.modelClass, anyAccount: true },
|
|
51
|
+
...others.map((rung, rank) => ({ rung, rank })).sort((a, b) => rungWeight(b.rung) - rungWeight(a.rung) || a.rank - b.rank).map(({ rung }) => rung)];
|
|
52
|
+
}
|
|
53
|
+
/** The ladder a turn walks: each "<Model> · Any subscription" rung becomes
|
|
54
|
+
* one rung per engine that runs that model, every account of each, in its
|
|
55
|
+
* place on the ladder. A route the ladder already names keeps its own
|
|
56
|
+
* place and settings. Keys still join only the last band (resolveLadder). */
|
|
57
|
+
export function expandAnySubscription(ladder, models) {
|
|
58
|
+
if (!ladder.some((entry) => entry.anySubscription))
|
|
59
|
+
return ladder.map((entry) => ({ ...entry }));
|
|
60
|
+
const out = [];
|
|
61
|
+
for (const entry of ladder) {
|
|
62
|
+
const runs = entry.anySubscription ? modelRuns(entry, models) : undefined;
|
|
63
|
+
if (!runs) {
|
|
64
|
+
out.push({ ...entry });
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
for (const [index, rung] of runs.entries()) {
|
|
68
|
+
if (index && [...ladder, ...out].some((other) => sameRung(other, rung)))
|
|
69
|
+
continue;
|
|
70
|
+
out.push(rung);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
@@ -6,14 +6,18 @@
|
|
|
6
6
|
//
|
|
7
7
|
// Document shape (anything else is rejected whole, never half-applied):
|
|
8
8
|
// { "week": "2026-10-30",
|
|
9
|
-
// "models": [{ "id": "claude-opus-5.5", "class": "Mezcal", "rank": 1 }]
|
|
9
|
+
// "models": [{ "id": "claude-opus-5.5", "class": "Mezcal", "rank": 1 }],
|
|
10
|
+
// "harnesses": { "grokAgent": 1, "ollamaCloud": 0.5 } }
|
|
10
11
|
// `id` is a catalog id or a name the alias table knows (normalized the same
|
|
11
12
|
// way as leaderboard names); `class` is exactly Mezcal, Plata, Reposado or
|
|
12
13
|
// Añejo; `rank` orders the class, 1 first. Models the document does not
|
|
13
|
-
// name keep their ordinary sources.
|
|
14
|
+
// name keep their ordinary sources. `harnesses` is optional: driver kind to
|
|
15
|
+
// a weight from 0 to 1 that orders rungs inside a class
|
|
16
|
+
// (shared/harness-weights.ts); harnesses it leaves out keep their default.
|
|
14
17
|
import { existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
15
18
|
import { dirname } from "node:path";
|
|
16
19
|
import { MODEL_CLASSES } from "../../shared/engine-tiers.js";
|
|
20
|
+
import { parseHarnessWeights } from "../../shared/harness-weights.js";
|
|
17
21
|
import { writeFileAtomic } from "../atomic.js";
|
|
18
22
|
import { normalizeName } from "./aliases.js";
|
|
19
23
|
export const CHIBITEK_RANKINGS_CACHE = "model-rankings-chibitek.json";
|
|
@@ -63,7 +67,8 @@ export function parseRankings(raw, catalog, fetchedAt) {
|
|
|
63
67
|
}
|
|
64
68
|
if (!rows.length)
|
|
65
69
|
return null;
|
|
66
|
-
|
|
70
|
+
const harnesses = parseHarnessWeights(doc.harnesses);
|
|
71
|
+
return { rankings: { week: doc.week, rows, fetchedAt, ...(harnesses ? { harnesses } : {}) }, unknown };
|
|
67
72
|
}
|
|
68
73
|
/** Last good document from disk; null when there is none or it is unreadable. */
|
|
69
74
|
export function readRankingsCache(path, catalog) {
|
|
@@ -17,6 +17,7 @@ import { MODEL_CATALOG, catalogIdFor, localTag, matchSnapshots, onDeviceModel, w
|
|
|
17
17
|
import { AA_ATTRIBUTION, AA_MODELS_URL, artificialAnalysisKey, fetchArtificialAnalysis } from "./artificial-analysis.js";
|
|
18
18
|
import { BASELINE } from "./baseline.js";
|
|
19
19
|
import { AA_CACHE_FILE, CACHE_FILE, readAaCache, readCache, validSnapshots, writeAaCache, writeCache } from "./cache.js";
|
|
20
|
+
import { setPublishedHarnessWeights } from "../ladder-order.js";
|
|
20
21
|
import { CHIBITEK_RANKINGS_CACHE, fetchRankings, parseRankings, readRankingsCache, writeRankingsCache } from "./chibitek-rankings.js";
|
|
21
22
|
import { byClass, classifyModels, matchAaRows } from "./classes.js";
|
|
22
23
|
import { fetchSource } from "./fetch.js";
|
|
@@ -61,6 +62,7 @@ export function createModelLevels(options) {
|
|
|
61
62
|
let aaOrigin = aaFetched ? "cache" : aaBaseline ? "baseline" : null;
|
|
62
63
|
const rankingsCachePath = join(options.dataDir, CHIBITEK_RANKINGS_CACHE);
|
|
63
64
|
let rankings = readRankingsCache(rankingsCachePath, baseCatalog);
|
|
65
|
+
setPublishedHarnessWeights(rankings?.harnesses);
|
|
64
66
|
let lastRefresh = null;
|
|
65
67
|
let inFlight = null;
|
|
66
68
|
let firstTimer = null;
|
|
@@ -189,6 +191,7 @@ export function createModelLevels(options) {
|
|
|
189
191
|
if (!parsed)
|
|
190
192
|
throw new Error("chibitek-rankings: no usable rows");
|
|
191
193
|
rankings = parsed.rankings;
|
|
194
|
+
setPublishedHarnessWeights(rankings.harnesses);
|
|
192
195
|
writeRankingsCache(rankingsCachePath, document, now());
|
|
193
196
|
updated.push("chibitek-rankings");
|
|
194
197
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { NexusInitializeError, NexusUnavailableError } from "./client.js";
|
|
2
|
+
// One shared wait after Nexus fails: 1, 5, 15, then 30 minutes while the
|
|
3
|
+
// outage lasts (unreachable, or signed out, which makes the bridge open a
|
|
4
|
+
// sign-in page). A failure more than an hour after the previous one is a
|
|
5
|
+
// new blip and starts over at one minute, so a night of Wi-Fi drops does
|
|
6
|
+
// not leave every later call blocked for half an hour.
|
|
7
|
+
const WAITS_MS = [60_000, 300_000, 900_000, 1_800_000];
|
|
8
|
+
const SAME_OUTAGE_MS = 2 * WAITS_MS[WAITS_MS.length - 1];
|
|
9
|
+
export class UnavailableBackoff {
|
|
10
|
+
until = 0;
|
|
11
|
+
failures = 0;
|
|
12
|
+
lastAt = 0;
|
|
13
|
+
/** How much longer to wait; 0 when calls may go through. */
|
|
14
|
+
remainingMs(now) {
|
|
15
|
+
return Math.max(0, this.until - now);
|
|
16
|
+
}
|
|
17
|
+
failed(now) {
|
|
18
|
+
if (now - this.lastAt > SAME_OUTAGE_MS)
|
|
19
|
+
this.failures = 0;
|
|
20
|
+
this.lastAt = now;
|
|
21
|
+
this.failures += 1;
|
|
22
|
+
this.until = now + WAITS_MS[Math.min(this.failures - 1, WAITS_MS.length - 1)];
|
|
23
|
+
}
|
|
24
|
+
succeeded() {
|
|
25
|
+
this.failures = 0;
|
|
26
|
+
this.until = 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** One failed initialize is retried and does not count. The retry failing
|
|
30
|
+
* trips the breaker. Any other outage trips immediately. */
|
|
31
|
+
export function guardNexusClient(client, backoff, now, log) {
|
|
32
|
+
const finish = async (tool, args, timeoutMs) => {
|
|
33
|
+
try {
|
|
34
|
+
const result = await client.call(tool, args, timeoutMs);
|
|
35
|
+
backoff.succeeded();
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (!(error instanceof NexusInitializeError) && error instanceof NexusUnavailableError)
|
|
40
|
+
backoff.failed(now());
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
call: async (tool, args, timeoutMs) => {
|
|
46
|
+
const remaining = backoff.remainingMs(now());
|
|
47
|
+
if (remaining > 0)
|
|
48
|
+
throw new NexusUnavailableError(`waiting before trying Nexus again (next try in ${Math.ceil(remaining / 60_000)} min)`);
|
|
49
|
+
try {
|
|
50
|
+
return await finish(tool, args, timeoutMs);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (!(error instanceof NexusInitializeError))
|
|
54
|
+
throw error;
|
|
55
|
+
log("Nexus initialize failed; retrying once");
|
|
56
|
+
try {
|
|
57
|
+
return await finish(tool, args, timeoutMs);
|
|
58
|
+
}
|
|
59
|
+
catch (again) {
|
|
60
|
+
if (again instanceof NexusInitializeError)
|
|
61
|
+
backoff.failed(now());
|
|
62
|
+
throw again;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
close: () => client.close(),
|
|
67
|
+
};
|
|
68
|
+
}
|