@maximoai/maximo-syntax-cli 0.1.8 → 0.1.10
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 +31 -0
- package/dist/cli.mjs +379 -271
- 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",
|
|
@@ -110690,7 +110913,7 @@ class OpenAIShimMessages {
|
|
|
110690
110913
|
});
|
|
110691
110914
|
if (!response.ok) {
|
|
110692
110915
|
const errorBody = await response.text().catch(() => "unknown error");
|
|
110693
|
-
throw new Error(`
|
|
110916
|
+
throw new Error(`MaximoAI API error ${response.status}: ${errorBody}`);
|
|
110694
110917
|
}
|
|
110695
110918
|
return response;
|
|
110696
110919
|
}
|
|
@@ -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-03T18:56:37.901Z",
|
|
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) {
|
|
@@ -288805,7 +289049,7 @@ function OAuthStatusMessage(t0) {
|
|
|
288805
289049
|
let t3;
|
|
288806
289050
|
if ($2[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
288807
289051
|
t2 = /* @__PURE__ */ jsx_dev_runtime71.jsxDEV(ThemedText, {
|
|
288808
|
-
children: "
|
|
289052
|
+
children: "Maximo Syntax supports OpenAI-compatible providers (GPT-4o, DeepSeek, Ollama, Groq), Google Gemini, Amazon Bedrock, Microsoft Foundry, and Vertex AI. Set the required environment variables, then restart Maximo Syntax."
|
|
288809
289053
|
}, undefined, false, undefined, this);
|
|
288810
289054
|
t3 = /* @__PURE__ */ jsx_dev_runtime71.jsxDEV(ThemedText, {
|
|
288811
289055
|
children: "If you are part of an enterprise organization, contact your administrator for setup instructions."
|
|
@@ -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
|
}
|
|
@@ -289771,7 +290015,7 @@ async function fetchUtilization() {
|
|
|
289771
290015
|
if (!isMaximoAISubscriber() || !hasProfileScope()) {
|
|
289772
290016
|
return {};
|
|
289773
290017
|
}
|
|
289774
|
-
const tokens =
|
|
290018
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
289775
290019
|
if (tokens && isOAuthTokenExpired(tokens.expiresAt)) {
|
|
289776
290020
|
return null;
|
|
289777
290021
|
}
|
|
@@ -301088,7 +301332,7 @@ NOTE: You just closed out 3+ tasks and none of them was a verification step. Bef
|
|
|
301088
301332
|
|
|
301089
301333
|
// src/utils/teleport/environments.ts
|
|
301090
301334
|
async function fetchEnvironments() {
|
|
301091
|
-
const accessToken =
|
|
301335
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
301092
301336
|
if (!accessToken) {
|
|
301093
301337
|
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
301338
|
}
|
|
@@ -301151,7 +301395,7 @@ function checkIsInGitRepo() {
|
|
|
301151
301395
|
}
|
|
301152
301396
|
async function checkGithubAppInstalled(owner, repo, signal) {
|
|
301153
301397
|
try {
|
|
301154
|
-
const accessToken =
|
|
301398
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
301155
301399
|
if (!accessToken) {
|
|
301156
301400
|
logForDebugging2("checkGithubAppInstalled: No access token found, assuming app not installed");
|
|
301157
301401
|
return false;
|
|
@@ -305192,7 +305436,7 @@ async function teleportResumeCodeSession(sessionId, onProgress) {
|
|
|
305192
305436
|
}
|
|
305193
305437
|
logForDebugging2(`Resuming code session ID: ${sessionId}`);
|
|
305194
305438
|
try {
|
|
305195
|
-
const accessToken =
|
|
305439
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
305196
305440
|
if (!accessToken) {
|
|
305197
305441
|
logEvent("tengu_teleport_resume_error", {
|
|
305198
305442
|
error_type: "no_access_token"
|
|
@@ -305333,7 +305577,7 @@ ${source_default.dim("Run /status in Maximo Syntax to check your account.")}`);
|
|
|
305333
305577
|
}
|
|
305334
305578
|
}
|
|
305335
305579
|
async function pollRemoteSessionEvents(sessionId, afterId = null, opts) {
|
|
305336
|
-
const accessToken =
|
|
305580
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
305337
305581
|
if (!accessToken) {
|
|
305338
305582
|
throw new Error("No access token for polling");
|
|
305339
305583
|
}
|
|
@@ -305409,7 +305653,7 @@ async function teleportToRemote(options2) {
|
|
|
305409
305653
|
const { initialMessage, signal } = options2;
|
|
305410
305654
|
try {
|
|
305411
305655
|
await checkAndRefreshOAuthTokenIfNeeded();
|
|
305412
|
-
const accessToken =
|
|
305656
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
305413
305657
|
if (!accessToken) {
|
|
305414
305658
|
logError2(new Error("No access token found for remote session creation"));
|
|
305415
305659
|
return null;
|
|
@@ -305714,7 +305958,7 @@ Response data: ${jsonStringify(response.data, null, 2)}`));
|
|
|
305714
305958
|
}
|
|
305715
305959
|
}
|
|
305716
305960
|
async function archiveRemoteSession(sessionId) {
|
|
305717
|
-
const accessToken =
|
|
305961
|
+
const accessToken = getMaximoAIOAuthTokens2()?.accessToken;
|
|
305718
305962
|
if (!accessToken)
|
|
305719
305963
|
return;
|
|
305720
305964
|
const orgUUID = await getOrganizationUUID();
|
|
@@ -349939,146 +350183,6 @@ var init_ExitWorktreeTool = __esm(() => {
|
|
|
349939
350183
|
// src/tools/ConfigTool/constants.ts
|
|
349940
350184
|
var CONFIG_TOOL_NAME = "Config";
|
|
349941
350185
|
|
|
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
350186
|
// src/utils/model/modelOptions.ts
|
|
350083
350187
|
function getDefaultOptionForUser(fastMode = false) {
|
|
350084
350188
|
if (process.env.USER_TYPE === "ant") {
|
|
@@ -364502,7 +364606,7 @@ function getAnthropicEnvMetadata() {
|
|
|
364502
364606
|
function getBuildAgeMinutes() {
|
|
364503
364607
|
if (false)
|
|
364504
364608
|
;
|
|
364505
|
-
const buildTime = new Date("2026-04-
|
|
364609
|
+
const buildTime = new Date("2026-04-03T18:56:37.901Z").getTime();
|
|
364506
364610
|
if (isNaN(buildTime))
|
|
364507
364611
|
return;
|
|
364508
364612
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -380704,7 +380808,7 @@ Run /share and post the JSON file to ${MACRO.FEEDBACK_CHANNEL}.`;
|
|
|
380704
380808
|
if (error42 instanceof APIError && error42.status === 400 && error42.message.toLowerCase().includes("organization has been disabled")) {
|
|
380705
380809
|
const { source } = getAnthropicApiKeyWithSource();
|
|
380706
380810
|
if (source === "ANTHROPIC_API_KEY" && process.env.ANTHROPIC_API_KEY && !isMaximoAISubscriber()) {
|
|
380707
|
-
const hasStoredOAuth =
|
|
380811
|
+
const hasStoredOAuth = getMaximoAIOAuthTokens2()?.accessToken != null;
|
|
380708
380812
|
return createAssistantAPIErrorMessage({
|
|
380709
380813
|
error: "invalid_request",
|
|
380710
380814
|
content: hasStoredOAuth ? ORG_DISABLED_ERROR_MESSAGE_ENV_KEY_WITH_OAUTH : ORG_DISABLED_ERROR_MESSAGE_ENV_KEY
|
|
@@ -409521,7 +409625,7 @@ function gateChannelServer(serverName, capabilities, pluginSource) {
|
|
|
409521
409625
|
reason: "channels feature is not currently available"
|
|
409522
409626
|
};
|
|
409523
409627
|
}
|
|
409524
|
-
if (!
|
|
409628
|
+
if (!getMaximoAIOAuthTokens2()?.accessToken) {
|
|
409525
409629
|
return {
|
|
409526
409630
|
action: "skip",
|
|
409527
409631
|
kind: "auth",
|
|
@@ -427866,7 +427970,7 @@ function getBridgeBaseUrlOverride() {
|
|
|
427866
427970
|
return process.env.USER_TYPE === "ant" && process.env.CLAUDE_BRIDGE_BASE_URL || undefined;
|
|
427867
427971
|
}
|
|
427868
427972
|
function getBridgeAccessToken() {
|
|
427869
|
-
return getBridgeTokenOverride() ??
|
|
427973
|
+
return getBridgeTokenOverride() ?? getMaximoAIOAuthTokens2()?.accessToken;
|
|
427870
427974
|
}
|
|
427871
427975
|
function getBridgeBaseUrl() {
|
|
427872
427976
|
return getBridgeBaseUrlOverride() ?? getOauthConfig().BASE_API_URL;
|
|
@@ -428113,7 +428217,7 @@ async function createBridgeSession({
|
|
|
428113
428217
|
getAccessToken,
|
|
428114
428218
|
permissionMode
|
|
428115
428219
|
}) {
|
|
428116
|
-
const { getMaximoAIOAuthTokens:
|
|
428220
|
+
const { getMaximoAIOAuthTokens: getMaximoAIOAuthTokens3 } = await Promise.resolve().then(() => (init_auth2(), exports_auth));
|
|
428117
428221
|
const { getOrganizationUUID: getOrganizationUUID2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
428118
428222
|
const { getOauthConfig: getOauthConfig2 } = await Promise.resolve().then(() => (init_oauth(), exports_oauth));
|
|
428119
428223
|
const { getOAuthHeaders: getOAuthHeaders2 } = await Promise.resolve().then(() => (init_api2(), exports_api));
|
|
@@ -428121,7 +428225,7 @@ async function createBridgeSession({
|
|
|
428121
428225
|
const { getDefaultBranch: getDefaultBranch2 } = await Promise.resolve().then(() => (init_git(), exports_git));
|
|
428122
428226
|
const { getMainLoopModel: getMainLoopModel3 } = await Promise.resolve().then(() => (init_model(), exports_model));
|
|
428123
428227
|
const { default: axios2 } = await Promise.resolve().then(() => (init_axios2(), exports_axios));
|
|
428124
|
-
const accessToken = getAccessToken?.() ??
|
|
428228
|
+
const accessToken = getAccessToken?.() ?? getMaximoAIOAuthTokens3()?.accessToken;
|
|
428125
428229
|
if (!accessToken) {
|
|
428126
428230
|
logForDebugging2("[bridge] No access token for session creation");
|
|
428127
428231
|
return null;
|
|
@@ -428218,12 +428322,12 @@ async function createBridgeSession({
|
|
|
428218
428322
|
return sessionData.id;
|
|
428219
428323
|
}
|
|
428220
428324
|
async function getBridgeSession(sessionId, opts) {
|
|
428221
|
-
const { getMaximoAIOAuthTokens:
|
|
428325
|
+
const { getMaximoAIOAuthTokens: getMaximoAIOAuthTokens3 } = await Promise.resolve().then(() => (init_auth2(), exports_auth));
|
|
428222
428326
|
const { getOrganizationUUID: getOrganizationUUID2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
428223
428327
|
const { getOauthConfig: getOauthConfig2 } = await Promise.resolve().then(() => (init_oauth(), exports_oauth));
|
|
428224
428328
|
const { getOAuthHeaders: getOAuthHeaders2 } = await Promise.resolve().then(() => (init_api2(), exports_api));
|
|
428225
428329
|
const { default: axios2 } = await Promise.resolve().then(() => (init_axios2(), exports_axios));
|
|
428226
|
-
const accessToken = opts?.getAccessToken?.() ??
|
|
428330
|
+
const accessToken = opts?.getAccessToken?.() ?? getMaximoAIOAuthTokens3()?.accessToken;
|
|
428227
428331
|
if (!accessToken) {
|
|
428228
428332
|
logForDebugging2("[bridge] No access token for session fetch");
|
|
428229
428333
|
return null;
|
|
@@ -428255,12 +428359,12 @@ async function getBridgeSession(sessionId, opts) {
|
|
|
428255
428359
|
return response.data;
|
|
428256
428360
|
}
|
|
428257
428361
|
async function archiveBridgeSession(sessionId, opts) {
|
|
428258
|
-
const { getMaximoAIOAuthTokens:
|
|
428362
|
+
const { getMaximoAIOAuthTokens: getMaximoAIOAuthTokens3 } = await Promise.resolve().then(() => (init_auth2(), exports_auth));
|
|
428259
428363
|
const { getOrganizationUUID: getOrganizationUUID2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
428260
428364
|
const { getOauthConfig: getOauthConfig2 } = await Promise.resolve().then(() => (init_oauth(), exports_oauth));
|
|
428261
428365
|
const { getOAuthHeaders: getOAuthHeaders2 } = await Promise.resolve().then(() => (init_api2(), exports_api));
|
|
428262
428366
|
const { default: axios2 } = await Promise.resolve().then(() => (init_axios2(), exports_axios));
|
|
428263
|
-
const accessToken = opts?.getAccessToken?.() ??
|
|
428367
|
+
const accessToken = opts?.getAccessToken?.() ?? getMaximoAIOAuthTokens3()?.accessToken;
|
|
428264
428368
|
if (!accessToken) {
|
|
428265
428369
|
logForDebugging2("[bridge] No access token for session archive");
|
|
428266
428370
|
return;
|
|
@@ -428290,12 +428394,12 @@ async function archiveBridgeSession(sessionId, opts) {
|
|
|
428290
428394
|
}
|
|
428291
428395
|
}
|
|
428292
428396
|
async function updateBridgeSessionTitle(sessionId, title, opts) {
|
|
428293
|
-
const { getMaximoAIOAuthTokens:
|
|
428397
|
+
const { getMaximoAIOAuthTokens: getMaximoAIOAuthTokens3 } = await Promise.resolve().then(() => (init_auth2(), exports_auth));
|
|
428294
428398
|
const { getOrganizationUUID: getOrganizationUUID2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
428295
428399
|
const { getOauthConfig: getOauthConfig2 } = await Promise.resolve().then(() => (init_oauth(), exports_oauth));
|
|
428296
428400
|
const { getOAuthHeaders: getOAuthHeaders2 } = await Promise.resolve().then(() => (init_api2(), exports_api));
|
|
428297
428401
|
const { default: axios2 } = await Promise.resolve().then(() => (init_axios2(), exports_axios));
|
|
428298
|
-
const accessToken = opts?.getAccessToken?.() ??
|
|
428402
|
+
const accessToken = opts?.getAccessToken?.() ?? getMaximoAIOAuthTokens3()?.accessToken;
|
|
428299
428403
|
if (!accessToken) {
|
|
428300
428404
|
logForDebugging2("[bridge] No access token for session title update");
|
|
428301
428405
|
return;
|
|
@@ -428941,7 +429045,7 @@ function getRecentActivitySync() {
|
|
|
428941
429045
|
return cachedActivity;
|
|
428942
429046
|
}
|
|
428943
429047
|
function getLogoDisplayData() {
|
|
428944
|
-
const version2 = process.env.DEMO_VERSION ?? "0.1.
|
|
429048
|
+
const version2 = process.env.DEMO_VERSION ?? "0.1.10" ?? "99.0.0";
|
|
428945
429049
|
const serverUrl = getDirectConnectServerUrl();
|
|
428946
429050
|
const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
|
|
428947
429051
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -429738,7 +429842,7 @@ function createProjectOnboardingFeed(steps) {
|
|
|
429738
429842
|
text: `${checkmark}${text}`
|
|
429739
429843
|
};
|
|
429740
429844
|
});
|
|
429741
|
-
const warningText = getCwd() === homedir30() ? "Note: You have launched
|
|
429845
|
+
const warningText = getCwd() === homedir30() ? "Note: You have launched maximo in your home directory. For the best experience, launch it in a project directory instead." : undefined;
|
|
429742
429846
|
if (warningText) {
|
|
429743
429847
|
lines.push({
|
|
429744
429848
|
text: warningText
|
|
@@ -430379,7 +430483,7 @@ var init_AnimatedAsterisk = __esm(() => {
|
|
|
430379
430483
|
|
|
430380
430484
|
// src/components/LogoV2/Opus1mMergeNotice.tsx
|
|
430381
430485
|
function shouldShowOpus1mMergeNotice() {
|
|
430382
|
-
return
|
|
430486
|
+
return false;
|
|
430383
430487
|
}
|
|
430384
430488
|
function Opus1mMergeNotice() {
|
|
430385
430489
|
const $2 = import_react_compiler_runtime201.c(4);
|
|
@@ -430437,12 +430541,11 @@ function Opus1mMergeNotice() {
|
|
|
430437
430541
|
}
|
|
430438
430542
|
return t2;
|
|
430439
430543
|
}
|
|
430440
|
-
var import_react_compiler_runtime201, import_react151, jsx_dev_runtime255
|
|
430544
|
+
var import_react_compiler_runtime201, import_react151, jsx_dev_runtime255;
|
|
430441
430545
|
var init_Opus1mMergeNotice = __esm(() => {
|
|
430442
430546
|
init_figures2();
|
|
430443
430547
|
init_ink2();
|
|
430444
430548
|
init_config2();
|
|
430445
|
-
init_model();
|
|
430446
430549
|
init_AnimatedAsterisk();
|
|
430447
430550
|
import_react_compiler_runtime201 = __toESM(require_dist4(), 1);
|
|
430448
430551
|
import_react151 = __toESM(require_react(), 1);
|
|
@@ -430475,10 +430578,13 @@ var init_VoiceModeNotice = __esm(() => {
|
|
|
430475
430578
|
});
|
|
430476
430579
|
|
|
430477
430580
|
// src/components/LogoV2/LogoV2.tsx
|
|
430581
|
+
function isMaximoAIOAuthContext() {
|
|
430582
|
+
return isMaximoAISubscriber() || getAPIProvider() === "openai";
|
|
430583
|
+
}
|
|
430478
430584
|
function LogoV2() {
|
|
430479
430585
|
const $2 = import_react_compiler_runtime203.c(94);
|
|
430480
430586
|
const activities = getRecentActivitySync();
|
|
430481
|
-
const showAccountIdentity = getAPIProvider() === "firstParty";
|
|
430587
|
+
const showAccountIdentity = getAPIProvider() === "firstParty" || isMaximoAIOAuthContext();
|
|
430482
430588
|
const username = showAccountIdentity ? getGlobalConfig().oauthAccount?.displayName ?? "" : "";
|
|
430483
430589
|
const { columns } = useTerminalSize();
|
|
430484
430590
|
let t0;
|
|
@@ -431302,6 +431408,8 @@ var init_LogoV2 = __esm(() => {
|
|
|
431302
431408
|
init_providers();
|
|
431303
431409
|
init_useMainLoopModel();
|
|
431304
431410
|
init_model();
|
|
431411
|
+
init_auth2();
|
|
431412
|
+
init_config2();
|
|
431305
431413
|
import_react_compiler_runtime203 = __toESM(require_dist4(), 1);
|
|
431306
431414
|
import_react153 = __toESM(require_react(), 1);
|
|
431307
431415
|
jsx_dev_runtime257 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -458072,7 +458180,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
458072
458180
|
var call56 = async () => {
|
|
458073
458181
|
return {
|
|
458074
458182
|
type: "text",
|
|
458075
|
-
value: `${"99.0.0"} (built ${"2026-04-
|
|
458183
|
+
value: `${"99.0.0"} (built ${"2026-04-03T18:56:37.901Z"})`
|
|
458076
458184
|
};
|
|
458077
458185
|
}, version2, version_default;
|
|
458078
458186
|
var init_version = __esm(() => {
|
|
@@ -462115,7 +462223,7 @@ __export(exports_upgrade, {
|
|
|
462115
462223
|
async function call67(onDone, context7) {
|
|
462116
462224
|
try {
|
|
462117
462225
|
if (isMaximoAISubscriber()) {
|
|
462118
|
-
const tokens =
|
|
462226
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
462119
462227
|
let isMax20x = false;
|
|
462120
462228
|
if (tokens?.subscriptionType && tokens?.rateLimitTier) {
|
|
462121
462229
|
isMax20x = tokens.subscriptionType === "max" && tokens.rateLimitTier === "default_claude_max_20x";
|
|
@@ -480285,7 +480393,7 @@ function createChromeContext(env4) {
|
|
|
480285
480393
|
return getGlobalConfig().oauthAccount?.accountUuid;
|
|
480286
480394
|
},
|
|
480287
480395
|
getOAuthToken: async () => {
|
|
480288
|
-
return
|
|
480396
|
+
return getMaximoAIOAuthTokens2()?.accessToken ?? "";
|
|
480289
480397
|
},
|
|
480290
480398
|
...isLocalBridge() && { devUserId: "dev_user_local" }
|
|
480291
480399
|
}
|
|
@@ -525000,7 +525108,7 @@ function useCanSwitchToExistingSubscription() {
|
|
|
525000
525108
|
useStartupNotification(_temp295);
|
|
525001
525109
|
}
|
|
525002
525110
|
async function _temp295() {
|
|
525003
|
-
if ((getGlobalConfig().subscriptionNoticeCount ?? 0) >=
|
|
525111
|
+
if ((getGlobalConfig().subscriptionNoticeCount ?? 0) >= MAX_SHOW_COUNT) {
|
|
525004
525112
|
return null;
|
|
525005
525113
|
}
|
|
525006
525114
|
const subscriptionType = await getExistingMaximoSubscription();
|
|
@@ -525052,7 +525160,7 @@ async function getExistingMaximoSubscription() {
|
|
|
525052
525160
|
}
|
|
525053
525161
|
return null;
|
|
525054
525162
|
}
|
|
525055
|
-
var jsx_dev_runtime463,
|
|
525163
|
+
var jsx_dev_runtime463, MAX_SHOW_COUNT = 3;
|
|
525056
525164
|
var init_useCanSwitchToExistingSubscription = __esm(() => {
|
|
525057
525165
|
init_getOauthProfile();
|
|
525058
525166
|
init_auth2();
|
|
@@ -529902,7 +530010,7 @@ async function fetchBootstrapAPI() {
|
|
|
529902
530010
|
return null;
|
|
529903
530011
|
}
|
|
529904
530012
|
const apiKey = getAnthropicApiKey();
|
|
529905
|
-
const hasUsableOAuth =
|
|
530013
|
+
const hasUsableOAuth = getMaximoAIOAuthTokens2()?.accessToken && hasProfileScope();
|
|
529906
530014
|
if (!hasUsableOAuth && !apiKey) {
|
|
529907
530015
|
logForDebugging2("[Bootstrap] Skipped: no usable OAuth or API key");
|
|
529908
530016
|
return null;
|
|
@@ -529910,7 +530018,7 @@ async function fetchBootstrapAPI() {
|
|
|
529910
530018
|
const endpoint = `${getOauthConfig().BASE_API_URL}/api/claude_cli/bootstrap`;
|
|
529911
530019
|
try {
|
|
529912
530020
|
return await withOAuth401Retry(async () => {
|
|
529913
|
-
const token =
|
|
530021
|
+
const token = getMaximoAIOAuthTokens2()?.accessToken;
|
|
529914
530022
|
let authHeaders;
|
|
529915
530023
|
if (token && hasProfileScope()) {
|
|
529916
530024
|
authHeaders = {
|
|
@@ -530979,7 +531087,7 @@ function WelcomeV2() {
|
|
|
530979
531087
|
dimColor: true,
|
|
530980
531088
|
children: [
|
|
530981
531089
|
"v",
|
|
530982
|
-
"0.1.
|
|
531090
|
+
"0.1.10",
|
|
530983
531091
|
" "
|
|
530984
531092
|
]
|
|
530985
531093
|
}, undefined, true, undefined, this)
|
|
@@ -531179,7 +531287,7 @@ function WelcomeV2() {
|
|
|
531179
531287
|
dimColor: true,
|
|
531180
531288
|
children: [
|
|
531181
531289
|
"v",
|
|
531182
|
-
"0.1.
|
|
531290
|
+
"0.1.10",
|
|
531183
531291
|
" "
|
|
531184
531292
|
]
|
|
531185
531293
|
}, undefined, true, undefined, this)
|
|
@@ -531402,7 +531510,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
531402
531510
|
dimColor: true,
|
|
531403
531511
|
children: [
|
|
531404
531512
|
"v",
|
|
531405
|
-
"0.1.
|
|
531513
|
+
"0.1.10",
|
|
531406
531514
|
" "
|
|
531407
531515
|
]
|
|
531408
531516
|
}, undefined, true, undefined, this);
|
|
@@ -531656,7 +531764,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
531656
531764
|
dimColor: true,
|
|
531657
531765
|
children: [
|
|
531658
531766
|
"v",
|
|
531659
|
-
"0.1.
|
|
531767
|
+
"0.1.10",
|
|
531660
531768
|
" "
|
|
531661
531769
|
]
|
|
531662
531770
|
}, undefined, true, undefined, this);
|
|
@@ -543721,12 +543829,12 @@ async function initReplBridge(options2) {
|
|
|
543721
543829
|
}
|
|
543722
543830
|
if (!getBridgeTokenOverride()) {
|
|
543723
543831
|
const cfg = getGlobalConfig();
|
|
543724
|
-
if (cfg.bridgeOauthDeadExpiresAt != null && (cfg.bridgeOauthDeadFailCount ?? 0) >= 3 &&
|
|
543832
|
+
if (cfg.bridgeOauthDeadExpiresAt != null && (cfg.bridgeOauthDeadFailCount ?? 0) >= 3 && getMaximoAIOAuthTokens2()?.expiresAt === cfg.bridgeOauthDeadExpiresAt) {
|
|
543725
543833
|
logForDebugging2(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${cfg.bridgeOauthDeadFailCount} times)`);
|
|
543726
543834
|
return null;
|
|
543727
543835
|
}
|
|
543728
543836
|
await checkAndRefreshOAuthTokenIfNeeded();
|
|
543729
|
-
const tokens =
|
|
543837
|
+
const tokens = getMaximoAIOAuthTokens2();
|
|
543730
543838
|
if (tokens && tokens.expiresAt !== null && tokens.expiresAt <= Date.now()) {
|
|
543731
543839
|
logBridgeSkip("oauth_expired_unrefreshable", "[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)");
|
|
543732
543840
|
onStateChange?.("failed", "/login");
|
|
@@ -551609,7 +551717,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
551609
551717
|
pendingHookMessages
|
|
551610
551718
|
}, renderAndRun);
|
|
551611
551719
|
}
|
|
551612
|
-
}).version("0.1.
|
|
551720
|
+
}).version("0.1.10 (Maximo Syntax)", "-v, --version", "Output the version number");
|
|
551613
551721
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
551614
551722
|
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
551723
|
if (canUserConfigureAdvisor()) {
|
|
@@ -552114,7 +552222,7 @@ function validateProviderEnvOrExit() {
|
|
|
552114
552222
|
async function main2() {
|
|
552115
552223
|
const args = process.argv.slice(2);
|
|
552116
552224
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
552117
|
-
console.log(`${"0.1.
|
|
552225
|
+
console.log(`${"0.1.10"} (Maximo Syntax)`);
|
|
552118
552226
|
return;
|
|
552119
552227
|
}
|
|
552120
552228
|
validateProviderEnvOrExit();
|
|
@@ -552183,4 +552291,4 @@ async function main2() {
|
|
|
552183
552291
|
}
|
|
552184
552292
|
main2();
|
|
552185
552293
|
|
|
552186
|
-
//# debugId=
|
|
552294
|
+
//# debugId=D4985EAB6AC67CFF64756E2164756E21
|