claude-use 11.8.1 → 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 +76 -11
- 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>",
|
|
@@ -114184,6 +114184,13 @@ function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
|
|
|
114184
114184
|
const sibling = import_node_path44.default.join(parsed.dir, `agent-shim${parsed.ext}`);
|
|
114185
114185
|
return siblingExists(sibling) ? sibling : resolvedOwnExecutablePath;
|
|
114186
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
|
+
}
|
|
114187
114194
|
var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
|
|
114188
114195
|
var FRONTDOOR_POLL_MS = 1e3;
|
|
114189
114196
|
var MS_PER_MINUTE3 = 6e4;
|
|
@@ -131081,15 +131088,20 @@ function createRcStreamHub(deps) {
|
|
|
131081
131088
|
|
|
131082
131089
|
// src/frontdoor/watchdog.ts
|
|
131083
131090
|
var import_node_worker_threads2 = require("node:worker_threads");
|
|
131091
|
+
init_schema();
|
|
131084
131092
|
init_ensure2();
|
|
131085
131093
|
init_probe();
|
|
131086
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";
|
|
131087
131098
|
var CHECKS_PER_PROBE_DEADLINE = 2;
|
|
131088
131099
|
var DOOR_WATCHDOG_CHECK_MS = PROBE_TIMEOUT_MS / CHECKS_PER_PROBE_DEADLINE;
|
|
131089
131100
|
var WATCHDOG_SOURCE = `
|
|
131090
131101
|
const { workerData, parentPort } = require("node:worker_threads");
|
|
131091
131102
|
const fs = require("node:fs");
|
|
131092
|
-
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();
|
|
131093
131105
|
const counter = new Int32Array(shared);
|
|
131094
131106
|
let lastValue = Atomics.load(counter, 0);
|
|
131095
131107
|
let lastChangeAt = Date.now();
|
|
@@ -131106,6 +131118,31 @@ const record = (message) => {
|
|
|
131106
131118
|
// The state file is a courtesy to whoever looks next; the process still has to end.
|
|
131107
131119
|
}
|
|
131108
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
|
+
};
|
|
131109
131146
|
const timer = setInterval(() => {
|
|
131110
131147
|
if (stopped) return;
|
|
131111
131148
|
const now = Date.now();
|
|
@@ -131120,6 +131157,8 @@ const timer = setInterval(() => {
|
|
|
131120
131157
|
if (now - lastChangeAt >= boundMs) {
|
|
131121
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";
|
|
131122
131159
|
record(message);
|
|
131160
|
+
log(message);
|
|
131161
|
+
spawnReplacement();
|
|
131123
131162
|
stopped = true;
|
|
131124
131163
|
clearInterval(timer);
|
|
131125
131164
|
if (action === "kill-process") {
|
|
@@ -131142,7 +131181,7 @@ function startThreadWatchdog(params) {
|
|
|
131142
131181
|
const counter = new Int32Array(shared);
|
|
131143
131182
|
const worker = new import_node_worker_threads2.Worker(WATCHDOG_SOURCE, {
|
|
131144
131183
|
eval: true,
|
|
131145
|
-
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 }
|
|
131146
131185
|
});
|
|
131147
131186
|
worker.unref();
|
|
131148
131187
|
worker.on("message", (message) => {
|
|
@@ -131270,6 +131309,13 @@ function createRealQuotaRefresher(params) {
|
|
|
131270
131309
|
|
|
131271
131310
|
// src/frontdoor/commands.ts
|
|
131272
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
|
+
}
|
|
131273
131319
|
function appendLog(paths, line) {
|
|
131274
131320
|
import_node_fs19.default.mkdirSync(paths.logsDir, { recursive: true });
|
|
131275
131321
|
import_node_fs19.default.appendFileSync(paths.frontdoorLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
|
|
@@ -131663,7 +131709,16 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
131663
131709
|
return { port: handle.port, close: handle.close };
|
|
131664
131710
|
},
|
|
131665
131711
|
closeRcStreamHub: rcHub.close,
|
|
131666
|
-
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
|
+
}),
|
|
131667
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.
|
|
131668
131723
|
observeLaunchRegistry: createLaunchEventPublisher(doorEvents, () => Date.now()).observe,
|
|
131669
131724
|
doorHealth,
|
|
@@ -131708,14 +131763,24 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
131708
131763
|
registerRcCommand(frontdoor, paths);
|
|
131709
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 () => {
|
|
131710
131765
|
const idleShutdownMinutes = readGlobalConfig(paths)?.frontdoor?.idleShutdownMinutes ?? FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES;
|
|
131711
|
-
|
|
131712
|
-
|
|
131713
|
-
|
|
131714
|
-
|
|
131715
|
-
|
|
131716
|
-
|
|
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
|
+
}
|
|
131717
131782
|
declareThisProcessTheFrontDoor();
|
|
131718
|
-
deps.exit(await runFrontDoorSupervisor(idleShutdownMinutes,
|
|
131783
|
+
deps.exit(await runFrontDoorSupervisor(idleShutdownMinutes, supervisorPorts));
|
|
131719
131784
|
});
|
|
131720
131785
|
}
|
|
131721
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>",
|