@chibitek/chibi 0.1.184 → 0.1.186
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/{abnfDiagram-O67JEVCF-D63grDEy.js → abnfDiagram-O67JEVCF-T4rFqxxY.js} +1 -1
- package/dist/assets/{arc-bQvylCdS.js → arc-BE0n08tb.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-BOAFaaj7.js → architectureDiagram-NJMV4G6O-W248FhnN.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-ewLAgFlb.js → blockDiagram-BEXU5L5S-YQUaYL76.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-Dn_C6A7b.js → c4Diagram-YGBWAQC7-DvtNnJ7Q.js} +1 -1
- package/dist/assets/channel-DhsCc8Nd.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-DpB_wNSI.js → chunk-2Q5K7J3B-r9zB0AN4.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-DIelvlCV.js → chunk-3FUC2YCW-DcaWZ44l.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-O-aALIul.js → chunk-5VM5RSS4-B9BoCCOM.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-Dqe5r4Ji.js → chunk-GTNCS2PH-jiyufqr5.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-FzFr6U_I.js → chunk-GWA4HPMP-86KjuKSi.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BuJO0Fyh.js → chunk-JWPE2WC7-P-CZmlpX.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-DMgFuMgZ.js → chunk-NETBCI7D-DOwQkah7.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-BYXYAyMu.js → chunk-WEXAMYUT-BYpUWdau.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-s_OT2iv7.js → chunk-XXDRQBXY-BNWicp85.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-Cdbr4CZV.js → classDiagram-v2-NBCMYWYE-DeSoK71a.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-CXjx4058.js → cose-bilkent-JH36ORCC-DRvyy4x6.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-Cc2YqzW6.js → cynefin-OW5HDTMX-BPgTdM9o.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-Cze_i1Vk.js → cynefinDiagram-VND7K2PF-CVqWmCzX.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-oPouQ7XU.js → dagre-6A5THRUB-C8Nn1Pd7.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-DNRc977u.js → diagram-22UHCM2B-BoFPCHMw.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-B8vBo05Y.js → diagram-3UASUU5V-Bw55J1mb.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-dCch9eKa.js → diagram-ATOU4E4O-DGQrBqML.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-CYJSen9G.js → diagram-CDSNMT55-COdY5ptf.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-RxYVGgc6.js → diagram-MLGK6HIB-BPZDoncY.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-B-UyrObe.js → diagram-MPIPVDR6-Fi29WkCR.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-CxGXwVT7.js → ebnfDiagram-ZINNZB2B-BXquz6x1.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-CHGRRKuJ.js → elk-276RUBZZ-C_e9eijP.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-BMJusoDl.js → erDiagram-OPXOYQCR-C4PKtrfT.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-DtiBETZe.js → flowDiagram-KWPJA3E3-BlEulfZP.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-DAXqRUQM.js → ganttDiagram-FUAMR5RP-BksDszQx.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-Cx_M7do1.js → gitGraphDiagram-X574FWY7-EYJKMot5.js} +1 -1
- package/dist/assets/{index-COCy7XsD.js → index-Bf2yMkX_.js} +5 -5
- package/dist/assets/{index-DKt9qb9g.js → index-Do0zrygp.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-CNgfLxed.js → infoDiagram-VRGFBTTK-BuX8YJRd.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-BvdGqyOz.js → ishikawaDiagram-OU5B5YK6-BOOBBq5e.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-atzjOsJ2.js → journeyDiagram-ZHPQQLJL-2VfxHa4O.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-miq8ywtS.js → kanban-definition-PNTS6WVX-DniBc17b.js} +1 -1
- package/dist/assets/{linear-3skQIwEd.js → linear-CrF1eGjn.js} +1 -1
- package/dist/assets/{mermaid.core-CcefVt63.js → mermaid.core-BL_dHjXO.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-CyJLiFXW.js → mindmap-definition-NLK3R4M7-DUGzdUse.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-DdBX63bl.js → pegDiagram-GJSIUBJH-CO3xT6J0.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-DNO9-2f5.js → pieDiagram-5QR66LMP-8gmuAKxu.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-BciZP71K.js → quadrantDiagram-O4NWA36T-D0I0xUDm.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-4IdVOKPa.js → railroadDiagram-XR7U4H2S-DY0BvxgQ.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-DFdsFYy-.js → requirementDiagram-PLB6GJNP-DhGe1AaP.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-HH2WFlmw.js → sankeyDiagram-IPEJSGJF-CeCrbMFN.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-CP91Sy-s.js → sequenceDiagram-PO4LG4MO-fWSeitKd.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-DhZiuL4S.js → sizeCapture-INFHLROL-Dtg_1bqe.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-DIa0uzhR.js → stateDiagram-v2-GCMORJYK-DGUAiQQE.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-CXr7kql9.js → swimlanes-2SLR337P-DebVwPYw.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-B5p2N9qd.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-BidOWl1X.js → timeline-definition-EJHVYXUP-Dg7oYgtr.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-Dt0DqsBc.js → usecaseDiagram-POWQR4AR-uqTnPXSC.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-DMfDgcZH.js → vennDiagram-UO4OBE2U-CzMUwXwR.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-jgsJZ4n4.js → wardleyDiagram-VNRHLVJA-BsyaKB_7.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-AllqBdcw.js → xychartDiagram-PMCCYNJV-7hUye0pF.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/index.js +961 -895
- package/dist-server/openmausbot.js +224 -176
- package/dist-server/pair-cli.js +224 -176
- package/dist-server/server/computer-stop-names.js +35 -0
- package/dist-server/server/connection-cap-failover.js +1 -1
- package/dist-server/server/container-computer.js +14 -17
- package/dist-server/server/drivers/claude-auth-status.js +25 -0
- package/dist-server/server/drivers/claude.js +6 -5
- package/dist-server/server/drivers/retry.js +1 -0
- package/dist-server/server/engine-failover.js +14 -5
- package/dist-server/server/engine-failure.js +4 -4
- package/dist-server/server/index.js +19 -19
- package/dist-server/server/injected-model-rest.js +9 -0
- package/dist-server/server/local-vm-start.js +22 -0
- package/dist-server/server/model-access-refusal.js +62 -0
- package/dist-server/server/vps-computer.js +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-DaRjZag9.js +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-CtuksGU4.js +0 -8
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// The names a stop line gives, on a turn that must drive a computer, for the
|
|
2
|
+
// engines a ladder passed over (restingLine's `computer` argument). Both stop
|
|
3
|
+
// paths use it: restingStop at a turn's start and finalizeConnectionCapPick
|
|
4
|
+
// mid-turn.
|
|
5
|
+
import { canDriveComputer, engineHealth } from "./engine-tiers.js";
|
|
6
|
+
/** Of these engines, which cannot drive `computer`, and which could but were
|
|
7
|
+
* skipped as signed out or unavailable before any rest was read (once
|
|
8
|
+
* dropped from the line, 2026-11-10, so "Codex needs sign-in" never showed).
|
|
9
|
+
* Each engine once, by display name.
|
|
10
|
+
*
|
|
11
|
+
* The ladder's own skip reason decides, so an engine it passed over for
|
|
12
|
+
* something else (refused, no model, resting) is never named as one sign-in
|
|
13
|
+
* away. An entry with no reason (the bot's own engine, which the ladder does
|
|
14
|
+
* not list) is read from its health. */
|
|
15
|
+
export function computerStopNames(candidates, skipped, computer) {
|
|
16
|
+
const names = { engines: [], signedOut: [], unavailable: [] };
|
|
17
|
+
const reasons = new Map();
|
|
18
|
+
for (const skip of skipped)
|
|
19
|
+
reasons.set(skip.instanceId, reasons.get(skip.instanceId) ?? skip.reason);
|
|
20
|
+
for (const [instanceId, reason] of reasons) {
|
|
21
|
+
const candidate = candidates.find((entry) => entry.instanceId === instanceId);
|
|
22
|
+
if (!candidate)
|
|
23
|
+
continue;
|
|
24
|
+
if (!canDriveComputer(candidate, computer)) {
|
|
25
|
+
names.engines.push(candidate.displayName);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const why = reason ?? engineHealth(candidate);
|
|
29
|
+
if (why === "signed-out")
|
|
30
|
+
names.signedOut.push(candidate.displayName);
|
|
31
|
+
else if (why === "unavailable")
|
|
32
|
+
names.unavailable.push(candidate.displayName);
|
|
33
|
+
}
|
|
34
|
+
return names;
|
|
35
|
+
}
|
|
@@ -155,7 +155,7 @@ export function finalizeConnectionCapPick(input) {
|
|
|
155
155
|
const named = input.restingNamed([input.failedInstanceId, ...input.alreadyTried, ...resting]);
|
|
156
156
|
return {
|
|
157
157
|
line: restingLine(named, input.formatTime, input.cannotDrive, { capped: input.triedCount >= MAX_ENGINES_PER_TURN }),
|
|
158
|
-
category: named.some((engine) => engine.needsSignIn || engine.keyExpired) ? "account" : "failover_exhausted",
|
|
158
|
+
category: named.some((engine) => engine.needsSignIn || engine.keyExpired) || input.cannotDrive?.signedOut?.length ? "account" : "failover_exhausted",
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
if (input.failureKind === "usage_limited") {
|
|
@@ -16,6 +16,8 @@ import { colimaStartPlan, dockerEnvForColima, startColima } from "./colima-docke
|
|
|
16
16
|
import { spawnOptionsFor } from "./spawn-command.js";
|
|
17
17
|
import { DATA_DIR } from "./config.js";
|
|
18
18
|
import { SPAWNED_PROXIES } from "./proxy-paths.js";
|
|
19
|
+
import { localVmStartableWhenStopped } from "./local-vm-start.js";
|
|
20
|
+
export { localVmStartableWhenStopped };
|
|
19
21
|
const run = promisify(execFile);
|
|
20
22
|
const SCREENSHOT_STATUS_TTL_MS = 10_000;
|
|
21
23
|
export const CUA_DRIVER_VERSION = "0.20.0";
|
|
@@ -312,9 +314,8 @@ function emptyStatus(platform, target) {
|
|
|
312
314
|
* Every other problem in `statusProblem` stays the person's call and returns
|
|
313
315
|
* false here: no runtime, daemon down, image never prepared, `create_supported`
|
|
314
316
|
* false, and any existing container — stale image, unmanaged, unsafe network,
|
|
315
|
-
* security or persistence. A stopped container is
|
|
316
|
-
*
|
|
317
|
-
* recreate rather than a start.
|
|
317
|
+
* security or persistence. A stopped container is not recreated either: it is
|
|
318
|
+
* started with its disk (`localVmStartableWhenStopped`).
|
|
318
319
|
*/
|
|
319
320
|
export function localVmRecreatableOnDemand(status) {
|
|
320
321
|
return Boolean(status.runtime)
|
|
@@ -323,17 +324,13 @@ export function localVmRecreatableOnDemand(status) {
|
|
|
323
324
|
&& status.container === "missing"
|
|
324
325
|
&& status.create_supported;
|
|
325
326
|
}
|
|
326
|
-
/** A stopped VM may contain installed applications and files outside the mount.
|
|
327
|
-
* Replacement requires an explicit removal; startup never discards its disk. */
|
|
328
|
-
export function localVmReplaceableWhenStopped(_status) {
|
|
329
|
-
return false;
|
|
330
|
-
}
|
|
331
327
|
/** Whether Auto may attach this Local VM without a person choosing it: the
|
|
332
|
-
* desktop is ready,
|
|
333
|
-
* recreated after idling away
|
|
334
|
-
*
|
|
328
|
+
* desktop is ready, its image is prepared and the container can simply be
|
|
329
|
+
* recreated after idling away, or it is stopped and can be started again.
|
|
330
|
+
* Anything else — no runtime, daemon down, image never prepared, an unmanaged
|
|
331
|
+
* or unsafe container — stays the person's call. */
|
|
335
332
|
export function autoLocalVmAttachable(status) {
|
|
336
|
-
return status.ready === true || localVmRecreatableOnDemand(status) ||
|
|
333
|
+
return status.ready === true || localVmRecreatableOnDemand(status) || localVmStartableWhenStopped(status);
|
|
337
334
|
}
|
|
338
335
|
function statusProblem(status) {
|
|
339
336
|
if (!status.runtime)
|
|
@@ -358,7 +355,7 @@ function statusProblem(status) {
|
|
|
358
355
|
if (status.persistence === "unsafe")
|
|
359
356
|
return "The existing Local VM is missing its durable workspace; recreate it";
|
|
360
357
|
if (status.container === "stopped")
|
|
361
|
-
return "The Local VM is stopped
|
|
358
|
+
return "The Local VM is stopped. Its disk and files are kept, and it starts again the next time a bot uses it.";
|
|
362
359
|
if (status.desktop_error)
|
|
363
360
|
return `The Local VM desktop failed to start: ${status.desktop_error}`;
|
|
364
361
|
if (!status.desktopReady)
|
|
@@ -630,8 +627,8 @@ function appleWorkspaceMountIsSafe(mounts, platform, expectedWorkspace) {
|
|
|
630
627
|
* runtime-specific capability exception is Podman's Firefox sandbox chroot.
|
|
631
628
|
* Callers also differ on restart policy — the VPS
|
|
632
629
|
* container must survive a reboot nobody is watching ("unless-stopped"),
|
|
633
|
-
* while the Local VM
|
|
634
|
-
*
|
|
630
|
+
* while the Local VM never starts by itself at boot: Atomic starts a stopped
|
|
631
|
+
* one when a turn or the person asks (localVmStartableWhenStopped). */
|
|
635
632
|
export function dockerSecurityIsHardened(config, options = {}) {
|
|
636
633
|
if (!config)
|
|
637
634
|
return false;
|
|
@@ -787,8 +784,8 @@ export async function containerComputerAction(action, runner = sh, platform = pr
|
|
|
787
784
|
if (action === "run" && !before.create_supported) {
|
|
788
785
|
throw Object.assign(new Error(before.problem ?? "This runtime cannot create a per-bot Local VM"), { status: 409 });
|
|
789
786
|
}
|
|
790
|
-
if (action === "start") {
|
|
791
|
-
throw Object.assign(new Error("This
|
|
787
|
+
if (action === "start" && !localVmStartableWhenStopped(before)) {
|
|
788
|
+
throw Object.assign(new Error(before.container === "stopped" ? before.problem ?? "This Local VM cannot be started; recreate it" : "The Local VM is not stopped"), {
|
|
792
789
|
status: 409,
|
|
793
790
|
});
|
|
794
791
|
}
|
|
@@ -1,4 +1,29 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
1
2
|
import { execCli } from "../procs.js";
|
|
3
|
+
/** Keep the CLI off the machine's Anthropic profile (the `ant` CLI's store,
|
|
4
|
+
* ~/.config/anthropic, chosen by `ANTHROPIC_PROFILE`) unless this account's
|
|
5
|
+
* own settings name one on purpose.
|
|
6
|
+
*
|
|
7
|
+
* 2026-11-10: that store held an access token that had expired in August
|
|
8
|
+
* and has no refresh token. Claude Code used it, `claude auth status`
|
|
9
|
+
* answered `loggedIn: true, authMethod: "oauth_token"` without checking the
|
|
10
|
+
* expiry, and every turn ended "Login expired · ... re-authenticate your
|
|
11
|
+
* Anthropic profile". Settings showed Claude signed in while it rested as
|
|
12
|
+
* "needs sign-in" every half hour for three days. Pointing the CLI's profile
|
|
13
|
+
* folder at one that never exists leaves it its own login (Keychain or
|
|
14
|
+
* CLAUDE_CONFIG_DIR), so the probe and the turn both tell the truth.
|
|
15
|
+
*
|
|
16
|
+
* The CLI's own tools inherit this, so `ant` or an SDK script a bot runs
|
|
17
|
+
* finds no profile either, like the API keys this launch already removes. */
|
|
18
|
+
export function isolateAnthropicProfile(env, instanceEnvironment, dataDir) {
|
|
19
|
+
if (choseAnthropicProfile(instanceEnvironment))
|
|
20
|
+
return;
|
|
21
|
+
delete env.ANTHROPIC_PROFILE;
|
|
22
|
+
env.ANTHROPIC_CONFIG_DIR = join(dataDir, "claude-no-anthropic-profile");
|
|
23
|
+
}
|
|
24
|
+
/** Whether this account's own settings name an Anthropic profile on purpose:
|
|
25
|
+
* then the profile's token is its sign-in, for a named account too. */
|
|
26
|
+
export const choseAnthropicProfile = (instanceEnvironment) => Boolean(instanceEnvironment.ANTHROPIC_PROFILE || instanceEnvironment.ANTHROPIC_CONFIG_DIR);
|
|
2
27
|
/** Whether a parsed `claude auth status --json` answer is this account's own
|
|
3
28
|
* sign-in.
|
|
4
29
|
*
|
|
@@ -22,12 +22,12 @@ import { brokerSocketPath, describeSpawnFailure, execCli, killCliTree, resolveCl
|
|
|
22
22
|
import { parseClaudeMcpList, parseClaudeMcpLocalNames } from "../claude-account-connectors.js";
|
|
23
23
|
import { classifyResumeFailure, mayReplay, recoveryPromptFor } from "../resume-recovery.js";
|
|
24
24
|
import { ClaudeLoginController } from "./claude-login-auth.js";
|
|
25
|
-
import { claudeAuthStatus } from "./claude-auth-status.js";
|
|
25
|
+
import { choseAnthropicProfile, claudeAuthStatus, isolateAnthropicProfile } from "./claude-auth-status.js";
|
|
26
26
|
export { claudeSignedIn } from "./claude-auth-status.js";
|
|
27
27
|
import { gateServer, resultBudget } from "../mcp-gate-config.js";
|
|
28
28
|
import { newEventId, newId } from "../contracts.js";
|
|
29
29
|
import { askInputSummary, commandSummary, toolDetailPreview } from "../tool-summary.js";
|
|
30
|
-
import { classifyError, computeBackoff, computeCredentialRefreshBackoff, CREDENTIAL_REFRESH_CONFLICT, interruptibleDelay, RETRY_MAX_ATTEMPTS, } from "./retry.js";
|
|
30
|
+
import { classifyError, computeBackoff, computeCredentialRefreshBackoff, CREDENTIAL_REFRESH_CONFLICT, interruptibleDelay, isModelAccessRefused, RETRY_MAX_ATTEMPTS, } from "./retry.js";
|
|
31
31
|
import { applyClaudeInject, decodeInjectId, mergeLocalInject, probeLocalInjects, resolveInjectId, } from "./local-inject.js";
|
|
32
32
|
import { appendNative } from "./native.js";
|
|
33
33
|
import { SPAWNED_PROXIES } from "../proxy-paths.js";
|
|
@@ -76,7 +76,7 @@ export function resolveClaudeConfigDir(configDir, env = process.env) {
|
|
|
76
76
|
export function claudeAuthFailure(frame, text) {
|
|
77
77
|
if (frame.is_api_error_message !== true && typeof frame.error !== "string")
|
|
78
78
|
return false;
|
|
79
|
-
return frame.error === "authentication_failed" || classifyError({ text }).reason === "auth_failed";
|
|
79
|
+
return !isModelAccessRefused(text) && (frame.error === "authentication_failed" || classifyError({ text }).reason === "auth_failed");
|
|
80
80
|
}
|
|
81
81
|
/** Whether a stream frame is the CLI reporting that it lost a race to renew
|
|
82
82
|
* the shared OAuth token ("Failed to refresh OAuth token: another Claude
|
|
@@ -118,7 +118,7 @@ export function claudeResultStopReason(o) {
|
|
|
118
118
|
* Keeping the probe and turn environments identical prevents setup from
|
|
119
119
|
* claiming an API-key login that the turn itself would deliberately remove.
|
|
120
120
|
*/
|
|
121
|
-
function claudeEnvironment(model, source = process.env, configDir, instanceEnvironment = {}) {
|
|
121
|
+
export function claudeEnvironment(model, source = process.env, configDir, instanceEnvironment = {}) {
|
|
122
122
|
const env = { ...source, PATH: augmentedPath(), NPM_CONFIG_LOGLEVEL: "error" };
|
|
123
123
|
if (configDir?.trim()) {
|
|
124
124
|
env.CLAUDE_CONFIG_DIR = resolveClaudeConfigDir(configDir, env);
|
|
@@ -135,6 +135,7 @@ function claudeEnvironment(model, source = process.env, configDir, instanceEnvir
|
|
|
135
135
|
}
|
|
136
136
|
delete env.CLAUDECODE;
|
|
137
137
|
delete env.CLAUDE_CODE_ENTRYPOINT;
|
|
138
|
+
isolateAnthropicProfile(env, instanceEnvironment, DATA_DIR);
|
|
138
139
|
// The harness process may hold workspace credentials (xai/box/voice keys,
|
|
139
140
|
// env-injected at boot); none of them are this CLI's to see.
|
|
140
141
|
stripWorkspaceCredentialEnv(env);
|
|
@@ -844,7 +845,7 @@ export const ClaudeDriver = {
|
|
|
844
845
|
const environment = (model) => claudeEnvironment(config.managed ? undefined : model, { ...process.env, ...input.environment }, config.configDir, input.environment);
|
|
845
846
|
const catalogEnv = environment();
|
|
846
847
|
// An account with its own folder signs in there, never on a borrowed login (claudeOwnLogin).
|
|
847
|
-
const namedAccount = Boolean(config.configDir?.trim());
|
|
848
|
+
const namedAccount = Boolean(config.configDir?.trim()) && !choseAnthropicProfile(input.environment);
|
|
848
849
|
// Say it once where a headless or source run reads its logs; the Engines
|
|
849
850
|
// page carries the same warning for the desktop (claudeInheritWarning).
|
|
850
851
|
if (inheritsUserConfig(catalogEnv)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isProviderSafetyBlock } from "../../shared/provider-safety.js";
|
|
2
2
|
import { classifyEngineFailure } from "../engine-failure.js";
|
|
3
|
+
export { isModelAccessRefused } from "../model-access-refusal.js";
|
|
3
4
|
/** Retries after the first try (docs/chibitek/engine-tiers.md, "Automatic
|
|
4
5
|
* failover"): two, with backoff. */
|
|
5
6
|
export const RETRY_MAX_RETRIES = 2;
|
|
@@ -255,11 +255,20 @@ export function restingLine(engines, formatTime, computer, options = {}) {
|
|
|
255
255
|
: engine.needsSignIn ? `${engine.label} needs sign-in`
|
|
256
256
|
: engine.notResponding ? `${engine.label} is not responding`
|
|
257
257
|
: `${engine.label} is resting until ${formatTime(engine.until)}`));
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
258
|
+
// Engines that could work on the place but were passed over before any
|
|
259
|
+
// rest was read: signed out, or not ready on this computer. Named so the
|
|
260
|
+
// line never hides a way back (an engine one sign-in away).
|
|
261
|
+
const fresh = (labels) => (labels ?? []).filter((label) => !seen.has(label) && seen.add(label));
|
|
262
|
+
const signedOut = fresh(computer?.signedOut).map((label) => `${label} needs sign-in`);
|
|
263
|
+
const unavailable = fresh(computer?.unavailable).map((label) => `${label} is unavailable`);
|
|
264
|
+
const hint = listed.some((engine) => engine.keyExpired || engine.needsSignIn) || signedOut.length ? ` ${ACCOUNTS_HINT}` : "";
|
|
265
|
+
const cannot = fresh(computer?.engines).map((label) => `${label} can't control ${computer.place}`);
|
|
266
|
+
// After the two-try cap the cap line says more, unless an engine cannot
|
|
267
|
+
// control the place at all; the passed-over engines are named either way.
|
|
268
|
+
if (cannot.length || ((signedOut.length || unavailable.length) && !options.capped)) {
|
|
269
|
+
return `No engine that can work on ${computer.place} is free, so this turn stopped: ${[...parts, ...signedOut, ...unavailable, ...cannot].join("; ")}.${hint}`;
|
|
270
|
+
}
|
|
271
|
+
parts.push(...signedOut, ...unavailable);
|
|
263
272
|
// The two-try cap, not an empty ladder: say so, with what each engine hit.
|
|
264
273
|
if (options.capped) {
|
|
265
274
|
const count = MAX_ENGINES_PER_TURN === 2 ? "two" : String(MAX_ENGINES_PER_TURN);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AUTH_STATUS, isModelAccessRefused } from "./model-access-refusal.js";
|
|
1
2
|
/** resetAt and resetText, when the text states a reset; else, for a rolling
|
|
2
3
|
* window, its length. */
|
|
3
4
|
export function statedReset(text, now = Date.now()) {
|
|
@@ -109,13 +110,10 @@ const AUTH_FAILED = [
|
|
|
109
110
|
// Claude Code: "Not logged in · Please run /login", "Login expired · Run /login ...", "Invalid API key · ...";
|
|
110
111
|
// Anthropic API: 401 authentication_error "invalid x-api-key";
|
|
111
112
|
// OpenAI: "Incorrect API key provided"; ACP agents: -32000 "Authentication required".
|
|
112
|
-
|
|
113
|
+
...AUTH_STATUS, // a 401/403 as a status or beside sign-in words, never a bare number
|
|
113
114
|
/\bunauthori[sz]ed\b|\bunauthenticated\b|\bforbidden\b/i,
|
|
114
115
|
/\bauthentication[_ ](?:error|failed|required)\b|\binvalid_credentials\b|\bAUTH_REQUIRED\b/i,
|
|
115
116
|
/\b(?:invalid|incorrect)[ _-]?(?:x-)?api[ _-]?key\b|\bapi key (?:is )?(?:invalid|expired|revoked|not valid)\b/i,
|
|
116
|
-
// OpenCode, 2026-10-19, as a JSON-RPC internal error: "Internal error:
|
|
117
|
-
// This API key has expired. Create a new API key in OpenCode Console ..."
|
|
118
|
-
/\bapi[ _-]?key (?:has |was )(?:been )?(?:expired|revoked|disabled)\b/i,
|
|
119
117
|
/\bnot (?:logged|signed) in\b|\b(?:logged|signed) out\b|\b(?:please )?run \/login\b|\b(?:login|sign-?in) (?:has )?expired\b|\bmissing bearer\b/i,
|
|
120
118
|
/\b(?:token|session|credentials?) (?:has |have )?expired\b|\bexpired (?:token|session|credentials?)\b/i,
|
|
121
119
|
];
|
|
@@ -149,6 +147,8 @@ export function classifyEngineFailure(text, now = Date.now()) {
|
|
|
149
147
|
}
|
|
150
148
|
if (isCredentialDead(text))
|
|
151
149
|
return { kind: "auth_failed", permanent: true };
|
|
150
|
+
if (isModelAccessRefused(text))
|
|
151
|
+
return { kind: "request_rejected" }; // the model rests, not the login
|
|
152
152
|
if (AUTH_FAILED.some((pattern) => pattern.test(text)))
|
|
153
153
|
return { kind: "auth_failed" };
|
|
154
154
|
if (STALLED.some((pattern) => pattern.test(text)))
|
|
@@ -76,7 +76,7 @@ import { turnTimingFinish, turnTimingMark, turnTimingStart } from "./turn-timing
|
|
|
76
76
|
import { ATOMIC_TEAM_PACKAGE_ID, BUILTIN_CHIBI_REFUSALS, builtinChibiPatchRefusal } from "./builtin-chibi.js";
|
|
77
77
|
import { canAccessTeam, canContactTeamOf, canManagePeer, canReachPeer, canReachTeam, coordinatorSupervises, peerAllowed, peerName, peerRosterSystemPrompt, peerStatus, peerStatusWords, reachablePeers, reachesEveryTeam, roomBoundaryHolds, teamStatusPrompt, PEER_ROSTER_MAX, routeTeammates, roomPeerRosterSystemPrompt, rosterAbout, roomRosterLine, PEER_ACCESS_HELP } from "./peer-roster.js";
|
|
78
78
|
import { openMausStatusSystemPrompt } from "./openmaus-status-capsule.js";
|
|
79
|
-
import { containerComputerAction, managedImageNeedsUpgrade, containerComputerExists, containerComputerFrame, containerComputerMcp, containerComputerScreenshot, containerComputerStatus, recentContainerComputerStatus, containerRuntimeStatus, ensureContainerRuntime, containerRuntimeError, localVmRecreatableOnDemand, perBotLocalVmTarget, SHARED_LOCAL_VM_TARGET, setupCommands, } from "./container-computer.js";
|
|
79
|
+
import { containerComputerAction, managedImageNeedsUpgrade, containerComputerExists, containerComputerFrame, containerComputerMcp, containerComputerScreenshot, containerComputerStatus, recentContainerComputerStatus, containerRuntimeStatus, ensureContainerRuntime, containerRuntimeError, localVmRecreatableOnDemand, localVmStartableWhenStopped, perBotLocalVmTarget, SHARED_LOCAL_VM_TARGET, setupCommands, } from "./container-computer.js";
|
|
80
80
|
import { ensureDirs, instanceConfigs, loadConfig, providerReloadKeys, localVmMaxInstances, localVmAutoStartRuntime, localVmMode, parseConfigPatch, roomTurnTimeoutMinutes, threadEventLogMaxBytes, maxConcurrentBotThreads, threadEventLogRetentionDays, saveConfig, showToolCallsEnabled, claudeUserMcpEnabled, userMcpEnabledFor, addonEnabled, skillAuthoringEnabled, sharedComputersEnabled, teamRoomsEnabled, builtInBrowserEnabled, llmThreadTitlesEnabled, onDeviceHelpersEnabled, browserProfileReplacementConflict, browserProfilePartitionTarget, syncCredentialEnv, withInstanceCli, persistableInstanceConfigs, vpsSshAlias, browserEngineAttachCdpUrl, DATA_DIR, EVENTS_DIR, NATIVE_DIR, customMcpServers, roomHandoffLimits, onConfigSaved, accountBotGrantPolicy, } from "./config.js";
|
|
81
81
|
import { sweepThreadEventLogs } from "./thread-retention.js";
|
|
82
82
|
import { GodModeSwitch } from "./god-mode.js";
|
|
@@ -275,7 +275,7 @@ import { localHost, probeLocalInjects } from "./drivers/local-inject.js";
|
|
|
275
275
|
import { totalmem } from "node:os";
|
|
276
276
|
import { loadInstanceKeys } from "./instance-keys.js";
|
|
277
277
|
import { createProviderAccountRoutes } from "./routes/provider-accounts.js";
|
|
278
|
-
import { accountStops, injectedModel, restScope } from "./injected-model-rest.js";
|
|
278
|
+
import { accountStops, injectedModel, modelScope, refusedModelScope, restScope } from "./injected-model-rest.js";
|
|
279
279
|
import { accountProvider } from "../shared/provider-accounts.js";
|
|
280
280
|
import { createAccountRoutes } from "./routes/accounts.js";
|
|
281
281
|
import { installNativeVault } from "./vault/runtime.js";
|
|
@@ -302,6 +302,7 @@ import { MODEL_CLASSES, TIERS_THAT_MAY_DROP_A_CLASS, botEngineMode, isBotTier, m
|
|
|
302
302
|
import { EngineRestStore } from "./engine-rest.js";
|
|
303
303
|
import { bindAtomicEngineAccountSource } from "./atomic-engine-accounts.js";
|
|
304
304
|
import { classifyEngineFailure } from "./engine-failure.js";
|
|
305
|
+
import { computerStopNames } from "./computer-stop-names.js";
|
|
305
306
|
import { PayPerUseEpisodes } from "./pay-per-use.js";
|
|
306
307
|
import { PersonalBotMdm, connectionsFor, engineOwner, isPrivateChibiPair, migrateEngineOwners, ownerAllows, ownerPickRefusal, personalBotPatchRefusal, personalConfig, privateBotAccountView, privateBotInternalRefusal, privateChibiLinkAudit, privateChibiLinked, setPrivateChibiLinkReader, withChibiLink, withEngineOwner, withPersonalConnection, withReadWorkMemory, withUseLocalModels, withoutEngineOwner, } from "./personal-bot.js";
|
|
307
308
|
import { PERSONAL_BOT_REFUSALS, chibiPrivateBotLinkPrompt, isPersonalBot, personalStopLine, personalTime, privateBotPrompt } from "../shared/personal-bot.js";
|
|
@@ -3177,7 +3178,8 @@ function restingStop(candidates, skipped, ownId, computer) {
|
|
|
3177
3178
|
return entry ? [{ label: candidate?.displayName ?? instanceId, until: entry.until, needsSignIn: entry.needsSignIn, keyExpired: entry.keyExpired,
|
|
3178
3179
|
notResponding: entry.notResponding }] : [];
|
|
3179
3180
|
});
|
|
3180
|
-
|
|
3181
|
+
const named = cannotDriveNamed(candidates, [{ instanceId: ownId }, ...skipped], computer);
|
|
3182
|
+
return Object.assign(new Error(restingLine(engines, restTime, named)), { status: 409, code: "engines_resting", category: engines.some((engine) => engine.needsSignIn || engine.keyExpired) || named?.signedOut.length ? "account" : "failover_exhausted" });
|
|
3181
3183
|
}
|
|
3182
3184
|
/** The computer a turn's engine must drive itself: the bot's or the
|
|
3183
3185
|
* conversation's explicit "Works on" place, as dispatch mounts it. Auto, Off,
|
|
@@ -3191,16 +3193,12 @@ function turnComputer(bot, threadId, runOn) {
|
|
|
3191
3193
|
return "vps";
|
|
3192
3194
|
return undefined;
|
|
3193
3195
|
}
|
|
3194
|
-
/** For a stop line:
|
|
3195
|
-
*
|
|
3196
|
-
function cannotDriveNamed(candidates,
|
|
3196
|
+
/** For a stop line: what the turn's computer is called, and which engines cannot drive it or
|
|
3197
|
+
* could but were skipped as signed out or unavailable (computerStopNames). */
|
|
3198
|
+
function cannotDriveNamed(candidates, skipped, computer) {
|
|
3197
3199
|
if (!computer)
|
|
3198
3200
|
return undefined;
|
|
3199
|
-
|
|
3200
|
-
const candidate = candidates.find((entry) => entry.instanceId === instanceId);
|
|
3201
|
-
return candidate && !canDriveComputer(candidate, computer) ? [candidate.displayName] : [];
|
|
3202
|
-
});
|
|
3203
|
-
return { place: surfaceLabel(computer === "vps" ? "cloud" : computer), engines };
|
|
3201
|
+
return { place: surfaceLabel(computer === "vps" ? "cloud" : computer), ...computerStopNames(candidates, skipped, computer) };
|
|
3204
3202
|
}
|
|
3205
3203
|
// ── the Primary Bot sweep's engine (server/primary-bot.ts) ───────────────
|
|
3206
3204
|
// Chibi is always the Orchestrator, but a sweep is Routine work: it runs on
|
|
@@ -3455,7 +3453,7 @@ const engineProbes = new EngineProbes({
|
|
|
3455
3453
|
});
|
|
3456
3454
|
engineProbes.start();
|
|
3457
3455
|
const engineResting = (candidate, model) => restingOnRoute(candidate, model, engineSnapshots.current() ?? [], // twins: sameRoute
|
|
3458
|
-
(entry) => engineRests.resting(entry.instanceId, engineAccount(entry), restScope(entry, model), injectedModel(model))); // restScope: an `ollama::` model on Claude rests alone
|
|
3456
|
+
(entry) => engineRests.resting(entry.instanceId, engineAccount(entry), restScope(entry, model), injectedModel(model)) ?? engineRests.resting(entry.instanceId, engineAccount(entry), modelScope(model), true)); // restScope: an `ollama::` model on Claude rests alone; modelScope: so does a model the plan refused
|
|
3459
3457
|
/** A model's class, when a source or a person's override grades it (a local
|
|
3460
3458
|
* Ollama model is Añejo); undefined otherwise (server/model-levels). */
|
|
3461
3459
|
function modelClassOf(driverKind, model) {
|
|
@@ -3615,7 +3613,8 @@ function noteEngineBack(event) {
|
|
|
3615
3613
|
const candidate = engineSnapshots.current()?.find((entry) => entry.instanceId === instanceId);
|
|
3616
3614
|
const selection = directTurnBots.get(event.threadId)?.modelSelection;
|
|
3617
3615
|
const model = selection?.instanceId === instanceId ? selection.model : undefined;
|
|
3618
|
-
|
|
3616
|
+
for (const scope of new Set([candidate ? restScope(candidate, model) : undefined, modelScope(model)]))
|
|
3617
|
+
engineRests.noteBack(instanceId, candidate ? engineAccount(candidate) : undefined, scope);
|
|
3619
3618
|
}
|
|
3620
3619
|
/** Rest a refused engine and continue on an eligible engine, or show an actionable line. */
|
|
3621
3620
|
function engineFailover(turn, completion) {
|
|
@@ -3636,7 +3635,7 @@ function engineFailover(turn, completion) {
|
|
|
3636
3635
|
// that provider rests, the engine's others stay free. A stall is the engine's.
|
|
3637
3636
|
// A dead key is the whole account's, whichever provider the model ran on:
|
|
3638
3637
|
// the rest names no provider, so Atomic Engine skips the account too.
|
|
3639
|
-
const scope = failure.kind === "stalled" || failure.permanent || !failedCandidate ? undefined : restScope(failedCandidate, ran?.model);
|
|
3638
|
+
const scope = failure.kind === "stalled" || failure.permanent || !failedCandidate ? undefined : restScope(failedCandidate, ran?.model) ?? refusedModelScope(failure.message, ran?.model);
|
|
3640
3639
|
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),
|
|
3641
3640
|
...(failure.permanent ? { permanent: true } : {}), ...(scope ? { scope } : {}), ...(ran?.model ? { model: ran.model } : {}),
|
|
3642
3641
|
...(failure.kind === "auth_failed" && failedCandidate ? { reportedSignedIn: failedCandidate.snapshot.state === "available" && failedCandidate.snapshot.authenticated === true } : {}) });
|
|
@@ -3888,7 +3887,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
|
|
|
3888
3887
|
choice, fallback, subscriptionLine: subscriptionMove?.line, failureKind: turn.failure?.kind,
|
|
3889
3888
|
pausedUntil: payPerUse.pausedUntil(), skipped: resolution.skipped, payPerUsePausedLine, restingNamed,
|
|
3890
3889
|
failedInstanceId: turn.instanceId, alreadyTried: attempt.tried, triedCount: tried.size,
|
|
3891
|
-
cannotDrive: cannotDriveNamed(candidates, resolution.skipped
|
|
3890
|
+
cannotDrive: cannotDriveNamed(candidates, resolution.skipped, computer),
|
|
3892
3891
|
policy: connectionRunOutPolicy(cfg.engineTiers), paidApproved: Boolean(payPerUse.current()?.keptGoingAt),
|
|
3893
3892
|
local: Boolean(placed.local), currentLabel: engineLabel(candidates, attempt.selection),
|
|
3894
3893
|
nextLabel: choice ? engineLabel(candidates, choice.selection) : undefined,
|
|
@@ -14356,21 +14355,22 @@ async function readyLocalVmForTurn(botId, target, isCurrent = () => true, onNote
|
|
|
14356
14355
|
noteLocalVmSeen(target, status);
|
|
14357
14356
|
if (!isCurrent())
|
|
14358
14357
|
return status;
|
|
14359
|
-
|
|
14360
|
-
|
|
14358
|
+
const start = localVmStartableWhenStopped(status);
|
|
14359
|
+
if (status.ready || !(start || localVmRecreatableOnDemand(status)) || !status.runtime)
|
|
14360
|
+
return status; // start: a stopped VM keeps its disk, never recreated
|
|
14361
14361
|
// Another creation is already mid-flight and its container is not yet
|
|
14362
14362
|
// visible to a count, so the safe answer is the inspected status —
|
|
14363
14363
|
// exactly what the over-cap path below returns.
|
|
14364
14364
|
if (!ownsProvision)
|
|
14365
14365
|
return status;
|
|
14366
|
-
if (target.key !== SHARED_LOCAL_VM_TARGET.key) {
|
|
14366
|
+
if (!start && target.key !== SHARED_LOCAL_VM_TARGET.key) {
|
|
14367
14367
|
const count = await existingPerBotLocalVmCount(status.runtime);
|
|
14368
14368
|
if (!isCurrent() || count >= localVmMaxInstances(cfg))
|
|
14369
14369
|
return status;
|
|
14370
14370
|
}
|
|
14371
14371
|
broadcast({ kind: "computer", botId, state: "provisioning" });
|
|
14372
14372
|
try {
|
|
14373
|
-
status = await containerComputerAction("run", undefined, undefined, target);
|
|
14373
|
+
status = await containerComputerAction(start ? "start" : "run", undefined, undefined, target);
|
|
14374
14374
|
}
|
|
14375
14375
|
catch {
|
|
14376
14376
|
// Keep the inspected status: its `problem` names the real obstacle,
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// session limit was moved off its Ollama model onto another Claude account.
|
|
10
10
|
import { decodeInjectId } from "./drivers/local-inject.js";
|
|
11
11
|
import { modelProvider } from "./harness-import/engine-policy.js";
|
|
12
|
+
import { isModelAccessRefused } from "./model-access-refusal.js";
|
|
12
13
|
/** The rest scope of a model whose turns go to another host. */
|
|
13
14
|
export const INJECTED_SCOPE = "injected";
|
|
14
15
|
/** Whether this model goes to another host than the engine's own account. */
|
|
@@ -21,5 +22,13 @@ export function restScope(candidate, model) {
|
|
|
21
22
|
return undefined;
|
|
22
23
|
return injectedModel(model) ? INJECTED_SCOPE : modelProvider(candidate, model);
|
|
23
24
|
}
|
|
25
|
+
/** The scope of a rest for one model its account may not use, on an engine
|
|
26
|
+
* with no providers to rest instead (Claude, Codex): `model:<id>`. */
|
|
27
|
+
export const modelScope = (model) => (model ? `model:${model}` : undefined);
|
|
28
|
+
/** That scope when the failure is a model refusal (a plan that does not open
|
|
29
|
+
* the model, an unknown id; model-access-refusal.ts), else undefined. Without
|
|
30
|
+
* it the rest had no scope and one bot on a refused model benched every bot
|
|
31
|
+
* on the engine's other models. */
|
|
32
|
+
export const refusedModelScope = (message, model) => (message && isModelAccessRefused(message) ? modelScope(model) : undefined);
|
|
24
33
|
/** Whether the engine's account state (signed out, resting) stops this model. */
|
|
25
34
|
export const accountStops = (model) => !injectedModel(model);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Whether a stopped Local VM can simply be started again, disk and all: the
|
|
2
|
+
* container Atomic made, on the current image, with its safety limits intact.
|
|
3
|
+
*
|
|
4
|
+
* A stopped VM was once never started ("its desktop leaves a stale X lock on
|
|
5
|
+
* stop"), so every restart of the Mac or of the container runtime left the
|
|
6
|
+
* person at "remove and recreate it", losing whatever was installed inside.
|
|
7
|
+
* The image's own start script removes that lock before the display starts
|
|
8
|
+
* (start-vnc.sh: `rm -f /tmp/.X1-lock /tmp/.X11-unix/X1`), and a stopped VM
|
|
9
|
+
* comes back with display, desktop and Cua Driver after a clean stop and
|
|
10
|
+
* after a killed runtime alike (checked on driver-0.20.0-v6, 2026-11-11). If
|
|
11
|
+
* a start ever does leave the desktop down, `statusProblem` says so. */
|
|
12
|
+
export function localVmStartableWhenStopped(status) {
|
|
13
|
+
return Boolean(status.runtime)
|
|
14
|
+
&& status.daemonUp === true
|
|
15
|
+
&& status.image === true
|
|
16
|
+
&& status.container === "stopped"
|
|
17
|
+
&& status.imageMatches === true
|
|
18
|
+
&& status.managed === true
|
|
19
|
+
&& status.network !== "unsafe"
|
|
20
|
+
&& status.security !== "unsafe"
|
|
21
|
+
&& status.persistence !== "unsafe";
|
|
22
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// When a provider's 401/403 means "signed out" and when it means "this
|
|
2
|
+
// model is not open to you" (server/engine-failure.ts reads both).
|
|
3
|
+
//
|
|
4
|
+
// Written 2026-11-10 while chasing "Claude needs sign-in" on a Mac whose
|
|
5
|
+
// Claude subscription was active. That stop turned out to be a real expired
|
|
6
|
+
// login (the borrowed Anthropic profile token; see isolateAnthropicProfile in
|
|
7
|
+
// server/drivers/claude-auth-status.ts), not a misread. What stays here is the
|
|
8
|
+
// guard the search showed was missing: the sign-in patterns matched a bare
|
|
9
|
+
// 401 or 403 anywhere in the text, and a model the signed-in plan does not
|
|
10
|
+
// open is not fixed by a new sign-in, so it must not rest the whole account.
|
|
11
|
+
/** A 401 or 403 that is a failed sign-in: written as a status ("API Error:
|
|
12
|
+
* 401", "HTTP 403", "status 401") or beside sign-in words, never a bare
|
|
13
|
+
* number in a usage, plan or new-model message. */
|
|
14
|
+
export const AUTH_STATUS = [
|
|
15
|
+
// "API Error: 401", "HTTP 403", "HTTP/1.1 403", "status code 401", "error
|
|
16
|
+
// code: 403", JSON "status":401. A bare "code" is not enough ("exited with
|
|
17
|
+
// code 403" is a process), and neither is a count ("Error 403 files").
|
|
18
|
+
/\b(?:api error|http(?:\/\d(?:\.\d)?)?|(?:status|error|response)(?:[ _]?code)?)\b["\s:=([]*40[13]\b(?!\s+(?:of|files?|rows?|items?|messages?|tokens?|results?|lines?|bytes|tests?|errors?|warnings?|seconds?|minutes?|ms|times)\b)|"code"\s*:\s*40[13]\b/i,
|
|
19
|
+
// OpenCode's ACP shape, "Upstream request failed: [401] ...". The bracket
|
|
20
|
+
// alone is not a status: "[403] indexing files" is a log line.
|
|
21
|
+
/\b(?:failed|error|rejected)\b[^\n[]{0,12}\[40[13]\]/i,
|
|
22
|
+
// "Request failed with 401", "Request failed (403)": the number ends the
|
|
23
|
+
// thought.
|
|
24
|
+
/\b(?:failed|rejected|responded|answered)(?: with)?(?: (?:a|an|status|http|code))* \(?40[13]\)?(?=\s*(?:$|[.,;:)\]]|from\b|error\b|response\b))/i,
|
|
25
|
+
// "received 403 from upstream". These verbs also count things ("returned
|
|
26
|
+
// 401."), so the number needs what it came from.
|
|
27
|
+
/\b(?:returned|received|got) (?:a |an )?\(?40[13]\)?(?=\s*(?:from\b|error\b|response\b))/i,
|
|
28
|
+
/\b40[13]\b[^\n]{0,160}\b(?:unauthori[sz]ed|unauthenticated|authenticat\w*|api[ _-]?key|oauth|(?:access |bearer )?token|credentials?|log(?:ged)?[ -]?in|sign(?:ed)?[ -]?in)\b/i,
|
|
29
|
+
];
|
|
30
|
+
// The shapes read. The second is Claude Code's own wording; the first is the
|
|
31
|
+
// Anthropic API's permission_error shape and was not captured from a live
|
|
32
|
+
// failure:
|
|
33
|
+
// "API Error: 403 {"type":"error","error":{"type":"permission_error",
|
|
34
|
+
// "message":"Your plan does not include access to claude-fable-5-2."}}"
|
|
35
|
+
// "There's an issue with the selected model (claude-fable-5-2). It may not
|
|
36
|
+
// exist or you may not have access to it. Run /model to pick a different
|
|
37
|
+
// model."
|
|
38
|
+
// Every pattern needs the word "model" or a model's own name. A product name
|
|
39
|
+
// alone does not count: "Your account does not have access to Claude. Please
|
|
40
|
+
// login again" is the wrong account signed in, which is a sign-in.
|
|
41
|
+
const MODEL_NAME = "model|claude-[\\w.-]+|gpt-[\\w.-]+|gemini-[\\w.-]+|grok-[\\w.-]+|opus|sonnet|haiku|fable";
|
|
42
|
+
const MODEL_ACCESS_REFUSED = [
|
|
43
|
+
/\bissue with the selected model\b|\bmodel\b[^\n]{0,120}\b(?:may|does) not exist or you (?:may |do )?not have access\b/i,
|
|
44
|
+
/\b(?:do(?:es)?n['’]?t|do(?:es)? not) (?:currently )?have access to (?:the |this |that )?(?:model\b|claude-|gpt-|gemini-|grok-|o\d)/i,
|
|
45
|
+
new RegExp(`\\b(?:plan|subscription|organi[sz]ation|account|tier) (?:does not|doesn['’]?t) (?:include|support|allow|have access to)\\b[^.\\n]{0,80}\\b(?:${MODEL_NAME})\\b`, "i"),
|
|
46
|
+
/\b(?:model|claude-[\w.-]+|opus|sonnet|haiku|fable)\b(?:[^.\n]|\.\d){0,80}\b(?:is |are )?(?:not available|unavailable|not included|not enabled|not supported) (?:on|in|for|with) (?:your|this|the) (?:current )?(?:plan|subscription|account|organi[sz]ation|tier)\b/i,
|
|
47
|
+
/\bmodel_not_found\b|\bnot_found_error\b[^\n]{0,200}\bmodel\b|\bmodel\b[^\n]{0,40}\bnot_found_error\b/i,
|
|
48
|
+
new RegExp(`\\bpermission_error\\b[^\\n]{0,240}\\b(?:${MODEL_NAME})\\b`, "i"),
|
|
49
|
+
];
|
|
50
|
+
// Real sign-in or dead-credential words win, whatever model the message
|
|
51
|
+
// names: "OAuth token expired", "token has been revoked", "login again",
|
|
52
|
+
// "OAuth token does not meet scope requirement".
|
|
53
|
+
const SIGN_IN_WORDS = /\bnot (?:logged|signed) in\b|\b(?:please )?run \/login\b|\blog ?in again\b|\bsign ?in again\b|\bre-?authenticat\w*|\b(?:login|sign-?in|token|session|credentials?) (?:has |have )?expired\b|\b(?:token|key|credentials?|session) (?:has |have |was |were )?(?:been )?revoked\b|\bauthentication_error\b|\boauth\b|\bscope requirement\b|\binvalid[ _-]?(?:x-)?api[ _-]?key\b|\bkey (?:has |was )?(?:been )?(?:expired|revoked)\b/i;
|
|
54
|
+
/** Whether the text says the signed-in account may not use this model (a
|
|
55
|
+
* plan, organization or model-id refusal). That model rests
|
|
56
|
+
* (request_rejected, scoped to it); the login and the engine's other models
|
|
57
|
+
* stay good. */
|
|
58
|
+
export function isModelAccessRefused(text) {
|
|
59
|
+
if (!text || SIGN_IN_WORDS.test(text))
|
|
60
|
+
return false;
|
|
61
|
+
return MODEL_ACCESS_REFUSED.some((pattern) => pattern.test(text));
|
|
62
|
+
}
|
|
@@ -732,7 +732,7 @@ export function vpsContainerRunArgs(containerName, imageRef = VPS_IMAGE, viewerS
|
|
|
732
732
|
// someone opens the panel. unless-stopped survives reboots while still
|
|
733
733
|
// honoring an explicit Stop. The shared hardening check accepts exactly
|
|
734
734
|
// this policy for the VPS caller (and only "no"/unset for the Local VM,
|
|
735
|
-
//
|
|
735
|
+
// which Atomic starts on demand and never at boot).
|
|
736
736
|
"--restart",
|
|
737
737
|
"unless-stopped",
|
|
738
738
|
"-e",
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-CcefVt63.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-DtiBETZe.js";import{_ as a}from"./mermaid.core-CcefVt63.js";import"./chunk-5VM5RSS4-O-aALIul.js";import"./chunk-XXDRQBXY-s_OT2iv7.js";import"./chunk-WEXAMYUT-BYXYAyMu.js";import"./chunk-GWA4HPMP-FzFr6U_I.js";import"./channel-DaRjZag9.js";import"./index-COCy7XsD.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};
|