claude-use 11.78.0 → 11.80.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.cjs CHANGED
@@ -4764,7 +4764,7 @@ var init_package = __esm({
4764
4764
  "package.json"() {
4765
4765
  package_default = {
4766
4766
  name: "claude-use",
4767
- version: "11.78.0",
4767
+ version: "11.80.0",
4768
4768
  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.",
4769
4769
  license: "MIT",
4770
4770
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -7037,6 +7037,78 @@ var init_account = __esm({
7037
7037
  }
7038
7038
  });
7039
7039
 
7040
+ // src/usage/accountDescription.ts
7041
+ function describeAccountOrganisation(account) {
7042
+ const parts = [account.organizationName, account.organizationType].filter((part) => part !== void 0);
7043
+ return parts.length === 0 ? void 0 : parts.join(", ");
7044
+ }
7045
+ var init_accountDescription = __esm({
7046
+ "src/usage/accountDescription.ts"() {
7047
+ "use strict";
7048
+ }
7049
+ });
7050
+
7051
+ // src/identityAccounts.ts
7052
+ function readIdentityAccount(fs14, identitiesDir, identity) {
7053
+ try {
7054
+ const account = readAccountMetadata(fs14, identitiesDir, identity);
7055
+ return account === void 0 ? void 0 : { account };
7056
+ } catch (error) {
7057
+ if (error instanceof AccountMetadataError) {
7058
+ return { problem: error.message };
7059
+ }
7060
+ throw error;
7061
+ }
7062
+ }
7063
+ function summariseIdentityAccount(account) {
7064
+ const summary = {
7065
+ ...account.emailAddress === void 0 ? {} : { emailAddress: account.emailAddress },
7066
+ ...account.organizationName === void 0 ? {} : { organizationName: account.organizationName },
7067
+ ...account.organizationType === void 0 ? {} : { organizationType: account.organizationType },
7068
+ ...account.organizationRole === void 0 ? {} : { organizationRole: account.organizationRole },
7069
+ ...account.billingType === void 0 ? {} : { billingType: account.billingType },
7070
+ ...account.seatTier === void 0 ? {} : { seatTier: account.seatTier }
7071
+ };
7072
+ return Object.keys(summary).length === 0 ? void 0 : summary;
7073
+ }
7074
+ function loginKeyOf(account) {
7075
+ return account.accountUuid === void 0 ? void 0 : JSON.stringify([account.accountUuid, account.organizationUuid ?? null]);
7076
+ }
7077
+ function collectByLogin(items, loginOf) {
7078
+ const groups = /* @__PURE__ */ new Map();
7079
+ for (const item of items) {
7080
+ const key = loginOf(item) ?? /* @__PURE__ */ Symbol("no login");
7081
+ const group = groups.get(key);
7082
+ if (group === void 0) {
7083
+ groups.set(key, [item]);
7084
+ } else {
7085
+ group.push(item);
7086
+ }
7087
+ }
7088
+ return [...groups.values()];
7089
+ }
7090
+ function groupSharedLogins(items, loginOf) {
7091
+ return collectByLogin(items, loginOf).filter((group) => group.length > 1);
7092
+ }
7093
+ function joinNames(names) {
7094
+ const last = names.at(-1);
7095
+ return names.length < 2 || last === void 0 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${last}`;
7096
+ }
7097
+ function describeAccountHolder(summary) {
7098
+ const organisation = describeAccountOrganisation(summary);
7099
+ if (summary.emailAddress === void 0) {
7100
+ return organisation;
7101
+ }
7102
+ return organisation === void 0 ? summary.emailAddress : `${summary.emailAddress} (${organisation})`;
7103
+ }
7104
+ var init_identityAccounts = __esm({
7105
+ "src/identityAccounts.ts"() {
7106
+ "use strict";
7107
+ init_account();
7108
+ init_accountDescription();
7109
+ }
7110
+ });
7111
+
7040
7112
  // src/usage/rateLimit.ts
7041
7113
  function epochSecondsToIso(value) {
7042
7114
  if (value === void 0) {
@@ -7404,6 +7476,9 @@ function assessRefusedNested(member, nested, nowMs) {
7404
7476
  };
7405
7477
  }
7406
7478
  function assess(member, nowMs) {
7479
+ if (member.sameLoginAs !== void 0) {
7480
+ return { candidate: { identity: member.identity, class: "ineligible", plan: planOf(member.account), reasons: [`same login as ${member.sameLoginAs}`] } };
7481
+ }
7407
7482
  const nested = member.nested;
7408
7483
  if (nested === void 0) {
7409
7484
  return assessIdentity(member, nowMs);
@@ -7876,6 +7951,29 @@ function loadPoolMembers(fs14, paths, identities, nowMs) {
7876
7951
  }
7877
7952
  });
7878
7953
  }
7954
+ function snapshotAgeKey(member) {
7955
+ return member.snapshot === void 0 ? Number.NEGATIVE_INFINITY : Date.parse(member.snapshot.updatedAt);
7956
+ }
7957
+ function collapseSharedLogins(members) {
7958
+ const groups = groupSharedLogins(members, (member) => member.nested === void 0 && member.account !== void 0 ? loginKeyOf(member.account) : void 0);
7959
+ const representativeOf = /* @__PURE__ */ new Map();
7960
+ for (const group of groups) {
7961
+ const representative = group.reduce((freshest, member) => snapshotAgeKey(member) > snapshotAgeKey(freshest) ? member : freshest);
7962
+ for (const member of group) {
7963
+ if (member !== representative) {
7964
+ representativeOf.set(member, representative.identity);
7965
+ }
7966
+ }
7967
+ }
7968
+ return members.map((member) => {
7969
+ const representative = representativeOf.get(member);
7970
+ return representative === void 0 ? member : { ...member, sameLoginAs: representative };
7971
+ });
7972
+ }
7973
+ function stickyOnRepresentative(sticky, members) {
7974
+ const twin = sticky === void 0 ? void 0 : members.find((member) => member.identity === sticky.identity && member.sameLoginAs !== void 0);
7975
+ return sticky === void 0 || twin?.sameLoginAs === void 0 ? sticky : { ...sticky, identity: twin.sameLoginAs };
7976
+ }
7879
7977
  function rankPoolGraph(input) {
7880
7978
  return rankNamedPool(input, input.poolName, [], input.sticky);
7881
7979
  }
@@ -7903,13 +8001,15 @@ function rankNamedPool(input, poolName, stack, sticky) {
7903
8001
  members.push(typeof entry === "string" ? nested.member : { ...nested.member, policy: entry.when });
7904
8002
  missing.push(...nested.missing);
7905
8003
  }
8004
+ const collapsed = collapseSharedLogins(members);
8005
+ const stickyPick = stickyOnRepresentative(sticky, collapsed);
7906
8006
  const ranking = rankPool({
7907
- members,
8007
+ members: collapsed,
7908
8008
  nowMs: input.nowMs,
7909
8009
  resuming: input.resuming,
7910
8010
  ...input.resumeContextTokens === void 0 ? {} : { resumeContextTokens: input.resumeContextTokens },
7911
8011
  ...input.committedContextTokens === void 0 ? {} : { committedContextTokens: input.committedContextTokens },
7912
- ...sticky === void 0 ? {} : { sticky },
8012
+ ...stickyPick === void 0 ? {} : { sticky: stickyPick },
7913
8013
  ...pool.preference === void 0 ? {} : { preference: pool.preference }
7914
8014
  });
7915
8015
  return { ranking, missing };
@@ -7997,6 +8097,7 @@ var init_poolPick = __esm({
7997
8097
  init_cliError();
7998
8098
  init_identity();
7999
8099
  init_schema();
8100
+ init_identityAccounts();
8000
8101
  init_account();
8001
8102
  init_pick();
8002
8103
  init_read();
@@ -10726,7 +10827,8 @@ var init_argv = __esm({
10726
10827
  { flag: "--remote-control", key: "remoteControl" },
10727
10828
  { flag: "--wait", key: "wait" },
10728
10829
  { flag: "--pause", key: "pause" },
10729
- { flag: "--explain", key: "explain" }
10830
+ { flag: "--explain", key: "explain" },
10831
+ { flag: "--pick", key: "pick" }
10730
10832
  ];
10731
10833
  LAUNCHER_FLAG_NAMES = [
10732
10834
  ...VALUED_FLAGS,
@@ -11812,7 +11914,7 @@ function decideLaunch(params, readOnly) {
11812
11914
  const configDirEscapeHatchApplies = env.CLAUDE_CONFIG_DIR !== void 0 && env.CLAUDE_CONFIG_DIR !== "";
11813
11915
  const decidedIdentity = decideIdentity({
11814
11916
  env,
11815
- argv0Identity: parsedArgv.identity,
11917
+ argv0Identity: params.pickedIdentity ?? parsedArgv.identity,
11816
11918
  directoryPinnedIdentity: params.directoryPinnedIdentity,
11817
11919
  readActiveIdentityFile: () => {
11818
11920
  const raw = fs14.readFileUtf8(paths.activeIdentityFile);
@@ -17083,65 +17185,7 @@ init_realPorts();
17083
17185
  var import_node_fs10 = __toESM(require("node:fs"), 1);
17084
17186
  var import_node_path29 = __toESM(require("node:path"), 1);
17085
17187
  init_signIn();
17086
-
17087
- // src/identityAccounts.ts
17088
- init_account();
17089
-
17090
- // src/usage/accountDescription.ts
17091
- function describeAccountOrganisation(account) {
17092
- const parts = [account.organizationName, account.organizationType].filter((part) => part !== void 0);
17093
- return parts.length === 0 ? void 0 : parts.join(", ");
17094
- }
17095
-
17096
- // src/identityAccounts.ts
17097
- function readIdentityAccount(fs14, identitiesDir, identity) {
17098
- try {
17099
- const account = readAccountMetadata(fs14, identitiesDir, identity);
17100
- return account === void 0 ? void 0 : { account };
17101
- } catch (error) {
17102
- if (error instanceof AccountMetadataError) {
17103
- return { problem: error.message };
17104
- }
17105
- throw error;
17106
- }
17107
- }
17108
- function summariseIdentityAccount(account) {
17109
- const summary = {
17110
- ...account.emailAddress === void 0 ? {} : { emailAddress: account.emailAddress },
17111
- ...account.organizationName === void 0 ? {} : { organizationName: account.organizationName },
17112
- ...account.organizationType === void 0 ? {} : { organizationType: account.organizationType },
17113
- ...account.organizationRole === void 0 ? {} : { organizationRole: account.organizationRole },
17114
- ...account.billingType === void 0 ? {} : { billingType: account.billingType },
17115
- ...account.seatTier === void 0 ? {} : { seatTier: account.seatTier }
17116
- };
17117
- return Object.keys(summary).length === 0 ? void 0 : summary;
17118
- }
17119
- function loginKeyOf(account) {
17120
- return account.accountUuid === void 0 ? void 0 : JSON.stringify([account.accountUuid, account.organizationUuid ?? null]);
17121
- }
17122
- function collectByLogin(items, loginOf) {
17123
- const groups = /* @__PURE__ */ new Map();
17124
- for (const item of items) {
17125
- const key = loginOf(item) ?? /* @__PURE__ */ Symbol("no login");
17126
- const group = groups.get(key);
17127
- if (group === void 0) {
17128
- groups.set(key, [item]);
17129
- } else {
17130
- group.push(item);
17131
- }
17132
- }
17133
- return [...groups.values()];
17134
- }
17135
- function groupSharedLogins(items, loginOf) {
17136
- return collectByLogin(items, loginOf).filter((group) => group.length > 1);
17137
- }
17138
- function describeAccountHolder(summary) {
17139
- const organisation = describeAccountOrganisation(summary);
17140
- if (summary.emailAddress === void 0) {
17141
- return organisation;
17142
- }
17143
- return organisation === void 0 ? summary.emailAddress : `${summary.emailAddress} (${organisation})`;
17144
- }
17188
+ init_identityAccounts();
17145
17189
 
17146
17190
  // src/codex/siwcStore.ts
17147
17191
  var import_zod26 = require("zod");
@@ -17495,6 +17539,27 @@ init_providerAliases();
17495
17539
  init_providersStore();
17496
17540
  init_guard();
17497
17541
  init_identity();
17542
+
17543
+ // src/poolSharedLogins.ts
17544
+ init_identityAccounts();
17545
+ init_identity();
17546
+ function sharedLoginMembers(members, accountOf) {
17547
+ const known = members.flatMap((identity) => {
17548
+ const account = poolNameOf(identity) === void 0 ? accountOf(identity) : void 0;
17549
+ return account === void 0 ? [] : [{ identity, account }];
17550
+ });
17551
+ return groupSharedLogins(known, (entry) => loginKeyOf(entry.account)).flatMap((group) => {
17552
+ const first = group[0];
17553
+ return first === void 0 ? [] : [{ members: group.map((entry) => entry.identity), account: first.account }];
17554
+ });
17555
+ }
17556
+ function describeSharedLoginMembers(poolName, shared) {
17557
+ const summary = summariseIdentityAccount(shared.account);
17558
+ const holder = summary === void 0 ? void 0 : describeAccountHolder(summary);
17559
+ return `Pool "${poolName}" lists ${joinNames(shared.members)}, which hold the same login${holder === void 0 ? "" : ` (${holder})`}, so they share one quota window. A launch ranks them as one candidate and never fails over from one to another; keep one of them in the pool.`;
17560
+ }
17561
+
17562
+ // src/doctorReport.ts
17498
17563
  init_extends();
17499
17564
  var DOCTOR_SEVERITIES = ["pass", "warn", "fail"];
17500
17565
  var DOCTOR_SECTIONS = [
@@ -17517,10 +17582,6 @@ var DOCTOR_SECTIONS = [
17517
17582
  "frontdoor",
17518
17583
  "models"
17519
17584
  ];
17520
- function joinNames(names) {
17521
- const last = names.at(-1);
17522
- return names.length < 2 || last === void 0 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${last}`;
17523
- }
17524
17585
  function refinePathShadow(status, ownExecutablePath, realpath) {
17525
17586
  if (status.status !== "shadowed") {
17526
17587
  return status;
@@ -17833,6 +17894,7 @@ function runDoctor(params) {
17833
17894
  }
17834
17895
  const validatedGlobalConfig = params.globalConfig.raw === void 0 ? void 0 : validateJson(GlobalConfigSchema, params.globalConfig);
17835
17896
  const pools = validatedGlobalConfig?.ok === true ? validatedGlobalConfig.data.pools ?? {} : {};
17897
+ const accountByIdentity = new Map(params.identities.flatMap((entry) => validIdentityNames.has(entry.name) && entry.account !== void 0 ? [[entry.name, entry.account]] : []));
17836
17898
  for (const [poolName, pool] of Object.entries(pools)) {
17837
17899
  const missing = pool.identities.filter((member) => poolNameOf(poolMemberIdentity(member)) === void 0 && !validIdentityNames.has(poolMemberIdentity(member)));
17838
17900
  const undefinedPools = pool.identities.flatMap((member) => {
@@ -17848,6 +17910,9 @@ function runDoctor(params) {
17848
17910
  ];
17849
17911
  push("pool", "fail", `Pool "${poolName}" names ${problems.join(" and ")}.`, poolName);
17850
17912
  }
17913
+ for (const shared of sharedLoginMembers(pool.identities.map(poolMemberIdentity), (identityName) => accountByIdentity.get(identityName))) {
17914
+ push("pool", "warn", describeSharedLoginMembers(poolName, shared), poolName);
17915
+ }
17851
17916
  }
17852
17917
  const reportedCycles = /* @__PURE__ */ new Set();
17853
17918
  for (const poolName of Object.keys(pools).sort()) {
package/dist/index.mjs CHANGED
@@ -4740,7 +4740,7 @@ var init_package = __esm({
4740
4740
  "package.json"() {
4741
4741
  package_default = {
4742
4742
  name: "claude-use",
4743
- version: "11.78.0",
4743
+ version: "11.80.0",
4744
4744
  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.",
4745
4745
  license: "MIT",
4746
4746
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -7012,6 +7012,78 @@ var init_account = __esm({
7012
7012
  }
7013
7013
  });
7014
7014
 
7015
+ // src/usage/accountDescription.ts
7016
+ function describeAccountOrganisation(account) {
7017
+ const parts = [account.organizationName, account.organizationType].filter((part) => part !== void 0);
7018
+ return parts.length === 0 ? void 0 : parts.join(", ");
7019
+ }
7020
+ var init_accountDescription = __esm({
7021
+ "src/usage/accountDescription.ts"() {
7022
+ "use strict";
7023
+ }
7024
+ });
7025
+
7026
+ // src/identityAccounts.ts
7027
+ function readIdentityAccount(fs14, identitiesDir, identity) {
7028
+ try {
7029
+ const account = readAccountMetadata(fs14, identitiesDir, identity);
7030
+ return account === void 0 ? void 0 : { account };
7031
+ } catch (error) {
7032
+ if (error instanceof AccountMetadataError) {
7033
+ return { problem: error.message };
7034
+ }
7035
+ throw error;
7036
+ }
7037
+ }
7038
+ function summariseIdentityAccount(account) {
7039
+ const summary = {
7040
+ ...account.emailAddress === void 0 ? {} : { emailAddress: account.emailAddress },
7041
+ ...account.organizationName === void 0 ? {} : { organizationName: account.organizationName },
7042
+ ...account.organizationType === void 0 ? {} : { organizationType: account.organizationType },
7043
+ ...account.organizationRole === void 0 ? {} : { organizationRole: account.organizationRole },
7044
+ ...account.billingType === void 0 ? {} : { billingType: account.billingType },
7045
+ ...account.seatTier === void 0 ? {} : { seatTier: account.seatTier }
7046
+ };
7047
+ return Object.keys(summary).length === 0 ? void 0 : summary;
7048
+ }
7049
+ function loginKeyOf(account) {
7050
+ return account.accountUuid === void 0 ? void 0 : JSON.stringify([account.accountUuid, account.organizationUuid ?? null]);
7051
+ }
7052
+ function collectByLogin(items, loginOf) {
7053
+ const groups = /* @__PURE__ */ new Map();
7054
+ for (const item of items) {
7055
+ const key = loginOf(item) ?? /* @__PURE__ */ Symbol("no login");
7056
+ const group = groups.get(key);
7057
+ if (group === void 0) {
7058
+ groups.set(key, [item]);
7059
+ } else {
7060
+ group.push(item);
7061
+ }
7062
+ }
7063
+ return [...groups.values()];
7064
+ }
7065
+ function groupSharedLogins(items, loginOf) {
7066
+ return collectByLogin(items, loginOf).filter((group) => group.length > 1);
7067
+ }
7068
+ function joinNames(names) {
7069
+ const last = names.at(-1);
7070
+ return names.length < 2 || last === void 0 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${last}`;
7071
+ }
7072
+ function describeAccountHolder(summary) {
7073
+ const organisation = describeAccountOrganisation(summary);
7074
+ if (summary.emailAddress === void 0) {
7075
+ return organisation;
7076
+ }
7077
+ return organisation === void 0 ? summary.emailAddress : `${summary.emailAddress} (${organisation})`;
7078
+ }
7079
+ var init_identityAccounts = __esm({
7080
+ "src/identityAccounts.ts"() {
7081
+ "use strict";
7082
+ init_account();
7083
+ init_accountDescription();
7084
+ }
7085
+ });
7086
+
7015
7087
  // src/usage/rateLimit.ts
7016
7088
  function epochSecondsToIso(value) {
7017
7089
  if (value === void 0) {
@@ -7379,6 +7451,9 @@ function assessRefusedNested(member, nested, nowMs) {
7379
7451
  };
7380
7452
  }
7381
7453
  function assess(member, nowMs) {
7454
+ if (member.sameLoginAs !== void 0) {
7455
+ return { candidate: { identity: member.identity, class: "ineligible", plan: planOf(member.account), reasons: [`same login as ${member.sameLoginAs}`] } };
7456
+ }
7382
7457
  const nested = member.nested;
7383
7458
  if (nested === void 0) {
7384
7459
  return assessIdentity(member, nowMs);
@@ -7853,6 +7928,29 @@ function loadPoolMembers(fs14, paths, identities, nowMs) {
7853
7928
  }
7854
7929
  });
7855
7930
  }
7931
+ function snapshotAgeKey(member) {
7932
+ return member.snapshot === void 0 ? Number.NEGATIVE_INFINITY : Date.parse(member.snapshot.updatedAt);
7933
+ }
7934
+ function collapseSharedLogins(members) {
7935
+ const groups = groupSharedLogins(members, (member) => member.nested === void 0 && member.account !== void 0 ? loginKeyOf(member.account) : void 0);
7936
+ const representativeOf = /* @__PURE__ */ new Map();
7937
+ for (const group of groups) {
7938
+ const representative = group.reduce((freshest, member) => snapshotAgeKey(member) > snapshotAgeKey(freshest) ? member : freshest);
7939
+ for (const member of group) {
7940
+ if (member !== representative) {
7941
+ representativeOf.set(member, representative.identity);
7942
+ }
7943
+ }
7944
+ }
7945
+ return members.map((member) => {
7946
+ const representative = representativeOf.get(member);
7947
+ return representative === void 0 ? member : { ...member, sameLoginAs: representative };
7948
+ });
7949
+ }
7950
+ function stickyOnRepresentative(sticky, members) {
7951
+ const twin = sticky === void 0 ? void 0 : members.find((member) => member.identity === sticky.identity && member.sameLoginAs !== void 0);
7952
+ return sticky === void 0 || twin?.sameLoginAs === void 0 ? sticky : { ...sticky, identity: twin.sameLoginAs };
7953
+ }
7856
7954
  function rankPoolGraph(input) {
7857
7955
  return rankNamedPool(input, input.poolName, [], input.sticky);
7858
7956
  }
@@ -7880,13 +7978,15 @@ function rankNamedPool(input, poolName, stack, sticky) {
7880
7978
  members.push(typeof entry === "string" ? nested.member : { ...nested.member, policy: entry.when });
7881
7979
  missing.push(...nested.missing);
7882
7980
  }
7981
+ const collapsed = collapseSharedLogins(members);
7982
+ const stickyPick = stickyOnRepresentative(sticky, collapsed);
7883
7983
  const ranking = rankPool({
7884
- members,
7984
+ members: collapsed,
7885
7985
  nowMs: input.nowMs,
7886
7986
  resuming: input.resuming,
7887
7987
  ...input.resumeContextTokens === void 0 ? {} : { resumeContextTokens: input.resumeContextTokens },
7888
7988
  ...input.committedContextTokens === void 0 ? {} : { committedContextTokens: input.committedContextTokens },
7889
- ...sticky === void 0 ? {} : { sticky },
7989
+ ...stickyPick === void 0 ? {} : { sticky: stickyPick },
7890
7990
  ...pool.preference === void 0 ? {} : { preference: pool.preference }
7891
7991
  });
7892
7992
  return { ranking, missing };
@@ -7972,6 +8072,7 @@ var init_poolPick = __esm({
7972
8072
  init_cliError();
7973
8073
  init_identity();
7974
8074
  init_schema();
8075
+ init_identityAccounts();
7975
8076
  init_account();
7976
8077
  init_pick();
7977
8078
  init_read();
@@ -10699,7 +10800,8 @@ var init_argv = __esm({
10699
10800
  { flag: "--remote-control", key: "remoteControl" },
10700
10801
  { flag: "--wait", key: "wait" },
10701
10802
  { flag: "--pause", key: "pause" },
10702
- { flag: "--explain", key: "explain" }
10803
+ { flag: "--explain", key: "explain" },
10804
+ { flag: "--pick", key: "pick" }
10703
10805
  ];
10704
10806
  LAUNCHER_FLAG_NAMES = [
10705
10807
  ...VALUED_FLAGS,
@@ -11787,7 +11889,7 @@ function decideLaunch(params, readOnly) {
11787
11889
  const configDirEscapeHatchApplies = env.CLAUDE_CONFIG_DIR !== void 0 && env.CLAUDE_CONFIG_DIR !== "";
11788
11890
  const decidedIdentity = decideIdentity({
11789
11891
  env,
11790
- argv0Identity: parsedArgv.identity,
11892
+ argv0Identity: params.pickedIdentity ?? parsedArgv.identity,
11791
11893
  directoryPinnedIdentity: params.directoryPinnedIdentity,
11792
11894
  readActiveIdentityFile: () => {
11793
11895
  const raw = fs14.readFileUtf8(paths.activeIdentityFile);
@@ -16668,65 +16770,7 @@ init_realPorts();
16668
16770
  import fs11 from "node:fs";
16669
16771
  import path29 from "node:path";
16670
16772
  init_signIn();
16671
-
16672
- // src/identityAccounts.ts
16673
- init_account();
16674
-
16675
- // src/usage/accountDescription.ts
16676
- function describeAccountOrganisation(account) {
16677
- const parts = [account.organizationName, account.organizationType].filter((part) => part !== void 0);
16678
- return parts.length === 0 ? void 0 : parts.join(", ");
16679
- }
16680
-
16681
- // src/identityAccounts.ts
16682
- function readIdentityAccount(fs14, identitiesDir, identity) {
16683
- try {
16684
- const account = readAccountMetadata(fs14, identitiesDir, identity);
16685
- return account === void 0 ? void 0 : { account };
16686
- } catch (error) {
16687
- if (error instanceof AccountMetadataError) {
16688
- return { problem: error.message };
16689
- }
16690
- throw error;
16691
- }
16692
- }
16693
- function summariseIdentityAccount(account) {
16694
- const summary = {
16695
- ...account.emailAddress === void 0 ? {} : { emailAddress: account.emailAddress },
16696
- ...account.organizationName === void 0 ? {} : { organizationName: account.organizationName },
16697
- ...account.organizationType === void 0 ? {} : { organizationType: account.organizationType },
16698
- ...account.organizationRole === void 0 ? {} : { organizationRole: account.organizationRole },
16699
- ...account.billingType === void 0 ? {} : { billingType: account.billingType },
16700
- ...account.seatTier === void 0 ? {} : { seatTier: account.seatTier }
16701
- };
16702
- return Object.keys(summary).length === 0 ? void 0 : summary;
16703
- }
16704
- function loginKeyOf(account) {
16705
- return account.accountUuid === void 0 ? void 0 : JSON.stringify([account.accountUuid, account.organizationUuid ?? null]);
16706
- }
16707
- function collectByLogin(items, loginOf) {
16708
- const groups = /* @__PURE__ */ new Map();
16709
- for (const item of items) {
16710
- const key = loginOf(item) ?? /* @__PURE__ */ Symbol("no login");
16711
- const group = groups.get(key);
16712
- if (group === void 0) {
16713
- groups.set(key, [item]);
16714
- } else {
16715
- group.push(item);
16716
- }
16717
- }
16718
- return [...groups.values()];
16719
- }
16720
- function groupSharedLogins(items, loginOf) {
16721
- return collectByLogin(items, loginOf).filter((group) => group.length > 1);
16722
- }
16723
- function describeAccountHolder(summary) {
16724
- const organisation = describeAccountOrganisation(summary);
16725
- if (summary.emailAddress === void 0) {
16726
- return organisation;
16727
- }
16728
- return organisation === void 0 ? summary.emailAddress : `${summary.emailAddress} (${organisation})`;
16729
- }
16773
+ init_identityAccounts();
16730
16774
 
16731
16775
  // src/codex/siwcStore.ts
16732
16776
  import { z as z26 } from "zod";
@@ -17080,6 +17124,27 @@ init_providerAliases();
17080
17124
  init_providersStore();
17081
17125
  init_guard();
17082
17126
  init_identity();
17127
+
17128
+ // src/poolSharedLogins.ts
17129
+ init_identityAccounts();
17130
+ init_identity();
17131
+ function sharedLoginMembers(members, accountOf) {
17132
+ const known = members.flatMap((identity) => {
17133
+ const account = poolNameOf(identity) === void 0 ? accountOf(identity) : void 0;
17134
+ return account === void 0 ? [] : [{ identity, account }];
17135
+ });
17136
+ return groupSharedLogins(known, (entry) => loginKeyOf(entry.account)).flatMap((group) => {
17137
+ const first = group[0];
17138
+ return first === void 0 ? [] : [{ members: group.map((entry) => entry.identity), account: first.account }];
17139
+ });
17140
+ }
17141
+ function describeSharedLoginMembers(poolName, shared) {
17142
+ const summary = summariseIdentityAccount(shared.account);
17143
+ const holder = summary === void 0 ? void 0 : describeAccountHolder(summary);
17144
+ return `Pool "${poolName}" lists ${joinNames(shared.members)}, which hold the same login${holder === void 0 ? "" : ` (${holder})`}, so they share one quota window. A launch ranks them as one candidate and never fails over from one to another; keep one of them in the pool.`;
17145
+ }
17146
+
17147
+ // src/doctorReport.ts
17083
17148
  init_extends();
17084
17149
  var DOCTOR_SEVERITIES = ["pass", "warn", "fail"];
17085
17150
  var DOCTOR_SECTIONS = [
@@ -17102,10 +17167,6 @@ var DOCTOR_SECTIONS = [
17102
17167
  "frontdoor",
17103
17168
  "models"
17104
17169
  ];
17105
- function joinNames(names) {
17106
- const last = names.at(-1);
17107
- return names.length < 2 || last === void 0 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${last}`;
17108
- }
17109
17170
  function refinePathShadow(status, ownExecutablePath, realpath) {
17110
17171
  if (status.status !== "shadowed") {
17111
17172
  return status;
@@ -17418,6 +17479,7 @@ function runDoctor(params) {
17418
17479
  }
17419
17480
  const validatedGlobalConfig = params.globalConfig.raw === void 0 ? void 0 : validateJson(GlobalConfigSchema, params.globalConfig);
17420
17481
  const pools = validatedGlobalConfig?.ok === true ? validatedGlobalConfig.data.pools ?? {} : {};
17482
+ const accountByIdentity = new Map(params.identities.flatMap((entry) => validIdentityNames.has(entry.name) && entry.account !== void 0 ? [[entry.name, entry.account]] : []));
17421
17483
  for (const [poolName, pool] of Object.entries(pools)) {
17422
17484
  const missing = pool.identities.filter((member) => poolNameOf(poolMemberIdentity(member)) === void 0 && !validIdentityNames.has(poolMemberIdentity(member)));
17423
17485
  const undefinedPools = pool.identities.flatMap((member) => {
@@ -17433,6 +17495,9 @@ function runDoctor(params) {
17433
17495
  ];
17434
17496
  push("pool", "fail", `Pool "${poolName}" names ${problems.join(" and ")}.`, poolName);
17435
17497
  }
17498
+ for (const shared of sharedLoginMembers(pool.identities.map(poolMemberIdentity), (identityName) => accountByIdentity.get(identityName))) {
17499
+ push("pool", "warn", describeSharedLoginMembers(poolName, shared), poolName);
17500
+ }
17436
17501
  }
17437
17502
  const reportedCycles = /* @__PURE__ */ new Set();
17438
17503
  for (const poolName of Object.keys(pools).sort()) {