agent-shim 14.12.5 → 14.13.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/cli.cjs CHANGED
@@ -28135,6 +28135,35 @@ var init_versionDiscovery = __esm({
28135
28135
  }
28136
28136
  });
28137
28137
 
28138
+ // src/identityGrants.ts
28139
+ function canonicalFeatures(features) {
28140
+ return GRANT_FEATURES.filter((feature) => features.includes(feature));
28141
+ }
28142
+ function withGrant(grants, borrowerId, features) {
28143
+ const held = grants.find((grant) => grant.to === borrowerId)?.features ?? [];
28144
+ const added = { to: borrowerId, features: canonicalFeatures([...held, ...features]) };
28145
+ return [...grants.filter((grant) => grant.to !== borrowerId), added].sort((first, second) => first.to.localeCompare(second.to));
28146
+ }
28147
+ function withoutGrant(grants, borrowerId, features) {
28148
+ return grants.flatMap((grant) => {
28149
+ if (grant.to !== borrowerId) {
28150
+ return [grant];
28151
+ }
28152
+ const kept = features === void 0 ? [] : grant.features.filter((feature) => !features.includes(feature));
28153
+ return kept.length === 0 ? [] : [{ to: grant.to, features: kept }];
28154
+ });
28155
+ }
28156
+ function loginsLentTo(identities, borrowerId) {
28157
+ return identities.flatMap((identity) => identity.id === borrowerId ? [] : (identity.grants ?? []).filter((grant) => grant.to === borrowerId).map((grant) => ({ from: identity.name, features: grant.features })));
28158
+ }
28159
+ var GRANT_FEATURES;
28160
+ var init_identityGrants = __esm({
28161
+ "src/identityGrants.ts"() {
28162
+ "use strict";
28163
+ GRANT_FEATURES = ["remote-control", "artifacts", "connectors", "server-tools"];
28164
+ }
28165
+ });
28166
+
28138
28167
  // src/config/schema.ts
28139
28168
  function isOverridableCategory(name) {
28140
28169
  return OVERRIDABLE_CATEGORIES.some((category) => category === name);
@@ -28173,7 +28202,7 @@ function isTimeZone(name) {
28173
28202
  return false;
28174
28203
  }
28175
28204
  }
28176
- var import_node_path5, 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, TIER_MODEL_ENV_VARIABLES, OTHER_MODEL_ENV_VARIABLES, MODEL_ENV_VARIABLES, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, MAX_TIMER_DELAY_MS, HttpBaseUrlSchema, SERVER_TOOLS_MODES, HttpProviderSchema, CodexProviderSchema, RouterProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, FamilySettingsSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_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, FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
28205
+ var import_node_path5, 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, TIER_MODEL_ENV_VARIABLES, OTHER_MODEL_ENV_VARIABLES, MODEL_ENV_VARIABLES, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, MAX_TIMER_DELAY_MS, HttpBaseUrlSchema, SERVER_TOOLS_MODES, HttpProviderSchema, CodexProviderSchema, RouterProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, FamilySettingsSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_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, FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentityGrantSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
28177
28206
  var init_schema = __esm({
28178
28207
  "src/config/schema.ts"() {
28179
28208
  "use strict";
@@ -28186,6 +28215,7 @@ var init_schema = __esm({
28186
28215
  init_identity();
28187
28216
  init_versionDiscovery();
28188
28217
  init_ownEntry();
28218
+ init_identityGrants();
28189
28219
  CATEGORY_NAMES = ["secret", "runtime", "history", "knowledge", "settings"];
28190
28220
  OVERRIDABLE_CATEGORIES = ["runtime", "history", "knowledge", "settings"];
28191
28221
  CategoryMapSchema = external_exports.strictObject({
@@ -28635,6 +28665,10 @@ var init_schema = __esm({
28635
28665
  models: ModelsConfigSchema.optional(),
28636
28666
  jobs: external_exports.record(PoolNameSchema, JobSchema).optional()
28637
28667
  });
28668
+ IdentityGrantSchema = external_exports.strictObject({
28669
+ to: FileNameSchema,
28670
+ features: external_exports.array(external_exports.enum(GRANT_FEATURES)).min(1)
28671
+ });
28638
28672
  IdentitySchema = external_exports.strictObject({
28639
28673
  /** The CLI this login belongs to; absent means Claude Code for backwards compatibility. */
28640
28674
  agent: external_exports.enum(["claude", "codex"]).optional(),
@@ -28647,6 +28681,8 @@ var init_schema = __esm({
28647
28681
  provider: StoredNameSchema.optional(),
28648
28682
  allowAmbientCredential: external_exports.boolean().default(false),
28649
28683
  credential: CredentialSchema.optional(),
28684
+ /** Which other identities may use this identity's claude.ai login, and for what (`identity grant`). Absent: none may. */
28685
+ grants: external_exports.array(IdentityGrantSchema).min(1).optional(),
28650
28686
  /** When this identity's five-hour window should be open: the front door opens one at each anchor if none is. Absent, nothing is opened on a schedule. */
28651
28687
  anchors: external_exports.array(AnchorSchema).min(1).optional()
28652
28688
  });
@@ -40018,6 +40054,35 @@ function setAllowAmbientCredential(paths, identityName, allow) {
40018
40054
  allowAmbientCredential: allow
40019
40055
  });
40020
40056
  }
40057
+ function changeIdentityGrants(paths, parties, change, namesLock) {
40058
+ return withIdentityNamesLock(paths, namesLock, () => {
40059
+ const lenderId = requireStoredIdentityId(paths, parties.lender);
40060
+ const borrowerId = requireStoredIdentityId(paths, parties.borrower);
40061
+ if (lenderId === borrowerId) {
40062
+ throw new UsageError(`Identity "${parties.lender}" already uses its own login, so there is nothing to grant to itself.`);
40063
+ }
40064
+ const lender = readIdentityById(paths, lenderId);
40065
+ const borrower = readIdentityById(paths, borrowerId);
40066
+ if (lender === void 0) {
40067
+ throw identityNotFound(paths, parties.lender);
40068
+ }
40069
+ for (const identity of [lender, borrower]) {
40070
+ if (identity?.agent === "codex") {
40071
+ throw new UsageError(`Identity "${identity.name}" runs Codex, which has no claude.ai login to lend or borrow.`);
40072
+ }
40073
+ }
40074
+ return writeIdentityGrants(paths, lenderId, change(lender.grants ?? [], borrowerId));
40075
+ });
40076
+ }
40077
+ function writeIdentityGrants(paths, id2, grants) {
40078
+ return applyPatch(identityJsonPath(paths, id2), IdentitySchema, { grants: grants.length === 0 ? void 0 : grants.map((grant) => ({ to: grant.to, features: [...grant.features] })) });
40079
+ }
40080
+ function grantIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
40081
+ return changeIdentityGrants(paths, parties, (grants, borrowerId) => withGrant(grants, borrowerId, features), namesLock);
40082
+ }
40083
+ function revokeIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
40084
+ return changeIdentityGrants(paths, parties, (grants, borrowerId) => withoutGrant(grants, borrowerId, features), namesLock);
40085
+ }
40021
40086
  function setIdentityCredential(paths, identityName, change) {
40022
40087
  const id2 = requireStoredIdentityId(paths, identityName);
40023
40088
  const existing = readIdentityById(paths, id2);
@@ -40103,6 +40168,11 @@ function removeIdentityWithLockHeld(paths, name, namesLock) {
40103
40168
  if (readActiveIdentity2(paths) === name) {
40104
40169
  import_node_fs12.default.rmSync(paths.activeIdentityFile);
40105
40170
  }
40171
+ for (const listing of listIdentities(paths)) {
40172
+ if (listing.problem === void 0 && listing.identity.grants?.some((grant) => grant.to === id2) === true) {
40173
+ writeIdentityGrants(paths, listing.id, withoutGrant(listing.identity.grants, id2, void 0));
40174
+ }
40175
+ }
40106
40176
  return id2;
40107
40177
  } finally {
40108
40178
  resync.release();
@@ -40134,6 +40204,7 @@ var init_identityStore = __esm({
40134
40204
  init_sameDirectory();
40135
40205
  init_identityRecords();
40136
40206
  init_launchRecords();
40207
+ init_identityGrants();
40137
40208
  IdentityNotFoundError = class extends CliError {
40138
40209
  constructor(name, remedy2 = `Run \`agent-shim identity add ${name}\` first.`) {
40139
40210
  super(`No identity named "${name}". ${remedy2}`);
@@ -76446,7 +76517,7 @@ var init_package = __esm({
76446
76517
  "package.json"() {
76447
76518
  package_default = {
76448
76519
  name: "agent-shim",
76449
- version: "14.12.5",
76520
+ version: "14.13.0",
76450
76521
  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.",
76451
76522
  license: "MIT",
76452
76523
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -129080,6 +129151,7 @@ init_schema();
129080
129151
  init_baseUrlDisplay();
129081
129152
  init_providerReachability();
129082
129153
  init_identityStore();
129154
+ init_identityGrants();
129083
129155
  init_credential();
129084
129156
  init_claudeVersion();
129085
129157
  init_credentialCache();
@@ -129275,6 +129347,7 @@ function runCheck(params) {
129275
129347
  return {
129276
129348
  ...params.identityName === void 0 ? {} : { identityName: params.identityName },
129277
129349
  identitySource: params.identitySource,
129350
+ ...params.borrowedLogins === void 0 || params.borrowedLogins.length === 0 ? {} : { borrowedLogins: params.borrowedLogins },
129278
129351
  ...params.poolPick === void 0 ? {} : { poolPick: params.poolPick },
129279
129352
  ...params.configProfileName === void 0 ? {} : { configProfileName: params.configProfileName },
129280
129353
  configProfileSource: params.configProfileSource,
@@ -129301,6 +129374,9 @@ function buildProviderReachability(provider, probe) {
129301
129374
  function formatCheckReport(report) {
129302
129375
  const lines = [];
129303
129376
  lines.push(`Identity: ${report.identityName ?? "(none)"} (${report.identitySource})`);
129377
+ for (const loan of report.borrowedLogins ?? []) {
129378
+ lines.push(`Borrows the login of ${loan.from} for ${loan.features.join(", ")}.`);
129379
+ }
129304
129380
  if (report.poolPick !== void 0) {
129305
129381
  const top = report.poolPick.candidates.find((candidate) => candidate.identity === report.poolPick?.pick);
129306
129382
  lines.push(`Pool: ${report.poolPick.pool}${top === void 0 ? ", every member is refused right now" : `, would pick ${top.identity} (${top.reasons.join("; ")})`}`);
@@ -129395,6 +129471,7 @@ function checkReportToJson(report) {
129395
129471
  const decisions = [...report.resolved.decisions.values()].sort((a10, b) => a10.relPath < b.relPath ? -1 : a10.relPath > b.relPath ? 1 : 0);
129396
129472
  return {
129397
129473
  identity: { name: report.identityName ?? null, source: report.identitySource },
129474
+ ...report.borrowedLogins === void 0 ? {} : { borrowedLogins: report.borrowedLogins },
129398
129475
  ...report.poolPick === void 0 ? {} : { pool: report.poolPick },
129399
129476
  configProfile: { name: report.configProfileName ?? null, source: report.configProfileSource },
129400
129477
  layers: report.resolved.assembled.layers.map((layer) => ({ id: layer.id, kind: layer.kind, source: layer.source })),
@@ -129475,6 +129552,7 @@ function collectCheckReport(params) {
129475
129552
  ...identityDecision.name === void 0 ? {} : { identityName: identityDecision.name },
129476
129553
  ...identityId === void 0 ? {} : { identityId },
129477
129554
  identitySource: identityDecision.source,
129555
+ ...identityId === void 0 ? {} : { borrowedLogins: loginsLentTo(listIdentities(paths).flatMap((entry) => entry.problem === void 0 ? [{ id: entry.id, name: entry.name, grants: entry.identity.grants }] : []), identityId) },
129478
129556
  ...poolPick === void 0 ? {} : { poolPick },
129479
129557
  ...configProfileDecision.name === void 0 ? {} : { configProfileName: configProfileDecision.name },
129480
129558
  configProfileSource: configProfileDecision.source,
@@ -131874,11 +131952,20 @@ function runDoctor(params) {
131874
131952
  `${entry.name} is valid and authenticates with ${authenticatesWith}${cache.text}.`,
131875
131953
  entry.name
131876
131954
  );
131955
+ const keychainItem = params.platform === "darwin" && params.run !== void 0 ? keychainHasItem(params.run, entry.farmRoot) : void 0;
131956
+ for (const grant of validated3.data.grants ?? []) {
131957
+ if (!identityIds.has(grant.to)) {
131958
+ push("identity", "warn", `${entry.name} lends its login to identity id "${grant.to}", which does not exist. Remove that entry from its identity.json.`, entry.name);
131959
+ }
131960
+ }
131961
+ if (validated3.data.grants !== void 0 && keychainItem !== true && !entry.credentialsFilePresent) {
131962
+ push("sign-in", "warn", `${entry.name} lends its login but has none stored, so every borrowed request fails. Run \`agent-shim run @${entry.name}\` and sign in.`, entry.name);
131963
+ }
131877
131964
  const standing = credential !== void 0 ? "uses a credential block" : identityProvider !== void 0 ? `exists for provider "${identityProvider}"` : "is signed in";
131878
131965
  const signIn = decideSignIn({
131879
131966
  hasCredentialBlock: credential !== void 0,
131880
131967
  provider: identityProvider,
131881
- keychainItem: params.platform === "darwin" && params.run !== void 0 ? keychainHasItem(params.run, entry.farmRoot) : void 0,
131968
+ keychainItem,
131882
131969
  credentialsFile: entry.credentialsFilePresent,
131883
131970
  platform: params.platform
131884
131971
  });
@@ -132453,6 +132540,7 @@ function cacheChange(options, existing) {
132453
132540
 
132454
132541
  // src/cli/parsers.ts
132455
132542
  init_schema();
132543
+ init_identityGrants();
132456
132544
 
132457
132545
  // src/usage/anchor.ts
132458
132546
  init_schema();
@@ -132580,6 +132668,15 @@ function collectRepeated(value3, previous = []) {
132580
132668
  function collectAnchor(value3, previous = []) {
132581
132669
  return [...previous, asInvalidArgument(() => parseAnchor(value3))];
132582
132670
  }
132671
+ function collectGrantFeature(value3, previous = []) {
132672
+ return [...previous, asInvalidArgument(() => {
132673
+ const feature = GRANT_FEATURES.find((candidate) => candidate === value3);
132674
+ if (feature === void 0) {
132675
+ throw new Error(`"${value3}" is not one of ${GRANT_FEATURES.join(", ")}`);
132676
+ }
132677
+ return feature;
132678
+ })];
132679
+ }
132583
132680
  function parseUtilisationPercent(value3) {
132584
132681
  return asInvalidArgument(() => {
132585
132682
  const percent2 = CompactAtUtilisationSchema.safeParse(Number(value3));
@@ -132600,6 +132697,7 @@ function parseDurationOption(value3) {
132600
132697
  }
132601
132698
 
132602
132699
  // src/identityManager.ts
132700
+ init_identityGrants();
132603
132701
  init_classify();
132604
132702
  init_schema();
132605
132703
  init_credential();
@@ -132615,7 +132713,8 @@ function identityWriteView(identity) {
132615
132713
  ...identity.provider === void 0 ? {} : { provider: identity.provider },
132616
132714
  allowAmbientCredential: identity.allowAmbientCredential,
132617
132715
  ...identity.credential === void 0 ? {} : { credential: summariseCredential(identity.credential) },
132618
- ...identity.anchors === void 0 ? {} : { anchors: identity.anchors }
132716
+ ...identity.anchors === void 0 ? {} : { anchors: identity.anchors },
132717
+ ...identity.grants === void 0 ? {} : { grants: identity.grants }
132619
132718
  };
132620
132719
  }
132621
132720
 
@@ -134316,6 +134415,7 @@ async function tryRunAtIdentityShortcut(deps, argv, keychain) {
134316
134415
  return true;
134317
134416
  }
134318
134417
  function toIdentityView(paths, { entry, read }, sharesLoginWith) {
134418
+ const nameOf2 = identityLabeller(paths);
134319
134419
  const account = read?.account === void 0 ? void 0 : summariseIdentityAccount(read.account);
134320
134420
  return {
134321
134421
  name: entry.name,
@@ -134329,7 +134429,8 @@ function toIdentityView(paths, { entry, read }, sharesLoginWith) {
134329
134429
  ...entry.identity.provider === void 0 ? {} : { provider: entry.identity.provider },
134330
134430
  allowAmbientCredential: entry.identity.allowAmbientCredential,
134331
134431
  ...entry.identity.credential === void 0 ? {} : { credential: summariseCredential(entry.identity.credential) },
134332
- ...entry.identity.anchors === void 0 ? {} : { anchors: entry.identity.anchors }
134432
+ ...entry.identity.anchors === void 0 ? {} : { anchors: entry.identity.anchors },
134433
+ ...entry.identity.grants === void 0 ? {} : { grants: entry.identity.grants.map((grant) => ({ to: nameOf2(grant.to), features: grant.features })) }
134333
134434
  } : { problem: entry.problem, ...entry.displaced === void 0 ? {} : { displaced: entry.displaced } },
134334
134435
  ...account === void 0 ? {} : { account },
134335
134436
  ...read?.problem === void 0 ? {} : { accountProblem: read.problem },
@@ -134358,7 +134459,8 @@ function formatIdentityLine(entry, view, shared) {
134358
134459
  const provider = entry.identity.provider === void 0 ? "" : ` (provider: ${entry.identity.provider})`;
134359
134460
  const ambient = entry.identity.allowAmbientCredential ? " [allows ambient credential]" : "";
134360
134461
  const credential = entry.identity.credential === void 0 ? "" : ` [credential ${describeCredential(entry.identity.credential)}]`;
134361
- return `${marker}${named}${entry.identity.agent === "codex" ? " [codex]" : ""}${label2}${defaultProfile}${provider}${ambient}${credential}${account}${accountProblem}`;
134462
+ const grants = (view.grants ?? []).map((grant) => ` [lends to ${grant.to}: ${grant.features.join(", ")}]`).join("");
134463
+ return `${marker}${named}${entry.identity.agent === "codex" ? " [codex]" : ""}${label2}${defaultProfile}${provider}${ambient}${credential}${grants}${account}${accountProblem}`;
134362
134464
  }
134363
134465
  var RENAME_DESCRIPTION = "Rename an identity: change its name and rewrite every reference to it. Its directory, login and usage stay where they are, so it goes ahead while sessions run on it. A rename that was interrupted is finished by running the same command again.";
134364
134466
  var MOVE_DESCRIPTION = "Also move the identity's directory to the new name and carry its login across. Only for an identity whose directory has its name; refused while a session is running on it or a launch is starting on it. One that was interrupted is finished by running the same command again.";
@@ -134546,6 +134648,24 @@ Run \`agent-shim doctor\` for the full detail on every ${kinds.join(" or ")} ent
134546
134648
  "agent-shim identity set work --no-anchor"
134547
134649
  ]
134548
134650
  );
134651
+ withExamples(
134652
+ identity.command("grant <lender>").description("Let another identity's sessions use this identity's claude.ai login for the named features, through the front door. Nothing is lent until granted.").requiredOption("--to <borrower>", "The identity whose sessions may use the login.").requiredOption("--feature <feature>", `What the login may be used for (repeatable): ${GRANT_FEATURES.join(", ")}.`, collectGrantFeature).option("--json", "Print the result as JSON.").action((lender, options) => {
134653
+ const updated = grantIdentityLogin(paths, { lender, borrower: options.to }, options.feature);
134654
+ reportMutation(options.json, { action: "updated", kind: "identity", name: lender, value: identityWriteView(updated) }, () => {
134655
+ console.log(`Identity "${options.to}" may now use the login of "${lender}" for ${options.feature.join(", ")}.`);
134656
+ });
134657
+ }),
134658
+ ["agent-shim identity grant personal --to work --feature artifacts --feature connectors"]
134659
+ );
134660
+ withExamples(
134661
+ identity.command("revoke <lender>").description("Stop another identity's sessions using this identity's claude.ai login, for the named features or for everything.").requiredOption("--to <borrower>", "The identity whose grant is taken back.").option("--feature <feature>", `What to stop (repeatable; everything when absent): ${GRANT_FEATURES.join(", ")}.`, collectGrantFeature).option("--json", "Print the result as JSON.").action((lender, options) => {
134662
+ const updated = revokeIdentityLogin(paths, { lender, borrower: options.to }, options.feature);
134663
+ reportMutation(options.json, { action: "updated", kind: "identity", name: lender, value: identityWriteView(updated) }, () => {
134664
+ console.log(`Identity "${options.to}" may no longer use the login of "${lender}" for ${options.feature === void 0 ? "anything" : options.feature.join(", ")}.`);
134665
+ });
134666
+ }),
134667
+ ["agent-shim identity revoke personal --to work --feature connectors", "agent-shim identity revoke personal --to work"]
134668
+ );
134549
134669
  withExamples(
134550
134670
  identity.command("remove <name>").description(
134551
134671
  `Delete an identity and its directory, including its credentials and anything it does not share with ~/.claude, and ${REMOVED_STATE}. Shared data in ~/.claude is kept.`
@@ -136456,6 +136576,7 @@ var PoolPickReportSchema = external_exports.strictObject({
136456
136576
  });
136457
136577
 
136458
136578
  // src/checkReportSchema.ts
136579
+ init_identityGrants();
136459
136580
  var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
136460
136581
  var CheckLayerViewSchema = external_exports.strictObject({
136461
136582
  id: external_exports.int(),
@@ -136531,6 +136652,8 @@ var CheckClaudeVersionSchema = external_exports.strictObject({
136531
136652
  });
136532
136653
  var CheckReportJsonSchema = external_exports.strictObject({
136533
136654
  identity: external_exports.strictObject({ name: external_exports.string().nullable(), source: external_exports.enum(IDENTITY_DECISION_SOURCES) }),
136655
+ /** The logins other identities lend this one through the front door; absent when none does. */
136656
+ borrowedLogins: external_exports.readonly(external_exports.array(external_exports.strictObject({ from: external_exports.string(), features: external_exports.readonly(external_exports.array(external_exports.enum(GRANT_FEATURES))) }))).optional(),
136534
136657
  /** The pool ranking, when the launch named a pool instead of an identity. */
136535
136658
  pool: PoolPickReportSchema.optional(),
136536
136659
  configProfile: external_exports.strictObject({ name: external_exports.string().nullable(), source: external_exports.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
@@ -147777,7 +147900,9 @@ var IdentityValueSchema = external_exports.strictObject({
147777
147900
  provider: external_exports.string().optional(),
147778
147901
  allowAmbientCredential: external_exports.boolean(),
147779
147902
  credential: CredentialSummarySchema2.optional(),
147780
- anchors: external_exports.array(AnchorSchema).optional()
147903
+ anchors: external_exports.array(AnchorSchema).optional(),
147904
+ /** Read only here: a grant is made and revoked from the command line alone, so a program driving the door cannot widen what it may reach. */
147905
+ grants: external_exports.array(IdentityGrantSchema).optional()
147781
147906
  });
147782
147907
  var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
147783
147908
  var ProviderValueSchema = external_exports.strictObject({
package/dist/index.cjs CHANGED
@@ -926,6 +926,35 @@ var init_versionDiscovery = __esm({
926
926
  }
927
927
  });
928
928
 
929
+ // src/identityGrants.ts
930
+ function canonicalFeatures(features) {
931
+ return GRANT_FEATURES.filter((feature) => features.includes(feature));
932
+ }
933
+ function withGrant(grants, borrowerId, features) {
934
+ const held = grants.find((grant) => grant.to === borrowerId)?.features ?? [];
935
+ const added = { to: borrowerId, features: canonicalFeatures([...held, ...features]) };
936
+ return [...grants.filter((grant) => grant.to !== borrowerId), added].sort((first, second) => first.to.localeCompare(second.to));
937
+ }
938
+ function withoutGrant(grants, borrowerId, features) {
939
+ return grants.flatMap((grant) => {
940
+ if (grant.to !== borrowerId) {
941
+ return [grant];
942
+ }
943
+ const kept = features === void 0 ? [] : grant.features.filter((feature) => !features.includes(feature));
944
+ return kept.length === 0 ? [] : [{ to: grant.to, features: kept }];
945
+ });
946
+ }
947
+ function loginsLentTo(identities, borrowerId) {
948
+ return identities.flatMap((identity) => identity.id === borrowerId ? [] : (identity.grants ?? []).filter((grant) => grant.to === borrowerId).map((grant) => ({ from: identity.name, features: grant.features })));
949
+ }
950
+ var GRANT_FEATURES;
951
+ var init_identityGrants = __esm({
952
+ "src/identityGrants.ts"() {
953
+ "use strict";
954
+ GRANT_FEATURES = ["remote-control", "artifacts", "connectors", "server-tools"];
955
+ }
956
+ });
957
+
929
958
  // src/config/schema.ts
930
959
  function isOverridableCategory(name) {
931
960
  return OVERRIDABLE_CATEGORIES.some((category) => category === name);
@@ -964,7 +993,7 @@ function isTimeZone(name) {
964
993
  return false;
965
994
  }
966
995
  }
967
- var import_node_path3, import_zod3, import_trilean, 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, TIER_MODEL_ENV_VARIABLES, OTHER_MODEL_ENV_VARIABLES, MODEL_ENV_VARIABLES, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, MAX_TIMER_DELAY_MS, HttpBaseUrlSchema, SERVER_TOOLS_MODES, HttpProviderSchema, CodexProviderSchema, RouterProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, FamilySettingsSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_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;
996
+ var import_node_path3, import_zod3, import_trilean, 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, TIER_MODEL_ENV_VARIABLES, OTHER_MODEL_ENV_VARIABLES, MODEL_ENV_VARIABLES, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, MAX_TIMER_DELAY_MS, HttpBaseUrlSchema, SERVER_TOOLS_MODES, HttpProviderSchema, CodexProviderSchema, RouterProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, FamilySettingsSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_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, IdentityGrantSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
968
997
  var init_schema = __esm({
969
998
  "src/config/schema.ts"() {
970
999
  "use strict";
@@ -977,6 +1006,7 @@ var init_schema = __esm({
977
1006
  init_identity();
978
1007
  init_versionDiscovery();
979
1008
  init_ownEntry();
1009
+ init_identityGrants();
980
1010
  CATEGORY_NAMES = ["secret", "runtime", "history", "knowledge", "settings"];
981
1011
  OVERRIDABLE_CATEGORIES = ["runtime", "history", "knowledge", "settings"];
982
1012
  CategoryMapSchema = import_zod3.z.strictObject({
@@ -1425,6 +1455,10 @@ var init_schema = __esm({
1425
1455
  models: ModelsConfigSchema.optional(),
1426
1456
  jobs: import_zod3.z.record(PoolNameSchema, JobSchema).optional()
1427
1457
  });
1458
+ IdentityGrantSchema = import_zod3.z.strictObject({
1459
+ to: FileNameSchema,
1460
+ features: import_zod3.z.array(import_zod3.z.enum(GRANT_FEATURES)).min(1)
1461
+ });
1428
1462
  IdentitySchema = import_zod3.z.strictObject({
1429
1463
  /** The CLI this login belongs to; absent means Claude Code for backwards compatibility. */
1430
1464
  agent: import_zod3.z.enum(["claude", "codex"]).optional(),
@@ -1437,6 +1471,8 @@ var init_schema = __esm({
1437
1471
  provider: StoredNameSchema.optional(),
1438
1472
  allowAmbientCredential: import_zod3.z.boolean().default(false),
1439
1473
  credential: CredentialSchema.optional(),
1474
+ /** Which other identities may use this identity's claude.ai login, and for what (`identity grant`). Absent: none may. */
1475
+ grants: import_zod3.z.array(IdentityGrantSchema).min(1).optional(),
1440
1476
  /** When this identity's five-hour window should be open: the front door opens one at each anchor if none is. Absent, nothing is opened on a schedule. */
1441
1477
  anchors: import_zod3.z.array(AnchorSchema).min(1).optional()
1442
1478
  });
@@ -15039,6 +15075,35 @@ function setAllowAmbientCredential(paths, identityName, allow) {
15039
15075
  allowAmbientCredential: allow
15040
15076
  });
15041
15077
  }
15078
+ function changeIdentityGrants(paths, parties, change, namesLock) {
15079
+ return withIdentityNamesLock(paths, namesLock, () => {
15080
+ const lenderId = requireStoredIdentityId(paths, parties.lender);
15081
+ const borrowerId = requireStoredIdentityId(paths, parties.borrower);
15082
+ if (lenderId === borrowerId) {
15083
+ throw new UsageError(`Identity "${parties.lender}" already uses its own login, so there is nothing to grant to itself.`);
15084
+ }
15085
+ const lender = readIdentityById(paths, lenderId);
15086
+ const borrower = readIdentityById(paths, borrowerId);
15087
+ if (lender === void 0) {
15088
+ throw identityNotFound(paths, parties.lender);
15089
+ }
15090
+ for (const identity of [lender, borrower]) {
15091
+ if (identity?.agent === "codex") {
15092
+ throw new UsageError(`Identity "${identity.name}" runs Codex, which has no claude.ai login to lend or borrow.`);
15093
+ }
15094
+ }
15095
+ return writeIdentityGrants(paths, lenderId, change(lender.grants ?? [], borrowerId));
15096
+ });
15097
+ }
15098
+ function writeIdentityGrants(paths, id, grants) {
15099
+ return applyPatch(identityJsonPath(paths, id), IdentitySchema, { grants: grants.length === 0 ? void 0 : grants.map((grant) => ({ to: grant.to, features: [...grant.features] })) });
15100
+ }
15101
+ function grantIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
15102
+ return changeIdentityGrants(paths, parties, (grants, borrowerId) => withGrant(grants, borrowerId, features), namesLock);
15103
+ }
15104
+ function revokeIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
15105
+ return changeIdentityGrants(paths, parties, (grants, borrowerId) => withoutGrant(grants, borrowerId, features), namesLock);
15106
+ }
15042
15107
  function setIdentityCredential(paths, identityName, change) {
15043
15108
  const id = requireStoredIdentityId(paths, identityName);
15044
15109
  const existing = readIdentityById(paths, id);
@@ -15121,6 +15186,11 @@ function removeIdentityWithLockHeld(paths, name, namesLock) {
15121
15186
  if (readActiveIdentity2(paths) === name) {
15122
15187
  import_node_fs9.default.rmSync(paths.activeIdentityFile);
15123
15188
  }
15189
+ for (const listing of listIdentities(paths)) {
15190
+ if (listing.problem === void 0 && listing.identity.grants?.some((grant) => grant.to === id) === true) {
15191
+ writeIdentityGrants(paths, listing.id, withoutGrant(listing.identity.grants, id, void 0));
15192
+ }
15193
+ }
15124
15194
  return id;
15125
15195
  } finally {
15126
15196
  resync.release();
@@ -15152,6 +15222,7 @@ var init_identityStore = __esm({
15152
15222
  init_sameDirectory();
15153
15223
  init_identityRecords();
15154
15224
  init_launchRecords();
15225
+ init_identityGrants();
15155
15226
  IdentityNotFoundError = class extends CliError {
15156
15227
  constructor(name, remedy2 = `Run \`agent-shim identity add ${name}\` first.`) {
15157
15228
  super(`No identity named "${name}". ${remedy2}`);
@@ -15212,7 +15283,7 @@ var init_package = __esm({
15212
15283
  "package.json"() {
15213
15284
  package_default = {
15214
15285
  name: "agent-shim",
15215
- version: "14.12.5",
15286
+ version: "14.13.0",
15216
15287
  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.",
15217
15288
  license: "MIT",
15218
15289
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -20751,6 +20822,7 @@ __export(index_exports, {
20751
20822
  getRcSessionContextUsage: () => getRcSessionContextUsage,
20752
20823
  getRcSessionMcpStatus: () => getRcSessionMcpStatus,
20753
20824
  getRcSessionUsage: () => getRcSessionUsage,
20825
+ grantIdentityLogin: () => grantIdentityLogin,
20754
20826
  headroomSocketTarget: () => headroomSocketTarget,
20755
20827
  identityExists: () => identityExists,
20756
20828
  identityIdOf: () => identityIdOf,
@@ -20846,6 +20918,7 @@ __export(index_exports, {
20846
20918
  resolveLayoutPaths: () => resolveLayoutPaths,
20847
20919
  resolveSupervisorConfig: () => resolveSupervisorConfig,
20848
20920
  resyncFarm: () => resyncFarm,
20921
+ revokeIdentityLogin: () => revokeIdentityLogin,
20849
20922
  runCheck: () => runCheck,
20850
20923
  runClaudeLaunch: () => runClaudeLaunch,
20851
20924
  runDoctor: () => runDoctor,
@@ -22252,6 +22325,7 @@ var PoolPickReportSchema = import_zod28.z.strictObject({
22252
22325
  });
22253
22326
 
22254
22327
  // src/checkReportSchema.ts
22328
+ init_identityGrants();
22255
22329
  var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
22256
22330
  var CheckLayerViewSchema = import_zod29.z.strictObject({
22257
22331
  id: import_zod29.z.int(),
@@ -22327,6 +22401,8 @@ var CheckClaudeVersionSchema = import_zod29.z.strictObject({
22327
22401
  });
22328
22402
  var CheckReportJsonSchema = import_zod29.z.strictObject({
22329
22403
  identity: import_zod29.z.strictObject({ name: import_zod29.z.string().nullable(), source: import_zod29.z.enum(IDENTITY_DECISION_SOURCES) }),
22404
+ /** The logins other identities lend this one through the front door; absent when none does. */
22405
+ borrowedLogins: import_zod29.z.readonly(import_zod29.z.array(import_zod29.z.strictObject({ from: import_zod29.z.string(), features: import_zod29.z.readonly(import_zod29.z.array(import_zod29.z.enum(GRANT_FEATURES))) }))).optional(),
22330
22406
  /** The pool ranking, when the launch named a pool instead of an identity. */
22331
22407
  pool: PoolPickReportSchema.optional(),
22332
22408
  configProfile: import_zod29.z.strictObject({ name: import_zod29.z.string().nullable(), source: import_zod29.z.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
@@ -22679,6 +22755,7 @@ init_schema();
22679
22755
  init_baseUrlDisplay();
22680
22756
  init_providerReachability();
22681
22757
  init_identityStore();
22758
+ init_identityGrants();
22682
22759
  init_credential();
22683
22760
  init_claudeVersion();
22684
22761
  init_credentialCache();
@@ -22874,6 +22951,7 @@ function runCheck(params) {
22874
22951
  return {
22875
22952
  ...params.identityName === void 0 ? {} : { identityName: params.identityName },
22876
22953
  identitySource: params.identitySource,
22954
+ ...params.borrowedLogins === void 0 || params.borrowedLogins.length === 0 ? {} : { borrowedLogins: params.borrowedLogins },
22877
22955
  ...params.poolPick === void 0 ? {} : { poolPick: params.poolPick },
22878
22956
  ...params.configProfileName === void 0 ? {} : { configProfileName: params.configProfileName },
22879
22957
  configProfileSource: params.configProfileSource,
@@ -22900,6 +22978,9 @@ function buildProviderReachability(provider, probe) {
22900
22978
  function formatCheckReport(report) {
22901
22979
  const lines = [];
22902
22980
  lines.push(`Identity: ${report.identityName ?? "(none)"} (${report.identitySource})`);
22981
+ for (const loan of report.borrowedLogins ?? []) {
22982
+ lines.push(`Borrows the login of ${loan.from} for ${loan.features.join(", ")}.`);
22983
+ }
22903
22984
  if (report.poolPick !== void 0) {
22904
22985
  const top = report.poolPick.candidates.find((candidate) => candidate.identity === report.poolPick?.pick);
22905
22986
  lines.push(`Pool: ${report.poolPick.pool}${top === void 0 ? ", every member is refused right now" : `, would pick ${top.identity} (${top.reasons.join("; ")})`}`);
@@ -22994,6 +23075,7 @@ function checkReportToJson(report) {
22994
23075
  const decisions = [...report.resolved.decisions.values()].sort((a, b) => a.relPath < b.relPath ? -1 : a.relPath > b.relPath ? 1 : 0);
22995
23076
  return {
22996
23077
  identity: { name: report.identityName ?? null, source: report.identitySource },
23078
+ ...report.borrowedLogins === void 0 ? {} : { borrowedLogins: report.borrowedLogins },
22997
23079
  ...report.poolPick === void 0 ? {} : { pool: report.poolPick },
22998
23080
  configProfile: { name: report.configProfileName ?? null, source: report.configProfileSource },
22999
23081
  layers: report.resolved.assembled.layers.map((layer) => ({ id: layer.id, kind: layer.kind, source: layer.source })),
@@ -23074,6 +23156,7 @@ function collectCheckReport(params) {
23074
23156
  ...identityDecision.name === void 0 ? {} : { identityName: identityDecision.name },
23075
23157
  ...identityId === void 0 ? {} : { identityId },
23076
23158
  identitySource: identityDecision.source,
23159
+ ...identityId === void 0 ? {} : { borrowedLogins: loginsLentTo(listIdentities(paths).flatMap((entry) => entry.problem === void 0 ? [{ id: entry.id, name: entry.name, grants: entry.identity.grants }] : []), identityId) },
23077
23160
  ...poolPick === void 0 ? {} : { poolPick },
23078
23161
  ...configProfileDecision.name === void 0 ? {} : { configProfileName: configProfileDecision.name },
23079
23162
  configProfileSource: configProfileDecision.source,
@@ -24785,11 +24868,20 @@ function runDoctor(params) {
24785
24868
  `${entry.name} is valid and authenticates with ${authenticatesWith}${cache.text}.`,
24786
24869
  entry.name
24787
24870
  );
24871
+ const keychainItem = params.platform === "darwin" && params.run !== void 0 ? keychainHasItem(params.run, entry.farmRoot) : void 0;
24872
+ for (const grant of validated3.data.grants ?? []) {
24873
+ if (!identityIds.has(grant.to)) {
24874
+ push("identity", "warn", `${entry.name} lends its login to identity id "${grant.to}", which does not exist. Remove that entry from its identity.json.`, entry.name);
24875
+ }
24876
+ }
24877
+ if (validated3.data.grants !== void 0 && keychainItem !== true && !entry.credentialsFilePresent) {
24878
+ push("sign-in", "warn", `${entry.name} lends its login but has none stored, so every borrowed request fails. Run \`agent-shim run @${entry.name}\` and sign in.`, entry.name);
24879
+ }
24788
24880
  const standing = credential !== void 0 ? "uses a credential block" : identityProvider !== void 0 ? `exists for provider "${identityProvider}"` : "is signed in";
24789
24881
  const signIn = decideSignIn({
24790
24882
  hasCredentialBlock: credential !== void 0,
24791
24883
  provider: identityProvider,
24792
- keychainItem: params.platform === "darwin" && params.run !== void 0 ? keychainHasItem(params.run, entry.farmRoot) : void 0,
24884
+ keychainItem,
24793
24885
  credentialsFile: entry.credentialsFilePresent,
24794
24886
  platform: params.platform
24795
24887
  });
@@ -25360,7 +25452,8 @@ function identityWriteView(identity) {
25360
25452
  ...identity.provider === void 0 ? {} : { provider: identity.provider },
25361
25453
  allowAmbientCredential: identity.allowAmbientCredential,
25362
25454
  ...identity.credential === void 0 ? {} : { credential: summariseCredential(identity.credential) },
25363
- ...identity.anchors === void 0 ? {} : { anchors: identity.anchors }
25455
+ ...identity.anchors === void 0 ? {} : { anchors: identity.anchors },
25456
+ ...identity.grants === void 0 ? {} : { grants: identity.grants }
25364
25457
  };
25365
25458
  }
25366
25459
 
@@ -25433,7 +25526,9 @@ var IdentityValueSchema = import_zod43.z.strictObject({
25433
25526
  provider: import_zod43.z.string().optional(),
25434
25527
  allowAmbientCredential: import_zod43.z.boolean(),
25435
25528
  credential: CredentialSummarySchema2.optional(),
25436
- anchors: import_zod43.z.array(AnchorSchema).optional()
25529
+ anchors: import_zod43.z.array(AnchorSchema).optional(),
25530
+ /** Read only here: a grant is made and revoked from the command line alone, so a program driving the door cannot widen what it may reach. */
25531
+ grants: import_zod43.z.array(IdentityGrantSchema).optional()
25437
25532
  });
25438
25533
  var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
25439
25534
  var ProviderValueSchema = import_zod43.z.strictObject({
@@ -29502,6 +29597,7 @@ init_ownCli();
29502
29597
  getRcSessionContextUsage,
29503
29598
  getRcSessionMcpStatus,
29504
29599
  getRcSessionUsage,
29600
+ grantIdentityLogin,
29505
29601
  headroomSocketTarget,
29506
29602
  identityExists,
29507
29603
  identityIdOf,
@@ -29597,6 +29693,7 @@ init_ownCli();
29597
29693
  resolveLayoutPaths,
29598
29694
  resolveSupervisorConfig,
29599
29695
  resyncFarm,
29696
+ revokeIdentityLogin,
29600
29697
  runCheck,
29601
29698
  runClaudeLaunch,
29602
29699
  runDoctor,
package/dist/index.mjs CHANGED
@@ -904,6 +904,35 @@ var init_versionDiscovery = __esm({
904
904
  }
905
905
  });
906
906
 
907
+ // src/identityGrants.ts
908
+ function canonicalFeatures(features) {
909
+ return GRANT_FEATURES.filter((feature) => features.includes(feature));
910
+ }
911
+ function withGrant(grants, borrowerId, features) {
912
+ const held = grants.find((grant) => grant.to === borrowerId)?.features ?? [];
913
+ const added = { to: borrowerId, features: canonicalFeatures([...held, ...features]) };
914
+ return [...grants.filter((grant) => grant.to !== borrowerId), added].sort((first, second) => first.to.localeCompare(second.to));
915
+ }
916
+ function withoutGrant(grants, borrowerId, features) {
917
+ return grants.flatMap((grant) => {
918
+ if (grant.to !== borrowerId) {
919
+ return [grant];
920
+ }
921
+ const kept = features === void 0 ? [] : grant.features.filter((feature) => !features.includes(feature));
922
+ return kept.length === 0 ? [] : [{ to: grant.to, features: kept }];
923
+ });
924
+ }
925
+ function loginsLentTo(identities, borrowerId) {
926
+ return identities.flatMap((identity) => identity.id === borrowerId ? [] : (identity.grants ?? []).filter((grant) => grant.to === borrowerId).map((grant) => ({ from: identity.name, features: grant.features })));
927
+ }
928
+ var GRANT_FEATURES;
929
+ var init_identityGrants = __esm({
930
+ "src/identityGrants.ts"() {
931
+ "use strict";
932
+ GRANT_FEATURES = ["remote-control", "artifacts", "connectors", "server-tools"];
933
+ }
934
+ });
935
+
907
936
  // src/config/schema.ts
908
937
  import path3 from "node:path";
909
938
  import { z as z3 } from "zod";
@@ -945,7 +974,7 @@ function isTimeZone(name) {
945
974
  return false;
946
975
  }
947
976
  }
948
- 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, TIER_MODEL_ENV_VARIABLES, OTHER_MODEL_ENV_VARIABLES, MODEL_ENV_VARIABLES, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, MAX_TIMER_DELAY_MS, HttpBaseUrlSchema, SERVER_TOOLS_MODES, HttpProviderSchema, CodexProviderSchema, RouterProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, FamilySettingsSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_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;
977
+ 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, TIER_MODEL_ENV_VARIABLES, OTHER_MODEL_ENV_VARIABLES, MODEL_ENV_VARIABLES, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, MAX_TIMER_DELAY_MS, HttpBaseUrlSchema, SERVER_TOOLS_MODES, HttpProviderSchema, CodexProviderSchema, RouterProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, FamilySettingsSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_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, IdentityGrantSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
949
978
  var init_schema = __esm({
950
979
  "src/config/schema.ts"() {
951
980
  "use strict";
@@ -955,6 +984,7 @@ var init_schema = __esm({
955
984
  init_identity();
956
985
  init_versionDiscovery();
957
986
  init_ownEntry();
987
+ init_identityGrants();
958
988
  CATEGORY_NAMES = ["secret", "runtime", "history", "knowledge", "settings"];
959
989
  OVERRIDABLE_CATEGORIES = ["runtime", "history", "knowledge", "settings"];
960
990
  CategoryMapSchema = z3.strictObject({
@@ -1403,6 +1433,10 @@ var init_schema = __esm({
1403
1433
  models: ModelsConfigSchema.optional(),
1404
1434
  jobs: z3.record(PoolNameSchema, JobSchema).optional()
1405
1435
  });
1436
+ IdentityGrantSchema = z3.strictObject({
1437
+ to: FileNameSchema,
1438
+ features: z3.array(z3.enum(GRANT_FEATURES)).min(1)
1439
+ });
1406
1440
  IdentitySchema = z3.strictObject({
1407
1441
  /** The CLI this login belongs to; absent means Claude Code for backwards compatibility. */
1408
1442
  agent: z3.enum(["claude", "codex"]).optional(),
@@ -1415,6 +1449,8 @@ var init_schema = __esm({
1415
1449
  provider: StoredNameSchema.optional(),
1416
1450
  allowAmbientCredential: z3.boolean().default(false),
1417
1451
  credential: CredentialSchema.optional(),
1452
+ /** Which other identities may use this identity's claude.ai login, and for what (`identity grant`). Absent: none may. */
1453
+ grants: z3.array(IdentityGrantSchema).min(1).optional(),
1418
1454
  /** When this identity's five-hour window should be open: the front door opens one at each anchor if none is. Absent, nothing is opened on a schedule. */
1419
1455
  anchors: z3.array(AnchorSchema).min(1).optional()
1420
1456
  });
@@ -15012,6 +15048,35 @@ function setAllowAmbientCredential(paths, identityName, allow) {
15012
15048
  allowAmbientCredential: allow
15013
15049
  });
15014
15050
  }
15051
+ function changeIdentityGrants(paths, parties, change, namesLock) {
15052
+ return withIdentityNamesLock(paths, namesLock, () => {
15053
+ const lenderId = requireStoredIdentityId(paths, parties.lender);
15054
+ const borrowerId = requireStoredIdentityId(paths, parties.borrower);
15055
+ if (lenderId === borrowerId) {
15056
+ throw new UsageError(`Identity "${parties.lender}" already uses its own login, so there is nothing to grant to itself.`);
15057
+ }
15058
+ const lender = readIdentityById(paths, lenderId);
15059
+ const borrower = readIdentityById(paths, borrowerId);
15060
+ if (lender === void 0) {
15061
+ throw identityNotFound(paths, parties.lender);
15062
+ }
15063
+ for (const identity of [lender, borrower]) {
15064
+ if (identity?.agent === "codex") {
15065
+ throw new UsageError(`Identity "${identity.name}" runs Codex, which has no claude.ai login to lend or borrow.`);
15066
+ }
15067
+ }
15068
+ return writeIdentityGrants(paths, lenderId, change(lender.grants ?? [], borrowerId));
15069
+ });
15070
+ }
15071
+ function writeIdentityGrants(paths, id, grants) {
15072
+ return applyPatch(identityJsonPath(paths, id), IdentitySchema, { grants: grants.length === 0 ? void 0 : grants.map((grant) => ({ to: grant.to, features: [...grant.features] })) });
15073
+ }
15074
+ function grantIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
15075
+ return changeIdentityGrants(paths, parties, (grants, borrowerId) => withGrant(grants, borrowerId, features), namesLock);
15076
+ }
15077
+ function revokeIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
15078
+ return changeIdentityGrants(paths, parties, (grants, borrowerId) => withoutGrant(grants, borrowerId, features), namesLock);
15079
+ }
15015
15080
  function setIdentityCredential(paths, identityName, change) {
15016
15081
  const id = requireStoredIdentityId(paths, identityName);
15017
15082
  const existing = readIdentityById(paths, id);
@@ -15094,6 +15159,11 @@ function removeIdentityWithLockHeld(paths, name, namesLock) {
15094
15159
  if (readActiveIdentity2(paths) === name) {
15095
15160
  fs9.rmSync(paths.activeIdentityFile);
15096
15161
  }
15162
+ for (const listing of listIdentities(paths)) {
15163
+ if (listing.problem === void 0 && listing.identity.grants?.some((grant) => grant.to === id) === true) {
15164
+ writeIdentityGrants(paths, listing.id, withoutGrant(listing.identity.grants, id, void 0));
15165
+ }
15166
+ }
15097
15167
  return id;
15098
15168
  } finally {
15099
15169
  resync.release();
@@ -15123,6 +15193,7 @@ var init_identityStore = __esm({
15123
15193
  init_sameDirectory();
15124
15194
  init_identityRecords();
15125
15195
  init_launchRecords();
15196
+ init_identityGrants();
15126
15197
  IdentityNotFoundError = class extends CliError {
15127
15198
  constructor(name, remedy2 = `Run \`agent-shim identity add ${name}\` first.`) {
15128
15199
  super(`No identity named "${name}". ${remedy2}`);
@@ -15183,7 +15254,7 @@ var init_package = __esm({
15183
15254
  "package.json"() {
15184
15255
  package_default = {
15185
15256
  name: "agent-shim",
15186
- version: "14.12.5",
15257
+ version: "14.13.0",
15187
15258
  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.",
15188
15259
  license: "MIT",
15189
15260
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -21799,6 +21870,7 @@ var PoolPickReportSchema = z28.strictObject({
21799
21870
  });
21800
21871
 
21801
21872
  // src/checkReportSchema.ts
21873
+ init_identityGrants();
21802
21874
  var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
21803
21875
  var CheckLayerViewSchema = z29.strictObject({
21804
21876
  id: z29.int(),
@@ -21874,6 +21946,8 @@ var CheckClaudeVersionSchema = z29.strictObject({
21874
21946
  });
21875
21947
  var CheckReportJsonSchema = z29.strictObject({
21876
21948
  identity: z29.strictObject({ name: z29.string().nullable(), source: z29.enum(IDENTITY_DECISION_SOURCES) }),
21949
+ /** The logins other identities lend this one through the front door; absent when none does. */
21950
+ borrowedLogins: z29.readonly(z29.array(z29.strictObject({ from: z29.string(), features: z29.readonly(z29.array(z29.enum(GRANT_FEATURES))) }))).optional(),
21877
21951
  /** The pool ranking, when the launch named a pool instead of an identity. */
21878
21952
  pool: PoolPickReportSchema.optional(),
21879
21953
  configProfile: z29.strictObject({ name: z29.string().nullable(), source: z29.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
@@ -22224,6 +22298,7 @@ init_schema();
22224
22298
  init_baseUrlDisplay();
22225
22299
  init_providerReachability();
22226
22300
  init_identityStore();
22301
+ init_identityGrants();
22227
22302
  init_credential();
22228
22303
  init_claudeVersion();
22229
22304
  init_credentialCache();
@@ -22421,6 +22496,7 @@ function runCheck(params) {
22421
22496
  return {
22422
22497
  ...params.identityName === void 0 ? {} : { identityName: params.identityName },
22423
22498
  identitySource: params.identitySource,
22499
+ ...params.borrowedLogins === void 0 || params.borrowedLogins.length === 0 ? {} : { borrowedLogins: params.borrowedLogins },
22424
22500
  ...params.poolPick === void 0 ? {} : { poolPick: params.poolPick },
22425
22501
  ...params.configProfileName === void 0 ? {} : { configProfileName: params.configProfileName },
22426
22502
  configProfileSource: params.configProfileSource,
@@ -22447,6 +22523,9 @@ function buildProviderReachability(provider, probe) {
22447
22523
  function formatCheckReport(report) {
22448
22524
  const lines = [];
22449
22525
  lines.push(`Identity: ${report.identityName ?? "(none)"} (${report.identitySource})`);
22526
+ for (const loan of report.borrowedLogins ?? []) {
22527
+ lines.push(`Borrows the login of ${loan.from} for ${loan.features.join(", ")}.`);
22528
+ }
22450
22529
  if (report.poolPick !== void 0) {
22451
22530
  const top = report.poolPick.candidates.find((candidate) => candidate.identity === report.poolPick?.pick);
22452
22531
  lines.push(`Pool: ${report.poolPick.pool}${top === void 0 ? ", every member is refused right now" : `, would pick ${top.identity} (${top.reasons.join("; ")})`}`);
@@ -22541,6 +22620,7 @@ function checkReportToJson(report) {
22541
22620
  const decisions = [...report.resolved.decisions.values()].sort((a, b) => a.relPath < b.relPath ? -1 : a.relPath > b.relPath ? 1 : 0);
22542
22621
  return {
22543
22622
  identity: { name: report.identityName ?? null, source: report.identitySource },
22623
+ ...report.borrowedLogins === void 0 ? {} : { borrowedLogins: report.borrowedLogins },
22544
22624
  ...report.poolPick === void 0 ? {} : { pool: report.poolPick },
22545
22625
  configProfile: { name: report.configProfileName ?? null, source: report.configProfileSource },
22546
22626
  layers: report.resolved.assembled.layers.map((layer) => ({ id: layer.id, kind: layer.kind, source: layer.source })),
@@ -22621,6 +22701,7 @@ function collectCheckReport(params) {
22621
22701
  ...identityDecision.name === void 0 ? {} : { identityName: identityDecision.name },
22622
22702
  ...identityId === void 0 ? {} : { identityId },
22623
22703
  identitySource: identityDecision.source,
22704
+ ...identityId === void 0 ? {} : { borrowedLogins: loginsLentTo(listIdentities(paths).flatMap((entry) => entry.problem === void 0 ? [{ id: entry.id, name: entry.name, grants: entry.identity.grants }] : []), identityId) },
22624
22705
  ...poolPick === void 0 ? {} : { poolPick },
22625
22706
  ...configProfileDecision.name === void 0 ? {} : { configProfileName: configProfileDecision.name },
22626
22707
  configProfileSource: configProfileDecision.source,
@@ -24332,11 +24413,20 @@ function runDoctor(params) {
24332
24413
  `${entry.name} is valid and authenticates with ${authenticatesWith}${cache.text}.`,
24333
24414
  entry.name
24334
24415
  );
24416
+ const keychainItem = params.platform === "darwin" && params.run !== void 0 ? keychainHasItem(params.run, entry.farmRoot) : void 0;
24417
+ for (const grant of validated3.data.grants ?? []) {
24418
+ if (!identityIds.has(grant.to)) {
24419
+ push("identity", "warn", `${entry.name} lends its login to identity id "${grant.to}", which does not exist. Remove that entry from its identity.json.`, entry.name);
24420
+ }
24421
+ }
24422
+ if (validated3.data.grants !== void 0 && keychainItem !== true && !entry.credentialsFilePresent) {
24423
+ push("sign-in", "warn", `${entry.name} lends its login but has none stored, so every borrowed request fails. Run \`agent-shim run @${entry.name}\` and sign in.`, entry.name);
24424
+ }
24335
24425
  const standing = credential !== void 0 ? "uses a credential block" : identityProvider !== void 0 ? `exists for provider "${identityProvider}"` : "is signed in";
24336
24426
  const signIn = decideSignIn({
24337
24427
  hasCredentialBlock: credential !== void 0,
24338
24428
  provider: identityProvider,
24339
- keychainItem: params.platform === "darwin" && params.run !== void 0 ? keychainHasItem(params.run, entry.farmRoot) : void 0,
24429
+ keychainItem,
24340
24430
  credentialsFile: entry.credentialsFilePresent,
24341
24431
  platform: params.platform
24342
24432
  });
@@ -24907,7 +24997,8 @@ function identityWriteView(identity) {
24907
24997
  ...identity.provider === void 0 ? {} : { provider: identity.provider },
24908
24998
  allowAmbientCredential: identity.allowAmbientCredential,
24909
24999
  ...identity.credential === void 0 ? {} : { credential: summariseCredential(identity.credential) },
24910
- ...identity.anchors === void 0 ? {} : { anchors: identity.anchors }
25000
+ ...identity.anchors === void 0 ? {} : { anchors: identity.anchors },
25001
+ ...identity.grants === void 0 ? {} : { grants: identity.grants }
24911
25002
  };
24912
25003
  }
24913
25004
 
@@ -24980,7 +25071,9 @@ var IdentityValueSchema = z43.strictObject({
24980
25071
  provider: z43.string().optional(),
24981
25072
  allowAmbientCredential: z43.boolean(),
24982
25073
  credential: CredentialSummarySchema2.optional(),
24983
- anchors: z43.array(AnchorSchema).optional()
25074
+ anchors: z43.array(AnchorSchema).optional(),
25075
+ /** Read only here: a grant is made and revoked from the command line alone, so a program driving the door cannot widen what it may reach. */
25076
+ grants: z43.array(IdentityGrantSchema).optional()
24984
25077
  });
24985
25078
  var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
24986
25079
  var ProviderValueSchema = z43.strictObject({
@@ -29048,6 +29141,7 @@ export {
29048
29141
  getRcSessionContextUsage,
29049
29142
  getRcSessionMcpStatus,
29050
29143
  getRcSessionUsage,
29144
+ grantIdentityLogin,
29051
29145
  headroomSocketTarget,
29052
29146
  identityExists,
29053
29147
  identityIdOf,
@@ -29143,6 +29237,7 @@ export {
29143
29237
  resolveLayoutPaths,
29144
29238
  resolveSupervisorConfig,
29145
29239
  resyncFarm,
29240
+ revokeIdentityLogin,
29146
29241
  runCheck,
29147
29242
  runClaudeLaunch,
29148
29243
  runDoctor,
@@ -5424,9 +5424,6 @@ declare const GlobalConfigSchema: z.ZodObject<{
5424
5424
  }, z.core.$strict>>>;
5425
5425
  }, z.core.$strict>;
5426
5426
  type GlobalConfig = z.infer<typeof GlobalConfigSchema>;
5427
- /**
5428
- * An identity's own `identity.json`. `credential`, when present, authenticates the identity from a token instead of (or ahead of) its stored login: the launcher resolves it and exports it as its target (typically `oauthToken`, a `claude setup-token` token) in the child's environment only. Without it the identity uses the login stored in its own directory.
5429
- */
5430
5427
  declare const IdentitySchema: z.ZodObject<{
5431
5428
  agent: z.ZodOptional<z.ZodEnum<{
5432
5429
  claude: "claude";
@@ -5474,6 +5471,15 @@ declare const IdentitySchema: z.ZodObject<{
5474
5471
  }>>;
5475
5472
  }, z.core.$strict>>;
5476
5473
  }, z.core.$strict>>;
5474
+ grants: z.ZodOptional<z.ZodArray<z.ZodObject<{
5475
+ to: z.ZodString;
5476
+ features: z.ZodArray<z.ZodEnum<{
5477
+ "remote-control": "remote-control";
5478
+ artifacts: "artifacts";
5479
+ connectors: "connectors";
5480
+ "server-tools": "server-tools";
5481
+ }>>;
5482
+ }, z.core.$strict>>>;
5477
5483
  anchors: z.ZodOptional<z.ZodArray<z.ZodObject<{
5478
5484
  days: z.ZodArray<z.ZodEnum<{
5479
5485
  mon: "mon";
@@ -9409,6 +9415,15 @@ declare const CheckReportJsonSchema: z.ZodObject<{
9409
9415
  none: "none";
9410
9416
  }>;
9411
9417
  }, z.core.$strict>;
9418
+ borrowedLogins: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
9419
+ from: z.ZodString;
9420
+ features: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
9421
+ "remote-control": "remote-control";
9422
+ artifacts: "artifacts";
9423
+ connectors: "connectors";
9424
+ "server-tools": "server-tools";
9425
+ }>>>;
9426
+ }, z.core.$strict>>>>;
9412
9427
  pool: z.ZodOptional<z.ZodObject<{
9413
9428
  pool: z.ZodString;
9414
9429
  directory: z.ZodString;
@@ -10296,6 +10311,15 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
10296
10311
  time: zod.ZodString;
10297
10312
  timeZone: zod.ZodOptional<zod.ZodString>;
10298
10313
  }, zod_v4_core.$strict>>>;
10314
+ grants: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
10315
+ to: zod.ZodString;
10316
+ features: zod.ZodArray<zod.ZodEnum<{
10317
+ "remote-control": "remote-control";
10318
+ artifacts: "artifacts";
10319
+ connectors: "connectors";
10320
+ "server-tools": "server-tools";
10321
+ }>>;
10322
+ }, zod_v4_core.$strict>>>;
10299
10323
  }, zod_v4_core.$strict>;
10300
10324
  }, zod_v4_core.$strict>, MergedErrorMap<$ErrorMap, TErrorMap>>;
10301
10325
  set: _orpc_server.DecoratedProcedure<DoorApiContext & object, IntersectPick<TInitialContext, $OutContext>, zod.ZodObject<{
@@ -10409,6 +10433,15 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
10409
10433
  time: zod.ZodString;
10410
10434
  timeZone: zod.ZodOptional<zod.ZodString>;
10411
10435
  }, zod_v4_core.$strict>>>;
10436
+ grants: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
10437
+ to: zod.ZodString;
10438
+ features: zod.ZodArray<zod.ZodEnum<{
10439
+ "remote-control": "remote-control";
10440
+ artifacts: "artifacts";
10441
+ connectors: "connectors";
10442
+ "server-tools": "server-tools";
10443
+ }>>;
10444
+ }, zod_v4_core.$strict>>>;
10412
10445
  }, zod_v4_core.$strict>;
10413
10446
  }, zod_v4_core.$strict>, MergedErrorMap<$ErrorMap, TErrorMap>>;
10414
10447
  remove: _orpc_server.DecoratedProcedure<DoorApiContext & object, IntersectPick<TInitialContext, $OutContext>, zod.ZodObject<{
@@ -16461,6 +16494,15 @@ declare function createControlApiRouter(deps: ControlApiDeps): {
16461
16494
  none: "none";
16462
16495
  }>;
16463
16496
  }, z.core.$strict>;
16497
+ borrowedLogins: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
16498
+ from: z.ZodString;
16499
+ features: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
16500
+ "remote-control": "remote-control";
16501
+ artifacts: "artifacts";
16502
+ connectors: "connectors";
16503
+ "server-tools": "server-tools";
16504
+ }>>>;
16505
+ }, z.core.$strict>>>>;
16464
16506
  pool: z.ZodOptional<z.ZodObject<{
16465
16507
  pool: z.ZodString;
16466
16508
  directory: z.ZodString;
@@ -17727,6 +17769,15 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
17727
17769
  time: z.ZodString;
17728
17770
  timeZone: z.ZodOptional<z.ZodString>;
17729
17771
  }, z.core.$strict>>>;
17772
+ grants: z.ZodOptional<z.ZodArray<z.ZodObject<{
17773
+ to: z.ZodString;
17774
+ features: z.ZodArray<z.ZodEnum<{
17775
+ "remote-control": "remote-control";
17776
+ artifacts: "artifacts";
17777
+ connectors: "connectors";
17778
+ "server-tools": "server-tools";
17779
+ }>>;
17780
+ }, z.core.$strict>>>;
17730
17781
  }, z.core.$strict>;
17731
17782
  }, z.core.$strict>, MergedErrorMap<$ErrorMap, TErrorMap>>;
17732
17783
  set: _orpc_server.DecoratedProcedure<DoorApiContext & object, IntersectPick<TInitialContext, $OutContext>, z.ZodObject<{
@@ -17840,6 +17891,15 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
17840
17891
  time: z.ZodString;
17841
17892
  timeZone: z.ZodOptional<z.ZodString>;
17842
17893
  }, z.core.$strict>>>;
17894
+ grants: z.ZodOptional<z.ZodArray<z.ZodObject<{
17895
+ to: z.ZodString;
17896
+ features: z.ZodArray<z.ZodEnum<{
17897
+ "remote-control": "remote-control";
17898
+ artifacts: "artifacts";
17899
+ connectors: "connectors";
17900
+ "server-tools": "server-tools";
17901
+ }>>;
17902
+ }, z.core.$strict>>>;
17843
17903
  }, z.core.$strict>;
17844
17904
  }, z.core.$strict>, MergedErrorMap<$ErrorMap, TErrorMap>>;
17845
17905
  remove: _orpc_server.DecoratedProcedure<DoorApiContext & object, IntersectPick<TInitialContext, $OutContext>, z.ZodObject<{
@@ -21617,6 +21677,15 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
21617
21677
  none: "none";
21618
21678
  }>;
21619
21679
  }, z.core.$strict>;
21680
+ borrowedLogins: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
21681
+ from: z.ZodString;
21682
+ features: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
21683
+ "remote-control": "remote-control";
21684
+ artifacts: "artifacts";
21685
+ connectors: "connectors";
21686
+ "server-tools": "server-tools";
21687
+ }>>>;
21688
+ }, z.core.$strict>>>>;
21620
21689
  pool: z.ZodOptional<z.ZodObject<{
21621
21690
  pool: z.ZodString;
21622
21691
  directory: z.ZodString;
@@ -22549,6 +22618,15 @@ declare const ConfigIdentityAddOutputSchema: z.ZodObject<{
22549
22618
  time: z.ZodString;
22550
22619
  timeZone: z.ZodOptional<z.ZodString>;
22551
22620
  }, z.core.$strict>>>;
22621
+ grants: z.ZodOptional<z.ZodArray<z.ZodObject<{
22622
+ to: z.ZodString;
22623
+ features: z.ZodArray<z.ZodEnum<{
22624
+ "remote-control": "remote-control";
22625
+ artifacts: "artifacts";
22626
+ connectors: "connectors";
22627
+ "server-tools": "server-tools";
22628
+ }>>;
22629
+ }, z.core.$strict>>>;
22552
22630
  }, z.core.$strict>;
22553
22631
  }, z.core.$strict>;
22554
22632
  /** `defaultConfigProfile: false` clears it; `credential: false` removes the credential block, returning the identity to its stored login. At least one field must be present. */
@@ -22664,6 +22742,15 @@ declare const ConfigIdentitySetOutputSchema: z.ZodObject<{
22664
22742
  time: z.ZodString;
22665
22743
  timeZone: z.ZodOptional<z.ZodString>;
22666
22744
  }, z.core.$strict>>>;
22745
+ grants: z.ZodOptional<z.ZodArray<z.ZodObject<{
22746
+ to: z.ZodString;
22747
+ features: z.ZodArray<z.ZodEnum<{
22748
+ "remote-control": "remote-control";
22749
+ artifacts: "artifacts";
22750
+ connectors: "connectors";
22751
+ "server-tools": "server-tools";
22752
+ }>>;
22753
+ }, z.core.$strict>>>;
22667
22754
  }, z.core.$strict>;
22668
22755
  }, z.core.$strict>;
22669
22756
  declare const ConfigIdentityRemoveInputSchema: z.ZodObject<{
@@ -27957,6 +28044,18 @@ declare class DuplicateIdentityNameError extends CliError {
27957
28044
  constructor(identityName: string, ids: readonly string[]);
27958
28045
  }
27959
28046
 
28047
+ /**
28048
+ * What one identity lets another do with its claude.ai login. A grant is stored on the lending identity and names the borrower by id, so a rename changes nothing it says. Pure decisions only: the files are `identityStore.ts`'s.
28049
+ */
28050
+ /** The things a grant can cover. */
28051
+ declare const GRANT_FEATURES: readonly ["remote-control", "artifacts", "connectors", "server-tools"];
28052
+ type GrantFeature = (typeof GRANT_FEATURES)[number];
28053
+ /** One login `borrowerId` may use: the lending identity and what its grant covers. */
28054
+ interface BorrowedLogin {
28055
+ readonly from: string;
28056
+ readonly features: readonly GrantFeature[];
28057
+ }
28058
+
27960
28059
  /** Raised by any operation that requires an identity to already exist, when it does not. `remedy` says what to do, adding the identity unless given (`identityNotFound` gives it from the state on disk). */
27961
28060
  declare class IdentityNotFoundError extends CliError {
27962
28061
  readonly name: string;
@@ -28052,6 +28151,19 @@ declare function setDefaultConfigProfile(paths: LayoutPaths, identityName: strin
28052
28151
  * Patches `identity`'s `allowAmbientCredential` field. Throws `IdentityNotFoundError` when the identity does not exist.
28053
28152
  */
28054
28153
  declare function setAllowAmbientCredential(paths: LayoutPaths, identityName: string, allow: boolean): Identity;
28154
+ /** Two identities named for a grant or a revocation: who lends the login and who borrows it. */
28155
+ interface IdentityGrantParties {
28156
+ readonly lender: string;
28157
+ readonly borrower: string;
28158
+ }
28159
+ /**
28160
+ * Lets `parties.borrower` use `parties.lender`'s claude.ai login for `features`, adding to what it already holds. Throws `IdentityNotFoundError` when either identity does not exist, and `UsageError` when both are one identity or either runs Codex.
28161
+ */
28162
+ declare function grantIdentityLogin(paths: LayoutPaths, parties: IdentityGrantParties, features: readonly GrantFeature[], namesLock?: IdentityNamesLockPorts): Identity;
28163
+ /**
28164
+ * Takes `features` from what `parties.borrower` may do with `parties.lender`'s login, or everything when `features` is undefined. Revoking what was never granted changes nothing. Throws as `grantIdentityLogin` does.
28165
+ */
28166
+ declare function revokeIdentityLogin(paths: LayoutPaths, parties: IdentityGrantParties, features: readonly GrantFeature[] | undefined, namesLock?: IdentityNamesLockPorts): Identity;
28055
28167
  /** The change `setIdentityCredential` makes: new sources and/or a new target for the credential block, or `false` to remove the block and return the identity to its stored login. */
28056
28168
  type IdentityCredentialChange = {
28057
28169
  readonly sources?: readonly CredentialSource[];
@@ -28438,6 +28550,8 @@ interface RunCheckParams {
28438
28550
  readonly poolPick?: PoolPickReport;
28439
28551
  readonly configProfileName?: string;
28440
28552
  readonly configProfileSource: ConfigProfileDecisionSource;
28553
+ /** The logins other identities lend the resolved identity; absent or empty when none does. */
28554
+ readonly borrowedLogins?: readonly BorrowedLogin[];
28441
28555
  /** The resolved identity's own `identity.json`, when one was found. */
28442
28556
  readonly identity?: Identity;
28443
28557
  /** Raw `settings.json`/`settings.local.json` contents, keyed by filename, undefined when a file does not exist. */
@@ -28474,6 +28588,8 @@ type ProviderReachabilityReport = {
28474
28588
  interface CheckReport {
28475
28589
  readonly identityName?: string;
28476
28590
  readonly identitySource: IdentityDecisionSource;
28591
+ /** The logins other identities lend this one through the front door (`identity grant`); absent when none does. */
28592
+ readonly borrowedLogins?: readonly BorrowedLogin[];
28477
28593
  readonly poolPick?: PoolPickReport;
28478
28594
  readonly configProfileName?: string;
28479
28595
  readonly configProfileSource: ConfigProfileDecisionSource;
@@ -29066,5 +29182,5 @@ declare const OWN_CLI_FILE_NAME = "cli.cjs";
29066
29182
  */
29067
29183
  declare function agentShimCliPath(distDir?: string | undefined): string;
29068
29184
 
29069
- export { AMBIENT_CREDENTIAL_VARS, AgentKindSchema, AgentMetaSchema, AgentNodeSchema, AgentTreesListInputSchema, AgentTreesListOutputSchema, AgentTreesShowInputSchema, AgentTreesShowOutputSchema, CHECK_CREDENTIAL_APPLIES, CODEX_APP_SERVER_GENERATED_AGAINST, CODEX_APP_SERVER_TIMEOUT_MS, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, CodexAccountReadSchema, CodexAppServerProtocolError, CodexAppServerRequestError, CodexAppServerUnavailableError, CodexLogoutOutputSchema, CodexRateLimitsReadSchema, CodexSignInSchema, CodexStatusOutputSchema, ConfigIdentityAddInputSchema, ConfigIdentityAddOutputSchema, ConfigIdentityRemoveInputSchema, ConfigIdentityRemoveOutputSchema, ConfigIdentitySetInputSchema, ConfigIdentitySetOutputSchema, ConfigIdentityUseOutputSchema, ConfigNameInputSchema, ConfigPoolAddInputSchema, ConfigPoolAddOutputSchema, ConfigPoolRemoveInputSchema, ConfigPoolRemoveOutputSchema, ConfigPoolSetInputSchema, ConfigPoolSetOutputSchema, ConfigPoolUseOutputSchema, ConfigProfileAddInputSchema, ConfigProfileAddOutputSchema, ConfigProfileRemoveInputSchema, ConfigProfileRemoveOutputSchema, ConfigProfileSchema, ConfigProfileSetInputSchema, ConfigProfileSetOutputSchema, ConfigProfileUseOutputSchema, ConfigProviderAddInputSchema, ConfigProviderAddOutputSchema, ConfigProviderRemoveInputSchema, ConfigProviderRemoveOutputSchema, ConfigProviderSetInputSchema, ConfigProviderSetOutputSchema, ConfigRuleAddInputSchema, ConfigRuleAddOutputSchema, ConfigRuleRemoveInputSchema, ConfigRuleRemoveOutputSchema, ConfigRuleSetInputSchema, ConfigRuleSetOutputSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, CredentialSummarySchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DOOR_HEALTH_EVENT_SOURCE, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, DoorHealthEventSchema, DuplicateIdentityNameError, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorControlMaterialError, FrontDoorNotServingError, FrontDoorRestartOutputSchema, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LIVE_TASK_CAP, LaunchLifecycleEventSchema, LaunchRefusedError, LaunchResolveInputSchema, LaunchResolveOutputSchema, LegacyProviderFileError, LiveTaskSchema, MergedAgentNodeSchema, MergedAgentTreeSchema, OWN_CLI_FILE_NAME, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolGraphError, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, QUOTA_EXPIRING_EVENT_SOURCE, QuotaExpiringEventSchema, RC_CONTEXT_USAGE_DETAILS, RC_GOAL_CLEAR_WORDS, RC_GOAL_CONDITION_MAX_CHARS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_RETIRE_REASONS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_SESSION_COMMAND_MAX_WAIT_MS, RC_SESSION_COMMAND_VERIFIED_VERSIONS, RC_SESSION_END_REASONS, RC_SESSION_EVENT_LOG_CAPACITY, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcLiveRateLimitSchema, RcPermissionModeSchema, RcRateLimitInfoSchema, RcRateLimitWindowSchema, RcSessionEventCursorExpiredError, RcSessionEventSchema, RcSessionEventsPageInputSchema, RcSessionEventsReadInputSchema, RcSessionEventsReadOutputSchema, RcSessionEventsStreamInputSchema, RcSessionTransitionSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, ResetRowSchema, ResetScheduleSchema, SessionAgentTreeSchema, SessionLookupError, SessionSummarySchema, TaskItemSchema, USAGE_EVENT_SOURCE, UpdateCheckOutputSchema, UsageChangeEventSchema, UsageError, UsageListOutputSchema, UsageLiveOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, WorkflowRunSchema, addDirectoryRule, addIdentity, addPool, addProvider, agentShimCliPath, answerRcControlRequest, applyAgentTaskEvent, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, changePool, checkReportHasWarnings, checkReportToJson, claudeCodeVersionGate, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, collectResets, collectSessionList, createAgentTreesApiRouter, createCodexApiRouter, createConfigApiRouter, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createDoorHealthPublisher, createEventsApiRouter, createLaunchApiRouter, createLaunchEventPublisher, createLeafCache, createLifecycleApiRouter, createLiveSessionRegistry, createProfile, createQuotaExpiringPublisher, createRcApiNodeHandler, createRcApiRouter, createRcClaudeCodeVersions, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcLiveUsage, createRcSelfHostSurface, createRcSessionCommands, createRcSessionEventLog, createRcSessionEventsApiRouter, createRcSessionRegistryReader, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, followRcSessionEvents, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiFromState, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, headroomSocketTarget, identityExists, identityIdOf, identityNameOf, identityRecords, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, launchRequiredUpstreams, listDirectoryRules, listIdentities, listProfiles, listProviders, listSessions, listUsageSnapshots, locateSession, matchBranch, mergeLiveTasks, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcGoalOutput, parseRcStreamEnvelope, planOf, poolIdentities, poolSelectedByLaunch, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcLocalCommandAnswerOf, rcManualCompactBoundaryOf, rcObserverAsPassthrough, rcRateLimitInfoOf, rcSelfHostFromEnv, rcStatusWithRegistry, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readCodexAccount, readCodexRateLimits, readDirectoryRules, readFarmManifest, readFrontDoorControlMaterial, readGlobalConfig, readIdentity, readIdentityById, readIdentityRecords, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readSessionAgentTree, readUsageSnapshot, realCodexAppServerPort, realConnectCertStore, realConnectEffects, realMemberProviderResolver, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, realSessionFs, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, refreshLaunchPoolUsage, refreshPoolUsage, refreshStalePoolMembers, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveClaudeLaunch, resolveDecisions, resolveLaunch, resolveLaunchSelection, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runClaudeLaunch, runDoctor, runFrontDoorSupervisor, runLaunchPlan, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, showSession, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, summariseSession, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, watchedInstallEntry, withRegisteredSessionFacts, writeDirectoryRules };
29185
+ export { AMBIENT_CREDENTIAL_VARS, AgentKindSchema, AgentMetaSchema, AgentNodeSchema, AgentTreesListInputSchema, AgentTreesListOutputSchema, AgentTreesShowInputSchema, AgentTreesShowOutputSchema, CHECK_CREDENTIAL_APPLIES, CODEX_APP_SERVER_GENERATED_AGAINST, CODEX_APP_SERVER_TIMEOUT_MS, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, CodexAccountReadSchema, CodexAppServerProtocolError, CodexAppServerRequestError, CodexAppServerUnavailableError, CodexLogoutOutputSchema, CodexRateLimitsReadSchema, CodexSignInSchema, CodexStatusOutputSchema, ConfigIdentityAddInputSchema, ConfigIdentityAddOutputSchema, ConfigIdentityRemoveInputSchema, ConfigIdentityRemoveOutputSchema, ConfigIdentitySetInputSchema, ConfigIdentitySetOutputSchema, ConfigIdentityUseOutputSchema, ConfigNameInputSchema, ConfigPoolAddInputSchema, ConfigPoolAddOutputSchema, ConfigPoolRemoveInputSchema, ConfigPoolRemoveOutputSchema, ConfigPoolSetInputSchema, ConfigPoolSetOutputSchema, ConfigPoolUseOutputSchema, ConfigProfileAddInputSchema, ConfigProfileAddOutputSchema, ConfigProfileRemoveInputSchema, ConfigProfileRemoveOutputSchema, ConfigProfileSchema, ConfigProfileSetInputSchema, ConfigProfileSetOutputSchema, ConfigProfileUseOutputSchema, ConfigProviderAddInputSchema, ConfigProviderAddOutputSchema, ConfigProviderRemoveInputSchema, ConfigProviderRemoveOutputSchema, ConfigProviderSetInputSchema, ConfigProviderSetOutputSchema, ConfigRuleAddInputSchema, ConfigRuleAddOutputSchema, ConfigRuleRemoveInputSchema, ConfigRuleRemoveOutputSchema, ConfigRuleSetInputSchema, ConfigRuleSetOutputSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, CredentialSummarySchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DOOR_HEALTH_EVENT_SOURCE, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, DoorHealthEventSchema, DuplicateIdentityNameError, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorControlMaterialError, FrontDoorNotServingError, FrontDoorRestartOutputSchema, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LIVE_TASK_CAP, LaunchLifecycleEventSchema, LaunchRefusedError, LaunchResolveInputSchema, LaunchResolveOutputSchema, LegacyProviderFileError, LiveTaskSchema, MergedAgentNodeSchema, MergedAgentTreeSchema, OWN_CLI_FILE_NAME, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolGraphError, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, QUOTA_EXPIRING_EVENT_SOURCE, QuotaExpiringEventSchema, RC_CONTEXT_USAGE_DETAILS, RC_GOAL_CLEAR_WORDS, RC_GOAL_CONDITION_MAX_CHARS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_RETIRE_REASONS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_SESSION_COMMAND_MAX_WAIT_MS, RC_SESSION_COMMAND_VERIFIED_VERSIONS, RC_SESSION_END_REASONS, RC_SESSION_EVENT_LOG_CAPACITY, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcLiveRateLimitSchema, RcPermissionModeSchema, RcRateLimitInfoSchema, RcRateLimitWindowSchema, RcSessionEventCursorExpiredError, RcSessionEventSchema, RcSessionEventsPageInputSchema, RcSessionEventsReadInputSchema, RcSessionEventsReadOutputSchema, RcSessionEventsStreamInputSchema, RcSessionTransitionSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, ResetRowSchema, ResetScheduleSchema, SessionAgentTreeSchema, SessionLookupError, SessionSummarySchema, TaskItemSchema, USAGE_EVENT_SOURCE, UpdateCheckOutputSchema, UsageChangeEventSchema, UsageError, UsageListOutputSchema, UsageLiveOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, WorkflowRunSchema, addDirectoryRule, addIdentity, addPool, addProvider, agentShimCliPath, answerRcControlRequest, applyAgentTaskEvent, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, changePool, checkReportHasWarnings, checkReportToJson, claudeCodeVersionGate, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, collectResets, collectSessionList, createAgentTreesApiRouter, createCodexApiRouter, createConfigApiRouter, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createDoorHealthPublisher, createEventsApiRouter, createLaunchApiRouter, createLaunchEventPublisher, createLeafCache, createLifecycleApiRouter, createLiveSessionRegistry, createProfile, createQuotaExpiringPublisher, createRcApiNodeHandler, createRcApiRouter, createRcClaudeCodeVersions, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcLiveUsage, createRcSelfHostSurface, createRcSessionCommands, createRcSessionEventLog, createRcSessionEventsApiRouter, createRcSessionRegistryReader, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, followRcSessionEvents, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiFromState, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, grantIdentityLogin, headroomSocketTarget, identityExists, identityIdOf, identityNameOf, identityRecords, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, launchRequiredUpstreams, listDirectoryRules, listIdentities, listProfiles, listProviders, listSessions, listUsageSnapshots, locateSession, matchBranch, mergeLiveTasks, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcGoalOutput, parseRcStreamEnvelope, planOf, poolIdentities, poolSelectedByLaunch, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcLocalCommandAnswerOf, rcManualCompactBoundaryOf, rcObserverAsPassthrough, rcRateLimitInfoOf, rcSelfHostFromEnv, rcStatusWithRegistry, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readCodexAccount, readCodexRateLimits, readDirectoryRules, readFarmManifest, readFrontDoorControlMaterial, readGlobalConfig, readIdentity, readIdentityById, readIdentityRecords, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readSessionAgentTree, readUsageSnapshot, realCodexAppServerPort, realConnectCertStore, realConnectEffects, realMemberProviderResolver, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, realSessionFs, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, refreshLaunchPoolUsage, refreshPoolUsage, refreshStalePoolMembers, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveClaudeLaunch, resolveDecisions, resolveLaunch, resolveLaunchSelection, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, revokeIdentityLogin, runCheck, runClaudeLaunch, runDoctor, runFrontDoorSupervisor, runLaunchPlan, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, showSession, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, summariseSession, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, watchedInstallEntry, withRegisteredSessionFacts, writeDirectoryRules };
29070
29186
  export type { AddDirectoryRuleOptions, AddProviderInput, AgentKind, AgentNode, AgentReadFs, AgentTreesApiDeps, AgentTreesApiRouter, AmbientCredentialDetection, AmbientCredentialGuardResult, AmbientCredentialVar, AnthropicUsageRefresher, BuildEntryFactsParams, CaMaterial, Candidate, CarryOverParams, CarryOverResult, CategoryMap, CheckReport, CheckReportJson, ClaudeCodeVersionGate, ClaudeLaunchPlan, ClaudeLaunchResolution, CodexAccountRead, CodexApiClient, CodexApiDeps, CodexApiRouter, CodexAppServerConnection, CodexAppServerPort, CodexAppServerReadOptions, CodexRateLimitsRead, CollectCheckReportParams, CollectDoctorReportParams, CompiledRule, ConditionContext, ConfigApiDeps, ConfigApiRouter, ConfigProfile, ConnectCertStore, ConnectEffects, ConnectLimits, ConnectLocalSurface, ConnectServerConfig, ConnectServerHandle, ConnectTarget, ControlApiClient, ControlApiDeps, ControlApiRouter, Credential, CredentialSource, Decision, Diagnostic, DirectoryRule, DirectoryRules, DoctorReport, DoorApiClient, DoorApiContext, DoorApiDeps, DoorApiRouter, DoorEvent, DoorEventHub, DoorEventPublisher, DoorEventStream, DoorEventsApiDeps, DoorHealthEvent, DoorHealthPublisher, EffectiveWindow, EliminatedRule, EnsureFrontDoorPorts, EnsureHeadroomPorts, EntryFact, EntryFacts, EntryValue, EvaluateAmbientCredentialGuardParams, FlattenedCascade, FrontDoorControlMaterial, FrontDoorRcControl, FrontDoorSessionStatus, FrontDoorStatus, FrontDoorSupervisorPorts, GlobalConfig, HeadroomSupervisorConfig, Identity, IdentityCredentialChange, IdentityListEntry, IdentityListing, IdentityNameRead, IdentityRecord, IdentityRecordsPort, IdentitySession, InjectedCredential, LaunchApiDeps, LaunchApiRouter, LaunchDecision, LaunchEventPublisher, LaunchLifecycleEvent, LaunchPlan, LaunchPoolDecision, LaunchResolution, LaunchSelection, Layer, LayerId, LayoutPaths, LeafCert, LifecycleApiClient, LifecycleApiDeps, LifecycleApiRouter, LiveSessionRegistry, LiveSessionRegistryPorts, LiveTask, LiveTaskBook, LocatedSession, MergedAgentNode, MergedAgentTree, NestedContribution, OwnExecutableStat, PlanClass, Pool, PoolChange, PoolMember, PoolPickReport, PoolPolicy, PoolRanking, PortableConfig, PrepareClaudeLaunchOptions, PrepareLaunchParams, ProfileListEntry, Provider, ProviderListEntry, ProviderOf, QuotaExpiringEvent, QuotaExpiringPublisher, RankPoolInput, RcAnswerDecision, RcAnswerDeps, RcApiClient, RcApiDeps, RcApiRouter, RcClaudeCodeVersions, RcCompactOptions, RcCompactReport, RcContextUsageDetail, RcControlAnswer, RcControlHandlerDeps, RcControlRequestDeps, RcControlTransport, RcCredentialStore, RcDialAnswer, RcDialTarget, RcEventDial, RcEventFanout, RcEventWriteResult, RcExchangeObserver, RcGoal, RcGoalClearReport, RcGoalReport, RcGoalSetReport, RcInjectDeps, RcLiveRateLimit, RcLiveUsage, RcLiveUsageDeps, RcObservedCredential, RcObservedRequest, RcPendingQuestion, RcPendingRequestSummary, RcPendingRetireReason, RcPermissionMode, RcPresenceAnswer, RcQuestionOption, RcQuestionSelection, RcRateLimitInfo, RcRateLimitWindow, RcReadFileEncoding, RcReadFileOptions, RcRefusalKind, RcRegisteredSession, RcRegistryIdentity, RcSelfHostCredentialRecord, RcSelfHostDeps, RcSelfHostMintResult, RcSelfHostSurface, RcSessionCommandDeps, RcSessionCommandOptions, RcSessionCommandResult, RcSessionCommandRoute, RcSessionCommands, RcSessionEndReason, RcSessionEvent, RcSessionEventLog, RcSessionEventLogDeps, RcSessionEventsApiDeps, RcSessionEventsApiRouter, RcSessionEventsRead, RcSessionEventsReadInput, RcSessionRegistryDeps, RcSessionRegistryFs, RcSessionRoute, RcSessionStatus, RcSessionSummary, RcSessionTracker, RcSessionTrackerDeps, RcSessionTransition, RcStreamAnswer, RcStreamDial, RcStreamEnvelope, RcStreamEvent, RcStreamHub, RcStreamHubDeps, RcSupervisedTarget, RcTurnReport, RcWebFetchDeps, RcWebFetchHop, RcWebFetchOutcome, RcWebFetcher, RcWorkerFact, RcWriteHeaders, ReadSessionOptions, RealMemberProviderParams, RecoverFarmParams, RecoveryResult, RefreshLaunchPoolUsageOptions, RefreshPoolUsageParams, RefreshStalePoolMembersParams, ResetRow, ResetSchedule, ResolveClaudeLaunchOptions, ResolveDecisionsInput, ResolveLaunchSelectionParams, ResolvedState, ResyncFarmParams, ResyncFarmResult, RunCheckParams, RunClaudeLaunchOptions, RunDoctorParams, RunFrontDoorSupervisorOptions, RunLauncherParams, RunSupervisorOptions, SessionAgentTree, SessionCommandFs, SessionListFilters, SessionRef, SessionSummary, SessionView, SpawnClaudeParams, SseParsedEvent, StickyPick, SupervisorPorts, TaskItem, UnreadableIdentityListEntry, UpdateDirectoryRuleOptions, UpdateProviderInput, UsageChangeEvent, UsageReadFs, UsageSnapshot, WhenCondition, WhenEvaluation, WorkflowRun };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-shim",
3
- "version": "14.12.5",
3
+ "version": "14.13.0",
4
4
  "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.",
5
5
  "license": "MIT",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",