agent-shim 14.16.1 → 14.17.1
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/README.md +4 -1
- package/dist/cli.cjs +120 -10
- package/dist/index.cjs +81 -6
- package/dist/index.mjs +81 -6
- package/dist/types/index.d.ts +113 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,11 +19,13 @@ Keeping these separate matters because they answer different questions. "Which l
|
|
|
19
19
|
|
|
20
20
|
## Install
|
|
21
21
|
|
|
22
|
+
[Claude Code](https://claude.com/claude-code) must already be installed; agent-shim launches it rather than bundling it.
|
|
23
|
+
|
|
22
24
|
```bash
|
|
23
25
|
curl -fsSL https://github.com/ExaDev/agent-shim/releases/latest/download/install.sh | sh
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
This installs `agent-shim` alone into `~/.local/bin`; your existing `claude` command is left untouched. `agent-shim run [args...]` reaches the same identity-resolve, farm-resync, spawn pipeline a `claude`-named binary would, so every feature already works with no further setup. Run `agent-shim shim enable` once for the shorter `claude @<name>` form (`shim disable` reverses it).
|
|
28
|
+
This installs `agent-shim` alone into `~/.local/bin`; your existing `claude` command is left untouched. Add `~/.local/bin` to `PATH` if a shell's default doesn't already include it (`export PATH="$HOME/.local/bin:$PATH"`), since the commands below run `agent-shim` by bare name. `agent-shim run [args...]` reaches the same identity-resolve, farm-resync, spawn pipeline a `claude`-named binary would, so every feature already works with no further setup. Run `agent-shim shim enable` once for the shorter `claude @<name>` form (`shim disable` reverses it).
|
|
27
29
|
|
|
28
30
|
Also available: npm (`npm install -g agent-shim`, needs Node 22.18 or later, or 24 and above), Homebrew (`brew install ExaDev/agent-shim/agent-shim`), Scoop on Windows, a scoped GitHub Packages alias, and installing straight from the git repository with no registry at all. Each channel's exact commands, the platform support matrix, and the one architecture (macOS x64) that needs a different install path are in [docs/installation.md](docs/installation.md).
|
|
29
31
|
|
|
@@ -193,6 +195,7 @@ Issues and pull requests are welcome. Please keep the tool itself free of assump
|
|
|
193
195
|
- [docs/rc-agent-events.md](docs/rc-agent-events.md): the task and subagent lifecycle events a Remote Control session's read stream carries, and the keys that join them to the transcripts on disk.
|
|
194
196
|
- [docs/rc-session-events.md](docs/rc-session-events.md): one event stream across every observed Remote Control session (appearances and endings, worker state changes, pending-request births and retirements), its cursors and resume, and the explicit expiry when a cursor can no longer be honoured.
|
|
195
197
|
- [docs/agent-transcripts.md](docs/agent-transcripts.md): how Claude Code lays out a session's subagents, forks, workflow runs, tasks, teams and jobs on disk, and which fields are always present.
|
|
198
|
+
- [docs/claude-code-service-contracts.md](docs/claude-code-service-contracts.md): captured contracts of Claude Code's own service calls (connectors, artifacts, Remote Control, tool surfaces, login renewal), including a live cross-login probe against two real logins.
|
|
196
199
|
|
|
197
200
|
## License
|
|
198
201
|
|
package/dist/cli.cjs
CHANGED
|
@@ -28164,6 +28164,24 @@ var init_identityGrants = __esm({
|
|
|
28164
28164
|
}
|
|
28165
28165
|
});
|
|
28166
28166
|
|
|
28167
|
+
// src/toolLogins.ts
|
|
28168
|
+
function withToolLogin(current, surface, lenderId) {
|
|
28169
|
+
return { ...current, [surface]: lenderId };
|
|
28170
|
+
}
|
|
28171
|
+
function withoutToolLogin(current, surface) {
|
|
28172
|
+
if (surface === void 0) {
|
|
28173
|
+
return {};
|
|
28174
|
+
}
|
|
28175
|
+
return Object.fromEntries(Object.entries(current ?? {}).filter(([key]) => key !== surface));
|
|
28176
|
+
}
|
|
28177
|
+
var TOOL_SURFACES;
|
|
28178
|
+
var init_toolLogins = __esm({
|
|
28179
|
+
"src/toolLogins.ts"() {
|
|
28180
|
+
"use strict";
|
|
28181
|
+
TOOL_SURFACES = ["design", "claude-test", "pages", "triggers", "web-search", "web-fetch"];
|
|
28182
|
+
}
|
|
28183
|
+
});
|
|
28184
|
+
|
|
28167
28185
|
// src/config/schema.ts
|
|
28168
28186
|
function isOverridableCategory(name) {
|
|
28169
28187
|
return OVERRIDABLE_CATEGORIES.some((category) => category === name);
|
|
@@ -28202,7 +28220,7 @@ function isTimeZone(name) {
|
|
|
28202
28220
|
return false;
|
|
28203
28221
|
}
|
|
28204
28222
|
}
|
|
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;
|
|
28223
|
+
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, ToolLoginsSchema, IdentityGrantSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
|
|
28206
28224
|
var init_schema = __esm({
|
|
28207
28225
|
"src/config/schema.ts"() {
|
|
28208
28226
|
"use strict";
|
|
@@ -28216,6 +28234,7 @@ var init_schema = __esm({
|
|
|
28216
28234
|
init_versionDiscovery();
|
|
28217
28235
|
init_ownEntry();
|
|
28218
28236
|
init_identityGrants();
|
|
28237
|
+
init_toolLogins();
|
|
28219
28238
|
CATEGORY_NAMES = ["secret", "runtime", "history", "knowledge", "settings"];
|
|
28220
28239
|
OVERRIDABLE_CATEGORIES = ["runtime", "history", "knowledge", "settings"];
|
|
28221
28240
|
CategoryMapSchema = external_exports.strictObject({
|
|
@@ -28665,6 +28684,7 @@ var init_schema = __esm({
|
|
|
28665
28684
|
models: ModelsConfigSchema.optional(),
|
|
28666
28685
|
jobs: external_exports.record(PoolNameSchema, JobSchema).optional()
|
|
28667
28686
|
});
|
|
28687
|
+
ToolLoginsSchema = external_exports.partialRecord(external_exports.enum(TOOL_SURFACES), FileNameSchema);
|
|
28668
28688
|
IdentityGrantSchema = external_exports.strictObject({
|
|
28669
28689
|
to: FileNameSchema,
|
|
28670
28690
|
features: external_exports.array(external_exports.enum(GRANT_FEATURES)).min(1)
|
|
@@ -28683,6 +28703,8 @@ var init_schema = __esm({
|
|
|
28683
28703
|
credential: CredentialSchema.optional(),
|
|
28684
28704
|
/** Which other identities may use this identity's claude.ai login, and for what (`identity grant`). Absent: none may. */
|
|
28685
28705
|
grants: external_exports.array(IdentityGrantSchema).min(1).optional(),
|
|
28706
|
+
/** Which lender serves each server-tool surface this identity (the borrower) has chosen one for (`identity set --tool-login`). Absent: this identity's own login serves every surface. */
|
|
28707
|
+
toolLogins: ToolLoginsSchema.optional(),
|
|
28686
28708
|
/** 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. */
|
|
28687
28709
|
anchors: external_exports.array(AnchorSchema).min(1).optional()
|
|
28688
28710
|
});
|
|
@@ -41591,6 +41613,17 @@ function writeIdentityGrants(paths, id2, grants) {
|
|
|
41591
41613
|
function grantIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
|
|
41592
41614
|
return changeIdentityGrants(paths, parties, (grants, borrowerId) => withGrant(grants, borrowerId, features), namesLock);
|
|
41593
41615
|
}
|
|
41616
|
+
function setToolLogin(paths, borrowerName, surface, lender, namesLock = realIdentityNamesLockPorts) {
|
|
41617
|
+
return withIdentityNamesLock(paths, namesLock, () => {
|
|
41618
|
+
const borrowerId = requireStoredIdentityId(paths, borrowerName);
|
|
41619
|
+
const borrower = readIdentityById(paths, borrowerId);
|
|
41620
|
+
if (borrower === void 0) {
|
|
41621
|
+
throw identityNotFound(paths, borrowerName);
|
|
41622
|
+
}
|
|
41623
|
+
const updated = lender === false ? withoutToolLogin(borrower.toolLogins, surface) : withToolLogin(borrower.toolLogins, surface, requireStoredIdentityId(paths, lender));
|
|
41624
|
+
return applyPatch(identityJsonPath(paths, borrowerId), IdentitySchema, { toolLogins: Object.keys(updated).length === 0 ? void 0 : updated });
|
|
41625
|
+
});
|
|
41626
|
+
}
|
|
41594
41627
|
function revokeIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
|
|
41595
41628
|
return changeIdentityGrants(paths, parties, (grants, borrowerId) => withoutGrant(grants, borrowerId, features), namesLock);
|
|
41596
41629
|
}
|
|
@@ -41720,6 +41753,7 @@ var init_identityStore = __esm({
|
|
|
41720
41753
|
init_connectorListMerge();
|
|
41721
41754
|
init_lenderLogin();
|
|
41722
41755
|
init_quotaHttp();
|
|
41756
|
+
init_toolLogins();
|
|
41723
41757
|
IdentityNotFoundError = class extends CliError {
|
|
41724
41758
|
constructor(name, remedy2 = `Run \`agent-shim identity add ${name}\` first.`) {
|
|
41725
41759
|
super(`No identity named "${name}". ${remedy2}`);
|
|
@@ -76766,7 +76800,7 @@ var init_package = __esm({
|
|
|
76766
76800
|
"package.json"() {
|
|
76767
76801
|
package_default = {
|
|
76768
76802
|
name: "agent-shim",
|
|
76769
|
-
version: "14.
|
|
76803
|
+
version: "14.17.1",
|
|
76770
76804
|
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.",
|
|
76771
76805
|
license: "MIT",
|
|
76772
76806
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -132058,6 +132092,24 @@ function pushLegacyName(push, params) {
|
|
|
132058
132092
|
);
|
|
132059
132093
|
}
|
|
132060
132094
|
}
|
|
132095
|
+
function grantsCoverServerTools(identities, lenderId, borrowerId) {
|
|
132096
|
+
const lender = identities.find((entry) => entry.id === lenderId);
|
|
132097
|
+
let parsed;
|
|
132098
|
+
try {
|
|
132099
|
+
parsed = JSON.parse(lender?.raw ?? "");
|
|
132100
|
+
} catch {
|
|
132101
|
+
return false;
|
|
132102
|
+
}
|
|
132103
|
+
const grants = typeof parsed === "object" && parsed !== null && "grants" in parsed ? Reflect.get(parsed, "grants") : void 0;
|
|
132104
|
+
return Array.isArray(grants) && grants.some((grant) => isServerToolsGrantTo(grant, borrowerId));
|
|
132105
|
+
}
|
|
132106
|
+
function isServerToolsGrantTo(grant, borrowerId) {
|
|
132107
|
+
if (typeof grant !== "object" || grant === null || Reflect.get(grant, "to") !== borrowerId) {
|
|
132108
|
+
return false;
|
|
132109
|
+
}
|
|
132110
|
+
const features = Reflect.get(grant, "features");
|
|
132111
|
+
return Array.isArray(features) && features.includes("server-tools");
|
|
132112
|
+
}
|
|
132061
132113
|
function runDoctor(params) {
|
|
132062
132114
|
const findings = [];
|
|
132063
132115
|
const push = (section, severity, message, subject) => {
|
|
@@ -132207,6 +132259,13 @@ function runDoctor(params) {
|
|
|
132207
132259
|
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);
|
|
132208
132260
|
}
|
|
132209
132261
|
}
|
|
132262
|
+
for (const [surface, lenderId] of Object.entries(validated3.data.toolLogins ?? {})) {
|
|
132263
|
+
if (!identityIds.has(lenderId)) {
|
|
132264
|
+
push("identity", "warn", `${entry.name} serves "${surface}" from identity id "${lenderId}", which does not exist. Remove that entry from its identity.json.`, entry.name);
|
|
132265
|
+
} else if (!grantsCoverServerTools(params.identities, lenderId, entry.id)) {
|
|
132266
|
+
push("identity", "warn", `${entry.name} serves "${surface}" from identity id "${lenderId}", which does not currently grant it "server-tools". Grant it, or remove the tool login.`, entry.name);
|
|
132267
|
+
}
|
|
132268
|
+
}
|
|
132210
132269
|
if (validated3.data.grants !== void 0 && keychainItem !== true && !entry.credentialsFilePresent) {
|
|
132211
132270
|
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);
|
|
132212
132271
|
}
|
|
@@ -132789,6 +132848,7 @@ function cacheChange(options, existing) {
|
|
|
132789
132848
|
|
|
132790
132849
|
// src/cli/parsers.ts
|
|
132791
132850
|
init_schema();
|
|
132851
|
+
init_toolLogins();
|
|
132792
132852
|
init_identityGrants();
|
|
132793
132853
|
|
|
132794
132854
|
// src/usage/anchor.ts
|
|
@@ -132917,6 +132977,25 @@ function collectRepeated(value3, previous = []) {
|
|
|
132917
132977
|
function collectAnchor(value3, previous = []) {
|
|
132918
132978
|
return [...previous, asInvalidArgument(() => parseAnchor(value3))];
|
|
132919
132979
|
}
|
|
132980
|
+
function collectToolLoginAssignment(value3, previous = []) {
|
|
132981
|
+
return [...previous, asInvalidArgument(() => {
|
|
132982
|
+
const { key, value: lender } = parsePair(value3);
|
|
132983
|
+
const surface = TOOL_SURFACES.find((candidate) => candidate === key);
|
|
132984
|
+
if (surface === void 0) {
|
|
132985
|
+
throw new Error(`"${key}" is not one of ${TOOL_SURFACES.join(", ")}`);
|
|
132986
|
+
}
|
|
132987
|
+
return { surface, lender };
|
|
132988
|
+
})];
|
|
132989
|
+
}
|
|
132990
|
+
function collectToolLoginSurface(value3, previous = []) {
|
|
132991
|
+
return [...previous, asInvalidArgument(() => {
|
|
132992
|
+
const surface = TOOL_SURFACES.find((candidate) => candidate === value3);
|
|
132993
|
+
if (surface === void 0) {
|
|
132994
|
+
throw new Error(`"${value3}" is not one of ${TOOL_SURFACES.join(", ")}`);
|
|
132995
|
+
}
|
|
132996
|
+
return surface;
|
|
132997
|
+
})];
|
|
132998
|
+
}
|
|
132920
132999
|
function collectGrantFeature(value3, previous = []) {
|
|
132921
133000
|
return [...previous, asInvalidArgument(() => {
|
|
132922
133001
|
const feature = GRANT_FEATURES.find((candidate) => candidate === value3);
|
|
@@ -132946,6 +133025,7 @@ function parseDurationOption(value3) {
|
|
|
132946
133025
|
}
|
|
132947
133026
|
|
|
132948
133027
|
// src/identityManager.ts
|
|
133028
|
+
init_toolLogins();
|
|
132949
133029
|
init_identityGrants();
|
|
132950
133030
|
init_classify();
|
|
132951
133031
|
init_schema();
|
|
@@ -132963,7 +133043,8 @@ function identityWriteView(identity) {
|
|
|
132963
133043
|
allowAmbientCredential: identity.allowAmbientCredential,
|
|
132964
133044
|
...identity.credential === void 0 ? {} : { credential: summariseCredential(identity.credential) },
|
|
132965
133045
|
...identity.anchors === void 0 ? {} : { anchors: identity.anchors },
|
|
132966
|
-
...identity.grants === void 0 ? {} : { grants: identity.grants }
|
|
133046
|
+
...identity.grants === void 0 ? {} : { grants: identity.grants },
|
|
133047
|
+
...identity.toolLogins === void 0 ? {} : { toolLogins: identity.toolLogins }
|
|
132967
133048
|
};
|
|
132968
133049
|
}
|
|
132969
133050
|
|
|
@@ -134679,7 +134760,8 @@ function toIdentityView(paths, { entry, read }, sharesLoginWith) {
|
|
|
134679
134760
|
allowAmbientCredential: entry.identity.allowAmbientCredential,
|
|
134680
134761
|
...entry.identity.credential === void 0 ? {} : { credential: summariseCredential(entry.identity.credential) },
|
|
134681
134762
|
...entry.identity.anchors === void 0 ? {} : { anchors: entry.identity.anchors },
|
|
134682
|
-
...entry.identity.grants === void 0 ? {} : { grants: entry.identity.grants.map((grant) => ({ to: nameOf2(grant.to), features: grant.features })) }
|
|
134763
|
+
...entry.identity.grants === void 0 ? {} : { grants: entry.identity.grants.map((grant) => ({ to: nameOf2(grant.to), features: grant.features })) },
|
|
134764
|
+
...entry.identity.toolLogins === void 0 ? {} : { toolLogins: Object.fromEntries(Object.entries(entry.identity.toolLogins).map(([surface, lender]) => [surface, nameOf2(lender)])) }
|
|
134683
134765
|
} : { problem: entry.problem, ...entry.displaced === void 0 ? {} : { displaced: entry.displaced } },
|
|
134684
134766
|
...account === void 0 ? {} : { account },
|
|
134685
134767
|
...read?.problem === void 0 ? {} : { accountProblem: read.problem },
|
|
@@ -134709,7 +134791,8 @@ function formatIdentityLine(entry, view, shared) {
|
|
|
134709
134791
|
const ambient = entry.identity.allowAmbientCredential ? " [allows ambient credential]" : "";
|
|
134710
134792
|
const credential = entry.identity.credential === void 0 ? "" : ` [credential ${describeCredential(entry.identity.credential)}]`;
|
|
134711
134793
|
const grants = (view.grants ?? []).map((grant) => ` [lends to ${grant.to}: ${grant.features.join(", ")}]`).join("");
|
|
134712
|
-
|
|
134794
|
+
const toolLogins = Object.entries(view.toolLogins ?? {}).map(([surface, lender]) => ` [${surface} from ${lender}]`).join("");
|
|
134795
|
+
return `${marker}${named}${entry.identity.agent === "codex" ? " [codex]" : ""}${label2}${defaultProfile}${provider}${ambient}${credential}${grants}${toolLogins}${account}${accountProblem}`;
|
|
134713
134796
|
}
|
|
134714
134797
|
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.";
|
|
134715
134798
|
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.";
|
|
@@ -134808,7 +134891,11 @@ Run \`agent-shim doctor\` for the full detail on every ${kinds.join(" or ")} ent
|
|
|
134808
134891
|
"--anchor <spec>",
|
|
134809
134892
|
`Have the front door open a five-hour window for this identity at these times when none is open, so its window resets when you want (repeatable, replacing any existing anchors): ${ANCHOR_SYNTAX}.`,
|
|
134810
134893
|
collectAnchor
|
|
134811
|
-
).option("--no-anchor", "Remove this identity's anchors.").
|
|
134894
|
+
).option("--no-anchor", "Remove this identity's anchors.").option(
|
|
134895
|
+
"--tool-login <surface>=<lender>",
|
|
134896
|
+
`Serve one of this identity's server-tool surfaces from a granted lender's login instead of its own (repeatable, one assignment per surface): ${TOOL_SURFACES.join(", ")}.`,
|
|
134897
|
+
collectToolLoginAssignment
|
|
134898
|
+
).option("--clear-tool-login <surface>", "Return one surface to this identity's own login (repeatable).", collectToolLoginSurface).addOption(
|
|
134812
134899
|
new Option(
|
|
134813
134900
|
"--credential-target <target>",
|
|
134814
134901
|
"Where the token goes: oauthToken sets CLAUDE_CODE_OAUTH_TOKEN (a `claude setup-token` token), bearer sets ANTHROPIC_AUTH_TOKEN (the default), apiKey sets ANTHROPIC_API_KEY."
|
|
@@ -134820,7 +134907,7 @@ Run \`agent-shim doctor\` for the full detail on every ${kinds.join(" or ")} ent
|
|
|
134820
134907
|
const { json: json2, ...options } = allOptions;
|
|
134821
134908
|
if (Object.entries(allOptions).every(([key, value3]) => key === "json" || value3 === void 0)) {
|
|
134822
134909
|
throw new UsageError(
|
|
134823
|
-
"Nothing to change: pass --label, --no-label, --default-profile, --no-default-profile, --provider, --no-provider, --allow-ambient-credential, --no-allow-ambient-credential, --credential, --no-credential, --credential-target, --anchor, --no-anchor or a --credential-cache option."
|
|
134910
|
+
"Nothing to change: pass --label, --no-label, --default-profile, --no-default-profile, --provider, --no-provider, --allow-ambient-credential, --no-allow-ambient-credential, --credential, --no-credential, --credential-target, --anchor, --no-anchor, --tool-login, --clear-tool-login or a --credential-cache option."
|
|
134824
134911
|
);
|
|
134825
134912
|
}
|
|
134826
134913
|
if (!identityExists(paths, name)) {
|
|
@@ -134876,6 +134963,14 @@ Run \`agent-shim doctor\` for the full detail on every ${kinds.join(" or ")} ent
|
|
|
134876
134963
|
const updated = setIdentityAnchors(paths, name, options.anchor === false ? void 0 : options.anchor);
|
|
134877
134964
|
messages.push(updated.anchors === void 0 ? `Identity "${name}" no longer has anchors.` : `Identity "${name}" now has anchors ${updated.anchors.map(formatAnchor).join(" ")}.`);
|
|
134878
134965
|
}
|
|
134966
|
+
for (const surface of options.clearToolLogin ?? []) {
|
|
134967
|
+
setToolLogin(paths, name, surface, false);
|
|
134968
|
+
messages.push(`Identity "${name}" serves "${surface}" from its own login again.`);
|
|
134969
|
+
}
|
|
134970
|
+
for (const { surface, lender } of options.toolLogin ?? []) {
|
|
134971
|
+
setToolLogin(paths, name, surface, lender);
|
|
134972
|
+
messages.push(`Identity "${name}" now serves "${surface}" from "${lender}"'s login.`);
|
|
134973
|
+
}
|
|
134879
134974
|
const stored2 = readIdentity(paths, name);
|
|
134880
134975
|
if (stored2 === void 0) {
|
|
134881
134976
|
throw identityNotFound(paths, name);
|
|
@@ -148120,6 +148215,7 @@ init_schema();
|
|
|
148120
148215
|
init_names();
|
|
148121
148216
|
init_keychainLogin();
|
|
148122
148217
|
init_statusline();
|
|
148218
|
+
init_toolLogins();
|
|
148123
148219
|
var RemovalConfirmationSchema = external_exports.boolean();
|
|
148124
148220
|
var CredentialWriteSchema = (targets) => external_exports.strictObject({
|
|
148125
148221
|
sources: external_exports.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
@@ -148152,7 +148248,8 @@ var IdentityValueSchema = external_exports.strictObject({
|
|
|
148152
148248
|
credential: CredentialSummarySchema2.optional(),
|
|
148153
148249
|
anchors: external_exports.array(AnchorSchema).optional(),
|
|
148154
148250
|
/** 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. */
|
|
148155
|
-
grants: external_exports.array(IdentityGrantSchema).optional()
|
|
148251
|
+
grants: external_exports.array(IdentityGrantSchema).optional(),
|
|
148252
|
+
toolLogins: ToolLoginsSchema.optional()
|
|
148156
148253
|
});
|
|
148157
148254
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
148158
148255
|
var ProviderValueSchema = external_exports.strictObject({
|
|
@@ -148177,7 +148274,11 @@ var ConfigIdentitySetInputSchema = external_exports.strictObject({
|
|
|
148177
148274
|
allowAmbientCredential: external_exports.boolean().optional(),
|
|
148178
148275
|
credential: external_exports.union([external_exports.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
|
|
148179
148276
|
/** `false` removes the anchors; a list replaces them. */
|
|
148180
|
-
anchors: external_exports.union([external_exports.literal(false), external_exports.array(AnchorSchema).min(1)]).optional()
|
|
148277
|
+
anchors: external_exports.union([external_exports.literal(false), external_exports.array(AnchorSchema).min(1)]).optional(),
|
|
148278
|
+
/** Each assignment replaces whatever that surface already named. */
|
|
148279
|
+
toolLogin: external_exports.array(external_exports.strictObject({ surface: external_exports.enum(TOOL_SURFACES), lender: external_exports.string().min(1) })).optional(),
|
|
148280
|
+
/** Surfaces to return to the identity's own login. */
|
|
148281
|
+
clearToolLogin: external_exports.array(external_exports.enum(TOOL_SURFACES)).optional()
|
|
148181
148282
|
});
|
|
148182
148283
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
148183
148284
|
var ConfigIdentityRemoveInputSchema = external_exports.strictObject({ name: external_exports.string().min(1), confirm: RemovalConfirmationSchema });
|
|
@@ -148465,7 +148566,7 @@ function createConfigApiRouter(deps) {
|
|
|
148465
148566
|
}),
|
|
148466
148567
|
set: route("/rest/config/identity/set", "Update an identity's label, default profile, provider, ambient-credential setting, credential or anchors").input(ConfigIdentitySetInputSchema).output(ConfigIdentitySetOutputSchema).handler(
|
|
148467
148568
|
({ input: input2 }) => guarded(() => {
|
|
148468
|
-
requireChange(input2.label !== void 0 || input2.defaultConfigProfile !== void 0 || input2.provider !== void 0 || input2.allowAmbientCredential !== void 0 || input2.credential !== void 0 || input2.anchors !== void 0, "label, defaultConfigProfile, provider, allowAmbientCredential, credential or
|
|
148569
|
+
requireChange(input2.label !== void 0 || input2.defaultConfigProfile !== void 0 || input2.provider !== void 0 || input2.allowAmbientCredential !== void 0 || input2.credential !== void 0 || input2.anchors !== void 0 || input2.toolLogin !== void 0 || input2.clearToolLogin !== void 0, "label, defaultConfigProfile, provider, allowAmbientCredential, credential, anchors, toolLogin or clearToolLogin");
|
|
148469
148570
|
if (!identityExists(paths, input2.name)) {
|
|
148470
148571
|
throw identityNotFound(paths, input2.name);
|
|
148471
148572
|
}
|
|
@@ -148502,6 +148603,15 @@ function createConfigApiRouter(deps) {
|
|
|
148502
148603
|
if (input2.anchors !== void 0) {
|
|
148503
148604
|
setIdentityAnchors(paths, input2.name, input2.anchors === false ? void 0 : input2.anchors);
|
|
148504
148605
|
}
|
|
148606
|
+
for (const surface of input2.clearToolLogin ?? []) {
|
|
148607
|
+
setToolLogin(paths, input2.name, surface, false);
|
|
148608
|
+
}
|
|
148609
|
+
for (const { surface, lender } of input2.toolLogin ?? []) {
|
|
148610
|
+
if (!identityExists(paths, lender)) {
|
|
148611
|
+
throw identityNotFound(paths, lender);
|
|
148612
|
+
}
|
|
148613
|
+
setToolLogin(paths, input2.name, surface, lender);
|
|
148614
|
+
}
|
|
148505
148615
|
return { action: "updated", kind: "identity", name: input2.name, value: identityValue(input2.name, paths) };
|
|
148506
148616
|
})
|
|
148507
148617
|
),
|
package/dist/index.cjs
CHANGED
|
@@ -955,6 +955,24 @@ var init_identityGrants = __esm({
|
|
|
955
955
|
}
|
|
956
956
|
});
|
|
957
957
|
|
|
958
|
+
// src/toolLogins.ts
|
|
959
|
+
function withToolLogin(current, surface, lenderId) {
|
|
960
|
+
return { ...current, [surface]: lenderId };
|
|
961
|
+
}
|
|
962
|
+
function withoutToolLogin(current, surface) {
|
|
963
|
+
if (surface === void 0) {
|
|
964
|
+
return {};
|
|
965
|
+
}
|
|
966
|
+
return Object.fromEntries(Object.entries(current ?? {}).filter(([key]) => key !== surface));
|
|
967
|
+
}
|
|
968
|
+
var TOOL_SURFACES;
|
|
969
|
+
var init_toolLogins = __esm({
|
|
970
|
+
"src/toolLogins.ts"() {
|
|
971
|
+
"use strict";
|
|
972
|
+
TOOL_SURFACES = ["design", "claude-test", "pages", "triggers", "web-search", "web-fetch"];
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
|
|
958
976
|
// src/config/schema.ts
|
|
959
977
|
function isOverridableCategory(name) {
|
|
960
978
|
return OVERRIDABLE_CATEGORIES.some((category) => category === name);
|
|
@@ -993,7 +1011,7 @@ function isTimeZone(name) {
|
|
|
993
1011
|
return false;
|
|
994
1012
|
}
|
|
995
1013
|
}
|
|
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;
|
|
1014
|
+
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, ToolLoginsSchema, IdentityGrantSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
|
|
997
1015
|
var init_schema = __esm({
|
|
998
1016
|
"src/config/schema.ts"() {
|
|
999
1017
|
"use strict";
|
|
@@ -1007,6 +1025,7 @@ var init_schema = __esm({
|
|
|
1007
1025
|
init_versionDiscovery();
|
|
1008
1026
|
init_ownEntry();
|
|
1009
1027
|
init_identityGrants();
|
|
1028
|
+
init_toolLogins();
|
|
1010
1029
|
CATEGORY_NAMES = ["secret", "runtime", "history", "knowledge", "settings"];
|
|
1011
1030
|
OVERRIDABLE_CATEGORIES = ["runtime", "history", "knowledge", "settings"];
|
|
1012
1031
|
CategoryMapSchema = import_zod3.z.strictObject({
|
|
@@ -1455,6 +1474,7 @@ var init_schema = __esm({
|
|
|
1455
1474
|
models: ModelsConfigSchema.optional(),
|
|
1456
1475
|
jobs: import_zod3.z.record(PoolNameSchema, JobSchema).optional()
|
|
1457
1476
|
});
|
|
1477
|
+
ToolLoginsSchema = import_zod3.z.partialRecord(import_zod3.z.enum(TOOL_SURFACES), FileNameSchema);
|
|
1458
1478
|
IdentityGrantSchema = import_zod3.z.strictObject({
|
|
1459
1479
|
to: FileNameSchema,
|
|
1460
1480
|
features: import_zod3.z.array(import_zod3.z.enum(GRANT_FEATURES)).min(1)
|
|
@@ -1473,6 +1493,8 @@ var init_schema = __esm({
|
|
|
1473
1493
|
credential: CredentialSchema.optional(),
|
|
1474
1494
|
/** Which other identities may use this identity's claude.ai login, and for what (`identity grant`). Absent: none may. */
|
|
1475
1495
|
grants: import_zod3.z.array(IdentityGrantSchema).min(1).optional(),
|
|
1496
|
+
/** Which lender serves each server-tool surface this identity (the borrower) has chosen one for (`identity set --tool-login`). Absent: this identity's own login serves every surface. */
|
|
1497
|
+
toolLogins: ToolLoginsSchema.optional(),
|
|
1476
1498
|
/** 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. */
|
|
1477
1499
|
anchors: import_zod3.z.array(AnchorSchema).min(1).optional()
|
|
1478
1500
|
});
|
|
@@ -15149,6 +15171,17 @@ function writeIdentityGrants(paths, id, grants) {
|
|
|
15149
15171
|
function grantIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
|
|
15150
15172
|
return changeIdentityGrants(paths, parties, (grants, borrowerId) => withGrant(grants, borrowerId, features), namesLock);
|
|
15151
15173
|
}
|
|
15174
|
+
function setToolLogin(paths, borrowerName, surface, lender, namesLock = realIdentityNamesLockPorts) {
|
|
15175
|
+
return withIdentityNamesLock(paths, namesLock, () => {
|
|
15176
|
+
const borrowerId = requireStoredIdentityId(paths, borrowerName);
|
|
15177
|
+
const borrower = readIdentityById(paths, borrowerId);
|
|
15178
|
+
if (borrower === void 0) {
|
|
15179
|
+
throw identityNotFound(paths, borrowerName);
|
|
15180
|
+
}
|
|
15181
|
+
const updated = lender === false ? withoutToolLogin(borrower.toolLogins, surface) : withToolLogin(borrower.toolLogins, surface, requireStoredIdentityId(paths, lender));
|
|
15182
|
+
return applyPatch(identityJsonPath(paths, borrowerId), IdentitySchema, { toolLogins: Object.keys(updated).length === 0 ? void 0 : updated });
|
|
15183
|
+
});
|
|
15184
|
+
}
|
|
15152
15185
|
function revokeIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
|
|
15153
15186
|
return changeIdentityGrants(paths, parties, (grants, borrowerId) => withoutGrant(grants, borrowerId, features), namesLock);
|
|
15154
15187
|
}
|
|
@@ -15275,6 +15308,7 @@ var init_identityStore = __esm({
|
|
|
15275
15308
|
init_connectorListMerge();
|
|
15276
15309
|
init_lenderLogin();
|
|
15277
15310
|
init_quotaHttp();
|
|
15311
|
+
init_toolLogins();
|
|
15278
15312
|
IdentityNotFoundError = class extends CliError {
|
|
15279
15313
|
constructor(name, remedy2 = `Run \`agent-shim identity add ${name}\` first.`) {
|
|
15280
15314
|
super(`No identity named "${name}". ${remedy2}`);
|
|
@@ -15335,7 +15369,7 @@ var init_package = __esm({
|
|
|
15335
15369
|
"package.json"() {
|
|
15336
15370
|
package_default = {
|
|
15337
15371
|
name: "agent-shim",
|
|
15338
|
-
version: "14.
|
|
15372
|
+
version: "14.17.1",
|
|
15339
15373
|
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.",
|
|
15340
15374
|
license: "MIT",
|
|
15341
15375
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -24777,6 +24811,24 @@ function pushLegacyName(push, params) {
|
|
|
24777
24811
|
);
|
|
24778
24812
|
}
|
|
24779
24813
|
}
|
|
24814
|
+
function grantsCoverServerTools(identities, lenderId, borrowerId) {
|
|
24815
|
+
const lender = identities.find((entry) => entry.id === lenderId);
|
|
24816
|
+
let parsed;
|
|
24817
|
+
try {
|
|
24818
|
+
parsed = JSON.parse(lender?.raw ?? "");
|
|
24819
|
+
} catch {
|
|
24820
|
+
return false;
|
|
24821
|
+
}
|
|
24822
|
+
const grants = typeof parsed === "object" && parsed !== null && "grants" in parsed ? Reflect.get(parsed, "grants") : void 0;
|
|
24823
|
+
return Array.isArray(grants) && grants.some((grant) => isServerToolsGrantTo(grant, borrowerId));
|
|
24824
|
+
}
|
|
24825
|
+
function isServerToolsGrantTo(grant, borrowerId) {
|
|
24826
|
+
if (typeof grant !== "object" || grant === null || Reflect.get(grant, "to") !== borrowerId) {
|
|
24827
|
+
return false;
|
|
24828
|
+
}
|
|
24829
|
+
const features = Reflect.get(grant, "features");
|
|
24830
|
+
return Array.isArray(features) && features.includes("server-tools");
|
|
24831
|
+
}
|
|
24780
24832
|
function runDoctor(params) {
|
|
24781
24833
|
const findings = [];
|
|
24782
24834
|
const push = (section, severity, message, subject) => {
|
|
@@ -24926,6 +24978,13 @@ function runDoctor(params) {
|
|
|
24926
24978
|
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);
|
|
24927
24979
|
}
|
|
24928
24980
|
}
|
|
24981
|
+
for (const [surface, lenderId] of Object.entries(validated3.data.toolLogins ?? {})) {
|
|
24982
|
+
if (!identityIds.has(lenderId)) {
|
|
24983
|
+
push("identity", "warn", `${entry.name} serves "${surface}" from identity id "${lenderId}", which does not exist. Remove that entry from its identity.json.`, entry.name);
|
|
24984
|
+
} else if (!grantsCoverServerTools(params.identities, lenderId, entry.id)) {
|
|
24985
|
+
push("identity", "warn", `${entry.name} serves "${surface}" from identity id "${lenderId}", which does not currently grant it "server-tools". Grant it, or remove the tool login.`, entry.name);
|
|
24986
|
+
}
|
|
24987
|
+
}
|
|
24929
24988
|
if (validated3.data.grants !== void 0 && keychainItem !== true && !entry.credentialsFilePresent) {
|
|
24930
24989
|
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);
|
|
24931
24990
|
}
|
|
@@ -25505,7 +25564,8 @@ function identityWriteView(identity) {
|
|
|
25505
25564
|
allowAmbientCredential: identity.allowAmbientCredential,
|
|
25506
25565
|
...identity.credential === void 0 ? {} : { credential: summariseCredential(identity.credential) },
|
|
25507
25566
|
...identity.anchors === void 0 ? {} : { anchors: identity.anchors },
|
|
25508
|
-
...identity.grants === void 0 ? {} : { grants: identity.grants }
|
|
25567
|
+
...identity.grants === void 0 ? {} : { grants: identity.grants },
|
|
25568
|
+
...identity.toolLogins === void 0 ? {} : { toolLogins: identity.toolLogins }
|
|
25509
25569
|
};
|
|
25510
25570
|
}
|
|
25511
25571
|
|
|
@@ -25548,6 +25608,7 @@ init_schema();
|
|
|
25548
25608
|
init_names();
|
|
25549
25609
|
init_keychainLogin();
|
|
25550
25610
|
init_statusline();
|
|
25611
|
+
init_toolLogins();
|
|
25551
25612
|
var RemovalConfirmationSchema = import_zod43.z.boolean();
|
|
25552
25613
|
var CredentialWriteSchema = (targets) => import_zod43.z.strictObject({
|
|
25553
25614
|
sources: import_zod43.z.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
@@ -25580,7 +25641,8 @@ var IdentityValueSchema = import_zod43.z.strictObject({
|
|
|
25580
25641
|
credential: CredentialSummarySchema2.optional(),
|
|
25581
25642
|
anchors: import_zod43.z.array(AnchorSchema).optional(),
|
|
25582
25643
|
/** 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. */
|
|
25583
|
-
grants: import_zod43.z.array(IdentityGrantSchema).optional()
|
|
25644
|
+
grants: import_zod43.z.array(IdentityGrantSchema).optional(),
|
|
25645
|
+
toolLogins: ToolLoginsSchema.optional()
|
|
25584
25646
|
});
|
|
25585
25647
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
25586
25648
|
var ProviderValueSchema = import_zod43.z.strictObject({
|
|
@@ -25605,7 +25667,11 @@ var ConfigIdentitySetInputSchema = import_zod43.z.strictObject({
|
|
|
25605
25667
|
allowAmbientCredential: import_zod43.z.boolean().optional(),
|
|
25606
25668
|
credential: import_zod43.z.union([import_zod43.z.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
|
|
25607
25669
|
/** `false` removes the anchors; a list replaces them. */
|
|
25608
|
-
anchors: import_zod43.z.union([import_zod43.z.literal(false), import_zod43.z.array(AnchorSchema).min(1)]).optional()
|
|
25670
|
+
anchors: import_zod43.z.union([import_zod43.z.literal(false), import_zod43.z.array(AnchorSchema).min(1)]).optional(),
|
|
25671
|
+
/** Each assignment replaces whatever that surface already named. */
|
|
25672
|
+
toolLogin: import_zod43.z.array(import_zod43.z.strictObject({ surface: import_zod43.z.enum(TOOL_SURFACES), lender: import_zod43.z.string().min(1) })).optional(),
|
|
25673
|
+
/** Surfaces to return to the identity's own login. */
|
|
25674
|
+
clearToolLogin: import_zod43.z.array(import_zod43.z.enum(TOOL_SURFACES)).optional()
|
|
25609
25675
|
});
|
|
25610
25676
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
25611
25677
|
var ConfigIdentityRemoveInputSchema = import_zod43.z.strictObject({ name: import_zod43.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
@@ -25828,7 +25894,7 @@ function createConfigApiRouter(deps) {
|
|
|
25828
25894
|
}),
|
|
25829
25895
|
set: route("/rest/config/identity/set", "Update an identity's label, default profile, provider, ambient-credential setting, credential or anchors").input(ConfigIdentitySetInputSchema).output(ConfigIdentitySetOutputSchema).handler(
|
|
25830
25896
|
({ input }) => guarded(() => {
|
|
25831
|
-
requireChange(input.label !== void 0 || input.defaultConfigProfile !== void 0 || input.provider !== void 0 || input.allowAmbientCredential !== void 0 || input.credential !== void 0 || input.anchors !== void 0, "label, defaultConfigProfile, provider, allowAmbientCredential, credential or
|
|
25897
|
+
requireChange(input.label !== void 0 || input.defaultConfigProfile !== void 0 || input.provider !== void 0 || input.allowAmbientCredential !== void 0 || input.credential !== void 0 || input.anchors !== void 0 || input.toolLogin !== void 0 || input.clearToolLogin !== void 0, "label, defaultConfigProfile, provider, allowAmbientCredential, credential, anchors, toolLogin or clearToolLogin");
|
|
25832
25898
|
if (!identityExists(paths, input.name)) {
|
|
25833
25899
|
throw identityNotFound(paths, input.name);
|
|
25834
25900
|
}
|
|
@@ -25865,6 +25931,15 @@ function createConfigApiRouter(deps) {
|
|
|
25865
25931
|
if (input.anchors !== void 0) {
|
|
25866
25932
|
setIdentityAnchors(paths, input.name, input.anchors === false ? void 0 : input.anchors);
|
|
25867
25933
|
}
|
|
25934
|
+
for (const surface of input.clearToolLogin ?? []) {
|
|
25935
|
+
setToolLogin(paths, input.name, surface, false);
|
|
25936
|
+
}
|
|
25937
|
+
for (const { surface, lender } of input.toolLogin ?? []) {
|
|
25938
|
+
if (!identityExists(paths, lender)) {
|
|
25939
|
+
throw identityNotFound(paths, lender);
|
|
25940
|
+
}
|
|
25941
|
+
setToolLogin(paths, input.name, surface, lender);
|
|
25942
|
+
}
|
|
25868
25943
|
return { action: "updated", kind: "identity", name: input.name, value: identityValue(input.name, paths) };
|
|
25869
25944
|
})
|
|
25870
25945
|
),
|
package/dist/index.mjs
CHANGED
|
@@ -933,6 +933,24 @@ var init_identityGrants = __esm({
|
|
|
933
933
|
}
|
|
934
934
|
});
|
|
935
935
|
|
|
936
|
+
// src/toolLogins.ts
|
|
937
|
+
function withToolLogin(current, surface, lenderId) {
|
|
938
|
+
return { ...current, [surface]: lenderId };
|
|
939
|
+
}
|
|
940
|
+
function withoutToolLogin(current, surface) {
|
|
941
|
+
if (surface === void 0) {
|
|
942
|
+
return {};
|
|
943
|
+
}
|
|
944
|
+
return Object.fromEntries(Object.entries(current ?? {}).filter(([key]) => key !== surface));
|
|
945
|
+
}
|
|
946
|
+
var TOOL_SURFACES;
|
|
947
|
+
var init_toolLogins = __esm({
|
|
948
|
+
"src/toolLogins.ts"() {
|
|
949
|
+
"use strict";
|
|
950
|
+
TOOL_SURFACES = ["design", "claude-test", "pages", "triggers", "web-search", "web-fetch"];
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
|
|
936
954
|
// src/config/schema.ts
|
|
937
955
|
import path3 from "node:path";
|
|
938
956
|
import { z as z3 } from "zod";
|
|
@@ -974,7 +992,7 @@ function isTimeZone(name) {
|
|
|
974
992
|
return false;
|
|
975
993
|
}
|
|
976
994
|
}
|
|
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;
|
|
995
|
+
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, ToolLoginsSchema, IdentityGrantSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
|
|
978
996
|
var init_schema = __esm({
|
|
979
997
|
"src/config/schema.ts"() {
|
|
980
998
|
"use strict";
|
|
@@ -985,6 +1003,7 @@ var init_schema = __esm({
|
|
|
985
1003
|
init_versionDiscovery();
|
|
986
1004
|
init_ownEntry();
|
|
987
1005
|
init_identityGrants();
|
|
1006
|
+
init_toolLogins();
|
|
988
1007
|
CATEGORY_NAMES = ["secret", "runtime", "history", "knowledge", "settings"];
|
|
989
1008
|
OVERRIDABLE_CATEGORIES = ["runtime", "history", "knowledge", "settings"];
|
|
990
1009
|
CategoryMapSchema = z3.strictObject({
|
|
@@ -1433,6 +1452,7 @@ var init_schema = __esm({
|
|
|
1433
1452
|
models: ModelsConfigSchema.optional(),
|
|
1434
1453
|
jobs: z3.record(PoolNameSchema, JobSchema).optional()
|
|
1435
1454
|
});
|
|
1455
|
+
ToolLoginsSchema = z3.partialRecord(z3.enum(TOOL_SURFACES), FileNameSchema);
|
|
1436
1456
|
IdentityGrantSchema = z3.strictObject({
|
|
1437
1457
|
to: FileNameSchema,
|
|
1438
1458
|
features: z3.array(z3.enum(GRANT_FEATURES)).min(1)
|
|
@@ -1451,6 +1471,8 @@ var init_schema = __esm({
|
|
|
1451
1471
|
credential: CredentialSchema.optional(),
|
|
1452
1472
|
/** Which other identities may use this identity's claude.ai login, and for what (`identity grant`). Absent: none may. */
|
|
1453
1473
|
grants: z3.array(IdentityGrantSchema).min(1).optional(),
|
|
1474
|
+
/** Which lender serves each server-tool surface this identity (the borrower) has chosen one for (`identity set --tool-login`). Absent: this identity's own login serves every surface. */
|
|
1475
|
+
toolLogins: ToolLoginsSchema.optional(),
|
|
1454
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. */
|
|
1455
1477
|
anchors: z3.array(AnchorSchema).min(1).optional()
|
|
1456
1478
|
});
|
|
@@ -15122,6 +15144,17 @@ function writeIdentityGrants(paths, id, grants) {
|
|
|
15122
15144
|
function grantIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
|
|
15123
15145
|
return changeIdentityGrants(paths, parties, (grants, borrowerId) => withGrant(grants, borrowerId, features), namesLock);
|
|
15124
15146
|
}
|
|
15147
|
+
function setToolLogin(paths, borrowerName, surface, lender, namesLock = realIdentityNamesLockPorts) {
|
|
15148
|
+
return withIdentityNamesLock(paths, namesLock, () => {
|
|
15149
|
+
const borrowerId = requireStoredIdentityId(paths, borrowerName);
|
|
15150
|
+
const borrower = readIdentityById(paths, borrowerId);
|
|
15151
|
+
if (borrower === void 0) {
|
|
15152
|
+
throw identityNotFound(paths, borrowerName);
|
|
15153
|
+
}
|
|
15154
|
+
const updated = lender === false ? withoutToolLogin(borrower.toolLogins, surface) : withToolLogin(borrower.toolLogins, surface, requireStoredIdentityId(paths, lender));
|
|
15155
|
+
return applyPatch(identityJsonPath(paths, borrowerId), IdentitySchema, { toolLogins: Object.keys(updated).length === 0 ? void 0 : updated });
|
|
15156
|
+
});
|
|
15157
|
+
}
|
|
15125
15158
|
function revokeIdentityLogin(paths, parties, features, namesLock = realIdentityNamesLockPorts) {
|
|
15126
15159
|
return changeIdentityGrants(paths, parties, (grants, borrowerId) => withoutGrant(grants, borrowerId, features), namesLock);
|
|
15127
15160
|
}
|
|
@@ -15246,6 +15279,7 @@ var init_identityStore = __esm({
|
|
|
15246
15279
|
init_connectorListMerge();
|
|
15247
15280
|
init_lenderLogin();
|
|
15248
15281
|
init_quotaHttp();
|
|
15282
|
+
init_toolLogins();
|
|
15249
15283
|
IdentityNotFoundError = class extends CliError {
|
|
15250
15284
|
constructor(name, remedy2 = `Run \`agent-shim identity add ${name}\` first.`) {
|
|
15251
15285
|
super(`No identity named "${name}". ${remedy2}`);
|
|
@@ -15306,7 +15340,7 @@ var init_package = __esm({
|
|
|
15306
15340
|
"package.json"() {
|
|
15307
15341
|
package_default = {
|
|
15308
15342
|
name: "agent-shim",
|
|
15309
|
-
version: "14.
|
|
15343
|
+
version: "14.17.1",
|
|
15310
15344
|
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.",
|
|
15311
15345
|
license: "MIT",
|
|
15312
15346
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -24322,6 +24356,24 @@ function pushLegacyName(push, params) {
|
|
|
24322
24356
|
);
|
|
24323
24357
|
}
|
|
24324
24358
|
}
|
|
24359
|
+
function grantsCoverServerTools(identities, lenderId, borrowerId) {
|
|
24360
|
+
const lender = identities.find((entry) => entry.id === lenderId);
|
|
24361
|
+
let parsed;
|
|
24362
|
+
try {
|
|
24363
|
+
parsed = JSON.parse(lender?.raw ?? "");
|
|
24364
|
+
} catch {
|
|
24365
|
+
return false;
|
|
24366
|
+
}
|
|
24367
|
+
const grants = typeof parsed === "object" && parsed !== null && "grants" in parsed ? Reflect.get(parsed, "grants") : void 0;
|
|
24368
|
+
return Array.isArray(grants) && grants.some((grant) => isServerToolsGrantTo(grant, borrowerId));
|
|
24369
|
+
}
|
|
24370
|
+
function isServerToolsGrantTo(grant, borrowerId) {
|
|
24371
|
+
if (typeof grant !== "object" || grant === null || Reflect.get(grant, "to") !== borrowerId) {
|
|
24372
|
+
return false;
|
|
24373
|
+
}
|
|
24374
|
+
const features = Reflect.get(grant, "features");
|
|
24375
|
+
return Array.isArray(features) && features.includes("server-tools");
|
|
24376
|
+
}
|
|
24325
24377
|
function runDoctor(params) {
|
|
24326
24378
|
const findings = [];
|
|
24327
24379
|
const push = (section, severity, message, subject) => {
|
|
@@ -24471,6 +24523,13 @@ function runDoctor(params) {
|
|
|
24471
24523
|
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);
|
|
24472
24524
|
}
|
|
24473
24525
|
}
|
|
24526
|
+
for (const [surface, lenderId] of Object.entries(validated3.data.toolLogins ?? {})) {
|
|
24527
|
+
if (!identityIds.has(lenderId)) {
|
|
24528
|
+
push("identity", "warn", `${entry.name} serves "${surface}" from identity id "${lenderId}", which does not exist. Remove that entry from its identity.json.`, entry.name);
|
|
24529
|
+
} else if (!grantsCoverServerTools(params.identities, lenderId, entry.id)) {
|
|
24530
|
+
push("identity", "warn", `${entry.name} serves "${surface}" from identity id "${lenderId}", which does not currently grant it "server-tools". Grant it, or remove the tool login.`, entry.name);
|
|
24531
|
+
}
|
|
24532
|
+
}
|
|
24474
24533
|
if (validated3.data.grants !== void 0 && keychainItem !== true && !entry.credentialsFilePresent) {
|
|
24475
24534
|
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);
|
|
24476
24535
|
}
|
|
@@ -25050,7 +25109,8 @@ function identityWriteView(identity) {
|
|
|
25050
25109
|
allowAmbientCredential: identity.allowAmbientCredential,
|
|
25051
25110
|
...identity.credential === void 0 ? {} : { credential: summariseCredential(identity.credential) },
|
|
25052
25111
|
...identity.anchors === void 0 ? {} : { anchors: identity.anchors },
|
|
25053
|
-
...identity.grants === void 0 ? {} : { grants: identity.grants }
|
|
25112
|
+
...identity.grants === void 0 ? {} : { grants: identity.grants },
|
|
25113
|
+
...identity.toolLogins === void 0 ? {} : { toolLogins: identity.toolLogins }
|
|
25054
25114
|
};
|
|
25055
25115
|
}
|
|
25056
25116
|
|
|
@@ -25092,6 +25152,7 @@ init_schema();
|
|
|
25092
25152
|
init_names();
|
|
25093
25153
|
init_keychainLogin();
|
|
25094
25154
|
init_statusline();
|
|
25155
|
+
init_toolLogins();
|
|
25095
25156
|
import { z as z43 } from "zod";
|
|
25096
25157
|
var RemovalConfirmationSchema = z43.boolean();
|
|
25097
25158
|
var CredentialWriteSchema = (targets) => z43.strictObject({
|
|
@@ -25125,7 +25186,8 @@ var IdentityValueSchema = z43.strictObject({
|
|
|
25125
25186
|
credential: CredentialSummarySchema2.optional(),
|
|
25126
25187
|
anchors: z43.array(AnchorSchema).optional(),
|
|
25127
25188
|
/** 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. */
|
|
25128
|
-
grants: z43.array(IdentityGrantSchema).optional()
|
|
25189
|
+
grants: z43.array(IdentityGrantSchema).optional(),
|
|
25190
|
+
toolLogins: ToolLoginsSchema.optional()
|
|
25129
25191
|
});
|
|
25130
25192
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
25131
25193
|
var ProviderValueSchema = z43.strictObject({
|
|
@@ -25150,7 +25212,11 @@ var ConfigIdentitySetInputSchema = z43.strictObject({
|
|
|
25150
25212
|
allowAmbientCredential: z43.boolean().optional(),
|
|
25151
25213
|
credential: z43.union([z43.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
|
|
25152
25214
|
/** `false` removes the anchors; a list replaces them. */
|
|
25153
|
-
anchors: z43.union([z43.literal(false), z43.array(AnchorSchema).min(1)]).optional()
|
|
25215
|
+
anchors: z43.union([z43.literal(false), z43.array(AnchorSchema).min(1)]).optional(),
|
|
25216
|
+
/** Each assignment replaces whatever that surface already named. */
|
|
25217
|
+
toolLogin: z43.array(z43.strictObject({ surface: z43.enum(TOOL_SURFACES), lender: z43.string().min(1) })).optional(),
|
|
25218
|
+
/** Surfaces to return to the identity's own login. */
|
|
25219
|
+
clearToolLogin: z43.array(z43.enum(TOOL_SURFACES)).optional()
|
|
25154
25220
|
});
|
|
25155
25221
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
25156
25222
|
var ConfigIdentityRemoveInputSchema = z43.strictObject({ name: z43.string().min(1), confirm: RemovalConfirmationSchema });
|
|
@@ -25373,7 +25439,7 @@ function createConfigApiRouter(deps) {
|
|
|
25373
25439
|
}),
|
|
25374
25440
|
set: route("/rest/config/identity/set", "Update an identity's label, default profile, provider, ambient-credential setting, credential or anchors").input(ConfigIdentitySetInputSchema).output(ConfigIdentitySetOutputSchema).handler(
|
|
25375
25441
|
({ input }) => guarded(() => {
|
|
25376
|
-
requireChange(input.label !== void 0 || input.defaultConfigProfile !== void 0 || input.provider !== void 0 || input.allowAmbientCredential !== void 0 || input.credential !== void 0 || input.anchors !== void 0, "label, defaultConfigProfile, provider, allowAmbientCredential, credential or
|
|
25442
|
+
requireChange(input.label !== void 0 || input.defaultConfigProfile !== void 0 || input.provider !== void 0 || input.allowAmbientCredential !== void 0 || input.credential !== void 0 || input.anchors !== void 0 || input.toolLogin !== void 0 || input.clearToolLogin !== void 0, "label, defaultConfigProfile, provider, allowAmbientCredential, credential, anchors, toolLogin or clearToolLogin");
|
|
25377
25443
|
if (!identityExists(paths, input.name)) {
|
|
25378
25444
|
throw identityNotFound(paths, input.name);
|
|
25379
25445
|
}
|
|
@@ -25410,6 +25476,15 @@ function createConfigApiRouter(deps) {
|
|
|
25410
25476
|
if (input.anchors !== void 0) {
|
|
25411
25477
|
setIdentityAnchors(paths, input.name, input.anchors === false ? void 0 : input.anchors);
|
|
25412
25478
|
}
|
|
25479
|
+
for (const surface of input.clearToolLogin ?? []) {
|
|
25480
|
+
setToolLogin(paths, input.name, surface, false);
|
|
25481
|
+
}
|
|
25482
|
+
for (const { surface, lender } of input.toolLogin ?? []) {
|
|
25483
|
+
if (!identityExists(paths, lender)) {
|
|
25484
|
+
throw identityNotFound(paths, lender);
|
|
25485
|
+
}
|
|
25486
|
+
setToolLogin(paths, input.name, surface, lender);
|
|
25487
|
+
}
|
|
25413
25488
|
return { action: "updated", kind: "identity", name: input.name, value: identityValue(input.name, paths) };
|
|
25414
25489
|
})
|
|
25415
25490
|
),
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5480,6 +5480,14 @@ declare const IdentitySchema: z.ZodObject<{
|
|
|
5480
5480
|
"server-tools": "server-tools";
|
|
5481
5481
|
}>>;
|
|
5482
5482
|
}, z.core.$strict>>>;
|
|
5483
|
+
toolLogins: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
5484
|
+
design: "design";
|
|
5485
|
+
"claude-test": "claude-test";
|
|
5486
|
+
pages: "pages";
|
|
5487
|
+
triggers: "triggers";
|
|
5488
|
+
"web-search": "web-search";
|
|
5489
|
+
"web-fetch": "web-fetch";
|
|
5490
|
+
}> & z.core.$partial, z.ZodString>>;
|
|
5483
5491
|
anchors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
5484
5492
|
days: z.ZodArray<z.ZodEnum<{
|
|
5485
5493
|
mon: "mon";
|
|
@@ -10324,6 +10332,14 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
|
|
|
10324
10332
|
"server-tools": "server-tools";
|
|
10325
10333
|
}>>;
|
|
10326
10334
|
}, zod_v4_core.$strict>>>;
|
|
10335
|
+
toolLogins: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<{
|
|
10336
|
+
design: "design";
|
|
10337
|
+
"claude-test": "claude-test";
|
|
10338
|
+
pages: "pages";
|
|
10339
|
+
triggers: "triggers";
|
|
10340
|
+
"web-search": "web-search";
|
|
10341
|
+
"web-fetch": "web-fetch";
|
|
10342
|
+
}> & zod_v4_core.$partial, zod.ZodString>>;
|
|
10327
10343
|
}, zod_v4_core.$strict>;
|
|
10328
10344
|
}, zod_v4_core.$strict>, MergedErrorMap<$ErrorMap, TErrorMap>>;
|
|
10329
10345
|
set: _orpc_server.DecoratedProcedure<DoorApiContext & object, IntersectPick<TInitialContext, $OutContext>, zod.ZodObject<{
|
|
@@ -10377,6 +10393,25 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
|
|
|
10377
10393
|
time: zod.ZodString;
|
|
10378
10394
|
timeZone: zod.ZodOptional<zod.ZodString>;
|
|
10379
10395
|
}, zod_v4_core.$strict>>]>>;
|
|
10396
|
+
toolLogin: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
10397
|
+
surface: zod.ZodEnum<{
|
|
10398
|
+
design: "design";
|
|
10399
|
+
"claude-test": "claude-test";
|
|
10400
|
+
pages: "pages";
|
|
10401
|
+
triggers: "triggers";
|
|
10402
|
+
"web-search": "web-search";
|
|
10403
|
+
"web-fetch": "web-fetch";
|
|
10404
|
+
}>;
|
|
10405
|
+
lender: zod.ZodString;
|
|
10406
|
+
}, zod_v4_core.$strict>>>;
|
|
10407
|
+
clearToolLogin: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
|
|
10408
|
+
design: "design";
|
|
10409
|
+
"claude-test": "claude-test";
|
|
10410
|
+
pages: "pages";
|
|
10411
|
+
triggers: "triggers";
|
|
10412
|
+
"web-search": "web-search";
|
|
10413
|
+
"web-fetch": "web-fetch";
|
|
10414
|
+
}>>>;
|
|
10380
10415
|
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
10381
10416
|
action: zod.ZodLiteral<"updated">;
|
|
10382
10417
|
kind: zod.ZodLiteral<"identity">;
|
|
@@ -10446,6 +10481,14 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
|
|
|
10446
10481
|
"server-tools": "server-tools";
|
|
10447
10482
|
}>>;
|
|
10448
10483
|
}, zod_v4_core.$strict>>>;
|
|
10484
|
+
toolLogins: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<{
|
|
10485
|
+
design: "design";
|
|
10486
|
+
"claude-test": "claude-test";
|
|
10487
|
+
pages: "pages";
|
|
10488
|
+
triggers: "triggers";
|
|
10489
|
+
"web-search": "web-search";
|
|
10490
|
+
"web-fetch": "web-fetch";
|
|
10491
|
+
}> & zod_v4_core.$partial, zod.ZodString>>;
|
|
10449
10492
|
}, zod_v4_core.$strict>;
|
|
10450
10493
|
}, zod_v4_core.$strict>, MergedErrorMap<$ErrorMap, TErrorMap>>;
|
|
10451
10494
|
remove: _orpc_server.DecoratedProcedure<DoorApiContext & object, IntersectPick<TInitialContext, $OutContext>, zod.ZodObject<{
|
|
@@ -17782,6 +17825,14 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
|
|
|
17782
17825
|
"server-tools": "server-tools";
|
|
17783
17826
|
}>>;
|
|
17784
17827
|
}, z.core.$strict>>>;
|
|
17828
|
+
toolLogins: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
17829
|
+
design: "design";
|
|
17830
|
+
"claude-test": "claude-test";
|
|
17831
|
+
pages: "pages";
|
|
17832
|
+
triggers: "triggers";
|
|
17833
|
+
"web-search": "web-search";
|
|
17834
|
+
"web-fetch": "web-fetch";
|
|
17835
|
+
}> & z.core.$partial, z.ZodString>>;
|
|
17785
17836
|
}, z.core.$strict>;
|
|
17786
17837
|
}, z.core.$strict>, MergedErrorMap<$ErrorMap, TErrorMap>>;
|
|
17787
17838
|
set: _orpc_server.DecoratedProcedure<DoorApiContext & object, IntersectPick<TInitialContext, $OutContext>, z.ZodObject<{
|
|
@@ -17835,6 +17886,25 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
|
|
|
17835
17886
|
time: z.ZodString;
|
|
17836
17887
|
timeZone: z.ZodOptional<z.ZodString>;
|
|
17837
17888
|
}, z.core.$strict>>]>>;
|
|
17889
|
+
toolLogin: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17890
|
+
surface: z.ZodEnum<{
|
|
17891
|
+
design: "design";
|
|
17892
|
+
"claude-test": "claude-test";
|
|
17893
|
+
pages: "pages";
|
|
17894
|
+
triggers: "triggers";
|
|
17895
|
+
"web-search": "web-search";
|
|
17896
|
+
"web-fetch": "web-fetch";
|
|
17897
|
+
}>;
|
|
17898
|
+
lender: z.ZodString;
|
|
17899
|
+
}, z.core.$strict>>>;
|
|
17900
|
+
clearToolLogin: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
17901
|
+
design: "design";
|
|
17902
|
+
"claude-test": "claude-test";
|
|
17903
|
+
pages: "pages";
|
|
17904
|
+
triggers: "triggers";
|
|
17905
|
+
"web-search": "web-search";
|
|
17906
|
+
"web-fetch": "web-fetch";
|
|
17907
|
+
}>>>;
|
|
17838
17908
|
}, z.core.$strict>, z.ZodObject<{
|
|
17839
17909
|
action: z.ZodLiteral<"updated">;
|
|
17840
17910
|
kind: z.ZodLiteral<"identity">;
|
|
@@ -17904,6 +17974,14 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
|
|
|
17904
17974
|
"server-tools": "server-tools";
|
|
17905
17975
|
}>>;
|
|
17906
17976
|
}, z.core.$strict>>>;
|
|
17977
|
+
toolLogins: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
17978
|
+
design: "design";
|
|
17979
|
+
"claude-test": "claude-test";
|
|
17980
|
+
pages: "pages";
|
|
17981
|
+
triggers: "triggers";
|
|
17982
|
+
"web-search": "web-search";
|
|
17983
|
+
"web-fetch": "web-fetch";
|
|
17984
|
+
}> & z.core.$partial, z.ZodString>>;
|
|
17907
17985
|
}, z.core.$strict>;
|
|
17908
17986
|
}, z.core.$strict>, MergedErrorMap<$ErrorMap, TErrorMap>>;
|
|
17909
17987
|
remove: _orpc_server.DecoratedProcedure<DoorApiContext & object, IntersectPick<TInitialContext, $OutContext>, z.ZodObject<{
|
|
@@ -22631,6 +22709,14 @@ declare const ConfigIdentityAddOutputSchema: z.ZodObject<{
|
|
|
22631
22709
|
"server-tools": "server-tools";
|
|
22632
22710
|
}>>;
|
|
22633
22711
|
}, z.core.$strict>>>;
|
|
22712
|
+
toolLogins: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
22713
|
+
design: "design";
|
|
22714
|
+
"claude-test": "claude-test";
|
|
22715
|
+
pages: "pages";
|
|
22716
|
+
triggers: "triggers";
|
|
22717
|
+
"web-search": "web-search";
|
|
22718
|
+
"web-fetch": "web-fetch";
|
|
22719
|
+
}> & z.core.$partial, z.ZodString>>;
|
|
22634
22720
|
}, z.core.$strict>;
|
|
22635
22721
|
}, z.core.$strict>;
|
|
22636
22722
|
/** `defaultConfigProfile: false` clears it; `credential: false` removes the credential block, returning the identity to its stored login. At least one field must be present. */
|
|
@@ -22685,6 +22771,25 @@ declare const ConfigIdentitySetInputSchema: z.ZodObject<{
|
|
|
22685
22771
|
time: z.ZodString;
|
|
22686
22772
|
timeZone: z.ZodOptional<z.ZodString>;
|
|
22687
22773
|
}, z.core.$strict>>]>>;
|
|
22774
|
+
toolLogin: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
22775
|
+
surface: z.ZodEnum<{
|
|
22776
|
+
design: "design";
|
|
22777
|
+
"claude-test": "claude-test";
|
|
22778
|
+
pages: "pages";
|
|
22779
|
+
triggers: "triggers";
|
|
22780
|
+
"web-search": "web-search";
|
|
22781
|
+
"web-fetch": "web-fetch";
|
|
22782
|
+
}>;
|
|
22783
|
+
lender: z.ZodString;
|
|
22784
|
+
}, z.core.$strict>>>;
|
|
22785
|
+
clearToolLogin: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
22786
|
+
design: "design";
|
|
22787
|
+
"claude-test": "claude-test";
|
|
22788
|
+
pages: "pages";
|
|
22789
|
+
triggers: "triggers";
|
|
22790
|
+
"web-search": "web-search";
|
|
22791
|
+
"web-fetch": "web-fetch";
|
|
22792
|
+
}>>>;
|
|
22688
22793
|
}, z.core.$strict>;
|
|
22689
22794
|
declare const ConfigIdentitySetOutputSchema: z.ZodObject<{
|
|
22690
22795
|
action: z.ZodLiteral<"updated">;
|
|
@@ -22755,6 +22860,14 @@ declare const ConfigIdentitySetOutputSchema: z.ZodObject<{
|
|
|
22755
22860
|
"server-tools": "server-tools";
|
|
22756
22861
|
}>>;
|
|
22757
22862
|
}, z.core.$strict>>>;
|
|
22863
|
+
toolLogins: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
22864
|
+
design: "design";
|
|
22865
|
+
"claude-test": "claude-test";
|
|
22866
|
+
pages: "pages";
|
|
22867
|
+
triggers: "triggers";
|
|
22868
|
+
"web-search": "web-search";
|
|
22869
|
+
"web-fetch": "web-fetch";
|
|
22870
|
+
}> & z.core.$partial, z.ZodString>>;
|
|
22758
22871
|
}, z.core.$strict>;
|
|
22759
22872
|
}, z.core.$strict>;
|
|
22760
22873
|
declare const ConfigIdentityRemoveInputSchema: z.ZodObject<{
|
|
@@ -29011,13 +29124,6 @@ interface RunDoctorParams {
|
|
|
29011
29124
|
readonly rcSelfHostMint?: RcSelfHostMintFacts;
|
|
29012
29125
|
};
|
|
29013
29126
|
}
|
|
29014
|
-
/**
|
|
29015
|
-
* Audits the whole `~/.agent-shim` config graph for internal consistency: every identity, every configuration profile's own `extends` chain, every provider, `directory-rules.json`, `config.json`, `categories.local.json`, `active-identity`, plus real Claude Code binary discoverability and ambient-credential exposure.
|
|
29016
|
-
*
|
|
29017
|
-
* Deliberately identity/directory-agnostic, unlike `runCheck` — there is no single cascade to resolve `doctor` against, so it never touches settings-exposure (which only means anything relative to one resolved cascade).
|
|
29018
|
-
*
|
|
29019
|
-
* Every check aggregates rather than throws: a malformed file becomes one `fail` finding for that file, not an aborted report. This is the one place in the codebase that deliberately breaks the "throw a validation error and let it propagate" convention every other command relies on — `doctor`'s whole purpose is to survive a broken file and keep auditing everything else.
|
|
29020
|
-
*/
|
|
29021
29127
|
declare function runDoctor(params: RunDoctorParams): DoctorReport;
|
|
29022
29128
|
/** What `collectDoctorReport` needs from its caller. */
|
|
29023
29129
|
interface CollectDoctorReportParams {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-shim",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.17.1",
|
|
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>",
|