github-router 0.3.242 → 0.3.244

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.
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 3,
3
3
  "name": "github-router browser bridge",
4
4
  "short_name": "gh-router-browser",
5
- "version": "0.3.242",
5
+ "version": "0.3.244",
6
6
  "description": "Bridge between Claude (via github-router /mcp) and the browser. Implements tab control, navigation, clicks, form fill, downloads, screenshots, devtools eval. Blocks navigation to chrome://settings.",
7
7
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqJElxuBlonBS3TVW9FJN0mGTtShB3L1hoaYf6k39SOr1ogGYmF90EjRxy1i21k9wQQjPf26bcBu/9X67KrQjQV0uB38CaNukgiSeoLjfptN811u+PJHx6BP+jx3Qa6/3VenNPxHC8WEU0GXql8QSjIHEyCwKb6fMASXOK94JyB5Ywov2x8mt/+9ncqBBBMVzf6r5Sagy4PL1XnryLsuADD/vOEkPet8wXgH/Oj7v5tTsQQZ7U1JT51PoDs2BFnXc5v3TkVgZwd32k3ONh+nkDw1Hof+4zwUGOyJE6eMrlYzRlKM4Qxdf9JpavQvqfieAbTRWcyKeclnHeoIfE7cDBQIDAQAB",
8
8
  "background": {
@@ -0,0 +1,2 @@
1
+ import { W as runWorkerAgent } from "./peer-mcp-personas-B4r1LmlQ.js";
2
+ export { runWorkerAgent };
package/dist/main.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { $ as searchWeb, $t as DEFAULT_CLAUDE_MODEL_FALLBACKS, A as trustRepo, An as state, At as getTokenCount, Bt as hasSupportedBrowserInstalled, C as fileLastPromptStore, Cn as fetchWithTransientRetry, Ct as scoutModel, D as repoRoot, Dn as copilotBaseUrl, Dt as shimDefaultsToXhigh, E as repoFingerprint, En as GITHUB_API_BASE_URL, Et as workerToolsEnabled, Ft as createChatCompletions, G as buildEnv, Gt as CONDENSED_OPERATING_SEQUENCE, Ht as extractTarGzMember, It as MAX_RESPONSE_BODY_BYTES, J as toolbeltEnabled, Jt as ArtifactClient, K as availableToolCommands, Kt as DEFINITION_OF_GREATNESS, Lt as readResponseBodyCapped, M as resolveSealedGate, Mt as resolveMcpToolTimeoutMs, Nt as pickEndpoint, O as stopGateEnabledForRepo, On as copilotHeaders, Ot as countTokens, Pt as createResponses, Q as assetFor, Qt as toolbeltPathOverride, Rt as parseJsonOrDiagnose, S as fileFindingsStore, Sn as getGitHubUser, St as reviewerModel, T as isSubagentContext, Tn as forwardError, Tt as standInToolEnabled, Ut as extractZipMember, Vt as provisionAndIndexColbert, Wt as warmTreeSitterPool, X as vscodeRipgrepPath, Xt as buildWorkspaceHeaderJson, Y as toolbeltSkipSet, Yt as buildWorkspaceHeaderHelperCommand, Z as TOOLBELT_TOOLS, Zt as collapsePathKeys, _ as stopGateDisabled, _n as isNullish, _t as browserCompoundToolsEnabled, a as buildPeerAwarenessSnippet, an as generateRandomPort, at as buildAnthropicErrorEvent, b as stopReviewEnabled, bn as sleep$1, bt as geminiAvailable, c as personasFor, cn as withInstallLock, ct as logStreamError, d as buildStopHookCommand, dn as setupGitHubToken, dt as handleMcpDelete, en as DEFAULT_CODEX_MODEL, et as ADVISOR_INTERNAL_TOOL_NAME, f as captureLaunchBaseline, fn as tryRefreshAndRetry, ft as handleMcpPost, g as launchBaselineKey, gn as filterBetaHeader, gt as browseAgentEnabled, h as injectStopHookIntoSettingsFile, hn as cacheVSCodeVersion, ht as brainstormModel, i as buildAgentPrompt, in as UPSTREAM_INACTIVITY_TIMEOUT_MS, it as isAdvisorRequested, j as liveExec, jt as assembleResponsesPayload, k as stopReviewStateDir, kn as githubHeaders, kt as createMessages, l as buildArtifactOpenHookCommand, ln as setupCopilotToken, lt as readIteratorWithTimeout, m as fileBlockBudget, mn as cacheModels, mt as artifactToolsEnabled, n as MCP_GROUPS, nt as buildAdvisorStream, o as buildPeerAwarenessSummary, on as pickClaudeDefault, ot as buildOpenAIErrorEvent, p as decideStopHook, pn as cacheCopilotVersion, pt as agentToolsEnabled, q as buildToolbeltAwareness, qt as shouldUseInsecureTls, r as assertMcpToolSurfaceConsistent, rn as UPSTREAM_FETCH_TIMEOUT_MS, rt as injectAdvisorTool, s as enumerateInjectedMcpToolNames, sn as getPackageVersion$1, st as isControllerClosedError, t as GROUP_META, tn as DEFAULT_CODEX_MODEL_FALLBACKS, tt as ADVISOR_TOOL_INSTRUCTIONS, u as buildSessionBindHookCommand, un as setupGitHubAgentToken, ut as relayAnthropicStream, v as stopGateId, vn as resolveCodexModel, vt as browserToolsEnabled, w as fileReviewDebounce, wn as HTTPError, wt as scribeModel, x as fileBaselineStore, xn as getModels, xt as nativeSubagentModel, y as stopGatePlanMode, yn as resolveModel, yt as fleetToolsEnabled, zt as provisionBrowserAssets } from "./peer-mcp-personas-CPcQik2-.js";
2
+ import { $ as searchWeb, $t as DEFAULT_CLAUDE_MODEL_FALLBACKS, A as trustRepo, An as state, At as getTokenCount, Bt as hasSupportedBrowserInstalled, C as fileLastPromptStore, Cn as fetchWithTransientRetry, Ct as scoutModel, D as repoRoot, Dn as copilotBaseUrl, Dt as shimDefaultsToXhigh, E as repoFingerprint, En as GITHUB_API_BASE_URL, Et as workerToolsEnabled, Ft as createChatCompletions, G as buildEnv, Gt as CONDENSED_OPERATING_SEQUENCE, Ht as extractTarGzMember, It as MAX_RESPONSE_BODY_BYTES, J as toolbeltEnabled, Jt as ArtifactClient, K as availableToolCommands, Kt as DEFINITION_OF_GREATNESS, Lt as readResponseBodyCapped, M as resolveSealedGate, Mt as resolveMcpToolTimeoutMs, Nt as pickEndpoint, O as stopGateEnabledForRepo, On as copilotHeaders, Ot as countTokens, Pt as createResponses, Q as assetFor, Qt as toolbeltPathOverride, Rt as parseJsonOrDiagnose, S as fileFindingsStore, Sn as getGitHubUser, St as reviewerModel, T as isSubagentContext, Tn as forwardError, Tt as standInToolEnabled, Ut as extractZipMember, Vt as provisionAndIndexColbert, Wt as warmTreeSitterPool, X as vscodeRipgrepPath, Xt as buildWorkspaceHeaderJson, Y as toolbeltSkipSet, Yt as buildWorkspaceHeaderHelperCommand, Z as TOOLBELT_TOOLS, Zt as collapsePathKeys, _ as stopGateDisabled, _n as isNullish, _t as browserCompoundToolsEnabled, a as buildPeerAwarenessSnippet, an as generateRandomPort, at as buildAnthropicErrorEvent, b as stopReviewEnabled, bn as sleep$1, bt as geminiAvailable, c as personasFor, cn as withInstallLock, ct as logStreamError, d as buildStopHookCommand, dn as setupGitHubToken, dt as handleMcpDelete, en as DEFAULT_CODEX_MODEL, et as ADVISOR_INTERNAL_TOOL_NAME, f as captureLaunchBaseline, fn as tryRefreshAndRetry, ft as handleMcpPost, g as launchBaselineKey, gn as filterBetaHeader, gt as browseAgentEnabled, h as injectStopHookIntoSettingsFile, hn as cacheVSCodeVersion, ht as brainstormModel, i as buildAgentPrompt, in as UPSTREAM_INACTIVITY_TIMEOUT_MS, it as isAdvisorRequested, j as liveExec, jt as assembleResponsesPayload, k as stopReviewStateDir, kn as githubHeaders, kt as createMessages, l as buildArtifactOpenHookCommand, ln as setupCopilotToken, lt as readIteratorWithTimeout, m as fileBlockBudget, mn as cacheModels, mt as artifactToolsEnabled, n as MCP_GROUPS, nt as buildAdvisorStream, o as buildPeerAwarenessSummary, on as pickClaudeDefault, ot as buildOpenAIErrorEvent, p as decideStopHook, pn as cacheCopilotVersion, pt as agentToolsEnabled, q as buildToolbeltAwareness, qt as shouldUseInsecureTls, r as assertMcpToolSurfaceConsistent, rn as UPSTREAM_FETCH_TIMEOUT_MS, rt as injectAdvisorTool, s as enumerateInjectedMcpToolNames, sn as getPackageVersion$1, st as isControllerClosedError, t as GROUP_META, tn as DEFAULT_CODEX_MODEL_FALLBACKS, tt as ADVISOR_TOOL_INSTRUCTIONS, u as buildSessionBindHookCommand, un as setupGitHubAgentToken, ut as relayAnthropicStream, v as stopGateId, vn as resolveCodexModel, vt as browserToolsEnabled, w as fileReviewDebounce, wn as HTTPError, wt as scribeModel, x as fileBaselineStore, xn as getModels, xt as nativeSubagentModel, y as stopGatePlanMode, yn as resolveModel, yt as fleetToolsEnabled, zt as provisionBrowserAssets } from "./peer-mcp-personas-B4r1LmlQ.js";
3
3
  import { a as isUnderClaudeConfigMirror, d as writeRuntimeFileSecure, i as ensurePaths, o as removeOwnClaudeConfigMirror, r as ensureClaudeConfigMirror, t as PATHS, u as writeArtifactCredsToMirror } from "./paths-BjTMI_xK.js";
4
4
  import { c as killManagedTree, d as resolveExecutable, f as runCommandCapture, l as parseBoolEnv, p as runCommandVoid, s as killChildProcessTree, u as parseIntEnv } from "./lifecycle-DHZsVN8j.js";
5
5
  import { a as sweepRegistry } from "./lifecycle-CUf1UDrH.js";
6
- import { defineCommand, runMain } from "citty";
6
+ import { defineCommand, runMain, showUsage } from "citty";
7
7
  import consola from "consola";
8
8
  import { createHash, randomBytes, randomUUID } from "node:crypto";
9
9
  import fs, { chmod, copyFile, link, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
@@ -3087,7 +3087,7 @@ async function discoverGateCommands(cwd, opts) {
3087
3087
  if (files.length === 0) return null;
3088
3088
  let result;
3089
3089
  try {
3090
- const { runWorkerAgent } = await import("./engine-uNp8h5ia.js");
3090
+ const { runWorkerAgent } = await import("./engine-BGcK36w4.js");
3091
3091
  result = await runWorkerAgent({
3092
3092
  mode: "explore",
3093
3093
  workspace: root,
@@ -4300,7 +4300,7 @@ const STYLE_DIRECTIVE = "Write concisely without losing detail. Use a natural hu
4300
4300
  * Self-referentially compliant with the style directive: no em dashes, no
4301
4301
  * Claude / Anthropic attribution.
4302
4302
  */
4303
- const OPERATING_DEFAULTS_DIRECTIVE = "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nOrchestrate. Delegate research, implementation, review, and large reads to the right subagent, worker, or model. Reach for `implementer` when you know what to build, `reviewer` when something exists and you want it assessed (including reproducing and root-causing a failure), `brainstorm` when you do not yet know which approach to take, `scout` to find or understand something in the repo, and `scribe` for docs and ADRs that trail the code; worker-* agents for background non-blocking runs; Task subagents for parallel work; peer critics for review. That keeps your own context free to reason and collaborate with the user. Prefer parallel delegation for independent work. Do trivial, surgical, and last-mile work directly; delegate the rest rather than doing it yourself and filling your own context. Delegate to a subagent by default whenever one can do the work without loss of quality: the main thread is where you think with and respond to the user, and its context window is a finite shared resource, so protect it by pushing heavy or exploratory work outward and keeping only the conclusions.\n\nAim high. Default to radical simplicity and a relentless focus on the user's real experience: design for the person and the job to be done, not the demo. Reason about the whole system from first principles, anticipating scale and the long arc rather than patching the surface. Work backwards from the outcome the user actually needs. Question every assumption and prefer what you can derive, reproduce, or test.\n\nEngineering excellence. When making technical decisions, give little weight to development cost; prefer quality, simplicity, robustness, scalability, and long-term maintainability. Fix a bug by first reproducing it end to end, as close to how a real user hits it as you can, so you solve the real problem and not a symptom. When testing a product end to end, be picky about the UI and obsessed with pixel perfection: if something clearly looks off, even when it is unrelated to your task, get it fixed along the way. Hold that same bar for the codebase itself: a lint error, a failing test, or a flaky test is worth fixing the moment you see it, whoever introduced it. Fold it into your current work rather than letting it derail the task the user actually asked for.";
4303
+ const OPERATING_DEFAULTS_DIRECTIVE = "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nOrchestrate. Delegate research, implementation, review, and large reads to the right subagent, worker, or model. Reach for `implementer` when you know what to build, `reviewer` when something exists and you want it assessed (including reproducing and root-causing a failure), `brainstorm` when you do not yet know which approach to take, `scout` to find or understand something in the repo, and `scribe` for docs and ADRs that trail the code; worker-* agents for background non-blocking runs; Task subagents for parallel work; peer critics for review. That keeps your own context free to reason and collaborate with the user. Prefer parallel delegation for independent work. Delegation pays when the work is WIDE (many files or sources to sweep) or SLOW, and you need only the conclusion: the main thread is where you think with and respond to the user, and its context window is a finite shared resource. It does NOT pay merely because a sub-question is separable. A narrow, deep question whose whole value is file:line fidelity loses exactly that through a summarization layer, and a sub-question you could answer in one command is cheaper done directly than paying a subagent's startup. Do trivial, surgical, and last-mile work yourself.\n\nAim high. Default to radical simplicity and a relentless focus on the user's real experience: design for the person and the job to be done, not the demo. Reason about the whole system from first principles, anticipating scale and the long arc rather than patching the surface. Work backwards from the outcome the user actually needs. Question every assumption and prefer what you can derive, reproduce, or test.\n\nEngineering excellence. When making technical decisions, give little weight to development cost; prefer quality, simplicity, robustness, scalability, and long-term maintainability. Fix a bug by first reproducing it end to end, as close to how a real user hits it as you can, so you solve the real problem and not a symptom. When testing a product end to end, be picky about the UI and obsessed with pixel perfection: if something clearly looks off, even when it is unrelated to your task, get it fixed along the way. Hold that same bar for the codebase itself: a lint error, a failing test, or a flaky test is worth fixing the moment you see it, whoever introduced it. Fold it into your current work rather than letting it derail the task the user actually asked for.";
4304
4304
  /**
4305
4305
  * Condensed digest of OPERATING_DEFAULTS_DIRECTIVE for the spawned session's
4306
4306
  * system prompt (--append-system-prompt). The FULL directive is prepended to
@@ -4308,7 +4308,7 @@ const OPERATING_DEFAULTS_DIRECTIVE = "## Operating defaults (apply when the user
4308
4308
  * keeps both behavioral directives at top salience without duplicating the full
4309
4309
  * ~310-token block in the context window every turn. Points to the full copy.
4310
4310
  */
4311
- const OPERATING_DEFAULTS_DIGEST = "## Operating defaults (the user's explicit direction and the domain's standards always override)\n\nOrchestrate: delegate research, implementation, review, and large reads to the right subagent, worker, or model by default wherever one can do the work without losing quality, preferring parallel delegation for independent work, to protect the main thread's finite context and keep it free for reasoning and interacting with the user; do trivial, surgical, and last-mile work directly. Aim high: default to radical simplicity and the user's real experience, whole-system first-principles thinking that anticipates scale and the long arc, and working backwards from the outcome the user actually needs; question every assumption and prefer what you can derive, reproduce, or test. Engineering excellence: prefer quality and long-term maintainability over dev cost; reproduce bugs end to end before fixing; keep a pixel-perfect UI bar; fix any lint, test failure, or flake on sight without letting it derail the task at hand. The full statement of these defaults is in your CLAUDE.md project instructions.";
4311
+ const OPERATING_DEFAULTS_DIGEST = "## Operating defaults (the user's explicit direction and the domain's standards always override)\n\nOrchestrate: delegate research, implementation, review, and large reads to the right subagent, worker, or model when the work is WIDE (many files or sources to sweep) or SLOW and you need only the conclusion, preferring parallel delegation for independent work, to protect the main thread's finite context and keep it free for reasoning and interacting with the user; not merely because a sub-question is separable — a narrow, deep question whose value is file:line fidelity loses that through a summarization layer, and one answerable in a single command is cheaper done directly. Do trivial, surgical, and last-mile work yourself. Aim high: default to radical simplicity and the user's real experience, whole-system first-principles thinking that anticipates scale and the long arc, and working backwards from the outcome the user actually needs; question every assumption and prefer what you can derive, reproduce, or test. Engineering excellence: prefer quality and long-term maintainability over dev cost; reproduce bugs end to end before fixing; keep a pixel-perfect UI bar; fix any lint, test failure, or flake on sight without letting it derail the task at hand. The full statement of these defaults is in your CLAUDE.md project instructions.";
4312
4312
  /**
4313
4313
  * Skip the helper if the user's `~/.claude/CLAUDE.md` (or, equivalently,
4314
4314
  * the would-be post-write file) has grown past this size.
@@ -5538,7 +5538,7 @@ function initProxyFromEnv() {
5538
5538
  //#endregion
5539
5539
  //#region package.json
5540
5540
  var name = "github-router";
5541
- var version$1 = "0.3.242";
5541
+ var version$1 = "0.3.244";
5542
5542
  //#endregion
5543
5543
  //#region src/lib/approval.ts
5544
5544
  const awaitApproval = async () => {
@@ -8782,6 +8782,25 @@ server.notFound((c) => c.json({
8782
8782
  //#endregion
8783
8783
  //#region src/lib/server-setup.ts
8784
8784
  const MAX_PORT_RETRIES = 10;
8785
+ /**
8786
+ * Build the srvx `serve()` options shared by the explicit-port and
8787
+ * random-port paths.
8788
+ *
8789
+ * Extracted and exported so the Bun idle-reaper override below is
8790
+ * assertable. `setupAndServe` itself performs auth and network I/O, so the
8791
+ * only way to pin this behaviour in a test is to make the options object
8792
+ * reachable on its own — and it needs pinning, because deleting the override
8793
+ * reintroduces a failure that looks like an upstream/network problem rather
8794
+ * than a config one.
8795
+ */
8796
+ function buildServeOptions(fetchHandler, silent) {
8797
+ return {
8798
+ fetch: fetchHandler,
8799
+ hostname: "127.0.0.1",
8800
+ silent,
8801
+ bun: { idleTimeout: 0 }
8802
+ };
8803
+ }
8785
8804
  async function setupAndServe(options) {
8786
8805
  if (options.proxyEnv) initProxyFromEnv();
8787
8806
  if (options.verbose) {
@@ -8815,11 +8834,7 @@ async function setupAndServe(options) {
8815
8834
  await setupCopilotToken();
8816
8835
  await cacheModels();
8817
8836
  consola.debug(`Available models: \n${state.models?.data.map((model) => `- ${model.id}`).join("\n")}`);
8818
- const serveOptions = {
8819
- fetch: server.fetch,
8820
- hostname: "127.0.0.1",
8821
- silent: options.silent
8822
- };
8837
+ const serveOptions = buildServeOptions(server.fetch, options.silent);
8823
8838
  let srvxServer;
8824
8839
  if (options.port !== void 0) srvxServer = serve({
8825
8840
  ...serveOptions,
@@ -12689,7 +12704,49 @@ const main = defineCommand({
12689
12704
  "internal-worker-guard": internalWorkerGuard
12690
12705
  }
12691
12706
  });
12692
- await runMain(main);
12707
+ /**
12708
+ * Print usage ourselves and let the process DRAIN, instead of letting citty
12709
+ * hard-exit while stdout is still queued.
12710
+ *
12711
+ * citty's `runMain` calls `process.exit(0)` immediately after `showUsage`
12712
+ * resolves (citty 0.2.2 dist/index.mjs:389; 0.1.6 does the same, so this is
12713
+ * not an upgrade regression). On Windows a PIPE-backed stdout is async, so the
12714
+ * usage text is still in a libuv handle when the hard exit tears the loop down
12715
+ * and node aborts:
12716
+ * `Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), file src\win\async.c`
12717
+ * — after printing the help the user asked for.
12718
+ *
12719
+ * `--version` is unaffected: citty's version branch has no `process.exit()`
12720
+ * and drains naturally. That asymmetry is why this survived so long — the
12721
+ * cheapest smoke test passes while every `--help` path aborts. Node 22 on
12722
+ * Windows tolerated it; node 24 does not, and release.yml publishes with
12723
+ * node 24.
12724
+ *
12725
+ * Forcing `_handle.setBlocking(true)` first was tried and does NOT fix it —
12726
+ * the abort still reproduces through a pipe. The only reliable fix is to not
12727
+ * hard-exit at all, which is the same resolution the internal hooks already
12728
+ * use (`process.exitCode = 0`, never `process.exit()`), guarded by the tests
12729
+ * in this repo's internal-hooks-crash suite.
12730
+ *
12731
+ * Only the help path is intercepted; everything else still goes through citty
12732
+ * so argument parsing, subcommand dispatch and error handling stay citty's.
12733
+ */
12734
+ const HELP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h"]);
12735
+ async function resolveHelpTarget() {
12736
+ const name = argv.find((arg) => !arg.startsWith("-"));
12737
+ const table = main.subCommands;
12738
+ const entry = name ? table?.[name] : void 0;
12739
+ if (!entry) return { cmd: main };
12740
+ return {
12741
+ cmd: typeof entry === "function" ? await entry() : await entry,
12742
+ parent: main
12743
+ };
12744
+ }
12745
+ if (argv.some((arg) => HELP_FLAGS.has(arg))) {
12746
+ const { cmd, parent } = await resolveHelpTarget();
12747
+ await showUsage(cmd, parent);
12748
+ process.exitCode = 0;
12749
+ } else await runMain(main);
12693
12750
  //#endregion
12694
12751
  export {};
12695
12752