github-router 0.3.261 → 0.3.269

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.
Files changed (78) hide show
  1. package/dist/{attribution-settings-Bl0HHJQF.js → attribution-settings-B1txv_Lk.js} +4 -4
  2. package/dist/{attribution-settings-Bl0HHJQF.js.map → attribution-settings-B1txv_Lk.js.map} +1 -1
  3. package/dist/{auth-I8k2OOvA.js → auth-r-my7efo.js} +3 -3
  4. package/dist/{auth-I8k2OOvA.js.map → auth-r-my7efo.js.map} +1 -1
  5. package/dist/browser-bridge/index.js +67 -27
  6. package/dist/browser-ext/manifest.json +1 -1
  7. package/dist/{check-usage-SOn7-cWc.js → check-usage-CZr2ZkG0.js} +4 -4
  8. package/dist/{check-usage-SOn7-cWc.js.map → check-usage-CZr2ZkG0.js.map} +1 -1
  9. package/dist/{claude-CEaI47j7.js → claude-BjNY0J6e.js} +15 -15
  10. package/dist/{claude-CEaI47j7.js.map → claude-BjNY0J6e.js.map} +1 -1
  11. package/dist/{codex-C6Eyz3EV.js → codex-CoRWpkHL.js} +5 -6
  12. package/dist/{codex-C6Eyz3EV.js.map → codex-CoRWpkHL.js.map} +1 -1
  13. package/dist/{debug-vshv4nIv.js → debug-CuuxCk_J.js} +2 -2
  14. package/dist/{debug-vshv4nIv.js.map → debug-CuuxCk_J.js.map} +1 -1
  15. package/dist/engine-DpVC7HRL.js +2 -0
  16. package/dist/{exec-DTO2oin0.js → exec-y8C_MU8A.js} +89 -18
  17. package/dist/exec-y8C_MU8A.js.map +1 -0
  18. package/dist/{gate-discovery-BnPhH_AC.js → gate-discovery-D-7oua8b.js} +6 -6
  19. package/dist/{gate-discovery-BnPhH_AC.js.map → gate-discovery-D-7oua8b.js.map} +1 -1
  20. package/dist/{get-copilot-usage-CYpAsYrM.js → get-copilot-usage-CFEpeA7E.js} +2 -2
  21. package/dist/{get-copilot-usage-CYpAsYrM.js.map → get-copilot-usage-CFEpeA7E.js.map} +1 -1
  22. package/dist/{internal-artifact-open-CZGO831M.js → internal-artifact-open-CDqPfegE.js} +2 -2
  23. package/dist/{internal-artifact-open-CZGO831M.js.map → internal-artifact-open-CDqPfegE.js.map} +1 -1
  24. package/dist/{internal-plan-review-6gkcOAjT.js → internal-plan-review-CH9qTHoZ.js} +3 -3
  25. package/dist/{internal-plan-review-6gkcOAjT.js.map → internal-plan-review-CH9qTHoZ.js.map} +1 -1
  26. package/dist/{internal-prompt-submit-CSJR24-y.js → internal-prompt-submit-Bve1s4z_.js} +5 -5
  27. package/dist/{internal-prompt-submit-CSJR24-y.js.map → internal-prompt-submit-Bve1s4z_.js.map} +1 -1
  28. package/dist/{internal-session-bind-DtSBTkQe.js → internal-session-bind-Cc8bMXHK.js} +2 -2
  29. package/dist/{internal-session-bind-DtSBTkQe.js.map → internal-session-bind-Cc8bMXHK.js.map} +1 -1
  30. package/dist/{internal-stop-hook-CiflCJO-.js → internal-stop-hook-Db5o9RcZ.js} +6 -6
  31. package/dist/{internal-stop-hook-CiflCJO-.js.map → internal-stop-hook-Db5o9RcZ.js.map} +1 -1
  32. package/dist/{internal-stop-review-_1Mqz7eT.js → internal-stop-review-CWE7_QVv.js} +2 -2
  33. package/dist/{internal-stop-review-_1Mqz7eT.js.map → internal-stop-review-CWE7_QVv.js.map} +1 -1
  34. package/dist/{lifecycle-DjC9tC1A.js → lifecycle-0XrazT05.js} +2 -2
  35. package/dist/{lifecycle-DjC9tC1A.js.map → lifecycle-0XrazT05.js.map} +1 -1
  36. package/dist/lifecycle-2M0IThRr.js +2 -0
  37. package/dist/{lifecycle-Bd1Fyf4B.js → lifecycle-AgNOtFRv.js} +3 -3
  38. package/dist/{lifecycle-Bd1Fyf4B.js.map → lifecycle-AgNOtFRv.js.map} +1 -1
  39. package/dist/lifecycle-C8kFsAj-.js +2 -0
  40. package/dist/main.js +14 -14
  41. package/dist/{models-uQgsKNNC.js → models-CJLt4XjP.js} +35 -30
  42. package/dist/models-CJLt4XjP.js.map +1 -0
  43. package/dist/{orchestration-BiZviyam.js → orchestration-B_Q3ncXI.js} +3 -3
  44. package/dist/{orchestration-BiZviyam.js.map → orchestration-B_Q3ncXI.js.map} +1 -1
  45. package/dist/paths-BbHtQAOs.js +2 -0
  46. package/dist/{paths-BXrbboAS.js → paths-Bg1_DWhi.js} +3 -3
  47. package/dist/{paths-BXrbboAS.js.map → paths-Bg1_DWhi.js.map} +1 -1
  48. package/dist/{peer-mcp-personas-V4AXhm9B.js → peer-mcp-personas-DSbBlgFt.js} +119 -45
  49. package/dist/peer-mcp-personas-DSbBlgFt.js.map +1 -0
  50. package/dist/{plan-review-hook-Bo4y1r3j.js → plan-review-hook-BKOcW5s4.js} +3 -3
  51. package/dist/{plan-review-hook-Bo4y1r3j.js.map → plan-review-hook-BKOcW5s4.js.map} +1 -1
  52. package/dist/{prompt-submit-hook-BFRFLSk5.js → prompt-submit-hook-F7Zih_au.js} +2 -2
  53. package/dist/{prompt-submit-hook-BFRFLSk5.js.map → prompt-submit-hook-F7Zih_au.js.map} +1 -1
  54. package/dist/{provision-BLwsOFCI.js → provision-CA-xwnFu.js} +5 -5
  55. package/dist/{provision-BLwsOFCI.js.map → provision-CA-xwnFu.js.map} +1 -1
  56. package/dist/{serve-De-kqWXM.js → serve-DHny4ewF.js} +20 -15
  57. package/dist/{serve-De-kqWXM.js.map → serve-DHny4ewF.js.map} +1 -1
  58. package/dist/{server-setup-BeeT8m-w.js → server-setup-Dd293T1O.js} +479 -75
  59. package/dist/server-setup-Dd293T1O.js.map +1 -0
  60. package/dist/{start-DEC0M8UH.js → start-P2rmHBkL.js} +3 -3
  61. package/dist/{start-DEC0M8UH.js.map → start-P2rmHBkL.js.map} +1 -1
  62. package/dist/{stop-gate-hook-DoYD9Wt8.js → stop-gate-hook-BqpumJtl.js} +12 -7
  63. package/dist/{stop-gate-hook-DoYD9Wt8.js.map → stop-gate-hook-BqpumJtl.js.map} +1 -1
  64. package/dist/{stop-gate-policy-CoMKWSsS.js → stop-gate-policy-C0XOBZhB.js} +3 -3
  65. package/dist/{stop-gate-policy-CoMKWSsS.js.map → stop-gate-policy-C0XOBZhB.js.map} +1 -1
  66. package/dist/{token-DWknHe9M.js → token-C_q95GF7.js} +124 -14
  67. package/dist/{token-DWknHe9M.js.map → token-C_q95GF7.js.map} +1 -1
  68. package/package.json +2 -2
  69. package/dist/engine-B4Ohhv5i.js +0 -2
  70. package/dist/exec-DTO2oin0.js.map +0 -1
  71. package/dist/file-log-reporter-vI8qCFNM.js +0 -158
  72. package/dist/file-log-reporter-vI8qCFNM.js.map +0 -1
  73. package/dist/lifecycle-CRTWEbiP.js +0 -2
  74. package/dist/lifecycle-DUPXAOQS.js +0 -2
  75. package/dist/models-uQgsKNNC.js.map +0 -1
  76. package/dist/paths-Dz1WyRJG.js +0 -2
  77. package/dist/peer-mcp-personas-V4AXhm9B.js.map +0 -1
  78. package/dist/server-setup-BeeT8m-w.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { t as getPackageVersion } from "./version-_Q1WpsQp.js";
2
- import { t as PATHS } from "./paths-BXrbboAS.js";
3
- import { C as copilotHeaders, E as githubAgentHeaders, O as state, S as copilotBaseUrl, T as githubAgentGraphQLHeaders, _ as withTransientRetry, b as GITHUB_API_BASE_URL, d as resolveModel, f as sleep$2, g as fetchWithTransientRetry, h as isAllowedCopilotHost, i as tryRefreshAndRetry, v as HTTPError, w as copilotVersion, x as GITHUB_GRAPHQL_URL } from "./token-DWknHe9M.js";
4
- import { a as resolveExecutable, c as runManagedExeCapture, i as parseIntEnv, r as parseBoolEnv } from "./exec-DTO2oin0.js";
5
- import { i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-DjC9tC1A.js";
2
+ import { t as PATHS } from "./paths-Bg1_DWhi.js";
3
+ import { C as copilotHeaders, E as githubAgentHeaders, O as state, S as copilotBaseUrl, T as githubAgentGraphQLHeaders, _ as withTransientRetry, b as GITHUB_API_BASE_URL, d as resolveModel, f as sleep$2, g as fetchWithTransientRetry, h as isAllowedCopilotHost, i as tryRefreshAndRetry, v as HTTPError, w as copilotVersion, x as GITHUB_GRAPHQL_URL } from "./token-C_q95GF7.js";
4
+ import { a as resolveExecutable, c as runManagedExeCapture, i as parseIntEnv, l as spawnTaskkillBestEffort, r as parseBoolEnv } from "./exec-y8C_MU8A.js";
5
+ import { i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-0XrazT05.js";
6
6
  import { t as MCP_WORKSPACE_HEADER } from "./mcp-workspace-header-CGJbNeHb.js";
7
7
  import { n as ArtifactError, r as applyInsecureTls, t as ArtifactClient } from "./client-CQMfroGV.js";
8
- import { n as isPidAlive, r as registerColbertExitHandlers, s as trackChild, t as getColbertInstanceUuid } from "./lifecycle-Bd1Fyf4B.js";
9
- import { h as runGateChecks, m as sealedGateIds, p as resolveSealedGate } from "./stop-gate-hook-DoYD9Wt8.js";
10
- import { t as liveExec } from "./orchestration-BiZviyam.js";
8
+ import { n as isPidAlive, r as registerColbertExitHandlers, s as trackChild, t as getColbertInstanceUuid } from "./lifecycle-AgNOtFRv.js";
9
+ import { h as runGateChecks, m as sealedGateIds, p as resolveSealedGate } from "./stop-gate-hook-BqpumJtl.js";
10
+ import { t as liveExec } from "./orchestration-B_Q3ncXI.js";
11
11
  import { createRequire } from "node:module";
12
12
  import consola from "consola";
13
13
  import { chmodSync, closeSync, constants, cpSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
@@ -3966,6 +3966,7 @@ async function readCappedText(response) {
3966
3966
  text += decoder.decode();
3967
3967
  } catch (err) {
3968
3968
  consola.debug("first-mate capi: capped read interrupted:", err);
3969
+ await reader.cancel().catch(() => void 0);
3969
3970
  }
3970
3971
  return text.length > MAX_LOG_BYTES ? text.slice(0, MAX_LOG_BYTES) : text;
3971
3972
  }
@@ -4511,13 +4512,45 @@ function currentFenceToken() {
4511
4512
  function sleep$1(ms) {
4512
4513
  return new Promise((resolve) => setTimeout(resolve, ms));
4513
4514
  }
4515
+ /**
4516
+ * Backoff for a transient Windows rename failure.
4517
+ *
4518
+ * On Windows `fs.rename` over an existing destination transiently fails with
4519
+ * EPERM / EBUSY / EACCES when anything else holds the target open for even a
4520
+ * moment — antivirus, the search indexer, a backup agent, an editor. Nothing is
4521
+ * wrong; the handle closes microseconds later.
4522
+ *
4523
+ * This matters here more than most places: this function is the durable write
4524
+ * for mission ledgers and decisions. Without a retry, a single AV scan landing
4525
+ * on the wrong millisecond throws out of a state write, and the caller sees a
4526
+ * mission-tracking failure it cannot act on. Observed in the test suite as an
4527
+ * EPERM on `octo__alpha.json`.
4528
+ *
4529
+ * Same delays as `renameWithRetry` in `~/lib/claude-md-injection`, which
4530
+ * documents the underlying Windows behavior at length.
4531
+ */
4532
+ const RENAME_RETRY_DELAYS_MS = [
4533
+ 50,
4534
+ 200,
4535
+ 500
4536
+ ];
4514
4537
  async function writeJsonSecure(target, value) {
4515
4538
  await fs$1.mkdir(path.dirname(target), { recursive: true });
4516
4539
  const tmp = `${target}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
4517
4540
  try {
4518
4541
  await fs$1.writeFile(tmp, `${JSON.stringify(value, null, 2)}\n`, { mode: 384 });
4519
4542
  await fs$1.chmod(tmp, 384).catch(() => {});
4520
- await fs$1.rename(tmp, target);
4543
+ let lastErr;
4544
+ let renamed = false;
4545
+ for (let attempt = 0; attempt <= RENAME_RETRY_DELAYS_MS.length; attempt++) try {
4546
+ await fs$1.rename(tmp, target);
4547
+ renamed = true;
4548
+ break;
4549
+ } catch (err) {
4550
+ lastErr = err;
4551
+ if (attempt < RENAME_RETRY_DELAYS_MS.length) await sleep$1(RENAME_RETRY_DELAYS_MS[attempt]);
4552
+ }
4553
+ if (!renamed) throw lastErr;
4521
4554
  await fs$1.chmod(target, 384).catch(() => {});
4522
4555
  } catch (err) {
4523
4556
  await fs$1.unlink(tmp).catch(() => {});
@@ -4534,8 +4567,11 @@ async function withFileLock(target, fn) {
4534
4567
  const start = Date.now();
4535
4568
  for (;;) try {
4536
4569
  const fh = await fs$1.open(lockPath, "wx");
4537
- await fh.writeFile(ownerToken);
4538
- await fh.close();
4570
+ try {
4571
+ await fh.writeFile(ownerToken);
4572
+ } finally {
4573
+ await fh.close().catch(() => {});
4574
+ }
4539
4575
  break;
4540
4576
  } catch (err) {
4541
4577
  const code = err.code;
@@ -9773,6 +9809,35 @@ function parseRepoSlug(value) {
9773
9809
  repo: parts[1].trim()
9774
9810
  };
9775
9811
  }
9812
+ /**
9813
+ * Repositories `scaffold_repo` is permitted to write to.
9814
+ *
9815
+ * `parseRepoSlug` validates SHAPE only, so before this gate any `owner/name`
9816
+ * the agent token could reach was writable. The tool's own description says it
9817
+ * "is not for arbitrary third-party repositories" — that was prose in a model-
9818
+ * facing string, not enforcement.
9819
+ *
9820
+ * Why it matters here specifically: `--browse` ingests arbitrary web content,
9821
+ * and that content reaches a model whose tool surface (under `--agents`, with
9822
+ * the second write-scoped token) includes creating branches, committing files,
9823
+ * and opening PRs. A fetched page that talks a model into naming a different
9824
+ * repo is the realistic version of that risk, and nothing downstream would
9825
+ * have caught it: the branch+PR flow and the human merge gate bound the BLAST
9826
+ * RADIUS of a write, but neither constrains WHICH repo it lands in.
9827
+ *
9828
+ * Configured with `GH_ROUTER_FM_SCAFFOLD_REPOS` as a comma-separated list of
9829
+ * `owner/name` entries; `owner/*` allows a whole org. Matching is
9830
+ * case-insensitive (GitHub logins are). Unset means DENY-ALL rather than
9831
+ * allow-all: a default-open gate is not a gate, and the operator who wants
9832
+ * scaffolding is the one who knows which repos they own. The error names the
9833
+ * env var so the honest use case is one copy-paste away.
9834
+ */
9835
+ function assertScaffoldRepoAllowed(repo) {
9836
+ const patterns = (process.env.GH_ROUTER_FM_SCAFFOLD_REPOS ?? "").split(",").map((entry) => entry.trim().toLowerCase()).filter((entry) => entry.length > 0);
9837
+ const slug = `${repo.owner}/${repo.repo}`.toLowerCase();
9838
+ if (patterns.some((pattern) => pattern === slug || pattern === `${repo.owner.toLowerCase()}/*`)) return;
9839
+ throw new ScaffoldHelperError("repo-not-allowed", `scaffold_repo refused ${slug}: it is not in the allowlist. This tool creates branches, commits files, and opens pull requests, so it is restricted to repositories the operator has named. Set GH_ROUTER_FM_SCAFFOLD_REPOS to a comma-separated list of owner/name entries (or owner/* for a whole org) to permit it.` + (patterns.length === 0 ? " It is currently unset, so every repository is denied." : ""));
9840
+ }
9776
9841
  function normalizeBranchRef(value) {
9777
9842
  const trimmed = value.trim();
9778
9843
  const withoutRefsPrefix = trimmed.startsWith("refs/heads/") ? trimmed.slice(11) : trimmed.startsWith("heads/") ? trimmed.slice(6) : trimmed;
@@ -10670,7 +10735,7 @@ function createFirstMateTools(depsOverride = {}) {
10670
10735
  repos
10671
10736
  });
10672
10737
  }),
10673
- tool("scaffold_repo", "Seeds first-mate and agentic-dev convention files into a GitHub repository by creating a scaffold branch, committing deterministic files, and opening a pull request; it does not write directly to the default branch. Inputs name the owner/name repo, optional base ref, handling mode, and optional detection overrides for stack, OS, package manager, commands, and UI evidence. Returns the pull request plus committed, preserved, and per-file report data, or a no-op note when nothing needs seeding. Use when preparing an owned repository for the first-mate cloud-agent workflow. It is not for arbitrary third-party repositories, normal feature work, or repeated runs unless the operator intentionally wants missing or enhanced convention files.", objectSchema({
10738
+ tool("scaffold_repo", "Seeds first-mate and agentic-dev convention files into a GitHub repository by creating a scaffold branch, committing deterministic files, and opening a pull request; it does not write directly to the default branch. Inputs name the owner/name repo, optional base ref, handling mode, and optional detection overrides for stack, OS, package manager, commands, and UI evidence. Returns the pull request plus committed, preserved, and per-file report data, or a no-op note when nothing needs seeding. Use when preparing an owned repository for the first-mate cloud-agent workflow. Repositories must be allowlisted by the operator via GH_ROUTER_FM_SCAFFOLD_REPOS (unset denies every repository), so a repo outside that list is refused rather than written to. It is not for arbitrary third-party repositories, normal feature work, or repeated runs unless the operator intentionally wants missing or enhanced convention files.", objectSchema({
10674
10739
  repo: stringProp("Repository as an owner/name string."),
10675
10740
  mode: enumProp([
10676
10741
  "add-missing-only",
@@ -10682,6 +10747,7 @@ function createFirstMateTools(depsOverride = {}) {
10682
10747
  }, ["repo"]), async (args, signal) => {
10683
10748
  const input = parseScaffoldRepoArgs(args);
10684
10749
  const repo = parseRepoSlug(input.repo);
10750
+ assertScaffoldRepoAllowed(repo);
10685
10751
  const repository = input.base_ref === void 0 ? await getRepositoryDetails(repo, signal) : { defaultBranch: normalizeBranchRef(input.base_ref) };
10686
10752
  const baseBranch = repository.defaultBranch;
10687
10753
  const desiredFiles = buildScaffoldFiles(await detectScaffoldOptions({
@@ -13315,14 +13381,7 @@ function tokenize(text) {
13315
13381
  function killChild(child) {
13316
13382
  if (!child.pid || child.killed) return;
13317
13383
  if (process.platform === "win32") {
13318
- try {
13319
- execFile("taskkill", [
13320
- "/T",
13321
- "/F",
13322
- "/PID",
13323
- String(child.pid)
13324
- ], () => {});
13325
- } catch {}
13384
+ spawnTaskkillBestEffort(child.pid);
13326
13385
  return;
13327
13386
  }
13328
13387
  try {
@@ -15408,7 +15467,11 @@ const _metaWriteChains = /* @__PURE__ */ new Map();
15408
15467
  async function writeColbertMeta(meta) {
15409
15468
  const key = metaHashForWorkspace(meta.workspace);
15410
15469
  const next = (_metaWriteChains.get(key) ?? Promise.resolve()).then(() => writeColbertMetaUnchained(meta));
15411
- _metaWriteChains.set(key, next.then(() => void 0, () => void 0));
15470
+ const settled = next.then(() => void 0, () => void 0);
15471
+ _metaWriteChains.set(key, settled);
15472
+ settled.then(() => {
15473
+ if (_metaWriteChains.get(key) === settled) _metaWriteChains.delete(key);
15474
+ });
15412
15475
  return next;
15413
15476
  }
15414
15477
  async function writeColbertMetaUnchained(meta) {
@@ -18360,7 +18423,7 @@ function logAudit$1(record) {
18360
18423
  try {
18361
18424
  const fs = await import("node:fs/promises");
18362
18425
  const path = await import("node:path");
18363
- const { PATHS } = await import("./paths-Dz1WyRJG.js");
18426
+ const { PATHS } = await import("./paths-BbHtQAOs.js");
18364
18427
  const dir = path.join(PATHS.APP_DIR, "browser-mcp");
18365
18428
  await fs.mkdir(dir, { recursive: true });
18366
18429
  const line = JSON.stringify({
@@ -19176,7 +19239,10 @@ async function readResponseBodyCapped(response, routePath, capBytes = MAX_RESPON
19176
19239
  chunks.push(value);
19177
19240
  }
19178
19241
  } catch (err) {
19179
- if (!capped) consola.warn(`readResponseBodyCapped: read error at ${routePath}:`, err);
19242
+ if (!capped) {
19243
+ consola.warn(`readResponseBodyCapped: read error at ${routePath}:`, err);
19244
+ await reader.cancel().catch(() => void 0);
19245
+ }
19180
19246
  }
19181
19247
  if (capped) {
19182
19248
  consola.warn(`Non-streaming upstream response at ${routePath} exceeded ${capBytes} bytes (10 MiB cap); dropping body to prevent OOM. Check upstream health.`);
@@ -27412,6 +27478,7 @@ function isAdvisorRequested(rawBetaHeader) {
27412
27478
  * blocks the client expects.
27413
27479
  */
27414
27480
  function injectAdvisorTool(rawBody) {
27481
+ if (rawBody.includes(`"name":"__anthropic_advisor"`) && !rawBody.includes("\"advisor_")) return rawBody;
27415
27482
  let parsed;
27416
27483
  try {
27417
27484
  parsed = JSON.parse(rawBody);
@@ -29343,23 +29410,30 @@ function fetchUrlTool() {
29343
29410
  let buf = "";
29344
29411
  let bytes = 0;
29345
29412
  let truncated = false;
29346
- while (true) {
29347
- const { done, value } = await reader.read();
29348
- if (done) break;
29349
- if (!value) continue;
29350
- const chunk = value;
29351
- const room = FETCH_URL_MAX_BYTES - bytes;
29352
- if (chunk.byteLength <= room) {
29353
- buf += decoder.decode(chunk, { stream: true });
29354
- bytes += chunk.byteLength;
29355
- } else {
29356
- if (room > 0) buf += decoder.decode(chunk.subarray(0, room), { stream: true });
29357
- truncated = true;
29358
- try {
29359
- await reader.cancel("size_cap");
29360
- } catch {}
29361
- break;
29413
+ try {
29414
+ while (true) {
29415
+ const { done, value } = await reader.read();
29416
+ if (done) break;
29417
+ if (!value) continue;
29418
+ const chunk = value;
29419
+ const room = FETCH_URL_MAX_BYTES - bytes;
29420
+ if (chunk.byteLength <= room) {
29421
+ buf += decoder.decode(chunk, { stream: true });
29422
+ bytes += chunk.byteLength;
29423
+ } else {
29424
+ if (room > 0) buf += decoder.decode(chunk.subarray(0, room), { stream: true });
29425
+ truncated = true;
29426
+ try {
29427
+ await reader.cancel("size_cap");
29428
+ } catch {}
29429
+ break;
29430
+ }
29362
29431
  }
29432
+ } catch (err) {
29433
+ try {
29434
+ await reader.cancel("read_error");
29435
+ } catch {}
29436
+ throw err;
29363
29437
  }
29364
29438
  buf += decoder.decode();
29365
29439
  if (truncated) buf += `\n[fetch_url: truncated at ${FETCH_URL_MAX_BYTES} bytes]`;
@@ -33269,7 +33343,7 @@ const NON_PERSONA_MCP_TOOLS = Object.freeze([
33269
33343
  toolNameHttp: "explore",
33270
33344
  group: "workers",
33271
33345
  capability: "worker",
33272
- description: "Runs as the background `worker-explore` agent. Dispatch via the Agent tool (subagent_type: worker-explore) so the turn is never blocked; the result arrives as a completion notification. Read-only investigation by an autonomous worker (Pi runtime; default model `gemini-3.6-flash` at high reasoning, override via the `model` arg with any Copilot-catalog model that advertises `tool_calls`). It has read, glob, grep, semantic-first code search, web search, fetch_url, advisor, update_plan, and read-only toolbelt tools, and it returns a single text answer. Use for bounded research, repo discovery, dependency investigation, or multi-file reading that would otherwise consume the lead context window. Not for implementation, test authoring, or verification of a concrete diff; use implement, test, or review for those scopes. Brief the investigation goal and constraints, not step-by-step tool semantics.",
33346
+ description: "Runs as the background `worker-explore` agent. Dispatch via the Agent tool (subagent_type: worker-explore) so the turn is never blocked; the result arrives as a completion notification. Read-only investigation by an autonomous worker (Pi runtime; default model `gemini-3.6-flash` at high reasoning, override via the `model` arg with any Copilot-catalog model that advertises `tool_calls`). It has read, glob, grep, semantic-first code search, web search, fetch_url, advisor, update_plan, and read-only toolbelt tools, and it returns a single text answer. Use for bounded research, repo discovery, dependency investigation, or multi-file reading that would otherwise consume the lead context window. Not for implementation, test authoring, or verification of a concrete diff; use implement, test, or review for those scopes. Brief the investigation goal and constraints, not step-by-step tool semantics. Strictly read-only: it changes nothing on disk, and its returned text is the only artifact it produces — route to `implement` or `test` when a file actually needs to change. If the result is too large to relay it is truncated to a preview and the FULL text is written to a file, whose absolute path is in the returned text; read that file rather than re-running the worker.",
33273
33347
  inputSchema: {
33274
33348
  type: "object",
33275
33349
  required: ["prompt"],
@@ -33310,7 +33384,7 @@ const NON_PERSONA_MCP_TOOLS = Object.freeze([
33310
33384
  toolNameHttp: "implement",
33311
33385
  group: "workers",
33312
33386
  capability: "worker",
33313
- description: "Runs as the background `worker-implement` agent. Dispatch via the Agent tool (subagent_type: worker-implement) so the turn is never blocked; the result arrives as a completion notification. Delegates a scoped coding task to an autonomous worker (Pi runtime; default model `gpt-5.6-sol` at xhigh reasoning, override via `model` with any Copilot-catalog model that advertises `tool_calls`). It has the explore read-only tools plus edit, write, bash, and codex_review, and it returns its final text with any changed files or worktree diff. Use for bounded implementation work that may take a while or benefits from isolated worker context. Not for pure research, planning, review, or independent test authoring; use explore, plan, review, or test for those scopes. ALWAYS runs in an isolated git worktree and returns the diff via a saved patch file (a `--stat` summary + a bounded preview + the patch path; a small diff is inlined in full) — it never edits your working tree, and it HARD-ERRORS if the workspace is not a git repository. For in-place edits, use the native `implementer` subagent.",
33387
+ description: "Runs as the background `worker-implement` agent. Dispatch via the Agent tool (subagent_type: worker-implement) so the turn is never blocked; the result arrives as a completion notification. Delegates a scoped coding task to an autonomous worker (Pi runtime; default model `gpt-5.6-sol` at xhigh reasoning, override via `model` with any Copilot-catalog model that advertises `tool_calls`). It has the explore read-only tools plus edit, write, bash, and codex_review, and it returns its final text with any changed files or worktree diff. Use for bounded implementation work that may take a while or benefits from isolated worker context. Not for pure research, planning, review, or independent test authoring; use explore, plan, review, or test for those scopes. ALWAYS runs in an isolated git worktree and returns the diff via a saved patch file (a `--stat` summary + a bounded preview + the patch path; a small diff is inlined in full) — it never edits your working tree, and it HARD-ERRORS if the workspace is not a git repository. For in-place edits, use the native `implementer` subagent. If the result is too large to relay it is truncated to a preview and the FULL text is written to a file, whose absolute path is in the returned text; read that file rather than re-running the worker.",
33314
33388
  inputSchema: {
33315
33389
  type: "object",
33316
33390
  required: ["prompt"],
@@ -33355,7 +33429,7 @@ const NON_PERSONA_MCP_TOOLS = Object.freeze([
33355
33429
  toolNameHttp: "review",
33356
33430
  group: "workers",
33357
33431
  capability: "worker",
33358
- description: "Runs as the background `worker-review` agent. Dispatch via the Agent tool (subagent_type: worker-review) so the turn is never blocked; the result arrives as a completion notification. Read-only code review by an autonomous worker (Pi runtime; default model `gemini-3.1-pro-preview`, default thinking xhigh clamped to high for that model, override via `model` with any Copilot-catalog model that advertises `tool_calls`). It has the same read-only toolset as explore and verifies claims against surrounding repository context before returning severity-ranked findings with `file:line` citations. Use for reviewing a change, diff, or correctness claim when the reviewer should read the code itself rather than trusting a pasted artifact. Not for architecture critique, implementation, or test authoring; use codex_critic or gemini_critic for design review, implement for edits, and test for independent test creation.",
33432
+ description: "Runs as the background `worker-review` agent. Dispatch via the Agent tool (subagent_type: worker-review) so the turn is never blocked; the result arrives as a completion notification. Read-only code review by an autonomous worker (Pi runtime; default model `gemini-3.1-pro-preview`, default thinking xhigh clamped to high for that model, override via `model` with any Copilot-catalog model that advertises `tool_calls`). It has the same read-only toolset as explore and verifies claims against surrounding repository context before returning severity-ranked findings with `file:line` citations. Use for reviewing a change, diff, or correctness claim when the reviewer should read the code itself rather than trusting a pasted artifact. Not for architecture critique, implementation, or test authoring; use codex_critic or gemini_critic for design review, implement for edits, and test for independent test creation. Strictly read-only: it changes nothing on disk, and its returned text is the only artifact it produces — route to `implement` or `test` when a file actually needs to change. If the result is too large to relay it is truncated to a preview and the FULL text is written to a file, whose absolute path is in the returned text; read that file rather than re-running the worker.",
33359
33433
  inputSchema: {
33360
33434
  type: "object",
33361
33435
  required: ["prompt"],
@@ -33396,7 +33470,7 @@ const NON_PERSONA_MCP_TOOLS = Object.freeze([
33396
33470
  toolNameHttp: "plan",
33397
33471
  group: "workers",
33398
33472
  capability: "worker",
33399
- description: "Runs as the background `worker-plan` agent. Dispatch via the Agent tool (subagent_type: worker-plan) so the turn is never blocked; the result arrives as a completion notification. Read-only implementation planning by an autonomous worker (Pi runtime; default model `claude-opus-5` at xhigh reasoning, override via `model` with any Copilot-catalog model that advertises `tool_calls`). It has the same read-only toolset as explore and returns a concrete, ordered implementation plan covering files, approach, risks, and how acceptance criteria will be verified. Use before coding when the task needs repo-grounded sequencing or acceptance criteria translated into implementation steps. Not for editing files, running an implementation, writing tests, or adversarial review; use implement, test, or review for those scopes.",
33473
+ description: "Runs as the background `worker-plan` agent. Dispatch via the Agent tool (subagent_type: worker-plan) so the turn is never blocked; the result arrives as a completion notification. Read-only implementation planning by an autonomous worker (Pi runtime; default model `claude-opus-5` at xhigh reasoning, override via `model` with any Copilot-catalog model that advertises `tool_calls`). It has the same read-only toolset as explore and returns a concrete, ordered implementation plan covering files, approach, risks, and how acceptance criteria will be verified. Use before coding when the task needs repo-grounded sequencing or acceptance criteria translated into implementation steps. Not for editing files, running an implementation, writing tests, or adversarial review; use implement, test, or review for those scopes. Strictly read-only: it changes nothing on disk, and its returned text is the only artifact it produces — route to `implement` or `test` when a file actually needs to change. If the result is too large to relay it is truncated to a preview and the FULL text is written to a file, whose absolute path is in the returned text; read that file rather than re-running the worker.",
33400
33474
  inputSchema: {
33401
33475
  type: "object",
33402
33476
  required: ["prompt"],
@@ -33437,7 +33511,7 @@ const NON_PERSONA_MCP_TOOLS = Object.freeze([
33437
33511
  toolNameHttp: "test",
33438
33512
  group: "workers",
33439
33513
  capability: "worker",
33440
- description: "Runs as the background `worker-test` agent. Dispatch via the Agent tool (subagent_type: worker-test) so the turn is never blocked; the result arrives as a completion notification. Independent adversarial test authoring by an autonomous worker (Pi runtime; default model `gpt-5.6-sol` at xhigh reasoning, override via `model` with any Copilot-catalog model that advertises `tool_calls`). It has the same read/write toolset as implement and writes tests that try to break the implementation through edge cases, error paths, and acceptance criteria, then runs them and reports pass/fail. Use when a separate test author should challenge an implementation without modifying the production code to make tests pass. Not for implementing fixes, broad research, or code review; use implement, explore, or review for those scopes. ALWAYS runs in an isolated git worktree and returns the test diff via a saved patch file (a `--stat` summary + a bounded preview + the patch path; a small diff is inlined in full) — it never edits your working tree, and it HARD-ERRORS if the workspace is not a git repository. For in-place test authoring, use the native `implementer` subagent.",
33514
+ description: "Runs as the background `worker-test` agent. Dispatch via the Agent tool (subagent_type: worker-test) so the turn is never blocked; the result arrives as a completion notification. Independent adversarial test authoring by an autonomous worker (Pi runtime; default model `gpt-5.6-sol` at xhigh reasoning, override via `model` with any Copilot-catalog model that advertises `tool_calls`). It has the same read/write toolset as implement and writes tests that try to break the implementation through edge cases, error paths, and acceptance criteria, then runs them and reports pass/fail. Use when a separate test author should challenge an implementation without modifying the production code to make tests pass. Not for implementing fixes, broad research, or code review; use implement, explore, or review for those scopes. ALWAYS runs in an isolated git worktree and returns the test diff via a saved patch file (a `--stat` summary + a bounded preview + the patch path; a small diff is inlined in full) — it never edits your working tree, and it HARD-ERRORS if the workspace is not a git repository. For in-place test authoring, use the native `implementer` subagent. If the result is too large to relay it is truncated to a preview and the FULL text is written to a file, whose absolute path is in the returned text; read that file rather than re-running the worker.",
33441
33515
  inputSchema: {
33442
33516
  type: "object",
33443
33517
  required: ["prompt"],
@@ -33684,7 +33758,7 @@ const NON_PERSONA_MCP_TOOLS = Object.freeze([
33684
33758
  toolNameHttp: "browse",
33685
33759
  group: "workers",
33686
33760
  capability: "browse_agent",
33687
- description: "Runs as the background `worker-browse` agent. Dispatch via the Agent tool (subagent_type: worker-browse) so the turn is never blocked; the result arrives as a completion notification. A Pi-driven autonomous browser worker (default model `gpt-5.4-mini`) drives a real browser to accomplish `task`, keeps raw DOM and page snapshots inside its own context, and returns a single text result. Use for delegated multi-step web tasks such as comparing prices, logging into a dashboard, or summarizing pages when the lead does not need to steer each click. Not for direct in-context browser control, screenshots, or precise element interactions; use the `browser` MCP tools for those. Pass `sessionId` to continue a prior browse session, or omit it for a fresh isolated session; multiple calls run as parallel sessions on the shared browser.",
33761
+ description: "Runs as the background `worker-browse` agent. Dispatch via the Agent tool (subagent_type: worker-browse) so the turn is never blocked; the result arrives as a completion notification. A Pi-driven autonomous browser worker (default model `gpt-5.4-mini`) drives a real browser to accomplish `task`, keeps raw DOM and page snapshots inside its own context, and returns a single text result. Use for delegated multi-step web tasks such as comparing prices, logging into a dashboard, or summarizing pages when the lead does not need to steer each click. Not for direct in-context browser control, screenshots, or precise element interactions; use the `browser` MCP tools for those. Pass `sessionId` to continue a prior browse session, or omit it for a fresh isolated session; multiple calls run as parallel sessions on the shared browser. If the result is too large to relay it is truncated to a preview and the FULL text is written to a file, whose absolute path is in the returned text; read that file rather than re-running the worker.",
33688
33762
  inputSchema: {
33689
33763
  type: "object",
33690
33764
  required: ["task"],
@@ -34145,4 +34219,4 @@ function enumerateInjectedMcpToolNames(groupKeys, opts = {}) {
34145
34219
  //#endregion
34146
34220
  export { reviewerModel as $, searchWeb as A, DEFAULT_CODEX_MODEL_FALLBACKS as At, readIteratorWithTimeout as B, buildToolbeltAwareness as C, CONDENSED_OPERATING_SEQUENCE as Ct, TOOLBELT_TOOLS$1 as D, toolbeltPathOverride as Dt, vscodeRipgrepPath as E, collapsePathKeys as Et, isAdvisorRequested as F, pickClaudeDefault as Ft, artifactToolsEnabled as G, handleMcpDelete as H, buildAnthropicErrorEvent as I, withOneMSuffix as It, browserCompoundToolsEnabled as J, brainstormModel as K, buildOpenAIErrorEvent as L, withInstallLock as Lt, ADVISOR_TOOL_INSTRUCTIONS as M, UPSTREAM_FETCH_TIMEOUT_MS as Mt, buildAdvisorStream as N, UPSTREAM_INACTIVITY_TIMEOUT_MS as Nt, assetFor as O, DEFAULT_CLAUDE_MODEL_FALLBACKS as Ot, injectAdvisorTool as P, generateRandomPort as Pt, nativeSubagentModel as Q, isControllerClosedError as R, availableToolCommands as S, warmTreeSitterPool as St, toolbeltSkipSet as T, shouldUseInsecureTls as Tt, handleMcpPost as U, relayAnthropicStream as V, agentToolsEnabled as W, fleetToolsEnabled as X, browserToolsEnabled as Y, geminiAvailable as Z, appendPlanReminder as _, hasSupportedBrowserInstalled as _t, buildPeerAwarenessSnippet as a, countTokens as at, runWorkerAgent as b, extractTarGzMember as bt, personasFor as c, assembleResponsesPayload as ct, EXPLORE_DEFAULT_MODEL as d, createResponses as dt, scoutModel as et, EXPLORE_DEFAULT_THINKING as f, createChatCompletions as ft, TEST_DEFAULT_MODEL as g, provisionBrowserAssets as gt, REVIEW_DEFAULT_MODEL as h, parseJsonOrDiagnose as ht, buildAgentPrompt as i, shimDefaultsToXhigh as it, ADVISOR_INTERNAL_TOOL_NAME as j, DEFAULT_PORT as jt, satisfiesMinVersion as k, DEFAULT_CODEX_MODEL as kt, BROWSE_DEFAULT_MODEL as l, resolveMcpToolTimeoutMs as lt, PLAN_DEFAULT_MODEL as m, readResponseBodyCapped as mt, MCP_GROUPS as n, standInToolEnabled as nt, buildPeerAwarenessSummary as o, createMessages as ot, IMPLEMENT_DEFAULT_MODEL as p, MAX_RESPONSE_BODY_BYTES as pt, browseAgentEnabled as q, assertMcpToolSurfaceConsistent as r, workerToolsEnabled as rt, enumerateInjectedMcpToolNames as s, getTokenCount as st, GROUP_META as t, scribeModel as tt, DEFAULT_MODEL as u, pickEndpoint as ut, resolveModeDefaults as v, colbertDegradedWarning as vt, toolbeltEnabled as w, DEFINITION_OF_GREATNESS as wt, buildEnv as x, extractZipMember as xt, resolveWorkerRunOpts as y, provisionAndIndexColbert as yt, logStreamError as z };
34147
34221
 
34148
- //# sourceMappingURL=peer-mcp-personas-V4AXhm9B.js.map
34222
+ //# sourceMappingURL=peer-mcp-personas-DSbBlgFt.js.map