claudish 12.3.0 → 12.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +329 -78
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -901,7 +901,7 @@ var init_onepassword_config = __esm(() => {
|
|
|
901
901
|
});
|
|
902
902
|
|
|
903
903
|
// src/version.ts
|
|
904
|
-
var VERSION = "12.3.
|
|
904
|
+
var VERSION = "12.3.2";
|
|
905
905
|
|
|
906
906
|
// src/logger.ts
|
|
907
907
|
import { appendFile, existsSync as existsSync2, mkdirSync, readdirSync, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
|
|
@@ -19605,6 +19605,11 @@ Check GOOGLE_APPLICATION_CREDENTIALS path.`);
|
|
|
19605
19605
|
}
|
|
19606
19606
|
}
|
|
19607
19607
|
}
|
|
19608
|
+
function resetVertexProjectDiscovery() {
|
|
19609
|
+
discoveredProjectPromise = null;
|
|
19610
|
+
discoveredProjectSettled = undefined;
|
|
19611
|
+
syncAdcOrigin = undefined;
|
|
19612
|
+
}
|
|
19608
19613
|
function describeVertexProjectSource(origin) {
|
|
19609
19614
|
switch (origin.source) {
|
|
19610
19615
|
case "env":
|
|
@@ -19615,6 +19620,20 @@ function describeVertexProjectSource(origin) {
|
|
|
19615
19620
|
return `\`${origin.detail}\``;
|
|
19616
19621
|
}
|
|
19617
19622
|
}
|
|
19623
|
+
function describeVertexAccessDenied({
|
|
19624
|
+
status,
|
|
19625
|
+
upstream,
|
|
19626
|
+
projectId,
|
|
19627
|
+
origin,
|
|
19628
|
+
account
|
|
19629
|
+
}) {
|
|
19630
|
+
const segments = [`HTTP ${status}: ${upstream}`];
|
|
19631
|
+
if (account)
|
|
19632
|
+
segments.push(`ADC account ${account}`);
|
|
19633
|
+
segments.push(`project ${projectId}` + (origin ? ` (from ${describeVertexProjectSource(origin)})` : ""));
|
|
19634
|
+
segments.push("to sign in as another account: gcloud auth application-default login");
|
|
19635
|
+
return segments.join(" \xB7 ");
|
|
19636
|
+
}
|
|
19618
19637
|
function envProjectOrigin() {
|
|
19619
19638
|
for (const name of VERTEX_PROJECT_ENV_VARS) {
|
|
19620
19639
|
const value = process.env[name]?.trim();
|
|
@@ -19753,6 +19772,9 @@ function buildVertexOAuthEndpoint(config, publisher, model, streaming = true) {
|
|
|
19753
19772
|
}
|
|
19754
19773
|
return `https://aiplatform.googleapis.com/v1/projects/${config.projectId}/locations/global/endpoints/openapi/chat/completions`;
|
|
19755
19774
|
}
|
|
19775
|
+
function resetVertexAuthManager() {
|
|
19776
|
+
authManagerInstance = null;
|
|
19777
|
+
}
|
|
19756
19778
|
function getVertexAuthManager() {
|
|
19757
19779
|
if (!authManagerInstance) {
|
|
19758
19780
|
authManagerInstance = new VertexAuthManager;
|
|
@@ -23769,6 +23791,22 @@ var init_minimax_model_dialect = __esm(() => {
|
|
|
23769
23791
|
};
|
|
23770
23792
|
});
|
|
23771
23793
|
|
|
23794
|
+
// src/auth/antigravity-client-version.ts
|
|
23795
|
+
function getAgyClientVersion() {
|
|
23796
|
+
return version2;
|
|
23797
|
+
}
|
|
23798
|
+
function agyClientVersionReadFor(accessToken) {
|
|
23799
|
+
return readForToken === accessToken;
|
|
23800
|
+
}
|
|
23801
|
+
function recordAgyClientVersionRead(read, accessToken) {
|
|
23802
|
+
readForToken = accessToken;
|
|
23803
|
+
if (read === null || read === version2)
|
|
23804
|
+
return false;
|
|
23805
|
+
version2 = read;
|
|
23806
|
+
return true;
|
|
23807
|
+
}
|
|
23808
|
+
var version2 = null, readForToken = null;
|
|
23809
|
+
|
|
23772
23810
|
// src/auth/credentials/credential-error.ts
|
|
23773
23811
|
function terminalCredentialError(message, upstreamStatus) {
|
|
23774
23812
|
return Object.assign(new Error(message), {
|
|
@@ -23859,6 +23897,21 @@ function defaultRunAgyRefresh() {
|
|
|
23859
23897
|
invalidateReadStoreMemo();
|
|
23860
23898
|
}
|
|
23861
23899
|
}
|
|
23900
|
+
function defaultReadAgyVersion() {
|
|
23901
|
+
const agy = locateAgyBinary();
|
|
23902
|
+
if (!agy)
|
|
23903
|
+
return null;
|
|
23904
|
+
try {
|
|
23905
|
+
const out = execFileSync(agy, ["--version"], {
|
|
23906
|
+
encoding: "utf8",
|
|
23907
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
23908
|
+
timeout: AGY_VERSION_TIMEOUT_MS
|
|
23909
|
+
});
|
|
23910
|
+
return out.match(/\d+(\.\d+)+/)?.[0] ?? null;
|
|
23911
|
+
} catch {
|
|
23912
|
+
return null;
|
|
23913
|
+
}
|
|
23914
|
+
}
|
|
23862
23915
|
function parseRecord(raw) {
|
|
23863
23916
|
if (!raw)
|
|
23864
23917
|
return null;
|
|
@@ -23916,6 +23969,18 @@ function needsRefresh(tok, now) {
|
|
|
23916
23969
|
return true;
|
|
23917
23970
|
return now >= expMs - EXPIRY_SKEW_MS;
|
|
23918
23971
|
}
|
|
23972
|
+
function captureAgyClientVersion(accessToken, deps) {
|
|
23973
|
+
if (!deps.readAgyVersion || agyClientVersionReadFor(accessToken))
|
|
23974
|
+
return;
|
|
23975
|
+
const read = deps.readAgyVersion();
|
|
23976
|
+
recordAgyClientVersionRead(read, accessToken);
|
|
23977
|
+
if (read) {
|
|
23978
|
+
log(`[Antigravity] Client version from agy: ${read}`);
|
|
23979
|
+
} else {
|
|
23980
|
+
const kept = getAgyClientVersion();
|
|
23981
|
+
log("[Antigravity] Could not read the agy version" + (kept ? `; keeping ${kept}.` : "; using the fallback version."));
|
|
23982
|
+
}
|
|
23983
|
+
}
|
|
23919
23984
|
async function resolveValidToken(deps) {
|
|
23920
23985
|
if (process.platform !== "darwin") {
|
|
23921
23986
|
throw terminalCredentialError("[Antigravity] The shared Antigravity token store is macOS-only for now. " + "Use g@<model> with GEMINI_API_KEY on this platform.");
|
|
@@ -23925,6 +23990,7 @@ async function resolveValidToken(deps) {
|
|
|
23925
23990
|
throw terminalCredentialError("[Antigravity] No Antigravity session found. Sign in with `claudish login antigravity`, " + "or use g@<model> with GEMINI_API_KEY " + "(get one at https://aistudio.google.com/app/apikey).");
|
|
23926
23991
|
}
|
|
23927
23992
|
if (!needsRefresh(rec.token, deps.now())) {
|
|
23993
|
+
captureAgyClientVersion(rec.token.access_token, deps);
|
|
23928
23994
|
return rec.token.access_token;
|
|
23929
23995
|
}
|
|
23930
23996
|
log("[Antigravity] Access token expired/near-expiry \u2014 asking the Antigravity CLI to refresh.");
|
|
@@ -23932,6 +23998,7 @@ async function resolveValidToken(deps) {
|
|
|
23932
23998
|
const refreshedRec = parseRecord(deps.readStore());
|
|
23933
23999
|
if (refreshedRec && !needsRefresh(refreshedRec.token, deps.now())) {
|
|
23934
24000
|
log("[Antigravity] Shared token refreshed by the Antigravity CLI.");
|
|
24001
|
+
captureAgyClientVersion(refreshedRec.token.access_token, deps);
|
|
23935
24002
|
return refreshedRec.token.access_token;
|
|
23936
24003
|
}
|
|
23937
24004
|
const message = `[Antigravity] ${describeRefreshFailure(outcome)}`;
|
|
@@ -23978,6 +24045,7 @@ async function forceRefreshAntigravityToken(deps = defaultDeps) {
|
|
|
23978
24045
|
const token = refreshed?.token;
|
|
23979
24046
|
if (token && token.access_token !== original.access_token && !needsRefresh(token, deps.now())) {
|
|
23980
24047
|
log("[Antigravity] Shared token re-minted by the Antigravity CLI.");
|
|
24048
|
+
captureAgyClientVersion(token.access_token, deps);
|
|
23981
24049
|
return token.access_token;
|
|
23982
24050
|
}
|
|
23983
24051
|
if (!refreshed || refreshed.token.access_token === original.access_token) {
|
|
@@ -24001,7 +24069,7 @@ function _resetAntigravityTokenState() {
|
|
|
24001
24069
|
cachedHasToken = null;
|
|
24002
24070
|
invalidateReadStoreMemo();
|
|
24003
24071
|
}
|
|
24004
|
-
var KC_SERVICE = "gemini", KC_ACCOUNT = "antigravity", PREFIX = "go-keyring-base64:", EXPIRY_SKEW_MS = 120000, AGY_REFRESH_TIMEOUT_MS = 12000, READ_STORE_TTL_MS = 3000, cachedRawStore = null, defaultDeps, cachedHasToken = null, HAS_TOKEN_TTL_MS = 5000, inFlight = null;
|
|
24072
|
+
var KC_SERVICE = "gemini", KC_ACCOUNT = "antigravity", PREFIX = "go-keyring-base64:", EXPIRY_SKEW_MS = 120000, AGY_REFRESH_TIMEOUT_MS = 12000, AGY_VERSION_TIMEOUT_MS = 5000, READ_STORE_TTL_MS = 3000, cachedRawStore = null, defaultDeps, cachedHasToken = null, HAS_TOKEN_TTL_MS = 5000, inFlight = null;
|
|
24005
24073
|
var init_antigravity_token = __esm(() => {
|
|
24006
24074
|
init_logger();
|
|
24007
24075
|
defaultDeps = {
|
|
@@ -24009,6 +24077,7 @@ var init_antigravity_token = __esm(() => {
|
|
|
24009
24077
|
writeStore: defaultWriteStore,
|
|
24010
24078
|
deleteStore: defaultDeleteStore,
|
|
24011
24079
|
runAgyRefresh: defaultRunAgyRefresh,
|
|
24080
|
+
readAgyVersion: defaultReadAgyVersion,
|
|
24012
24081
|
now: () => Date.now()
|
|
24013
24082
|
};
|
|
24014
24083
|
});
|
|
@@ -24026,8 +24095,11 @@ function makeTerminalSetupError(message) {
|
|
|
24026
24095
|
err.terminal = true;
|
|
24027
24096
|
return err;
|
|
24028
24097
|
}
|
|
24098
|
+
function antigravityClientVersion() {
|
|
24099
|
+
return getAgyClientVersion() ?? AGY_FALLBACK_CLIENT_VERSION;
|
|
24100
|
+
}
|
|
24029
24101
|
function buildAntigravityUserAgent() {
|
|
24030
|
-
return `antigravity/cli
|
|
24102
|
+
return `antigravity/cli/${antigravityClientVersion()} (aidev_client; os_type=${process.platform}; arch=${process.arch}; auth_method=consumer)`;
|
|
24031
24103
|
}
|
|
24032
24104
|
function resetAntigravityUserCache() {
|
|
24033
24105
|
cachedAgProjectId = null;
|
|
@@ -24035,6 +24107,7 @@ function resetAntigravityUserCache() {
|
|
|
24035
24107
|
cachedAgTierName = null;
|
|
24036
24108
|
agServedCache = null;
|
|
24037
24109
|
agServedCacheAt = 0;
|
|
24110
|
+
agServedCacheVersion = null;
|
|
24038
24111
|
}
|
|
24039
24112
|
async function callLoadCodeAssistAntigravity(accessToken) {
|
|
24040
24113
|
const res = await fetch(`${apiBase()}:loadCodeAssist`, {
|
|
@@ -24101,8 +24174,31 @@ async function retrieveUserQuota(accessToken, projectId) {
|
|
|
24101
24174
|
return null;
|
|
24102
24175
|
}
|
|
24103
24176
|
}
|
|
24177
|
+
function flattenAgentModelSorts(sorts) {
|
|
24178
|
+
if (!Array.isArray(sorts))
|
|
24179
|
+
return;
|
|
24180
|
+
const seen = new Set;
|
|
24181
|
+
const ids = [];
|
|
24182
|
+
for (const sort of sorts) {
|
|
24183
|
+
for (const group of sort?.groups ?? []) {
|
|
24184
|
+
for (const id of group?.modelIds ?? []) {
|
|
24185
|
+
if (typeof id !== "string" || id === "" || seen.has(id))
|
|
24186
|
+
continue;
|
|
24187
|
+
seen.add(id);
|
|
24188
|
+
ids.push(id);
|
|
24189
|
+
}
|
|
24190
|
+
}
|
|
24191
|
+
}
|
|
24192
|
+
return ids.length > 0 ? ids : undefined;
|
|
24193
|
+
}
|
|
24104
24194
|
async function getServedAntigravityModels(accessToken, projectId, opts) {
|
|
24105
24195
|
const now = Date.now();
|
|
24196
|
+
const version = antigravityClientVersion();
|
|
24197
|
+
if (agServedCache && agServedCacheVersion !== version) {
|
|
24198
|
+
log(`[Antigravity] Client version changed (${agServedCacheVersion} -> ${version}); ` + "refetching the dynamic models catalog.");
|
|
24199
|
+
agServedCache = null;
|
|
24200
|
+
agServedCacheAt = 0;
|
|
24201
|
+
}
|
|
24106
24202
|
if (!opts?.force && agServedCache && now - agServedCacheAt < SERVED_MODELS_TTL_MS) {
|
|
24107
24203
|
return agServedCache;
|
|
24108
24204
|
}
|
|
@@ -24154,8 +24250,17 @@ async function getServedAntigravityModels(accessToken, projectId, opts) {
|
|
|
24154
24250
|
if (info?.newModelId)
|
|
24155
24251
|
deprecatedReplacements[oldId] = info.newModelId;
|
|
24156
24252
|
}
|
|
24157
|
-
|
|
24253
|
+
const agentModelIds = flattenAgentModelSorts(data.agentModelSorts);
|
|
24254
|
+
agServedCache = {
|
|
24255
|
+
servedIds,
|
|
24256
|
+
defaultId,
|
|
24257
|
+
meta,
|
|
24258
|
+
excludedIds,
|
|
24259
|
+
deprecatedReplacements,
|
|
24260
|
+
...agentModelIds ? { agentModelIds } : {}
|
|
24261
|
+
};
|
|
24158
24262
|
agServedCacheAt = now;
|
|
24263
|
+
agServedCacheVersion = version;
|
|
24159
24264
|
return agServedCache;
|
|
24160
24265
|
}
|
|
24161
24266
|
} else {
|
|
@@ -24168,7 +24273,7 @@ async function getServedAntigravityModels(accessToken, projectId, opts) {
|
|
|
24168
24273
|
return agServedCache;
|
|
24169
24274
|
return { servedIds: [], defaultId: null, meta: {} };
|
|
24170
24275
|
}
|
|
24171
|
-
var ANTIGRAVITY_DEFAULT_HOST = "https://daily-cloudcode-pa.googleapis.com", SERVED_MODELS_TTL_MS, ANTIGRAVITY_IDE_TYPE = "ANTIGRAVITY", cachedAgProjectId = null, cachedAgTierId = null, cachedAgTierName = null, agServedCache = null, agServedCacheAt = 0;
|
|
24276
|
+
var ANTIGRAVITY_DEFAULT_HOST = "https://daily-cloudcode-pa.googleapis.com", SERVED_MODELS_TTL_MS, ANTIGRAVITY_IDE_TYPE = "ANTIGRAVITY", AGY_FALLBACK_CLIENT_VERSION = "1.1.9", cachedAgProjectId = null, cachedAgTierId = null, cachedAgTierName = null, agServedCache = null, agServedCacheAt = 0, agServedCacheVersion = null;
|
|
24172
24277
|
var init_antigravity_user = __esm(() => {
|
|
24173
24278
|
init_logger();
|
|
24174
24279
|
SERVED_MODELS_TTL_MS = 10 * 60 * 1000;
|
|
@@ -31094,6 +31199,10 @@ class VertexCredentialProvider {
|
|
|
31094
31199
|
const config = await resolveVertexConfig();
|
|
31095
31200
|
return selectVertexAuthMode({ project: config?.projectId }) !== null;
|
|
31096
31201
|
}
|
|
31202
|
+
invalidate() {
|
|
31203
|
+
resetVertexAuthManager();
|
|
31204
|
+
resetVertexProjectDiscovery();
|
|
31205
|
+
}
|
|
31097
31206
|
async getRequestAuth(_ctx) {
|
|
31098
31207
|
const config = await resolveVertexConfig();
|
|
31099
31208
|
if (selectVertexAuthMode({ project: config?.projectId }) === "project") {
|
|
@@ -33017,20 +33126,26 @@ async function fetchAntigravityModelsCatalog() {
|
|
|
33017
33126
|
};
|
|
33018
33127
|
}
|
|
33019
33128
|
const { projectId } = await setupAntigravityUser(token);
|
|
33020
|
-
const { servedIds, meta, excludedIds } = await getServedAntigravityModels(token, projectId);
|
|
33129
|
+
const { servedIds, meta, excludedIds, agentModelIds } = await getServedAntigravityModels(token, projectId);
|
|
33021
33130
|
const declaredExcluded = excludedIds ?? new Set;
|
|
33022
|
-
const
|
|
33131
|
+
const served = new Set(servedIds);
|
|
33132
|
+
const agentSelectable = (agentModelIds ?? []).filter((id) => served.has(id) && !declaredExcluded.has(id));
|
|
33133
|
+
const position = new Map(agentSelectable.map((id, index) => [id, index]));
|
|
33134
|
+
const otherSelectable = servedIds.filter((id) => !position.has(id) && !declaredExcluded.has(id) && !isUndeclaredEditorInternal(id));
|
|
33023
33135
|
return {
|
|
33024
33136
|
kind: "models",
|
|
33025
33137
|
endpoint,
|
|
33026
|
-
models:
|
|
33138
|
+
models: [...agentSelectable, ...otherSelectable].map((id) => {
|
|
33027
33139
|
const m = meta[id];
|
|
33140
|
+
const index = position.get(id);
|
|
33141
|
+
const order = index === undefined ? {} : { providerOrder: index };
|
|
33028
33142
|
return m?.contextWindow ? {
|
|
33029
33143
|
id,
|
|
33030
33144
|
contextWindow: m.contextWindow,
|
|
33031
33145
|
ignoreCatalogReleaseDate: true,
|
|
33032
|
-
reported: "chat"
|
|
33033
|
-
|
|
33146
|
+
reported: "chat",
|
|
33147
|
+
...order
|
|
33148
|
+
} : { id, ignoreCatalogReleaseDate: true, reported: "chat", ...order };
|
|
33034
33149
|
})
|
|
33035
33150
|
};
|
|
33036
33151
|
} catch (err) {
|
|
@@ -40553,6 +40668,10 @@ var init_poe = __esm(() => {
|
|
|
40553
40668
|
});
|
|
40554
40669
|
|
|
40555
40670
|
// src/providers/transport/vertex-discovery.ts
|
|
40671
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
40672
|
+
function _clearVertexDiscoveryCache() {
|
|
40673
|
+
_cache3.clear();
|
|
40674
|
+
}
|
|
40556
40675
|
function isServedByVertex(m) {
|
|
40557
40676
|
if (!m.publisherModelTemplate)
|
|
40558
40677
|
return false;
|
|
@@ -40609,8 +40728,43 @@ async function listVertexPublisherModels(publisher = VERTEX_DEFAULT_PUBLISHER) {
|
|
|
40609
40728
|
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS4)
|
|
40610
40729
|
});
|
|
40611
40730
|
if (!response.ok) {
|
|
40731
|
+
log(`[vertex-discovery] HTTP ${response.status} from ${endpoint}`);
|
|
40612
40732
|
const detail = await response.text().catch(() => "");
|
|
40613
|
-
|
|
40733
|
+
const upstream = upstreamErrorMessage(detail);
|
|
40734
|
+
const origin = await resolveVertexProjectOrigin();
|
|
40735
|
+
if (response.status === 401 || response.status === 403) {
|
|
40736
|
+
let account;
|
|
40737
|
+
try {
|
|
40738
|
+
const credPath = process.env.GOOGLE_APPLICATION_CREDENTIALS;
|
|
40739
|
+
if (credPath) {
|
|
40740
|
+
try {
|
|
40741
|
+
const credential = JSON.parse(await readFile4(credPath, "utf-8"));
|
|
40742
|
+
account = str2(credential.client_email);
|
|
40743
|
+
} catch {}
|
|
40744
|
+
}
|
|
40745
|
+
if (!account) {
|
|
40746
|
+
const token = auth.headers.Authorization?.match(/^Bearer\s+(.+)$/i)?.[1];
|
|
40747
|
+
if (token) {
|
|
40748
|
+
const tokeninfo = await fetch(`https://oauth2.googleapis.com/tokeninfo?access_token=${encodeURIComponent(token)}`, { method: "GET", signal: AbortSignal.timeout(3000) });
|
|
40749
|
+
if (tokeninfo.ok) {
|
|
40750
|
+
account = str2((await tokeninfo.json()).email);
|
|
40751
|
+
}
|
|
40752
|
+
}
|
|
40753
|
+
}
|
|
40754
|
+
} catch {}
|
|
40755
|
+
const explanation = describeVertexAccessDenied({
|
|
40756
|
+
status: response.status,
|
|
40757
|
+
upstream,
|
|
40758
|
+
account,
|
|
40759
|
+
origin,
|
|
40760
|
+
projectId: config.projectId
|
|
40761
|
+
});
|
|
40762
|
+
throw new Error(explanation);
|
|
40763
|
+
}
|
|
40764
|
+
throw new Error([
|
|
40765
|
+
`HTTP ${response.status}: ${upstream}`,
|
|
40766
|
+
`project ${config.projectId}` + (origin ? ` (from ${describeVertexProjectSource(origin)})` : "")
|
|
40767
|
+
].join(" \xB7 "));
|
|
40614
40768
|
}
|
|
40615
40769
|
const listed = parsePublisherModels(await response.json());
|
|
40616
40770
|
const models = listed.filter(isServedByVertex).map((m) => {
|
|
@@ -40626,6 +40780,15 @@ function oneLine4(text, max = 200) {
|
|
|
40626
40780
|
const flat = text.replace(/\s+/g, " ").trim();
|
|
40627
40781
|
return flat.length > max ? `${flat.slice(0, max)}\u2026` : flat;
|
|
40628
40782
|
}
|
|
40783
|
+
function upstreamErrorMessage(detail) {
|
|
40784
|
+
try {
|
|
40785
|
+
const body = JSON.parse(detail);
|
|
40786
|
+
const message = str2(body?.error?.message);
|
|
40787
|
+
if (message)
|
|
40788
|
+
return message;
|
|
40789
|
+
} catch {}
|
|
40790
|
+
return oneLine4(detail) || "(no message)";
|
|
40791
|
+
}
|
|
40629
40792
|
async function verifyServed(ids, config, headers) {
|
|
40630
40793
|
const base = `https://${vertexApiHost(config.location)}/v1/` + `projects/${config.projectId}/locations/${config.location}/publishers`;
|
|
40631
40794
|
return Promise.all(ids.map(async (id) => {
|
|
@@ -52040,7 +52203,8 @@ function ModelPicker({ source, onDone, onDiscoveryFailure }) {
|
|
|
52040
52203
|
value: filter,
|
|
52041
52204
|
matches: shown.length,
|
|
52042
52205
|
total: list.rows.length,
|
|
52043
|
-
width: layout.inner
|
|
52206
|
+
width: layout.inner,
|
|
52207
|
+
idle: discovery.outcome?.kind === "rows" && discovery.outcome.providerOrdered ? "" : undefined
|
|
52044
52208
|
}),
|
|
52045
52209
|
/* @__PURE__ */ jsx10(ColumnHeader, {
|
|
52046
52210
|
layout: rowLayout
|
|
@@ -53012,7 +53176,8 @@ async function buildDiscoveredModelOutcome(provider, displayName, catalog) {
|
|
|
53012
53176
|
if (head === undefined) {
|
|
53013
53177
|
return { kind: "collapsed-empty", servedCount, chatCount, fallbackRows };
|
|
53014
53178
|
}
|
|
53015
|
-
|
|
53179
|
+
const providerOrdered = discovered.some((m) => typeof m.providerOrder === "number");
|
|
53180
|
+
return providerOrdered ? { kind: "rows", rows: [head, ...tail], servedCount, chatCount, providerOrdered: true } : { kind: "rows", rows: [head, ...tail], servedCount, chatCount };
|
|
53016
53181
|
}
|
|
53017
53182
|
async function buildDiscoveredModelRows(provider, displayName, catalog) {
|
|
53018
53183
|
const outcome = await buildDiscoveredModelOutcome(provider, displayName, catalog);
|
|
@@ -53050,8 +53215,18 @@ function buildRowsFromDiscovered(provider, displayName, discovered, catalogRows)
|
|
|
53050
53215
|
source: displayName
|
|
53051
53216
|
};
|
|
53052
53217
|
});
|
|
53218
|
+
const orderById = new Map;
|
|
53219
|
+
for (const m of discovered) {
|
|
53220
|
+
if (typeof m.providerOrder === "number")
|
|
53221
|
+
orderById.set(m.id, m.providerOrder);
|
|
53222
|
+
}
|
|
53223
|
+
if (orderById.size > 0)
|
|
53224
|
+
return inProviderOrder(rows, orderById);
|
|
53053
53225
|
return sortModelsNewestFirst(rows);
|
|
53054
53226
|
}
|
|
53227
|
+
function inProviderOrder(rows, orderById) {
|
|
53228
|
+
return rows.filter((row) => orderById.has(row.id)).sort((a, b) => (orderById.get(a.id) ?? 0) - (orderById.get(b.id) ?? 0));
|
|
53229
|
+
}
|
|
53055
53230
|
async function selectModelFromProvider(provider, tierName, recommendedModels, _forceUpdate, catalog) {
|
|
53056
53231
|
const prefix = pickerModelPrefix(provider) ?? `${provider}@`;
|
|
53057
53232
|
const displayName = getPickerDisplayName(provider);
|
|
@@ -63952,6 +64127,9 @@ function readProcessTable() {
|
|
|
63952
64127
|
return [];
|
|
63953
64128
|
}
|
|
63954
64129
|
}
|
|
64130
|
+
function processTableTrusted(table) {
|
|
64131
|
+
return table.some((r) => r.pid === process.pid);
|
|
64132
|
+
}
|
|
63955
64133
|
function readProcessTableAsync() {
|
|
63956
64134
|
return new Promise((resolve) => {
|
|
63957
64135
|
try {
|
|
@@ -64888,8 +65066,9 @@ function ownerStartOfSelf() {
|
|
|
64888
65066
|
if (ownStart)
|
|
64889
65067
|
return ownStart;
|
|
64890
65068
|
const row = readProcessTable().find((r) => r.pid === process.pid);
|
|
64891
|
-
|
|
64892
|
-
|
|
65069
|
+
if (row)
|
|
65070
|
+
ownStart = row.lstart;
|
|
65071
|
+
return row?.lstart ?? "";
|
|
64893
65072
|
}
|
|
64894
65073
|
function ownerAlive(rec, table) {
|
|
64895
65074
|
const row = table.find((r) => r.pid === rec.ownerPid);
|
|
@@ -65143,6 +65322,10 @@ async function killVerified(rec, root) {
|
|
|
65143
65322
|
}
|
|
65144
65323
|
async function sweepRecord(rec, root, out) {
|
|
65145
65324
|
const table = readProcessTable();
|
|
65325
|
+
if (!processTableTrusted(table)) {
|
|
65326
|
+
out.kept.push(rec.paneId);
|
|
65327
|
+
return;
|
|
65328
|
+
}
|
|
65146
65329
|
if (ownerAlive(rec, table))
|
|
65147
65330
|
return;
|
|
65148
65331
|
const watcher = rec.watcherPid ? table.find((r) => r.pid === rec.watcherPid) : undefined;
|
|
@@ -65155,6 +65338,10 @@ async function sweepRecord(rec, root, out) {
|
|
|
65155
65338
|
if (anyVerified)
|
|
65156
65339
|
await killVerified(rec, root);
|
|
65157
65340
|
const after = readProcessTable();
|
|
65341
|
+
if (!processTableTrusted(after)) {
|
|
65342
|
+
out.kept.push(rec.paneId);
|
|
65343
|
+
return;
|
|
65344
|
+
}
|
|
65158
65345
|
const stillAlive = t0.group && groupCheck(after, t0.group) || liveEscaped(after, t0.group).length > 0 || t0.mag !== null && isPaneMagmux(t0.mag, rec.paneId, after);
|
|
65159
65346
|
if (stillAlive) {
|
|
65160
65347
|
out.kept.push(rec.paneId);
|
|
@@ -65187,6 +65374,10 @@ function ownerOfIdAlive(id, table) {
|
|
|
65187
65374
|
async function sweepRecordlessSocket(root, name, out) {
|
|
65188
65375
|
const id = name.slice("magmux-".length, -".sock".length);
|
|
65189
65376
|
const table = readProcessTable();
|
|
65377
|
+
if (!processTableTrusted(table)) {
|
|
65378
|
+
out.kept.push(id);
|
|
65379
|
+
return;
|
|
65380
|
+
}
|
|
65190
65381
|
if (ownerOfIdAlive(id, table))
|
|
65191
65382
|
return;
|
|
65192
65383
|
const sockPath = join43(root, name);
|
|
@@ -65259,7 +65450,7 @@ var init_pane_registry = __esm(() => {
|
|
|
65259
65450
|
});
|
|
65260
65451
|
|
|
65261
65452
|
// src/mcp-session/parent-session.ts
|
|
65262
|
-
import { readFile as
|
|
65453
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
65263
65454
|
import { join as join44 } from "path";
|
|
65264
65455
|
function positiveInt(value) {
|
|
65265
65456
|
if (value === undefined || !/^[1-9][0-9]*$/.test(value))
|
|
@@ -65288,7 +65479,7 @@ function claudeConfigDir(env) {
|
|
|
65288
65479
|
}
|
|
65289
65480
|
async function readHostSessionRecord(opts) {
|
|
65290
65481
|
try {
|
|
65291
|
-
const raw = await
|
|
65482
|
+
const raw = await readFile5(join44(opts.configDir, "sessions", `${opts.hostPid}.json`), "utf-8");
|
|
65292
65483
|
const parsed = JSON.parse(raw);
|
|
65293
65484
|
if (!parsed || typeof parsed !== "object")
|
|
65294
65485
|
return;
|
|
@@ -73817,9 +74008,10 @@ async function main() {
|
|
|
73817
74008
|
const transport = new StdioServerTransport;
|
|
73818
74009
|
await server.connect(transport);
|
|
73819
74010
|
installMcpShutdown(sessionManager);
|
|
73820
|
-
|
|
73821
|
-
|
|
73822
|
-
|
|
74011
|
+
if (!nested)
|
|
74012
|
+
ensureSwept(sockRootFor()).catch(() => {
|
|
74013
|
+
return;
|
|
74014
|
+
});
|
|
73823
74015
|
}
|
|
73824
74016
|
function installMcpShutdown(sessionManager) {
|
|
73825
74017
|
const before = async () => {
|
|
@@ -74651,6 +74843,16 @@ var init_source = __esm(() => {
|
|
|
74651
74843
|
});
|
|
74652
74844
|
|
|
74653
74845
|
// src/tui/providers.ts
|
|
74846
|
+
function providerLoginAction(p) {
|
|
74847
|
+
if (p.oauthSlug)
|
|
74848
|
+
return { kind: "claudish", slug: p.oauthSlug };
|
|
74849
|
+
if (p.catalogName === "vertex")
|
|
74850
|
+
return { kind: "gcloud-adc" };
|
|
74851
|
+
return;
|
|
74852
|
+
}
|
|
74853
|
+
function providerSetLabel(p) {
|
|
74854
|
+
return p.catalogName === "vertex" ? "project" : "key";
|
|
74855
|
+
}
|
|
74654
74856
|
function toProviderDef(def) {
|
|
74655
74857
|
return {
|
|
74656
74858
|
name: def.name === "google" ? "gemini" : def.name,
|
|
@@ -74695,7 +74897,7 @@ function providerCredentialNote(p) {
|
|
|
74695
74897
|
return;
|
|
74696
74898
|
const origin = peekVertexProjectOrigin();
|
|
74697
74899
|
if (!origin) {
|
|
74698
|
-
return hasVertexAdcCredentials() ? `ADC present, no project \u2014 ${VERTEX_SET_PROJECT_REMEDY}` : `No credential \u2014 run \`gcloud auth application-default login
|
|
74900
|
+
return hasVertexAdcCredentials() ? `ADC present, no project \u2014 ${VERTEX_SET_PROJECT_REMEDY}` : `No credential \u2014 run \`gcloud auth application-default login\` (press l), then ${VERTEX_SET_PROJECT_REMEDY}`;
|
|
74699
74901
|
}
|
|
74700
74902
|
return `Project ${origin.projectId} from ${describeVertexProjectSource(origin)}`;
|
|
74701
74903
|
}
|
|
@@ -75177,11 +75379,9 @@ import { homedir as homedir36 } from "os";
|
|
|
75177
75379
|
import { join as join56 } from "path";
|
|
75178
75380
|
async function defaultSuggestModel() {
|
|
75179
75381
|
try {
|
|
75180
|
-
const
|
|
75181
|
-
|
|
75182
|
-
|
|
75183
|
-
const { projectId } = await setupAntigravityUser(tok.access_token);
|
|
75184
|
-
const { servedIds, defaultId } = await getServedAntigravityModels(tok.access_token, projectId);
|
|
75382
|
+
const token = await getValidAntigravityAccessToken();
|
|
75383
|
+
const { projectId } = await setupAntigravityUser(token);
|
|
75384
|
+
const { servedIds, defaultId } = await getServedAntigravityModels(token, projectId);
|
|
75185
75385
|
return defaultId || servedIds[0] || "<model>";
|
|
75186
75386
|
} catch {
|
|
75187
75387
|
return "<model>";
|
|
@@ -76679,6 +76879,32 @@ var init_constants3 = __esm(() => {
|
|
|
76679
76879
|
|
|
76680
76880
|
// src/tui/components/Footer.tsx
|
|
76681
76881
|
import { jsx as jsx14, jsxs as jsxs10 } from "@opentui/react/jsx-runtime";
|
|
76882
|
+
function providerFooterKeys(providerCaps) {
|
|
76883
|
+
const showKey = providerCaps ? providerCaps.apiKey : true;
|
|
76884
|
+
const showEndpoint = providerCaps ? providerCaps.endpoint || providerCaps.local : true;
|
|
76885
|
+
const showLogin = providerCaps ? providerCaps.oauth : true;
|
|
76886
|
+
const showRemove = providerCaps ? !providerCaps.local && (providerCaps.apiKey || providerCaps.endpoint) : true;
|
|
76887
|
+
const showUrl = providerCaps ? providerCaps.endpoint : true;
|
|
76888
|
+
const keys = [[C.blue, "\u2191\u2193", "navigate"]];
|
|
76889
|
+
if (showKey)
|
|
76890
|
+
keys.push([C.green, "s", providerCaps?.setLabel === "project" ? "set project" : "set key"]);
|
|
76891
|
+
if (showEndpoint)
|
|
76892
|
+
keys.push([
|
|
76893
|
+
C.green,
|
|
76894
|
+
"e",
|
|
76895
|
+
providerCaps?.local ? providerCaps.localEnabled ? "disable" : "enable" : "endpoint"
|
|
76896
|
+
]);
|
|
76897
|
+
if (showUrl)
|
|
76898
|
+
keys.push([C.green, "u", "url"]);
|
|
76899
|
+
if (showLogin)
|
|
76900
|
+
keys.push([C.green, "l", "login"]);
|
|
76901
|
+
keys.push([C.cyan, "t", "test"]);
|
|
76902
|
+
keys.push([C.cyan, "T", "test all"]);
|
|
76903
|
+
if (showRemove)
|
|
76904
|
+
keys.push([C.red, "x", "remove"]);
|
|
76905
|
+
keys.push([C.dim, "q", "quit"]);
|
|
76906
|
+
return keys;
|
|
76907
|
+
}
|
|
76682
76908
|
function Footer({ activeTab, mode, probeMode, providerCaps }) {
|
|
76683
76909
|
const isProfileEditMode = mode === "new_profile" || mode === "pick_profile_scope" || mode === "pick_provider_prefix" || mode === "edit_profile_opus" || mode === "edit_profile_sonnet" || mode === "edit_profile_haiku" || mode === "edit_profile_subagent";
|
|
76684
76910
|
let keys;
|
|
@@ -76700,29 +76926,7 @@ function Footer({ activeTab, mode, probeMode, providerCaps }) {
|
|
|
76700
76926
|
[C.dim, "q", "quit"]
|
|
76701
76927
|
];
|
|
76702
76928
|
} else if (activeTab === "providers") {
|
|
76703
|
-
|
|
76704
|
-
const showEndpoint = providerCaps ? providerCaps.endpoint || providerCaps.local : true;
|
|
76705
|
-
const showLogin = providerCaps ? providerCaps.oauth : true;
|
|
76706
|
-
const showRemove = providerCaps ? !providerCaps.local && (providerCaps.apiKey || providerCaps.endpoint) : true;
|
|
76707
|
-
const showUrl = providerCaps ? providerCaps.endpoint : true;
|
|
76708
|
-
keys = [[C.blue, "\u2191\u2193", "navigate"]];
|
|
76709
|
-
if (showKey)
|
|
76710
|
-
keys.push([C.green, "s", "set key"]);
|
|
76711
|
-
if (showEndpoint)
|
|
76712
|
-
keys.push([
|
|
76713
|
-
C.green,
|
|
76714
|
-
"e",
|
|
76715
|
-
providerCaps?.local ? providerCaps.localEnabled ? "disable" : "enable" : "endpoint"
|
|
76716
|
-
]);
|
|
76717
|
-
if (showUrl)
|
|
76718
|
-
keys.push([C.green, "u", "url"]);
|
|
76719
|
-
if (showLogin)
|
|
76720
|
-
keys.push([C.green, "l", "login"]);
|
|
76721
|
-
keys.push([C.cyan, "t", "test"]);
|
|
76722
|
-
keys.push([C.cyan, "T", "test all"]);
|
|
76723
|
-
if (showRemove)
|
|
76724
|
-
keys.push([C.red, "x", "remove"]);
|
|
76725
|
-
keys.push([C.dim, "q", "quit"]);
|
|
76929
|
+
keys = providerFooterKeys(providerCaps);
|
|
76726
76930
|
} else if (activeTab === "profiles" && isProfileEditMode) {
|
|
76727
76931
|
keys = [[C.dim, "wizard", "follow the panel above"]];
|
|
76728
76932
|
} else if (activeTab === "profiles") {
|
|
@@ -78850,6 +79054,9 @@ function wrapToLines(text, maxWidth, maxLines) {
|
|
|
78850
79054
|
}
|
|
78851
79055
|
return lines;
|
|
78852
79056
|
}
|
|
79057
|
+
function credentialNoteLines(note, width, hasFailure) {
|
|
79058
|
+
return wrapToLines(note, width - 4 - "Auth: ".length, hasFailure ? 1 : 2);
|
|
79059
|
+
}
|
|
78853
79060
|
function resolveProviderDetailKeyDisplay(input) {
|
|
78854
79061
|
if (input.isLocal)
|
|
78855
79062
|
return input.isReady ? "enabled" : "disabled";
|
|
@@ -78861,6 +79068,11 @@ function resolveProviderDetailKeyDisplay(input) {
|
|
|
78861
79068
|
return input.cfgKeyMask;
|
|
78862
79069
|
return "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
78863
79070
|
}
|
|
79071
|
+
function validTestNote(input) {
|
|
79072
|
+
if (input.isLocal)
|
|
79073
|
+
return " Local provider responded through the shared probe path.";
|
|
79074
|
+
return input.credential === "login" ? " Login is valid and endpoint is reachable." : " API key is valid and endpoint is reachable.";
|
|
79075
|
+
}
|
|
78864
79076
|
function ProviderDetail({
|
|
78865
79077
|
selectedProvider,
|
|
78866
79078
|
mode,
|
|
@@ -78898,7 +79110,7 @@ function ProviderDetail({
|
|
|
78898
79110
|
border: true,
|
|
78899
79111
|
borderStyle: "single",
|
|
78900
79112
|
borderColor: C.focusBorder,
|
|
78901
|
-
title: mode === "input_key" ? ` Set API Key \u2014 ${selectedProvider.displayName} \u2192 ${keySaveTarget} ` : ` Set Endpoint \u2014 ${selectedProvider.displayName} `,
|
|
79113
|
+
title: mode === "input_key" ? ` Set ${providerSetLabel(selectedProvider) === "project" ? "Project" : "API Key"} \u2014 ${selectedProvider.displayName} \u2192 ${keySaveTarget} ` : ` Set Endpoint \u2014 ${selectedProvider.displayName} `,
|
|
78902
79114
|
backgroundColor: C.bg,
|
|
78903
79115
|
flexDirection: "column",
|
|
78904
79116
|
paddingX: 1,
|
|
@@ -78960,6 +79172,7 @@ function ProviderDetail({
|
|
|
78960
79172
|
}
|
|
78961
79173
|
const tr = testResults[selectedProvider.name];
|
|
78962
79174
|
const failureText = tr && (tr.status === "failed" || tr.status === "unavailable") ? tr.providerMessage ?? tr.error : undefined;
|
|
79175
|
+
const noteLines = credentialNote ? credentialNoteLines(credentialNote, width, !!failureText) : [];
|
|
78963
79176
|
return /* @__PURE__ */ jsxs18("box", {
|
|
78964
79177
|
height: DETAIL_H,
|
|
78965
79178
|
border: true,
|
|
@@ -79122,19 +79335,19 @@ function ProviderDetail({
|
|
|
79122
79335
|
})
|
|
79123
79336
|
]
|
|
79124
79337
|
}),
|
|
79125
|
-
|
|
79338
|
+
noteLines.map((line, i) => /* @__PURE__ */ jsxs18("text", {
|
|
79126
79339
|
children: [
|
|
79127
79340
|
/* @__PURE__ */ jsx22("span", {
|
|
79128
79341
|
fg: C.blue,
|
|
79129
79342
|
attributes: A.bold,
|
|
79130
|
-
children: "Auth: "
|
|
79343
|
+
children: i === 0 ? "Auth: " : " "
|
|
79131
79344
|
}),
|
|
79132
79345
|
/* @__PURE__ */ jsx22("span", {
|
|
79133
79346
|
fg: hasKey ? C.green : C.yellow,
|
|
79134
|
-
children:
|
|
79347
|
+
children: line
|
|
79135
79348
|
})
|
|
79136
79349
|
]
|
|
79137
|
-
}),
|
|
79350
|
+
}, i)),
|
|
79138
79351
|
selectedProvider.endpointEnvVar && /* @__PURE__ */ jsxs18("text", {
|
|
79139
79352
|
children: [
|
|
79140
79353
|
/* @__PURE__ */ jsxs18("span", {
|
|
@@ -79151,7 +79364,7 @@ function ProviderDetail({
|
|
|
79151
79364
|
})
|
|
79152
79365
|
]
|
|
79153
79366
|
}),
|
|
79154
|
-
!failureText && /* @__PURE__ */ jsxs18("text", {
|
|
79367
|
+
!failureText && noteLines.length < 2 && /* @__PURE__ */ jsxs18("text", {
|
|
79155
79368
|
children: [
|
|
79156
79369
|
/* @__PURE__ */ jsxs18("span", {
|
|
79157
79370
|
fg: C.blue,
|
|
@@ -79205,7 +79418,10 @@ function ProviderDetail({
|
|
|
79205
79418
|
}),
|
|
79206
79419
|
/* @__PURE__ */ jsx22("span", {
|
|
79207
79420
|
fg: C.fgMuted,
|
|
79208
|
-
children:
|
|
79421
|
+
children: validTestNote({
|
|
79422
|
+
isLocal: !!selectedProvider.isLocal,
|
|
79423
|
+
credential: isOAuth || selectedProvider.catalogName === "vertex" ? "login" : "key"
|
|
79424
|
+
})
|
|
79209
79425
|
})
|
|
79210
79426
|
]
|
|
79211
79427
|
}),
|
|
@@ -79232,6 +79448,7 @@ function ProviderDetail({
|
|
|
79232
79448
|
}
|
|
79233
79449
|
var init_ProviderDetail = __esm(() => {
|
|
79234
79450
|
init_constants3();
|
|
79451
|
+
init_providers();
|
|
79235
79452
|
init_theme2();
|
|
79236
79453
|
});
|
|
79237
79454
|
|
|
@@ -81398,6 +81615,9 @@ var init_onepassword_fields = __esm(() => {
|
|
|
81398
81615
|
import { useKeyboard as useKeyboard3, useRenderer, useTerminalDimensions as useTerminalDimensions3 } from "@opentui/react";
|
|
81399
81616
|
import { useCallback as useCallback4, useEffect as useEffect11, useMemo as useMemo5, useRef as useRef8, useState as useState11 } from "react";
|
|
81400
81617
|
import { jsx as jsx27, jsxs as jsxs23, Fragment as Fragment15 } from "@opentui/react/jsx-runtime";
|
|
81618
|
+
function nextStatusAfterProbeReady(current) {
|
|
81619
|
+
return current === "Starting probe proxy\u2026" ? null : current;
|
|
81620
|
+
}
|
|
81401
81621
|
async function resolveOpEntrySecrets(entries, auth) {
|
|
81402
81622
|
const secrets = {};
|
|
81403
81623
|
for (const entry of entries) {
|
|
@@ -81987,6 +82207,7 @@ function App({ requestLogin } = {}) {
|
|
|
81987
82207
|
if (prov.catalogName === "meta-muse-code")
|
|
81988
82208
|
await prepareMuseLoginForTuiAction();
|
|
81989
82209
|
const proxyUrl = await ensureProbeProxy();
|
|
82210
|
+
setStatusMsg(nextStatusAfterProbeReady);
|
|
81990
82211
|
const catalogModel = getProbeModel(prov.catalogName);
|
|
81991
82212
|
const tried = new Set;
|
|
81992
82213
|
const MAX_ATTEMPTS = 3;
|
|
@@ -82699,15 +82920,17 @@ function App({ requestLogin } = {}) {
|
|
|
82699
82920
|
}
|
|
82700
82921
|
setStatusMsg(failureMsg ?? (changed ? removedFrom.length > 0 ? `Removed ${selectedProvider.displayName} key from ${removedFrom.join(" + ")}.` : `Stored config removed for ${selectedProvider.displayName}.` : "No stored config to remove."));
|
|
82701
82922
|
} else if (key.name === "l") {
|
|
82702
|
-
const
|
|
82703
|
-
|
|
82704
|
-
|
|
82923
|
+
const action = providerLoginAction(selectedProvider);
|
|
82924
|
+
const setLabel = providerSetLabel(selectedProvider) === "project" ? "a project" : "an API key";
|
|
82925
|
+
const command = action?.kind === "gcloud-adc" ? "gcloud auth application-default login" : action ? `claudish login ${action.slug}` : "";
|
|
82926
|
+
if (!action) {
|
|
82927
|
+
setStatusMsg(`${selectedProvider.displayName} doesn't support OAuth login. Press s to set ${setLabel}.`);
|
|
82705
82928
|
} else if (!requestLogin) {
|
|
82706
|
-
setStatusMsg(`Run:
|
|
82929
|
+
setStatusMsg(`Run: ${command}`);
|
|
82707
82930
|
} else {
|
|
82708
|
-
setStatusMsg(`Launching:
|
|
82931
|
+
setStatusMsg(`Launching: ${command}\u2026`);
|
|
82709
82932
|
setTimeout(() => {
|
|
82710
|
-
requestLogin(
|
|
82933
|
+
requestLogin(action);
|
|
82711
82934
|
renderer.destroy();
|
|
82712
82935
|
}, 50);
|
|
82713
82936
|
}
|
|
@@ -82728,17 +82951,18 @@ function App({ requestLogin } = {}) {
|
|
|
82728
82951
|
}
|
|
82729
82952
|
} else if (key.name === "t") {
|
|
82730
82953
|
const caps = providerAuthCapabilities(selectedProvider, config);
|
|
82954
|
+
const setLabel = providerSetLabel(selectedProvider);
|
|
82731
82955
|
const localRunning = selectedProviderIsLocal && localLiveness[selectedProvider.catalogName] === "running";
|
|
82732
82956
|
const ready = providerIsReady(selectedProvider, config) || localRunning;
|
|
82733
82957
|
if (!ready) {
|
|
82734
82958
|
if (selectedProviderIsLocal) {
|
|
82735
82959
|
setStatusMsg(`${selectedProvider.displayName}: not running / disabled. Start the server, or press e to enable.`);
|
|
82736
82960
|
} else if (caps.apiKey.supported && caps.oauth.supported) {
|
|
82737
|
-
setStatusMsg(`${selectedProvider.displayName}: no credentials. Press s to set a
|
|
82961
|
+
setStatusMsg(`${selectedProvider.displayName}: no credentials. Press s to set a ${setLabel} or l to login.`);
|
|
82738
82962
|
} else if (caps.oauth.supported) {
|
|
82739
82963
|
setStatusMsg(`${selectedProvider.displayName}: no credentials. Press l to login.`);
|
|
82740
82964
|
} else if (caps.apiKey.supported) {
|
|
82741
|
-
setStatusMsg(`${selectedProvider.displayName}: no
|
|
82965
|
+
setStatusMsg(`${selectedProvider.displayName}: no ${setLabel} set. Press s to set ${setLabel === "project" ? "a project" : "an API key"}.`);
|
|
82742
82966
|
} else {
|
|
82743
82967
|
setStatusMsg(`${selectedProvider.displayName} doesn't support auth from the TUI.`);
|
|
82744
82968
|
}
|
|
@@ -83167,7 +83391,8 @@ function App({ requestLogin } = {}) {
|
|
|
83167
83391
|
probeMode,
|
|
83168
83392
|
providerCaps: activeTab === "providers" && selectedProvider ? {
|
|
83169
83393
|
apiKey: !!selectedProvider.apiKeyEnvVar,
|
|
83170
|
-
oauth:
|
|
83394
|
+
oauth: Boolean(providerLoginAction(selectedProvider)),
|
|
83395
|
+
setLabel: providerSetLabel(selectedProvider),
|
|
83171
83396
|
endpoint: !!selectedProvider.endpointEnvVar,
|
|
83172
83397
|
local: selectedProviderIsLocal,
|
|
83173
83398
|
localEnabled: selectedLocalEnabled
|
|
@@ -83241,21 +83466,25 @@ var init_App = __esm(() => {
|
|
|
83241
83466
|
// src/tui/index.tsx
|
|
83242
83467
|
var exports_tui = {};
|
|
83243
83468
|
__export(exports_tui, {
|
|
83469
|
+
gcloudCommand: () => gcloudCommand,
|
|
83244
83470
|
startConfigTui: () => startConfigTui
|
|
83245
83471
|
});
|
|
83246
83472
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
83247
83473
|
import { createCliRenderer as createCliRenderer3 } from "@opentui/core";
|
|
83248
83474
|
import { createRoot as createRoot3 } from "@opentui/react";
|
|
83249
83475
|
import { jsx as jsx28 } from "@opentui/react/jsx-runtime";
|
|
83476
|
+
function gcloudCommand(platform) {
|
|
83477
|
+
return platform === "win32" ? "gcloud.cmd" : "gcloud";
|
|
83478
|
+
}
|
|
83250
83479
|
async function startConfigTui() {
|
|
83251
83480
|
setCredentialPromptRole(decideTuiRole());
|
|
83252
83481
|
ensureEndpointsRegistered();
|
|
83253
83482
|
setStderrQuiet(true);
|
|
83254
83483
|
const loginRequest = {
|
|
83255
|
-
|
|
83484
|
+
action: null
|
|
83256
83485
|
};
|
|
83257
|
-
const requestLogin = (
|
|
83258
|
-
loginRequest.
|
|
83486
|
+
const requestLogin = (action) => {
|
|
83487
|
+
loginRequest.action = action;
|
|
83259
83488
|
};
|
|
83260
83489
|
const renderer = await createCliRenderer3({
|
|
83261
83490
|
exitOnCtrlC: false
|
|
@@ -83269,23 +83498,37 @@ async function startConfigTui() {
|
|
|
83269
83498
|
});
|
|
83270
83499
|
await shutdownProbeProxy();
|
|
83271
83500
|
setStderrQuiet(false);
|
|
83272
|
-
if (loginRequest.
|
|
83273
|
-
const
|
|
83501
|
+
if (loginRequest.action !== null) {
|
|
83502
|
+
const action = loginRequest.action;
|
|
83503
|
+
const command = action.kind === "gcloud-adc" ? "gcloud auth application-default login" : `claudish login ${action.slug}`;
|
|
83274
83504
|
console.log(`
|
|
83275
|
-
Launching:
|
|
83505
|
+
Launching: ${command}
|
|
83276
83506
|
`);
|
|
83277
|
-
const result = spawnSync3(process.
|
|
83278
|
-
stdio: "inherit"
|
|
83279
|
-
|
|
83507
|
+
const result = action.kind === "gcloud-adc" ? spawnSync3(gcloudCommand(process.platform), ["auth", "application-default", "login"], {
|
|
83508
|
+
stdio: "inherit",
|
|
83509
|
+
shell: process.platform === "win32"
|
|
83510
|
+
}) : spawnSync3(process.argv[0], [process.argv[1], "login", action.slug], { stdio: "inherit" });
|
|
83280
83511
|
if (result.error) {
|
|
83281
|
-
|
|
83512
|
+
if (action.kind === "gcloud-adc" && result.error.code === "ENOENT") {
|
|
83513
|
+
console.error(`
|
|
83514
|
+
gcloud not found \u2014 install the Google Cloud CLI (https://cloud.google.com/sdk/docs/install)
|
|
83515
|
+
`);
|
|
83516
|
+
} else {
|
|
83517
|
+
console.error(`
|
|
83282
83518
|
\u274C Failed to spawn login: ${result.error.message}
|
|
83283
83519
|
`);
|
|
83520
|
+
}
|
|
83284
83521
|
} else if (result.status !== 0) {
|
|
83285
83522
|
console.error(`
|
|
83286
83523
|
\u274C Login exited with status ${result.status}
|
|
83287
83524
|
`);
|
|
83525
|
+
} else if (action.kind === "gcloud-adc") {
|
|
83526
|
+
resetVertexProjectDiscovery();
|
|
83527
|
+
credentials.invalidate("vertex");
|
|
83528
|
+
_clearVertexDiscoveryCache();
|
|
83529
|
+
invalidateProbeProxyHandlers("vertex");
|
|
83288
83530
|
} else {
|
|
83531
|
+
const slug = action.slug;
|
|
83289
83532
|
if (slug === "antigravity") {
|
|
83290
83533
|
_resetAntigravityTokenState();
|
|
83291
83534
|
invalidateProbeProxyHandlers("antigravity");
|
|
@@ -83315,10 +83558,12 @@ var init_tui = __esm(() => {
|
|
|
83315
83558
|
init_authority();
|
|
83316
83559
|
init_prompt_role();
|
|
83317
83560
|
init_kimi_oauth();
|
|
83561
|
+
init_vertex_auth();
|
|
83318
83562
|
init_logger();
|
|
83319
|
-
init_renderer_theme();
|
|
83320
83563
|
init_endpoint_registration();
|
|
83321
83564
|
init_muse_credentials();
|
|
83565
|
+
init_vertex_discovery();
|
|
83566
|
+
init_renderer_theme();
|
|
83322
83567
|
init_App();
|
|
83323
83568
|
if (isDirectRun) {
|
|
83324
83569
|
startConfigTui().catch((err) => {
|
|
@@ -83818,6 +84063,13 @@ function shouldHideIncidentalAnthropicKey(config, env = process.env) {
|
|
|
83818
84063
|
return false;
|
|
83819
84064
|
return !wantsAnthropicApiBilling(config, env);
|
|
83820
84065
|
}
|
|
84066
|
+
function applyProxyPlaceholderAuth(env, paneChild = isPaneChild()) {
|
|
84067
|
+
env.ANTHROPIC_AUTH_TOKEN = CLAUDISH_PLACEHOLDER_AUTH_TOKEN;
|
|
84068
|
+
if (paneChild)
|
|
84069
|
+
delete env.ANTHROPIC_API_KEY;
|
|
84070
|
+
else
|
|
84071
|
+
env.ANTHROPIC_API_KEY = CLAUDISH_PLACEHOLDER_API_KEY;
|
|
84072
|
+
}
|
|
83821
84073
|
function scrubInheritedClaudishPlaceholders(env) {
|
|
83822
84074
|
const removed = [];
|
|
83823
84075
|
for (const name of ["ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_API_KEY"]) {
|
|
@@ -84461,8 +84713,7 @@ async function runClaudeWithProxy(config, proxyUrl, onCleanup) {
|
|
|
84461
84713
|
if (classifierPassthroughEnabled(config)) {
|
|
84462
84714
|
console.error("[claudish] classifier passthrough enabled but no Anthropic credentials detected \u2014 " + "classifier requests will fail to authenticate against api.anthropic.com. " + "Map a role to a native Claude model (e.g. --model-sonnet claude-sonnet-5) or set ANTHROPIC_API_KEY.");
|
|
84463
84715
|
}
|
|
84464
|
-
env
|
|
84465
|
-
env.ANTHROPIC_AUTH_TOKEN = CLAUDISH_PLACEHOLDER_AUTH_TOKEN;
|
|
84716
|
+
applyProxyPlaceholderAuth(env);
|
|
84466
84717
|
const realWindow = await computeMainThreadContextWindow(config);
|
|
84467
84718
|
const contextEnv = resolveContextWindowEnv(realWindow, process.env);
|
|
84468
84719
|
Object.assign(env, contextEnv.vars);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudish",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.2",
|
|
4
4
|
"description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"ai"
|
|
61
61
|
],
|
|
62
62
|
"optionalDependencies": {
|
|
63
|
-
"@claudish/magmux-darwin-arm64": "12.3.
|
|
64
|
-
"@claudish/magmux-darwin-x64": "12.3.
|
|
65
|
-
"@claudish/magmux-linux-arm64": "12.3.
|
|
66
|
-
"@claudish/magmux-linux-x64": "12.3.
|
|
63
|
+
"@claudish/magmux-darwin-arm64": "12.3.2",
|
|
64
|
+
"@claudish/magmux-darwin-x64": "12.3.2",
|
|
65
|
+
"@claudish/magmux-linux-arm64": "12.3.2",
|
|
66
|
+
"@claudish/magmux-linux-x64": "12.3.2"
|
|
67
67
|
},
|
|
68
68
|
"author": "Jack Rudenko <i@madappgang.com>",
|
|
69
69
|
"license": "MIT",
|