github-router 0.3.110 → 0.3.111
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/browser-ext/manifest.json +1 -1
- package/dist/{lifecycle-DoFZQWAC.js → lifecycle-BHG64Dhh.js} +2 -2
- package/dist/{lifecycle-yl1T7iQf.js → lifecycle-D6zt0iH_.js} +2 -2
- package/dist/{lifecycle-yl1T7iQf.js.map → lifecycle-D6zt0iH_.js.map} +1 -1
- package/dist/{lifecycle-BFBvekpf.js → lifecycle-DzJicg68.js} +3 -3
- package/dist/{lifecycle-BFBvekpf.js.map → lifecycle-DzJicg68.js.map} +1 -1
- package/dist/{lifecycle-BMd7UJo7.js → lifecycle-YCqABCX4.js} +2 -2
- package/dist/main.js +256 -9
- package/dist/main.js.map +1 -1
- package/dist/{paths-C8zBV5RE.js → paths-CDWhYOdp.js} +3 -3
- package/dist/{paths-C8zBV5RE.js.map → paths-CDWhYOdp.js.map} +1 -1
- package/dist/{paths-0Vw8oIDa.js → paths-DNVIKCZP.js} +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as removeOwnClaudeConfigMirror, i as isUnderClaudeConfigMirror, l as writeRuntimeFileSecure, n as ensureClaudeConfigMirror, r as ensurePaths, t as PATHS } from "./paths-
|
|
3
|
-
import { c as
|
|
4
|
-
import { a as sweepRegistry, i as registerExitHandlers, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-
|
|
2
|
+
import { a as removeOwnClaudeConfigMirror, i as isUnderClaudeConfigMirror, l as writeRuntimeFileSecure, n as ensureClaudeConfigMirror, r as ensurePaths, t as PATHS } from "./paths-CDWhYOdp.js";
|
|
3
|
+
import { c as parseBoolEnv, d as runCommandVoid, f as runManagedExeCapture, l as resolveExecutable, n as isPidAlive, o as trackChild, r as registerColbertExitHandlers, s as killManagedTree, t as getColbertInstanceUuid, u as runCommandCapture } from "./lifecycle-DzJicg68.js";
|
|
4
|
+
import { a as sweepRegistry, i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-D6zt0iH_.js";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { defineCommand, runMain } from "citty";
|
|
7
7
|
import consola from "consola";
|
|
@@ -5761,7 +5761,7 @@ function semanticSearchOptedIn() {
|
|
|
5761
5761
|
function colbertSearchEnabled() {
|
|
5762
5762
|
return semanticSearchOptedIn() && colbertArtifactsPresent() && colbertSmokeOk();
|
|
5763
5763
|
}
|
|
5764
|
-
let _started = false;
|
|
5764
|
+
let _started$1 = false;
|
|
5765
5765
|
/**
|
|
5766
5766
|
* Fire-and-forget provision + background-index. Never throws; safe to
|
|
5767
5767
|
* `void`-call from a launcher right after the server is listening.
|
|
@@ -5769,8 +5769,8 @@ let _started = false;
|
|
|
5769
5769
|
*/
|
|
5770
5770
|
async function provisionAndIndexColbert(opts = {}) {
|
|
5771
5771
|
if (!semanticSearchOptedIn()) return;
|
|
5772
|
-
if (_started) return;
|
|
5773
|
-
_started = true;
|
|
5772
|
+
if (_started$1) return;
|
|
5773
|
+
_started$1 = true;
|
|
5774
5774
|
registerColbertExitHandlers();
|
|
5775
5775
|
let provisioned = false;
|
|
5776
5776
|
try {
|
|
@@ -7102,7 +7102,7 @@ function logAudit$1(record) {
|
|
|
7102
7102
|
try {
|
|
7103
7103
|
const fs$2 = await import("node:fs/promises");
|
|
7104
7104
|
const path$1 = await import("node:path");
|
|
7105
|
-
const { PATHS: PATHS$1 } = await import("./paths-
|
|
7105
|
+
const { PATHS: PATHS$1 } = await import("./paths-DNVIKCZP.js");
|
|
7106
7106
|
const dir = path$1.join(PATHS$1.APP_DIR, "browser-mcp");
|
|
7107
7107
|
await fs$2.mkdir(dir, { recursive: true });
|
|
7108
7108
|
const line = JSON.stringify({
|
|
@@ -17471,7 +17471,7 @@ async function createWorktree(workspaceAbs, opts) {
|
|
|
17471
17471
|
* Exported solely for the test helpers in this file to reach.
|
|
17472
17472
|
*/
|
|
17473
17473
|
const WORKTREE_REGISTRY = new WorktreeRegistry();
|
|
17474
|
-
registerExitHandlers(WORKTREE_REGISTRY);
|
|
17474
|
+
registerExitHandlers$1(WORKTREE_REGISTRY);
|
|
17475
17475
|
/** Default model + thinking for the READ-ONLY worker modes (`explore`,
|
|
17476
17476
|
* `review`). `gemini-3.5-flash` at `high` (its top reasoning tier) — fast,
|
|
17477
17477
|
* 1M-context, tool-call-capable.
|
|
@@ -22160,6 +22160,249 @@ async function exposedCommands(binDir) {
|
|
|
22160
22160
|
return out;
|
|
22161
22161
|
}
|
|
22162
22162
|
|
|
22163
|
+
//#endregion
|
|
22164
|
+
//#region src/lib/keep-awake/flags.ts
|
|
22165
|
+
/**
|
|
22166
|
+
* True unless the operator opted out via `GH_ROUTER_DISABLE_KEEP_AWAKE`.
|
|
22167
|
+
* Keep-awake is ON BY DEFAULT (the win32-only platform gate is applied
|
|
22168
|
+
* separately in `keepAwakeEnabled()`). Mirrors the colbert opt-out idiom
|
|
22169
|
+
* (`parseBoolEnv(...) !== true`) so on/off semantics don't drift.
|
|
22170
|
+
*/
|
|
22171
|
+
function keepAwakeOptedIn() {
|
|
22172
|
+
return parseBoolEnv(process$1.env.GH_ROUTER_DISABLE_KEEP_AWAKE) !== true;
|
|
22173
|
+
}
|
|
22174
|
+
/**
|
|
22175
|
+
* True iff the operator opted IN to keeping the DISPLAY awake too via
|
|
22176
|
+
* `GH_ROUTER_KEEP_DISPLAY_ON=1`. Default OFF: the machine stays awake
|
|
22177
|
+
* (`ES_SYSTEM_REQUIRED`) but the panel is allowed to sleep.
|
|
22178
|
+
*/
|
|
22179
|
+
function keepDisplayOn() {
|
|
22180
|
+
return parseBoolEnv(process$1.env.GH_ROUTER_KEEP_DISPLAY_ON) === true;
|
|
22181
|
+
}
|
|
22182
|
+
|
|
22183
|
+
//#endregion
|
|
22184
|
+
//#region src/lib/keep-awake/helper.ts
|
|
22185
|
+
const ES_CONTINUOUS = 2147483648;
|
|
22186
|
+
const ES_SYSTEM_REQUIRED = 1;
|
|
22187
|
+
const ES_DISPLAY_REQUIRED = 2;
|
|
22188
|
+
/** Default time to wait for the helper's `OK` readiness line. */
|
|
22189
|
+
const DEFAULT_READY_TIMEOUT_MS = 5e3;
|
|
22190
|
+
/**
|
|
22191
|
+
* The execution-state flags to assert. Always `ES_CONTINUOUS |
|
|
22192
|
+
* ES_SYSTEM_REQUIRED` (machine stays awake); adds `ES_DISPLAY_REQUIRED`
|
|
22193
|
+
* (screen stays on) when `displayRequired`. `>>> 0` forces an unsigned
|
|
22194
|
+
* 32-bit value so the hex literal handed to PowerShell is positive.
|
|
22195
|
+
*/
|
|
22196
|
+
function executionStateFlags(displayRequired) {
|
|
22197
|
+
let flags = ES_CONTINUOUS | ES_SYSTEM_REQUIRED;
|
|
22198
|
+
if (displayRequired) flags |= ES_DISPLAY_REQUIRED;
|
|
22199
|
+
return flags >>> 0;
|
|
22200
|
+
}
|
|
22201
|
+
/** Format a uint32 as a PowerShell `[uint32]<decimal>` literal.
|
|
22202
|
+
*
|
|
22203
|
+
* Decimal, NOT hex: in Windows PowerShell a hex literal like `0x80000001`
|
|
22204
|
+
* parses as a *negative* Int32 (`-2147483647`) and fails to convert to
|
|
22205
|
+
* the `uint` parameter ("Value was either too large or too small for a
|
|
22206
|
+
* UInt32"). A decimal literal over Int32.MaxValue auto-promotes to a
|
|
22207
|
+
* positive Int64, and the explicit `[uint32]` cast then fits. Verified
|
|
22208
|
+
* against a real win32 host before shipping. */
|
|
22209
|
+
function psUint32(n) {
|
|
22210
|
+
return `[uint32]${n >>> 0}`;
|
|
22211
|
+
}
|
|
22212
|
+
/**
|
|
22213
|
+
* Build the PowerShell script the persistent helper runs. PURE — the
|
|
22214
|
+
* flag value is our own constant templated as a numeric literal, so
|
|
22215
|
+
* there is no injection surface. The script:
|
|
22216
|
+
* 1. P/Invokes `SetThreadExecutionState` with the requested flags.
|
|
22217
|
+
* 2. Prints `OK` once the assertion succeeds (the readiness signal;
|
|
22218
|
+
* no `OK` => `Add-Type` was CLM-blocked or the call returned 0).
|
|
22219
|
+
* 3. Blocks reading stdin so it self-exits on parent death (pipe EOF).
|
|
22220
|
+
* 4. Clears the assertion (`ES_CONTINUOUS` only) on the way out.
|
|
22221
|
+
*
|
|
22222
|
+
* The C# member-definition is a PowerShell SINGLE-quoted string so its
|
|
22223
|
+
* embedded `"kernel32.dll"` double-quotes need no escaping.
|
|
22224
|
+
*/
|
|
22225
|
+
function buildKeepAwakeScript(displayRequired) {
|
|
22226
|
+
const assert = psUint32(executionStateFlags(displayRequired));
|
|
22227
|
+
const clear = psUint32(ES_CONTINUOUS);
|
|
22228
|
+
return [
|
|
22229
|
+
`Add-Type -Name P -Namespace W -MemberDefinition '[System.Runtime.InteropServices.DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint e);'`,
|
|
22230
|
+
`if ([W.P]::SetThreadExecutionState(${assert}) -ne 0) { [Console]::Out.WriteLine('OK'); [Console]::Out.Flush() }`,
|
|
22231
|
+
`while ($null -ne [Console]::In.ReadLine()) {}`,
|
|
22232
|
+
`[void][W.P]::SetThreadExecutionState(${clear})`
|
|
22233
|
+
].join("\n");
|
|
22234
|
+
}
|
|
22235
|
+
/** The argv passed to powershell.exe (excluding the executable itself). */
|
|
22236
|
+
function buildHelperArgs(displayRequired) {
|
|
22237
|
+
return [
|
|
22238
|
+
"-NoProfile",
|
|
22239
|
+
"-NonInteractive",
|
|
22240
|
+
"-Command",
|
|
22241
|
+
buildKeepAwakeScript(displayRequired)
|
|
22242
|
+
];
|
|
22243
|
+
}
|
|
22244
|
+
/**
|
|
22245
|
+
* Spawn the persistent helper. Returns a null handle (and `ready` →
|
|
22246
|
+
* `false`) when powershell.exe can't be resolved or spawn throws — both
|
|
22247
|
+
* clean no-op degradations. The helper's stdout is piped only to detect
|
|
22248
|
+
* the `OK` readiness line; stderr is ignored.
|
|
22249
|
+
*/
|
|
22250
|
+
function spawnHelper(opts) {
|
|
22251
|
+
const ps = resolveExecutable("powershell.exe");
|
|
22252
|
+
if (!ps) return {
|
|
22253
|
+
handle: null,
|
|
22254
|
+
ready: Promise.resolve(false)
|
|
22255
|
+
};
|
|
22256
|
+
let child;
|
|
22257
|
+
try {
|
|
22258
|
+
child = spawn(ps, buildHelperArgs(opts.displayRequired), {
|
|
22259
|
+
stdio: [
|
|
22260
|
+
"pipe",
|
|
22261
|
+
"pipe",
|
|
22262
|
+
"ignore"
|
|
22263
|
+
],
|
|
22264
|
+
windowsHide: true,
|
|
22265
|
+
shell: false
|
|
22266
|
+
});
|
|
22267
|
+
} catch {
|
|
22268
|
+
return {
|
|
22269
|
+
handle: null,
|
|
22270
|
+
ready: Promise.resolve(false)
|
|
22271
|
+
};
|
|
22272
|
+
}
|
|
22273
|
+
child.on("error", () => {});
|
|
22274
|
+
return {
|
|
22275
|
+
handle: { child },
|
|
22276
|
+
ready: new Promise((resolve) => {
|
|
22277
|
+
let settled = false;
|
|
22278
|
+
let buf = "";
|
|
22279
|
+
const done = (v) => {
|
|
22280
|
+
if (settled) return;
|
|
22281
|
+
settled = true;
|
|
22282
|
+
clearTimeout(timer);
|
|
22283
|
+
resolve(v);
|
|
22284
|
+
};
|
|
22285
|
+
const timer = setTimeout(() => done(false), opts.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS);
|
|
22286
|
+
timer.unref?.();
|
|
22287
|
+
child.stdout?.on("data", (c) => {
|
|
22288
|
+
if (settled || buf.length > 256) return;
|
|
22289
|
+
buf += c.toString("utf8");
|
|
22290
|
+
if (buf.includes("OK")) done(true);
|
|
22291
|
+
});
|
|
22292
|
+
child.stdout?.on("error", () => {});
|
|
22293
|
+
child.once("exit", () => done(false));
|
|
22294
|
+
child.once("error", () => done(false));
|
|
22295
|
+
})
|
|
22296
|
+
};
|
|
22297
|
+
}
|
|
22298
|
+
/**
|
|
22299
|
+
* Release the assertion: close the helper's stdin (→ pipe EOF → the
|
|
22300
|
+
* helper clears `ES_*` and exits) then `taskkill /T /F` as a
|
|
22301
|
+
* belt-and-suspenders reap. Windows also releases the assertion on the
|
|
22302
|
+
* helper's process death regardless. Best-effort; never throws.
|
|
22303
|
+
*/
|
|
22304
|
+
function killHelper(handle) {
|
|
22305
|
+
const { child } = handle;
|
|
22306
|
+
try {
|
|
22307
|
+
child.stdin?.end();
|
|
22308
|
+
} catch {}
|
|
22309
|
+
try {
|
|
22310
|
+
killManagedTree(child);
|
|
22311
|
+
} catch {}
|
|
22312
|
+
}
|
|
22313
|
+
|
|
22314
|
+
//#endregion
|
|
22315
|
+
//#region src/lib/keep-awake/index.ts
|
|
22316
|
+
/**
|
|
22317
|
+
* True iff keep-awake should run THIS launch: win32 AND not opted out.
|
|
22318
|
+
* Non-win32 short-circuits before anything else (no spawn, no flags read
|
|
22319
|
+
* beyond the opt-out, no handler registration). `platform` is injectable
|
|
22320
|
+
* for tests; production callers use the default `process.platform`.
|
|
22321
|
+
*/
|
|
22322
|
+
function keepAwakeEnabled(platform$1 = process$1.platform) {
|
|
22323
|
+
return platform$1 === "win32" && keepAwakeOptedIn();
|
|
22324
|
+
}
|
|
22325
|
+
let _handle = null;
|
|
22326
|
+
let _started = false;
|
|
22327
|
+
/** Synchronously release the assertion + drop the handle. Idempotent.
|
|
22328
|
+
* Also clears the `_started` latch so a transient failure never
|
|
22329
|
+
* permanently disables a later start. */
|
|
22330
|
+
function releaseSync() {
|
|
22331
|
+
const h = _handle;
|
|
22332
|
+
_handle = null;
|
|
22333
|
+
_started = false;
|
|
22334
|
+
if (h) try {
|
|
22335
|
+
killHelper(h);
|
|
22336
|
+
} catch {}
|
|
22337
|
+
}
|
|
22338
|
+
let _registered = false;
|
|
22339
|
+
let _exitHandler = null;
|
|
22340
|
+
let _sigintHandler = null;
|
|
22341
|
+
let _sigtermHandler = null;
|
|
22342
|
+
/**
|
|
22343
|
+
* Wire SIGINT/SIGTERM/exit handlers that release the assertion.
|
|
22344
|
+
* Idempotent. The signal handlers re-raise after releasing (remove self
|
|
22345
|
+
* + `process.kill(self)`) so Node's default terminate-on-signal is
|
|
22346
|
+
* restored — otherwise merely attaching a listener cancels the default
|
|
22347
|
+
* and Ctrl-C would clean but not exit. This is load-bearing for the
|
|
22348
|
+
* `start` subcommand, which has no `launchChild`/`onShutdown` of its own.
|
|
22349
|
+
*/
|
|
22350
|
+
function registerExitHandlers() {
|
|
22351
|
+
if (_registered) return;
|
|
22352
|
+
_registered = true;
|
|
22353
|
+
_exitHandler = () => releaseSync();
|
|
22354
|
+
_sigintHandler = () => {
|
|
22355
|
+
releaseSync();
|
|
22356
|
+
if (_sigintHandler) process$1.off("SIGINT", _sigintHandler);
|
|
22357
|
+
process$1.kill(process$1.pid, "SIGINT");
|
|
22358
|
+
};
|
|
22359
|
+
_sigtermHandler = () => {
|
|
22360
|
+
releaseSync();
|
|
22361
|
+
if (_sigtermHandler) process$1.off("SIGTERM", _sigtermHandler);
|
|
22362
|
+
process$1.kill(process$1.pid, "SIGTERM");
|
|
22363
|
+
};
|
|
22364
|
+
process$1.on("SIGINT", _sigintHandler);
|
|
22365
|
+
process$1.on("SIGTERM", _sigtermHandler);
|
|
22366
|
+
process$1.on("exit", _exitHandler);
|
|
22367
|
+
}
|
|
22368
|
+
/**
|
|
22369
|
+
* Start keeping the machine awake. Synchronous, fire-and-forget,
|
|
22370
|
+
* idempotent within a run. No-op off win32 or when opted out. Never
|
|
22371
|
+
* throws.
|
|
22372
|
+
*/
|
|
22373
|
+
function startKeepAwake() {
|
|
22374
|
+
if (!keepAwakeEnabled()) return;
|
|
22375
|
+
if (_started) return;
|
|
22376
|
+
_started = true;
|
|
22377
|
+
try {
|
|
22378
|
+
const { handle, ready } = spawnHelper({ displayRequired: keepDisplayOn() });
|
|
22379
|
+
if (!handle) {
|
|
22380
|
+
_started = false;
|
|
22381
|
+
consola.debug("keep-awake: inactive (powershell.exe not resolvable)");
|
|
22382
|
+
return;
|
|
22383
|
+
}
|
|
22384
|
+
_handle = handle;
|
|
22385
|
+
handle.child.once("exit", () => {
|
|
22386
|
+
if (_handle === handle) _handle = null;
|
|
22387
|
+
});
|
|
22388
|
+
registerExitHandlers();
|
|
22389
|
+
ready.then((ok) => {
|
|
22390
|
+
consola.debug(ok ? "keep-awake: holding SetThreadExecutionState assertion (system sleep prevented)" : "keep-awake: inactive (helper did not confirm — Constrained Language Mode or PowerShell unavailable)");
|
|
22391
|
+
});
|
|
22392
|
+
} catch (err) {
|
|
22393
|
+
_started = false;
|
|
22394
|
+
_handle = null;
|
|
22395
|
+
consola.debug("keep-awake: failed to start (continuing):", err);
|
|
22396
|
+
}
|
|
22397
|
+
}
|
|
22398
|
+
/**
|
|
22399
|
+
* Release the assertion / reap the helper. Idempotent; safe to `await`
|
|
22400
|
+
* from a subcommand's `onShutdown` chain. Never throws.
|
|
22401
|
+
*/
|
|
22402
|
+
async function stopKeepAwake() {
|
|
22403
|
+
releaseSync();
|
|
22404
|
+
}
|
|
22405
|
+
|
|
22163
22406
|
//#endregion
|
|
22164
22407
|
//#region src/lib/proxy.ts
|
|
22165
22408
|
function initProxyFromEnv() {
|
|
@@ -22209,7 +22452,7 @@ function initProxyFromEnv() {
|
|
|
22209
22452
|
//#endregion
|
|
22210
22453
|
//#region package.json
|
|
22211
22454
|
var name = "github-router";
|
|
22212
|
-
var version$1 = "0.3.
|
|
22455
|
+
var version$1 = "0.3.111";
|
|
22213
22456
|
|
|
22214
22457
|
//#endregion
|
|
22215
22458
|
//#region src/lib/approval.ts
|
|
@@ -24328,8 +24571,10 @@ const claude = defineCommand({
|
|
|
24328
24571
|
}
|
|
24329
24572
|
}
|
|
24330
24573
|
provisionAndIndexColbert();
|
|
24574
|
+
startKeepAwake();
|
|
24331
24575
|
if (browserToolsEnabled()) provisionBrowserAssets().catch((err) => consola.debug("Browser extension provisioning failed:", err));
|
|
24332
24576
|
const baseShutdown = async () => {
|
|
24577
|
+
await stopKeepAwake();
|
|
24333
24578
|
await removeOwnClaudeConfigMirror();
|
|
24334
24579
|
};
|
|
24335
24580
|
let onShutdown = baseShutdown;
|
|
@@ -24451,6 +24696,7 @@ const codex = defineCommand({
|
|
|
24451
24696
|
runSelfUpdate({ selfUpdate: args["self-update"] !== false });
|
|
24452
24697
|
if (toolbeltEnabled()) provisionToolbelt().catch(() => {});
|
|
24453
24698
|
provisionAndIndexColbert();
|
|
24699
|
+
startKeepAwake();
|
|
24454
24700
|
if ((state.browseEnabled || process$1.env.GH_ROUTER_ENABLE_BROWSE === "1") && hasSupportedBrowserInstalled()) provisionBrowserAssets().catch((err) => consola.debug("Browser extension provisioning failed:", err));
|
|
24455
24701
|
const usingDefault = !args.model;
|
|
24456
24702
|
const requestedModel = args.model ?? DEFAULT_CODEX_MODEL;
|
|
@@ -24882,6 +25128,7 @@ const start = defineCommand({
|
|
|
24882
25128
|
});
|
|
24883
25129
|
runSelfUpdate({ selfUpdate: args["self-update"] !== false });
|
|
24884
25130
|
provisionAndIndexColbert();
|
|
25131
|
+
startKeepAwake();
|
|
24885
25132
|
if (browserToolsEnabled()) provisionBrowserAssets().catch((err) => consola.debug("Browser extension provisioning failed:", err));
|
|
24886
25133
|
if (args.cc) generateClaudeCodeCommand(serverUrl, args.model);
|
|
24887
25134
|
if (args.cx) generateCodexCommand(serverUrl, args.model);
|