@maximoai/maximo-syntax-cli 0.1.9 → 0.1.11
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/README.md +30 -0
- package/dist/cli.mjs +797 -281
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -40868,9 +40868,7 @@ var init_oauth = __esm(() => {
|
|
|
40868
40868
|
MCP_PROXY_PATH: "/v1/mcp/{server_id}"
|
|
40869
40869
|
} : undefined;
|
|
40870
40870
|
ALLOWED_OAUTH_BASE_URLS = [
|
|
40871
|
-
"https://
|
|
40872
|
-
"https://claude.fedstart.com",
|
|
40873
|
-
"https://claude-staging.fedstart.com"
|
|
40871
|
+
"https://api.maximoai.co"
|
|
40874
40872
|
];
|
|
40875
40873
|
});
|
|
40876
40874
|
|
|
@@ -107984,8 +107982,8 @@ async function getOauthProfileFromApiKey() {
|
|
|
107984
107982
|
logError2(error41);
|
|
107985
107983
|
}
|
|
107986
107984
|
}
|
|
107987
|
-
async function getOauthProfileFromOauthToken(accessToken) {
|
|
107988
|
-
const endpoint = `${getOauthConfig().BASE_API_URL}/api/oauth/profile`;
|
|
107985
|
+
async function getOauthProfileFromOauthToken(accessToken, loginWithMaximoAi) {
|
|
107986
|
+
const endpoint = loginWithMaximoAi ? MAXIMO_OAUTH_CONFIG.PROFILE_URL : `${getOauthConfig().BASE_API_URL}/api/oauth/profile`;
|
|
107989
107987
|
try {
|
|
107990
107988
|
const response = await axios_default.get(endpoint, {
|
|
107991
107989
|
headers: {
|
|
@@ -107999,12 +107997,17 @@ async function getOauthProfileFromOauthToken(accessToken) {
|
|
|
107999
107997
|
logError2(error41);
|
|
108000
107998
|
}
|
|
108001
107999
|
}
|
|
108000
|
+
var MAXIMO_OAUTH_CONFIG;
|
|
108002
108001
|
var init_getOauthProfile = __esm(() => {
|
|
108003
108002
|
init_axios2();
|
|
108004
108003
|
init_oauth();
|
|
108005
108004
|
init_auth2();
|
|
108006
108005
|
init_config2();
|
|
108007
108006
|
init_log3();
|
|
108007
|
+
MAXIMO_OAUTH_CONFIG = {
|
|
108008
|
+
BASE_API_URL: "https://api.maximoai.co",
|
|
108009
|
+
PROFILE_URL: "https://api.maximoai.co/syntax/auth/oauth/profile"
|
|
108010
|
+
};
|
|
108008
108011
|
});
|
|
108009
108012
|
|
|
108010
108013
|
// src/services/oauth/client.ts
|
|
@@ -108021,7 +108024,8 @@ __export(exports_client, {
|
|
|
108021
108024
|
fetchAndStoreUserRoles: () => fetchAndStoreUserRoles,
|
|
108022
108025
|
exchangeCodeForTokens: () => exchangeCodeForTokens,
|
|
108023
108026
|
createAndStoreApiKey: () => createAndStoreApiKey,
|
|
108024
|
-
buildAuthUrl: () => buildAuthUrl
|
|
108027
|
+
buildAuthUrl: () => buildAuthUrl,
|
|
108028
|
+
MAXIMO_OAUTH_CONFIG: () => MAXIMO_OAUTH_CONFIG2
|
|
108025
108029
|
});
|
|
108026
108030
|
function shouldUseMaximoAIAuth(scopes) {
|
|
108027
108031
|
return Boolean(scopes?.includes(CLAUDE_AI_INFERENCE_SCOPE));
|
|
@@ -108040,12 +108044,12 @@ function buildAuthUrl({
|
|
|
108040
108044
|
loginHint,
|
|
108041
108045
|
loginMethod
|
|
108042
108046
|
}) {
|
|
108043
|
-
const authUrlBase = loginWithMaximoAi ?
|
|
108047
|
+
const authUrlBase = loginWithMaximoAi ? MAXIMO_OAUTH_CONFIG2.AUTHORIZE_URL : getOauthConfig().CONSOLE_AUTHORIZE_URL;
|
|
108044
108048
|
const authUrl = new URL(authUrlBase);
|
|
108045
108049
|
authUrl.searchParams.append("code", "true");
|
|
108046
|
-
authUrl.searchParams.append("client_id", getOauthConfig().CLIENT_ID);
|
|
108050
|
+
authUrl.searchParams.append("client_id", loginWithMaximoAi ? MAXIMO_OAUTH_CONFIG2.CLIENT_ID : getOauthConfig().CLIENT_ID);
|
|
108047
108051
|
authUrl.searchParams.append("response_type", "code");
|
|
108048
|
-
authUrl.searchParams.append("redirect_uri", isManual ? getOauthConfig().MANUAL_REDIRECT_URL : `http://localhost:${port}/callback`);
|
|
108052
|
+
authUrl.searchParams.append("redirect_uri", isManual ? loginWithMaximoAi ? MAXIMO_OAUTH_CONFIG2.MANUAL_REDIRECT_URL : getOauthConfig().MANUAL_REDIRECT_URL : `http://localhost:${port}/callback`);
|
|
108049
108053
|
const scopesToUse = inferenceOnly ? [CLAUDE_AI_INFERENCE_SCOPE] : ALL_OAUTH_SCOPES;
|
|
108050
108054
|
authUrl.searchParams.append("scope", scopesToUse.join(" "));
|
|
108051
108055
|
authUrl.searchParams.append("code_challenge", codeChallenge);
|
|
@@ -108062,19 +108066,20 @@ function buildAuthUrl({
|
|
|
108062
108066
|
}
|
|
108063
108067
|
return authUrl.toString();
|
|
108064
108068
|
}
|
|
108065
|
-
async function exchangeCodeForTokens(authorizationCode, state, codeVerifier, port, useManualRedirect = false, expiresIn) {
|
|
108069
|
+
async function exchangeCodeForTokens(authorizationCode, state, codeVerifier, port, useManualRedirect = false, expiresIn, loginWithMaximoAi) {
|
|
108070
|
+
const config2 = loginWithMaximoAi ? MAXIMO_OAUTH_CONFIG2 : getOauthConfig();
|
|
108066
108071
|
const requestBody = {
|
|
108067
108072
|
grant_type: "authorization_code",
|
|
108068
108073
|
code: authorizationCode,
|
|
108069
|
-
redirect_uri: useManualRedirect ?
|
|
108070
|
-
client_id:
|
|
108074
|
+
redirect_uri: useManualRedirect ? config2.MANUAL_REDIRECT_URL : `http://localhost:${port}/callback`,
|
|
108075
|
+
client_id: config2.CLIENT_ID,
|
|
108071
108076
|
code_verifier: codeVerifier,
|
|
108072
108077
|
state
|
|
108073
108078
|
};
|
|
108074
108079
|
if (expiresIn !== undefined) {
|
|
108075
108080
|
requestBody.expires_in = expiresIn;
|
|
108076
108081
|
}
|
|
108077
|
-
const response = await axios_default.post(
|
|
108082
|
+
const response = await axios_default.post(config2.TOKEN_URL, requestBody, {
|
|
108078
108083
|
headers: { "Content-Type": "application/json" },
|
|
108079
108084
|
timeout: 15000
|
|
108080
108085
|
});
|
|
@@ -108084,15 +108089,16 @@ async function exchangeCodeForTokens(authorizationCode, state, codeVerifier, por
|
|
|
108084
108089
|
logEvent("tengu_oauth_token_exchange_success", {});
|
|
108085
108090
|
return response.data;
|
|
108086
108091
|
}
|
|
108087
|
-
async function refreshOAuthToken(refreshToken, { scopes: requestedScopes } = {}) {
|
|
108092
|
+
async function refreshOAuthToken(refreshToken, { scopes: requestedScopes, loginWithMaximoAi } = {}) {
|
|
108093
|
+
const config2 = loginWithMaximoAi ? MAXIMO_OAUTH_CONFIG2 : getOauthConfig();
|
|
108088
108094
|
const requestBody = {
|
|
108089
108095
|
grant_type: "refresh_token",
|
|
108090
108096
|
refresh_token: refreshToken,
|
|
108091
|
-
client_id:
|
|
108097
|
+
client_id: config2.CLIENT_ID,
|
|
108092
108098
|
scope: ((requestedScopes?.length) ? requestedScopes : CLAUDE_AI_OAUTH_SCOPES).join(" ")
|
|
108093
108099
|
};
|
|
108094
108100
|
try {
|
|
108095
|
-
const response = await axios_default.post(
|
|
108101
|
+
const response = await axios_default.post(config2.TOKEN_URL, requestBody, {
|
|
108096
108102
|
headers: { "Content-Type": "application/json" },
|
|
108097
108103
|
timeout: 15000
|
|
108098
108104
|
});
|
|
@@ -108108,11 +108114,11 @@ async function refreshOAuthToken(refreshToken, { scopes: requestedScopes } = {})
|
|
|
108108
108114
|
const expiresAt = Date.now() + expiresIn * 1000;
|
|
108109
108115
|
const scopes = parseScopes(data.scope);
|
|
108110
108116
|
logEvent("tengu_oauth_token_refresh_success", {});
|
|
108111
|
-
const
|
|
108112
|
-
const existing =
|
|
108113
|
-
const haveProfileAlready =
|
|
108114
|
-
const profileInfo = haveProfileAlready ? null : await fetchProfileInfo(accessToken);
|
|
108115
|
-
if (profileInfo &&
|
|
108117
|
+
const globalConfig2 = getGlobalConfig();
|
|
108118
|
+
const existing = getMaximoAIOAuthTokens2();
|
|
108119
|
+
const haveProfileAlready = globalConfig2.oauthAccount?.billingType !== undefined && globalConfig2.oauthAccount?.accountCreatedAt !== undefined && globalConfig2.oauthAccount?.subscriptionCreatedAt !== undefined && existing?.subscriptionType != null && existing?.rateLimitTier != null;
|
|
108120
|
+
const profileInfo = haveProfileAlready ? null : await fetchProfileInfo(accessToken, loginWithMaximoAi);
|
|
108121
|
+
if (profileInfo && globalConfig2.oauthAccount) {
|
|
108116
108122
|
const updates = {};
|
|
108117
108123
|
if (profileInfo.displayName !== undefined) {
|
|
108118
108124
|
updates.displayName = profileInfo.displayName;
|
|
@@ -108161,16 +108167,17 @@ async function refreshOAuthToken(refreshToken, { scopes: requestedScopes } = {})
|
|
|
108161
108167
|
throw error41;
|
|
108162
108168
|
}
|
|
108163
108169
|
}
|
|
108164
|
-
async function fetchAndStoreUserRoles(accessToken) {
|
|
108165
|
-
const
|
|
108170
|
+
async function fetchAndStoreUserRoles(accessToken, loginWithMaximoAi) {
|
|
108171
|
+
const config2 = loginWithMaximoAi ? MAXIMO_OAUTH_CONFIG2 : getOauthConfig();
|
|
108172
|
+
const response = await axios_default.get(config2.ROLES_URL, {
|
|
108166
108173
|
headers: { Authorization: `Bearer ${accessToken}` }
|
|
108167
108174
|
});
|
|
108168
108175
|
if (response.status !== 200) {
|
|
108169
108176
|
throw new Error(`Failed to fetch user roles: ${response.statusText}`);
|
|
108170
108177
|
}
|
|
108171
108178
|
const data = response.data;
|
|
108172
|
-
const
|
|
108173
|
-
if (!
|
|
108179
|
+
const globalConfig2 = getGlobalConfig();
|
|
108180
|
+
if (!globalConfig2.oauthAccount) {
|
|
108174
108181
|
throw new Error("OAuth account information not found in config");
|
|
108175
108182
|
}
|
|
108176
108183
|
saveGlobalConfig((current) => ({
|
|
@@ -108186,9 +108193,10 @@ async function fetchAndStoreUserRoles(accessToken) {
|
|
|
108186
108193
|
org_role: data.organization_role
|
|
108187
108194
|
});
|
|
108188
108195
|
}
|
|
108189
|
-
async function createAndStoreApiKey(accessToken) {
|
|
108196
|
+
async function createAndStoreApiKey(accessToken, loginWithMaximoAi) {
|
|
108190
108197
|
try {
|
|
108191
|
-
const
|
|
108198
|
+
const config2 = loginWithMaximoAi ? MAXIMO_OAUTH_CONFIG2 : getOauthConfig();
|
|
108199
|
+
const response = await axios_default.post(config2.API_KEY_URL, null, {
|
|
108192
108200
|
headers: { Authorization: `Bearer ${accessToken}` }
|
|
108193
108201
|
});
|
|
108194
108202
|
const apiKey = response.data?.raw_key;
|
|
@@ -108218,22 +108226,20 @@ function isOAuthTokenExpired(expiresAt) {
|
|
|
108218
108226
|
const expiresWithBuffer = now + bufferTime;
|
|
108219
108227
|
return expiresWithBuffer >= expiresAt;
|
|
108220
108228
|
}
|
|
108221
|
-
async function fetchProfileInfo(accessToken) {
|
|
108222
|
-
const
|
|
108229
|
+
async function fetchProfileInfo(accessToken, loginWithMaximoAi) {
|
|
108230
|
+
const config2 = loginWithMaximoAi ? MAXIMO_OAUTH_CONFIG2 : getOauthConfig();
|
|
108231
|
+
const profile = await getOauthProfileFromOauthToken(accessToken, loginWithMaximoAi);
|
|
108223
108232
|
const orgType = profile?.organization?.organization_type;
|
|
108224
108233
|
let subscriptionType = null;
|
|
108225
108234
|
switch (orgType) {
|
|
108226
|
-
case "
|
|
108227
|
-
subscriptionType = "max";
|
|
108228
|
-
break;
|
|
108229
|
-
case "claude_pro":
|
|
108235
|
+
case "pro":
|
|
108230
108236
|
subscriptionType = "pro";
|
|
108231
108237
|
break;
|
|
108232
|
-
case "
|
|
108233
|
-
subscriptionType = "
|
|
108238
|
+
case "prime":
|
|
108239
|
+
subscriptionType = "prime";
|
|
108234
108240
|
break;
|
|
108235
|
-
case "
|
|
108236
|
-
subscriptionType = "
|
|
108241
|
+
case "plus":
|
|
108242
|
+
subscriptionType = "plus";
|
|
108237
108243
|
break;
|
|
108238
108244
|
default:
|
|
108239
108245
|
subscriptionType = null;
|
|
@@ -108263,7 +108269,7 @@ async function getOrganizationUUID() {
|
|
|
108263
108269
|
if (orgUUID) {
|
|
108264
108270
|
return orgUUID;
|
|
108265
108271
|
}
|
|
108266
|
-
const accessToken =
|
|
108272
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
108267
108273
|
if (accessToken === undefined || !hasProfileScope()) {
|
|
108268
108274
|
return null;
|
|
108269
108275
|
}
|
|
@@ -108293,7 +108299,7 @@ async function populateOAuthAccountInfoIfNeeded() {
|
|
|
108293
108299
|
if (config2.oauthAccount && config2.oauthAccount.billingType !== undefined && config2.oauthAccount.accountCreatedAt !== undefined && config2.oauthAccount.subscriptionCreatedAt !== undefined || !isMaximoAISubscriber() || !hasProfileScope()) {
|
|
108294
108300
|
return false;
|
|
108295
108301
|
}
|
|
108296
|
-
const tokens =
|
|
108302
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
108297
108303
|
if (tokens?.accessToken) {
|
|
108298
108304
|
const profile = await getOauthProfileFromOauthToken(tokens.accessToken);
|
|
108299
108305
|
if (profile) {
|
|
@@ -108344,6 +108350,7 @@ function storeOAuthAccountInfo({
|
|
|
108344
108350
|
return { ...current, oauthAccount: accountInfo };
|
|
108345
108351
|
});
|
|
108346
108352
|
}
|
|
108353
|
+
var MAXIMO_OAUTH_CONFIG2;
|
|
108347
108354
|
var init_client2 = __esm(() => {
|
|
108348
108355
|
init_axios2();
|
|
108349
108356
|
init_analytics();
|
|
@@ -108352,6 +108359,18 @@ var init_client2 = __esm(() => {
|
|
|
108352
108359
|
init_config2();
|
|
108353
108360
|
init_debug();
|
|
108354
108361
|
init_getOauthProfile();
|
|
108362
|
+
MAXIMO_OAUTH_CONFIG2 = {
|
|
108363
|
+
BASE_API_URL: "https://api.maximoai.co",
|
|
108364
|
+
AUTHORIZE_URL: "https://api.maximoai.co/syntax/auth/oauth/authorize",
|
|
108365
|
+
TOKEN_URL: "https://api.maximoai.co/syntax/auth/oauth/token",
|
|
108366
|
+
API_KEY_URL: "https://api.maximoai.co/syntax/auth/oauth/claude_cli/create_api_key",
|
|
108367
|
+
ROLES_URL: "https://api.maximoai.co/syntax/auth/oauth/claude_cli/roles",
|
|
108368
|
+
PROFILE_URL: "https://api.maximoai.co/syntax/auth/oauth/profile",
|
|
108369
|
+
MANUAL_REDIRECT_URL: "https://api.maximoai.co/syntax/auth/oauth/code/callback",
|
|
108370
|
+
CLIENT_ID: "maximo-cli-client",
|
|
108371
|
+
CLAUDEAI_SUCCESS_URL: "https://maximoai.co/syntax/oauth/success",
|
|
108372
|
+
CONSOLE_SUCCESS_URL: "https://maximoai.co/syntax/oauth/success"
|
|
108373
|
+
};
|
|
108355
108374
|
});
|
|
108356
108375
|
|
|
108357
108376
|
// src/utils/authFileDescriptor.ts
|
|
@@ -108684,7 +108703,7 @@ function getFastModeUnavailableReason() {
|
|
|
108684
108703
|
return null;
|
|
108685
108704
|
}
|
|
108686
108705
|
}
|
|
108687
|
-
const authType =
|
|
108706
|
+
const authType = getMaximoAIOAuthTokens2() !== null ? "oauth" : "api-key";
|
|
108688
108707
|
const reason = getDisabledReasonMessage(orgStatus.reason, authType);
|
|
108689
108708
|
logForDebugging2(`Fast mode unavailable: ${reason}`);
|
|
108690
108709
|
return reason;
|
|
@@ -108843,7 +108862,7 @@ async function prefetchFastModeStatus() {
|
|
|
108843
108862
|
return inflightPrefetch;
|
|
108844
108863
|
}
|
|
108845
108864
|
const apiKey = getAnthropicApiKey();
|
|
108846
|
-
const hasUsableOAuth =
|
|
108865
|
+
const hasUsableOAuth = getMaximoAIOAuthTokens2()?.accessToken && hasProfileScope();
|
|
108847
108866
|
if (!hasUsableOAuth && !apiKey) {
|
|
108848
108867
|
const isAnt = process.env.USER_TYPE === "ant";
|
|
108849
108868
|
const cachedEnabled = getGlobalConfig().penguinModeOrgEnabled === true;
|
|
@@ -108857,7 +108876,7 @@ async function prefetchFastModeStatus() {
|
|
|
108857
108876
|
}
|
|
108858
108877
|
lastPrefetchAt = now;
|
|
108859
108878
|
const fetchWithCurrentAuth = async () => {
|
|
108860
|
-
const currentTokens =
|
|
108879
|
+
const currentTokens = getMaximoAIOAuthTokens2();
|
|
108861
108880
|
const auth = currentTokens?.accessToken && hasProfileScope() ? { accessToken: currentTokens.accessToken } : apiKey ? { apiKey } : null;
|
|
108862
108881
|
if (!auth) {
|
|
108863
108882
|
throw new Error("No auth available");
|
|
@@ -108872,7 +108891,7 @@ async function prefetchFastModeStatus() {
|
|
|
108872
108891
|
} catch (err) {
|
|
108873
108892
|
const isAuthError = axios_default.isAxiosError(err) && (err.response?.status === 401 || err.response?.status === 403 && typeof err.response?.data === "string" && err.response.data.includes("OAuth token has been revoked"));
|
|
108874
108893
|
if (isAuthError) {
|
|
108875
|
-
const failedAccessToken =
|
|
108894
|
+
const failedAccessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
108876
108895
|
if (failedAccessToken) {
|
|
108877
108896
|
await handleOAuth401Error(failedAccessToken);
|
|
108878
108897
|
status = await fetchWithCurrentAuth();
|
|
@@ -109191,6 +109210,146 @@ var init_antModels = __esm(() => {
|
|
|
109191
109210
|
init_growthbook();
|
|
109192
109211
|
});
|
|
109193
109212
|
|
|
109213
|
+
// src/services/api/maximoModels.ts
|
|
109214
|
+
function isMaximoAIProviderInternal() {
|
|
109215
|
+
const provider = process.env.CLAUDE_CODE_USE_OPENAI ? "openai" : process.env.CLAUDE_CODE_USE_GEMINI ? "gemini" : process.env.CLAUDE_CODE_USE_BEDROCK ? "bedrock" : process.env.CLAUDE_CODE_USE_VERTEX ? "vertex" : process.env.CLAUDE_CODE_USE_FOUNDRY ? "foundry" : "firstParty";
|
|
109216
|
+
const baseUrl = process.env.OPENAI_BASE_URL || "";
|
|
109217
|
+
if (provider === "openai" && (baseUrl.includes("api.maximoai.co") || baseUrl.includes("maximoai.co"))) {
|
|
109218
|
+
return true;
|
|
109219
|
+
}
|
|
109220
|
+
const globalConfig2 = getGlobalConfig();
|
|
109221
|
+
if (globalConfig2.maximoApiKey && (globalConfig2.openAIBaseUrl?.includes("maximoai.co") || baseUrl.includes("maximoai.co"))) {
|
|
109222
|
+
return true;
|
|
109223
|
+
}
|
|
109224
|
+
return false;
|
|
109225
|
+
}
|
|
109226
|
+
function getMaximoAIBaseUrl() {
|
|
109227
|
+
const globalConfig2 = getGlobalConfig();
|
|
109228
|
+
return globalConfig2.openAIBaseUrl || process.env.OPENAI_BASE_URL || "https://api.maximoai.co/v1";
|
|
109229
|
+
}
|
|
109230
|
+
function getMaximoApiKey() {
|
|
109231
|
+
const globalConfig2 = getGlobalConfig();
|
|
109232
|
+
return globalConfig2.maximoApiKey || process.env.OPENAI_API_KEY;
|
|
109233
|
+
}
|
|
109234
|
+
async function fetchMaximoModels() {
|
|
109235
|
+
if (cachedModels && Date.now() - lastFetchTime < CACHE_TTL) {
|
|
109236
|
+
return cachedModels;
|
|
109237
|
+
}
|
|
109238
|
+
const baseUrl = getMaximoAIBaseUrl();
|
|
109239
|
+
const apiKey = getMaximoApiKey();
|
|
109240
|
+
if (!apiKey) {
|
|
109241
|
+
return [];
|
|
109242
|
+
}
|
|
109243
|
+
try {
|
|
109244
|
+
const response = await fetch(`${baseUrl}/models`, {
|
|
109245
|
+
headers: {
|
|
109246
|
+
Authorization: `Bearer ${apiKey}`,
|
|
109247
|
+
"Content-Type": "application/json"
|
|
109248
|
+
}
|
|
109249
|
+
});
|
|
109250
|
+
if (!response.ok) {
|
|
109251
|
+
throw new Error(`Failed to fetch models: ${response.status} ${response.statusText}`);
|
|
109252
|
+
}
|
|
109253
|
+
const data = await response.json();
|
|
109254
|
+
const sortedModels = data.data.sort((a2, b) => {
|
|
109255
|
+
const aIsPandora = a2.id.includes("pandora");
|
|
109256
|
+
const bIsPandora = b.id.includes("pandora");
|
|
109257
|
+
if (aIsPandora && !bIsPandora)
|
|
109258
|
+
return -1;
|
|
109259
|
+
if (!aIsPandora && bIsPandora)
|
|
109260
|
+
return 1;
|
|
109261
|
+
if (a2.isPreview && !b.isPreview)
|
|
109262
|
+
return 1;
|
|
109263
|
+
if (!a2.isPreview && b.isPreview)
|
|
109264
|
+
return -1;
|
|
109265
|
+
return a2.name.localeCompare(b.name);
|
|
109266
|
+
});
|
|
109267
|
+
cachedModels = sortedModels;
|
|
109268
|
+
lastFetchTime = Date.now();
|
|
109269
|
+
return sortedModels;
|
|
109270
|
+
} catch (error41) {
|
|
109271
|
+
logError2(error41);
|
|
109272
|
+
return cachedModels || [];
|
|
109273
|
+
}
|
|
109274
|
+
}
|
|
109275
|
+
function getShortLabel(fullName, modelId) {
|
|
109276
|
+
const match = fullName.match(/Maximo AI:\s*(.+)/);
|
|
109277
|
+
if (match) {
|
|
109278
|
+
return match[1];
|
|
109279
|
+
}
|
|
109280
|
+
return modelId.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
109281
|
+
}
|
|
109282
|
+
function toModelOption(model) {
|
|
109283
|
+
const label = getShortLabel(model.name, model.id);
|
|
109284
|
+
let description = model.description;
|
|
109285
|
+
if (description.length > 120) {
|
|
109286
|
+
description = description.slice(0, 117) + "...";
|
|
109287
|
+
}
|
|
109288
|
+
if (model.isPreview) {
|
|
109289
|
+
description = `[Preview] ${description}`;
|
|
109290
|
+
}
|
|
109291
|
+
const contextInK = Math.round(model.context_length / 1000);
|
|
109292
|
+
const outputInK = Math.round(model.max_output_length / 1000);
|
|
109293
|
+
return {
|
|
109294
|
+
value: model.id,
|
|
109295
|
+
label,
|
|
109296
|
+
description: `${description} · ${contextInK}K context · ${outputInK}K output`,
|
|
109297
|
+
descriptionForModel: `${model.name} - ${model.description}`
|
|
109298
|
+
};
|
|
109299
|
+
}
|
|
109300
|
+
async function getMaximoModelOptions() {
|
|
109301
|
+
if (!isMaximoAIProviderInternal()) {
|
|
109302
|
+
return null;
|
|
109303
|
+
}
|
|
109304
|
+
const models = await fetchMaximoModels();
|
|
109305
|
+
if (models.length === 0) {
|
|
109306
|
+
return null;
|
|
109307
|
+
}
|
|
109308
|
+
const groupedModels = {};
|
|
109309
|
+
for (const model of models) {
|
|
109310
|
+
const match = model.id.match(/maximo-(\w+)-/);
|
|
109311
|
+
const family = match ? match[1] : "other";
|
|
109312
|
+
if (!groupedModels[family]) {
|
|
109313
|
+
groupedModels[family] = [];
|
|
109314
|
+
}
|
|
109315
|
+
groupedModels[family].push(model);
|
|
109316
|
+
}
|
|
109317
|
+
const options = [];
|
|
109318
|
+
const familyPriority = ["pandora", "astra", "beta", "alpha"];
|
|
109319
|
+
for (const family of familyPriority) {
|
|
109320
|
+
if (groupedModels[family]) {
|
|
109321
|
+
groupedModels[family].sort((a2, b) => {
|
|
109322
|
+
const aVersion = a2.id.match(/(\d+\.?\d*)/)?.[1] || "0";
|
|
109323
|
+
const bVersion = b.id.match(/(\d+\.?\d*)/)?.[1] || "0";
|
|
109324
|
+
return parseFloat(bVersion) - parseFloat(aVersion);
|
|
109325
|
+
});
|
|
109326
|
+
for (const model of groupedModels[family]) {
|
|
109327
|
+
options.push(toModelOption(model));
|
|
109328
|
+
}
|
|
109329
|
+
}
|
|
109330
|
+
}
|
|
109331
|
+
for (const [family, models2] of Object.entries(groupedModels)) {
|
|
109332
|
+
if (!familyPriority.includes(family)) {
|
|
109333
|
+
for (const model of models2) {
|
|
109334
|
+
options.push(toModelOption(model));
|
|
109335
|
+
}
|
|
109336
|
+
}
|
|
109337
|
+
}
|
|
109338
|
+
return options;
|
|
109339
|
+
}
|
|
109340
|
+
function getCachedMaximoModelOptions() {
|
|
109341
|
+
if (!cachedModels || cachedModels.length === 0) {
|
|
109342
|
+
return null;
|
|
109343
|
+
}
|
|
109344
|
+
return cachedModels.map(toModelOption);
|
|
109345
|
+
}
|
|
109346
|
+
var cachedModels = null, lastFetchTime = 0, CACHE_TTL;
|
|
109347
|
+
var init_maximoModels = __esm(() => {
|
|
109348
|
+
init_config2();
|
|
109349
|
+
init_log3();
|
|
109350
|
+
CACHE_TTL = 5 * 60 * 1000;
|
|
109351
|
+
});
|
|
109352
|
+
|
|
109194
109353
|
// src/utils/model/model.ts
|
|
109195
109354
|
var exports_model = {};
|
|
109196
109355
|
__export(exports_model, {
|
|
@@ -109233,6 +109392,10 @@ function isMaximoAIProvider() {
|
|
|
109233
109392
|
if (globalConfig2.maximoApiKey && (globalConfig2.openAIBaseUrl?.includes("maximoai.co") || baseUrl.includes("maximoai.co"))) {
|
|
109234
109393
|
return true;
|
|
109235
109394
|
}
|
|
109395
|
+
const oauthTokens = getMaximoAIOAuthTokens();
|
|
109396
|
+
if (oauthTokens?.accessToken && isMaximoAISubscriber()) {
|
|
109397
|
+
return true;
|
|
109398
|
+
}
|
|
109236
109399
|
return false;
|
|
109237
109400
|
}
|
|
109238
109401
|
function getSmallFastModel() {
|
|
@@ -109368,6 +109531,24 @@ function getDefaultMainLoopModel() {
|
|
|
109368
109531
|
}
|
|
109369
109532
|
function firstPartyNameToCanonical(name) {
|
|
109370
109533
|
name = name.toLowerCase();
|
|
109534
|
+
if (name.includes("maximo-pandora-3.6-nano")) {
|
|
109535
|
+
return "maximo-pandora-3.6-nano";
|
|
109536
|
+
}
|
|
109537
|
+
if (name.includes("maximo-pandora-3.5-syntax-fast")) {
|
|
109538
|
+
return "maximo-pandora-3.5-syntax-fast";
|
|
109539
|
+
}
|
|
109540
|
+
if (name.includes("maximo-pandora-3.5")) {
|
|
109541
|
+
return "maximo-pandora-3.5";
|
|
109542
|
+
}
|
|
109543
|
+
if (name.includes("maximo-pandora")) {
|
|
109544
|
+
return "maximo-pandora";
|
|
109545
|
+
}
|
|
109546
|
+
if (name.includes("maximo-astra")) {
|
|
109547
|
+
return "maximo-astra";
|
|
109548
|
+
}
|
|
109549
|
+
if (name.includes("maximo-alpha")) {
|
|
109550
|
+
return "maximo-alpha";
|
|
109551
|
+
}
|
|
109371
109552
|
if (name.includes("claude-opus-4-6")) {
|
|
109372
109553
|
return "claude-opus-4-6";
|
|
109373
109554
|
}
|
|
@@ -109420,6 +109601,21 @@ function getCanonicalName(fullModelName) {
|
|
|
109420
109601
|
return firstPartyNameToCanonical(resolveOverriddenModel(fullModelName));
|
|
109421
109602
|
}
|
|
109422
109603
|
function getMaximoAiUserDefaultModelDescription(fastMode = false) {
|
|
109604
|
+
if (isMaximoAIProvider() || isMaximoAISubscriber()) {
|
|
109605
|
+
const cachedOptions = getCachedMaximoModelOptions();
|
|
109606
|
+
if (cachedOptions && cachedOptions.length > 0) {
|
|
109607
|
+
if (fastMode) {
|
|
109608
|
+
const nanoModel = cachedOptions.find((opt) => opt.label.toLowerCase().includes("nano") || opt.value.toLowerCase().includes("nano")) || cachedOptions[cachedOptions.length - 1];
|
|
109609
|
+
return `${nanoModel.label} · Fast & efficient`;
|
|
109610
|
+
}
|
|
109611
|
+
const syntaxModel = cachedOptions.find((opt) => opt.label.toLowerCase().includes("syntax") || opt.value.toLowerCase().includes("syntax")) || cachedOptions[0];
|
|
109612
|
+
return `${syntaxModel.label} · Optimized for coding`;
|
|
109613
|
+
}
|
|
109614
|
+
if (fastMode) {
|
|
109615
|
+
return "Pandora 3.6 Nano · Fast & efficient";
|
|
109616
|
+
}
|
|
109617
|
+
return "Pandora 3.5 Syntax Fast · Optimized for coding";
|
|
109618
|
+
}
|
|
109423
109619
|
if (isMaxSubscriber() || isTeamPremiumSubscriber()) {
|
|
109424
109620
|
if (isOpus1mMergeEnabled()) {
|
|
109425
109621
|
return `Opus 4.6 with 1M context · Most capable for complex work${fastMode ? getOpus46PricingSuffix(true) : ""}`;
|
|
@@ -109615,12 +109811,38 @@ function modelDisplayString(model) {
|
|
|
109615
109811
|
const resolvedModel = parseUserSpecifiedModel(model);
|
|
109616
109812
|
return model === resolvedModel ? resolvedModel : `${model} (${resolvedModel})`;
|
|
109617
109813
|
}
|
|
109814
|
+
function getMaximoMarketingNameForModel(modelId) {
|
|
109815
|
+
const cachedOptions = getCachedMaximoModelOptions();
|
|
109816
|
+
if (!cachedOptions || cachedOptions.length === 0) {
|
|
109817
|
+
return;
|
|
109818
|
+
}
|
|
109819
|
+
const exactMatch = cachedOptions.find((opt) => opt.value === modelId);
|
|
109820
|
+
if (exactMatch) {
|
|
109821
|
+
return exactMatch.label;
|
|
109822
|
+
}
|
|
109823
|
+
const canonical = getCanonicalName(modelId);
|
|
109824
|
+
const canonicalMatch = cachedOptions.find((opt) => opt.value === canonical);
|
|
109825
|
+
if (canonicalMatch) {
|
|
109826
|
+
return canonicalMatch.label;
|
|
109827
|
+
}
|
|
109828
|
+
const partialMatch = cachedOptions.find((opt) => modelId.includes(opt.value) || opt.value.includes(modelId) || modelId.includes(opt.label.toLowerCase().replace(/\s+/g, "-")));
|
|
109829
|
+
if (partialMatch) {
|
|
109830
|
+
return partialMatch.label;
|
|
109831
|
+
}
|
|
109832
|
+
return;
|
|
109833
|
+
}
|
|
109618
109834
|
function getMarketingNameForModel(modelId) {
|
|
109619
109835
|
if (getAPIProvider() === "foundry") {
|
|
109620
109836
|
return;
|
|
109621
109837
|
}
|
|
109622
109838
|
const has1m = modelId.toLowerCase().includes("[1m]");
|
|
109623
109839
|
const canonical = getCanonicalName(modelId);
|
|
109840
|
+
if (isMaximoAIProvider() || isMaximoAISubscriber()) {
|
|
109841
|
+
const maximoLabel = getMaximoMarketingNameForModel(canonical);
|
|
109842
|
+
if (maximoLabel) {
|
|
109843
|
+
return maximoLabel;
|
|
109844
|
+
}
|
|
109845
|
+
}
|
|
109624
109846
|
if (canonical.includes("claude-opus-4-6")) {
|
|
109625
109847
|
return has1m ? "Opus 4.6 (with 1M context)" : "Opus 4.6";
|
|
109626
109848
|
}
|
|
@@ -109675,6 +109897,7 @@ var init_model = __esm(() => {
|
|
|
109675
109897
|
init_stringUtils();
|
|
109676
109898
|
init_config2();
|
|
109677
109899
|
init_antModels();
|
|
109900
|
+
init_maximoModels();
|
|
109678
109901
|
LEGACY_OPUS_FIRSTPARTY = [
|
|
109679
109902
|
"claude-opus-4-20250514",
|
|
109680
109903
|
"claude-opus-4-1-20250805",
|
|
@@ -117477,7 +117700,7 @@ async function getAnthropicClient({
|
|
|
117477
117700
|
}
|
|
117478
117701
|
const clientConfig = {
|
|
117479
117702
|
apiKey: isMaximoAISubscriber() ? null : apiKey || getAnthropicApiKey(),
|
|
117480
|
-
authToken: isMaximoAISubscriber() ?
|
|
117703
|
+
authToken: isMaximoAISubscriber() ? getMaximoAIOAuthTokens2()?.accessToken : undefined,
|
|
117481
117704
|
...process.env.USER_TYPE === "ant" && isEnvTruthy(process.env.USE_STAGING_OAUTH) ? { baseURL: getOauthConfig().BASE_API_URL } : {},
|
|
117482
117705
|
...ARGS,
|
|
117483
117706
|
...isDebugToStdErr() && { logger: createStderrLogger() }
|
|
@@ -120039,7 +120262,7 @@ __export(exports_auth, {
|
|
|
120039
120262
|
getOtelHeadersFromHelper: () => getOtelHeadersFromHelper,
|
|
120040
120263
|
getOauthAccountInfo: () => getOauthAccountInfo,
|
|
120041
120264
|
getMaximoAIOAuthTokensAsync: () => getMaximoAIOAuthTokensAsync,
|
|
120042
|
-
getMaximoAIOAuthTokens: () =>
|
|
120265
|
+
getMaximoAIOAuthTokens: () => getMaximoAIOAuthTokens2,
|
|
120043
120266
|
getConfiguredApiKeyHelper: () => getConfiguredApiKeyHelper,
|
|
120044
120267
|
getAuthTokenSource: () => getAuthTokenSource,
|
|
120045
120268
|
getApiKeyHelperElapsedMs: () => getApiKeyHelperElapsedMs,
|
|
@@ -120110,7 +120333,7 @@ function getAuthTokenSource() {
|
|
|
120110
120333
|
if (apiKeyHelper && !isManagedOAuthContext()) {
|
|
120111
120334
|
return { source: "apiKeyHelper", hasToken: true };
|
|
120112
120335
|
}
|
|
120113
|
-
const oauthTokens =
|
|
120336
|
+
const oauthTokens = getMaximoAIOAuthTokens2();
|
|
120114
120337
|
if (shouldUseMaximoAIAuth(oauthTokens?.scopes) && oauthTokens?.accessToken) {
|
|
120115
120338
|
return { source: "claude.ai", hasToken: true };
|
|
120116
120339
|
}
|
|
@@ -120694,7 +120917,7 @@ function saveOAuthTokensIfNeeded(tokens) {
|
|
|
120694
120917
|
} else {
|
|
120695
120918
|
logEvent("tengu_oauth_tokens_save_failed", { storageBackend });
|
|
120696
120919
|
}
|
|
120697
|
-
|
|
120920
|
+
getMaximoAIOAuthTokens2.cache?.clear?.();
|
|
120698
120921
|
clearBetasCaches();
|
|
120699
120922
|
clearToolSchemaCache();
|
|
120700
120923
|
return updateStatus;
|
|
@@ -120708,7 +120931,7 @@ function saveOAuthTokensIfNeeded(tokens) {
|
|
|
120708
120931
|
}
|
|
120709
120932
|
}
|
|
120710
120933
|
function clearOAuthTokenCache() {
|
|
120711
|
-
|
|
120934
|
+
getMaximoAIOAuthTokens2.cache?.clear?.();
|
|
120712
120935
|
clearKeychainCache();
|
|
120713
120936
|
}
|
|
120714
120937
|
async function invalidateOAuthCacheIfDiskChanged() {
|
|
@@ -120719,7 +120942,7 @@ async function invalidateOAuthCacheIfDiskChanged() {
|
|
|
120719
120942
|
clearOAuthTokenCache();
|
|
120720
120943
|
}
|
|
120721
120944
|
} catch {
|
|
120722
|
-
|
|
120945
|
+
getMaximoAIOAuthTokens2.cache?.clear?.();
|
|
120723
120946
|
}
|
|
120724
120947
|
}
|
|
120725
120948
|
function handleOAuth401Error(failedAccessToken) {
|
|
@@ -120748,7 +120971,7 @@ async function getMaximoAIOAuthTokensAsync() {
|
|
|
120748
120971
|
if (isBareMode())
|
|
120749
120972
|
return null;
|
|
120750
120973
|
if (process.env.CLAUDE_CODE_OAUTH_TOKEN || getOAuthTokenFromFileDescriptor()) {
|
|
120751
|
-
return
|
|
120974
|
+
return getMaximoAIOAuthTokens2();
|
|
120752
120975
|
}
|
|
120753
120976
|
try {
|
|
120754
120977
|
const secureStorage = getSecureStorage();
|
|
@@ -120779,7 +121002,7 @@ function checkAndRefreshOAuthTokenIfNeeded(retryCount = 0, force = false) {
|
|
|
120779
121002
|
async function checkAndRefreshOAuthTokenIfNeededImpl(retryCount, force) {
|
|
120780
121003
|
const MAX_RETRIES = 5;
|
|
120781
121004
|
await invalidateOAuthCacheIfDiskChanged();
|
|
120782
|
-
const tokens =
|
|
121005
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
120783
121006
|
if (!force) {
|
|
120784
121007
|
if (!tokens?.refreshToken || !isOAuthTokenExpired(tokens.expiresAt)) {
|
|
120785
121008
|
return false;
|
|
@@ -120791,7 +121014,7 @@ async function checkAndRefreshOAuthTokenIfNeededImpl(retryCount, force) {
|
|
|
120791
121014
|
if (!shouldUseMaximoAIAuth(tokens.scopes)) {
|
|
120792
121015
|
return false;
|
|
120793
121016
|
}
|
|
120794
|
-
|
|
121017
|
+
getMaximoAIOAuthTokens2.cache?.clear?.();
|
|
120795
121018
|
clearKeychainCache();
|
|
120796
121019
|
const freshTokens = await getMaximoAIOAuthTokensAsync();
|
|
120797
121020
|
if (!freshTokens?.refreshToken || !isOAuthTokenExpired(freshTokens.expiresAt)) {
|
|
@@ -120825,7 +121048,7 @@ async function checkAndRefreshOAuthTokenIfNeededImpl(retryCount, force) {
|
|
|
120825
121048
|
return false;
|
|
120826
121049
|
}
|
|
120827
121050
|
try {
|
|
120828
|
-
|
|
121051
|
+
getMaximoAIOAuthTokens2.cache?.clear?.();
|
|
120829
121052
|
clearKeychainCache();
|
|
120830
121053
|
const lockedTokens = await getMaximoAIOAuthTokensAsync();
|
|
120831
121054
|
if (!lockedTokens?.refreshToken || !isOAuthTokenExpired(lockedTokens.expiresAt)) {
|
|
@@ -120837,12 +121060,12 @@ async function checkAndRefreshOAuthTokenIfNeededImpl(retryCount, force) {
|
|
|
120837
121060
|
scopes: shouldUseMaximoAIAuth(lockedTokens.scopes) ? undefined : lockedTokens.scopes
|
|
120838
121061
|
});
|
|
120839
121062
|
saveOAuthTokensIfNeeded(refreshedTokens);
|
|
120840
|
-
|
|
121063
|
+
getMaximoAIOAuthTokens2.cache?.clear?.();
|
|
120841
121064
|
clearKeychainCache();
|
|
120842
121065
|
return true;
|
|
120843
121066
|
} catch (error42) {
|
|
120844
121067
|
logError2(error42);
|
|
120845
|
-
|
|
121068
|
+
getMaximoAIOAuthTokens2.cache?.clear?.();
|
|
120846
121069
|
clearKeychainCache();
|
|
120847
121070
|
const currentTokens = await getMaximoAIOAuthTokensAsync();
|
|
120848
121071
|
if (currentTokens && !isOAuthTokenExpired(currentTokens.expiresAt)) {
|
|
@@ -120860,10 +121083,10 @@ function isMaximoAISubscriber() {
|
|
|
120860
121083
|
if (!isAnthropicAuthEnabled()) {
|
|
120861
121084
|
return false;
|
|
120862
121085
|
}
|
|
120863
|
-
return shouldUseMaximoAIAuth(
|
|
121086
|
+
return shouldUseMaximoAIAuth(getMaximoAIOAuthTokens2()?.scopes);
|
|
120864
121087
|
}
|
|
120865
121088
|
function hasProfileScope() {
|
|
120866
|
-
return
|
|
121089
|
+
return getMaximoAIOAuthTokens2()?.scopes?.includes(CLAUDE_AI_PROFILE_SCOPE) ?? false;
|
|
120867
121090
|
}
|
|
120868
121091
|
function is1PApiCustomer() {
|
|
120869
121092
|
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) || isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) || isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY)) {
|
|
@@ -120899,7 +121122,7 @@ function getSubscriptionType() {
|
|
|
120899
121122
|
if (!isAnthropicAuthEnabled()) {
|
|
120900
121123
|
return null;
|
|
120901
121124
|
}
|
|
120902
|
-
const oauthTokens =
|
|
121125
|
+
const oauthTokens = getMaximoAIOAuthTokens2();
|
|
120903
121126
|
if (!oauthTokens) {
|
|
120904
121127
|
return null;
|
|
120905
121128
|
}
|
|
@@ -120924,7 +121147,7 @@ function getRateLimitTier() {
|
|
|
120924
121147
|
if (!isAnthropicAuthEnabled()) {
|
|
120925
121148
|
return null;
|
|
120926
121149
|
}
|
|
120927
|
-
const oauthTokens =
|
|
121150
|
+
const oauthTokens = getMaximoAIOAuthTokens2();
|
|
120928
121151
|
if (!oauthTokens) {
|
|
120929
121152
|
return null;
|
|
120930
121153
|
}
|
|
@@ -121049,7 +121272,7 @@ async function validateForceLoginOrg() {
|
|
|
121049
121272
|
return { valid: true };
|
|
121050
121273
|
}
|
|
121051
121274
|
await checkAndRefreshOAuthTokenIfNeeded();
|
|
121052
|
-
const tokens =
|
|
121275
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
121053
121276
|
if (!tokens) {
|
|
121054
121277
|
return { valid: true };
|
|
121055
121278
|
}
|
|
@@ -121091,7 +121314,7 @@ but this machine requires organization ${requiredOrgUuid}.
|
|
|
121091
121314
|
Please log in with the correct organization: claude auth login`
|
|
121092
121315
|
};
|
|
121093
121316
|
}
|
|
121094
|
-
var DEFAULT_API_KEY_HELPER_TTL, _apiKeyHelperCache = null, _apiKeyHelperInflight = null, _apiKeyHelperEpoch = 0, DEFAULT_AWS_STS_TTL, AWS_AUTH_REFRESH_TIMEOUT_MS, refreshAndGetAwsCredentials, GCP_CREDENTIALS_CHECK_TIMEOUT_MS = 5000, DEFAULT_GCP_CREDENTIAL_TTL = 3600000, GCP_AUTH_REFRESH_TIMEOUT_MS = 180000, refreshGcpCredentialsIfNeeded, getApiKeyFromConfigOrMacOSKeychain,
|
|
121317
|
+
var DEFAULT_API_KEY_HELPER_TTL, _apiKeyHelperCache = null, _apiKeyHelperInflight = null, _apiKeyHelperEpoch = 0, DEFAULT_AWS_STS_TTL, AWS_AUTH_REFRESH_TIMEOUT_MS, refreshAndGetAwsCredentials, GCP_CREDENTIALS_CHECK_TIMEOUT_MS = 5000, DEFAULT_GCP_CREDENTIAL_TTL = 3600000, GCP_AUTH_REFRESH_TIMEOUT_MS = 180000, refreshGcpCredentialsIfNeeded, getApiKeyFromConfigOrMacOSKeychain, getMaximoAIOAuthTokens2, lastCredentialsMtimeMs = 0, pending401Handlers, pendingRefreshCheck = null, cachedOtelHeaders = null, cachedOtelHeadersTimestamp = 0, DEFAULT_OTEL_HEADERS_DEBOUNCE_MS = 1740000, GcpCredentialsTimeoutError;
|
|
121095
121318
|
var init_auth2 = __esm(() => {
|
|
121096
121319
|
init_source();
|
|
121097
121320
|
init_execa();
|
|
@@ -121164,7 +121387,7 @@ var init_auth2 = __esm(() => {
|
|
|
121164
121387
|
}
|
|
121165
121388
|
return { key: config2.primaryApiKey, source: "/login managed key" };
|
|
121166
121389
|
});
|
|
121167
|
-
|
|
121390
|
+
getMaximoAIOAuthTokens2 = memoize_default(() => {
|
|
121168
121391
|
if (isBareMode())
|
|
121169
121392
|
return null;
|
|
121170
121393
|
if (process.env.CLAUDE_CODE_OAUTH_TOKEN) {
|
|
@@ -121251,7 +121474,7 @@ function getWebFetchUserAgent() {
|
|
|
121251
121474
|
}
|
|
121252
121475
|
function getAuthHeaders2() {
|
|
121253
121476
|
if (isMaximoAISubscriber()) {
|
|
121254
|
-
const oauthTokens =
|
|
121477
|
+
const oauthTokens = getMaximoAIOAuthTokens2();
|
|
121255
121478
|
if (!oauthTokens?.accessToken) {
|
|
121256
121479
|
return {
|
|
121257
121480
|
headers: {},
|
|
@@ -121288,7 +121511,7 @@ async function withOAuth401Retry(request, opts) {
|
|
|
121288
121511
|
const isAuthError = status === 401 || opts?.also403Revoked && status === 403 && typeof err.response?.data === "string" && err.response.data.includes("OAuth token has been revoked");
|
|
121289
121512
|
if (!isAuthError)
|
|
121290
121513
|
throw err;
|
|
121291
|
-
const failedAccessToken =
|
|
121514
|
+
const failedAccessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
121292
121515
|
if (!failedAccessToken)
|
|
121293
121516
|
throw err;
|
|
121294
121517
|
await handleOAuth401Error(failedAccessToken);
|
|
@@ -123076,7 +123299,7 @@ var init_metadata = __esm(() => {
|
|
|
123076
123299
|
isMaximoAiAuth: isMaximoAISubscriber(),
|
|
123077
123300
|
version: "99.0.0",
|
|
123078
123301
|
versionBase: getVersionBase(),
|
|
123079
|
-
buildTime: "2026-04-
|
|
123302
|
+
buildTime: "2026-04-10T22:52:11.984Z",
|
|
123080
123303
|
deploymentEnvironment: env3.detectDeploymentEnvironment(),
|
|
123081
123304
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
123082
123305
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -123406,7 +123629,7 @@ class FirstPartyEventLoggingExporter {
|
|
|
123406
123629
|
}
|
|
123407
123630
|
let shouldSkipAuth = this.skipAuth || !hasTrust;
|
|
123408
123631
|
if (!shouldSkipAuth && isMaximoAISubscriber()) {
|
|
123409
|
-
const tokens =
|
|
123632
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
123410
123633
|
if (!hasProfileScope()) {
|
|
123411
123634
|
shouldSkipAuth = true;
|
|
123412
123635
|
} else if (tokens && isOAuthTokenExpired(tokens.expiresAt)) {
|
|
@@ -180440,7 +180663,7 @@ async function* withRetry(getClient, operation, options2) {
|
|
|
180440
180663
|
}
|
|
180441
180664
|
if (client3 === null || lastError instanceof APIError && lastError.status === 401 || isOAuthTokenRevokedError(lastError) || isBedrockAuthError(lastError) || isVertexAuthError(lastError) || isStaleConnection) {
|
|
180442
180665
|
if (lastError instanceof APIError && lastError.status === 401 || isOAuthTokenRevokedError(lastError)) {
|
|
180443
|
-
const failedAccessToken =
|
|
180666
|
+
const failedAccessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
180444
180667
|
if (failedAccessToken) {
|
|
180445
180668
|
await handleOAuth401Error(failedAccessToken);
|
|
180446
180669
|
}
|
|
@@ -253412,7 +253635,7 @@ var init_claudeai = __esm(() => {
|
|
|
253412
253635
|
});
|
|
253413
253636
|
return {};
|
|
253414
253637
|
}
|
|
253415
|
-
const tokens =
|
|
253638
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
253416
253639
|
if (!tokens?.accessToken) {
|
|
253417
253640
|
logForDebugging2("[claudeai-mcp] No access token");
|
|
253418
253641
|
logEvent("tengu_claudeai_mcp_eligibility", {
|
|
@@ -263907,7 +264130,7 @@ function createMaximoAiProxyFetch(innerFetch) {
|
|
|
263907
264130
|
return async (url3, init) => {
|
|
263908
264131
|
const doRequest = async () => {
|
|
263909
264132
|
await checkAndRefreshOAuthTokenIfNeeded();
|
|
263910
|
-
const currentTokens =
|
|
264133
|
+
const currentTokens = getMaximoAIOAuthTokens2();
|
|
263911
264134
|
if (!currentTokens) {
|
|
263912
264135
|
throw new Error("No claude.ai OAuth token available");
|
|
263913
264136
|
}
|
|
@@ -263925,7 +264148,7 @@ function createMaximoAiProxyFetch(innerFetch) {
|
|
|
263925
264148
|
tokenChanged
|
|
263926
264149
|
});
|
|
263927
264150
|
if (!tokenChanged) {
|
|
263928
|
-
const now2 =
|
|
264151
|
+
const now2 = getMaximoAIOAuthTokens2()?.accessToken;
|
|
263929
264152
|
if (!now2 || now2 === sentToken) {
|
|
263930
264153
|
return response;
|
|
263931
264154
|
}
|
|
@@ -264974,7 +265197,7 @@ var init_client7 = __esm(() => {
|
|
|
264974
265197
|
throw new Error("SDK servers should be handled in print.ts");
|
|
264975
265198
|
} else if (serverRef.type === "claudeai-proxy") {
|
|
264976
265199
|
logMCPDebug(name, `Initializing claude.ai proxy transport for server ${serverRef.id}`);
|
|
264977
|
-
const tokens =
|
|
265200
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
264978
265201
|
if (!tokens) {
|
|
264979
265202
|
throw new Error("No claude.ai OAuth token found");
|
|
264980
265203
|
}
|
|
@@ -268842,8 +269065,8 @@ async function enrollTrustedDevice() {
|
|
|
268842
269065
|
logForDebugging2("[trusted-device] CLAUDE_TRUSTED_DEVICE_TOKEN env var is set, skipping enrollment (env var takes precedence)");
|
|
268843
269066
|
return;
|
|
268844
269067
|
}
|
|
268845
|
-
const { getMaximoAIOAuthTokens:
|
|
268846
|
-
const accessToken =
|
|
269068
|
+
const { getMaximoAIOAuthTokens: getMaximoAIOAuthTokens3 } = (init_auth2(), __toCommonJS(exports_auth));
|
|
269069
|
+
const accessToken = getMaximoAIOAuthTokens3()?.accessToken;
|
|
268847
269070
|
if (!accessToken) {
|
|
268848
269071
|
logForDebugging2("[trusted-device] No OAuth token, skipping enrollment");
|
|
268849
269072
|
return;
|
|
@@ -269448,7 +269671,7 @@ function isPolicyLimitsEligible() {
|
|
|
269448
269671
|
return true;
|
|
269449
269672
|
}
|
|
269450
269673
|
} catch {}
|
|
269451
|
-
const tokens =
|
|
269674
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
269452
269675
|
if (!tokens?.accessToken) {
|
|
269453
269676
|
return false;
|
|
269454
269677
|
}
|
|
@@ -269478,7 +269701,7 @@ function getAuthHeaders3() {
|
|
|
269478
269701
|
};
|
|
269479
269702
|
}
|
|
269480
269703
|
} catch {}
|
|
269481
|
-
const oauthTokens =
|
|
269704
|
+
const oauthTokens = getMaximoAIOAuthTokens2();
|
|
269482
269705
|
if (oauthTokens?.accessToken) {
|
|
269483
269706
|
return {
|
|
269484
269707
|
headers: {
|
|
@@ -271090,7 +271313,15 @@ var init_option_map = __esm(() => {
|
|
|
271090
271313
|
let lastItem;
|
|
271091
271314
|
let previous;
|
|
271092
271315
|
let index = 0;
|
|
271093
|
-
|
|
271316
|
+
let safeOptions;
|
|
271317
|
+
try {
|
|
271318
|
+
safeOptions = Array.isArray(options2) ? options2 : options2 ? Array.from(options2) : [];
|
|
271319
|
+
} catch {
|
|
271320
|
+
safeOptions = [];
|
|
271321
|
+
}
|
|
271322
|
+
for (const option of safeOptions) {
|
|
271323
|
+
if (option == null)
|
|
271324
|
+
continue;
|
|
271094
271325
|
const item = {
|
|
271095
271326
|
label: option.label,
|
|
271096
271327
|
value: option.value,
|
|
@@ -271119,11 +271350,12 @@ var init_option_map = __esm(() => {
|
|
|
271119
271350
|
import { isDeepStrictEqual } from "util";
|
|
271120
271351
|
function useSelectNavigation({
|
|
271121
271352
|
visibleOptionCount = 5,
|
|
271122
|
-
options:
|
|
271353
|
+
options: rawOptions,
|
|
271123
271354
|
initialFocusValue,
|
|
271124
271355
|
onFocus,
|
|
271125
271356
|
focusValue
|
|
271126
271357
|
}) {
|
|
271358
|
+
const options2 = Array.isArray(rawOptions) ? rawOptions : [];
|
|
271127
271359
|
const [state, dispatch] = import_react48.useReducer(reducer, {
|
|
271128
271360
|
visibleOptionCount,
|
|
271129
271361
|
options: options2,
|
|
@@ -271450,7 +271682,7 @@ import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
|
|
|
271450
271682
|
function useMultiSelectState({
|
|
271451
271683
|
isDisabled = false,
|
|
271452
271684
|
visibleOptionCount = 5,
|
|
271453
|
-
options:
|
|
271685
|
+
options: rawOptions,
|
|
271454
271686
|
defaultValue = [],
|
|
271455
271687
|
onChange,
|
|
271456
271688
|
onCancel,
|
|
@@ -271463,6 +271695,7 @@ function useMultiSelectState({
|
|
|
271463
271695
|
initialFocusLast,
|
|
271464
271696
|
hideIndexes = false
|
|
271465
271697
|
}) {
|
|
271698
|
+
const options2 = Array.isArray(rawOptions) ? rawOptions : [];
|
|
271466
271699
|
const [selectedValues, setSelectedValues] = import_react49.useState(defaultValue);
|
|
271467
271700
|
const [isSubmitFocused, setIsSubmitFocused] = import_react49.useState(false);
|
|
271468
271701
|
const [lastOptions, setLastOptions] = import_react49.useState(options2);
|
|
@@ -271628,7 +271861,7 @@ function SelectMulti(t0) {
|
|
|
271628
271861
|
const {
|
|
271629
271862
|
isDisabled: t1,
|
|
271630
271863
|
visibleOptionCount: t2,
|
|
271631
|
-
options:
|
|
271864
|
+
options: rawOptions,
|
|
271632
271865
|
defaultValue: t3,
|
|
271633
271866
|
onCancel,
|
|
271634
271867
|
onChange,
|
|
@@ -271647,6 +271880,7 @@ function SelectMulti(t0) {
|
|
|
271647
271880
|
} = t0;
|
|
271648
271881
|
const isDisabled = t1 === undefined ? false : t1;
|
|
271649
271882
|
const visibleOptionCount = t2 === undefined ? 5 : t2;
|
|
271883
|
+
const options2 = Array.isArray(rawOptions) ? rawOptions : [];
|
|
271650
271884
|
let t5;
|
|
271651
271885
|
if ($2[0] !== t3) {
|
|
271652
271886
|
t5 = t3 === undefined ? [] : t3;
|
|
@@ -271878,7 +272112,7 @@ var import_react50, useSelectInput = ({
|
|
|
271878
272112
|
isDisabled = false,
|
|
271879
272113
|
disableSelection = false,
|
|
271880
272114
|
state,
|
|
271881
|
-
options:
|
|
272115
|
+
options: rawOptions,
|
|
271882
272116
|
isMultiSelect = false,
|
|
271883
272117
|
onUpFromFirstItem,
|
|
271884
272118
|
onDownFromLastItem,
|
|
@@ -271887,6 +272121,7 @@ var import_react50, useSelectInput = ({
|
|
|
271887
272121
|
imagesSelected = false,
|
|
271888
272122
|
onEnterImageSelection
|
|
271889
272123
|
}) => {
|
|
272124
|
+
const options2 = Array.isArray(rawOptions) ? rawOptions : [];
|
|
271890
272125
|
useRegisterOverlay("select", !!state.onCancel);
|
|
271891
272126
|
const isInInput = import_react50.useMemo(() => {
|
|
271892
272127
|
const focusedOption = options2.find((opt) => opt.value === state.focusedValue);
|
|
@@ -272094,7 +272329,7 @@ function Select(t0) {
|
|
|
272094
272329
|
hideIndexes: t2,
|
|
272095
272330
|
visibleOptionCount: t3,
|
|
272096
272331
|
highlightText,
|
|
272097
|
-
options:
|
|
272332
|
+
options: rawOptions,
|
|
272098
272333
|
defaultValue,
|
|
272099
272334
|
onCancel,
|
|
272100
272335
|
onChange,
|
|
@@ -272117,6 +272352,7 @@ function Select(t0) {
|
|
|
272117
272352
|
const layout = t4 === undefined ? "compact" : t4;
|
|
272118
272353
|
const disableSelection = t5 === undefined ? false : t5;
|
|
272119
272354
|
const inlineDescriptions = t6 === undefined ? false : t6;
|
|
272355
|
+
const options2 = Array.isArray(rawOptions) ? rawOptions : [];
|
|
272120
272356
|
const [imagesSelected, setImagesSelected] = import_react52.useState(false);
|
|
272121
272357
|
const [selectedImageIndex, setSelectedImageIndex] = import_react52.useState(0);
|
|
272122
272358
|
let t7;
|
|
@@ -273843,7 +274079,7 @@ function isRemoteManagedSettingsEligible() {
|
|
|
273843
274079
|
if (process.env.CLAUDE_CODE_ENTRYPOINT === "local-agent") {
|
|
273844
274080
|
return cached2 = setEligibility(false);
|
|
273845
274081
|
}
|
|
273846
|
-
const tokens =
|
|
274082
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
273847
274083
|
if (tokens?.accessToken && tokens.subscriptionType === null) {
|
|
273848
274084
|
return cached2 = setEligibility(true);
|
|
273849
274085
|
}
|
|
@@ -273942,7 +274178,7 @@ function getRemoteSettingsAuthHeaders() {
|
|
|
273942
274178
|
};
|
|
273943
274179
|
}
|
|
273944
274180
|
} catch {}
|
|
273945
|
-
const oauthTokens =
|
|
274181
|
+
const oauthTokens = getMaximoAIOAuthTokens2();
|
|
273946
274182
|
if (oauthTokens?.accessToken) {
|
|
273947
274183
|
return {
|
|
273948
274184
|
headers: {
|
|
@@ -275841,7 +276077,7 @@ async function performLogout({
|
|
|
275841
276077
|
});
|
|
275842
276078
|
}
|
|
275843
276079
|
async function clearAuthRelatedCaches() {
|
|
275844
|
-
|
|
276080
|
+
getMaximoAIOAuthTokens2.cache?.clear?.();
|
|
275845
276081
|
clearTrustedDeviceTokenCache();
|
|
275846
276082
|
clearBetasCaches();
|
|
275847
276083
|
clearToolSchemaCache();
|
|
@@ -275977,7 +276213,7 @@ class AuthCodeListener {
|
|
|
275977
276213
|
logEvent("tengu_oauth_automatic_redirect", { custom_handler: true });
|
|
275978
276214
|
return;
|
|
275979
276215
|
}
|
|
275980
|
-
const successUrl = shouldUseMaximoAIAuth(scopes) ?
|
|
276216
|
+
const successUrl = shouldUseMaximoAIAuth(scopes) ? MAXIMO_OAUTH_CONFIG2.CLAUDEAI_SUCCESS_URL : getOauthConfig().CONSOLE_SUCCESS_URL;
|
|
275981
276217
|
this.pendingResponse.writeHead(302, { Location: successUrl });
|
|
275982
276218
|
this.pendingResponse.end();
|
|
275983
276219
|
this.pendingResponse = null;
|
|
@@ -276115,8 +276351,8 @@ class OAuthService {
|
|
|
276115
276351
|
const isAutomaticFlow = this.authCodeListener?.hasPendingResponse() ?? false;
|
|
276116
276352
|
logEvent("tengu_oauth_auth_code_received", { automatic: isAutomaticFlow });
|
|
276117
276353
|
try {
|
|
276118
|
-
const tokenResponse = await exchangeCodeForTokens(authorizationCode, state, this.codeVerifier, this.port, !isAutomaticFlow, options2?.expiresIn);
|
|
276119
|
-
const profileInfo = await fetchProfileInfo(tokenResponse.access_token);
|
|
276354
|
+
const tokenResponse = await exchangeCodeForTokens(authorizationCode, state, this.codeVerifier, this.port, !isAutomaticFlow, options2?.expiresIn, options2?.loginWithMaximoAi);
|
|
276355
|
+
const profileInfo = await fetchProfileInfo(tokenResponse.access_token, options2?.loginWithMaximoAi);
|
|
276120
276356
|
if (isAutomaticFlow) {
|
|
276121
276357
|
const scopes = parseScopes(tokenResponse.scope);
|
|
276122
276358
|
this.authCodeListener?.handleSuccessRedirect(scopes);
|
|
@@ -279308,6 +279544,14 @@ async function installOAuthTokens(tokens) {
|
|
|
279308
279544
|
await fetchAndStoreUserRoles(tokens.accessToken).catch((err2) => logForDebugging2(String(err2), { level: "error" }));
|
|
279309
279545
|
if (shouldUseMaximoAIAuth(tokens.scopes)) {
|
|
279310
279546
|
await fetchAndStoreMaximoCodeFirstTokenDate().catch((err2) => logForDebugging2(String(err2), { level: "error" }));
|
|
279547
|
+
saveGlobalConfig((current) => ({
|
|
279548
|
+
...current,
|
|
279549
|
+
maximoApiKey: tokens.accessToken,
|
|
279550
|
+
openAIBaseUrl: "https://api.maximoai.co/v1"
|
|
279551
|
+
}));
|
|
279552
|
+
process.env.CLAUDE_CODE_USE_OPENAI = "true";
|
|
279553
|
+
process.env.OPENAI_BASE_URL = "https://api.maximoai.co/v1";
|
|
279554
|
+
process.env.OPENAI_API_KEY = tokens.accessToken;
|
|
279311
279555
|
} else {
|
|
279312
279556
|
const apiKey = await createAndStoreApiKey(tokens.accessToken);
|
|
279313
279557
|
if (!apiKey) {
|
|
@@ -289433,7 +289677,7 @@ async function axiosGetWithRetry(url3, config2) {
|
|
|
289433
289677
|
throw lastError;
|
|
289434
289678
|
}
|
|
289435
289679
|
async function prepareApiRequest() {
|
|
289436
|
-
const accessToken =
|
|
289680
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
289437
289681
|
if (accessToken === undefined) {
|
|
289438
289682
|
throw new Error("Maximo Syntax web sessions require authentication with a Maximo.ai account. API key authentication is not sufficient. Please run /login to authenticate, or check your authentication status with /status.");
|
|
289439
289683
|
}
|
|
@@ -289767,16 +290011,128 @@ var init_overageCreditGrant = __esm(() => {
|
|
|
289767
290011
|
});
|
|
289768
290012
|
|
|
289769
290013
|
// src/services/api/usage.ts
|
|
290014
|
+
function getUsageApiBaseUrl() {
|
|
290015
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
290016
|
+
if (tokens?.scopes && shouldUseMaximoAIAuth(tokens.scopes)) {
|
|
290017
|
+
return MAXIMO_OAUTH_CONFIG2.BASE_API_URL;
|
|
290018
|
+
}
|
|
290019
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI)) {
|
|
290020
|
+
const baseUrl = process.env.OPENAI_BASE_URL || getGlobalConfig().openAIBaseUrl;
|
|
290021
|
+
if (baseUrl?.includes("maximoai.co")) {
|
|
290022
|
+
return MAXIMO_OAUTH_CONFIG2.BASE_API_URL;
|
|
290023
|
+
}
|
|
290024
|
+
}
|
|
290025
|
+
const globalConfig2 = getGlobalConfig();
|
|
290026
|
+
if (globalConfig2.maximoApiKey || globalConfig2.openAIBaseUrl?.includes("maximoai.co")) {
|
|
290027
|
+
return MAXIMO_OAUTH_CONFIG2.BASE_API_URL;
|
|
290028
|
+
}
|
|
290029
|
+
return getOauthConfig().BASE_API_URL;
|
|
290030
|
+
}
|
|
290031
|
+
function hasMaximoApiKey() {
|
|
290032
|
+
console.log("[Usage] hasMaximoApiKey check:", {
|
|
290033
|
+
useOpenAI: isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI),
|
|
290034
|
+
baseUrl: process.env.OPENAI_BASE_URL || getGlobalConfig().openAIBaseUrl,
|
|
290035
|
+
hasApiKey: !!process.env.OPENAI_API_KEY,
|
|
290036
|
+
hasMaximoApiKey: !!getGlobalConfig().maximoApiKey,
|
|
290037
|
+
hasAnthropicKey: !!getAnthropicApiKey()
|
|
290038
|
+
});
|
|
290039
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI)) {
|
|
290040
|
+
const baseUrl = process.env.OPENAI_BASE_URL || getGlobalConfig().openAIBaseUrl;
|
|
290041
|
+
const apiKey = process.env.OPENAI_API_KEY;
|
|
290042
|
+
if (apiKey && baseUrl?.includes("maximoai.co")) {
|
|
290043
|
+
console.log("[Usage] Found OPENAI_API_KEY with Maximo base URL");
|
|
290044
|
+
return true;
|
|
290045
|
+
}
|
|
290046
|
+
}
|
|
290047
|
+
const globalConfig2 = getGlobalConfig();
|
|
290048
|
+
if (globalConfig2.maximoApiKey) {
|
|
290049
|
+
console.log("[Usage] Found maximoApiKey in global config");
|
|
290050
|
+
return true;
|
|
290051
|
+
}
|
|
290052
|
+
if (getAnthropicApiKey()) {
|
|
290053
|
+
console.log("[Usage] Found Anthropic API key");
|
|
290054
|
+
return true;
|
|
290055
|
+
}
|
|
290056
|
+
console.log("[Usage] No Maximo API key found");
|
|
290057
|
+
return false;
|
|
290058
|
+
}
|
|
290059
|
+
function getUsageApiKey() {
|
|
290060
|
+
console.log("[Usage] getUsageApiKey:", {
|
|
290061
|
+
useOpenAI: isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI),
|
|
290062
|
+
baseUrl: process.env.OPENAI_BASE_URL || getGlobalConfig().openAIBaseUrl,
|
|
290063
|
+
hasKey: !!process.env.OPENAI_API_KEY,
|
|
290064
|
+
keyLength: process.env.OPENAI_API_KEY?.length,
|
|
290065
|
+
keyPrefix: process.env.OPENAI_API_KEY?.substring(0, 10)
|
|
290066
|
+
});
|
|
290067
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI)) {
|
|
290068
|
+
const baseUrl = process.env.OPENAI_BASE_URL || getGlobalConfig().openAIBaseUrl;
|
|
290069
|
+
if (baseUrl?.includes("maximoai.co")) {
|
|
290070
|
+
console.log("[Usage] Returning OPENAI_API_KEY for usage endpoint");
|
|
290071
|
+
return process.env.OPENAI_API_KEY || null;
|
|
290072
|
+
}
|
|
290073
|
+
}
|
|
290074
|
+
const globalConfig2 = getGlobalConfig();
|
|
290075
|
+
if (globalConfig2.maximoApiKey) {
|
|
290076
|
+
console.log("[Usage] Returning maximoApiKey from global config");
|
|
290077
|
+
return globalConfig2.maximoApiKey;
|
|
290078
|
+
}
|
|
290079
|
+
const anthropicKey = getAnthropicApiKey();
|
|
290080
|
+
console.log("[Usage] Falling back to Anthropic API key:", !!anthropicKey);
|
|
290081
|
+
return anthropicKey;
|
|
290082
|
+
}
|
|
290083
|
+
function canFetchUsage() {
|
|
290084
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
290085
|
+
const hasMaximoOAuth = tokens?.scopes && shouldUseMaximoAIAuth(tokens.scopes);
|
|
290086
|
+
const hasApiKey = hasMaximoApiKey();
|
|
290087
|
+
console.log("[Usage] canFetchUsage check:", {
|
|
290088
|
+
hasMaximoOAuth: !!hasMaximoOAuth,
|
|
290089
|
+
hasMaximoApiKey: hasApiKey,
|
|
290090
|
+
oauthScopes: tokens?.scopes
|
|
290091
|
+
});
|
|
290092
|
+
if (hasMaximoOAuth) {
|
|
290093
|
+
return true;
|
|
290094
|
+
}
|
|
290095
|
+
if (hasApiKey) {
|
|
290096
|
+
return true;
|
|
290097
|
+
}
|
|
290098
|
+
return false;
|
|
290099
|
+
}
|
|
289770
290100
|
async function fetchUtilization() {
|
|
289771
|
-
if (!
|
|
290101
|
+
if (!canFetchUsage()) {
|
|
289772
290102
|
return {};
|
|
289773
290103
|
}
|
|
289774
|
-
const tokens = getMaximoAIOAuthTokens();
|
|
289775
|
-
if (tokens && isOAuthTokenExpired(tokens.expiresAt)) {
|
|
289776
|
-
return null;
|
|
289777
|
-
}
|
|
289778
290104
|
const authResult = getAuthHeaders2();
|
|
289779
290105
|
if (authResult.error) {
|
|
290106
|
+
const apiKey = getUsageApiKey();
|
|
290107
|
+
if (apiKey) {
|
|
290108
|
+
console.log("[Usage] Using API key for utilization endpoint");
|
|
290109
|
+
const response2 = await axios_default.get(`${getUsageApiBaseUrl()}/cli/oauth/usage`, {
|
|
290110
|
+
headers: {
|
|
290111
|
+
"Content-Type": "application/json",
|
|
290112
|
+
"User-Agent": getMaximoCodeUserAgent(),
|
|
290113
|
+
"x-api-key": apiKey
|
|
290114
|
+
},
|
|
290115
|
+
timeout: 5000
|
|
290116
|
+
});
|
|
290117
|
+
return response2.data;
|
|
290118
|
+
}
|
|
290119
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
290120
|
+
if (tokens?.accessToken && shouldUseMaximoAIAuth(tokens.scopes)) {
|
|
290121
|
+
if (isOAuthTokenExpired(tokens.expiresAt)) {
|
|
290122
|
+
console.log("[Usage] OAuth token expired");
|
|
290123
|
+
return null;
|
|
290124
|
+
}
|
|
290125
|
+
console.log("[Usage] Using OAuth token directly for utilization endpoint");
|
|
290126
|
+
const response2 = await axios_default.get(`${getUsageApiBaseUrl()}/cli/oauth/usage`, {
|
|
290127
|
+
headers: {
|
|
290128
|
+
"Content-Type": "application/json",
|
|
290129
|
+
"User-Agent": getMaximoCodeUserAgent(),
|
|
290130
|
+
Authorization: `Bearer ${tokens.accessToken}`
|
|
290131
|
+
},
|
|
290132
|
+
timeout: 5000
|
|
290133
|
+
});
|
|
290134
|
+
return response2.data;
|
|
290135
|
+
}
|
|
289780
290136
|
throw new Error(`Auth error: ${authResult.error}`);
|
|
289781
290137
|
}
|
|
289782
290138
|
const headers = {
|
|
@@ -289784,19 +290140,89 @@ async function fetchUtilization() {
|
|
|
289784
290140
|
"User-Agent": getMaximoCodeUserAgent(),
|
|
289785
290141
|
...authResult.headers
|
|
289786
290142
|
};
|
|
289787
|
-
const url3 = `${
|
|
290143
|
+
const url3 = `${getUsageApiBaseUrl()}/cli/oauth/usage`;
|
|
289788
290144
|
const response = await axios_default.get(url3, {
|
|
289789
290145
|
headers,
|
|
289790
290146
|
timeout: 5000
|
|
289791
290147
|
});
|
|
289792
290148
|
return response.data;
|
|
289793
290149
|
}
|
|
290150
|
+
async function fetchDetailedUsage() {
|
|
290151
|
+
if (!canFetchUsage()) {
|
|
290152
|
+
console.log("[Usage] canFetchUsage returned false - cannot fetch usage data");
|
|
290153
|
+
return null;
|
|
290154
|
+
}
|
|
290155
|
+
const authResult = getAuthHeaders2();
|
|
290156
|
+
console.log("[Usage] fetchDetailedUsage authResult:", { error: authResult.error, hasHeaders: !!authResult.headers, headerKeys: authResult.headers ? Object.keys(authResult.headers) : [] });
|
|
290157
|
+
if (authResult.error) {
|
|
290158
|
+
const apiKey = getUsageApiKey();
|
|
290159
|
+
console.log("[Usage] apiKey from getUsageApiKey():", !!apiKey, apiKey?.substring(0, 15));
|
|
290160
|
+
if (apiKey) {
|
|
290161
|
+
console.log("[Usage] Using API key for detailed-usage endpoint");
|
|
290162
|
+
try {
|
|
290163
|
+
const response = await axios_default.get(`${getUsageApiBaseUrl()}/cli/usage/detailed-usage`, {
|
|
290164
|
+
headers: {
|
|
290165
|
+
"Content-Type": "application/json",
|
|
290166
|
+
"User-Agent": getMaximoCodeUserAgent(),
|
|
290167
|
+
"x-api-key": apiKey
|
|
290168
|
+
},
|
|
290169
|
+
timeout: 1e4
|
|
290170
|
+
});
|
|
290171
|
+
console.log("[Usage] Response received (API key):", response.data?.success);
|
|
290172
|
+
return response.data;
|
|
290173
|
+
} catch (err2) {
|
|
290174
|
+
console.log("[Usage] API key request failed:", err2.response?.status, err2.response?.data);
|
|
290175
|
+
throw err2;
|
|
290176
|
+
}
|
|
290177
|
+
}
|
|
290178
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
290179
|
+
if (tokens?.accessToken && shouldUseMaximoAIAuth(tokens.scopes)) {
|
|
290180
|
+
if (isOAuthTokenExpired(tokens.expiresAt)) {
|
|
290181
|
+
console.log("[Usage] OAuth token expired");
|
|
290182
|
+
return null;
|
|
290183
|
+
}
|
|
290184
|
+
console.log("[Usage] Using OAuth token directly for detailed-usage endpoint");
|
|
290185
|
+
const response = await axios_default.get(`${getUsageApiBaseUrl()}/cli/usage/detailed-usage`, {
|
|
290186
|
+
headers: {
|
|
290187
|
+
"Content-Type": "application/json",
|
|
290188
|
+
"User-Agent": getMaximoCodeUserAgent(),
|
|
290189
|
+
Authorization: `Bearer ${tokens.accessToken}`
|
|
290190
|
+
},
|
|
290191
|
+
timeout: 1e4
|
|
290192
|
+
});
|
|
290193
|
+
console.log("[Usage] Response received (OAuth):", response.data?.success);
|
|
290194
|
+
return response.data;
|
|
290195
|
+
}
|
|
290196
|
+
console.log("[Usage] Auth error:", authResult.error);
|
|
290197
|
+
throw new Error(`Auth error: ${authResult.error}`);
|
|
290198
|
+
}
|
|
290199
|
+
console.log("[Usage] Making request to /api/usage/detailed-usage with headers:", Object.keys(authResult.headers));
|
|
290200
|
+
const headers = {
|
|
290201
|
+
"Content-Type": "application/json",
|
|
290202
|
+
"User-Agent": getMaximoCodeUserAgent(),
|
|
290203
|
+
...authResult.headers
|
|
290204
|
+
};
|
|
290205
|
+
const url3 = `${getUsageApiBaseUrl()}/cli/usage/detailed-usage`;
|
|
290206
|
+
try {
|
|
290207
|
+
const response = await axios_default.get(url3, {
|
|
290208
|
+
headers,
|
|
290209
|
+
timeout: 1e4
|
|
290210
|
+
});
|
|
290211
|
+
console.log("[Usage] Response received:", response.data?.success);
|
|
290212
|
+
return response.data;
|
|
290213
|
+
} catch (err2) {
|
|
290214
|
+
console.log("[Usage] API error:", err2.response?.status, err2.response?.data);
|
|
290215
|
+
throw err2;
|
|
290216
|
+
}
|
|
290217
|
+
}
|
|
289794
290218
|
var init_usage = __esm(() => {
|
|
289795
290219
|
init_axios2();
|
|
289796
290220
|
init_oauth();
|
|
289797
290221
|
init_auth2();
|
|
289798
290222
|
init_http2();
|
|
289799
290223
|
init_client2();
|
|
290224
|
+
init_config2();
|
|
290225
|
+
init_envUtils();
|
|
289800
290226
|
});
|
|
289801
290227
|
|
|
289802
290228
|
// src/commands/extra-usage/extra-usage-core.ts
|
|
@@ -301088,7 +301514,7 @@ NOTE: You just closed out 3+ tasks and none of them was a verification step. Bef
|
|
|
301088
301514
|
|
|
301089
301515
|
// src/utils/teleport/environments.ts
|
|
301090
301516
|
async function fetchEnvironments() {
|
|
301091
|
-
const accessToken =
|
|
301517
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
301092
301518
|
if (!accessToken) {
|
|
301093
301519
|
throw new Error("Maximo Syntax web sessions require authentication with a Maximo.ai account. API key authentication is not sufficient. Please run /login to authenticate, or check your authentication status with /status.");
|
|
301094
301520
|
}
|
|
@@ -301151,7 +301577,7 @@ function checkIsInGitRepo() {
|
|
|
301151
301577
|
}
|
|
301152
301578
|
async function checkGithubAppInstalled(owner, repo, signal) {
|
|
301153
301579
|
try {
|
|
301154
|
-
const accessToken =
|
|
301580
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
301155
301581
|
if (!accessToken) {
|
|
301156
301582
|
logForDebugging2("checkGithubAppInstalled: No access token found, assuming app not installed");
|
|
301157
301583
|
return false;
|
|
@@ -305192,7 +305618,7 @@ async function teleportResumeCodeSession(sessionId, onProgress) {
|
|
|
305192
305618
|
}
|
|
305193
305619
|
logForDebugging2(`Resuming code session ID: ${sessionId}`);
|
|
305194
305620
|
try {
|
|
305195
|
-
const accessToken =
|
|
305621
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
305196
305622
|
if (!accessToken) {
|
|
305197
305623
|
logEvent("tengu_teleport_resume_error", {
|
|
305198
305624
|
error_type: "no_access_token"
|
|
@@ -305333,7 +305759,7 @@ ${source_default.dim("Run /status in Maximo Syntax to check your account.")}`);
|
|
|
305333
305759
|
}
|
|
305334
305760
|
}
|
|
305335
305761
|
async function pollRemoteSessionEvents(sessionId, afterId = null, opts) {
|
|
305336
|
-
const accessToken =
|
|
305762
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
305337
305763
|
if (!accessToken) {
|
|
305338
305764
|
throw new Error("No access token for polling");
|
|
305339
305765
|
}
|
|
@@ -305409,7 +305835,7 @@ async function teleportToRemote(options2) {
|
|
|
305409
305835
|
const { initialMessage, signal } = options2;
|
|
305410
305836
|
try {
|
|
305411
305837
|
await checkAndRefreshOAuthTokenIfNeeded();
|
|
305412
|
-
const accessToken =
|
|
305838
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
305413
305839
|
if (!accessToken) {
|
|
305414
305840
|
logError2(new Error("No access token found for remote session creation"));
|
|
305415
305841
|
return null;
|
|
@@ -305714,7 +306140,7 @@ Response data: ${jsonStringify(response.data, null, 2)}`));
|
|
|
305714
306140
|
}
|
|
305715
306141
|
}
|
|
305716
306142
|
async function archiveRemoteSession(sessionId) {
|
|
305717
|
-
const accessToken =
|
|
306143
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
305718
306144
|
if (!accessToken)
|
|
305719
306145
|
return;
|
|
305720
306146
|
const orgUUID = await getOrganizationUUID();
|
|
@@ -349939,146 +350365,6 @@ var init_ExitWorktreeTool = __esm(() => {
|
|
|
349939
350365
|
// src/tools/ConfigTool/constants.ts
|
|
349940
350366
|
var CONFIG_TOOL_NAME = "Config";
|
|
349941
350367
|
|
|
349942
|
-
// src/services/api/maximoModels.ts
|
|
349943
|
-
function isMaximoAIProviderInternal() {
|
|
349944
|
-
const provider = process.env.CLAUDE_CODE_USE_OPENAI ? "openai" : process.env.CLAUDE_CODE_USE_GEMINI ? "gemini" : process.env.CLAUDE_CODE_USE_BEDROCK ? "bedrock" : process.env.CLAUDE_CODE_USE_VERTEX ? "vertex" : process.env.CLAUDE_CODE_USE_FOUNDRY ? "foundry" : "firstParty";
|
|
349945
|
-
const baseUrl = process.env.OPENAI_BASE_URL || "";
|
|
349946
|
-
if (provider === "openai" && (baseUrl.includes("api.maximoai.co") || baseUrl.includes("maximoai.co"))) {
|
|
349947
|
-
return true;
|
|
349948
|
-
}
|
|
349949
|
-
const globalConfig2 = getGlobalConfig();
|
|
349950
|
-
if (globalConfig2.maximoApiKey && (globalConfig2.openAIBaseUrl?.includes("maximoai.co") || baseUrl.includes("maximoai.co"))) {
|
|
349951
|
-
return true;
|
|
349952
|
-
}
|
|
349953
|
-
return false;
|
|
349954
|
-
}
|
|
349955
|
-
function getMaximoAIBaseUrl() {
|
|
349956
|
-
const globalConfig2 = getGlobalConfig();
|
|
349957
|
-
return globalConfig2.openAIBaseUrl || process.env.OPENAI_BASE_URL || "https://api.maximoai.co/v1";
|
|
349958
|
-
}
|
|
349959
|
-
function getMaximoApiKey() {
|
|
349960
|
-
const globalConfig2 = getGlobalConfig();
|
|
349961
|
-
return globalConfig2.maximoApiKey || process.env.OPENAI_API_KEY;
|
|
349962
|
-
}
|
|
349963
|
-
async function fetchMaximoModels() {
|
|
349964
|
-
if (cachedModels && Date.now() - lastFetchTime < CACHE_TTL) {
|
|
349965
|
-
return cachedModels;
|
|
349966
|
-
}
|
|
349967
|
-
const baseUrl = getMaximoAIBaseUrl();
|
|
349968
|
-
const apiKey = getMaximoApiKey();
|
|
349969
|
-
if (!apiKey) {
|
|
349970
|
-
return [];
|
|
349971
|
-
}
|
|
349972
|
-
try {
|
|
349973
|
-
const response = await fetch(`${baseUrl}/models`, {
|
|
349974
|
-
headers: {
|
|
349975
|
-
Authorization: `Bearer ${apiKey}`,
|
|
349976
|
-
"Content-Type": "application/json"
|
|
349977
|
-
}
|
|
349978
|
-
});
|
|
349979
|
-
if (!response.ok) {
|
|
349980
|
-
throw new Error(`Failed to fetch models: ${response.status} ${response.statusText}`);
|
|
349981
|
-
}
|
|
349982
|
-
const data = await response.json();
|
|
349983
|
-
const sortedModels = data.data.sort((a2, b) => {
|
|
349984
|
-
const aIsPandora = a2.id.includes("pandora");
|
|
349985
|
-
const bIsPandora = b.id.includes("pandora");
|
|
349986
|
-
if (aIsPandora && !bIsPandora)
|
|
349987
|
-
return -1;
|
|
349988
|
-
if (!aIsPandora && bIsPandora)
|
|
349989
|
-
return 1;
|
|
349990
|
-
if (a2.isPreview && !b.isPreview)
|
|
349991
|
-
return 1;
|
|
349992
|
-
if (!a2.isPreview && b.isPreview)
|
|
349993
|
-
return -1;
|
|
349994
|
-
return a2.name.localeCompare(b.name);
|
|
349995
|
-
});
|
|
349996
|
-
cachedModels = sortedModels;
|
|
349997
|
-
lastFetchTime = Date.now();
|
|
349998
|
-
return sortedModels;
|
|
349999
|
-
} catch (error42) {
|
|
350000
|
-
logError2(error42);
|
|
350001
|
-
return cachedModels || [];
|
|
350002
|
-
}
|
|
350003
|
-
}
|
|
350004
|
-
function getShortLabel(fullName, modelId) {
|
|
350005
|
-
const match = fullName.match(/Maximo AI:\s*(.+)/);
|
|
350006
|
-
if (match) {
|
|
350007
|
-
return match[1];
|
|
350008
|
-
}
|
|
350009
|
-
return modelId.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
350010
|
-
}
|
|
350011
|
-
function toModelOption(model) {
|
|
350012
|
-
const label = getShortLabel(model.name, model.id);
|
|
350013
|
-
let description = model.description;
|
|
350014
|
-
if (description.length > 120) {
|
|
350015
|
-
description = description.slice(0, 117) + "...";
|
|
350016
|
-
}
|
|
350017
|
-
if (model.isPreview) {
|
|
350018
|
-
description = `[Preview] ${description}`;
|
|
350019
|
-
}
|
|
350020
|
-
const contextInK = Math.round(model.context_length / 1000);
|
|
350021
|
-
const outputInK = Math.round(model.max_output_length / 1000);
|
|
350022
|
-
return {
|
|
350023
|
-
value: model.id,
|
|
350024
|
-
label,
|
|
350025
|
-
description: `${description} · ${contextInK}K context · ${outputInK}K output`,
|
|
350026
|
-
descriptionForModel: `${model.name} - ${model.description}`
|
|
350027
|
-
};
|
|
350028
|
-
}
|
|
350029
|
-
async function getMaximoModelOptions() {
|
|
350030
|
-
if (!isMaximoAIProviderInternal()) {
|
|
350031
|
-
return null;
|
|
350032
|
-
}
|
|
350033
|
-
const models = await fetchMaximoModels();
|
|
350034
|
-
if (models.length === 0) {
|
|
350035
|
-
return null;
|
|
350036
|
-
}
|
|
350037
|
-
const groupedModels = {};
|
|
350038
|
-
for (const model of models) {
|
|
350039
|
-
const match = model.id.match(/maximo-(\w+)-/);
|
|
350040
|
-
const family = match ? match[1] : "other";
|
|
350041
|
-
if (!groupedModels[family]) {
|
|
350042
|
-
groupedModels[family] = [];
|
|
350043
|
-
}
|
|
350044
|
-
groupedModels[family].push(model);
|
|
350045
|
-
}
|
|
350046
|
-
const options2 = [];
|
|
350047
|
-
const familyPriority = ["pandora", "astra", "beta", "alpha"];
|
|
350048
|
-
for (const family of familyPriority) {
|
|
350049
|
-
if (groupedModels[family]) {
|
|
350050
|
-
groupedModels[family].sort((a2, b) => {
|
|
350051
|
-
const aVersion = a2.id.match(/(\d+\.?\d*)/)?.[1] || "0";
|
|
350052
|
-
const bVersion = b.id.match(/(\d+\.?\d*)/)?.[1] || "0";
|
|
350053
|
-
return parseFloat(bVersion) - parseFloat(aVersion);
|
|
350054
|
-
});
|
|
350055
|
-
for (const model of groupedModels[family]) {
|
|
350056
|
-
options2.push(toModelOption(model));
|
|
350057
|
-
}
|
|
350058
|
-
}
|
|
350059
|
-
}
|
|
350060
|
-
for (const [family, models2] of Object.entries(groupedModels)) {
|
|
350061
|
-
if (!familyPriority.includes(family)) {
|
|
350062
|
-
for (const model of models2) {
|
|
350063
|
-
options2.push(toModelOption(model));
|
|
350064
|
-
}
|
|
350065
|
-
}
|
|
350066
|
-
}
|
|
350067
|
-
return options2;
|
|
350068
|
-
}
|
|
350069
|
-
function getCachedMaximoModelOptions() {
|
|
350070
|
-
if (!cachedModels || cachedModels.length === 0) {
|
|
350071
|
-
return null;
|
|
350072
|
-
}
|
|
350073
|
-
return cachedModels.map(toModelOption);
|
|
350074
|
-
}
|
|
350075
|
-
var cachedModels = null, lastFetchTime = 0, CACHE_TTL;
|
|
350076
|
-
var init_maximoModels = __esm(() => {
|
|
350077
|
-
init_config2();
|
|
350078
|
-
init_log3();
|
|
350079
|
-
CACHE_TTL = 5 * 60 * 1000;
|
|
350080
|
-
});
|
|
350081
|
-
|
|
350082
350368
|
// src/utils/model/modelOptions.ts
|
|
350083
350369
|
function getDefaultOptionForUser(fastMode = false) {
|
|
350084
350370
|
if (process.env.USER_TYPE === "ant") {
|
|
@@ -364502,7 +364788,7 @@ function getAnthropicEnvMetadata() {
|
|
|
364502
364788
|
function getBuildAgeMinutes() {
|
|
364503
364789
|
if (false)
|
|
364504
364790
|
;
|
|
364505
|
-
const buildTime = new Date("2026-04-
|
|
364791
|
+
const buildTime = new Date("2026-04-10T22:52:11.984Z").getTime();
|
|
364506
364792
|
if (isNaN(buildTime))
|
|
364507
364793
|
return;
|
|
364508
364794
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -380704,7 +380990,7 @@ Run /share and post the JSON file to ${MACRO.FEEDBACK_CHANNEL}.`;
|
|
|
380704
380990
|
if (error42 instanceof APIError && error42.status === 400 && error42.message.toLowerCase().includes("organization has been disabled")) {
|
|
380705
380991
|
const { source } = getAnthropicApiKeyWithSource();
|
|
380706
380992
|
if (source === "ANTHROPIC_API_KEY" && process.env.ANTHROPIC_API_KEY && !isMaximoAISubscriber()) {
|
|
380707
|
-
const hasStoredOAuth =
|
|
380993
|
+
const hasStoredOAuth = getMaximoAIOAuthTokens2()?.accessToken != null;
|
|
380708
380994
|
return createAssistantAPIErrorMessage({
|
|
380709
380995
|
error: "invalid_request",
|
|
380710
380996
|
content: hasStoredOAuth ? ORG_DISABLED_ERROR_MESSAGE_ENV_KEY_WITH_OAUTH : ORG_DISABLED_ERROR_MESSAGE_ENV_KEY
|
|
@@ -396141,6 +396427,7 @@ function LimitBar(t0) {
|
|
|
396141
396427
|
}
|
|
396142
396428
|
function Usage() {
|
|
396143
396429
|
const [utilization, setUtilization] = import_react110.useState(null);
|
|
396430
|
+
const [detailedUsage, setDetailedUsage] = import_react110.useState(null);
|
|
396144
396431
|
const [error42, setError] = import_react110.useState(null);
|
|
396145
396432
|
const [isLoading, setIsLoading] = import_react110.useState(true);
|
|
396146
396433
|
const {
|
|
@@ -396152,8 +396439,14 @@ function Usage() {
|
|
|
396152
396439
|
setIsLoading(true);
|
|
396153
396440
|
setError(null);
|
|
396154
396441
|
try {
|
|
396155
|
-
const
|
|
396156
|
-
|
|
396442
|
+
const [utilData, detailedData] = await Promise.all([
|
|
396443
|
+
fetchUtilization(),
|
|
396444
|
+
fetchDetailedUsage()
|
|
396445
|
+
]);
|
|
396446
|
+
setUtilization(utilData);
|
|
396447
|
+
if (detailedData?.success) {
|
|
396448
|
+
setDetailedUsage(detailedData.data);
|
|
396449
|
+
}
|
|
396157
396450
|
} catch (err2) {
|
|
396158
396451
|
logError2(err2);
|
|
396159
396452
|
const axiosError = err2;
|
|
@@ -396265,6 +396558,15 @@ function Usage() {
|
|
|
396265
396558
|
isEligibleForOverageCreditGrant() && /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(OverageCreditUpsell, {
|
|
396266
396559
|
maxWidth
|
|
396267
396560
|
}, undefined, false, undefined, this),
|
|
396561
|
+
detailedUsage && /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(BillingSection, {
|
|
396562
|
+
billing: detailedUsage.billing,
|
|
396563
|
+
subscription: detailedUsage.subscription,
|
|
396564
|
+
maxWidth
|
|
396565
|
+
}, undefined, false, undefined, this),
|
|
396566
|
+
detailedUsage?.allocations && /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(AllocationsSection, {
|
|
396567
|
+
allocations: detailedUsage.allocations,
|
|
396568
|
+
maxWidth
|
|
396569
|
+
}, undefined, false, undefined, this),
|
|
396268
396570
|
/* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396269
396571
|
dimColor: true,
|
|
396270
396572
|
children: /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ConfigurableShortcutHint, {
|
|
@@ -396413,6 +396715,217 @@ function ExtraUsageSection(t0) {
|
|
|
396413
396715
|
}
|
|
396414
396716
|
return t10;
|
|
396415
396717
|
}
|
|
396718
|
+
function BillingSection(t0) {
|
|
396719
|
+
const $2 = import_react_compiler_runtime143.c(11);
|
|
396720
|
+
const { billing, subscription, maxWidth } = t0;
|
|
396721
|
+
const { walletBalance, totalSpent, totalDeposited, currency } = billing;
|
|
396722
|
+
const formattedWallet = formatCost(walletBalance, 2);
|
|
396723
|
+
const formattedSpent = formatCost(totalSpent, 2);
|
|
396724
|
+
const formattedDeposited = formatCost(totalDeposited, 2);
|
|
396725
|
+
let t1;
|
|
396726
|
+
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
396727
|
+
t1 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396728
|
+
bold: true,
|
|
396729
|
+
children: "Billing"
|
|
396730
|
+
}, undefined, false, undefined, this);
|
|
396731
|
+
$2[0] = t1;
|
|
396732
|
+
} else {
|
|
396733
|
+
t1 = $2[0];
|
|
396734
|
+
}
|
|
396735
|
+
let t2;
|
|
396736
|
+
if ($2[1] !== formattedWallet) {
|
|
396737
|
+
t2 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396738
|
+
children: [
|
|
396739
|
+
/* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396740
|
+
dimColor: true,
|
|
396741
|
+
children: "Wallet Balance: "
|
|
396742
|
+
}, undefined, false, undefined, this),
|
|
396743
|
+
/* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396744
|
+
color: "green",
|
|
396745
|
+
children: [
|
|
396746
|
+
formattedWallet,
|
|
396747
|
+
" ",
|
|
396748
|
+
currency
|
|
396749
|
+
]
|
|
396750
|
+
}, undefined, true, undefined, this)
|
|
396751
|
+
]
|
|
396752
|
+
}, undefined, true, undefined, this);
|
|
396753
|
+
$2[1] = formattedWallet;
|
|
396754
|
+
$2[2] = t2;
|
|
396755
|
+
} else {
|
|
396756
|
+
t2 = $2[2];
|
|
396757
|
+
}
|
|
396758
|
+
let t3;
|
|
396759
|
+
if ($2[3] !== formattedSpent) {
|
|
396760
|
+
t3 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396761
|
+
children: [
|
|
396762
|
+
/* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396763
|
+
dimColor: true,
|
|
396764
|
+
children: "Total Spent: "
|
|
396765
|
+
}, undefined, false, undefined, this),
|
|
396766
|
+
/* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396767
|
+
color: "red",
|
|
396768
|
+
children: [
|
|
396769
|
+
formattedSpent,
|
|
396770
|
+
" ",
|
|
396771
|
+
currency
|
|
396772
|
+
]
|
|
396773
|
+
}, undefined, true, undefined, this)
|
|
396774
|
+
]
|
|
396775
|
+
}, undefined, true, undefined, this);
|
|
396776
|
+
$2[3] = formattedSpent;
|
|
396777
|
+
$2[4] = t3;
|
|
396778
|
+
} else {
|
|
396779
|
+
t3 = $2[4];
|
|
396780
|
+
}
|
|
396781
|
+
let t4;
|
|
396782
|
+
if ($2[5] !== formattedDeposited) {
|
|
396783
|
+
t4 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396784
|
+
children: [
|
|
396785
|
+
/* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396786
|
+
dimColor: true,
|
|
396787
|
+
children: "Total Deposited: "
|
|
396788
|
+
}, undefined, false, undefined, this),
|
|
396789
|
+
/* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396790
|
+
children: [
|
|
396791
|
+
formattedDeposited,
|
|
396792
|
+
" ",
|
|
396793
|
+
currency
|
|
396794
|
+
]
|
|
396795
|
+
}, undefined, true, undefined, this)
|
|
396796
|
+
]
|
|
396797
|
+
}, undefined, true, undefined, this);
|
|
396798
|
+
$2[5] = formattedDeposited;
|
|
396799
|
+
$2[6] = t4;
|
|
396800
|
+
} else {
|
|
396801
|
+
t4 = $2[6];
|
|
396802
|
+
}
|
|
396803
|
+
let t5;
|
|
396804
|
+
if ($2[7] !== t1 || $2[8] !== t2 || $2[9] !== t3 || $2[10] !== subscription) {
|
|
396805
|
+
t5 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedBox_default, {
|
|
396806
|
+
flexDirection: "column",
|
|
396807
|
+
gap: 1,
|
|
396808
|
+
children: [
|
|
396809
|
+
t1,
|
|
396810
|
+
subscription?.displayAmount && /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396811
|
+
children: [
|
|
396812
|
+
/* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396813
|
+
dimColor: true,
|
|
396814
|
+
children: "Subscription: "
|
|
396815
|
+
}, undefined, false, undefined, this),
|
|
396816
|
+
/* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396817
|
+
color: "cyan",
|
|
396818
|
+
children: [
|
|
396819
|
+
subscription.planType,
|
|
396820
|
+
" (",
|
|
396821
|
+
subscription.displayAmount,
|
|
396822
|
+
" ",
|
|
396823
|
+
subscription.currency,
|
|
396824
|
+
")"
|
|
396825
|
+
]
|
|
396826
|
+
}, undefined, true, undefined, this)
|
|
396827
|
+
]
|
|
396828
|
+
}, undefined, true, undefined, this),
|
|
396829
|
+
t2,
|
|
396830
|
+
t3,
|
|
396831
|
+
t4
|
|
396832
|
+
]
|
|
396833
|
+
}, undefined, true, undefined, this);
|
|
396834
|
+
$2[7] = t1;
|
|
396835
|
+
$2[8] = t2;
|
|
396836
|
+
$2[9] = t3;
|
|
396837
|
+
$2[10] = subscription;
|
|
396838
|
+
} else {
|
|
396839
|
+
t5 = $2[8];
|
|
396840
|
+
}
|
|
396841
|
+
return t5;
|
|
396842
|
+
}
|
|
396843
|
+
function AllocationsSection(t0) {
|
|
396844
|
+
const $2 = import_react_compiler_runtime143.c(14);
|
|
396845
|
+
const { allocations, maxWidth } = t0;
|
|
396846
|
+
const { daily, fiveHour, weekly } = allocations;
|
|
396847
|
+
let t1;
|
|
396848
|
+
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
396849
|
+
t1 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedText, {
|
|
396850
|
+
bold: true,
|
|
396851
|
+
children: "Allocations"
|
|
396852
|
+
}, undefined, false, undefined, this);
|
|
396853
|
+
$2[0] = t1;
|
|
396854
|
+
} else {
|
|
396855
|
+
t1 = $2[0];
|
|
396856
|
+
}
|
|
396857
|
+
const dailyLimit = {
|
|
396858
|
+
utilization: daily.percentUsed,
|
|
396859
|
+
resets_at: daily.resetAt
|
|
396860
|
+
};
|
|
396861
|
+
const fiveHourLimit = {
|
|
396862
|
+
utilization: fiveHour.percentUsed,
|
|
396863
|
+
resets_at: fiveHour.resetAt
|
|
396864
|
+
};
|
|
396865
|
+
const weeklyLimit = {
|
|
396866
|
+
utilization: weekly.percentUsed,
|
|
396867
|
+
resets_at: weekly.resetAt
|
|
396868
|
+
};
|
|
396869
|
+
let t2;
|
|
396870
|
+
if ($2[1] !== maxWidth || $2[2] !== dailyLimit) {
|
|
396871
|
+
t2 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(LimitBar, {
|
|
396872
|
+
title: "Daily Limit",
|
|
396873
|
+
limit: dailyLimit,
|
|
396874
|
+
maxWidth
|
|
396875
|
+
}, undefined, false, undefined, this);
|
|
396876
|
+
$2[1] = maxWidth;
|
|
396877
|
+
$2[2] = dailyLimit;
|
|
396878
|
+
$2[3] = t2;
|
|
396879
|
+
} else {
|
|
396880
|
+
t2 = $2[3];
|
|
396881
|
+
}
|
|
396882
|
+
let t3;
|
|
396883
|
+
if ($2[4] !== maxWidth || $2[5] !== fiveHourLimit) {
|
|
396884
|
+
t3 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(LimitBar, {
|
|
396885
|
+
title: "5-Hour Window",
|
|
396886
|
+
limit: fiveHourLimit,
|
|
396887
|
+
maxWidth
|
|
396888
|
+
}, undefined, false, undefined, this);
|
|
396889
|
+
$2[4] = maxWidth;
|
|
396890
|
+
$2[5] = fiveHourLimit;
|
|
396891
|
+
$2[6] = t3;
|
|
396892
|
+
} else {
|
|
396893
|
+
t3 = $2[6];
|
|
396894
|
+
}
|
|
396895
|
+
let t4;
|
|
396896
|
+
if ($2[7] !== maxWidth || $2[8] !== weeklyLimit) {
|
|
396897
|
+
t4 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(LimitBar, {
|
|
396898
|
+
title: "Weekly Limit",
|
|
396899
|
+
limit: weeklyLimit,
|
|
396900
|
+
maxWidth
|
|
396901
|
+
}, undefined, false, undefined, this);
|
|
396902
|
+
$2[7] = maxWidth;
|
|
396903
|
+
$2[8] = weeklyLimit;
|
|
396904
|
+
$2[9] = t4;
|
|
396905
|
+
} else {
|
|
396906
|
+
t4 = $2[9];
|
|
396907
|
+
}
|
|
396908
|
+
let t5;
|
|
396909
|
+
if ($2[10] !== t1 || $2[11] !== t2 || $2[12] !== t3 || $2[13] !== t4) {
|
|
396910
|
+
t5 = /* @__PURE__ */ jsx_dev_runtime180.jsxDEV(ThemedBox_default, {
|
|
396911
|
+
flexDirection: "column",
|
|
396912
|
+
gap: 1,
|
|
396913
|
+
children: [
|
|
396914
|
+
t1,
|
|
396915
|
+
t2,
|
|
396916
|
+
t3,
|
|
396917
|
+
t4
|
|
396918
|
+
]
|
|
396919
|
+
}, undefined, true, undefined, this);
|
|
396920
|
+
$2[10] = t1;
|
|
396921
|
+
$2[11] = t2;
|
|
396922
|
+
$2[12] = t3;
|
|
396923
|
+
$2[13] = t4;
|
|
396924
|
+
} else {
|
|
396925
|
+
t5 = $2[10];
|
|
396926
|
+
}
|
|
396927
|
+
return t5;
|
|
396928
|
+
}
|
|
396416
396929
|
var import_react_compiler_runtime143, React56, import_react110, jsx_dev_runtime180, EXTRA_USAGE_SECTION_TITLE = "Extra usage";
|
|
396417
396930
|
var init_Usage = __esm(() => {
|
|
396418
396931
|
init_extra_usage2();
|
|
@@ -409521,7 +410034,7 @@ function gateChannelServer(serverName, capabilities, pluginSource) {
|
|
|
409521
410034
|
reason: "channels feature is not currently available"
|
|
409522
410035
|
};
|
|
409523
410036
|
}
|
|
409524
|
-
if (!
|
|
410037
|
+
if (!getMaximoAIOAuthTokens2()?.accessToken) {
|
|
409525
410038
|
return {
|
|
409526
410039
|
action: "skip",
|
|
409527
410040
|
kind: "auth",
|
|
@@ -427866,7 +428379,7 @@ function getBridgeBaseUrlOverride() {
|
|
|
427866
428379
|
return process.env.USER_TYPE === "ant" && process.env.CLAUDE_BRIDGE_BASE_URL || undefined;
|
|
427867
428380
|
}
|
|
427868
428381
|
function getBridgeAccessToken() {
|
|
427869
|
-
return getBridgeTokenOverride() ??
|
|
428382
|
+
return getBridgeTokenOverride() ?? getMaximoAIOAuthTokens2()?.accessToken;
|
|
427870
428383
|
}
|
|
427871
428384
|
function getBridgeBaseUrl() {
|
|
427872
428385
|
return getBridgeBaseUrlOverride() ?? getOauthConfig().BASE_API_URL;
|
|
@@ -428113,7 +428626,7 @@ async function createBridgeSession({
|
|
|
428113
428626
|
getAccessToken,
|
|
428114
428627
|
permissionMode
|
|
428115
428628
|
}) {
|
|
428116
|
-
const { getMaximoAIOAuthTokens:
|
|
428629
|
+
const { getMaximoAIOAuthTokens: getMaximoAIOAuthTokens3 } = await Promise.resolve().then(() => (init_auth2(), exports_auth));
|
|
428117
428630
|
const { getOrganizationUUID: getOrganizationUUID2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
428118
428631
|
const { getOauthConfig: getOauthConfig2 } = await Promise.resolve().then(() => (init_oauth(), exports_oauth));
|
|
428119
428632
|
const { getOAuthHeaders: getOAuthHeaders2 } = await Promise.resolve().then(() => (init_api2(), exports_api));
|
|
@@ -428121,7 +428634,7 @@ async function createBridgeSession({
|
|
|
428121
428634
|
const { getDefaultBranch: getDefaultBranch2 } = await Promise.resolve().then(() => (init_git(), exports_git));
|
|
428122
428635
|
const { getMainLoopModel: getMainLoopModel3 } = await Promise.resolve().then(() => (init_model(), exports_model));
|
|
428123
428636
|
const { default: axios2 } = await Promise.resolve().then(() => (init_axios2(), exports_axios));
|
|
428124
|
-
const accessToken = getAccessToken?.() ??
|
|
428637
|
+
const accessToken = getAccessToken?.() ?? getMaximoAIOAuthTokens3()?.accessToken;
|
|
428125
428638
|
if (!accessToken) {
|
|
428126
428639
|
logForDebugging2("[bridge] No access token for session creation");
|
|
428127
428640
|
return null;
|
|
@@ -428218,12 +428731,12 @@ async function createBridgeSession({
|
|
|
428218
428731
|
return sessionData.id;
|
|
428219
428732
|
}
|
|
428220
428733
|
async function getBridgeSession(sessionId, opts) {
|
|
428221
|
-
const { getMaximoAIOAuthTokens:
|
|
428734
|
+
const { getMaximoAIOAuthTokens: getMaximoAIOAuthTokens3 } = await Promise.resolve().then(() => (init_auth2(), exports_auth));
|
|
428222
428735
|
const { getOrganizationUUID: getOrganizationUUID2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
428223
428736
|
const { getOauthConfig: getOauthConfig2 } = await Promise.resolve().then(() => (init_oauth(), exports_oauth));
|
|
428224
428737
|
const { getOAuthHeaders: getOAuthHeaders2 } = await Promise.resolve().then(() => (init_api2(), exports_api));
|
|
428225
428738
|
const { default: axios2 } = await Promise.resolve().then(() => (init_axios2(), exports_axios));
|
|
428226
|
-
const accessToken = opts?.getAccessToken?.() ??
|
|
428739
|
+
const accessToken = opts?.getAccessToken?.() ?? getMaximoAIOAuthTokens3()?.accessToken;
|
|
428227
428740
|
if (!accessToken) {
|
|
428228
428741
|
logForDebugging2("[bridge] No access token for session fetch");
|
|
428229
428742
|
return null;
|
|
@@ -428255,12 +428768,12 @@ async function getBridgeSession(sessionId, opts) {
|
|
|
428255
428768
|
return response.data;
|
|
428256
428769
|
}
|
|
428257
428770
|
async function archiveBridgeSession(sessionId, opts) {
|
|
428258
|
-
const { getMaximoAIOAuthTokens:
|
|
428771
|
+
const { getMaximoAIOAuthTokens: getMaximoAIOAuthTokens3 } = await Promise.resolve().then(() => (init_auth2(), exports_auth));
|
|
428259
428772
|
const { getOrganizationUUID: getOrganizationUUID2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
428260
428773
|
const { getOauthConfig: getOauthConfig2 } = await Promise.resolve().then(() => (init_oauth(), exports_oauth));
|
|
428261
428774
|
const { getOAuthHeaders: getOAuthHeaders2 } = await Promise.resolve().then(() => (init_api2(), exports_api));
|
|
428262
428775
|
const { default: axios2 } = await Promise.resolve().then(() => (init_axios2(), exports_axios));
|
|
428263
|
-
const accessToken = opts?.getAccessToken?.() ??
|
|
428776
|
+
const accessToken = opts?.getAccessToken?.() ?? getMaximoAIOAuthTokens3()?.accessToken;
|
|
428264
428777
|
if (!accessToken) {
|
|
428265
428778
|
logForDebugging2("[bridge] No access token for session archive");
|
|
428266
428779
|
return;
|
|
@@ -428290,12 +428803,12 @@ async function archiveBridgeSession(sessionId, opts) {
|
|
|
428290
428803
|
}
|
|
428291
428804
|
}
|
|
428292
428805
|
async function updateBridgeSessionTitle(sessionId, title, opts) {
|
|
428293
|
-
const { getMaximoAIOAuthTokens:
|
|
428806
|
+
const { getMaximoAIOAuthTokens: getMaximoAIOAuthTokens3 } = await Promise.resolve().then(() => (init_auth2(), exports_auth));
|
|
428294
428807
|
const { getOrganizationUUID: getOrganizationUUID2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
428295
428808
|
const { getOauthConfig: getOauthConfig2 } = await Promise.resolve().then(() => (init_oauth(), exports_oauth));
|
|
428296
428809
|
const { getOAuthHeaders: getOAuthHeaders2 } = await Promise.resolve().then(() => (init_api2(), exports_api));
|
|
428297
428810
|
const { default: axios2 } = await Promise.resolve().then(() => (init_axios2(), exports_axios));
|
|
428298
|
-
const accessToken = opts?.getAccessToken?.() ??
|
|
428811
|
+
const accessToken = opts?.getAccessToken?.() ?? getMaximoAIOAuthTokens3()?.accessToken;
|
|
428299
428812
|
if (!accessToken) {
|
|
428300
428813
|
logForDebugging2("[bridge] No access token for session title update");
|
|
428301
428814
|
return;
|
|
@@ -428941,7 +429454,7 @@ function getRecentActivitySync() {
|
|
|
428941
429454
|
return cachedActivity;
|
|
428942
429455
|
}
|
|
428943
429456
|
function getLogoDisplayData() {
|
|
428944
|
-
const version2 = process.env.DEMO_VERSION ?? "0.1.
|
|
429457
|
+
const version2 = process.env.DEMO_VERSION ?? "0.1.11" ?? "99.0.0";
|
|
428945
429458
|
const serverUrl = getDirectConnectServerUrl();
|
|
428946
429459
|
const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
|
|
428947
429460
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -430379,7 +430892,7 @@ var init_AnimatedAsterisk = __esm(() => {
|
|
|
430379
430892
|
|
|
430380
430893
|
// src/components/LogoV2/Opus1mMergeNotice.tsx
|
|
430381
430894
|
function shouldShowOpus1mMergeNotice() {
|
|
430382
|
-
return
|
|
430895
|
+
return false;
|
|
430383
430896
|
}
|
|
430384
430897
|
function Opus1mMergeNotice() {
|
|
430385
430898
|
const $2 = import_react_compiler_runtime201.c(4);
|
|
@@ -430437,12 +430950,11 @@ function Opus1mMergeNotice() {
|
|
|
430437
430950
|
}
|
|
430438
430951
|
return t2;
|
|
430439
430952
|
}
|
|
430440
|
-
var import_react_compiler_runtime201, import_react151, jsx_dev_runtime255
|
|
430953
|
+
var import_react_compiler_runtime201, import_react151, jsx_dev_runtime255;
|
|
430441
430954
|
var init_Opus1mMergeNotice = __esm(() => {
|
|
430442
430955
|
init_figures2();
|
|
430443
430956
|
init_ink2();
|
|
430444
430957
|
init_config2();
|
|
430445
|
-
init_model();
|
|
430446
430958
|
init_AnimatedAsterisk();
|
|
430447
430959
|
import_react_compiler_runtime201 = __toESM(require_dist4(), 1);
|
|
430448
430960
|
import_react151 = __toESM(require_react(), 1);
|
|
@@ -430475,10 +430987,13 @@ var init_VoiceModeNotice = __esm(() => {
|
|
|
430475
430987
|
});
|
|
430476
430988
|
|
|
430477
430989
|
// src/components/LogoV2/LogoV2.tsx
|
|
430990
|
+
function isMaximoAIOAuthContext() {
|
|
430991
|
+
return isMaximoAISubscriber() || getAPIProvider() === "openai";
|
|
430992
|
+
}
|
|
430478
430993
|
function LogoV2() {
|
|
430479
430994
|
const $2 = import_react_compiler_runtime203.c(94);
|
|
430480
430995
|
const activities = getRecentActivitySync();
|
|
430481
|
-
const showAccountIdentity = getAPIProvider() === "firstParty";
|
|
430996
|
+
const showAccountIdentity = getAPIProvider() === "firstParty" || isMaximoAIOAuthContext();
|
|
430482
430997
|
const username = showAccountIdentity ? getGlobalConfig().oauthAccount?.displayName ?? "" : "";
|
|
430483
430998
|
const { columns } = useTerminalSize();
|
|
430484
430999
|
let t0;
|
|
@@ -431302,6 +431817,8 @@ var init_LogoV2 = __esm(() => {
|
|
|
431302
431817
|
init_providers();
|
|
431303
431818
|
init_useMainLoopModel();
|
|
431304
431819
|
init_model();
|
|
431820
|
+
init_auth2();
|
|
431821
|
+
init_config2();
|
|
431305
431822
|
import_react_compiler_runtime203 = __toESM(require_dist4(), 1);
|
|
431306
431823
|
import_react153 = __toESM(require_react(), 1);
|
|
431307
431824
|
jsx_dev_runtime257 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -444222,7 +444739,6 @@ var init_usage3 = __esm(() => {
|
|
|
444222
444739
|
type: "local-jsx",
|
|
444223
444740
|
name: "usage",
|
|
444224
444741
|
description: "Show plan usage limits",
|
|
444225
|
-
availability: ["claude-ai"],
|
|
444226
444742
|
load: () => Promise.resolve().then(() => (init_usage2(), exports_usage))
|
|
444227
444743
|
};
|
|
444228
444744
|
});
|
|
@@ -458072,7 +458588,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
458072
458588
|
var call56 = async () => {
|
|
458073
458589
|
return {
|
|
458074
458590
|
type: "text",
|
|
458075
|
-
value: `${"99.0.0"} (built ${"2026-04-
|
|
458591
|
+
value: `${"99.0.0"} (built ${"2026-04-10T22:52:11.984Z"})`
|
|
458076
458592
|
};
|
|
458077
458593
|
}, version2, version_default;
|
|
458078
458594
|
var init_version = __esm(() => {
|
|
@@ -459627,7 +460143,7 @@ function MaximoInChromeMenu(t0) {
|
|
|
459627
460143
|
onDone,
|
|
459628
460144
|
isExtensionInstalled: installed,
|
|
459629
460145
|
configEnabled,
|
|
459630
|
-
isMaximoAISubscriber:
|
|
460146
|
+
isMaximoAISubscriber: isMaximoAISubscriber3,
|
|
459631
460147
|
isWSL
|
|
459632
460148
|
} = t0;
|
|
459633
460149
|
const mcpClients = useAppState(_temp159);
|
|
@@ -459802,7 +460318,7 @@ function MaximoInChromeMenu(t0) {
|
|
|
459802
460318
|
} else {
|
|
459803
460319
|
options2 = $2[8];
|
|
459804
460320
|
}
|
|
459805
|
-
const isDisabled = isWSL || !
|
|
460321
|
+
const isDisabled = isWSL || !isMaximoAISubscriber3;
|
|
459806
460322
|
let t5;
|
|
459807
460323
|
if ($2[18] !== onDone) {
|
|
459808
460324
|
t5 = () => onDone();
|
|
@@ -459832,12 +460348,12 @@ function MaximoInChromeMenu(t0) {
|
|
|
459832
460348
|
t7 = $2[22];
|
|
459833
460349
|
}
|
|
459834
460350
|
let t8;
|
|
459835
|
-
if ($2[23] !==
|
|
459836
|
-
t8 = !
|
|
460351
|
+
if ($2[23] !== isMaximoAISubscriber3) {
|
|
460352
|
+
t8 = !isMaximoAISubscriber3 && /* @__PURE__ */ jsx_dev_runtime344.jsxDEV(ThemedText, {
|
|
459837
460353
|
color: "error",
|
|
459838
460354
|
children: "Maximo in Chrome requires a claude.ai subscription."
|
|
459839
460355
|
}, undefined, false, undefined, this);
|
|
459840
|
-
$2[23] =
|
|
460356
|
+
$2[23] = isMaximoAISubscriber3;
|
|
459841
460357
|
$2[24] = t8;
|
|
459842
460358
|
} else {
|
|
459843
460359
|
t8 = $2[24];
|
|
@@ -462115,7 +462631,7 @@ __export(exports_upgrade, {
|
|
|
462115
462631
|
async function call67(onDone, context7) {
|
|
462116
462632
|
try {
|
|
462117
462633
|
if (isMaximoAISubscriber()) {
|
|
462118
|
-
const tokens =
|
|
462634
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
462119
462635
|
let isMax20x = false;
|
|
462120
462636
|
if (tokens?.subscriptionType && tokens?.rateLimitTier) {
|
|
462121
462637
|
isMax20x = tokens.subscriptionType === "max" && tokens.rateLimitTier === "default_claude_max_20x";
|
|
@@ -480285,7 +480801,7 @@ function createChromeContext(env4) {
|
|
|
480285
480801
|
return getGlobalConfig().oauthAccount?.accountUuid;
|
|
480286
480802
|
},
|
|
480287
480803
|
getOAuthToken: async () => {
|
|
480288
|
-
return
|
|
480804
|
+
return getMaximoAIOAuthTokens2()?.accessToken ?? "";
|
|
480289
480805
|
},
|
|
480290
480806
|
...isLocalBridge() && { devUserId: "dev_user_local" }
|
|
480291
480807
|
}
|
|
@@ -525000,7 +525516,7 @@ function useCanSwitchToExistingSubscription() {
|
|
|
525000
525516
|
useStartupNotification(_temp295);
|
|
525001
525517
|
}
|
|
525002
525518
|
async function _temp295() {
|
|
525003
|
-
if ((getGlobalConfig().subscriptionNoticeCount ?? 0) >=
|
|
525519
|
+
if ((getGlobalConfig().subscriptionNoticeCount ?? 0) >= MAX_SHOW_COUNT) {
|
|
525004
525520
|
return null;
|
|
525005
525521
|
}
|
|
525006
525522
|
const subscriptionType = await getExistingMaximoSubscription();
|
|
@@ -525052,7 +525568,7 @@ async function getExistingMaximoSubscription() {
|
|
|
525052
525568
|
}
|
|
525053
525569
|
return null;
|
|
525054
525570
|
}
|
|
525055
|
-
var jsx_dev_runtime463,
|
|
525571
|
+
var jsx_dev_runtime463, MAX_SHOW_COUNT = 3;
|
|
525056
525572
|
var init_useCanSwitchToExistingSubscription = __esm(() => {
|
|
525057
525573
|
init_getOauthProfile();
|
|
525058
525574
|
init_auth2();
|
|
@@ -529902,7 +530418,7 @@ async function fetchBootstrapAPI() {
|
|
|
529902
530418
|
return null;
|
|
529903
530419
|
}
|
|
529904
530420
|
const apiKey = getAnthropicApiKey();
|
|
529905
|
-
const hasUsableOAuth =
|
|
530421
|
+
const hasUsableOAuth = getMaximoAIOAuthTokens2()?.accessToken && hasProfileScope();
|
|
529906
530422
|
if (!hasUsableOAuth && !apiKey) {
|
|
529907
530423
|
logForDebugging2("[Bootstrap] Skipped: no usable OAuth or API key");
|
|
529908
530424
|
return null;
|
|
@@ -529910,7 +530426,7 @@ async function fetchBootstrapAPI() {
|
|
|
529910
530426
|
const endpoint = `${getOauthConfig().BASE_API_URL}/api/claude_cli/bootstrap`;
|
|
529911
530427
|
try {
|
|
529912
530428
|
return await withOAuth401Retry(async () => {
|
|
529913
|
-
const token =
|
|
530429
|
+
const token = getMaximoAIOAuthTokens2()?.accessToken;
|
|
529914
530430
|
let authHeaders;
|
|
529915
530431
|
if (token && hasProfileScope()) {
|
|
529916
530432
|
authHeaders = {
|
|
@@ -530979,7 +531495,7 @@ function WelcomeV2() {
|
|
|
530979
531495
|
dimColor: true,
|
|
530980
531496
|
children: [
|
|
530981
531497
|
"v",
|
|
530982
|
-
"0.1.
|
|
531498
|
+
"0.1.11",
|
|
530983
531499
|
" "
|
|
530984
531500
|
]
|
|
530985
531501
|
}, undefined, true, undefined, this)
|
|
@@ -531179,7 +531695,7 @@ function WelcomeV2() {
|
|
|
531179
531695
|
dimColor: true,
|
|
531180
531696
|
children: [
|
|
531181
531697
|
"v",
|
|
531182
|
-
"0.1.
|
|
531698
|
+
"0.1.11",
|
|
531183
531699
|
" "
|
|
531184
531700
|
]
|
|
531185
531701
|
}, undefined, true, undefined, this)
|
|
@@ -531402,7 +531918,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
531402
531918
|
dimColor: true,
|
|
531403
531919
|
children: [
|
|
531404
531920
|
"v",
|
|
531405
|
-
"0.1.
|
|
531921
|
+
"0.1.11",
|
|
531406
531922
|
" "
|
|
531407
531923
|
]
|
|
531408
531924
|
}, undefined, true, undefined, this);
|
|
@@ -531656,7 +532172,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
531656
532172
|
dimColor: true,
|
|
531657
532173
|
children: [
|
|
531658
532174
|
"v",
|
|
531659
|
-
"0.1.
|
|
532175
|
+
"0.1.11",
|
|
531660
532176
|
" "
|
|
531661
532177
|
]
|
|
531662
532178
|
}, undefined, true, undefined, this);
|
|
@@ -543721,12 +544237,12 @@ async function initReplBridge(options2) {
|
|
|
543721
544237
|
}
|
|
543722
544238
|
if (!getBridgeTokenOverride()) {
|
|
543723
544239
|
const cfg = getGlobalConfig();
|
|
543724
|
-
if (cfg.bridgeOauthDeadExpiresAt != null && (cfg.bridgeOauthDeadFailCount ?? 0) >= 3 &&
|
|
544240
|
+
if (cfg.bridgeOauthDeadExpiresAt != null && (cfg.bridgeOauthDeadFailCount ?? 0) >= 3 && getMaximoAIOAuthTokens2()?.expiresAt === cfg.bridgeOauthDeadExpiresAt) {
|
|
543725
544241
|
logForDebugging2(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${cfg.bridgeOauthDeadFailCount} times)`);
|
|
543726
544242
|
return null;
|
|
543727
544243
|
}
|
|
543728
544244
|
await checkAndRefreshOAuthTokenIfNeeded();
|
|
543729
|
-
const tokens =
|
|
544245
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
543730
544246
|
if (tokens && tokens.expiresAt !== null && tokens.expiresAt <= Date.now()) {
|
|
543731
544247
|
logBridgeSkip("oauth_expired_unrefreshable", "[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)");
|
|
543732
544248
|
onStateChange?.("failed", "/login");
|
|
@@ -551609,7 +552125,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
551609
552125
|
pendingHookMessages
|
|
551610
552126
|
}, renderAndRun);
|
|
551611
552127
|
}
|
|
551612
|
-
}).version("0.1.
|
|
552128
|
+
}).version("0.1.11 (Maximo Syntax)", "-v, --version", "Output the version number");
|
|
551613
552129
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
551614
552130
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
551615
552131
|
if (canUserConfigureAdvisor()) {
|
|
@@ -552114,7 +552630,7 @@ function validateProviderEnvOrExit() {
|
|
|
552114
552630
|
async function main2() {
|
|
552115
552631
|
const args = process.argv.slice(2);
|
|
552116
552632
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
552117
|
-
console.log(`${"0.1.
|
|
552633
|
+
console.log(`${"0.1.11"} (Maximo Syntax)`);
|
|
552118
552634
|
return;
|
|
552119
552635
|
}
|
|
552120
552636
|
validateProviderEnvOrExit();
|
|
@@ -552183,4 +552699,4 @@ async function main2() {
|
|
|
552183
552699
|
}
|
|
552184
552700
|
main2();
|
|
552185
552701
|
|
|
552186
|
-
//# debugId=
|
|
552702
|
+
//# debugId=BD18CEBFE731917064756E2164756E21
|