agent-shim 8.39.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 +78 -42
- package/dist/index.cjs +1662 -1596
- package/dist/index.mjs +1668 -1604
- package/dist/types/index.d.ts +91 -2
- package/package.json +1 -1
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.
|
|
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>",
|
|
@@ -65215,12 +65215,7 @@ function rankNamedPool(input2, poolName, stack, sticky) {
|
|
|
65215
65215
|
}
|
|
65216
65216
|
continue;
|
|
65217
65217
|
}
|
|
65218
|
-
|
|
65219
|
-
throw new PoolGraphError(`Pool "${poolName}" member "${poolMemberIdentity(entry)}" names a pool that is not defined.`);
|
|
65220
|
-
}
|
|
65221
|
-
if (childStack.includes(nestedName)) {
|
|
65222
|
-
throw new PoolGraphError(`Pool "${poolName}" member "${poolMemberIdentity(entry)}" closes a cycle: ${[...childStack.slice(childStack.indexOf(nestedName)), nestedName].join(" -> ")}. A pool cannot nest itself, directly or through another pool.`);
|
|
65223
|
-
}
|
|
65218
|
+
assertNestable(input2.pools, poolName, poolMemberIdentity(entry), nestedName, childStack);
|
|
65224
65219
|
const nested = nestedMember(input2, nestedName, childStack, sticky);
|
|
65225
65220
|
members2.push(typeof entry === "string" ? nested.member : { ...nested.member, policy: entry.when });
|
|
65226
65221
|
missing.push(...nested.missing);
|
|
@@ -65234,6 +65229,14 @@ function rankNamedPool(input2, poolName, stack, sticky) {
|
|
|
65234
65229
|
});
|
|
65235
65230
|
return { ranking, missing };
|
|
65236
65231
|
}
|
|
65232
|
+
function assertNestable(pools, poolName, member, nestedName, childStack) {
|
|
65233
|
+
if (pools[nestedName] === void 0) {
|
|
65234
|
+
throw new PoolGraphError(`Pool "${poolName}" member "${member}" names a pool that is not defined.`);
|
|
65235
|
+
}
|
|
65236
|
+
if (childStack.includes(nestedName)) {
|
|
65237
|
+
throw new PoolGraphError(`Pool "${poolName}" member "${member}" closes a cycle: ${[...childStack.slice(childStack.indexOf(nestedName)), nestedName].join(" -> ")}. A pool cannot nest itself, directly or through another pool.`);
|
|
65238
|
+
}
|
|
65239
|
+
}
|
|
65237
65240
|
function nestedMember(input2, nestedName, childStack, sticky) {
|
|
65238
65241
|
const nested = rankNamedPool(input2, nestedName, childStack, sticky);
|
|
65239
65242
|
const pick2 = nested.ranking.pick;
|
|
@@ -65316,6 +65319,46 @@ function collectPoolPick(params) {
|
|
|
65316
65319
|
};
|
|
65317
65320
|
}
|
|
65318
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
|
+
|
|
65319
65362
|
// src/realCredentialCache.ts
|
|
65320
65363
|
var import_node_child_process3 = require("node:child_process");
|
|
65321
65364
|
var import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
@@ -66088,37 +66131,9 @@ function collectCheckReport(params) {
|
|
|
66088
66131
|
const read = cosmiconfigReader();
|
|
66089
66132
|
const classification = loadClassification(paths);
|
|
66090
66133
|
const loaded = loadCascadeInput({ paths, home, cwd, read });
|
|
66091
|
-
const selections = readDirectorySelections(loaded);
|
|
66092
66134
|
const git = resolveGitBranch(realRunPort, cwd);
|
|
66093
|
-
const
|
|
66094
|
-
|
|
66095
|
-
argv0Identity: params.identity,
|
|
66096
|
-
directoryPinnedIdentity: selections.identity,
|
|
66097
|
-
readActiveIdentityFile: () => {
|
|
66098
|
-
const raw = realFsPort.readFileUtf8(paths.activeIdentityFile);
|
|
66099
|
-
if (raw === void 0) {
|
|
66100
|
-
return void 0;
|
|
66101
|
-
}
|
|
66102
|
-
const trimmed = raw.trim();
|
|
66103
|
-
return trimmed === "" ? void 0 : trimmed;
|
|
66104
|
-
}
|
|
66105
|
-
});
|
|
66106
|
-
let poolPick;
|
|
66107
|
-
if (decidedIdentity.pool !== void 0) {
|
|
66108
|
-
const pools = loaded.globalConfig?.pools ?? {};
|
|
66109
|
-
if (pools[decidedIdentity.pool] === void 0) {
|
|
66110
|
-
throw new PoolNotFoundError(decidedIdentity.pool);
|
|
66111
|
-
}
|
|
66112
|
-
poolPick = collectPoolPick({ paths, fs: realFsPort, usageFs: realFarmFs, poolName: decidedIdentity.pool, pools, directory: cwd, nowMs: Date.now() });
|
|
66113
|
-
}
|
|
66114
|
-
const identityDecision = poolPick?.pick === void 0 ? decidedIdentity : { ...decidedIdentity, name: poolPick.pick };
|
|
66115
|
-
const loadedIdentity = identityDecision.name === void 0 ? void 0 : loadIdentity(paths.identitiesDir, identityDecision.name, realFsPort);
|
|
66116
|
-
const configProfileDecision = decideConfigProfile({
|
|
66117
|
-
env: params.env,
|
|
66118
|
-
directoryRuleConfigProfile: selections.configProfile,
|
|
66119
|
-
identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
|
|
66120
|
-
globalDefaultConfigProfile: loaded.globalConfig?.defaultConfigProfile
|
|
66121
|
-
});
|
|
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;
|
|
66122
66137
|
const cascade = loadCascadeInput({
|
|
66123
66138
|
paths,
|
|
66124
66139
|
home,
|
|
@@ -66149,7 +66164,7 @@ function collectCheckReport(params) {
|
|
|
66149
66164
|
...poolPick === void 0 ? {} : { poolPick },
|
|
66150
66165
|
...configProfileDecision.name === void 0 ? {} : { configProfileName: configProfileDecision.name },
|
|
66151
66166
|
configProfileSource: configProfileDecision.source,
|
|
66152
|
-
...
|
|
66167
|
+
...identityConfig === void 0 ? {} : { identity: identityConfig },
|
|
66153
66168
|
settingsFiles,
|
|
66154
66169
|
run: realRunPort,
|
|
66155
66170
|
credentialCache: realCredentialCacheEnv(paths),
|
|
@@ -93736,7 +93751,13 @@ function resolvePoolLaunch(params) {
|
|
|
93736
93751
|
if (pick2 !== void 0) {
|
|
93737
93752
|
recordStickyPick(params.usageFs, params.paths.usagePicksFile, params.cwd, pick2.identity, nowMs);
|
|
93738
93753
|
const move = movedOff === void 0 ? "" : `moved off ${movedOff.identity} (${movedOff.reason}); `;
|
|
93739
|
-
return {
|
|
93754
|
+
return {
|
|
93755
|
+
ok: true,
|
|
93756
|
+
identity: pick2.identity,
|
|
93757
|
+
explanation: `pool ${poolName}: ${move}${pick2.reasons.slice(0, REASONS_LOGGED).join("; ")}`,
|
|
93758
|
+
reasons: pick2.reasons,
|
|
93759
|
+
...movedOff === void 0 ? {} : { movedOff }
|
|
93760
|
+
};
|
|
93740
93761
|
}
|
|
93741
93762
|
if (earliestReturn === void 0) {
|
|
93742
93763
|
return { ok: false, message: `agent-shim: no member of pool "${poolName}" can be picked.` };
|
|
@@ -94082,7 +94103,11 @@ function pickFromPool(decided, params, parsedArgv) {
|
|
|
94082
94103
|
log.error(resolution.message);
|
|
94083
94104
|
return proc.exit(1);
|
|
94084
94105
|
}
|
|
94085
|
-
return {
|
|
94106
|
+
return {
|
|
94107
|
+
identityDecision: { ...decided, name: resolution.identity },
|
|
94108
|
+
poolExplanation: resolution.explanation,
|
|
94109
|
+
poolPick: { name: decided.pool, reasons: resolution.reasons, ...resolution.movedOff === void 0 ? {} : { movedOff: resolution.movedOff } }
|
|
94110
|
+
};
|
|
94086
94111
|
}
|
|
94087
94112
|
function prepareLaunch(params) {
|
|
94088
94113
|
const { paths, fs: fs20, proc, log } = params;
|
|
@@ -94108,7 +94133,7 @@ function prepareLaunch(params) {
|
|
|
94108
94133
|
return trimmed === "" ? void 0 : trimmed;
|
|
94109
94134
|
}
|
|
94110
94135
|
});
|
|
94111
|
-
const { identityDecision, poolExplanation } = pickFromPool(decidedIdentity, params, parsedArgv);
|
|
94136
|
+
const { identityDecision, poolExplanation, poolPick } = pickFromPool(decidedIdentity, params, parsedArgv);
|
|
94112
94137
|
const farmIdentity = configDirEscapeHatchApplies ? void 0 : identityDecision.name;
|
|
94113
94138
|
const farm = farmIdentity === void 0 ? void 0 : params.farm;
|
|
94114
94139
|
if (farm !== void 0 && farmIdentity !== void 0) {
|
|
@@ -94322,7 +94347,18 @@ function prepareLaunch(params) {
|
|
|
94322
94347
|
registered();
|
|
94323
94348
|
}
|
|
94324
94349
|
};
|
|
94325
|
-
|
|
94350
|
+
const configDir = finalEnv.CLAUDE_CONFIG_DIR;
|
|
94351
|
+
const decision = {
|
|
94352
|
+
identitySource: identityDecision.source,
|
|
94353
|
+
configDirEscapeHatch: identityDecision.configDirEscapeHatch,
|
|
94354
|
+
configProfileSource: configProfileDecision.source,
|
|
94355
|
+
...identityDecision.name === void 0 ? {} : { identity: identityDecision.name },
|
|
94356
|
+
...poolPick === void 0 ? {} : { pool: poolPick },
|
|
94357
|
+
...configDir === void 0 || configDir === "" ? {} : { configDir },
|
|
94358
|
+
...configProfileDecision.name === void 0 ? {} : { configProfile: configProfileDecision.name },
|
|
94359
|
+
...resolvedProvider === void 0 ? {} : { provider: resolvedProvider.name }
|
|
94360
|
+
};
|
|
94361
|
+
return { bin: discovered.path, args: finalArgv, env: finalEnv, release, markChildStarted: updateCheck.markChildStarted, decision };
|
|
94326
94362
|
}
|
|
94327
94363
|
function runLauncher(params) {
|
|
94328
94364
|
const plan = prepareLaunch(params);
|