@chibitek/chibi 0.1.206 → 0.1.207
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-BBJ8EeT7.js → TerminalPanel-Cqjxle8G.js} +1 -1
- package/dist/assets/{abnfDiagram-O67JEVCF-a06YszXx.js → abnfDiagram-O67JEVCF-XB80WX43.js} +1 -1
- package/dist/assets/{arc-Fe3WbFfc.js → arc-BERcgYDi.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-DYcb0ZrL.js → architectureDiagram-NJMV4G6O-Dnc9s6SQ.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-xC5y8We2.js → blockDiagram-BEXU5L5S-Cxc21eYL.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-Dm81dUJa.js → c4Diagram-YGBWAQC7-CW-3gUcf.js} +1 -1
- package/dist/assets/channel-DaeKCO76.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-CDVJUGUd.js → chunk-2Q5K7J3B-Bs484eiW.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-BvPx7oJb.js → chunk-3FUC2YCW-qhnBgRDy.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-kUQxxDSH.js → chunk-5VM5RSS4-CsCqAEkH.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-hmSLPBzT.js → chunk-GTNCS2PH-ChBgFjPw.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-ivlnCC25.js → chunk-GWA4HPMP-Df5-WClq.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-hjxL5olg.js → chunk-JWPE2WC7-BdMXRJhO.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-ClgHcSe7.js → chunk-NETBCI7D-rmAqJ9nY.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-1i-fNDpg.js → chunk-WEXAMYUT-DYmTw4lw.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-BhPdm5u4.js → chunk-XXDRQBXY-C4o5SHm0.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-BsL-gKkF.js → classDiagram-v2-NBCMYWYE-Bm-ZzDk5.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-piSPlA0p.js → cose-bilkent-JH36ORCC-CFMRSfMu.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-D2T5q7wD.js → cynefin-OW5HDTMX-BDedZ5yW.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-CWHt2804.js → cynefinDiagram-VND7K2PF-i7KARSqF.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-BNioVBDz.js → dagre-6A5THRUB-CwWpV0i_.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-DULW9a3n.js → diagram-22UHCM2B-CWIMT3-K.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-EYvilvye.js → diagram-3UASUU5V-C7HGc_ap.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-BRkFLoxi.js → diagram-ATOU4E4O-BeLM7ihN.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-B0IbbTpB.js → diagram-CDSNMT55-CN1rVM-W.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-u7n_3e2v.js → diagram-MLGK6HIB-CuLcsx4e.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-NegomnHr.js → diagram-MPIPVDR6-Bie61r-h.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-BPZmiseK.js → ebnfDiagram-ZINNZB2B-ChMg86y3.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-BcBEThvp.js → elk-276RUBZZ-DG9xXwoW.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-BVAGByE5.js → erDiagram-OPXOYQCR-C9bl-nWK.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-ByZ1IyAE.js → flowDiagram-KWPJA3E3-DvdWxFI8.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-CEa3O2pJ.js → ganttDiagram-FUAMR5RP-DDCNSEYc.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-dul-ZoaX.js → gitGraphDiagram-X574FWY7-PFvmOSMd.js} +1 -1
- package/dist/assets/{index-Tw4-5a-J.js → index-Ci2mINhA.js} +152 -152
- package/dist/assets/{index-CFUbzTrj.js → index-DnniNB7N.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-Bt9KS597.js → infoDiagram-VRGFBTTK-HEZh-PnK.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-BjJTuEjh.js → ishikawaDiagram-OU5B5YK6-P3mmCGAU.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-j07hDjg4.js → journeyDiagram-ZHPQQLJL-dKG4AQu2.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-DU8baSEs.js → kanban-definition-PNTS6WVX-BeIHeQTt.js} +1 -1
- package/dist/assets/{linear-Dj1tr9Bh.js → linear-DnEqDr6r.js} +1 -1
- package/dist/assets/{mermaid.core-BeSGZMCl.js → mermaid.core-D7hz6n4u.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-LiRl-Bq2.js → mindmap-definition-NLK3R4M7-BxJ8p-DN.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-COL7EWof.js → pegDiagram-GJSIUBJH-CkQT2dHJ.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-BnMXaara.js → pieDiagram-5QR66LMP-DmVVhYaY.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-BjLcZ6bG.js → quadrantDiagram-O4NWA36T-DsOz-qCY.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-wKCzKLAA.js → railroadDiagram-XR7U4H2S-CeYfvaki.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-BjoTwmZ-.js → requirementDiagram-PLB6GJNP-BCtM-2uN.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-CuGyR0Tn.js → sankeyDiagram-IPEJSGJF-Cu8ki35x.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-DxOzUuSx.js → sequenceDiagram-PO4LG4MO-DKbS5Gcs.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-B-bTrmx9.js → sizeCapture-INFHLROL-Ceut6PrE.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-D6ZflrZQ.js → stateDiagram-v2-GCMORJYK-Bl5uMY2f.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-DKgdDJlH.js → swimlanes-2SLR337P-CoMPbJ2k.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-DLJq0mAR.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-Dli4hqxc.js → timeline-definition-EJHVYXUP-D0xkKp46.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-CQ8Cc1rN.js → usecaseDiagram-POWQR4AR-BCCL6QIf.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-JEu7ZkzA.js → vennDiagram-UO4OBE2U-B7g3jK72.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-DkFigbd0.js → wardleyDiagram-VNRHLVJA-DFhnqQKP.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-DwOctln8.js → xychartDiagram-PMCCYNJV-mIXMscRS.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/accounts-proxy.js +12 -2
- package/dist-server/browser-proxy.js +15 -2
- package/dist-server/drivers/phone-proxy.js +13 -4
- package/dist-server/index.js +27 -15
- package/dist-server/openmausbot.js +5 -3
- package/dist-server/pair-cli.js +5 -3
- package/dist-server/server/accounts-proxy.js +17 -2
- package/dist-server/server/agents-token-file.js +10 -7
- package/dist-server/server/browser-proxy.js +18 -2
- package/dist-server/server/connection-cap-failover.js +3 -1
- package/dist-server/server/drivers/phone-proxy.js +18 -4
- package/dist-server/server/engine-failover.js +5 -0
- package/dist-server/server/engine-failure.js +3 -3
- package/dist-server/server/engine-rest.js +1 -0
- package/dist-server/server/harness/bus.js +7 -2
- package/dist-server/server/index.js +10 -10
- package/package.json +1 -1
- package/dist/assets/channel-D3ihDYTR.js +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-DSlLxTUH.js +0 -8
package/dist-server/index.js
CHANGED
|
@@ -37298,7 +37298,8 @@ var USAGE_LIMITED = [
|
|
|
37298
37298
|
// Codex: "You've hit your usage limit. Upgrade to Pro ... or try again in 2 days 4 hours";
|
|
37299
37299
|
// Cursor: "You've hit your usage limit for this month".
|
|
37300
37300
|
/\busage limit\b/i,
|
|
37301
|
-
/\bhit your (
|
|
37301
|
+
/\bhit your (?:[\w-]+ )?limit\b/i,
|
|
37302
|
+
// \"hit your 5-hour limit · resets 3:50am\" (Claude Code, 2026-11-22)
|
|
37302
37303
|
/\b(?:5-hour|five-hour|hourly|weekly|daily|monthly|session|opus|sonnet) (?:usage )?limit (?:reached|exceeded|hit)\b/i,
|
|
37303
37304
|
/\blimit reached\b[^.]*\breset/i,
|
|
37304
37305
|
// OpenAI API: "You exceeded your current quota, please check your plan and billing details." (insufficient_quota);
|
|
@@ -37309,7 +37310,7 @@ var USAGE_LIMITED = [
|
|
|
37309
37310
|
/\bplan limit\b|\blimit (?:of|for) your (?:plan|subscription)\b/i,
|
|
37310
37311
|
// Anthropic API: "Your credit balance is too low to access the Anthropic API."
|
|
37311
37312
|
// xAI: "Your team ... has either used all available credits or reached its monthly spending limit."
|
|
37312
|
-
/\bcredit balance (?:is )?too low\b|\binsufficient (?:\w+ )?(?:credits?|balance|funds)\b|\b(?:out|run out) of credits\b/i,
|
|
37313
|
+
/\bcredit balance (?:is )?too low\b|\binsufficient (?:\w+ )?(?:credits?|balance|funds)\b|\b(?:out|run out) of (?:usage )?credits\b/i,
|
|
37313
37314
|
/\bused all (?:available |of your )?credits\b|\bno credits? (?:left|remaining)\b|\bspending limit\b/i,
|
|
37314
37315
|
/\bexhausted your (?:\w+ )?quota\b/i,
|
|
37315
37316
|
/\bquota\b[^.]{0,60}\b(?:exceeded|exhausted|reached|used up)\b|\b(?:exceeded|exhausted|reached)\b[^.]{0,40}\bquota\b/i,
|
|
@@ -37355,7 +37356,8 @@ var AUTH_FAILED = [
|
|
|
37355
37356
|
/\b(?:token|session|credentials?) (?:has |have )?expired\b|\bexpired (?:token|session|credentials?)\b/i
|
|
37356
37357
|
];
|
|
37357
37358
|
var STALLED = [
|
|
37358
|
-
/\bwent fully silent\b[^.]{0,80}\bturn was stopped\b/i
|
|
37359
|
+
/\bwent fully silent\b[^.]{0,80}\bturn was stopped\b|\bGateway inaccessible\b/i
|
|
37360
|
+
// the second: Hermes `acp` could not reach or start its gateway service, so it is not responding (2026-11-22)
|
|
37359
37361
|
];
|
|
37360
37362
|
var OPAQUE_REQUEST_REJECTION = /^Internal error: Bad Request \(session\/prompt\b/;
|
|
37361
37363
|
function isOpaqueRequestRejection(message4) {
|
|
@@ -80886,6 +80888,9 @@ var EventBus = class {
|
|
|
80886
80888
|
gate = null;
|
|
80887
80889
|
unsubscribes = /* @__PURE__ */ new Map();
|
|
80888
80890
|
pendingLogWarnings = /* @__PURE__ */ new Map();
|
|
80891
|
+
/** Events already in the canonical log: a held event released later by the
|
|
80892
|
+
* gate is the same object, logged once. */
|
|
80893
|
+
recorded = /* @__PURE__ */ new WeakSet();
|
|
80889
80894
|
appendLog;
|
|
80890
80895
|
constructor(appendLog = appendFileSync3) {
|
|
80891
80896
|
this.appendLog = appendLog;
|
|
@@ -80910,11 +80915,13 @@ var EventBus = class {
|
|
|
80910
80915
|
this.record(event);
|
|
80911
80916
|
const deliveries = this.gate ? this.gate(event) : [event];
|
|
80912
80917
|
for (const delivery of deliveries) {
|
|
80913
|
-
|
|
80918
|
+
this.record(delivery);
|
|
80914
80919
|
this.deliver(delivery);
|
|
80915
80920
|
}
|
|
80916
80921
|
}
|
|
80917
80922
|
record(event) {
|
|
80923
|
+
if (this.recorded.has(event)) return;
|
|
80924
|
+
this.recorded.add(event);
|
|
80918
80925
|
const pendingWarning = this.pendingLogWarnings.get(event.threadId);
|
|
80919
80926
|
const persistedEvents = pendingWarning ? [pendingWarning, redactSecrets(event)] : [redactSecrets(event)];
|
|
80920
80927
|
try {
|
|
@@ -107298,12 +107305,12 @@ var SessionRegistry = class {
|
|
|
107298
107305
|
import { createHash as createHash49 } from "node:crypto";
|
|
107299
107306
|
import { mkdirSync as mkdirSync64 } from "node:fs";
|
|
107300
107307
|
import { join as join122 } from "node:path";
|
|
107301
|
-
function agentsTokenFile(botId, threadId, dataDir2 = DATA_DIR) {
|
|
107308
|
+
function agentsTokenFile(botId, threadId, dataDir2 = DATA_DIR, kind = "agents") {
|
|
107302
107309
|
const digest2 = createHash49("sha256").update(`${botId}\0${threadId}`).digest("hex").slice(0, 24);
|
|
107303
|
-
return join122(dataDir2, "agents-tokens", `${digest2}.token`);
|
|
107310
|
+
return join122(dataDir2, "agents-tokens", kind === "agents" ? `${digest2}.token` : `${digest2}.${kind}.token`);
|
|
107304
107311
|
}
|
|
107305
|
-
function writeAgentsTokenFile(botId, threadId, token, dataDir2 = DATA_DIR) {
|
|
107306
|
-
const path2 = agentsTokenFile(botId, threadId, dataDir2);
|
|
107312
|
+
function writeAgentsTokenFile(botId, threadId, token, dataDir2 = DATA_DIR, kind = "agents") {
|
|
107313
|
+
const path2 = agentsTokenFile(botId, threadId, dataDir2, kind);
|
|
107307
107314
|
mkdirSync64(join122(dataDir2, "agents-tokens"), { recursive: true, mode: 448 });
|
|
107308
107315
|
writeFileAtomic(path2, token, { mode: 384 });
|
|
107309
107316
|
return path2;
|
|
@@ -120595,6 +120602,7 @@ function triesSpent(tried, needsPerson2) {
|
|
|
120595
120602
|
const all2 = [...tried];
|
|
120596
120603
|
return all2.length >= MAX_ENGINES_WALKED || all2.filter((instanceId) => !needsPerson2(instanceId)).length >= MAX_ENGINES_PER_TURN;
|
|
120597
120604
|
}
|
|
120605
|
+
var uncountedTry = (turn, resting, needsPerson2) => (instanceId) => needsPerson2(instanceId) || instanceId === turn.instanceId && turn.failure?.setup === true || resting.some((entry) => entry.instanceId === instanceId && entry.setup === true);
|
|
120598
120606
|
var accountOf = (engine) => engine.snapshot.account?.email ?? engine.snapshot.account?.organization;
|
|
120599
120607
|
var sameRoute = (a, b3) => a.instanceId !== b3.instanceId && a.driverKind === b3.driverKind && accountOf(a) === accountOf(b3);
|
|
120600
120608
|
function restingOnRoute(candidate, model2, candidates, restOf) {
|
|
@@ -120798,7 +120806,7 @@ function finalizeConnectionCapPick(input) {
|
|
|
120798
120806
|
return { line: transientThrottleStopLine(input.currentLabel), category: "failover_exhausted" };
|
|
120799
120807
|
}
|
|
120800
120808
|
const { choice } = input;
|
|
120801
|
-
if (!choice && input.failureKind === "provider_error") return { passthrough: true };
|
|
120809
|
+
if (!choice && input.failureKind === "provider_error" && input.triedCount < MAX_ENGINES_PER_TURN) return { passthrough: true };
|
|
120802
120810
|
if (!choice) {
|
|
120803
120811
|
if (input.pausedUntil !== void 0 && input.skipped.some((skip) => skip.reason === "paused")) {
|
|
120804
120812
|
return { line: input.payPerUsePausedLine(input.pausedUntil) };
|
|
@@ -122087,6 +122095,7 @@ var EngineRestStore = class {
|
|
|
122087
122095
|
until: restUntil,
|
|
122088
122096
|
count,
|
|
122089
122097
|
...reason === "auth_failed" ? { needsSignIn: true } : {},
|
|
122098
|
+
...detail.setup ? { setup: true } : {},
|
|
122090
122099
|
...keyExpired ? { keyExpired: true } : {},
|
|
122091
122100
|
...reason === "auth_failed" && detail.reportedSignedIn !== void 0 ? { reportedSignedIn: detail.reportedSignedIn } : {},
|
|
122092
122101
|
...reason === "auth_failed" && active?.sawSignedOut ? { sawSignedOut: true } : {},
|
|
@@ -129454,6 +129463,7 @@ async function browserIntegration(botId, profile, turn) {
|
|
|
129454
129463
|
env: {
|
|
129455
129464
|
...AGENTS_NODE_FLAG,
|
|
129456
129465
|
OMB_BROWSER_TOKEN: token,
|
|
129466
|
+
OMB_BROWSER_TOKEN_FILE: writeAgentsTokenFile(botId, turn.threadId, token, void 0, "browser"),
|
|
129457
129467
|
OMB_HARNESS_URL: `http://127.0.0.1:${PORT}`
|
|
129458
129468
|
}
|
|
129459
129469
|
} };
|
|
@@ -129480,6 +129490,7 @@ function phoneIntegration(botId, threadId, generation) {
|
|
|
129480
129490
|
const env = {
|
|
129481
129491
|
...AGENTS_NODE_FLAG,
|
|
129482
129492
|
OMB_PHONE_TOKEN: token,
|
|
129493
|
+
OMB_PHONE_TOKEN_FILE: writeAgentsTokenFile(botId, threadId, token, void 0, "phone"),
|
|
129483
129494
|
OMB_HARNESS_URL: `http://127.0.0.1:${PORT}`
|
|
129484
129495
|
};
|
|
129485
129496
|
if (process.env.OMB_ADB_PATH) env.OMB_ADB_PATH = process.env.OMB_ADB_PATH;
|
|
@@ -129501,7 +129512,7 @@ function accountsIntegration(botId, threadId, generation) {
|
|
|
129501
129512
|
return {
|
|
129502
129513
|
command: process.execPath,
|
|
129503
129514
|
args: [SPAWNED_PROXIES.accounts],
|
|
129504
|
-
env: { ...AGENTS_NODE_FLAG, OMB_ACCOUNTS_TOKEN: token, OMB_HARNESS_URL: `http://127.0.0.1:${PORT}` },
|
|
129515
|
+
env: { ...AGENTS_NODE_FLAG, OMB_ACCOUNTS_TOKEN: token, OMB_ACCOUNTS_TOKEN_FILE: writeAgentsTokenFile(botId, threadId, token, void 0, "accounts"), OMB_HARNESS_URL: `http://127.0.0.1:${PORT}` },
|
|
129505
129516
|
readOnlyTools: ACCOUNT_TOOLS.filter((tool3) => isReadOnlyAccountTool(tool3.name)).map((tool3) => tool3.name),
|
|
129506
129517
|
askTools: ACCOUNT_TOOLS.filter((tool3) => !isReadOnlyAccountTool(tool3.name)).map((tool3) => tool3.name)
|
|
129507
129518
|
};
|
|
@@ -130689,6 +130700,7 @@ function engineFailover(turn, completion) {
|
|
|
130689
130700
|
...failure7.permanent ? { permanent: true } : {},
|
|
130690
130701
|
...scope ? { scope } : {},
|
|
130691
130702
|
...ran?.model ? { model: ran.model } : {},
|
|
130703
|
+
...failure7.setup ? { setup: true } : {},
|
|
130692
130704
|
...failure7.kind === "auth_failed" && failedCandidate ? { reportedSignedIn: failedCandidate.snapshot.state === "available" && failedCandidate.snapshot.authenticated === true } : {}
|
|
130693
130705
|
}
|
|
130694
130706
|
);
|
|
@@ -130895,19 +130907,19 @@ function roomEngineFailover(turn, completion, room, profile, candidates, failedC
|
|
|
130895
130907
|
}];
|
|
130896
130908
|
}
|
|
130897
130909
|
function failoverPick(turn, profile, projected, candidates, failedCandidate, restingNamed, attempt) {
|
|
130898
|
-
const tried = new Set(attempt.tried);
|
|
130910
|
+
const tried = new Set(attempt.tried), uncounted = uncountedTry(turn, engineRests.active(), needsPerson);
|
|
130899
130911
|
const tier = turnTier(profile, turn.threadId);
|
|
130900
130912
|
const plan = enginePlan(profile, turn.threadId, tier);
|
|
130901
130913
|
const required2 = plan.modelClass;
|
|
130902
130914
|
const neededClass = attempt.persist ? required2 : failedCandidate ? pinnedClass(failedCandidate, attempt.selection.model, tier) : required2;
|
|
130903
130915
|
const computer = projected ? turnComputer(projected, turn.threadId, attempt.runOn) : void 0;
|
|
130904
|
-
const subscriptionMove = isSubscriptionBot(profile) ? triesSpent(tried,
|
|
130916
|
+
const subscriptionMove = isSubscriptionBot(profile) ? triesSpent(tried, uncounted) || !projected ? { line: subscriptionLine(profile, candidates) } : subscriptionPlacement({ profile, projected, candidates, tried: /* @__PURE__ */ new Set([...tried, turn.instanceId]), auto: attempt.persist, modelClass: neededClass }) : void 0;
|
|
130905
130917
|
if (subscriptionMove && !subscriptionMove.choice) return { line: subscriptionMove.line };
|
|
130906
130918
|
const personalTurn = isPersonalBot(profile) && !subscriptionMove;
|
|
130907
|
-
const personalMove = subscriptionMove?.choice ? { choice: { selection: subscriptionMove.choice.selection, candidate: subscriptionMove.choice.candidate, step: 0, band: "subscription" }, line: "" } : personalTurn ? triesSpent(tried,
|
|
130919
|
+
const personalMove = subscriptionMove?.choice ? { choice: { selection: subscriptionMove.choice.selection, candidate: subscriptionMove.choice.candidate, step: 0, band: "subscription" }, line: "" } : personalTurn ? triesSpent(tried, uncounted) || !projected ? { line: personalLine(candidates, false) } : personalPlacement({ profile, projected, candidates, tried, needs: { tools: true, vision: attempt.vision }, modelClass: neededClass, computer }) : void 0;
|
|
130908
130920
|
if (personalMove && !personalMove.choice) return { line: personalMove.line };
|
|
130909
130921
|
const resting = (candidate, model2) => engineResting(candidate, model2) || model2 === attempt.selection.model && !!failedCandidate && sameRoute(candidate, failedCandidate);
|
|
130910
|
-
const resolution = personalMove || triesSpent(tried,
|
|
130922
|
+
const resolution = personalMove || triesSpent(tried, uncounted) || !projected ? { skipped: [] } : resolveFailover({
|
|
130911
130923
|
ladder: plan.ladder,
|
|
130912
130924
|
classLadder: (modelClass) => classLadder(classedModels(), modelClass),
|
|
130913
130925
|
failed: attempt.selection,
|
|
@@ -130951,7 +130963,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
130951
130963
|
restingNamed,
|
|
130952
130964
|
failedInstanceId: turn.instanceId,
|
|
130953
130965
|
alreadyTried: attempt.tried,
|
|
130954
|
-
triedCount: [...tried].filter((instanceId) => !
|
|
130966
|
+
triedCount: [...tried].filter((instanceId) => !uncounted(instanceId)).length,
|
|
130955
130967
|
cannotDrive: cannotDriveNamed(candidates, resolution.skipped, computer),
|
|
130956
130968
|
policy: connectionRunOutPolicy(cfg.engineTiers),
|
|
130957
130969
|
paidApproved: Boolean(payPerUse.current()?.keptGoingAt),
|
|
@@ -27146,7 +27146,8 @@ var init_engine_failure = __esm({
|
|
|
27146
27146
|
// Codex: "You've hit your usage limit. Upgrade to Pro ... or try again in 2 days 4 hours";
|
|
27147
27147
|
// Cursor: "You've hit your usage limit for this month".
|
|
27148
27148
|
/\busage limit\b/i,
|
|
27149
|
-
/\bhit your (
|
|
27149
|
+
/\bhit your (?:[\w-]+ )?limit\b/i,
|
|
27150
|
+
// \"hit your 5-hour limit · resets 3:50am\" (Claude Code, 2026-11-22)
|
|
27150
27151
|
/\b(?:5-hour|five-hour|hourly|weekly|daily|monthly|session|opus|sonnet) (?:usage )?limit (?:reached|exceeded|hit)\b/i,
|
|
27151
27152
|
/\blimit reached\b[^.]*\breset/i,
|
|
27152
27153
|
// OpenAI API: "You exceeded your current quota, please check your plan and billing details." (insufficient_quota);
|
|
@@ -27157,7 +27158,7 @@ var init_engine_failure = __esm({
|
|
|
27157
27158
|
/\bplan limit\b|\blimit (?:of|for) your (?:plan|subscription)\b/i,
|
|
27158
27159
|
// Anthropic API: "Your credit balance is too low to access the Anthropic API."
|
|
27159
27160
|
// xAI: "Your team ... has either used all available credits or reached its monthly spending limit."
|
|
27160
|
-
/\bcredit balance (?:is )?too low\b|\binsufficient (?:\w+ )?(?:credits?|balance|funds)\b|\b(?:out|run out) of credits\b/i,
|
|
27161
|
+
/\bcredit balance (?:is )?too low\b|\binsufficient (?:\w+ )?(?:credits?|balance|funds)\b|\b(?:out|run out) of (?:usage )?credits\b/i,
|
|
27161
27162
|
/\bused all (?:available |of your )?credits\b|\bno credits? (?:left|remaining)\b|\bspending limit\b/i,
|
|
27162
27163
|
/\bexhausted your (?:\w+ )?quota\b/i,
|
|
27163
27164
|
/\bquota\b[^.]{0,60}\b(?:exceeded|exhausted|reached|used up)\b|\b(?:exceeded|exhausted|reached)\b[^.]{0,40}\bquota\b/i,
|
|
@@ -27200,7 +27201,8 @@ var init_engine_failure = __esm({
|
|
|
27200
27201
|
/\b(?:token|session|credentials?) (?:has |have )?expired\b|\bexpired (?:token|session|credentials?)\b/i
|
|
27201
27202
|
];
|
|
27202
27203
|
STALLED = [
|
|
27203
|
-
/\bwent fully silent\b[^.]{0,80}\bturn was stopped\b/i
|
|
27204
|
+
/\bwent fully silent\b[^.]{0,80}\bturn was stopped\b|\bGateway inaccessible\b/i
|
|
27205
|
+
// the second: Hermes `acp` could not reach or start its gateway service, so it is not responding (2026-11-22)
|
|
27204
27206
|
];
|
|
27205
27207
|
OPAQUE_REQUEST_REJECTION = /^Internal error: Bad Request \(session\/prompt\b/;
|
|
27206
27208
|
LOG_AUTH_FAILED = [
|
package/dist-server/pair-cli.js
CHANGED
|
@@ -27146,7 +27146,8 @@ var init_engine_failure = __esm({
|
|
|
27146
27146
|
// Codex: "You've hit your usage limit. Upgrade to Pro ... or try again in 2 days 4 hours";
|
|
27147
27147
|
// Cursor: "You've hit your usage limit for this month".
|
|
27148
27148
|
/\busage limit\b/i,
|
|
27149
|
-
/\bhit your (
|
|
27149
|
+
/\bhit your (?:[\w-]+ )?limit\b/i,
|
|
27150
|
+
// \"hit your 5-hour limit · resets 3:50am\" (Claude Code, 2026-11-22)
|
|
27150
27151
|
/\b(?:5-hour|five-hour|hourly|weekly|daily|monthly|session|opus|sonnet) (?:usage )?limit (?:reached|exceeded|hit)\b/i,
|
|
27151
27152
|
/\blimit reached\b[^.]*\breset/i,
|
|
27152
27153
|
// OpenAI API: "You exceeded your current quota, please check your plan and billing details." (insufficient_quota);
|
|
@@ -27157,7 +27158,7 @@ var init_engine_failure = __esm({
|
|
|
27157
27158
|
/\bplan limit\b|\blimit (?:of|for) your (?:plan|subscription)\b/i,
|
|
27158
27159
|
// Anthropic API: "Your credit balance is too low to access the Anthropic API."
|
|
27159
27160
|
// xAI: "Your team ... has either used all available credits or reached its monthly spending limit."
|
|
27160
|
-
/\bcredit balance (?:is )?too low\b|\binsufficient (?:\w+ )?(?:credits?|balance|funds)\b|\b(?:out|run out) of credits\b/i,
|
|
27161
|
+
/\bcredit balance (?:is )?too low\b|\binsufficient (?:\w+ )?(?:credits?|balance|funds)\b|\b(?:out|run out) of (?:usage )?credits\b/i,
|
|
27161
27162
|
/\bused all (?:available |of your )?credits\b|\bno credits? (?:left|remaining)\b|\bspending limit\b/i,
|
|
27162
27163
|
/\bexhausted your (?:\w+ )?quota\b/i,
|
|
27163
27164
|
/\bquota\b[^.]{0,60}\b(?:exceeded|exhausted|reached|used up)\b|\b(?:exceeded|exhausted|reached)\b[^.]{0,40}\bquota\b/i,
|
|
@@ -27200,7 +27201,8 @@ var init_engine_failure = __esm({
|
|
|
27200
27201
|
/\b(?:token|session|credentials?) (?:has |have )?expired\b|\bexpired (?:token|session|credentials?)\b/i
|
|
27201
27202
|
];
|
|
27202
27203
|
STALLED = [
|
|
27203
|
-
/\bwent fully silent\b[^.]{0,80}\bturn was stopped\b/i
|
|
27204
|
+
/\bwent fully silent\b[^.]{0,80}\bturn was stopped\b|\bGateway inaccessible\b/i
|
|
27205
|
+
// the second: Hermes `acp` could not reach or start its gateway service, so it is not responding (2026-11-22)
|
|
27204
27206
|
];
|
|
27205
27207
|
OPAQUE_REQUEST_REJECTION = /^Internal error: Bad Request \(session\/prompt\b/;
|
|
27206
27208
|
LOG_AUTH_FAILED = [
|
|
@@ -5,9 +5,24 @@
|
|
|
5
5
|
// the harness decides, per call, which accounts this bot may use.
|
|
6
6
|
//
|
|
7
7
|
// stdout is the MCP transport. Never log there.
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
8
9
|
import readline from "node:readline";
|
|
9
10
|
const HARNESS = process.env.OMB_HARNESS_URL ?? "http://127.0.0.1:8799";
|
|
10
|
-
const
|
|
11
|
+
const TOKEN_FILE = process.env.OMB_ACCOUNTS_TOKEN_FILE ?? "";
|
|
12
|
+
const SPAWN_TOKEN = process.env.OMB_ACCOUNTS_TOKEN ?? "";
|
|
13
|
+
// Read per call: the harness rewrites the file each turn, and a pooled engine
|
|
14
|
+
// keeps this process across turns, so the spawn-time token is revoked by turn
|
|
15
|
+
// two and every call would answer "this turn's tool access has expired".
|
|
16
|
+
const token = () => {
|
|
17
|
+
if (!TOKEN_FILE)
|
|
18
|
+
return SPAWN_TOKEN;
|
|
19
|
+
try {
|
|
20
|
+
return readFileSync(TOKEN_FILE, "utf8").trim() || SPAWN_TOKEN;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return SPAWN_TOKEN;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
11
26
|
const TIMEOUT_MS = 3 * 60_000;
|
|
12
27
|
const MAX_RESPONSE_BYTES = 1024 * 1024;
|
|
13
28
|
const send = (message) => process.stdout.write(`${JSON.stringify(message)}\n`);
|
|
@@ -17,7 +32,7 @@ const textResult = (text, isError = false) => ({ content: [{ type: "text", text
|
|
|
17
32
|
async function harness(path, init = {}) {
|
|
18
33
|
const response = await fetch(`${HARNESS}${path}`, {
|
|
19
34
|
...init,
|
|
20
|
-
headers: { "content-type": "application/json", authorization: `Bearer ${
|
|
35
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${token()}` },
|
|
21
36
|
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
22
37
|
});
|
|
23
38
|
const text = await response.text();
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
//
|
|
1
|
+
// A spawned proxy's current bearer, on disk. The harness rewrites it every
|
|
2
2
|
// turn; the proxy reads it per call. An ACP engine keeps the proxy process it
|
|
3
3
|
// connected at session/new for the whole pooled session (Hermes skips
|
|
4
4
|
// already-connected MCP names on session/load), so a token carried only in
|
|
5
|
-
// the spawn environment is revoked by turn two and every
|
|
6
|
-
// answers INTERNAL_CAPABILITY_EXPIRED until the session idles out.
|
|
5
|
+
// the spawn environment is revoked by turn two and every tool call through
|
|
6
|
+
// that proxy answers INTERNAL_CAPABILITY_EXPIRED until the session idles out.
|
|
7
|
+
// Applies to every turn-scoped proxy (agents, accounts, phone, browser). Same
|
|
7
8
|
// pattern as the Claude driver's hook tokens; never exported in a backup.
|
|
8
9
|
import { createHash } from "node:crypto";
|
|
9
10
|
import { mkdirSync } from "node:fs";
|
|
10
11
|
import { join } from "node:path";
|
|
11
12
|
import { writeFileAtomic } from "./atomic.js";
|
|
12
13
|
import { DATA_DIR } from "./config.js";
|
|
13
|
-
|
|
14
|
+
// "agents" keeps its historical bare name so a pooled agents proxy spawned by
|
|
15
|
+
// an older harness build still finds its file after an update.
|
|
16
|
+
export function agentsTokenFile(botId, threadId, dataDir = DATA_DIR, kind = "agents") {
|
|
14
17
|
const digest = createHash("sha256").update(`${botId}\0${threadId}`).digest("hex").slice(0, 24);
|
|
15
|
-
return join(dataDir, "agents-tokens", `${digest}.token`);
|
|
18
|
+
return join(dataDir, "agents-tokens", kind === "agents" ? `${digest}.token` : `${digest}.${kind}.token`);
|
|
16
19
|
}
|
|
17
20
|
/** Writes this turn's token (0600) and returns the path the proxy reads. */
|
|
18
|
-
export function writeAgentsTokenFile(botId, threadId, token, dataDir = DATA_DIR) {
|
|
19
|
-
const path = agentsTokenFile(botId, threadId, dataDir);
|
|
21
|
+
export function writeAgentsTokenFile(botId, threadId, token, dataDir = DATA_DIR, kind = "agents") {
|
|
22
|
+
const path = agentsTokenFile(botId, threadId, dataDir, kind);
|
|
20
23
|
mkdirSync(join(dataDir, "agents-tokens"), { recursive: true, mode: 0o700 });
|
|
21
24
|
writeFileAtomic(path, token, { mode: 0o600 });
|
|
22
25
|
return path;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Per-turn MCP entry point. Only a scoped browser capability crosses into the
|
|
2
2
|
// agent process; engine commands, session names, and credentials stay in OMB.
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
3
4
|
import { pathToFileURL } from "node:url";
|
|
4
5
|
const MAX_INPUT_BYTES = 1_048_576;
|
|
5
6
|
const MAX_OUTPUT_BYTES = 16_777_216;
|
|
@@ -75,7 +76,22 @@ export async function browserProxyRequest(frame, connection) {
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
function run() {
|
|
78
|
-
const
|
|
79
|
+
const url = process.env.OMB_HARNESS_URL ?? "";
|
|
80
|
+
const spawnToken = process.env.OMB_BROWSER_TOKEN ?? "";
|
|
81
|
+
const tokenFile = process.env.OMB_BROWSER_TOKEN_FILE ?? "";
|
|
82
|
+
// Read per call: the harness rewrites the file each turn, and a pooled
|
|
83
|
+
// engine keeps this process across turns, so the spawn-time token is
|
|
84
|
+
// revoked by turn two.
|
|
85
|
+
const connection = () => {
|
|
86
|
+
let token = spawnToken;
|
|
87
|
+
if (tokenFile) {
|
|
88
|
+
try {
|
|
89
|
+
token = readFileSync(tokenFile, "utf8").trim() || spawnToken;
|
|
90
|
+
}
|
|
91
|
+
catch { /* fall back */ }
|
|
92
|
+
}
|
|
93
|
+
return { url, token };
|
|
94
|
+
};
|
|
79
95
|
let input = Buffer.alloc(0);
|
|
80
96
|
let pending = 0;
|
|
81
97
|
const output = (message) => {
|
|
@@ -118,7 +134,7 @@ function run() {
|
|
|
118
134
|
continue;
|
|
119
135
|
}
|
|
120
136
|
pending++;
|
|
121
|
-
void browserProxyRequest(frame, connection).then(output).finally(() => { pending--; });
|
|
137
|
+
void browserProxyRequest(frame, connection()).then(output).finally(() => { pending--; });
|
|
122
138
|
}
|
|
123
139
|
if (input.length > MAX_INPUT_BYTES) {
|
|
124
140
|
process.stdin.destroy();
|
|
@@ -134,7 +134,9 @@ export function finalizeConnectionCapPick(input) {
|
|
|
134
134
|
return { line: transientThrottleStopLine(input.currentLabel), category: "failover_exhausted" };
|
|
135
135
|
}
|
|
136
136
|
const { choice } = input;
|
|
137
|
-
|
|
137
|
+
// An engine's own error text passes through only while the turn may still
|
|
138
|
+
// move; at the cap the person gets the plain stopped line, not raw text.
|
|
139
|
+
if (!choice && input.failureKind === "provider_error" && input.triedCount < MAX_ENGINES_PER_TURN)
|
|
138
140
|
return { passthrough: true };
|
|
139
141
|
if (!choice) {
|
|
140
142
|
if (input.pausedUntil !== undefined && input.skipped.some((skip) => skip.reason === "paused")) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// First-party Android phone MCP server. It deliberately accepts physical USB
|
|
2
2
|
// devices only: no emulators, wireless debugging, network ADB, or Tailscale.
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
-
import { accessSync, constants, existsSync } from "node:fs";
|
|
4
|
+
import { accessSync, constants, existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { createInterface } from "node:readline";
|
|
6
6
|
import { delimiter, join } from "node:path";
|
|
7
7
|
import { homedir } from "node:os";
|
|
@@ -252,18 +252,32 @@ const textResult = (text, isError = false) => ({ content: [{ type: "text", text
|
|
|
252
252
|
// is idempotent; a blocked caller can retry once the holding turn settles.
|
|
253
253
|
export function createPhoneClaim(env = process.env, fetchImpl = fetch) {
|
|
254
254
|
const url = env.OMB_HARNESS_URL?.trim();
|
|
255
|
-
const
|
|
256
|
-
|
|
255
|
+
const spawnToken = env.OMB_PHONE_TOKEN?.trim() ?? "";
|
|
256
|
+
const tokenFile = env.OMB_PHONE_TOKEN_FILE?.trim() ?? "";
|
|
257
|
+
if (!url || (!spawnToken && !tokenFile)) {
|
|
257
258
|
// Spawned outside the harness (development, direct debugging): no
|
|
258
259
|
// exclusivity to enforce, exactly the behavior this proxy always had.
|
|
259
260
|
return async () => ({ ok: true });
|
|
260
261
|
}
|
|
262
|
+
// Read per call: the harness rewrites the file each turn, and a pooled
|
|
263
|
+
// engine keeps this process across turns, so the spawn-time token is
|
|
264
|
+
// revoked by turn two.
|
|
265
|
+
const token = () => {
|
|
266
|
+
if (!tokenFile)
|
|
267
|
+
return spawnToken;
|
|
268
|
+
try {
|
|
269
|
+
return readFileSync(tokenFile, "utf8").trim() || spawnToken;
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
return spawnToken;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
261
275
|
return async () => {
|
|
262
276
|
try {
|
|
263
277
|
const response = await fetchImpl(new URL("/api/internal/phone/claim", url), {
|
|
264
278
|
method: "POST",
|
|
265
279
|
redirect: "error",
|
|
266
|
-
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
|
|
280
|
+
headers: { authorization: `Bearer ${token()}`, "content-type": "application/json" },
|
|
267
281
|
body: "{}",
|
|
268
282
|
signal: AbortSignal.timeout(10_000),
|
|
269
283
|
});
|
|
@@ -51,6 +51,11 @@ export function triesSpent(tried, needsPerson) {
|
|
|
51
51
|
const all = [...tried];
|
|
52
52
|
return all.length >= MAX_ENGINES_WALKED || all.filter((instanceId) => !needsPerson(instanceId)).length >= MAX_ENGINES_PER_TURN;
|
|
53
53
|
}
|
|
54
|
+
/** The `needsPerson` of triesSpent widened: an engine that failed before
|
|
55
|
+
* accepting the prompt (session, gateway: `setup` on its rest, or on this
|
|
56
|
+
* turn's own failure) did not run the turn either, so it is not a try. */
|
|
57
|
+
export const uncountedTry = (turn, resting, needsPerson) => (instanceId) => needsPerson(instanceId) ||
|
|
58
|
+
(instanceId === turn.instanceId && turn.failure?.setup === true) || resting.some((entry) => entry.instanceId === instanceId && entry.setup === true);
|
|
54
59
|
const accountOf = (engine) => engine.snapshot.account?.email ?? engine.snapshot.account?.organization;
|
|
55
60
|
/** Another instance of the same engine on the same account (or on none): it
|
|
56
61
|
* sends a model down the route a failure just broke (two OpenCode instances
|
|
@@ -49,7 +49,7 @@ const USAGE_LIMITED = [
|
|
|
49
49
|
// Codex: "You've hit your usage limit. Upgrade to Pro ... or try again in 2 days 4 hours";
|
|
50
50
|
// Cursor: "You've hit your usage limit for this month".
|
|
51
51
|
/\busage limit\b/i,
|
|
52
|
-
/\bhit your (
|
|
52
|
+
/\bhit your (?:[\w-]+ )?limit\b/i, // \"hit your 5-hour limit · resets 3:50am\" (Claude Code, 2026-11-22)
|
|
53
53
|
/\b(?:5-hour|five-hour|hourly|weekly|daily|monthly|session|opus|sonnet) (?:usage )?limit (?:reached|exceeded|hit)\b/i,
|
|
54
54
|
/\blimit reached\b[^.]*\breset/i,
|
|
55
55
|
// OpenAI API: "You exceeded your current quota, please check your plan and billing details." (insufficient_quota);
|
|
@@ -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 (?:\w+ )?(?: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 (?:usage )?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,
|
|
@@ -121,7 +121,7 @@ const AUTH_FAILED = [
|
|
|
121
121
|
// the message and the turn was stopped." Drivers tag it structurally
|
|
122
122
|
// (runtime.error failure "stalled"); this reads the text form too.
|
|
123
123
|
const STALLED = [
|
|
124
|
-
/\bwent fully silent\b[^.]{0,80}\bturn was stopped\b/i,
|
|
124
|
+
/\bwent fully silent\b[^.]{0,80}\bturn was stopped\b|\bGateway inaccessible\b/i, // the second: Hermes `acp` could not reach or start its gateway service, so it is not responding (2026-11-22)
|
|
125
125
|
];
|
|
126
126
|
// OpenCode's ACP answer when its provider's API returned a bare 400: the
|
|
127
127
|
// JSON-RPC internal error with the provider's status text and nothing else,
|
|
@@ -181,6 +181,7 @@ export class EngineRestStore {
|
|
|
181
181
|
instanceId, ...(scope ? { scope } : {}), ...(account ? { account } : {}), reason, since: active?.since ?? now,
|
|
182
182
|
until: restUntil, count,
|
|
183
183
|
...(reason === "auth_failed" ? { needsSignIn: true } : {}),
|
|
184
|
+
...(detail.setup ? { setup: true } : {}),
|
|
184
185
|
...(keyExpired ? { keyExpired: true } : {}),
|
|
185
186
|
...(reason === "auth_failed" && detail.reportedSignedIn !== undefined ? { reportedSignedIn: detail.reportedSignedIn } : {}),
|
|
186
187
|
...(reason === "auth_failed" && active?.sawSignedOut ? { sawSignedOut: true } : {}),
|
|
@@ -16,6 +16,9 @@ export class EventBus {
|
|
|
16
16
|
gate = null;
|
|
17
17
|
unsubscribes = new Map();
|
|
18
18
|
pendingLogWarnings = new Map();
|
|
19
|
+
/** Events already in the canonical log: a held event released later by the
|
|
20
|
+
* gate is the same object, logged once. */
|
|
21
|
+
recorded = new WeakSet();
|
|
19
22
|
appendLog;
|
|
20
23
|
constructor(appendLog = appendFileSync) {
|
|
21
24
|
this.appendLog = appendLog;
|
|
@@ -44,12 +47,14 @@ export class EventBus {
|
|
|
44
47
|
this.record(event);
|
|
45
48
|
const deliveries = this.gate ? this.gate(event) : [event];
|
|
46
49
|
for (const delivery of deliveries) {
|
|
47
|
-
|
|
48
|
-
this.record(delivery);
|
|
50
|
+
this.record(delivery);
|
|
49
51
|
this.deliver(delivery);
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
record(event) {
|
|
55
|
+
if (this.recorded.has(event))
|
|
56
|
+
return;
|
|
57
|
+
this.recorded.add(event);
|
|
53
58
|
const pendingWarning = this.pendingLogWarnings.get(event.threadId);
|
|
54
59
|
const persistedEvents = pendingWarning ? [pendingWarning, redactSecrets(event)] : [redactSecrets(event)];
|
|
55
60
|
try {
|
|
@@ -327,7 +327,7 @@ import { createNexusMemoryRoutes, NexusImportOffer } from "./routes/nexus-memory
|
|
|
327
327
|
import { createBoardRoutes } from "./routes/board.js";
|
|
328
328
|
import { readBoardFromNexus } from "./board/nexus-board.js";
|
|
329
329
|
import { LocalModelInventory, localModePlacement, machineMemory } from "./local-models-mode.js";
|
|
330
|
-
import { eventBase, restTime, FailoverGate, MAX_ENGINES_PER_TURN, triesSpent, continuationNote, restingLine, restingOnRoute, sameRoute } from "./engine-failover.js";
|
|
330
|
+
import { eventBase, restTime, FailoverGate, MAX_ENGINES_PER_TURN, triesSpent, uncountedTry, continuationNote, restingLine, restingOnRoute, sameRoute } from "./engine-failover.js";
|
|
331
331
|
import { connectionRunOutPolicy, finalizeConnectionCapPick, finalizeNewTurnPlacement, pauseKeyBandForRunOut } from "./connection-cap-failover.js";
|
|
332
332
|
import { TURN_ERROR_CATEGORIES } from "../shared/runtime-events.js";
|
|
333
333
|
import { EngineProbes, PROBE_PROMPT, isProbeThread, probeThreadId } from "./engine-probe.js";
|
|
@@ -2094,7 +2094,7 @@ async function browserIntegration(botId, profile, turn) {
|
|
|
2094
2094
|
kind: "browser", depth: 0, skillAuthoring: false, createdBots: 0, openedThreads: 0 });
|
|
2095
2095
|
return { profile: partitionId, session, spec, integration: {
|
|
2096
2096
|
command: process.execPath, args: [SPAWNED_PROXIES.browser], env: {
|
|
2097
|
-
...AGENTS_NODE_FLAG, OMB_BROWSER_TOKEN: token, OMB_HARNESS_URL: `http://127.0.0.1:${PORT}`,
|
|
2097
|
+
...AGENTS_NODE_FLAG, OMB_BROWSER_TOKEN: token, OMB_BROWSER_TOKEN_FILE: writeAgentsTokenFile(botId, turn.threadId, token, undefined, "browser"), OMB_HARNESS_URL: `http://127.0.0.1:${PORT}`,
|
|
2098
2098
|
},
|
|
2099
2099
|
} };
|
|
2100
2100
|
}
|
|
@@ -2125,7 +2125,7 @@ function phoneIntegration(botId, threadId, generation) {
|
|
|
2125
2125
|
});
|
|
2126
2126
|
const env = {
|
|
2127
2127
|
...AGENTS_NODE_FLAG,
|
|
2128
|
-
OMB_PHONE_TOKEN: token,
|
|
2128
|
+
OMB_PHONE_TOKEN: token, OMB_PHONE_TOKEN_FILE: writeAgentsTokenFile(botId, threadId, token, undefined, "phone"),
|
|
2129
2129
|
OMB_HARNESS_URL: `http://127.0.0.1:${PORT}`,
|
|
2130
2130
|
};
|
|
2131
2131
|
if (process.env.OMB_ADB_PATH)
|
|
@@ -2153,7 +2153,7 @@ function accountsIntegration(botId, threadId, generation) {
|
|
|
2153
2153
|
return {
|
|
2154
2154
|
command: process.execPath,
|
|
2155
2155
|
args: [SPAWNED_PROXIES.accounts],
|
|
2156
|
-
env: { ...AGENTS_NODE_FLAG, OMB_ACCOUNTS_TOKEN: token, OMB_HARNESS_URL: `http://127.0.0.1:${PORT}` },
|
|
2156
|
+
env: { ...AGENTS_NODE_FLAG, OMB_ACCOUNTS_TOKEN: token, OMB_ACCOUNTS_TOKEN_FILE: writeAgentsTokenFile(botId, threadId, token, undefined, "accounts"), OMB_HARNESS_URL: `http://127.0.0.1:${PORT}` },
|
|
2157
2157
|
readOnlyTools: ACCOUNT_TOOLS.filter((tool) => isReadOnlyAccountTool(tool.name)).map((tool) => tool.name),
|
|
2158
2158
|
askTools: ACCOUNT_TOOLS.filter((tool) => !isReadOnlyAccountTool(tool.name)).map((tool) => tool.name),
|
|
2159
2159
|
};
|
|
@@ -3652,7 +3652,7 @@ function engineFailover(turn, completion) {
|
|
|
3652
3652
|
// the rest names no provider, so Atomic Engine skips the account too.
|
|
3653
3653
|
const scope = failure.kind === "stalled" || failure.permanent || !failedCandidate ? undefined : restScope(failedCandidate, ran?.model) ?? refusedModelScope(failure.message, ran?.model);
|
|
3654
3654
|
const restFailed = () => engineRests.rest(turn.instanceId, failedCandidate ? engineAccount(failedCandidate) : undefined, failure.kind, { resetAt: failure.resetAt, resetText: failure.resetText, windowMs: failure.windowMs, message: redactSecretsInText(failure.message),
|
|
3655
|
-
...(failure.permanent ? { permanent: true } : {}), ...(scope ? { scope } : {}), ...(ran?.model ? { model: ran.model } : {}),
|
|
3655
|
+
...(failure.permanent ? { permanent: true } : {}), ...(scope ? { scope } : {}), ...(ran?.model ? { model: ran.model } : {}), ...(failure.setup ? { setup: true } : {}),
|
|
3656
3656
|
...(failure.kind === "auth_failed" && failedCandidate ? { reportedSignedIn: failedCandidate.snapshot.state === "available" && failedCandidate.snapshot.authenticated === true } : {}) });
|
|
3657
3657
|
// Unknown failures rest only when the turn moves; otherwise preserve their report.
|
|
3658
3658
|
const rest = failure.kind === "provider_error" || failure.kind === "rate_limited" ? undefined : restFailed();
|
|
@@ -3841,7 +3841,7 @@ function roomEngineFailover(turn, completion, room, profile, candidates, failedC
|
|
|
3841
3841
|
* before a key), or the one line it stops with. Books pay-per-use for the
|
|
3842
3842
|
* move. Shared by a bot's own turns and room member turns. */
|
|
3843
3843
|
function failoverPick(turn, profile, projected, candidates, failedCandidate, restingNamed, attempt) {
|
|
3844
|
-
const tried = new Set(attempt.tried);
|
|
3844
|
+
const tried = new Set(attempt.tried), uncounted = uncountedTry(turn, engineRests.active(), needsPerson); // a setup failure is not a try
|
|
3845
3845
|
const tier = turnTier(profile, turn.threadId);
|
|
3846
3846
|
const plan = enginePlan(profile, turn.threadId, tier);
|
|
3847
3847
|
const required = plan.modelClass;
|
|
@@ -3851,7 +3851,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3851
3851
|
// provider on its side of the personal line; with none left it stops with
|
|
3852
3852
|
// its one line.
|
|
3853
3853
|
const subscriptionMove = isSubscriptionBot(profile)
|
|
3854
|
-
? triesSpent(tried,
|
|
3854
|
+
? triesSpent(tried, uncounted) || !projected
|
|
3855
3855
|
? { line: subscriptionLine(profile, candidates) }
|
|
3856
3856
|
: subscriptionPlacement({ profile, projected, candidates, tried: new Set([...tried, turn.instanceId]), auto: attempt.persist, modelClass: neededClass })
|
|
3857
3857
|
: undefined;
|
|
@@ -3863,7 +3863,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3863
3863
|
const personalMove = subscriptionMove?.choice
|
|
3864
3864
|
? { choice: { selection: subscriptionMove.choice.selection, candidate: subscriptionMove.choice.candidate, step: 0, band: "subscription" }, line: "" }
|
|
3865
3865
|
: personalTurn
|
|
3866
|
-
? triesSpent(tried,
|
|
3866
|
+
? triesSpent(tried, uncounted) || !projected
|
|
3867
3867
|
? { line: personalLine(candidates, false) }
|
|
3868
3868
|
: personalPlacement({ profile, projected, candidates, tried, needs: { tools: true, vision: attempt.vision }, modelClass: neededClass, computer })
|
|
3869
3869
|
: undefined;
|
|
@@ -3872,7 +3872,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3872
3872
|
// Every bot, pinned or not and of any tier, falls to the next subscription
|
|
3873
3873
|
// the person has, in any class, before a pay-per-use key (resolveFailover).
|
|
3874
3874
|
const resting = (candidate, model) => engineResting(candidate, model) || (model === attempt.selection.model && !!failedCandidate && sameRoute(candidate, failedCandidate));
|
|
3875
|
-
const resolution = personalMove || triesSpent(tried,
|
|
3875
|
+
const resolution = personalMove || triesSpent(tried, uncounted) || !projected ? { skipped: [] } : resolveFailover({
|
|
3876
3876
|
ladder: plan.ladder,
|
|
3877
3877
|
classLadder: (modelClass) => classLadder(classedModels(), modelClass),
|
|
3878
3878
|
failed: attempt.selection,
|
|
@@ -3896,7 +3896,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3896
3896
|
return finalizeConnectionCapPick({
|
|
3897
3897
|
choice, subscriptionLine: subscriptionMove?.line, failureKind: turn.failure?.kind,
|
|
3898
3898
|
pausedUntil: payPerUse.pausedUntil(), skipped: resolution.skipped, payPerUsePausedLine, restingNamed,
|
|
3899
|
-
failedInstanceId: turn.instanceId, alreadyTried: attempt.tried, triedCount: [...tried].filter((instanceId) => !
|
|
3899
|
+
failedInstanceId: turn.instanceId, alreadyTried: attempt.tried, triedCount: [...tried].filter((instanceId) => !uncounted(instanceId)).length,
|
|
3900
3900
|
cannotDrive: cannotDriveNamed(candidates, resolution.skipped, computer),
|
|
3901
3901
|
policy: connectionRunOutPolicy(cfg.engineTiers), paidApproved: Boolean(payPerUse.current()?.keptGoingAt),
|
|
3902
3902
|
local: Boolean(placed.local), currentLabel: engineLabel(candidates, attempt.selection),
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-BeSGZMCl.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as r,s as e}from"./flowDiagram-KWPJA3E3-ByZ1IyAE.js";import{_ as a}from"./mermaid.core-BeSGZMCl.js";import"./chunk-5VM5RSS4-kUQxxDSH.js";import"./chunk-XXDRQBXY-BhPdm5u4.js";import"./chunk-WEXAMYUT-1i-fNDpg.js";import"./chunk-GWA4HPMP-ivlnCC25.js";import"./channel-D3ihDYTR.js";import"./index-Tw4-5a-J.js";var o=a(t=>`${e(t)}
|
|
2
|
-
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
-
stroke: ${t.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),s=o,u=r({styles:s});export{u as diagram};
|