github-router 0.3.131 → 0.3.135

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.
@@ -1,6 +1,6 @@
1
- import { t as PATHS } from "./paths-CNgpeaWd.js";
2
- import { d as runCommandCapture, l as parseBoolEnv, n as isPidAlive, o as trackChild, p as runManagedExeCapture, r as registerColbertExitHandlers, t as getColbertInstanceUuid, u as resolveExecutable } from "./lifecycle-DTJ2Ugqf.js";
3
- import { i as registerExitHandlers, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-Cyxwmj1c.js";
1
+ import { t as PATHS } from "./paths-Cn5OzmYL.js";
2
+ import { d as runCommandCapture, l as parseBoolEnv, n as isPidAlive, o as trackChild, p as runManagedExeCapture, r as registerColbertExitHandlers, t as getColbertInstanceUuid, u as resolveExecutable } from "./lifecycle-Cqe8OQVX.js";
3
+ import { i as registerExitHandlers, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-CeVDX6av.js";
4
4
  import { createRequire } from "node:module";
5
5
  import consola from "consola";
6
6
  import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
@@ -1047,6 +1047,24 @@ function collapsePathKeys(env) {
1047
1047
  return env;
1048
1048
  }
1049
1049
 
1050
+ //#endregion
1051
+ //#region src/lib/insecure-tls.ts
1052
+ const IS_BUN = typeof globalThis.Bun !== "undefined";
1053
+ let sharedInsecureDispatcher;
1054
+ function insecureDispatcher() {
1055
+ return sharedInsecureDispatcher ??= new Agent({ connect: { rejectUnauthorized: false } });
1056
+ }
1057
+ /**
1058
+ * Attach the runtime-correct TLS-verification-off mechanism to a fetch init for a
1059
+ * single self-signed direct-HTTPS instance: Bun → `tls`, Node → an undici
1060
+ * `dispatcher`. Exported so BOTH runtime branches are unit-testable under one
1061
+ * interpreter (the untested Node branch is exactly what shipped broken).
1062
+ */
1063
+ function applyInsecureTls(init, isBun = IS_BUN) {
1064
+ if (isBun) init.tls = { rejectUnauthorized: false };
1065
+ else init.dispatcher = insecureDispatcher();
1066
+ }
1067
+
1050
1068
  //#endregion
1051
1069
  //#region src/lib/artifact/client.ts
1052
1070
  var ArtifactError = class extends Error {
@@ -1068,11 +1086,13 @@ var ArtifactClient = class {
1068
1086
  token;
1069
1087
  sessionId;
1070
1088
  fetchFn;
1089
+ insecureTLS;
1071
1090
  constructor(options) {
1072
1091
  this.baseUrl = options.baseUrl.replace(/\/+$/, "");
1073
1092
  this.token = options.token;
1074
1093
  this.sessionId = options.sessionId;
1075
1094
  this.fetchFn = options.fetchFn ?? globalThis.fetch.bind(globalThis);
1095
+ this.insecureTLS = options.insecureTLS ?? false;
1076
1096
  }
1077
1097
  open(file, signal) {
1078
1098
  return this.request("POST", `/api/artifact/${encodeURIComponent(this.sessionId)}/open`, { file }, signal);
@@ -1101,7 +1121,7 @@ var ArtifactClient = class {
1101
1121
  const timeout = combineSignalAndTimeout(signal, timeoutMsHint);
1102
1122
  let response;
1103
1123
  try {
1104
- response = await this.fetchFn(url.toString(), {
1124
+ const init = {
1105
1125
  method,
1106
1126
  headers: {
1107
1127
  Authorization: `Bearer ${this.token}`,
@@ -1110,7 +1130,9 @@ var ArtifactClient = class {
1110
1130
  body: body === void 0 ? void 0 : JSON.stringify(body),
1111
1131
  redirect: "error",
1112
1132
  signal: timeout.signal
1113
- });
1133
+ };
1134
+ if (this.insecureTLS) applyInsecureTls(init);
1135
+ response = await this.fetchFn(url.toString(), init);
1114
1136
  } catch (err) {
1115
1137
  throw mapNetworkError$1(err);
1116
1138
  } finally {
@@ -1308,10 +1330,29 @@ function readArtifactEnv() {
1308
1330
  return {
1309
1331
  baseUrl,
1310
1332
  token,
1311
- sessionId
1333
+ sessionId,
1334
+ insecureTLS: shouldUseInsecureTls(baseUrl)
1312
1335
  };
1313
1336
  }
1337
+ function shouldUseInsecureTls(baseUrl) {
1338
+ let url;
1339
+ try {
1340
+ url = new URL(baseUrl);
1341
+ } catch {
1342
+ return false;
1343
+ }
1344
+ if (url.protocol !== "https:") return false;
1345
+ const explicit = (process.env.AIORDIE_INSECURE_TLS ?? "").trim().toLowerCase();
1346
+ if (explicit === "0" || explicit === "false" || explicit === "off") return false;
1347
+ if (isLoopbackIp(url.hostname)) return true;
1348
+ return url.hostname === "localhost" && (explicit === "1" || explicit === "true");
1349
+ }
1350
+ function isLoopbackIp(hostname) {
1351
+ const host = hostname.replace(/^\[|\]$/g, "");
1352
+ return host === "::1" || /^127(?:\.\d{1,3}){3}$/.test(host);
1353
+ }
1314
1354
  function clientFromEnv(env) {
1355
+ consola.debug(`ARTIFACT_ENV: token present=${env.token.length > 0}, insecureTLS=${env.insecureTLS}`);
1315
1356
  return new ArtifactClient(env);
1316
1357
  }
1317
1358
  async function pollUntilReady(client, signal) {
@@ -1644,21 +1685,6 @@ function createTunnelTokenProvider(runner = realDevtunnelRunner()) {
1644
1685
 
1645
1686
  //#endregion
1646
1687
  //#region src/lib/fleet/client.ts
1647
- const IS_BUN = typeof globalThis.Bun !== "undefined";
1648
- let sharedInsecureDispatcher;
1649
- function insecureDispatcher() {
1650
- return sharedInsecureDispatcher ??= new Agent({ connect: { rejectUnauthorized: false } });
1651
- }
1652
- /**
1653
- * Attach the runtime-correct TLS-verification-off mechanism to a fetch init for a
1654
- * single self-signed direct-HTTPS instance: Bun → `tls`, Node → an undici
1655
- * `dispatcher`. Exported so BOTH runtime branches are unit-testable under one
1656
- * interpreter (the untested Node branch is exactly what shipped broken).
1657
- */
1658
- function applyInsecureTls(init, isBun = IS_BUN) {
1659
- if (isBun) init.tls = { rejectUnauthorized: false };
1660
- else init.dispatcher = insecureDispatcher();
1661
- }
1662
1688
  var FleetError = class extends Error {
1663
1689
  code;
1664
1690
  retryable;
@@ -8420,7 +8446,7 @@ function logAudit$1(record) {
8420
8446
  try {
8421
8447
  const fs$2 = await import("node:fs/promises");
8422
8448
  const path$1 = await import("node:path");
8423
- const { PATHS: PATHS$1 } = await import("./paths-B-ATynF7.js");
8449
+ const { PATHS: PATHS$1 } = await import("./paths-Bljq3UJC.js");
8424
8450
  const dir = path$1.join(PATHS$1.APP_DIR, "browser-mcp");
8425
8451
  await fs$2.mkdir(dir, { recursive: true });
8426
8452
  const line = JSON.stringify({
@@ -20699,7 +20725,7 @@ function entryHasCommand(entry, command) {
20699
20725
  * other entries. Returns a new object (never mutates the input). Re-running the
20700
20726
  * launcher with the same command+event does not duplicate the hook.
20701
20727
  */
20702
- function mergeStopHookIntoSettings(existing, command, event = "Stop", timeoutSec) {
20728
+ function mergeStopHookIntoSettings(existing, command, event = "Stop", timeoutSec, matcher) {
20703
20729
  const base = existing && typeof existing === "object" ? { ...existing } : {};
20704
20730
  const hooks = base.hooks && typeof base.hooks === "object" ? { ...base.hooks } : {};
20705
20731
  const arr = Array.isArray(hooks[event]) ? [...hooks[event]] : [];
@@ -20709,7 +20735,10 @@ function mergeStopHookIntoSettings(existing, command, event = "Stop", timeoutSec
20709
20735
  command
20710
20736
  };
20711
20737
  if (typeof timeoutSec === "number" && Number.isFinite(timeoutSec) && timeoutSec > 0) hook.timeout = timeoutSec;
20712
- arr.push({ hooks: [hook] });
20738
+ arr.push(matcher ? {
20739
+ matcher,
20740
+ hooks: [hook]
20741
+ } : { hooks: [hook] });
20713
20742
  }
20714
20743
  hooks[event] = arr;
20715
20744
  base.hooks = hooks;
@@ -20915,6 +20944,12 @@ function buildSessionBindHookCommand(execPath, scriptPath, outPath) {
20915
20944
  const q = (s) => `"${s}"`;
20916
20945
  return `${scriptPath && scriptPath !== execPath ? `${q(execPath)} ${q(scriptPath)}` : q(execPath)} internal-session-bind --out ${q(outPath)}`;
20917
20946
  }
20947
+ /** Command for the `internal-artifact-open` hook (no args — token comes from the
20948
+ * mirror creds file, plan from the plans dir; nothing secret in argv). */
20949
+ function buildArtifactOpenHookCommand(execPath, scriptPath) {
20950
+ const q = (s) => `"${s}"`;
20951
+ return `${scriptPath && scriptPath !== execPath ? `${q(execPath)} ${q(scriptPath)}` : q(execPath)} internal-artifact-open`;
20952
+ }
20918
20953
  /**
20919
20954
  * Read-merge-atomic-write the Stop hook into a Claude Code `settings.json` file
20920
20955
  * (the mirrored one). A MISSING file (ENOENT) starts from `{}`; any OTHER read or
@@ -20923,7 +20958,7 @@ function buildSessionBindHookCommand(execPath, scriptPath, outPath) {
20923
20958
  * other setting, is idempotent, and uses temp+rename so Claude Code's mtime
20924
20959
  * watcher never sees a half-written file. Returns the merged object.
20925
20960
  */
20926
- async function injectStopHookIntoSettingsFile(settingsPath, command, event = "Stop", timeoutSec) {
20961
+ async function injectStopHookIntoSettingsFile(settingsPath, command, event = "Stop", timeoutSec, matcher) {
20927
20962
  let existing = {};
20928
20963
  let raw;
20929
20964
  try {
@@ -20937,7 +20972,7 @@ async function injectStopHookIntoSettingsFile(settingsPath, command, event = "St
20937
20972
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) existing = parsed;
20938
20973
  else throw new Error(`settings.json at ${settingsPath} is not a JSON object; refusing to overwrite`);
20939
20974
  }
20940
- const merged = mergeStopHookIntoSettings(existing, command, event, timeoutSec);
20975
+ const merged = mergeStopHookIntoSettings(existing, command, event, timeoutSec, matcher);
20941
20976
  const tmp = `${settingsPath}.${process.pid}.tmp`;
20942
20977
  await promises.writeFile(tmp, `${JSON.stringify(merged, null, 2)}\n`, { mode: 384 });
20943
20978
  await promises.rename(tmp, settingsPath);
@@ -22705,5 +22740,5 @@ async function runStandInToolCall(args, signal) {
22705
22740
  }
22706
22741
 
22707
22742
  //#endregion
22708
- export { relayAnthropicStream as $, IMPLEMENT_DEFAULT_MODEL as A, withInstallLock as At, vscodeRipgrepPath as B, resolveModel as Bt, stopGateEnabledForRepo as C, DEFAULT_CODEX_MODEL_FALLBACKS as Ct, liveExec as D, generateRandomPort as Dt, resolveSealedGate as E, UPSTREAM_INACTIVITY_TIMEOUT_MS as Et, withNoOutputRetry as F, cacheModels as Ft, ADVISOR_TOOL_INSTRUCTIONS as G, forwardError as Gt, assetFor as H, getModels as Ht, availableToolCommands as I, cacheVSCodeVersion as It, isAdvisorRequested as J, copilotHeaders as Jt, buildAdvisorStream as K, GITHUB_API_BASE_URL as Kt, buildToolbeltAwareness as L, filterBetaHeader as Lt, REVIEW_DEFAULT_MODEL as M, setupGitHubToken as Mt, appendPlanReminder as N, tryRefreshAndRetry as Nt, BROWSE_DEFAULT_MODEL as O, pickClaudeDefault as Ot, runWorkerAgent as P, cacheCopilotVersion as Pt, readIteratorWithTimeout as Q, toolbeltEnabled as R, isNullish as Rt, repoRoot as S, DEFAULT_CODEX_MODEL as St, trustRepo as T, UPSTREAM_FETCH_TIMEOUT_MS as Tt, searchWeb as U, fetchWithTransientRetry as Ut, TOOLBELT_TOOLS$1 as V, sleep as Vt, ADVISOR_INTERNAL_TOOL_NAME as W, HTTPError as Wt, isControllerClosedError as X, state as Xt, buildOpenAIErrorEvent as Y, githubHeaders as Yt, logStreamError as Z, fileFindingsStore as _, extractTarGzMember as _t, buildPeerAwarenessSnippet as a, workerToolsEnabled as at, isSubagentContext as b, toolbeltPathOverride as bt, buildStopHookCommand as c, getTokenCount as ct, fileBlockBudget as d, MAX_RESPONSE_BODY_BYTES as dt, handleMcpDelete as et, injectStopHookIntoSettingsFile as f, readResponseBodyCapped as ft, fileBaselineStore as g, provisionAndIndexColbert as gt, stopReviewEnabled as h, hasSupportedBrowserInstalled as ht, buildAgentPrompt as i, standInToolEnabled as it, PLAN_DEFAULT_MODEL as j, setupCopilotToken as jt, DEFAULT_MODEL as k, getPackageVersion as kt, captureLaunchBaseline as l, createResponses as lt, stopGateId as m, provisionBrowserAssets as mt, MCP_GROUPS as n, browserToolsEnabled as nt, personasFor as o, countTokens as ot, launchBaselineKey as p, parseJsonOrDiagnose as pt, injectAdvisorTool as q, copilotBaseUrl as qt, assertMcpToolSurfaceConsistent as r, fleetToolsEnabled as rt, buildSessionBindHookCommand as s, createMessages as st, GROUP_META as t, handleMcpPost as tt, decideStopHook as u, createChatCompletions as ut, fileLastPromptStore as v, extractZipMember as vt, stopReviewStateDir as w, DEFAULT_PORT as wt, repoFingerprint as x, DEFAULT_CLAUDE_MODEL_FALLBACKS as xt, fileReviewDebounce as y, collapsePathKeys as yt, toolbeltSkipSet as z, resolveCodexModel as zt };
22709
- //# sourceMappingURL=peer-mcp-personas-CH2gmdPN.js.map
22743
+ export { readIteratorWithTimeout as $, state as $t, DEFAULT_MODEL as A, generateRandomPort as At, toolbeltSkipSet as B, filterBetaHeader as Bt, repoRoot as C, toolbeltPathOverride as Ct, resolveSealedGate as D, DEFAULT_PORT as Dt, trustRepo as E, DEFAULT_CODEX_MODEL_FALLBACKS as Et, runWorkerAgent as F, setupGitHubToken as Ft, ADVISOR_INTERNAL_TOOL_NAME as G, getModels as Gt, TOOLBELT_TOOLS$1 as H, resolveCodexModel as Ht, withNoOutputRetry as I, tryRefreshAndRetry as It, injectAdvisorTool as J, forwardError as Jt, ADVISOR_TOOL_INSTRUCTIONS as K, fetchWithTransientRetry as Kt, availableToolCommands as L, cacheCopilotVersion as Lt, PLAN_DEFAULT_MODEL as M, getPackageVersion as Mt, REVIEW_DEFAULT_MODEL as N, withInstallLock as Nt, liveExec as O, UPSTREAM_FETCH_TIMEOUT_MS as Ot, appendPlanReminder as P, setupCopilotToken as Pt, logStreamError as Q, githubHeaders as Qt, buildToolbeltAwareness as R, cacheModels as Rt, repoFingerprint as S, collapsePathKeys as St, stopReviewStateDir as T, DEFAULT_CODEX_MODEL as Tt, assetFor as U, resolveModel as Ut, vscodeRipgrepPath as V, isNullish as Vt, searchWeb as W, sleep as Wt, buildOpenAIErrorEvent as X, copilotBaseUrl as Xt, isAdvisorRequested as Y, GITHUB_API_BASE_URL as Yt, isControllerClosedError as Z, copilotHeaders as Zt, fileBaselineStore as _, provisionAndIndexColbert as _t, buildPeerAwarenessSnippet as a, standInToolEnabled as at, fileReviewDebounce as b, shouldUseInsecureTls as bt, buildSessionBindHookCommand as c, createMessages as ct, decideStopHook as d, createChatCompletions as dt, relayAnthropicStream as et, fileBlockBudget as f, MAX_RESPONSE_BODY_BYTES as ft, stopReviewEnabled as g, hasSupportedBrowserInstalled as gt, stopGateId as h, provisionBrowserAssets as ht, buildAgentPrompt as i, fleetToolsEnabled as it, IMPLEMENT_DEFAULT_MODEL as j, pickClaudeDefault as jt, BROWSE_DEFAULT_MODEL as k, UPSTREAM_INACTIVITY_TIMEOUT_MS as kt, buildStopHookCommand as l, getTokenCount as lt, launchBaselineKey as m, parseJsonOrDiagnose as mt, MCP_GROUPS as n, handleMcpPost as nt, personasFor as o, workerToolsEnabled as ot, injectStopHookIntoSettingsFile as p, readResponseBodyCapped as pt, buildAdvisorStream as q, HTTPError as qt, assertMcpToolSurfaceConsistent as r, browserToolsEnabled as rt, buildArtifactOpenHookCommand as s, countTokens as st, GROUP_META as t, handleMcpDelete as tt, captureLaunchBaseline as u, createResponses as ut, fileFindingsStore as v, extractTarGzMember as vt, stopGateEnabledForRepo as w, DEFAULT_CLAUDE_MODEL_FALLBACKS as wt, isSubagentContext as x, ArtifactClient as xt, fileLastPromptStore as y, extractZipMember as yt, toolbeltEnabled as z, cacheVSCodeVersion as zt };
22744
+ //# sourceMappingURL=peer-mcp-personas-ClyKATAD.js.map