johns-harness 2026.10.16 → 2026.10.18
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/CHANGELOG.md +17 -0
- package/README.md +7 -5
- package/dist/auth-profiles-5CHn7vq1.js +4 -0
- package/dist/command-registry-ZarkU2_Y.js +4 -0
- package/dist/commands-registry-C78-tPS3.js +3 -2
- package/dist/commands-registry-D0Jkz-Sn.js +3 -2
- package/dist/commands-registry-DJWLO-6B.js +3 -2
- package/dist/commands-registry-l51VuG0m.js +3 -2
- package/dist/compact-B247y5Qt.js +1 -1
- package/dist/model-selection-BGlGpPgM.js +4 -0
- package/dist/model-selection-BU6wl1le.js +4 -0
- package/dist/model-selection-L7RMwsG-.js +4 -0
- package/dist/models-CxHdes0w.js +4 -3
- package/dist/models-cli-DZnoM8Ln.js +8 -5
- package/dist/models-cli-U89juIRK.js +4 -2
- package/dist/pi-embedded-C6ITuRXf.js +1 -1
- package/dist/pi-embedded-DoQsYfIY.js +1 -1
- package/dist/pi-embedded-helpers-B7bn2aDM.js +5 -1
- package/dist/pi-embedded-helpers-CGK9ncQY.js +5 -1
- package/dist/pi-embedded-helpers-CkWXaNFn.js +5 -1
- package/dist/pi-embedded-helpers-DLLQ3MsR.js +5 -1
- package/dist/plugin-sdk/commands-registry-B4ZP4Y1B.js +3 -2
- package/dist/plugin-sdk/commands-registry-B8Og-fWU.js +3 -2
- package/dist/plugin-sdk/commands-registry-BoAXxFpH.js +3 -2
- package/dist/plugin-sdk/commands-registry-Ca1h6XvV.js +3 -2
- package/dist/plugin-sdk/commands-registry-Do-Y2EhN.js +3 -2
- package/dist/plugin-sdk/commands-registry-DpRs-E_M.js +3 -2
- package/dist/plugin-sdk/config-4Fgm-yEH.js +4 -0
- package/dist/plugin-sdk/config-Di-lyCdh.js +4 -0
- package/dist/plugin-sdk/dispatch-BP0viZiL.js +1 -1
- package/dist/plugin-sdk/dispatch-CQsjmw7g.js +1 -1
- package/dist/plugin-sdk/dispatch-Cerq29sy.js +1 -1
- package/dist/plugin-sdk/dispatch-Cndjtt0g.js +1 -1
- package/dist/plugin-sdk/dispatch-UogiJYul.js +1 -1
- package/dist/plugin-sdk/mattermost.js +3 -2
- package/dist/plugin-sdk/model-auth-CX9cPHdC.js +4 -0
- package/dist/plugin-sdk/model-auth-Ciehz0x5.js +4 -0
- package/dist/plugin-sdk/model-auth-DVyo6JSX.js +4 -0
- package/dist/plugin-sdk/model-auth-kiHYHGrs.js +4 -0
- package/dist/plugin-sdk/pi-embedded-helpers-B89Z8pGU.js +5 -1
- package/dist/plugin-sdk/pi-embedded-helpers-BDFUaaiY.js +5 -1
- package/dist/plugin-sdk/pi-embedded-helpers-BnFhV3or.js +5 -1
- package/dist/plugin-sdk/pi-embedded-helpers-CRUVFL1T.js +5 -1
- package/dist/plugin-sdk/pi-embedded-helpers-CY7PsNpl.js +5 -1
- package/dist/plugin-sdk/pi-embedded-helpers-Dira0ZRW.js +5 -1
- package/dist/plugin-sdk/reply-DbZnH8-h.js +1 -1
- package/dist/program-context-CKpVgs9O.js +4 -0
- package/dist/reply-C5LKjXcC.js +1 -1
- package/dist/subscription-login.js +152 -0
- package/docs/PATCHES.md +36 -0
- package/docs/cli/models.md +11 -6
- package/node_modules/@mariozechner/pi-ai/dist/providers/anthropic.js +6 -3
- package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/anthropic.js +49 -95
- package/package.json +1 -1
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/providers/anthropic.js +6 -3
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/utils/oauth/anthropic.js +58 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.10.18
|
|
4
|
+
|
|
5
|
+
- **Claude subscription proven live and fixed to fail over:** a real Decision Team credential (john.rood@decision.com) completed `johnness login claude` on 2026.10.17 end to end: hCaptcha, magic link, consent, `code#state`, token exchange, atomic `anthropic:subscription` storage. Through the harness's own Anthropic adapter, Opus 5.5 answered HTTP 200 with streaming, one tool call and `anthropic-ratelimit-unified-*` headers (`5h-status: allowed`), every subscription turn cost $0, and a forced refresh rotated both tokens through the real resolver. Two things broke on the way, both fixed here.
|
|
6
|
+
- **Current Claude Code user-agent floor:** Anthropic now rejects `claude-cli/2.1.62` for current models with HTTP 400 `claude_code_version_too_old` ("version 2.1.280 or newer is required"). The vendored and installed adapter send `claude-cli/2.1.304` for subscription tokens only; API-key requests are unchanged.
|
|
7
|
+
- **Subscription rejections fail over to the API key:** when an organization has extra usage switched off, Anthropic answers the harness's full request with HTTP 400 "Third-party apps now draw from extra usage, not plan limits" (`anthropic-ratelimit-unified-overage-disabled-reason: org_level_disabled`). The stock classifier treated that 400 as a format error and ended the turn. It and the version rejection are now billing failures in all ten helper bundles: the subscription profile is disabled for the billing backoff and the paid API profile answers the same turn. Verified live: subscription 400, then API-key 200 with the tool call and a normal reply, with the subscription usage still recorded at $0 and the API turns priced normally.
|
|
8
|
+
- **What John or a Decision admin may still toggle:** Anthropic bills third-party apps against the organization's Extra usage, not the included plan limits. With Extra usage off for the Decision Team org, every full harness turn on the subscription falls back to the API key. Turn on Extra usage (Claude admin settings, billing) to have subscription turns served; a bare Claude Code request already succeeds, so the credential and Team entitlement are fine.
|
|
9
|
+
- **Validation:** Family 87 exact replay (adapter + 10 helper copies, `--check` read-only, `--dependency-only`), classifier tests on the verbatim Anthropic messages, real adapter user-agent and $0 tests, older hash-pinned families (67, 78, 81, 82) strip and re-layer Family 87 with Family 86, 543 verifier checks, full suite 1,192 tests (1,187 pass, 5 skip).
|
|
10
|
+
- **Rollback:** `npm i -g johns-harness@2026.10.17`.
|
|
11
|
+
|
|
12
|
+
## 2026.10.17
|
|
13
|
+
|
|
14
|
+
- **Named subscription login:** bare `/login` lists options; `/login chatgpt` (alias `gpt`, case-insensitive) preserves the existing ChatGPT device flow. `/login claude` adds a browser/URL plus complete-code handoff, PKCE and state checks, a 15-minute window and owner-only native dispatch. CLI equivalents are `johnness login [chatgpt|claude]` and `johnness models auth login [chatgpt|claude]`; `--no-browser` supports remote Claude sign-in, and the existing `--device` shortcut still signs in to ChatGPT.
|
|
15
|
+
- **Claude subscription first:** current Claude Code OAuth client/endpoints and the existing Claude Code request envelope. Credentials live separately in `anthropic:subscription`, refresh automatically and preserve all existing API-key profiles. Every auth-order copy prefers the subscription, rotates to available API profiles after rate limits, auth errors or quota, and returns to subscription priority after cooldown. Explicit user-locked profiles remain explicit.
|
|
16
|
+
- **Credential-specific cost:** Claude subscription attempts record $0 across input, output and cache usage. API fallback attempts keep normal API pricing; the model catalog is unchanged. No gateway restart or live config edit is part of installation or login.
|
|
17
|
+
- **Validation:** native command/CLI dispatch, current OAuth endpoints, PKCE/code/state errors, route ownership, atomic mode-0600 credential storage, real locked refresh persistence, all ten auth-order copies, API failover classification, synthetic real-adapter SSE and subscription/API cost separation, plus exact replay and packed-install gates. Real subscription entitlement still requires the owner to finish browser sign-in.
|
|
18
|
+
- **Rollback:** `npm i -g johns-harness@2026.10.16`.
|
|
19
|
+
|
|
3
20
|
## 2026.10.16
|
|
4
21
|
|
|
5
22
|
- **Fixed Telegram replies disappearing after sending a file.** A successful message-tool send used to discard every final reply to that chat, even unrelated text. Telegram briefly showed the reply as a preview and then removed it because it never received a final payload. Direct and queued replies now deduplicate actual content instead of suppressing the entire destination; distinct follow-up text is finalized and stays visible.
|
package/README.md
CHANGED
|
@@ -47,11 +47,13 @@ The wizard sets up credentials, workspace, gateway, and channels. It asks for yo
|
|
|
47
47
|
|
|
48
48
|
<!-- JOHNNESS_PATCH_DEVICE_LOGIN_60B -->
|
|
49
49
|
### Signing in from chat
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Enable "Device code authorization for Codex" once in chatgpt.com > Settings > Security;
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
Send `/login` to list subscription choices. Use `/login chatgpt` (or `/login gpt`) for ChatGPT / Codex, and `/login claude` for a Claude subscription. Provider names are case-insensitive.
|
|
51
|
+
|
|
52
|
+
For **ChatGPT**, open the link, sign in, enter the device code on that page and tap Approve. In Telegram, tap the code to copy it. Enable "Device code authorization for Codex" once in chatgpt.com > Settings > Security; then send `/login chatgpt` for a fresh code. The existing device flow is unchanged.
|
|
53
|
+
|
|
54
|
+
For **Claude**, open the link, sign in to your subscription account, approve, then copy the complete code (including `#state`) from the callback page. Send `/login claude <complete code>` in the same chat. This uses the Claude Code OAuth client and request envelope, not a new third-party Anthropic client. Eligible Pro, Max and Team accounts use subscription limits first, with your existing Anthropic API-key profile as fallback on rate limits, authentication failures or quota exhaustion. Subscription turns record $0; API fallback turns keep normal API pricing. Tokens refresh automatically. Sign-in does not edit gateway configuration. If Anthropic answers "Third-party apps now draw from extra usage", your organization has Extra usage switched off; the harness falls back to the API key on that turn, and an org admin can turn Extra usage on in Claude admin billing settings to have subscription turns served.
|
|
55
|
+
|
|
56
|
+
In a terminal, run `johnness login` to list choices, `johnness login chatgpt` or `johnness login claude`. Claude opens the browser and asks for the complete code; use `--no-browser` on a remote host to print the link instead. The equivalent commands are `johnness models auth login chatgpt` and `johnness models auth login claude`. Existing `johnness models auth login --device` remains a ChatGPT shortcut.
|
|
55
57
|
|
|
56
58
|
<!-- JOHNNESS_PATCH_DEFAULTS_61 -->
|
|
57
59
|
### Batteries included
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { claudeSubscriptionOrder } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
1
2
|
// JOHNNESS_PATCH_CATALOG_REFRESH_65
|
|
2
3
|
import { mergeShippedCatalog65 } from "./catalog-refresh.js";
|
|
3
4
|
import { refreshManagedCodexProfile, readManagedCodexStore, mutateAuthProfile, updateAuthStoreMetadata, saveAuthStoreSnapshot } from "./codex-oauth-owner.js";
|
|
@@ -17015,6 +17016,9 @@ function resolveAuthProfileEligibility(params) {
|
|
|
17015
17016
|
};
|
|
17016
17017
|
}
|
|
17017
17018
|
function resolveAuthProfileOrder(params) {
|
|
17019
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: subscription-first, API fallback, cooldown-aware.
|
|
17020
|
+
const subscriptionOrder = claudeSubscriptionOrder(params, profileId => resolveAuthProfileEligibility({ ...params, profileId, now: Date.now() }).eligible, profileId => isProfileInCooldown(params.store, profileId));
|
|
17021
|
+
if (subscriptionOrder) return subscriptionOrder;
|
|
17018
17022
|
const { cfg, store, provider, preferredProfile } = params;
|
|
17019
17023
|
const providerKey = normalizeProviderId(provider);
|
|
17020
17024
|
const providerAuthKey = normalizeProviderIdForAuth(provider);
|
|
@@ -14,6 +14,10 @@ const shouldRegisterCorePrimaryOnly = (argv) => {
|
|
|
14
14
|
return true;
|
|
15
15
|
};
|
|
16
16
|
const coreEntries = [
|
|
17
|
+
{ // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
18
|
+
commands: [{ name: "login", description: "Sign in to ChatGPT or Claude subscription", hasSubcommands: false }],
|
|
19
|
+
register: async ({ program }) => { (await import("./subscription-login.js")).registerLoginCommand(program); }
|
|
20
|
+
},
|
|
17
21
|
{
|
|
18
22
|
commands: [{ name: "migrate", description: "Back up and migrate legacy state into native John's Harness state", hasSubcommands: false }],
|
|
19
23
|
register: async ({ program }) => { (await import("./register.migrate.js")).registerMigrateCommand(program); }
|
|
@@ -198,9 +198,10 @@ function buildChatCommands() {
|
|
|
198
198
|
defineChatCommand({
|
|
199
199
|
key: "login",
|
|
200
200
|
nativeName: "login",
|
|
201
|
-
description: "
|
|
201
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
202
202
|
textAliases: ["/login", "/relogin"],
|
|
203
|
-
category: "management"
|
|
203
|
+
category: "management",
|
|
204
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
204
205
|
}),
|
|
205
206
|
defineChatCommand({
|
|
206
207
|
key: "status",
|
|
@@ -235,9 +235,10 @@ function buildChatCommands() {
|
|
|
235
235
|
defineChatCommand({
|
|
236
236
|
key: "login",
|
|
237
237
|
nativeName: "login",
|
|
238
|
-
description: "
|
|
238
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
239
239
|
textAliases: ["/login", "/relogin"],
|
|
240
|
-
category: "management"
|
|
240
|
+
category: "management",
|
|
241
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
241
242
|
}),
|
|
242
243
|
defineChatCommand({
|
|
243
244
|
key: "status",
|
|
@@ -235,9 +235,10 @@ function buildChatCommands() {
|
|
|
235
235
|
defineChatCommand({
|
|
236
236
|
key: "login",
|
|
237
237
|
nativeName: "login",
|
|
238
|
-
description: "
|
|
238
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
239
239
|
textAliases: ["/login", "/relogin"],
|
|
240
|
-
category: "management"
|
|
240
|
+
category: "management",
|
|
241
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
241
242
|
}),
|
|
242
243
|
defineChatCommand({
|
|
243
244
|
key: "status",
|
|
@@ -198,9 +198,10 @@ function buildChatCommands() {
|
|
|
198
198
|
defineChatCommand({
|
|
199
199
|
key: "login",
|
|
200
200
|
nativeName: "login",
|
|
201
|
-
description: "
|
|
201
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
202
202
|
textAliases: ["/login", "/relogin"],
|
|
203
|
-
category: "management"
|
|
203
|
+
category: "management",
|
|
204
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
204
205
|
}),
|
|
205
206
|
defineChatCommand({
|
|
206
207
|
key: "status",
|
package/dist/compact-B247y5Qt.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createImageGenerateTool } from "./image-generate.js";
|
|
|
4
4
|
import { handleUpdateCommand } from "./update-command.js";
|
|
5
5
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
6
6
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
7
|
-
import { handleDeviceLoginCommand } from "./
|
|
7
|
+
import { handleSubscriptionLoginCommand as handleDeviceLoginCommand } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
8
8
|
import { E as normalizeLogLevel, a as logVerbose, c as shouldLogVerbose, k as resolvePreferredJohnnessTmpDir, m as getChildLogger, p as theme, t as danger, u as warn } from "./globals-Bv4ZcVWM.js";
|
|
9
9
|
import { g as resolveStateDir, r as STATE_DIR, u as resolveGatewayPort, y as resolveRequiredHomeDir } from "./paths-BfR2LXbA.js";
|
|
10
10
|
import { c as sanitizeForLog, d as createNonExitingRuntime, f as defaultRuntime, t as createSubsystemLogger } from "./subsystem-Cf9yS0UI.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { claudeSubscriptionOrder } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
1
2
|
// JOHNNESS_PATCH_CATALOG_REFRESH_65
|
|
2
3
|
import { mergeShippedCatalog65 } from "./catalog-refresh.js";
|
|
3
4
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
@@ -15224,6 +15225,9 @@ function resolveAuthProfileEligibility(params) {
|
|
|
15224
15225
|
};
|
|
15225
15226
|
}
|
|
15226
15227
|
function resolveAuthProfileOrder(params) {
|
|
15228
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: subscription-first, API fallback, cooldown-aware.
|
|
15229
|
+
const subscriptionOrder = claudeSubscriptionOrder(params, profileId => resolveAuthProfileEligibility({ ...params, profileId, now: Date.now() }).eligible, profileId => isProfileInCooldown(params.store, profileId));
|
|
15230
|
+
if (subscriptionOrder) return subscriptionOrder;
|
|
15227
15231
|
const { cfg, store, provider, preferredProfile } = params;
|
|
15228
15232
|
const providerKey = normalizeProviderId(provider);
|
|
15229
15233
|
const providerAuthKey = normalizeProviderIdForAuth(provider);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { claudeSubscriptionOrder } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
1
2
|
// JOHNNESS_PATCH_CATALOG_REFRESH_65
|
|
2
3
|
import { mergeShippedCatalog65 } from "./catalog-refresh.js";
|
|
3
4
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
@@ -15113,6 +15114,9 @@ function resolveAuthProfileEligibility(params) {
|
|
|
15113
15114
|
};
|
|
15114
15115
|
}
|
|
15115
15116
|
function resolveAuthProfileOrder(params) {
|
|
15117
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: subscription-first, API fallback, cooldown-aware.
|
|
15118
|
+
const subscriptionOrder = claudeSubscriptionOrder(params, profileId => resolveAuthProfileEligibility({ ...params, profileId, now: Date.now() }).eligible, profileId => isProfileInCooldown(params.store, profileId));
|
|
15119
|
+
if (subscriptionOrder) return subscriptionOrder;
|
|
15116
15120
|
const { cfg, store, provider, preferredProfile } = params;
|
|
15117
15121
|
const providerKey = normalizeProviderId(provider);
|
|
15118
15122
|
const providerAuthKey = normalizeProviderIdForAuth(provider);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { claudeSubscriptionOrder } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
1
2
|
// JOHNNESS_PATCH_CATALOG_REFRESH_65
|
|
2
3
|
import { mergeShippedCatalog65 } from "./catalog-refresh.js";
|
|
3
4
|
import { refreshManagedCodexProfile, readManagedCodexStore, mutateAuthProfile, updateAuthStoreMetadata, saveAuthStoreSnapshot } from "./codex-oauth-owner.js";
|
|
@@ -13492,6 +13493,9 @@ function resolveAuthProfileEligibility(params) {
|
|
|
13492
13493
|
};
|
|
13493
13494
|
}
|
|
13494
13495
|
function resolveAuthProfileOrder(params) {
|
|
13496
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: subscription-first, API fallback, cooldown-aware.
|
|
13497
|
+
const subscriptionOrder = claudeSubscriptionOrder(params, profileId => resolveAuthProfileEligibility({ ...params, profileId, now: Date.now() }).eligible, profileId => isProfileInCooldown(params.store, profileId));
|
|
13498
|
+
if (subscriptionOrder) return subscriptionOrder;
|
|
13495
13499
|
const { cfg, store, provider, preferredProfile } = params;
|
|
13496
13500
|
const providerKey = normalizeProviderId(provider);
|
|
13497
13501
|
const providerAuthKey = normalizeProviderIdForAuth(provider);
|
package/dist/models-CxHdes0w.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
2
2
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
3
|
-
import {
|
|
3
|
+
import { runSubscriptionLoginCli } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
4
4
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
5
5
|
import { d as colorize, f as isRich$1, p as theme } from "./globals-Bv4ZcVWM.js";
|
|
6
6
|
import { t as CONFIG_PATH } from "./paths-BfR2LXbA.js";
|
|
@@ -339,9 +339,10 @@ async function runBuiltInOpenAICodexLogin(params) {
|
|
|
339
339
|
else params.runtime.log(`Default model available: ${OPENAI_CODEX_DEFAULT_MODEL} (use --set-default to apply)`);
|
|
340
340
|
}
|
|
341
341
|
async function modelsAuthLoginCommand(opts, runtime) {
|
|
342
|
-
|
|
342
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: named subscriptions also work headlessly.
|
|
343
|
+
if (!opts.provider || ["claude", "anthropic", "chatgpt", "gpt", "openai-codex"].includes(String(opts.provider).toLowerCase())) {
|
|
343
344
|
const config = await loadValidConfigOrThrow();
|
|
344
|
-
return await
|
|
345
|
+
return await runSubscriptionLoginCli(opts.provider ?? (opts.device ? "chatgpt" : undefined), opts, runtime, { agentDir: resolveAgentDir(config, resolveDefaultAgentId(config)) });
|
|
345
346
|
}
|
|
346
347
|
if (!process.stdin.isTTY) throw new Error("models auth login requires an interactive TTY.");
|
|
347
348
|
const config = await loadValidConfigOrThrow();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
2
2
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
3
|
-
import {
|
|
3
|
+
import { runSubscriptionLoginCli } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
4
4
|
import { t as CONFIG_PATH } from "./paths-BJV7vkaX.js";
|
|
5
5
|
import { d as colorize, f as isRich$1, p as theme } from "./globals-BM8hKFm0.js";
|
|
6
6
|
import { S as shortenHomePath } from "./utils-DC4zYvW0.js";
|
|
@@ -440,9 +440,10 @@ async function runBuiltInOpenAICodexLogin(params) {
|
|
|
440
440
|
else params.runtime.log(`Default model available: ${OPENAI_CODEX_DEFAULT_MODEL} (use --set-default to apply)`);
|
|
441
441
|
}
|
|
442
442
|
async function modelsAuthLoginCommand(opts, runtime) {
|
|
443
|
-
|
|
443
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: named subscriptions also work headlessly.
|
|
444
|
+
if (!opts.provider || ["claude", "anthropic", "chatgpt", "gpt", "openai-codex"].includes(String(opts.provider).toLowerCase())) {
|
|
444
445
|
const config = await loadValidConfigOrThrow();
|
|
445
|
-
return await
|
|
446
|
+
return await runSubscriptionLoginCli(opts.provider ?? (opts.device ? "chatgpt" : undefined), opts, runtime, { agentDir: resolveAgentDir(config, resolveDefaultAgentId(config)) });
|
|
446
447
|
}
|
|
447
448
|
if (!process.stdin.isTTY) throw new Error("models auth login requires an interactive TTY.");
|
|
448
449
|
const config = await loadValidConfigOrThrow();
|
|
@@ -2593,11 +2594,13 @@ function registerModelsCli(program) {
|
|
|
2593
2594
|
await modelsAuthAddCommand({}, defaultRuntime);
|
|
2594
2595
|
});
|
|
2595
2596
|
});
|
|
2596
|
-
auth.command("login").description("
|
|
2597
|
+
auth.command("login [subscription]").description("Sign in to chatgpt (gpt) or claude; omit to list subscriptions; --provider for plugins") // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
2598
|
+
.option("--device", "Sign in to ChatGPT using a headless device code", false).option("--no-browser", "Print the Claude sign-in URL without opening a browser").option("--provider <id>", "Subscription or plugin provider id").option("--method <id>", "Provider auth method id").option("--set-default", "Apply the provider's default model recommendation", false).action(async (subscription, opts) => {
|
|
2597
2599
|
await runModelsCommand(async () => {
|
|
2598
2600
|
await modelsAuthLoginCommand({
|
|
2599
2601
|
device: Boolean(opts.device),
|
|
2600
|
-
|
|
2602
|
+
noBrowser: opts.browser === false,
|
|
2603
|
+
provider: subscription ?? opts.provider,
|
|
2601
2604
|
method: opts.method,
|
|
2602
2605
|
setDefault: Boolean(opts.setDefault)
|
|
2603
2606
|
}, defaultRuntime);
|
|
@@ -248,11 +248,13 @@ function registerModelsCli(program) {
|
|
|
248
248
|
await modelsAuthAddCommand({}, defaultRuntime);
|
|
249
249
|
});
|
|
250
250
|
});
|
|
251
|
-
auth.command("login").description("
|
|
251
|
+
auth.command("login [subscription]").description("Sign in to chatgpt (gpt) or claude; omit to list subscriptions; --provider for plugins") // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
252
|
+
.option("--device", "Sign in to ChatGPT using a headless device code", false).option("--no-browser", "Print the Claude sign-in URL without opening a browser").option("--provider <id>", "Subscription or plugin provider id").option("--method <id>", "Provider auth method id").option("--set-default", "Apply the provider's default model recommendation", false).action(async (subscription, opts) => {
|
|
252
253
|
await runModelsCommand(async () => {
|
|
253
254
|
await modelsAuthLoginCommand({
|
|
254
255
|
device: Boolean(opts.device),
|
|
255
|
-
|
|
256
|
+
noBrowser: opts.browser === false,
|
|
257
|
+
provider: subscription ?? opts.provider,
|
|
256
258
|
method: opts.method,
|
|
257
259
|
setDefault: Boolean(opts.setDefault)
|
|
258
260
|
}, defaultRuntime);
|
|
@@ -4,7 +4,7 @@ import { createImageGenerateTool } from "./image-generate.js";
|
|
|
4
4
|
import { handleUpdateCommand } from "./update-command.js";
|
|
5
5
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
6
6
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
7
|
-
import { handleDeviceLoginCommand } from "./
|
|
7
|
+
import { handleSubscriptionLoginCommand as handleDeviceLoginCommand } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
8
8
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
9
9
|
import { _ as normalizeStringEntries, a as resolveAgentDir, b as resolveAgentModelPrimaryValue, c as resolveAgentWorkspaceDir, d as resolveRunModelFallbacksOverride, f as resolveSessionAgentId, g as normalizeHyphenSlug, h as normalizeAtHashSlug, i as resolveAgentConfig, l as resolveDefaultAgentId, n as hasConfiguredModelFallbacks, p as resolveSessionAgentIds, r as listAgentIds, s as resolveAgentSkillsFilter, t as runTasksWithConcurrency, u as resolveEffectiveModelFallbacks, v as normalizeStringEntriesLower, x as toAgentModelListLike, y as resolveAgentModelFallbackValues } from "./run-with-concurrency-Cuc1THN9.js";
|
|
10
10
|
import { a as resolveGatewayPort, c as resolveStateDir, d as resolveRequiredHomeDir, l as expandHomePrefix, n as STATE_DIR, r as resolveConfigPath } from "./paths-hfkBoC7i.js";
|
|
@@ -4,7 +4,7 @@ import { createImageGenerateTool } from "./image-generate.js";
|
|
|
4
4
|
import { handleUpdateCommand } from "./update-command.js";
|
|
5
5
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
6
6
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
7
|
-
import { handleDeviceLoginCommand } from "./
|
|
7
|
+
import { handleSubscriptionLoginCommand as handleDeviceLoginCommand } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
8
8
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
9
9
|
import { $ as isValidAgentId, C as filterBootstrapFilesForSession, D as runCommandWithTimeout, G as normalizeStringEntries, J as DEFAULT_MAIN_KEY, K as normalizeStringEntriesLower, M as openBoundaryFileSync, O as runExec, Q as classifySessionKeyShape, S as ensureAgentWorkspace, T as resolveJohnnessPackageRoot, U as normalizeAtHashSlug, V as normalizeWindowsPathForComparison, W as normalizeHyphenSlug, X as buildAgentPeerSessionKey, Y as buildAgentMainSessionKey, _t as resolveAgentModelFallbackValues, a as resolveAgentDir, at as scopedHeartbeatWakeOptions, c as resolveAgentWorkspaceDir, ct as normalizeOptionalAccountId, d as resolveRunModelFallbacksOverride, dt as getSubagentDepth, et as normalizeAgentId, f as resolveSessionAgentId, ft as isAcpSessionKey, gt as resolveThreadParentSessionKey, h as DEFAULT_AGENT_WORKSPACE_DIR, ht as parseAgentSessionKey, i as resolveAgentConfig, it as sanitizeAgentId, j as openBoundaryFile, k as spawnWithFallback, l as resolveDefaultAgentId, lt as isBlockedObjectKey, mt as isSubagentSessionKey, n as hasConfiguredModelFallbacks, nt as resolveAgentIdFromSessionKey, ot as DEFAULT_ACCOUNT_ID, p as resolveSessionAgentIds, pt as isCronSessionKey, q as DEFAULT_AGENT_ID, r as listAgentIds, rt as resolveThreadSessionKeys, s as resolveAgentSkillsFilter, st as normalizeAccountId$2, t as runTasksWithConcurrency, tt as normalizeMainKey, u as resolveEffectiveModelFallbacks, ut as deriveSessionChatType, v as DEFAULT_IDENTITY_FILENAME, vt as resolveAgentModelPrimaryValue, w as loadWorkspaceBootstrapFiles, yt as toAgentModelListLike } from "./run-with-concurrency-BXSUl5Nj.js";
|
|
10
10
|
import { a as resolveGatewayPort, c as resolveStateDir, d as resolveRequiredHomeDir, l as expandHomePrefix, n as STATE_DIR, r as resolveConfigPath } from "./paths-GBpjI3o0.js";
|
|
@@ -226,7 +226,11 @@ const ERROR_PATTERNS = {
|
|
|
226
226
|
/insufficient[_ ]quota/i,
|
|
227
227
|
"credit balance",
|
|
228
228
|
"plans & billing",
|
|
229
|
-
"insufficient balance"
|
|
229
|
+
"insufficient balance",
|
|
230
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_FAILOVER_87: Claude subscription credentials that cannot serve this request.
|
|
231
|
+
"draw from extra usage",
|
|
232
|
+
"claude_code_version_too_old",
|
|
233
|
+
/claude code [0-9.]+ does not support this model/i
|
|
230
234
|
],
|
|
231
235
|
authPermanent: [
|
|
232
236
|
/api[_ ]?key[_ ]?(?:revoked|invalid|deactivated|deleted)/i,
|
|
@@ -226,7 +226,11 @@ const ERROR_PATTERNS = {
|
|
|
226
226
|
/insufficient[_ ]quota/i,
|
|
227
227
|
"credit balance",
|
|
228
228
|
"plans & billing",
|
|
229
|
-
"insufficient balance"
|
|
229
|
+
"insufficient balance",
|
|
230
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_FAILOVER_87: Claude subscription credentials that cannot serve this request.
|
|
231
|
+
"draw from extra usage",
|
|
232
|
+
"claude_code_version_too_old",
|
|
233
|
+
/claude code [0-9.]+ does not support this model/i
|
|
230
234
|
],
|
|
231
235
|
authPermanent: [
|
|
232
236
|
/api[_ ]?key[_ ]?(?:revoked|invalid|deactivated|deleted)/i,
|
|
@@ -8785,7 +8785,11 @@ const ERROR_PATTERNS = {
|
|
|
8785
8785
|
/insufficient[_ ]quota/i,
|
|
8786
8786
|
"credit balance",
|
|
8787
8787
|
"plans & billing",
|
|
8788
|
-
"insufficient balance"
|
|
8788
|
+
"insufficient balance",
|
|
8789
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_FAILOVER_87: Claude subscription credentials that cannot serve this request.
|
|
8790
|
+
"draw from extra usage",
|
|
8791
|
+
"claude_code_version_too_old",
|
|
8792
|
+
/claude code [0-9.]+ does not support this model/i
|
|
8789
8793
|
],
|
|
8790
8794
|
authPermanent: [
|
|
8791
8795
|
/api[_ ]?key[_ ]?(?:revoked|invalid|deactivated|deleted)/i,
|
|
@@ -8788,7 +8788,11 @@ const ERROR_PATTERNS = {
|
|
|
8788
8788
|
/insufficient[_ ]quota/i,
|
|
8789
8789
|
"credit balance",
|
|
8790
8790
|
"plans & billing",
|
|
8791
|
-
"insufficient balance"
|
|
8791
|
+
"insufficient balance",
|
|
8792
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_FAILOVER_87: Claude subscription credentials that cannot serve this request.
|
|
8793
|
+
"draw from extra usage",
|
|
8794
|
+
"claude_code_version_too_old",
|
|
8795
|
+
/claude code [0-9.]+ does not support this model/i
|
|
8792
8796
|
],
|
|
8793
8797
|
authPermanent: [
|
|
8794
8798
|
/api[_ ]?key[_ ]?(?:revoked|invalid|deactivated|deleted)/i,
|
|
@@ -235,9 +235,10 @@ function buildChatCommands() {
|
|
|
235
235
|
defineChatCommand({
|
|
236
236
|
key: "login",
|
|
237
237
|
nativeName: "login",
|
|
238
|
-
description: "
|
|
238
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
239
239
|
textAliases: ["/login", "/relogin"],
|
|
240
|
-
category: "management"
|
|
240
|
+
category: "management",
|
|
241
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
241
242
|
}),
|
|
242
243
|
defineChatCommand({
|
|
243
244
|
key: "status",
|
|
@@ -235,9 +235,10 @@ function buildChatCommands() {
|
|
|
235
235
|
defineChatCommand({
|
|
236
236
|
key: "login",
|
|
237
237
|
nativeName: "login",
|
|
238
|
-
description: "
|
|
238
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
239
239
|
textAliases: ["/login", "/relogin"],
|
|
240
|
-
category: "management"
|
|
240
|
+
category: "management",
|
|
241
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
241
242
|
}),
|
|
242
243
|
defineChatCommand({
|
|
243
244
|
key: "status",
|
|
@@ -235,9 +235,10 @@ function buildChatCommands() {
|
|
|
235
235
|
defineChatCommand({
|
|
236
236
|
key: "login",
|
|
237
237
|
nativeName: "login",
|
|
238
|
-
description: "
|
|
238
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
239
239
|
textAliases: ["/login", "/relogin"],
|
|
240
|
-
category: "management"
|
|
240
|
+
category: "management",
|
|
241
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
241
242
|
}),
|
|
242
243
|
defineChatCommand({
|
|
243
244
|
key: "status",
|
|
@@ -235,9 +235,10 @@ function buildChatCommands() {
|
|
|
235
235
|
defineChatCommand({
|
|
236
236
|
key: "login",
|
|
237
237
|
nativeName: "login",
|
|
238
|
-
description: "
|
|
238
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
239
239
|
textAliases: ["/login", "/relogin"],
|
|
240
|
-
category: "management"
|
|
240
|
+
category: "management",
|
|
241
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
241
242
|
}),
|
|
242
243
|
defineChatCommand({
|
|
243
244
|
key: "status",
|
|
@@ -235,9 +235,10 @@ function buildChatCommands() {
|
|
|
235
235
|
defineChatCommand({
|
|
236
236
|
key: "login",
|
|
237
237
|
nativeName: "login",
|
|
238
|
-
description: "
|
|
238
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
239
239
|
textAliases: ["/login", "/relogin"],
|
|
240
|
-
category: "management"
|
|
240
|
+
category: "management",
|
|
241
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
241
242
|
}),
|
|
242
243
|
defineChatCommand({
|
|
243
244
|
key: "status",
|
|
@@ -235,9 +235,10 @@ function buildChatCommands() {
|
|
|
235
235
|
defineChatCommand({
|
|
236
236
|
key: "login",
|
|
237
237
|
nativeName: "login",
|
|
238
|
-
description: "
|
|
238
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
239
239
|
textAliases: ["/login", "/relogin"],
|
|
240
|
-
category: "management"
|
|
240
|
+
category: "management",
|
|
241
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
241
242
|
}),
|
|
242
243
|
defineChatCommand({
|
|
243
244
|
key: "status",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { claudeSubscriptionOrder } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
1
2
|
// JOHNNESS_PATCH_CATALOG_REFRESH_65
|
|
2
3
|
import { mergeShippedCatalog65 } from "../catalog-refresh.js";
|
|
3
4
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
@@ -3306,6 +3307,9 @@ function resolveAuthProfileEligibility(params) {
|
|
|
3306
3307
|
};
|
|
3307
3308
|
}
|
|
3308
3309
|
function resolveAuthProfileOrder(params) {
|
|
3310
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: subscription-first, API fallback, cooldown-aware.
|
|
3311
|
+
const subscriptionOrder = claudeSubscriptionOrder(params, profileId => resolveAuthProfileEligibility({ ...params, profileId, now: Date.now() }).eligible, profileId => isProfileInCooldown(params.store, profileId));
|
|
3312
|
+
if (subscriptionOrder) return subscriptionOrder;
|
|
3309
3313
|
const { cfg, store, provider, preferredProfile } = params;
|
|
3310
3314
|
const providerKey = normalizeProviderId(provider);
|
|
3311
3315
|
const providerAuthKey = normalizeProviderIdForAuth(provider);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { claudeSubscriptionOrder } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
1
2
|
// JOHNNESS_PATCH_CATALOG_REFRESH_65
|
|
2
3
|
import { mergeShippedCatalog65 } from "../catalog-refresh.js";
|
|
3
4
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
@@ -4307,6 +4308,9 @@ function resolveAuthProfileEligibility(params) {
|
|
|
4307
4308
|
};
|
|
4308
4309
|
}
|
|
4309
4310
|
function resolveAuthProfileOrder(params) {
|
|
4311
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: subscription-first, API fallback, cooldown-aware.
|
|
4312
|
+
const subscriptionOrder = claudeSubscriptionOrder(params, profileId => resolveAuthProfileEligibility({ ...params, profileId, now: Date.now() }).eligible, profileId => isProfileInCooldown(params.store, profileId));
|
|
4313
|
+
if (subscriptionOrder) return subscriptionOrder;
|
|
4310
4314
|
const { cfg, store, provider, preferredProfile } = params;
|
|
4311
4315
|
const providerKey = normalizeProviderId(provider);
|
|
4312
4316
|
const providerAuthKey = normalizeProviderIdForAuth(provider);
|
|
@@ -4,7 +4,7 @@ import { createImageGenerateTool } from "../image-generate.js";
|
|
|
4
4
|
import { handleUpdateCommand } from "../update-command.js";
|
|
5
5
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
6
6
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
7
|
-
import { handleDeviceLoginCommand } from "../
|
|
7
|
+
import { handleSubscriptionLoginCommand as handleDeviceLoginCommand } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
8
8
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
9
9
|
import { $ as buildAgentPeerSessionKey, C as filterBootstrapFilesForSession, D as runCommandWithTimeout, G as normalizeStringEntries, J as resolveAgentModelPrimaryValue, K as normalizeStringEntriesLower, M as openBoundaryFileSync, O as runExec, Q as buildAgentMainSessionKey, S as ensureAgentWorkspace, T as resolveJohnnessPackageRoot, U as normalizeAtHashSlug, V as normalizeWindowsPathForComparison, W as normalizeHyphenSlug, X as DEFAULT_AGENT_ID, Y as toAgentModelListLike, Z as DEFAULT_MAIN_KEY, _t as isSubagentSessionKey, a as resolveAgentDir, at as resolveAgentIdFromSessionKey, c as resolveAgentWorkspaceDir, ct as scopedHeartbeatWakeOptions, d as resolveRunModelFallbacksOverride, dt as normalizeOptionalAccountId, f as resolveSessionAgentId, ft as isBlockedObjectKey, gt as isCronSessionKey, h as DEFAULT_AGENT_WORKSPACE_DIR, ht as isAcpSessionKey, i as resolveAgentConfig, it as normalizeMainKey, j as openBoundaryFile, k as spawnWithFallback, l as resolveDefaultAgentId, lt as DEFAULT_ACCOUNT_ID, mt as getSubagentDepth, n as hasConfiguredModelFallbacks, nt as isValidAgentId, ot as resolveThreadSessionKeys, p as resolveSessionAgentIds, pt as deriveSessionChatType, q as resolveAgentModelFallbackValues, r as listAgentIds, rt as normalizeAgentId, s as resolveAgentSkillsFilter, st as sanitizeAgentId, t as runTasksWithConcurrency, tt as classifySessionKeyShape, u as resolveEffectiveModelFallbacks, ut as normalizeAccountId$2, v as DEFAULT_IDENTITY_FILENAME, vt as parseAgentSessionKey, w as loadWorkspaceBootstrapFiles, yt as resolveThreadParentSessionKey } from "./run-with-concurrency-XmKq-xNS.js";
|
|
10
10
|
import { a as getWebAuthAgeMs, d as readWebSelfId, g as resolveAccountEntry, h as webAuthExists, n as resolveWhatsAppAccount, o as logWebSelfId, s as logoutWeb, t as hasAnyWhatsAppAuth } from "./accounts-D-pSCe1E.js";
|
|
@@ -4,7 +4,7 @@ import { createImageGenerateTool } from "../image-generate.js";
|
|
|
4
4
|
import { handleUpdateCommand } from "../update-command.js";
|
|
5
5
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
6
6
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
7
|
-
import { handleDeviceLoginCommand } from "../
|
|
7
|
+
import { handleSubscriptionLoginCommand as handleDeviceLoginCommand } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
8
8
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
9
9
|
import { A as mediaKindFromMime, C as imageMimeFromFormat, E as kindFromMime, O as MAX_IMAGE_BYTES, T as isGifMedia, a as isMarkdownCapableMessageChannel, b as detectMime, c as resolveGatewayMessageChannel, d as GATEWAY_CLIENT_MODES, f as GATEWAY_CLIENT_NAMES, g as getImageMetadata, i as isInternalMessageChannel, l as resolveMessageChannel, n as isDeliverableMessageChannel, o as listDeliverableMessageChannels, r as isGatewayMessageChannel, s as normalizeMessageChannel, t as INTERNAL_MESSAGE_CHANNEL, u as GATEWAY_CLIENT_IDS, w as isAudioFileName, x as extensionForMime, y as resizeToJpeg } from "./message-channel-DfmYEnql.js";
|
|
10
10
|
import { B as shouldLogVerbose, C as isPlainObject, D as logWarn, E as logInfo, F as unregisterActiveProgressLine, G as theme, H as warn, I as danger, K as getChildLogger, M as defaultRuntime, N as clearActiveProgressLine, O as createSubsystemLogger, P as registerActiveProgressLine, R as logVerbose, S as truncateUtf16Safe, T as logError, U as colorize, W as isRich, X as resolvePreferredJohnnessTmpDir, Y as normalizeLogLevel, Z as consumeRootOptionToken, _ as shortenHomeInString, a as ensureDir$3, b as sliceUtf16Safe, c as isRecord$1, d as normalizeE164, h as resolveUserPath, j as createNonExitingRuntime, k as sanitizeForLog, o as escapeRegExp, r as clampInt, s as formatTerminalLink, t as CONFIG_DIR, v as shortenHomePath, w as logDebug, y as sleep$1, z as setVerbose } from "./utils-B0IyLNx9.js";
|
|
@@ -4,7 +4,7 @@ import { createImageGenerateTool } from "../image-generate.js";
|
|
|
4
4
|
import { handleUpdateCommand } from "../update-command.js";
|
|
5
5
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
6
6
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
7
|
-
import { handleDeviceLoginCommand } from "../
|
|
7
|
+
import { handleSubscriptionLoginCommand as handleDeviceLoginCommand } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
8
8
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
9
9
|
import { $ as buildAgentPeerSessionKey, C as filterBootstrapFilesForSession, D as runCommandWithTimeout, G as normalizeStringEntries, J as resolveAgentModelPrimaryValue, K as normalizeStringEntriesLower, M as openBoundaryFileSync, O as runExec, Q as buildAgentMainSessionKey, S as ensureAgentWorkspace, T as resolveJohnnessPackageRoot, U as normalizeAtHashSlug, V as normalizeWindowsPathForComparison, W as normalizeHyphenSlug, X as DEFAULT_AGENT_ID, Y as toAgentModelListLike, Z as DEFAULT_MAIN_KEY, _t as isSubagentSessionKey, a as resolveAgentDir, at as resolveAgentIdFromSessionKey, c as resolveAgentWorkspaceDir, ct as scopedHeartbeatWakeOptions, d as resolveRunModelFallbacksOverride, dt as normalizeOptionalAccountId, f as resolveSessionAgentId, ft as isBlockedObjectKey, gt as isCronSessionKey, h as DEFAULT_AGENT_WORKSPACE_DIR, ht as isAcpSessionKey, i as resolveAgentConfig, it as normalizeMainKey, j as openBoundaryFile, k as spawnWithFallback, l as resolveDefaultAgentId, lt as DEFAULT_ACCOUNT_ID, mt as getSubagentDepth, n as hasConfiguredModelFallbacks, nt as isValidAgentId, ot as resolveThreadSessionKeys, p as resolveSessionAgentIds, pt as deriveSessionChatType, q as resolveAgentModelFallbackValues, r as listAgentIds, rt as normalizeAgentId, s as resolveAgentSkillsFilter, st as sanitizeAgentId, t as runTasksWithConcurrency, tt as classifySessionKeyShape, u as resolveEffectiveModelFallbacks, ut as normalizeAccountId$2, v as DEFAULT_IDENTITY_FILENAME, vt as parseAgentSessionKey, w as loadWorkspaceBootstrapFiles, yt as resolveThreadParentSessionKey } from "./run-with-concurrency-BMh-rgTO.js";
|
|
10
10
|
import { c as getWebAuthAgeMs, i as resolveWhatsAppAccount, l as logWebSelfId, m as readWebSelfId, t as hasAnyWhatsAppAuth, u as logoutWeb, v as webAuthExists, y as resolveAccountEntry } from "./accounts-B2lcx0zq.js";
|
|
@@ -4,7 +4,7 @@ import { createImageGenerateTool } from "../image-generate.js";
|
|
|
4
4
|
import { handleUpdateCommand } from "../update-command.js";
|
|
5
5
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
6
6
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
7
|
-
import { handleDeviceLoginCommand } from "../
|
|
7
|
+
import { handleSubscriptionLoginCommand as handleDeviceLoginCommand } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
8
8
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
9
9
|
import { $ as isValidAgentId, C as filterBootstrapFilesForSession, D as runCommandWithTimeout, G as normalizeStringEntries, J as DEFAULT_MAIN_KEY, K as normalizeStringEntriesLower, M as openBoundaryFileSync, O as runExec, Q as classifySessionKeyShape, S as ensureAgentWorkspace, T as resolveJohnnessPackageRoot, U as normalizeAtHashSlug, V as normalizeWindowsPathForComparison, W as normalizeHyphenSlug, X as buildAgentPeerSessionKey, Y as buildAgentMainSessionKey, _t as resolveAgentModelFallbackValues, a as resolveAgentDir, at as scopedHeartbeatWakeOptions, c as resolveAgentWorkspaceDir, ct as normalizeOptionalAccountId, d as resolveRunModelFallbacksOverride, dt as getSubagentDepth, et as normalizeAgentId, f as resolveSessionAgentId, ft as isAcpSessionKey, gt as resolveThreadParentSessionKey, h as DEFAULT_AGENT_WORKSPACE_DIR, ht as parseAgentSessionKey, i as resolveAgentConfig, it as sanitizeAgentId, j as openBoundaryFile, k as spawnWithFallback, l as resolveDefaultAgentId, lt as isBlockedObjectKey, mt as isSubagentSessionKey, n as hasConfiguredModelFallbacks, nt as resolveAgentIdFromSessionKey, ot as DEFAULT_ACCOUNT_ID, p as resolveSessionAgentIds, pt as isCronSessionKey, q as DEFAULT_AGENT_ID, r as listAgentIds, rt as resolveThreadSessionKeys, s as resolveAgentSkillsFilter, st as normalizeAccountId$2, t as runTasksWithConcurrency, tt as normalizeMainKey, u as resolveEffectiveModelFallbacks, ut as deriveSessionChatType, v as DEFAULT_IDENTITY_FILENAME, vt as resolveAgentModelPrimaryValue, w as loadWorkspaceBootstrapFiles, yt as toAgentModelListLike } from "./run-with-concurrency-DCb27DCP.js";
|
|
10
10
|
import { a as resolveGatewayPort, c as resolveStateDir, d as resolveRequiredHomeDir, l as expandHomePrefix, n as STATE_DIR, r as resolveConfigPath } from "./paths-B9fwHuf0.js";
|
|
@@ -4,7 +4,7 @@ import { createImageGenerateTool } from "../image-generate.js";
|
|
|
4
4
|
import { handleUpdateCommand } from "../update-command.js";
|
|
5
5
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60
|
|
6
6
|
// JOHNNESS_PATCH_DEVICE_LOGIN_60B
|
|
7
|
-
import { handleDeviceLoginCommand } from "../
|
|
7
|
+
import { handleSubscriptionLoginCommand as handleDeviceLoginCommand } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
8
8
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
9
9
|
import { $ as stripUndefinedFields, A as unpinMessageDiscord, At as resolveAllowlistProviderRuntimeGroupPolicy, B as listScheduledEventsDiscord, C as editMessageDiscord, Ct as hasAnyGuildPermissionDiscord, D as pinMessageDiscord, Dt as evaluateGroupRouteAccessForPolicy, E as listThreadsDiscord, Et as chunkDiscordTextWithMode, F as fetchMemberInfoDiscord, Ft as buildChannelKeyCandidates, G as uploadStickerDiscord, H as timeoutMemberDiscord, I as fetchRoleInfoDiscord, It as normalizeChannelSlug, J as editChannelDiscord, K as createChannelDiscord, L as fetchVoiceStatusDiscord, Lt as resolveChannelEntryMatchWithFallback, M as banMemberDiscord, Mt as resolveOpenProviderRuntimeGroupPolicy, N as createScheduledEventDiscord, Nt as warnMissingProviderGroupPolicyFallbackOnce, O as readMessagesDiscord, Ot as evaluateMatchedGroupAccessForPolicy, P as fetchChannelInfoDiscord, Pt as applyChannelMatchMeta, Q as sendDiscordText, R as kickMemberDiscord, S as deleteMessageDiscord, St as fetchChannelPermissionsDiscord, T as listPinsDiscord, Tt as createDiscordRestClient, U as listGuildEmojisDiscord, V as removeRoleDiscord, W as uploadEmojiDiscord, X as removeChannelPermissionDiscord, Y as moveChannelDiscord, Z as setChannelPermissionDiscord, _ as sendStickerDiscord, _t as formatDiscordUserTag, a as sendDiscordComponentMessage, at as normalizeDiscordAllowList, b as formatMention, bt as DiscordApiError, c as parseDiscordComponentCustomId, ct as resolveDiscordChannelConfigWithFallback, d as parseDiscordModalCustomIdForCarbon, dt as resolveDiscordOwnerAccess, et as parseDiscordTarget, f as readDiscordComponentSpec, ft as resolveDiscordOwnerAllowFrom, g as sendPollDiscord, gt as formatDiscordReactionEmoji, h as sendMessageDiscord, ht as shouldEmitDiscordReactionNotification, i as removeReactionDiscord, it as isDiscordGroupAllowedByPolicy, j as addRoleDiscord, jt as resolveDefaultGroupPolicy, k as searchMessagesDiscord, kt as GROUP_POLICY_BLOCKED_LABEL, l as parseDiscordComponentCustomIdForCarbon, lt as resolveDiscordGuildEntry, m as resolveDiscordModalEntry, mt as resolveGroupDmAllow, n as reactMessageDiscord, nt as listDiscordDirectoryGroupsLive, o as createDiscordFormModal, ot as normalizeDiscordSlug, p as resolveDiscordComponentEntry, pt as resolveDiscordShouldRequireMention, q as deleteChannelDiscord, r as removeOwnReactionsDiscord, rt as listDiscordDirectoryPeersLive, s as formatDiscordComponentEventText, st as resolveDiscordAllowListMatch, t as fetchReactionsDiscord, tt as resolveDiscordChannelId, u as parseDiscordModalCustomId, ut as resolveDiscordMemberAccessState, v as sendVoiceMessageDiscord, vt as resolveDiscordSystemLocation, w as fetchMessageDiscord, wt as createDiscordClient, x as createThreadDiscord, xt as fetchDiscord, y as sendWebhookMessageDiscord, yt as resolveTimestampMs, z as listGuildChannelsDiscord } from "./send-Dy8sRjb5.js";
|
|
10
10
|
import { $ as buildAgentPeerSessionKey, C as filterBootstrapFilesForSession, D as runCommandWithTimeout, G as normalizeStringEntries, J as resolveAgentModelPrimaryValue, K as normalizeStringEntriesLower, M as openBoundaryFileSync, O as runExec, Q as buildAgentMainSessionKey, S as ensureAgentWorkspace, T as resolveJohnnessPackageRoot, U as normalizeAtHashSlug, V as normalizeWindowsPathForComparison, W as normalizeHyphenSlug, X as DEFAULT_AGENT_ID, Y as toAgentModelListLike, Z as DEFAULT_MAIN_KEY, _t as isSubagentSessionKey, a as resolveAgentDir, at as resolveAgentIdFromSessionKey, c as resolveAgentWorkspaceDir, ct as scopedHeartbeatWakeOptions, d as resolveRunModelFallbacksOverride, dt as normalizeOptionalAccountId, f as resolveSessionAgentId, ft as isBlockedObjectKey, gt as isCronSessionKey, h as DEFAULT_AGENT_WORKSPACE_DIR, ht as isAcpSessionKey, i as resolveAgentConfig, it as normalizeMainKey, j as openBoundaryFile, k as spawnWithFallback, l as resolveDefaultAgentId, lt as DEFAULT_ACCOUNT_ID, mt as getSubagentDepth, n as hasConfiguredModelFallbacks, nt as isValidAgentId, ot as resolveThreadSessionKeys, p as resolveSessionAgentIds, pt as deriveSessionChatType, q as resolveAgentModelFallbackValues, r as listAgentIds, rt as normalizeAgentId, s as resolveAgentSkillsFilter, st as sanitizeAgentId, t as runTasksWithConcurrency, tt as classifySessionKeyShape, u as resolveEffectiveModelFallbacks, ut as normalizeAccountId$2, v as DEFAULT_IDENTITY_FILENAME, vt as parseAgentSessionKey, w as loadWorkspaceBootstrapFiles, yt as resolveThreadParentSessionKey } from "./run-with-concurrency-D4zr_gVN.js";
|
|
@@ -3301,9 +3301,10 @@ function buildChatCommands() {
|
|
|
3301
3301
|
defineChatCommand({
|
|
3302
3302
|
key: "login",
|
|
3303
3303
|
nativeName: "login",
|
|
3304
|
-
description: "
|
|
3304
|
+
description: "Subscription login: /login chatgpt (gpt) or /login claude (owner only).", // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
3305
3305
|
textAliases: ["/login", "/relogin"],
|
|
3306
|
-
category: "management"
|
|
3306
|
+
category: "management",
|
|
3307
|
+
args: [{ name: "provider", description: "chatgpt, gpt or claude; optional complete Claude code after provider", type: "string", captureRemaining: true }]
|
|
3307
3308
|
}),
|
|
3308
3309
|
defineChatCommand({
|
|
3309
3310
|
key: "status",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { claudeSubscriptionOrder } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
1
2
|
// JOHNNESS_PATCH_CATALOG_REFRESH_65
|
|
2
3
|
import { mergeShippedCatalog65 } from "../catalog-refresh.js";
|
|
3
4
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
@@ -18488,6 +18489,9 @@ function resolveAuthProfileEligibility(params) {
|
|
|
18488
18489
|
};
|
|
18489
18490
|
}
|
|
18490
18491
|
function resolveAuthProfileOrder(params) {
|
|
18492
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: subscription-first, API fallback, cooldown-aware.
|
|
18493
|
+
const subscriptionOrder = claudeSubscriptionOrder(params, profileId => resolveAuthProfileEligibility({ ...params, profileId, now: Date.now() }).eligible, profileId => isProfileInCooldown(params.store, profileId));
|
|
18494
|
+
if (subscriptionOrder) return subscriptionOrder;
|
|
18491
18495
|
const { cfg, store, provider, preferredProfile } = params;
|
|
18492
18496
|
const providerKey = normalizeProviderId(provider);
|
|
18493
18497
|
const providerAuthKey = normalizeProviderIdForAuth(provider);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { claudeSubscriptionOrder } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
|
|
1
2
|
// JOHNNESS_PATCH_CATALOG_REFRESH_65
|
|
2
3
|
import { mergeShippedCatalog65 } from "../catalog-refresh.js";
|
|
3
4
|
// JOHNNESS_PATCH_NATIVE_STATE_MIGRATION_59
|
|
@@ -18498,6 +18499,9 @@ function resolveAuthProfileEligibility(params) {
|
|
|
18498
18499
|
};
|
|
18499
18500
|
}
|
|
18500
18501
|
function resolveAuthProfileOrder(params) {
|
|
18502
|
+
// JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86: subscription-first, API fallback, cooldown-aware.
|
|
18503
|
+
const subscriptionOrder = claudeSubscriptionOrder(params, profileId => resolveAuthProfileEligibility({ ...params, profileId, now: Date.now() }).eligible, profileId => isProfileInCooldown(params.store, profileId));
|
|
18504
|
+
if (subscriptionOrder) return subscriptionOrder;
|
|
18501
18505
|
const { cfg, store, provider, preferredProfile } = params;
|
|
18502
18506
|
const providerKey = normalizeProviderId(provider);
|
|
18503
18507
|
const providerAuthKey = normalizeProviderIdForAuth(provider);
|