claude-use 11.22.0 → 11.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -223,7 +223,7 @@ function isTimeZone(name) {
223
223
  return false;
224
224
  }
225
225
  }
226
- var CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_TIER_MODELS, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_TIER_MODELS, CodexProviderConfigSchema, ProviderRouteSchema, HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, ProviderSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
226
+ var CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, ANTIGRAVITY_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_TIERS, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, ProviderSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
227
227
  var init_schema = __esm({
228
228
  "src/config/schema.ts"() {
229
229
  "use strict";
@@ -321,14 +321,17 @@ var init_schema = __esm({
321
321
  });
322
322
  PROVIDER_KINDS = ["http", "codex", "antigravity"];
323
323
  ANTIGRAVITY_MODES = ["cloud", "local"];
324
+ ANTIGRAVITY_TIERS = ["fable", "opus", "sonnet", "haiku"];
324
325
  ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
325
326
  ANTIGRAVITY_DEFAULT_MODE = "cloud";
327
+ ANTIGRAVITY_DEFAULT_MODEL = "gemini-3.8-flash-high";
326
328
  ANTIGRAVITY_DEFAULT_TIER_MODELS = Object.freeze({
327
329
  fable: ["gemini-4-argon-high", "claude-opus-5-5-high", "gemini-3.8-flash-high"],
328
330
  opus: ["claude-opus-5-5-high", "gemini-4-argon-high", "gemini-3.8-flash-high"],
329
331
  sonnet: ["claude-sonnet-5-5-medium", "gemini-4-argon-medium", "gemini-3.8-flash-medium"],
330
332
  haiku: ["gemini-3.8-flash-low", "gemini-4-argon-low", "claude-sonnet-5-5-low"]
331
333
  });
334
+ ANTIGRAVITY_DEFAULT_EFFORT = "low";
332
335
  AntigravityModelTargetSchema = z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]);
333
336
  AntigravityProviderConfigSchema = z.strictObject({
334
337
  /** Operational mode: direct cloud endpoint or local ACP daemon. Defaults to `cloud`. */
@@ -358,14 +361,18 @@ var init_schema = __esm({
358
361
  socketPath: z.string().min(1).optional()
359
362
  }).optional()
360
363
  });
364
+ CODEX_TIERS = ["fable", "opus", "sonnet", "haiku"];
361
365
  CODEX_EFFORTS = ["none", "low", "medium", "high"];
362
366
  CODEX_LOGINS = ["codex-cli", "chatgpt-sign-in"];
367
+ CODEX_DEFAULT_LOGIN = "codex-cli";
368
+ CODEX_DEFAULT_MODEL = "gpt-5.6-sol";
363
369
  CODEX_DEFAULT_TIER_MODELS = Object.freeze({
364
370
  fable: "gpt-5.6-sol",
365
371
  opus: "gpt-5.6-sol",
366
372
  sonnet: "gpt-5.6-terra",
367
373
  haiku: "gpt-5.6-luna"
368
374
  });
375
+ CODEX_DEFAULT_EFFORT = "low";
369
376
  CodexProviderConfigSchema = z.strictObject({
370
377
  /** The codex model a request maps to when no tier matches its model name. */
371
378
  defaultModel: z.string().min(1).optional(),
@@ -602,7 +609,7 @@ function parseIgnoringUnrecognisedKeys(schema, raw) {
602
609
  return second.success ? { success: true, data: second.data, ignored } : { success: false, issues: second.error.issues };
603
610
  }
604
611
  function describeIgnoredKeys(filePath, ignored) {
605
- const places = ignored.map(({ path: path41, keys }) => `${path41.length === 0 ? "" : `${path41.map(String).join(".")}.`}${keys.join(", ")}`);
612
+ const places = ignored.map(({ path: path42, keys }) => `${path42.length === 0 ? "" : `${path42.map(String).join(".")}.`}${keys.join(", ")}`);
606
613
  return `${filePath} has settings this version of agent-shim does not know and ignores: ${places.join("; ")}. A newer release may read them.`;
607
614
  }
608
615
  function noteIgnoredKeys(filePath, ignored) {
@@ -624,9 +631,9 @@ function restoreIgnoredKeys(filePath, value) {
624
631
  return value;
625
632
  }
626
633
  const restored = structuredClone(value);
627
- for (const { path: path41, values } of ignored) {
634
+ for (const { path: path42, values } of ignored) {
628
635
  let holder = restored;
629
- for (const step of path41) {
636
+ for (const step of path42) {
630
637
  holder = isRecord(holder) ? holder[step] : void 0;
631
638
  }
632
639
  if (isRecord(holder)) {
@@ -2904,7 +2911,7 @@ var init_package = __esm({
2904
2911
  "package.json"() {
2905
2912
  package_default = {
2906
2913
  name: "claude-use",
2907
- version: "11.22.0",
2914
+ version: "11.24.0",
2908
2915
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
2909
2916
  license: "MIT",
2910
2917
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -6706,6 +6713,49 @@ var init_providersStore = __esm({
6706
6713
  }
6707
6714
  });
6708
6715
 
6716
+ // src/usage/signIn.ts
6717
+ import { createHash as createHash6 } from "node:crypto";
6718
+ import path26 from "node:path";
6719
+ function claudeCodeKeychainService(configDir) {
6720
+ return `${KEYCHAIN_SERVICE_PREFIX}-${createHash6("sha256").update(configDir).digest("hex").slice(0, KEYCHAIN_SERVICE_HASH_DIGITS)}`;
6721
+ }
6722
+ function keychainHasItem(run, configDir) {
6723
+ return run.run("security", ["find-generic-password", "-s", claudeCodeKeychainService(configDir)]).status === 0;
6724
+ }
6725
+ function decideSignIn(facts) {
6726
+ if (facts.hasCredentialBlock) {
6727
+ return { state: "token", detail: "supplies its own credential through a credential block, so a stored login is not what a launch uses" };
6728
+ }
6729
+ if (facts.keychainItem === true) {
6730
+ return { state: "signed-in", detail: "a login is stored in the macOS Keychain" };
6731
+ }
6732
+ if (facts.credentialsFile) {
6733
+ return { state: "signed-in", detail: `a login is stored in ${CREDENTIALS_FILE}` };
6734
+ }
6735
+ return { state: "signed-out", detail: facts.platform === "darwin" ? `no Keychain item and no ${CREDENTIALS_FILE}` : `no ${CREDENTIALS_FILE}` };
6736
+ }
6737
+ function credentialsFilePath(farmRoot) {
6738
+ return path26.join(farmRoot, CREDENTIALS_FILE);
6739
+ }
6740
+ function identitySignIn(fs13, probe, identity) {
6741
+ const probing = !identity.hasCredentialBlock;
6742
+ return decideSignIn({
6743
+ hasCredentialBlock: identity.hasCredentialBlock,
6744
+ keychainItem: probing && probe.platform === "darwin" && probe.run !== void 0 ? keychainHasItem(probe.run, identity.farmRoot) : void 0,
6745
+ credentialsFile: probing && fs13.lstat(credentialsFilePath(identity.farmRoot)) !== void 0,
6746
+ platform: probe.platform
6747
+ });
6748
+ }
6749
+ var CREDENTIALS_FILE, KEYCHAIN_SERVICE_PREFIX, KEYCHAIN_SERVICE_HASH_DIGITS;
6750
+ var init_signIn = __esm({
6751
+ "src/usage/signIn.ts"() {
6752
+ "use strict";
6753
+ CREDENTIALS_FILE = ".credentials.json";
6754
+ KEYCHAIN_SERVICE_PREFIX = "Claude Code-credentials";
6755
+ KEYCHAIN_SERVICE_HASH_DIGITS = 8;
6756
+ }
6757
+ });
6758
+
6709
6759
  // src/cli/bool.ts
6710
6760
  function parseBoolWord(input) {
6711
6761
  switch (input) {
@@ -6855,17 +6905,17 @@ var init_commandDeps = __esm({
6855
6905
 
6856
6906
  // src/claudeShim.ts
6857
6907
  import fs8 from "node:fs";
6858
- import path27 from "node:path";
6908
+ import path28 from "node:path";
6859
6909
  import { z as z19 } from "zod";
6860
6910
  function commandFilename(ownExecutablePath, commandName) {
6861
6911
  return ownExecutablePath.toLowerCase().endsWith(".exe") ? `${commandName}.exe` : commandName;
6862
6912
  }
6863
6913
  function resolveOwnBinaryCheck(paths, contentSourcePath) {
6864
6914
  const state = readJson(paths.claudeShimFile, ClaudeShimStateSchema);
6865
- const recordedTarget = state === void 0 ? void 0 : path27.resolve(state.targetPath);
6915
+ const recordedTarget = state === void 0 ? void 0 : path28.resolve(state.targetPath);
6866
6916
  let ownStat;
6867
6917
  return (candidate) => {
6868
- if (recordedTarget !== void 0 && path27.resolve(candidate) === recordedTarget) {
6918
+ if (recordedTarget !== void 0 && path28.resolve(candidate) === recordedTarget) {
6869
6919
  return true;
6870
6920
  }
6871
6921
  ownStat ??= statOrUndefined(contentSourcePath);
@@ -6888,15 +6938,15 @@ function statOrUndefined(target) {
6888
6938
  }
6889
6939
  }
6890
6940
  function findPathShadow(params) {
6891
- const resolvedTargetDir = path27.resolve(params.targetDir);
6941
+ const resolvedTargetDir = path28.resolve(params.targetDir);
6892
6942
  for (const dir of params.pathDirs) {
6893
6943
  const found = params.findExecutableInDir(dir, params.targetFilename);
6894
6944
  if (found === void 0) {
6895
6945
  continue;
6896
6946
  }
6897
- return path27.resolve(dir) === resolvedTargetDir ? { status: "ok" } : { status: "shadowed", by: found };
6947
+ return path28.resolve(dir) === resolvedTargetDir ? { status: "ok" } : { status: "shadowed", by: found };
6898
6948
  }
6899
- return params.pathDirs.some((dir) => path27.resolve(dir) === resolvedTargetDir) ? { status: "ok" } : { status: "not-on-path" };
6949
+ return params.pathDirs.some((dir) => path28.resolve(dir) === resolvedTargetDir) ? { status: "ok" } : { status: "not-on-path" };
6900
6950
  }
6901
6951
  var ClaudeShimStateSchema, nodeLinkFs;
6902
6952
  var init_claudeShim = __esm({
@@ -7554,7 +7604,7 @@ function buildEnv(params) {
7554
7604
  }
7555
7605
  }
7556
7606
  if (params.provider !== void 0) {
7557
- env.ANTHROPIC_AUTH_TOKEN = void 0;
7607
+ env.ANTHROPIC_AUTH_TOKEN = params.remoteControl ? void 0 : PROVIDER_SESSION_PLACEHOLDER;
7558
7608
  env.ANTHROPIC_API_KEY = void 0;
7559
7609
  env.CLAUDE_CODE_OAUTH_TOKEN = void 0;
7560
7610
  } else if (params.identityCredential !== void 0) {
@@ -7586,7 +7636,7 @@ function buildEnv(params) {
7586
7636
  }
7587
7637
  return env;
7588
7638
  }
7589
- var LOOPBACK_HOSTS;
7639
+ var LOOPBACK_HOSTS, PROVIDER_SESSION_PLACEHOLDER;
7590
7640
  var init_flags = __esm({
7591
7641
  "src/launcher/flags.ts"() {
7592
7642
  "use strict";
@@ -7596,6 +7646,7 @@ var init_flags = __esm({
7596
7646
  init_capability();
7597
7647
  init_route();
7598
7648
  LOOPBACK_HOSTS = ["127.0.0.1", "localhost", "::1"];
7649
+ PROVIDER_SESSION_PLACEHOLDER = "agent-shim-provider-session";
7599
7650
  }
7600
7651
  });
7601
7652
 
@@ -7724,13 +7775,43 @@ function withConversation(passthrough, conversation, id) {
7724
7775
  }
7725
7776
  return [...kept, conversation === "start" ? "--session-id" : "--resume", id, ...tail];
7726
7777
  }
7778
+ function hasSettingsArgument(passthrough) {
7779
+ const end = passthrough.indexOf(TERMINATOR2);
7780
+ return (end === -1 ? passthrough : passthrough.slice(0, end)).some((token) => token === "--settings" || token.startsWith("--settings="));
7781
+ }
7727
7782
  function withSupervision(passthrough, supervised) {
7728
- const conversation = supervised.conversation === "as-given" ? passthrough : withConversation(passthrough, supervised.conversation, supervised.sessionId);
7729
- if (supervised.settings === void 0) {
7730
- return conversation;
7783
+ return supervised.conversation === "as-given" ? passthrough : withConversation(passthrough, supervised.conversation, supervised.sessionId);
7784
+ }
7785
+ function withLauncherSettings(passthrough, settings) {
7786
+ if (settings === void 0) {
7787
+ return passthrough;
7788
+ }
7789
+ const end = passthrough.indexOf(TERMINATOR2);
7790
+ return end === -1 ? [...passthrough, "--settings", settings] : [...passthrough.slice(0, end), "--settings", settings, ...passthrough.slice(end)];
7791
+ }
7792
+ function isRecord15(value) {
7793
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7794
+ }
7795
+ function mergeSettings(parts) {
7796
+ const merged = {};
7797
+ let any = false;
7798
+ for (const part of parts) {
7799
+ if (part === void 0) {
7800
+ continue;
7801
+ }
7802
+ const parsed = JSON.parse(part);
7803
+ if (!isRecord15(parsed)) {
7804
+ throw new Error("a launch's settings part is not a JSON object");
7805
+ }
7806
+ for (const [key, value] of Object.entries(parsed)) {
7807
+ if (key in merged) {
7808
+ throw new Error(`two launch settings parts both set "${key}"`);
7809
+ }
7810
+ merged[key] = value;
7811
+ }
7812
+ any = true;
7731
7813
  }
7732
- const end = conversation.indexOf(TERMINATOR2);
7733
- return end === -1 ? [...conversation, "--settings", supervised.settings] : [...conversation.slice(0, end), "--settings", supervised.settings, ...conversation.slice(end)];
7814
+ return any ? JSON.stringify(merged) : void 0;
7734
7815
  }
7735
7816
  var TERMINATOR2, VALUED_CONVERSATION_FLAGS, CONTINUE_FLAGS;
7736
7817
  var init_claudeSession = __esm({
@@ -7743,6 +7824,253 @@ var init_claudeSession = __esm({
7743
7824
  }
7744
7825
  });
7745
7826
 
7827
+ // src/antigravity/cloudUpstream.ts
7828
+ var init_cloudUpstream = __esm({
7829
+ "src/antigravity/cloudUpstream.ts"() {
7830
+ "use strict";
7831
+ }
7832
+ });
7833
+
7834
+ // src/antigravity/quota.ts
7835
+ var SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY4, FIVE_HOUR_PERIOD_SECONDS, WEEK_PERIOD_SECONDS;
7836
+ var init_quota = __esm({
7837
+ "src/antigravity/quota.ts"() {
7838
+ "use strict";
7839
+ init_cloudUpstream();
7840
+ SECONDS_PER_HOUR = 3600;
7841
+ HOURS_PER_FIVE_HOUR_WINDOW = 5;
7842
+ DAYS_PER_WEEK = 7;
7843
+ HOURS_PER_DAY4 = 24;
7844
+ FIVE_HOUR_PERIOD_SECONDS = HOURS_PER_FIVE_HOUR_WINDOW * SECONDS_PER_HOUR;
7845
+ WEEK_PERIOD_SECONDS = DAYS_PER_WEEK * HOURS_PER_DAY4 * SECONDS_PER_HOUR;
7846
+ }
7847
+ });
7848
+
7849
+ // src/antigravity/signatures.ts
7850
+ var init_signatures = __esm({
7851
+ "src/antigravity/signatures.ts"() {
7852
+ "use strict";
7853
+ }
7854
+ });
7855
+
7856
+ // src/codex/anthropic.ts
7857
+ import { z as z29 } from "zod";
7858
+ var TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
7859
+ var init_anthropic = __esm({
7860
+ "src/codex/anthropic.ts"() {
7861
+ "use strict";
7862
+ TextBlockSchema = z29.looseObject({ type: z29.literal("text"), text: z29.string() });
7863
+ Base64ImageSourceSchema = z29.looseObject({ type: z29.literal("base64"), media_type: z29.string().min(1), data: z29.string() });
7864
+ UrlImageSourceSchema = z29.looseObject({ type: z29.literal("url"), url: z29.string().min(1) });
7865
+ ImageBlockSchema = z29.looseObject({
7866
+ type: z29.literal("image"),
7867
+ source: z29.union([Base64ImageSourceSchema, UrlImageSourceSchema])
7868
+ });
7869
+ ToolUseBlockSchema = z29.looseObject({
7870
+ type: z29.literal("tool_use"),
7871
+ id: z29.string().min(1),
7872
+ name: z29.string().min(1),
7873
+ input: z29.unknown()
7874
+ });
7875
+ ToolResultContentBlockSchema = z29.union([TextBlockSchema, z29.looseObject({ type: z29.string() })]);
7876
+ ToolResultBlockSchema = z29.looseObject({
7877
+ type: z29.literal("tool_result"),
7878
+ tool_use_id: z29.string().min(1),
7879
+ content: z29.union([z29.string(), z29.array(ToolResultContentBlockSchema)]).optional()
7880
+ });
7881
+ OtherBlockSchema = z29.looseObject({ type: z29.string() });
7882
+ ContentBlockSchema = z29.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
7883
+ MessageSchema = z29.looseObject({
7884
+ role: z29.enum(["user", "assistant", "system"]),
7885
+ content: z29.union([z29.string(), z29.array(ContentBlockSchema)])
7886
+ });
7887
+ ToolSchema = z29.looseObject({
7888
+ name: z29.string().min(1),
7889
+ description: z29.string().optional(),
7890
+ input_schema: z29.record(z29.string(), z29.unknown()).optional()
7891
+ });
7892
+ ToolChoiceSchema = z29.union([
7893
+ z29.looseObject({ type: z29.enum(["auto", "none", "any"]) }),
7894
+ z29.looseObject({ type: z29.literal("tool"), name: z29.string().min(1) })
7895
+ ]);
7896
+ SystemSchema = z29.union([z29.string(), z29.array(z29.union([TextBlockSchema, OtherBlockSchema]))]);
7897
+ MessagesRequestSchema = z29.looseObject({
7898
+ model: z29.string().optional(),
7899
+ system: SystemSchema.optional(),
7900
+ messages: z29.array(MessageSchema),
7901
+ tools: z29.array(ToolSchema).optional(),
7902
+ tool_choice: ToolChoiceSchema.optional(),
7903
+ stream: z29.boolean().optional(),
7904
+ /** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
7905
+ metadata: z29.looseObject({ user_id: z29.string().optional() }).optional(),
7906
+ /** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
7907
+ output_config: z29.looseObject({ effort: z29.string().optional() }).optional()
7908
+ });
7909
+ CountTokensRequestSchema = z29.looseObject({
7910
+ system: z29.unknown().optional(),
7911
+ messages: z29.unknown().optional(),
7912
+ tools: z29.unknown().optional()
7913
+ });
7914
+ }
7915
+ });
7916
+
7917
+ // src/antigravity/translate.ts
7918
+ function candidatesOf(target) {
7919
+ return typeof target === "string" ? [target] : target;
7920
+ }
7921
+ function isAntigravityTier(key) {
7922
+ return ANTIGRAVITY_TIERS.some((tier) => tier === key);
7923
+ }
7924
+ function resolveAntigravityConfig(config) {
7925
+ const overrides = config?.models ?? {};
7926
+ const aliases = /* @__PURE__ */ new Map();
7927
+ for (const [key, target] of Object.entries(overrides)) {
7928
+ if (!isAntigravityTier(key)) {
7929
+ aliases.set(key.toLowerCase(), candidatesOf(target));
7930
+ }
7931
+ }
7932
+ const tierModel = (tier) => {
7933
+ const target = overrides[tier];
7934
+ return target === void 0 ? ANTIGRAVITY_DEFAULT_TIER_MODELS[tier] : candidatesOf(target);
7935
+ };
7936
+ return {
7937
+ mode: config?.mode ?? ANTIGRAVITY_DEFAULT_MODE,
7938
+ defaultModel: config?.defaultModel ?? ANTIGRAVITY_DEFAULT_MODEL,
7939
+ models: { fable: tierModel("fable"), opus: tierModel("opus"), sonnet: tierModel("sonnet"), haiku: tierModel("haiku") },
7940
+ aliases,
7941
+ degradeDownTiers: config?.degradeDownTiers ?? false,
7942
+ effort: config?.effort ?? ANTIGRAVITY_DEFAULT_EFFORT,
7943
+ cloud: {
7944
+ endpoint: config?.cloud?.endpoint,
7945
+ projectId: config?.cloud?.projectId,
7946
+ location: config?.cloud?.location
7947
+ },
7948
+ local: {
7949
+ command: config?.local?.command,
7950
+ socketPath: config?.local?.socketPath
7951
+ }
7952
+ };
7953
+ }
7954
+ var init_translate = __esm({
7955
+ "src/antigravity/translate.ts"() {
7956
+ "use strict";
7957
+ init_quota();
7958
+ init_signatures();
7959
+ init_schema();
7960
+ init_anthropic();
7961
+ }
7962
+ });
7963
+
7964
+ // src/codex/translate.ts
7965
+ function resolveCodexConfig(config) {
7966
+ const overrides = config?.models;
7967
+ return {
7968
+ defaultModel: config?.defaultModel ?? CODEX_DEFAULT_MODEL,
7969
+ models: {
7970
+ fable: overrides?.fable ?? CODEX_DEFAULT_TIER_MODELS.fable,
7971
+ opus: overrides?.opus ?? CODEX_DEFAULT_TIER_MODELS.opus,
7972
+ sonnet: overrides?.sonnet ?? CODEX_DEFAULT_TIER_MODELS.sonnet,
7973
+ haiku: overrides?.haiku ?? CODEX_DEFAULT_TIER_MODELS.haiku
7974
+ },
7975
+ effort: config?.effort ?? CODEX_DEFAULT_EFFORT,
7976
+ login: config?.login ?? CODEX_DEFAULT_LOGIN
7977
+ };
7978
+ }
7979
+ var init_translate2 = __esm({
7980
+ "src/codex/translate.ts"() {
7981
+ "use strict";
7982
+ init_schema();
7983
+ init_anthropic();
7984
+ }
7985
+ });
7986
+
7987
+ // src/launcher/modelPicker.ts
7988
+ function joined(parts) {
7989
+ const last = parts[parts.length - 1];
7990
+ return last === void 0 || parts.length === 1 ? last ?? "" : `${parts.slice(0, -1).join(", ")} and ${last}`;
7991
+ }
7992
+ function rowOf2(model, reaches) {
7993
+ const lead = reaches.find((reach) => reach.standing === "first") ?? reaches[0];
7994
+ if (lead === void 0) {
7995
+ throw new Error(`model ${model} is reached by no tier`);
7996
+ }
7997
+ const firsts = reaches.filter((reach) => reach.standing === "first").map((reach) => reach.tier);
7998
+ const fallbacks = reaches.filter((reach) => reach.standing === "fallback").map((reach) => reach.tier);
7999
+ const serves = firsts.length === 0 ? [] : [`Serves the ${joined(firsts)} tier${firsts.length === 1 ? "" : "s"}`];
8000
+ const falls = fallbacks.length === 0 ? [] : [`${serves.length === 0 ? "Fallback" : "fallback"} for ${joined(fallbacks)}`];
8001
+ return { model, label: model, description: [...serves, ...falls].join("; "), behavesAs: TIER_BEHAVES_AS[lead.tier] };
8002
+ }
8003
+ function rowsOfTable(table) {
8004
+ const reachesByModel = /* @__PURE__ */ new Map();
8005
+ for (const [tier, candidates] of table) {
8006
+ candidates.forEach((model, index) => {
8007
+ const reaches = reachesByModel.get(model) ?? [];
8008
+ if (!reaches.some((reach) => reach.tier === tier)) {
8009
+ reaches.push({ tier, standing: index === 0 ? "first" : "fallback" });
8010
+ }
8011
+ reachesByModel.set(model, reaches);
8012
+ });
8013
+ }
8014
+ return [...reachesByModel].map(([model, reaches]) => rowOf2(model, reaches));
8015
+ }
8016
+ function antigravityRows(provider) {
8017
+ const config = resolveAntigravityConfig(provider.antigravity);
8018
+ const tiers = rowsOfTable(ANTIGRAVITY_TIERS.map((tier) => [tier, config.models[tier]]));
8019
+ const behavesAsOf = new Map(tiers.map((row) => [row.model, row.behavesAs]));
8020
+ const aliases = [...config.aliases].flatMap(([alias, candidates]) => {
8021
+ const [first] = candidates;
8022
+ const behavesAs = first === void 0 ? void 0 : behavesAsOf.get(first);
8023
+ return behavesAs === void 0 ? [] : [{ model: alias, label: alias, description: `Alias for ${candidates.join(", then ")}`, behavesAs }];
8024
+ });
8025
+ return [...tiers, ...aliases];
8026
+ }
8027
+ function codexRows(provider) {
8028
+ const config = resolveCodexConfig(provider.codex);
8029
+ return rowsOfTable(CODEX_TIERS.map((tier) => [tier, [config.models[tier]]]));
8030
+ }
8031
+ function httpRows(provider) {
8032
+ const env = provider.env ?? {};
8033
+ const table = CODEX_TIERS.flatMap((tier) => {
8034
+ const model = env[TIER_ENV_VARIABLES[tier]];
8035
+ return model === void 0 || model === "" ? [] : [[tier, [model]]];
8036
+ });
8037
+ return rowsOfTable(table);
8038
+ }
8039
+ function providerModelRows(provider) {
8040
+ if (provider.kind === "codex") {
8041
+ return codexRows(provider);
8042
+ }
8043
+ if (provider.kind === "antigravity") {
8044
+ return antigravityRows(provider);
8045
+ }
8046
+ return httpRows(provider);
8047
+ }
8048
+ function modelPickerSettings(provider) {
8049
+ const options = providerModelRows(provider);
8050
+ return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions: true } });
8051
+ }
8052
+ var TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
8053
+ var init_modelPicker = __esm({
8054
+ "src/launcher/modelPicker.ts"() {
8055
+ "use strict";
8056
+ init_translate();
8057
+ init_translate2();
8058
+ init_schema();
8059
+ TIER_BEHAVES_AS = Object.freeze({
8060
+ fable: "claude-fable-5-1",
8061
+ opus: "claude-opus-5-5",
8062
+ sonnet: "claude-sonnet-5-5",
8063
+ haiku: "claude-haiku-5-5"
8064
+ });
8065
+ TIER_ENV_VARIABLES = Object.freeze({
8066
+ fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
8067
+ opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
8068
+ sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
8069
+ haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
8070
+ });
8071
+ }
8072
+ });
8073
+
7746
8074
  // src/launcher/pool.ts
7747
8075
  function isResuming(passthrough) {
7748
8076
  const end = passthrough.indexOf(TERMINATOR3);
@@ -8154,7 +8482,7 @@ function decideLaunch(params, readOnly) {
8154
8482
  }
8155
8483
  const pinnedVersion = resolveClaudeVersion({ env, ...parsedArgv.claudeVersion === void 0 ? {} : { flag: parsedArgv.claudeVersion }, ...cascadeLaunch?.claudeVersion === void 0 ? {} : { cascade: cascadeLaunch.claudeVersion } });
8156
8484
  const discovered = params.resolveClaudeBinary(pinnedVersion === void 0 ? void 0 : { version: pinnedVersion.version });
8157
- const flags = resolveLaunchFlags({
8485
+ const requestedFlags = resolveLaunchFlags({
8158
8486
  env,
8159
8487
  ...cascadeLaunch === void 0 ? {} : { cascade: cascadeLaunch },
8160
8488
  flags: {
@@ -8164,10 +8492,21 @@ function decideLaunch(params, readOnly) {
8164
8492
  ...parsedArgv.trackUsage === void 0 ? {} : { trackUsage: parsedArgv.trackUsage }
8165
8493
  }
8166
8494
  });
8495
+ const loginlessProvider = requestedFlags.remoteControl && selectedProvider !== void 0 && farmIdentity !== void 0 && params.hasStoredLogin?.(farmIdentity) === false ? { identity: farmIdentity, provider: selectedProvider.name } : void 0;
8496
+ if (loginlessProvider !== void 0 && !readOnly) {
8497
+ log.info(`agent-shim: identity ${loginlessProvider.identity} has no stored login, so Remote Control, which needs one, is off for this launch; provider ${loginlessProvider.provider} runs without it`);
8498
+ }
8499
+ const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
8500
+ const pickerSettings = selectedProvider === void 0 ? void 0 : modelPickerSettings(selectedProvider.definition);
8501
+ const callerSettings = hasSettingsArgument(parsedArgv.rest);
8502
+ if (pickerSettings !== void 0 && callerSettings && !readOnly) {
8503
+ log.info("agent-shim: this launch passes its own --settings, so /model keeps Claude Code's own model names instead of listing the provider's models");
8504
+ }
8505
+ const launcherSettings = mergeSettings([params.supervised?.settings, callerSettings ? void 0 : pickerSettings]);
8167
8506
  const args = buildArgv({
8168
8507
  toolFlags: buildFlagArgs(flags),
8169
8508
  extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
8170
- passthrough: params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised)
8509
+ passthrough: withLauncherSettings(params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised), launcherSettings)
8171
8510
  });
8172
8511
  const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : path38.join(paths.identitiesDir, identityDecision.name);
8173
8512
  const decision = {
@@ -8289,7 +8628,8 @@ function prepareLaunch(params) {
8289
8628
  ...identityCredential === void 0 ? {} : { identityCredential },
8290
8629
  ...frontDoor === void 0 ? {} : { frontdoor: frontDoor },
8291
8630
  ...headroom === void 0 ? {} : { headroom },
8292
- sessionId
8631
+ sessionId,
8632
+ remoteControl: resolvedFlags.remoteControl
8293
8633
  });
8294
8634
  const releases = [...headroom === void 0 || headroomPort === void 0 ? [] : [headroomPort.release], ...frontDoorRelease === void 0 ? [] : [frontDoorRelease]];
8295
8635
  const release = () => {
@@ -8311,7 +8651,8 @@ function resolveLaunch(params) {
8311
8651
  ...decided.provider === void 0 ? {} : { provider: decided.provider },
8312
8652
  ...frontDoor ? { frontdoor: { port: 0, connectPort: 0, trustBundlePath: "", sessionToken: "" } } : {},
8313
8653
  ...decided.flags.headroom ? { headroom: { socketPath: "", projectId: "" } } : {},
8314
- sessionId: ""
8654
+ sessionId: "",
8655
+ remoteControl: decided.flags.remoteControl
8315
8656
  });
8316
8657
  const credentialNames = decided.identityCredentialBlock === void 0 ? [] : Object.keys(credentialVariables(decided.identityCredentialBlock.target ?? "bearer", ""));
8317
8658
  const environment = [.../* @__PURE__ */ new Set([...Object.keys(built).filter((name) => built[name] !== env[name]), ...credentialNames])].sort();
@@ -8355,6 +8696,7 @@ var init_launcher = __esm({
8355
8696
  init_flags();
8356
8697
  init_extraFlags();
8357
8698
  init_claudeSession();
8699
+ init_modelPicker();
8358
8700
  init_pool();
8359
8701
  init_resumeContext();
8360
8702
  init_lock();
@@ -8407,7 +8749,7 @@ var init_selfIdentity = __esm({
8407
8749
  });
8408
8750
 
8409
8751
  // src/frontdoor/trust.ts
8410
- import { createHash as createHash6 } from "node:crypto";
8752
+ import { createHash as createHash7 } from "node:crypto";
8411
8753
  import path40 from "node:path";
8412
8754
  function resolveTrustBundle(params) {
8413
8755
  const { caCertFile, bundlesDir, variable, inherited, fs: fs13 } = params;
@@ -8429,7 +8771,7 @@ function resolveTrustBundle(params) {
8429
8771
  }
8430
8772
  const combined = `${inheritedPem.trimEnd()}
8431
8773
  ${caPem}`;
8432
- const bundle = path40.join(bundlesDir, `${createHash6("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
8774
+ const bundle = path40.join(bundlesDir, `${createHash7("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
8433
8775
  if (!fs13.exists(bundle)) {
8434
8776
  fs13.mkdirp(bundlesDir);
8435
8777
  fs13.writeFileAtomic(bundle, combined);
@@ -8507,6 +8849,7 @@ var init_realFrontDoorPort = __esm({
8507
8849
 
8508
8850
  // src/launchWiring.ts
8509
8851
  import os8 from "node:os";
8852
+ import path41 from "node:path";
8510
8853
  import { randomUUID as randomUUID5 } from "node:crypto";
8511
8854
  function buildFarmRuntime(paths, cwd) {
8512
8855
  const home = os8.homedir();
@@ -8560,6 +8903,7 @@ function realPrepareLaunchParams(paths, options) {
8560
8903
  headroom: realHeadroomPort(paths, { spawnDaemon: options.spawnDaemon, cwd: farm.runtime.cwd }),
8561
8904
  frontdoor: realFrontDoorPort(paths, options.spawnDaemon),
8562
8905
  credentials: { ...realCredentialPort, cache: realCredentialCacheEnv(paths) },
8906
+ hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: path41.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
8563
8907
  ...farm.directoryIdentity === void 0 ? {} : { directoryPinnedIdentity: farm.directoryIdentity },
8564
8908
  ...farm.directoryConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: farm.directoryConfigProfile },
8565
8909
  ...farm.globalDefaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: farm.globalDefaultConfigProfile },
@@ -8631,6 +8975,7 @@ var init_launchWiring = __esm({
8631
8975
  init_launchHook();
8632
8976
  init_cascade();
8633
8977
  init_paths();
8978
+ init_signIn();
8634
8979
  init_realPorts();
8635
8980
  LaunchRefusedError = class extends CliError {
8636
8981
  exitCode;
@@ -8832,84 +9177,77 @@ var init_identityClaude = __esm({
8832
9177
  }
8833
9178
  });
8834
9179
 
8835
- // src/antigravity/cloudUpstream.ts
8836
- var init_cloudUpstream = __esm({
8837
- "src/antigravity/cloudUpstream.ts"() {
8838
- "use strict";
8839
- }
8840
- });
8841
-
8842
9180
  // src/usage/providerQuota.ts
8843
- import { z as z29 } from "zod";
8844
- var MS_PER_SECOND7, SECONDS_PER_HOUR, HOURS_PER_DAY4, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
9181
+ import { z as z30 } from "zod";
9182
+ var MS_PER_SECOND7, SECONDS_PER_HOUR2, HOURS_PER_DAY5, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
8845
9183
  var init_providerQuota = __esm({
8846
9184
  "src/usage/providerQuota.ts"() {
8847
9185
  "use strict";
8848
9186
  init_cloudUpstream();
8849
9187
  init_schema2();
8850
9188
  MS_PER_SECOND7 = 1e3;
8851
- SECONDS_PER_HOUR = 3600;
8852
- HOURS_PER_DAY4 = 24;
9189
+ SECONDS_PER_HOUR2 = 3600;
9190
+ HOURS_PER_DAY5 = 24;
8853
9191
  DAYS_PER_MONTH = 30;
8854
9192
  ZAI_HOST = "api.z.ai";
8855
9193
  ZAI_QUOTA_URL = `https://${ZAI_HOST}/api/monitor/usage/quota/limit`;
8856
9194
  ZAI_UNIT_HOURS = 3;
8857
9195
  ZAI_UNIT_MONTHS = 5;
8858
9196
  ZAI_UNIT_MS = /* @__PURE__ */ new Map([
8859
- [ZAI_UNIT_HOURS, SECONDS_PER_HOUR * MS_PER_SECOND7],
8860
- [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7]
9197
+ [ZAI_UNIT_HOURS, SECONDS_PER_HOUR2 * MS_PER_SECOND7],
9198
+ [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7]
8861
9199
  ]);
8862
- ZaiLimitSchema = z29.object({
8863
- type: z29.string(),
8864
- unit: z29.number().int(),
8865
- number: z29.number().int().positive(),
8866
- percentage: z29.number().nonnegative(),
8867
- nextResetTime: z29.number().positive().optional(),
8868
- usage: z29.number().nonnegative().optional(),
8869
- currentValue: z29.number().nonnegative().optional(),
8870
- remaining: z29.number().nonnegative().optional()
9200
+ ZaiLimitSchema = z30.object({
9201
+ type: z30.string(),
9202
+ unit: z30.number().int(),
9203
+ number: z30.number().int().positive(),
9204
+ percentage: z30.number().nonnegative(),
9205
+ nextResetTime: z30.number().positive().optional(),
9206
+ usage: z30.number().nonnegative().optional(),
9207
+ currentValue: z30.number().nonnegative().optional(),
9208
+ remaining: z30.number().nonnegative().optional()
8871
9209
  });
8872
- ZaiResponseSchema = z29.object({
8873
- success: z29.boolean(),
8874
- msg: z29.string().optional(),
8875
- data: z29.object({ level: z29.string().optional(), limits: z29.array(ZaiLimitSchema) })
9210
+ ZaiResponseSchema = z30.object({
9211
+ success: z30.boolean(),
9212
+ msg: z30.string().optional(),
9213
+ data: z30.object({ level: z30.string().optional(), limits: z30.array(ZaiLimitSchema) })
8876
9214
  });
8877
9215
  OPENROUTER_HOST = "openrouter.ai";
8878
9216
  OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
8879
9217
  OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
8880
- MS_PER_DAY3 = HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7;
8881
- OpenRouterKeySchema = z29.object({
8882
- data: z29.object({
8883
- limit: z29.number().nonnegative().nullable(),
8884
- limit_remaining: z29.number().nullable(),
8885
- limit_reset: z29.string().nullable(),
8886
- is_free_tier: z29.boolean().optional(),
8887
- free_model_daily_requests: z29.object({ used: z29.number().nonnegative(), limit: z29.number().nonnegative(), remaining: z29.number() }).optional()
9218
+ MS_PER_DAY3 = HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
9219
+ OpenRouterKeySchema = z30.object({
9220
+ data: z30.object({
9221
+ limit: z30.number().nonnegative().nullable(),
9222
+ limit_remaining: z30.number().nullable(),
9223
+ limit_reset: z30.string().nullable(),
9224
+ is_free_tier: z30.boolean().optional(),
9225
+ free_model_daily_requests: z30.object({ used: z30.number().nonnegative(), limit: z30.number().nonnegative(), remaining: z30.number() }).optional()
8888
9226
  })
8889
9227
  });
8890
- OpenRouterCreditsSchema = z29.object({ data: z29.object({ total_credits: z29.number().nonnegative(), total_usage: z29.number().nonnegative() }) });
9228
+ OpenRouterCreditsSchema = z30.object({ data: z30.object({ total_credits: z30.number().nonnegative(), total_usage: z30.number().nonnegative() }) });
8891
9229
  ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
8892
9230
  ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
8893
9231
  ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
8894
9232
  FIVE_HOURS2 = 5;
8895
- DAYS_PER_WEEK = 7;
8896
- FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR * MS_PER_SECOND7;
8897
- WEEK_MS = DAYS_PER_WEEK * HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7;
8898
- AntigravityBucketSchema = z29.object({
8899
- bucketId: z29.string(),
8900
- remainingFraction: z29.number().optional(),
8901
- resetTime: z29.string().optional()
9233
+ DAYS_PER_WEEK2 = 7;
9234
+ FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
9235
+ WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
9236
+ AntigravityBucketSchema = z30.object({
9237
+ bucketId: z30.string(),
9238
+ remainingFraction: z30.number().optional(),
9239
+ resetTime: z30.string().optional()
8902
9240
  });
8903
- AntigravitySummarySchema = z29.object({ groups: z29.array(z29.object({ buckets: z29.array(AntigravityBucketSchema) })) });
8904
- GoogleTokenInfoSchema = z29.object({
8905
- email: z29.string().optional(),
8906
- sub: z29.string().optional()
9241
+ AntigravitySummarySchema = z30.object({ groups: z30.array(z30.object({ buckets: z30.array(AntigravityBucketSchema) })) });
9242
+ GoogleTokenInfoSchema = z30.object({
9243
+ email: z30.string().optional(),
9244
+ sub: z30.string().optional()
8907
9245
  });
8908
- AntigravityUserSchema = z29.object({
9246
+ AntigravityUserSchema = z30.object({
8909
9247
  /** The code-assist tier context, which defaults to the free tier for every account. */
8910
- currentTier: z29.object({ name: z29.string().optional(), id: z29.string().optional() }).optional(),
9248
+ currentTier: z30.object({ name: z30.string().optional(), id: z30.string().optional() }).optional(),
8911
9249
  /** The account's paid subscription; absent when the account has none. */
8912
- paidTier: z29.object({ name: z29.string().optional(), id: z29.string().optional() }).optional()
9250
+ paidTier: z30.object({ name: z30.string().optional(), id: z30.string().optional() }).optional()
8913
9251
  });
8914
9252
  }
8915
9253
  });
@@ -9538,8 +9876,8 @@ function parseConnectTarget(authority) {
9538
9876
  function isInterceptedHost(host, interceptHosts) {
9539
9877
  return interceptHosts.includes(host);
9540
9878
  }
9541
- function servedByPipeline(path41) {
9542
- return path41?.startsWith(ROUTED_PATH_PREFIX) === true;
9879
+ function servedByPipeline(path42) {
9880
+ return path42?.startsWith(ROUTED_PATH_PREFIX) === true;
9543
9881
  }
9544
9882
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
9545
9883
  "connection",
@@ -10333,11 +10671,11 @@ function createRcSessionTracker(deps) {
10333
10671
  };
10334
10672
  const observeExchange = (request4) => {
10335
10673
  const method = (request4.method ?? "").toUpperCase();
10336
- const path41 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
10337
- if (!path41.startsWith(RC_SESSIONS_PATH_PREFIX)) {
10674
+ const path42 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
10675
+ if (!path42.startsWith(RC_SESSIONS_PATH_PREFIX)) {
10338
10676
  return void 0;
10339
10677
  }
10340
- const tail = path41.slice(RC_SESSIONS_PATH_PREFIX.length);
10678
+ const tail = path42.slice(RC_SESSIONS_PATH_PREFIX.length);
10341
10679
  const facts = {
10342
10680
  oauthAuthorization: oauthAuthorizationOf(request4.headers),
10343
10681
  anthropicVersion: singleHeader(request4.headers, "anthropic-version"),
@@ -10727,8 +11065,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
10727
11065
  function isRcReadFileEncoding(value) {
10728
11066
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value);
10729
11067
  }
10730
- function buildRcReadFilePayload(requestId, path41, options) {
10731
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path41, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
11068
+ function buildRcReadFilePayload(requestId, path42, options) {
11069
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path42, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
10732
11070
  }
10733
11071
  function buildRcFileSuggestionsPayload(requestId, query) {
10734
11072
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -10830,15 +11168,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
10830
11168
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
10831
11169
  return result.ok ? { ...result, requestId } : result;
10832
11170
  }
10833
- async function readRcSessionFile(deps, sessionId, path41, options) {
10834
- if (path41 === "") {
11171
+ async function readRcSessionFile(deps, sessionId, path42, options) {
11172
+ if (path42 === "") {
10835
11173
  return { ok: false, message: "a read-file write needs a non-empty path: the SDK's own field names the file the worker resolves against the session's cwd, and an empty string names none" };
10836
11174
  }
10837
11175
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
10838
11176
  return { ok: false, message: "a read-file write's max-bytes is a positive whole number of bytes: the SDK's own field caps the read, and a zero or negative cap reads nothing" };
10839
11177
  }
10840
11178
  const requestId = deps.newUuid();
10841
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path41, options), `read ${path41} from session ${sessionId}`);
11179
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path42, options), `read ${path42} from session ${sessionId}`);
10842
11180
  return result.ok ? { ...result, requestId } : result;
10843
11181
  }
10844
11182
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -11007,11 +11345,11 @@ function createRcControlHandler(deps) {
11007
11345
  path: "read-file",
11008
11346
  read: (body) => {
11009
11347
  const session = bodyString(body, "session");
11010
- const path41 = bodyString(body, "path");
11348
+ const path42 = bodyString(body, "path");
11011
11349
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
11012
11350
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
11013
- const refused2 = session === void 0 || path41 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
11014
- return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path41, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
11351
+ const refused2 = session === void 0 || path42 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
11352
+ return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path42, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
11015
11353
  }
11016
11354
  },
11017
11355
  {
@@ -11321,9 +11659,9 @@ function requestIdOfBody(body) {
11321
11659
  }
11322
11660
  function frontDoorRcControl(transport, token) {
11323
11661
  const headers = { authorization: `Bearer ${token}` };
11324
- const listAnswerOf = async (path41, what) => {
11662
+ const listAnswerOf = async (path42, what) => {
11325
11663
  try {
11326
- return await transport.request({ method: "GET", path: path41, headers });
11664
+ return await transport.request({ method: "GET", path: path42, headers });
11327
11665
  } catch (error) {
11328
11666
  throw new Error(`${what}: could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
11329
11667
  }
@@ -11395,10 +11733,10 @@ function frontDoorRcControl(transport, token) {
11395
11733
  }
11396
11734
  return pending;
11397
11735
  };
11398
- const writeOf = async (path41, body, describeFailure2) => {
11736
+ const writeOf = async (path42, body, describeFailure2) => {
11399
11737
  let answer;
11400
11738
  try {
11401
- answer = await transport.request({ method: "POST", path: path41, headers: { ...headers, "content-type": "application/json" }, body });
11739
+ answer = await transport.request({ method: "POST", path: path42, headers: { ...headers, "content-type": "application/json" }, body });
11402
11740
  } catch (error) {
11403
11741
  return { ok: false, message: `could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}` };
11404
11742
  }
@@ -11429,10 +11767,10 @@ function frontDoorRcControl(transport, token) {
11429
11767
  endSession: async (sessionId, reason) => await writeOf(`${CONTROL_PATH_PREFIX}/end-session`, JSON.stringify({ session: sessionId, ...reason === void 0 ? {} : { reason } }), (status, message) => `ending ${sessionId} failed (HTTP ${String(status)}): ${message}`),
11430
11768
  getUsage: async (sessionId, skipBehaviors) => await writeOf(`${CONTROL_PATH_PREFIX}/get-usage`, JSON.stringify({ session: sessionId, ...skipBehaviors === void 0 ? {} : { skipBehaviors } }), (status, message) => `requesting the usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
11431
11769
  getContextUsage: async (sessionId, detail) => await writeOf(`${CONTROL_PATH_PREFIX}/get-context-usage`, JSON.stringify({ session: sessionId, ...detail === void 0 ? {} : { detail } }), (status, message) => `requesting the context usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
11432
- readFile: async (sessionId, path41, options) => await writeOf(
11770
+ readFile: async (sessionId, path42, options) => await writeOf(
11433
11771
  `${CONTROL_PATH_PREFIX}/read-file`,
11434
- JSON.stringify({ session: sessionId, path: path41, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
11435
- (status, message) => `reading ${path41} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
11772
+ JSON.stringify({ session: sessionId, path: path42, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
11773
+ (status, message) => `reading ${path42} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
11436
11774
  ),
11437
11775
  fileSuggestions: async (sessionId, query) => await writeOf(`${CONTROL_PATH_PREFIX}/file-suggestions`, JSON.stringify({ session: sessionId, query }), (status, message) => `requesting file suggestions from ${sessionId} failed (HTTP ${String(status)}): ${message}`),
11438
11776
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -11591,12 +11929,12 @@ function tlsFacts(options) {
11591
11929
  }
11592
11930
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
11593
11931
  const agent = new ExemptTlsAgent();
11594
- const post = async (path41, headers, body) => await new Promise((resolve, reject) => {
11932
+ const post = async (path42, headers, body) => await new Promise((resolve, reject) => {
11595
11933
  const options = {
11596
11934
  host: target.host,
11597
11935
  port: target.port,
11598
11936
  method: "POST",
11599
- path: path41,
11937
+ path: path42,
11600
11938
  // The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
11601
11939
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
11602
11940
  agent
@@ -11661,12 +11999,12 @@ function lateRcStreamDial(resolve) {
11661
11999
  }
11662
12000
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
11663
12001
  const agent = new ExemptTlsAgent();
11664
- const request4 = async (method, path41, headers, body, signal) => await new Promise((resolve, reject) => {
12002
+ const request4 = async (method, path42, headers, body, signal) => await new Promise((resolve, reject) => {
11665
12003
  const options = {
11666
12004
  host: target.host,
11667
12005
  port: target.port,
11668
12006
  method,
11669
- path: path41,
12007
+ path: path42,
11670
12008
  // The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
11671
12009
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
11672
12010
  agent,
@@ -11708,9 +12046,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
11708
12046
  return { status, body: await readAll(response) };
11709
12047
  },
11710
12048
  openStream: async (sessionId, headers, resume, signal) => {
11711
- const path41 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
12049
+ const path42 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
11712
12050
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
11713
- const { status, response } = await request4("GET", path41, streamHeaders, void 0, signal);
12051
+ const { status, response } = await request4("GET", path42, streamHeaders, void 0, signal);
11714
12052
  if (!isSuccessful2(status)) {
11715
12053
  await readAll(response);
11716
12054
  return { status, chunks: NO_CHUNKS };
@@ -12862,19 +13200,19 @@ function writePools(paths, pools) {
12862
13200
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
12863
13201
  }
12864
13202
  function poolCycleOf(pools, name) {
12865
- const walk = (current, path41) => {
13203
+ const walk = (current, path42) => {
12866
13204
  for (const entry of pools[current]?.identities ?? []) {
12867
13205
  const nested = poolNameOf(poolMemberIdentity(entry));
12868
13206
  if (nested === void 0) {
12869
13207
  continue;
12870
13208
  }
12871
13209
  if (nested === name) {
12872
- return [...path41, nested];
13210
+ return [...path42, nested];
12873
13211
  }
12874
- if (path41.includes(nested)) {
13212
+ if (path42.includes(nested)) {
12875
13213
  continue;
12876
13214
  }
12877
- const found = walk(nested, [...path41, nested]);
13215
+ const found = walk(nested, [...path42, nested]);
12878
13216
  if (found !== void 0) {
12879
13217
  return found;
12880
13218
  }
@@ -12996,6 +13334,7 @@ init_cascade();
12996
13334
  init_paths();
12997
13335
  init_realCredentialCache();
12998
13336
  init_providersStore();
13337
+ init_signIn();
12999
13338
  init_realPorts();
13000
13339
  init_envBool();
13001
13340
  init_load();
@@ -13008,7 +13347,7 @@ init_guard();
13008
13347
  init_providersStore();
13009
13348
  init_projects();
13010
13349
  init_pipeline();
13011
- import path26 from "node:path";
13350
+ import path27 from "node:path";
13012
13351
  import { z as z15 } from "zod";
13013
13352
  var HISTORY_PROJECTS_KEY_PREFIX = "history/projects/";
13014
13353
  function projectFragmentOf(rawKey) {
@@ -13065,26 +13404,18 @@ function formatDecision(decision) {
13065
13404
  const eliminatedNote = decision.eliminated !== void 0 && decision.eliminated.length > 0 ? ` [${String(decision.eliminated.length)} more specific rule(s) eliminated by a failing when-condition]` : "";
13066
13405
  return `${decision.relPath}: ${status} \u2014 ${reason}${eliminatedNote}`;
13067
13406
  }
13068
- function parseKeychainServiceName(stderr) {
13069
- const match = /"svce"<blob>="([^"]*)"/.exec(stderr);
13070
- return match?.[1];
13071
- }
13072
13407
  function lookupKeychainService(run, farmRoot) {
13073
- const result = run.run("security", ["find-generic-password", "-a", farmRoot, "-g"]);
13408
+ const serviceName = claudeCodeKeychainService(farmRoot);
13409
+ const result = run.run("security", ["find-generic-password", "-s", serviceName]);
13074
13410
  if (result.status !== 0) {
13075
13411
  return {
13076
13412
  checked: true,
13077
13413
  found: false,
13078
- note: `No Keychain entry found for account "${farmRoot}" (security exited ${result.status === null ? "with no status" : String(result.status)}).`
13414
+ serviceName,
13415
+ note: `No Keychain entry found for service "${serviceName}" (security exited ${result.status === null ? "with no status" : String(result.status)}).`
13079
13416
  };
13080
13417
  }
13081
- const serviceName = parseKeychainServiceName(result.stderr);
13082
- return {
13083
- checked: true,
13084
- found: true,
13085
- ...serviceName === void 0 ? {} : { serviceName },
13086
- note: serviceName === void 0 ? `A Keychain entry was found for account "${farmRoot}" but its service name could not be parsed from security's output.` : `Keychain service name for this identity: "${serviceName}".`
13087
- };
13418
+ return { checked: true, found: true, serviceName, note: `Keychain service name for this identity: "${serviceName}".` };
13088
13419
  }
13089
13420
  var SettingsSecretsShapeSchema = z15.looseObject({
13090
13421
  env: z15.record(z15.string(), z15.unknown()).optional(),
@@ -13346,10 +13677,10 @@ function collectCheckReport(params) {
13346
13677
  }).input;
13347
13678
  const providerName = cascadeProviderName(cascade);
13348
13679
  const provider = providerName === void 0 ? void 0 : loadCheckProvider(paths, providerName);
13349
- const farmRoot = identityDecision.name === void 0 ? void 0 : path26.join(paths.identitiesDir, identityDecision.name);
13680
+ const farmRoot = identityDecision.name === void 0 ? void 0 : path27.join(paths.identitiesDir, identityDecision.name);
13350
13681
  const settingsFiles = {
13351
- "settings.json": realFsPort.readFileUtf8(path26.join(claudeHome, "settings.json")),
13352
- "settings.local.json": realFsPort.readFileUtf8(path26.join(claudeHome, "settings.local.json"))
13682
+ "settings.json": realFsPort.readFileUtf8(path27.join(claudeHome, "settings.json")),
13683
+ "settings.local.json": realFsPort.readFileUtf8(path27.join(claudeHome, "settings.local.json"))
13353
13684
  };
13354
13685
  const report = runCheck({
13355
13686
  cwd,
@@ -13655,7 +13986,7 @@ init_schema();
13655
13986
  init_cliError();
13656
13987
  init_identity();
13657
13988
  import fs9 from "node:fs";
13658
- import path28 from "node:path";
13989
+ import path29 from "node:path";
13659
13990
  init_lock();
13660
13991
  var IdentityNotFoundError = class extends CliError {
13661
13992
  constructor(name) {
@@ -13684,7 +14015,7 @@ var InvalidIdentityNameError = class extends CliError {
13684
14015
  attemptedName;
13685
14016
  };
13686
14017
  function identityJsonPath(paths, name) {
13687
- return path28.join(paths.identitiesDir, name, "identity.json");
14018
+ return path29.join(paths.identitiesDir, name, "identity.json");
13688
14019
  }
13689
14020
  function requireIdentityNames(paths, names) {
13690
14021
  const existing = new Set(listIdentities(paths).map((entry) => entry.name));
@@ -13799,7 +14130,7 @@ function setIdentityCredential(paths, identityName, change) {
13799
14130
  });
13800
14131
  }
13801
14132
  function belongsToIdentity(entry, name) {
13802
- return entry === name || entry === path28.basename(identityLockPath("", name)) || entry.startsWith(`.${name}.scratch.`) || entry.startsWith(`.${name}.previous.`);
14133
+ return entry === name || entry === path29.basename(identityLockPath("", name)) || entry.startsWith(`.${name}.scratch.`) || entry.startsWith(`.${name}.previous.`);
13803
14134
  }
13804
14135
  function removeIdentity(paths, name) {
13805
14136
  if (!identityExists(paths, name)) {
@@ -13807,7 +14138,7 @@ function removeIdentity(paths, name) {
13807
14138
  }
13808
14139
  for (const entry of fs9.readdirSync(paths.identitiesDir)) {
13809
14140
  if (belongsToIdentity(entry, name)) {
13810
- fs9.rmSync(path28.join(paths.identitiesDir, entry), { recursive: true, force: true });
14141
+ fs9.rmSync(path29.join(paths.identitiesDir, entry), { recursive: true, force: true });
13811
14142
  }
13812
14143
  }
13813
14144
  if (readActiveIdentity2(paths) === name) {
@@ -13819,28 +14150,7 @@ function removeIdentity(paths, name) {
13819
14150
  init_realPorts();
13820
14151
  import fs11 from "node:fs";
13821
14152
  import path30 from "node:path";
13822
-
13823
- // src/usage/signIn.ts
13824
- import path29 from "node:path";
13825
- var CREDENTIALS_FILE = ".credentials.json";
13826
- function keychainHasItem(run, account) {
13827
- return run.run("security", ["find-generic-password", "-a", account]).status === 0;
13828
- }
13829
- function decideSignIn(facts) {
13830
- if (facts.hasCredentialBlock) {
13831
- return { state: "token", detail: "supplies its own credential through a credential block, so a stored login is not what a launch uses" };
13832
- }
13833
- if (facts.keychainItem === true) {
13834
- return { state: "signed-in", detail: "a login is stored in the macOS Keychain" };
13835
- }
13836
- if (facts.credentialsFile) {
13837
- return { state: "signed-in", detail: `a login is stored in ${CREDENTIALS_FILE}` };
13838
- }
13839
- return { state: "signed-out", detail: facts.platform === "darwin" ? `no Keychain item and no ${CREDENTIALS_FILE}` : `no ${CREDENTIALS_FILE}` };
13840
- }
13841
- function credentialsFilePath(farmRoot) {
13842
- return path29.join(farmRoot, CREDENTIALS_FILE);
13843
- }
14153
+ init_signIn();
13844
14154
 
13845
14155
  // src/codex/siwcStore.ts
13846
14156
  import { z as z22 } from "zod";
@@ -15181,7 +15491,7 @@ function profileValue(name, paths) {
15181
15491
  function createConfigApiRouter(deps) {
15182
15492
  const authed = doorApiAuth(deps.expectedToken);
15183
15493
  const { paths } = deps;
15184
- const route = (path41, summary) => authed.meta(openapi3({ method: "POST", path: path41, summary, tags: [CONFIG_API_TAG] }));
15494
+ const route = (path42, summary) => authed.meta(openapi3({ method: "POST", path: path42, summary, tags: [CONFIG_API_TAG] }));
15185
15495
  return {
15186
15496
  config: {
15187
15497
  identity: {
@@ -16471,7 +16781,7 @@ function numberOf(record, field) {
16471
16781
  }
16472
16782
  return void 0;
16473
16783
  }
16474
- function pageOfRcChannel(url, rows, idOf, rowOf2) {
16784
+ function pageOfRcChannel(url, rows, idOf, rowOf3) {
16475
16785
  const query = new URL(url, "http://127.0.0.1").searchParams;
16476
16786
  const anchor = query.get("after_event_id") ?? query.get("cursor");
16477
16787
  const rawLimit = query.get("limit");
@@ -16485,7 +16795,7 @@ function pageOfRcChannel(url, rows, idOf, rowOf2) {
16485
16795
  }
16486
16796
  const page = limit === void 0 ? rows.slice(from) : rows.slice(from, from + limit);
16487
16797
  const last = page[page.length - 1];
16488
- return { data: page.map(rowOf2), ...last === void 0 ? {} : { next_cursor: idOf(last) } };
16798
+ return { data: page.map(rowOf3), ...last === void 0 ? {} : { next_cursor: idOf(last) } };
16489
16799
  }
16490
16800
  async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
16491
16801
  const { request: request4, response, host } = ctx;