github-router 0.3.241 → 0.3.243

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.241",
5
+ "version": "0.3.243",
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-r_UmLBkJ.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-DL15-epb.js");
3090
+ const { runWorkerAgent } = await import("./engine-BGcK36w4.js");
3091
3091
  result = await runWorkerAgent({
3092
3092
  mode: "explore",
3093
3093
  workspace: root,
@@ -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.241";
5541
+ var version$1 = "0.3.243";
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,
@@ -8919,7 +8934,7 @@ const sharedServerArgs = {
8919
8934
  browse: {
8920
8935
  type: "boolean",
8921
8936
  default: false,
8922
- description: "Enable the browser-control MCP tools (browser_open_tab, browser_screenshot, browser_click, etc.) on /mcp. Requires Chrome or Edge installed; the bundled extension must be loaded on first tool call (the proxy returns install_required with Web Store URLs + a Load Unpacked fallback path). Off by default; can also be enabled with GH_ROUTER_ENABLE_BROWSE=1."
8937
+ description: "Enable the browser-control MCP tools (browser_open_tab, browser_screenshot, browser_click, etc.) on /mcp. Requires Chrome or Edge installed; the bundled extension must be loaded on first tool call (the proxy returns install_required with a Load Unpacked path and the expected extension ID). Off by default; can also be enabled with GH_ROUTER_ENABLE_BROWSE=1."
8923
8938
  },
8924
8939
  fleet: {
8925
8940
  type: "boolean",
@@ -9381,9 +9396,10 @@ const claude = defineCommand({
9381
9396
  const inCache = (slug) => state.models?.data.some((m) => m.id === resolveModel(slug)) ?? false;
9382
9397
  if (!inCache(chosenSlug)) {
9383
9398
  for (const fallback of DEFAULT_CLAUDE_MODEL_FALLBACKS) if (inCache(fallback)) {
9384
- consola.info(`Default model "${chosenSlug}" not in your Copilot model list; falling back to "${fallback}".`);
9385
- chosenSlug = fallback;
9386
- resolvedSlug = resolveModel(fallback);
9399
+ const fallbackSlug = pickClaudeDefault(fallback.replace(/^claude-opus-/, ""));
9400
+ consola.info(`Default model "${chosenSlug}" not in your Copilot model list; falling back to "${fallbackSlug}".`);
9401
+ chosenSlug = fallbackSlug;
9402
+ resolvedSlug = resolveModel(fallbackSlug);
9387
9403
  break;
9388
9404
  }
9389
9405
  }
@@ -12688,7 +12704,49 @@ const main = defineCommand({
12688
12704
  "internal-worker-guard": internalWorkerGuard
12689
12705
  }
12690
12706
  });
12691
- 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);
12692
12750
  //#endregion
12693
12751
  export {};
12694
12752