agent-shim 14.14.0 → 14.16.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 +3791 -3491
- package/dist/index.cjs +56 -4
- package/dist/index.mjs +56 -4
- package/dist/types/index.d.ts +8 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6178,7 +6178,7 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
|
|
|
6178
6178
|
`;
|
|
6179
6179
|
pumpTapSession(socket, async (clientAlpn) => await effects.connectTlsUpstream(host, HTTPS_PORT, clientAlpn), config.capture?.tapStream?.(host), Buffer.from(headText, "utf8"));
|
|
6180
6180
|
};
|
|
6181
|
-
const sessionsFor = (ownedSet) => config.interceptHosts.map((host) => {
|
|
6181
|
+
const sessionsFor = (ownedSet) => (ownedSet ? config.interceptHosts.filter((host) => host !== CONNECT_CONNECTOR_PROXY_HOST) : config.interceptHosts).map((host) => {
|
|
6182
6182
|
if (config.tapHosts.includes(host) && !ownedSet) {
|
|
6183
6183
|
const serveSecure2 = (secure) => {
|
|
6184
6184
|
pumpTapSession(secure, async (clientAlpn) => await effects.connectTlsUpstream(host, HTTPS_PORT, clientAlpn), config.capture?.tapStream?.(host));
|
|
@@ -6221,6 +6221,11 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
|
|
|
6221
6221
|
answerAndClose(response, REQUEST_STATUS.notFound);
|
|
6222
6222
|
return;
|
|
6223
6223
|
}
|
|
6224
|
+
const rewritten = config.rewriteForwardedAuthorization?.(host, request4, tunnelTokens.get(request4.socket));
|
|
6225
|
+
if (rewritten !== void 0) {
|
|
6226
|
+
request4.headers.authorization = rewritten.authorization;
|
|
6227
|
+
request4.url = rewritten.url;
|
|
6228
|
+
}
|
|
6224
6229
|
effects.forwardHttp(config.upstreamFor(host), request4, response, config.capture?.observePassthrough(request4));
|
|
6225
6230
|
};
|
|
6226
6231
|
const handler = (request4, response) => {
|
|
@@ -6570,7 +6575,7 @@ function realConnectCertStore(paths) {
|
|
|
6570
6575
|
}
|
|
6571
6576
|
};
|
|
6572
6577
|
}
|
|
6573
|
-
var import_node_crypto6, fs3, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, ROUTED_PATH_PREFIX, HTTPS_PORT, HTTP_BAD_GATEWAY, CA_KEY_FILE_MODE, CONNECT_LINE_TOKENS, HEAD_TERMINATOR, MAX_CONNECT_HEAD_BYTES, CONNECT_ESTABLISHED, REFUSAL_HEADER, REFUSAL, CONNECT_LIMITS, CA_VALIDITY_DAYS, LEAF_VALIDITY_DAYS, CA_SUBJECT_COMMON_NAME, MS_PER_DAY, TARGET_BASE, HOP_BY_HOP_HEADERS, REQUEST_STATUS, REFUSED_UPGRADE_RESPONSE, TAP_ALPN_PROTOCOLS, SELF_HOSTED_TUNNEL_REFUSAL;
|
|
6578
|
+
var import_node_crypto6, fs3, CONNECT_INTERCEPT_HOST, CONNECT_CONNECTOR_PROXY_HOST, CONNECT_INTERCEPT_HOSTS, ROUTED_PATH_PREFIX, HTTPS_PORT, HTTP_BAD_GATEWAY, CA_KEY_FILE_MODE, CONNECT_LINE_TOKENS, HEAD_TERMINATOR, MAX_CONNECT_HEAD_BYTES, CONNECT_ESTABLISHED, REFUSAL_HEADER, REFUSAL, CONNECT_LIMITS, CA_VALIDITY_DAYS, LEAF_VALIDITY_DAYS, CA_SUBJECT_COMMON_NAME, MS_PER_DAY, TARGET_BASE, HOP_BY_HOP_HEADERS, REQUEST_STATUS, REFUSED_UPGRADE_RESPONSE, TAP_ALPN_PROTOCOLS, SELF_HOSTED_TUNNEL_REFUSAL;
|
|
6574
6579
|
var init_connect = __esm({
|
|
6575
6580
|
"src/frontdoor/connect.ts"() {
|
|
6576
6581
|
"use strict";
|
|
@@ -6584,7 +6589,8 @@ var init_connect = __esm({
|
|
|
6584
6589
|
init_supervisor();
|
|
6585
6590
|
init_keepTicking();
|
|
6586
6591
|
CONNECT_INTERCEPT_HOST = "api.anthropic.com";
|
|
6587
|
-
|
|
6592
|
+
CONNECT_CONNECTOR_PROXY_HOST = "mcp-proxy.anthropic.com";
|
|
6593
|
+
CONNECT_INTERCEPT_HOSTS = [CONNECT_INTERCEPT_HOST, "platform.claude.com", CONNECT_CONNECTOR_PROXY_HOST];
|
|
6588
6594
|
ROUTED_PATH_PREFIX = "/v1/";
|
|
6589
6595
|
HTTPS_PORT = 443;
|
|
6590
6596
|
HTTP_BAD_GATEWAY = 502;
|
|
@@ -14782,6 +14788,48 @@ var init_launchRecords = __esm({
|
|
|
14782
14788
|
}
|
|
14783
14789
|
});
|
|
14784
14790
|
|
|
14791
|
+
// src/connectorGrants.ts
|
|
14792
|
+
var init_connectorGrants = __esm({
|
|
14793
|
+
"src/connectorGrants.ts"() {
|
|
14794
|
+
"use strict";
|
|
14795
|
+
}
|
|
14796
|
+
});
|
|
14797
|
+
|
|
14798
|
+
// src/lenderLogin.ts
|
|
14799
|
+
var init_lenderLogin = __esm({
|
|
14800
|
+
"src/lenderLogin.ts"() {
|
|
14801
|
+
"use strict";
|
|
14802
|
+
init_keychainLogin();
|
|
14803
|
+
init_signIn();
|
|
14804
|
+
}
|
|
14805
|
+
});
|
|
14806
|
+
|
|
14807
|
+
// src/connectorProxyAuth.ts
|
|
14808
|
+
var init_connectorProxyAuth = __esm({
|
|
14809
|
+
"src/connectorProxyAuth.ts"() {
|
|
14810
|
+
"use strict";
|
|
14811
|
+
init_connect();
|
|
14812
|
+
init_connectorGrants();
|
|
14813
|
+
init_lenderLogin();
|
|
14814
|
+
}
|
|
14815
|
+
});
|
|
14816
|
+
|
|
14817
|
+
// src/connectorListMerge.ts
|
|
14818
|
+
var init_connectorListMerge = __esm({
|
|
14819
|
+
"src/connectorListMerge.ts"() {
|
|
14820
|
+
"use strict";
|
|
14821
|
+
init_http();
|
|
14822
|
+
init_connectorGrants();
|
|
14823
|
+
}
|
|
14824
|
+
});
|
|
14825
|
+
|
|
14826
|
+
// src/usage/quotaHttp.ts
|
|
14827
|
+
var init_quotaHttp = __esm({
|
|
14828
|
+
"src/usage/quotaHttp.ts"() {
|
|
14829
|
+
"use strict";
|
|
14830
|
+
}
|
|
14831
|
+
});
|
|
14832
|
+
|
|
14785
14833
|
// src/identityStore.ts
|
|
14786
14834
|
function displacedIdentity(paths, verb, name, id) {
|
|
14787
14835
|
return new DisplacedIdentityError(verb, name, id, import_node_fs9.default.existsSync(identityDirectory(paths, id)));
|
|
@@ -15223,6 +15271,10 @@ var init_identityStore = __esm({
|
|
|
15223
15271
|
init_identityRecords();
|
|
15224
15272
|
init_launchRecords();
|
|
15225
15273
|
init_identityGrants();
|
|
15274
|
+
init_connectorProxyAuth();
|
|
15275
|
+
init_connectorListMerge();
|
|
15276
|
+
init_lenderLogin();
|
|
15277
|
+
init_quotaHttp();
|
|
15226
15278
|
IdentityNotFoundError = class extends CliError {
|
|
15227
15279
|
constructor(name, remedy2 = `Run \`agent-shim identity add ${name}\` first.`) {
|
|
15228
15280
|
super(`No identity named "${name}". ${remedy2}`);
|
|
@@ -15283,7 +15335,7 @@ var init_package = __esm({
|
|
|
15283
15335
|
"package.json"() {
|
|
15284
15336
|
package_default = {
|
|
15285
15337
|
name: "agent-shim",
|
|
15286
|
-
version: "14.
|
|
15338
|
+
version: "14.16.0",
|
|
15287
15339
|
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.",
|
|
15288
15340
|
license: "MIT",
|
|
15289
15341
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
package/dist/index.mjs
CHANGED
|
@@ -6154,7 +6154,7 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
|
|
|
6154
6154
|
`;
|
|
6155
6155
|
pumpTapSession(socket, async (clientAlpn) => await effects.connectTlsUpstream(host, HTTPS_PORT, clientAlpn), config.capture?.tapStream?.(host), Buffer.from(headText, "utf8"));
|
|
6156
6156
|
};
|
|
6157
|
-
const sessionsFor = (ownedSet) => config.interceptHosts.map((host) => {
|
|
6157
|
+
const sessionsFor = (ownedSet) => (ownedSet ? config.interceptHosts.filter((host) => host !== CONNECT_CONNECTOR_PROXY_HOST) : config.interceptHosts).map((host) => {
|
|
6158
6158
|
if (config.tapHosts.includes(host) && !ownedSet) {
|
|
6159
6159
|
const serveSecure2 = (secure) => {
|
|
6160
6160
|
pumpTapSession(secure, async (clientAlpn) => await effects.connectTlsUpstream(host, HTTPS_PORT, clientAlpn), config.capture?.tapStream?.(host));
|
|
@@ -6197,6 +6197,11 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
|
|
|
6197
6197
|
answerAndClose(response, REQUEST_STATUS.notFound);
|
|
6198
6198
|
return;
|
|
6199
6199
|
}
|
|
6200
|
+
const rewritten = config.rewriteForwardedAuthorization?.(host, request4, tunnelTokens.get(request4.socket));
|
|
6201
|
+
if (rewritten !== void 0) {
|
|
6202
|
+
request4.headers.authorization = rewritten.authorization;
|
|
6203
|
+
request4.url = rewritten.url;
|
|
6204
|
+
}
|
|
6200
6205
|
effects.forwardHttp(config.upstreamFor(host), request4, response, config.capture?.observePassthrough(request4));
|
|
6201
6206
|
};
|
|
6202
6207
|
const handler = (request4, response) => {
|
|
@@ -6546,7 +6551,7 @@ function realConnectCertStore(paths) {
|
|
|
6546
6551
|
}
|
|
6547
6552
|
};
|
|
6548
6553
|
}
|
|
6549
|
-
var CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, ROUTED_PATH_PREFIX, HTTPS_PORT, HTTP_BAD_GATEWAY, CA_KEY_FILE_MODE, CONNECT_LINE_TOKENS, HEAD_TERMINATOR, MAX_CONNECT_HEAD_BYTES, CONNECT_ESTABLISHED, REFUSAL_HEADER, REFUSAL, CONNECT_LIMITS, CA_VALIDITY_DAYS, LEAF_VALIDITY_DAYS, CA_SUBJECT_COMMON_NAME, MS_PER_DAY, TARGET_BASE, HOP_BY_HOP_HEADERS, REQUEST_STATUS, REFUSED_UPGRADE_RESPONSE, TAP_ALPN_PROTOCOLS, SELF_HOSTED_TUNNEL_REFUSAL;
|
|
6554
|
+
var CONNECT_INTERCEPT_HOST, CONNECT_CONNECTOR_PROXY_HOST, CONNECT_INTERCEPT_HOSTS, ROUTED_PATH_PREFIX, HTTPS_PORT, HTTP_BAD_GATEWAY, CA_KEY_FILE_MODE, CONNECT_LINE_TOKENS, HEAD_TERMINATOR, MAX_CONNECT_HEAD_BYTES, CONNECT_ESTABLISHED, REFUSAL_HEADER, REFUSAL, CONNECT_LIMITS, CA_VALIDITY_DAYS, LEAF_VALIDITY_DAYS, CA_SUBJECT_COMMON_NAME, MS_PER_DAY, TARGET_BASE, HOP_BY_HOP_HEADERS, REQUEST_STATUS, REFUSED_UPGRADE_RESPONSE, TAP_ALPN_PROTOCOLS, SELF_HOSTED_TUNNEL_REFUSAL;
|
|
6550
6555
|
var init_connect = __esm({
|
|
6551
6556
|
"src/frontdoor/connect.ts"() {
|
|
6552
6557
|
"use strict";
|
|
@@ -6558,7 +6563,8 @@ var init_connect = __esm({
|
|
|
6558
6563
|
init_supervisor();
|
|
6559
6564
|
init_keepTicking();
|
|
6560
6565
|
CONNECT_INTERCEPT_HOST = "api.anthropic.com";
|
|
6561
|
-
|
|
6566
|
+
CONNECT_CONNECTOR_PROXY_HOST = "mcp-proxy.anthropic.com";
|
|
6567
|
+
CONNECT_INTERCEPT_HOSTS = [CONNECT_INTERCEPT_HOST, "platform.claude.com", CONNECT_CONNECTOR_PROXY_HOST];
|
|
6562
6568
|
ROUTED_PATH_PREFIX = "/v1/";
|
|
6563
6569
|
HTTPS_PORT = 443;
|
|
6564
6570
|
HTTP_BAD_GATEWAY = 502;
|
|
@@ -14753,6 +14759,48 @@ var init_launchRecords = __esm({
|
|
|
14753
14759
|
}
|
|
14754
14760
|
});
|
|
14755
14761
|
|
|
14762
|
+
// src/connectorGrants.ts
|
|
14763
|
+
var init_connectorGrants = __esm({
|
|
14764
|
+
"src/connectorGrants.ts"() {
|
|
14765
|
+
"use strict";
|
|
14766
|
+
}
|
|
14767
|
+
});
|
|
14768
|
+
|
|
14769
|
+
// src/lenderLogin.ts
|
|
14770
|
+
var init_lenderLogin = __esm({
|
|
14771
|
+
"src/lenderLogin.ts"() {
|
|
14772
|
+
"use strict";
|
|
14773
|
+
init_keychainLogin();
|
|
14774
|
+
init_signIn();
|
|
14775
|
+
}
|
|
14776
|
+
});
|
|
14777
|
+
|
|
14778
|
+
// src/connectorProxyAuth.ts
|
|
14779
|
+
var init_connectorProxyAuth = __esm({
|
|
14780
|
+
"src/connectorProxyAuth.ts"() {
|
|
14781
|
+
"use strict";
|
|
14782
|
+
init_connect();
|
|
14783
|
+
init_connectorGrants();
|
|
14784
|
+
init_lenderLogin();
|
|
14785
|
+
}
|
|
14786
|
+
});
|
|
14787
|
+
|
|
14788
|
+
// src/connectorListMerge.ts
|
|
14789
|
+
var init_connectorListMerge = __esm({
|
|
14790
|
+
"src/connectorListMerge.ts"() {
|
|
14791
|
+
"use strict";
|
|
14792
|
+
init_http();
|
|
14793
|
+
init_connectorGrants();
|
|
14794
|
+
}
|
|
14795
|
+
});
|
|
14796
|
+
|
|
14797
|
+
// src/usage/quotaHttp.ts
|
|
14798
|
+
var init_quotaHttp = __esm({
|
|
14799
|
+
"src/usage/quotaHttp.ts"() {
|
|
14800
|
+
"use strict";
|
|
14801
|
+
}
|
|
14802
|
+
});
|
|
14803
|
+
|
|
14756
14804
|
// src/identityStore.ts
|
|
14757
14805
|
import fs9 from "node:fs";
|
|
14758
14806
|
import path31 from "node:path";
|
|
@@ -15194,6 +15242,10 @@ var init_identityStore = __esm({
|
|
|
15194
15242
|
init_identityRecords();
|
|
15195
15243
|
init_launchRecords();
|
|
15196
15244
|
init_identityGrants();
|
|
15245
|
+
init_connectorProxyAuth();
|
|
15246
|
+
init_connectorListMerge();
|
|
15247
|
+
init_lenderLogin();
|
|
15248
|
+
init_quotaHttp();
|
|
15197
15249
|
IdentityNotFoundError = class extends CliError {
|
|
15198
15250
|
constructor(name, remedy2 = `Run \`agent-shim identity add ${name}\` first.`) {
|
|
15199
15251
|
super(`No identity named "${name}". ${remedy2}`);
|
|
@@ -15254,7 +15306,7 @@ var init_package = __esm({
|
|
|
15254
15306
|
"package.json"() {
|
|
15255
15307
|
package_default = {
|
|
15256
15308
|
name: "agent-shim",
|
|
15257
|
-
version: "14.
|
|
15309
|
+
version: "14.16.0",
|
|
15258
15310
|
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.",
|
|
15259
15311
|
license: "MIT",
|
|
15260
15312
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6514,9 +6514,6 @@ interface Predecessor {
|
|
|
6514
6514
|
*/
|
|
6515
6515
|
/** The API host: Claude Code's own upstream, the one host whose `/v1/` paths the routed pipeline serves. */
|
|
6516
6516
|
declare const CONNECT_INTERCEPT_HOST = "api.anthropic.com";
|
|
6517
|
-
/**
|
|
6518
|
-
* Every CONNECT host whose TLS this surface terminates, each with its own leaf and its own HTTP parser: the API host above, and `platform.claude.com`, the claude.ai control plane where Remote Control's long-lived channel and its handshake live. Terminating the second one is what makes a Remote Control login rejection observable at all: its bytes cross this surface either way, and blind-tunnelling them hides exactly the exchange that failed. Only the API host's `/v1/` paths ever reach the routed pipeline; everything else on either session is piped to that session's own real upstream, so the pipeline's identification and authorisation are never asked to serve another host's traffic.
|
|
6519
|
-
*/
|
|
6520
6517
|
declare const CONNECT_INTERCEPT_HOSTS: readonly string[];
|
|
6521
6518
|
/** Paths under this prefix are what the routed pipeline serves; everything else on the terminated session goes to the real upstream. */
|
|
6522
6519
|
declare const ROUTED_PATH_PREFIX = "/v1/";
|
|
@@ -6673,6 +6670,13 @@ interface ConnectServerConfig {
|
|
|
6673
6670
|
readonly leafFor: (host: string) => LeafCert;
|
|
6674
6671
|
/** Where non-routed paths on one host's terminated session are piped: that host's own real upstream over TLS. */
|
|
6675
6672
|
readonly upstreamFor: (host: string) => ConnectForwardTarget;
|
|
6673
|
+
/**
|
|
6674
|
+
* Rewrites a non-routed request's `authorization` header and, since the lender's own connector carries a different id than the one this swap decodes it from, its URL, before it is piped to `host`'s real upstream: the one host (`CONNECT_CONNECTOR_PROXY_HOST`) and reason this surface edits a request at all, a connector call whose id names a lender the session's identity currently holds a `connectors` grant from. Undefined, or no call at all, leaves the request exactly as the client sent it; `tunnelToken` is the CONNECT capability this session presented (absent on the transparent surface, which resolves no identity).
|
|
6675
|
+
*/
|
|
6676
|
+
readonly rewriteForwardedAuthorization?: (host: string, request: IncomingMessage, tunnelToken: string | undefined) => {
|
|
6677
|
+
readonly authorization: string;
|
|
6678
|
+
readonly url: string;
|
|
6679
|
+
} | undefined;
|
|
6676
6680
|
/** Whether a capability presented as a CONNECT request's proxy credential belongs to a live launch: the same constant-time check against the same registry the routed pipeline's admission makes, read fresh on every call because launches come and go. */
|
|
6677
6681
|
readonly isLiveCapability: (token: string) => boolean;
|
|
6678
6682
|
/**
|
|
@@ -28142,6 +28146,7 @@ type IdentityListing = IdentityListEntry | UnreadableIdentityListEntry;
|
|
|
28142
28146
|
*
|
|
28143
28147
|
* One identity whose `identity.json` cannot be read is reported as its own `UnreadableIdentityListEntry` rather than aborting the whole listing. A single bad file blocking `identity list` outright is exactly the failure mode that hides every *other* identity from view at the moment the user most needs to see them — and the file need not even be corrupt to land here, since a name written by a newer agent-shim whose naming rule has since widened is rejected outright by an older binary's own copy of `IdentitySchema`.
|
|
28144
28148
|
*/
|
|
28149
|
+
/** Every identity's grants, with none of the rest of its `identity.json`: a listing's `grants` field alongside the name and id a grant is read or checked by, skipping any identity whose own file could not be read. What the door's connector-proxy bearer swap (`connectorProxyAuth.ts`) reads fresh on every borrowed request, since a grant can change mid-session. */
|
|
28145
28150
|
declare function listIdentities(paths: LayoutPaths): readonly IdentityListing[];
|
|
28146
28151
|
/**
|
|
28147
28152
|
* Sets `identity`'s `defaultConfigProfile` field, or clears it when `profileName` is undefined. Throws `IdentityNotFoundError` when the identity does not exist. Whether the profile exists is the caller's concern: `identity set --default-profile` checks it first.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-shim",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.16.0",
|
|
4
4
|
"description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Joseph Mearman <joseph@mearman.co.uk>",
|