github-router 0.3.373 → 0.3.375

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 (152) hide show
  1. package/dist/ado-tools-BOW1k1KW.js +1 -0
  2. package/dist/{aic-ledger-Cp7Yk9-Q.js → aic-ledger-CeSXqTEE.js} +5 -7
  3. package/dist/{aic-ledger-Cp7Yk9-Q.js.map → aic-ledger-CeSXqTEE.js.map} +1 -1
  4. package/dist/{aic-statusline-settings-B5EMMSFC.js → aic-statusline-settings-BKveu679.js} +3 -4
  5. package/dist/{aic-statusline-settings-B5EMMSFC.js.map → aic-statusline-settings-BKveu679.js.map} +1 -1
  6. package/dist/{attribution-settings-DZ8fEfvP.js → attribution-settings-Cs6CsXK3.js} +33 -53
  7. package/dist/{attribution-settings-DZ8fEfvP.js.map → attribution-settings-Cs6CsXK3.js.map} +1 -1
  8. package/dist/{auth-B1egtvt4.js → auth-BZHpTtfF.js} +5 -6
  9. package/dist/{auth-B1egtvt4.js.map → auth-BZHpTtfF.js.map} +1 -1
  10. package/dist/{balanced-profile-contract-Dm_usmw7.js → balanced-profile-contract-B6pSoWjm.js} +2 -3
  11. package/dist/{balanced-profile-contract-Dm_usmw7.js.map → balanced-profile-contract-B6pSoWjm.js.map} +1 -1
  12. package/dist/{bluebird-client-ByCRusGQ.js → bluebird-client-BasIdv5J.js} +8 -12
  13. package/dist/{bluebird-client-ByCRusGQ.js.map → bluebird-client-BasIdv5J.js.map} +1 -1
  14. package/dist/{bluebird-client-CY6NBHQu.js → bluebird-client-BvoMTmEv.js} +1 -1
  15. package/dist/browser-bridge/index.js +84 -55
  16. package/dist/browser-ext/manifest.json +1 -1
  17. package/dist/{check-usage-T_z84Pgc.js → check-usage-BlIWDuV2.js} +5 -6
  18. package/dist/{check-usage-T_z84Pgc.js.map → check-usage-BlIWDuV2.js.map} +1 -1
  19. package/dist/{claude-8ksmV0dC.js → claude-Q1yfHGGE.js} +37 -43
  20. package/dist/{claude-8ksmV0dC.js.map → claude-Q1yfHGGE.js.map} +1 -1
  21. package/dist/{claude-md-injection-BnzVv_aB.js → claude-md-injection-DU5KYXNc.js} +6 -7
  22. package/dist/{claude-md-injection-BnzVv_aB.js.map → claude-md-injection-DU5KYXNc.js.map} +1 -1
  23. package/dist/{client-CQMfroGV.js → client-Bjp3XAMK.js} +3 -5
  24. package/dist/{client-CQMfroGV.js.map → client-Bjp3XAMK.js.map} +1 -1
  25. package/dist/{codex-C89FoaaG.js → codex-BuOUR6lB.js} +10 -11
  26. package/dist/{codex-C89FoaaG.js.map → codex-BuOUR6lB.js.map} +1 -1
  27. package/dist/{copilot-discount-T-cfWmc4.js → copilot-discount-CHNQLYDJ.js} +3 -4
  28. package/dist/{copilot-discount-T-cfWmc4.js.map → copilot-discount-CHNQLYDJ.js.map} +1 -1
  29. package/dist/{debug-DL2JsRqY.js → debug-1HUHCWFl.js} +3 -4
  30. package/dist/{debug-DL2JsRqY.js.map → debug-1HUHCWFl.js.map} +1 -1
  31. package/dist/engine-BC4TF4pt.js +1 -0
  32. package/dist/{exec-Bf8g_bIR.js → exec-BC0MAnoA.js} +2 -3
  33. package/dist/{exec-Bf8g_bIR.js.map → exec-BC0MAnoA.js.map} +1 -1
  34. package/dist/{fast-profile-contract-JOnZBgFB.js → fast-profile-contract-BLnKg0Ay.js} +2 -3
  35. package/dist/{fast-profile-contract-JOnZBgFB.js.map → fast-profile-contract-BLnKg0Ay.js.map} +1 -1
  36. package/dist/{gate-discovery-Bc9FdRwg.js → gate-discovery-DiXu_olc.js} +8 -10
  37. package/dist/{gate-discovery-Bc9FdRwg.js.map → gate-discovery-DiXu_olc.js.map} +1 -1
  38. package/dist/{get-copilot-usage-BSXeQEx8.js → get-copilot-usage-CKg42gSH.js} +5 -6
  39. package/dist/{get-copilot-usage-BSXeQEx8.js.map → get-copilot-usage-CKg42gSH.js.map} +1 -1
  40. package/dist/{hook-mcp-client-DERIkeR7.js → hook-mcp-client-CYx10nlU.js} +2 -3
  41. package/dist/hook-mcp-client-CYx10nlU.js.map +1 -0
  42. package/dist/hooks.mjs +1766 -1548
  43. package/dist/hooks.sha256 +1 -1
  44. package/dist/{index-cmd-DOhwt92u.js → index-cmd-BPXhTfGQ.js} +8 -9
  45. package/dist/index-cmd-BPXhTfGQ.js.map +1 -0
  46. package/dist/{internal-aic-status-CY0QxSa7.js → internal-aic-status-FQB1DQzX.js} +6 -8
  47. package/dist/{internal-aic-status-CY0QxSa7.js.map → internal-aic-status-FQB1DQzX.js.map} +1 -1
  48. package/dist/{internal-artifact-open-NAGn9Mgt.js → internal-artifact-open-DbHjipxU.js} +5 -7
  49. package/dist/{internal-artifact-open-NAGn9Mgt.js.map → internal-artifact-open-DbHjipxU.js.map} +1 -1
  50. package/dist/{internal-fast-dispatch-guard-De_DJOyZ.js → internal-fast-dispatch-guard-DMzqs-r8.js} +1 -1
  51. package/dist/{internal-fast-dispatch-guard-_n-A8hgo.js → internal-fast-dispatch-guard-PDdlkPU3.js} +6 -8
  52. package/dist/{internal-fast-dispatch-guard-_n-A8hgo.js.map → internal-fast-dispatch-guard-PDdlkPU3.js.map} +1 -1
  53. package/dist/{internal-first-mate-guard-GufCUMl3.js → internal-first-mate-guard-4Yro9xNM.js} +5 -7
  54. package/dist/{internal-first-mate-guard-GufCUMl3.js.map → internal-first-mate-guard-4Yro9xNM.js.map} +1 -1
  55. package/dist/{internal-first-mate-guard-C8GwLbaX.js → internal-first-mate-guard-BxPDUsV3.js} +1 -1
  56. package/dist/{internal-max-dispatch-guard-4rh6KSd8.js → internal-max-dispatch-guard-D3L00YXj.js} +5 -7
  57. package/dist/{internal-max-dispatch-guard-4rh6KSd8.js.map → internal-max-dispatch-guard-D3L00YXj.js.map} +1 -1
  58. package/dist/{internal-max-dispatch-guard-CKnzgJje.js → internal-max-dispatch-guard-fhBX_w49.js} +1 -1
  59. package/dist/{internal-plan-review-ChFx8wTX.js → internal-plan-review-BfHLeszV.js} +6 -7
  60. package/dist/{internal-plan-review-ChFx8wTX.js.map → internal-plan-review-BfHLeszV.js.map} +1 -1
  61. package/dist/{internal-prompt-submit-BW5g3MjD.js → internal-prompt-submit-BbnaMF2R.js} +7 -8
  62. package/dist/{internal-prompt-submit-BW5g3MjD.js.map → internal-prompt-submit-BbnaMF2R.js.map} +1 -1
  63. package/dist/{internal-prompt-submit-C4uDwr7G.js → internal-prompt-submit-DKzCckz-.js} +2 -2
  64. package/dist/{internal-rebrief-DvBS8myn.js → internal-rebrief-aEvxp7jw.js} +7 -9
  65. package/dist/{internal-rebrief-DvBS8myn.js.map → internal-rebrief-aEvxp7jw.js.map} +1 -1
  66. package/dist/{internal-session-bind-dsUOcKxU.js → internal-session-bind-pN1V11Mn.js} +3 -4
  67. package/dist/{internal-session-bind-dsUOcKxU.js.map → internal-session-bind-pN1V11Mn.js.map} +1 -1
  68. package/dist/{internal-stop-hook-nS91Jkda.js → internal-stop-hook-VQuOYpUC.js} +9 -10
  69. package/dist/{internal-stop-hook-nS91Jkda.js.map → internal-stop-hook-VQuOYpUC.js.map} +1 -1
  70. package/dist/{internal-stop-review-D_KEV_04.js → internal-stop-review-BWp-4XWW.js} +4 -5
  71. package/dist/{internal-stop-review-D_KEV_04.js.map → internal-stop-review-BWp-4XWW.js.map} +1 -1
  72. package/dist/{internal-worker-guard-DB6shBIn.js → internal-worker-guard-C9OZPgzu.js} +3 -4
  73. package/dist/{internal-worker-guard-DB6shBIn.js.map → internal-worker-guard-C9OZPgzu.js.map} +1 -1
  74. package/dist/{internal-workspace-header-DBg5Y7oN.js → internal-workspace-header-B4TXFBLU.js} +3 -4
  75. package/dist/{internal-workspace-header-DBg5Y7oN.js.map → internal-workspace-header-B4TXFBLU.js.map} +1 -1
  76. package/dist/lib/tree-sitter-pool/{lifecycle-Dx0SnP7Z.js → lifecycle-BPpOigPZ.js} +1 -2
  77. package/dist/lib/tree-sitter-pool/{lifecycle-C7W8D2lx.js → lifecycle-C3vsqXjS.js} +1 -3
  78. package/dist/lib/tree-sitter-pool/worker.js +29 -35
  79. package/dist/lifecycle-BENRuuX6.js +1 -0
  80. package/dist/{lifecycle-K9oVtGde.mjs → lifecycle-DBKu1T5r.mjs} +0 -1
  81. package/dist/{lifecycle-Gge2Dadd.js → lifecycle-Dh9y8OF1.js} +3 -4
  82. package/dist/{lifecycle-Gge2Dadd.js.map → lifecycle-Dh9y8OF1.js.map} +1 -1
  83. package/dist/lifecycle-Dli9vGI2.js +1 -0
  84. package/dist/{lifecycle-9nX09dBl.js → lifecycle-vjHAFCaY.js} +4 -6
  85. package/dist/{lifecycle-9nX09dBl.js.map → lifecycle-vjHAFCaY.js.map} +1 -1
  86. package/dist/main.js +26 -27
  87. package/dist/{max-profile-contract-CRj7N211.js → max-profile-contract-DLLTsSs2.js} +5 -8
  88. package/dist/{max-profile-contract-CRj7N211.js.map → max-profile-contract-DLLTsSs2.js.map} +1 -1
  89. package/dist/{mcp-workspace-header-Xw9B1W6T.js → mcp-workspace-header-C5-dOWNa.js} +3 -4
  90. package/dist/{mcp-workspace-header-Xw9B1W6T.js.map → mcp-workspace-header-C5-dOWNa.js.map} +1 -1
  91. package/dist/{models-Ca-HQTYi.js → models-B6nH1sS6.js} +4 -5
  92. package/dist/{models-Ca-HQTYi.js.map → models-B6nH1sS6.js.map} +1 -1
  93. package/dist/{orchestration-D3-2ulhX.js → orchestration-B93jxrWI.js} +4 -5
  94. package/dist/{orchestration-D3-2ulhX.js.map → orchestration-B93jxrWI.js.map} +1 -1
  95. package/dist/{package-root-B-osctCk.js → package-root-BXgdIM3q.js} +2 -3
  96. package/dist/{package-root-B-osctCk.js.map → package-root-BXgdIM3q.js.map} +1 -1
  97. package/dist/paths-Be9_ujQ3.js +1 -0
  98. package/dist/{paths-C5477RGC.js → paths-CVEO8jEH.js} +5 -7
  99. package/dist/{paths-C5477RGC.js.map → paths-CVEO8jEH.js.map} +1 -1
  100. package/dist/{peer-mcp-personas-BSxDj9sJ.js → peer-mcp-personas-Cv21q_YR.js} +244 -372
  101. package/dist/peer-mcp-personas-Cv21q_YR.js.map +1 -0
  102. package/dist/{pi-BglhJ6n_.js → pi-B5qq1G6b.js} +84 -36
  103. package/dist/pi-B5qq1G6b.js.map +1 -0
  104. package/dist/{pi-memory-bridge-DEU1SUDz.js → pi-memory-bridge-Dvj1T3e3.js} +2 -3
  105. package/dist/{pi-memory-bridge-DEU1SUDz.js.map → pi-memory-bridge-Dvj1T3e3.js.map} +1 -1
  106. package/dist/{plan-review-hook-C9K-em4D.js → plan-review-hook-MhjK92wq.js} +5 -6
  107. package/dist/{plan-review-hook-C9K-em4D.js.map → plan-review-hook-MhjK92wq.js.map} +1 -1
  108. package/dist/{provision-B0GNohdl.js → provision-CRmtV6ew.js} +10 -14
  109. package/dist/{provision-B0GNohdl.js.map → provision-CRmtV6ew.js.map} +1 -1
  110. package/dist/rolldown-runtime-D3PmRqjj.js +4 -0
  111. package/dist/{self-invocation-BtcGj-lY.js → self-invocation-DMUnXVGT.js} +5 -7
  112. package/dist/{self-invocation-BtcGj-lY.js.map → self-invocation-DMUnXVGT.js.map} +1 -1
  113. package/dist/{serve-BxZq9vNl.js → serve-wl5FKum-.js} +24 -30
  114. package/dist/{serve-BxZq9vNl.js.map → serve-wl5FKum-.js.map} +1 -1
  115. package/dist/{server-setup-BLdWCcby.js → server-setup-Ck_FRAEt.js} +67 -117
  116. package/dist/{server-setup-BLdWCcby.js.map → server-setup-Ck_FRAEt.js.map} +1 -1
  117. package/dist/{service-backend-BV2hHjuB.js → service-backend-Ce6b2XEe.js} +112 -130
  118. package/dist/service-backend-Ce6b2XEe.js.map +1 -0
  119. package/dist/{start-C3Zb8XMT.js → start-CsMY6_qY.js} +6 -8
  120. package/dist/{start-C3Zb8XMT.js.map → start-CsMY6_qY.js.map} +1 -1
  121. package/dist/{state-DzsaGHr9.js → state-CCGDJ43X.js} +2 -3
  122. package/dist/{state-DzsaGHr9.js.map → state-CCGDJ43X.js.map} +1 -1
  123. package/dist/{static-context-pack-CsOAC87F.js → static-context-pack-DwC69_VA.js} +14 -24
  124. package/dist/{static-context-pack-CsOAC87F.js.map → static-context-pack-DwC69_VA.js.map} +1 -1
  125. package/dist/{stop-gate-hook-DnLC09Lg.js → stop-gate-hook-CBVLD8iB.js} +9 -14
  126. package/dist/{stop-gate-hook-DnLC09Lg.js.map → stop-gate-hook-CBVLD8iB.js.map} +1 -1
  127. package/dist/{stop-gate-policy-Dx9c98_d.js → stop-gate-policy-BehNiNix.js} +4 -5
  128. package/dist/{stop-gate-policy-Dx9c98_d.js.map → stop-gate-policy-BehNiNix.js.map} +1 -1
  129. package/dist/{token-Dqjs5ixP.js → token-CPzYxU4Y.js} +16 -28
  130. package/dist/{token-Dqjs5ixP.js.map → token-CPzYxU4Y.js.map} +1 -1
  131. package/dist/{token-CVG0yI_j.js → token-DHEkiO4g.js} +3 -4
  132. package/dist/{token-CVG0yI_j.js.map → token-DHEkiO4g.js.map} +1 -1
  133. package/dist/{upstream-retry-i1k1Xai2.js → upstream-retry-VNR-bCuT.js} +2 -3
  134. package/dist/{upstream-retry-i1k1Xai2.js.map → upstream-retry-VNR-bCuT.js.map} +1 -1
  135. package/dist/{version-C8x2hQrZ.js → version-CTqwKr26.js} +3 -4
  136. package/dist/{version-C8x2hQrZ.js.map → version-CTqwKr26.js.map} +1 -1
  137. package/dist/{worker-dispatch-B1w2qfjX.js → worker-dispatch-C7RtNOXv.js} +3 -4
  138. package/dist/{worker-dispatch-B1w2qfjX.js.map → worker-dispatch-C7RtNOXv.js.map} +1 -1
  139. package/dist/{workiq-qnJR5_n2.js → workiq-CQauEAMc.js} +3 -4
  140. package/dist/{workiq-qnJR5_n2.js.map → workiq-CQauEAMc.js.map} +1 -1
  141. package/dist/{workiq-tools-C6LAF_vA.js → workiq-tools-7n2xXMrQ.js} +1 -1
  142. package/package.json +18 -15
  143. package/dist/ado-tools-WDyisN8w.js +0 -1
  144. package/dist/engine-C207cikp.js +0 -1
  145. package/dist/hook-mcp-client-DERIkeR7.js.map +0 -1
  146. package/dist/index-cmd-DOhwt92u.js.map +0 -1
  147. package/dist/lifecycle-C_CT13c9.js +0 -1
  148. package/dist/lifecycle-DibiH857.js +0 -1
  149. package/dist/paths-CEswtFj5.js +0 -1
  150. package/dist/peer-mcp-personas-BSxDj9sJ.js.map +0 -1
  151. package/dist/pi-BglhJ6n_.js.map +0 -1
  152. package/dist/service-backend-BV2hHjuB.js.map +0 -1
@@ -1,29 +1,29 @@
1
- import { A as validateWorkspace, C as provisionColbert, D as colbertPlatformSupported, F as outlineFile, M as isSensitivePath, N as recommendedRgThreads, O as resolveRipgrep, S as colbertSmokeOk, _ as gitState, d as runSemanticSearch, f as startupKickAllowed, j as confineToWorkspaceResult, k as searchCode, o as serviceBackendEnabled, r as runServiceSearch, u as kickBackgroundInit, x as colbertArtifactsPresent, y as readColbertMeta } from "./service-backend-BV2hHjuB.js";
2
- import { n as explicitPackageRoot } from "./package-root-B-osctCk.js";
3
- import { t as getPackageVersion } from "./version-C8x2hQrZ.js";
4
- import { t as PATHS } from "./paths-C5477RGC.js";
5
- import { t as state } from "./state-DzsaGHr9.js";
6
- import { C as copilotHeaders, E as githubAgentHeaders, S as copilotBaseUrl, T as githubAgentGraphQLHeaders, _ as isAllowedCopilotHost, b as GITHUB_API_BASE_URL, f as resolveModel, i as tryRefreshAndRetry, p as sleep$3, v as HTTPError, w as copilotVersion, x as GITHUB_GRAPHQL_URL } from "./token-Dqjs5ixP.js";
7
- import { a as withTransientRetry, i as sanitizeTransportText, n as classifyTransportError, r as fetchWithTransientRetry } from "./upstream-retry-i1k1Xai2.js";
8
- import { a as parseBoolEnv, d as runManagedExeCapture, o as parseIntEnv, s as resolveExecutable } from "./exec-Bf8g_bIR.js";
9
- import { a as FAST_PROFILE_ASTRA_MODEL, c as FAST_PROFILE_MODELS, d as FAST_PROFILE_NATIVE_MODELS, f as FAST_PROFILE_ORACLE_EFFORT, n as FAST_PROFILE_ADVISOR_EFFORT, p as FAST_PROFILE_ORACLE_MODEL, r as FAST_PROFILE_ADVISOR_MODEL, u as FAST_PROFILE_NATIVE_EFFORTS } from "./fast-profile-contract-JOnZBgFB.js";
10
- import { A as CHEAPEST2_PROFILE_MODELS, C as localContractFor, F as CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN, I as CHEAPEST_PROFILE_MODELS, M as CHEAPEST_PROFILE_ADVISOR_MODEL, N as CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT, P as CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX, T as LOCAL_PROFILE_LEAD_MODEL, _ as isBalancedFamily, a as decidePromptSubmitV2, b as isLocalFamily, c as CHEAPEST_REWRITE_EFFORT, f as balancedContractFor, g as displayModelName, h as consultIsLocalTransport, k as LOCAL_CONSULT_MAX_OUTPUT_TOKENS, m as cheapestRewriteModelFor, p as cheapestContractFor, t as buildStaticPack, u as isCheapestRewriteDisabledEnv, v as isCheapestFamily, w as BALANCED2_PROFILE_MODELS, x as isPinnedLaunchProfile, y as isCheaplocalProfile } from "./static-context-pack-CsOAC87F.js";
11
- import { r as BALANCED_PROFILE_MODELS } from "./balanced-profile-contract-Dm_usmw7.js";
12
- import { A as normalizeTrailingOneMSuffix, D as maxPeerInstructions, E as maxPeerDescription, O as fastEndpointForCatalogId, b as MAX_ADVISOR_SYSTEM_PROMPT, f as maxCodexReviewerModel, g as maxProReplacementModel, h as maxOpusModel, i as MAX_PROFILE_MODELS, k as fastEndpointForModel, m as maxGrokModel, p as maxGeminiModel, r as MAX_PROFILE_LEAD_MODEL, v as maxSonnetModel } from "./max-profile-contract-CRj7N211.js";
13
- import { i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-Gge2Dadd.js";
14
- import { t as MCP_WORKSPACE_HEADER } from "./mcp-workspace-header-Xw9B1W6T.js";
15
- import { n as ArtifactError, r as applyInsecureTls, t as ArtifactClient } from "./client-CQMfroGV.js";
16
- import { f as stopReviewStateDir, n as fileFindingsStore, o as fileRewriteFlagStore, r as fileLastPromptStore } from "./stop-gate-policy-Dx9c98_d.js";
17
- import { _ as RemoteMcpError, b as sanitizeRemoteDetail, f as getAzureRepoFromGit, g as RemoteMcpClient, h as describeAzFailure, l as ensureBluebirdClient, m as AzCliAccessTokenCache, o as BluebirdError, p as resolveAzureRepoIds, v as isRecord$4, x as sleep$4, y as parseRetryAfter } from "./bluebird-client-ByCRusGQ.js";
18
- import { r as registerColbertExitHandlers } from "./lifecycle-9nX09dBl.js";
19
- import { a as extractAndRecordPricedAic, i as extractAndRecordAic, l as recordAic, m as extractCopilotUsage, u as recordZeroCostRequest } from "./aic-ledger-Cp7Yk9-Q.js";
20
- import { d as WORKIQ_READ_TOOLS, f as WORKIQ_RETRIEVAL_CONTENT_TYPE, i as ensureWorkiqToken, m as WORKIQ_WRITE_TOOLS, n as WorkiqAuthError, t as AUTH_REMEDY, u as WORKIQ_PROTOCOL_VERSION } from "./token-CVG0yI_j.js";
21
- import { h as runGateChecks, m as sealedGateIds, p as resolveSealedGate } from "./stop-gate-hook-DnLC09Lg.js";
22
- import { t as liveExec } from "./orchestration-D3-2ulhX.js";
1
+ import { n as explicitPackageRoot } from "./package-root-BXgdIM3q.js";
2
+ import { t as getPackageVersion } from "./version-CTqwKr26.js";
3
+ import { t as PATHS } from "./paths-CVEO8jEH.js";
4
+ import { t as state } from "./state-CCGDJ43X.js";
5
+ import { C as copilotHeaders, E as githubAgentHeaders, S as copilotBaseUrl, T as githubAgentGraphQLHeaders, _ as isAllowedCopilotHost, b as GITHUB_API_BASE_URL, f as resolveModel, i as tryRefreshAndRetry, p as sleep$3, v as HTTPError, w as copilotVersion, x as GITHUB_GRAPHQL_URL } from "./token-CPzYxU4Y.js";
6
+ import { a as withTransientRetry, i as sanitizeTransportText, n as classifyTransportError, r as fetchWithTransientRetry } from "./upstream-retry-VNR-bCuT.js";
7
+ import { a as parseBoolEnv, d as runManagedExeCapture, o as parseIntEnv, s as resolveExecutable } from "./exec-BC0MAnoA.js";
8
+ import { A as validateWorkspace, C as provisionColbert, D as colbertPlatformSupported, F as outlineFile, M as isSensitivePath, N as recommendedRgThreads, O as resolveRipgrep, S as colbertSmokeOk, _ as gitState, d as runSemanticSearch, f as startupKickAllowed, j as confineToWorkspaceResult, k as searchCode, o as serviceBackendEnabled, r as runServiceSearch, u as kickBackgroundInit, x as colbertArtifactsPresent, y as readColbertMeta } from "./service-backend-Ce6b2XEe.js";
9
+ import { a as FAST_PROFILE_ASTRA_MODEL, c as FAST_PROFILE_MODELS, d as FAST_PROFILE_NATIVE_MODELS, f as FAST_PROFILE_ORACLE_EFFORT, n as FAST_PROFILE_ADVISOR_EFFORT, p as FAST_PROFILE_ORACLE_MODEL, r as FAST_PROFILE_ADVISOR_MODEL, u as FAST_PROFILE_NATIVE_EFFORTS } from "./fast-profile-contract-BLnKg0Ay.js";
10
+ import { A as CHEAPEST2_PROFILE_MODELS, C as localContractFor, F as CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN, I as CHEAPEST_PROFILE_MODELS, M as CHEAPEST_PROFILE_ADVISOR_MODEL, N as CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT, P as CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX, T as LOCAL_PROFILE_LEAD_MODEL, _ as isBalancedFamily, a as decidePromptSubmitV2, b as isLocalFamily, c as CHEAPEST_REWRITE_EFFORT, f as balancedContractFor, g as displayModelName, h as consultIsLocalTransport, k as LOCAL_CONSULT_MAX_OUTPUT_TOKENS, m as cheapestRewriteModelFor, p as cheapestContractFor, t as buildStaticPack, u as isCheapestRewriteDisabledEnv, v as isCheapestFamily, w as BALANCED2_PROFILE_MODELS, x as isPinnedLaunchProfile, y as isCheaplocalProfile } from "./static-context-pack-DwC69_VA.js";
11
+ import { r as BALANCED_PROFILE_MODELS } from "./balanced-profile-contract-B6pSoWjm.js";
12
+ import { A as normalizeTrailingOneMSuffix, D as maxPeerInstructions, E as maxPeerDescription, O as fastEndpointForCatalogId, b as MAX_ADVISOR_SYSTEM_PROMPT, f as maxCodexReviewerModel, g as maxProReplacementModel, h as maxOpusModel, i as MAX_PROFILE_MODELS, k as fastEndpointForModel, m as maxGrokModel, p as maxGeminiModel, r as MAX_PROFILE_LEAD_MODEL, v as maxSonnetModel } from "./max-profile-contract-DLLTsSs2.js";
13
+ import { i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-Dh9y8OF1.js";
14
+ import { t as MCP_WORKSPACE_HEADER } from "./mcp-workspace-header-C5-dOWNa.js";
15
+ import { n as ArtifactError, r as applyInsecureTls, t as ArtifactClient } from "./client-Bjp3XAMK.js";
16
+ import { f as stopReviewStateDir, n as fileFindingsStore, o as fileRewriteFlagStore, r as fileLastPromptStore } from "./stop-gate-policy-BehNiNix.js";
17
+ import { _ as RemoteMcpError, b as sanitizeRemoteDetail, f as getAzureRepoFromGit, g as RemoteMcpClient, h as describeAzFailure, l as ensureBluebirdClient, m as AzCliAccessTokenCache, o as BluebirdError, p as resolveAzureRepoIds, v as isRecord$4, x as sleep$4, y as parseRetryAfter } from "./bluebird-client-BasIdv5J.js";
18
+ import { r as registerColbertExitHandlers } from "./lifecycle-vjHAFCaY.js";
19
+ import { a as extractAndRecordPricedAic, i as extractAndRecordAic, l as recordAic, m as extractCopilotUsage, u as recordZeroCostRequest } from "./aic-ledger-CeSXqTEE.js";
20
+ import { d as WORKIQ_READ_TOOLS, f as WORKIQ_RETRIEVAL_CONTENT_TYPE, i as ensureWorkiqToken, m as WORKIQ_WRITE_TOOLS, n as WorkiqAuthError, t as AUTH_REMEDY, u as WORKIQ_PROTOCOL_VERSION } from "./token-DHEkiO4g.js";
21
+ import { h as runGateChecks, m as sealedGateIds, p as resolveSealedGate } from "./stop-gate-hook-CBVLD8iB.js";
22
+ import { t as liveExec } from "./orchestration-B93jxrWI.js";
23
23
  import { createRequire } from "node:module";
24
24
  import consola from "consola";
25
25
  import { chmodSync, closeSync, constants, cpSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
26
- import path, * as path$1 from "node:path";
26
+ import path$1, * as path from "node:path";
27
27
  import { fileURLToPath } from "node:url";
28
28
  import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
29
29
  import fs$1, { open, readFile, stat } from "node:fs/promises";
@@ -39,7 +39,7 @@ import { Type } from "typebox";
39
39
  import "partial-json";
40
40
  import { Compile } from "typebox/compile";
41
41
  import { Value } from "typebox/value";
42
- //#region src/lib/cheap-profile-contract.ts
42
+ // src/lib/cheap-profile-contract.ts
43
43
  /**
44
44
  * Fixed identities for the literal `github-router claude -m cheap` and
45
45
  * `-m cheap1m` cheap-family profiles.
@@ -122,8 +122,7 @@ Object.freeze({
122
122
  "General-Purpose": Object.freeze(["reviewer"]),
123
123
  reviewer: Object.freeze([])
124
124
  });
125
- //#endregion
126
- //#region src/lib/one-m-context.ts
125
+ // src/lib/one-m-context.ts
127
126
  /**
128
127
  * Context-window threshold at which Claude Code's `[1m]` accounting unlock is
129
128
  * worth requesting. Shared by `pickClaudeDefault` (`./port`), the gateway
@@ -240,8 +239,7 @@ function withOneMSuffixForLead(slug) {
240
239
  if (oneMContextDisabled()) return base;
241
240
  return catalogAdvertises1M(resolveModel(base)) ? `${base}[1m]` : base;
242
241
  }
243
- //#endregion
244
- //#region src/services/copilot/endpoint.ts
242
+ // src/services/copilot/endpoint.ts
245
243
  /**
246
244
  * Catalog spellings that mean each of our two clients. Copilot is not
247
245
  * self-consistent about the `/v1` prefix — the live catalog advertises
@@ -304,8 +302,7 @@ function resolveEndpointForModelId(id) {
304
302
  endpoints: found.supported_endpoints ?? []
305
303
  };
306
304
  }
307
- //#endregion
308
- //#region src/lib/anthropic-translate/classifier.ts
305
+ // src/lib/anthropic-translate/classifier.ts
309
306
  /**
310
307
  * Routing classifier for `POST /v1/messages`.
311
308
  *
@@ -410,8 +407,7 @@ function classifyMessagesRoute(modelId, model, originalModelId, fastProfile = fa
410
407
  if (endpoint === "chat") return "chat-shim";
411
408
  return "claude-passthrough";
412
409
  }
413
- //#endregion
414
- //#region src/lib/port.ts
410
+ // src/lib/port.ts
415
411
  const DEFAULT_PORT = 8787;
416
412
  const DEFAULT_CLAUDE_MODEL_FALLBACKS = [
417
413
  "claude-opus-5",
@@ -686,8 +682,7 @@ function upstreamAllowH2() {
686
682
  function upstreamMaxConnections() {
687
683
  return envInt$1("GH_ROUTER_UPSTREAM_MAX_CONNECTIONS", 256);
688
684
  }
689
- //#endregion
690
- //#region src/lib/toolbelt/path-inject.ts
685
+ // src/lib/toolbelt/path-inject.ts
691
686
  /**
692
687
  * PATH-injection helpers for the LLM toolbelt.
693
688
  *
@@ -715,7 +710,7 @@ function pathEnvKey(env) {
715
710
  function toolbeltPathOverride(parentEnv, binDir) {
716
711
  const key = pathEnvKey(parentEnv);
717
712
  const current = parentEnv[key] ?? "";
718
- return { [key]: current ? `${binDir}${path.delimiter}${current}` : binDir };
713
+ return { [key]: current ? `${binDir}${path$1.delimiter}${current}` : binDir };
719
714
  }
720
715
  /**
721
716
  * Defense-in-depth: collapse all case-variant PATH keys in `env` into a
@@ -736,8 +731,7 @@ function collapsePathKeys(env) {
736
731
  env[process.platform === "win32" ? "Path" : "PATH"] = bestValue;
737
732
  return env;
738
733
  }
739
- //#endregion
740
- //#region src/lib/local-consult-redaction.ts
734
+ // src/lib/local-consult-redaction.ts
741
735
  /**
742
736
  * The two halves of the redaction contract that surrounds a local consult.
743
737
  *
@@ -772,8 +766,7 @@ const LOCAL_CONSULT_REDACTION_LINE = "Replace every credential, token, key, pass
772
766
  * the wrong question.
773
767
  */
774
768
  const LOCAL_CONSULT_REDACTION_NOTE = "Any credential in the material you receive has been replaced with a placeholder; treat it as an unknown value and do not ask for the real one.";
775
- //#endregion
776
- //#region src/lib/artifact/tools.ts
769
+ // src/lib/artifact/tools.ts
777
770
  const ARTIFACT_GROUP = "peers";
778
771
  const ARTIFACT_POLL_TOOL_BUDGET_MS = 5e4;
779
772
  const ARTIFACT_SINGLE_POLL_TIMEOUT_MS = 25e3;
@@ -1129,8 +1122,7 @@ function enumProp$1(values, description) {
1129
1122
  description
1130
1123
  };
1131
1124
  }
1132
- //#endregion
1133
- //#region src/lib/colbert/index.ts
1125
+ // src/lib/colbert/index.ts
1134
1126
  /**
1135
1127
  * ColBERT semantic-search sidecar — public entry points.
1136
1128
  *
@@ -1239,8 +1231,7 @@ async function colbertDegradedWarning(cwd, opts = {}) {
1239
1231
  return null;
1240
1232
  }
1241
1233
  }
1242
- //#endregion
1243
- //#region src/lib/unified-code-search.ts
1234
+ // src/lib/unified-code-search.ts
1244
1235
  /**
1245
1236
  * Unified, semantic-first code search; the single source of truth behind
1246
1237
  * BOTH the MCP `code` tool (`src/lib/peer-mcp-personas.ts`) and the worker
@@ -1367,15 +1358,15 @@ async function outlinesForSemanticResults(input, results, signal) {
1367
1358
  }
1368
1359
  const outlines = [];
1369
1360
  const deadline = Date.now() + 2e3;
1370
- const workspace = path.resolve(input.workspace);
1361
+ const workspace = path$1.resolve(input.workspace);
1371
1362
  for (const file of files) {
1372
1363
  if (signal?.aborted || Date.now() > deadline) break;
1373
1364
  const normalized = file.replaceAll("\\", "/").replace(/^\/+/, "");
1374
1365
  if (!normalized || normalized.includes("\0") || /^[A-Za-z]:/.test(normalized) || normalized.startsWith("//")) continue;
1375
1366
  if (normalized.split("/").some((part) => part === "..")) continue;
1376
- const abs = path.resolve(workspace, normalized);
1377
- const rel = path.relative(workspace, abs);
1378
- if (!rel || rel.startsWith("..") || path.isAbsolute(rel)) continue;
1367
+ const abs = path$1.resolve(workspace, normalized);
1368
+ const rel = path$1.relative(workspace, abs);
1369
+ if (!rel || rel.startsWith("..") || path$1.isAbsolute(rel)) continue;
1379
1370
  try {
1380
1371
  const outlined = await outlineFile(abs, signal);
1381
1372
  outlines.push({
@@ -1578,8 +1569,7 @@ async function runUnifiedCodeSearch(input, signal) {
1578
1569
  notice: joinNotice(r.notice, semanticFallbackNotice(sem))
1579
1570
  };
1580
1571
  }
1581
- //#endregion
1582
- //#region src/lib/hook-prompt-brief.ts
1572
+ // src/lib/hook-prompt-brief.ts
1583
1573
  /**
1584
1574
  * Pi's native MCP servers are always `gh-router-`-prefixed
1585
1575
  * (`PI_MCP_SERVER_PREFIX`, so a user's own `search` entry can never shadow
@@ -1680,11 +1670,9 @@ async function runPiPromptBrief(input) {
1680
1670
  return "";
1681
1671
  }
1682
1672
  }
1683
- //#endregion
1684
- //#region src/lib/gemini-review-model.ts
1673
+ // src/lib/gemini-review-model.ts
1685
1674
  const GEMINI_REVIEW_DEFAULT_MODEL = "gemini-3.1-pro-preview";
1686
- //#endregion
1687
- //#region src/lib/fleet/mesh-egress-agent.ts
1675
+ // src/lib/fleet/mesh-egress-agent.ts
1688
1676
  /**
1689
1677
  * Runtime-aware "route this fetch through the mesh loopback egress proxy" for a
1690
1678
  * mesh peer. Mirrors `~/lib/insecure-tls`'s `applyInsecureTls`: the BUILT proxy
@@ -1734,8 +1722,7 @@ function applyMeshEgressProxy(init, meshProxy, isBun = IS_BUN) {
1734
1722
  init.dispatcher = agent;
1735
1723
  return agent;
1736
1724
  }
1737
- //#endregion
1738
- //#region src/lib/fleet/tunnel-auth.ts
1725
+ // src/lib/fleet/tunnel-auth.ts
1739
1726
  var TunnelAuthError = class extends Error {
1740
1727
  code;
1741
1728
  constructor(code, message) {
@@ -1761,7 +1748,7 @@ function safeRealpath(p) {
1761
1748
  try {
1762
1749
  return realpathSync(p);
1763
1750
  } catch {
1764
- return path.resolve(p);
1751
+ return path$1.resolve(p);
1765
1752
  }
1766
1753
  }
1767
1754
  /**
@@ -1773,14 +1760,14 @@ function safeRealpath(p) {
1773
1760
  * non-canonical path like `/safe/../cwd/devtunnel` or a symlink cannot evade it.
1774
1761
  * Returns the (original) path to spawn, or throws.
1775
1762
  */
1776
- function assertTrustedDevtunnelPath(resolved, cwd = typeof process.cwd === "function" ? path.resolve(process.cwd()) : null) {
1763
+ function assertTrustedDevtunnelPath(resolved, cwd = typeof process.cwd === "function" ? path$1.resolve(process.cwd()) : null) {
1777
1764
  if (!resolved) throw new TunnelAuthError("NOT_INSTALLED", "the devtunnel CLI was not found on PATH; install it and run `devtunnel user login` on this (control-plane) machine");
1778
- if (!path.isAbsolute(resolved)) throw new TunnelAuthError("NOT_INSTALLED", "refusing to run a non-absolute devtunnel binary");
1779
- const ext = path.extname(resolved).toLowerCase();
1765
+ if (!path$1.isAbsolute(resolved)) throw new TunnelAuthError("NOT_INSTALLED", "refusing to run a non-absolute devtunnel binary");
1766
+ const ext = path$1.extname(resolved).toLowerCase();
1780
1767
  if (ext === ".cmd" || ext === ".bat" || ext === ".ps1") throw new TunnelAuthError("NOT_INSTALLED", "resolved devtunnel is a script shim (.cmd/.bat/.ps1); github-router runs the native devtunnel(.exe) — ensure the native binary precedes any shim on PATH");
1781
1768
  const realResolved = safeRealpath(resolved);
1782
1769
  const realCwd = cwd ? safeRealpath(cwd) : null;
1783
- if (realCwd && (realResolved === realCwd || realResolved.startsWith(realCwd + path.sep))) throw new TunnelAuthError("NOT_INSTALLED", "refusing to run a cwd-local devtunnel binary");
1770
+ if (realCwd && (realResolved === realCwd || realResolved.startsWith(realCwd + path$1.sep))) throw new TunnelAuthError("NOT_INSTALLED", "refusing to run a cwd-local devtunnel binary");
1784
1771
  return resolved;
1785
1772
  }
1786
1773
  /**
@@ -1946,8 +1933,7 @@ function createTunnelTokenProvider(runner = realDevtunnelRunner()) {
1946
1933
  }
1947
1934
  };
1948
1935
  }
1949
- //#endregion
1950
- //#region src/lib/fleet/client.ts
1936
+ // src/lib/fleet/client.ts
1951
1937
  var FleetError = class extends Error {
1952
1938
  code;
1953
1939
  retryable;
@@ -2334,8 +2320,7 @@ async function closeQuietly(agent) {
2334
2320
  else if (typeof agent.close === "function") await agent.close();
2335
2321
  } catch {}
2336
2322
  }
2337
- //#endregion
2338
- //#region src/lib/fleet/registry.ts
2323
+ // src/lib/fleet/registry.ts
2339
2324
  var FleetRegistryError = class extends Error {
2340
2325
  code;
2341
2326
  constructor(code, message) {
@@ -2345,7 +2330,7 @@ var FleetRegistryError = class extends Error {
2345
2330
  }
2346
2331
  };
2347
2332
  function defaultFleetConfigPath() {
2348
- return process.env.GH_ROUTER_FLEET_CONFIG || path.join(os.homedir(), ".local", "share", "github-router", "fleet.json");
2333
+ return process.env.GH_ROUTER_FLEET_CONFIG || path$1.join(os.homedir(), ".local", "share", "github-router", "fleet.json");
2349
2334
  }
2350
2335
  async function loadFleetRegistryConfig(configPath = defaultFleetConfigPath()) {
2351
2336
  let stat;
@@ -2558,8 +2543,7 @@ function isObject(value) {
2558
2543
  function isNodeErrorCode(err, code) {
2559
2544
  return isObject(err) && err.code === code;
2560
2545
  }
2561
- //#endregion
2562
- //#region src/lib/fleet/discovery.ts
2546
+ // src/lib/fleet/discovery.ts
2563
2547
  /**
2564
2548
  * Mesh fleet discovery: read the local ai-or-die instance's `mesh/peers.json`
2565
2549
  * (written by its MeshManager from the sidecar's tailnet `Status()`) off disk and
@@ -2575,20 +2559,20 @@ const EGRESS_JSON_MAX_BYTES = 65536;
2575
2559
  /** The ai-or-die app data dir (NOT github-router's) — mirrors MeshManager's `base`. */
2576
2560
  function aiordieAppDir() {
2577
2561
  if (process.platform === "win32") {
2578
- const localApp = process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local");
2579
- return path.join(localApp, "ai-or-die");
2562
+ const localApp = process.env.LOCALAPPDATA || path$1.join(os.homedir(), "AppData", "Local");
2563
+ return path$1.join(localApp, "ai-or-die");
2580
2564
  }
2581
- return path.join(os.homedir(), ".ai-or-die");
2565
+ return path$1.join(os.homedir(), ".ai-or-die");
2582
2566
  }
2583
2567
  function meshPeersFilePath() {
2584
2568
  const override = process.env.GH_ROUTER_FLEET_PEERS_FILE;
2585
2569
  if (override && override.trim() !== "") return override.trim();
2586
- return path.join(aiordieAppDir(), "mesh", "peers.json");
2570
+ return path$1.join(aiordieAppDir(), "mesh", "peers.json");
2587
2571
  }
2588
2572
  function meshEgressFilePath() {
2589
2573
  const override = process.env.GH_ROUTER_FLEET_EGRESS_FILE;
2590
2574
  if (override && override.trim() !== "") return override.trim();
2591
- return path.join(aiordieAppDir(), "mesh", "egress.json");
2575
+ return path$1.join(aiordieAppDir(), "mesh", "egress.json");
2592
2576
  }
2593
2577
  function meshDiscoveryDisabled() {
2594
2578
  return process.env.GH_ROUTER_FLEET_DISCOVERY === "0";
@@ -2806,8 +2790,7 @@ var MergedFleetRegistry = class {
2806
2790
  return [...staticInfos, ...discovered.map(toInfo)];
2807
2791
  }
2808
2792
  };
2809
- //#endregion
2810
- //#region src/lib/fleet/driver.ts
2793
+ // src/lib/fleet/driver.ts
2811
2794
  /** ai-or-die named keys (raw:false maps these; never a literal "\r"). C4. */
2812
2795
  const SUBMIT_KEY = "enter";
2813
2796
  const INTERRUPT_KEY = "ctrl-c";
@@ -3260,8 +3243,7 @@ async function driveTask(deps) {
3260
3243
  sendConfirmation: send.confirmation
3261
3244
  };
3262
3245
  }
3263
- //#endregion
3264
- //#region src/lib/fleet/tools.ts
3246
+ // src/lib/fleet/tools.ts
3265
3247
  const FLEET_GROUP = "fleet";
3266
3248
  const INSTANCE_PROBE_TIMEOUT_MS = 2e3;
3267
3249
  const INSTANCE_PROBE_CACHE_TTL_MS = 5e3;
@@ -4150,8 +4132,7 @@ function arrayProp(description) {
4150
4132
  description
4151
4133
  };
4152
4134
  }
4153
- //#endregion
4154
- //#region src/lib/agent/types.ts
4135
+ // src/lib/agent/types.ts
4155
4136
  var AgentError = class extends Error {
4156
4137
  code;
4157
4138
  cause;
@@ -4162,8 +4143,7 @@ var AgentError = class extends Error {
4162
4143
  this.cause = options?.cause;
4163
4144
  }
4164
4145
  };
4165
- //#endregion
4166
- //#region src/lib/agent/rest.ts
4146
+ // src/lib/agent/rest.ts
4167
4147
  function restHeaders(apiVersion, extra) {
4168
4148
  const headers = githubAgentHeaders(state);
4169
4149
  if (apiVersion) headers["x-github-api-version"] = apiVersion;
@@ -4230,8 +4210,7 @@ async function ghRest(method, path, opts = {}) {
4230
4210
  if (!response.ok) throw agentErrorFromResponse(response);
4231
4211
  return parseJsonOrEmpty(response);
4232
4212
  }
4233
- //#endregion
4234
- //#region src/lib/agent/graphql.ts
4213
+ // src/lib/agent/graphql.ts
4235
4214
  function graphQLErrorMessage(error) {
4236
4215
  return String(error.message ?? error.type ?? error.extensions?.code ?? "GraphQL error");
4237
4216
  }
@@ -4282,8 +4261,7 @@ async function ghGraphQL(query, variables, opts = {}) {
4282
4261
  if (payload.data === void 0) throw new AgentError("UPSTREAM", "GitHub GraphQL response did not include data");
4283
4262
  return payload.data;
4284
4263
  }
4285
- //#endregion
4286
- //#region src/lib/agent/service.ts
4264
+ // src/lib/agent/service.ts
4287
4265
  const CACHE_TTL_MS = 3e5;
4288
4266
  const FILE_SUMMARY_LIMIT = 50;
4289
4267
  const CHECK_SUMMARY_LIMIT = 20;
@@ -4860,8 +4838,7 @@ function repoContentPath$1(path) {
4860
4838
  function gitRefBranchPath$1(branch) {
4861
4839
  return branch.split("/").map(segment$2).join("/");
4862
4840
  }
4863
- //#endregion
4864
- //#region src/lib/agent/capi.ts
4841
+ // src/lib/agent/capi.ts
4865
4842
  const CAPI_INTEGRATION_ID = "copilot-4-cli";
4866
4843
  const CAPI_API_VERSION = "2026-01-09";
4867
4844
  const HOST_CACHE_TTL_MS = 6e5;
@@ -5092,8 +5069,7 @@ async function getSessionLog(sessionId, signal) {
5092
5069
  return null;
5093
5070
  }
5094
5071
  }
5095
- //#endregion
5096
- //#region src/lib/agent/tasks.ts
5072
+ // src/lib/agent/tasks.ts
5097
5073
  const AGENT_TASKS_API_VERSION = "2026-03-10";
5098
5074
  const LOG_EXCERPT_LIMIT = 4e3;
5099
5075
  const TRUNCATED_MARKER = "…[truncated]…";
@@ -5266,11 +5242,10 @@ async function cancelTask(repo, taskId) {
5266
5242
  await ghRest("POST", `${taskPath(repo, taskId)}${CANCEL_TASK_PATH_SUFFIX}`, { apiVersion: AGENT_TASKS_API_VERSION });
5267
5243
  return { cancelled: true };
5268
5244
  }
5269
- //#endregion
5270
- //#region src/lib/first-mate/scheduler/lease.ts
5245
+ // src/lib/first-mate/scheduler/lease.ts
5271
5246
  const DEFAULT_TTL_MS = 3e4;
5272
5247
  function leasePath(dir) {
5273
- return path.join(dir, "scheduler.lease.json");
5248
+ return path$1.join(dir, "scheduler.lease.json");
5274
5249
  }
5275
5250
  function isLease(value) {
5276
5251
  if (typeof value !== "object" || value === null) return false;
@@ -5293,7 +5268,7 @@ async function readLeaseFile(file) {
5293
5268
  }
5294
5269
  }
5295
5270
  async function writeLeaseAtomic(file, lease) {
5296
- await fs$1.mkdir(path.dirname(file), { recursive: true });
5271
+ await fs$1.mkdir(path$1.dirname(file), { recursive: true });
5297
5272
  const tmp = `${file}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
5298
5273
  try {
5299
5274
  await fs$1.writeFile(tmp, `${JSON.stringify(lease, null, 2)}\n`, { mode: 384 });
@@ -5306,7 +5281,7 @@ async function writeLeaseAtomic(file, lease) {
5306
5281
  const LEASE_LOCK_MAX_WAIT_MS = 1e4;
5307
5282
  async function withLeaseLock(file, fn, hooks) {
5308
5283
  const lockPath = `${file}.lock`;
5309
- await fs$1.mkdir(path.dirname(lockPath), { recursive: true });
5284
+ await fs$1.mkdir(path$1.dirname(lockPath), { recursive: true });
5310
5285
  const ownerToken = `${process.pid}-${randomBytes(8).toString("hex")}`;
5311
5286
  const staging = `${lockPath}.acq.${ownerToken}`;
5312
5287
  await fs$1.writeFile(staging, ownerToken, { mode: 384 });
@@ -5481,8 +5456,7 @@ function makeDriveGate(lease) {
5481
5456
  return (await lease.renew() ?? await lease.tryAcquire()) !== void 0;
5482
5457
  };
5483
5458
  }
5484
- //#endregion
5485
- //#region src/lib/first-mate/durable-store.ts
5459
+ // src/lib/first-mate/durable-store.ts
5486
5460
  var DurableConflictError = class extends Error {
5487
5461
  constructor(message) {
5488
5462
  super(message);
@@ -5541,7 +5515,7 @@ const RENAME_RETRY_DELAYS_MS = [
5541
5515
  500
5542
5516
  ];
5543
5517
  async function writeJsonSecure(target, value) {
5544
- await fs$1.mkdir(path.dirname(target), { recursive: true });
5518
+ await fs$1.mkdir(path$1.dirname(target), { recursive: true });
5545
5519
  const tmp = `${target}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
5546
5520
  try {
5547
5521
  await fs$1.writeFile(tmp, `${JSON.stringify(value, null, 2)}\n`, { mode: 384 });
@@ -5568,7 +5542,7 @@ const LOCK_RETRY_MS = 25;
5568
5542
  const LOCK_MAX_WAIT_MS = 1e4;
5569
5543
  async function withFileLock(target, fn) {
5570
5544
  const lockPath = `${target}.lock`;
5571
- await fs$1.mkdir(path.dirname(lockPath), { recursive: true });
5545
+ await fs$1.mkdir(path$1.dirname(lockPath), { recursive: true });
5572
5546
  const ownerToken = `${process.pid}-${randomBytes(8).toString("hex")}`;
5573
5547
  const start = Date.now();
5574
5548
  for (;;) try {
@@ -5680,8 +5654,7 @@ async function commitJsonCas(opts) {
5680
5654
  }
5681
5655
  throw lastConflict ?? new DurableConflictError(`durable store failed to converge for ${opts.path}`);
5682
5656
  }
5683
- //#endregion
5684
- //#region src/lib/first-mate/decisions.ts
5657
+ // src/lib/first-mate/decisions.ts
5685
5658
  const DECISIONS_VERSION = 1;
5686
5659
  const DECISION_STATUSES = /* @__PURE__ */ new Set([
5687
5660
  "pending",
@@ -5690,7 +5663,7 @@ const DECISION_STATUSES = /* @__PURE__ */ new Set([
5690
5663
  "queued_away_irreversible"
5691
5664
  ]);
5692
5665
  function decisionsPath() {
5693
- return path.join(PATHS.FIRST_MATE_DIR, "decisions.json");
5666
+ return path$1.join(PATHS.FIRST_MATE_DIR, "decisions.json");
5694
5667
  }
5695
5668
  function asRecord$5(value) {
5696
5669
  return typeof value === "object" && value !== null ? value : void 0;
@@ -5827,8 +5800,7 @@ async function markAnswered(decisionId, chosenOptionId, resolvedBy) {
5827
5800
  record.resolvedMs = Date.now();
5828
5801
  });
5829
5802
  }
5830
- //#endregion
5831
- //#region src/lib/first-mate/approval.ts
5803
+ // src/lib/first-mate/approval.ts
5832
5804
  function sameRepo$1(a, b) {
5833
5805
  return a.owner.toLowerCase() === b.owner.toLowerCase() && a.name.toLowerCase() === b.name.toLowerCase();
5834
5806
  }
@@ -5912,8 +5884,7 @@ async function verifyAndConsumeApproval(args) {
5912
5884
  return { ok: true };
5913
5885
  });
5914
5886
  }
5915
- //#endregion
5916
- //#region src/lib/copilot-model-policy.ts
5887
+ // src/lib/copilot-model-policy.ts
5917
5888
  /**
5918
5889
  * Which Copilot models a running proxy is allowed to bill.
5919
5890
  *
@@ -6171,8 +6142,7 @@ function resolveTierModel(tier, opts = {}) {
6171
6142
  };
6172
6143
  return value;
6173
6144
  }
6174
- //#endregion
6175
- //#region src/lib/first-mate/classifier.ts
6145
+ // src/lib/first-mate/classifier.ts
6176
6146
  function isRecord$3(value) {
6177
6147
  return typeof value === "object" && value !== null && !Array.isArray(value);
6178
6148
  }
@@ -6314,8 +6284,7 @@ async function classifyStuck(logExcerpt) {
6314
6284
  }
6315
6285
  }))?.value ?? null;
6316
6286
  }
6317
- //#endregion
6318
- //#region src/lib/first-mate/decision-packet.ts
6287
+ // src/lib/first-mate/decision-packet.ts
6319
6288
  const HTML_ESCAPES = {
6320
6289
  "&": "&",
6321
6290
  "<": "&lt;",
@@ -6439,8 +6408,7 @@ ${optionCards}
6439
6408
  decisionId
6440
6409
  };
6441
6410
  }
6442
- //#endregion
6443
- //#region src/lib/first-mate/ledger.ts
6411
+ // src/lib/first-mate/ledger.ts
6444
6412
  const LEDGER_VERSION = 1;
6445
6413
  const DEFAULT_TERMINAL_MAX_AGE_MS = 6048e5;
6446
6414
  const AGENTS = /* @__PURE__ */ new Set([
@@ -6499,7 +6467,7 @@ function sanitizeSegment$1(value) {
6499
6467
  return cleaned.length > 0 ? cleaned : "_";
6500
6468
  }
6501
6469
  function repoLedgerPath(repo) {
6502
- return path.join(PATHS.FIRST_MATE_DIR, `${sanitizeSegment$1(repo.owner)}__${sanitizeSegment$1(repo.name)}.json`);
6470
+ return path$1.join(PATHS.FIRST_MATE_DIR, `${sanitizeSegment$1(repo.owner)}__${sanitizeSegment$1(repo.name)}.json`);
6503
6471
  }
6504
6472
  function asRecord$4(value) {
6505
6473
  return typeof value === "object" && value !== null ? value : void 0;
@@ -6650,11 +6618,10 @@ async function pruneTerminal(repo, maxAgeMs = DEFAULT_TERMINAL_MAX_AGE_MS) {
6650
6618
  return current.filter((row) => row.terminal !== true || keptTerminals.has(row));
6651
6619
  });
6652
6620
  }
6653
- //#endregion
6654
- //#region src/lib/first-mate/registry.ts
6621
+ // src/lib/first-mate/registry.ts
6655
6622
  const REGISTRY_VERSION = 1;
6656
6623
  function registryPath() {
6657
- return path.join(PATHS.FIRST_MATE_DIR, "missions.json");
6624
+ return path$1.join(PATHS.FIRST_MATE_DIR, "missions.json");
6658
6625
  }
6659
6626
  function asRecord$3(value) {
6660
6627
  return typeof value === "object" && value !== null ? value : void 0;
@@ -6757,8 +6724,7 @@ async function loadAllUnits(missionIdFilter) {
6757
6724
  }
6758
6725
  return units;
6759
6726
  }
6760
- //#endregion
6761
- //#region src/lib/first-mate/dod.ts
6727
+ // src/lib/first-mate/dod.ts
6762
6728
  const DOD_TEXT = `Definition of Done — the agent MUST satisfy ALL of the following before declaring work complete:
6763
6729
 
6764
6730
  1. Run the FULL test, lint, and typecheck suite and paste the ACTUAL verbatim output. Never claim success — show the output.
@@ -6774,8 +6740,7 @@ function renderDod(acceptanceCriteria) {
6774
6740
  parts.push(DOD_TEXT);
6775
6741
  return parts.join("\n\n");
6776
6742
  }
6777
- //#endregion
6778
- //#region src/lib/first-mate/observe.ts
6743
+ // src/lib/first-mate/observe.ts
6779
6744
  const PROVIDER_STATES$1 = /* @__PURE__ */ new Set([
6780
6745
  "none",
6781
6746
  "queued",
@@ -7008,8 +6973,7 @@ async function observeUnit(unit) {
7008
6973
  ...artifactPrimaryState?.nodeId ? { prNodeId: artifactPrimaryState.nodeId } : {}
7009
6974
  };
7010
6975
  }
7011
- //#endregion
7012
- //#region src/lib/first-mate/task-model.ts
6976
+ // src/lib/first-mate/task-model.ts
7013
6977
  /**
7014
6978
  * Resolve the model the GitHub cloud coding agent should run a first-mate task
7015
6979
  * with.
@@ -7050,11 +7014,10 @@ function resolveCloudAgentModel(chosen, catalog) {
7050
7014
  for (const candidate of [DEFAULT_CODEX_MODEL, ...DEFAULT_CODEX_MODEL_FALLBACKS]) if (ids.has(candidate)) return candidate;
7051
7015
  return DEFAULT_CODEX_MODEL;
7052
7016
  }
7053
- //#endregion
7054
- //#region src/lib/first-mate/scheduler/outbox.ts
7017
+ // src/lib/first-mate/scheduler/outbox.ts
7055
7018
  const OUTBOX_VERSION = 1;
7056
7019
  function outboxPath(dir) {
7057
- return path.join(dir, "scheduler.outbox.json");
7020
+ return path$1.join(dir, "scheduler.outbox.json");
7058
7021
  }
7059
7022
  function isEntry(value) {
7060
7023
  if (typeof value !== "object" || value === null) return false;
@@ -7087,7 +7050,7 @@ var Outbox = class {
7087
7050
  }
7088
7051
  }
7089
7052
  async write(entries) {
7090
- await fs$1.mkdir(path.dirname(this.file), { recursive: true });
7053
+ await fs$1.mkdir(path$1.dirname(this.file), { recursive: true });
7091
7054
  const tmp = `${this.file}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
7092
7055
  const value = {
7093
7056
  version: OUTBOX_VERSION,
@@ -7352,14 +7315,12 @@ function nextAction(state, row, policy) {
7352
7315
  }
7353
7316
  return { kind: "noop" };
7354
7317
  }
7355
- //#endregion
7356
- //#region src/lib/first-mate/types.ts
7318
+ // src/lib/first-mate/types.ts
7357
7319
  const DEFAULT_POLICY = {
7358
7320
  maxRetries: 6,
7359
7321
  totalFixCap: 10
7360
7322
  };
7361
- //#endregion
7362
- //#region src/lib/first-mate/controller.ts
7323
+ // src/lib/first-mate/controller.ts
7363
7324
  const MODEL_KINDS = [
7364
7325
  "review_plan",
7365
7326
  "answer_agent_question",
@@ -7424,9 +7385,9 @@ function sanitizeSegment(value) {
7424
7385
  return cleaned.length > 0 ? cleaned : "_";
7425
7386
  }
7426
7387
  async function writeDecisionPacketHtml(packetId, html) {
7427
- const dir = path.join(PATHS.FIRST_MATE_DIR, "packets");
7388
+ const dir = path$1.join(PATHS.FIRST_MATE_DIR, "packets");
7428
7389
  await fs$1.mkdir(dir, { recursive: true });
7429
- const target = path.join(dir, `${sanitizeSegment(packetId)}.html`);
7390
+ const target = path$1.join(dir, `${sanitizeSegment(packetId)}.html`);
7430
7391
  await fs$1.writeFile(target, html, { mode: 384 });
7431
7392
  return target;
7432
7393
  }
@@ -9270,8 +9231,7 @@ async function advance(input = {}, deps = defaultDeps) {
9270
9231
  };
9271
9232
  return fenceToken !== void 0 ? runFenced(fenceToken, runDrive) : runDrive();
9272
9233
  }
9273
- //#endregion
9274
- //#region src/lib/first-mate/operating-protocol.ts
9234
+ // src/lib/first-mate/operating-protocol.ts
9275
9235
  /**
9276
9236
  * Single source of truth for the condensed CEO/CTO/CPO operating sequence.
9277
9237
  *
@@ -9358,8 +9318,7 @@ Anti-cargo-cult (do NOT fake a check): a screenshot file existing, a green \`toH
9358
9318
 
9359
9319
  ## Soft signals & anti-cargo-cult (do NOT fake a checkmark, do NOT hard-gate)
9360
9320
  SEO indexing/ranking is never guaranteed by Google; E-E-A-T/content quality has no exposed score. Proxy via byline/last-updated presence, content architecture, and (with auth) Search Console Performance — record as evidence, not a binary pass. Do NOT hard-gate raw test-coverage %, raw star count, "has a Discord", Diataxis "compliance" as a box-tick, or any \`community/profile\` file-presence number treated as evidence of community — taken as proof of greatness these ARE the hallucinated-progress trap. The intangibles that separate LOVED from merely-functional — a clear vision/opinion, DX that delights, great error messages, brand/name/story, a maintainer who cares — are real but SOFT: estimate them with an advisory rubric and label the score advisory, never verified.`;
9361
- //#endregion
9362
- //#region src/lib/first-mate/scaffold-spec.ts
9321
+ // src/lib/first-mate/scaffold-spec.ts
9363
9322
  const COPILOT_SETUP_JOB_NAME = "copilot-setup-steps";
9364
9323
  const COPILOT_SETUP_PATH = ".github/workflows/copilot-setup-steps.yml";
9365
9324
  const GUIDANCE_PATHS = [
@@ -11014,8 +10973,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
11014
10973
  function capitalize(value) {
11015
10974
  return `${value.slice(0, 1).toUpperCase()}${value.slice(1)}`;
11016
10975
  }
11017
- //#endregion
11018
- //#region src/lib/first-mate/scaffold-helpers.ts
10976
+ // src/lib/first-mate/scaffold-helpers.ts
11019
10977
  var ScaffoldHelperError = class extends Error {
11020
10978
  code;
11021
10979
  cause;
@@ -11184,8 +11142,7 @@ function gitRefBranchPath(branch) {
11184
11142
  function segment(value) {
11185
11143
  return encodeURIComponent(String(value));
11186
11144
  }
11187
- //#endregion
11188
- //#region src/lib/first-mate/scheduler/answer-inbox.ts
11145
+ // src/lib/first-mate/scheduler/answer-inbox.ts
11189
11146
  const sleep$1 = (ms) => new Promise((r) => setTimeout(r, ms));
11190
11147
  /**
11191
11148
  * Windows sharing-violation codes. When two processes rename the SAME source
@@ -11264,7 +11221,7 @@ var AnswerInbox = class {
11264
11221
  */
11265
11222
  inflight = /* @__PURE__ */ new Set();
11266
11223
  constructor(opts = {}) {
11267
- this.file = path.join(opts.dir ?? PATHS.FIRST_MATE_DIR, "answers.jsonl");
11224
+ this.file = path$1.join(opts.dir ?? PATHS.FIRST_MATE_DIR, "answers.jsonl");
11268
11225
  }
11269
11226
  /** Append submitted answers. Returns how many records were enqueued. */
11270
11227
  async enqueue(a) {
@@ -11279,7 +11236,7 @@ var AnswerInbox = class {
11279
11236
  }))];
11280
11237
  if (lines.length === 0) return 0;
11281
11238
  const run = this.chain.then(async () => {
11282
- await fs$1.mkdir(path.dirname(this.file), { recursive: true });
11239
+ await fs$1.mkdir(path$1.dirname(this.file), { recursive: true });
11283
11240
  await fs$1.appendFile(this.file, `${lines.map((l) => JSON.stringify(l)).join("\n")}\n`, { mode: 384 });
11284
11241
  });
11285
11242
  this.chain = run.then(() => void 0, () => void 0);
@@ -11316,8 +11273,8 @@ var AnswerInbox = class {
11316
11273
  modelAnswers: [],
11317
11274
  humanDecisions: []
11318
11275
  };
11319
- const dir = path.dirname(this.file);
11320
- const base = path.basename(this.file);
11276
+ const dir = path$1.dirname(this.file);
11277
+ const base = path$1.basename(this.file);
11321
11278
  const claimed = [];
11322
11279
  let siblings;
11323
11280
  try {
@@ -11327,7 +11284,7 @@ var AnswerInbox = class {
11327
11284
  }
11328
11285
  for (const name of siblings) {
11329
11286
  if (!name.startsWith(`${base}.draining.`)) continue;
11330
- const orphan = path.join(dir, name);
11287
+ const orphan = path$1.join(dir, name);
11331
11288
  if (this.inflight.has(orphan)) continue;
11332
11289
  if (heldClaims.has(orphan)) continue;
11333
11290
  const owner = ownerPidOf(name);
@@ -11365,8 +11322,7 @@ var AnswerInbox = class {
11365
11322
  };
11366
11323
  }
11367
11324
  };
11368
- //#endregion
11369
- //#region src/lib/first-mate/scheduler/shadow.ts
11325
+ // src/lib/first-mate/scheduler/shadow.ts
11370
11326
  const TRUSTED_KEYS = /* @__PURE__ */ new Set([
11371
11327
  "goal",
11372
11328
  "acceptance_criteria",
@@ -11487,12 +11443,12 @@ var Tier1Shadow = class {
11487
11443
  now;
11488
11444
  judge;
11489
11445
  constructor(opts = {}) {
11490
- this.file = path.join(opts.dir ?? PATHS.FIRST_MATE_DIR, "tier1-shadow.jsonl");
11446
+ this.file = path$1.join(opts.dir ?? PATHS.FIRST_MATE_DIR, "tier1-shadow.jsonl");
11491
11447
  this.now = opts.nowMs ?? Date.now;
11492
11448
  this.judge = opts.judge ?? defaultTier1Judge;
11493
11449
  }
11494
11450
  async append(record) {
11495
- await fs$1.mkdir(path.dirname(this.file), { recursive: true });
11451
+ await fs$1.mkdir(path$1.dirname(this.file), { recursive: true });
11496
11452
  await fs$1.appendFile(this.file, `${JSON.stringify(record)}\n`, { mode: 384 });
11497
11453
  }
11498
11454
  /**
@@ -11690,11 +11646,10 @@ function decideRoute(kind, verdict) {
11690
11646
  reason: verifier === void 0 ? "allowlisted reversible low-stakes kind, high-confidence, known" : "allowlisted, high-confidence, known, low-stakes, verifier-backed"
11691
11647
  };
11692
11648
  }
11693
- //#endregion
11694
- //#region src/lib/first-mate/strategy-store.ts
11649
+ // src/lib/first-mate/strategy-store.ts
11695
11650
  const STRATEGIES_VERSION = 1;
11696
11651
  function strategiesPath() {
11697
- return path.join(PATHS.FIRST_MATE_DIR, "strategy.json");
11652
+ return path$1.join(PATHS.FIRST_MATE_DIR, "strategy.json");
11698
11653
  }
11699
11654
  function asRecord$1(value) {
11700
11655
  return typeof value === "object" && value !== null ? value : void 0;
@@ -11825,8 +11780,7 @@ async function upsertStrategy(rec) {
11825
11780
  strategies.splice(0, strategies.length, ...kept, next);
11826
11781
  });
11827
11782
  }
11828
- //#endregion
11829
- //#region src/lib/first-mate/tools.ts
11783
+ // src/lib/first-mate/tools.ts
11830
11784
  const FIRST_MATE_GROUP = "first-mate";
11831
11785
  /**
11832
11786
  * Phase 1.3 — the heartbeat/lead's drive lease. Shared (default first-mate dir)
@@ -13121,8 +13075,7 @@ function objectProp(description, properties, required) {
13121
13075
  function anyProp(description) {
13122
13076
  return { description };
13123
13077
  }
13124
- //#endregion
13125
- //#region src/lib/kusto-client.ts
13078
+ // src/lib/kusto-client.ts
13126
13079
  /**
13127
13080
  * Azure Data Explorer (Kusto) REST client.
13128
13081
  *
@@ -13541,8 +13494,7 @@ async function getKustoToken(clusterUri, signal) {
13541
13494
  throw new KustoError(describeAzFailure("Kusto", err), { retriable: false });
13542
13495
  }
13543
13496
  }
13544
- //#endregion
13545
- //#region src/lib/worker-agent/relay-cap.ts
13497
+ // src/lib/worker-agent/relay-cap.ts
13546
13498
  /**
13547
13499
  * Relay-safe result capping for the worker MCP boundary.
13548
13500
  *
@@ -13640,7 +13592,7 @@ async function sweepAgedWorkerDiffs(opts = {}) {
13640
13592
  const now = Date.now();
13641
13593
  for (const name of entries) {
13642
13594
  if (!WORKER_DIFF_NAME_RE.test(name)) continue;
13643
- const full = path.join(PATHS.WORKER_DIFFS_DIR, name);
13595
+ const full = path$1.join(PATHS.WORKER_DIFFS_DIR, name);
13644
13596
  try {
13645
13597
  if (now - (await fs$1.stat(full)).mtimeMs < AGE_SWEEP_MS$1) continue;
13646
13598
  await fs$1.rm(full, { force: true }).catch(() => {});
@@ -13660,7 +13612,7 @@ async function saveOverflowResult(text) {
13660
13612
  let lastErr;
13661
13613
  for (let attempt = 0; attempt < 5; attempt++) {
13662
13614
  const name = `${process$1.pid}-${randomBytes(4).toString("hex")}.txt`;
13663
- const outPath = path.join(PATHS.WORKER_DIFFS_DIR, name);
13615
+ const outPath = path$1.join(PATHS.WORKER_DIFFS_DIR, name);
13664
13616
  try {
13665
13617
  await fs$1.writeFile(outPath, text, {
13666
13618
  mode: 384,
@@ -13701,8 +13653,7 @@ async function relaySafeText(text, reservedBytes = 0) {
13701
13653
  const out = utf8HeadPreview(text, Math.max(0, cap - Buffer.byteLength(trailer, "utf8"))) + trailer;
13702
13654
  return Buffer.byteLength(out, "utf8") <= cap ? out : utf8HeadPreview(out, cap);
13703
13655
  }
13704
- //#endregion
13705
- //#region src/lib/kusto-tools.ts
13656
+ // src/lib/kusto-tools.ts
13706
13657
  const KUSTO_GROUP = "kusto";
13707
13658
  /**
13708
13659
  * One process-lifetime client per resolved cluster, keyed on the NORMALIZED
@@ -13901,8 +13852,7 @@ const KUSTO_TOOLS = Object.freeze([
13901
13852
  }
13902
13853
  }
13903
13854
  ]);
13904
- //#endregion
13905
- //#region src/lib/cloudagent-client.ts
13855
+ // src/lib/cloudagent-client.ts
13906
13856
  /**
13907
13857
  * Cloud Agent Job API v2 client.
13908
13858
  *
@@ -15261,8 +15211,7 @@ async function getCloudAgentToken(resource, signal) {
15261
15211
  throw new CloudAgentError(describeAzFailure("Cloud Agent", err), { retriable: false });
15262
15212
  }
15263
15213
  }
15264
- //#endregion
15265
- //#region src/lib/cloudagent-tools.ts
15214
+ // src/lib/cloudagent-tools.ts
15266
15215
  const CLOUDAGENT_GROUP = "cloudagent";
15267
15216
  const CLOUDAGENT_DEFAULT_TIER = "normal";
15268
15217
  const CLOUDAGENT_TIERS = [
@@ -16582,8 +16531,7 @@ async function summaryFor(client, jobId, signal) {
16582
16531
  return null;
16583
16532
  }
16584
16533
  }
16585
- //#endregion
16586
- //#region src/lib/browser-mcp/browser-detect.ts
16534
+ // src/lib/browser-mcp/browser-detect.ts
16587
16535
  let cached;
16588
16536
  function probeWindowsRegistry(subkey) {
16589
16537
  try {
@@ -16628,10 +16576,10 @@ function windowsLiteralPaths(browser) {
16628
16576
  const pf = process$1.env["PROGRAMFILES"];
16629
16577
  const pf86 = process$1.env["PROGRAMFILES(X86)"];
16630
16578
  return (browser === "chrome" ? [
16631
- localApp ? path.join(localApp, "Google", "Chrome", "Application", "chrome.exe") : void 0,
16632
- pf ? path.join(pf, "Google", "Chrome", "Application", "chrome.exe") : void 0,
16633
- pf86 ? path.join(pf86, "Google", "Chrome", "Application", "chrome.exe") : void 0
16634
- ] : [pf86 ? path.join(pf86, "Microsoft", "Edge", "Application", "msedge.exe") : void 0, pf ? path.join(pf, "Microsoft", "Edge", "Application", "msedge.exe") : void 0]).filter((p) => typeof p === "string");
16579
+ localApp ? path$1.join(localApp, "Google", "Chrome", "Application", "chrome.exe") : void 0,
16580
+ pf ? path$1.join(pf, "Google", "Chrome", "Application", "chrome.exe") : void 0,
16581
+ pf86 ? path$1.join(pf86, "Google", "Chrome", "Application", "chrome.exe") : void 0
16582
+ ] : [pf86 ? path$1.join(pf86, "Microsoft", "Edge", "Application", "msedge.exe") : void 0, pf ? path$1.join(pf, "Microsoft", "Edge", "Application", "msedge.exe") : void 0]).filter((p) => typeof p === "string");
16635
16583
  }
16636
16584
  function probeWindows() {
16637
16585
  const found = [];
@@ -16692,8 +16640,7 @@ function detectSupportedBrowsers() {
16692
16640
  function hasSupportedBrowserInstalled() {
16693
16641
  return detectSupportedBrowsers().length > 0;
16694
16642
  }
16695
- //#endregion
16696
- //#region src/lib/browser-mcp/bridge-paths.ts
16643
+ // src/lib/browser-mcp/bridge-paths.ts
16697
16644
  /**
16698
16645
  * Filesystem path where the browser bridge writes its discovery file
16699
16646
  * (`{pid, port, token, startedAt}`) and where the install-check reads
@@ -16715,10 +16662,9 @@ function hasSupportedBrowserInstalled() {
16715
16662
  * is introduced.
16716
16663
  */
16717
16664
  function discoveryPath() {
16718
- return path.join(homedir(), ".local", "share", "github-router", "browser-mcp", "bridge.json");
16665
+ return path$1.join(homedir(), ".local", "share", "github-router", "browser-mcp", "bridge.json");
16719
16666
  }
16720
- //#endregion
16721
- //#region src/lib/browser-mcp/native-host-installer.ts
16667
+ // src/lib/browser-mcp/native-host-installer.ts
16722
16668
  const NMH_HOST_ID = "com.githubrouter.browser";
16723
16669
  /**
16724
16670
  * Compute the deterministic 32-char chrome-extension ID from the
@@ -16743,7 +16689,7 @@ function computeExtensionIdFromKey(keyB64) {
16743
16689
  return out;
16744
16690
  }
16745
16691
  function readManifestKey() {
16746
- const candidates = [path.resolve(extensionDir(), "manifest.json")];
16692
+ const candidates = [path$1.resolve(extensionDir(), "manifest.json")];
16747
16693
  for (const candidate of candidates) try {
16748
16694
  const raw = readFileSync(candidate, "utf8");
16749
16695
  const parsed = JSON.parse(raw);
@@ -16760,11 +16706,11 @@ function findPackageRoot(startDir, maxHops = 10) {
16760
16706
  let cur = startDir;
16761
16707
  for (let i = 0; i < maxHops; i++) {
16762
16708
  try {
16763
- const pkgPath = path.join(cur, "package.json");
16709
+ const pkgPath = path$1.join(cur, "package.json");
16764
16710
  const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
16765
16711
  if (pkg.name && pkg.name.includes("github-router")) return cur;
16766
16712
  } catch {}
16767
- const parent = path.dirname(cur);
16713
+ const parent = path$1.dirname(cur);
16768
16714
  if (parent === cur) break;
16769
16715
  cur = parent;
16770
16716
  }
@@ -16785,11 +16731,11 @@ function packageRoot() {
16785
16731
  if (explicit) return explicit;
16786
16732
  const entryPath = typeof process$1?.argv?.[1] === "string" ? process$1.argv[1] : void 0;
16787
16733
  if (entryPath) {
16788
- const fromEntry = findPackageRoot(path.dirname(entryPath));
16734
+ const fromEntry = findPackageRoot(path$1.dirname(entryPath));
16789
16735
  if (fromEntry) return fromEntry;
16790
16736
  }
16791
16737
  try {
16792
- const fromHere = findPackageRoot(path.dirname(fileURLToPath(import.meta.url)));
16738
+ const fromHere = findPackageRoot(path$1.dirname(fileURLToPath(import.meta.url)));
16793
16739
  if (fromHere) return fromHere;
16794
16740
  } catch {}
16795
16741
  return process$1?.cwd?.() ?? ".";
@@ -16799,11 +16745,11 @@ function fileExists(p) {
16799
16745
  }
16800
16746
  /** Stable materialized extension dir: `<APP_DIR>/browser-ext`. */
16801
16747
  function stableExtensionDir() {
16802
- return path.join(PATHS.APP_DIR, "browser-ext");
16748
+ return path$1.join(PATHS.APP_DIR, "browser-ext");
16803
16749
  }
16804
16750
  /** Stable materialized bridge bundle: `<APP_DIR>/browser-bridge/index.js`. */
16805
16751
  function stableBridgeBundlePath() {
16806
- return path.join(PATHS.APP_DIR, "browser-bridge", "index.js");
16752
+ return path$1.join(PATHS.APP_DIR, "browser-bridge", "index.js");
16807
16753
  }
16808
16754
  /**
16809
16755
  * The bundled (shipped) extension dir — the SOURCE for provisioning,
@@ -16817,13 +16763,13 @@ function stableBridgeBundlePath() {
16817
16763
  */
16818
16764
  function bundledExtensionDir() {
16819
16765
  const root = packageRoot();
16820
- const distExt = path.join(root, "dist", "browser-ext");
16821
- if (fileExists(path.join(distExt, "manifest.json"))) return distExt;
16822
- return path.join(root, "src", "browser-ext");
16766
+ const distExt = path$1.join(root, "dist", "browser-ext");
16767
+ if (fileExists(path$1.join(distExt, "manifest.json"))) return distExt;
16768
+ return path$1.join(root, "src", "browser-ext");
16823
16769
  }
16824
16770
  /** The bundled (shipped) bridge entrypoint — SOURCE for provisioning. */
16825
16771
  function bundledBridgeBundlePath() {
16826
- return path.join(packageRoot(), "dist", "browser-bridge", "index.js");
16772
+ return path$1.join(packageRoot(), "dist", "browser-bridge", "index.js");
16827
16773
  }
16828
16774
  /**
16829
16775
  * Runtime extension directory — the path Chrome "Load unpacked"s and the
@@ -16837,7 +16783,7 @@ function bundledBridgeBundlePath() {
16837
16783
  function extensionDir() {
16838
16784
  const override = process$1.env.GH_ROUTER_BROWSER_EXT_DIR;
16839
16785
  if (override && override.length > 0) return override;
16840
- if (fileExists(path.join(stableExtensionDir(), "manifest.json"))) return stableExtensionDir();
16786
+ if (fileExists(path$1.join(stableExtensionDir(), "manifest.json"))) return stableExtensionDir();
16841
16787
  return bundledExtensionDir();
16842
16788
  }
16843
16789
  /**
@@ -16851,7 +16797,7 @@ function bridgeBundlePath() {
16851
16797
  return bundledBridgeBundlePath();
16852
16798
  }
16853
16799
  function appBrowserMcpDir() {
16854
- const dir = path.join(PATHS.APP_DIR, "browser-mcp");
16800
+ const dir = path$1.join(PATHS.APP_DIR, "browser-mcp");
16855
16801
  mkdirSync(dir, { recursive: true });
16856
16802
  return dir;
16857
16803
  }
@@ -16900,12 +16846,12 @@ function writeLauncherShim() {
16900
16846
  const bridgeJs = bridgeBundlePath();
16901
16847
  const interp = resolveBridgeInterpreter();
16902
16848
  if (platform() === "win32") {
16903
- const batPath = path.join(dir, "launcher.bat");
16849
+ const batPath = path$1.join(dir, "launcher.bat");
16904
16850
  const content = `@echo off\r\n"${interp}" "${bridgeJs}" %*\r\n`;
16905
16851
  writeFileSync(batPath, content, "utf8");
16906
16852
  return batPath;
16907
16853
  }
16908
- const shPath = path.join(dir, "launcher.sh");
16854
+ const shPath = path$1.join(dir, "launcher.sh");
16909
16855
  const content = `#!/usr/bin/env bash\nexec "${interp}" "${bridgeJs}" "$@"\n`;
16910
16856
  writeFileSync(shPath, content, { mode: 493 });
16911
16857
  try {
@@ -16917,22 +16863,22 @@ function nmhPathsFor(browser) {
16917
16863
  switch (platform()) {
16918
16864
  case "win32": {
16919
16865
  const local = process$1.env.LOCALAPPDATA;
16920
- const base = local ? path.join(local, "github-router", "browser-mcp") : path.join(homedir(), "AppData", "Local", "github-router", "browser-mcp");
16866
+ const base = local ? path$1.join(local, "github-router", "browser-mcp") : path$1.join(homedir(), "AppData", "Local", "github-router", "browser-mcp");
16921
16867
  mkdirSync(base, { recursive: true });
16922
16868
  return {
16923
- manifestPath: path.join(base, `${NMH_HOST_ID}.json`),
16869
+ manifestPath: path$1.join(base, `${NMH_HOST_ID}.json`),
16924
16870
  registryKey: browser === "chrome" ? `HKCU\\Software\\Google\\Chrome\\NativeMessagingHosts\\${NMH_HOST_ID}` : `HKCU\\Software\\Microsoft\\Edge\\NativeMessagingHosts\\${NMH_HOST_ID}`
16925
16871
  };
16926
16872
  }
16927
16873
  case "darwin": {
16928
- const base = browser === "chrome" ? path.join(homedir(), "Library", "Application Support", "Google", "Chrome", "NativeMessagingHosts") : path.join(homedir(), "Library", "Application Support", "Microsoft Edge", "NativeMessagingHosts");
16874
+ const base = browser === "chrome" ? path$1.join(homedir(), "Library", "Application Support", "Google", "Chrome", "NativeMessagingHosts") : path$1.join(homedir(), "Library", "Application Support", "Microsoft Edge", "NativeMessagingHosts");
16929
16875
  mkdirSync(base, { recursive: true });
16930
- return { manifestPath: path.join(base, `${NMH_HOST_ID}.json`) };
16876
+ return { manifestPath: path$1.join(base, `${NMH_HOST_ID}.json`) };
16931
16877
  }
16932
16878
  default: {
16933
- const base = browser === "chrome" ? path.join(homedir(), ".config", "google-chrome", "NativeMessagingHosts") : path.join(homedir(), ".config", "microsoft-edge", "NativeMessagingHosts");
16879
+ const base = browser === "chrome" ? path$1.join(homedir(), ".config", "google-chrome", "NativeMessagingHosts") : path$1.join(homedir(), ".config", "microsoft-edge", "NativeMessagingHosts");
16934
16880
  mkdirSync(base, { recursive: true });
16935
- return { manifestPath: path.join(base, `${NMH_HOST_ID}.json`) };
16881
+ return { manifestPath: path$1.join(base, `${NMH_HOST_ID}.json`) };
16936
16882
  }
16937
16883
  }
16938
16884
  }
@@ -16995,8 +16941,7 @@ function installNativeHostForAll(browsers) {
16995
16941
  }
16996
16942
  return results;
16997
16943
  }
16998
- //#endregion
16999
- //#region src/lib/browser-mcp/provision.ts
16944
+ // src/lib/browser-mcp/provision.ts
17000
16945
  /** Sidecar holding the content signature of the last materialized copy. */
17001
16946
  const SIGNATURE_FILE = ".provisioned";
17002
16947
  /** Source files excluded from both the copy and the content signature. */
@@ -17025,9 +16970,9 @@ async function _provisionImpl() {
17025
16970
  if (!existsSync(srcBridge)) return;
17026
16971
  const destExtDir = stableExtensionDir();
17027
16972
  const destBridge = stableBridgeBundlePath();
17028
- const sigPath = path.join(destExtDir, SIGNATURE_FILE);
16973
+ const sigPath = path$1.join(destExtDir, SIGNATURE_FILE);
17029
16974
  const signature = computeSignature(srcExtDir, srcBridge);
17030
- const upToDate = existsSync(path.join(destExtDir, "manifest.json")) && existsSync(destBridge) && readSignature(sigPath) === signature;
16975
+ const upToDate = existsSync(path$1.join(destExtDir, "manifest.json")) && existsSync(destBridge) && readSignature(sigPath) === signature;
17031
16976
  let fullySynced = true;
17032
16977
  if (!upToDate) {
17033
16978
  materializeExtension(srcExtDir, destExtDir);
@@ -17060,7 +17005,7 @@ function computeSignature(srcExtDir, srcBridge) {
17060
17005
  for (const name of names) {
17061
17006
  h.update(name);
17062
17007
  try {
17063
- h.update(readFileSync(path.join(srcExtDir, name)));
17008
+ h.update(readFileSync(path$1.join(srcExtDir, name)));
17064
17009
  } catch {
17065
17010
  h.update(`\x00unreadable:${name}\x00`);
17066
17011
  }
@@ -17095,7 +17040,7 @@ function materializeExtension(srcDir, destDir) {
17095
17040
  cpSync(srcDir, destDir, {
17096
17041
  recursive: true,
17097
17042
  force: true,
17098
- filter: (s) => !EXCLUDED_FILES.has(path.basename(s))
17043
+ filter: (s) => !EXCLUDED_FILES.has(path$1.basename(s))
17099
17044
  });
17100
17045
  }
17101
17046
  /**
@@ -17107,7 +17052,7 @@ function materializeExtension(srcDir, destDir) {
17107
17052
  * is no usable bridge at all.
17108
17053
  */
17109
17054
  function tryMaterializeBridge(srcBridge, destBridge) {
17110
- mkdirSync(path.dirname(destBridge), { recursive: true });
17055
+ mkdirSync(path$1.dirname(destBridge), { recursive: true });
17111
17056
  const tmp = `${destBridge}.tmp-${process.pid}`;
17112
17057
  try {
17113
17058
  writeFileSync(tmp, readFileSync(srcBridge));
@@ -17138,7 +17083,7 @@ function tryMaterializeBridge(srcBridge, destBridge) {
17138
17083
  function stampVersion(destExtDir) {
17139
17084
  const version = getPackageVersion();
17140
17085
  if (!/^\d{1,9}(\.\d{1,9}){0,3}$/.test(version)) return true;
17141
- const manifestPath = path.join(destExtDir, "manifest.json");
17086
+ const manifestPath = path$1.join(destExtDir, "manifest.json");
17142
17087
  try {
17143
17088
  const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
17144
17089
  if (manifest.version === version) return true;
@@ -17152,8 +17097,7 @@ function stampVersion(destExtDir) {
17152
17097
  return false;
17153
17098
  }
17154
17099
  }
17155
- //#endregion
17156
- //#region src/lib/browser-mcp/install-check.ts
17100
+ // src/lib/browser-mcp/install-check.ts
17157
17101
  function readBridgeDiscovery() {
17158
17102
  try {
17159
17103
  const raw = readFileSync(discoveryPath(), "utf8");
@@ -17186,7 +17130,7 @@ function bridgeBundleExists() {
17186
17130
  }
17187
17131
  function loadStableExtensionId() {
17188
17132
  try {
17189
- const manifestPath = path.join(extensionDir(), "manifest.json");
17133
+ const manifestPath = path$1.join(extensionDir(), "manifest.json");
17190
17134
  const raw = readFileSync(manifestPath, "utf8");
17191
17135
  const parsed = JSON.parse(raw);
17192
17136
  if (typeof parsed.key === "string") return computeExtensionIdFromKey(parsed.key);
@@ -17201,7 +17145,7 @@ function loadStableExtensionId() {
17201
17145
  */
17202
17146
  function loadExpectedExtensionVersion() {
17203
17147
  try {
17204
- const manifestPath = path.join(extensionDir(), "manifest.json");
17148
+ const manifestPath = path$1.join(extensionDir(), "manifest.json");
17205
17149
  const raw = readFileSync(manifestPath, "utf8");
17206
17150
  const parsed = JSON.parse(raw);
17207
17151
  if (typeof parsed.version === "string" && parsed.version.length > 0) return parsed.version;
@@ -17442,8 +17386,7 @@ function installRequiredToolResult(payload) {
17442
17386
  isError: true
17443
17387
  };
17444
17388
  }
17445
- //#endregion
17446
- //#region src/lib/browser-mcp/humanlike.ts
17389
+ // src/lib/browser-mcp/humanlike.ts
17447
17390
  /**
17448
17391
  * Sample from a Beta(2, 5) distribution scaled to [minMs, maxMs].
17449
17392
  * The Beta(2, 5) shape has its mode near 0.2 of the range — humans
@@ -17493,8 +17436,7 @@ function normalSample() {
17493
17436
  function interActionDelay() {
17494
17437
  return betaDelay(800, 4600);
17495
17438
  }
17496
- //#endregion
17497
- //#region src/lib/browser-mcp/policy.ts
17439
+ // src/lib/browser-mcp/policy.ts
17498
17440
  const BLOCKED_URL_RE = /^(chrome|edge|brave|opera|vivaldi):\/\/(settings|preferences|extensions|policy|management|password|flags|flag-descriptions)/i;
17499
17441
  const BLOCKED_VIEW_SOURCE_RE = /^view-source:(chrome|edge):\/\/(settings|extensions)/i;
17500
17442
  const BLOCKED_OPTIONS_HTML_RE = /^(chrome|edge)-extension:\/\/.*\/(options|popup)\.html/i;
@@ -17524,8 +17466,7 @@ function preflightUrlPolicy(toolName, args) {
17524
17466
  if (toolName !== "browser_open_tab" && toolName !== "browser_navigate") return { blocked: false };
17525
17467
  return checkUrlPolicy(args.url);
17526
17468
  }
17527
- //#endregion
17528
- //#region src/lib/attachments.ts
17469
+ // src/lib/attachments.ts
17529
17470
  /**
17530
17471
  * Build a text + image tool result.
17531
17472
  *
@@ -17621,8 +17562,7 @@ function decodeBase64Strict(input) {
17621
17562
  if (buf.toString("base64") !== padded) return null;
17622
17563
  return new Uint8Array(buf);
17623
17564
  }
17624
- //#endregion
17625
- //#region src/lib/browser-mcp/dispatch.ts
17565
+ // src/lib/browser-mcp/dispatch.ts
17626
17566
  /**
17627
17567
  * Tools whose dispatch counts as a mutating user action for pacing
17628
17568
  * purposes. Read-only tools (list_tabs, screenshot, read_page,
@@ -18039,7 +17979,7 @@ function logAudit$1(record) {
18039
17979
  try {
18040
17980
  const fs = await import("node:fs/promises");
18041
17981
  const path = await import("node:path");
18042
- const { PATHS } = await import("./paths-CEswtFj5.js");
17982
+ const { PATHS } = await import("./paths-Be9_ujQ3.js");
18043
17983
  const dir = path.join(PATHS.APP_DIR, "browser-mcp");
18044
17984
  await fs.mkdir(dir, { recursive: true });
18045
17985
  const line = JSON.stringify({
@@ -18050,8 +17990,7 @@ function logAudit$1(record) {
18050
17990
  } catch {}
18051
17991
  })();
18052
17992
  }
18053
- //#endregion
18054
- //#region src/lib/browser-mcp/matcher.ts
17993
+ // src/lib/browser-mcp/matcher.ts
18055
17994
  /**
18056
17995
  * Resolve an intent to an action. Synchronous, no I/O, <5ms expected
18057
17996
  * on a 200-element snapshot.
@@ -18441,8 +18380,7 @@ const LAYERS = [
18441
18380
  }
18442
18381
  }
18443
18382
  ];
18444
- //#endregion
18445
- //#region src/lib/browser-mcp/parse-intent.ts
18383
+ // src/lib/browser-mcp/parse-intent.ts
18446
18384
  const VERB_RE = /^\s*(click|press|tap|fill|enter|type|select|choose|scroll(?:[ -]?into[ -]?view)?|toggle|check|uncheck|open|focus|hover)\s+/i;
18447
18385
  const VALUE_RE = /\s+(?:with|to|=)\s+(.+?)\s*$/i;
18448
18386
  const QUOTED_RE = /["'`]([^"'`]+)["'`]/;
@@ -18559,8 +18497,7 @@ function mapVerb(raw) {
18559
18497
  if (v === "scroll" || v === "scrollintoview" || v === "scroll into view" || v === "scroll-into-view") return "scroll_into_view";
18560
18498
  if (v === "hover" || v === "focus") return void 0;
18561
18499
  }
18562
- //#endregion
18563
- //#region src/lib/mcp-inflight.ts
18500
+ // src/lib/mcp-inflight.ts
18564
18501
  /**
18565
18502
  * Shared concurrency cap for MCP `tools/call` dispatches.
18566
18503
  *
@@ -18618,8 +18555,7 @@ function acquireInFlightSlot() {
18618
18555
  function currentInFlight() {
18619
18556
  return inFlight$2;
18620
18557
  }
18621
- //#endregion
18622
- //#region src/lib/prompt-cache.ts
18558
+ // src/lib/prompt-cache.ts
18623
18559
  /**
18624
18560
  * Conservative eligibility floor, in UTF-8 BYTES — never `.length`, which
18625
18561
  * counts UTF-16 code units and undercounts anything outside the BMP (an
@@ -18977,8 +18913,7 @@ function applyClaudeCachePolicy(rawBody, opts) {
18977
18913
  });
18978
18914
  return JSON.stringify(body);
18979
18915
  }
18980
- //#endregion
18981
- //#region src/lib/vision-preflight.ts
18916
+ // src/lib/vision-preflight.ts
18982
18917
  /**
18983
18918
  * Outbound vision handling.
18984
18919
  *
@@ -19454,8 +19389,7 @@ function pruneImagesFromAnthropicMessages(messages, verdicts) {
19454
19389
  assertConsumed(imageIndex, verdicts);
19455
19390
  return out;
19456
19391
  }
19457
- //#endregion
19458
- //#region src/lib/diagnose-response.ts
19392
+ // src/lib/diagnose-response.ts
19459
19393
  const PREVIEW_LIMIT = 200;
19460
19394
  async function parseJsonOrDiagnose(response, routePath) {
19461
19395
  const cloned = response.clone();
@@ -19469,8 +19403,7 @@ async function parseJsonOrDiagnose(response, routePath) {
19469
19403
  throw error;
19470
19404
  }
19471
19405
  }
19472
- //#endregion
19473
- //#region src/lib/response-cap.ts
19406
+ // src/lib/response-cap.ts
19474
19407
  /**
19475
19408
  * Hard byte cap for non-streaming upstream response bodies.
19476
19409
  *
@@ -19566,8 +19499,7 @@ async function readResponseBodyCapped(response, routePath, capBytes = MAX_RESPON
19566
19499
  throw err;
19567
19500
  }
19568
19501
  }
19569
- //#endregion
19570
- //#region src/services/copilot/create-chat-completions.ts
19502
+ // src/services/copilot/create-chat-completions.ts
19571
19503
  /**
19572
19504
  * `retryTransient` (opt-in, default false) adds a bounded pre-first-byte
19573
19505
  * transient retry (429/5xx/network) AROUND the 401-refresh path. Safe
@@ -19667,8 +19599,7 @@ const createChatCompletions = async (payload, modelHeaders, callerSignal, retryT
19667
19599
  }));
19668
19600
  return cappedResult.value;
19669
19601
  };
19670
- //#endregion
19671
- //#region src/services/copilot/create-responses.ts
19602
+ // src/services/copilot/create-responses.ts
19672
19603
  /**
19673
19604
  * `retryTransient` (opt-in, default false) adds a bounded pre-first-byte
19674
19605
  * transient retry (429/5xx/network) AROUND the 401-refresh path. Safe
@@ -19778,8 +19709,7 @@ function detectAgentCall(input) {
19778
19709
  return false;
19779
19710
  });
19780
19711
  }
19781
- //#endregion
19782
- //#region src/lib/browser-mcp/compressor.ts
19712
+ // src/lib/browser-mcp/compressor.ts
19783
19713
  /**
19784
19714
  * Static fallback chain for the inner compressor, identical on every launch
19785
19715
  * profile. Order is preference, with vision (required for the Phase D visual
@@ -20306,8 +20236,7 @@ async function pickElementVisual(screenshotB64, contentType, intent, visualSurfa
20306
20236
  reason: typeof obj.reason === "string" ? obj.reason : ""
20307
20237
  };
20308
20238
  }
20309
- //#endregion
20310
- //#region src/lib/browser-mcp/decompose.ts
20239
+ // src/lib/browser-mcp/decompose.ts
20311
20240
  const LOGIN_RE = /^log[ -]?in (?:to .+? )?with\s+([^\s/]+)\s*\/\s*(.+?)\s*$/i;
20312
20241
  const SEARCH_CLICK_RE = /^search\s+(?:for\s+)?(.+?)\s+and\s+click\s+(?:the\s+)?first\s+result\s*$/i;
20313
20242
  const CONJUNCTION_SPLIT_RE = /\s*(?:\s+and\s+then\s+|\s+then\s+|\s*;\s*|\s*,\s+and\s+)\s*/i;
@@ -20384,8 +20313,7 @@ function decompose(intent, value) {
20384
20313
  template: "fallback"
20385
20314
  };
20386
20315
  }
20387
- //#endregion
20388
- //#region src/lib/browser-mcp/observe.ts
20316
+ // src/lib/browser-mcp/observe.ts
20389
20317
  const OBSERVE_SYSTEM = `You describe a web page for an AI assistant that cannot see the DOM.
20390
20318
 
20391
20319
  Write 2-4 sentences focused on user-actionable elements (forms, buttons, links) and the page's purpose. If 'intent' is provided, focus the description on the region most relevant to that intent.
@@ -20432,8 +20360,7 @@ async function observePage(snapshot, intent, signal) {
20432
20360
  if (snapshot.title) out.title = snapshot.title;
20433
20361
  return out;
20434
20362
  }
20435
- //#endregion
20436
- //#region src/lib/browser-mcp/planner.ts
20363
+ // src/lib/browser-mcp/planner.ts
20437
20364
  const PLANNER_SYSTEM = `You are a browser-automation replanner. A user issued a high-level intent that was decomposed into atomic steps. Several steps ran successfully, then one failed. You see the page state AFTER the failure and decide what to do next.
20438
20365
 
20439
20366
  Your job: produce a revised list of atomic steps that will accomplish the original intent given the current page. If you cannot — the page has changed in a way that makes the intent impossible (login form vanished, navigation moved elsewhere, captcha appeared) — return an empty list and explain why in reasoning.
@@ -20534,8 +20461,7 @@ async function planCompoundReplan(input, signal) {
20534
20461
  reasoning
20535
20462
  };
20536
20463
  }
20537
- //#endregion
20538
- //#region src/lib/browser-mcp/index.ts
20464
+ // src/lib/browser-mcp/index.ts
20539
20465
  /**
20540
20466
  * Helper for compound tools (`browser_find` / `browser_act` /
20541
20467
  * `browser_extract`): fetch the page snapshot via the existing
@@ -21533,8 +21459,7 @@ async function dispatchActionByRef(tabId, ref, action, value, signal) {
21533
21459
  navigated: typeof parsed.navigated === "boolean" ? parsed.navigated : void 0
21534
21460
  });
21535
21461
  }
21536
- //#endregion
21537
- //#region src/lib/browser-mcp/session-registry.ts
21462
+ // src/lib/browser-mcp/session-registry.ts
21538
21463
  /**
21539
21464
  * In-memory browse-session registry — tab-ownership over a SHARED Chrome
21540
21465
  * profile, so multiple browse agents can drive the ONE real browser in
@@ -21787,8 +21712,7 @@ function registerExitHandlers() {
21787
21712
  process$1.on("exit", exitHandler);
21788
21713
  }
21789
21714
  registerExitHandlers();
21790
- //#endregion
21791
- //#region src/vendor/pi/ai/utils/event-stream.ts
21715
+ // src/vendor/pi/ai/utils/event-stream.ts
21792
21716
  var EventStream = class {
21793
21717
  queue = [];
21794
21718
  waiting = [];
@@ -21862,8 +21786,7 @@ if (typeof process !== "undefined" && (process.versions?.node || process.version
21862
21786
  m.join;
21863
21787
  });
21864
21788
  }
21865
- //#endregion
21866
- //#region src/vendor/pi/ai/utils/retry.ts
21789
+ // src/vendor/pi/ai/utils/retry.ts
21867
21790
  function buildProviderErrorPattern(patterns) {
21868
21791
  return new RegExp(patterns.join("|"), "i");
21869
21792
  }
@@ -21919,8 +21842,7 @@ buildProviderErrorPattern([
21919
21842
  "please retry your request",
21920
21843
  "ResourceExhausted"
21921
21844
  ]);
21922
- //#endregion
21923
- //#region src/vendor/pi/ai/utils/text.ts
21845
+ // src/vendor/pi/ai/utils/text.ts
21924
21846
  /** Extract and join text from message content. */
21925
21847
  function contentText(content, separator = "\n") {
21926
21848
  if (typeof content === "string") return content;
@@ -21932,8 +21854,7 @@ function getSystemMessageText(message) {
21932
21854
  for (const text of Object.values(message.sections ?? {})) if (text !== null) parts.push(text);
21933
21855
  return parts.filter((part) => part.length > 0).join("\n\n");
21934
21856
  }
21935
- //#endregion
21936
- //#region src/vendor/pi/ai/utils/transcript.ts
21857
+ // src/vendor/pi/ai/utils/transcript.ts
21937
21858
  /**
21938
21859
  * Build the leading system message for a prompt and tool set. Returns undefined when
21939
21860
  * both are empty, so an empty transcript stays empty.
@@ -22038,8 +21959,7 @@ function getToolStateChanges(previous, current) {
22038
21959
  }).map((tool) => ({ name: tool.name }))
22039
21960
  };
22040
21961
  }
22041
- //#endregion
22042
- //#region src/vendor/pi/ai/utils/validation.ts
21962
+ // src/vendor/pi/ai/utils/validation.ts
22043
21963
  const validatorCache = /* @__PURE__ */ new WeakMap();
22044
21964
  const TYPEBOX_KIND = Symbol.for("TypeBox.Kind");
22045
21965
  function getSchemaTypes(schema) {
@@ -22199,8 +22119,7 @@ function validateToolArguments(tool, toolCall) {
22199
22119
  function getDefaultStreamFn() {
22200
22120
  throw new Error("No default stream function configured. Pass streamFn explicitly or call setDefaultStreamFn().");
22201
22121
  }
22202
- //#endregion
22203
- //#region src/vendor/pi/agent/agent-loop.ts
22122
+ // src/vendor/pi/agent/agent-loop.ts
22204
22123
  /**
22205
22124
  * Agent loop that works with AgentMessage throughout.
22206
22125
  * Transforms to Message[] only at the LLM call boundary.
@@ -22791,8 +22710,7 @@ async function emitToolResultMessage(toolResultMessage, emit) {
22791
22710
  message: toolResultMessage
22792
22711
  });
22793
22712
  }
22794
- //#endregion
22795
- //#region src/vendor/pi/agent/agent.ts
22713
+ // src/vendor/pi/agent/agent.ts
22796
22714
  function defaultConvertToLlm(messages) {
22797
22715
  return messages.filter((message) => message.role === "system" || message.role === "user" || message.role === "assistant" || message.role === "toolResult");
22798
22716
  }
@@ -22888,7 +22806,7 @@ var PendingMessageQueue = class {
22888
22806
  * `Agent` owns the current transcript, emits lifecycle events, executes tools,
22889
22807
  * and exposes queueing APIs for steering and follow-up messages.
22890
22808
  */
22891
- var Agent$1 = class {
22809
+ var Agent = class {
22892
22810
  _state;
22893
22811
  listeners = /* @__PURE__ */ new Set();
22894
22812
  steeringQueue;
@@ -23228,8 +23146,7 @@ var Agent$1 = class {
23228
23146
  for (const listener of this.listeners) await listener(event, signal);
23229
23147
  }
23230
23148
  };
23231
- //#endregion
23232
- //#region src/lib/worker-agent/budget.ts
23149
+ // src/lib/worker-agent/budget.ts
23233
23150
  const DEFAULT_MAX_TURNS = 500;
23234
23151
  const DEFAULT_MODEL_CALL_TIMEOUT_MS = 9e5;
23235
23152
  const DEFAULT_MAX_TOOL_BYTES = 16777216;
@@ -23447,8 +23364,7 @@ function extractTextByteLength(result) {
23447
23364
  }
23448
23365
  return total;
23449
23366
  }
23450
- //#endregion
23451
- //#region src/lib/worker-agent/model-resolve.ts
23367
+ // src/lib/worker-agent/model-resolve.ts
23452
23368
  /**
23453
23369
  * Validate `model` + clamp `thinking` against the live Copilot catalog.
23454
23370
  *
@@ -23802,8 +23718,7 @@ function buildCatalogView() {
23802
23718
  }
23803
23719
  return rows.sort((a, b) => a.id.localeCompare(b.id));
23804
23720
  }
23805
- //#endregion
23806
- //#region src/lib/worker-agent/session-defaults.ts
23721
+ // src/lib/worker-agent/session-defaults.ts
23807
23722
  const MODES = Object.freeze([
23808
23723
  "explore",
23809
23724
  "review",
@@ -23835,8 +23750,7 @@ function resetAllWorkerSessionDefaults() {
23835
23750
  for (const mode of MODES) delete overrides[mode];
23836
23751
  }
23837
23752
  const WORKER_MODES = MODES;
23838
- //#endregion
23839
- //#region src/lib/worker-agent/prompts.ts
23753
+ // src/lib/worker-agent/prompts.ts
23840
23754
  /**
23841
23755
  * System prompts for the worker agent.
23842
23756
  *
@@ -23972,8 +23886,7 @@ function systemPromptFor(mode, searchEnabled = false, bluebirdEnabled = false) {
23972
23886
  }
23973
23887
  return `${SECURITY_BOUNDARY}\n\n${note}`;
23974
23888
  }
23975
- //#endregion
23976
- //#region src/lib/worker-agent/redact.ts
23889
+ // src/lib/worker-agent/redact.ts
23977
23890
  /**
23978
23891
  * Structured stderr audit log for worker tool calls.
23979
23892
  *
@@ -24066,8 +23979,7 @@ function logAudit(ctx) {
24066
23979
  consola.info(`[worker-agent] ${fields.join(" ")}`);
24067
23980
  } catch {}
24068
23981
  }
24069
- //#endregion
24070
- //#region src/lib/worker-agent/semaphore.ts
23982
+ // src/lib/worker-agent/semaphore.ts
24071
23983
  /**
24072
23984
  * Worker concurrency semaphore.
24073
23985
  *
@@ -24127,8 +24039,7 @@ async function acquireWorkerSlot(signal) {
24127
24039
  inFlight = Math.max(0, inFlight - 1);
24128
24040
  };
24129
24041
  }
24130
- //#endregion
24131
- //#region src/services/copilot/responses-request.ts
24042
+ // src/services/copilot/responses-request.ts
24132
24043
  /**
24133
24044
  * Copilot's `/responses` endpoint rejects a positive `max_output_tokens` below
24134
24045
  * 16 with an HTTP 400 (verified live on gpt-5.5 and gpt-5.3-codex):
@@ -24275,8 +24186,7 @@ function assembleResponsesPayload(opts) {
24275
24186
  stablePrefix: opts.cachePolicy.stablePrefix ?? opts.instructions
24276
24187
  }) : payload;
24277
24188
  }
24278
- //#endregion
24279
- //#region src/lib/worker-agent/context-budget.ts
24189
+ // src/lib/worker-agent/context-budget.ts
24280
24190
  /**
24281
24191
  * Per-run context budget for worker agents.
24282
24192
  *
@@ -24371,8 +24281,7 @@ function makeContextBudget(windowTokens) {
24371
24281
  perResultCapBytes: clamp(Math.round(effectiveWindowTokens * PER_RESULT_CAP_FRACTION * BYTES_PER_TOKEN), PER_RESULT_CAP_MIN_BYTES, PER_RESULT_CAP_MAX_BYTES)
24372
24282
  };
24373
24283
  }
24374
- //#endregion
24375
- //#region src/lib/worker-agent/stream-fn.ts
24284
+ // src/lib/worker-agent/stream-fn.ts
24376
24285
  /**
24377
24286
  * Custom Pi `StreamFn` that routes all worker-agent LLM traffic through the
24378
24287
  * proxy's existing `createChatCompletions` to Copilot.
@@ -25471,8 +25380,7 @@ function isAbortError(err) {
25471
25380
  if (typeof code === "string" && code === "ABORT_ERR") return true;
25472
25381
  return false;
25473
25382
  }
25474
- //#endregion
25475
- //#region src/lib/worker-agent/browse-tools.ts
25383
+ // src/lib/worker-agent/browse-tools.ts
25476
25384
  /** Wrap a text payload in Pi's tool-result shape (empty `details`). */
25477
25385
  function textResult$1(text) {
25478
25386
  return {
@@ -25873,8 +25781,7 @@ function buildBrowseTools(opts = {}) {
25873
25781
  makeTerminalTool(REPORT_INSUFFICIENT_TOOL, "Report insufficient", REPORT_INSUFFICIENT_DESCRIPTION, REPORT_INSUFFICIENT_SCHEMA)
25874
25782
  ];
25875
25783
  }
25876
- //#endregion
25877
- //#region src/lib/worker-agent/compaction.ts
25784
+ // src/lib/worker-agent/compaction.ts
25878
25785
  /** Content already at/below this byte size isn't worth stubbing (idempotency). */
25879
25786
  const STUB_SKIP_BYTES = 256;
25880
25787
  function toolResultStub(toolName) {
@@ -26050,8 +25957,7 @@ function compactWorkerContext(messages, budget) {
26050
25957
  if (sum > budget.hardLimitTokens) prunePass(out, out.length, firstUserIdx, budget.hardLimitTokens, sum);
26051
25958
  return out;
26052
25959
  }
26053
- //#endregion
26054
- //#region src/lib/worker-agent/tool-output-cap.ts
25960
+ // src/lib/worker-agent/tool-output-cap.ts
26055
25961
  /**
26056
25962
  * Generic, boundary-safe cap for a worker tool's model-visible TEXT output.
26057
25963
  *
@@ -26194,8 +26100,7 @@ function capToolResultText(content, capBytes) {
26194
26100
  }
26195
26101
  ];
26196
26102
  }
26197
- //#endregion
26198
- //#region src/lib/launch-registry.ts
26103
+ // src/lib/launch-registry.ts
26199
26104
  /**
26200
26105
  * Prefix marking a synthetic credential's `accessToken` as carrying a
26201
26106
  * `/v1/messages` launch-binding secret.
@@ -26304,8 +26209,7 @@ function findLaunchMcpAuthByNonce(nonce) {
26304
26209
  function findLaunchBySecret(secret) {
26305
26210
  for (const entry of state.launchRegistry.values()) if (constantTimeStringEqual(entry.secret, secret)) return entry;
26306
26211
  }
26307
- //#endregion
26308
- //#region src/services/copilot/create-messages.ts
26212
+ // src/services/copilot/create-messages.ts
26309
26213
  /**
26310
26214
  * Build headers that match what VS Code Copilot Chat sends to the Copilot API.
26311
26215
  *
@@ -26728,8 +26632,7 @@ async function sendLocalMessages(req) {
26728
26632
  if (text.length === 0) throw new Error(`Local model returned empty response (model: ${req.model})`);
26729
26633
  return text;
26730
26634
  }
26731
- //#endregion
26732
- //#region src/lib/peer-attachments.ts
26635
+ // src/lib/peer-attachments.ts
26733
26636
  /**
26734
26637
  * Server-side image loading for peer-critic attachments (`imagePaths`).
26735
26638
  *
@@ -26880,8 +26783,7 @@ async function loadPeerImages(paths, workspace) {
26880
26783
  images
26881
26784
  };
26882
26785
  }
26883
- //#endregion
26884
- //#region src/lib/tokenizer.ts
26786
+ // src/lib/tokenizer.ts
26885
26787
  const ENCODING_MAP = {
26886
26788
  o200k_base: () => import("gpt-tokenizer/encoding/o200k_base"),
26887
26789
  cl100k_base: () => import("gpt-tokenizer/encoding/cl100k_base"),
@@ -27095,8 +26997,7 @@ const getTokenCount = async (payload, model) => {
27095
26997
  output: outputTokens
27096
26998
  };
27097
26999
  };
27098
- //#endregion
27099
- //#region src/lib/openai-frontier.ts
27000
+ // src/lib/openai-frontier.ts
27100
27001
  /**
27101
27002
  * OpenAI frontier models + shim effort policy.
27102
27003
  *
@@ -27137,8 +27038,7 @@ function normalizeModelId(id) {
27137
27038
  function shimDefaultsToXhigh(id) {
27138
27039
  return XHIGH_DEFAULT_SHIM_MODELS.includes(normalizeModelId(id));
27139
27040
  }
27140
- //#endregion
27141
- //#region src/lib/mcp-capabilities.ts
27041
+ // src/lib/mcp-capabilities.ts
27142
27042
  /**
27143
27043
  * Capability-gate predicates for the proxy's MCP tool surface.
27144
27044
  *
@@ -28030,8 +27930,7 @@ var AdoMcpClient = class extends RemoteMcpClient {
28030
27930
  return envelope;
28031
27931
  }
28032
27932
  };
28033
- //#endregion
28034
- //#region src/lib/ado-tools.ts
27933
+ // src/lib/ado-tools.ts
28035
27934
  /**
28036
27935
  * The `ado` MCP group: the tool surface Azure DevOps itself advertises.
28037
27936
  *
@@ -28205,8 +28104,7 @@ function adoMcpToolEntries() {
28205
28104
  if (!state.adoEnabled) return [];
28206
28105
  return snapshot$1;
28207
28106
  }
28208
- //#endregion
28209
- //#region src/lib/workiq/client.ts
28107
+ // src/lib/workiq/client.ts
28210
28108
  /**
28211
28109
  * Work IQ MCP client: a thin subclass of the shared streamable-HTTP transport
28212
28110
  * pointed at `https://workiq.svc.cloud.microsoft/mcp`.
@@ -28417,8 +28315,7 @@ var WorkiqMcpClient = class extends RemoteMcpClient {
28417
28315
  }] };
28418
28316
  }
28419
28317
  };
28420
- //#endregion
28421
- //#region src/lib/workiq-tools.ts
28318
+ // src/lib/workiq-tools.ts
28422
28319
  /**
28423
28320
  * The `workiq` MCP group: Microsoft 365 research through the hosted Work IQ
28424
28321
  * service.
@@ -28613,8 +28510,7 @@ function workiqMcpToolEntries() {
28613
28510
  if (!state.workiqEnabled) return [];
28614
28511
  return snapshot;
28615
28512
  }
28616
- //#endregion
28617
- //#region src/routes/mcp/handler.ts
28513
+ // src/routes/mcp/handler.ts
28618
28514
  const MCP_PROTOCOL_VERSION = "2025-06-18";
28619
28515
  const SERVER_NAME = "github-router-peers";
28620
28516
  const SERVER_VERSION = "1";
@@ -29475,7 +29371,7 @@ function toolAcceptsWorkspace(tool) {
29475
29371
  */
29476
29372
  function applySessionWorkspace(args, sessionWorkspace, tool) {
29477
29373
  if (args.workspace !== void 0 && args.workspace !== "") return "argument";
29478
- if ((!tool || toolAcceptsWorkspace(tool)) && typeof sessionWorkspace === "string" && sessionWorkspace.length > 0 && path.isAbsolute(sessionWorkspace)) {
29374
+ if ((!tool || toolAcceptsWorkspace(tool)) && typeof sessionWorkspace === "string" && sessionWorkspace.length > 0 && path$1.isAbsolute(sessionWorkspace)) {
29479
29375
  args.workspace = sessionWorkspace;
29480
29376
  return "session";
29481
29377
  }
@@ -29719,7 +29615,7 @@ async function handleToolsCall(body, scope, launch, audience = "shared", session
29719
29615
  personaContext = typeof args.context === "string" ? args.context : void 0;
29720
29616
  if (args.imagePaths !== void 0) {
29721
29617
  if (!Array.isArray(args.imagePaths) || args.imagePaths.some((v) => typeof v !== "string")) return rpcError(body.id, RPC_INVALID_PARAMS, "tools/call: arguments.imagePaths must be an array of strings");
29722
- const imageRoot = typeof sessionWorkspace === "string" && sessionWorkspace.length > 0 && path.isAbsolute(sessionWorkspace) ? sessionWorkspace : process.cwd();
29618
+ const imageRoot = typeof sessionWorkspace === "string" && sessionWorkspace.length > 0 && path$1.isAbsolute(sessionWorkspace) ? sessionWorkspace : process.cwd();
29723
29619
  const loaded = await loadPeerImages(args.imagePaths, imageRoot);
29724
29620
  if (!loaded.ok) return rpcError(body.id, RPC_INVALID_PARAMS, `tools/call: ${loaded.error}`);
29725
29621
  personaImages = loaded.images;
@@ -30092,8 +29988,7 @@ function handleMcpDelete(c) {
30092
29988
  if (!auth.ok) return c.json(rpcError(null, RPC_INVALID_REQUEST, auth.reason), auth.status);
30093
29989
  return c.body(null, 200);
30094
29990
  }
30095
- //#endregion
30096
- //#region src/lib/anthropic-usage.ts
29991
+ // src/lib/anthropic-usage.ts
30097
29992
  const ENCODER$2 = new TextEncoder();
30098
29993
  const DECODER = new TextDecoder();
30099
29994
  /** The usage fields this module reasons about, in log order. */
@@ -30343,8 +30238,7 @@ function createAnthropicUsageRewriteTransform() {
30343
30238
  }
30344
30239
  };
30345
30240
  }
30346
- //#endregion
30347
- //#region src/lib/reasoning-effort.ts
30241
+ // src/lib/reasoning-effort.ts
30348
30242
  /**
30349
30243
  * Reasoning-effort bucketing + clamping shared by the `/v1/messages` handler
30350
30244
  * (adaptive-thinking translation) and the Anthropic-translation shim
@@ -30423,7 +30317,7 @@ function clampEffort(bucketed, supported) {
30423
30317
  if (supported.includes(bucketed)) return bucketed;
30424
30318
  const targetIdx = EFFORT_ORDER.indexOf(bucketed);
30425
30319
  let best;
30426
- let bestDist = Infinity;
30320
+ let bestDist = 1e400;
30427
30321
  for (let i = 0; i < EFFORT_ORDER.length; i++) {
30428
30322
  const value = EFFORT_ORDER[i];
30429
30323
  if (!supported.includes(value)) continue;
@@ -30435,8 +30329,7 @@ function clampEffort(bucketed, supported) {
30435
30329
  }
30436
30330
  return best ?? bucketed;
30437
30331
  }
30438
- //#endregion
30439
- //#region src/lib/stream-relay.ts
30332
+ // src/lib/stream-relay.ts
30440
30333
  const ENCODER$1 = new TextEncoder();
30441
30334
  /** Concatenate two byte runs, preserving order (left first). */
30442
30335
  function concatBytes(left, right) {
@@ -30707,8 +30600,7 @@ function logStreamError(routePath, error, bytesRelayed) {
30707
30600
  transport
30708
30601
  };
30709
30602
  }
30710
- //#endregion
30711
- //#region src/lib/thinking-history-repair.ts
30603
+ // src/lib/thinking-history-repair.ts
30712
30604
  const THINKING_INTEGRITY_ERROR_RES = [/messages\.(\d+)\.content\.(\d+):\s*`thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified/, /messages\.(\d+)\.content\.(\d+):\s*Invalid `signature` in `thinking` block/];
30713
30605
  const MAX_REMEMBERED_REPAIRS = 1e3;
30714
30606
  const OMITTED_THINKING_PLACEHOLDER = "[prior reasoning omitted]";
@@ -30956,8 +30848,7 @@ function rememberThinkingHistoryRepair(fingerprint) {
30956
30848
  }
30957
30849
  rememberedRepairs.add(fingerprint);
30958
30850
  }
30959
- //#endregion
30960
- //#region src/services/advisor/advisor.ts
30851
+ // src/services/advisor/advisor.ts
30961
30852
  /**
30962
30853
  * Phase I: ADVISOR proxy-side translation.
30963
30854
  *
@@ -32469,8 +32360,7 @@ function buildAdvisorStream(opts) {
32469
32360
  }
32470
32361
  });
32471
32362
  }
32472
- //#endregion
32473
- //#region src/services/copilot/web-search.ts
32363
+ // src/services/copilot/web-search.ts
32474
32364
  const RpcSchema = z.object({
32475
32365
  jsonrpc: z.literal("2.0"),
32476
32366
  id: z.number().optional(),
@@ -32645,8 +32535,7 @@ async function searchWeb(query, signal) {
32645
32535
  } catch {}
32646
32536
  }
32647
32537
  }
32648
- //#endregion
32649
- //#region src/lib/toolbelt/manifest.ts
32538
+ // src/lib/toolbelt/manifest.ts
32650
32539
  /**
32651
32540
  * Parse the first `X.Y.Z` out of a `--version` line into comparable parts.
32652
32541
  * Tools print wildly different shapes (`ast-grep 0.43.0`, `jq-1.7.1`,
@@ -32953,8 +32842,7 @@ const TOOLBELT_TOOLS$1 = [
32953
32842
  }
32954
32843
  }
32955
32844
  ];
32956
- //#endregion
32957
- //#region src/lib/toolbelt/index.ts
32845
+ // src/lib/toolbelt/index.ts
32958
32846
  /**
32959
32847
  * Toolbelt gating, gap-fill planning, and the awareness one-liner.
32960
32848
  *
@@ -33018,8 +32906,7 @@ function buildToolbeltAwareness(commands) {
33018
32906
  if (commands.length === 0) return null;
33019
32907
  return "Fast CLI tools are available on your PATH; prefer them when applicable: " + commands.map((c) => TOOL_DESC[c] ?? c).join(", ") + ".";
33020
32908
  }
33021
- //#endregion
33022
- //#region src/lib/worker-agent/bash.ts
32909
+ // src/lib/worker-agent/bash.ts
33023
32910
  /**
33024
32911
  * Bounded `bash` execution for the worker tool.
33025
32912
  *
@@ -33288,8 +33175,7 @@ function runBash(cmd, opts) {
33288
33175
  });
33289
33176
  });
33290
33177
  }
33291
- //#endregion
33292
- //#region src/lib/worker-agent/tools.ts
33178
+ // src/lib/worker-agent/tools.ts
33293
33179
  /**
33294
33180
  * Worker-agent AgentTool definitions.
33295
33181
  *
@@ -33560,10 +33446,10 @@ async function runRipgrep(args, cwd, signal) {
33560
33446
  * error so we don't leave litter.
33561
33447
  */
33562
33448
  function atomicWriteSync(absPath, contents) {
33563
- const dir = path$1.dirname(absPath);
33564
- const base = path$1.basename(absPath);
33449
+ const dir = path.dirname(absPath);
33450
+ const base = path.basename(absPath);
33565
33451
  const rand = Math.random().toString(16).slice(2, 10);
33566
- const tmp = path$1.join(dir, `.${base}.${rand}.tmp`);
33452
+ const tmp = path.join(dir, `.${base}.${rand}.tmp`);
33567
33453
  let fd;
33568
33454
  try {
33569
33455
  fd = openSync(tmp, "w", 420);
@@ -34491,8 +34377,7 @@ function buildWorkerTools(opts) {
34491
34377
  codexReviewTool()
34492
34378
  ];
34493
34379
  }
34494
- //#endregion
34495
- //#region src/lib/worker-agent/worktree.ts
34380
+ // src/lib/worker-agent/worktree.ts
34496
34381
  /**
34497
34382
  * Git worktree provisioning for `worker_implement({worktree: true})`.
34498
34383
  *
@@ -34627,7 +34512,7 @@ async function findRepoRoot(workspaceAbs) {
34627
34512
  if (lines.length < 2) throw new Error(`worker-agent worktree: unexpected git rev-parse output: ${JSON.stringify(result.stdout)}`);
34628
34513
  const repoRoot = lines[0];
34629
34514
  let gitCommonDir = lines[1];
34630
- if (!path.isAbsolute(gitCommonDir)) gitCommonDir = path.resolve(repoRoot, gitCommonDir);
34515
+ if (!path$1.isAbsolute(gitCommonDir)) gitCommonDir = path$1.resolve(repoRoot, gitCommonDir);
34631
34516
  return {
34632
34517
  repoRoot,
34633
34518
  gitCommonDir
@@ -34654,7 +34539,7 @@ async function sweepAgedWorktrees(parent) {
34654
34539
  const now = Date.now();
34655
34540
  for (const name of entries) {
34656
34541
  if (!WORKTREE_DIR_NAME_RE.test(name)) continue;
34657
- const full = path.join(parent, name);
34542
+ const full = path$1.join(parent, name);
34658
34543
  try {
34659
34544
  const ageMs = now - (await fs$1.stat(full)).mtimeMs;
34660
34545
  if (ageMs < AGE_SWEEP_MTIME_FLOOR_MS) continue;
@@ -34683,7 +34568,7 @@ async function sweepAgedWorktrees(parent) {
34683
34568
  */
34684
34569
  async function createWorktree(workspaceAbs, opts) {
34685
34570
  const { repoRoot, gitCommonDir } = await findRepoRoot(workspaceAbs);
34686
- const parent = path.join(gitCommonDir, "worker-worktrees");
34571
+ const parent = path$1.join(gitCommonDir, "worker-worktrees");
34687
34572
  await fs$1.mkdir(parent, { recursive: true });
34688
34573
  await sweepAgedWorktrees(parent);
34689
34574
  let existing = [];
@@ -34694,7 +34579,7 @@ async function createWorktree(workspaceAbs, opts) {
34694
34579
  const suffix = randomBytes(4).toString("hex");
34695
34580
  const slug = `${process$1.pid}-${opts.instanceUuid}-${suffix}`;
34696
34581
  const branch = `worker/${slug}`;
34697
- const dir = path.join(parent, slug);
34582
+ const dir = path$1.join(parent, slug);
34698
34583
  await execFileP("git", [
34699
34584
  "-C",
34700
34585
  repoRoot,
@@ -34734,9 +34619,9 @@ async function createWorktree(workspaceAbs, opts) {
34734
34619
  "-z"
34735
34620
  ])).stdout.split("\0").filter((s) => s.length > 0);
34736
34621
  for (const rel of files) {
34737
- const src = path.join(repoRoot, rel);
34738
- const dst = path.join(dir, rel);
34739
- await fs$1.mkdir(path.dirname(dst), { recursive: true });
34622
+ const src = path$1.join(repoRoot, rel);
34623
+ const dst = path$1.join(dir, rel);
34624
+ await fs$1.mkdir(path$1.dirname(dst), { recursive: true });
34740
34625
  try {
34741
34626
  await fs$1.copyFile(src, dst);
34742
34627
  } catch (err) {
@@ -34861,7 +34746,7 @@ async function saveOverflowPatch(dir) {
34861
34746
  let lastErr;
34862
34747
  for (let attempt = 0; attempt < 5; attempt++) {
34863
34748
  const name = `${process$1.pid}-${randomBytes(4).toString("hex")}.patch`;
34864
- const patchPath = path.join(PATHS.WORKER_DIFFS_DIR, name);
34749
+ const patchPath = path$1.join(PATHS.WORKER_DIFFS_DIR, name);
34865
34750
  try {
34866
34751
  await fs$1.writeFile(patchPath, patch.stdout, {
34867
34752
  mode: 384,
@@ -34875,8 +34760,7 @@ async function saveOverflowPatch(dir) {
34875
34760
  }
34876
34761
  throw lastErr instanceof Error ? lastErr : /* @__PURE__ */ new Error("saveOverflowPatch: exhausted unique-name retries");
34877
34762
  }
34878
- //#endregion
34879
- //#region src/lib/worker-agent/engine.ts
34763
+ // src/lib/worker-agent/engine.ts
34880
34764
  /**
34881
34765
  * `runWorkerAgent` — the engine that wires every foundation module
34882
34766
  * (`types`, `paths`, `prompts`, `budget`, `redact`, `semaphore`,
@@ -35269,7 +35153,7 @@ async function runWorkerAgentOnce(opts) {
35269
35153
  searchEnabled: state.searchEnabled === true,
35270
35154
  bluebirdEnabled: state.bluebirdEnabled === true
35271
35155
  });
35272
- const agent = new Agent$1({
35156
+ const agent = new Agent({
35273
35157
  initialState: {
35274
35158
  systemPrompt: systemPromptFor(opts.mode, state.searchEnabled === true, state.bluebirdEnabled === true),
35275
35159
  model: makeModelShim(resolved.modelId),
@@ -35493,8 +35377,7 @@ function appendPlanReminder(messages, planState) {
35493
35377
  };
35494
35378
  return [...messages, reminder];
35495
35379
  }
35496
- //#endregion
35497
- //#region src/lib/stand-in.ts
35380
+ // src/lib/stand-in.ts
35498
35381
  /**
35499
35382
  * The three frontier peers. Effort is FIXED per model — not caller-tunable.
35500
35383
  * The tool's purpose is "give me the best 3-lab judgment available";
@@ -35915,8 +35798,7 @@ function voteRecord(r1, r2, panel) {
35915
35798
  function round2(n) {
35916
35799
  return Math.round(n * 100) / 100;
35917
35800
  }
35918
- //#endregion
35919
- //#region src/lib/orchestration/select.ts
35801
+ // src/lib/orchestration/select.ts
35920
35802
  const subsetOf = (a, b) => {
35921
35803
  for (const x of a) if (!b.has(x)) return false;
35922
35804
  return true;
@@ -35961,8 +35843,7 @@ function selectChampion(orchestrated, baseline, canonicalGateIds, tiePolicy) {
35961
35843
  reason: "orchestrated does not pass strictly more canonical checks than the baseline (strict policy)"
35962
35844
  };
35963
35845
  }
35964
- //#endregion
35965
- //#region src/lib/orchestration/verify.ts
35846
+ // src/lib/orchestration/verify.ts
35966
35847
  /**
35967
35848
  * Static verifier for the workflow IR. This is what `decompose`'s output is
35968
35849
  * checked against (and what Claude calls pre-flight) BEFORE the frozen kernel
@@ -36189,8 +36070,7 @@ function hasCycle(nodes, byId) {
36189
36070
  }
36190
36071
  return false;
36191
36072
  }
36192
- //#endregion
36193
- //#region src/lib/orchestration/kernel.ts
36073
+ // src/lib/orchestration/kernel.ts
36194
36074
  const DEFAULT_MAX_RETRIES = 2;
36195
36075
  async function executeWorkflow(ir, runner, opts) {
36196
36076
  const verdict = verifyWorkflowIR(ir, { knownGateIds: opts.knownGateIds });
@@ -36272,8 +36152,7 @@ async function executeWorkflow(ir, runner, opts) {
36272
36152
  gatesPassed: winnerRes.ok
36273
36153
  };
36274
36154
  }
36275
- //#endregion
36276
- //#region src/lib/orchestration/decompose.ts
36155
+ // src/lib/orchestration/decompose.ts
36277
36156
  const DEFAULT_MAX_ROUNDS = 3;
36278
36157
  const formatViolations = (violations) => violations.map((v) => `${v.code}: ${v.message}${v.nodeId ? ` (node "${v.nodeId}")` : ""}`);
36279
36158
  /** Draft once, never throwing — a thrown driver becomes a failed round. */
@@ -36373,8 +36252,7 @@ async function decomposeWorkflow(ask, deps, opts = {}) {
36373
36252
  rounds: attempts
36374
36253
  };
36375
36254
  }
36376
- //#endregion
36377
- //#region src/lib/orchestration/runner.ts
36255
+ // src/lib/orchestration/runner.ts
36378
36256
  const passesAll = (g, checks) => {
36379
36257
  for (const id of checks) if (!g.passed.has(id)) return false;
36380
36258
  return true;
@@ -36452,8 +36330,7 @@ function makeRunner(deps, ctx) {
36452
36330
  }
36453
36331
  } };
36454
36332
  }
36455
- //#endregion
36456
- //#region src/lib/orchestration/runner-live.ts
36333
+ // src/lib/orchestration/runner-live.ts
36457
36334
  /**
36458
36335
  * The LIVE adapter for the kernel's NodeRunner primitives. buildLiveRunner wires
36459
36336
  * the four injected RunnerDeps to real side effects: a git worktree per write
@@ -36554,8 +36431,7 @@ function buildLiveRunner(ctx, prim) {
36554
36431
  }
36555
36432
  };
36556
36433
  }
36557
- //#endregion
36558
- //#region src/lib/orchestration/attest.ts
36434
+ // src/lib/orchestration/attest.ts
36559
36435
  function isNonEmptyString(v) {
36560
36436
  return typeof v === "string" && v.length > 0;
36561
36437
  }
@@ -36618,8 +36494,7 @@ function attestRun(input) {
36618
36494
  nodes: results
36619
36495
  };
36620
36496
  }
36621
- //#endregion
36622
- //#region src/lib/orchestration/decompose-live.ts
36497
+ // src/lib/orchestration/decompose-live.ts
36623
36498
  /**
36624
36499
  * The LIVE adapter for `decompose` — wires the injected `DecomposeDeps` to real
36625
36500
  * Copilot model calls (`dispatchModelCall`). The driver drafts the IR as JSON;
@@ -36722,8 +36597,7 @@ function buildLiveDecomposeDeps(opts) {
36722
36597
  }
36723
36598
  return deps;
36724
36599
  }
36725
- //#endregion
36726
- //#region src/lib/orchestration/run-workflow-live.ts
36600
+ // src/lib/orchestration/run-workflow-live.ts
36727
36601
  /**
36728
36602
  * The LIVE composition for `run_workflow`: assembles the real side-effecting
36729
36603
  * primitives (git worktrees via `createWorktree`, the worker engine via
@@ -36782,7 +36656,7 @@ async function runWorkflowLive(opts) {
36782
36656
  ok: false,
36783
36657
  error: "ask is required (a non-empty string)"
36784
36658
  };
36785
- if (typeof opts.workspace !== "string" || !path.isAbsolute(opts.workspace)) return {
36659
+ if (typeof opts.workspace !== "string" || !path$1.isAbsolute(opts.workspace)) return {
36786
36660
  ok: false,
36787
36661
  error: "workspace must be an absolute path"
36788
36662
  };
@@ -36866,8 +36740,7 @@ async function runWorkflowLive(opts) {
36866
36740
  await lr.cleanup();
36867
36741
  }
36868
36742
  }
36869
- //#endregion
36870
- //#region src/lib/peer-mcp-personas.ts
36743
+ // src/lib/peer-mcp-personas.ts
36871
36744
  /**
36872
36745
  * Peer-model persona specifications.
36873
36746
  *
@@ -38771,7 +38644,7 @@ async function runWorkerToolCall(call) {
38771
38644
  }],
38772
38645
  isError: true
38773
38646
  };
38774
- if (!path.isAbsolute(args.workspace)) return {
38647
+ if (!path$1.isAbsolute(args.workspace)) return {
38775
38648
  content: [{
38776
38649
  type: "text",
38777
38650
  text: `worker_${mode}: arguments.workspace must be an absolute path (got "${args.workspace}")`
@@ -38878,7 +38751,7 @@ async function runBrowseToolCall(args, signal) {
38878
38751
  }],
38879
38752
  isError: true
38880
38753
  };
38881
- if (!path.isAbsolute(args.workspace)) return {
38754
+ if (!path$1.isAbsolute(args.workspace)) return {
38882
38755
  content: [{
38883
38756
  type: "text",
38884
38757
  text: `browse: arguments.workspace must be an absolute path (got "${args.workspace}")`
@@ -39055,7 +38928,6 @@ function enumerateInjectedMcpToolNames(groupKeys, opts = {}) {
39055
38928
  if (opts.codexCli) names.push("mcp__codex-cli__codex");
39056
38929
  return [...new Set(names)];
39057
38930
  }
39058
- //#endregion
39059
38931
  export { buildAnthropicErrorEvent as $, DEFAULT_PORT as $n, nativeSubagentModel as $t, TOOLBELT_TOOLS$1 as A, parseJsonOrDiagnose as An, brainstormModel as At, FAST_ADVISOR_TOOL_INSTRUCTIONS as B, colbertDegradedWarning as Bn, cloudAgentToolsEnabled as Bt, runWorkerAgent as C, assembleResponsesPayload as Cn, ADO_DEFAULT_TOOLSETS as Ct, toolbeltEnabled as D, createChatCompletions as Dn, artifactToolsEnabled as Dt, buildToolbeltAwareness as E, createResponses as En, agentToolsEnabled as Et, ADVISOR_TOOL_INSTRUCTIONS as F, normalizeKustoClusterUri as Fn, cheapOracleModel as Ft, isAdvisorRequested as G, LOCAL_CONSULT_REDACTION_NOTE as Gn, fastPlanModel as Gt, LOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS as H, semanticSearchOptedIn as Hn, fastAstraModel as Ht, CHEAPEST_ADVISOR_TOOL_INSTRUCTIONS as I, CONDENSED_OPERATING_SEQUENCE as In, cheapReviewerModel as It, resolveCuratedAdvisorModel as J, BUDGET_SMALL_FAST_CATALOG_ID as Jn, fleetToolsEnabled as Jt, resolveAdvisorEffort as K, collapsePathKeys as Kn, fastReviewerModel as Kt, CHEAPEST_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS as L, DEFINITION_OF_GREATNESS as Ln, cheapestAdvisorModel as Lt, satisfiesMinVersion as M, provisionBrowserAssets as Mn, browserCompoundToolsEnabled as Mt, searchWeb as N, hasSupportedBrowserInstalled as Nn, browserToolsEnabled as Nt, toolbeltSkipSet as O, MAX_RESPONSE_BODY_BYTES as On, balancedOracleModel as Ot, ADVISOR_INTERNAL_TOOL_NAME as P, normalizeCloudAgentEnvironment as Pn, cheapAdvisorModel as Pt, repairRejectedThinkingHistory as Q, DEFAULT_CODEX_MODEL_FALLBACKS as Qn, kustoToolsEnabled as Qt, CHEAPLOCAL_ADVISOR_TOOL_INSTRUCTIONS as R, assertCopilotModelAllowed as Rn, cheapestOracleModel as Rt, resolveWorkerRunOpts as S, unregisterLaunch as Sn, provisionAdoTools as St, availableToolCommands as T, resolveMcpToolTimeoutMs as Tn, adoToolsEnabled as Tt, buildAdvisorStream as U, shouldUseInsecureTls as Un, fastGeneralPurposeModel as Ut, LOCAL_ADVISOR_TOOL_INSTRUCTIONS as V, provisionAndIndexColbert as Vn, fastAdvisorModel as Vt, injectAdvisorTool as W, LOCAL_CONSULT_REDACTION_LINE as Wn, fastOracleModel as Wt, rememberThinkingHistoryRepair as X, DEFAULT_CLAUDE_MODEL_FALLBACKS as Xn, generalPurposeFastModel as Xt, formatThinkingRepairDecline as Y, BUDGET_SMALL_FAST_SLUG as Yn, geminiAvailable as Yt, repairKnownThinkingHistory as Z, DEFAULT_CODEX_MODEL as Zn, implementerFastModel as Zt, REVIEW_DEFAULT_MODEL as _, LAUNCH_BOUND_TOKEN_PREFIX as _n, CHEAP_PROFILE_NATIVE_MODELS as _r, provisionWorkiqTools as _t, buildAgentPrompt as a, standInToolEnabled as an, resolveLeadSlugArg as ar, EFFORT_ORDER as at, resolveDefaultModel as b, registerLaunch as bn, buildAdoToolEntries as bt, enumerateInjectedMcpToolNames as c, shimDefaultsToXhigh as cn, classifyMessagesRoute as cr, clampEffort as ct, BROWSE_DEFAULT_MODEL as d, getTokenizerFromModel as dn, withOneMSuffix as dr, normalizeAnthropicUsageInPlace as dt, resolveGeminiReviewModel as en, UPSTREAM_FETCH_TIMEOUT_MS as er, buildOpenAIErrorEvent as et, DEFAULT_MODEL_CHAIN as f, configureLocalEgress as fn, withOneMSuffixForLead as fr, handleMcpDelete as ft, PLAN_DEFAULT_MODEL as g, createMessages as gn, CHEAP_PROFILE_NATIVE_EFFORTS as gr, disposeWorkiqClients as gt, IMPLEMENT_DEFAULT_MODEL as h, countTokens as hn, CHEAP_PROFILE_NATIVE_AGENT_NAMES as hr, buildWorkiqToolEntries as ht, assertMcpToolSurfaceConsistent as i, scribeModel as in, pickClaudeDefault as ir, relayAnthropicStream as it, assetFor as j, normalizeOpenAIUsage as jn, browseAgentEnabled as jt, vscodeRipgrepPath as k, readResponseBodyCapped as kn, balancedReviewerModel as kt, maxPersonasFor as l, getTextTokenCount as ln, catalogAdvertises1M as lr, anthropicUsageNormalizeDisabled as lt, EXPLORE_DEFAULT_THINKING as m, localSessionId as mn, CHEAP_PROFILE_MODELS as mr, WORKIQ_TOOL_ALIASES as mt, MCP_GROUPS as n, reviewerModel as nn, generateRandomPort as nr, logStreamError as nt, buildPeerAwarenessSnippet as o, workerToolsEnabled as on, upstreamAllowH2 as or, UNKNOWN_EFFORT_ANCHOR as ot, EXPLORE_DEFAULT_MODEL as p, localBaseUrl as pn, CHEAP_PROFILE_ADVISOR_CLIENT_MODEL as pr, handleMcpPost as pt, resolveAdvisorModel as q, toolbeltPathOverride as qn, fastScoutModel as qt, agentNamesForToolAllowlist as r, scoutModel as rn, isBudgetClaudeLead as rr, readIteratorWithTimeout as rt, buildPeerAwarenessSummary as s, workiqToolsEnabled as sn, upstreamMaxConnections as sr, bucketEffort as st, GROUP_META as t, reviewerFastModel as tn, UPSTREAM_INACTIVITY_TIMEOUT_MS as tr, isControllerClosedError as tt, personasFor as u, getTokenCount as un, oneMContextDisabled as ur, createAnthropicUsageRewriteTransform as ut, TEST_DEFAULT_MODEL as v, findLaunchBySecret as vn, CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS as vr, workiqMcpToolEntries as vt, buildEnv as w, warnOnTokenPriceDrift as wn, normalizeAdoToolsets as wt, resolveModeDefaults as x, rememberLaunchSessionId as xn, disposeAdoClients as xt, appendPlanReminder as y, launchBoundAccessToken as yn, adoMcpToolEntries as yt, CHEAPLOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS as z, effectiveLocalProfile as zn, cheapestReviewerModel as zt };
39060
38932
 
39061
- //# sourceMappingURL=peer-mcp-personas-BSxDj9sJ.js.map
38933
+ //# sourceMappingURL=peer-mcp-personas-Cv21q_YR.js.map