claudish 7.60.0 → 7.62.0
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 +1032 -398
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -729,7 +729,7 @@ var init_onepassword_config = __esm(() => {
|
|
|
729
729
|
});
|
|
730
730
|
|
|
731
731
|
// src/version.ts
|
|
732
|
-
var VERSION = "7.
|
|
732
|
+
var VERSION = "7.62.0";
|
|
733
733
|
|
|
734
734
|
// src/logger.ts
|
|
735
735
|
var exports_logger = {};
|
|
@@ -5358,6 +5358,57 @@ var init_op_source = __esm(() => {
|
|
|
5358
5358
|
environmentResolutions = new Map;
|
|
5359
5359
|
});
|
|
5360
5360
|
|
|
5361
|
+
// src/classifier-passthrough.ts
|
|
5362
|
+
function blockText(block) {
|
|
5363
|
+
if (typeof block === "string")
|
|
5364
|
+
return block;
|
|
5365
|
+
if (block && typeof block === "object" && block.type === "text" && typeof block.text === "string") {
|
|
5366
|
+
return block.text;
|
|
5367
|
+
}
|
|
5368
|
+
return null;
|
|
5369
|
+
}
|
|
5370
|
+
function startsWithMarker(text) {
|
|
5371
|
+
let i = 0;
|
|
5372
|
+
while (i < text.length) {
|
|
5373
|
+
const ch = text.charCodeAt(i);
|
|
5374
|
+
if (ch !== 32 && ch !== 9 && ch !== 10 && ch !== 13 && ch !== 12 && ch !== 11)
|
|
5375
|
+
break;
|
|
5376
|
+
i++;
|
|
5377
|
+
}
|
|
5378
|
+
return text.startsWith(CLASSIFIER_SYSTEM_MARKER, i);
|
|
5379
|
+
}
|
|
5380
|
+
function isAutoModeClassifierRequest(body) {
|
|
5381
|
+
if (!body || typeof body !== "object")
|
|
5382
|
+
return false;
|
|
5383
|
+
const system = body.system;
|
|
5384
|
+
if (typeof system === "string")
|
|
5385
|
+
return startsWithMarker(system);
|
|
5386
|
+
if (!Array.isArray(system))
|
|
5387
|
+
return false;
|
|
5388
|
+
for (const block of system) {
|
|
5389
|
+
const text = blockText(block);
|
|
5390
|
+
if (text !== null && startsWithMarker(text))
|
|
5391
|
+
return true;
|
|
5392
|
+
}
|
|
5393
|
+
return false;
|
|
5394
|
+
}
|
|
5395
|
+
function rewriteClassifierForNative(body, model) {
|
|
5396
|
+
body.model = model;
|
|
5397
|
+
delete body.thinking;
|
|
5398
|
+
}
|
|
5399
|
+
function resolveClassifierConfig(config, env = process.env) {
|
|
5400
|
+
const flagModel = config.classifierModel?.trim();
|
|
5401
|
+
const flagProvider = config.classifierProvider?.trim().toLowerCase();
|
|
5402
|
+
const envProvider = env.CLAUDISH_CLASSIFIER_PROVIDER?.trim().toLowerCase();
|
|
5403
|
+
const envModel = env.CLAUDISH_CLASSIFIER_MODEL?.trim();
|
|
5404
|
+
const enabled = !!flagModel || flagProvider === "anthropic" || envProvider === "anthropic" || !!envModel;
|
|
5405
|
+
return { enabled, model: flagModel || envModel || DEFAULT_CLASSIFIER_MODEL };
|
|
5406
|
+
}
|
|
5407
|
+
function classifierPassthroughEnabled(config, env = process.env) {
|
|
5408
|
+
return resolveClassifierConfig(config, env).enabled;
|
|
5409
|
+
}
|
|
5410
|
+
var CLASSIFIER_SYSTEM_MARKER = "You are a security monitor for autonomous AI coding agents.", DEFAULT_CLASSIFIER_MODEL = "claude-sonnet-5";
|
|
5411
|
+
|
|
5361
5412
|
// src/onepassword-command.ts
|
|
5362
5413
|
var exports_onepassword_command = {};
|
|
5363
5414
|
__export(exports_onepassword_command, {
|
|
@@ -31653,6 +31704,8 @@ var init_qwen_model_dialect = __esm(() => {
|
|
|
31653
31704
|
}
|
|
31654
31705
|
if (originalRequest.thinking)
|
|
31655
31706
|
delete request.thinking;
|
|
31707
|
+
if (request.reasoning_effort !== undefined)
|
|
31708
|
+
delete request.reasoning_effort;
|
|
31656
31709
|
return request;
|
|
31657
31710
|
}
|
|
31658
31711
|
shouldHandle(modelId) {
|
|
@@ -37046,6 +37099,9 @@ function hasModelUnsupportedWording(errorBody) {
|
|
|
37046
37099
|
const lower = (errorBody || "").toLowerCase();
|
|
37047
37100
|
return UNSUPPORTED_PHRASES.some((phrase) => lower.includes(phrase));
|
|
37048
37101
|
}
|
|
37102
|
+
function hasActionableLink(errorBody) {
|
|
37103
|
+
return /https?:\/\/\S+/i.test(errorBody || "");
|
|
37104
|
+
}
|
|
37049
37105
|
var UNSUPPORTED_PHRASES;
|
|
37050
37106
|
var init_model_unsupported = __esm(() => {
|
|
37051
37107
|
UNSUPPORTED_PHRASES = [
|
|
@@ -39256,7 +39312,7 @@ class ComposedHandler {
|
|
|
39256
39312
|
}
|
|
39257
39313
|
}
|
|
39258
39314
|
if (this.provider.transformPayload) {
|
|
39259
|
-
requestPayload = this.provider.transformPayload(requestPayload);
|
|
39315
|
+
requestPayload = this.provider.transformPayload(requestPayload, claudeRequest);
|
|
39260
39316
|
}
|
|
39261
39317
|
const endpoint = this.provider.getEndpoint(this.targetModel);
|
|
39262
39318
|
const headers = await this.provider.getHeaders();
|
|
@@ -39899,6 +39955,9 @@ function getRecoveryHint(status, errorText, providerName, transportTerminal429)
|
|
|
39899
39955
|
if (isQuotaExhaustionError(status, errorText)) {
|
|
39900
39956
|
return "Out of quota \u2014 check your plan & billing details. This won't recover on retry.";
|
|
39901
39957
|
}
|
|
39958
|
+
if (hasActionableLink(errorText)) {
|
|
39959
|
+
return "Provider rejected the request and gave a specific fix \u2014 follow the link in the message below.";
|
|
39960
|
+
}
|
|
39902
39961
|
return "Check API key / OAuth credentials.";
|
|
39903
39962
|
}
|
|
39904
39963
|
if (status === 404) {
|
|
@@ -43669,14 +43728,19 @@ var init_ollamacloud = __esm(() => {
|
|
|
43669
43728
|
});
|
|
43670
43729
|
|
|
43671
43730
|
// src/providers/transport/openai-codex.ts
|
|
43672
|
-
|
|
43731
|
+
import { createHash as createHash5, randomBytes as randomBytes6 } from "crypto";
|
|
43732
|
+
var FALLBACK_CONVERSATION_KEY, OpenAICodexTransport;
|
|
43673
43733
|
var init_openai_codex = __esm(() => {
|
|
43674
43734
|
init_codex_api_format();
|
|
43675
43735
|
init_model_catalog();
|
|
43676
43736
|
init_authority();
|
|
43737
|
+
init_harness();
|
|
43677
43738
|
init_openai();
|
|
43739
|
+
FALLBACK_CONVERSATION_KEY = randomBytes6(16).toString("hex");
|
|
43678
43740
|
OpenAICodexTransport = class OpenAICodexTransport extends OpenAIProviderTransport {
|
|
43679
43741
|
cachedAuth = null;
|
|
43742
|
+
cachedCacheKeyFor;
|
|
43743
|
+
cachedCacheKey = "";
|
|
43680
43744
|
async refreshAuth() {
|
|
43681
43745
|
try {
|
|
43682
43746
|
this.cachedAuth = await credentials.getRequestAuth("openai-codex", { model: "" });
|
|
@@ -43692,7 +43756,7 @@ var init_openai_codex = __esm(() => {
|
|
|
43692
43756
|
return { ...this.cachedAuth.headers };
|
|
43693
43757
|
return super.getHeaders();
|
|
43694
43758
|
}
|
|
43695
|
-
transformPayload(payload) {
|
|
43759
|
+
transformPayload(payload, claudeRequest) {
|
|
43696
43760
|
let normalizedPayload = payload;
|
|
43697
43761
|
if (payload?.model) {
|
|
43698
43762
|
const normalized = normalizeCodexModel(payload.model);
|
|
@@ -43700,8 +43764,24 @@ var init_openai_codex = __esm(() => {
|
|
|
43700
43764
|
normalizedPayload = { ...payload, model: normalized };
|
|
43701
43765
|
}
|
|
43702
43766
|
}
|
|
43767
|
+
if (normalizedPayload && typeof normalizedPayload === "object") {
|
|
43768
|
+
normalizedPayload = {
|
|
43769
|
+
...normalizedPayload,
|
|
43770
|
+
prompt_cache_key: normalizedPayload.prompt_cache_key ?? this.resolvePromptCacheKey(claudeRequest)
|
|
43771
|
+
};
|
|
43772
|
+
}
|
|
43703
43773
|
return this.cachedAuth?.transformPayload?.(normalizedPayload) ?? normalizedPayload;
|
|
43704
43774
|
}
|
|
43775
|
+
resolvePromptCacheKey(claudeRequest) {
|
|
43776
|
+
const sessionId2 = extractSessionId(claudeRequest);
|
|
43777
|
+
if (!sessionId2)
|
|
43778
|
+
return `claudish_${FALLBACK_CONVERSATION_KEY}`;
|
|
43779
|
+
if (this.cachedCacheKeyFor !== sessionId2) {
|
|
43780
|
+
this.cachedCacheKeyFor = sessionId2;
|
|
43781
|
+
this.cachedCacheKey = `claudish_${createHash5("sha256").update(sessionId2).digest("hex").slice(0, 32)}`;
|
|
43782
|
+
}
|
|
43783
|
+
return this.cachedCacheKey;
|
|
43784
|
+
}
|
|
43705
43785
|
getContextWindow() {
|
|
43706
43786
|
return lookupModelForProvider(this.modelName, this.name) ?? 0;
|
|
43707
43787
|
}
|
|
@@ -44522,6 +44602,7 @@ var init_provider_definitions = __esm(() => {
|
|
|
44522
44602
|
baseUrl: "https://api.z.ai",
|
|
44523
44603
|
baseUrlEnvVars: ["ZHIPU_BASE_URL", "GLM_BASE_URL"],
|
|
44524
44604
|
apiPath: "/api/paas/v4/chat/completions",
|
|
44605
|
+
modelDiscovery: { path: "/api/paas/v4/models", format: "openai-models-list" },
|
|
44525
44606
|
apiKeyEnvVar: "ZHIPU_API_KEY",
|
|
44526
44607
|
apiKeyAliases: ["GLM_API_KEY"],
|
|
44527
44608
|
apiKeyDescription: "GLM/Zhipu API Key",
|
|
@@ -48075,6 +48156,14 @@ function classifyHttpError(status, body, latencyMs) {
|
|
|
48075
48156
|
errorMessage: extractErrorMessage(body) || `HTTP ${authStatus}`
|
|
48076
48157
|
};
|
|
48077
48158
|
}
|
|
48159
|
+
if (hasActionableLink(body)) {
|
|
48160
|
+
return {
|
|
48161
|
+
state: "error",
|
|
48162
|
+
latencyMs,
|
|
48163
|
+
httpStatus: authStatus,
|
|
48164
|
+
errorMessage: extractErrorMessage(body) || `HTTP ${authStatus}`
|
|
48165
|
+
};
|
|
48166
|
+
}
|
|
48078
48167
|
return {
|
|
48079
48168
|
state: "auth-failed",
|
|
48080
48169
|
latencyMs,
|
|
@@ -48121,6 +48210,20 @@ function classifyHttpError(status, body, latencyMs) {
|
|
|
48121
48210
|
errorMessage: extractErrorMessage(body) || `HTTP ${status}`
|
|
48122
48211
|
};
|
|
48123
48212
|
}
|
|
48213
|
+
function truncateKeepingLink(text, max = 160) {
|
|
48214
|
+
if (text.length <= max)
|
|
48215
|
+
return text;
|
|
48216
|
+
const url2 = text.match(/https?:\/\/\S+/i)?.[0];
|
|
48217
|
+
if (!url2)
|
|
48218
|
+
return `${text.slice(0, max - 3)}...`;
|
|
48219
|
+
const room = max - url2.length - 4;
|
|
48220
|
+
if (room <= 0)
|
|
48221
|
+
return url2;
|
|
48222
|
+
const head = text.slice(0, room);
|
|
48223
|
+
const lastSpace = head.lastIndexOf(" ");
|
|
48224
|
+
const prose = (lastSpace > room * 0.5 ? head.slice(0, lastSpace) : head).trimEnd();
|
|
48225
|
+
return `${prose}... ${url2}`;
|
|
48226
|
+
}
|
|
48124
48227
|
function extractErrorMessage(body) {
|
|
48125
48228
|
if (!body)
|
|
48126
48229
|
return;
|
|
@@ -48128,13 +48231,13 @@ function extractErrorMessage(body) {
|
|
|
48128
48231
|
const parsed = JSON.parse(body);
|
|
48129
48232
|
const msg2 = parsed?.error?.message || parsed?.error?.error?.message || parsed?.message || parsed?.detail;
|
|
48130
48233
|
if (typeof msg2 === "string" && msg2.length > 0) {
|
|
48131
|
-
return msg2
|
|
48234
|
+
return truncateKeepingLink(msg2);
|
|
48132
48235
|
}
|
|
48133
48236
|
} catch {}
|
|
48134
48237
|
const trimmed2 = body.trim();
|
|
48135
48238
|
if (!trimmed2)
|
|
48136
48239
|
return;
|
|
48137
|
-
return trimmed2
|
|
48240
|
+
return truncateKeepingLink(trimmed2);
|
|
48138
48241
|
}
|
|
48139
48242
|
async function consumeProbeStream(response, timeoutMs, startedAt) {
|
|
48140
48243
|
const body = response.body;
|
|
@@ -51893,6 +51996,41 @@ var exports_proxy_server = {};
|
|
|
51893
51996
|
__export(exports_proxy_server, {
|
|
51894
51997
|
createProxyServer: () => createProxyServer
|
|
51895
51998
|
});
|
|
51999
|
+
import { appendFileSync as appendFileSync7, mkdirSync as mkdirSync13 } from "fs";
|
|
52000
|
+
import { join as join29 } from "path";
|
|
52001
|
+
function maybeCaptureClassifierRequest(c, body) {
|
|
52002
|
+
if (!process.env.CLAUDISH_CLASSIFIER_DEBUG)
|
|
52003
|
+
return;
|
|
52004
|
+
try {
|
|
52005
|
+
const dir = join29(process.cwd(), "logs");
|
|
52006
|
+
if (!classifierCaptureDirReady) {
|
|
52007
|
+
mkdirSync13(dir, { recursive: true });
|
|
52008
|
+
classifierCaptureDirReady = true;
|
|
52009
|
+
}
|
|
52010
|
+
const record4 = {
|
|
52011
|
+
ts: new Date().toISOString(),
|
|
52012
|
+
model: body?.model,
|
|
52013
|
+
stream: body?.stream,
|
|
52014
|
+
max_tokens: body?.max_tokens,
|
|
52015
|
+
temperature: body?.temperature,
|
|
52016
|
+
top_p: body?.top_p,
|
|
52017
|
+
top_k: body?.top_k,
|
|
52018
|
+
thinking: body?.thinking,
|
|
52019
|
+
hasTools: Array.isArray(body?.tools) && body.tools.length > 0,
|
|
52020
|
+
tool_choice: body?.tool_choice,
|
|
52021
|
+
system: body?.system,
|
|
52022
|
+
headers: {
|
|
52023
|
+
"anthropic-beta": c.req.header("anthropic-beta") ?? null,
|
|
52024
|
+
"anthropic-version": c.req.header("anthropic-version") ?? null,
|
|
52025
|
+
"x-app": c.req.header("x-app") ?? null,
|
|
52026
|
+
authorization: c.req.header("authorization") ? "Bearer <present>" : null,
|
|
52027
|
+
"x-api-key": c.req.header("x-api-key") ? "<present>" : null
|
|
52028
|
+
}
|
|
52029
|
+
};
|
|
52030
|
+
appendFileSync7(join29(dir, "classifier-capture.jsonl"), `${JSON.stringify(record4)}
|
|
52031
|
+
`);
|
|
52032
|
+
} catch {}
|
|
52033
|
+
}
|
|
51896
52034
|
async function createProxyServer(port, _openrouterApiKey, model, monitorMode = false, anthropicApiKey, modelMap, options = {}) {
|
|
51897
52035
|
try {
|
|
51898
52036
|
const config2 = loadConfig();
|
|
@@ -52304,6 +52442,12 @@ ${plan.hint}` : `[Route] ${plan.reason}`;
|
|
|
52304
52442
|
try {
|
|
52305
52443
|
const body = await c.req.json();
|
|
52306
52444
|
log(`[RequestMeta] model=${body.model} output_config=${JSON.stringify(body.output_config) ?? "(none)"} metadata=${JSON.stringify(body.metadata) ?? "(none)"} anthropic-beta=${c.req.header("anthropic-beta") ?? "(none)"}`);
|
|
52445
|
+
maybeCaptureClassifierRequest(c, body);
|
|
52446
|
+
if (!monitorMode && options.classifier?.enabled && isAutoModeClassifierRequest(body)) {
|
|
52447
|
+
log(`[Classifier] auto-mode permission classifier \u2192 native Anthropic (model ${body.model} \u2192 ${options.classifier.model})`);
|
|
52448
|
+
rewriteClassifierForNative(body, options.classifier.model);
|
|
52449
|
+
return nativeHandler.handle(c, body);
|
|
52450
|
+
}
|
|
52307
52451
|
const handler = await getHandlerForRequest(body.model);
|
|
52308
52452
|
return await handler.handle(c, body);
|
|
52309
52453
|
} catch (e) {
|
|
@@ -52349,7 +52493,7 @@ ${plan.hint}` : `[Route] ${plan.reason}`;
|
|
|
52349
52493
|
}
|
|
52350
52494
|
};
|
|
52351
52495
|
}
|
|
52352
|
-
var RoutingError;
|
|
52496
|
+
var RoutingError, classifierCaptureDirReady = false;
|
|
52353
52497
|
var init_proxy_server = __esm(() => {
|
|
52354
52498
|
init_dist();
|
|
52355
52499
|
init_cors();
|
|
@@ -52429,12 +52573,12 @@ var init_redact = __esm(() => {
|
|
|
52429
52573
|
|
|
52430
52574
|
// src/team-stats.ts
|
|
52431
52575
|
import { existsSync as existsSync20, readFileSync as readFileSync19, writeFileSync as writeFileSync12 } from "fs";
|
|
52432
|
-
import { join as
|
|
52576
|
+
import { join as join30 } from "path";
|
|
52433
52577
|
function statsDir(sessionPath) {
|
|
52434
|
-
return
|
|
52578
|
+
return join30(sessionPath, "stats");
|
|
52435
52579
|
}
|
|
52436
52580
|
function tokenFileFor(sessionPath, anonId) {
|
|
52437
|
-
return
|
|
52581
|
+
return join30(statsDir(sessionPath), `${anonId}.json`);
|
|
52438
52582
|
}
|
|
52439
52583
|
function readTokenStats(sessionPath, anonId) {
|
|
52440
52584
|
const path = tokenFileFor(sessionPath, anonId);
|
|
@@ -52589,7 +52733,7 @@ ${segs.join(" \xB7 ")}`;
|
|
|
52589
52733
|
}
|
|
52590
52734
|
function writeStatusFile(sessionPath, manifest, status, opts) {
|
|
52591
52735
|
try {
|
|
52592
|
-
writeFileSync12(
|
|
52736
|
+
writeFileSync12(join30(sessionPath, "status.txt"), `${renderTeamStats(sessionPath, manifest, status, opts)}
|
|
52593
52737
|
`, "utf-8");
|
|
52594
52738
|
} catch {}
|
|
52595
52739
|
}
|
|
@@ -52741,12 +52885,12 @@ import { spawn as spawn2 } from "child_process";
|
|
|
52741
52885
|
import {
|
|
52742
52886
|
createWriteStream as createWriteStream2,
|
|
52743
52887
|
existsSync as existsSync21,
|
|
52744
|
-
mkdirSync as
|
|
52888
|
+
mkdirSync as mkdirSync14,
|
|
52745
52889
|
readFileSync as readFileSync20,
|
|
52746
52890
|
readdirSync as readdirSync3,
|
|
52747
52891
|
writeFileSync as writeFileSync13
|
|
52748
52892
|
} from "fs";
|
|
52749
|
-
import { join as
|
|
52893
|
+
import { join as join31, resolve as resolve3 } from "path";
|
|
52750
52894
|
function resolveCaptureMode(explicit, env = process.env) {
|
|
52751
52895
|
if (explicit)
|
|
52752
52896
|
return explicit;
|
|
@@ -52843,18 +52987,18 @@ function setupSession(sessionPath, models, input) {
|
|
|
52843
52987
|
if (models.length === 0) {
|
|
52844
52988
|
throw new Error("At least one model is required");
|
|
52845
52989
|
}
|
|
52846
|
-
if (existsSync21(
|
|
52990
|
+
if (existsSync21(join31(sessionPath, "manifest.json"))) {
|
|
52847
52991
|
throw new Error(`Session already exists at ${sessionPath}. Use a new directory path or delete the existing session first.`);
|
|
52848
52992
|
}
|
|
52849
52993
|
const sentinels = models.filter(isSentinelModel);
|
|
52850
52994
|
if (sentinels.length > 0) {
|
|
52851
52995
|
throw new Error(`Invalid model(s) for team run: ${sentinels.join(", ")}. These are Claude Code agent selectors, not external model IDs. Use real external models (e.g., "gemini-2.0-flash", "gpt-4o", "or@deepseek/deepseek-r1"). For Claude models, use a Task agent instead of the team tool.`);
|
|
52852
52996
|
}
|
|
52853
|
-
|
|
52854
|
-
|
|
52997
|
+
mkdirSync14(join31(sessionPath, "work"), { recursive: true });
|
|
52998
|
+
mkdirSync14(join31(sessionPath, "errors"), { recursive: true });
|
|
52855
52999
|
if (input !== undefined) {
|
|
52856
|
-
writeFileSync13(
|
|
52857
|
-
} else if (!existsSync21(
|
|
53000
|
+
writeFileSync13(join31(sessionPath, "input.md"), input, "utf-8");
|
|
53001
|
+
} else if (!existsSync21(join31(sessionPath, "input.md"))) {
|
|
52858
53002
|
throw new Error(`No input.md found at ${sessionPath} and no input provided`);
|
|
52859
53003
|
}
|
|
52860
53004
|
const ids = models.map((_, i) => String(i + 1).padStart(2, "0"));
|
|
@@ -52871,9 +53015,9 @@ function setupSession(sessionPath, models, input) {
|
|
|
52871
53015
|
model: models[i],
|
|
52872
53016
|
assignedAt: now
|
|
52873
53017
|
};
|
|
52874
|
-
|
|
53018
|
+
mkdirSync14(join31(sessionPath, "work", anonId), { recursive: true });
|
|
52875
53019
|
}
|
|
52876
|
-
writeFileSync13(
|
|
53020
|
+
writeFileSync13(join31(sessionPath, "manifest.json"), JSON.stringify(manifest, null, 2), "utf-8");
|
|
52877
53021
|
const status = {
|
|
52878
53022
|
startedAt: now,
|
|
52879
53023
|
models: Object.fromEntries(Object.keys(manifest.models).map((id) => [
|
|
@@ -52887,7 +53031,7 @@ function setupSession(sessionPath, models, input) {
|
|
|
52887
53031
|
}
|
|
52888
53032
|
]))
|
|
52889
53033
|
};
|
|
52890
|
-
writeFileSync13(
|
|
53034
|
+
writeFileSync13(join31(sessionPath, "status.json"), JSON.stringify(status, null, 2), "utf-8");
|
|
52891
53035
|
return manifest;
|
|
52892
53036
|
}
|
|
52893
53037
|
function assertValidRequirePattern(pattern) {
|
|
@@ -52912,9 +53056,9 @@ function readFullOutputIfNeeded(opts) {
|
|
|
52912
53056
|
async function runModels(sessionPath, opts = {}) {
|
|
52913
53057
|
const timeoutMs = (opts.timeout ?? 300) * 1000;
|
|
52914
53058
|
assertValidRequirePattern(opts.requirePattern);
|
|
52915
|
-
const manifest = JSON.parse(readFileSync20(
|
|
52916
|
-
const statusPath =
|
|
52917
|
-
const inputPath =
|
|
53059
|
+
const manifest = JSON.parse(readFileSync20(join31(sessionPath, "manifest.json"), "utf-8"));
|
|
53060
|
+
const statusPath = join31(sessionPath, "status.json");
|
|
53061
|
+
const inputPath = join31(sessionPath, "input.md");
|
|
52918
53062
|
const inputContent = readFileSync20(inputPath, "utf-8");
|
|
52919
53063
|
const spawnPlan = await (opts.spawnPlanner ?? prehydrateCredentialsForSpawn)(Object.values(manifest.models).map((m) => m.model));
|
|
52920
53064
|
const statusCache = JSON.parse(readFileSync20(statusPath, "utf-8"));
|
|
@@ -52953,7 +53097,7 @@ async function runModels(sessionPath, opts = {}) {
|
|
|
52953
53097
|
persistErrorLog(rt.errorLogPath, `RECOVERED: ${note}`, stderr, stdoutTail);
|
|
52954
53098
|
opts.onStatusChange?.(id, statusCache.models[id]);
|
|
52955
53099
|
}
|
|
52956
|
-
|
|
53100
|
+
mkdirSync14(statsDir(sessionPath), { recursive: true });
|
|
52957
53101
|
const processes = new Map;
|
|
52958
53102
|
const runtimes = new Map;
|
|
52959
53103
|
const sigintHandler = () => {
|
|
@@ -52965,8 +53109,8 @@ async function runModels(sessionPath, opts = {}) {
|
|
|
52965
53109
|
process.on("SIGINT", sigintHandler);
|
|
52966
53110
|
const completionPromises = [];
|
|
52967
53111
|
for (const [anonId, entry] of Object.entries(manifest.models)) {
|
|
52968
|
-
const outputPath =
|
|
52969
|
-
const errorLogPath =
|
|
53112
|
+
const outputPath = join31(sessionPath, `response-${anonId}.md`);
|
|
53113
|
+
const errorLogPath = join31(sessionPath, "errors", `${anonId}.log`);
|
|
52970
53114
|
const spawnModel = spawnPlan.pinned.get(entry.model) ?? entry.model;
|
|
52971
53115
|
const args = [
|
|
52972
53116
|
"--model",
|
|
@@ -53192,7 +53336,7 @@ async function runModels(sessionPath, opts = {}) {
|
|
|
53192
53336
|
opts.onStatusChange?.(id, statusCache.models[id]);
|
|
53193
53337
|
const stopped = await terminateChildTree(proc);
|
|
53194
53338
|
if (!stopped) {
|
|
53195
|
-
persistErrorLog(rt?.errorLogPath ??
|
|
53339
|
+
persistErrorLog(rt?.errorLogPath ?? join31(sessionPath, "errors", `${id}.log`), "TIMEOUT: child survived SIGKILL \u2014 it may still be running and billing", stderr, stdoutTail);
|
|
53196
53340
|
}
|
|
53197
53341
|
};
|
|
53198
53342
|
const allDone = Promise.all(completionPromises);
|
|
@@ -53251,23 +53395,23 @@ async function judgeResponses(sessionPath, opts = {}) {
|
|
|
53251
53395
|
const responses = {};
|
|
53252
53396
|
for (const file2 of responseFiles) {
|
|
53253
53397
|
const id = file2.replace(/^response-/, "").replace(/\.md$/, "");
|
|
53254
|
-
responses[id] = readFileSync20(
|
|
53398
|
+
responses[id] = readFileSync20(join31(sessionPath, file2), "utf-8");
|
|
53255
53399
|
}
|
|
53256
|
-
const input = readFileSync20(
|
|
53400
|
+
const input = readFileSync20(join31(sessionPath, "input.md"), "utf-8");
|
|
53257
53401
|
const judgePrompt = buildJudgePrompt(input, responses);
|
|
53258
|
-
writeFileSync13(
|
|
53402
|
+
writeFileSync13(join31(sessionPath, "judge-prompt.md"), judgePrompt, "utf-8");
|
|
53259
53403
|
const judgeModels = opts.judges ?? getDefaultJudgeModels(sessionPath);
|
|
53260
|
-
const judgePath =
|
|
53261
|
-
|
|
53404
|
+
const judgePath = join31(sessionPath, "judging");
|
|
53405
|
+
mkdirSync14(judgePath, { recursive: true });
|
|
53262
53406
|
setupSession(judgePath, judgeModels, judgePrompt);
|
|
53263
53407
|
await runModels(judgePath, { claudeFlags: opts.claudeFlags });
|
|
53264
53408
|
const votes = parseJudgeVotes(judgePath, Object.keys(responses));
|
|
53265
53409
|
const verdict = aggregateVerdict(votes, Object.keys(responses));
|
|
53266
|
-
writeFileSync13(
|
|
53410
|
+
writeFileSync13(join31(sessionPath, "verdict.md"), formatVerdict(verdict, sessionPath), "utf-8");
|
|
53267
53411
|
return verdict;
|
|
53268
53412
|
}
|
|
53269
53413
|
function getStatus(sessionPath) {
|
|
53270
|
-
return JSON.parse(readFileSync20(
|
|
53414
|
+
return JSON.parse(readFileSync20(join31(sessionPath, "status.json"), "utf-8"));
|
|
53271
53415
|
}
|
|
53272
53416
|
function fisherYatesShuffle(arr) {
|
|
53273
53417
|
for (let i = arr.length - 1;i > 0; i--) {
|
|
@@ -53277,7 +53421,7 @@ function fisherYatesShuffle(arr) {
|
|
|
53277
53421
|
return arr;
|
|
53278
53422
|
}
|
|
53279
53423
|
function getDefaultJudgeModels(sessionPath) {
|
|
53280
|
-
const manifest = JSON.parse(readFileSync20(
|
|
53424
|
+
const manifest = JSON.parse(readFileSync20(join31(sessionPath, "manifest.json"), "utf-8"));
|
|
53281
53425
|
return Object.values(manifest.models).map((e) => e.model);
|
|
53282
53426
|
}
|
|
53283
53427
|
function buildJudgePrompt(input, responses) {
|
|
@@ -53340,7 +53484,7 @@ function parseJudgeVotes(judgePath, responseIds) {
|
|
|
53340
53484
|
const judgeId = file2.replace(/^response-/, "").replace(/\.md$/, "");
|
|
53341
53485
|
let content;
|
|
53342
53486
|
try {
|
|
53343
|
-
content = readFileSync20(
|
|
53487
|
+
content = readFileSync20(join31(judgePath, file2), "utf-8");
|
|
53344
53488
|
} catch {
|
|
53345
53489
|
continue;
|
|
53346
53490
|
}
|
|
@@ -53392,7 +53536,7 @@ function aggregateVerdict(votes, responseIds) {
|
|
|
53392
53536
|
function formatVerdict(verdict, sessionPath) {
|
|
53393
53537
|
let manifest = null;
|
|
53394
53538
|
try {
|
|
53395
|
-
manifest = JSON.parse(readFileSync20(
|
|
53539
|
+
manifest = JSON.parse(readFileSync20(join31(sessionPath, "manifest.json"), "utf-8"));
|
|
53396
53540
|
} catch {}
|
|
53397
53541
|
let output = `# Team Verdict
|
|
53398
53542
|
|
|
@@ -53453,9 +53597,9 @@ __export(exports_mcp_server, {
|
|
|
53453
53597
|
parseAnthropicSse: () => parseAnthropicSse,
|
|
53454
53598
|
formatTeamResult: () => formatTeamResult
|
|
53455
53599
|
});
|
|
53456
|
-
import { existsSync as existsSync22, mkdirSync as
|
|
53600
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync15, readFileSync as readFileSync21, readdirSync as readdirSync4, writeFileSync as writeFileSync14 } from "fs";
|
|
53457
53601
|
import { homedir as homedir29 } from "os";
|
|
53458
|
-
import { dirname as dirname9, join as
|
|
53602
|
+
import { dirname as dirname9, join as join32, resolve as resolve4 } from "path";
|
|
53459
53603
|
import { fileURLToPath } from "url";
|
|
53460
53604
|
async function loadAllModels(forceRefresh = false) {
|
|
53461
53605
|
if (!forceRefresh && existsSync22(ALL_MODELS_CACHE_PATH2)) {
|
|
@@ -53474,7 +53618,7 @@ async function loadAllModels(forceRefresh = false) {
|
|
|
53474
53618
|
throw new Error(`API returned ${response.status}`);
|
|
53475
53619
|
const data = await response.json();
|
|
53476
53620
|
const models = data.data || [];
|
|
53477
|
-
|
|
53621
|
+
mkdirSync15(CLAUDISH_CACHE_DIR, { recursive: true });
|
|
53478
53622
|
writeFileSync14(ALL_MODELS_CACHE_PATH2, JSON.stringify({ lastUpdated: new Date().toISOString(), models }), "utf-8");
|
|
53479
53623
|
return models;
|
|
53480
53624
|
} catch {
|
|
@@ -54194,16 +54338,16 @@ Use with: run_prompt(model="${results[0].model.id}", prompt="your prompt")`;
|
|
|
54194
54338
|
const sp = session_path;
|
|
54195
54339
|
for (const file2 of ["status.json", "manifest.json", "input.md"]) {
|
|
54196
54340
|
try {
|
|
54197
|
-
sessionData[file2] = readFileSync21(
|
|
54341
|
+
sessionData[file2] = readFileSync21(join32(sp, file2), "utf-8");
|
|
54198
54342
|
} catch {}
|
|
54199
54343
|
}
|
|
54200
54344
|
try {
|
|
54201
|
-
const errorDir =
|
|
54345
|
+
const errorDir = join32(sp, "errors");
|
|
54202
54346
|
if (existsSync22(errorDir)) {
|
|
54203
54347
|
for (const f of readdirSync4(errorDir)) {
|
|
54204
54348
|
if (f.endsWith(".log")) {
|
|
54205
54349
|
try {
|
|
54206
|
-
sessionData[`errors/${f}`] = readFileSync21(
|
|
54350
|
+
sessionData[`errors/${f}`] = readFileSync21(join32(errorDir, f), "utf-8");
|
|
54207
54351
|
} catch {}
|
|
54208
54352
|
}
|
|
54209
54353
|
}
|
|
@@ -54213,7 +54357,7 @@ Use with: run_prompt(model="${results[0].model.id}", prompt="your prompt")`;
|
|
|
54213
54357
|
for (const f of readdirSync4(sp)) {
|
|
54214
54358
|
if (f.startsWith("response-") && f.endsWith(".md")) {
|
|
54215
54359
|
try {
|
|
54216
|
-
const content = readFileSync21(
|
|
54360
|
+
const content = readFileSync21(join32(sp, f), "utf-8");
|
|
54217
54361
|
sessionData[f] = content.slice(0, 200) + (content.length > 200 ? "... (truncated)" : "");
|
|
54218
54362
|
} catch {}
|
|
54219
54363
|
}
|
|
@@ -54222,7 +54366,7 @@ Use with: run_prompt(model="${results[0].model.id}", prompt="your prompt")`;
|
|
|
54222
54366
|
}
|
|
54223
54367
|
let version2 = "unknown";
|
|
54224
54368
|
try {
|
|
54225
|
-
const pkgPath =
|
|
54369
|
+
const pkgPath = join32(__dirname2, "../package.json");
|
|
54226
54370
|
if (existsSync22(pkgPath)) {
|
|
54227
54371
|
version2 = JSON.parse(readFileSync21(pkgPath, "utf-8")).version;
|
|
54228
54372
|
}
|
|
@@ -54643,8 +54787,8 @@ var init_mcp_server = __esm(() => {
|
|
|
54643
54787
|
import_dotenv2.config({ quiet: true });
|
|
54644
54788
|
__filename2 = fileURLToPath(import.meta.url);
|
|
54645
54789
|
__dirname2 = dirname9(__filename2);
|
|
54646
|
-
CLAUDISH_CACHE_DIR =
|
|
54647
|
-
ALL_MODELS_CACHE_PATH2 =
|
|
54790
|
+
CLAUDISH_CACHE_DIR = join32(homedir29(), ".claudish");
|
|
54791
|
+
ALL_MODELS_CACHE_PATH2 = join32(CLAUDISH_CACHE_DIR, "all-models.json");
|
|
54648
54792
|
NEXT_STEP = {
|
|
54649
54793
|
nonzero_exit: "read the evidence log, then retry or drop the model",
|
|
54650
54794
|
timeout: "raise `timeout`, or pick a faster model",
|
|
@@ -54768,6 +54912,208 @@ var init_serve_command = __esm(() => {
|
|
|
54768
54912
|
init_proxy_server();
|
|
54769
54913
|
});
|
|
54770
54914
|
|
|
54915
|
+
// src/theme/theme-mode.ts
|
|
54916
|
+
var exports_theme_mode = {};
|
|
54917
|
+
__export(exports_theme_mode, {
|
|
54918
|
+
themeModeOverride: () => themeModeOverride,
|
|
54919
|
+
themeModeFromColorFgBg: () => themeModeFromColorFgBg,
|
|
54920
|
+
setThemeMode: () => setThemeMode,
|
|
54921
|
+
resetThemeModeForTests: () => resetThemeModeForTests,
|
|
54922
|
+
relativeLuminance: () => relativeLuminance,
|
|
54923
|
+
queryTerminalThemeMode: () => queryTerminalThemeMode,
|
|
54924
|
+
onThemeModeChange: () => onThemeModeChange,
|
|
54925
|
+
getThemeMode: () => getThemeMode,
|
|
54926
|
+
detectAndSetThemeModeSync: () => detectAndSetThemeModeSync,
|
|
54927
|
+
detectAndSetThemeMode: () => detectAndSetThemeMode,
|
|
54928
|
+
classifyOscBackground: () => classifyOscBackground
|
|
54929
|
+
});
|
|
54930
|
+
function getThemeMode() {
|
|
54931
|
+
return detected;
|
|
54932
|
+
}
|
|
54933
|
+
function setThemeMode(mode) {
|
|
54934
|
+
detected = mode;
|
|
54935
|
+
for (const cb of listeners)
|
|
54936
|
+
cb(mode);
|
|
54937
|
+
}
|
|
54938
|
+
function onThemeModeChange(cb) {
|
|
54939
|
+
listeners.push(cb);
|
|
54940
|
+
cb(detected);
|
|
54941
|
+
}
|
|
54942
|
+
function resetThemeModeForTests() {
|
|
54943
|
+
setThemeMode(null);
|
|
54944
|
+
}
|
|
54945
|
+
function themeModeOverride(env = process.env) {
|
|
54946
|
+
const raw2 = env.CLAUDISH_THEME?.trim().toLowerCase();
|
|
54947
|
+
if (raw2 === "light" || raw2 === "dark")
|
|
54948
|
+
return raw2;
|
|
54949
|
+
return null;
|
|
54950
|
+
}
|
|
54951
|
+
function themeModeFromColorFgBg(env = process.env) {
|
|
54952
|
+
const raw2 = env.COLORFGBG;
|
|
54953
|
+
if (!raw2)
|
|
54954
|
+
return null;
|
|
54955
|
+
const last = raw2.split(";").pop()?.trim();
|
|
54956
|
+
if (!last || !/^\d+$/.test(last))
|
|
54957
|
+
return null;
|
|
54958
|
+
const bg = Number.parseInt(last, 10);
|
|
54959
|
+
if (bg === 7 || bg === 15)
|
|
54960
|
+
return "light";
|
|
54961
|
+
if (bg <= 8)
|
|
54962
|
+
return "dark";
|
|
54963
|
+
return null;
|
|
54964
|
+
}
|
|
54965
|
+
function relativeLuminance(r, g, b) {
|
|
54966
|
+
const lin = (c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
54967
|
+
return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
|
|
54968
|
+
}
|
|
54969
|
+
function classifyOscBackground(reply) {
|
|
54970
|
+
const m = reply.match(/\]11;rgb:([0-9a-fA-F]{1,4})\/([0-9a-fA-F]{1,4})\/([0-9a-fA-F]{1,4})/);
|
|
54971
|
+
if (!m)
|
|
54972
|
+
return null;
|
|
54973
|
+
const channel = (hex3) => {
|
|
54974
|
+
const max = 16 ** hex3.length - 1;
|
|
54975
|
+
return Number.parseInt(hex3, 16) / max;
|
|
54976
|
+
};
|
|
54977
|
+
const lum = relativeLuminance(channel(m[1]), channel(m[2]), channel(m[3]));
|
|
54978
|
+
return lum >= MID_SRGB_LUMINANCE ? "light" : "dark";
|
|
54979
|
+
}
|
|
54980
|
+
async function queryTerminalThemeMode(timeoutMs = 150) {
|
|
54981
|
+
const stdin = process.stdin;
|
|
54982
|
+
const stdout = process.stdout;
|
|
54983
|
+
if (!stdin.isTTY || !stdout.isTTY || typeof stdin.setRawMode !== "function")
|
|
54984
|
+
return null;
|
|
54985
|
+
if (process.env.TERM === "dumb")
|
|
54986
|
+
return null;
|
|
54987
|
+
return await new Promise((resolve5) => {
|
|
54988
|
+
let buffer = "";
|
|
54989
|
+
let settled = false;
|
|
54990
|
+
const wasRaw = stdin.isRaw === true;
|
|
54991
|
+
const finish = (mode) => {
|
|
54992
|
+
if (settled)
|
|
54993
|
+
return;
|
|
54994
|
+
settled = true;
|
|
54995
|
+
clearTimeout(timer);
|
|
54996
|
+
stdin.off("data", onData);
|
|
54997
|
+
try {
|
|
54998
|
+
if (!wasRaw)
|
|
54999
|
+
stdin.setRawMode(false);
|
|
55000
|
+
stdin.pause();
|
|
55001
|
+
} catch {}
|
|
55002
|
+
resolve5(mode);
|
|
55003
|
+
};
|
|
55004
|
+
const onData = (chunk) => {
|
|
55005
|
+
buffer += chunk.toString("latin1");
|
|
55006
|
+
if (/\]11;[^\x07\x1b]*(\x07|\x1b\\)/.test(buffer)) {
|
|
55007
|
+
finish(classifyOscBackground(buffer));
|
|
55008
|
+
}
|
|
55009
|
+
};
|
|
55010
|
+
const timer = setTimeout(() => finish(null), timeoutMs);
|
|
55011
|
+
try {
|
|
55012
|
+
if (!wasRaw)
|
|
55013
|
+
stdin.setRawMode(true);
|
|
55014
|
+
stdin.resume();
|
|
55015
|
+
stdin.on("data", onData);
|
|
55016
|
+
stdout.write("\x1B]11;?\x07");
|
|
55017
|
+
} catch {
|
|
55018
|
+
finish(null);
|
|
55019
|
+
}
|
|
55020
|
+
});
|
|
55021
|
+
}
|
|
55022
|
+
async function detectAndSetThemeMode() {
|
|
55023
|
+
const override = themeModeOverride();
|
|
55024
|
+
if (override) {
|
|
55025
|
+
setThemeMode(override);
|
|
55026
|
+
return override;
|
|
55027
|
+
}
|
|
55028
|
+
const fromEnv = themeModeFromColorFgBg();
|
|
55029
|
+
if (fromEnv) {
|
|
55030
|
+
setThemeMode(fromEnv);
|
|
55031
|
+
return fromEnv;
|
|
55032
|
+
}
|
|
55033
|
+
const fromOsc = await queryTerminalThemeMode();
|
|
55034
|
+
setThemeMode(fromOsc);
|
|
55035
|
+
return fromOsc;
|
|
55036
|
+
}
|
|
55037
|
+
function detectAndSetThemeModeSync() {
|
|
55038
|
+
const mode = themeModeOverride() ?? themeModeFromColorFgBg();
|
|
55039
|
+
if (mode)
|
|
55040
|
+
setThemeMode(mode);
|
|
55041
|
+
return mode ?? detected;
|
|
55042
|
+
}
|
|
55043
|
+
var detected = null, listeners, MID_SRGB_LUMINANCE;
|
|
55044
|
+
var init_theme_mode = __esm(() => {
|
|
55045
|
+
listeners = [];
|
|
55046
|
+
MID_SRGB_LUMINANCE = relativeLuminance(0.5, 0.5, 0.5);
|
|
55047
|
+
});
|
|
55048
|
+
|
|
55049
|
+
// src/theme/ansi.ts
|
|
55050
|
+
function fgHex(hex3) {
|
|
55051
|
+
const r = Number.parseInt(hex3.slice(1, 3), 16);
|
|
55052
|
+
const g = Number.parseInt(hex3.slice(3, 5), 16);
|
|
55053
|
+
const b = Number.parseInt(hex3.slice(5, 7), 16);
|
|
55054
|
+
return `\x1B[38;2;${r};${g};${b}m`;
|
|
55055
|
+
}
|
|
55056
|
+
function bgHex(hex3) {
|
|
55057
|
+
const r = Number.parseInt(hex3.slice(1, 3), 16);
|
|
55058
|
+
const g = Number.parseInt(hex3.slice(3, 5), 16);
|
|
55059
|
+
const b = Number.parseInt(hex3.slice(5, 7), 16);
|
|
55060
|
+
return `\x1B[48;2;${r};${g};${b}m`;
|
|
55061
|
+
}
|
|
55062
|
+
function cliAnsi() {
|
|
55063
|
+
if (process.env.NO_COLOR)
|
|
55064
|
+
return NONE;
|
|
55065
|
+
return getThemeMode() === "light" ? LIGHT : CLASSIC;
|
|
55066
|
+
}
|
|
55067
|
+
var CLASSIC, LIGHT, NONE;
|
|
55068
|
+
var init_ansi = __esm(() => {
|
|
55069
|
+
init_theme_mode();
|
|
55070
|
+
CLASSIC = {
|
|
55071
|
+
RESET: "\x1B[0m",
|
|
55072
|
+
BOLD: "\x1B[1m",
|
|
55073
|
+
DIM: "\x1B[2m",
|
|
55074
|
+
ITALIC: "\x1B[3m",
|
|
55075
|
+
GREEN: "\x1B[32m",
|
|
55076
|
+
BRIGHT_GREEN: "\x1B[92m",
|
|
55077
|
+
RED: "\x1B[31m",
|
|
55078
|
+
YELLOW: "\x1B[33m",
|
|
55079
|
+
CYAN: "\x1B[36m",
|
|
55080
|
+
BLUE: "\x1B[34m",
|
|
55081
|
+
MAGENTA: "\x1B[35m",
|
|
55082
|
+
GRAY: "\x1B[90m",
|
|
55083
|
+
STRONG: "\x1B[37m"
|
|
55084
|
+
};
|
|
55085
|
+
LIGHT = {
|
|
55086
|
+
RESET: "\x1B[0m",
|
|
55087
|
+
BOLD: "\x1B[1m",
|
|
55088
|
+
DIM: "\x1B[2m",
|
|
55089
|
+
ITALIC: "\x1B[3m",
|
|
55090
|
+
GREEN: fgHex("#15803d"),
|
|
55091
|
+
BRIGHT_GREEN: fgHex("#166534"),
|
|
55092
|
+
RED: fgHex("#dc2626"),
|
|
55093
|
+
YELLOW: fgHex("#a16207"),
|
|
55094
|
+
CYAN: fgHex("#0e7490"),
|
|
55095
|
+
BLUE: fgHex("#1d4ed8"),
|
|
55096
|
+
MAGENTA: fgHex("#9333ea"),
|
|
55097
|
+
GRAY: fgHex("#6b7280"),
|
|
55098
|
+
STRONG: fgHex("#111827")
|
|
55099
|
+
};
|
|
55100
|
+
NONE = {
|
|
55101
|
+
RESET: "",
|
|
55102
|
+
BOLD: "",
|
|
55103
|
+
DIM: "",
|
|
55104
|
+
ITALIC: "",
|
|
55105
|
+
GREEN: "",
|
|
55106
|
+
BRIGHT_GREEN: "",
|
|
55107
|
+
RED: "",
|
|
55108
|
+
YELLOW: "",
|
|
55109
|
+
CYAN: "",
|
|
55110
|
+
BLUE: "",
|
|
55111
|
+
MAGENTA: "",
|
|
55112
|
+
GRAY: "",
|
|
55113
|
+
STRONG: ""
|
|
55114
|
+
};
|
|
55115
|
+
});
|
|
55116
|
+
|
|
54771
55117
|
// src/behavior-command.ts
|
|
54772
55118
|
var exports_behavior_command = {};
|
|
54773
55119
|
__export(exports_behavior_command, {
|
|
@@ -54953,10 +55299,23 @@ Usage:
|
|
|
54953
55299
|
process.exit(1);
|
|
54954
55300
|
}
|
|
54955
55301
|
}
|
|
54956
|
-
var green = (s) =>
|
|
55302
|
+
var green = (s) => {
|
|
55303
|
+
const a = cliAnsi();
|
|
55304
|
+
return `${a.GREEN}${s}${a.RESET}`;
|
|
55305
|
+
}, yellow = (s) => {
|
|
55306
|
+
const a = cliAnsi();
|
|
55307
|
+
return `${a.YELLOW}${s}${a.RESET}`;
|
|
55308
|
+
}, dim2 = (s) => {
|
|
55309
|
+
const a = cliAnsi();
|
|
55310
|
+
return `${a.DIM}${s}${a.RESET}`;
|
|
55311
|
+
}, bold2 = (s) => {
|
|
55312
|
+
const a = cliAnsi();
|
|
55313
|
+
return `${a.BOLD}${s}${a.RESET}`;
|
|
55314
|
+
};
|
|
54957
55315
|
var init_behavior_command = __esm(() => {
|
|
54958
55316
|
init_behavior();
|
|
54959
55317
|
init_profile_config();
|
|
55318
|
+
init_ansi();
|
|
54960
55319
|
});
|
|
54961
55320
|
|
|
54962
55321
|
// src/team-grid.ts
|
|
@@ -54968,7 +55327,7 @@ import { spawn as spawn3 } from "child_process";
|
|
|
54968
55327
|
import { execSync } from "child_process";
|
|
54969
55328
|
import { existsSync as existsSync25, readFileSync as readFileSync24, writeFileSync as writeFileSync16 } from "fs";
|
|
54970
55329
|
import { connect as netConnect } from "net";
|
|
54971
|
-
import { dirname as dirname10, join as
|
|
55330
|
+
import { dirname as dirname10, join as join33 } from "path";
|
|
54972
55331
|
import { setTimeout as wait } from "timers/promises";
|
|
54973
55332
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
54974
55333
|
function resolveRouteInfo(modelId) {
|
|
@@ -55062,17 +55421,17 @@ function buildPaneHeader(model, prompt, bg) {
|
|
|
55062
55421
|
function findMagmuxBinary() {
|
|
55063
55422
|
const thisFile = fileURLToPath2(import.meta.url);
|
|
55064
55423
|
const thisDir = dirname10(thisFile);
|
|
55065
|
-
const pkgRoot =
|
|
55424
|
+
const pkgRoot = join33(thisDir, "..");
|
|
55066
55425
|
const platform2 = process.platform;
|
|
55067
55426
|
const arch = process.arch;
|
|
55068
|
-
const bundledMagmux =
|
|
55427
|
+
const bundledMagmux = join33(pkgRoot, "native", `magmux-${platform2}-${arch}`);
|
|
55069
55428
|
if (existsSync25(bundledMagmux))
|
|
55070
55429
|
return bundledMagmux;
|
|
55071
55430
|
try {
|
|
55072
55431
|
const pkgName = `@claudish/magmux-${platform2}-${arch}`;
|
|
55073
55432
|
let searchDir = pkgRoot;
|
|
55074
55433
|
for (let i = 0;i < 5; i++) {
|
|
55075
|
-
const candidate =
|
|
55434
|
+
const candidate = join33(searchDir, "node_modules", pkgName, "bin", "magmux");
|
|
55076
55435
|
if (existsSync25(candidate))
|
|
55077
55436
|
return candidate;
|
|
55078
55437
|
const parent = dirname10(searchDir);
|
|
@@ -55184,9 +55543,9 @@ async function runWithGrid(sessionPath, models, input, opts) {
|
|
|
55184
55543
|
const keep = opts?.keep ?? false;
|
|
55185
55544
|
const manifest = setupSession(sessionPath, models, input);
|
|
55186
55545
|
const startedAt = new Date().toISOString();
|
|
55187
|
-
const gridfilePath =
|
|
55188
|
-
const prompt = readFileSync24(
|
|
55189
|
-
const rawPrompt = readFileSync24(
|
|
55546
|
+
const gridfilePath = join33(sessionPath, "gridfile.txt");
|
|
55547
|
+
const prompt = readFileSync24(join33(sessionPath, "input.md"), "utf-8").replace(/'/g, "'\\''").replace(/\n/g, " ");
|
|
55548
|
+
const rawPrompt = readFileSync24(join33(sessionPath, "input.md"), "utf-8");
|
|
55190
55549
|
const usedBannerColors = new Set;
|
|
55191
55550
|
const gridLines = Object.entries(manifest.models).map(([anonId]) => {
|
|
55192
55551
|
const model = manifest.models[anonId].model;
|
|
@@ -55217,7 +55576,7 @@ async function runWithGrid(sessionPath, models, input, opts) {
|
|
|
55217
55576
|
});
|
|
55218
55577
|
const [{ results }] = await Promise.all([subscription, procExit]);
|
|
55219
55578
|
const status = buildTeamStatus(manifest, startedAt, results?.panes ?? null);
|
|
55220
|
-
const statusPath =
|
|
55579
|
+
const statusPath = join33(sessionPath, "status.json");
|
|
55221
55580
|
writeFileSync16(statusPath, JSON.stringify(status, null, 2), "utf-8");
|
|
55222
55581
|
return status;
|
|
55223
55582
|
}
|
|
@@ -55243,7 +55602,7 @@ __export(exports_team_cli, {
|
|
|
55243
55602
|
teamCommand: () => teamCommand
|
|
55244
55603
|
});
|
|
55245
55604
|
import { readFileSync as readFileSync25 } from "fs";
|
|
55246
|
-
import { join as
|
|
55605
|
+
import { join as join34 } from "path";
|
|
55247
55606
|
function getFlag(args, flag) {
|
|
55248
55607
|
const idx = args.indexOf(flag);
|
|
55249
55608
|
if (idx === -1 || idx + 1 >= args.length)
|
|
@@ -55366,7 +55725,7 @@ async function teamCommand(args) {
|
|
|
55366
55725
|
}
|
|
55367
55726
|
case "judge": {
|
|
55368
55727
|
await judgeResponses(sessionPath, { judges });
|
|
55369
|
-
console.log(readFileSync25(
|
|
55728
|
+
console.log(readFileSync25(join34(sessionPath, "verdict.md"), "utf-8"));
|
|
55370
55729
|
break;
|
|
55371
55730
|
}
|
|
55372
55731
|
case "run-and-judge": {
|
|
@@ -55384,7 +55743,7 @@ async function teamCommand(args) {
|
|
|
55384
55743
|
});
|
|
55385
55744
|
printStatus(status);
|
|
55386
55745
|
await judgeResponses(sessionPath, { judges });
|
|
55387
|
-
console.log(readFileSync25(
|
|
55746
|
+
console.log(readFileSync25(join34(sessionPath, "verdict.md"), "utf-8"));
|
|
55388
55747
|
break;
|
|
55389
55748
|
}
|
|
55390
55749
|
case "status": {
|
|
@@ -56944,13 +57303,13 @@ var init_mjs = __esm(() => {
|
|
|
56944
57303
|
this.#sigListeners = {};
|
|
56945
57304
|
for (const sig of signals) {
|
|
56946
57305
|
this.#sigListeners[sig] = () => {
|
|
56947
|
-
const
|
|
57306
|
+
const listeners2 = this.#process.listeners(sig);
|
|
56948
57307
|
let { count } = this.#emitter;
|
|
56949
57308
|
const p = process4;
|
|
56950
57309
|
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
56951
57310
|
count += p.__signal_exit_emitter__.count;
|
|
56952
57311
|
}
|
|
56953
|
-
if (
|
|
57312
|
+
if (listeners2.length === count) {
|
|
56954
57313
|
this.unload();
|
|
56955
57314
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
56956
57315
|
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
@@ -67909,7 +68268,7 @@ var init_dist16 = __esm(() => {
|
|
|
67909
68268
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
67910
68269
|
import { existsSync as existsSync26, unlinkSync as unlinkSync7 } from "fs";
|
|
67911
68270
|
import { homedir as homedir30 } from "os";
|
|
67912
|
-
import { join as
|
|
68271
|
+
import { join as join35 } from "path";
|
|
67913
68272
|
async function defaultSuggestModel() {
|
|
67914
68273
|
try {
|
|
67915
68274
|
const tok = readSharedAntigravityToken();
|
|
@@ -68030,7 +68389,7 @@ No session detected yet. Starting the Antigravity CLI interactively \u2014
|
|
|
68030
68389
|
async logout(deps) {
|
|
68031
68390
|
deleteSharedAntigravityToken(deps);
|
|
68032
68391
|
try {
|
|
68033
|
-
const tokenFile =
|
|
68392
|
+
const tokenFile = join35(homedir30(), ".gemini", "antigravity-cli", "antigravity-oauth-token");
|
|
68034
68393
|
if (existsSync26(tokenFile))
|
|
68035
68394
|
unlinkSync7(tokenFile);
|
|
68036
68395
|
} catch {}
|
|
@@ -68172,7 +68531,21 @@ __export(exports_quota_command, {
|
|
|
68172
68531
|
formatRelativeReset: () => formatRelativeReset,
|
|
68173
68532
|
buildUsageBar: () => buildUsageBar
|
|
68174
68533
|
});
|
|
68534
|
+
function refreshAnsi() {
|
|
68535
|
+
const a = cliAnsi();
|
|
68536
|
+
R = a.RESET;
|
|
68537
|
+
B = a.BOLD;
|
|
68538
|
+
D = a.DIM;
|
|
68539
|
+
I = a.ITALIC;
|
|
68540
|
+
RED = a.RED;
|
|
68541
|
+
GRN = a.GREEN;
|
|
68542
|
+
YEL = a.YELLOW;
|
|
68543
|
+
CYN = a.CYAN;
|
|
68544
|
+
WHT = a.STRONG;
|
|
68545
|
+
GRY = a.GRAY;
|
|
68546
|
+
}
|
|
68175
68547
|
async function quotaCommand(provider) {
|
|
68548
|
+
refreshAnsi();
|
|
68176
68549
|
const adapter = provider ? resolveAdapterFromInput(provider) : await promptForAdapter();
|
|
68177
68550
|
if (!adapter) {
|
|
68178
68551
|
printUnknownProvider(provider ?? "");
|
|
@@ -68313,6 +68686,7 @@ function colorFor(usedPct) {
|
|
|
68313
68686
|
return usedPct < 50 ? GRN : usedPct < 80 ? YEL : RED;
|
|
68314
68687
|
}
|
|
68315
68688
|
function buildUsageBar(usedFraction, color, width = 24) {
|
|
68689
|
+
refreshAnsi();
|
|
68316
68690
|
const clamped = Math.max(0, Math.min(1, usedFraction));
|
|
68317
68691
|
const usedCols = clamped >= 1 ? width : Math.max(clamped > 0.005 ? 1 : 0, Math.round(clamped * width));
|
|
68318
68692
|
const freeCols = width - usedCols;
|
|
@@ -68336,9 +68710,10 @@ function formatRelativeReset(resetTime) {
|
|
|
68336
68710
|
return `resets ${hours}h`;
|
|
68337
68711
|
return `resets ${minutes}m`;
|
|
68338
68712
|
}
|
|
68339
|
-
var R = "
|
|
68713
|
+
var R = "", B = "", D = "", I = "", RED = "", GRN = "", YEL = "", CYN = "", WHT = "", GRY = "", W = 58, FRIENDLY_NAMES;
|
|
68340
68714
|
var init_quota_command = __esm(() => {
|
|
68341
68715
|
init_provider_definitions();
|
|
68716
|
+
init_ansi();
|
|
68342
68717
|
init_registry();
|
|
68343
68718
|
FRIENDLY_NAMES = {
|
|
68344
68719
|
gpt: "openai-codex",
|
|
@@ -68401,7 +68776,9 @@ var init_config2 = __esm(() => {
|
|
|
68401
68776
|
CLAUDISH_SUMMARIZE_TOOLS: "CLAUDISH_SUMMARIZE_TOOLS",
|
|
68402
68777
|
CLAUDISH_DIAG_MODE: "CLAUDISH_DIAG_MODE",
|
|
68403
68778
|
CLAUDISH_DEBUG: "CLAUDISH_DEBUG",
|
|
68404
|
-
CLAUDISH_ANTHROPIC_API_BILLING: "CLAUDISH_ANTHROPIC_API_BILLING"
|
|
68779
|
+
CLAUDISH_ANTHROPIC_API_BILLING: "CLAUDISH_ANTHROPIC_API_BILLING",
|
|
68780
|
+
CLAUDISH_CLASSIFIER_PROVIDER: "CLAUDISH_CLASSIFIER_PROVIDER",
|
|
68781
|
+
CLAUDISH_CLASSIFIER_MODEL: "CLAUDISH_CLASSIFIER_MODEL"
|
|
68405
68782
|
};
|
|
68406
68783
|
OPENROUTER_HEADERS = {
|
|
68407
68784
|
"HTTP-Referer": "https://claudish.com",
|
|
@@ -69468,11 +69845,11 @@ var init_model_selector = __esm(() => {
|
|
|
69468
69845
|
import { createTextAttributes } from "@opentui/core";
|
|
69469
69846
|
function latencyBucket(ms) {
|
|
69470
69847
|
const v = Math.max(0, ms);
|
|
69471
|
-
for (const b of
|
|
69848
|
+
for (const b of activeLatencyBuckets) {
|
|
69472
69849
|
if (v < b.maxMs)
|
|
69473
69850
|
return b;
|
|
69474
69851
|
}
|
|
69475
|
-
return
|
|
69852
|
+
return activeLatencyBuckets[activeLatencyBuckets.length - 1];
|
|
69476
69853
|
}
|
|
69477
69854
|
function formatLatency(ms) {
|
|
69478
69855
|
if (ms < 1000)
|
|
@@ -69501,6 +69878,24 @@ function hexToAnsiFg(hex3) {
|
|
|
69501
69878
|
const b = Number.parseInt(hex3.slice(5, 7), 16);
|
|
69502
69879
|
return `\x1B[38;2;${r};${g};${b}m`;
|
|
69503
69880
|
}
|
|
69881
|
+
function registerPaletteRefresher(fn) {
|
|
69882
|
+
paletteRefreshers.push(fn);
|
|
69883
|
+
fn();
|
|
69884
|
+
}
|
|
69885
|
+
function applyTuiTheme(mode) {
|
|
69886
|
+
const palette = mode === "light" ? LIGHT2 : DARK;
|
|
69887
|
+
activeLatencyBuckets = mode === "light" ? LATENCY_BUCKETS_LIGHT : LATENCY_BUCKETS_DARK;
|
|
69888
|
+
Object.assign(C, palette);
|
|
69889
|
+
Object.assign(STAGE_BG, mode === "light" ? STAGE_BG_LIGHT : STAGE_BG_DARK);
|
|
69890
|
+
STAGE_BG_ANSI.network = hexToAnsiBg(STAGE_BG.network);
|
|
69891
|
+
STAGE_BG_ANSI.server = hexToAnsiBg(STAGE_BG.server);
|
|
69892
|
+
STAGE_BG_ANSI.streaming = hexToAnsiBg(STAGE_BG.streaming);
|
|
69893
|
+
STAGE_FG.network = C.cyan;
|
|
69894
|
+
STAGE_FG.server = C.blue;
|
|
69895
|
+
STAGE_FG.streaming = C.yellow;
|
|
69896
|
+
for (const fn of paletteRefreshers)
|
|
69897
|
+
fn();
|
|
69898
|
+
}
|
|
69504
69899
|
function throughputFg(tokensPerSec) {
|
|
69505
69900
|
if (tokensPerSec >= 100)
|
|
69506
69901
|
return C.brightGreen;
|
|
@@ -69567,9 +69962,10 @@ function tokBarCells(tokensPerSec, maxTokPerSec, tokWidth) {
|
|
|
69567
69962
|
const raw2 = Math.round(tokWidth * Math.max(0, tokensPerSec) / denom);
|
|
69568
69963
|
return Math.min(tokWidth, Math.max(0, raw2));
|
|
69569
69964
|
}
|
|
69570
|
-
var C, bold3, A,
|
|
69965
|
+
var DARK, LIGHT2, C, bold3, A, LATENCY_BUCKETS_DARK, LATENCY_BUCKETS_LIGHT, activeLatencyBuckets, latencyFg = "#ffffff", LATENCY_FG_ANSI = "\x1B[38;2;255;255;255m", ANSI_RESET = "\x1B[0m", STAGE_BG_DARK, STAGE_BG_LIGHT, STAGE_BG, STAGE_FG, STAGE_BG_ANSI, paletteRefreshers;
|
|
69571
69966
|
var init_theme2 = __esm(() => {
|
|
69572
|
-
|
|
69967
|
+
init_theme_mode();
|
|
69968
|
+
DARK = {
|
|
69573
69969
|
bg: "#000000",
|
|
69574
69970
|
bgAlt: "#111111",
|
|
69575
69971
|
bgHighlight: "#1e3a5f",
|
|
@@ -69589,6 +69985,8 @@ var init_theme2 = __esm(() => {
|
|
|
69589
69985
|
orange: "#ff8800",
|
|
69590
69986
|
white: "#ffffff",
|
|
69591
69987
|
black: "#000000",
|
|
69988
|
+
ink: "#ffffff",
|
|
69989
|
+
strong: "#ffffff",
|
|
69592
69990
|
tabActiveBg: "#0088ff",
|
|
69593
69991
|
tabInactiveBg: "#001a33",
|
|
69594
69992
|
tabActiveFg: "#ffffff",
|
|
@@ -69598,23 +69996,71 @@ var init_theme2 = __esm(() => {
|
|
|
69598
69996
|
chipKeyBg: "#3a3a3a",
|
|
69599
69997
|
chipLabelBg: "#222222"
|
|
69600
69998
|
};
|
|
69999
|
+
LIGHT2 = {
|
|
70000
|
+
bg: "#ffffff",
|
|
70001
|
+
bgAlt: "#f3f4f6",
|
|
70002
|
+
bgHighlight: "#bfdbfe",
|
|
70003
|
+
bgError: "#fee2e2",
|
|
70004
|
+
fg: "#1f2937",
|
|
70005
|
+
fgMuted: "#4b5563",
|
|
70006
|
+
dim: "#6b7280",
|
|
70007
|
+
border: "#d1d5db",
|
|
70008
|
+
focusBorder: "#2563eb",
|
|
70009
|
+
green: "#15803d",
|
|
70010
|
+
brightGreen: "#166534",
|
|
70011
|
+
red: "#dc2626",
|
|
70012
|
+
yellow: "#a16207",
|
|
70013
|
+
cyan: "#0e7490",
|
|
70014
|
+
blue: "#1d4ed8",
|
|
70015
|
+
magenta: "#9333ea",
|
|
70016
|
+
orange: "#c2410c",
|
|
70017
|
+
white: "#ffffff",
|
|
70018
|
+
black: "#000000",
|
|
70019
|
+
ink: "#ffffff",
|
|
70020
|
+
strong: "#111827",
|
|
70021
|
+
tabActiveBg: "#2563eb",
|
|
70022
|
+
tabInactiveBg: "#e5e7eb",
|
|
70023
|
+
tabActiveFg: "#ffffff",
|
|
70024
|
+
tabInactiveFg: "#374151",
|
|
70025
|
+
pillKeyBg: "#2d6e3e",
|
|
70026
|
+
pillOauthBg: "#1f6d75",
|
|
70027
|
+
chipKeyBg: "#d1d5db",
|
|
70028
|
+
chipLabelBg: "#e5e7eb"
|
|
70029
|
+
};
|
|
70030
|
+
C = { ...DARK };
|
|
69601
70031
|
bold3 = createTextAttributes({ bold: true });
|
|
69602
70032
|
A = {
|
|
69603
70033
|
bold: bold3,
|
|
69604
70034
|
boldIf: (enabled2) => enabled2 ? bold3 : undefined
|
|
69605
70035
|
};
|
|
69606
|
-
|
|
70036
|
+
LATENCY_BUCKETS_DARK = [
|
|
69607
70037
|
{ maxMs: 500, hex: "#1f8f3b" },
|
|
69608
70038
|
{ maxMs: 1000, hex: "#2d6e3e" },
|
|
69609
70039
|
{ maxMs: 3000, hex: "#8a7d1e" },
|
|
69610
70040
|
{ maxMs: 6000, hex: "#b5651d" },
|
|
69611
70041
|
{ maxMs: Number.POSITIVE_INFINITY, hex: "#9e2b2b" }
|
|
69612
70042
|
];
|
|
69613
|
-
|
|
70043
|
+
LATENCY_BUCKETS_LIGHT = [
|
|
70044
|
+
{ maxMs: 500, hex: "#1d8738" },
|
|
70045
|
+
{ maxMs: 1000, hex: "#2d6e3e" },
|
|
70046
|
+
{ maxMs: 3000, hex: "#83771c" },
|
|
70047
|
+
{ maxMs: 6000, hex: "#b0621c" },
|
|
70048
|
+
{ maxMs: Number.POSITIVE_INFINITY, hex: "#9e2b2b" }
|
|
70049
|
+
];
|
|
70050
|
+
activeLatencyBuckets = LATENCY_BUCKETS_DARK;
|
|
70051
|
+
STAGE_BG_DARK = {
|
|
69614
70052
|
network: "#00b3c4",
|
|
69615
70053
|
server: "#2563ff",
|
|
69616
70054
|
streaming: "#ffcc00"
|
|
69617
70055
|
};
|
|
70056
|
+
STAGE_BG_LIGHT = {
|
|
70057
|
+
network: "#0891b2",
|
|
70058
|
+
server: "#2563eb",
|
|
70059
|
+
streaming: "#d97706"
|
|
70060
|
+
};
|
|
70061
|
+
STAGE_BG = {
|
|
70062
|
+
...STAGE_BG_DARK
|
|
70063
|
+
};
|
|
69618
70064
|
STAGE_FG = {
|
|
69619
70065
|
network: C.cyan,
|
|
69620
70066
|
server: C.blue,
|
|
@@ -69625,9 +70071,32 @@ var init_theme2 = __esm(() => {
|
|
|
69625
70071
|
server: hexToAnsiBg(STAGE_BG.server),
|
|
69626
70072
|
streaming: hexToAnsiBg(STAGE_BG.streaming)
|
|
69627
70073
|
};
|
|
70074
|
+
paletteRefreshers = [];
|
|
70075
|
+
onThemeModeChange(applyTuiTheme);
|
|
69628
70076
|
});
|
|
69629
70077
|
|
|
69630
70078
|
// src/probe/probe-results-printer.ts
|
|
70079
|
+
function buildPrinterColors() {
|
|
70080
|
+
const a = cliAnsi();
|
|
70081
|
+
const light = getThemeMode() === "light";
|
|
70082
|
+
const noColor = !!process.env.NO_COLOR;
|
|
70083
|
+
return {
|
|
70084
|
+
reset: a.RESET,
|
|
70085
|
+
bold: a.BOLD,
|
|
70086
|
+
dim: a.DIM,
|
|
70087
|
+
green: a.GREEN,
|
|
70088
|
+
red: a.RED,
|
|
70089
|
+
yellow: a.YELLOW,
|
|
70090
|
+
cyan: a.CYAN,
|
|
70091
|
+
brightGreen: a.BRIGHT_GREEN,
|
|
70092
|
+
gray: a.GRAY,
|
|
70093
|
+
bgFastest: noColor ? "" : light ? bgHex("#bbf7d0") : "\x1B[48;5;22m",
|
|
70094
|
+
bgSlowest: noColor ? "" : light ? bgHex("#fecaca") : "\x1B[48;5;95m"
|
|
70095
|
+
};
|
|
70096
|
+
}
|
|
70097
|
+
function refreshPc() {
|
|
70098
|
+
pc = buildPrinterColors();
|
|
70099
|
+
}
|
|
69631
70100
|
function stripAnsi2(s) {
|
|
69632
70101
|
return s.replace(ANSI_RE2, "");
|
|
69633
70102
|
}
|
|
@@ -70040,6 +70509,7 @@ function buildCardLayout(result, isLiveProbe, directKeyVar) {
|
|
|
70040
70509
|
};
|
|
70041
70510
|
}
|
|
70042
70511
|
function computeRequiredWidth(result, isLiveProbe, directKeyVar) {
|
|
70512
|
+
refreshPc();
|
|
70043
70513
|
const layout = buildCardLayout(result, isLiveProbe, directKeyVar);
|
|
70044
70514
|
return computeCardWidth(layout.rows, layout.widths, visibleLength(layout.titleStyled), visibleLength(layout.summaryStyled), layout.footerVis);
|
|
70045
70515
|
}
|
|
@@ -70255,6 +70725,7 @@ function renderLeaderboard(results, scales, maxWidth, w) {
|
|
|
70255
70725
|
`);
|
|
70256
70726
|
}
|
|
70257
70727
|
function printProbeResults(results, isLiveProbe) {
|
|
70728
|
+
refreshPc();
|
|
70258
70729
|
const w = process.stderr.write.bind(process.stderr);
|
|
70259
70730
|
w(`
|
|
70260
70731
|
`);
|
|
@@ -70291,26 +70762,30 @@ function printProbeResults(results, isLiveProbe) {
|
|
|
70291
70762
|
var pc, ANSI_RE2, PRINTER_BAR_WIDTH = 24, PRINTER_TOK_WIDTH = 14, PRINTER_TRACK = "\xB7", PRINTER_BAR_FILL = "\u2588", STAGE_NUM_W = 6, PRINTER_TOK_VALUE_W = 9, PRINTER_BARS_FULL_WIDTH, PRINTER_BARS_NOTOK_WIDTH, PRINTER_BARS_MIN_WIDTH, MIN_CARD_WIDTH = 60, CARD_PADDING_LEFT = 2, CARD_PADDING_RIGHT = 2;
|
|
70292
70763
|
var init_probe_results_printer = __esm(() => {
|
|
70293
70764
|
init_probe_live();
|
|
70765
|
+
init_ansi();
|
|
70766
|
+
init_theme_mode();
|
|
70294
70767
|
init_theme2();
|
|
70295
|
-
pc = {
|
|
70296
|
-
reset: "\x1B[0m",
|
|
70297
|
-
bold: "\x1B[1m",
|
|
70298
|
-
dim: "\x1B[2m",
|
|
70299
|
-
green: "\x1B[32m",
|
|
70300
|
-
red: "\x1B[31m",
|
|
70301
|
-
yellow: "\x1B[33m",
|
|
70302
|
-
cyan: "\x1B[36m",
|
|
70303
|
-
brightGreen: "\x1B[92m",
|
|
70304
|
-
gray: "\x1B[90m",
|
|
70305
|
-
bgFastest: "\x1B[48;5;22m",
|
|
70306
|
-
bgSlowest: "\x1B[48;5;95m"
|
|
70307
|
-
};
|
|
70308
70768
|
ANSI_RE2 = /\x1b\[[0-9;]*[A-Za-z]/g;
|
|
70309
70769
|
PRINTER_BARS_FULL_WIDTH = 24 + 2 + 7 + 34 + 17 + 9;
|
|
70310
70770
|
PRINTER_BARS_NOTOK_WIDTH = 24 + 2 + 7 + 34 + 2 + 9;
|
|
70311
70771
|
PRINTER_BARS_MIN_WIDTH = 24 + 2 + 7 + 2 + 9;
|
|
70312
70772
|
});
|
|
70313
70773
|
|
|
70774
|
+
// src/theme/renderer-theme.ts
|
|
70775
|
+
async function applyRendererThemeMode(renderer) {
|
|
70776
|
+
const override = themeModeOverride();
|
|
70777
|
+
if (override) {
|
|
70778
|
+
setThemeMode(override);
|
|
70779
|
+
return;
|
|
70780
|
+
}
|
|
70781
|
+
const mode = await renderer.waitForThemeMode(THEME_MODE_WAIT_MS).catch(() => null);
|
|
70782
|
+
setThemeMode(mode ?? getThemeMode());
|
|
70783
|
+
}
|
|
70784
|
+
var THEME_MODE_WAIT_MS = 250;
|
|
70785
|
+
var init_renderer_theme = __esm(() => {
|
|
70786
|
+
init_theme_mode();
|
|
70787
|
+
});
|
|
70788
|
+
|
|
70314
70789
|
// src/probe/probe-tui-app.tsx
|
|
70315
70790
|
import { useKeyboard, useTerminalDimensions } from "@opentui/react";
|
|
70316
70791
|
import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
@@ -70427,6 +70902,9 @@ function padEndSafe(s, n) {
|
|
|
70427
70902
|
function stripAnsi3(text) {
|
|
70428
70903
|
return text.replace(/\x1b\[[0-9;]*[A-Za-z]/g, "");
|
|
70429
70904
|
}
|
|
70905
|
+
function ishGreen() {
|
|
70906
|
+
return getThemeMode() === "light" ? "#047857" : "#00ff7f";
|
|
70907
|
+
}
|
|
70430
70908
|
function Banner() {
|
|
70431
70909
|
const claudLines = [
|
|
70432
70910
|
" \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 ",
|
|
@@ -70438,7 +70916,6 @@ function Banner() {
|
|
|
70438
70916
|
];
|
|
70439
70917
|
const ishLines = [" _ _ ", " (_)__| |_ ", " | (_-< ' \\ ", " |_/__/_||_|"];
|
|
70440
70918
|
const ishPad = " ";
|
|
70441
|
-
const ishGreen = "#00ff7f";
|
|
70442
70919
|
const renderBannerRow = (claudLine, ishLine, key) => /* @__PURE__ */ jsxDEV("box", {
|
|
70443
70920
|
flexDirection: "row",
|
|
70444
70921
|
children: [
|
|
@@ -70455,7 +70932,7 @@ function Banner() {
|
|
|
70455
70932
|
}, undefined, false, undefined, this),
|
|
70456
70933
|
/* @__PURE__ */ jsxDEV("text", {
|
|
70457
70934
|
children: /* @__PURE__ */ jsxDEV("span", {
|
|
70458
|
-
fg: ishGreen,
|
|
70935
|
+
fg: ishGreen(),
|
|
70459
70936
|
attributes: A.bold,
|
|
70460
70937
|
children: ishLine
|
|
70461
70938
|
}, undefined, false, undefined, this)
|
|
@@ -70596,7 +71073,7 @@ function ProgressBar({
|
|
|
70596
71073
|
children: " "
|
|
70597
71074
|
}, undefined, false, undefined, this),
|
|
70598
71075
|
/* @__PURE__ */ jsxDEV("span", {
|
|
70599
|
-
fg: C.
|
|
71076
|
+
fg: C.strong,
|
|
70600
71077
|
children: padStartSafe2(formatLatency(t.totalMs), TOTAL_COL)
|
|
70601
71078
|
}, undefined, false, undefined, this),
|
|
70602
71079
|
layout.showBreakdown && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
@@ -70740,10 +71217,10 @@ function ModelGroup({
|
|
|
70740
71217
|
children: " "
|
|
70741
71218
|
}, undefined, false, undefined, this),
|
|
70742
71219
|
/* @__PURE__ */ jsxDEV("box", {
|
|
70743
|
-
backgroundColor:
|
|
71220
|
+
backgroundColor: C.bgHighlight,
|
|
70744
71221
|
children: /* @__PURE__ */ jsxDEV("text", {
|
|
70745
71222
|
children: /* @__PURE__ */ jsxDEV("span", {
|
|
70746
|
-
fg:
|
|
71223
|
+
fg: C.strong,
|
|
70747
71224
|
attributes: A.bold,
|
|
70748
71225
|
children: headerText
|
|
70749
71226
|
}, undefined, false, undefined, this)
|
|
@@ -70962,7 +71439,7 @@ function DetailLinkRow({
|
|
|
70962
71439
|
children: " "
|
|
70963
71440
|
}, undefined, false, undefined, this),
|
|
70964
71441
|
/* @__PURE__ */ jsxDEV("span", {
|
|
70965
|
-
fg: C.
|
|
71442
|
+
fg: C.strong,
|
|
70966
71443
|
children: padStartSafe2(formatLatency(t.totalMs), TOTAL_COL)
|
|
70967
71444
|
}, undefined, false, undefined, this),
|
|
70968
71445
|
layout.showBreakdown && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
@@ -71270,7 +71747,7 @@ function LeaderLiveRow({
|
|
|
71270
71747
|
children: [
|
|
71271
71748
|
lead,
|
|
71272
71749
|
/* @__PURE__ */ jsxDEV("span", {
|
|
71273
|
-
fg: C.
|
|
71750
|
+
fg: C.strong,
|
|
71274
71751
|
children: padStartSafe2(formatLatency(t.totalMs), TOTAL_COL)
|
|
71275
71752
|
}, undefined, false, undefined, this)
|
|
71276
71753
|
]
|
|
@@ -71300,7 +71777,7 @@ function LeaderLiveRow({
|
|
|
71300
71777
|
children: " "
|
|
71301
71778
|
}, undefined, false, undefined, this),
|
|
71302
71779
|
/* @__PURE__ */ jsxDEV("span", {
|
|
71303
|
-
fg: C.
|
|
71780
|
+
fg: C.strong,
|
|
71304
71781
|
children: padStartSafe2(formatLatency(t.totalMs), TOTAL_COL)
|
|
71305
71782
|
}, undefined, false, undefined, this),
|
|
71306
71783
|
layout.showBreakdown && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
@@ -71654,6 +72131,7 @@ function ProbeApp({
|
|
|
71654
72131
|
var ANIM_FRAMES, TIMELINE_BAR_FULL = 24, TIMELINE_BAR_NARROW = 12, TOK_BAR_FULL = 14, TOTAL_COL = 7, STAGE_NUM_W2 = 6, BREAKDOWN_COL, TOK_VALUE_COL = 7, TRACK_CHAR = "\xB7", BAR_FILL = "\u2588", BANNER_ROWS = 7, SCROLL_HINT_ROWS = 1, LEGEND_ROWS = 2, MIN_LIST_H = 4, TAB_BAR_ROWS = 2;
|
|
71655
72132
|
var init_probe_tui_app = __esm(() => {
|
|
71656
72133
|
init_probe_live();
|
|
72134
|
+
init_theme_mode();
|
|
71657
72135
|
init_theme2();
|
|
71658
72136
|
ANIM_FRAMES = ["\u2593", "\u2592", "\u2591", "\u2592"];
|
|
71659
72137
|
BREAKDOWN_COL = 16 + 3 * STAGE_NUM_W2;
|
|
@@ -71666,10 +72144,11 @@ import { jsxDEV as jsxDEV2 } from "@opentui/react/jsx-dev-runtime";
|
|
|
71666
72144
|
async function startProbeTui(initial) {
|
|
71667
72145
|
const renderer = await createCliRenderer({
|
|
71668
72146
|
stdout: process.stderr,
|
|
71669
|
-
|
|
72147
|
+
screenMode: "main-screen",
|
|
71670
72148
|
useMouse: true,
|
|
71671
72149
|
exitOnCtrlC: true
|
|
71672
72150
|
});
|
|
72151
|
+
await applyRendererThemeMode(renderer);
|
|
71673
72152
|
const store = new ProbeStore(initial);
|
|
71674
72153
|
let resolveQuit;
|
|
71675
72154
|
const quitPromise = new Promise((resolve5) => {
|
|
@@ -71702,6 +72181,7 @@ async function startProbeTui(initial) {
|
|
|
71702
72181
|
return { store, waitForQuit: () => quitPromise, shutdown };
|
|
71703
72182
|
}
|
|
71704
72183
|
var init_probe_tui_runtime = __esm(() => {
|
|
72184
|
+
init_renderer_theme();
|
|
71705
72185
|
init_probe_tui_app();
|
|
71706
72186
|
});
|
|
71707
72187
|
|
|
@@ -71785,20 +72265,20 @@ __export(exports_cli, {
|
|
|
71785
72265
|
import {
|
|
71786
72266
|
copyFileSync as copyFileSync2,
|
|
71787
72267
|
existsSync as existsSync27,
|
|
71788
|
-
mkdirSync as
|
|
72268
|
+
mkdirSync as mkdirSync16,
|
|
71789
72269
|
readFileSync as readFileSync27,
|
|
71790
72270
|
readdirSync as readdirSync5,
|
|
71791
72271
|
unlinkSync as unlinkSync8,
|
|
71792
72272
|
writeFileSync as writeFileSync18
|
|
71793
72273
|
} from "fs";
|
|
71794
72274
|
import { homedir as homedir31 } from "os";
|
|
71795
|
-
import { dirname as dirname11, join as
|
|
72275
|
+
import { dirname as dirname11, join as join36 } from "path";
|
|
71796
72276
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
71797
72277
|
function getVersion3() {
|
|
71798
72278
|
return VERSION;
|
|
71799
72279
|
}
|
|
71800
72280
|
function clearAllModelCaches() {
|
|
71801
|
-
const cacheDir =
|
|
72281
|
+
const cacheDir = join36(homedir31(), ".claudish");
|
|
71802
72282
|
if (!existsSync27(cacheDir))
|
|
71803
72283
|
return;
|
|
71804
72284
|
const cachePatterns = ["pricing-cache.json", "recommended-models-cache.json"];
|
|
@@ -71807,7 +72287,7 @@ function clearAllModelCaches() {
|
|
|
71807
72287
|
const files = readdirSync5(cacheDir);
|
|
71808
72288
|
for (const file2 of files) {
|
|
71809
72289
|
if (cachePatterns.includes(file2)) {
|
|
71810
|
-
unlinkSync8(
|
|
72290
|
+
unlinkSync8(join36(cacheDir, file2));
|
|
71811
72291
|
cleared++;
|
|
71812
72292
|
}
|
|
71813
72293
|
}
|
|
@@ -72013,6 +72493,20 @@ async function parseArgs(args) {
|
|
|
72013
72493
|
config3.defaultProvider = dpArg;
|
|
72014
72494
|
} else if (arg === "--anthropic-api-billing") {
|
|
72015
72495
|
config3.anthropicApiBilling = true;
|
|
72496
|
+
} else if (arg === "--classifier-model") {
|
|
72497
|
+
const cmArg = args[++i];
|
|
72498
|
+
if (!cmArg) {
|
|
72499
|
+
console.error("--classifier-model requires a model id");
|
|
72500
|
+
process.exit(1);
|
|
72501
|
+
}
|
|
72502
|
+
config3.classifierModel = cmArg;
|
|
72503
|
+
} else if (arg === "--classifier-provider") {
|
|
72504
|
+
const cpArg = args[++i];
|
|
72505
|
+
if (!cpArg) {
|
|
72506
|
+
console.error("--classifier-provider requires a provider name (e.g. anthropic)");
|
|
72507
|
+
process.exit(1);
|
|
72508
|
+
}
|
|
72509
|
+
config3.classifierProvider = cpArg;
|
|
72016
72510
|
} else if (arg === "--op-env" || arg.startsWith("--op-env=")) {
|
|
72017
72511
|
const v = arg.startsWith("--op-env=") ? arg.slice("--op-env=".length) : args[++i];
|
|
72018
72512
|
if (!v) {
|
|
@@ -72223,14 +72717,14 @@ Usage: claudish --models --provider <slug>`);
|
|
|
72223
72717
|
});
|
|
72224
72718
|
config3.resolvedDefaultProvider = resolved;
|
|
72225
72719
|
if (resolved.legacyAutoPromoted && !config3.quiet) {
|
|
72226
|
-
const markerFile =
|
|
72720
|
+
const markerFile = join36(homedir31(), ".claudish", ".legacy-litellm-hint-shown");
|
|
72227
72721
|
if (!existsSync27(markerFile)) {
|
|
72228
72722
|
const hint = buildLegacyHint(resolved);
|
|
72229
72723
|
if (hint) {
|
|
72230
72724
|
console.error(hint);
|
|
72231
72725
|
}
|
|
72232
72726
|
try {
|
|
72233
|
-
|
|
72727
|
+
mkdirSync16(dirname11(markerFile), { recursive: true });
|
|
72234
72728
|
writeFileSync18(markerFile, new Date().toISOString(), "utf-8");
|
|
72235
72729
|
} catch {}
|
|
72236
72730
|
}
|
|
@@ -72756,9 +73250,7 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
|
|
|
72756
73250
|
};
|
|
72757
73251
|
}
|
|
72758
73252
|
if (jsonOutput) {
|
|
72759
|
-
const DIM =
|
|
72760
|
-
const YELLOW = "\x1B[33m";
|
|
72761
|
-
const RESET = "\x1B[0m";
|
|
73253
|
+
const { DIM, YELLOW, RESET } = cliAnsi();
|
|
72762
73254
|
let liveProxy2 = null;
|
|
72763
73255
|
if (options.live) {
|
|
72764
73256
|
try {
|
|
@@ -73032,14 +73524,15 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
|
|
|
73032
73524
|
}
|
|
73033
73525
|
function printHelp2() {
|
|
73034
73526
|
const useColor = !!process.stdout.isTTY && !process.env.NO_COLOR;
|
|
73035
|
-
const
|
|
73036
|
-
const
|
|
73037
|
-
const
|
|
73038
|
-
const
|
|
73039
|
-
const
|
|
73040
|
-
const
|
|
73041
|
-
const
|
|
73042
|
-
const
|
|
73527
|
+
const A2 = cliAnsi();
|
|
73528
|
+
const c = (esc2) => (s) => useColor && esc2 ? `${esc2}${s}${A2.RESET}` : s;
|
|
73529
|
+
const bold4 = c(A2.BOLD);
|
|
73530
|
+
const dim3 = c(A2.DIM);
|
|
73531
|
+
const cyan = c(A2.CYAN);
|
|
73532
|
+
const green2 = c(A2.GREEN);
|
|
73533
|
+
const yellow2 = c(A2.YELLOW);
|
|
73534
|
+
const magenta = c(A2.MAGENTA);
|
|
73535
|
+
const blue = c(A2.BLUE);
|
|
73043
73536
|
const h = (title) => bold4(cyan(`\u258C ${title}`));
|
|
73044
73537
|
console.log(`
|
|
73045
73538
|
${bold4("claudish")} ${dim3("\xB7")} Run Claude Code with any AI model
|
|
@@ -73333,7 +73826,7 @@ ${h("MORE INFO")}
|
|
|
73333
73826
|
}
|
|
73334
73827
|
function printAIAgentGuide() {
|
|
73335
73828
|
try {
|
|
73336
|
-
const guidePath =
|
|
73829
|
+
const guidePath = join36(__dirname3, "../AI_AGENT_GUIDE.md");
|
|
73337
73830
|
const guideContent = readFileSync27(guidePath, "utf-8");
|
|
73338
73831
|
console.log(guideContent);
|
|
73339
73832
|
} catch (error46) {
|
|
@@ -73350,10 +73843,10 @@ async function initializeClaudishSkill() {
|
|
|
73350
73843
|
console.log(`\uD83D\uDD27 Initializing Claudish skill in current project...
|
|
73351
73844
|
`);
|
|
73352
73845
|
const cwd = process.cwd();
|
|
73353
|
-
const claudeDir =
|
|
73354
|
-
const skillsDir =
|
|
73355
|
-
const claudishSkillDir =
|
|
73356
|
-
const skillFile =
|
|
73846
|
+
const claudeDir = join36(cwd, ".claude");
|
|
73847
|
+
const skillsDir = join36(claudeDir, "skills");
|
|
73848
|
+
const claudishSkillDir = join36(skillsDir, "claudish-usage");
|
|
73849
|
+
const skillFile = join36(claudishSkillDir, "SKILL.md");
|
|
73357
73850
|
if (existsSync27(skillFile)) {
|
|
73358
73851
|
console.log("\u2705 Claudish skill already installed at:");
|
|
73359
73852
|
console.log(` ${skillFile}
|
|
@@ -73361,7 +73854,7 @@ async function initializeClaudishSkill() {
|
|
|
73361
73854
|
console.log("\uD83D\uDCA1 To reinstall, delete the file and run 'claudish --init' again.");
|
|
73362
73855
|
return;
|
|
73363
73856
|
}
|
|
73364
|
-
const sourceSkillPath =
|
|
73857
|
+
const sourceSkillPath = join36(__dirname3, "../skills/claudish-usage/SKILL.md");
|
|
73365
73858
|
if (!existsSync27(sourceSkillPath)) {
|
|
73366
73859
|
console.error("\u274C Error: Claudish skill file not found in installation.");
|
|
73367
73860
|
console.error(` Expected at: ${sourceSkillPath}`);
|
|
@@ -73372,15 +73865,15 @@ async function initializeClaudishSkill() {
|
|
|
73372
73865
|
}
|
|
73373
73866
|
try {
|
|
73374
73867
|
if (!existsSync27(claudeDir)) {
|
|
73375
|
-
|
|
73868
|
+
mkdirSync16(claudeDir, { recursive: true });
|
|
73376
73869
|
console.log("\uD83D\uDCC1 Created .claude/ directory");
|
|
73377
73870
|
}
|
|
73378
73871
|
if (!existsSync27(skillsDir)) {
|
|
73379
|
-
|
|
73872
|
+
mkdirSync16(skillsDir, { recursive: true });
|
|
73380
73873
|
console.log("\uD83D\uDCC1 Created .claude/skills/ directory");
|
|
73381
73874
|
}
|
|
73382
73875
|
if (!existsSync27(claudishSkillDir)) {
|
|
73383
|
-
|
|
73876
|
+
mkdirSync16(claudishSkillDir, { recursive: true });
|
|
73384
73877
|
console.log("\uD83D\uDCC1 Created .claude/skills/claudish-usage/ directory");
|
|
73385
73878
|
}
|
|
73386
73879
|
copyFileSync2(sourceSkillPath, skillFile);
|
|
@@ -73453,6 +73946,7 @@ var init_cli = __esm(() => {
|
|
|
73453
73946
|
init_probe_runner();
|
|
73454
73947
|
init_provider_definitions();
|
|
73455
73948
|
init_routing_rules();
|
|
73949
|
+
init_ansi();
|
|
73456
73950
|
init_provider_resolver();
|
|
73457
73951
|
__filename3 = fileURLToPath3(import.meta.url);
|
|
73458
73952
|
__dirname3 = dirname11(__filename3);
|
|
@@ -73467,24 +73961,24 @@ __export(exports_update_checker, {
|
|
|
73467
73961
|
clearCache: () => clearCache,
|
|
73468
73962
|
checkForUpdates: () => checkForUpdates
|
|
73469
73963
|
});
|
|
73470
|
-
import { existsSync as existsSync28, mkdirSync as
|
|
73964
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync17, readFileSync as readFileSync28, unlinkSync as unlinkSync9, writeFileSync as writeFileSync19 } from "fs";
|
|
73471
73965
|
import { homedir as homedir32, platform as platform2, tmpdir } from "os";
|
|
73472
|
-
import { join as
|
|
73966
|
+
import { join as join37 } from "path";
|
|
73473
73967
|
function getCacheFilePath() {
|
|
73474
73968
|
let cacheDir;
|
|
73475
73969
|
if (isWindows) {
|
|
73476
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
73477
|
-
cacheDir =
|
|
73970
|
+
const localAppData = process.env.LOCALAPPDATA || join37(homedir32(), "AppData", "Local");
|
|
73971
|
+
cacheDir = join37(localAppData, "claudish");
|
|
73478
73972
|
} else {
|
|
73479
|
-
cacheDir =
|
|
73973
|
+
cacheDir = join37(homedir32(), ".cache", "claudish");
|
|
73480
73974
|
}
|
|
73481
73975
|
try {
|
|
73482
73976
|
if (!existsSync28(cacheDir)) {
|
|
73483
|
-
|
|
73977
|
+
mkdirSync17(cacheDir, { recursive: true });
|
|
73484
73978
|
}
|
|
73485
|
-
return
|
|
73979
|
+
return join37(cacheDir, "update-check.json");
|
|
73486
73980
|
} catch {
|
|
73487
|
-
return
|
|
73981
|
+
return join37(tmpdir(), "claudish-update-check.json");
|
|
73488
73982
|
}
|
|
73489
73983
|
}
|
|
73490
73984
|
function readCache() {
|
|
@@ -73588,13 +74082,15 @@ async function checkForUpdates(currentVersion, options = {}) {
|
|
|
73588
74082
|
return;
|
|
73589
74083
|
}
|
|
73590
74084
|
if (!quiet) {
|
|
74085
|
+
const { RESET, BOLD, GREEN, CYAN, DIM } = cliAnsi();
|
|
73591
74086
|
console.error("");
|
|
73592
74087
|
console.error(` ${CYAN}\u250C${RESET} ${BOLD}Update available:${RESET} ${currentVersion} ${DIM}\u2192${RESET} ${GREEN}${latestVersion}${RESET} ${DIM}Run:${RESET} ${BOLD}${CYAN}claudish update${RESET}`);
|
|
73593
74088
|
console.error("");
|
|
73594
74089
|
}
|
|
73595
74090
|
}
|
|
73596
|
-
var isWindows, NPM_REGISTRY_URL = "https://registry.npmjs.org/claudish/latest", CACHE_MAX_AGE_MS
|
|
74091
|
+
var isWindows, NPM_REGISTRY_URL = "https://registry.npmjs.org/claudish/latest", CACHE_MAX_AGE_MS;
|
|
73597
74092
|
var init_update_checker = __esm(() => {
|
|
74093
|
+
init_ansi();
|
|
73598
74094
|
isWindows = platform2() === "win32";
|
|
73599
74095
|
CACHE_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
73600
74096
|
});
|
|
@@ -73605,6 +74101,9 @@ __export(exports_update_command, {
|
|
|
73605
74101
|
updateCommand: () => updateCommand
|
|
73606
74102
|
});
|
|
73607
74103
|
import { execSync as execSync2 } from "child_process";
|
|
74104
|
+
function refreshAnsi2() {
|
|
74105
|
+
({ RESET, BOLD, GREEN, YELLOW, CYAN, RED: RED2, MAGENTA, DIM } = cliAnsi());
|
|
74106
|
+
}
|
|
73608
74107
|
function detectInstallationMethod() {
|
|
73609
74108
|
const scriptPath = process.argv[1] || "";
|
|
73610
74109
|
if (scriptPath.includes("/opt/homebrew/") || scriptPath.includes("/usr/local/Cellar/")) {
|
|
@@ -73639,8 +74138,8 @@ async function executeUpdate(command) {
|
|
|
73639
74138
|
return true;
|
|
73640
74139
|
} catch {
|
|
73641
74140
|
console.error(`
|
|
73642
|
-
${RED2}\u2717${
|
|
73643
|
-
console.error(`${YELLOW}Try manually:${
|
|
74141
|
+
${RED2}\u2717${RESET} ${BOLD}Update failed.${RESET}`);
|
|
74142
|
+
console.error(`${YELLOW}Try manually:${RESET}`);
|
|
73644
74143
|
console.error(` ${command}
|
|
73645
74144
|
`);
|
|
73646
74145
|
return false;
|
|
@@ -73721,15 +74220,15 @@ async function fetchChangelog(currentVersion, latestVersion) {
|
|
|
73721
74220
|
function itemStyle(type) {
|
|
73722
74221
|
switch (type) {
|
|
73723
74222
|
case "feat":
|
|
73724
|
-
return { symbol: "\u2726", color:
|
|
74223
|
+
return { symbol: "\u2726", color: GREEN };
|
|
73725
74224
|
case "fix":
|
|
73726
74225
|
return { symbol: "\u2726", color: YELLOW };
|
|
73727
74226
|
case "breaking":
|
|
73728
74227
|
return { symbol: "\u2726", color: MAGENTA };
|
|
73729
74228
|
case "perf":
|
|
73730
|
-
return { symbol: "\u2726", color:
|
|
74229
|
+
return { symbol: "\u2726", color: CYAN };
|
|
73731
74230
|
case "chore":
|
|
73732
|
-
return { symbol: "\u25AA", color:
|
|
74231
|
+
return { symbol: "\u25AA", color: DIM };
|
|
73733
74232
|
}
|
|
73734
74233
|
}
|
|
73735
74234
|
function displayChangelog(entries) {
|
|
@@ -73737,34 +74236,34 @@ function displayChangelog(entries) {
|
|
|
73737
74236
|
return;
|
|
73738
74237
|
}
|
|
73739
74238
|
const innerWidth = 50;
|
|
73740
|
-
const headerLabel = ` ${YELLOW}\u2726${
|
|
74239
|
+
const headerLabel = ` ${YELLOW}\u2726${RESET} ${BOLD}What's New${RESET}`;
|
|
73741
74240
|
const headerVisible = 14;
|
|
73742
74241
|
const headerPad = innerWidth - headerVisible;
|
|
73743
74242
|
console.log("");
|
|
73744
|
-
console.log(`${
|
|
73745
|
-
console.log(`${
|
|
73746
|
-
console.log(`${
|
|
74243
|
+
console.log(`${CYAN}\u250C${"\u2500".repeat(innerWidth + 1)}\u2510${RESET}`);
|
|
74244
|
+
console.log(`${CYAN}\u2502${RESET}${headerLabel}${" ".repeat(headerPad)}${CYAN}\u2502${RESET}`);
|
|
74245
|
+
console.log(`${CYAN}\u2514${"\u2500".repeat(innerWidth + 1)}\u2518${RESET}`);
|
|
73747
74246
|
console.log("");
|
|
73748
74247
|
for (const entry of entries) {
|
|
73749
74248
|
const titlePart = entry.title ? ` ${entry.title}` : "";
|
|
73750
|
-
console.log(` ${
|
|
73751
|
-
console.log(` ${
|
|
74249
|
+
console.log(` ${BOLD}${GREEN}v${entry.version}${RESET}${titlePart}`);
|
|
74250
|
+
console.log(` ${DIM}${"\u2500".repeat(30)}${RESET}`);
|
|
73752
74251
|
for (const item of entry.items) {
|
|
73753
74252
|
const { symbol: symbol2, color } = itemStyle(item.type);
|
|
73754
|
-
console.log(` ${color}${symbol2}${
|
|
74253
|
+
console.log(` ${color}${symbol2}${RESET} ${item.text}`);
|
|
73755
74254
|
}
|
|
73756
74255
|
console.log("");
|
|
73757
74256
|
}
|
|
73758
|
-
console.log(`${
|
|
74257
|
+
console.log(`${CYAN}Please restart any running claudish sessions.${RESET}`);
|
|
73759
74258
|
}
|
|
73760
74259
|
function printManualInstructions() {
|
|
73761
74260
|
console.log(`
|
|
73762
|
-
${
|
|
73763
|
-
console.log(`${YELLOW}Please update manually:${
|
|
74261
|
+
${BOLD}Unable to detect installation method.${RESET}`);
|
|
74262
|
+
console.log(`${YELLOW}Please update manually:${RESET}
|
|
73764
74263
|
`);
|
|
73765
|
-
console.log(` ${
|
|
73766
|
-
console.log(` ${
|
|
73767
|
-
console.log(` ${
|
|
74264
|
+
console.log(` ${CYAN}npm:${RESET} npm install -g claudish@latest`);
|
|
74265
|
+
console.log(` ${CYAN}bun:${RESET} bun install -g claudish@latest`);
|
|
74266
|
+
console.log(` ${CYAN}brew:${RESET} brew upgrade claudish
|
|
73768
74267
|
`);
|
|
73769
74268
|
}
|
|
73770
74269
|
function fetchLatestVersionViaNpm() {
|
|
@@ -73793,17 +74292,18 @@ async function resolveLatestVersion() {
|
|
|
73793
74292
|
return { error: fetchError };
|
|
73794
74293
|
}
|
|
73795
74294
|
async function updateCommand() {
|
|
74295
|
+
refreshAnsi2();
|
|
73796
74296
|
const currentVersion = getVersion3();
|
|
73797
74297
|
const installInfo = detectInstallationMethod();
|
|
73798
74298
|
const result = await resolveLatestVersion();
|
|
73799
74299
|
if ("error" in result) {
|
|
73800
|
-
console.error(`${RED2}\u2717${
|
|
73801
|
-
console.error(`${
|
|
73802
|
-
console.error(`${YELLOW}The npm registry may be slow or unreachable from this network.${
|
|
74300
|
+
console.error(`${RED2}\u2717${RESET} Unable to fetch latest version from npm registry.`);
|
|
74301
|
+
console.error(`${DIM}Reason: ${result.error}${RESET}`);
|
|
74302
|
+
console.error(`${YELLOW}The npm registry may be slow or unreachable from this network.${RESET}`);
|
|
73803
74303
|
const manualCommand = getUpdateCommand(installInfo.method);
|
|
73804
74304
|
if (manualCommand) {
|
|
73805
|
-
console.error(`${YELLOW}You can update manually:${
|
|
73806
|
-
console.error(` ${
|
|
74305
|
+
console.error(`${YELLOW}You can update manually:${RESET}`);
|
|
74306
|
+
console.error(` ${CYAN}${manualCommand}${RESET}
|
|
73807
74307
|
`);
|
|
73808
74308
|
} else {
|
|
73809
74309
|
printManualInstructions();
|
|
@@ -73813,24 +74313,24 @@ async function updateCommand() {
|
|
|
73813
74313
|
const latestVersion = result.version;
|
|
73814
74314
|
const comparison = compareVersions(latestVersion, currentVersion);
|
|
73815
74315
|
if (comparison <= 0) {
|
|
73816
|
-
console.log(`${
|
|
73817
|
-
console.log(`${
|
|
74316
|
+
console.log(`${GREEN}\u2713${RESET} ${BOLD}Already up-to-date!${RESET}`);
|
|
74317
|
+
console.log(`${CYAN}Current version: ${currentVersion}${RESET}
|
|
73818
74318
|
`);
|
|
73819
74319
|
process.exit(0);
|
|
73820
74320
|
}
|
|
73821
|
-
console.log(` ${
|
|
74321
|
+
console.log(` ${BOLD}claudish${RESET} ${YELLOW}v${currentVersion}${RESET} ${DIM}\u2192${RESET} ${GREEN}v${latestVersion}${RESET} ${DIM}(${installInfo.method})${RESET}`);
|
|
73822
74322
|
if (installInfo.method === "unknown") {
|
|
73823
74323
|
printManualInstructions();
|
|
73824
74324
|
process.exit(1);
|
|
73825
74325
|
}
|
|
73826
74326
|
const command = getUpdateCommand(installInfo.method);
|
|
73827
74327
|
console.log(`
|
|
73828
|
-
${
|
|
74328
|
+
${DIM}Updating...${RESET}
|
|
73829
74329
|
`);
|
|
73830
74330
|
const success2 = await executeUpdate(command);
|
|
73831
74331
|
if (success2) {
|
|
73832
74332
|
console.log(`
|
|
73833
|
-
${
|
|
74333
|
+
${GREEN}\u2713${RESET} ${BOLD}Updated successfully${RESET}`);
|
|
73834
74334
|
clearCache();
|
|
73835
74335
|
const changelog = await fetchChangelog(currentVersion, latestVersion);
|
|
73836
74336
|
displayChangelog(changelog);
|
|
@@ -73840,9 +74340,10 @@ ${DIM2}Updating...${RESET2}
|
|
|
73840
74340
|
process.exit(1);
|
|
73841
74341
|
}
|
|
73842
74342
|
}
|
|
73843
|
-
var
|
|
74343
|
+
var RESET = "", BOLD = "", GREEN = "", YELLOW = "", CYAN = "", RED2 = "", MAGENTA = "", DIM = "", SECTION_TYPE_MAP;
|
|
73844
74344
|
var init_update_command = __esm(() => {
|
|
73845
74345
|
init_cli();
|
|
74346
|
+
init_ansi();
|
|
73846
74347
|
init_update_checker();
|
|
73847
74348
|
SECTION_TYPE_MAP = {
|
|
73848
74349
|
"new features": "feat",
|
|
@@ -73871,6 +74372,9 @@ __export(exports_profile_commands, {
|
|
|
73871
74372
|
profileAddCommand: () => profileAddCommand,
|
|
73872
74373
|
initCommand: () => initCommand
|
|
73873
74374
|
});
|
|
74375
|
+
function refreshAnsi3() {
|
|
74376
|
+
({ RESET: RESET2, BOLD: BOLD2, DIM: DIM2, GREEN: GREEN2, YELLOW: YELLOW2, CYAN: CYAN2, MAGENTA: MAGENTA2 } = cliAnsi());
|
|
74377
|
+
}
|
|
73874
74378
|
function parseScopeFlag(args) {
|
|
73875
74379
|
const remainingArgs = [];
|
|
73876
74380
|
let scope;
|
|
@@ -73907,16 +74411,17 @@ async function resolveScope(scopeFlag) {
|
|
|
73907
74411
|
}
|
|
73908
74412
|
function scopeBadge(scope, shadowed) {
|
|
73909
74413
|
if (scope === "local") {
|
|
73910
|
-
return `${MAGENTA2}[local]${
|
|
74414
|
+
return `${MAGENTA2}[local]${RESET2}`;
|
|
73911
74415
|
}
|
|
73912
74416
|
if (shadowed) {
|
|
73913
|
-
return `${
|
|
74417
|
+
return `${DIM2}[global, shadowed]${RESET2}`;
|
|
73914
74418
|
}
|
|
73915
|
-
return `${
|
|
74419
|
+
return `${DIM2}[global]${RESET2}`;
|
|
73916
74420
|
}
|
|
73917
74421
|
async function initCommand(scopeFlag) {
|
|
74422
|
+
refreshAnsi3();
|
|
73918
74423
|
console.log(`
|
|
73919
|
-
${
|
|
74424
|
+
${BOLD2}${CYAN2}Claudish Setup Wizard${RESET2}
|
|
73920
74425
|
`);
|
|
73921
74426
|
const scope = await resolveScope(scopeFlag);
|
|
73922
74427
|
const configPath = getConfigPathForScope(scope);
|
|
@@ -73930,31 +74435,32 @@ ${BOLD3}${CYAN3}Claudish Setup Wizard${RESET3}
|
|
|
73930
74435
|
return;
|
|
73931
74436
|
}
|
|
73932
74437
|
}
|
|
73933
|
-
console.log(`${
|
|
74438
|
+
console.log(`${DIM2}This wizard will help you set up Claudish with your preferred models.${RESET2}
|
|
73934
74439
|
`);
|
|
73935
74440
|
const profileName = "default";
|
|
73936
|
-
console.log(`${
|
|
73937
|
-
console.log(`${
|
|
74441
|
+
console.log(`${BOLD2}Step 1: Select models for each Claude tier${RESET2}`);
|
|
74442
|
+
console.log(`${DIM2}These models will be used when Claude Code requests specific model types.${RESET2}
|
|
73938
74443
|
`);
|
|
73939
74444
|
const models = await selectModelsForProfile();
|
|
73940
74445
|
const profile = createProfile(profileName, models, undefined, scope);
|
|
73941
74446
|
setDefaultProfile(profileName, scope);
|
|
73942
74447
|
console.log(`
|
|
73943
|
-
${
|
|
74448
|
+
${GREEN2}\u2713${RESET2} Configuration saved to: ${CYAN2}${configPath}${RESET2}`);
|
|
73944
74449
|
console.log(`
|
|
73945
|
-
${
|
|
74450
|
+
${BOLD2}Profile created:${RESET2}`);
|
|
73946
74451
|
printProfile(profile, true, false, scope);
|
|
73947
74452
|
console.log(`
|
|
73948
|
-
${
|
|
73949
|
-
console.log(` ${
|
|
73950
|
-
console.log(` ${
|
|
74453
|
+
${BOLD2}Usage:${RESET2}`);
|
|
74454
|
+
console.log(` ${CYAN2}claudish${RESET2} # Use default profile`);
|
|
74455
|
+
console.log(` ${CYAN2}claudish profile add${RESET2} # Add another profile`);
|
|
73951
74456
|
if (scope === "local") {
|
|
73952
74457
|
console.log(`
|
|
73953
|
-
${
|
|
74458
|
+
${DIM2}Local config applies only when running from this directory.${RESET2}`);
|
|
73954
74459
|
}
|
|
73955
74460
|
console.log("");
|
|
73956
74461
|
}
|
|
73957
74462
|
async function profileListCommand(scopeFilter) {
|
|
74463
|
+
refreshAnsi3();
|
|
73958
74464
|
const allProfiles = listAllProfiles();
|
|
73959
74465
|
const profiles = scopeFilter ? allProfiles.filter((p) => p.scope === scopeFilter) : allProfiles;
|
|
73960
74466
|
if (profiles.length === 0) {
|
|
@@ -73966,11 +74472,11 @@ async function profileListCommand(scopeFilter) {
|
|
|
73966
74472
|
return;
|
|
73967
74473
|
}
|
|
73968
74474
|
console.log(`
|
|
73969
|
-
${
|
|
74475
|
+
${BOLD2}Claudish Profiles${RESET2}
|
|
73970
74476
|
`);
|
|
73971
|
-
console.log(`${
|
|
74477
|
+
console.log(`${DIM2}Global: ${getConfigPath()}${RESET2}`);
|
|
73972
74478
|
if (localConfigExists()) {
|
|
73973
|
-
console.log(`${
|
|
74479
|
+
console.log(`${DIM2}Local: ${getLocalConfigPath()}${RESET2}`);
|
|
73974
74480
|
}
|
|
73975
74481
|
console.log("");
|
|
73976
74482
|
for (const profile of profiles) {
|
|
@@ -73979,20 +74485,21 @@ ${BOLD3}Claudish Profiles${RESET3}
|
|
|
73979
74485
|
}
|
|
73980
74486
|
}
|
|
73981
74487
|
async function profileAddCommand(scopeFlag) {
|
|
74488
|
+
refreshAnsi3();
|
|
73982
74489
|
console.log(`
|
|
73983
|
-
${
|
|
74490
|
+
${BOLD2}${CYAN2}Add New Profile${RESET2}
|
|
73984
74491
|
`);
|
|
73985
74492
|
const scope = await resolveScope(scopeFlag);
|
|
73986
74493
|
const existingNames = getProfileNames(scope);
|
|
73987
74494
|
const name = await promptForProfileName(existingNames);
|
|
73988
74495
|
const description = await promptForProfileDescription();
|
|
73989
74496
|
console.log(`
|
|
73990
|
-
${
|
|
74497
|
+
${BOLD2}Select models for this profile:${RESET2}
|
|
73991
74498
|
`);
|
|
73992
74499
|
const models = await selectModelsForProfile();
|
|
73993
74500
|
const profile = createProfile(name, models, description, scope);
|
|
73994
74501
|
console.log(`
|
|
73995
|
-
${
|
|
74502
|
+
${GREEN2}\u2713${RESET2} Profile "${name}" created ${scopeBadge(scope)}.`);
|
|
73996
74503
|
printProfile(profile, false, false, scope);
|
|
73997
74504
|
const setAsDefault = await dist_default4({
|
|
73998
74505
|
message: `Set this profile as default in ${scope} config?`,
|
|
@@ -74000,10 +74507,11 @@ ${GREEN3}\u2713${RESET3} Profile "${name}" created ${scopeBadge(scope)}.`);
|
|
|
74000
74507
|
});
|
|
74001
74508
|
if (setAsDefault) {
|
|
74002
74509
|
setDefaultProfile(name, scope);
|
|
74003
|
-
console.log(`${
|
|
74510
|
+
console.log(`${GREEN2}\u2713${RESET2} "${name}" is now the default ${scope} profile.`);
|
|
74004
74511
|
}
|
|
74005
74512
|
}
|
|
74006
74513
|
async function profileRemoveCommand(name, scopeFlag) {
|
|
74514
|
+
refreshAnsi3();
|
|
74007
74515
|
let scope = scopeFlag;
|
|
74008
74516
|
let profileName = name;
|
|
74009
74517
|
if (!profileName) {
|
|
@@ -74016,7 +74524,7 @@ async function profileRemoveCommand(name, scopeFlag) {
|
|
|
74016
74524
|
const choice = await dist_default11({
|
|
74017
74525
|
message: "Select a profile to remove:",
|
|
74018
74526
|
choices: selectable.map((p) => ({
|
|
74019
|
-
name: `${p.name} ${scopeBadge(p.scope)}${p.isDefault ? ` ${YELLOW2}(default)${
|
|
74527
|
+
name: `${p.name} ${scopeBadge(p.scope)}${p.isDefault ? ` ${YELLOW2}(default)${RESET2}` : ""}`,
|
|
74020
74528
|
value: `${p.scope}:${p.name}`
|
|
74021
74529
|
}))
|
|
74022
74530
|
});
|
|
@@ -74064,12 +74572,13 @@ async function profileRemoveCommand(name, scopeFlag) {
|
|
|
74064
74572
|
}
|
|
74065
74573
|
try {
|
|
74066
74574
|
deleteProfile(profileName, scope);
|
|
74067
|
-
console.log(`${
|
|
74575
|
+
console.log(`${GREEN2}\u2713${RESET2} Profile "${profileName}" deleted from ${scope} config.`);
|
|
74068
74576
|
} catch (error46) {
|
|
74069
74577
|
console.error(`Error: ${error46}`);
|
|
74070
74578
|
}
|
|
74071
74579
|
}
|
|
74072
74580
|
async function profileUseCommand(name, scopeFlag) {
|
|
74581
|
+
refreshAnsi3();
|
|
74073
74582
|
let scope = scopeFlag;
|
|
74074
74583
|
let profileName = name;
|
|
74075
74584
|
if (!profileName) {
|
|
@@ -74082,7 +74591,7 @@ async function profileUseCommand(name, scopeFlag) {
|
|
|
74082
74591
|
const choice = await dist_default11({
|
|
74083
74592
|
message: "Select a profile to set as default:",
|
|
74084
74593
|
choices: selectable.map((p) => ({
|
|
74085
|
-
name: `${p.name} ${scopeBadge(p.scope)}${p.isDefault ? ` ${YELLOW2}(default)${
|
|
74594
|
+
name: `${p.name} ${scopeBadge(p.scope)}${p.isDefault ? ` ${YELLOW2}(default)${RESET2}` : ""}`,
|
|
74086
74595
|
value: `${p.scope}:${p.name}`
|
|
74087
74596
|
}))
|
|
74088
74597
|
});
|
|
@@ -74118,9 +74627,10 @@ async function profileUseCommand(name, scopeFlag) {
|
|
|
74118
74627
|
return;
|
|
74119
74628
|
}
|
|
74120
74629
|
setDefaultProfile(profileName, scope);
|
|
74121
|
-
console.log(`${
|
|
74630
|
+
console.log(`${GREEN2}\u2713${RESET2} "${profileName}" is now the default ${scope} profile.`);
|
|
74122
74631
|
}
|
|
74123
74632
|
async function profileShowCommand(name, scopeFlag) {
|
|
74633
|
+
refreshAnsi3();
|
|
74124
74634
|
let profileName = name;
|
|
74125
74635
|
let scope = scopeFlag;
|
|
74126
74636
|
if (!profileName) {
|
|
@@ -74160,6 +74670,7 @@ async function profileShowCommand(name, scopeFlag) {
|
|
|
74160
74670
|
printProfile(profile, isDefault, true, scope);
|
|
74161
74671
|
}
|
|
74162
74672
|
async function profileEditCommand(name, scopeFlag) {
|
|
74673
|
+
refreshAnsi3();
|
|
74163
74674
|
let scope = scopeFlag;
|
|
74164
74675
|
let profileName = name;
|
|
74165
74676
|
if (!profileName) {
|
|
@@ -74172,7 +74683,7 @@ async function profileEditCommand(name, scopeFlag) {
|
|
|
74172
74683
|
const choice = await dist_default11({
|
|
74173
74684
|
message: "Select a profile to edit:",
|
|
74174
74685
|
choices: selectable.map((p) => ({
|
|
74175
|
-
name: `${p.name} ${scopeBadge(p.scope)}${p.isDefault ? ` ${YELLOW2}(default)${
|
|
74686
|
+
name: `${p.name} ${scopeBadge(p.scope)}${p.isDefault ? ` ${YELLOW2}(default)${RESET2}` : ""}`,
|
|
74176
74687
|
value: `${p.scope}:${p.name}`
|
|
74177
74688
|
}))
|
|
74178
74689
|
});
|
|
@@ -74207,9 +74718,9 @@ async function profileEditCommand(name, scopeFlag) {
|
|
|
74207
74718
|
return;
|
|
74208
74719
|
}
|
|
74209
74720
|
console.log(`
|
|
74210
|
-
${
|
|
74721
|
+
${BOLD2}Editing profile: ${profileName}${RESET2} ${scopeBadge(scope)}
|
|
74211
74722
|
`);
|
|
74212
|
-
console.log(`${
|
|
74723
|
+
console.log(`${DIM2}Current models:${RESET2}`);
|
|
74213
74724
|
printModelMapping(profile.models);
|
|
74214
74725
|
console.log("");
|
|
74215
74726
|
const whatToEdit = await dist_default11({
|
|
@@ -74231,14 +74742,14 @@ ${BOLD3}Editing profile: ${profileName}${RESET3} ${scopeBadge(scope)}
|
|
|
74231
74742
|
const newDescription = await promptForProfileDescription();
|
|
74232
74743
|
profile.description = newDescription;
|
|
74233
74744
|
setProfile(profile, scope);
|
|
74234
|
-
console.log(`${
|
|
74745
|
+
console.log(`${GREEN2}\u2713${RESET2} Description updated.`);
|
|
74235
74746
|
return;
|
|
74236
74747
|
}
|
|
74237
74748
|
if (whatToEdit === "all") {
|
|
74238
74749
|
const models = await selectModelsForProfile();
|
|
74239
74750
|
profile.models = { ...profile.models, ...models };
|
|
74240
74751
|
setProfile(profile, scope);
|
|
74241
|
-
console.log(`${
|
|
74752
|
+
console.log(`${GREEN2}\u2713${RESET2} All models updated.`);
|
|
74242
74753
|
return;
|
|
74243
74754
|
}
|
|
74244
74755
|
const tier = whatToEdit;
|
|
@@ -74248,42 +74759,43 @@ ${BOLD3}Editing profile: ${profileName}${RESET3} ${scopeBadge(scope)}
|
|
|
74248
74759
|
});
|
|
74249
74760
|
profile.models[tier] = newModel;
|
|
74250
74761
|
setProfile(profile, scope);
|
|
74251
|
-
console.log(`${
|
|
74762
|
+
console.log(`${GREEN2}\u2713${RESET2} ${tierName} model updated to: ${newModel}`);
|
|
74252
74763
|
}
|
|
74253
74764
|
function printProfile(profile, isDefault, verbose = false, scope) {
|
|
74254
|
-
const defaultBadge = isDefault ? ` ${YELLOW2}(default)${
|
|
74765
|
+
const defaultBadge = isDefault ? ` ${YELLOW2}(default)${RESET2}` : "";
|
|
74255
74766
|
const scopeTag = scope ? ` ${scopeBadge(scope)}` : "";
|
|
74256
|
-
console.log(`${
|
|
74767
|
+
console.log(`${BOLD2}${profile.name}${RESET2}${defaultBadge}${scopeTag}`);
|
|
74257
74768
|
if (profile.description) {
|
|
74258
|
-
console.log(` ${
|
|
74769
|
+
console.log(` ${DIM2}${profile.description}${RESET2}`);
|
|
74259
74770
|
}
|
|
74260
74771
|
printModelMapping(profile.models);
|
|
74261
74772
|
if (verbose) {
|
|
74262
|
-
console.log(` ${
|
|
74263
|
-
console.log(` ${
|
|
74773
|
+
console.log(` ${DIM2}Created: ${profile.createdAt}${RESET2}`);
|
|
74774
|
+
console.log(` ${DIM2}Updated: ${profile.updatedAt}${RESET2}`);
|
|
74264
74775
|
}
|
|
74265
74776
|
}
|
|
74266
74777
|
function printProfileWithScope(profile) {
|
|
74267
|
-
const defaultBadge = profile.isDefault ? ` ${YELLOW2}(default)${
|
|
74778
|
+
const defaultBadge = profile.isDefault ? ` ${YELLOW2}(default)${RESET2}` : "";
|
|
74268
74779
|
const badge = scopeBadge(profile.scope, profile.shadowed);
|
|
74269
|
-
console.log(`${
|
|
74780
|
+
console.log(`${BOLD2}${profile.name}${RESET2}${defaultBadge} ${badge}`);
|
|
74270
74781
|
if (profile.shadowed) {
|
|
74271
|
-
console.log(` ${
|
|
74782
|
+
console.log(` ${DIM2}(overridden by local profile of same name)${RESET2}`);
|
|
74272
74783
|
}
|
|
74273
74784
|
if (profile.description) {
|
|
74274
|
-
console.log(` ${
|
|
74785
|
+
console.log(` ${DIM2}${profile.description}${RESET2}`);
|
|
74275
74786
|
}
|
|
74276
74787
|
printModelMapping(profile.models);
|
|
74277
74788
|
}
|
|
74278
74789
|
function printModelMapping(models) {
|
|
74279
|
-
console.log(` ${
|
|
74280
|
-
console.log(` ${
|
|
74281
|
-
console.log(` ${
|
|
74790
|
+
console.log(` ${CYAN2}opus${RESET2}: ${models.opus || `${DIM2}not set${RESET2}`}`);
|
|
74791
|
+
console.log(` ${CYAN2}sonnet${RESET2}: ${models.sonnet || `${DIM2}not set${RESET2}`}`);
|
|
74792
|
+
console.log(` ${CYAN2}haiku${RESET2}: ${models.haiku || `${DIM2}not set${RESET2}`}`);
|
|
74282
74793
|
if (models.subagent) {
|
|
74283
|
-
console.log(` ${
|
|
74794
|
+
console.log(` ${CYAN2}subagent${RESET2}: ${models.subagent}`);
|
|
74284
74795
|
}
|
|
74285
74796
|
}
|
|
74286
74797
|
async function profileCommand(args) {
|
|
74798
|
+
refreshAnsi3();
|
|
74287
74799
|
const { scope, remainingArgs } = parseScopeFlag(args);
|
|
74288
74800
|
const subcommand = remainingArgs[0];
|
|
74289
74801
|
const name = remainingArgs[1];
|
|
@@ -74320,22 +74832,22 @@ async function profileCommand(args) {
|
|
|
74320
74832
|
}
|
|
74321
74833
|
function printProfileHelp() {
|
|
74322
74834
|
console.log(`
|
|
74323
|
-
${
|
|
74324
|
-
|
|
74325
|
-
${
|
|
74326
|
-
${
|
|
74327
|
-
${
|
|
74328
|
-
${
|
|
74329
|
-
${
|
|
74330
|
-
${
|
|
74331
|
-
${
|
|
74332
|
-
|
|
74333
|
-
${
|
|
74334
|
-
${
|
|
74335
|
-
${
|
|
74336
|
-
${
|
|
74337
|
-
|
|
74338
|
-
${
|
|
74835
|
+
${BOLD2}Usage:${RESET2} claudish profile <command> [options]
|
|
74836
|
+
|
|
74837
|
+
${BOLD2}Commands:${RESET2}
|
|
74838
|
+
${CYAN2}list${RESET2}, ${CYAN2}ls${RESET2} List all profiles
|
|
74839
|
+
${CYAN2}add${RESET2}, ${CYAN2}new${RESET2} Add a new profile
|
|
74840
|
+
${CYAN2}remove${RESET2} ${DIM2}[name]${RESET2} Remove a profile
|
|
74841
|
+
${CYAN2}use${RESET2} ${DIM2}[name]${RESET2} Set default profile
|
|
74842
|
+
${CYAN2}show${RESET2} ${DIM2}[name]${RESET2} Show profile details
|
|
74843
|
+
${CYAN2}edit${RESET2} ${DIM2}[name]${RESET2} Edit a profile
|
|
74844
|
+
|
|
74845
|
+
${BOLD2}Scope Flags:${RESET2}
|
|
74846
|
+
${CYAN2}--local${RESET2} Target .claudish.json in the current directory
|
|
74847
|
+
${CYAN2}--global${RESET2} Target ~/.claudish/config.json (default)
|
|
74848
|
+
${DIM2}If neither flag is given, you'll be prompted interactively.${RESET2}
|
|
74849
|
+
|
|
74850
|
+
${BOLD2}Examples:${RESET2}
|
|
74339
74851
|
claudish profile list
|
|
74340
74852
|
claudish profile list --local
|
|
74341
74853
|
claudish profile add --local
|
|
@@ -74345,11 +74857,12 @@ ${BOLD3}Examples:${RESET3}
|
|
|
74345
74857
|
claudish init --local
|
|
74346
74858
|
`);
|
|
74347
74859
|
}
|
|
74348
|
-
var
|
|
74860
|
+
var RESET2 = "", BOLD2 = "", DIM2 = "", GREEN2 = "", YELLOW2 = "", CYAN2 = "", MAGENTA2 = "";
|
|
74349
74861
|
var init_profile_commands = __esm(() => {
|
|
74350
74862
|
init_dist16();
|
|
74351
74863
|
init_model_selector();
|
|
74352
74864
|
init_profile_config();
|
|
74865
|
+
init_ansi();
|
|
74353
74866
|
});
|
|
74354
74867
|
|
|
74355
74868
|
// src/providers/local-liveness.ts
|
|
@@ -74401,9 +74914,9 @@ var init_local_liveness = __esm(() => {
|
|
|
74401
74914
|
});
|
|
74402
74915
|
|
|
74403
74916
|
// src/providers/probe-catalog.ts
|
|
74404
|
-
import { existsSync as existsSync29, mkdirSync as
|
|
74917
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync18, readFileSync as readFileSync29, writeFileSync as writeFileSync20 } from "fs";
|
|
74405
74918
|
import { homedir as homedir33 } from "os";
|
|
74406
|
-
import { dirname as dirname12, join as
|
|
74919
|
+
import { dirname as dirname12, join as join38 } from "path";
|
|
74407
74920
|
function readProbeModelsCache(path2 = PROBE_MODELS_CACHE_PATH) {
|
|
74408
74921
|
if (!existsSync29(path2))
|
|
74409
74922
|
return null;
|
|
@@ -74418,7 +74931,7 @@ function readProbeModelsCache(path2 = PROBE_MODELS_CACHE_PATH) {
|
|
|
74418
74931
|
return raw2;
|
|
74419
74932
|
}
|
|
74420
74933
|
function writeProbeModelsCache(data, path2 = PROBE_MODELS_CACHE_PATH) {
|
|
74421
|
-
|
|
74934
|
+
mkdirSync18(dirname12(path2), { recursive: true });
|
|
74422
74935
|
writeFileSync20(path2, JSON.stringify(data), "utf-8");
|
|
74423
74936
|
}
|
|
74424
74937
|
function isCacheFresh(data, ttlMs = CACHE_TTL_MS4) {
|
|
@@ -74538,7 +75051,7 @@ function isValidResponse(raw2) {
|
|
|
74538
75051
|
var PROBE_MODELS_URL = "https://us-central1-claudish-6da10.cloudfunctions.net/probeModels", CACHE_TTL_MS4, FETCH_TIMEOUT_MS3 = 15000, PROBE_MODELS_CACHE_PATH, _inFlight = null;
|
|
74539
75052
|
var init_probe_catalog = __esm(() => {
|
|
74540
75053
|
CACHE_TTL_MS4 = 60 * 60 * 1000;
|
|
74541
|
-
PROBE_MODELS_CACHE_PATH =
|
|
75054
|
+
PROBE_MODELS_CACHE_PATH = join38(homedir33(), ".claudish", "probe-models.json");
|
|
74542
75055
|
});
|
|
74543
75056
|
|
|
74544
75057
|
// src/tui/constants.ts
|
|
@@ -74817,7 +75330,7 @@ function OnepasswordContent({
|
|
|
74817
75330
|
children: " "
|
|
74818
75331
|
}, undefined, false, undefined, this),
|
|
74819
75332
|
/* @__PURE__ */ jsxDEV4("span", {
|
|
74820
|
-
fg: selected ? C.
|
|
75333
|
+
fg: selected ? C.strong : C.fgMuted,
|
|
74821
75334
|
attributes: A.boldIf(selected),
|
|
74822
75335
|
children: e.value
|
|
74823
75336
|
}, undefined, false, undefined, this),
|
|
@@ -74922,7 +75435,7 @@ function OnepasswordContent({
|
|
|
74922
75435
|
children: "\u25B4 "
|
|
74923
75436
|
}, undefined, false, undefined, this),
|
|
74924
75437
|
/* @__PURE__ */ jsxDEV4("span", {
|
|
74925
|
-
fg: C.
|
|
75438
|
+
fg: C.strong,
|
|
74926
75439
|
children: `project: ${account.project}`
|
|
74927
75440
|
}, undefined, false, undefined, this)
|
|
74928
75441
|
]
|
|
@@ -74934,7 +75447,7 @@ function OnepasswordContent({
|
|
|
74934
75447
|
children: "\u2022 "
|
|
74935
75448
|
}, undefined, false, undefined, this),
|
|
74936
75449
|
/* @__PURE__ */ jsxDEV4("span", {
|
|
74937
|
-
fg: C.
|
|
75450
|
+
fg: C.strong,
|
|
74938
75451
|
children: `global: ${account.global}`
|
|
74939
75452
|
}, undefined, false, undefined, this)
|
|
74940
75453
|
]
|
|
@@ -74947,7 +75460,7 @@ function OnepasswordContent({
|
|
|
74947
75460
|
/* @__PURE__ */ jsxDEV4("text", {
|
|
74948
75461
|
children: [
|
|
74949
75462
|
/* @__PURE__ */ jsxDEV4("span", {
|
|
74950
|
-
fg: C.
|
|
75463
|
+
fg: C.strong,
|
|
74951
75464
|
attributes: A.bold,
|
|
74952
75465
|
children: String(keyCount)
|
|
74953
75466
|
}, undefined, false, undefined, this),
|
|
@@ -74960,7 +75473,7 @@ function OnepasswordContent({
|
|
|
74960
75473
|
children: " "
|
|
74961
75474
|
}, undefined, false, undefined, this),
|
|
74962
75475
|
/* @__PURE__ */ jsxDEV4("span", {
|
|
74963
|
-
fg: C.
|
|
75476
|
+
fg: C.strong,
|
|
74964
75477
|
attributes: A.bold,
|
|
74965
75478
|
children: String(setCount)
|
|
74966
75479
|
}, undefined, false, undefined, this),
|
|
@@ -74973,7 +75486,7 @@ function OnepasswordContent({
|
|
|
74973
75486
|
children: " "
|
|
74974
75487
|
}, undefined, false, undefined, this),
|
|
74975
75488
|
/* @__PURE__ */ jsxDEV4("span", {
|
|
74976
|
-
fg: C.
|
|
75489
|
+
fg: C.strong,
|
|
74977
75490
|
attributes: A.bold,
|
|
74978
75491
|
children: String(envCount)
|
|
74979
75492
|
}, undefined, false, undefined, this),
|
|
@@ -75134,7 +75647,7 @@ function OnepasswordDetail({ selectedEntry, testResults }) {
|
|
|
75134
75647
|
children: "Kind: "
|
|
75135
75648
|
}, undefined, false, undefined, this),
|
|
75136
75649
|
/* @__PURE__ */ jsxDEV5("span", {
|
|
75137
|
-
fg: C.
|
|
75650
|
+
fg: C.strong,
|
|
75138
75651
|
children: kindLabel2(selectedEntry.kind)
|
|
75139
75652
|
}, undefined, false, undefined, this)
|
|
75140
75653
|
]
|
|
@@ -75147,7 +75660,7 @@ function OnepasswordDetail({ selectedEntry, testResults }) {
|
|
|
75147
75660
|
children: "Value: "
|
|
75148
75661
|
}, undefined, false, undefined, this),
|
|
75149
75662
|
/* @__PURE__ */ jsxDEV5("span", {
|
|
75150
|
-
fg: C.
|
|
75663
|
+
fg: C.strong,
|
|
75151
75664
|
children: selectedEntry.value
|
|
75152
75665
|
}, undefined, false, undefined, this)
|
|
75153
75666
|
]
|
|
@@ -75451,7 +75964,7 @@ function OnepasswordModal({
|
|
|
75451
75964
|
children: "filter: "
|
|
75452
75965
|
}, undefined, false, undefined, this),
|
|
75453
75966
|
filter ? /* @__PURE__ */ jsxDEV6("span", {
|
|
75454
|
-
fg: C.
|
|
75967
|
+
fg: C.strong,
|
|
75455
75968
|
attributes: A.bold,
|
|
75456
75969
|
children: filter
|
|
75457
75970
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV6("span", {
|
|
@@ -75497,7 +76010,7 @@ function OnepasswordModal({
|
|
|
75497
76010
|
children: selected ? "\u25B6 " : " "
|
|
75498
76011
|
}, undefined, false, undefined, this),
|
|
75499
76012
|
/* @__PURE__ */ jsxDEV6("span", {
|
|
75500
|
-
fg: selected ? C.
|
|
76013
|
+
fg: selected ? C.strong : C.fgMuted,
|
|
75501
76014
|
attributes: A.boldIf(selected),
|
|
75502
76015
|
children: row
|
|
75503
76016
|
}, undefined, false, undefined, this)
|
|
@@ -75589,7 +76102,7 @@ function OnepasswordModal({
|
|
|
75589
76102
|
children: "filter: "
|
|
75590
76103
|
}, undefined, false, undefined, this),
|
|
75591
76104
|
filter ? /* @__PURE__ */ jsxDEV6("span", {
|
|
75592
|
-
fg: C.
|
|
76105
|
+
fg: C.strong,
|
|
75593
76106
|
attributes: A.bold,
|
|
75594
76107
|
children: filter
|
|
75595
76108
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV6("span", {
|
|
@@ -75689,7 +76202,7 @@ function OnepasswordModal({
|
|
|
75689
76202
|
focused: true,
|
|
75690
76203
|
width: dialogW - 6,
|
|
75691
76204
|
backgroundColor: C.bgHighlight,
|
|
75692
|
-
textColor: C.
|
|
76205
|
+
textColor: C.strong
|
|
75693
76206
|
}, undefined, false, undefined, this)
|
|
75694
76207
|
]
|
|
75695
76208
|
}, undefined, true, undefined, this),
|
|
@@ -75745,7 +76258,7 @@ function OnepasswordModal({
|
|
|
75745
76258
|
children: selected ? "\u25B6 " : " "
|
|
75746
76259
|
}, undefined, false, undefined, this),
|
|
75747
76260
|
/* @__PURE__ */ jsxDEV6("span", {
|
|
75748
|
-
fg: selected ? C.
|
|
76261
|
+
fg: selected ? C.strong : C.fgMuted,
|
|
75749
76262
|
attributes: A.bold,
|
|
75750
76263
|
children: opt.title
|
|
75751
76264
|
}, undefined, false, undefined, this)
|
|
@@ -75772,7 +76285,7 @@ function OnepasswordModal({
|
|
|
75772
76285
|
backgroundColor: C.bg,
|
|
75773
76286
|
textColor: C.fgMuted,
|
|
75774
76287
|
selectedBackgroundColor: C.bgHighlight,
|
|
75775
|
-
selectedTextColor: C.
|
|
76288
|
+
selectedTextColor: C.strong,
|
|
75776
76289
|
height: SCOPE_OPTIONS.length
|
|
75777
76290
|
}, undefined, false, undefined, this);
|
|
75778
76291
|
} else if (mode === "pick_op_account") {
|
|
@@ -76018,7 +76531,7 @@ function PrivacyContent({
|
|
|
76018
76531
|
}, undefined, false, undefined, this),
|
|
76019
76532
|
/* @__PURE__ */ jsxDEV7("text", {
|
|
76020
76533
|
children: /* @__PURE__ */ jsxDEV7("span", {
|
|
76021
|
-
fg: C.
|
|
76534
|
+
fg: C.strong,
|
|
76022
76535
|
attributes: A.bold,
|
|
76023
76536
|
children: "Never sends keys, prompts, or paths."
|
|
76024
76537
|
}, undefined, false, undefined, this)
|
|
@@ -76087,7 +76600,7 @@ function PrivacyContent({
|
|
|
76087
76600
|
]
|
|
76088
76601
|
}, undefined, true, undefined, this),
|
|
76089
76602
|
/* @__PURE__ */ jsxDEV7("span", {
|
|
76090
|
-
fg: C.
|
|
76603
|
+
fg: C.strong,
|
|
76091
76604
|
attributes: A.bold,
|
|
76092
76605
|
children: bufStats.events
|
|
76093
76606
|
}, undefined, false, undefined, this),
|
|
@@ -76430,7 +76943,7 @@ function ProfilesContent({
|
|
|
76430
76943
|
children: " "
|
|
76431
76944
|
}, undefined, false, undefined, this),
|
|
76432
76945
|
/* @__PURE__ */ jsxDEV10("span", {
|
|
76433
|
-
fg: selected ? C.
|
|
76946
|
+
fg: selected ? C.strong : isActive ? C.orange : C.fgMuted,
|
|
76434
76947
|
attributes: A.boldIf(selected || isActive),
|
|
76435
76948
|
children: namePad
|
|
76436
76949
|
}, undefined, false, undefined, this),
|
|
@@ -76447,7 +76960,7 @@ function ProfilesContent({
|
|
|
76447
76960
|
children: " "
|
|
76448
76961
|
}, undefined, false, undefined, this),
|
|
76449
76962
|
/* @__PURE__ */ jsxDEV10("span", {
|
|
76450
|
-
fg: selected ? C.
|
|
76963
|
+
fg: selected ? C.strong : shadowed ? C.dim : C.fgMuted,
|
|
76451
76964
|
children: shadowed ? "(shadowed by local) " : modelSummary
|
|
76452
76965
|
}, undefined, false, undefined, this)
|
|
76453
76966
|
]
|
|
@@ -76491,7 +77004,7 @@ function ProfilesContent({
|
|
|
76491
77004
|
backgroundColor: C.bg,
|
|
76492
77005
|
textColor: C.fgMuted,
|
|
76493
77006
|
selectedBackgroundColor: C.bgHighlight,
|
|
76494
|
-
selectedTextColor: C.
|
|
77007
|
+
selectedTextColor: C.strong,
|
|
76495
77008
|
height: scopeOptions.length
|
|
76496
77009
|
}, undefined, false, undefined, this),
|
|
76497
77010
|
/* @__PURE__ */ jsxDEV10("text", {
|
|
@@ -76617,7 +77130,7 @@ function ProfilesContent({
|
|
|
76617
77130
|
children: "> "
|
|
76618
77131
|
}, undefined, false, undefined, this),
|
|
76619
77132
|
/* @__PURE__ */ jsxDEV10("span", {
|
|
76620
|
-
fg: editProfileValue === "auto" ? C.yellow : C.
|
|
77133
|
+
fg: editProfileValue === "auto" ? C.yellow : C.strong,
|
|
76621
77134
|
children: editProfileValue
|
|
76622
77135
|
}, undefined, false, undefined, this),
|
|
76623
77136
|
/* @__PURE__ */ jsxDEV10("span", {
|
|
@@ -76648,7 +77161,7 @@ function ProfilesContent({
|
|
|
76648
77161
|
children: s.substring(0, matchIdx)
|
|
76649
77162
|
}, undefined, false, undefined, this),
|
|
76650
77163
|
/* @__PURE__ */ jsxDEV10("span", {
|
|
76651
|
-
fg: selected ? C.
|
|
77164
|
+
fg: selected ? C.strong : C.cyan,
|
|
76652
77165
|
attributes: A.bold,
|
|
76653
77166
|
children: s.substring(matchIdx, matchIdx + lower.length)
|
|
76654
77167
|
}, undefined, false, undefined, this),
|
|
@@ -76658,7 +77171,7 @@ function ProfilesContent({
|
|
|
76658
77171
|
}, undefined, false, undefined, this)
|
|
76659
77172
|
]
|
|
76660
77173
|
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV10("span", {
|
|
76661
|
-
fg: selected ? C.
|
|
77174
|
+
fg: selected ? C.strong : C.fgMuted,
|
|
76662
77175
|
children: s
|
|
76663
77176
|
}, undefined, false, undefined, this)
|
|
76664
77177
|
]
|
|
@@ -76905,7 +77418,7 @@ function ProviderDetail({
|
|
|
76905
77418
|
focused: true,
|
|
76906
77419
|
width: width - 8,
|
|
76907
77420
|
backgroundColor: C.bgHighlight,
|
|
76908
|
-
textColor: C.
|
|
77421
|
+
textColor: C.strong
|
|
76909
77422
|
}, undefined, false, undefined, this)
|
|
76910
77423
|
]
|
|
76911
77424
|
}, undefined, true, undefined, this)
|
|
@@ -77068,7 +77581,7 @@ function ProviderDetail({
|
|
|
77068
77581
|
]
|
|
77069
77582
|
}, undefined, true, undefined, this),
|
|
77070
77583
|
/* @__PURE__ */ jsxDEV11("span", {
|
|
77071
|
-
fg: C.
|
|
77584
|
+
fg: C.strong,
|
|
77072
77585
|
children: selectedProvider.description
|
|
77073
77586
|
}, undefined, false, undefined, this)
|
|
77074
77587
|
]
|
|
@@ -77300,7 +77813,7 @@ function ProvidersContent({
|
|
|
77300
77813
|
children: " "
|
|
77301
77814
|
}, undefined, false, undefined, this),
|
|
77302
77815
|
/* @__PURE__ */ jsxDEV12("span", {
|
|
77303
|
-
fg: selected ? C.
|
|
77816
|
+
fg: selected ? C.strong : isReady ? C.fgMuted : C.dim,
|
|
77304
77817
|
attributes: A.boldIf(selected),
|
|
77305
77818
|
children: pad(p.displayName, COL_NAME)
|
|
77306
77819
|
}, undefined, false, undefined, this),
|
|
@@ -77320,14 +77833,14 @@ function ProvidersContent({
|
|
|
77320
77833
|
/* @__PURE__ */ jsxDEV12(Fragment8, {
|
|
77321
77834
|
children: [
|
|
77322
77835
|
/* @__PURE__ */ jsxDEV12("span", {
|
|
77323
|
-
fg: keySlot.set ? C.
|
|
77836
|
+
fg: keySlot.set ? C.strong : C.dim,
|
|
77324
77837
|
children: keySlotGlyph
|
|
77325
77838
|
}, undefined, false, undefined, this),
|
|
77326
77839
|
/* @__PURE__ */ jsxDEV12("span", {
|
|
77327
77840
|
children: " "
|
|
77328
77841
|
}, undefined, false, undefined, this),
|
|
77329
77842
|
/* @__PURE__ */ jsxDEV12("span", {
|
|
77330
|
-
fg: oauthSlot.set ? C.
|
|
77843
|
+
fg: oauthSlot.set ? C.strong : C.dim,
|
|
77331
77844
|
children: oauthSlotGlyph
|
|
77332
77845
|
}, undefined, false, undefined, this)
|
|
77333
77846
|
]
|
|
@@ -77352,7 +77865,7 @@ function ProvidersContent({
|
|
|
77352
77865
|
fg: C.yellow,
|
|
77353
77866
|
children: tr.error.replace(/\s+/g, " ").trim()
|
|
77354
77867
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV12("span", {
|
|
77355
|
-
fg: selected ? C.
|
|
77868
|
+
fg: selected ? C.strong : C.dim,
|
|
77356
77869
|
children: p.description
|
|
77357
77870
|
}, undefined, false, undefined, this)
|
|
77358
77871
|
]
|
|
@@ -77531,7 +78044,7 @@ function RoutingContent({
|
|
|
77531
78044
|
children: [
|
|
77532
78045
|
/* @__PURE__ */ jsxDEV13("text", {
|
|
77533
78046
|
children: /* @__PURE__ */ jsxDEV13("span", {
|
|
77534
|
-
fg: C.
|
|
78047
|
+
fg: C.strong,
|
|
77535
78048
|
attributes: A.bold,
|
|
77536
78049
|
children: "Route Probe"
|
|
77537
78050
|
}, undefined, false, undefined, this)
|
|
@@ -77556,7 +78069,7 @@ function RoutingContent({
|
|
|
77556
78069
|
children: "> "
|
|
77557
78070
|
}, undefined, false, undefined, this),
|
|
77558
78071
|
/* @__PURE__ */ jsxDEV13("span", {
|
|
77559
|
-
fg: C.
|
|
78072
|
+
fg: C.strong,
|
|
77560
78073
|
children: probeModel
|
|
77561
78074
|
}, undefined, false, undefined, this),
|
|
77562
78075
|
/* @__PURE__ */ jsxDEV13("span", {
|
|
@@ -77614,7 +78127,7 @@ function RoutingContent({
|
|
|
77614
78127
|
children: /* @__PURE__ */ jsxDEV13("text", {
|
|
77615
78128
|
children: [
|
|
77616
78129
|
/* @__PURE__ */ jsxDEV13("span", {
|
|
77617
|
-
fg: C.
|
|
78130
|
+
fg: C.strong,
|
|
77618
78131
|
attributes: A.bold,
|
|
77619
78132
|
children: probeMode === "done" ? "Probe: " : "Probing: "
|
|
77620
78133
|
}, undefined, false, undefined, this),
|
|
@@ -77673,7 +78186,7 @@ function RoutingContent({
|
|
|
77673
78186
|
children: `${idx + 1}. `
|
|
77674
78187
|
}, undefined, false, undefined, this),
|
|
77675
78188
|
/* @__PURE__ */ jsxDEV13("span", {
|
|
77676
|
-
fg: isNoKey ? C.dim : isSelected ? C.
|
|
78189
|
+
fg: isNoKey ? C.dim : isSelected ? C.strong : isNotReached ? C.dim : C.fgMuted,
|
|
77677
78190
|
attributes: A.boldIf(isSelected),
|
|
77678
78191
|
children: nameCol
|
|
77679
78192
|
}, undefined, false, undefined, this),
|
|
@@ -77948,7 +78461,7 @@ function RoutingContent({
|
|
|
77948
78461
|
scopeText = "global ";
|
|
77949
78462
|
scopeFg = C.green;
|
|
77950
78463
|
}
|
|
77951
|
-
const patFg = sel ? C.
|
|
78464
|
+
const patFg = sel ? C.strong : isDefault ? C.fgMuted : C.cyan;
|
|
77952
78465
|
const chainFg = sel ? C.cyan : isDefault ? C.dim : C.fgMuted;
|
|
77953
78466
|
return /* @__PURE__ */ jsxDEV13("box", {
|
|
77954
78467
|
height: 1,
|
|
@@ -77996,7 +78509,7 @@ function RoutingContent({
|
|
|
77996
78509
|
children: "Scope for "
|
|
77997
78510
|
}, undefined, false, undefined, this),
|
|
77998
78511
|
/* @__PURE__ */ jsxDEV13("span", {
|
|
77999
|
-
fg: C.
|
|
78512
|
+
fg: C.strong,
|
|
78000
78513
|
attributes: A.bold,
|
|
78001
78514
|
children: routingPattern
|
|
78002
78515
|
}, undefined, false, undefined, this),
|
|
@@ -78155,7 +78668,7 @@ function RoutingContent({
|
|
|
78155
78668
|
children: "> "
|
|
78156
78669
|
}, undefined, false, undefined, this),
|
|
78157
78670
|
/* @__PURE__ */ jsxDEV13("span", {
|
|
78158
|
-
fg: C.
|
|
78671
|
+
fg: C.strong,
|
|
78159
78672
|
children: routingPattern
|
|
78160
78673
|
}, undefined, false, undefined, this),
|
|
78161
78674
|
/* @__PURE__ */ jsxDEV13("span", {
|
|
@@ -78208,7 +78721,7 @@ function RoutingContent({
|
|
|
78208
78721
|
children: "Select providers for "
|
|
78209
78722
|
}, undefined, false, undefined, this),
|
|
78210
78723
|
/* @__PURE__ */ jsxDEV13("span", {
|
|
78211
|
-
fg: C.
|
|
78724
|
+
fg: C.strong,
|
|
78212
78725
|
attributes: A.bold,
|
|
78213
78726
|
children: routingPattern
|
|
78214
78727
|
}, undefined, false, undefined, this),
|
|
@@ -78257,7 +78770,7 @@ function RoutingContent({
|
|
|
78257
78770
|
children: " [ ] "
|
|
78258
78771
|
}, undefined, false, undefined, this),
|
|
78259
78772
|
/* @__PURE__ */ jsxDEV13("span", {
|
|
78260
|
-
fg: isCursor ? C.
|
|
78773
|
+
fg: isCursor ? C.strong : ready ? C.fgMuted : C.dim,
|
|
78261
78774
|
attributes: A.boldIf(isCursor),
|
|
78262
78775
|
children: label
|
|
78263
78776
|
}, undefined, false, undefined, this),
|
|
@@ -80505,7 +81018,7 @@ function App({ requestLogin } = {}) {
|
|
|
80505
81018
|
children: /* @__PURE__ */ jsxDEV16("text", {
|
|
80506
81019
|
children: [
|
|
80507
81020
|
/* @__PURE__ */ jsxDEV16("span", {
|
|
80508
|
-
fg: C.
|
|
81021
|
+
fg: C.strong,
|
|
80509
81022
|
attributes: A.bold,
|
|
80510
81023
|
children: "claudish"
|
|
80511
81024
|
}, undefined, false, undefined, this),
|
|
@@ -80758,6 +81271,7 @@ async function startConfigTui() {
|
|
|
80758
81271
|
const renderer = await createCliRenderer2({
|
|
80759
81272
|
exitOnCtrlC: false
|
|
80760
81273
|
});
|
|
81274
|
+
await applyRendererThemeMode(renderer);
|
|
80761
81275
|
await new Promise((resolve5) => {
|
|
80762
81276
|
renderer.once("destroy", () => resolve5());
|
|
80763
81277
|
createRoot2(renderer).render(/* @__PURE__ */ jsxDEV17(App, {
|
|
@@ -80807,6 +81321,7 @@ var init_tui = __esm(() => {
|
|
|
80807
81321
|
init_codex_oauth();
|
|
80808
81322
|
init_kimi_oauth();
|
|
80809
81323
|
init_logger();
|
|
81324
|
+
init_renderer_theme();
|
|
80810
81325
|
init_endpoint_registration();
|
|
80811
81326
|
init_App();
|
|
80812
81327
|
if (isDirectRun) {
|
|
@@ -80870,13 +81385,16 @@ var init_terminal_isolation = __esm(() => {
|
|
|
80870
81385
|
// src/claude-runner.ts
|
|
80871
81386
|
var exports_claude_runner = {};
|
|
80872
81387
|
__export(exports_claude_runner, {
|
|
81388
|
+
shouldHideIncidentalAnthropicKey: () => shouldHideIncidentalAnthropicKey,
|
|
80873
81389
|
runClaudeWithProxy: () => runClaudeWithProxy,
|
|
80874
81390
|
resolveLocalContextWindow: () => resolveLocalContextWindow,
|
|
80875
81391
|
resolveContextWindowEnv: () => resolveContextWindowEnv,
|
|
80876
81392
|
managedSettingsForcesClaudeAi: () => managedSettingsForcesClaudeAi,
|
|
80877
81393
|
isProxyAuthMode: () => isProxyAuthMode,
|
|
80878
81394
|
initializeTokenFile: () => initializeTokenFile,
|
|
81395
|
+
hasResolvableAnthropicAuth: () => hasResolvableAnthropicAuth,
|
|
80879
81396
|
discoverUserStatusLineCommand: () => discoverUserStatusLineCommand,
|
|
81397
|
+
defaultKeychainAnthropicProbe: () => defaultKeychainAnthropicProbe,
|
|
80880
81398
|
createTempSettingsFile: () => createTempSettingsFile,
|
|
80881
81399
|
createStatusLineScript: () => createStatusLineScript,
|
|
80882
81400
|
computeMainThreadContextWindow: () => computeMainThreadContextWindow,
|
|
@@ -80889,11 +81407,11 @@ __export(exports_claude_runner, {
|
|
|
80889
81407
|
MIN_AUTO_COMPACT_WINDOW: () => MIN_AUTO_COMPACT_WINDOW,
|
|
80890
81408
|
CLAUDE_CODE_DEFAULT_MAX_CONTEXT: () => CLAUDE_CODE_DEFAULT_MAX_CONTEXT
|
|
80891
81409
|
});
|
|
80892
|
-
import { spawn as spawn5 } from "child_process";
|
|
81410
|
+
import { spawn as spawn5, spawnSync as spawnSync5 } from "child_process";
|
|
80893
81411
|
import {
|
|
80894
81412
|
closeSync as closeSync5,
|
|
80895
81413
|
existsSync as existsSync30,
|
|
80896
|
-
mkdirSync as
|
|
81414
|
+
mkdirSync as mkdirSync19,
|
|
80897
81415
|
openSync as openSync5,
|
|
80898
81416
|
readFileSync as readFileSync30,
|
|
80899
81417
|
readdirSync as readdirSync6,
|
|
@@ -80902,7 +81420,7 @@ import {
|
|
|
80902
81420
|
writeFileSync as writeFileSync21
|
|
80903
81421
|
} from "fs";
|
|
80904
81422
|
import { homedir as homedir34, tmpdir as tmpdir2 } from "os";
|
|
80905
|
-
import { dirname as dirname13, join as
|
|
81423
|
+
import { dirname as dirname13, join as join39 } from "path";
|
|
80906
81424
|
import { isatty } from "tty";
|
|
80907
81425
|
function releaseTerminalIsolation() {
|
|
80908
81426
|
if (!restoreTerminal)
|
|
@@ -80920,10 +81438,10 @@ function hasNativeAnthropicMapping(config3) {
|
|
|
80920
81438
|
];
|
|
80921
81439
|
return models.some((m) => m && parseModelSpec(m).provider === "native-anthropic");
|
|
80922
81440
|
}
|
|
80923
|
-
function wantsAnthropicApiBilling(config3) {
|
|
81441
|
+
function wantsAnthropicApiBilling(config3, env = process.env) {
|
|
80924
81442
|
if (config3.anthropicApiBilling)
|
|
80925
81443
|
return true;
|
|
80926
|
-
const raw2 =
|
|
81444
|
+
const raw2 = env[ENV.CLAUDISH_ANTHROPIC_API_BILLING];
|
|
80927
81445
|
if (raw2 !== undefined && raw2 !== "" && raw2 !== "0" && raw2.toLowerCase() !== "false")
|
|
80928
81446
|
return true;
|
|
80929
81447
|
try {
|
|
@@ -80932,12 +81450,32 @@ function wantsAnthropicApiBilling(config3) {
|
|
|
80932
81450
|
return false;
|
|
80933
81451
|
}
|
|
80934
81452
|
}
|
|
81453
|
+
function shouldHideIncidentalAnthropicKey(config3, env = process.env) {
|
|
81454
|
+
if (!hasNativeAnthropicMapping(config3))
|
|
81455
|
+
return false;
|
|
81456
|
+
if (!env.ANTHROPIC_API_KEY)
|
|
81457
|
+
return false;
|
|
81458
|
+
return !wantsAnthropicApiBilling(config3, env);
|
|
81459
|
+
}
|
|
81460
|
+
function hasResolvableAnthropicAuth(deps = {}) {
|
|
81461
|
+
const env = deps.env ?? process.env;
|
|
81462
|
+
const fileExists = deps.fileExists ?? existsSync30;
|
|
81463
|
+
const keychainProbe = deps.keychainProbe ?? defaultKeychainAnthropicProbe;
|
|
81464
|
+
if (env.ANTHROPIC_API_KEY || env.ANTHROPIC_AUTH_TOKEN)
|
|
81465
|
+
return true;
|
|
81466
|
+
if (fileExists(join39(homedir34(), ".claude", ".credentials.json")))
|
|
81467
|
+
return true;
|
|
81468
|
+
return keychainProbe();
|
|
81469
|
+
}
|
|
81470
|
+
function shouldPreserveNativeAuth(config3) {
|
|
81471
|
+
return hasNativeAnthropicMapping(config3) || classifierPassthroughEnabled(config3) && hasResolvableAnthropicAuth();
|
|
81472
|
+
}
|
|
80935
81473
|
function isProxyAuthMode(config3) {
|
|
80936
|
-
return !config3.monitor && !
|
|
81474
|
+
return !config3.monitor && !shouldPreserveNativeAuth(config3);
|
|
80937
81475
|
}
|
|
80938
81476
|
function managedSettingsPath() {
|
|
80939
81477
|
if (isWindows2()) {
|
|
80940
|
-
return
|
|
81478
|
+
return join39(process.env.PROGRAMDATA || "C:\\ProgramData", "ClaudeCode", "managed-settings.json");
|
|
80941
81479
|
}
|
|
80942
81480
|
if (process.platform === "darwin") {
|
|
80943
81481
|
return "/Library/Application Support/ClaudeCode/managed-settings.json";
|
|
@@ -80958,19 +81496,25 @@ function isWindows2() {
|
|
|
80958
81496
|
}
|
|
80959
81497
|
function createStatusLineScript(tokenFilePath) {
|
|
80960
81498
|
const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
|
|
80961
|
-
const claudishDir =
|
|
81499
|
+
const claudishDir = join39(homeDir, ".claudish");
|
|
80962
81500
|
const timestamp = Date.now();
|
|
80963
|
-
const scriptPath =
|
|
81501
|
+
const scriptPath = join39(claudishDir, `status-${timestamp}.js`);
|
|
80964
81502
|
const escapedTokenPath = tokenFilePath.replace(/\\/g, "\\\\");
|
|
81503
|
+
const light = getThemeMode() === "light";
|
|
81504
|
+
const cyanCode = light ? "38;2;14;116;144" : "96";
|
|
81505
|
+
const yellowCode = light ? "38;2;161;98;7" : "93";
|
|
81506
|
+
const greenCode = light ? "38;2;21;128;61" : "92";
|
|
81507
|
+
const redCode = light ? "38;2;220;38;38" : "91";
|
|
81508
|
+
const magentaCode = light ? "38;2;147;51;234" : "95";
|
|
80965
81509
|
const script = `
|
|
80966
81510
|
const fs = require('fs');
|
|
80967
81511
|
const path = require('path');
|
|
80968
81512
|
|
|
80969
|
-
const CYAN = "\\x1b[
|
|
80970
|
-
const YELLOW = "\\x1b[
|
|
80971
|
-
const GREEN = "\\x1b[
|
|
80972
|
-
const RED = "\\x1b[
|
|
80973
|
-
const MAGENTA = "\\x1b[
|
|
81513
|
+
const CYAN = "\\x1b[${cyanCode}m";
|
|
81514
|
+
const YELLOW = "\\x1b[${yellowCode}m";
|
|
81515
|
+
const GREEN = "\\x1b[${greenCode}m";
|
|
81516
|
+
const RED = "\\x1b[${redCode}m";
|
|
81517
|
+
const MAGENTA = "\\x1b[${magentaCode}m";
|
|
80974
81518
|
const DIM = "\\x1b[2m";
|
|
80975
81519
|
const RESET = "\\x1b[0m";
|
|
80976
81520
|
const BOLD = "\\x1b[1m";
|
|
@@ -81092,7 +81636,7 @@ process.stdin.on('end', () => {
|
|
|
81092
81636
|
}
|
|
81093
81637
|
function initializeTokenFile(tokenFilePath) {
|
|
81094
81638
|
try {
|
|
81095
|
-
|
|
81639
|
+
mkdirSync19(dirname13(tokenFilePath), { recursive: true });
|
|
81096
81640
|
writeFileSync21(tokenFilePath, JSON.stringify({
|
|
81097
81641
|
input_tokens: 0,
|
|
81098
81642
|
output_tokens: 0,
|
|
@@ -81124,7 +81668,7 @@ function cleanupStaleTokenFiles(dir, now = Date.now(), maxAgeMs = STALE_TOKEN_FI
|
|
|
81124
81668
|
if (!name.startsWith("tokens-") || !name.endsWith(".json"))
|
|
81125
81669
|
continue;
|
|
81126
81670
|
scanned++;
|
|
81127
|
-
const full =
|
|
81671
|
+
const full = join39(dir, name);
|
|
81128
81672
|
try {
|
|
81129
81673
|
if (statSync5(full).mtimeMs >= cutoff)
|
|
81130
81674
|
continue;
|
|
@@ -81153,9 +81697,9 @@ function parseSettingsArgSafe(value) {
|
|
|
81153
81697
|
}
|
|
81154
81698
|
function userSettingsFileCandidates(cwd) {
|
|
81155
81699
|
return [
|
|
81156
|
-
|
|
81157
|
-
|
|
81158
|
-
|
|
81700
|
+
join39(homedir34(), ".claude", "settings.json"),
|
|
81701
|
+
join39(cwd, ".claude", "settings.json"),
|
|
81702
|
+
join39(cwd, ".claude", "settings.local.json")
|
|
81159
81703
|
];
|
|
81160
81704
|
}
|
|
81161
81705
|
function discoverUserStatusLineCommand(claudeArgs = [], cwd = process.cwd()) {
|
|
@@ -81196,13 +81740,13 @@ function buildChainedStatusCommand(userCommand, claudishBody, claudishSegment) {
|
|
|
81196
81740
|
}
|
|
81197
81741
|
function createTempSettingsFile(_modelDisplay, port, proxyAuthMode, userStatusLineCommand) {
|
|
81198
81742
|
const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
|
|
81199
|
-
const claudishDir =
|
|
81743
|
+
const claudishDir = join39(homeDir, ".claudish");
|
|
81200
81744
|
try {
|
|
81201
|
-
|
|
81745
|
+
mkdirSync19(claudishDir, { recursive: true });
|
|
81202
81746
|
} catch {}
|
|
81203
81747
|
const timestamp = Date.now();
|
|
81204
|
-
const tempPath =
|
|
81205
|
-
const tokenFilePath =
|
|
81748
|
+
const tempPath = join39(claudishDir, `settings-${timestamp}.json`);
|
|
81749
|
+
const tokenFilePath = join39(claudishDir, `tokens-${port}.json`);
|
|
81206
81750
|
cleanupStaleTokenFiles(claudishDir);
|
|
81207
81751
|
initializeTokenFile(tokenFilePath);
|
|
81208
81752
|
let statusCommand;
|
|
@@ -81210,22 +81754,23 @@ function createTempSettingsFile(_modelDisplay, port, proxyAuthMode, userStatusLi
|
|
|
81210
81754
|
const scriptPath = createStatusLineScript(tokenFilePath);
|
|
81211
81755
|
statusCommand = `node "${scriptPath}"`;
|
|
81212
81756
|
} else {
|
|
81213
|
-
const
|
|
81214
|
-
const
|
|
81215
|
-
const
|
|
81216
|
-
const
|
|
81217
|
-
const
|
|
81218
|
-
const
|
|
81219
|
-
const
|
|
81757
|
+
const light = getThemeMode() === "light";
|
|
81758
|
+
const CYAN3 = light ? "\\033[38;2;14;116;144m" : "\\033[96m";
|
|
81759
|
+
const YELLOW3 = light ? "\\033[38;2;161;98;7m" : "\\033[93m";
|
|
81760
|
+
const GREEN3 = light ? "\\033[38;2;21;128;61m" : "\\033[92m";
|
|
81761
|
+
const MAGENTA3 = light ? "\\033[38;2;147;51;234m" : "\\033[95m";
|
|
81762
|
+
const DIM3 = "\\033[2m";
|
|
81763
|
+
const RESET3 = "\\033[0m";
|
|
81764
|
+
const BOLD3 = "\\033[1m";
|
|
81220
81765
|
const readPlanBash = `PLAN_PAIR=$(echo "$TOKENS" | grep -o '"id": *"[^"]*", *"used_pct": *[0-9]*' | sed 's/"id": *"\\([^"]*\\)", *"used_pct": *\\([0-9]*\\)/\\2 \\1/' | sort -rn | head -1); if [ -n "$PLAN_PAIR" ]; then PLAN_PCT="\${PLAN_PAIR%% *}"; PLAN_ID="\${PLAN_PAIR#* }"; case "$PLAN_PCT" in ''|*[!0-9]*) PLAN_PCT="" ;; esac; [ -n "$PLAN_PCT" ] && PLAN_DISPLAY="$PLAN_ID:$PLAN_PCT%"; fi;`;
|
|
81221
81766
|
const formatTokensBash = `fmt_tok() { local n=\${1:-0}; if [ "$n" -ge 1000000 ]; then echo "$((n/1000000))M"; elif [ "$n" -ge 1000 ]; then echo "$((n/1000))k"; else echo "$n"; fi; }`;
|
|
81222
81767
|
const effWinBash = `eff_win() { local w=\${1:-0}; local m=\${CLAUDE_CODE_MAX_CONTEXT_TOKENS:-}; local a=\${CLAUDE_CODE_AUTO_COMPACT_WINDOW:-}; case "$m" in ''|*[!0-9]*) m=${CLAUDE_CODE_DEFAULT_MAX_CONTEXT};; esac; case "$a" in ''|*[!0-9]*) a=0;; esac; case "$w" in ''|*[!0-9]*) w=0;; esac; if [ "$w" -gt 0 ]; then if [ "$m" -gt 0 ] && [ "$m" -lt "$w" ]; then w=$m; fi; if [ "$a" -gt 0 ] && [ "$a" -lt "$w" ]; then w=$a; fi; fi; echo "$w"; }`;
|
|
81223
81768
|
const dirPrelude = `DIR=$(basename "$(pwd)"); [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true; `;
|
|
81224
81769
|
const readState = `CTX=-1; COST="0"; IS_FREE="false"; IS_EST="false"; PROVIDER=""; TOKEN_MODEL=""; IN_TOK=0; CTX_WIN=0; PLAN_DISPLAY=""; ${formatTokensBash}; ${effWinBash}; if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null | tr -d '\\n\\r'); V=$(echo "$TOKENS" | grep -o '"context_left_percent": *-\\?[0-9]*' | grep -o '\\-\\?[0-9]*'); [ -n "$V" ] && CTX="$V"; V=$(echo "$TOKENS" | grep -o '"total_cost": *[0-9.]*' | cut -d: -f2 | tr -d ' '); [ -n "$V" ] && COST="$V"; V=$(echo "$TOKENS" | grep -o '"input_tokens": *[0-9]*' | grep -o '[0-9]*'); [ -n "$V" ] && IN_TOK="$V"; V=$(echo "$TOKENS" | grep -o '"context_window": *[0-9]*' | grep -o '[0-9]*'); [ -n "$V" ] && CTX_WIN="$V"; V=$(echo "$TOKENS" | grep -o '"is_free": *[a-z]*' | cut -d: -f2 | tr -d ' '); [ -n "$V" ] && IS_FREE="$V"; V=$(echo "$TOKENS" | grep -o '"is_estimated": *[a-z]*' | cut -d: -f2 | tr -d ' '); [ -n "$V" ] && IS_EST="$V"; V=$(echo "$TOKENS" | grep -o '"provider_name": *"[^"]*"' | cut -d'"' -f4); [ -n "$V" ] && PROVIDER="$V"; V=$(echo "$TOKENS" | grep -o '"model_name": *"[^"]*"' | cut -d'"' -f4); [ -n "$V" ] && TOKEN_MODEL="$V"; ${readPlanBash} fi; if [ "$CLAUDISH_IS_LOCAL" = "true" ]; then COST_DISPLAY="LOCAL"; elif [ "$IS_FREE" = "true" ]; then COST_DISPLAY="FREE"; elif [ "$IS_EST" = "true" ]; then COST_DISPLAY=$(printf "~\\$%.3f" "$COST"); else COST_DISPLAY=$(printf "\\$%.3f" "$COST"); fi; MODEL_DISPLAY="\${TOKEN_MODEL:-$CLAUDISH_ACTIVE_MODEL_NAME}"; if [ -n "$PROVIDER" ]; then MODEL_DISPLAY="$PROVIDER $MODEL_DISPLAY"; fi; EFF_WIN=$(eff_win $CTX_WIN); if [ "$EFF_WIN" -gt 0 ] 2>/dev/null && [ "$IN_TOK" -gt 0 ] 2>/dev/null; then CTX=$(( ((EFF_WIN - IN_TOK) * 200 / EFF_WIN + 1) / 2 )); if [ "$CTX" -lt 0 ]; then CTX=0; fi; fi; if [ "$CTX" -lt 0 ] 2>/dev/null || [ "$EFF_WIN" -le 0 ] 2>/dev/null; then if [ "$IN_TOK" -gt 0 ] 2>/dev/null; then CTX_DISPLAY="$(fmt_tok $IN_TOK) tokens"; else CTX_DISPLAY="N/A"; fi; elif [ "$IN_TOK" -gt 0 ] 2>/dev/null; then if [ "$EFF_WIN" -lt "$CTX_WIN" ] 2>/dev/null; then CTX_DISPLAY="$CTX% ($(fmt_tok $IN_TOK)/$(fmt_tok $EFF_WIN) of $(fmt_tok $CTX_WIN))"; else CTX_DISPLAY="$CTX% ($(fmt_tok $IN_TOK)/$(fmt_tok $EFF_WIN))"; fi; else CTX_DISPLAY="$CTX%"; fi`;
|
|
81225
|
-
const planSuffix = `if [ -n "$PLAN_DISPLAY" ]; then printf " ${
|
|
81226
|
-
const segmentWithDir = `printf "${
|
|
81227
|
-
const segmentNoDirWithProvider = `printf "${YELLOW3}%s${
|
|
81228
|
-
const segmentNoDirNoProvider = `printf "${
|
|
81770
|
+
const planSuffix = `if [ -n "$PLAN_DISPLAY" ]; then printf " ${DIM3}\u2022${RESET3} ${GREEN3}%s${RESET3}" "$PLAN_DISPLAY"; fi`;
|
|
81771
|
+
const segmentWithDir = `printf "${CYAN3}${BOLD3}%s${RESET3} ${DIM3}\u2022${RESET3} ${YELLOW3}%s${RESET3} ${DIM3}\u2022${RESET3} ${GREEN3}%s${RESET3} ${DIM3}\u2022${RESET3} ${MAGENTA3}%s${RESET3}" "$DIR" "$MODEL_DISPLAY" "$COST_DISPLAY" "$CTX_DISPLAY"; ${planSuffix}; printf "\\n"`;
|
|
81772
|
+
const segmentNoDirWithProvider = `printf "${YELLOW3}%s${RESET3} ${DIM3}\u2022${RESET3} ${GREEN3}%s${RESET3} ${DIM3}\u2022${RESET3} ${MAGENTA3}%s${RESET3}" "$PROVIDER" "$COST_DISPLAY" "$CTX_DISPLAY"; ${planSuffix}; printf "\\n"`;
|
|
81773
|
+
const segmentNoDirNoProvider = `printf "${GREEN3}%s${RESET3} ${DIM3}\u2022${RESET3} ${MAGENTA3}%s${RESET3}" "$COST_DISPLAY" "$CTX_DISPLAY"; ${planSuffix}; printf "\\n"`;
|
|
81229
81774
|
const segmentNoDir = `if [ -n "$PROVIDER" ]; then ${segmentNoDirWithProvider}; else ${segmentNoDirNoProvider}; fi`;
|
|
81230
81775
|
statusCommand = userStatusLineCommand ? buildChainedStatusCommand(userStatusLineCommand, readState, segmentNoDir) : `JSON=$(cat); ${dirPrelude}${readState}; ${segmentWithDir}`;
|
|
81231
81776
|
}
|
|
@@ -81398,12 +81943,15 @@ async function runClaudeWithProxy(config3, proxyUrl, onCleanup) {
|
|
|
81398
81943
|
env[ENV.ANTHROPIC_MODEL] = modelId;
|
|
81399
81944
|
env[ENV.ANTHROPIC_SMALL_FAST_MODEL] = modelId;
|
|
81400
81945
|
}
|
|
81401
|
-
if (
|
|
81402
|
-
if (
|
|
81946
|
+
if (shouldPreserveNativeAuth(config3)) {
|
|
81947
|
+
if (shouldHideIncidentalAnthropicKey(config3)) {
|
|
81403
81948
|
delete env.ANTHROPIC_API_KEY;
|
|
81404
81949
|
hidAnthropicApiKey = true;
|
|
81405
81950
|
}
|
|
81406
81951
|
} else {
|
|
81952
|
+
if (classifierPassthroughEnabled(config3)) {
|
|
81953
|
+
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.");
|
|
81954
|
+
}
|
|
81407
81955
|
env.ANTHROPIC_API_KEY = "sk-ant-api03-placeholder-not-used-proxy-handles-auth-with-openrouter-key-xxxxxxxxxxxxxxxxxxxxx";
|
|
81408
81956
|
env.ANTHROPIC_AUTH_TOKEN = "placeholder-token-not-used-proxy-handles-auth";
|
|
81409
81957
|
const realWindow = await computeMainThreadContextWindow(config3);
|
|
@@ -81453,7 +82001,7 @@ async function runClaudeWithProxy(config3, proxyUrl, onCleanup) {
|
|
|
81453
82001
|
console.error(`
|
|
81454
82002
|
Or set CLAUDE_PATH to your custom installation:`);
|
|
81455
82003
|
const home = homedir34();
|
|
81456
|
-
const localPath = isWindows2() ?
|
|
82004
|
+
const localPath = isWindows2() ? join39(home, ".claude", "local", "claude.exe") : join39(home, ".claude", "local", "claude");
|
|
81457
82005
|
console.error(` export CLAUDE_PATH=${localPath}`);
|
|
81458
82006
|
process.exit(1);
|
|
81459
82007
|
}
|
|
@@ -81538,15 +82086,15 @@ async function findClaudeBinary() {
|
|
|
81538
82086
|
}
|
|
81539
82087
|
}
|
|
81540
82088
|
const home = homedir34();
|
|
81541
|
-
const localPath = isWindows3 ?
|
|
82089
|
+
const localPath = isWindows3 ? join39(home, ".claude", "local", "claude.exe") : join39(home, ".claude", "local", "claude");
|
|
81542
82090
|
if (existsSync30(localPath)) {
|
|
81543
82091
|
return localPath;
|
|
81544
82092
|
}
|
|
81545
82093
|
if (isWindows3) {
|
|
81546
82094
|
const windowsPaths = [
|
|
81547
|
-
|
|
81548
|
-
|
|
81549
|
-
|
|
82095
|
+
join39(home, "AppData", "Roaming", "npm", "claude.cmd"),
|
|
82096
|
+
join39(home, ".npm-global", "claude.cmd"),
|
|
82097
|
+
join39(home, "node_modules", ".bin", "claude.cmd")
|
|
81550
82098
|
];
|
|
81551
82099
|
for (const path2 of windowsPaths) {
|
|
81552
82100
|
if (existsSync30(path2)) {
|
|
@@ -81557,11 +82105,11 @@ async function findClaudeBinary() {
|
|
|
81557
82105
|
const commonPaths = [
|
|
81558
82106
|
"/usr/local/bin/claude",
|
|
81559
82107
|
"/opt/homebrew/bin/claude",
|
|
81560
|
-
|
|
81561
|
-
|
|
81562
|
-
|
|
82108
|
+
join39(home, ".npm-global/bin/claude"),
|
|
82109
|
+
join39(home, ".local/bin/claude"),
|
|
82110
|
+
join39(home, "node_modules/.bin/claude"),
|
|
81563
82111
|
"/data/data/com.termux/files/usr/bin/claude",
|
|
81564
|
-
|
|
82112
|
+
join39(home, "../usr/bin/claude")
|
|
81565
82113
|
];
|
|
81566
82114
|
for (const path2 of commonPaths) {
|
|
81567
82115
|
if (existsSync30(path2)) {
|
|
@@ -81601,7 +82149,21 @@ async function checkClaudeInstalled() {
|
|
|
81601
82149
|
const binary = await findClaudeBinary();
|
|
81602
82150
|
return binary !== null;
|
|
81603
82151
|
}
|
|
81604
|
-
var restoreTerminal = null,
|
|
82152
|
+
var restoreTerminal = null, macosKeychainAnthropicResult, defaultKeychainAnthropicProbe = () => {
|
|
82153
|
+
if (process.platform !== "darwin")
|
|
82154
|
+
return false;
|
|
82155
|
+
if (macosKeychainAnthropicResult !== undefined)
|
|
82156
|
+
return macosKeychainAnthropicResult;
|
|
82157
|
+
try {
|
|
82158
|
+
const res = spawnSync5("security", ["find-generic-password", "-s", "Claude Code-credentials"], {
|
|
82159
|
+
stdio: "ignore"
|
|
82160
|
+
});
|
|
82161
|
+
macosKeychainAnthropicResult = !res.error && res.status === 0;
|
|
82162
|
+
} catch {
|
|
82163
|
+
macosKeychainAnthropicResult = false;
|
|
82164
|
+
}
|
|
82165
|
+
return macosKeychainAnthropicResult;
|
|
82166
|
+
}, STALE_TOKEN_FILE_MS, MAX_TOKEN_FILES_SCANNED = 4000, CLAUDE_CODE_DEFAULT_MAX_CONTEXT = 200000, USER_STATUS_LINE_TIMEOUT_SECONDS = 3, MIN_AUTO_COMPACT_WINDOW = 200000;
|
|
81605
82167
|
var init_claude_runner = __esm(() => {
|
|
81606
82168
|
init_model_catalog();
|
|
81607
82169
|
init_config2();
|
|
@@ -81613,6 +82175,7 @@ var init_claude_runner = __esm(() => {
|
|
|
81613
82175
|
init_routing_rules();
|
|
81614
82176
|
init_telemetry();
|
|
81615
82177
|
init_terminal_isolation();
|
|
82178
|
+
init_theme_mode();
|
|
81616
82179
|
STALE_TOKEN_FILE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
81617
82180
|
});
|
|
81618
82181
|
|
|
@@ -81623,18 +82186,18 @@ __export(exports_diag_output, {
|
|
|
81623
82186
|
NullDiagOutput: () => NullDiagOutput,
|
|
81624
82187
|
LogFileDiagOutput: () => LogFileDiagOutput
|
|
81625
82188
|
});
|
|
81626
|
-
import { createWriteStream as createWriteStream3, mkdirSync as
|
|
82189
|
+
import { createWriteStream as createWriteStream3, mkdirSync as mkdirSync20, unlinkSync as unlinkSync11, writeFileSync as writeFileSync22 } from "fs";
|
|
81627
82190
|
import { homedir as homedir35 } from "os";
|
|
81628
|
-
import { join as
|
|
82191
|
+
import { join as join40 } from "path";
|
|
81629
82192
|
function getClaudishDir() {
|
|
81630
|
-
const dir =
|
|
82193
|
+
const dir = join40(homedir35(), ".claudish");
|
|
81631
82194
|
try {
|
|
81632
|
-
|
|
82195
|
+
mkdirSync20(dir, { recursive: true });
|
|
81633
82196
|
} catch {}
|
|
81634
82197
|
return dir;
|
|
81635
82198
|
}
|
|
81636
82199
|
function getDiagLogPath() {
|
|
81637
|
-
return
|
|
82200
|
+
return join40(getClaudishDir(), `diag-${process.pid}.log`);
|
|
81638
82201
|
}
|
|
81639
82202
|
|
|
81640
82203
|
class LogFileDiagOutput {
|
|
@@ -81987,6 +82550,32 @@ var init_text = __esm(() => {
|
|
|
81987
82550
|
});
|
|
81988
82551
|
|
|
81989
82552
|
// src/tui/viz/tokens.ts
|
|
82553
|
+
function refreshTokens() {
|
|
82554
|
+
tokens.fatal = C.red;
|
|
82555
|
+
tokens.error = C.red;
|
|
82556
|
+
tokens.warn = C.orange;
|
|
82557
|
+
tokens.info = C.cyan;
|
|
82558
|
+
tokens.debug = C.fgMuted;
|
|
82559
|
+
tokens.trace = C.dim;
|
|
82560
|
+
tokens.success = C.green;
|
|
82561
|
+
tokens.running = C.blue;
|
|
82562
|
+
tokens.idle = C.fgMuted;
|
|
82563
|
+
tokens.dead = C.dim;
|
|
82564
|
+
tokens.border = C.border;
|
|
82565
|
+
tokens.subtle = C.dim;
|
|
82566
|
+
tokens.text = C.fg;
|
|
82567
|
+
tokens.accent = C.focusBorder;
|
|
82568
|
+
tokens.bgPanel = C.bgAlt;
|
|
82569
|
+
tokens.ink = C.black;
|
|
82570
|
+
refreshRamps();
|
|
82571
|
+
}
|
|
82572
|
+
function refreshRamps() {
|
|
82573
|
+
ramps.load = [tokens.success, C.yellow, tokens.error];
|
|
82574
|
+
ramps.temperature = [tokens.running, tokens.success, C.orange, tokens.error];
|
|
82575
|
+
ramps.network = [tokens.success, C.yellow, tokens.error];
|
|
82576
|
+
ramps.savings = [tokens.error, C.yellow, tokens.success];
|
|
82577
|
+
ramps.volume = [C.border, C.blue, C.cyan];
|
|
82578
|
+
}
|
|
81990
82579
|
var tokens, ramps;
|
|
81991
82580
|
var init_tokens = __esm(() => {
|
|
81992
82581
|
init_theme2();
|
|
@@ -82015,6 +82604,7 @@ var init_tokens = __esm(() => {
|
|
|
82015
82604
|
savings: [tokens.error, C.yellow, tokens.success],
|
|
82016
82605
|
volume: [C.border, C.blue, C.cyan]
|
|
82017
82606
|
};
|
|
82607
|
+
registerPaletteRefresher(refreshTokens);
|
|
82018
82608
|
});
|
|
82019
82609
|
|
|
82020
82610
|
// src/tui/viz/color.ts
|
|
@@ -82170,7 +82760,7 @@ function BadgeSpan({ label, bg, width }) {
|
|
|
82170
82760
|
/* @__PURE__ */ jsxDEV18("span", {
|
|
82171
82761
|
fg: pickInk(bg),
|
|
82172
82762
|
bg,
|
|
82173
|
-
attributes:
|
|
82763
|
+
attributes: BOLD3,
|
|
82174
82764
|
children: ` ${label} `
|
|
82175
82765
|
}, undefined, false, undefined, this),
|
|
82176
82766
|
badgePad(label, width)
|
|
@@ -82201,12 +82791,12 @@ function Panel({
|
|
|
82201
82791
|
children
|
|
82202
82792
|
}, undefined, false, undefined, this);
|
|
82203
82793
|
}
|
|
82204
|
-
var
|
|
82794
|
+
var BOLD3, FILL = "\u2588", TRACK = "\u2591", SPARK, GAP = " ", NODATA = "\u254C", RAMP_CACHE, RAMP_CACHE_MAX = 64;
|
|
82205
82795
|
var init_widgets = __esm(() => {
|
|
82206
82796
|
init_color();
|
|
82207
82797
|
init_text();
|
|
82208
82798
|
init_tokens();
|
|
82209
|
-
|
|
82799
|
+
BOLD3 = createTextAttributes2({ bold: true });
|
|
82210
82800
|
SPARK = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
|
|
82211
82801
|
RAMP_CACHE = new Map;
|
|
82212
82802
|
});
|
|
@@ -82232,7 +82822,7 @@ __export(exports_session_discovery, {
|
|
|
82232
82822
|
import { execFile, execFileSync as execFileSync2 } from "child_process";
|
|
82233
82823
|
import { closeSync as closeSync6, openSync as openSync6, readSync, readdirSync as readdirSync7, statSync as statSync6 } from "fs";
|
|
82234
82824
|
import { homedir as homedir36 } from "os";
|
|
82235
|
-
import { basename, join as
|
|
82825
|
+
import { basename, join as join41 } from "path";
|
|
82236
82826
|
function slugForPath(absPath) {
|
|
82237
82827
|
return absPath.replace(/[/.]/g, "-");
|
|
82238
82828
|
}
|
|
@@ -82281,7 +82871,7 @@ function projectDirs() {
|
|
|
82281
82871
|
}
|
|
82282
82872
|
}
|
|
82283
82873
|
function sessionsIn(dirName) {
|
|
82284
|
-
const dir =
|
|
82874
|
+
const dir = join41(PROJECTS_DIR, dirName);
|
|
82285
82875
|
let names;
|
|
82286
82876
|
try {
|
|
82287
82877
|
names = readdirSync7(dir).filter((n) => n.endsWith(".jsonl"));
|
|
@@ -82290,7 +82880,7 @@ function sessionsIn(dirName) {
|
|
|
82290
82880
|
}
|
|
82291
82881
|
const rows = [];
|
|
82292
82882
|
for (const n of names) {
|
|
82293
|
-
const file2 =
|
|
82883
|
+
const file2 = join41(dir, n);
|
|
82294
82884
|
try {
|
|
82295
82885
|
const st = statSync6(file2);
|
|
82296
82886
|
if (st.size === 0)
|
|
@@ -82649,7 +83239,7 @@ function findLatestSessionId(cwd = process.cwd(), sinceMs = 0) {
|
|
|
82649
83239
|
}
|
|
82650
83240
|
var ENTRYPOINT_BYTES = 8192, PROJECTS_DIR, ACTIVE_WINDOW_MS = 120000, HEAD_BYTES, TAIL_BYTES, HARNESS_ENVELOPES, DEEP_TAIL_BYTES, RECENT_AI_TURNS = 5, RECENT_USER_TURNS = 1;
|
|
82651
83241
|
var init_session_discovery = __esm(() => {
|
|
82652
|
-
PROJECTS_DIR =
|
|
83242
|
+
PROJECTS_DIR = join41(homedir36(), ".claude", "projects");
|
|
82653
83243
|
HEAD_BYTES = 64 * 1024;
|
|
82654
83244
|
TAIL_BYTES = 128 * 1024;
|
|
82655
83245
|
HARNESS_ENVELOPES = [
|
|
@@ -82856,6 +83446,9 @@ var init_conversation = __esm(() => {
|
|
|
82856
83446
|
import { useKeyboard as useKeyboard3 } from "@opentui/react";
|
|
82857
83447
|
import { useEffect as useEffect5, useMemo as useMemo3, useState as useState6 } from "react";
|
|
82858
83448
|
import { jsxDEV as jsxDEV19, Fragment as Fragment12 } from "@opentui/react/jsx-dev-runtime";
|
|
83449
|
+
function speaker() {
|
|
83450
|
+
return getThemeMode() === "light" ? SPEAKER_LIGHT : SPEAKER;
|
|
83451
|
+
}
|
|
82859
83452
|
function layoutRows(turns, textWidth) {
|
|
82860
83453
|
const rows = [];
|
|
82861
83454
|
const turnStart = [];
|
|
@@ -83189,6 +83782,9 @@ function scrollbarCells(viewport, total, top, hits) {
|
|
|
83189
83782
|
}
|
|
83190
83783
|
return cells;
|
|
83191
83784
|
}
|
|
83785
|
+
function barColor(cell) {
|
|
83786
|
+
return cell === "track" ? tokens.border : cell === "thumb" ? tokens.accent : tokens.warn;
|
|
83787
|
+
}
|
|
83192
83788
|
function ReaderRow({
|
|
83193
83789
|
row,
|
|
83194
83790
|
turn,
|
|
@@ -83204,15 +83800,16 @@ function ReaderRow({
|
|
|
83204
83800
|
children: " ".repeat(Math.max(0, width))
|
|
83205
83801
|
}, undefined, false, undefined, this),
|
|
83206
83802
|
/* @__PURE__ */ jsxDEV19("span", {
|
|
83207
|
-
bg:
|
|
83803
|
+
bg: barColor(bar),
|
|
83208
83804
|
children: " "
|
|
83209
83805
|
}, undefined, false, undefined, this)
|
|
83210
83806
|
]
|
|
83211
83807
|
}, undefined, true, undefined, this);
|
|
83212
83808
|
}
|
|
83809
|
+
const sp = speaker();
|
|
83213
83810
|
const text = turn.text.slice(row.start, row.end);
|
|
83214
83811
|
const fg = turn.role === "user" ? tokens.text : C.fgMuted;
|
|
83215
|
-
const railFg = turn.role === "user" ?
|
|
83812
|
+
const railFg = turn.role === "user" ? sp.you : sp.ai;
|
|
83216
83813
|
const pad2 = Math.max(0, width - GUTTER - displayWidth(text));
|
|
83217
83814
|
return /* @__PURE__ */ jsxDEV19("text", {
|
|
83218
83815
|
children: [
|
|
@@ -83222,7 +83819,7 @@ function ReaderRow({
|
|
|
83222
83819
|
}, undefined, false, undefined, this),
|
|
83223
83820
|
row.first ? /* @__PURE__ */ jsxDEV19(BadgeSpan, {
|
|
83224
83821
|
label: turn.role === "user" ? "you" : "ai",
|
|
83225
|
-
bg: turn.role === "user" ?
|
|
83822
|
+
bg: turn.role === "user" ? sp.you : sp.ai,
|
|
83226
83823
|
width: ROLE_W
|
|
83227
83824
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV19("span", {
|
|
83228
83825
|
children: " ".repeat(ROLE_W)
|
|
@@ -83235,7 +83832,7 @@ function ReaderRow({
|
|
|
83235
83832
|
children: " ".repeat(pad2)
|
|
83236
83833
|
}, undefined, false, undefined, this),
|
|
83237
83834
|
/* @__PURE__ */ jsxDEV19("span", {
|
|
83238
|
-
bg:
|
|
83835
|
+
bg: barColor(bar),
|
|
83239
83836
|
children: " "
|
|
83240
83837
|
}, undefined, false, undefined, this)
|
|
83241
83838
|
]
|
|
@@ -83256,7 +83853,7 @@ function highlighted(text, hl, current, fg) {
|
|
|
83256
83853
|
}, `p${i}`, false, undefined, this));
|
|
83257
83854
|
const bg = hit === current ? tokens.accent : tokens.warn;
|
|
83258
83855
|
out.push(/* @__PURE__ */ jsxDEV19("span", {
|
|
83259
|
-
fg: tokens.ink,
|
|
83856
|
+
fg: pickInk(bg, tokens.ink, C.ink),
|
|
83260
83857
|
bg,
|
|
83261
83858
|
attributes: A.bold,
|
|
83262
83859
|
children: text.slice(start, e)
|
|
@@ -83272,9 +83869,11 @@ function highlighted(text, hl, current, fg) {
|
|
|
83272
83869
|
children: out
|
|
83273
83870
|
}, undefined, false, undefined, this);
|
|
83274
83871
|
}
|
|
83275
|
-
var RAIL = "\u258D", RAIL_W = 2, ROLE_W = 6, GUTTER, BAR_W = 1, SPEAKER, MAX_MATCHES = 5000, EMPTY_SEARCH, NO_TURNS
|
|
83872
|
+
var RAIL = "\u258D", RAIL_W = 2, ROLE_W = 6, GUTTER, BAR_W = 1, SPEAKER, SPEAKER_LIGHT, MAX_MATCHES = 5000, EMPTY_SEARCH, NO_TURNS;
|
|
83276
83873
|
var init_conversation_reader = __esm(() => {
|
|
83874
|
+
init_theme_mode();
|
|
83277
83875
|
init_theme2();
|
|
83876
|
+
init_color();
|
|
83278
83877
|
init_text();
|
|
83279
83878
|
init_tokens();
|
|
83280
83879
|
init_widgets();
|
|
@@ -83285,13 +83884,12 @@ var init_conversation_reader = __esm(() => {
|
|
|
83285
83884
|
you: "#39d353",
|
|
83286
83885
|
ai: "#39c5cf"
|
|
83287
83886
|
};
|
|
83887
|
+
SPEAKER_LIGHT = {
|
|
83888
|
+
you: "#2da44e",
|
|
83889
|
+
ai: "#0891b2"
|
|
83890
|
+
};
|
|
83288
83891
|
EMPTY_SEARCH = { hits: [], ranges: new Map, capped: false };
|
|
83289
83892
|
NO_TURNS = [];
|
|
83290
|
-
BAR_COLOR = {
|
|
83291
|
-
track: tokens.border,
|
|
83292
|
-
thumb: tokens.accent,
|
|
83293
|
-
hit: tokens.warn
|
|
83294
|
-
};
|
|
83295
83893
|
});
|
|
83296
83894
|
|
|
83297
83895
|
// src/session/resume-picker.tsx
|
|
@@ -83324,6 +83922,15 @@ function age(ms) {
|
|
|
83324
83922
|
return `${h}h`;
|
|
83325
83923
|
return `${Math.floor(h / 24)}d`;
|
|
83326
83924
|
}
|
|
83925
|
+
function ghLevels() {
|
|
83926
|
+
return getThemeMode() === "light" ? GH_LEVELS_LIGHT : GH_LEVELS;
|
|
83927
|
+
}
|
|
83928
|
+
function chips() {
|
|
83929
|
+
return getThemeMode() === "light" ? CHIP_LIGHT : CHIP;
|
|
83930
|
+
}
|
|
83931
|
+
function hereFg() {
|
|
83932
|
+
return ghLevels()[4];
|
|
83933
|
+
}
|
|
83327
83934
|
function chipW(label) {
|
|
83328
83935
|
return label + 2;
|
|
83329
83936
|
}
|
|
@@ -83350,6 +83957,9 @@ function Slot({
|
|
|
83350
83957
|
bg
|
|
83351
83958
|
}, undefined, false, undefined, this);
|
|
83352
83959
|
}
|
|
83960
|
+
function muted() {
|
|
83961
|
+
return C.fgMuted;
|
|
83962
|
+
}
|
|
83353
83963
|
function WorktreeRow({
|
|
83354
83964
|
g,
|
|
83355
83965
|
cursor,
|
|
@@ -83362,35 +83972,36 @@ function WorktreeRow({
|
|
|
83362
83972
|
const room = Math.max(0, width - blockWidth(cols));
|
|
83363
83973
|
const series = room >= SPARK_MIN_DAYS ? activitySeries(g.sessions, room) : null;
|
|
83364
83974
|
const spark = series && hasActivity(series) ? series : null;
|
|
83365
|
-
const
|
|
83975
|
+
const chip = chips();
|
|
83976
|
+
const run = [];
|
|
83366
83977
|
if (cols.sync > 0 && g.ahead) {
|
|
83367
|
-
|
|
83978
|
+
run.push({
|
|
83368
83979
|
label: `\u2191${padStartTo(String(g.ahead), cols.sync)}`,
|
|
83369
|
-
bg:
|
|
83980
|
+
bg: chip.ahead,
|
|
83370
83981
|
labelW: cols.sync + 1
|
|
83371
83982
|
});
|
|
83372
83983
|
}
|
|
83373
83984
|
if (cols.sync > 0 && g.behind) {
|
|
83374
|
-
|
|
83985
|
+
run.push({
|
|
83375
83986
|
label: `\u2193${padStartTo(String(g.behind), cols.sync)}`,
|
|
83376
|
-
bg:
|
|
83987
|
+
bg: chip.behind,
|
|
83377
83988
|
labelW: cols.sync + 1
|
|
83378
83989
|
});
|
|
83379
83990
|
}
|
|
83380
83991
|
if (cols.dirty > 0 && g.dirty) {
|
|
83381
|
-
|
|
83992
|
+
run.push({
|
|
83382
83993
|
label: `${DIRTY_GLYPH}${padStartTo(String(g.dirty), cols.dirty)}`,
|
|
83383
|
-
bg:
|
|
83994
|
+
bg: chip.dirty,
|
|
83384
83995
|
labelW: cols.dirty + 1
|
|
83385
83996
|
});
|
|
83386
83997
|
}
|
|
83387
|
-
|
|
83388
|
-
|
|
83998
|
+
run.push({ label: padStartTo(String(count), cols.count), bg: chip.count, labelW: cols.count });
|
|
83999
|
+
run.push({
|
|
83389
84000
|
label: padStartTo(g.lastActiveMs ? age(g.lastActiveMs) : "\u2014", cols.age),
|
|
83390
|
-
bg: stale ?
|
|
84001
|
+
bg: stale ? chip.stale : chip.fresh,
|
|
83391
84002
|
labelW: cols.age
|
|
83392
84003
|
});
|
|
83393
|
-
const used =
|
|
84004
|
+
const used = run.reduce((w, c) => w + c.labelW + 2, 0) + LIVE_W;
|
|
83394
84005
|
const gap = Math.max(0, width - room - used);
|
|
83395
84006
|
return /* @__PURE__ */ jsxDEV20("box", {
|
|
83396
84007
|
flexDirection: "column",
|
|
@@ -83410,7 +84021,7 @@ function WorktreeRow({
|
|
|
83410
84021
|
children: [
|
|
83411
84022
|
spark ? /* @__PURE__ */ jsxDEV20(SparklineSpan, {
|
|
83412
84023
|
values: spark,
|
|
83413
|
-
fg:
|
|
84024
|
+
fg: sparkFg()
|
|
83414
84025
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV20("span", {
|
|
83415
84026
|
children: " ".repeat(room)
|
|
83416
84027
|
}, undefined, false, undefined, this),
|
|
@@ -83421,7 +84032,7 @@ function WorktreeRow({
|
|
|
83421
84032
|
fg: tokens.success,
|
|
83422
84033
|
children: g.activeNow ? "\u25CF " : " "
|
|
83423
84034
|
}, undefined, false, undefined, this),
|
|
83424
|
-
|
|
84035
|
+
run.map((c) => /* @__PURE__ */ jsxDEV20(Slot, {
|
|
83425
84036
|
label: c.label,
|
|
83426
84037
|
bg: c.bg,
|
|
83427
84038
|
labelW: c.labelW
|
|
@@ -83432,6 +84043,12 @@ function WorktreeRow({
|
|
|
83432
84043
|
]
|
|
83433
84044
|
}, undefined, true, undefined, this);
|
|
83434
84045
|
}
|
|
84046
|
+
function scrollbarOptions() {
|
|
84047
|
+
return {
|
|
84048
|
+
showArrows: false,
|
|
84049
|
+
trackOptions: { backgroundColor: tokens.bgPanel, foregroundColor: tokens.border }
|
|
84050
|
+
};
|
|
84051
|
+
}
|
|
83435
84052
|
function dailyActivity(groups, days) {
|
|
83436
84053
|
const day = 86400000;
|
|
83437
84054
|
const today = Math.floor(Date.now() / day);
|
|
@@ -83460,6 +84077,7 @@ function ActivityCalendar({
|
|
|
83460
84077
|
width
|
|
83461
84078
|
}) {
|
|
83462
84079
|
const levels = activityLevels(days);
|
|
84080
|
+
const scale = ghLevels();
|
|
83463
84081
|
const title = `activity \xB7 ${ACTIVITY_WEEKS}w `;
|
|
83464
84082
|
const grid = Math.max(WEEK_DAYS, width - WEEK_LABEL_W);
|
|
83465
84083
|
const base = Math.floor(grid / WEEK_DAYS);
|
|
@@ -83491,7 +84109,7 @@ function ActivityCalendar({
|
|
|
83491
84109
|
children: padTo(ago === 0 ? "now" : `-${ago}w`, WEEK_LABEL_W)
|
|
83492
84110
|
}, undefined, false, undefined, this),
|
|
83493
84111
|
Array.from({ length: WEEK_DAYS }, (_2, d) => /* @__PURE__ */ jsxDEV20("span", {
|
|
83494
|
-
bg:
|
|
84112
|
+
bg: scale[levels[w * WEEK_DAYS + d] ?? 0],
|
|
83495
84113
|
children: " ".repeat(base + (d < extra ? 1 : 0))
|
|
83496
84114
|
}, d, false, undefined, this))
|
|
83497
84115
|
]
|
|
@@ -83525,6 +84143,9 @@ function SectionHeader({ label, width }) {
|
|
|
83525
84143
|
]
|
|
83526
84144
|
}, undefined, true, undefined, this);
|
|
83527
84145
|
}
|
|
84146
|
+
function sparkFg() {
|
|
84147
|
+
return getThemeMode() === "light" ? SPARK_FG_LIGHT : SPARK_FG;
|
|
84148
|
+
}
|
|
83528
84149
|
function hasActivity(series) {
|
|
83529
84150
|
return series.some((v) => v > 0);
|
|
83530
84151
|
}
|
|
@@ -83580,7 +84201,7 @@ function SessionRowView({
|
|
|
83580
84201
|
}, undefined, false, undefined, this),
|
|
83581
84202
|
/* @__PURE__ */ jsxDEV20(BadgeSpan, {
|
|
83582
84203
|
label: padStartTo(age(row.mtimeMs), SESSION_AGE_W),
|
|
83583
|
-
bg: Date.now() - row.mtimeMs < STALE_MS ?
|
|
84204
|
+
bg: Date.now() - row.mtimeMs < STALE_MS ? chips().fresh : chips().stale,
|
|
83584
84205
|
width: SESSION_AGE_COL
|
|
83585
84206
|
}, undefined, false, undefined, this),
|
|
83586
84207
|
/* @__PURE__ */ jsxDEV20(MeterSpan, {
|
|
@@ -83589,7 +84210,7 @@ function SessionRowView({
|
|
|
83589
84210
|
ramp: ramps.volume
|
|
83590
84211
|
}, undefined, false, undefined, this),
|
|
83591
84212
|
/* @__PURE__ */ jsxDEV20("span", {
|
|
83592
|
-
fg:
|
|
84213
|
+
fg: muted(),
|
|
83593
84214
|
children: padStartTo(size, SIZE_COL)
|
|
83594
84215
|
}, undefined, false, undefined, this),
|
|
83595
84216
|
row.gitBranch ? /* @__PURE__ */ jsxDEV20("span", {
|
|
@@ -83882,7 +84503,7 @@ function ResumePicker({ groups, onDone }) {
|
|
|
83882
84503
|
/* @__PURE__ */ jsxDEV20("scrollbox", {
|
|
83883
84504
|
focused: false,
|
|
83884
84505
|
flexGrow: 1,
|
|
83885
|
-
scrollbarOptions:
|
|
84506
|
+
scrollbarOptions: scrollbarOptions(),
|
|
83886
84507
|
children: [
|
|
83887
84508
|
fresh.map((g, i) => /* @__PURE__ */ jsxDEV20(WorktreeRow, {
|
|
83888
84509
|
g,
|
|
@@ -83926,7 +84547,7 @@ function ResumePicker({ groups, onDone }) {
|
|
|
83926
84547
|
children: /* @__PURE__ */ jsxDEV20("scrollbox", {
|
|
83927
84548
|
focused: false,
|
|
83928
84549
|
flexGrow: 1,
|
|
83929
|
-
scrollbarOptions:
|
|
84550
|
+
scrollbarOptions: scrollbarOptions(),
|
|
83930
84551
|
children: items.length === 0 ? /* @__PURE__ */ jsxDEV20("text", {
|
|
83931
84552
|
fg: tokens.subtle,
|
|
83932
84553
|
children: " no sessions match"
|
|
@@ -84047,17 +84668,18 @@ function WorktreeDetail({
|
|
|
84047
84668
|
children: "no worktree selected"
|
|
84048
84669
|
}, undefined, false, undefined, this);
|
|
84049
84670
|
const L = 9;
|
|
84671
|
+
const chip = chips();
|
|
84050
84672
|
const badges = [];
|
|
84051
84673
|
if (group.dirty !== undefined) {
|
|
84052
84674
|
badges.push({
|
|
84053
84675
|
label: group.dirty > 0 ? `${DIRTY_GLYPH}${group.dirty} uncommitted` : "clean",
|
|
84054
|
-
bg: group.dirty > 0 ?
|
|
84676
|
+
bg: group.dirty > 0 ? chip.dirty : chip.clean
|
|
84055
84677
|
});
|
|
84056
84678
|
}
|
|
84057
84679
|
if (group.ahead)
|
|
84058
|
-
badges.push({ label: `\u2191${group.ahead}`, bg:
|
|
84680
|
+
badges.push({ label: `\u2191${group.ahead}`, bg: chip.ahead });
|
|
84059
84681
|
if (group.behind)
|
|
84060
|
-
badges.push({ label: `\u2193${group.behind}`, bg:
|
|
84682
|
+
badges.push({ label: `\u2193${group.behind}`, bg: chip.behind });
|
|
84061
84683
|
const badgeW = badges.reduce((w, b) => w + displayWidth(b.label) + 2, 0);
|
|
84062
84684
|
const marker = group.current ? " \u25B6 you are here" : !group.live ? " worktree deleted" : "";
|
|
84063
84685
|
const branch = group.branch ?? (group.live ? "detached" : "\u2014");
|
|
@@ -84083,7 +84705,7 @@ function WorktreeDetail({
|
|
|
84083
84705
|
children: truncate3(group.name, nameW)
|
|
84084
84706
|
}, undefined, false, undefined, this),
|
|
84085
84707
|
/* @__PURE__ */ jsxDEV20("span", {
|
|
84086
|
-
fg: group.current ?
|
|
84708
|
+
fg: group.current ? hereFg() : tokens.dead,
|
|
84087
84709
|
children: marker
|
|
84088
84710
|
}, undefined, false, undefined, this),
|
|
84089
84711
|
/* @__PURE__ */ jsxDEV20("span", {
|
|
@@ -84116,7 +84738,7 @@ function WorktreeDetail({
|
|
|
84116
84738
|
}, undefined, false, undefined, this),
|
|
84117
84739
|
/* @__PURE__ */ jsxDEV20(Sparkline, {
|
|
84118
84740
|
values: hasActivity(spark) ? spark : [],
|
|
84119
|
-
fg:
|
|
84741
|
+
fg: sparkFg()
|
|
84120
84742
|
}, undefined, false, undefined, this),
|
|
84121
84743
|
/* @__PURE__ */ jsxDEV20("text", {
|
|
84122
84744
|
fg: tokens.trace,
|
|
@@ -84194,6 +84816,7 @@ function Conversation({
|
|
|
84194
84816
|
}, undefined, false, undefined, this);
|
|
84195
84817
|
}
|
|
84196
84818
|
const ROLE_W2 = 6;
|
|
84819
|
+
const sp = speaker();
|
|
84197
84820
|
const textW = Math.max(10, width - ROLE_W2 - 2);
|
|
84198
84821
|
const shown = turns.slice(-max);
|
|
84199
84822
|
return /* @__PURE__ */ jsxDEV20("box", {
|
|
@@ -84208,19 +84831,20 @@ function Conversation({
|
|
|
84208
84831
|
}, undefined, false, undefined, this),
|
|
84209
84832
|
/* @__PURE__ */ jsxDEV20(BadgeSpan, {
|
|
84210
84833
|
label: t.role === "user" ? "you" : "ai",
|
|
84211
|
-
bg: t.role === "user" ?
|
|
84834
|
+
bg: t.role === "user" ? sp.you : sp.ai,
|
|
84212
84835
|
width: ROLE_W2
|
|
84213
84836
|
}, undefined, false, undefined, this),
|
|
84214
84837
|
/* @__PURE__ */ jsxDEV20("span", {
|
|
84215
|
-
fg: t.role === "user" ? tokens.text :
|
|
84838
|
+
fg: t.role === "user" ? tokens.text : muted(),
|
|
84216
84839
|
children: truncate3(t.text, textW)
|
|
84217
84840
|
}, undefined, false, undefined, this)
|
|
84218
84841
|
]
|
|
84219
84842
|
}, `${i}-${t.text.slice(0, 12)}`, true, undefined, this))
|
|
84220
84843
|
}, undefined, false, undefined, this);
|
|
84221
84844
|
}
|
|
84222
|
-
var PANEL_CHROME = 4, PANEL_BORDER = 2, SCROLL_CHROME = 1, SIDEBAR_MIN = 28, SIDEBAR_MAX = 50, DETAIL_CHROME = 5, WORKTREE_DETAIL_H = 4, STALE_MS, GH_LEVELS, CHIP,
|
|
84845
|
+
var PANEL_CHROME = 4, PANEL_BORDER = 2, SCROLL_CHROME = 1, SIDEBAR_MIN = 28, SIDEBAR_MAX = 50, DETAIL_CHROME = 5, WORKTREE_DETAIL_H = 4, STALE_MS, GH_LEVELS, GH_LEVELS_LIGHT, CHIP, CHIP_LIGHT, LIVE_W = 2, DIRTY_GLYPH = "+", SESSION_AGE_W = 3, SESSION_AGE_COL, SIZE_FLOOR_BYTES, WEEK_DAYS = 7, ACTIVITY_WEEKS = 6, BRANCH_ICON = "\u2387", BRANCH_LEAD = 5, BRANCH_LEAD_DENSE = 6, WEEK_LABEL_W = 4, ACTIVITY_H, SPARK_MIN_DAYS = 7, SPARK_FG = "#3f6f9e", SPARK_FG_LIGHT = "#2563eb";
|
|
84223
84846
|
var init_resume_picker = __esm(() => {
|
|
84847
|
+
init_theme_mode();
|
|
84224
84848
|
init_theme2();
|
|
84225
84849
|
init_text();
|
|
84226
84850
|
init_tokens();
|
|
@@ -84230,6 +84854,7 @@ var init_resume_picker = __esm(() => {
|
|
|
84230
84854
|
init_session_discovery();
|
|
84231
84855
|
STALE_MS = 3 * 86400000;
|
|
84232
84856
|
GH_LEVELS = ["#21262d", "#0e4429", "#006d32", "#26a641", "#39d353"];
|
|
84857
|
+
GH_LEVELS_LIGHT = ["#d0d7de", "#9be9a8", "#40c463", "#30a14e", "#216e39"];
|
|
84233
84858
|
CHIP = {
|
|
84234
84859
|
fresh: GH_LEVELS[4],
|
|
84235
84860
|
stale: "#a1a9b3",
|
|
@@ -84239,14 +84864,17 @@ var init_resume_picker = __esm(() => {
|
|
|
84239
84864
|
ahead: "#bc8cff",
|
|
84240
84865
|
behind: "#d2a8ff"
|
|
84241
84866
|
};
|
|
84242
|
-
|
|
84867
|
+
CHIP_LIGHT = {
|
|
84868
|
+
fresh: GH_LEVELS_LIGHT[3],
|
|
84869
|
+
stale: "#818b98",
|
|
84870
|
+
count: "#218bff",
|
|
84871
|
+
dirty: "#bf8700",
|
|
84872
|
+
clean: GH_LEVELS_LIGHT[2],
|
|
84873
|
+
ahead: "#a475f9",
|
|
84874
|
+
behind: "#b88aff"
|
|
84875
|
+
};
|
|
84243
84876
|
SESSION_AGE_COL = SESSION_AGE_W + 3;
|
|
84244
84877
|
SIZE_FLOOR_BYTES = 16 * 1024;
|
|
84245
|
-
MUTED = C.fgMuted;
|
|
84246
|
-
SCROLLBAR = {
|
|
84247
|
-
showArrows: false,
|
|
84248
|
-
trackOptions: { backgroundColor: tokens.bgPanel, foregroundColor: tokens.border }
|
|
84249
|
-
};
|
|
84250
84878
|
ACTIVITY_H = 2 + ACTIVITY_WEEKS;
|
|
84251
84879
|
});
|
|
84252
84880
|
|
|
@@ -84268,9 +84896,10 @@ async function runResumePicker(cwd = process.cwd()) {
|
|
|
84268
84896
|
await enrichWorktreeGit(groups, repo.root);
|
|
84269
84897
|
setStderrQuiet(true);
|
|
84270
84898
|
const renderer = await createCliRenderer3({
|
|
84271
|
-
|
|
84899
|
+
screenMode: "alternate-screen",
|
|
84272
84900
|
exitOnCtrlC: false
|
|
84273
84901
|
});
|
|
84902
|
+
await applyRendererThemeMode(renderer);
|
|
84274
84903
|
const root = createRoot3(renderer);
|
|
84275
84904
|
let chosen = null;
|
|
84276
84905
|
try {
|
|
@@ -84301,6 +84930,7 @@ async function runResumePicker(cwd = process.cwd()) {
|
|
|
84301
84930
|
}
|
|
84302
84931
|
var init_resume_picker_run = __esm(() => {
|
|
84303
84932
|
init_logger();
|
|
84933
|
+
init_renderer_theme();
|
|
84304
84934
|
init_resume_picker();
|
|
84305
84935
|
init_session_discovery();
|
|
84306
84936
|
});
|
|
@@ -84343,9 +84973,9 @@ __export(exports_session_stats, {
|
|
|
84343
84973
|
});
|
|
84344
84974
|
import { readFileSync as readFileSync31 } from "fs";
|
|
84345
84975
|
import { homedir as homedir37 } from "os";
|
|
84346
|
-
import { join as
|
|
84976
|
+
import { join as join42 } from "path";
|
|
84347
84977
|
function tokenFilePath(port) {
|
|
84348
|
-
return process.env.CLAUDISH_TOKEN_FILE ||
|
|
84978
|
+
return process.env.CLAUDISH_TOKEN_FILE || join42(homedir37(), ".claudish", `tokens-${port}.json`);
|
|
84349
84979
|
}
|
|
84350
84980
|
function readSessionStats(port, opts) {
|
|
84351
84981
|
let raw2;
|
|
@@ -84431,7 +85061,7 @@ function bg(hex4) {
|
|
|
84431
85061
|
return `\x1B[48;2;${r};${g};${b}m`;
|
|
84432
85062
|
}
|
|
84433
85063
|
function paint(text, hex4, bold4 = false) {
|
|
84434
|
-
return `${bold4 ?
|
|
85064
|
+
return `${bold4 ? BOLD4 : ""}${fg(hex4)}${text}${RESET3}`;
|
|
84435
85065
|
}
|
|
84436
85066
|
function meter(pct, width, ramp = ramps.load) {
|
|
84437
85067
|
const cells = Math.floor(width);
|
|
@@ -84451,7 +85081,7 @@ function meter(pct, width, ramp = ramps.load) {
|
|
|
84451
85081
|
}
|
|
84452
85082
|
out += i < filled ? FILL2 : TRACK2;
|
|
84453
85083
|
}
|
|
84454
|
-
return out +
|
|
85084
|
+
return out + RESET3;
|
|
84455
85085
|
}
|
|
84456
85086
|
function stackedBar(segments, width) {
|
|
84457
85087
|
const cells = Math.floor(width);
|
|
@@ -84466,10 +85096,10 @@ function stackedBar(segments, width) {
|
|
|
84466
85096
|
if (n > 0)
|
|
84467
85097
|
out += `${bg(segments[i].color)}${" ".repeat(n)}`;
|
|
84468
85098
|
}
|
|
84469
|
-
return out +
|
|
85099
|
+
return out + RESET3;
|
|
84470
85100
|
}
|
|
84471
85101
|
function badge(label, hex4) {
|
|
84472
|
-
return `${
|
|
85102
|
+
return `${BOLD4}${fg(pickInk(hex4, tokens.ink, C.ink))}${bg(hex4)} ${label} ${RESET3}`;
|
|
84473
85103
|
}
|
|
84474
85104
|
function stripAnsi4(s) {
|
|
84475
85105
|
return s.replace(ANSI_RE3, "");
|
|
@@ -84502,7 +85132,7 @@ function clipStyled(s, width) {
|
|
|
84502
85132
|
w += cw;
|
|
84503
85133
|
i += ch.length;
|
|
84504
85134
|
}
|
|
84505
|
-
return out +
|
|
85135
|
+
return out + RESET3;
|
|
84506
85136
|
}
|
|
84507
85137
|
function padVisible2(s, width, align = "left") {
|
|
84508
85138
|
const clipped = clipStyled(s, width);
|
|
@@ -84544,8 +85174,9 @@ function usd(n) {
|
|
|
84544
85174
|
return `$${n.toFixed(3)}`;
|
|
84545
85175
|
return `$${n.toFixed(2)}`;
|
|
84546
85176
|
}
|
|
84547
|
-
var
|
|
85177
|
+
var RESET3 = "\x1B[0m", BOLD4 = "\x1B[1m", FILL2 = "\u2588", TRACK2 = "\u2591", NODATA2 = "\u254C", ANSI_RE3;
|
|
84548
85178
|
var init_ansi_viz = __esm(() => {
|
|
85179
|
+
init_theme2();
|
|
84549
85180
|
init_color();
|
|
84550
85181
|
init_text();
|
|
84551
85182
|
init_tokens();
|
|
@@ -84559,6 +85190,12 @@ __export(exports_session_summary, {
|
|
|
84559
85190
|
renderSessionSummary: () => renderSessionSummary,
|
|
84560
85191
|
printSessionSummary: () => printSessionSummary
|
|
84561
85192
|
});
|
|
85193
|
+
function toolColors() {
|
|
85194
|
+
return [C.blue, C.cyan, "#8a7d1e", "#1f6d75", C.magenta, "#2d6e3e", C.orange];
|
|
85195
|
+
}
|
|
85196
|
+
function toolOther() {
|
|
85197
|
+
return C.dim;
|
|
85198
|
+
}
|
|
84562
85199
|
function cardWidth() {
|
|
84563
85200
|
const cols = process.stdout.columns || 80;
|
|
84564
85201
|
return Math.max(MIN_W, Math.min(MAX_W, cols - 2));
|
|
@@ -84578,15 +85215,15 @@ function renderSessionSummary(input) {
|
|
|
84578
85215
|
out.push(`${paint("\u2502", tokens.border)} ${padVisible2(s, inner)} ${paint("\u2502", tokens.border)}`);
|
|
84579
85216
|
};
|
|
84580
85217
|
const blank = () => row("");
|
|
84581
|
-
const
|
|
85218
|
+
const chips2 = [badge(truncate3(modelSpec, 34), tokens.accent)];
|
|
84582
85219
|
if (stats.isFree)
|
|
84583
|
-
|
|
85220
|
+
chips2.push(badge("FREE", C.pillKeyBg));
|
|
84584
85221
|
else if (stats.isEstimated)
|
|
84585
|
-
|
|
85222
|
+
chips2.push(badge("EST", "#8a7d1e"));
|
|
84586
85223
|
if (exitCode !== 0)
|
|
84587
|
-
|
|
85224
|
+
chips2.push(badge(`EXIT ${exitCode}`, "#9e2b2b"));
|
|
84588
85225
|
const right = body(duration3(stats.durationMs));
|
|
84589
|
-
const left = clipStyled(
|
|
85226
|
+
const left = clipStyled(chips2.join(" "), Math.max(0, inner - visibleWidth(right) - 1));
|
|
84590
85227
|
const gap = Math.max(1, inner - visibleWidth(left) - visibleWidth(right));
|
|
84591
85228
|
row(left + " ".repeat(gap) + right);
|
|
84592
85229
|
if (stats.providerName)
|
|
@@ -84612,13 +85249,15 @@ function renderSessionSummary(input) {
|
|
|
84612
85249
|
], barW), dim3("in ") + body(usd(stats.inputCostUsd)) + dim3(" out ") + body(usd(stats.outputCostUsd)));
|
|
84613
85250
|
}
|
|
84614
85251
|
if (stats.toolCallTotal > 0) {
|
|
84615
|
-
const
|
|
84616
|
-
const
|
|
84617
|
-
const
|
|
85252
|
+
const toolCols = toolColors();
|
|
85253
|
+
const other = toolOther();
|
|
85254
|
+
const shown = stats.toolCalls.slice(0, toolCols.length);
|
|
85255
|
+
const rest = stats.toolCalls.slice(toolCols.length).reduce((a, t) => a + t.count, 0);
|
|
85256
|
+
const segs = shown.map((t, i) => ({ value: t.count, color: toolCols[i] }));
|
|
84618
85257
|
if (rest > 0)
|
|
84619
|
-
segs.push({ value: rest, color:
|
|
85258
|
+
segs.push({ value: rest, color: other });
|
|
84620
85259
|
dataRow("tools", stackedBar(segs, barW), body(padStartTo(String(stats.toolCallTotal), 4)) + dim3(" calls"));
|
|
84621
|
-
const legend = shown.map((t, i) => paint(`${t.name} ${t.count}`,
|
|
85260
|
+
const legend = shown.map((t, i) => paint(`${t.name} ${t.count}`, toolCols[i])).concat(rest > 0 ? [paint(`other ${rest}`, other)] : []);
|
|
84622
85261
|
for (const line of wrapStyled(legend, dim3(" \xB7 "), inner - LABEL_W)) {
|
|
84623
85262
|
row(" ".repeat(LABEL_W) + line);
|
|
84624
85263
|
}
|
|
@@ -84643,12 +85282,12 @@ function renderSessionSummary(input) {
|
|
|
84643
85282
|
}
|
|
84644
85283
|
return out;
|
|
84645
85284
|
}
|
|
84646
|
-
function wrapStyled(
|
|
85285
|
+
function wrapStyled(chips2, sep, width) {
|
|
84647
85286
|
const lines = [];
|
|
84648
85287
|
let cur = "";
|
|
84649
85288
|
let curW = 0;
|
|
84650
85289
|
const sepW = visibleWidth(sep);
|
|
84651
|
-
for (const chip of
|
|
85290
|
+
for (const chip of chips2) {
|
|
84652
85291
|
const w = visibleWidth(chip);
|
|
84653
85292
|
if (cur && curW + sepW + w > width) {
|
|
84654
85293
|
lines.push(cur);
|
|
@@ -84666,24 +85305,14 @@ function wrapStyled(chips, sep, width) {
|
|
|
84666
85305
|
function printSessionSummary(input, write) {
|
|
84667
85306
|
for (const line of renderSessionSummary(input))
|
|
84668
85307
|
write(line);
|
|
84669
|
-
write(
|
|
85308
|
+
write(RESET3);
|
|
84670
85309
|
}
|
|
84671
|
-
var
|
|
85310
|
+
var MIN_W = 62, MAX_W = 96, CHROME = 4, LABEL_W = 10;
|
|
84672
85311
|
var init_session_summary = __esm(() => {
|
|
84673
85312
|
init_theme2();
|
|
84674
85313
|
init_text();
|
|
84675
85314
|
init_tokens();
|
|
84676
85315
|
init_ansi_viz();
|
|
84677
|
-
TOOL_COLORS = [
|
|
84678
|
-
C.blue,
|
|
84679
|
-
C.cyan,
|
|
84680
|
-
"#8a7d1e",
|
|
84681
|
-
"#1f6d75",
|
|
84682
|
-
C.magenta,
|
|
84683
|
-
"#2d6e3e",
|
|
84684
|
-
C.orange
|
|
84685
|
-
];
|
|
84686
|
-
TOOL_OTHER = C.dim;
|
|
84687
85316
|
});
|
|
84688
85317
|
|
|
84689
85318
|
// src/index.ts
|
|
@@ -84691,7 +85320,7 @@ init_op_source();
|
|
|
84691
85320
|
init_startup_trace();
|
|
84692
85321
|
var import_dotenv3 = __toESM(require_main(), 1);
|
|
84693
85322
|
import { existsSync as existsSync31, readFileSync as readFileSync32 } from "fs";
|
|
84694
|
-
import { join as
|
|
85323
|
+
import { join as join43, resolve as resolve5 } from "path";
|
|
84695
85324
|
import_dotenv3.config({ quiet: true });
|
|
84696
85325
|
function classifyStartupKind() {
|
|
84697
85326
|
const argv = process.argv.slice(2);
|
|
@@ -84937,6 +85566,10 @@ async function runCli() {
|
|
|
84937
85566
|
return Buffer.concat(chunks).toString("utf-8");
|
|
84938
85567
|
}
|
|
84939
85568
|
try {
|
|
85569
|
+
await traceSpan("startup:theme-detect", async () => {
|
|
85570
|
+
const { detectAndSetThemeMode: detectAndSetThemeMode2 } = await Promise.resolve().then(() => (init_theme_mode(), exports_theme_mode));
|
|
85571
|
+
await detectAndSetThemeMode2();
|
|
85572
|
+
});
|
|
84940
85573
|
const cliConfig = await traceSpan("startup:parse-args", () => parseArgs2(process.argv.slice(2)));
|
|
84941
85574
|
await traceSpan("startup:endpoint-registration", async () => {
|
|
84942
85575
|
const { ensureEndpointsRegistered: ensureEndpointsRegistered2 } = await Promise.resolve().then(() => (init_endpoint_registration(), exports_endpoint_registration));
|
|
@@ -84952,7 +85585,7 @@ async function runCli() {
|
|
|
84952
85585
|
process.exit(1);
|
|
84953
85586
|
}
|
|
84954
85587
|
const mode = cliConfig.teamMode ?? "default";
|
|
84955
|
-
const sessionPath =
|
|
85588
|
+
const sessionPath = join43(process.cwd(), `.claudish-team-${Date.now()}`);
|
|
84956
85589
|
if (mode === "json") {
|
|
84957
85590
|
const { setupSession: setupSession2, runModels: runModels2 } = await Promise.resolve().then(() => (init_team_orchestrator(), exports_team_orchestrator));
|
|
84958
85591
|
setupSession2(sessionPath, cliConfig.team, prompt);
|
|
@@ -84962,7 +85595,7 @@ async function runCli() {
|
|
|
84962
85595
|
});
|
|
84963
85596
|
const result = { ...status2, responses: {} };
|
|
84964
85597
|
for (const anonId of Object.keys(status2.models)) {
|
|
84965
|
-
const responsePath =
|
|
85598
|
+
const responsePath = join43(sessionPath, `response-${anonId}.md`);
|
|
84966
85599
|
try {
|
|
84967
85600
|
const raw2 = readFileSync32(responsePath, "utf-8").trim();
|
|
84968
85601
|
try {
|
|
@@ -85169,7 +85802,8 @@ Team Status`);
|
|
|
85169
85802
|
isInteractive: cliConfig.interactive,
|
|
85170
85803
|
advisorModels: cliConfig.advisorModels,
|
|
85171
85804
|
advisorCollector: cliConfig.advisorCollector,
|
|
85172
|
-
modelChain: cliConfig.monitor ? undefined : cliConfig.modelChain
|
|
85805
|
+
modelChain: cliConfig.monitor ? undefined : cliConfig.modelChain,
|
|
85806
|
+
classifier: resolveClassifierConfig(cliConfig, process.env)
|
|
85173
85807
|
}));
|
|
85174
85808
|
const diag = createDiagOutput2({
|
|
85175
85809
|
interactive: cliConfig.interactive,
|