@chibitek/chibi 0.1.188 → 0.1.191
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-D8Eovq0F.js +10 -0
- package/dist/assets/TerminalPanel-DFuMZ0ql.css +1 -0
- package/dist/assets/{abnfDiagram-O67JEVCF-CKDXgnYw.js → abnfDiagram-O67JEVCF-CPvuUneJ.js} +1 -1
- package/dist/assets/{arc--VPK-xet.js → arc-aMP_0t5b.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-DSVjpq7n.js → architectureDiagram-NJMV4G6O-yyXrFi66.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-BiQ1JgSl.js → blockDiagram-BEXU5L5S-BQN3ZvRc.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-kWWEc-NZ.js → c4Diagram-YGBWAQC7-BieilTo4.js} +1 -1
- package/dist/assets/channel-Bw54wjTR.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-QJYqMtWJ.js → chunk-2Q5K7J3B-Df4lxXIM.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-C7oGYTZS.js → chunk-3FUC2YCW-su_KXf5y.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-MahQWTzh.js → chunk-5VM5RSS4-DL3rM5tY.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-CQfOvr7l.js → chunk-GTNCS2PH-53Ovfw1t.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-b0lt02Pi.js → chunk-GWA4HPMP-BkeiDfwS.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-J1_ylbx8.js → chunk-JWPE2WC7-CvsdGjCO.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-AWcL9tld.js → chunk-NETBCI7D-BngSjMee.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-DpTrAXJV.js → chunk-WEXAMYUT-DitKn6fq.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-2_DCjtc9.js → chunk-XXDRQBXY-Czjvl52d.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-BBQMtHHs.js → classDiagram-v2-NBCMYWYE-COr4Qzpk.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-CmxRmDe8.js → cose-bilkent-JH36ORCC-Eg0tlzqp.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-DjlothXK.js → cynefin-OW5HDTMX-BjtG84WL.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-D6HfzP26.js → cynefinDiagram-VND7K2PF-BzZtwDD4.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-BtzaxY50.js → dagre-6A5THRUB-TrLQ507j.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-DsyCiGJD.js → diagram-22UHCM2B-BDQDC-33.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-CjjvxIr3.js → diagram-3UASUU5V-Cm_mzSfE.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-DDu2iVRb.js → diagram-ATOU4E4O-CAI_i4oy.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-BBTViw3h.js → diagram-CDSNMT55-9GjNyQXn.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-D83j4C6w.js → diagram-MLGK6HIB-ETDg4UN-.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-DTpmpL8Q.js → diagram-MPIPVDR6-8_8dZKgW.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-D3B4hz_Y.js → ebnfDiagram-ZINNZB2B-BiYh2ZYM.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-CbNicGf_.js → elk-276RUBZZ-5u6sMYIg.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-DeSwxwFC.js → erDiagram-OPXOYQCR-Dm6semJ3.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-3n_Hk-ZR.js → flowDiagram-KWPJA3E3-DbQ12CeV.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-BsadEPTf.js → ganttDiagram-FUAMR5RP-C12s51S6.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-DOvqN3Jh.js → gitGraphDiagram-X574FWY7-BhkwBL2T.js} +1 -1
- package/dist/assets/{index-BmYLMFD8.js → index-D4BfC2Zf.js} +1 -1
- package/dist/assets/index-DBOyvapT.css +1 -0
- package/dist/assets/{index-B9LCl5y3.js → index-WT8Xwc4G.js} +175 -174
- package/dist/assets/{infoDiagram-VRGFBTTK-CI3tfMt9.js → infoDiagram-VRGFBTTK-IvWqyiSM.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-BE7AjZYf.js → ishikawaDiagram-OU5B5YK6-N2ZxLyoE.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-DplNZPox.js → journeyDiagram-ZHPQQLJL-UWy3ala_.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-Cos64we-.js → kanban-definition-PNTS6WVX-Cutk-kDA.js} +1 -1
- package/dist/assets/{linear-DDfQb-jo.js → linear-dPnV_-aA.js} +1 -1
- package/dist/assets/{mermaid.core-BekbnuLb.js → mermaid.core-QdldWb2L.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-DJ0MbzMW.js → mindmap-definition-NLK3R4M7-pkXW8CYn.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-DZNZCZ4O.js → pegDiagram-GJSIUBJH-DhKkEQzV.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-COD5v2yC.js → pieDiagram-5QR66LMP-DMehGrxw.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-D4dlLWfv.js → quadrantDiagram-O4NWA36T-oNzYf4fg.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-CEpVYFKl.js → railroadDiagram-XR7U4H2S-pkMOwYja.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-DYD5GX0G.js → requirementDiagram-PLB6GJNP-J29GrlJj.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-C9bPeTfK.js → sankeyDiagram-IPEJSGJF-YuyCeGY6.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-eXpmPg9C.js → sequenceDiagram-PO4LG4MO-BjxLu0JW.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-DfqKWBhp.js → sizeCapture-INFHLROL-BESOD3ec.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-DkIf90iA.js → stateDiagram-v2-GCMORJYK-DF2yvbZA.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-Ds64cQxN.js → swimlanes-2SLR337P-Bzp4ze7n.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-B6y4ZZ5q.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-Ci3-31qT.js → timeline-definition-EJHVYXUP-CnLbXs4R.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-DQUGgfBf.js → usecaseDiagram-POWQR4AR-nuJhbhCv.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-DV5_nmWl.js → vennDiagram-UO4OBE2U-D_hzVg9h.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-DatPTthc.js → wardleyDiagram-VNRHLVJA-hgmpI4iu.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-ADaxt1QH.js → xychartDiagram-PMCCYNJV-DwnJWdDn.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-server/container-mcp.js +3 -0
- package/dist-server/drivers/agents-proxy.js +14 -4
- package/dist-server/index.js +4802 -3806
- package/dist-server/openmausbot.js +1383 -846
- package/dist-server/pair-cli.js +1383 -846
- package/dist-server/server/browser-runtime.js +41 -5
- package/dist-server/server/chibi-defaults.js +96 -0
- package/dist-server/server/cli-login.js +4 -0
- package/dist-server/server/config.js +1 -1
- package/dist-server/server/connection-cap-failover.js +0 -2
- package/dist-server/server/drivers/agents-vault.js +4 -3
- 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 +14 -44
- package/dist-server/server/hermes-reply-failure.js +27 -0
- package/dist-server/server/hidden-ai-text.js +56 -0
- package/dist-server/server/index.js +47 -50
- 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 +27 -0
- package/dist-server/server/nexus-memory/index.js +12 -16
- 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/system-prompt.js +17 -2
- package/dist-server/server/terminal-places.js +63 -0
- package/dist-server/server/terminal.js +124 -0
- package/dist-server/server/vault/fill.js +338 -0
- package/dist-server/server/vault/request.js +6 -2
- package/dist-server/server/vault/routes.js +14 -2
- package/dist-server/server/vault/runtime.js +14 -0
- package/dist-server/server/vault/store.js +40 -3
- 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 +29 -1
- package/dist-server/shared/harness-weights.js +33 -0
- package/dist-server/shared/provider-accounts.js +5 -3
- package/dist-server/shared/subscription-bots.js +14 -6
- package/dist-server/shared/vault-api-providers.js +48 -0
- package/dist-server/shared/vault-csv.js +62 -14
- package/dist-server/shared/vault.js +14 -3
- package/dist-server/vps-container-mcp.js +3 -0
- 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-CQdxuHwI.js +0 -1
- package/dist/assets/index-CI0vGAif.css +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-bO3Klz6Z.js +0 -8
- 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
|
@@ -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";
|
|
@@ -293,6 +292,7 @@ import { compareWithinClass } from "./model-levels/classes.js";
|
|
|
293
292
|
import { HISTORY_RECEIPT_KIND, historyAttachmentStore } from "./harness-import/history.js";
|
|
294
293
|
import { chooseEngine, engineIntent, freeCandidate, harnessForName, localModel, newBotSelection, paidCandidate, perTokenModel } from "./harness-import/engine-policy.js";
|
|
295
294
|
import { createEngineTierRoutes } from "./routes/engine-tiers.js";
|
|
295
|
+
import { applyChibiDefaults, chibiDefaultSelection } from "./chibi-defaults.js";
|
|
296
296
|
import { createPrimaryBotRoutes } from "./routes/primary-bot.js";
|
|
297
297
|
import { EngineSnapshotCache, botTier, canDriveComputer, classLadder, engineAccount, engineHealth, engineLabel, engineTierClasses, engineTierLadders, engineTiersIncludeFree, generateLadders, handlesClientData, ladderForClass, keyBased, needsDelegation, resolveFailover, resolveLadder } from "./engine-tiers.js";
|
|
298
298
|
import { PRIMARY_BOT_THREAD_TITLE, PRIMARY_BOT_TRIGGER, PrimaryBotStore, routesAsSweep, PrimaryBotSweeper } from "./primary-bot.js";
|
|
@@ -321,9 +321,8 @@ import { createNexusMemoryRoutes } from "./routes/nexus-memory.js";
|
|
|
321
321
|
import { createBoardRoutes } from "./routes/board.js";
|
|
322
322
|
import { readBoardFromNexus } from "./board/nexus-board.js";
|
|
323
323
|
import { LocalModelInventory, localModePlacement, machineMemory } from "./local-models-mode.js";
|
|
324
|
-
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";
|
|
325
325
|
import { connectionRunOutPolicy, finalizeConnectionCapPick, finalizeNewTurnPlacement, pauseKeyBandForRunOut } from "./connection-cap-failover.js";
|
|
326
|
-
import { enterSessionFallback, onSessionFallback, ownOrFallback, sessionFallbackSpentLine, withoutSubscription } from "./session-fallback.js";
|
|
327
326
|
import { TURN_ERROR_CATEGORIES } from "../shared/runtime-events.js";
|
|
328
327
|
import { EngineProbes, PROBE_PROMPT, isProbeThread, probeThreadId } from "./engine-probe.js";
|
|
329
328
|
// [jev-verifier] opt-in Jev answer checks after a model switch (server/jev).
|
|
@@ -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";
|
|
@@ -2297,11 +2297,15 @@ async function defaultSelection() {
|
|
|
2297
2297
|
refusal: (instance) => policyModelRefusal(instance),
|
|
2298
2298
|
});
|
|
2299
2299
|
}
|
|
2300
|
-
/** Chibi
|
|
2301
|
-
*
|
|
2300
|
+
/** Chibi is made on its default model when that account is here; otherwise
|
|
2301
|
+
* on the Atomic Engine when its CLI is installed and allowed; otherwise on
|
|
2302
|
+
* the workspace default, like any new bot. */
|
|
2302
2303
|
async function builtinChibiSelection() {
|
|
2303
2304
|
if (hostedModels)
|
|
2304
2305
|
return defaultSelection();
|
|
2306
|
+
const preferred = chibiDefaultSelection(await describeEngines(), policyModelRefusal); // grades load later: applyChibiDefaults below
|
|
2307
|
+
if (preferred)
|
|
2308
|
+
return preferred;
|
|
2305
2309
|
const engine = (await describeEngines()).find((instance) => instance.instanceId === "atomic-engine");
|
|
2306
2310
|
if (engine?.snapshot.state === "available" && engine.snapshot.authenticated !== false &&
|
|
2307
2311
|
policyModelRefusal(engine) === undefined && engine.models.default) {
|
|
@@ -2312,9 +2316,8 @@ async function builtinChibiSelection() {
|
|
|
2312
2316
|
/** Every workspace has its built-in Chibi (store.ensureBuiltinChibi):
|
|
2313
2317
|
* checked at boot and after anything that brings in another roster. */
|
|
2314
2318
|
async function ensureBuiltinChibi() {
|
|
2315
|
-
if (store.builtinChibi())
|
|
2316
|
-
|
|
2317
|
-
store.ensureBuiltinChibi(await builtinChibiSelection());
|
|
2319
|
+
if (!store.builtinChibi())
|
|
2320
|
+
store.ensureBuiltinChibi(await builtinChibiSelection());
|
|
2318
2321
|
}
|
|
2319
2322
|
// Engines a bot may be placed on: hosted models choose for themselves, and
|
|
2320
2323
|
// an organisation's refusals stand.
|
|
@@ -2449,7 +2452,7 @@ const paw = new PawService({
|
|
|
2449
2452
|
const response = await fetch(url, { signal: AbortSignal.timeout(15_000) });
|
|
2450
2453
|
return response.ok ? await response.text() : null;
|
|
2451
2454
|
},
|
|
2452
|
-
localSource: () => cfg.paw?.localSource,
|
|
2455
|
+
localSource: () => cfg.paw?.localSource, nexus: () => nexusMemory.getClient(),
|
|
2453
2456
|
});
|
|
2454
2457
|
try {
|
|
2455
2458
|
if (await paw.ensure({ chibitek: cfg.onboarding?.setup?.chibitek === true }))
|
|
@@ -3060,20 +3063,15 @@ function turnEngineChoice(botId, threadId, needs, runOn) {
|
|
|
3060
3063
|
const task = store.taskByThread(botId, threadId);
|
|
3061
3064
|
if (hostedModels || !profile || !task)
|
|
3062
3065
|
return undefined;
|
|
3066
|
+
// A subscription bot runs only on its own provider: with no account of it
|
|
3067
|
+
// free the turn stops with its one line (Erick, 2026-11-13).
|
|
3063
3068
|
if (isSubscriptionBot(profile))
|
|
3064
|
-
return
|
|
3069
|
+
return subscriptionTurnEngineChoice(profile, threadId);
|
|
3065
3070
|
if (isPersonalBot(profile))
|
|
3066
3071
|
return personalTurnEngineChoice(profile, threadId, needs, runOn);
|
|
3067
3072
|
const projected = store.projectBotForTask(botId, threadId);
|
|
3068
3073
|
return projected ? ladderTurnEngineChoice(profile, projected, threadId, needs, runOn) : undefined;
|
|
3069
3074
|
}
|
|
3070
|
-
/** A company subscription bot's conversation on another provider's subscription, same class (server/session-fallback.ts). */
|
|
3071
|
-
function sessionFallbackChoice(profile, threadId, needs, runOn) {
|
|
3072
|
-
const projected = store.projectBotForTask(profile.id, threadId);
|
|
3073
|
-
const choice = isPersonalBot(profile) || !projected ? undefined
|
|
3074
|
-
: ladderTurnEngineChoice(withoutSubscription(profile), withoutSubscription(projected), threadId, needs, runOn, true);
|
|
3075
|
-
return choice && choice.selection.instanceId !== projected.modelSelection.instanceId ? { selection: choice.selection, persist: false } : undefined;
|
|
3076
|
-
}
|
|
3077
3075
|
/** A room member's engine at turn start, by turnEngineChoice's rules for
|
|
3078
3076
|
* the bot's own default (a room turn has no task of its own, so the bot's
|
|
3079
3077
|
* engine mode decides): resting and signed-out engines passed over, a
|
|
@@ -3097,7 +3095,7 @@ function ladderTurnEngineChoice(profile, projected, threadId, needs, runOn, subs
|
|
|
3097
3095
|
const plan = enginePlan(profile, threadId, tier);
|
|
3098
3096
|
const { ladder } = plan;
|
|
3099
3097
|
const computer = turnComputer(projected, threadId, runOn);
|
|
3100
|
-
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,
|
|
3101
3099
|
keyBandPaused: subscriptionsOnly || keyBandPausedFor(threadId), includeFree: engineTiersIncludeFree(cfg.engineTiers), clientData: handlesClientData(profile) };
|
|
3102
3100
|
const local = (resolution) => localModeTurn(resolution, { tier, context, needs, prefer: [projected.modelSelection.instanceId] });
|
|
3103
3101
|
const wider = (tried, modelClass) => resolveFailover({
|
|
@@ -3382,7 +3380,7 @@ const probeEnvMs = (name) => {
|
|
|
3382
3380
|
const value = Number(process.env[name]);
|
|
3383
3381
|
return Number.isFinite(value) && value > 0 ? value : undefined;
|
|
3384
3382
|
};
|
|
3385
|
-
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)
|
|
3386
3384
|
// Atomic Engine runs on the person's Atomic accounts (server/atomic-engine-accounts.ts).
|
|
3387
3385
|
// An account resting here (its limit was hit through another engine) shares its
|
|
3388
3386
|
// quota with the engine, so the engine is told when it is back. A stall is that
|
|
@@ -3728,11 +3726,11 @@ function engineFailover(turn, completion) {
|
|
|
3728
3726
|
});
|
|
3729
3727
|
}
|
|
3730
3728
|
retireFailedAttempt(turn.botId, turn.threadId, turn.generation, failedOwner, completion);
|
|
3731
|
-
const
|
|
3732
|
-
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))
|
|
3733
3731
|
reportIncident({
|
|
3734
|
-
kind: "engine-fallback", bot: profile, threadId: turn.threadId, notifyChief: true,
|
|
3735
|
-
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)}`,
|
|
3736
3734
|
});
|
|
3737
3735
|
console.error(`[omb-failover] thread=${turn.threadId} ${failure.kind}: ${moved.instanceId} -> ${choice.selection.instanceId} (attempt ${attempt})`);
|
|
3738
3736
|
// No turnId: the failed provider turn is retired, and its id would hide
|
|
@@ -3806,7 +3804,7 @@ function roomEngineFailover(turn, completion, room, profile, candidates, failedC
|
|
|
3806
3804
|
console.error(`[omb-failover] room thread=${turn.threadId} ${failure.kind}: ${room.selection.instanceId} -> ${choice.selection.instanceId} (attempt ${attempt})`);
|
|
3807
3805
|
if (!reportFreeFallback(profile, turn.threadId, choice.selection, `${failedLabel} failed (${failure.kind})`) && !failure.permanent) {
|
|
3808
3806
|
reportIncident({
|
|
3809
|
-
kind: "engine-fallback", bot: profile, threadId: turn.threadId,
|
|
3807
|
+
kind: "engine-fallback", bot: profile, threadId: turn.threadId, dedupeKey: `${room.selection.instanceId}:${failure.kind}`,
|
|
3810
3808
|
detail: `${failedLabel} failed (${failure.kind}); the room turn continued on ${replacementLabel}`,
|
|
3811
3809
|
});
|
|
3812
3810
|
}
|
|
@@ -3834,26 +3832,21 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3834
3832
|
const computer = projected ? turnComputer(projected, turn.threadId, attempt.runOn) : undefined;
|
|
3835
3833
|
// A subscription bot fails over only to another account of its own
|
|
3836
3834
|
// provider on its side of the personal line; with none left it stops with
|
|
3837
|
-
// its one line
|
|
3835
|
+
// its one line.
|
|
3838
3836
|
const subscriptionMove = isSubscriptionBot(profile)
|
|
3839
|
-
? tried
|
|
3837
|
+
? triesSpent(tried, needsPerson) || !projected
|
|
3840
3838
|
? { line: subscriptionLine(profile, candidates) }
|
|
3841
3839
|
: subscriptionPlacement({ profile, projected, candidates, tried: new Set([...tried, turn.instanceId]), auto: attempt.persist, modelClass: neededClass })
|
|
3842
3840
|
: undefined;
|
|
3843
|
-
|
|
3844
|
-
if (fallback && !enterSessionFallback(turn.threadId, false))
|
|
3845
|
-
return { line: sessionFallbackSpentLine(subscriptionMove.line) };
|
|
3846
|
-
if (subscriptionMove && !subscriptionMove.choice && !fallback)
|
|
3841
|
+
if (subscriptionMove && !subscriptionMove.choice)
|
|
3847
3842
|
return { line: subscriptionMove.line };
|
|
3848
|
-
if (fallback)
|
|
3849
|
-
[profile, projected] = [withoutSubscription(profile), withoutSubscription(projected)];
|
|
3850
3843
|
const personalTurn = isPersonalBot(profile) && !subscriptionMove;
|
|
3851
3844
|
// The Private Bot prefers personal engines and opted-in local compute,
|
|
3852
3845
|
// then company compute. startTurn rechecks company cost on every attempt.
|
|
3853
3846
|
const personalMove = subscriptionMove?.choice
|
|
3854
3847
|
? { choice: { selection: subscriptionMove.choice.selection, candidate: subscriptionMove.choice.candidate, step: 0, band: "subscription" }, line: "" }
|
|
3855
3848
|
: personalTurn
|
|
3856
|
-
? tried
|
|
3849
|
+
? triesSpent(tried, needsPerson) || !projected
|
|
3857
3850
|
? { line: personalLine(candidates, false) }
|
|
3858
3851
|
: personalPlacement({ profile, projected, candidates, tried, needs: { tools: true, vision: attempt.vision }, modelClass: neededClass, computer })
|
|
3859
3852
|
: undefined;
|
|
@@ -3862,12 +3855,12 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3862
3855
|
// Every bot, pinned or not and of any tier, falls to the next subscription
|
|
3863
3856
|
// the person has, in any class, before a pay-per-use key (resolveFailover).
|
|
3864
3857
|
const resting = (candidate, model) => engineResting(candidate, model) || (model === attempt.selection.model && !!failedCandidate && sameRoute(candidate, failedCandidate));
|
|
3865
|
-
const resolution = personalMove || tried
|
|
3858
|
+
const resolution = personalMove || triesSpent(tried, needsPerson) || !projected ? { skipped: [] } : resolveFailover({
|
|
3866
3859
|
ladder: plan.ladder,
|
|
3867
3860
|
classLadder: (modelClass) => classLadder(classedModels(), modelClass),
|
|
3868
3861
|
failed: attempt.selection,
|
|
3869
|
-
context: { candidates, needsDelegation: needsDelegation(tier, profile), computer, refuse: engineTierRefusal(projected), resting,
|
|
3870
|
-
keyBandPaused:
|
|
3862
|
+
context: { candidates, needsDelegation: needsDelegation(tier, profile), computer, refuse: engineTierRefusal(projected), resting, own: profile.modelSelection.instanceId,
|
|
3863
|
+
keyBandPaused: keyBandPausedFor(turn.threadId), includeFree: engineTiersIncludeFree(cfg.engineTiers), clientData: handlesClientData(profile) },
|
|
3871
3864
|
tried,
|
|
3872
3865
|
modelClass: neededClass,
|
|
3873
3866
|
mayDrop: true,
|
|
@@ -3884,16 +3877,16 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3884
3877
|
: { ...resolution, local: false };
|
|
3885
3878
|
const choice = placed.choice && placed.local ? { ...placed.choice, modelClass: "Añejo" } : placed.choice;
|
|
3886
3879
|
return finalizeConnectionCapPick({
|
|
3887
|
-
choice,
|
|
3880
|
+
choice, subscriptionLine: subscriptionMove?.line, failureKind: turn.failure?.kind,
|
|
3888
3881
|
pausedUntil: payPerUse.pausedUntil(), skipped: resolution.skipped, payPerUsePausedLine, restingNamed,
|
|
3889
|
-
failedInstanceId: turn.instanceId, alreadyTried: attempt.tried, triedCount: tried.
|
|
3882
|
+
failedInstanceId: turn.instanceId, alreadyTried: attempt.tried, triedCount: [...tried].filter((instanceId) => !needsPerson(instanceId)).length,
|
|
3890
3883
|
cannotDrive: cannotDriveNamed(candidates, resolution.skipped, computer),
|
|
3891
3884
|
policy: connectionRunOutPolicy(cfg.engineTiers), paidApproved: Boolean(payPerUse.current()?.keptGoingAt),
|
|
3892
3885
|
local: Boolean(placed.local), currentLabel: engineLabel(candidates, attempt.selection),
|
|
3893
3886
|
nextLabel: choice ? engineLabel(candidates, choice.selection) : undefined,
|
|
3894
3887
|
nextBand: choice && "band" in choice ? choice.band : undefined, resetAt: turn.failure?.resetAt, formatTime: restTime,
|
|
3895
3888
|
announceWaiting: () => notePayPerUse({ skipped: resolution.skipped, local: true, choice: { band: "key", selection: { instanceId: "", model: "" }, candidate: { instanceId: "" }, step: 0 } }),
|
|
3896
|
-
bookChoice: () => { if (!
|
|
3889
|
+
bookChoice: () => { if (!subscriptionMove) {
|
|
3897
3890
|
if (personalMove)
|
|
3898
3891
|
notePersonalPayPerUse(personalMove);
|
|
3899
3892
|
else
|
|
@@ -4066,7 +4059,7 @@ function engineTierRefusal(bot, options = {}) {
|
|
|
4066
4059
|
// A subscription bot never leaves its provider (server/subscription-bots.ts).
|
|
4067
4060
|
if (!providerAllows(bot, candidate, subscriptionFacts))
|
|
4068
4061
|
return "provider";
|
|
4069
|
-
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)))
|
|
4070
4063
|
return "approval";
|
|
4071
4064
|
return undefined;
|
|
4072
4065
|
};
|
|
@@ -8580,6 +8573,7 @@ function wakeDelegationSource(source, threadId, targetName, failureReason, routi
|
|
|
8580
8573
|
// with a link to the broken thread and retry_thread to act on it. The person
|
|
8581
8574
|
// reads one place. Policy in server/incidents.ts.
|
|
8582
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
|
|
8583
8577
|
/** What the broken thread was about: the last line the person (or the
|
|
8584
8578
|
* requester) sent there, and the last thing the bot said. */
|
|
8585
8579
|
function incidentContext(threadId) {
|
|
@@ -8623,13 +8617,13 @@ function reportIncident(input) {
|
|
|
8623
8617
|
detail: redactSecretsInText(input.detail),
|
|
8624
8618
|
...incidentContext(threadId),
|
|
8625
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;
|
|
8626
8624
|
const count = incidentLedger.note(threadId);
|
|
8627
|
-
// a crash loop is one incident, not a storm
|
|
8628
8625
|
if (count.muted)
|
|
8629
|
-
return;
|
|
8630
|
-
// The Private Bot's failures go to the person only: never into Chibi's
|
|
8631
|
-
// Team incidents thread, where its request and reply would be quoted.
|
|
8632
|
-
const chief = isPersonalBot(bot) ? undefined : chiefForBot(store.bots, bot);
|
|
8626
|
+
return; // a crash loop is one incident, not a storm
|
|
8633
8627
|
// A run that could not start and a failed routine have already buzzed
|
|
8634
8628
|
// the person (turn-failed, routine-failed) by the time they get here; a
|
|
8635
8629
|
// failure or stall mid-run has not. One notification per failure, never two.
|
|
@@ -9653,8 +9647,7 @@ async function startTurn(botId, text, opts) {
|
|
|
9653
9647
|
: threadBusy(botId, threadId) ? undefined : turnEngineChoice(botId, threadId, { tools: true, vision: turnHasImages(opts?.userMessage) }, opts?.runOn);
|
|
9654
9648
|
const tierSelection = engineChoice?.persist ? engineChoice.selection : undefined;
|
|
9655
9649
|
const projectedBot = store.projectBotForTask(botId, threadId);
|
|
9656
|
-
const
|
|
9657
|
-
const bot = fallbackBot && engineChoice ? { ...fallbackBot, modelSelection: engineChoice.selection } : fallbackBot;
|
|
9650
|
+
const bot = projectedBot && engineChoice ? { ...projectedBot, modelSelection: engineChoice.selection } : projectedBot;
|
|
9658
9651
|
if (!bot)
|
|
9659
9652
|
throw Object.assign(new Error("no such task"), { status: 404 });
|
|
9660
9653
|
// Routines and legacy peer delivery already have their own completion
|
|
@@ -10670,7 +10663,7 @@ async function startTurn(botId, text, opts) {
|
|
|
10670
10663
|
const owner = turnResourceOwners.get(threadId);
|
|
10671
10664
|
if (!owner || !claimTurnResource(owner, `browser:${session}`))
|
|
10672
10665
|
throw new Error("another thread is using this browser");
|
|
10673
|
-
return browserRuntime.withAgentAction(session, () => agentBrowserFrame(frame));
|
|
10666
|
+
return browserRuntime.withAgentAction(session, () => browserRuntime.frame(session, () => agentBrowserFrame(frame)));
|
|
10674
10667
|
};
|
|
10675
10668
|
}
|
|
10676
10669
|
}
|
|
@@ -14494,7 +14487,7 @@ function configStatus() {
|
|
|
14494
14487
|
features: {
|
|
14495
14488
|
skillAuthoring: skillAuthoringEnabled(cfg),
|
|
14496
14489
|
showToolCalls: showToolCallsEnabled(cfg),
|
|
14497
|
-
browser: builtInBrowserEnabled(cfg),
|
|
14490
|
+
browser: builtInBrowserEnabled(cfg), ...terminalFeatures(cfg),
|
|
14498
14491
|
// Maintainer-only escape hatch, not a Settings toggle: the desktop
|
|
14499
14492
|
// shell and the Settings UI read it so they offer nothing this server
|
|
14500
14493
|
// would refuse.
|
|
@@ -15281,6 +15274,7 @@ ROUTES.push(createJevRoutes({
|
|
|
15281
15274
|
hipaa: () => workspaceHipaa().enabled,
|
|
15282
15275
|
fromBot: (req) => authorizedInternalCapability(req.headers.authorization) !== null,
|
|
15283
15276
|
}));
|
|
15277
|
+
ROUTES.push(terminalRoutes({ cfg: () => cfg, dataDir: DATA_DIR, hasBot: (id) => Boolean(store.bot(id)), localVmContainer: (id) => localVmTargetForBot(id).containerName }));
|
|
15284
15278
|
// [dictation] Atomic Dictation's auto-correct and the Administrator's HIPAA
|
|
15285
15279
|
// switch (docs/chibitek/dictation.md, server/routes/dictation.ts).
|
|
15286
15280
|
let dictationIntelligence = null;
|
|
@@ -16001,6 +15995,8 @@ ROUTES.push(createHarnessImportRoutes({
|
|
|
16001
15995
|
// override regenerates them. OMB_MODEL_LEVELS_REFRESH=0 keeps the weekly job
|
|
16002
15996
|
// off the network and serves the cached or bundled classes.
|
|
16003
15997
|
const modelLevels = createModelLevels({ dataDir: DATA_DIR });
|
|
15998
|
+
if (!hostedModels)
|
|
15999
|
+
await applyChibiDefaults({ dataDir: DATA_DIR, cfg, saveConfig, store, engines: describeEngines, refused: policyModelRefusal, models: classedModels });
|
|
16004
16000
|
ROUTES.push(createModelLevelsRoutes({ levels: modelLevels,
|
|
16005
16001
|
fromBot: (req) => authorizedInternalCapability(req.headers.authorization) !== null }));
|
|
16006
16002
|
if (process.env.OMB_MODEL_LEVELS_REFRESH !== "0")
|
|
@@ -25420,6 +25416,7 @@ const gracefulShutdown = createGracefulShutdown({
|
|
|
25420
25416
|
sharedComputers.close();
|
|
25421
25417
|
sharedComputerControl.close();
|
|
25422
25418
|
browserLive.closeAll();
|
|
25419
|
+
closeTerminals();
|
|
25423
25420
|
for (const idle of localVmIdles.values())
|
|
25424
25421
|
idle.cancel();
|
|
25425
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,27 @@
|
|
|
1
|
+
// One shared wait after Nexus fails: 1, 5, 15, then 30 minutes while the
|
|
2
|
+
// outage lasts (unreachable, or signed out, which makes the bridge open a
|
|
3
|
+
// sign-in page). A failure more than an hour after the previous one is a
|
|
4
|
+
// new blip and starts over at one minute, so a night of Wi-Fi drops does
|
|
5
|
+
// not leave every later call blocked for half an hour.
|
|
6
|
+
const WAITS_MS = [60_000, 300_000, 900_000, 1_800_000];
|
|
7
|
+
const SAME_OUTAGE_MS = 2 * WAITS_MS[WAITS_MS.length - 1];
|
|
8
|
+
export class UnavailableBackoff {
|
|
9
|
+
until = 0;
|
|
10
|
+
failures = 0;
|
|
11
|
+
lastAt = 0;
|
|
12
|
+
/** How much longer to wait; 0 when calls may go through. */
|
|
13
|
+
remainingMs(now) {
|
|
14
|
+
return Math.max(0, this.until - now);
|
|
15
|
+
}
|
|
16
|
+
failed(now) {
|
|
17
|
+
if (now - this.lastAt > SAME_OUTAGE_MS)
|
|
18
|
+
this.failures = 0;
|
|
19
|
+
this.lastAt = now;
|
|
20
|
+
this.failures += 1;
|
|
21
|
+
this.until = now + WAITS_MS[Math.min(this.failures - 1, WAITS_MS.length - 1)];
|
|
22
|
+
}
|
|
23
|
+
succeeded() {
|
|
24
|
+
this.failures = 0;
|
|
25
|
+
this.until = 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -29,6 +29,7 @@ import { existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
|
|
|
29
29
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
30
30
|
import { writeFileAtomic } from "../atomic.js";
|
|
31
31
|
import { customMcpServers } from "../config.js";
|
|
32
|
+
import { UnavailableBackoff } from "./backoff.js";
|
|
32
33
|
import { nexusClientFor, NexusRejectedError, NexusUnavailableError } from "./client.js";
|
|
33
34
|
import { buildSessionOutcome, promptText } from "./outcome.js";
|
|
34
35
|
import { NexusOutbox } from "./outbox.js";
|
|
@@ -62,7 +63,6 @@ const DOC_MAX_BYTES = 10 * MB;
|
|
|
62
63
|
const READBACK_TTL_MS = 10 * 60_000;
|
|
63
64
|
const READBACK_TIMEOUT_MS = 2_500;
|
|
64
65
|
const LOCAL_NOTE_MAX_CHARS = 24_000;
|
|
65
|
-
const UNAVAILABLE_BACKOFF_MS = [60_000, 300_000, 900_000, 1_800_000];
|
|
66
66
|
/**
|
|
67
67
|
* Whose Nexus a message belongs to. Nexus writes go to the person signed in
|
|
68
68
|
* on this computer's bridge. A message from someone else on a shared
|
|
@@ -109,8 +109,7 @@ export class NexusMemory {
|
|
|
109
109
|
readBackCache = new Map();
|
|
110
110
|
client = null;
|
|
111
111
|
clientKey = "";
|
|
112
|
-
|
|
113
|
-
unavailableFailures = 0;
|
|
112
|
+
backoff = new UnavailableBackoff();
|
|
114
113
|
timer;
|
|
115
114
|
stopped = true;
|
|
116
115
|
now;
|
|
@@ -181,29 +180,26 @@ export class NexusMemory {
|
|
|
181
180
|
}
|
|
182
181
|
return this.client;
|
|
183
182
|
}
|
|
184
|
-
/** The client behind one shared back-off: once Nexus
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* minutes. Writes keep queuing on disk meanwhile. */
|
|
183
|
+
/** The client behind one shared back-off (see backoff.ts): once Nexus
|
|
184
|
+
* fails, nothing calls it again until the wait is over. Writes keep
|
|
185
|
+
* queuing on disk meanwhile. */
|
|
188
186
|
getClient() {
|
|
189
187
|
const client = this.rawClient();
|
|
190
188
|
if (!client)
|
|
191
189
|
return null;
|
|
192
190
|
return {
|
|
193
191
|
call: async (tool, args, timeoutMs) => {
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
const remaining = this.backoff.remainingMs(this.now());
|
|
193
|
+
if (remaining > 0)
|
|
194
|
+
throw new NexusUnavailableError(`waiting before trying Nexus again (next try in ${Math.ceil(remaining / 60_000)} min)`);
|
|
196
195
|
try {
|
|
197
196
|
const result = await client.call(tool, args, timeoutMs);
|
|
198
|
-
this.
|
|
199
|
-
this.unavailableUntil = 0;
|
|
197
|
+
this.backoff.succeeded();
|
|
200
198
|
return result;
|
|
201
199
|
}
|
|
202
200
|
catch (error) {
|
|
203
|
-
if (error instanceof NexusUnavailableError)
|
|
204
|
-
this.
|
|
205
|
-
this.unavailableUntil = this.now() + UNAVAILABLE_BACKOFF_MS[Math.min(this.unavailableFailures - 1, UNAVAILABLE_BACKOFF_MS.length - 1)];
|
|
206
|
-
}
|
|
201
|
+
if (error instanceof NexusUnavailableError)
|
|
202
|
+
this.backoff.failed(this.now());
|
|
207
203
|
throw error;
|
|
208
204
|
}
|
|
209
205
|
},
|
|
@@ -530,7 +526,7 @@ export class NexusMemory {
|
|
|
530
526
|
const due = outboxDue === null ? notesDue : notesDue === null ? outboxDue : Math.min(outboxDue, notesDue);
|
|
531
527
|
if (due === null)
|
|
532
528
|
return;
|
|
533
|
-
const wait = Math.max(delayMs ?? Math.max(0, due - this.now()), this.
|
|
529
|
+
const wait = Math.max(delayMs ?? Math.max(0, due - this.now()), this.backoff.remainingMs(this.now()), 0);
|
|
534
530
|
this.timer = setTimeout(() => {
|
|
535
531
|
void this.flush().finally(() => this.kick());
|
|
536
532
|
}, wait);
|