agent-shim 8.40.0 → 8.41.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
@@ -63708,7 +63708,7 @@ function registerIdentityCommand(program2, deps) {
63708
63708
  // package.json
63709
63709
  var package_default = {
63710
63710
  name: "agent-shim",
63711
- version: "8.40.0",
63711
+ version: "8.41.0",
63712
63712
  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.",
63713
63713
  license: "MIT",
63714
63714
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -65319,6 +65319,46 @@ function collectPoolPick(params) {
65319
65319
  };
65320
65320
  }
65321
65321
 
65322
+ // src/launchSelection.ts
65323
+ function selectLaunch(params, loaded) {
65324
+ const { paths, cwd } = params;
65325
+ const selections = readDirectorySelections(loaded);
65326
+ const decidedIdentity = decideIdentity({
65327
+ env: params.env,
65328
+ argv0Identity: params.identity,
65329
+ directoryPinnedIdentity: selections.identity,
65330
+ readActiveIdentityFile: () => {
65331
+ const raw = realFsPort.readFileUtf8(paths.activeIdentityFile);
65332
+ if (raw === void 0) {
65333
+ return void 0;
65334
+ }
65335
+ const trimmed = raw.trim();
65336
+ return trimmed === "" ? void 0 : trimmed;
65337
+ }
65338
+ });
65339
+ let poolPick;
65340
+ if (decidedIdentity.pool !== void 0) {
65341
+ const pools = loaded.globalConfig?.pools ?? {};
65342
+ if (pools[decidedIdentity.pool] === void 0) {
65343
+ throw new PoolNotFoundError(decidedIdentity.pool);
65344
+ }
65345
+ poolPick = collectPoolPick({ paths, fs: realFsPort, usageFs: realFarmFs, poolName: decidedIdentity.pool, pools, directory: cwd, nowMs: Date.now() });
65346
+ }
65347
+ const identity = poolPick?.pick === void 0 ? decidedIdentity : { ...decidedIdentity, name: poolPick.pick };
65348
+ const loadedIdentity = identity.name === void 0 ? void 0 : loadIdentity(paths.identitiesDir, identity.name, realFsPort);
65349
+ const configProfile = decideConfigProfile({
65350
+ env: params.env,
65351
+ ...params.configProfile === void 0 ? {} : { cliFlagConfigProfile: params.configProfile },
65352
+ directoryRuleConfigProfile: selections.configProfile,
65353
+ identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
65354
+ globalDefaultConfigProfile: loaded.globalConfig?.defaultConfigProfile
65355
+ });
65356
+ return {
65357
+ selection: { identity, ...poolPick === void 0 ? {} : { poolPick }, configProfile },
65358
+ ...loadedIdentity === void 0 ? {} : { identityConfig: loadedIdentity.config }
65359
+ };
65360
+ }
65361
+
65322
65362
  // src/realCredentialCache.ts
65323
65363
  var import_node_child_process3 = require("node:child_process");
65324
65364
  var import_node_fs9 = __toESM(require("node:fs"), 1);
@@ -66091,37 +66131,9 @@ function collectCheckReport(params) {
66091
66131
  const read = cosmiconfigReader();
66092
66132
  const classification = loadClassification(paths);
66093
66133
  const loaded = loadCascadeInput({ paths, home, cwd, read });
66094
- const selections = readDirectorySelections(loaded);
66095
66134
  const git = resolveGitBranch(realRunPort, cwd);
66096
- const decidedIdentity = decideIdentity({
66097
- env: params.env,
66098
- argv0Identity: params.identity,
66099
- directoryPinnedIdentity: selections.identity,
66100
- readActiveIdentityFile: () => {
66101
- const raw = realFsPort.readFileUtf8(paths.activeIdentityFile);
66102
- if (raw === void 0) {
66103
- return void 0;
66104
- }
66105
- const trimmed = raw.trim();
66106
- return trimmed === "" ? void 0 : trimmed;
66107
- }
66108
- });
66109
- let poolPick;
66110
- if (decidedIdentity.pool !== void 0) {
66111
- const pools = loaded.globalConfig?.pools ?? {};
66112
- if (pools[decidedIdentity.pool] === void 0) {
66113
- throw new PoolNotFoundError(decidedIdentity.pool);
66114
- }
66115
- poolPick = collectPoolPick({ paths, fs: realFsPort, usageFs: realFarmFs, poolName: decidedIdentity.pool, pools, directory: cwd, nowMs: Date.now() });
66116
- }
66117
- const identityDecision = poolPick?.pick === void 0 ? decidedIdentity : { ...decidedIdentity, name: poolPick.pick };
66118
- const loadedIdentity = identityDecision.name === void 0 ? void 0 : loadIdentity(paths.identitiesDir, identityDecision.name, realFsPort);
66119
- const configProfileDecision = decideConfigProfile({
66120
- env: params.env,
66121
- directoryRuleConfigProfile: selections.configProfile,
66122
- identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
66123
- globalDefaultConfigProfile: loaded.globalConfig?.defaultConfigProfile
66124
- });
66135
+ const { selection, identityConfig } = selectLaunch({ paths, cwd, env: params.env, ...params.identity === void 0 ? {} : { identity: params.identity } }, loaded);
66136
+ const { identity: identityDecision, poolPick, configProfile: configProfileDecision } = selection;
66125
66137
  const cascade = loadCascadeInput({
66126
66138
  paths,
66127
66139
  home,
@@ -66152,7 +66164,7 @@ function collectCheckReport(params) {
66152
66164
  ...poolPick === void 0 ? {} : { poolPick },
66153
66165
  ...configProfileDecision.name === void 0 ? {} : { configProfileName: configProfileDecision.name },
66154
66166
  configProfileSource: configProfileDecision.source,
66155
- ...loadedIdentity === void 0 ? {} : { identity: loadedIdentity.config },
66167
+ ...identityConfig === void 0 ? {} : { identity: identityConfig },
66156
66168
  settingsFiles,
66157
66169
  run: realRunPort,
66158
66170
  credentialCache: realCredentialCacheEnv(paths),