agent-shim 8.44.0 → 9.1.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 +54 -10
- package/dist/index.cjs +55 -9
- package/dist/index.mjs +54 -9
- package/dist/types/index.d.ts +15 -6
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -27054,6 +27054,32 @@ function writeHeadroomState(fs21, stateFile, state) {
|
|
|
27054
27054
|
fs21.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
|
|
27055
27055
|
`);
|
|
27056
27056
|
}
|
|
27057
|
+
function resolveServingHeadroomState(fs21, files, isRunning) {
|
|
27058
|
+
const current = readHeadroomState(fs21, files.stateFile);
|
|
27059
|
+
if (current !== void 0) {
|
|
27060
|
+
return { path: files.stateFile, state: current };
|
|
27061
|
+
}
|
|
27062
|
+
const legacy = readHeadroomState(fs21, files.legacyStateFile);
|
|
27063
|
+
if (legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid)) {
|
|
27064
|
+
return { path: files.legacyStateFile, state: legacy };
|
|
27065
|
+
}
|
|
27066
|
+
return void 0;
|
|
27067
|
+
}
|
|
27068
|
+
function migrateHeadroomState(fs21, files, isRunning) {
|
|
27069
|
+
const legacy = readHeadroomState(fs21, files.legacyStateFile);
|
|
27070
|
+
const legacyLive = legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid);
|
|
27071
|
+
const current = readHeadroomState(fs21, files.stateFile);
|
|
27072
|
+
if (current !== void 0 || legacyLive) {
|
|
27073
|
+
if (!legacyLive && fs21.readFileUtf8(files.legacyStateFile) !== void 0) {
|
|
27074
|
+
fs21.removeRecursive(files.legacyStateFile);
|
|
27075
|
+
}
|
|
27076
|
+
return;
|
|
27077
|
+
}
|
|
27078
|
+
if (legacy !== void 0) {
|
|
27079
|
+
writeHeadroomState(fs21, files.stateFile, legacy);
|
|
27080
|
+
}
|
|
27081
|
+
fs21.removeRecursive(files.legacyStateFile);
|
|
27082
|
+
}
|
|
27057
27083
|
function headroomAllowlist(providers) {
|
|
27058
27084
|
const urls = /* @__PURE__ */ new Set([HEADROOM_ANTHROPIC_UPSTREAM]);
|
|
27059
27085
|
for (const provider of providers) {
|
|
@@ -27133,7 +27159,7 @@ function readStartLock(fs21, lockFile) {
|
|
|
27133
27159
|
return void 0;
|
|
27134
27160
|
}
|
|
27135
27161
|
}
|
|
27136
|
-
var import_node_crypto2, import_node_path5, HEADROOM_ANTHROPIC_UPSTREAM,
|
|
27162
|
+
var import_node_crypto2, import_node_path5, HEADROOM_ANTHROPIC_UPSTREAM, HeadroomStateSchema, HeadroomSessionSchema, HeadroomLockSchema;
|
|
27137
27163
|
var init_state = __esm({
|
|
27138
27164
|
"src/headroom/state.ts"() {
|
|
27139
27165
|
"use strict";
|
|
@@ -27142,7 +27168,6 @@ var init_state = __esm({
|
|
|
27142
27168
|
init_zod();
|
|
27143
27169
|
init_schema();
|
|
27144
27170
|
HEADROOM_ANTHROPIC_UPSTREAM = "https://api.anthropic.com";
|
|
27145
|
-
HEADROOM_STATE_SCHEMA_VERSION = 2;
|
|
27146
27171
|
HeadroomStateSchema = external_exports.strictObject({
|
|
27147
27172
|
/** The supervisor process owning the daemon. Alive means someone is keeping headroom running. */
|
|
27148
27173
|
supervisorPid: external_exports.number().int().positive().optional(),
|
|
@@ -27174,8 +27199,9 @@ function ensureHeadroom(params) {
|
|
|
27174
27199
|
const deadline = ports.now() + HEADROOM_START_TIMEOUT_MS;
|
|
27175
27200
|
let spawnedSupervisor = false;
|
|
27176
27201
|
let awaitingAllowlist = false;
|
|
27202
|
+
migrateHeadroomState(ports.fs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning);
|
|
27177
27203
|
for (; ; ) {
|
|
27178
|
-
const state =
|
|
27204
|
+
const state = resolveServingHeadroomState(ports.fs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning)?.state;
|
|
27179
27205
|
if (state?.supervisorPid !== void 0 && ports.isRunning(state.supervisorPid)) {
|
|
27180
27206
|
const daemonUp = state.socketPath !== void 0 && state.headroomPid !== void 0 && ports.isRunning(state.headroomPid);
|
|
27181
27207
|
if (daemonUp && state.socketPath !== void 0) {
|
|
@@ -27600,7 +27626,8 @@ function compareVersions2(a10, b) {
|
|
|
27600
27626
|
async function runSupervisor(initialConfig, ports, options = {}) {
|
|
27601
27627
|
const { fs: fs21, paths } = ports;
|
|
27602
27628
|
let config2 = initialConfig;
|
|
27603
|
-
|
|
27629
|
+
migrateHeadroomState(fs21, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning);
|
|
27630
|
+
const previousState = resolveServingHeadroomState(fs21, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning)?.state;
|
|
27604
27631
|
if (previousState?.supervisorPid !== void 0 && previousState.supervisorPid !== ports.ownPid && ports.isRunning(previousState.supervisorPid)) {
|
|
27605
27632
|
ports.log(`agent-shim headroom supervisor ${String(ports.ownPid)}: supervisor ${String(previousState.supervisorPid)} already owns the daemon; exiting`);
|
|
27606
27633
|
return 0;
|
|
@@ -32463,7 +32490,8 @@ function buildLayoutPaths(root) {
|
|
|
32463
32490
|
categoriesLocalFile: import_node_path19.default.join(root, "categories.local.json"),
|
|
32464
32491
|
claudeShimFile: import_node_path19.default.join(root, "claude-shim.json"),
|
|
32465
32492
|
headroomDir: import_node_path19.default.join(root, "headroom"),
|
|
32466
|
-
headroomStateFile: import_node_path19.default.join(root, "headroom",
|
|
32493
|
+
headroomStateFile: import_node_path19.default.join(root, "headroom", "state.json"),
|
|
32494
|
+
headroomLegacyStateFile: import_node_path19.default.join(root, "headroom", "state.v2.json"),
|
|
32467
32495
|
headroomSocketDir: import_node_path19.default.join(root, "headroom", "run"),
|
|
32468
32496
|
headroomLockFile: import_node_path19.default.join(root, "headroom", "start.lock"),
|
|
32469
32497
|
headroomSessionsDir: import_node_path19.default.join(root, "headroom", "sessions"),
|
|
@@ -32497,7 +32525,6 @@ var init_paths = __esm({
|
|
|
32497
32525
|
import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
32498
32526
|
import_node_os3 = __toESM(require("node:os"), 1);
|
|
32499
32527
|
import_node_path19 = __toESM(require("node:path"), 1);
|
|
32500
|
-
init_state();
|
|
32501
32528
|
init_legacy();
|
|
32502
32529
|
}
|
|
32503
32530
|
});
|
|
@@ -32852,7 +32879,7 @@ var init_package = __esm({
|
|
|
32852
32879
|
"package.json"() {
|
|
32853
32880
|
package_default = {
|
|
32854
32881
|
name: "agent-shim",
|
|
32855
|
-
version: "
|
|
32882
|
+
version: "9.1.0",
|
|
32856
32883
|
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.",
|
|
32857
32884
|
license: "MIT",
|
|
32858
32885
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -106897,6 +106924,16 @@ function validateJson(schema, input2) {
|
|
|
106897
106924
|
}
|
|
106898
106925
|
return { ok: true, data: result.data };
|
|
106899
106926
|
}
|
|
106927
|
+
function tcpPortEraRecord(raw) {
|
|
106928
|
+
let parsed;
|
|
106929
|
+
try {
|
|
106930
|
+
parsed = JSON.parse(raw);
|
|
106931
|
+
} catch {
|
|
106932
|
+
return false;
|
|
106933
|
+
}
|
|
106934
|
+
const has = (key) => typeof parsed === "object" && parsed !== null && key in parsed;
|
|
106935
|
+
return (has("port") || has("lastPort")) && !has("socketPath");
|
|
106936
|
+
}
|
|
106900
106937
|
function pushPathResolution(push, resolution) {
|
|
106901
106938
|
const ownDir = import_node_path38.default.dirname(resolution.ownExecutablePath);
|
|
106902
106939
|
switch (resolution.agentShim.status) {
|
|
@@ -107206,6 +107243,8 @@ function runDoctor(params) {
|
|
|
107206
107243
|
}
|
|
107207
107244
|
if (params.headroom.state.raw === void 0) {
|
|
107208
107245
|
push("headroom", "pass", "No headroom daemon has ever run; nothing to check.");
|
|
107246
|
+
} else if (tcpPortEraRecord(params.headroom.state.raw)) {
|
|
107247
|
+
push("headroom", "pass", `${params.headroom.state.path} holds a previous release's TCP-port state record; the next launch through headroom claims over it.`);
|
|
107209
107248
|
} else {
|
|
107210
107249
|
const validated2 = validateJson(HeadroomStateSchema, params.headroom.state);
|
|
107211
107250
|
if (!validated2.ok) {
|
|
@@ -107410,7 +107449,12 @@ function collectDoctorReport(params) {
|
|
|
107410
107449
|
run: realRunPort,
|
|
107411
107450
|
platform: process.platform,
|
|
107412
107451
|
headroom: {
|
|
107413
|
-
|
|
107452
|
+
// Read-only resolution like `headroom status`: the doctor reports whichever record a launch would join, migrating nothing.
|
|
107453
|
+
state: (() => {
|
|
107454
|
+
const resolved = resolveServingHeadroomState(realFarmFs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, realIsProcessRunning);
|
|
107455
|
+
const statePath = resolved?.path ?? paths.headroomStateFile;
|
|
107456
|
+
return { path: statePath, raw: realFarmFs.readFileUtf8(statePath) };
|
|
107457
|
+
})(),
|
|
107414
107458
|
isRunning: realIsProcessRunning
|
|
107415
107459
|
}
|
|
107416
107460
|
});
|
|
@@ -117325,7 +117369,7 @@ init_socket();
|
|
|
117325
117369
|
init_state();
|
|
117326
117370
|
init_state2();
|
|
117327
117371
|
function headroomSocketTarget(fsPort, trust, paths) {
|
|
117328
|
-
const socketPath = readHeadroomState(fsPort, paths.headroomStateFile)?.socketPath;
|
|
117372
|
+
const socketPath = readHeadroomState(fsPort, paths.headroomStateFile)?.socketPath ?? readHeadroomState(fsPort, paths.headroomLegacyStateFile)?.socketPath;
|
|
117329
117373
|
return socketPath === void 0 ? void 0 : verifyHeadroomSocket(socketPath, trust);
|
|
117330
117374
|
}
|
|
117331
117375
|
function collectFrontDoorStatus(fsPort, socketTrust, paths, isRunning) {
|
|
@@ -118118,7 +118162,7 @@ init_realPorts();
|
|
|
118118
118162
|
init_state();
|
|
118119
118163
|
init_supervisor();
|
|
118120
118164
|
function collectHeadroomStatus(fsPort, paths, isRunning) {
|
|
118121
|
-
const state =
|
|
118165
|
+
const state = resolveServingHeadroomState(fsPort, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, isRunning)?.state ?? {};
|
|
118122
118166
|
const allowlist = currentHeadroomAllowlist(fsPort, paths);
|
|
118123
118167
|
const settings2 = settingsOf(readGlobalConfig(paths)?.headroom ?? {});
|
|
118124
118168
|
return {
|
package/dist/index.cjs
CHANGED
|
@@ -2643,7 +2643,7 @@ var init_package = __esm({
|
|
|
2643
2643
|
"package.json"() {
|
|
2644
2644
|
package_default = {
|
|
2645
2645
|
name: "agent-shim",
|
|
2646
|
-
version: "
|
|
2646
|
+
version: "9.1.0",
|
|
2647
2647
|
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.",
|
|
2648
2648
|
license: "MIT",
|
|
2649
2649
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -2765,6 +2765,32 @@ function writeHeadroomState(fs12, stateFile, state) {
|
|
|
2765
2765
|
fs12.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
|
|
2766
2766
|
`);
|
|
2767
2767
|
}
|
|
2768
|
+
function resolveServingHeadroomState(fs12, files, isRunning) {
|
|
2769
|
+
const current = readHeadroomState(fs12, files.stateFile);
|
|
2770
|
+
if (current !== void 0) {
|
|
2771
|
+
return { path: files.stateFile, state: current };
|
|
2772
|
+
}
|
|
2773
|
+
const legacy = readHeadroomState(fs12, files.legacyStateFile);
|
|
2774
|
+
if (legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid)) {
|
|
2775
|
+
return { path: files.legacyStateFile, state: legacy };
|
|
2776
|
+
}
|
|
2777
|
+
return void 0;
|
|
2778
|
+
}
|
|
2779
|
+
function migrateHeadroomState(fs12, files, isRunning) {
|
|
2780
|
+
const legacy = readHeadroomState(fs12, files.legacyStateFile);
|
|
2781
|
+
const legacyLive = legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid);
|
|
2782
|
+
const current = readHeadroomState(fs12, files.stateFile);
|
|
2783
|
+
if (current !== void 0 || legacyLive) {
|
|
2784
|
+
if (!legacyLive && fs12.readFileUtf8(files.legacyStateFile) !== void 0) {
|
|
2785
|
+
fs12.removeRecursive(files.legacyStateFile);
|
|
2786
|
+
}
|
|
2787
|
+
return;
|
|
2788
|
+
}
|
|
2789
|
+
if (legacy !== void 0) {
|
|
2790
|
+
writeHeadroomState(fs12, files.stateFile, legacy);
|
|
2791
|
+
}
|
|
2792
|
+
fs12.removeRecursive(files.legacyStateFile);
|
|
2793
|
+
}
|
|
2768
2794
|
function headroomAllowlist(providers) {
|
|
2769
2795
|
const urls = /* @__PURE__ */ new Set([HEADROOM_ANTHROPIC_UPSTREAM]);
|
|
2770
2796
|
for (const provider of providers) {
|
|
@@ -2844,7 +2870,7 @@ function readStartLock(fs12, lockFile) {
|
|
|
2844
2870
|
return void 0;
|
|
2845
2871
|
}
|
|
2846
2872
|
}
|
|
2847
|
-
var import_node_crypto6, import_node_path11, import_zod5, HEADROOM_ANTHROPIC_UPSTREAM,
|
|
2873
|
+
var import_node_crypto6, import_node_path11, import_zod5, HEADROOM_ANTHROPIC_UPSTREAM, HeadroomStateSchema, HeadroomSessionSchema, HeadroomLockSchema;
|
|
2848
2874
|
var init_state2 = __esm({
|
|
2849
2875
|
"src/headroom/state.ts"() {
|
|
2850
2876
|
"use strict";
|
|
@@ -2853,7 +2879,6 @@ var init_state2 = __esm({
|
|
|
2853
2879
|
import_zod5 = require("zod");
|
|
2854
2880
|
init_schema();
|
|
2855
2881
|
HEADROOM_ANTHROPIC_UPSTREAM = "https://api.anthropic.com";
|
|
2856
|
-
HEADROOM_STATE_SCHEMA_VERSION = 2;
|
|
2857
2882
|
HeadroomStateSchema = import_zod5.z.strictObject({
|
|
2858
2883
|
/** The supervisor process owning the daemon. Alive means someone is keeping headroom running. */
|
|
2859
2884
|
supervisorPid: import_zod5.z.number().int().positive().optional(),
|
|
@@ -2885,8 +2910,9 @@ function ensureHeadroom(params) {
|
|
|
2885
2910
|
const deadline = ports.now() + HEADROOM_START_TIMEOUT_MS;
|
|
2886
2911
|
let spawnedSupervisor = false;
|
|
2887
2912
|
let awaitingAllowlist = false;
|
|
2913
|
+
migrateHeadroomState(ports.fs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning);
|
|
2888
2914
|
for (; ; ) {
|
|
2889
|
-
const state =
|
|
2915
|
+
const state = resolveServingHeadroomState(ports.fs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning)?.state;
|
|
2890
2916
|
if (state?.supervisorPid !== void 0 && ports.isRunning(state.supervisorPid)) {
|
|
2891
2917
|
const daemonUp = state.socketPath !== void 0 && state.headroomPid !== void 0 && ports.isRunning(state.headroomPid);
|
|
2892
2918
|
if (daemonUp && state.socketPath !== void 0) {
|
|
@@ -3156,7 +3182,8 @@ function compareVersions2(a, b) {
|
|
|
3156
3182
|
async function runSupervisor(initialConfig, ports, options = {}) {
|
|
3157
3183
|
const { fs: fs12, paths } = ports;
|
|
3158
3184
|
let config = initialConfig;
|
|
3159
|
-
|
|
3185
|
+
migrateHeadroomState(fs12, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning);
|
|
3186
|
+
const previousState = resolveServingHeadroomState(fs12, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning)?.state;
|
|
3160
3187
|
if (previousState?.supervisorPid !== void 0 && previousState.supervisorPid !== ports.ownPid && ports.isRunning(previousState.supervisorPid)) {
|
|
3161
3188
|
ports.log(`agent-shim headroom supervisor ${String(ports.ownPid)}: supervisor ${String(previousState.supervisorPid)} already owns the daemon; exiting`);
|
|
3162
3189
|
return 0;
|
|
@@ -5081,7 +5108,8 @@ function buildLayoutPaths(root) {
|
|
|
5081
5108
|
categoriesLocalFile: import_node_path22.default.join(root, "categories.local.json"),
|
|
5082
5109
|
claudeShimFile: import_node_path22.default.join(root, "claude-shim.json"),
|
|
5083
5110
|
headroomDir: import_node_path22.default.join(root, "headroom"),
|
|
5084
|
-
headroomStateFile: import_node_path22.default.join(root, "headroom",
|
|
5111
|
+
headroomStateFile: import_node_path22.default.join(root, "headroom", "state.json"),
|
|
5112
|
+
headroomLegacyStateFile: import_node_path22.default.join(root, "headroom", "state.v2.json"),
|
|
5085
5113
|
headroomSocketDir: import_node_path22.default.join(root, "headroom", "run"),
|
|
5086
5114
|
headroomLockFile: import_node_path22.default.join(root, "headroom", "start.lock"),
|
|
5087
5115
|
headroomSessionsDir: import_node_path22.default.join(root, "headroom", "sessions"),
|
|
@@ -5115,7 +5143,6 @@ var init_paths = __esm({
|
|
|
5115
5143
|
import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
5116
5144
|
import_node_os4 = __toESM(require("node:os"), 1);
|
|
5117
5145
|
import_node_path22 = __toESM(require("node:path"), 1);
|
|
5118
|
-
init_state2();
|
|
5119
5146
|
init_legacy();
|
|
5120
5147
|
}
|
|
5121
5148
|
});
|
|
@@ -7649,6 +7676,7 @@ __export(index_exports, {
|
|
|
7649
7676
|
OWN_CLI_FILE_NAME: () => OWN_CLI_FILE_NAME,
|
|
7650
7677
|
PROMPT_CACHE_TTL_MS: () => PROMPT_CACHE_TTL_MS,
|
|
7651
7678
|
PlanClassSchema: () => PlanClassSchema,
|
|
7679
|
+
PoolGraphError: () => PoolGraphError,
|
|
7652
7680
|
PoolNameSchema: () => PoolNameSchema,
|
|
7653
7681
|
PoolNotFoundError: () => PoolNotFoundError,
|
|
7654
7682
|
PoolPickReportSchema: () => PoolPickReportSchema,
|
|
@@ -12126,6 +12154,16 @@ function validateJson(schema, input) {
|
|
|
12126
12154
|
}
|
|
12127
12155
|
return { ok: true, data: result.data };
|
|
12128
12156
|
}
|
|
12157
|
+
function tcpPortEraRecord(raw) {
|
|
12158
|
+
let parsed;
|
|
12159
|
+
try {
|
|
12160
|
+
parsed = JSON.parse(raw);
|
|
12161
|
+
} catch {
|
|
12162
|
+
return false;
|
|
12163
|
+
}
|
|
12164
|
+
const has = (key) => typeof parsed === "object" && parsed !== null && key in parsed;
|
|
12165
|
+
return (has("port") || has("lastPort")) && !has("socketPath");
|
|
12166
|
+
}
|
|
12129
12167
|
function pushPathResolution(push, resolution) {
|
|
12130
12168
|
const ownDir = import_node_path28.default.dirname(resolution.ownExecutablePath);
|
|
12131
12169
|
switch (resolution.agentShim.status) {
|
|
@@ -12435,6 +12473,8 @@ function runDoctor(params) {
|
|
|
12435
12473
|
}
|
|
12436
12474
|
if (params.headroom.state.raw === void 0) {
|
|
12437
12475
|
push("headroom", "pass", "No headroom daemon has ever run; nothing to check.");
|
|
12476
|
+
} else if (tcpPortEraRecord(params.headroom.state.raw)) {
|
|
12477
|
+
push("headroom", "pass", `${params.headroom.state.path} holds a previous release's TCP-port state record; the next launch through headroom claims over it.`);
|
|
12438
12478
|
} else {
|
|
12439
12479
|
const validated2 = validateJson(HeadroomStateSchema, params.headroom.state);
|
|
12440
12480
|
if (!validated2.ok) {
|
|
@@ -12639,7 +12679,12 @@ function collectDoctorReport(params) {
|
|
|
12639
12679
|
run: realRunPort,
|
|
12640
12680
|
platform: process.platform,
|
|
12641
12681
|
headroom: {
|
|
12642
|
-
|
|
12682
|
+
// Read-only resolution like `headroom status`: the doctor reports whichever record a launch would join, migrating nothing.
|
|
12683
|
+
state: (() => {
|
|
12684
|
+
const resolved = resolveServingHeadroomState(realFarmFs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, realIsProcessRunning);
|
|
12685
|
+
const statePath = resolved?.path ?? paths.headroomStateFile;
|
|
12686
|
+
return { path: statePath, raw: realFarmFs.readFileUtf8(statePath) };
|
|
12687
|
+
})(),
|
|
12643
12688
|
isRunning: realIsProcessRunning
|
|
12644
12689
|
}
|
|
12645
12690
|
});
|
|
@@ -12906,7 +12951,7 @@ init_socket();
|
|
|
12906
12951
|
init_state2();
|
|
12907
12952
|
init_state();
|
|
12908
12953
|
function headroomSocketTarget(fsPort, trust, paths) {
|
|
12909
|
-
const socketPath = readHeadroomState(fsPort, paths.headroomStateFile)?.socketPath;
|
|
12954
|
+
const socketPath = readHeadroomState(fsPort, paths.headroomStateFile)?.socketPath ?? readHeadroomState(fsPort, paths.headroomLegacyStateFile)?.socketPath;
|
|
12910
12955
|
return socketPath === void 0 ? void 0 : verifyHeadroomSocket(socketPath, trust);
|
|
12911
12956
|
}
|
|
12912
12957
|
function collectFrontDoorStatus(fsPort, socketTrust, paths, isRunning) {
|
|
@@ -15170,6 +15215,7 @@ init_ownCli();
|
|
|
15170
15215
|
OWN_CLI_FILE_NAME,
|
|
15171
15216
|
PROMPT_CACHE_TTL_MS,
|
|
15172
15217
|
PlanClassSchema,
|
|
15218
|
+
PoolGraphError,
|
|
15173
15219
|
PoolNameSchema,
|
|
15174
15220
|
PoolNotFoundError,
|
|
15175
15221
|
PoolPickReportSchema,
|
package/dist/index.mjs
CHANGED
|
@@ -2619,7 +2619,7 @@ var init_package = __esm({
|
|
|
2619
2619
|
"package.json"() {
|
|
2620
2620
|
package_default = {
|
|
2621
2621
|
name: "agent-shim",
|
|
2622
|
-
version: "
|
|
2622
|
+
version: "9.1.0",
|
|
2623
2623
|
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.",
|
|
2624
2624
|
license: "MIT",
|
|
2625
2625
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -2744,6 +2744,32 @@ function writeHeadroomState(fs12, stateFile, state) {
|
|
|
2744
2744
|
fs12.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
|
|
2745
2745
|
`);
|
|
2746
2746
|
}
|
|
2747
|
+
function resolveServingHeadroomState(fs12, files, isRunning) {
|
|
2748
|
+
const current = readHeadroomState(fs12, files.stateFile);
|
|
2749
|
+
if (current !== void 0) {
|
|
2750
|
+
return { path: files.stateFile, state: current };
|
|
2751
|
+
}
|
|
2752
|
+
const legacy = readHeadroomState(fs12, files.legacyStateFile);
|
|
2753
|
+
if (legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid)) {
|
|
2754
|
+
return { path: files.legacyStateFile, state: legacy };
|
|
2755
|
+
}
|
|
2756
|
+
return void 0;
|
|
2757
|
+
}
|
|
2758
|
+
function migrateHeadroomState(fs12, files, isRunning) {
|
|
2759
|
+
const legacy = readHeadroomState(fs12, files.legacyStateFile);
|
|
2760
|
+
const legacyLive = legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid);
|
|
2761
|
+
const current = readHeadroomState(fs12, files.stateFile);
|
|
2762
|
+
if (current !== void 0 || legacyLive) {
|
|
2763
|
+
if (!legacyLive && fs12.readFileUtf8(files.legacyStateFile) !== void 0) {
|
|
2764
|
+
fs12.removeRecursive(files.legacyStateFile);
|
|
2765
|
+
}
|
|
2766
|
+
return;
|
|
2767
|
+
}
|
|
2768
|
+
if (legacy !== void 0) {
|
|
2769
|
+
writeHeadroomState(fs12, files.stateFile, legacy);
|
|
2770
|
+
}
|
|
2771
|
+
fs12.removeRecursive(files.legacyStateFile);
|
|
2772
|
+
}
|
|
2747
2773
|
function headroomAllowlist(providers) {
|
|
2748
2774
|
const urls = /* @__PURE__ */ new Set([HEADROOM_ANTHROPIC_UPSTREAM]);
|
|
2749
2775
|
for (const provider of providers) {
|
|
@@ -2823,13 +2849,12 @@ function readStartLock(fs12, lockFile) {
|
|
|
2823
2849
|
return void 0;
|
|
2824
2850
|
}
|
|
2825
2851
|
}
|
|
2826
|
-
var HEADROOM_ANTHROPIC_UPSTREAM,
|
|
2852
|
+
var HEADROOM_ANTHROPIC_UPSTREAM, HeadroomStateSchema, HeadroomSessionSchema, HeadroomLockSchema;
|
|
2827
2853
|
var init_state2 = __esm({
|
|
2828
2854
|
"src/headroom/state.ts"() {
|
|
2829
2855
|
"use strict";
|
|
2830
2856
|
init_schema();
|
|
2831
2857
|
HEADROOM_ANTHROPIC_UPSTREAM = "https://api.anthropic.com";
|
|
2832
|
-
HEADROOM_STATE_SCHEMA_VERSION = 2;
|
|
2833
2858
|
HeadroomStateSchema = z5.strictObject({
|
|
2834
2859
|
/** The supervisor process owning the daemon. Alive means someone is keeping headroom running. */
|
|
2835
2860
|
supervisorPid: z5.number().int().positive().optional(),
|
|
@@ -2861,8 +2886,9 @@ function ensureHeadroom(params) {
|
|
|
2861
2886
|
const deadline = ports.now() + HEADROOM_START_TIMEOUT_MS;
|
|
2862
2887
|
let spawnedSupervisor = false;
|
|
2863
2888
|
let awaitingAllowlist = false;
|
|
2889
|
+
migrateHeadroomState(ports.fs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning);
|
|
2864
2890
|
for (; ; ) {
|
|
2865
|
-
const state =
|
|
2891
|
+
const state = resolveServingHeadroomState(ports.fs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning)?.state;
|
|
2866
2892
|
if (state?.supervisorPid !== void 0 && ports.isRunning(state.supervisorPid)) {
|
|
2867
2893
|
const daemonUp = state.socketPath !== void 0 && state.headroomPid !== void 0 && ports.isRunning(state.headroomPid);
|
|
2868
2894
|
if (daemonUp && state.socketPath !== void 0) {
|
|
@@ -3131,7 +3157,8 @@ function compareVersions2(a, b) {
|
|
|
3131
3157
|
async function runSupervisor(initialConfig, ports, options = {}) {
|
|
3132
3158
|
const { fs: fs12, paths } = ports;
|
|
3133
3159
|
let config = initialConfig;
|
|
3134
|
-
|
|
3160
|
+
migrateHeadroomState(fs12, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning);
|
|
3161
|
+
const previousState = resolveServingHeadroomState(fs12, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning)?.state;
|
|
3135
3162
|
if (previousState?.supervisorPid !== void 0 && previousState.supervisorPid !== ports.ownPid && ports.isRunning(previousState.supervisorPid)) {
|
|
3136
3163
|
ports.log(`agent-shim headroom supervisor ${String(ports.ownPid)}: supervisor ${String(previousState.supervisorPid)} already owns the daemon; exiting`);
|
|
3137
3164
|
return 0;
|
|
@@ -5058,7 +5085,8 @@ function buildLayoutPaths(root) {
|
|
|
5058
5085
|
categoriesLocalFile: path22.join(root, "categories.local.json"),
|
|
5059
5086
|
claudeShimFile: path22.join(root, "claude-shim.json"),
|
|
5060
5087
|
headroomDir: path22.join(root, "headroom"),
|
|
5061
|
-
headroomStateFile: path22.join(root, "headroom",
|
|
5088
|
+
headroomStateFile: path22.join(root, "headroom", "state.json"),
|
|
5089
|
+
headroomLegacyStateFile: path22.join(root, "headroom", "state.v2.json"),
|
|
5062
5090
|
headroomSocketDir: path22.join(root, "headroom", "run"),
|
|
5063
5091
|
headroomLockFile: path22.join(root, "headroom", "start.lock"),
|
|
5064
5092
|
headroomSessionsDir: path22.join(root, "headroom", "sessions"),
|
|
@@ -5088,7 +5116,6 @@ function resolveLayoutPaths() {
|
|
|
5088
5116
|
var init_paths = __esm({
|
|
5089
5117
|
"src/paths.ts"() {
|
|
5090
5118
|
"use strict";
|
|
5091
|
-
init_state2();
|
|
5092
5119
|
init_legacy();
|
|
5093
5120
|
}
|
|
5094
5121
|
});
|
|
@@ -11802,6 +11829,16 @@ function validateJson(schema, input) {
|
|
|
11802
11829
|
}
|
|
11803
11830
|
return { ok: true, data: result.data };
|
|
11804
11831
|
}
|
|
11832
|
+
function tcpPortEraRecord(raw) {
|
|
11833
|
+
let parsed;
|
|
11834
|
+
try {
|
|
11835
|
+
parsed = JSON.parse(raw);
|
|
11836
|
+
} catch {
|
|
11837
|
+
return false;
|
|
11838
|
+
}
|
|
11839
|
+
const has = (key) => typeof parsed === "object" && parsed !== null && key in parsed;
|
|
11840
|
+
return (has("port") || has("lastPort")) && !has("socketPath");
|
|
11841
|
+
}
|
|
11805
11842
|
function pushPathResolution(push, resolution) {
|
|
11806
11843
|
const ownDir = path28.dirname(resolution.ownExecutablePath);
|
|
11807
11844
|
switch (resolution.agentShim.status) {
|
|
@@ -12111,6 +12148,8 @@ function runDoctor(params) {
|
|
|
12111
12148
|
}
|
|
12112
12149
|
if (params.headroom.state.raw === void 0) {
|
|
12113
12150
|
push("headroom", "pass", "No headroom daemon has ever run; nothing to check.");
|
|
12151
|
+
} else if (tcpPortEraRecord(params.headroom.state.raw)) {
|
|
12152
|
+
push("headroom", "pass", `${params.headroom.state.path} holds a previous release's TCP-port state record; the next launch through headroom claims over it.`);
|
|
12114
12153
|
} else {
|
|
12115
12154
|
const validated2 = validateJson(HeadroomStateSchema, params.headroom.state);
|
|
12116
12155
|
if (!validated2.ok) {
|
|
@@ -12315,7 +12354,12 @@ function collectDoctorReport(params) {
|
|
|
12315
12354
|
run: realRunPort,
|
|
12316
12355
|
platform: process.platform,
|
|
12317
12356
|
headroom: {
|
|
12318
|
-
|
|
12357
|
+
// Read-only resolution like `headroom status`: the doctor reports whichever record a launch would join, migrating nothing.
|
|
12358
|
+
state: (() => {
|
|
12359
|
+
const resolved = resolveServingHeadroomState(realFarmFs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, realIsProcessRunning);
|
|
12360
|
+
const statePath = resolved?.path ?? paths.headroomStateFile;
|
|
12361
|
+
return { path: statePath, raw: realFarmFs.readFileUtf8(statePath) };
|
|
12362
|
+
})(),
|
|
12319
12363
|
isRunning: realIsProcessRunning
|
|
12320
12364
|
}
|
|
12321
12365
|
});
|
|
@@ -12582,7 +12626,7 @@ init_socket();
|
|
|
12582
12626
|
init_state2();
|
|
12583
12627
|
init_state();
|
|
12584
12628
|
function headroomSocketTarget(fsPort, trust, paths) {
|
|
12585
|
-
const socketPath = readHeadroomState(fsPort, paths.headroomStateFile)?.socketPath;
|
|
12629
|
+
const socketPath = readHeadroomState(fsPort, paths.headroomStateFile)?.socketPath ?? readHeadroomState(fsPort, paths.headroomLegacyStateFile)?.socketPath;
|
|
12586
12630
|
return socketPath === void 0 ? void 0 : verifyHeadroomSocket(socketPath, trust);
|
|
12587
12631
|
}
|
|
12588
12632
|
function collectFrontDoorStatus(fsPort, socketTrust, paths, isRunning) {
|
|
@@ -14845,6 +14889,7 @@ export {
|
|
|
14845
14889
|
OWN_CLI_FILE_NAME,
|
|
14846
14890
|
PROMPT_CACHE_TTL_MS,
|
|
14847
14891
|
PlanClassSchema,
|
|
14892
|
+
PoolGraphError,
|
|
14848
14893
|
PoolNameSchema,
|
|
14849
14894
|
PoolNotFoundError,
|
|
14850
14895
|
PoolPickReportSchema,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1659,8 +1659,10 @@ interface LayoutPaths {
|
|
|
1659
1659
|
readonly claudeShimFile: string;
|
|
1660
1660
|
/** Directory holding the headroom daemon's coordination state: the state file, the start lock, the session registry, and the socket directory. */
|
|
1661
1661
|
readonly headroomDir: string;
|
|
1662
|
-
/** Path to the headroom supervisor's state file: pids, socket path, version, allowlist hash, last error.
|
|
1662
|
+
/** Path to the headroom supervisor's state file: pids, socket path, version, allowlist hash, last error. One unversioned name every release shares, arbitrated by the ownership rules in `headroom/state.ts` rather than by a version in the file name. */
|
|
1663
1663
|
readonly headroomStateFile: string;
|
|
1664
|
+
/** The previous release's versioned name for the state file, read only while a supervisor from that release is still alive and removed once its generation has drained (see `migrateHeadroomState`). */
|
|
1665
|
+
readonly headroomLegacyStateFile: string;
|
|
1664
1666
|
/** Directory, mode 0700, holding the headroom daemon's unix socket: one `<supervisor-pid>.sock` per supervisor generation. Only its owner can enter it, which is what authenticates the door's hop to the daemon. */
|
|
1665
1667
|
readonly headroomSocketDir: string;
|
|
1666
1668
|
/** Path to the exclusive-create marker guarding "who spawns the supervisor" so concurrent launches start at most one. */
|
|
@@ -5473,12 +5475,12 @@ declare function createControlApiRouter(deps: ControlApiDeps): {
|
|
|
5473
5475
|
identity: "identity";
|
|
5474
5476
|
provider: "provider";
|
|
5475
5477
|
pool: "pool";
|
|
5478
|
+
keychain: "keychain";
|
|
5476
5479
|
"ambient-credential": "ambient-credential";
|
|
5477
5480
|
"binary-discovery": "binary-discovery";
|
|
5478
5481
|
"claude-shim": "claude-shim";
|
|
5479
5482
|
"path-resolution": "path-resolution";
|
|
5480
5483
|
"legacy-name": "legacy-name";
|
|
5481
|
-
keychain: "keychain";
|
|
5482
5484
|
"directory-rules": "directory-rules";
|
|
5483
5485
|
"categories-local": "categories-local";
|
|
5484
5486
|
"active-identity": "active-identity";
|
|
@@ -6054,12 +6056,12 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
|
|
|
6054
6056
|
identity: "identity";
|
|
6055
6057
|
provider: "provider";
|
|
6056
6058
|
pool: "pool";
|
|
6059
|
+
keychain: "keychain";
|
|
6057
6060
|
"ambient-credential": "ambient-credential";
|
|
6058
6061
|
"binary-discovery": "binary-discovery";
|
|
6059
6062
|
"claude-shim": "claude-shim";
|
|
6060
6063
|
"path-resolution": "path-resolution";
|
|
6061
6064
|
"legacy-name": "legacy-name";
|
|
6062
|
-
keychain: "keychain";
|
|
6063
6065
|
"directory-rules": "directory-rules";
|
|
6064
6066
|
"categories-local": "categories-local";
|
|
6065
6067
|
"active-identity": "active-identity";
|
|
@@ -6571,12 +6573,12 @@ declare const DoctorFindingSchema: z.ZodObject<{
|
|
|
6571
6573
|
identity: "identity";
|
|
6572
6574
|
provider: "provider";
|
|
6573
6575
|
pool: "pool";
|
|
6576
|
+
keychain: "keychain";
|
|
6574
6577
|
"ambient-credential": "ambient-credential";
|
|
6575
6578
|
"binary-discovery": "binary-discovery";
|
|
6576
6579
|
"claude-shim": "claude-shim";
|
|
6577
6580
|
"path-resolution": "path-resolution";
|
|
6578
6581
|
"legacy-name": "legacy-name";
|
|
6579
|
-
keychain: "keychain";
|
|
6580
6582
|
"directory-rules": "directory-rules";
|
|
6581
6583
|
"categories-local": "categories-local";
|
|
6582
6584
|
"active-identity": "active-identity";
|
|
@@ -6600,12 +6602,12 @@ declare const DoctorRunOutputSchema: z.ZodObject<{
|
|
|
6600
6602
|
identity: "identity";
|
|
6601
6603
|
provider: "provider";
|
|
6602
6604
|
pool: "pool";
|
|
6605
|
+
keychain: "keychain";
|
|
6603
6606
|
"ambient-credential": "ambient-credential";
|
|
6604
6607
|
"binary-discovery": "binary-discovery";
|
|
6605
6608
|
"claude-shim": "claude-shim";
|
|
6606
6609
|
"path-resolution": "path-resolution";
|
|
6607
6610
|
"legacy-name": "legacy-name";
|
|
6608
|
-
keychain: "keychain";
|
|
6609
6611
|
"directory-rules": "directory-rules";
|
|
6610
6612
|
"categories-local": "categories-local";
|
|
6611
6613
|
"active-identity": "active-identity";
|
|
@@ -7132,6 +7134,13 @@ interface PoolRanking {
|
|
|
7132
7134
|
*/
|
|
7133
7135
|
declare function rankPool(input: RankPoolInput): PoolRanking;
|
|
7134
7136
|
|
|
7137
|
+
/**
|
|
7138
|
+
* The store-backed side of pool picking: loads each member's recorded state and ranks it with `rankPool`, and keeps the per-directory record of the last pick. The launcher and `agent-shim pool pick` both go through `rankPoolGraph`, so the command shows exactly what a launch would choose.
|
|
7139
|
+
*/
|
|
7140
|
+
/** Raised while ranking a pool graph: a member names a pool that is not defined, or the graph reaches a pool it is already inside. `pool add` and `pool set` refuse both at write time; this is the guard for pools edited since. */
|
|
7141
|
+
declare class PoolGraphError extends CliError {
|
|
7142
|
+
constructor(message: string);
|
|
7143
|
+
}
|
|
7135
7144
|
/**
|
|
7136
7145
|
* The concrete identities the pool named `poolName` can launch as, in member order with a nested `pool:<name>` entry replaced by the identities of that pool at the entry's position, each identity once. It reads no usage and no identity file, so it lists every identity the pool graph names, whether or not it exists or is eligible: ranking is `rankPoolGraph`'s job.
|
|
7137
7146
|
*
|
|
@@ -7939,5 +7948,5 @@ declare const OWN_CLI_FILE_NAME = "cli.cjs";
|
|
|
7939
7948
|
*/
|
|
7940
7949
|
declare function agentShimCliPath(distDir?: string | undefined): string;
|
|
7941
7950
|
|
|
7942
|
-
export { AMBIENT_CREDENTIAL_VARS, CHECK_CREDENTIAL_APPLIES, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, ConfigProfileSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DOOR_HEALTH_EVENT_SOURCE, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, DoorHealthEventSchema, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorControlMaterialError, FrontDoorNotServingError, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LaunchLifecycleEventSchema, LaunchRefusedError, LegacyProviderFileError, OWN_CLI_FILE_NAME, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, QUOTA_EXPIRING_EVENT_SOURCE, QuotaExpiringEventSchema, RC_CONTEXT_USAGE_DETAILS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcLiveRateLimitSchema, RcPermissionModeSchema, RcRateLimitInfoSchema, RcRateLimitWindowSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, USAGE_EVENT_SOURCE, UsageError, UsageListOutputSchema, UsageLiveOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, addDirectoryRule, addIdentity, addPool, addProvider, agentShimCliPath, answerRcControlRequest, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createDoorHealthPublisher, createEventsApiRouter, createLaunchEventPublisher, createLeafCache, createProfile, createQuotaExpiringPublisher, createRcApiNodeHandler, createRcApiRouter, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcLiveUsage, createRcSelfHostSurface, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiFromState, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, headroomSocketTarget, identityExists, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, listDirectoryRules, listIdentities, listProfiles, listProviders, listUsageSnapshots, matchBranch, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcStreamEnvelope, planOf, poolIdentities, poolSelectedByLaunch, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcObserverAsPassthrough, rcRateLimitInfoOf, rcSelfHostFromEnv, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readDirectoryRules, readFarmManifest, readFrontDoorControlMaterial, readGlobalConfig, readIdentity, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readUsageSnapshot, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, refreshLaunchPoolUsage, refreshPoolUsage, refreshStalePoolMembers, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveDecisions, resolveLaunchSelection, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runClaudeLaunch, runDoctor, runFrontDoorSupervisor, runLaunchPlan, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setPool, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, watchedInstallEntry, writeDirectoryRules };
|
|
7951
|
+
export { AMBIENT_CREDENTIAL_VARS, CHECK_CREDENTIAL_APPLIES, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, ConfigProfileSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DOOR_HEALTH_EVENT_SOURCE, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, DoorHealthEventSchema, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorControlMaterialError, FrontDoorNotServingError, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LaunchLifecycleEventSchema, LaunchRefusedError, LegacyProviderFileError, OWN_CLI_FILE_NAME, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolGraphError, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, QUOTA_EXPIRING_EVENT_SOURCE, QuotaExpiringEventSchema, RC_CONTEXT_USAGE_DETAILS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcLiveRateLimitSchema, RcPermissionModeSchema, RcRateLimitInfoSchema, RcRateLimitWindowSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, USAGE_EVENT_SOURCE, UsageError, UsageListOutputSchema, UsageLiveOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, addDirectoryRule, addIdentity, addPool, addProvider, agentShimCliPath, answerRcControlRequest, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createDoorHealthPublisher, createEventsApiRouter, createLaunchEventPublisher, createLeafCache, createProfile, createQuotaExpiringPublisher, createRcApiNodeHandler, createRcApiRouter, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcLiveUsage, createRcSelfHostSurface, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiFromState, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, headroomSocketTarget, identityExists, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, listDirectoryRules, listIdentities, listProfiles, listProviders, listUsageSnapshots, matchBranch, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcStreamEnvelope, planOf, poolIdentities, poolSelectedByLaunch, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcObserverAsPassthrough, rcRateLimitInfoOf, rcSelfHostFromEnv, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readDirectoryRules, readFarmManifest, readFrontDoorControlMaterial, readGlobalConfig, readIdentity, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readUsageSnapshot, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, refreshLaunchPoolUsage, refreshPoolUsage, refreshStalePoolMembers, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveDecisions, resolveLaunchSelection, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runClaudeLaunch, runDoctor, runFrontDoorSupervisor, runLaunchPlan, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setPool, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, watchedInstallEntry, writeDirectoryRules };
|
|
7943
7952
|
export type { AddDirectoryRuleOptions, AddProviderInput, AmbientCredentialDetection, AmbientCredentialGuardResult, AmbientCredentialVar, AnthropicUsageRefresher, BuildEntryFactsParams, CaMaterial, Candidate, CarryOverParams, CarryOverResult, CategoryMap, CheckReport, CheckReportJson, CollectCheckReportParams, CollectDoctorReportParams, CompiledRule, ConditionContext, ConfigProfile, ConnectCertStore, ConnectEffects, ConnectLimits, ConnectLocalSurface, ConnectServerConfig, ConnectServerHandle, ConnectTarget, ControlApiClient, ControlApiDeps, ControlApiRouter, Credential, CredentialSource, Decision, Diagnostic, DirectoryRule, DirectoryRules, DoctorReport, DoorApiClient, DoorApiContext, DoorApiDeps, DoorApiRouter, DoorEvent, DoorEventHub, DoorEventPublisher, DoorEventStream, DoorEventsApiDeps, DoorHealthEvent, DoorHealthPublisher, EffectiveWindow, EliminatedRule, EnsureFrontDoorPorts, EnsureHeadroomPorts, EntryFact, EntryFacts, EntryValue, EvaluateAmbientCredentialGuardParams, FlattenedCascade, FrontDoorControlMaterial, FrontDoorRcControl, FrontDoorSessionStatus, FrontDoorStatus, FrontDoorSupervisorPorts, GlobalConfig, HeadroomSupervisorConfig, Identity, IdentityCredentialChange, IdentityListEntry, IdentityListing, InjectedCredential, LaunchDecision, LaunchEventPublisher, LaunchLifecycleEvent, LaunchPlan, LaunchPoolDecision, LaunchSelection, Layer, LayerId, LayoutPaths, LeafCert, NestedContribution, OwnExecutableStat, PlanClass, Pool, PoolMember, PoolPickReport, PoolRanking, PortableConfig, PrepareClaudeLaunchOptions, PrepareLaunchParams, ProfileListEntry, Provider, ProviderListEntry, QuotaExpiringEvent, QuotaExpiringPublisher, RankPoolInput, RcAnswerDecision, RcAnswerDeps, RcApiClient, RcApiDeps, RcApiRouter, RcContextUsageDetail, RcControlAnswer, RcControlHandlerDeps, RcControlRequestDeps, RcControlTransport, RcCredentialStore, RcDialAnswer, RcDialTarget, RcEventDial, RcEventFanout, RcEventWriteResult, RcExchangeObserver, RcInjectDeps, RcLiveRateLimit, RcLiveUsage, RcLiveUsageDeps, RcObservedCredential, RcObservedRequest, RcPendingRequestSummary, RcPermissionMode, RcPresenceAnswer, RcRateLimitInfo, RcRateLimitWindow, RcReadFileEncoding, RcReadFileOptions, RcSelfHostCredentialRecord, RcSelfHostDeps, RcSelfHostMintResult, RcSelfHostSurface, RcSessionStatus, RcSessionSummary, RcSessionTracker, RcSessionTrackerDeps, RcStreamAnswer, RcStreamDial, RcStreamEnvelope, RcStreamEvent, RcStreamHub, RcStreamHubDeps, RcWebFetchDeps, RcWebFetchHop, RcWebFetchOutcome, RcWebFetcher, RcWorkerFact, RcWriteHeaders, RecoverFarmParams, RecoveryResult, RefreshLaunchPoolUsageOptions, RefreshPoolUsageParams, RefreshStalePoolMembersParams, ResolveDecisionsInput, ResolveLaunchSelectionParams, ResolvedState, ResyncFarmParams, ResyncFarmResult, RunCheckParams, RunClaudeLaunchOptions, RunDoctorParams, RunFrontDoorSupervisorOptions, RunLauncherParams, RunSupervisorOptions, SpawnClaudeParams, SseParsedEvent, StickyPick, SupervisorPorts, UnreadableIdentityListEntry, UpdateDirectoryRuleOptions, UpdateProviderInput, UsageChangeEvent, UsageReadFs, UsageSnapshot, WhenCondition, WhenEvaluation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-shim",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.1.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>",
|