claude-use 11.8.0 → 11.8.2
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 +82 -16
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -34007,7 +34007,7 @@ var init_package = __esm({
|
|
|
34007
34007
|
"package.json"() {
|
|
34008
34008
|
package_default = {
|
|
34009
34009
|
name: "claude-use",
|
|
34010
|
-
version: "11.8.
|
|
34010
|
+
version: "11.8.2",
|
|
34011
34011
|
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.",
|
|
34012
34012
|
license: "MIT",
|
|
34013
34013
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -34289,10 +34289,11 @@ function parseProviderPath(path59) {
|
|
|
34289
34289
|
}
|
|
34290
34290
|
return { provider: decodeURIComponent(tail.slice(0, slash)), rest: tail.slice(slash) };
|
|
34291
34291
|
}
|
|
34292
|
-
var INTERNAL_HEADER_NAMES, IDENTITY_HEADER, SESSION_HEADER, PROVIDER_HEADER, HEADROOM_FLAG_HEADER, PROJECT_ID_HEADER,
|
|
34292
|
+
var HEADROOM_SESSION_HEADER, INTERNAL_HEADER_NAMES, IDENTITY_HEADER, SESSION_HEADER, PROVIDER_HEADER, HEADROOM_FLAG_HEADER, PROJECT_ID_HEADER, CLIENT_SESSION_HEADER, HEADROOM_BASE_URL_HEADER, AUTH_HEADER, HOP_SECRET_HEADER, HOP_ID_HEADER, PROVIDER_PATH_PREFIX;
|
|
34293
34293
|
var init_route = __esm({
|
|
34294
34294
|
"src/frontdoor/route.ts"() {
|
|
34295
34295
|
"use strict";
|
|
34296
|
+
HEADROOM_SESSION_HEADER = "x-headroom-session-id";
|
|
34296
34297
|
INTERNAL_HEADER_NAMES = [
|
|
34297
34298
|
"x-agent-shim-identity",
|
|
34298
34299
|
"x-agent-shim-session",
|
|
@@ -34302,7 +34303,7 @@ var init_route = __esm({
|
|
|
34302
34303
|
"x-agent-shim-hop",
|
|
34303
34304
|
"x-agent-shim-hop-id",
|
|
34304
34305
|
"x-headroom-project-id",
|
|
34305
|
-
|
|
34306
|
+
HEADROOM_SESSION_HEADER,
|
|
34306
34307
|
"x-headroom-base-url"
|
|
34307
34308
|
];
|
|
34308
34309
|
IDENTITY_HEADER = "x-agent-shim-identity";
|
|
@@ -34310,7 +34311,7 @@ var init_route = __esm({
|
|
|
34310
34311
|
PROVIDER_HEADER = "x-agent-shim-provider";
|
|
34311
34312
|
HEADROOM_FLAG_HEADER = "x-agent-shim-headroom";
|
|
34312
34313
|
PROJECT_ID_HEADER = "x-headroom-project-id";
|
|
34313
|
-
|
|
34314
|
+
CLIENT_SESSION_HEADER = "x-claude-code-session-id";
|
|
34314
34315
|
HEADROOM_BASE_URL_HEADER = "x-headroom-base-url";
|
|
34315
34316
|
AUTH_HEADER = "x-agent-shim-auth";
|
|
34316
34317
|
HOP_SECRET_HEADER = "x-agent-shim-hop";
|
|
@@ -114183,6 +114184,13 @@ function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
|
|
|
114183
114184
|
const sibling = import_node_path44.default.join(parsed.dir, `agent-shim${parsed.ext}`);
|
|
114184
114185
|
return siblingExists(sibling) ? sibling : resolvedOwnExecutablePath;
|
|
114185
114186
|
}
|
|
114187
|
+
var AWAIT_PID_POLL_MS = 50;
|
|
114188
|
+
async function awaitPidExit(pid, boundMs, ports) {
|
|
114189
|
+
const deadline = ports.now() + boundMs;
|
|
114190
|
+
while (ports.isRunning(pid) && ports.now() < deadline) {
|
|
114191
|
+
await ports.sleep(AWAIT_PID_POLL_MS);
|
|
114192
|
+
}
|
|
114193
|
+
}
|
|
114186
114194
|
var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
|
|
114187
114195
|
var FRONTDOOR_POLL_MS = 1e3;
|
|
114188
114196
|
var MS_PER_MINUTE3 = 6e4;
|
|
@@ -126856,8 +126864,8 @@ async function applyHeadroomHop(request7, response, upstream, deps, onThread) {
|
|
|
126856
126864
|
if (request7.session.projectId !== void 0) {
|
|
126857
126865
|
headers[PROJECT_ID_HEADER] = request7.session.projectId;
|
|
126858
126866
|
}
|
|
126859
|
-
if (request7.session.sessionId !== void 0) {
|
|
126860
|
-
headers[
|
|
126867
|
+
if (request7.session.sessionId !== void 0 && !Object.keys(headers).some((name) => name.toLowerCase() === CLIENT_SESSION_HEADER)) {
|
|
126868
|
+
headers[CLIENT_SESSION_HEADER] = request7.session.sessionId;
|
|
126861
126869
|
}
|
|
126862
126870
|
headers[HOP_SECRET_HEADER] = deps.hopSecret;
|
|
126863
126871
|
try {
|
|
@@ -131080,15 +131088,20 @@ function createRcStreamHub(deps) {
|
|
|
131080
131088
|
|
|
131081
131089
|
// src/frontdoor/watchdog.ts
|
|
131082
131090
|
var import_node_worker_threads2 = require("node:worker_threads");
|
|
131091
|
+
init_schema();
|
|
131083
131092
|
init_ensure2();
|
|
131084
131093
|
init_probe();
|
|
131085
131094
|
var DOOR_STALL_BOUND_MS = 2 * FRONTDOOR_PROBE_ATTEMPTS * PROBE_TIMEOUT_MS;
|
|
131095
|
+
var MS_PER_MINUTE4 = 6e4;
|
|
131096
|
+
var DOOR_RESPAWN_MIN_SERVING_MS = FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES * MS_PER_MINUTE4;
|
|
131097
|
+
var DOOR_AWAIT_PID_ENV = "AGENT_SHIM_FRONTDOOR_AWAIT_PID";
|
|
131086
131098
|
var CHECKS_PER_PROBE_DEADLINE = 2;
|
|
131087
131099
|
var DOOR_WATCHDOG_CHECK_MS = PROBE_TIMEOUT_MS / CHECKS_PER_PROBE_DEADLINE;
|
|
131088
131100
|
var WATCHDOG_SOURCE = `
|
|
131089
131101
|
const { workerData, parentPort } = require("node:worker_threads");
|
|
131090
131102
|
const fs = require("node:fs");
|
|
131091
|
-
const { shared, boundMs, checkEveryMs, stateFile, ownPid, action } = workerData;
|
|
131103
|
+
const { shared, boundMs, checkEveryMs, stateFile, ownPid, action, logFile, respawn, respawnAfterServingMs, awaitPidEnv } = workerData;
|
|
131104
|
+
const startedAt = Date.now();
|
|
131092
131105
|
const counter = new Int32Array(shared);
|
|
131093
131106
|
let lastValue = Atomics.load(counter, 0);
|
|
131094
131107
|
let lastChangeAt = Date.now();
|
|
@@ -131105,6 +131118,31 @@ const record = (message) => {
|
|
|
131105
131118
|
// The state file is a courtesy to whoever looks next; the process still has to end.
|
|
131106
131119
|
}
|
|
131107
131120
|
};
|
|
131121
|
+
const log = (line) => {
|
|
131122
|
+
if (logFile === undefined) return;
|
|
131123
|
+
try {
|
|
131124
|
+
fs.appendFileSync(logFile, new Date().toISOString() + " frontdoor " + String(ownPid) + ": " + line + "\\n");
|
|
131125
|
+
} catch (error) {
|
|
131126
|
+
// Nowhere left to report a failed log write to; the process still has to end.
|
|
131127
|
+
}
|
|
131128
|
+
};
|
|
131129
|
+
const spawnReplacement = () => {
|
|
131130
|
+
if (respawn === undefined || logFile === undefined) return;
|
|
131131
|
+
const servedMs = Date.now() - startedAt;
|
|
131132
|
+
if (servedMs < respawnAfterServingMs) {
|
|
131133
|
+
log("the door served for " + String(servedMs) + "ms before stalling, less than the " + String(respawnAfterServingMs) + "ms it must have served to be replaced; leaving the next launch to start one");
|
|
131134
|
+
return;
|
|
131135
|
+
}
|
|
131136
|
+
try {
|
|
131137
|
+
const out = fs.openSync(logFile, "a");
|
|
131138
|
+
const child = require("node:child_process").spawn(respawn.command, respawn.args, { detached: true, stdio: ["ignore", out, out], env: Object.assign({}, respawn.env, { [awaitPidEnv]: String(ownPid) }) });
|
|
131139
|
+
child.unref();
|
|
131140
|
+
fs.closeSync(out);
|
|
131141
|
+
log("started replacement door " + String(child.pid) + ", which binds once this process is gone");
|
|
131142
|
+
} catch (error) {
|
|
131143
|
+
log("could not start a replacement door: " + (error instanceof Error ? error.message : String(error)));
|
|
131144
|
+
}
|
|
131145
|
+
};
|
|
131108
131146
|
const timer = setInterval(() => {
|
|
131109
131147
|
if (stopped) return;
|
|
131110
131148
|
const now = Date.now();
|
|
@@ -131119,6 +131157,8 @@ const timer = setInterval(() => {
|
|
|
131119
131157
|
if (now - lastChangeAt >= boundMs) {
|
|
131120
131158
|
const message = "the front door's event loop did not run for " + String(now - lastChangeAt) + "ms; its watchdog ended the process so the next launch starts a fresh door on the same ports";
|
|
131121
131159
|
record(message);
|
|
131160
|
+
log(message);
|
|
131161
|
+
spawnReplacement();
|
|
131122
131162
|
stopped = true;
|
|
131123
131163
|
clearInterval(timer);
|
|
131124
131164
|
if (action === "kill-process") {
|
|
@@ -131141,7 +131181,7 @@ function startThreadWatchdog(params) {
|
|
|
131141
131181
|
const counter = new Int32Array(shared);
|
|
131142
131182
|
const worker = new import_node_worker_threads2.Worker(WATCHDOG_SOURCE, {
|
|
131143
131183
|
eval: true,
|
|
131144
|
-
workerData: { shared, boundMs: params.boundMs, checkEveryMs: params.checkEveryMs, stateFile: params.stateFile, ownPid: params.ownPid, action: params.action }
|
|
131184
|
+
workerData: { shared, boundMs: params.boundMs, checkEveryMs: params.checkEveryMs, stateFile: params.stateFile, ownPid: params.ownPid, action: params.action, logFile: params.logFile, respawn: params.respawn, respawnAfterServingMs: params.respawnAfterServingMs, awaitPidEnv: DOOR_AWAIT_PID_ENV }
|
|
131145
131185
|
});
|
|
131146
131186
|
worker.unref();
|
|
131147
131187
|
worker.on("message", (message) => {
|
|
@@ -131269,6 +131309,13 @@ function createRealQuotaRefresher(params) {
|
|
|
131269
131309
|
|
|
131270
131310
|
// src/frontdoor/commands.ts
|
|
131271
131311
|
init_store2();
|
|
131312
|
+
function respawnInvocation(paths) {
|
|
131313
|
+
const env = {};
|
|
131314
|
+
for (const [name, value2] of Object.entries({ ...process.env, AGENT_SHIM_HOME: paths.root })) {
|
|
131315
|
+
env[name] = value2;
|
|
131316
|
+
}
|
|
131317
|
+
return { ...selfInvocation(["__frontdoor-supervisor"]), env };
|
|
131318
|
+
}
|
|
131272
131319
|
function appendLog(paths, line) {
|
|
131273
131320
|
import_node_fs19.default.mkdirSync(paths.logsDir, { recursive: true });
|
|
131274
131321
|
import_node_fs19.default.appendFileSync(paths.frontdoorLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
|
|
@@ -131662,7 +131709,16 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
131662
131709
|
return { port: handle.port, close: handle.close };
|
|
131663
131710
|
},
|
|
131664
131711
|
closeRcStreamHub: rcHub.close,
|
|
131665
|
-
startWatchdog: () => startThreadWatchdog({
|
|
131712
|
+
startWatchdog: () => startThreadWatchdog({
|
|
131713
|
+
stateFile: paths.frontdoorStateFile,
|
|
131714
|
+
ownPid: process.pid,
|
|
131715
|
+
boundMs: DOOR_STALL_BOUND_MS,
|
|
131716
|
+
checkEveryMs: DOOR_WATCHDOG_CHECK_MS,
|
|
131717
|
+
action: "kill-process",
|
|
131718
|
+
logFile: paths.frontdoorLogPath,
|
|
131719
|
+
respawn: respawnInvocation(paths),
|
|
131720
|
+
respawnAfterServingMs: DOOR_RESPAWN_MIN_SERVING_MS
|
|
131721
|
+
}),
|
|
131666
131722
|
// The launch lifecycle publisher over the same backbone the typed API serves: the tick's registry facts go in here, and the door's own register, prune and end moments come out as source-tagged events.
|
|
131667
131723
|
observeLaunchRegistry: createLaunchEventPublisher(doorEvents, () => Date.now()).observe,
|
|
131668
131724
|
doorHealth,
|
|
@@ -131707,14 +131763,24 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
131707
131763
|
registerRcCommand(frontdoor, paths);
|
|
131708
131764
|
program2.command("__frontdoor-supervisor", { hidden: true }).description("Internal: serve the front-door routing listeners. Started by the launcher; never run by hand.").allowUnknownOption().action(async () => {
|
|
131709
131765
|
const idleShutdownMinutes = readGlobalConfig(paths)?.frontdoor?.idleShutdownMinutes ?? FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES;
|
|
131710
|
-
|
|
131711
|
-
|
|
131712
|
-
|
|
131713
|
-
|
|
131714
|
-
|
|
131715
|
-
|
|
131766
|
+
const supervisorPorts = realFrontDoorSupervisorPorts(paths);
|
|
131767
|
+
const ownPid = process.pid;
|
|
131768
|
+
process.on("exit", (code) => {
|
|
131769
|
+
supervisorPorts.log(`frontdoor ${String(ownPid)}: exiting with code ${String(code)}`);
|
|
131770
|
+
});
|
|
131771
|
+
for (const signal of ["SIGTERM", "SIGINT"]) {
|
|
131772
|
+
process.on(signal, () => {
|
|
131773
|
+
supervisorPorts.log(`frontdoor ${String(ownPid)}: received ${signal}; exiting`);
|
|
131774
|
+
deps.exit(0);
|
|
131775
|
+
});
|
|
131776
|
+
}
|
|
131777
|
+
const awaited = Number(process.env[DOOR_AWAIT_PID_ENV]);
|
|
131778
|
+
Reflect.deleteProperty(process.env, DOOR_AWAIT_PID_ENV);
|
|
131779
|
+
if (Number.isInteger(awaited) && awaited > 0) {
|
|
131780
|
+
await awaitPidExit(awaited, DOOR_STALL_BOUND_MS, supervisorPorts);
|
|
131781
|
+
}
|
|
131716
131782
|
declareThisProcessTheFrontDoor();
|
|
131717
|
-
deps.exit(await runFrontDoorSupervisor(idleShutdownMinutes,
|
|
131783
|
+
deps.exit(await runFrontDoorSupervisor(idleShutdownMinutes, supervisorPorts));
|
|
131718
131784
|
});
|
|
131719
131785
|
}
|
|
131720
131786
|
|
package/dist/index.cjs
CHANGED
|
@@ -2787,7 +2787,7 @@ var init_package = __esm({
|
|
|
2787
2787
|
"package.json"() {
|
|
2788
2788
|
package_default = {
|
|
2789
2789
|
name: "claude-use",
|
|
2790
|
-
version: "11.8.
|
|
2790
|
+
version: "11.8.2",
|
|
2791
2791
|
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.",
|
|
2792
2792
|
license: "MIT",
|
|
2793
2793
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
package/dist/index.mjs
CHANGED
|
@@ -2763,7 +2763,7 @@ var init_package = __esm({
|
|
|
2763
2763
|
"package.json"() {
|
|
2764
2764
|
package_default = {
|
|
2765
2765
|
name: "claude-use",
|
|
2766
|
-
version: "11.8.
|
|
2766
|
+
version: "11.8.2",
|
|
2767
2767
|
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.",
|
|
2768
2768
|
license: "MIT",
|
|
2769
2769
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-use",
|
|
3
|
-
"version": "11.8.
|
|
3
|
+
"version": "11.8.2",
|
|
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>",
|