claudish 7.66.1 → 7.67.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.
Files changed (2) hide show
  1. package/dist/index.js +850 -315
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -731,7 +731,7 @@ var init_onepassword_config = __esm(() => {
731
731
  });
732
732
 
733
733
  // src/version.ts
734
- var VERSION = "7.66.1";
734
+ var VERSION = "7.67.0";
735
735
 
736
736
  // src/logger.ts
737
737
  var exports_logger = {};
@@ -27562,6 +27562,7 @@ __export(exports_profile_config, {
27562
27562
  loadConfig: () => loadConfig,
27563
27563
  loadLocalConfig: () => loadLocalConfig,
27564
27564
  localConfigExists: () => localConfigExists,
27565
+ readProOnUltracode: () => readProOnUltracode,
27565
27566
  removeApiKey: () => removeApiKey,
27566
27567
  removeEndpoint: () => removeEndpoint,
27567
27568
  saveConfig: () => saveConfig,
@@ -27650,6 +27651,9 @@ function loadConfig() {
27650
27651
  if (config2.behavior !== undefined) {
27651
27652
  merged.behavior = config2.behavior;
27652
27653
  }
27654
+ if (config2.proOnUltracode !== undefined) {
27655
+ merged.proOnUltracode = config2.proOnUltracode;
27656
+ }
27653
27657
  return merged;
27654
27658
  } catch (error46) {
27655
27659
  console.error(`Warning: Failed to load config, using defaults: ${error46}`);
@@ -27685,6 +27689,19 @@ function getLocalConfigPath() {
27685
27689
  function localConfigExists() {
27686
27690
  return existsSync5(getLocalConfigPath());
27687
27691
  }
27692
+ function readProOnUltracode(paths = defaultScopedConfigPaths) {
27693
+ for (const pathFn of [paths.project, paths.global]) {
27694
+ try {
27695
+ const path = pathFn();
27696
+ if (!existsSync5(path))
27697
+ continue;
27698
+ const parsed = JSON.parse(readFileSync5(path, "utf-8"));
27699
+ if (typeof parsed?.proOnUltracode === "boolean")
27700
+ return parsed.proOnUltracode;
27701
+ } catch {}
27702
+ }
27703
+ return;
27704
+ }
27688
27705
  function isProjectDirectory() {
27689
27706
  const cwd = process.cwd();
27690
27707
  return [".git", "package.json", "Cargo.toml", "go.mod", "pyproject.toml", ".claudish.json"].some((f) => existsSync5(join7(cwd, f)));
@@ -27968,7 +27985,7 @@ function disableLocalProvider(providerName) {
27968
27985
  }
27969
27986
  saveConfig(config2);
27970
27987
  }
27971
- var CONFIG_DIR, CONFIG_FILE, LOCAL_CONFIG_FILENAME = ".claudish.json", DEFAULT_CONFIG;
27988
+ var CONFIG_DIR, CONFIG_FILE, LOCAL_CONFIG_FILENAME = ".claudish.json", DEFAULT_CONFIG, defaultScopedConfigPaths;
27972
27989
  var init_profile_config = __esm(() => {
27973
27990
  CONFIG_DIR = join7(homedir7(), ".claudish");
27974
27991
  CONFIG_FILE = join7(CONFIG_DIR, "config.json");
@@ -27985,6 +28002,10 @@ var init_profile_config = __esm(() => {
27985
28002
  }
27986
28003
  }
27987
28004
  };
28005
+ defaultScopedConfigPaths = {
28006
+ global: () => activeConfigFile(),
28007
+ project: () => getLocalConfigPath()
28008
+ };
27988
28009
  });
27989
28010
 
27990
28011
  // src/providers/runtime-providers.ts
@@ -28149,6 +28170,24 @@ function lookupFamilyDefaultVariant(familyId, provider, cachePath) {
28149
28170
  }
28150
28171
  return;
28151
28172
  }
28173
+ function lookupVariantPresets(baseModelId, provider, cachePath) {
28174
+ const cache2 = readAllModelsCache(cachePath);
28175
+ if (!cache2)
28176
+ return [];
28177
+ const wanted = stripVendorPrefix(baseModelId.toLowerCase());
28178
+ const found = [];
28179
+ for (const entry of cache2.entries) {
28180
+ const rv = entry.routeVariant;
28181
+ if (!rv?.preset || !rv.baseModelId)
28182
+ continue;
28183
+ if (stripVendorPrefix(rv.baseModelId.toLowerCase()) !== wanted)
28184
+ continue;
28185
+ if (provider !== undefined && rv.provider !== provider)
28186
+ continue;
28187
+ found.push({ modelId: entry.modelId, preset: rv.preset, provider: rv.provider });
28188
+ }
28189
+ return found;
28190
+ }
28152
28191
  function lookupModelCapabilities(modelId, cachePath) {
28153
28192
  const entry = findCacheEntry(modelId, cachePath);
28154
28193
  if (!entry)
@@ -28177,6 +28216,9 @@ function isSubscriptionPlan(provider, cachePath) {
28177
28216
  return false;
28178
28217
  return cache2.entries.some((e) => e.subscriptionPlans?.includes(provider));
28179
28218
  }
28219
+ function stripVendorPrefix(lowerId) {
28220
+ return lowerId.includes("/") ? lowerId.substring(lowerId.lastIndexOf("/") + 1) : lowerId;
28221
+ }
28180
28222
  function findCacheEntry(modelId, cachePath) {
28181
28223
  if (modelId.includes("@")) {
28182
28224
  throw new Error(`model-catalog lookup received provider-routed ID "${modelId}" \u2014 callers must strip the "@" prefix before calling`);
@@ -28185,7 +28227,7 @@ function findCacheEntry(modelId, cachePath) {
28185
28227
  if (!cache2 || cache2.entries.length === 0)
28186
28228
  return;
28187
28229
  const lower = modelId.toLowerCase();
28188
- const unprefixed = lower.includes("/") ? lower.substring(lower.lastIndexOf("/") + 1) : lower;
28230
+ const unprefixed = stripVendorPrefix(lower);
28189
28231
  for (const entry of cache2.entries) {
28190
28232
  const entryId = entry.modelId.toLowerCase();
28191
28233
  const exactMatch = entryId === unprefixed || entryId === lower;
@@ -28658,6 +28700,8 @@ class BaseAPIFormat {
28658
28700
  return request;
28659
28701
  }
28660
28702
  clampToAdvertisedEffort(requested, reasoning) {
28703
+ if (this.pinnedEffort)
28704
+ return this.pinnedEffort;
28661
28705
  const advertised = (reasoning.efforts ?? []).filter(isEffortLevel);
28662
28706
  if (advertised.length === 0) {
28663
28707
  return isEffortLevel(reasoning.defaultEffort) ? reasoning.defaultEffort : undefined;
@@ -28699,7 +28743,13 @@ class BaseAPIFormat {
28699
28743
  return 8192;
28700
28744
  }
28701
28745
  }
28746
+ pinnedEffort;
28747
+ setEffortOverride(level) {
28748
+ this.pinnedEffort = level;
28749
+ }
28702
28750
  resolveEffortLevel(originalRequest) {
28751
+ if (this.pinnedEffort)
28752
+ return this.pinnedEffort;
28703
28753
  const lvl = originalRequest?.output_config?.effort;
28704
28754
  if (typeof lvl === "string") {
28705
28755
  const lower = lvl.toLowerCase();
@@ -35177,6 +35227,57 @@ var init_middleware = __esm(() => {
35177
35227
  init_gemini_thought_signature();
35178
35228
  });
35179
35229
 
35230
+ // src/model-params.ts
35231
+ function isPlainObject3(value) {
35232
+ return typeof value === "object" && value !== null && !Array.isArray(value);
35233
+ }
35234
+ function deepMergeParams(target, source) {
35235
+ for (const [key, value] of Object.entries(source)) {
35236
+ if (isPlainObject3(value) && isPlainObject3(target[key])) {
35237
+ deepMergeParams(target[key], value);
35238
+ } else if (isPlainObject3(value)) {
35239
+ target[key] = deepMergeParams({}, value);
35240
+ } else {
35241
+ target[key] = value;
35242
+ }
35243
+ }
35244
+ return target;
35245
+ }
35246
+ function coerceValue(raw) {
35247
+ try {
35248
+ return JSON.parse(raw);
35249
+ } catch {
35250
+ return raw;
35251
+ }
35252
+ }
35253
+ function parseModelParams(spec, into = {}) {
35254
+ for (const item of spec.split(",")) {
35255
+ const trimmed2 = item.trim();
35256
+ if (!trimmed2)
35257
+ continue;
35258
+ const eq = trimmed2.indexOf("=");
35259
+ if (eq <= 0) {
35260
+ throw new Error(`--model-params item "${trimmed2}" must be key=value`);
35261
+ }
35262
+ const key = trimmed2.slice(0, eq).trim();
35263
+ const raw = trimmed2.slice(eq + 1);
35264
+ const path = key.split(".");
35265
+ if (path.some((seg) => seg.length === 0)) {
35266
+ throw new Error(`--model-params key "${key}" has an empty dot segment`);
35267
+ }
35268
+ const nested = {};
35269
+ let cursor = nested;
35270
+ for (const seg of path.slice(0, -1)) {
35271
+ const child = {};
35272
+ cursor[seg] = child;
35273
+ cursor = child;
35274
+ }
35275
+ cursor[path[path.length - 1]] = coerceValue(raw);
35276
+ deepMergeParams(into, nested);
35277
+ }
35278
+ return into;
35279
+ }
35280
+
35180
35281
  // src/handlers/shared/quota-exhaustion.ts
35181
35282
  function hasQuotaExhaustionWording(errorBody) {
35182
35283
  const lower = (errorBody || "").toLowerCase();
@@ -39198,6 +39299,362 @@ var init_vision_proxy = __esm(() => {
39198
39299
  init_catalog_query();
39199
39300
  });
39200
39301
 
39302
+ // src/session-events/event-translator.ts
39303
+ function translateLine(line) {
39304
+ let record4;
39305
+ try {
39306
+ record4 = JSON.parse(line);
39307
+ } catch {
39308
+ return null;
39309
+ }
39310
+ if (record4 === null || typeof record4 !== "object")
39311
+ return null;
39312
+ const at = typeof record4.timestamp === "string" ? record4.timestamp : undefined;
39313
+ if (record4.type === "attachment") {
39314
+ const attachmentType = record4.attachment?.type;
39315
+ if (attachmentType === "ultra_effort_enter")
39316
+ return { kind: "ultra_effort_enter", at };
39317
+ if (attachmentType === "ultra_effort_exit")
39318
+ return { kind: "ultra_effort_exit", at };
39319
+ return {
39320
+ kind: "unknown",
39321
+ attachmentType: typeof attachmentType === "string" ? attachmentType : undefined,
39322
+ at
39323
+ };
39324
+ }
39325
+ if (record4.type === "user") {
39326
+ const content = record4.message?.content;
39327
+ if (typeof content === "string" && content.includes("<local-command-stdout>")) {
39328
+ const match = content.match(EFFORT_STDOUT_RE);
39329
+ if (match) {
39330
+ const scope = match[2] === "this session only" ? "session" : "default";
39331
+ return { kind: "effort_changed", level: match[1], scope, at };
39332
+ }
39333
+ }
39334
+ }
39335
+ return null;
39336
+ }
39337
+ var EFFORT_STDOUT_RE;
39338
+ var init_event_translator = __esm(() => {
39339
+ EFFORT_STDOUT_RE = /Set effort level to (\S+) \((this session only|saved as your default)/;
39340
+ });
39341
+
39342
+ // src/session-events/session-state.ts
39343
+ function initialState(seed) {
39344
+ if (seed?.defaultEffort) {
39345
+ return {
39346
+ ultracodeActive: false,
39347
+ effort: seed.defaultEffort,
39348
+ defaultEffort: seed.defaultEffort,
39349
+ seededFrom: "settings"
39350
+ };
39351
+ }
39352
+ return { ultracodeActive: false, seededFrom: "none" };
39353
+ }
39354
+ function reduceEvent(state, event) {
39355
+ const next = { ...state, lastEventAt: event.at ?? state.lastEventAt };
39356
+ switch (event.kind) {
39357
+ case "ultra_effort_enter":
39358
+ next.ultracodeActive = true;
39359
+ return next;
39360
+ case "ultra_effort_exit":
39361
+ next.ultracodeActive = false;
39362
+ return next;
39363
+ case "effort_changed":
39364
+ next.effort = event.level;
39365
+ next.effortScope = event.scope;
39366
+ next.ultracodeActive = event.level === "ultracode";
39367
+ if (event.scope === "default")
39368
+ next.defaultEffort = event.level;
39369
+ return next;
39370
+ default:
39371
+ return next;
39372
+ }
39373
+ }
39374
+
39375
+ // src/session-events/transcript-tailer.ts
39376
+ import { closeSync as closeSync5, openSync as openSync5, readSync, statSync as statSync4 } from "fs";
39377
+
39378
+ class TranscriptTailer {
39379
+ filePath;
39380
+ onLine;
39381
+ opts;
39382
+ offset = 0;
39383
+ buffer = "";
39384
+ decoder = new TextDecoder;
39385
+ timer = null;
39386
+ disposed = false;
39387
+ constructor(filePath, onLine, opts = {}) {
39388
+ this.filePath = filePath;
39389
+ this.onLine = onLine;
39390
+ this.opts = opts;
39391
+ }
39392
+ start() {
39393
+ if (this.disposed)
39394
+ return;
39395
+ this.tick();
39396
+ this.schedule();
39397
+ }
39398
+ syncNow() {
39399
+ this.tick();
39400
+ }
39401
+ dispose() {
39402
+ this.disposed = true;
39403
+ if (this.timer) {
39404
+ clearTimeout(this.timer);
39405
+ this.timer = null;
39406
+ }
39407
+ }
39408
+ schedule() {
39409
+ if (this.disposed)
39410
+ return;
39411
+ this.timer = setTimeout(() => {
39412
+ this.tick();
39413
+ this.schedule();
39414
+ }, this.opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS);
39415
+ this.timer.unref?.();
39416
+ }
39417
+ tick() {
39418
+ if (this.disposed)
39419
+ return;
39420
+ try {
39421
+ const size = statSync4(this.filePath).size;
39422
+ if (size < this.offset) {
39423
+ this.offset = 0;
39424
+ this.buffer = "";
39425
+ this.decoder = new TextDecoder;
39426
+ }
39427
+ if (size === this.offset)
39428
+ return;
39429
+ const fd = openSync5(this.filePath, "r");
39430
+ let chunk;
39431
+ try {
39432
+ chunk = Buffer.alloc(size - this.offset);
39433
+ const bytesRead = readSync(fd, chunk, 0, chunk.length, this.offset);
39434
+ this.offset += bytesRead;
39435
+ if (bytesRead < chunk.length)
39436
+ chunk = chunk.subarray(0, bytesRead);
39437
+ } finally {
39438
+ closeSync5(fd);
39439
+ }
39440
+ this.buffer += this.decoder.decode(chunk, { stream: true });
39441
+ const lines = this.buffer.split(`
39442
+ `);
39443
+ this.buffer = lines.pop() ?? "";
39444
+ for (const line of lines) {
39445
+ if (line.trim())
39446
+ this.onLine(line);
39447
+ }
39448
+ } catch (err) {
39449
+ this.dispose();
39450
+ this.opts.onError?.(err);
39451
+ }
39452
+ }
39453
+ }
39454
+ var DEFAULT_POLL_INTERVAL_MS = 250;
39455
+ var init_transcript_tailer = () => {};
39456
+
39457
+ // src/session-events/index.ts
39458
+ import { existsSync as existsSync16, readFileSync as readFileSync15, readdirSync as readdirSync3 } from "fs";
39459
+ import { homedir as homedir23 } from "os";
39460
+ import { join as join23 } from "path";
39461
+ function extractSessionId2(metadata) {
39462
+ const userId = metadata?.user_id;
39463
+ if (typeof userId !== "string")
39464
+ return;
39465
+ try {
39466
+ const parsed = JSON.parse(userId);
39467
+ if (typeof parsed?.session_id === "string" && parsed.session_id) {
39468
+ return parsed.session_id;
39469
+ }
39470
+ } catch {}
39471
+ const match = userId.match(/session_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);
39472
+ return match?.[1];
39473
+ }
39474
+ function slugFromCwd(cwd) {
39475
+ return cwd.replace(/[^a-zA-Z0-9]/g, "-");
39476
+ }
39477
+
39478
+ class SessionEventRegistry {
39479
+ sessions = new Map;
39480
+ misses = new Map;
39481
+ subscribers = [];
39482
+ claudeHome;
39483
+ pollIntervalMs;
39484
+ constructor(opts = {}) {
39485
+ this.claudeHome = opts.claudeHome ?? join23(homedir23(), ".claude");
39486
+ this.pollIntervalMs = opts.pollIntervalMs;
39487
+ }
39488
+ ensureSession(sessionId) {
39489
+ try {
39490
+ this.sweepIdle();
39491
+ const existing = this.sessions.get(sessionId);
39492
+ if (existing) {
39493
+ existing.lastActivity = Date.now();
39494
+ return;
39495
+ }
39496
+ const miss = this.misses.get(sessionId);
39497
+ if (miss) {
39498
+ if (miss.count >= MAX_MISSES)
39499
+ return;
39500
+ if (Date.now() - miss.lastTry < MISS_TTL_MS)
39501
+ return;
39502
+ }
39503
+ const filePath = this.locateTranscript(sessionId);
39504
+ if (!filePath) {
39505
+ const count = (miss?.count ?? 0) + 1;
39506
+ this.misses.set(sessionId, { lastTry: Date.now(), count });
39507
+ if (count === MAX_MISSES) {
39508
+ log(`[SessionEvents] transcript for session ${sessionId} not found after ${MAX_MISSES} attempts \u2014 giving up`);
39509
+ }
39510
+ return;
39511
+ }
39512
+ this.misses.delete(sessionId);
39513
+ const entry = {
39514
+ state: initialState({ defaultEffort: this.readSettingsEffortLevel() }),
39515
+ tailer: new TranscriptTailer(filePath, (line) => this.onLine(sessionId, line), {
39516
+ pollIntervalMs: this.pollIntervalMs,
39517
+ onError: (err) => log(`[SessionEvents] tailer for ${sessionId} stopped: ${err}`)
39518
+ }),
39519
+ lastActivity: Date.now()
39520
+ };
39521
+ this.sessions.set(sessionId, entry);
39522
+ entry.tailer.start();
39523
+ log(`[SessionEvents] tailing ${filePath}`);
39524
+ } catch (err) {
39525
+ log(`[SessionEvents] ensureSession(${sessionId}) failed: ${err}`);
39526
+ }
39527
+ }
39528
+ sync(sessionId) {
39529
+ try {
39530
+ const entry = this.sessions.get(sessionId);
39531
+ if (entry) {
39532
+ entry.lastActivity = Date.now();
39533
+ entry.tailer.syncNow();
39534
+ }
39535
+ } catch (err) {
39536
+ log(`[SessionEvents] sync(${sessionId}) failed: ${err}`);
39537
+ }
39538
+ }
39539
+ getState(sessionId) {
39540
+ return this.sessions.get(sessionId)?.state;
39541
+ }
39542
+ subscribe(fn) {
39543
+ this.subscribers.push(fn);
39544
+ return () => {
39545
+ this.subscribers = this.subscribers.filter((s) => s !== fn);
39546
+ };
39547
+ }
39548
+ disposeAll() {
39549
+ for (const entry of this.sessions.values()) {
39550
+ entry.tailer.dispose();
39551
+ }
39552
+ this.sessions.clear();
39553
+ this.misses.clear();
39554
+ }
39555
+ onLine(sessionId, line) {
39556
+ const event = translateLine(line);
39557
+ if (!event)
39558
+ return;
39559
+ const entry = this.sessions.get(sessionId);
39560
+ if (!entry)
39561
+ return;
39562
+ entry.state = reduceEvent(entry.state, event);
39563
+ log(`[SessionEvents] ${sessionId}: ${event.kind}${event.kind === "effort_changed" ? ` level=${event.level} scope=${event.scope}` : ""} \u2192 ultracodeActive=${entry.state.ultracodeActive}`);
39564
+ for (const fn of this.subscribers) {
39565
+ try {
39566
+ fn(sessionId, event);
39567
+ } catch {}
39568
+ }
39569
+ }
39570
+ locateTranscript(sessionId) {
39571
+ const projectsDir = join23(this.claudeHome, "projects");
39572
+ const primary = join23(projectsDir, slugFromCwd(process.cwd()), `${sessionId}.jsonl`);
39573
+ if (existsSync16(primary))
39574
+ return primary;
39575
+ try {
39576
+ for (const dir of readdirSync3(projectsDir)) {
39577
+ const candidate = join23(projectsDir, dir, `${sessionId}.jsonl`);
39578
+ if (existsSync16(candidate))
39579
+ return candidate;
39580
+ }
39581
+ } catch {}
39582
+ return;
39583
+ }
39584
+ readSettingsEffortLevel() {
39585
+ try {
39586
+ const settings = JSON.parse(readFileSync15(join23(this.claudeHome, "settings.json"), "utf-8"));
39587
+ return typeof settings.effortLevel === "string" ? settings.effortLevel : undefined;
39588
+ } catch {
39589
+ return;
39590
+ }
39591
+ }
39592
+ sweepIdle() {
39593
+ const now2 = Date.now();
39594
+ for (const [sid, entry] of this.sessions) {
39595
+ if (now2 - entry.lastActivity > IDLE_SWEEP_MS) {
39596
+ entry.tailer.dispose();
39597
+ this.sessions.delete(sid);
39598
+ }
39599
+ }
39600
+ }
39601
+ }
39602
+ var MISS_TTL_MS = 5000, MAX_MISSES = 5, IDLE_SWEEP_MS, sessionEvents;
39603
+ var init_session_events = __esm(() => {
39604
+ init_logger();
39605
+ init_event_translator();
39606
+ init_transcript_tailer();
39607
+ IDLE_SWEEP_MS = 30 * 60 * 1000;
39608
+ sessionEvents = new SessionEventRegistry;
39609
+ });
39610
+
39611
+ // src/session-events/pro-injection.ts
39612
+ function resolveVariantPreset(bareModelName, provider, cachePath) {
39613
+ for (const variant of lookupVariantPresets(bareModelName, provider, cachePath)) {
39614
+ try {
39615
+ const params = parseModelParams(variant.preset);
39616
+ if (Object.keys(params).length === 0)
39617
+ continue;
39618
+ return {
39619
+ params,
39620
+ variantModelId: variant.modelId,
39621
+ provider: variant.provider,
39622
+ preset: variant.preset
39623
+ };
39624
+ } catch {}
39625
+ }
39626
+ return;
39627
+ }
39628
+ function applyProInjection(requestPayload, opts) {
39629
+ try {
39630
+ if (!opts.enabled || !opts.sessionId)
39631
+ return false;
39632
+ if (opts.outputConfig?.effort !== "xhigh")
39633
+ return false;
39634
+ if (opts.outputConfig?.format)
39635
+ return false;
39636
+ const registry2 = opts.registry ?? sessionEvents;
39637
+ registry2.ensureSession(opts.sessionId);
39638
+ registry2.sync(opts.sessionId);
39639
+ const state = registry2.getState(opts.sessionId);
39640
+ if (!state?.ultracodeActive)
39641
+ return false;
39642
+ const resolved = resolveVariantPreset(opts.bareModelName, opts.provider, opts.cachePath);
39643
+ if (!resolved)
39644
+ return false;
39645
+ deepMergeParams(requestPayload, resolved.params);
39646
+ log(`[SessionEvents] ultracode active \u2192 preset ${resolved.preset} for ${opts.targetModel} ` + `(catalog variant ${resolved.variantModelId} @ ${resolved.provider}, session ${opts.sessionId})`);
39647
+ return true;
39648
+ } catch {
39649
+ return false;
39650
+ }
39651
+ }
39652
+ var init_pro_injection = __esm(() => {
39653
+ init_model_catalog();
39654
+ init_logger();
39655
+ init_session_events();
39656
+ });
39657
+
39201
39658
  // src/providers/model-parser.ts
39202
39659
  function parseModelChain(modelSpec) {
39203
39660
  const parts = modelSpec.split(MODEL_CHAIN_SEPARATOR).map((s) => s.trim()).filter(Boolean);
@@ -39313,25 +39770,25 @@ var init_model_parser = __esm(() => {
39313
39770
 
39314
39771
  // src/stats-buffer.ts
39315
39772
  import {
39316
- existsSync as existsSync16,
39773
+ existsSync as existsSync17,
39317
39774
  mkdirSync as mkdirSync9,
39318
- readFileSync as readFileSync15,
39775
+ readFileSync as readFileSync16,
39319
39776
  renameSync as renameSync2,
39320
39777
  unlinkSync as unlinkSync5,
39321
39778
  writeFileSync as writeFileSync8
39322
39779
  } from "fs";
39323
- import { homedir as homedir23 } from "os";
39324
- import { join as join23 } from "path";
39780
+ import { homedir as homedir24 } from "os";
39781
+ import { join as join24 } from "path";
39325
39782
  function ensureDir() {
39326
- if (!existsSync16(CLAUDISH_DIR)) {
39783
+ if (!existsSync17(CLAUDISH_DIR)) {
39327
39784
  mkdirSync9(CLAUDISH_DIR, { recursive: true });
39328
39785
  }
39329
39786
  }
39330
39787
  function readFromDisk() {
39331
39788
  try {
39332
- if (!existsSync16(BUFFER_FILE))
39789
+ if (!existsSync17(BUFFER_FILE))
39333
39790
  return [];
39334
- const raw = readFileSync15(BUFFER_FILE, "utf-8");
39791
+ const raw = readFileSync16(BUFFER_FILE, "utf-8");
39335
39792
  const parsed = JSON.parse(raw);
39336
39793
  if (!Array.isArray(parsed.events))
39337
39794
  return [];
@@ -39356,7 +39813,7 @@ function writeToDisk(events) {
39356
39813
  ensureDir();
39357
39814
  const trimmed2 = enforceSizeCap([...events]);
39358
39815
  const payload = { version: 1, events: trimmed2 };
39359
- const tmpFile = join23(CLAUDISH_DIR, `stats-buffer.tmp.${process.pid}.json`);
39816
+ const tmpFile = join24(CLAUDISH_DIR, `stats-buffer.tmp.${process.pid}.json`);
39360
39817
  writeFileSync8(tmpFile, JSON.stringify(payload, null, 2), "utf-8");
39361
39818
  renameSync2(tmpFile, BUFFER_FILE);
39362
39819
  memoryCache = trimmed2;
@@ -39400,7 +39857,7 @@ function clearBuffer() {
39400
39857
  try {
39401
39858
  memoryCache = [];
39402
39859
  eventsSinceLastFlush = 0;
39403
- if (existsSync16(BUFFER_FILE)) {
39860
+ if (existsSync17(BUFFER_FILE)) {
39404
39861
  unlinkSync5(BUFFER_FILE);
39405
39862
  }
39406
39863
  } catch {}
@@ -39429,8 +39886,8 @@ function syncFlushOnExit() {
39429
39886
  var BUFFER_MAX_BYTES, CLAUDISH_DIR, BUFFER_FILE, memoryCache = null, eventsSinceLastFlush = 0, flushScheduled = false, SIGNAL_EXIT_CODE;
39430
39887
  var init_stats_buffer = __esm(() => {
39431
39888
  BUFFER_MAX_BYTES = 64 * 1024;
39432
- CLAUDISH_DIR = join23(homedir23(), ".claudish");
39433
- BUFFER_FILE = join23(CLAUDISH_DIR, "stats-buffer.json");
39889
+ CLAUDISH_DIR = join24(homedir24(), ".claudish");
39890
+ BUFFER_FILE = join24(CLAUDISH_DIR, "stats-buffer.json");
39434
39891
  process.on("exit", syncFlushOnExit);
39435
39892
  SIGNAL_EXIT_CODE = { SIGTERM: 143, SIGINT: 130 };
39436
39893
  for (const signal of ["SIGTERM", "SIGINT"]) {
@@ -42548,8 +43005,8 @@ var init_openai_responses_sse = __esm(() => {
42548
43005
 
42549
43006
  // src/handlers/shared/token-tracker.ts
42550
43007
  import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync9 } from "fs";
42551
- import { homedir as homedir24 } from "os";
42552
- import { dirname as dirname8, join as join24 } from "path";
43008
+ import { homedir as homedir25 } from "os";
43009
+ import { dirname as dirname8, join as join25 } from "path";
42553
43010
  function stripProviderPrefix(name) {
42554
43011
  const at = name.indexOf("@");
42555
43012
  return at === -1 ? name : name.slice(at + 1);
@@ -42737,7 +43194,7 @@ class TokenTracker {
42737
43194
  };
42738
43195
  }
42739
43196
  const override = process.env.CLAUDISH_TOKEN_FILE;
42740
- const outPath = override || join24(homedir24(), ".claudish", `tokens-${this.port}.json`);
43197
+ const outPath = override || join25(homedir25(), ".claudish", `tokens-${this.port}.json`);
42741
43198
  mkdirSync10(dirname8(outPath), { recursive: true });
42742
43199
  writeFileSync9(outPath, JSON.stringify(data), "utf-8");
42743
43200
  } catch (e) {
@@ -42862,6 +43319,12 @@ class ComposedHandler {
42862
43319
  }
42863
43320
  this.middlewareManager.initialize().catch((err) => log(`[ComposedHandler:${this.bareModelName}] Middleware init error: ${err}`));
42864
43321
  this.behaviorEngine = getBehaviorEngine();
43322
+ if (options.effortOverride) {
43323
+ for (const dialect of new Set([this.explicitAdapter, this.resolvedDialect, this.modelAdapter].filter(Boolean))) {
43324
+ dialect.setEffortOverride(options.effortOverride);
43325
+ }
43326
+ log(`[ComposedHandler] --effort ${options.effortOverride} pinned for ${this.targetModel} (catalog clamp skipped)`);
43327
+ }
42865
43328
  this.tokenTracker = new TokenTracker(port, {
42866
43329
  contextWindow: this.getModelContextWindow(),
42867
43330
  providerName: provider.name,
@@ -43000,6 +43463,22 @@ class ComposedHandler {
43000
43463
  this.modelAdapter.prepareRequest(requestPayload, claudeRequest);
43001
43464
  }
43002
43465
  const toolNameMap = adapter.getToolNameMap();
43466
+ if (this.options.proOnUltracode) {
43467
+ applyProInjection(requestPayload, {
43468
+ enabled: true,
43469
+ sessionId: extractSessionId2(claudeRequest?.metadata),
43470
+ bareModelName: this.bareModelName,
43471
+ provider: this.provider.name,
43472
+ targetModel: this.targetModel,
43473
+ outputConfig: claudeRequest?.output_config,
43474
+ registry: this.options.sessionEventRegistry,
43475
+ cachePath: this.options.catalogCachePath
43476
+ });
43477
+ }
43478
+ if (this.options.modelParams) {
43479
+ deepMergeParams(requestPayload, this.options.modelParams);
43480
+ log(`[ComposedHandler] Merged --model-params (${Object.keys(this.options.modelParams).join(", ")}) for ${this.targetModel}`);
43481
+ }
43003
43482
  if (this.provider.refreshAuth) {
43004
43483
  try {
43005
43484
  await this.provider.refreshAuth();
@@ -43716,6 +44195,8 @@ var init_composed_handler = __esm(() => {
43716
44195
  init_middleware();
43717
44196
  init_openai();
43718
44197
  init_vision_proxy();
44198
+ init_session_events();
44199
+ init_pro_injection();
43719
44200
  init_stats();
43720
44201
  init_telemetry();
43721
44202
  init_transform();
@@ -43739,11 +44220,11 @@ var init_composed_handler = __esm(() => {
43739
44220
  });
43740
44221
 
43741
44222
  // src/providers/api-key-provenance.ts
43742
- import { existsSync as existsSync17, readFileSync as readFileSync16 } from "fs";
43743
- import { homedir as homedir25 } from "os";
43744
- import { join as join25, resolve as resolve2 } from "path";
44223
+ import { existsSync as existsSync18, readFileSync as readFileSync17 } from "fs";
44224
+ import { homedir as homedir26 } from "os";
44225
+ import { join as join26, resolve as resolve2 } from "path";
43745
44226
  function activeConfigPath() {
43746
- return activeGlobalConfigFile(join25(homedir25(), ".claudish", "config.json"));
44227
+ return activeGlobalConfigFile(join26(homedir26(), ".claudish", "config.json"));
43747
44228
  }
43748
44229
  function configLayerLabel() {
43749
44230
  return getConfigFileOverride() ? activeConfigPath() : "~/.claudish/config.json";
@@ -43823,9 +44304,9 @@ function formatProvenanceLog(p) {
43823
44304
  function readDotenvKey(envVars) {
43824
44305
  try {
43825
44306
  const dotenvPath = resolve2(".env");
43826
- if (!existsSync17(dotenvPath))
44307
+ if (!existsSync18(dotenvPath))
43827
44308
  return null;
43828
- const parsed = import_dotenv.parse(readFileSync16(dotenvPath, "utf-8"));
44309
+ const parsed = import_dotenv.parse(readFileSync17(dotenvPath, "utf-8"));
43829
44310
  for (const v of envVars) {
43830
44311
  if (parsed[v])
43831
44312
  return parsed[v];
@@ -43838,9 +44319,9 @@ function readDotenvKey(envVars) {
43838
44319
  function readConfigKey(envVar) {
43839
44320
  try {
43840
44321
  const configPath = activeConfigPath();
43841
- if (!existsSync17(configPath))
44322
+ if (!existsSync18(configPath))
43842
44323
  return null;
43843
- const cfg = JSON.parse(readFileSync16(configPath, "utf-8"));
44324
+ const cfg = JSON.parse(readFileSync17(configPath, "utf-8"));
43844
44325
  return cfg.apiKeys?.[envVar] || null;
43845
44326
  } catch {
43846
44327
  return null;
@@ -48354,9 +48835,9 @@ __export(exports_session_discovery, {
48354
48835
  transcriptPathFor: () => transcriptPathFor
48355
48836
  });
48356
48837
  import { execFile, execFileSync as execFileSync2 } from "child_process";
48357
- import { closeSync as closeSync5, openSync as openSync5, readSync, readdirSync as readdirSync3, realpathSync, statSync as statSync4 } from "fs";
48358
- import { homedir as homedir26 } from "os";
48359
- import { basename, join as join26 } from "path";
48838
+ import { closeSync as closeSync6, openSync as openSync6, readSync as readSync2, readdirSync as readdirSync4, realpathSync, statSync as statSync5 } from "fs";
48839
+ import { homedir as homedir27 } from "os";
48840
+ import { basename, join as join27 } from "path";
48360
48841
  function slugForPath(absPath) {
48361
48842
  return absPath.replace(/[/.]/g, "-");
48362
48843
  }
@@ -48365,7 +48846,7 @@ function transcriptPathFor(cwd, sessionUuid) {
48365
48846
  try {
48366
48847
  real = realpathSync(cwd);
48367
48848
  } catch {}
48368
- return join26(PROJECTS_DIR, slugForPath(real), `${sessionUuid}.jsonl`);
48849
+ return join27(PROJECTS_DIR, slugForPath(real), `${sessionUuid}.jsonl`);
48369
48850
  }
48370
48851
  function isAgentSession(row) {
48371
48852
  return row.entrypoint !== undefined && row.entrypoint !== "cli";
@@ -48406,24 +48887,24 @@ function getRepoContext(cwd = process.cwd()) {
48406
48887
  }
48407
48888
  function projectDirs() {
48408
48889
  try {
48409
- return readdirSync3(PROJECTS_DIR, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
48890
+ return readdirSync4(PROJECTS_DIR, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
48410
48891
  } catch {
48411
48892
  return [];
48412
48893
  }
48413
48894
  }
48414
48895
  function sessionsIn(dirName) {
48415
- const dir = join26(PROJECTS_DIR, dirName);
48896
+ const dir = join27(PROJECTS_DIR, dirName);
48416
48897
  let names;
48417
48898
  try {
48418
- names = readdirSync3(dir).filter((n) => n.endsWith(".jsonl"));
48899
+ names = readdirSync4(dir).filter((n) => n.endsWith(".jsonl"));
48419
48900
  } catch {
48420
48901
  return [];
48421
48902
  }
48422
48903
  const rows = [];
48423
48904
  for (const n of names) {
48424
- const file2 = join26(dir, n);
48905
+ const file2 = join27(dir, n);
48425
48906
  try {
48426
- const st = statSync4(file2);
48907
+ const st = statSync5(file2);
48427
48908
  if (st.size === 0)
48428
48909
  continue;
48429
48910
  const row = {
@@ -48583,7 +49064,7 @@ function discoverWorktreeGroups(repo) {
48583
49064
  g.activeNow = g.sessions.some((s) => isActive(s));
48584
49065
  if (g.path) {
48585
49066
  try {
48586
- g.createdMs = statSync4(g.path).birthtimeMs;
49067
+ g.createdMs = statSync5(g.path).birthtimeMs;
48587
49068
  } catch {}
48588
49069
  }
48589
49070
  if (!g.createdMs && g.sessions.length > 0) {
@@ -48601,16 +49082,16 @@ function readChunk(file2, pos, len) {
48601
49082
  return "";
48602
49083
  let fd = null;
48603
49084
  try {
48604
- fd = openSync5(file2, "r");
49085
+ fd = openSync6(file2, "r");
48605
49086
  const buf = Buffer.allocUnsafe(len);
48606
- const n = readSync(fd, buf, 0, len, pos);
49087
+ const n = readSync2(fd, buf, 0, len, pos);
48607
49088
  return buf.subarray(0, n).toString("utf-8");
48608
49089
  } catch {
48609
49090
  return "";
48610
49091
  } finally {
48611
49092
  if (fd !== null) {
48612
49093
  try {
48613
- closeSync5(fd);
49094
+ closeSync6(fd);
48614
49095
  } catch {}
48615
49096
  }
48616
49097
  }
@@ -48671,7 +49152,7 @@ function hydrateSession(row) {
48671
49152
  row.hydrated = true;
48672
49153
  if (isActive(row)) {
48673
49154
  try {
48674
- row.sizeBytes = statSync4(row.file).size;
49155
+ row.sizeBytes = statSync5(row.file).size;
48675
49156
  } catch {}
48676
49157
  }
48677
49158
  const head = parseRecords(readChunk(row.file, 0, Math.min(HEAD_BYTES, row.sizeBytes)), false);
@@ -48780,7 +49261,7 @@ function findLatestSessionId(cwd = process.cwd(), sinceMs = 0) {
48780
49261
  }
48781
49262
  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;
48782
49263
  var init_session_discovery = __esm(() => {
48783
- PROJECTS_DIR = join26(homedir26(), ".claude", "projects");
49264
+ PROJECTS_DIR = join27(homedir27(), ".claude", "projects");
48784
49265
  HEAD_BYTES = 64 * 1024;
48785
49266
  TAIL_BYTES = 128 * 1024;
48786
49267
  HARNESS_ENVELOPES = [
@@ -48805,19 +49286,19 @@ function resolveClaudishSpawn(env = process.env) {
48805
49286
  var CLAUDISH_BIN_ENV = "CLAUDISH_BIN";
48806
49287
 
48807
49288
  // src/team-stats.ts
48808
- import { existsSync as existsSync18, readFileSync as readFileSync17, writeFileSync as writeFileSync10 } from "fs";
48809
- import { join as join27 } from "path";
49289
+ import { existsSync as existsSync19, readFileSync as readFileSync18, writeFileSync as writeFileSync10 } from "fs";
49290
+ import { join as join28 } from "path";
48810
49291
  function statsDir(sessionPath) {
48811
- return join27(sessionPath, "stats");
49292
+ return join28(sessionPath, "stats");
48812
49293
  }
48813
49294
  function tokenFileFor(sessionPath, anonId) {
48814
- return join27(statsDir(sessionPath), `${anonId}.json`);
49295
+ return join28(statsDir(sessionPath), `${anonId}.json`);
48815
49296
  }
48816
49297
  function readTokenStatsAt(path) {
48817
- if (!existsSync18(path))
49298
+ if (!existsSync19(path))
48818
49299
  return null;
48819
49300
  try {
48820
- return JSON.parse(readFileSync17(path, "utf-8"));
49301
+ return JSON.parse(readFileSync18(path, "utf-8"));
48821
49302
  } catch {
48822
49303
  return null;
48823
49304
  }
@@ -48968,7 +49449,7 @@ ${segs.join(" \xB7 ")}`;
48968
49449
  }
48969
49450
  function writeStatusFile(sessionPath, manifest, status, opts) {
48970
49451
  try {
48971
- writeFileSync10(join27(sessionPath, "status.txt"), `${renderTeamStats(sessionPath, manifest, status, opts)}
49452
+ writeFileSync10(join28(sessionPath, "status.txt"), `${renderTeamStats(sessionPath, manifest, status, opts)}
48972
49453
  `, "utf-8");
48973
49454
  } catch {}
48974
49455
  }
@@ -49000,13 +49481,13 @@ __export(exports_team_orchestrator, {
49000
49481
  import { spawn as spawn2 } from "child_process";
49001
49482
  import {
49002
49483
  createWriteStream,
49003
- existsSync as existsSync19,
49484
+ existsSync as existsSync20,
49004
49485
  mkdirSync as mkdirSync11,
49005
- readFileSync as readFileSync18,
49006
- readdirSync as readdirSync4,
49486
+ readFileSync as readFileSync19,
49487
+ readdirSync as readdirSync5,
49007
49488
  writeFileSync as writeFileSync11
49008
49489
  } from "fs";
49009
- import { join as join28, resolve as resolve3 } from "path";
49490
+ import { join as join29, resolve as resolve3 } from "path";
49010
49491
  function resolveCaptureMode(explicit, env = process.env) {
49011
49492
  if (explicit)
49012
49493
  return explicit;
@@ -49095,14 +49576,14 @@ function setupSession(sessionPath, models, input) {
49095
49576
  if (models.length === 0) {
49096
49577
  throw new Error("At least one model is required");
49097
49578
  }
49098
- if (existsSync19(join28(sessionPath, "manifest.json"))) {
49579
+ if (existsSync20(join29(sessionPath, "manifest.json"))) {
49099
49580
  throw new Error(`Session already exists at ${sessionPath}. Use a new directory path or delete the existing session first.`);
49100
49581
  }
49101
- mkdirSync11(join28(sessionPath, "work"), { recursive: true });
49102
- mkdirSync11(join28(sessionPath, "errors"), { recursive: true });
49582
+ mkdirSync11(join29(sessionPath, "work"), { recursive: true });
49583
+ mkdirSync11(join29(sessionPath, "errors"), { recursive: true });
49103
49584
  if (input !== undefined) {
49104
- writeFileSync11(join28(sessionPath, "input.md"), input, "utf-8");
49105
- } else if (!existsSync19(join28(sessionPath, "input.md"))) {
49585
+ writeFileSync11(join29(sessionPath, "input.md"), input, "utf-8");
49586
+ } else if (!existsSync20(join29(sessionPath, "input.md"))) {
49106
49587
  throw new Error(`No input.md found at ${sessionPath} and no input provided`);
49107
49588
  }
49108
49589
  const ids = models.map((_, i) => String(i + 1).padStart(2, "0"));
@@ -49119,9 +49600,9 @@ function setupSession(sessionPath, models, input) {
49119
49600
  model: models[i],
49120
49601
  assignedAt: now2
49121
49602
  };
49122
- mkdirSync11(join28(sessionPath, "work", anonId), { recursive: true });
49603
+ mkdirSync11(join29(sessionPath, "work", anonId), { recursive: true });
49123
49604
  }
49124
- writeFileSync11(join28(sessionPath, "manifest.json"), JSON.stringify(manifest, null, 2), "utf-8");
49605
+ writeFileSync11(join29(sessionPath, "manifest.json"), JSON.stringify(manifest, null, 2), "utf-8");
49125
49606
  const status = {
49126
49607
  startedAt: now2,
49127
49608
  models: Object.fromEntries(Object.keys(manifest.models).map((id) => [
@@ -49135,7 +49616,7 @@ function setupSession(sessionPath, models, input) {
49135
49616
  }
49136
49617
  ]))
49137
49618
  };
49138
- writeFileSync11(join28(sessionPath, "status.json"), JSON.stringify(status, null, 2), "utf-8");
49619
+ writeFileSync11(join29(sessionPath, "status.json"), JSON.stringify(status, null, 2), "utf-8");
49139
49620
  return manifest;
49140
49621
  }
49141
49622
  function assertValidRequirePattern(pattern) {
@@ -49152,7 +49633,7 @@ function readFullOutputIfNeeded(opts) {
49152
49633
  if (crashed || !requirePattern || outputSize <= STDOUT_TAIL_LIMIT)
49153
49634
  return;
49154
49635
  try {
49155
- return readFileSync18(outputPath, "utf-8");
49636
+ return readFileSync19(outputPath, "utf-8");
49156
49637
  } catch {
49157
49638
  return;
49158
49639
  }
@@ -49160,12 +49641,12 @@ function readFullOutputIfNeeded(opts) {
49160
49641
  async function runModels(sessionPath, opts = {}) {
49161
49642
  const timeoutMs = (opts.timeout ?? 300) * 1000;
49162
49643
  assertValidRequirePattern(opts.requirePattern);
49163
- const manifest = JSON.parse(readFileSync18(join28(sessionPath, "manifest.json"), "utf-8"));
49164
- const statusPath = join28(sessionPath, "status.json");
49165
- const inputPath = join28(sessionPath, "input.md");
49166
- const inputContent = readFileSync18(inputPath, "utf-8");
49644
+ const manifest = JSON.parse(readFileSync19(join29(sessionPath, "manifest.json"), "utf-8"));
49645
+ const statusPath = join29(sessionPath, "status.json");
49646
+ const inputPath = join29(sessionPath, "input.md");
49647
+ const inputContent = readFileSync19(inputPath, "utf-8");
49167
49648
  const spawnPlan = await (opts.spawnPlanner ?? prehydrateCredentialsForSpawn)(Object.values(manifest.models).map((m) => m.model));
49168
- const statusCache = JSON.parse(readFileSync18(statusPath, "utf-8"));
49649
+ const statusCache = JSON.parse(readFileSync19(statusPath, "utf-8"));
49169
49650
  function updateModelStatus(id, update) {
49170
49651
  statusCache.models[id] = { ...statusCache.models[id], ...update };
49171
49652
  writeFileSync11(statusPath, JSON.stringify(statusCache, null, 2), "utf-8");
@@ -49213,8 +49694,8 @@ async function runModels(sessionPath, opts = {}) {
49213
49694
  process.on("SIGINT", sigintHandler);
49214
49695
  const completionPromises = [];
49215
49696
  for (const [anonId, entry] of Object.entries(manifest.models)) {
49216
- const outputPath = join28(sessionPath, `response-${anonId}.md`);
49217
- const errorLogPath = join28(sessionPath, "errors", `${anonId}.log`);
49697
+ const outputPath = join29(sessionPath, `response-${anonId}.md`);
49698
+ const errorLogPath = join29(sessionPath, "errors", `${anonId}.log`);
49218
49699
  const spawnModel = spawnPlan.pinned.get(entry.model) ?? entry.model;
49219
49700
  const args = [
49220
49701
  "--model",
@@ -49440,7 +49921,7 @@ async function runModels(sessionPath, opts = {}) {
49440
49921
  opts.onStatusChange?.(id, statusCache.models[id]);
49441
49922
  const stopped = await terminateChildTree(proc);
49442
49923
  if (!stopped) {
49443
- persistErrorLog(rt?.errorLogPath ?? join28(sessionPath, "errors", `${id}.log`), "TIMEOUT: child survived SIGKILL \u2014 it may still be running and billing", stderr, stdoutTail);
49924
+ persistErrorLog(rt?.errorLogPath ?? join29(sessionPath, "errors", `${id}.log`), "TIMEOUT: child survived SIGKILL \u2014 it may still be running and billing", stderr, stdoutTail);
49444
49925
  }
49445
49926
  };
49446
49927
  const allDone = Promise.all(completionPromises);
@@ -49492,30 +49973,30 @@ async function runModels(sessionPath, opts = {}) {
49492
49973
  return statusCache;
49493
49974
  }
49494
49975
  async function judgeResponses(sessionPath, opts = {}) {
49495
- const responseFiles = readdirSync4(sessionPath).filter((f) => f.startsWith("response-") && f.endsWith(".md")).sort();
49976
+ const responseFiles = readdirSync5(sessionPath).filter((f) => f.startsWith("response-") && f.endsWith(".md")).sort();
49496
49977
  if (responseFiles.length < 2) {
49497
49978
  throw new Error(`Need at least 2 responses to judge, found ${responseFiles.length}`);
49498
49979
  }
49499
49980
  const responses = {};
49500
49981
  for (const file2 of responseFiles) {
49501
49982
  const id = file2.replace(/^response-/, "").replace(/\.md$/, "");
49502
- responses[id] = readFileSync18(join28(sessionPath, file2), "utf-8");
49983
+ responses[id] = readFileSync19(join29(sessionPath, file2), "utf-8");
49503
49984
  }
49504
- const input = readFileSync18(join28(sessionPath, "input.md"), "utf-8");
49985
+ const input = readFileSync19(join29(sessionPath, "input.md"), "utf-8");
49505
49986
  const judgePrompt = buildJudgePrompt(input, responses);
49506
- writeFileSync11(join28(sessionPath, "judge-prompt.md"), judgePrompt, "utf-8");
49987
+ writeFileSync11(join29(sessionPath, "judge-prompt.md"), judgePrompt, "utf-8");
49507
49988
  const judgeModels = opts.judges ?? getDefaultJudgeModels(sessionPath);
49508
- const judgePath = join28(sessionPath, "judging");
49989
+ const judgePath = join29(sessionPath, "judging");
49509
49990
  mkdirSync11(judgePath, { recursive: true });
49510
49991
  setupSession(judgePath, judgeModels, judgePrompt);
49511
49992
  await runModels(judgePath, { claudeFlags: opts.claudeFlags });
49512
49993
  const votes = parseJudgeVotes(judgePath, Object.keys(responses));
49513
49994
  const verdict = aggregateVerdict(votes, Object.keys(responses));
49514
- writeFileSync11(join28(sessionPath, "verdict.md"), formatVerdict(verdict, sessionPath), "utf-8");
49995
+ writeFileSync11(join29(sessionPath, "verdict.md"), formatVerdict(verdict, sessionPath), "utf-8");
49515
49996
  return verdict;
49516
49997
  }
49517
49998
  function getStatus(sessionPath) {
49518
- return JSON.parse(readFileSync18(join28(sessionPath, "status.json"), "utf-8"));
49999
+ return JSON.parse(readFileSync19(join29(sessionPath, "status.json"), "utf-8"));
49519
50000
  }
49520
50001
  function fisherYatesShuffle(arr) {
49521
50002
  for (let i = arr.length - 1;i > 0; i--) {
@@ -49525,7 +50006,7 @@ function fisherYatesShuffle(arr) {
49525
50006
  return arr;
49526
50007
  }
49527
50008
  function getDefaultJudgeModels(sessionPath) {
49528
- const manifest = JSON.parse(readFileSync18(join28(sessionPath, "manifest.json"), "utf-8"));
50009
+ const manifest = JSON.parse(readFileSync19(join29(sessionPath, "manifest.json"), "utf-8"));
49529
50010
  return Object.values(manifest.models).map((e) => e.model);
49530
50011
  }
49531
50012
  function buildJudgePrompt(input, responses) {
@@ -49583,12 +50064,12 @@ function buildJudgePrompt(input, responses) {
49583
50064
  }
49584
50065
  function parseJudgeVotes(judgePath, responseIds) {
49585
50066
  const votes = [];
49586
- const responseFiles = readdirSync4(judgePath).filter((f) => f.startsWith("response-") && f.endsWith(".md")).sort();
50067
+ const responseFiles = readdirSync5(judgePath).filter((f) => f.startsWith("response-") && f.endsWith(".md")).sort();
49587
50068
  for (const file2 of responseFiles) {
49588
50069
  const judgeId = file2.replace(/^response-/, "").replace(/\.md$/, "");
49589
50070
  let content;
49590
50071
  try {
49591
- content = readFileSync18(join28(judgePath, file2), "utf-8");
50072
+ content = readFileSync19(join29(judgePath, file2), "utf-8");
49592
50073
  } catch {
49593
50074
  continue;
49594
50075
  }
@@ -49640,7 +50121,7 @@ function aggregateVerdict(votes, responseIds) {
49640
50121
  function formatVerdict(verdict, sessionPath) {
49641
50122
  let manifest = null;
49642
50123
  try {
49643
- manifest = JSON.parse(readFileSync18(join28(sessionPath, "manifest.json"), "utf-8"));
50124
+ manifest = JSON.parse(readFileSync19(join29(sessionPath, "manifest.json"), "utf-8"));
49644
50125
  } catch {}
49645
50126
  let output = `# Team Verdict
49646
50127
 
@@ -49691,17 +50172,17 @@ import { spawn as spawn3 } from "child_process";
49691
50172
  import { randomUUID as randomUUID4 } from "crypto";
49692
50173
  import {
49693
50174
  appendFileSync as appendFileSync6,
49694
- closeSync as closeSync6,
50175
+ closeSync as closeSync7,
49695
50176
  createWriteStream as createWriteStream2,
49696
50177
  mkdirSync as mkdirSync12,
49697
- openSync as openSync6,
49698
- readFileSync as readFileSync19,
49699
- readSync as readSync2,
49700
- statSync as statSync5,
50178
+ openSync as openSync7,
50179
+ readFileSync as readFileSync20,
50180
+ readSync as readSync3,
50181
+ statSync as statSync6,
49701
50182
  writeFileSync as writeFileSync12
49702
50183
  } from "fs";
49703
- import { homedir as homedir27 } from "os";
49704
- import { join as join29, resolve as resolve4, sep } from "path";
50184
+ import { homedir as homedir28 } from "os";
50185
+ import { join as join30, resolve as resolve4, sep } from "path";
49705
50186
  import { StringDecoder } from "string_decoder";
49706
50187
  function buildChannelSpawnArgs(opts) {
49707
50188
  return [
@@ -49739,21 +50220,21 @@ function decodeChunk(decoder, chunk) {
49739
50220
  function readTailText(path, maxBytes) {
49740
50221
  let fd = null;
49741
50222
  try {
49742
- const size = statSync5(path).size;
50223
+ const size = statSync6(path).size;
49743
50224
  if (size === 0)
49744
50225
  return { text: "", truncated: false };
49745
50226
  const start = Math.max(0, size - maxBytes);
49746
50227
  const length = size - start;
49747
50228
  const buf = Buffer.alloc(length);
49748
- fd = openSync6(path, "r");
49749
- readSync2(fd, buf, 0, length, start);
50229
+ fd = openSync7(path, "r");
50230
+ readSync3(fd, buf, 0, length, start);
49750
50231
  return { text: buf.toString("utf-8"), truncated: start > 0 };
49751
50232
  } catch {
49752
50233
  return null;
49753
50234
  } finally {
49754
50235
  if (fd !== null) {
49755
50236
  try {
49756
- closeSync6(fd);
50237
+ closeSync7(fd);
49757
50238
  } catch {}
49758
50239
  }
49759
50240
  }
@@ -49770,7 +50251,7 @@ function readTailLines(path, maxBytes) {
49770
50251
  }
49771
50252
  function fileSize(path) {
49772
50253
  try {
49773
- return statSync5(path).size;
50254
+ return statSync6(path).size;
49774
50255
  } catch {
49775
50256
  return 0;
49776
50257
  }
@@ -49779,7 +50260,7 @@ function readJsonObject(path, maxBytes) {
49779
50260
  try {
49780
50261
  if (fileSize(path) > maxBytes)
49781
50262
  return null;
49782
- const parsed = JSON.parse(readFileSync19(path, "utf-8"));
50263
+ const parsed = JSON.parse(readFileSync20(path, "utf-8"));
49783
50264
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
49784
50265
  return null;
49785
50266
  return parsed;
@@ -49795,7 +50276,7 @@ function dropLeadingFragment(tail) {
49795
50276
  return firstBreak === -1 ? tail.text : tail.text.slice(firstBreak + 1);
49796
50277
  }
49797
50278
  function diskAccounting(sessionDir) {
49798
- const stats = readTokenStatsAt(join29(sessionDir, "tokens.json"));
50279
+ const stats = readTokenStatsAt(join30(sessionDir, "tokens.json"));
49799
50280
  return {
49800
50281
  tokensUsed: (stats?.total_tokens ?? 0) || (stats?.input_tokens ?? 0) + (stats?.output_tokens ?? 0),
49801
50282
  costUsd: stats?.total_cost ?? 0,
@@ -49835,7 +50316,7 @@ class SessionManager {
49835
50316
  this.maxSessions = options?.maxSessions ?? DEFAULT_MAX_SESSIONS;
49836
50317
  this.scrollbackCapacity = options?.scrollbackCapacity ?? DEFAULT_SCROLLBACK;
49837
50318
  this.terminalRetentionMs = options?.terminalRetentionMs ?? TERMINAL_RETENTION_MS;
49838
- this.sessionsDir = options?.sessionsDir ?? process.env.CLAUDISH_SESSIONS_DIR ?? join29(homedir27(), ".claudish", "sessions");
50319
+ this.sessionsDir = options?.sessionsDir ?? process.env.CLAUDISH_SESSIONS_DIR ?? join30(homedir28(), ".claudish", "sessions");
49839
50320
  this.stallSeconds = options?.stallSeconds;
49840
50321
  this.onStateChange = options?.onStateChange;
49841
50322
  }
@@ -49848,19 +50329,19 @@ class SessionManager {
49848
50329
  const claudeSessionId = randomUUID4();
49849
50330
  const timeout = Math.min(opts.timeoutSeconds ?? DEFAULT_TIMEOUT, MAX_TIMEOUT);
49850
50331
  const startedAt = new Date().toISOString();
49851
- const sessionDir = join29(this.sessionsDir, sessionId2);
50332
+ const sessionDir = join30(this.sessionsDir, sessionId2);
49852
50333
  mkdirSync12(sessionDir, { recursive: true });
49853
50334
  if (opts.prompt) {
49854
- writeFileSync12(join29(sessionDir, "prompt.md"), opts.prompt, "utf-8");
50335
+ writeFileSync12(join30(sessionDir, "prompt.md"), opts.prompt, "utf-8");
49855
50336
  }
49856
50337
  const args = buildChannelSpawnArgs({
49857
50338
  model: opts.spawnModel ?? opts.model,
49858
50339
  claudeSessionId,
49859
50340
  claudishFlags: opts.claudishFlags
49860
50341
  });
49861
- const tokenFile = join29(sessionDir, "tokens.json");
49862
- const eventLogPath = join29(sessionDir, "events.jsonl");
49863
- const upstreamErrorLogPath = join29(sessionDir, "upstream-errors.jsonl");
50342
+ const tokenFile = join30(sessionDir, "tokens.json");
50343
+ const eventLogPath = join30(sessionDir, "events.jsonl");
50344
+ const upstreamErrorLogPath = join30(sessionDir, "upstream-errors.jsonl");
49864
50345
  const cwd = opts.cwd ?? process.cwd();
49865
50346
  const spawnTarget = resolveClaudishSpawn();
49866
50347
  const proc = spawn3(spawnTarget.command, [...spawnTarget.prefixArgs, ...args], {
@@ -49875,7 +50356,7 @@ class SessionManager {
49875
50356
  }
49876
50357
  });
49877
50358
  const scrollback = new ScrollbackBuffer(this.scrollbackCapacity);
49878
- const outputLogStream = createWriteStream2(join29(sessionDir, "output.log"));
50359
+ const outputLogStream = createWriteStream2(join30(sessionDir, "output.log"));
49879
50360
  const entry = {
49880
50361
  info: {
49881
50362
  sessionId: sessionId2,
@@ -50159,7 +50640,7 @@ class SessionManager {
50159
50640
  return null;
50160
50641
  const root = resolve4(this.sessionsDir);
50161
50642
  const dir = resolve4(root, sessionId2);
50162
- if (dir !== join29(root, sessionId2))
50643
+ if (dir !== join30(root, sessionId2))
50163
50644
  return null;
50164
50645
  if (!dir.startsWith(root + sep))
50165
50646
  return null;
@@ -50171,14 +50652,14 @@ class SessionManager {
50171
50652
  return null;
50172
50653
  let dirMtimeMs;
50173
50654
  try {
50174
- const stat2 = statSync5(sessionDir);
50655
+ const stat2 = statSync6(sessionDir);
50175
50656
  if (!stat2.isDirectory())
50176
50657
  return null;
50177
50658
  dirMtimeMs = stat2.mtimeMs;
50178
50659
  } catch {
50179
50660
  return null;
50180
50661
  }
50181
- const meta3 = readJsonObject(join29(sessionDir, "meta.json"), META_READ_LIMIT);
50662
+ const meta3 = readJsonObject(join30(sessionDir, "meta.json"), META_READ_LIMIT);
50182
50663
  const partial2 = meta3 === null;
50183
50664
  const measured = diskAccounting(sessionDir);
50184
50665
  const startedAt = metaString(meta3?.startedAt) ?? new Date(dirMtimeMs).toISOString();
@@ -50207,7 +50688,7 @@ class SessionManager {
50207
50688
  };
50208
50689
  }
50209
50690
  diskOutput(record4, tailLines) {
50210
- const tail = readTailText(join29(record4.sessionDir, "output.log"), OUTPUT_TAIL_BYTES);
50691
+ const tail = readTailText(join30(record4.sessionDir, "output.log"), OUTPUT_TAIL_BYTES);
50211
50692
  const buffer = new ScrollbackBuffer(this.scrollbackCapacity);
50212
50693
  if (tail?.text)
50213
50694
  buffer.append(dropLeadingFragment(tail));
@@ -50225,9 +50706,9 @@ class SessionManager {
50225
50706
  }
50226
50707
  diskDiagnostics(record4, limit) {
50227
50708
  const { sessionDir, info } = record4;
50228
- const eventLogPath = join29(sessionDir, "events.jsonl");
50229
- const upstreamErrorLogPath = join29(sessionDir, "upstream-errors.jsonl");
50230
- const outputLogPath = join29(sessionDir, "output.log");
50709
+ const eventLogPath = join30(sessionDir, "events.jsonl");
50710
+ const upstreamErrorLogPath = join30(sessionDir, "upstream-errors.jsonl");
50711
+ const outputLogPath = join30(sessionDir, "output.log");
50231
50712
  const events = readTailLines(eventLogPath, EVENT_TAIL_BYTES);
50232
50713
  const outputTail = readTailText(outputLogPath, OUTPUT_TAIL_BYTES);
50233
50714
  return {
@@ -50268,7 +50749,7 @@ class SessionManager {
50268
50749
  };
50269
50750
  }
50270
50751
  diskStderrForDiagnostics(record4) {
50271
- const tail = readTailText(join29(record4.sessionDir, "stderr.log"), STDERR_READ_BYTES);
50752
+ const tail = readTailText(join30(record4.sessionDir, "stderr.log"), STDERR_READ_BYTES);
50272
50753
  const raw = tail?.text ?? "";
50273
50754
  const filtered = record4.info.status === "completed";
50274
50755
  const source = filtered ? meaningfulStderr(raw) : raw;
@@ -50443,11 +50924,11 @@ ${STDERR_TRUNCATION_MARKER} ${STDERR_SIDE_LIMIT} bytes per end \u2026
50443
50924
  entry.outputLogStream?.end();
50444
50925
  entry.outputLogStream = null;
50445
50926
  if (entry.stderr) {
50446
- writeFileSync12(join29(entry.sessionDir, "stderr.log"), redactSecrets(entry.stderr), "utf-8");
50927
+ writeFileSync12(join30(entry.sessionDir, "stderr.log"), redactSecrets(entry.stderr), "utf-8");
50447
50928
  }
50448
50929
  this.refreshAccounting(entry);
50449
50930
  entry.info.claudeSessionId = entry.reducer.claudeSessionId ?? entry.info.claudeSessionId;
50450
- writeFileSync12(join29(entry.sessionDir, "meta.json"), JSON.stringify(entry.info, null, 2), "utf-8");
50931
+ writeFileSync12(join30(entry.sessionDir, "meta.json"), JSON.stringify(entry.info, null, 2), "utf-8");
50451
50932
  }
50452
50933
  scheduleEviction(entry) {
50453
50934
  if (entry.evictHandle)
@@ -50507,7 +50988,7 @@ ${STDERR_TRUNCATION_MARKER} ${STDERR_SIDE_LIMIT} bytes per end \u2026
50507
50988
  return { state: "completed", content: "" };
50508
50989
  }
50509
50990
  refreshAccounting(entry) {
50510
- const stats = readTokenStatsAt(join29(entry.sessionDir, "tokens.json"));
50991
+ const stats = readTokenStatsAt(join30(entry.sessionDir, "tokens.json"));
50511
50992
  const fileTokens = (stats?.total_tokens ?? 0) || (stats?.input_tokens ?? 0) + (stats?.output_tokens ?? 0);
50512
50993
  entry.info.tokensUsed = fileTokens || entry.reducer.tokens;
50513
50994
  entry.info.costUsd = stats?.total_cost ?? 0;
@@ -50766,9 +51247,9 @@ function compareByReleaseDateDesc(a, b) {
50766
51247
  }
50767
51248
 
50768
51249
  // src/model-loader.ts
50769
- import { existsSync as existsSync20, mkdirSync as mkdirSync13, readFileSync as readFileSync20, writeFileSync as writeFileSync13 } from "fs";
50770
- import { homedir as homedir28 } from "os";
50771
- import { join as join30 } from "path";
51250
+ import { existsSync as existsSync21, mkdirSync as mkdirSync13, readFileSync as readFileSync21, writeFileSync as writeFileSync13 } from "fs";
51251
+ import { homedir as homedir29 } from "os";
51252
+ import { join as join31 } from "path";
50772
51253
  function groupRecommendedModels(entries) {
50773
51254
  const byId = new Map;
50774
51255
  const categoryOrder = new Map;
@@ -50887,9 +51368,9 @@ async function getRecommendedModels(opts = {}) {
50887
51368
  if (!forceRefresh && _cachedRecommendedModels) {
50888
51369
  return _cachedRecommendedModels;
50889
51370
  }
50890
- if (!forceRefresh && existsSync20(RECOMMENDED_MODELS_CACHE_PATH)) {
51371
+ if (!forceRefresh && existsSync21(RECOMMENDED_MODELS_CACHE_PATH)) {
50891
51372
  try {
50892
- const cacheData = JSON.parse(readFileSync20(RECOMMENDED_MODELS_CACHE_PATH, "utf-8"));
51373
+ const cacheData = JSON.parse(readFileSync21(RECOMMENDED_MODELS_CACHE_PATH, "utf-8"));
50893
51374
  if (cacheData.models && cacheData.models.length > 0 && isFreshEnough(cacheData)) {
50894
51375
  _cachedRecommendedModels = cacheData;
50895
51376
  return cacheData;
@@ -50905,7 +51386,7 @@ async function getRecommendedModels(opts = {}) {
50905
51386
  if (data.models && data.models.length > 0) {
50906
51387
  _cachedRecommendedModels = data;
50907
51388
  try {
50908
- const cacheDir = join30(homedir28(), ".claudish");
51389
+ const cacheDir = join31(homedir29(), ".claudish");
50909
51390
  mkdirSync13(cacheDir, { recursive: true });
50910
51391
  writeFileSync13(RECOMMENDED_MODELS_CACHE_PATH, JSON.stringify(data), "utf-8");
50911
51392
  } catch {}
@@ -50918,9 +51399,9 @@ async function getRecommendedModels(opts = {}) {
50918
51399
  function getRecommendedModelsSync() {
50919
51400
  if (_cachedRecommendedModels)
50920
51401
  return _cachedRecommendedModels;
50921
- if (existsSync20(RECOMMENDED_MODELS_CACHE_PATH)) {
51402
+ if (existsSync21(RECOMMENDED_MODELS_CACHE_PATH)) {
50922
51403
  try {
50923
- const cacheData = JSON.parse(readFileSync20(RECOMMENDED_MODELS_CACHE_PATH, "utf-8"));
51404
+ const cacheData = JSON.parse(readFileSync21(RECOMMENDED_MODELS_CACHE_PATH, "utf-8"));
50924
51405
  if (cacheData.models && cacheData.models.length > 0 && isFreshEnough(cacheData)) {
50925
51406
  _cachedRecommendedModels = cacheData;
50926
51407
  return cacheData;
@@ -51044,7 +51525,7 @@ var _cachedModelInfo = null, _cachedModelIds = null, _cachedRecommendedModels =
51044
51525
  var init_model_loader = __esm(() => {
51045
51526
  init_cache_ttl();
51046
51527
  FIREBASE_RECOMMENDED_URL = `${FIREBASE_BASE_URL}?catalog=recommended`;
51047
- RECOMMENDED_MODELS_CACHE_PATH = join30(homedir28(), ".claudish", "recommended-models-cache.json");
51528
+ RECOMMENDED_MODELS_CACHE_PATH = join31(homedir29(), ".claudish", "recommended-models-cache.json");
51048
51529
  FIREBASE_SLUG_TO_PROVIDER_NAME = {
51049
51530
  openai: "openai",
51050
51531
  google: "google",
@@ -54945,9 +55426,9 @@ var init_poe = __esm(() => {
54945
55426
  });
54946
55427
 
54947
55428
  // src/services/pricing-cache.ts
54948
- import { existsSync as existsSync21, readFileSync as readFileSync21, statSync as statSync6 } from "fs";
54949
- import { homedir as homedir29 } from "os";
54950
- import { join as join31 } from "path";
55429
+ import { existsSync as existsSync22, readFileSync as readFileSync22, statSync as statSync7 } from "fs";
55430
+ import { homedir as homedir30 } from "os";
55431
+ import { join as join32 } from "path";
54951
55432
  function prefixMatch(modelName) {
54952
55433
  for (const [key, pricing] of pricingMap) {
54953
55434
  if (modelName.startsWith(key))
@@ -54985,12 +55466,12 @@ async function warmPricingCache() {
54985
55466
  }
54986
55467
  function loadDiskCache() {
54987
55468
  try {
54988
- if (!existsSync21(CACHE_FILE))
55469
+ if (!existsSync22(CACHE_FILE))
54989
55470
  return false;
54990
- const stat2 = statSync6(CACHE_FILE);
55471
+ const stat2 = statSync7(CACHE_FILE);
54991
55472
  const age = Date.now() - stat2.mtimeMs;
54992
55473
  const isFresh = age < CACHE_TTL_MS3;
54993
- const raw2 = readFileSync21(CACHE_FILE, "utf-8");
55474
+ const raw2 = readFileSync22(CACHE_FILE, "utf-8");
54994
55475
  const data = JSON.parse(raw2);
54995
55476
  for (const [key, pricing] of Object.entries(data)) {
54996
55477
  pricingMap.set(key, pricing);
@@ -55006,8 +55487,8 @@ var init_pricing_cache = __esm(() => {
55006
55487
  init_logger();
55007
55488
  init_catalog_query();
55008
55489
  pricingMap = new Map;
55009
- CACHE_DIR = join31(homedir29(), ".claudish");
55010
- CACHE_FILE = join31(CACHE_DIR, "pricing-cache.json");
55490
+ CACHE_DIR = join32(homedir30(), ".claudish");
55491
+ CACHE_FILE = join32(CACHE_DIR, "pricing-cache.json");
55011
55492
  CACHE_TTL_MS3 = 24 * 60 * 60 * 1000;
55012
55493
  });
55013
55494
 
@@ -55017,12 +55498,12 @@ __export(exports_proxy_server, {
55017
55498
  createProxyServer: () => createProxyServer
55018
55499
  });
55019
55500
  import { appendFileSync as appendFileSync8, mkdirSync as mkdirSync14 } from "fs";
55020
- import { join as join32 } from "path";
55501
+ import { join as join33 } from "path";
55021
55502
  function maybeCaptureClassifierRequest(c, body) {
55022
55503
  if (!process.env.CLAUDISH_CLASSIFIER_DEBUG)
55023
55504
  return;
55024
55505
  try {
55025
- const dir = join32(process.cwd(), "logs");
55506
+ const dir = join33(process.cwd(), "logs");
55026
55507
  if (!classifierCaptureDirReady) {
55027
55508
  mkdirSync14(dir, { recursive: true });
55028
55509
  classifierCaptureDirReady = true;
@@ -55047,7 +55528,7 @@ function maybeCaptureClassifierRequest(c, body) {
55047
55528
  "x-api-key": c.req.header("x-api-key") ? "<present>" : null
55048
55529
  }
55049
55530
  };
55050
- appendFileSync8(join32(dir, "classifier-capture.jsonl"), `${JSON.stringify(record4)}
55531
+ appendFileSync8(join33(dir, "classifier-capture.jsonl"), `${JSON.stringify(record4)}
55051
55532
  `);
55052
55533
  } catch {}
55053
55534
  }
@@ -55070,6 +55551,11 @@ async function createProxyServer(port, _openrouterApiKey, model, monitorMode = f
55070
55551
  log(`[Proxy] behavior hooks load skipped: ${err instanceof Error ? err.message : String(err)}`);
55071
55552
  }
55072
55553
  const nativeHandler = new NativeHandler(anthropicApiKey, options.advisorModels, options.advisorCollector);
55554
+ const requestShapingOpts = {
55555
+ effortOverride: isEffortLevel(options.effortOverride) ? options.effortOverride : undefined,
55556
+ modelParams: options.modelParams,
55557
+ proOnUltracode: options.proOnUltracode
55558
+ };
55073
55559
  const openRouterHandlers = new Map;
55074
55560
  const localProviderHandlers = new Map;
55075
55561
  const remoteProviderHandlers = new Map;
@@ -55083,7 +55569,8 @@ async function createProxyServer(port, _openrouterApiKey, model, monitorMode = f
55083
55569
  openRouterHandlers.set(modelId, new ComposedHandler(orProvider, modelId, modelId, port, {
55084
55570
  adapter: orAdapter,
55085
55571
  isInteractive: options.isInteractive,
55086
- invocationMode
55572
+ invocationMode,
55573
+ ...requestShapingOpts
55087
55574
  }));
55088
55575
  }
55089
55576
  return openRouterHandlers.get(modelId);
@@ -55098,7 +55585,8 @@ async function createProxyServer(port, _openrouterApiKey, model, monitorMode = f
55098
55585
  const poeTransport = new PoeProvider;
55099
55586
  poeHandlers.set(modelId, new ComposedHandler(poeTransport, modelId, modelId, port, {
55100
55587
  isInteractive: options.isInteractive,
55101
- invocationMode
55588
+ invocationMode,
55589
+ ...requestShapingOpts
55102
55590
  }));
55103
55591
  }
55104
55592
  return poeHandlers.get(modelId);
@@ -55121,7 +55609,8 @@ async function createProxyServer(port, _openrouterApiKey, model, monitorMode = f
55121
55609
  tokenStrategy: "local",
55122
55610
  summarizeTools: options.summarizeTools,
55123
55611
  isInteractive: options.isInteractive,
55124
- invocationMode
55612
+ invocationMode,
55613
+ ...requestShapingOpts
55125
55614
  });
55126
55615
  localProviderHandlers.set(targetModel, handler);
55127
55616
  log(`[Proxy] Created local provider handler: ${resolved.provider.name}/${resolved.modelName}${resolved.concurrency !== undefined ? ` (concurrency: ${resolved.concurrency})` : ""}`);
@@ -55137,7 +55626,8 @@ async function createProxyServer(port, _openrouterApiKey, model, monitorMode = f
55137
55626
  tokenStrategy: "local",
55138
55627
  summarizeTools: options.summarizeTools,
55139
55628
  isInteractive: options.isInteractive,
55140
- invocationMode
55629
+ invocationMode,
55630
+ ...requestShapingOpts
55141
55631
  });
55142
55632
  localProviderHandlers.set(targetModel, handler);
55143
55633
  log(`[Proxy] Created URL-based local provider handler: ${urlParsed.baseUrl}/${urlParsed.modelName}`);
@@ -55192,7 +55682,7 @@ async function createProxyServer(port, _openrouterApiKey, model, monitorMode = f
55192
55682
  apiKey,
55193
55683
  targetModel,
55194
55684
  port,
55195
- sharedOpts: { isInteractive: options.isInteractive, invocationMode }
55685
+ sharedOpts: { isInteractive: options.isInteractive, invocationMode, ...requestShapingOpts }
55196
55686
  });
55197
55687
  if (!handler) {
55198
55688
  return null;
@@ -55515,6 +56005,7 @@ var RoutingError, classifierCaptureDirReady = false;
55515
56005
  var init_proxy_server = __esm(() => {
55516
56006
  init_dist();
55517
56007
  init_cors();
56008
+ init_base_api_format();
55518
56009
  init_local_adapter();
55519
56010
  init_openrouter_api_format();
55520
56011
  init_authority();
@@ -55560,14 +56051,14 @@ __export(exports_mcp_server, {
55560
56051
  runPromptViaProxy: () => runPromptViaProxy,
55561
56052
  startMcpServer: () => startMcpServer
55562
56053
  });
55563
- import { existsSync as existsSync22, mkdirSync as mkdirSync15, readFileSync as readFileSync22, readdirSync as readdirSync5, writeFileSync as writeFileSync14 } from "fs";
55564
- import { homedir as homedir30 } from "os";
55565
- import { dirname as dirname9, join as join33, resolve as resolve5 } from "path";
56054
+ import { existsSync as existsSync23, mkdirSync as mkdirSync15, readFileSync as readFileSync23, readdirSync as readdirSync6, writeFileSync as writeFileSync14 } from "fs";
56055
+ import { homedir as homedir31 } from "os";
56056
+ import { dirname as dirname9, join as join34, resolve as resolve5 } from "path";
55566
56057
  import { fileURLToPath } from "url";
55567
56058
  async function loadAllModels(forceRefresh = false) {
55568
- if (!forceRefresh && existsSync22(ALL_MODELS_CACHE_PATH2)) {
56059
+ if (!forceRefresh && existsSync23(ALL_MODELS_CACHE_PATH2)) {
55569
56060
  try {
55570
- const cacheData = JSON.parse(readFileSync22(ALL_MODELS_CACHE_PATH2, "utf-8"));
56061
+ const cacheData = JSON.parse(readFileSync23(ALL_MODELS_CACHE_PATH2, "utf-8"));
55571
56062
  const lastUpdated = new Date(cacheData.lastUpdated);
55572
56063
  const ageInDays = (Date.now() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
55573
56064
  if (ageInDays <= CACHE_MAX_AGE_DAYS) {
@@ -55585,8 +56076,8 @@ async function loadAllModels(forceRefresh = false) {
55585
56076
  writeFileSync14(ALL_MODELS_CACHE_PATH2, JSON.stringify({ lastUpdated: new Date().toISOString(), models }), "utf-8");
55586
56077
  return models;
55587
56078
  } catch {
55588
- if (existsSync22(ALL_MODELS_CACHE_PATH2)) {
55589
- const cacheData = JSON.parse(readFileSync22(ALL_MODELS_CACHE_PATH2, "utf-8"));
56079
+ if (existsSync23(ALL_MODELS_CACHE_PATH2)) {
56080
+ const cacheData = JSON.parse(readFileSync23(ALL_MODELS_CACHE_PATH2, "utf-8"));
55590
56081
  return cacheData.models || [];
55591
56082
  }
55592
56083
  return [];
@@ -56324,7 +56815,7 @@ Use with: run_prompt(model="${results[0].model.id}", prompt="your prompt")`;
56324
56815
  let stderrFull = stderr_snippet || "";
56325
56816
  if (error_log_path) {
56326
56817
  try {
56327
- stderrFull = readFileSync22(error_log_path, "utf-8");
56818
+ stderrFull = readFileSync23(error_log_path, "utf-8");
56328
56819
  } catch {}
56329
56820
  }
56330
56821
  const sessionData = {};
@@ -56332,26 +56823,26 @@ Use with: run_prompt(model="${results[0].model.id}", prompt="your prompt")`;
56332
56823
  const sp = session_path;
56333
56824
  for (const file2 of ["status.json", "manifest.json", "input.md"]) {
56334
56825
  try {
56335
- sessionData[file2] = readFileSync22(join33(sp, file2), "utf-8");
56826
+ sessionData[file2] = readFileSync23(join34(sp, file2), "utf-8");
56336
56827
  } catch {}
56337
56828
  }
56338
56829
  try {
56339
- const errorDir = join33(sp, "errors");
56340
- if (existsSync22(errorDir)) {
56341
- for (const f of readdirSync5(errorDir)) {
56830
+ const errorDir = join34(sp, "errors");
56831
+ if (existsSync23(errorDir)) {
56832
+ for (const f of readdirSync6(errorDir)) {
56342
56833
  if (f.endsWith(".log")) {
56343
56834
  try {
56344
- sessionData[`errors/${f}`] = readFileSync22(join33(errorDir, f), "utf-8");
56835
+ sessionData[`errors/${f}`] = readFileSync23(join34(errorDir, f), "utf-8");
56345
56836
  } catch {}
56346
56837
  }
56347
56838
  }
56348
56839
  }
56349
56840
  } catch {}
56350
56841
  try {
56351
- for (const f of readdirSync5(sp)) {
56842
+ for (const f of readdirSync6(sp)) {
56352
56843
  if (f.startsWith("response-") && f.endsWith(".md")) {
56353
56844
  try {
56354
- const content = readFileSync22(join33(sp, f), "utf-8");
56845
+ const content = readFileSync23(join34(sp, f), "utf-8");
56355
56846
  sessionData[f] = content.slice(0, 200) + (content.length > 200 ? "... (truncated)" : "");
56356
56847
  } catch {}
56357
56848
  }
@@ -56360,9 +56851,9 @@ Use with: run_prompt(model="${results[0].model.id}", prompt="your prompt")`;
56360
56851
  }
56361
56852
  let version2 = "unknown";
56362
56853
  try {
56363
- const pkgPath = join33(__dirname2, "../package.json");
56364
- if (existsSync22(pkgPath)) {
56365
- version2 = JSON.parse(readFileSync22(pkgPath, "utf-8")).version;
56854
+ const pkgPath = join34(__dirname2, "../package.json");
56855
+ if (existsSync23(pkgPath)) {
56856
+ version2 = JSON.parse(readFileSync23(pkgPath, "utf-8")).version;
56366
56857
  }
56367
56858
  } catch {}
56368
56859
  const report = {
@@ -56827,8 +57318,8 @@ var init_mcp_server = __esm(() => {
56827
57318
  import_dotenv2.config({ quiet: true });
56828
57319
  __filename2 = fileURLToPath(import.meta.url);
56829
57320
  __dirname2 = dirname9(__filename2);
56830
- CLAUDISH_CACHE_DIR = join33(homedir30(), ".claudish");
56831
- ALL_MODELS_CACHE_PATH2 = join33(CLAUDISH_CACHE_DIR, "all-models.json");
57321
+ CLAUDISH_CACHE_DIR = join34(homedir31(), ".claudish");
57322
+ ALL_MODELS_CACHE_PATH2 = join34(CLAUDISH_CACHE_DIR, "all-models.json");
56832
57323
  NEXT_STEP = {
56833
57324
  nonzero_exit: "read the evidence log, then retry or drop the model",
56834
57325
  timeout: "raise `timeout`, or pick a faster model",
@@ -56855,7 +57346,7 @@ var exports_serve_command = {};
56855
57346
  __export(exports_serve_command, {
56856
57347
  serveCommand: () => serveCommand
56857
57348
  });
56858
- import { existsSync as existsSync23, readFileSync as readFileSync23 } from "fs";
57349
+ import { existsSync as existsSync24, readFileSync as readFileSync24 } from "fs";
56859
57350
  function parseServeArgs(args) {
56860
57351
  const out = {};
56861
57352
  for (let i = 0;i < args.length; i++) {
@@ -56874,12 +57365,12 @@ function parseServeArgs(args) {
56874
57365
  return out;
56875
57366
  }
56876
57367
  function loadModelMap(path) {
56877
- if (!existsSync23(path)) {
57368
+ if (!existsSync24(path)) {
56878
57369
  throw new Error(`--models file not found: ${path}`);
56879
57370
  }
56880
57371
  let raw2;
56881
57372
  try {
56882
- raw2 = readFileSync23(path, "utf-8");
57373
+ raw2 = readFileSync24(path, "utf-8");
56883
57374
  } catch (e) {
56884
57375
  throw new Error(`failed to read --models file ${path}: ${e instanceof Error ? e.message : String(e)}`);
56885
57376
  }
@@ -57194,7 +57685,7 @@ var exports_behavior_command = {};
57194
57685
  __export(exports_behavior_command, {
57195
57686
  behaviorCommand: () => behaviorCommand
57196
57687
  });
57197
- import { existsSync as existsSync24, readFileSync as readFileSync24, writeFileSync as writeFileSync15 } from "fs";
57688
+ import { existsSync as existsSync25, readFileSync as readFileSync25, writeFileSync as writeFileSync15 } from "fs";
57198
57689
  function severityColor(sev) {
57199
57690
  if (sev === "fix")
57200
57691
  return green(sev);
@@ -57292,8 +57783,8 @@ function setTelemetryEnabled(value) {
57292
57783
  const path = getConfigPath();
57293
57784
  let cfg = {};
57294
57785
  try {
57295
- if (existsSync24(path)) {
57296
- const parsed = JSON.parse(readFileSync24(path, "utf-8"));
57786
+ if (existsSync25(path)) {
57787
+ const parsed = JSON.parse(readFileSync25(path, "utf-8"));
57297
57788
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
57298
57789
  cfg = parsed;
57299
57790
  }
@@ -57314,8 +57805,8 @@ function showTelemetry(action, json2) {
57314
57805
  let pending = 0;
57315
57806
  try {
57316
57807
  const path = outboxPath();
57317
- if (existsSync24(path)) {
57318
- pending = readFileSync24(path, "utf8").split(`
57808
+ if (existsSync25(path)) {
57809
+ pending = readFileSync25(path, "utf8").split(`
57319
57810
  `).filter(Boolean).length;
57320
57811
  }
57321
57812
  } catch {}
@@ -57400,9 +57891,9 @@ __export(exports_team_grid, {
57400
57891
  });
57401
57892
  import { spawn as spawn4 } from "child_process";
57402
57893
  import { execSync } from "child_process";
57403
- import { existsSync as existsSync25, readFileSync as readFileSync25, writeFileSync as writeFileSync16 } from "fs";
57894
+ import { existsSync as existsSync26, readFileSync as readFileSync26, writeFileSync as writeFileSync16 } from "fs";
57404
57895
  import { connect as netConnect } from "net";
57405
- import { dirname as dirname10, join as join34 } from "path";
57896
+ import { dirname as dirname10, join as join35 } from "path";
57406
57897
  import { setTimeout as wait } from "timers/promises";
57407
57898
  import { fileURLToPath as fileURLToPath2 } from "url";
57408
57899
  function resolveRouteInfo(modelId) {
@@ -57496,18 +57987,18 @@ function buildPaneHeader(model, prompt, bg) {
57496
57987
  function findMagmuxBinary() {
57497
57988
  const thisFile = fileURLToPath2(import.meta.url);
57498
57989
  const thisDir = dirname10(thisFile);
57499
- const pkgRoot = join34(thisDir, "..");
57990
+ const pkgRoot = join35(thisDir, "..");
57500
57991
  const platform2 = process.platform;
57501
57992
  const arch = process.arch;
57502
- const bundledMagmux = join34(pkgRoot, "native", `magmux-${platform2}-${arch}`);
57503
- if (existsSync25(bundledMagmux))
57993
+ const bundledMagmux = join35(pkgRoot, "native", `magmux-${platform2}-${arch}`);
57994
+ if (existsSync26(bundledMagmux))
57504
57995
  return bundledMagmux;
57505
57996
  try {
57506
57997
  const pkgName = `@claudish/magmux-${platform2}-${arch}`;
57507
57998
  let searchDir = pkgRoot;
57508
57999
  for (let i = 0;i < 5; i++) {
57509
- const candidate = join34(searchDir, "node_modules", pkgName, "bin", "magmux");
57510
- if (existsSync25(candidate))
58000
+ const candidate = join35(searchDir, "node_modules", pkgName, "bin", "magmux");
58001
+ if (existsSync26(candidate))
57511
58002
  return candidate;
57512
58003
  const parent = dirname10(searchDir);
57513
58004
  if (parent === searchDir)
@@ -57531,7 +58022,7 @@ function withoutControlPanes(evt) {
57531
58022
  async function subscribeToMagmux(sockPath, onEvent) {
57532
58023
  let client = null;
57533
58024
  for (let attempt = 0;attempt < 40; attempt++) {
57534
- if (existsSync25(sockPath)) {
58025
+ if (existsSync26(sockPath)) {
57535
58026
  try {
57536
58027
  client = await new Promise((resolve6, reject) => {
57537
58028
  const s = netConnect(sockPath);
@@ -57618,9 +58109,9 @@ async function runWithGrid(sessionPath, models, input, opts) {
57618
58109
  const keep = opts?.keep ?? false;
57619
58110
  const manifest = setupSession(sessionPath, models, input);
57620
58111
  const startedAt = new Date().toISOString();
57621
- const gridfilePath = join34(sessionPath, "gridfile.txt");
57622
- const prompt = readFileSync25(join34(sessionPath, "input.md"), "utf-8").replace(/'/g, "'\\''").replace(/\n/g, " ");
57623
- const rawPrompt = readFileSync25(join34(sessionPath, "input.md"), "utf-8");
58112
+ const gridfilePath = join35(sessionPath, "gridfile.txt");
58113
+ const prompt = readFileSync26(join35(sessionPath, "input.md"), "utf-8").replace(/'/g, "'\\''").replace(/\n/g, " ");
58114
+ const rawPrompt = readFileSync26(join35(sessionPath, "input.md"), "utf-8");
57624
58115
  const usedBannerColors = new Set;
57625
58116
  const gridLines = Object.entries(manifest.models).map(([anonId]) => {
57626
58117
  const model = manifest.models[anonId].model;
@@ -57651,7 +58142,7 @@ async function runWithGrid(sessionPath, models, input, opts) {
57651
58142
  });
57652
58143
  const [{ results }] = await Promise.all([subscription, procExit]);
57653
58144
  const status = buildTeamStatus(manifest, startedAt, results?.panes ?? null);
57654
- const statusPath = join34(sessionPath, "status.json");
58145
+ const statusPath = join35(sessionPath, "status.json");
57655
58146
  writeFileSync16(statusPath, JSON.stringify(status, null, 2), "utf-8");
57656
58147
  return status;
57657
58148
  }
@@ -57676,8 +58167,8 @@ var exports_team_cli = {};
57676
58167
  __export(exports_team_cli, {
57677
58168
  teamCommand: () => teamCommand
57678
58169
  });
57679
- import { readFileSync as readFileSync26 } from "fs";
57680
- import { join as join35 } from "path";
58170
+ import { readFileSync as readFileSync27 } from "fs";
58171
+ import { join as join36 } from "path";
57681
58172
  function getFlag(args, flag) {
57682
58173
  const idx = args.indexOf(flag);
57683
58174
  if (idx === -1 || idx + 1 >= args.length)
@@ -57800,7 +58291,7 @@ async function teamCommand(args) {
57800
58291
  }
57801
58292
  case "judge": {
57802
58293
  await judgeResponses(sessionPath, { judges });
57803
- console.log(readFileSync26(join35(sessionPath, "verdict.md"), "utf-8"));
58294
+ console.log(readFileSync27(join36(sessionPath, "verdict.md"), "utf-8"));
57804
58295
  break;
57805
58296
  }
57806
58297
  case "run-and-judge": {
@@ -57818,7 +58309,7 @@ async function teamCommand(args) {
57818
58309
  });
57819
58310
  printStatus(status);
57820
58311
  await judgeResponses(sessionPath, { judges });
57821
- console.log(readFileSync26(join35(sessionPath, "verdict.md"), "utf-8"));
58312
+ console.log(readFileSync27(join36(sessionPath, "verdict.md"), "utf-8"));
57822
58313
  break;
57823
58314
  }
57824
58315
  case "status": {
@@ -58468,7 +58959,7 @@ var init_theme = __esm(() => {
58468
58959
  });
58469
58960
 
58470
58961
  // ../../node_modules/.bun/@inquirer+core@11.0.1+04f2146be16c61ef/node_modules/@inquirer/core/dist/lib/make-theme.js
58471
- function isPlainObject3(value) {
58962
+ function isPlainObject4(value) {
58472
58963
  if (typeof value !== "object" || value === null)
58473
58964
  return false;
58474
58965
  let proto = value;
@@ -58482,7 +58973,7 @@ function deepMerge(...objects) {
58482
58973
  for (const obj of objects) {
58483
58974
  for (const [key, value] of Object.entries(obj)) {
58484
58975
  const prevValue = output[key];
58485
- output[key] = isPlainObject3(prevValue) && isPlainObject3(value) ? deepMerge(prevValue, value) : value;
58976
+ output[key] = isPlainObject4(prevValue) && isPlainObject4(value) ? deepMerge(prevValue, value) : value;
58486
58977
  }
58487
58978
  }
58488
58979
  return output;
@@ -69245,7 +69736,7 @@ var init_RemoveFileError = __esm(() => {
69245
69736
 
69246
69737
  // ../../node_modules/.bun/@inquirer+external-editor@2.0.1+04f2146be16c61ef/node_modules/@inquirer/external-editor/dist/index.js
69247
69738
  import { spawn as spawn5, spawnSync as spawnSync2 } from "child_process";
69248
- import { readFileSync as readFileSync27, unlinkSync as unlinkSync6, writeFileSync as writeFileSync17 } from "fs";
69739
+ import { readFileSync as readFileSync28, unlinkSync as unlinkSync6, writeFileSync as writeFileSync17 } from "fs";
69249
69740
  import path from "path";
69250
69741
  import os from "os";
69251
69742
  import { randomUUID as randomUUID5 } from "crypto";
@@ -69361,7 +69852,7 @@ class ExternalEditor {
69361
69852
  }
69362
69853
  readTemporaryFile() {
69363
69854
  try {
69364
- const tempFileBuffer = readFileSync27(this.tempFile);
69855
+ const tempFileBuffer = readFileSync28(this.tempFile);
69365
69856
  if (tempFileBuffer.length === 0) {
69366
69857
  this.text = "";
69367
69858
  } else {
@@ -70756,9 +71247,9 @@ var init_keychain_command = __esm(() => {
70756
71247
 
70757
71248
  // src/auth/antigravity-oauth.ts
70758
71249
  import { spawnSync as spawnSync3 } from "child_process";
70759
- import { existsSync as existsSync26, unlinkSync as unlinkSync7 } from "fs";
70760
- import { homedir as homedir31 } from "os";
70761
- import { join as join36 } from "path";
71250
+ import { existsSync as existsSync27, unlinkSync as unlinkSync7 } from "fs";
71251
+ import { homedir as homedir32 } from "os";
71252
+ import { join as join37 } from "path";
70762
71253
  async function defaultSuggestModel() {
70763
71254
  try {
70764
71255
  const tok = readSharedAntigravityToken();
@@ -70879,8 +71370,8 @@ No session detected yet. Starting the Antigravity CLI interactively \u2014
70879
71370
  async logout(deps2) {
70880
71371
  deleteSharedAntigravityToken(deps2);
70881
71372
  try {
70882
- const tokenFile = join36(homedir31(), ".gemini", "antigravity-cli", "antigravity-oauth-token");
70883
- if (existsSync26(tokenFile))
71373
+ const tokenFile = join37(homedir32(), ".gemini", "antigravity-cli", "antigravity-oauth-token");
71374
+ if (existsSync27(tokenFile))
70884
71375
  unlinkSync7(tokenFile);
70885
71376
  } catch {}
70886
71377
  log("[AntigravityOAuth] Antigravity session cleared (keychain + agy token file)");
@@ -72282,6 +72773,23 @@ var init_model_selector = __esm(() => {
72282
72773
  };
72283
72774
  });
72284
72775
 
72776
+ // src/providers/probe-runner.ts
72777
+ function pinProbeModelSpec(link) {
72778
+ if (link.provider === "native-anthropic")
72779
+ return link.modelSpec;
72780
+ return link.modelSpec.includes("@") ? link.modelSpec : `${link.provider}@${link.modelSpec}`;
72781
+ }
72782
+ function probeProviderRoute(proxyUrl, link, timeoutMs) {
72783
+ return probeLink(proxyUrl, {
72784
+ ...link,
72785
+ modelSpec: pinProbeModelSpec(link)
72786
+ }, timeoutMs);
72787
+ }
72788
+ var INTERACTIVE_PROBE_TIMEOUT_MS = 60000;
72789
+ var init_probe_runner = __esm(() => {
72790
+ init_probe_live();
72791
+ });
72792
+
72285
72793
  // src/tui/theme.ts
72286
72794
  import { createTextAttributes } from "@opentui/core";
72287
72795
  function latencyBucket(ms) {
@@ -72905,7 +73413,7 @@ function buildDirectRowData(result) {
72905
73413
  {
72906
73414
  num: "1",
72907
73415
  provider: result.nativeProvider,
72908
- spec: `${result.nativeProvider}@${result.model}`,
73416
+ spec: pinProbeModelSpec({ provider: result.nativeProvider, modelSpec: result.model }),
72909
73417
  status,
72910
73418
  errorDetail,
72911
73419
  barsTiming
@@ -73238,6 +73746,7 @@ function printProbeResults(results, isLiveProbe) {
73238
73746
  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;
73239
73747
  var init_probe_results_printer = __esm(() => {
73240
73748
  init_probe_live();
73749
+ init_probe_runner();
73241
73750
  init_ansi();
73242
73751
  init_theme_mode();
73243
73752
  init_theme2();
@@ -74711,23 +75220,6 @@ var init_claude_code_aliases = __esm(() => {
74711
75220
  };
74712
75221
  });
74713
75222
 
74714
- // src/providers/probe-runner.ts
74715
- function pinProbeModelSpec(link) {
74716
- if (link.provider === "native-anthropic")
74717
- return link.modelSpec;
74718
- return link.modelSpec.includes("@") ? link.modelSpec : `${link.provider}@${link.modelSpec}`;
74719
- }
74720
- function probeProviderRoute(proxyUrl, link, timeoutMs) {
74721
- return probeLink(proxyUrl, {
74722
- ...link,
74723
- modelSpec: pinProbeModelSpec(link)
74724
- }, timeoutMs);
74725
- }
74726
- var INTERACTIVE_PROBE_TIMEOUT_MS = 60000;
74727
- var init_probe_runner = __esm(() => {
74728
- init_probe_live();
74729
- });
74730
-
74731
75223
  // src/cli.ts
74732
75224
  var exports_cli = {};
74733
75225
  __export(exports_cli, {
@@ -74744,30 +75236,30 @@ __export(exports_cli, {
74744
75236
  });
74745
75237
  import {
74746
75238
  copyFileSync as copyFileSync2,
74747
- existsSync as existsSync27,
75239
+ existsSync as existsSync28,
74748
75240
  mkdirSync as mkdirSync16,
74749
- readFileSync as readFileSync28,
74750
- readdirSync as readdirSync6,
75241
+ readFileSync as readFileSync29,
75242
+ readdirSync as readdirSync7,
74751
75243
  unlinkSync as unlinkSync8,
74752
75244
  writeFileSync as writeFileSync18
74753
75245
  } from "fs";
74754
- import { homedir as homedir32 } from "os";
74755
- import { dirname as dirname11, join as join37 } from "path";
75246
+ import { homedir as homedir33 } from "os";
75247
+ import { dirname as dirname11, join as join38 } from "path";
74756
75248
  import { fileURLToPath as fileURLToPath3 } from "url";
74757
75249
  function getVersion3() {
74758
75250
  return VERSION;
74759
75251
  }
74760
75252
  function clearAllModelCaches() {
74761
- const cacheDir = join37(homedir32(), ".claudish");
74762
- if (!existsSync27(cacheDir))
75253
+ const cacheDir = join38(homedir33(), ".claudish");
75254
+ if (!existsSync28(cacheDir))
74763
75255
  return;
74764
75256
  const cachePatterns = ["pricing-cache.json", "recommended-models-cache.json"];
74765
75257
  let cleared = 0;
74766
75258
  try {
74767
- const files = readdirSync6(cacheDir);
75259
+ const files = readdirSync7(cacheDir);
74768
75260
  for (const file2 of files) {
74769
75261
  if (cachePatterns.includes(file2)) {
74770
- unlinkSync8(join37(cacheDir, file2));
75262
+ unlinkSync8(join38(cacheDir, file2));
74771
75263
  cleared++;
74772
75264
  }
74773
75265
  }
@@ -74987,6 +75479,33 @@ async function parseArgs(args) {
74987
75479
  process.exit(1);
74988
75480
  }
74989
75481
  config3.classifierProvider = cpArg;
75482
+ } else if (arg === "--model-params") {
75483
+ const mpArg = args[++i];
75484
+ if (!mpArg) {
75485
+ console.error("--model-params requires k=v[,k=v...] (e.g. reasoning.mode=pro)");
75486
+ process.exit(1);
75487
+ }
75488
+ try {
75489
+ config3.modelParams = parseModelParams(mpArg, config3.modelParams ?? {});
75490
+ } catch (err) {
75491
+ console.error(err instanceof Error ? err.message : String(err));
75492
+ process.exit(1);
75493
+ }
75494
+ } else if (arg === "--effort-override") {
75495
+ const effArg = args[++i];
75496
+ if (!effArg) {
75497
+ console.error(`--effort-override requires a level (${EFFORT_LEVELS.join(", ")})`);
75498
+ process.exit(1);
75499
+ }
75500
+ if (!isEffortLevel(effArg)) {
75501
+ console.error(`--effort-override "${effArg}" is not a canonical level (${EFFORT_LEVELS.join(", ")}). ` + "For a provider-specific value, use --model-params (e.g. --model-params reasoning_effort=<value>).");
75502
+ process.exit(1);
75503
+ }
75504
+ config3.effortOverride = effArg;
75505
+ } else if (arg === "--pro-on-ultracode") {
75506
+ config3.proOnUltracode = true;
75507
+ } else if (arg === "--no-pro-on-ultracode") {
75508
+ config3.proOnUltracode = false;
74990
75509
  } else if (arg === "--op-env" || arg.startsWith("--op-env=")) {
74991
75510
  const v = arg.startsWith("--op-env=") ? arg.slice("--op-env=".length) : args[++i];
74992
75511
  if (!v) {
@@ -75197,8 +75716,8 @@ Usage: claudish --models --provider <slug>`);
75197
75716
  });
75198
75717
  config3.resolvedDefaultProvider = resolved;
75199
75718
  if (resolved.legacyAutoPromoted && !config3.quiet) {
75200
- const markerFile = join37(homedir32(), ".claudish", ".legacy-litellm-hint-shown");
75201
- if (!existsSync27(markerFile)) {
75719
+ const markerFile = join38(homedir33(), ".claudish", ".legacy-litellm-hint-shown");
75720
+ if (!existsSync28(markerFile)) {
75202
75721
  const hint = buildLegacyHint(resolved);
75203
75722
  if (hint) {
75204
75723
  console.error(hint);
@@ -75210,6 +75729,14 @@ Usage: claudish --models --provider <slug>`);
75210
75729
  }
75211
75730
  }
75212
75731
  } catch {}
75732
+ if (config3.proOnUltracode === undefined) {
75733
+ const envVal = process.env.CLAUDISH_PRO_ON_ULTRACODE;
75734
+ if (envVal !== undefined) {
75735
+ config3.proOnUltracode = envVal === "1" || envVal.toLowerCase() === "true";
75736
+ } else {
75737
+ config3.proOnUltracode = readProOnUltracode() === true;
75738
+ }
75739
+ }
75213
75740
  return config3;
75214
75741
  }
75215
75742
  function formatModelDocPricing(pricing) {
@@ -75805,14 +76332,14 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
75805
76332
  }
75806
76333
  return;
75807
76334
  }
75808
- const initialState = {
76335
+ const initialState2 = {
75809
76336
  steps: [],
75810
76337
  links: [],
75811
76338
  phase: "live",
75812
76339
  results: [],
75813
76340
  activeTab: "summary"
75814
76341
  };
75815
- const tui = await startProbeTui(initialState);
76342
+ const tui = await startProbeTui(initialState2);
75816
76343
  const addStep = (name, status) => {
75817
76344
  tui.store.setState((prev) => ({
75818
76345
  ...prev,
@@ -76106,6 +76633,10 @@ ${h("OPTIONS")}
76106
76633
  ${green2("--free")} Show only FREE models in the interactive selector
76107
76634
  ${green2("--monitor")} Monitor mode - proxy to REAL Anthropic API and log traffic
76108
76635
  ${green2("--advisor")} ${yellow2('"m1,m2[:collector]"')} Multi-model advisor replacement (implies --monitor)
76636
+ ${green2("--model-params")} ${yellow2('"k=v,..."')} Extra request params merged into the payload (e.g. reasoning.mode=pro)
76637
+ ${green2("--effort-override")} ${yellow2("<level>")} Pin reasoning effort verbatim, skipping the per-model clamp
76638
+ ${green2("--pro-on-ultracode")} Apply the model's catalog preset while in ultracode (opt-in)
76639
+ ${green2("--no-pro-on-ultracode")} Force that off for this run (when enabled in config/env)
76109
76640
  ${green2("-y, --auto-approve")} Skip permission prompts (--dangerously-skip-permissions)
76110
76641
  ${green2("--no-auto-approve")} Explicitly enable permission prompts (default)
76111
76642
  ${green2("--dangerous")} Pass --dangerouslyDisableSandbox to Claude Code
@@ -76317,8 +76848,8 @@ ${h("MORE INFO")}
76317
76848
  }
76318
76849
  function printAIAgentGuide() {
76319
76850
  try {
76320
- const guidePath = join37(__dirname3, "../AI_AGENT_GUIDE.md");
76321
- const guideContent = readFileSync28(guidePath, "utf-8");
76851
+ const guidePath = join38(__dirname3, "../AI_AGENT_GUIDE.md");
76852
+ const guideContent = readFileSync29(guidePath, "utf-8");
76322
76853
  console.log(guideContent);
76323
76854
  } catch (error46) {
76324
76855
  console.error("Error reading AI Agent Guide:");
@@ -76334,19 +76865,19 @@ async function initializeClaudishSkill() {
76334
76865
  console.log(`\uD83D\uDD27 Initializing Claudish skill in current project...
76335
76866
  `);
76336
76867
  const cwd = process.cwd();
76337
- const claudeDir = join37(cwd, ".claude");
76338
- const skillsDir = join37(claudeDir, "skills");
76339
- const claudishSkillDir = join37(skillsDir, "claudish-usage");
76340
- const skillFile = join37(claudishSkillDir, "SKILL.md");
76341
- if (existsSync27(skillFile)) {
76868
+ const claudeDir = join38(cwd, ".claude");
76869
+ const skillsDir = join38(claudeDir, "skills");
76870
+ const claudishSkillDir = join38(skillsDir, "claudish-usage");
76871
+ const skillFile = join38(claudishSkillDir, "SKILL.md");
76872
+ if (existsSync28(skillFile)) {
76342
76873
  console.log("\u2705 Claudish skill already installed at:");
76343
76874
  console.log(` ${skillFile}
76344
76875
  `);
76345
76876
  console.log("\uD83D\uDCA1 To reinstall, delete the file and run 'claudish --init' again.");
76346
76877
  return;
76347
76878
  }
76348
- const sourceSkillPath = join37(__dirname3, "../skills/claudish-usage/SKILL.md");
76349
- if (!existsSync27(sourceSkillPath)) {
76879
+ const sourceSkillPath = join38(__dirname3, "../skills/claudish-usage/SKILL.md");
76880
+ if (!existsSync28(sourceSkillPath)) {
76350
76881
  console.error("\u274C Error: Claudish skill file not found in installation.");
76351
76882
  console.error(` Expected at: ${sourceSkillPath}`);
76352
76883
  console.error(`
@@ -76355,15 +76886,15 @@ async function initializeClaudishSkill() {
76355
76886
  process.exit(1);
76356
76887
  }
76357
76888
  try {
76358
- if (!existsSync27(claudeDir)) {
76889
+ if (!existsSync28(claudeDir)) {
76359
76890
  mkdirSync16(claudeDir, { recursive: true });
76360
76891
  console.log("\uD83D\uDCC1 Created .claude/ directory");
76361
76892
  }
76362
- if (!existsSync27(skillsDir)) {
76893
+ if (!existsSync28(skillsDir)) {
76363
76894
  mkdirSync16(skillsDir, { recursive: true });
76364
76895
  console.log("\uD83D\uDCC1 Created .claude/skills/ directory");
76365
76896
  }
76366
- if (!existsSync27(claudishSkillDir)) {
76897
+ if (!existsSync28(claudishSkillDir)) {
76367
76898
  mkdirSync16(claudishSkillDir, { recursive: true });
76368
76899
  console.log("\uD83D\uDCC1 Created .claude/skills/claudish-usage/ directory");
76369
76900
  }
@@ -76421,6 +76952,7 @@ function printAvailableModels() {
76421
76952
  }
76422
76953
  var __filename3, __dirname3;
76423
76954
  var init_cli = __esm(() => {
76955
+ init_base_api_format();
76424
76956
  init_config2();
76425
76957
  init_model_loader();
76426
76958
  init_model_selector();
@@ -76452,33 +76984,33 @@ __export(exports_update_checker, {
76452
76984
  fetchLatestVersion: () => fetchLatestVersion,
76453
76985
  fetchLatestVersionOrThrow: () => fetchLatestVersionOrThrow
76454
76986
  });
76455
- import { existsSync as existsSync28, mkdirSync as mkdirSync17, readFileSync as readFileSync29, unlinkSync as unlinkSync9, writeFileSync as writeFileSync19 } from "fs";
76456
- import { homedir as homedir33, platform as platform2, tmpdir } from "os";
76457
- import { join as join38 } from "path";
76987
+ import { existsSync as existsSync29, mkdirSync as mkdirSync17, readFileSync as readFileSync30, unlinkSync as unlinkSync9, writeFileSync as writeFileSync19 } from "fs";
76988
+ import { homedir as homedir34, platform as platform2, tmpdir } from "os";
76989
+ import { join as join39 } from "path";
76458
76990
  function getCacheFilePath() {
76459
76991
  let cacheDir;
76460
76992
  if (isWindows) {
76461
- const localAppData = process.env.LOCALAPPDATA || join38(homedir33(), "AppData", "Local");
76462
- cacheDir = join38(localAppData, "claudish");
76993
+ const localAppData = process.env.LOCALAPPDATA || join39(homedir34(), "AppData", "Local");
76994
+ cacheDir = join39(localAppData, "claudish");
76463
76995
  } else {
76464
- cacheDir = join38(homedir33(), ".cache", "claudish");
76996
+ cacheDir = join39(homedir34(), ".cache", "claudish");
76465
76997
  }
76466
76998
  try {
76467
- if (!existsSync28(cacheDir)) {
76999
+ if (!existsSync29(cacheDir)) {
76468
77000
  mkdirSync17(cacheDir, { recursive: true });
76469
77001
  }
76470
- return join38(cacheDir, "update-check.json");
77002
+ return join39(cacheDir, "update-check.json");
76471
77003
  } catch {
76472
- return join38(tmpdir(), "claudish-update-check.json");
77004
+ return join39(tmpdir(), "claudish-update-check.json");
76473
77005
  }
76474
77006
  }
76475
77007
  function readCache() {
76476
77008
  try {
76477
77009
  const cachePath = getCacheFilePath();
76478
- if (!existsSync28(cachePath)) {
77010
+ if (!existsSync29(cachePath)) {
76479
77011
  return null;
76480
77012
  }
76481
- const data = JSON.parse(readFileSync29(cachePath, "utf-8"));
77013
+ const data = JSON.parse(readFileSync30(cachePath, "utf-8"));
76482
77014
  return data;
76483
77015
  } catch {
76484
77016
  return null;
@@ -76501,7 +77033,7 @@ function isCacheValid(cache3) {
76501
77033
  function clearCache() {
76502
77034
  try {
76503
77035
  const cachePath = getCacheFilePath();
76504
- if (existsSync28(cachePath)) {
77036
+ if (existsSync29(cachePath)) {
76505
77037
  unlinkSync9(cachePath);
76506
77038
  }
76507
77039
  } catch {}
@@ -77405,15 +77937,15 @@ var init_local_liveness = __esm(() => {
77405
77937
  });
77406
77938
 
77407
77939
  // src/providers/probe-catalog.ts
77408
- import { existsSync as existsSync29, mkdirSync as mkdirSync18, readFileSync as readFileSync30, writeFileSync as writeFileSync20 } from "fs";
77409
- import { homedir as homedir34 } from "os";
77410
- import { dirname as dirname12, join as join39 } from "path";
77940
+ import { existsSync as existsSync30, mkdirSync as mkdirSync18, readFileSync as readFileSync31, writeFileSync as writeFileSync20 } from "fs";
77941
+ import { homedir as homedir35 } from "os";
77942
+ import { dirname as dirname12, join as join40 } from "path";
77411
77943
  function readProbeModelsCache(path2 = PROBE_MODELS_CACHE_PATH) {
77412
- if (!existsSync29(path2))
77944
+ if (!existsSync30(path2))
77413
77945
  return null;
77414
77946
  let raw2;
77415
77947
  try {
77416
- raw2 = JSON.parse(readFileSync30(path2, "utf-8"));
77948
+ raw2 = JSON.parse(readFileSync31(path2, "utf-8"));
77417
77949
  } catch {
77418
77950
  return null;
77419
77951
  }
@@ -77542,7 +78074,7 @@ function isValidResponse(raw2) {
77542
78074
  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;
77543
78075
  var init_probe_catalog = __esm(() => {
77544
78076
  CACHE_TTL_MS4 = 60 * 60 * 1000;
77545
- PROBE_MODELS_CACHE_PATH = join39(homedir34(), ".claudish", "probe-models.json");
78077
+ PROBE_MODELS_CACHE_PATH = join40(homedir35(), ".claudish", "probe-models.json");
77546
78078
  });
77547
78079
 
77548
78080
  // src/tui/constants.ts
@@ -84145,18 +84677,18 @@ __export(exports_claude_runner, {
84145
84677
  });
84146
84678
  import { spawn as spawn6, spawnSync as spawnSync5 } from "child_process";
84147
84679
  import {
84148
- closeSync as closeSync7,
84149
- existsSync as existsSync30,
84680
+ closeSync as closeSync8,
84681
+ existsSync as existsSync31,
84150
84682
  mkdirSync as mkdirSync19,
84151
- openSync as openSync7,
84152
- readFileSync as readFileSync31,
84153
- readdirSync as readdirSync7,
84154
- statSync as statSync7,
84683
+ openSync as openSync8,
84684
+ readFileSync as readFileSync32,
84685
+ readdirSync as readdirSync8,
84686
+ statSync as statSync8,
84155
84687
  unlinkSync as unlinkSync10,
84156
84688
  writeFileSync as writeFileSync21
84157
84689
  } from "fs";
84158
- import { homedir as homedir35, tmpdir as tmpdir2 } from "os";
84159
- import { dirname as dirname13, join as join40 } from "path";
84690
+ import { homedir as homedir36, tmpdir as tmpdir2 } from "os";
84691
+ import { dirname as dirname13, join as join41 } from "path";
84160
84692
  import { isatty } from "tty";
84161
84693
  function releaseTerminalIsolation() {
84162
84694
  if (!restoreTerminal)
@@ -84195,11 +84727,11 @@ function shouldHideIncidentalAnthropicKey(config3, env = process.env) {
84195
84727
  }
84196
84728
  function hasResolvableAnthropicAuth(deps2 = {}) {
84197
84729
  const env = deps2.env ?? process.env;
84198
- const fileExists = deps2.fileExists ?? existsSync30;
84730
+ const fileExists = deps2.fileExists ?? existsSync31;
84199
84731
  const keychainProbe = deps2.keychainProbe ?? defaultKeychainAnthropicProbe;
84200
84732
  if (env.ANTHROPIC_API_KEY || env.ANTHROPIC_AUTH_TOKEN)
84201
84733
  return true;
84202
- if (fileExists(join40(homedir35(), ".claude", ".credentials.json")))
84734
+ if (fileExists(join41(homedir36(), ".claude", ".credentials.json")))
84203
84735
  return true;
84204
84736
  return keychainProbe();
84205
84737
  }
@@ -84211,14 +84743,14 @@ function isProxyAuthMode(config3) {
84211
84743
  }
84212
84744
  function managedSettingsPath() {
84213
84745
  if (isWindows2()) {
84214
- return join40(process.env.PROGRAMDATA || "C:\\ProgramData", "ClaudeCode", "managed-settings.json");
84746
+ return join41(process.env.PROGRAMDATA || "C:\\ProgramData", "ClaudeCode", "managed-settings.json");
84215
84747
  }
84216
84748
  if (process.platform === "darwin") {
84217
84749
  return "/Library/Application Support/ClaudeCode/managed-settings.json";
84218
84750
  }
84219
84751
  return "/etc/claude-code/managed-settings.json";
84220
84752
  }
84221
- function managedSettingsForcesClaudeAi(readFile3 = readFileSync31) {
84753
+ function managedSettingsForcesClaudeAi(readFile3 = readFileSync32) {
84222
84754
  try {
84223
84755
  const raw2 = readFile3(managedSettingsPath(), "utf-8");
84224
84756
  const parsed = JSON.parse(raw2);
@@ -84232,9 +84764,9 @@ function isWindows2() {
84232
84764
  }
84233
84765
  function createStatusLineScript(tokenFilePath) {
84234
84766
  const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
84235
- const claudishDir = join40(homeDir, ".claudish");
84767
+ const claudishDir = join41(homeDir, ".claudish");
84236
84768
  const timestamp = Date.now();
84237
- const scriptPath = join40(claudishDir, `status-${timestamp}.js`);
84769
+ const scriptPath = join41(claudishDir, `status-${timestamp}.js`);
84238
84770
  const escapedTokenPath = tokenFilePath.replace(/\\/g, "\\\\");
84239
84771
  const light = getThemeMode() === "light";
84240
84772
  const cyanCode = light ? "38;2;14;116;144" : "96";
@@ -84392,7 +84924,7 @@ function cleanupStaleTokenFiles(dir, now2 = Date.now(), maxAgeMs = STALE_TOKEN_F
84392
84924
  let removed = 0;
84393
84925
  let entries;
84394
84926
  try {
84395
- entries = readdirSync7(dir);
84927
+ entries = readdirSync8(dir);
84396
84928
  } catch {
84397
84929
  return 0;
84398
84930
  }
@@ -84404,9 +84936,9 @@ function cleanupStaleTokenFiles(dir, now2 = Date.now(), maxAgeMs = STALE_TOKEN_F
84404
84936
  if (!name.startsWith("tokens-") || !name.endsWith(".json"))
84405
84937
  continue;
84406
84938
  scanned++;
84407
- const full = join40(dir, name);
84939
+ const full = join41(dir, name);
84408
84940
  try {
84409
- if (statSync7(full).mtimeMs >= cutoff)
84941
+ if (statSync8(full).mtimeMs >= cutoff)
84410
84942
  continue;
84411
84943
  unlinkSync10(full);
84412
84944
  removed++;
@@ -84421,7 +84953,7 @@ function parseSettingsArg(value) {
84421
84953
  if (value.trimStart().startsWith("{")) {
84422
84954
  return JSON.parse(value);
84423
84955
  }
84424
- return JSON.parse(readFileSync31(value, "utf-8"));
84956
+ return JSON.parse(readFileSync32(value, "utf-8"));
84425
84957
  }
84426
84958
  function parseSettingsArgSafe(value) {
84427
84959
  try {
@@ -84433,13 +84965,13 @@ function parseSettingsArgSafe(value) {
84433
84965
  }
84434
84966
  function userSettingsFileCandidates(cwd) {
84435
84967
  return [
84436
- join40(homedir35(), ".claude", "settings.json"),
84437
- join40(cwd, ".claude", "settings.json"),
84438
- join40(cwd, ".claude", "settings.local.json")
84968
+ join41(homedir36(), ".claude", "settings.json"),
84969
+ join41(cwd, ".claude", "settings.json"),
84970
+ join41(cwd, ".claude", "settings.local.json")
84439
84971
  ];
84440
84972
  }
84441
84973
  function discoverUserStatusLineCommand(claudeArgs = [], cwd = process.cwd()) {
84442
- const sources = userSettingsFileCandidates(cwd).filter((file2) => existsSync30(file2));
84974
+ const sources = userSettingsFileCandidates(cwd).filter((file2) => existsSync31(file2));
84443
84975
  const idx = claudeArgs.indexOf("--settings");
84444
84976
  const settingsArg = idx === -1 ? undefined : claudeArgs[idx + 1];
84445
84977
  if (settingsArg)
@@ -84476,13 +85008,13 @@ function buildChainedStatusCommand(userCommand, claudishBody, claudishSegment) {
84476
85008
  }
84477
85009
  function createTempSettingsFile(_modelDisplay, port, proxyAuthMode, userStatusLineCommand) {
84478
85010
  const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
84479
- const claudishDir = join40(homeDir, ".claudish");
85011
+ const claudishDir = join41(homeDir, ".claudish");
84480
85012
  try {
84481
85013
  mkdirSync19(claudishDir, { recursive: true });
84482
85014
  } catch {}
84483
85015
  const timestamp = Date.now();
84484
- const tempPath = join40(claudishDir, `settings-${timestamp}.json`);
84485
- const tokenFilePath = join40(claudishDir, `tokens-${port}.json`);
85016
+ const tempPath = join41(claudishDir, `settings-${timestamp}.json`);
85017
+ const tokenFilePath = join41(claudishDir, `tokens-${port}.json`);
84486
85018
  cleanupStaleTokenFiles(claudishDir);
84487
85019
  initializeTokenFile(tokenFilePath);
84488
85020
  let statusCommand;
@@ -84736,8 +85268,8 @@ async function runClaudeWithProxy(config3, proxyUrl, onCleanup) {
84736
85268
  console.error("Install it from: https://claude.com/claude-code");
84737
85269
  console.error(`
84738
85270
  Or set CLAUDE_PATH to your custom installation:`);
84739
- const home = homedir35();
84740
- const localPath = isWindows2() ? join40(home, ".claude", "local", "claude.exe") : join40(home, ".claude", "local", "claude");
85271
+ const home = homedir36();
85272
+ const localPath = isWindows2() ? join41(home, ".claude", "local", "claude.exe") : join41(home, ".claude", "local", "claude");
84741
85273
  console.error(` export CLAUDE_PATH=${localPath}`);
84742
85274
  process.exit(1);
84743
85275
  }
@@ -84748,11 +85280,11 @@ Or set CLAUDE_PATH to your custom installation:`);
84748
85280
  const childWantsTty = config3.interactive && !process.stdout.isTTY && Boolean(process.stdin.isTTY);
84749
85281
  if (childWantsTty) {
84750
85282
  try {
84751
- const fd = openSync7("/dev/fd/0", "r+");
85283
+ const fd = openSync8("/dev/fd/0", "r+");
84752
85284
  if (isatty(fd)) {
84753
85285
  ttyFd = fd;
84754
85286
  } else {
84755
- closeSync7(fd);
85287
+ closeSync8(fd);
84756
85288
  }
84757
85289
  } catch {
84758
85290
  ttyFd = undefined;
@@ -84775,7 +85307,7 @@ Or set CLAUDE_PATH to your custom installation:`);
84775
85307
  const fdToClose = ttyFd;
84776
85308
  proc.on("spawn", () => {
84777
85309
  try {
84778
- closeSync7(fdToClose);
85310
+ closeSync8(fdToClose);
84779
85311
  } catch {}
84780
85312
  });
84781
85313
  }
@@ -84817,23 +85349,23 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet, onCleanup) {
84817
85349
  async function findClaudeBinary() {
84818
85350
  const isWindows3 = process.platform === "win32";
84819
85351
  if (process.env.CLAUDE_PATH) {
84820
- if (existsSync30(process.env.CLAUDE_PATH)) {
85352
+ if (existsSync31(process.env.CLAUDE_PATH)) {
84821
85353
  return process.env.CLAUDE_PATH;
84822
85354
  }
84823
85355
  }
84824
- const home = homedir35();
84825
- const localPath = isWindows3 ? join40(home, ".claude", "local", "claude.exe") : join40(home, ".claude", "local", "claude");
84826
- if (existsSync30(localPath)) {
85356
+ const home = homedir36();
85357
+ const localPath = isWindows3 ? join41(home, ".claude", "local", "claude.exe") : join41(home, ".claude", "local", "claude");
85358
+ if (existsSync31(localPath)) {
84827
85359
  return localPath;
84828
85360
  }
84829
85361
  if (isWindows3) {
84830
85362
  const windowsPaths = [
84831
- join40(home, "AppData", "Roaming", "npm", "claude.cmd"),
84832
- join40(home, ".npm-global", "claude.cmd"),
84833
- join40(home, "node_modules", ".bin", "claude.cmd")
85363
+ join41(home, "AppData", "Roaming", "npm", "claude.cmd"),
85364
+ join41(home, ".npm-global", "claude.cmd"),
85365
+ join41(home, "node_modules", ".bin", "claude.cmd")
84834
85366
  ];
84835
85367
  for (const path2 of windowsPaths) {
84836
- if (existsSync30(path2)) {
85368
+ if (existsSync31(path2)) {
84837
85369
  return path2;
84838
85370
  }
84839
85371
  }
@@ -84841,14 +85373,14 @@ async function findClaudeBinary() {
84841
85373
  const commonPaths = [
84842
85374
  "/usr/local/bin/claude",
84843
85375
  "/opt/homebrew/bin/claude",
84844
- join40(home, ".npm-global/bin/claude"),
84845
- join40(home, ".local/bin/claude"),
84846
- join40(home, "node_modules/.bin/claude"),
85376
+ join41(home, ".npm-global/bin/claude"),
85377
+ join41(home, ".local/bin/claude"),
85378
+ join41(home, "node_modules/.bin/claude"),
84847
85379
  "/data/data/com.termux/files/usr/bin/claude",
84848
- join40(home, "../usr/bin/claude")
85380
+ join41(home, "../usr/bin/claude")
84849
85381
  ];
84850
85382
  for (const path2 of commonPaths) {
84851
- if (existsSync30(path2)) {
85383
+ if (existsSync31(path2)) {
84852
85384
  return path2;
84853
85385
  }
84854
85386
  }
@@ -84929,17 +85461,17 @@ __export(exports_diag_output, {
84929
85461
  createDiagOutput: () => createDiagOutput
84930
85462
  });
84931
85463
  import { createWriteStream as createWriteStream3, mkdirSync as mkdirSync20, unlinkSync as unlinkSync11, writeFileSync as writeFileSync22 } from "fs";
84932
- import { homedir as homedir36 } from "os";
84933
- import { join as join41 } from "path";
85464
+ import { homedir as homedir37 } from "os";
85465
+ import { join as join42 } from "path";
84934
85466
  function getClaudishDir() {
84935
- const dir = join41(homedir36(), ".claudish");
85467
+ const dir = join42(homedir37(), ".claudish");
84936
85468
  try {
84937
85469
  mkdirSync20(dir, { recursive: true });
84938
85470
  } catch {}
84939
85471
  return dir;
84940
85472
  }
84941
85473
  function getDiagLogPath() {
84942
- return join41(getClaudishDir(), `diag-${process.pid}.log`);
85474
+ return join42(getClaudishDir(), `diag-${process.pid}.log`);
84943
85475
  }
84944
85476
 
84945
85477
  class LogFileDiagOutput {
@@ -85544,7 +86076,7 @@ var init_widgets = __esm(() => {
85544
86076
  });
85545
86077
 
85546
86078
  // src/session/conversation.ts
85547
- import { closeSync as closeSync8, openSync as openSync8, readSync as readSync3, statSync as statSync8 } from "fs";
86079
+ import { closeSync as closeSync9, openSync as openSync9, readSync as readSync4, statSync as statSync9 } from "fs";
85548
86080
  import { StringDecoder as StringDecoder2 } from "string_decoder";
85549
86081
  function looksLikeTurn(line) {
85550
86082
  const assistant = line.includes('"type":"assistant"');
@@ -85599,8 +86131,8 @@ function readConversation(file2, opts = {}) {
85599
86131
  };
85600
86132
  let fd = null;
85601
86133
  try {
85602
- const size = statSync8(file2).size;
85603
- fd = openSync8(file2, "r");
86134
+ const size = statSync9(file2).size;
86135
+ fd = openSync9(file2, "r");
85604
86136
  const buf = Buffer.allocUnsafe(chunkBytes);
85605
86137
  const decoder = new StringDecoder2("utf-8");
85606
86138
  let pending = "";
@@ -85632,7 +86164,7 @@ function readConversation(file2, opts = {}) {
85632
86164
  take({ role: raw2.role, text, elided });
85633
86165
  };
85634
86166
  while (pos < size) {
85635
- const n = readSync3(fd, buf, 0, Math.min(chunkBytes, size - pos), pos);
86167
+ const n = readSync4(fd, buf, 0, Math.min(chunkBytes, size - pos), pos);
85636
86168
  if (n <= 0)
85637
86169
  break;
85638
86170
  pos += n;
@@ -85656,7 +86188,7 @@ function readConversation(file2, opts = {}) {
85656
86188
  } catch {} finally {
85657
86189
  if (fd !== null) {
85658
86190
  try {
85659
- closeSync8(fd);
86191
+ closeSync9(fd);
85660
86192
  } catch {}
85661
86193
  }
85662
86194
  }
@@ -87263,16 +87795,16 @@ __export(exports_session_stats, {
87263
87795
  readSessionStats: () => readSessionStats,
87264
87796
  tokenFilePath: () => tokenFilePath
87265
87797
  });
87266
- import { readFileSync as readFileSync32 } from "fs";
87267
- import { homedir as homedir37 } from "os";
87268
- import { join as join42 } from "path";
87798
+ import { readFileSync as readFileSync33 } from "fs";
87799
+ import { homedir as homedir38 } from "os";
87800
+ import { join as join43 } from "path";
87269
87801
  function tokenFilePath(port) {
87270
- return process.env.CLAUDISH_TOKEN_FILE || join42(homedir37(), ".claudish", `tokens-${port}.json`);
87802
+ return process.env.CLAUDISH_TOKEN_FILE || join43(homedir38(), ".claudish", `tokens-${port}.json`);
87271
87803
  }
87272
87804
  function readSessionStats(port, opts) {
87273
87805
  let raw2;
87274
87806
  try {
87275
- raw2 = JSON.parse(readFileSync32(tokenFilePath(port), "utf-8"));
87807
+ raw2 = JSON.parse(readFileSync33(tokenFilePath(port), "utf-8"));
87276
87808
  } catch {
87277
87809
  return null;
87278
87810
  }
@@ -87611,8 +88143,8 @@ var init_session_summary = __esm(() => {
87611
88143
  init_op_source();
87612
88144
  init_startup_trace();
87613
88145
  var import_dotenv3 = __toESM(require_main(), 1);
87614
- import { existsSync as existsSync31, readFileSync as readFileSync33 } from "fs";
87615
- import { join as join43, resolve as resolve6 } from "path";
88146
+ import { existsSync as existsSync32, readFileSync as readFileSync34 } from "fs";
88147
+ import { join as join44, resolve as resolve6 } from "path";
87616
88148
  import_dotenv3.config({ quiet: true });
87617
88149
  function classifyStartupKind() {
87618
88150
  const argv = process.argv.slice(2);
@@ -87712,7 +88244,7 @@ async function applyConfigOverride() {
87712
88244
  const { planConfigOverride: planConfigOverride2, setConfigFileOverride: setConfigFileOverride2 } = await Promise.resolve().then(() => exports_config_override);
87713
88245
  const plan = planConfigOverride2(process.argv.slice(2), process.env, {
87714
88246
  resolve: resolve6,
87715
- exists: existsSync31
88247
+ exists: existsSync32
87716
88248
  });
87717
88249
  if (plan.kind === "none")
87718
88250
  return;
@@ -87885,14 +88417,14 @@ async function runCli() {
87885
88417
  if (cliConfig.team && cliConfig.team.length > 0) {
87886
88418
  let prompt = cliConfig.claudeArgs.join(" ");
87887
88419
  if (cliConfig.inputFile) {
87888
- prompt = readFileSync33(cliConfig.inputFile, "utf-8");
88420
+ prompt = readFileSync34(cliConfig.inputFile, "utf-8");
87889
88421
  }
87890
88422
  if (!prompt.trim()) {
87891
88423
  console.error("Error: --team requires a prompt (positional args or -f <file>)");
87892
88424
  process.exit(1);
87893
88425
  }
87894
88426
  const mode = cliConfig.teamMode ?? "default";
87895
- const sessionPath = join43(process.cwd(), `.claudish-team-${Date.now()}`);
88427
+ const sessionPath = join44(process.cwd(), `.claudish-team-${Date.now()}`);
87896
88428
  if (mode === "json") {
87897
88429
  const { setupSession: setupSession2, runModels: runModels2 } = await Promise.resolve().then(() => (init_team_orchestrator(), exports_team_orchestrator));
87898
88430
  setupSession2(sessionPath, cliConfig.team, prompt);
@@ -87902,9 +88434,9 @@ async function runCli() {
87902
88434
  });
87903
88435
  const result = { ...status2, responses: {} };
87904
88436
  for (const anonId of Object.keys(status2.models)) {
87905
- const responsePath = join43(sessionPath, `response-${anonId}.md`);
88437
+ const responsePath = join44(sessionPath, `response-${anonId}.md`);
87906
88438
  try {
87907
- const raw2 = readFileSync33(responsePath, "utf-8").trim();
88439
+ const raw2 = readFileSync34(responsePath, "utf-8").trim();
87908
88440
  try {
87909
88441
  result.responses[anonId] = JSON.parse(raw2);
87910
88442
  } catch {
@@ -88110,7 +88642,10 @@ Team Status`);
88110
88642
  advisorModels: cliConfig.advisorModels,
88111
88643
  advisorCollector: cliConfig.advisorCollector,
88112
88644
  modelChain: cliConfig.monitor ? undefined : cliConfig.modelChain,
88113
- classifier: resolveClassifierConfig(cliConfig, process.env)
88645
+ classifier: resolveClassifierConfig(cliConfig, process.env),
88646
+ effortOverride: cliConfig.effortOverride,
88647
+ modelParams: cliConfig.modelParams,
88648
+ proOnUltracode: cliConfig.proOnUltracode
88114
88649
  }));
88115
88650
  const diag = createDiagOutput2({
88116
88651
  interactive: cliConfig.interactive,