github-router 0.3.372 → 0.3.374

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-HI_5bN_-.js → attribution-settings-BLTnz2_A.js} +33 -53
  7. package/dist/{attribution-settings-HI_5bN_-.js.map → attribution-settings-BLTnz2_A.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-BBSsqwln.js → claude-DSXrdz0v.js} +37 -43
  20. package/dist/{claude-BBSsqwln.js.map → claude-DSXrdz0v.js.map} +1 -1
  21. package/dist/{claude-md-injection-BMon6WUD.js → claude-md-injection-DU5KYXNc.js} +6 -7
  22. package/dist/{claude-md-injection-BMon6WUD.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-PRWoBiOH.js → codex-DGMUk65v.js} +10 -11
  26. package/dist/{codex-PRWoBiOH.js.map → codex-DGMUk65v.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-BNy8GKsC.js → gate-discovery-DiXu_olc.js} +8 -10
  37. package/dist/{gate-discovery-BNy8GKsC.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-CjRcmYk3.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-CXlOsW63.js → internal-stop-hook-VQuOYpUC.js} +9 -10
  69. package/dist/{internal-stop-hook-CXlOsW63.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-Dxxw5X1g.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-IYAvKF50.js → pi-DI2QtaiZ.js} +305 -89
  103. package/dist/pi-DI2QtaiZ.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-CIn6I4w_.js → provision-CRmtV6ew.js} +10 -14
  109. package/dist/{provision-CIn6I4w_.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-CttHP8dJ.js → serve-DRASJ-ZO.js} +24 -30
  114. package/dist/{serve-CttHP8dJ.js.map → serve-DRASJ-ZO.js.map} +1 -1
  115. package/dist/{server-setup-D7XHUrhM.js → server-setup-DldGizZR.js} +67 -117
  116. package/dist/{server-setup-D7XHUrhM.js.map → server-setup-DldGizZR.js.map} +1 -1
  117. package/dist/{service-backend-B6D_DY1Z.js → service-backend-Ce6b2XEe.js} +146 -146
  118. package/dist/service-backend-Ce6b2XEe.js.map +1 -0
  119. package/dist/{start-XU5HwLd9.js → start-C0gngUPK.js} +6 -8
  120. package/dist/{start-XU5HwLd9.js.map → start-C0gngUPK.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-CMoDjrO0.js → workiq-tools-7n2xXMrQ.js} +1 -1
  142. package/package.json +19 -17
  143. package/dist/ado-tools-CAtopk36.js +0 -1
  144. package/dist/engine-CDZdAx8N.js +0 -1
  145. package/dist/hook-mcp-client-DERIkeR7.js.map +0 -1
  146. package/dist/index-cmd-CjRcmYk3.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-Dxxw5X1g.js.map +0 -1
  151. package/dist/pi-IYAvKF50.js.map +0 -1
  152. package/dist/service-backend-B6D_DY1Z.js.map +0 -1
@@ -1,16 +1,16 @@
1
- import { P as warmTreeSitterPool } from "./service-backend-B6D_DY1Z.js";
2
- import { t as getPackageVersion } from "./version-C8x2hQrZ.js";
3
- import { t as PATHS } from "./paths-C5477RGC.js";
4
- import { t as state } from "./state-DzsaGHr9.js";
5
- import { H as profileDescriptor, I as formatBalancedPrerequisiteFailure, S as enableFileLogging, U as resolveLaunchProfile, V as formatLocalPrerequisiteFailure, W as validateBalancedProfilePrerequisites, Y as validateLocalProfilePrerequisites, Z as runSelfUpdate, _ as sweepStalePiAgentMirrors, a as setupAndServe, c as PI_MIN_VERSION, d as meetsPiMinVersion, f as refreshPiInBackground, g as removeOwnPiAgentMirror, h as ensurePiAgentMirror, i as parseSharedArgs, l as ensurePiInstalled, m as updatePi, o as sharedServerArgs, p as resolvePiRegistry, q as validateCheapestProfilePrerequisites, r as getPiLaunchEnvVars, s as LAUNCH_SECRET_HEADER, u as getInstalledPiVersion, v as startKeepAwake, y as stopKeepAwake, z as formatCheapestPrerequisiteFailure } from "./server-setup-D7XHUrhM.js";
6
- import { Bn as colbertDegradedWarning, Bt as cloudAgentToolsEnabled, D as toolbeltEnabled, Dt as artifactToolsEnabled, Gn as LOCAL_CONSULT_REDACTION_NOTE, Mn as provisionBrowserAssets, Nt as browserToolsEnabled, Qt as kustoToolsEnabled, Sn as unregisterLaunch, Tt as adoToolsEnabled, Vn as provisionAndIndexColbert, Wn as LOCAL_CONSULT_REDACTION_LINE, bn as registerLaunch, fn as configureLocalEgress, jt as browseAgentEnabled, pn as localBaseUrl, sn as workiqToolsEnabled } from "./peer-mcp-personas-Dxxw5X1g.js";
7
- import { C as localContractFor, O as LOCAL_PROFILE_TIER_MODELS, S as local2AdvisorContract, _ as isBalancedFamily, b as isLocalFamily, f as balancedContractFor, h as consultIsLocalTransport, p as cheapestContractFor, v as isCheapestFamily, y as isCheaplocalProfile } from "./static-context-pack-CsOAC87F.js";
8
- import { r as resolveSelfInvocation } from "./self-invocation-BtcGj-lY.js";
9
- import { i as launchChild, t as provisionToolbelt } from "./provision-CIn6I4w_.js";
10
- import { d as removeAicLedgerFile, f as sweepStaleAicLedgerFiles, n as aicSnapshot, o as formatAicExitSummary, t as aicLedgerPath } from "./aic-ledger-Cp7Yk9-Q.js";
11
- import { t as FRESH_CONSULT_CONTRACT } from "./claude-md-injection-BMon6WUD.js";
12
- import { i as buildAicStatusHookCommand, n as AIC_STATUSLINE_DISABLE_ENV, t as AIC_LEDGER_ENV } from "./aic-statusline-settings-B5EMMSFC.js";
13
- import { n as formatDiscountedCostTable, t as discountedUsdForSnapshot } from "./copilot-discount-T-cfWmc4.js";
1
+ import { H as profileDescriptor, I as formatBalancedPrerequisiteFailure, S as enableFileLogging, U as resolveLaunchProfile, V as formatLocalPrerequisiteFailure, W as validateBalancedProfilePrerequisites, Y as validateLocalProfilePrerequisites, Z as runSelfUpdate, _ as sweepStalePiAgentMirrors, a as setupAndServe, c as PI_MIN_VERSION, d as meetsPiMinVersion, f as refreshPiInBackground, g as removeOwnPiAgentMirror, h as ensurePiAgentMirror, i as parseSharedArgs, l as ensurePiInstalled, m as updatePi, o as sharedServerArgs, p as resolvePiRegistry, q as validateCheapestProfilePrerequisites, r as getPiLaunchEnvVars, s as LAUNCH_SECRET_HEADER, u as getInstalledPiVersion, v as startKeepAwake, y as stopKeepAwake, z as formatCheapestPrerequisiteFailure } from "./server-setup-DldGizZR.js";
2
+ import { i as buildAicStatusHookCommand, n as AIC_STATUSLINE_DISABLE_ENV, t as AIC_LEDGER_ENV } from "./aic-statusline-settings-BKveu679.js";
3
+ import { d as removeAicLedgerFile, f as sweepStaleAicLedgerFiles, n as aicSnapshot, o as formatAicExitSummary, t as aicLedgerPath } from "./aic-ledger-CeSXqTEE.js";
4
+ import { n as formatDiscountedCostTable, t as discountedUsdForSnapshot } from "./copilot-discount-CHNQLYDJ.js";
5
+ import { r as resolveSelfInvocation } from "./self-invocation-DMUnXVGT.js";
6
+ import { t as PATHS } from "./paths-CVEO8jEH.js";
7
+ import { t as FRESH_CONSULT_CONTRACT } from "./claude-md-injection-DU5KYXNc.js";
8
+ import { Bn as colbertDegradedWarning, Bt as cloudAgentToolsEnabled, D as toolbeltEnabled, Dt as artifactToolsEnabled, Gn as LOCAL_CONSULT_REDACTION_NOTE, Mn as provisionBrowserAssets, Nt as browserToolsEnabled, Qt as kustoToolsEnabled, Sn as unregisterLaunch, Tt as adoToolsEnabled, Vn as provisionAndIndexColbert, Wn as LOCAL_CONSULT_REDACTION_LINE, bn as registerLaunch, fn as configureLocalEgress, jt as browseAgentEnabled, pn as localBaseUrl, sn as workiqToolsEnabled } from "./peer-mcp-personas-Cv21q_YR.js";
9
+ import { C as localContractFor, O as LOCAL_PROFILE_TIER_MODELS, S as local2AdvisorContract, _ as isBalancedFamily, b as isLocalFamily, f as balancedContractFor, h as consultIsLocalTransport, p as cheapestContractFor, v as isCheapestFamily, y as isCheaplocalProfile } from "./static-context-pack-DwC69_VA.js";
10
+ import { i as launchChild, t as provisionToolbelt } from "./provision-CRmtV6ew.js";
11
+ import { t as state } from "./state-CCGDJ43X.js";
12
+ import { t as getPackageVersion } from "./version-CTqwKr26.js";
13
+ import { P as warmTreeSitterPool } from "./service-backend-Ce6b2XEe.js";
14
14
  import { defineCommand } from "citty";
15
15
  import consola from "consola";
16
16
  import { existsSync } from "node:fs";
@@ -18,7 +18,7 @@ import path from "node:path";
18
18
  import { createHash, randomBytes } from "node:crypto";
19
19
  import fs$1 from "node:fs/promises";
20
20
  import process$1 from "node:process";
21
- //#region src/lib/pi-tier-windows.ts
21
+ // src/lib/pi-tier-windows.ts
22
22
  /**
23
23
  * Copilot Default-tier (cheap) input-token thresholds per model.
24
24
  *
@@ -120,8 +120,7 @@ function liveInputPer1M(models) {
120
120
  function warnOnTierPriceDriftForModels(models) {
121
121
  warnOnTierPriceDrift(liveInputPer1M(models));
122
122
  }
123
- //#endregion
124
- //#region src/lib/pi-statusline.ts
123
+ // src/lib/pi-statusline.ts
125
124
  /**
126
125
  * Pi footer statusline: Claude-shaped payload builder + launch constants.
127
126
  *
@@ -288,8 +287,7 @@ function buildPiStatusPayload(source, opts) {
288
287
  worktree: null
289
288
  };
290
289
  }
291
- //#endregion
292
- //#region src/lib/pi-package-cache.ts
290
+ // src/lib/pi-package-cache.ts
293
291
  /**
294
292
  * Persistent npm-package cache for Pi launches.
295
293
  *
@@ -439,8 +437,7 @@ async function sweepStalePiPackageCaches() {
439
437
  }
440
438
  }));
441
439
  }
442
- //#endregion
443
- //#region src/lib/pi-models-settings.ts
440
+ // src/lib/pi-models-settings.ts
444
441
  /**
445
442
  * Pi thinking levels that can appear in `thinkingLevelMap`. `off` is
446
443
  * omitted: it means "no reasoning" and is never mapped to a provider
@@ -471,6 +468,28 @@ function piThinkingLevelMapFor(efforts) {
471
468
  /** Provider key used in models.json and agent `provider/model` references. */
472
469
  const PI_PROVIDER_NAME = "gh-router";
473
470
  const PI_MIN_VERSION_NOTE = `Requires Pi >= ${PI_MIN_VERSION} and Node >= 22.19.`;
471
+ /**
472
+ * The tool-preference steer the digest carries.
473
+ *
474
+ * Pi's own per-tool guidelines cover `read`/`write`/`edit` but leave `grep`,
475
+ * `find` and `ls` with empty arrays (`dist/core/tools/*.js`), and its "use bash
476
+ * for ls, rg, find" rule fires only when those dedicated tools are ABSENT
477
+ * (`dist/core/system-prompt.js:46`). A launch with all eight active is told
478
+ * nothing, so the digest has to say it.
479
+ *
480
+ * Both halves are load-bearing. The first half stops the model shelling out to
481
+ * `sed`/`cat`/`python` for work the dedicated tools do better and with the
482
+ * harness's own approval and diff handling. The second half exists because the
483
+ * first is not true without it: a `jq` pipeline over a JSON blob, an `ast-grep`
484
+ * structural query, `git log -S`, or a build/test command all belong in bash,
485
+ * and a blanket "never shell out" would make the agent worse at exactly the
486
+ * tasks where the shell is the right instrument. Naming the tools is the point
487
+ * — "use the best tool" alone gives no signal.
488
+ *
489
+ * Single constant so the test suite pins one sentence rather than scraping the
490
+ * digest for keywords.
491
+ */
492
+ const PI_TOOL_PREFERENCE_LINE = "- Use the dedicated tools where they fit — read/write/edit for files and grep/find/ls for search — instead of shelling out to cat, sed, or python; but reach for rg, jq, ast-grep, git, and the build/test commands whenever those are the better tool for the job.";
474
493
  function piCopilotContractFor(profileId) {
475
494
  return isCheapestFamily(profileId) ? cheapestContractFor(profileId) : balancedContractFor(profileId);
476
495
  }
@@ -968,6 +987,70 @@ const PI_DEFAULT_TOOLS = Object.freeze([
968
987
  "ls"
969
988
  ]);
970
989
  /**
990
+ * The pi keybinding action that owns `shift+tab` by default.
991
+ *
992
+ * Named rather than spelled inline so the keybindings writer and the test that
993
+ * pins it cannot drift: `dist/core/keybindings.js:13` declares this action with
994
+ * `defaultKeys: "shift+tab"`, and `RESERVED_KEYBINDINGS_FOR_EXTENSION_CONFLICTS`
995
+ * in `dist/core/extensions/runner.js:9-26` lists it, which is what makes an
996
+ * extension's `shift+tab` registration die with "conflicts with built-in
997
+ * shortcut. Skipping."
998
+ */
999
+ const PI_THINKING_CYCLE_ACTION = "app.thinking.cycle";
1000
+ /** The key `shift+tab` moves to when plan mode claims it. */
1001
+ const PI_THINKING_CYCLE_REBIND = "ctrl+shift+t";
1002
+ /**
1003
+ * Build the per-launch `keybindings.json` that frees `shift+tab` for plan mode.
1004
+ *
1005
+ * Claude Code binds `shift+tab` to its permission-mode ring, and the whole point
1006
+ * of this file is that a user arriving from Claude Code presses the same key
1007
+ * here. Pi routes the key to `app.thinking.cycle` and *reserves* it against
1008
+ * extension overrides, so an extension cannot claim it — but
1009
+ * `buildBuiltinKeybindings` skips every action whose configured value is an
1010
+ * empty list (`runner.js:31-49`), which leaves the key unbound and free for an
1011
+ * extension registration to take.
1012
+ *
1013
+ * The action is MOVED rather than emptied. Emptying was the first cut and it
1014
+ * costs a working pi binding for a plan-mode toggle that `/plan` already
1015
+ * provides; moving it keeps thinking-level cycling reachable. `ctrl+shift+t`
1016
+ * is free in pi's own table (`keybindings.js`) and among every shortcut the
1017
+ * bundled packages register (verified: ctrl+shift+o/e/r, ctrl+., alt+t).
1018
+ *
1019
+ * Only this one action is touched. Every other pi default is left to pi, so
1020
+ * this file cannot silently re-map a binding the user relies on. A user's own
1021
+ * `keybindings.json` is merged UNDER it, matching how `settings.json` is
1022
+ * layered — with one refinement in `mergePiKeybindingsSettings`: a user who
1023
+ * already moved thinking-cycle off `shift+tab` keeps their key, because the
1024
+ * invariant this file enforces is "shift+tab is unbound", not "our value wins".
1025
+ */
1026
+ function buildPiKeybindingsJson() {
1027
+ return { [PI_THINKING_CYCLE_ACTION]: [PI_THINKING_CYCLE_REBIND] };
1028
+ }
1029
+ /** Does this configured binding still claim `shift+tab`? */
1030
+ function boundToShiftTab(value) {
1031
+ return (Array.isArray(value) ? value : [value]).some((k) => typeof k === "string" && k.trim().toLowerCase() === "shift+tab");
1032
+ }
1033
+ /**
1034
+ * Lay our freed key over a snapshotted user `keybindings.json`.
1035
+ *
1036
+ * The invariant is "`shift+tab` is unbound", not "our value wins". So the
1037
+ * built value is applied only when the user's file still routes `shift+tab`
1038
+ * through `app.thinking.cycle` (absent counts as still-bound: that is the pi
1039
+ * default). A user who already moved it elsewhere — `F2`, `ctrl+shift+t`,
1040
+ * anything without `shift+tab` — keeps their binding, and the key is free
1041
+ * either way. Forcing our value there would silently undo a preference with no
1042
+ * gain to plan mode.
1043
+ *
1044
+ * Every other user binding survives untouched. Non-object input (corrupt JSON
1045
+ * parsed to a string, or an array) is discarded rather than spread, so a broken
1046
+ * file cannot plant junk keys in the launch mirror.
1047
+ */
1048
+ function mergePiKeybindingsSettings(userKeybindings, built) {
1049
+ const merged = { ...userKeybindings && typeof userKeybindings === "object" && !Array.isArray(userKeybindings) ? userKeybindings : {} };
1050
+ for (const [action, keys] of Object.entries(built)) if (!(action in merged) || boundToShiftTab(merged[action])) merged[action] = keys;
1051
+ return merged;
1052
+ }
1053
+ /**
971
1054
  * Build the per-launch `settings.json`. Additive over the snapshotted
972
1055
  * user settings (the launcher merges lists it owns): narrow model
973
1056
  * scope, fixed thinking, limited toolset, derived compaction, and the
@@ -1268,7 +1351,8 @@ function buildPiAppendSystem(profileId, opts = {}) {
1268
1351
  const lines = [
1269
1352
  `# gh-router ${profileId} mode`,
1270
1353
  "",
1271
- `- Lead owns planning directly; there is no Plan subagent.`
1354
+ `- Lead owns planning directly; there is no Plan subagent.`,
1355
+ PI_TOOL_PREFERENCE_LINE
1272
1356
  ];
1273
1357
  if (peers) {
1274
1358
  const oracle = piOracleEnabled(profileId);
@@ -1283,8 +1367,7 @@ function buildPiAppendSystem(profileId, opts = {}) {
1283
1367
  lines.push("", `(${PI_MIN_VERSION_NOTE})`, "");
1284
1368
  return lines.join("\n");
1285
1369
  }
1286
- //#endregion
1287
- //#region src/lib/pi-plan-mode.ts
1370
+ // src/lib/pi-plan-mode.ts
1288
1371
  /**
1289
1372
  * Strip markdown noise from one step's text.
1290
1373
  *
@@ -1412,16 +1495,82 @@ const PLAN_BLOCKED_TOOLS = Object.freeze([
1412
1495
  "apply_patch"
1413
1496
  ]);
1414
1497
  /**
1415
- * The plan file, relative to the workspace.
1498
+ * The plan file for ONE session, relative to the workspace.
1499
+ *
1500
+ * A fixed path was the original design and it does not survive parallel use.
1501
+ * Two sessions in the same repo both passed the path gate — the gate compares a
1502
+ * resolved path against this value and has no notion of ownership — so the
1503
+ * second plan silently replaced the first, and an `edit` written against the
1504
+ * old text failed with a message about fuzzy matching instead of naming the
1505
+ * collision. The rest of plan mode was already per-session: the mode flag, the
1506
+ * steps and the execution flag live in a `PLAN_MODE_ENTRY` in each session's
1507
+ * own transcript. The file was the last piece of shared mutable state.
1508
+ *
1509
+ * The Claude front-end already does this — its artifact hook reads
1510
+ * `tool_input.planFilePath` "per-session; never the globally-newest file in the
1511
+ * shared plans dir" (`src/internal-artifact-open.ts`). This is the same
1512
+ * contract, with the name derived rather than model-chosen:
1416
1513
  *
1417
- * Claude Code pins one path per session and tells the model "this is the only
1418
- * file you are allowed to edit". Ours is the repository's existing convention
1419
- * (`.github-router/plans/<slug>/plan.md`, the same artifact `/gh-plan` writes and
1420
- * `/gh-implement` reads), with a stable slug so a resumed session keeps editing
1421
- * the plan it started rather than opening a second one.
1514
+ * - **Derived, not chosen.** A generated three-word name would have to survive
1515
+ * the model restating it, and a resumed session that picked a different name
1516
+ * would fork the plan. A session id is unforgeable and resume-stable for
1517
+ * free, and it keeps the gate an exact-path comparison.
1518
+ * - **Full id, not a hash or a prefix.** The id already appears in the
1519
+ * transcript filename, so a plan directory traces back to the session that
1520
+ * wrote it. UUIDv7 is time-ordered at the front, so a prefix would collide
1521
+ * for launches in the same millisecond.
1522
+ * - **One `<slug>` segment**, so the repository's existing convention
1523
+ * (`.github-router/plans/<slug>/plan.md`, what `/gh-plan` writes and
1524
+ * `/gh-implement` reads, `.complete` beside it) still describes the shape.
1525
+ *
1526
+ * Sanitized to `[A-Za-z0-9._-]` as belt-and-braces: the id is host-generated,
1527
+ * but sanitizing also makes traversal structurally impossible — path separators
1528
+ * cannot survive, and a segment that is entirely dots is unreachable anyway
1529
+ * because every one of these starts with `pi-plan-`.
1530
+ *
1531
+ * Sanitizing is LOSSY, and lossy is a collision. pi's own id validator
1532
+ * (`assertValidSessionId`) admits `.`, so `a.b` and `a-b` are both legal ids,
1533
+ * and `--session-id` lets an operator pick either; mapping one onto the other
1534
+ * would reinstate, for that pair, the very bug this function exists to prevent.
1535
+ * Dots are therefore KEPT (they are inert inside a prefixed segment). Anything
1536
+ * that still had to be ALTERED — a character dropped, or the length cap hit —
1537
+ * carries a digest of its original bytes instead of silently merging with its
1538
+ * neighbours. Generated UUIDv7 ids are `[0-9a-f-]` and are untouched, so the
1539
+ * readable form that traces to the transcript filename stays the common case.
1540
+ * FNV-1a rather than a cryptographic digest because this has to survive being
1541
+ * inlined into the emitted extension (a `toString()` copy cannot import
1542
+ * `node:crypto`), and telling two host-generated ids apart does not need
1543
+ * resistance to an attacker who could pick the path outright.
1544
+ *
1545
+ * Emitted via `.toString()`, so this body carries no module-scope references —
1546
+ * the layout strings are inline for that reason, not by preference, and the
1547
+ * digest is hand-rolled because `node:crypto` is not importable there.
1422
1548
  */
1423
- function planFilePath() {
1424
- return ".github-router/plans/pi-plan/plan.md";
1549
+ function planFilePathForSession(sessionId) {
1550
+ const raw = typeof sessionId === "string" ? sessionId.trim() : "";
1551
+ let slug = "";
1552
+ let altered = false;
1553
+ for (const ch of raw) if (/[A-Za-z0-9._-]/.test(ch)) slug += ch;
1554
+ else {
1555
+ altered = true;
1556
+ if (slug.length > 0 && !slug.endsWith("-")) slug += "-";
1557
+ }
1558
+ slug = slug.replace(/^[.-]+|[.-]+$/g, "");
1559
+ if (slug.length > 96) {
1560
+ slug = slug.slice(0, 96).replace(/[.-]+$/g, "");
1561
+ altered = true;
1562
+ }
1563
+ if (slug !== raw) altered = true;
1564
+ if (!slug) return ".github-router/plans/pi-plan/plan.md";
1565
+ if (altered) {
1566
+ let hash = 2166136261;
1567
+ for (let i = 0; i < raw.length; i++) {
1568
+ hash ^= raw.charCodeAt(i);
1569
+ hash = Math.imul(hash, 16777619) >>> 0;
1570
+ }
1571
+ slug += "-" + hash.toString(16).padStart(8, "0");
1572
+ }
1573
+ return ".github-router/plans/pi-plan-" + slug + "/plan.md";
1425
1574
  }
1426
1575
  /** Session entry type for persisting plan state across resume. */
1427
1576
  const PLAN_MODE_ENTRY = "gh-router-plan-mode";
@@ -1447,9 +1596,10 @@ const PLAN_LIST_TYPE = "gh-router-plan-list";
1447
1596
  * module have different allowed specifiers), so it carries its own tiny
1448
1597
  * resolver: POSIX normalisation plus a Windows drive/UNC guard. It is not a
1449
1598
  * general path library — it only has to agree with itself between the
1450
- * comparison here and the value `planFilePath()` produces, which is why the
1451
- * relative plan path is a PARAMETER: a `toString()`-serialized function cannot
1452
- * see module scope, and a captured constant would be `undefined` at runtime.
1599
+ * comparison here and the value `planFilePathForSession()` produces, which is
1600
+ * why the relative plan path is a PARAMETER: a `toString()`-serialized function
1601
+ * cannot see module scope, and a captured constant would be `undefined` at
1602
+ * runtime.
1453
1603
  */
1454
1604
  function isPlanFilePath(cwd, target, rel) {
1455
1605
  const raw = typeof target === "string" ? target.trim() : "";
@@ -1485,7 +1635,9 @@ function isPlanFilePath(cwd, target, rel) {
1485
1635
  function buildPiPlanModeSection() {
1486
1636
  return [
1487
1637
  ` // ---- plan mode: Claude-Code-style planning (always on) ----`,
1488
- ` // /plan or Ctrl+Alt+P toggles it. The tool set is NEVER touched: it used to`,
1638
+ ` // /plan, Shift+Tab (freed: the mirror's keybindings.json moves thinking-`,
1639
+ ` // level cycling to Ctrl+Shift+T) or Ctrl+Alt+P (the fallback on a host`,
1640
+ ` // without that file) toggles it. The tool set is NEVER touched: it used to`,
1489
1641
  ` // be snapshotted on entry and restored on exit, and removing the writers from`,
1490
1642
  ` // it made the path gate below unreachable (pi answers "Tool write not found"`,
1491
1643
  ` // before any handler runs), plus a restored snapshot could widen the roster a`,
@@ -1502,7 +1654,7 @@ function buildPiPlanModeSection() {
1502
1654
  ` const PLAN_DONE_TYPE = ${JSON.stringify(PLAN_DONE_TYPE)};`,
1503
1655
  ` const PLAN_LIST_TYPE = ${JSON.stringify(PLAN_LIST_TYPE)};`,
1504
1656
  ` const PLAN_BLOCKED = new Set(${JSON.stringify([...PLAN_BLOCKED_TOOLS])});`,
1505
- ` const PLAN_FILE_REL = ${JSON.stringify(planFilePath())};`,
1657
+ ` const planFilePathForSession = (${planFilePathForSession.toString()});`,
1506
1658
  ` const isPlanFilePath = (${isPlanFilePath.toString()});`,
1507
1659
  ` const cleanPlanStepText = (${cleanPlanStepText.toString()});`,
1508
1660
  ` const extractPlanSteps = (${extractPlanSteps.toString()});`,
@@ -1514,12 +1666,38 @@ function buildPiPlanModeSection() {
1514
1666
  ` let planExecuting = false;`,
1515
1667
  ` let planSteps = [];`,
1516
1668
  ` let planCwd = "";`,
1669
+ ` // The plan file, resolved from THIS session's id and cached for the run.`,
1670
+ ` // A fixed path was the original design and it does not survive parallel`,
1671
+ ` // use: two sessions in one repo both cleared the gate, so the second plan`,
1672
+ ` // silently replaced the first. Resolving from the session id gives each`,
1673
+ ` // session its own file with no lock and no coordination, and because the`,
1674
+ ` // id is stable across resume the same session keeps editing the same file.`,
1675
+ ` // Cached, then re-resolved on every session_start: the derive is cheap but`,
1676
+ ` // it must run once per (possibly changing) session, not once per gate hit.`,
1677
+ ` let planRel = "";`,
1517
1678
  ` // Set while the "what next?" prompt is open. agent_end can fire again for`,
1518
1679
  ` // the same plan (a queued follow-up run ends too), and a second prompt on`,
1519
1680
  ` // top of the first would let two Execute answers each send an execution`,
1520
1681
  ` // kick, resetting progress and paying for a redundant turn.`,
1521
1682
  ` let planPromptOpen = false;`,
1522
1683
  ``,
1684
+ ` // Resolve (once per session) the ONE file this session may write. Every`,
1685
+ ` // read site goes through here so the notify, the status line, the brief`,
1686
+ ` // and the gate can never disagree about the path.`,
1687
+ ` function planRelFor(ctx) {`,
1688
+ ` if (planRel) return planRel;`,
1689
+ ` let id = "";`,
1690
+ ` try {`,
1691
+ ` const sm = ctx && ctx.sessionManager;`,
1692
+ ` if (sm && typeof sm.getSessionId === "function") id = sm.getSessionId();`,
1693
+ ` } catch {}`,
1694
+ ` // No second fallback here: planFilePathForSession ALWAYS returns a usable`,
1695
+ ` // path (an unusable id becomes the shared fallback inside it), so a`,
1696
+ ` // "|| fallback" would be dead code that reads like a live guard.`,
1697
+ ` planRel = planFilePathForSession(id);`,
1698
+ ` return planRel;`,
1699
+ ` }`,
1700
+ ``,
1523
1701
  ` function planPaint(ctx, text, color) {`,
1524
1702
  ` try {`,
1525
1703
  ` const theme = ctx && ctx.ui && ctx.ui.theme;`,
@@ -1582,7 +1760,7 @@ function buildPiPlanModeSection() {
1582
1760
  ` planPromptOpen = false;`,
1583
1761
  ` planSteps = [];`,
1584
1762
  ` try { if (ctx && typeof ctx.cwd === "string" && ctx.cwd) planCwd = ctx.cwd; } catch {}`,
1585
- ` try { ctx.ui.notify("Plan mode on: writes refused except " + PLAN_FILE_REL + ". Investigate, then write the plan there. Ctrl+Alt+P or /plan to leave.", "info"); } catch {}`,
1763
+ ` try { ctx.ui.notify("Plan mode on: writes refused except " + planRelFor(ctx) + ". Investigate, then write the plan there. Shift+Tab (or /plan) to leave.", "info"); } catch {}`,
1586
1764
  ` planUpdateUi(ctx);`,
1587
1765
  ` planPersist();`,
1588
1766
  ` }`,
@@ -1610,12 +1788,26 @@ function buildPiPlanModeSection() {
1610
1788
  ` });`,
1611
1789
  ` } catch {}`,
1612
1790
  ` try {`,
1791
+ ` // Claude Code's plan-mode key. Pi binds app.thinking.cycle to shift+tab`,
1792
+ ` // and reserves it against extension overrides, so the launcher moves that`,
1793
+ ` // action off shift+tab in the mirror's keybindings.json — this`,
1794
+ ` // registration takes the freed key. Registering anyway is safe when the`,
1795
+ ` // key is still bound: pi drops the extension shortcut with a diagnostic`,
1796
+ ` // instead of throwing, which is the honest failure mode.`,
1797
+ ` pi.registerShortcut("shift+tab", {`,
1798
+ ` description: "Toggle plan mode",`,
1799
+ ` handler: async (ctx) => { planToggle(ctx); },`,
1800
+ ` });`,
1801
+ ` } catch {}`,
1802
+ ` try {`,
1613
1803
  ` // Literal KeyId rather than Key.ctrlAlt("p"): the generated source then`,
1614
1804
  ` // needs no pi-tui import at all, which keeps it loadable on every build`,
1615
1805
  ` // whose host-provided specifier list is smaller than today's. The value`,
1616
1806
  ` // is exactly what Key.ctrlAlt("p") returns (pi-tui keys.js:118).`,
1807
+ ` // Kept as the fallback for a host whose keybindings.json we did not`,
1808
+ ` // write (older launcher, hand-run pi against this extension).`,
1617
1809
  ` pi.registerShortcut("ctrl+alt+p", {`,
1618
- ` description: "Toggle plan mode",`,
1810
+ ` description: "Toggle plan mode (alternate)",`,
1619
1811
  ` handler: async (ctx) => { planToggle(ctx); },`,
1620
1812
  ` });`,
1621
1813
  ` } catch {}`,
@@ -1624,7 +1816,7 @@ function buildPiPlanModeSection() {
1624
1816
  ` description: "Show plan mode state and the current step list",`,
1625
1817
  ` handler: async (_args, ctx) => {`,
1626
1818
  ` if (!planEnabled && !planExecuting && planSteps.length === 0) {`,
1627
- ` try { ctx.ui.notify("Plan mode is off. /plan (or Ctrl+Alt+P) to start planning.", "info"); } catch {}`,
1819
+ ` try { ctx.ui.notify("Plan mode is off. /plan (or Shift+Tab) to start planning.", "info"); } catch {}`,
1628
1820
  ` return;`,
1629
1821
  ` }`,
1630
1822
  ` const done = planSteps.filter((s) => s.completed).length;`,
@@ -1632,7 +1824,9 @@ function buildPiPlanModeSection() {
1632
1824
  ` ? "No steps parsed yet. Ask for a numbered Plan: block."`,
1633
1825
  ` : planSteps.map((s) => (s.completed ? "\\u2713 " : "\\u25CB ") + s.step + ". " + s.text).join("\\n");`,
1634
1826
  ` const head = planExecuting ? "Executing plan (" + done + "/" + planSteps.length + ")" : "Plan mode active";`,
1635
- ` try { ctx.ui.notify(head + "\\n" + body, "info"); } catch {}`,
1827
+ ` // Name THIS session's file: with a per-session path, "the plan file"`,
1828
+ ` // is no longer a single answer, and the human needs the real one.`,
1829
+ ` try { ctx.ui.notify(head + "\\n" + planRelFor(ctx) + "\\n" + body, "info"); } catch {}`,
1636
1830
  ` },`,
1637
1831
  ` });`,
1638
1832
  ` } catch {}`,
@@ -1653,10 +1847,11 @@ function buildPiPlanModeSection() {
1653
1847
  ` try { if (ctx && typeof ctx.cwd === "string" && ctx.cwd) planCwd = ctx.cwd; } catch {}`,
1654
1848
  ` const input = (event.input || {});`,
1655
1849
  ` const target = input.path !== undefined ? input.path : input.file_path;`,
1656
- ` if (isPlanFilePath(planCwd, target, PLAN_FILE_REL)) return undefined;`,
1850
+ ` const planFileRel = planRelFor(ctx);`,
1851
+ ` if (isPlanFilePath(planCwd, target, planFileRel)) return undefined;`,
1657
1852
  ` return {`,
1658
1853
  ` block: true,`,
1659
- ` reason: "Plan mode: this write is refused. The only file you may write is " + PLAN_FILE_REL + " (pass exactly that path). Record the plan there, or leave plan mode (/plan or Ctrl+Alt+P) to change code.",`,
1854
+ ` reason: "Plan mode: this write is refused. The only file you may write is " + planFileRel + " (pass exactly that path). Record the plan there, or leave plan mode (/plan or Shift+Tab) to change code.",`,
1660
1855
  ` };`,
1661
1856
  ` });`,
1662
1857
  ` } catch {}`,
@@ -1722,46 +1917,56 @@ function buildPiPlanModeSection() {
1722
1917
  ` // only write. The workflow is Claude's five phases compressed to what Pi`,
1723
1918
  ` // has: Explore/General-Purpose subagents exist, but the roster is`,
1724
1919
  ` // profile-dependent, so the phase text names the intent, not an agent.`,
1725
- ` const PLAN_BRIEF = [`,
1726
- ` "[PLAN MODE ACTIVE]",`,
1727
- ` "",`,
1728
- ` "Plan mode is active. The user does not want you to execute yet -- you must not edit files,",`,
1729
- ` "run a command that changes the code, or otherwise act on the plan. This supersedes any other",`,
1730
- ` "instruction you have received about doing the work now.",`,
1731
- ` "",`,
1732
- ` "One exception, and it is the whole of it: you may write your plan to",`,
1733
- ` " " + PLAN_FILE_REL,`,
1734
- ` "Edit and write are refused for every other path. Read, search, and run read-only commands",`,
1735
- ` "freely -- explore enough that the plan is grounded in what the code actually does.",`,
1736
- ` "",`,
1737
- ` "Work the plan like this:",`,
1738
- ` "1. Understand the request, and look for what already exists (functions, utilities, patterns)",`,
1739
- ` " before proposing anything new. Delegate broad or parallel discovery when that is faster",`,
1740
- ` " than reading serially yourself.",`,
1741
- ` "2. Ask the user whatever you cannot settle from the code. Do it once, up front, and never",`,
1742
- ` " ask what exploration could answer.",`,
1743
- ` "3. Design the approach far enough that an implementer would have no open decisions left:",`,
1744
- ` " which files, what changes in each, what each change is done when, and what would prove it.",`,
1745
- ` "4. Write the plan to the plan file: a short Context section, the recommended approach only,",`,
1746
- ` " the critical files, the verification steps, and any residual risk. Keep it scannable.",`,
1747
- ` "5. Summarise the plan in your reply too, so the user can answer without opening the file,",`,
1748
- ` " finishing with a numbered list of the steps -- that list becomes the checklist.",`,
1749
- ` "",`,
1750
- ` "Do NOT open an ask_user question or a prose prompt for plan approval. Leaving plan mode is",`,
1751
- ` "the user's action (/plan or Ctrl+Alt+P) -- asking permission to stop planning is the one",`,
1752
- ` "question this mode does not want, and approval you grant yourself is not approval.",`,
1753
- ` "If the user asks for changes, revise the SAME plan file rather than writing a second one.",`,
1754
- ` "The test for every other action: if it would reasonably be described as DOING the work",`,
1755
- ` "rather than planning it, it waits until plan mode is off.",`,
1756
- ` ].join("\\n");`,
1920
+ ` // Built per resolved path rather than as a module constant: the plan file`,
1921
+ ` // is per-session now, so a constant would name the wrong file for every`,
1922
+ ` // session but one. Called once per session (the result is cached on the`,
1923
+ ` // resolved path), not once per turn.`,
1924
+ ` let planBriefCache = { rel: "", text: "" };`,
1925
+ ` function planBriefFor(rel) {`,
1926
+ ` if (planBriefCache.rel === rel) return planBriefCache.text;`,
1927
+ ` const planBriefLines = [`,
1928
+ ` "[PLAN MODE ACTIVE]",`,
1929
+ ` "",`,
1930
+ ` "Plan mode is active. The user does not want you to execute yet -- you must not edit files,",`,
1931
+ ` "run a command that changes the code, or otherwise act on the plan. This supersedes any other",`,
1932
+ ` "instruction you have received about doing the work now.",`,
1933
+ ` "",`,
1934
+ ` "One exception, and it is the whole of it: you may write your plan to",`,
1935
+ ` " " + rel,`,
1936
+ ` "Edit and write are refused for every other path. Read, search, and run read-only commands",`,
1937
+ ` "freely -- explore enough that the plan is grounded in what the code actually does.",`,
1938
+ ` "",`,
1939
+ ` "Work the plan like this:",`,
1940
+ ` "1. Understand the request, and look for what already exists (functions, utilities, patterns)",`,
1941
+ ` " before proposing anything new. Delegate broad or parallel discovery when that is faster",`,
1942
+ ` " than reading serially yourself.",`,
1943
+ ` "2. Ask the user whatever you cannot settle from the code. Do it once, up front, and never",`,
1944
+ ` " ask what exploration could answer.",`,
1945
+ ` "3. Design the approach far enough that an implementer would have no open decisions left:",`,
1946
+ ` " which files, what changes in each, what each change is done when, and what would prove it.",`,
1947
+ ` "4. Write the plan to the plan file: a short Context section, the recommended approach only,",`,
1948
+ ` " the critical files, the verification steps, and any residual risk. Keep it scannable.",`,
1949
+ ` "5. Summarise the plan in your reply too, so the user can answer without opening the file,",`,
1950
+ ` " finishing with a numbered list of the steps -- that list becomes the checklist.",`,
1951
+ ` "",`,
1952
+ ` "Do NOT open an ask_user question or a prose prompt for plan approval. Leaving plan mode is",`,
1953
+ ` "the user's action (/plan or Shift+Tab) -- asking permission to stop planning is the one",`,
1954
+ ` "question this mode does not want, and approval you grant yourself is not approval.",`,
1955
+ ` "If the user asks for changes, revise this one plan file in place rather than writing a second plan.",`,
1956
+ ` "The test for every other action: if it would reasonably be described as DOING the work",`,
1957
+ ` "rather than planning it, it waits until plan mode is off.",`,
1958
+ ` ].join("\\n");`,
1959
+ ` planBriefCache = { rel: rel, text: planBriefLines };`,
1960
+ ` return planBriefLines;`,
1961
+ ` }`,
1757
1962
  ``,
1758
1963
  ` // Cost contract: inject NOTHING unless plan mode is actually engaged, and`,
1759
1964
  ` // only for a real user turn (a background notification must not re-add it).`,
1760
1965
  ` try {`,
1761
- ` pi.on("before_agent_start", async (event) => {`,
1966
+ ` pi.on("before_agent_start", async (event, ctx) => {`,
1762
1967
  ` if (!event || event.messageType !== "user") return undefined;`,
1763
1968
  ` if (planEnabled) {`,
1764
- ` return { message: { customType: PLAN_CONTEXT_TYPE, content: PLAN_BRIEF, display: false } };`,
1969
+ ` return { message: { customType: PLAN_CONTEXT_TYPE, content: planBriefFor(planRelFor(ctx)), display: false } };`,
1765
1970
  ` }`,
1766
1971
  ` if (planExecuting && planSteps.length > 0) {`,
1767
1972
  ` const remaining = planSteps.filter((s) => !s.completed).map((s) => s.step + ". " + s.text).join("\\n");`,
@@ -1852,7 +2057,7 @@ function buildPiPlanModeSection() {
1852
2057
  ` planPromptOpen = false;`,
1853
2058
  ` if (!choice) return;`,
1854
2059
  ` // The user may have left plan mode while the prompt was open (slash`,
1855
- ` // /plan, Ctrl+Alt+P, /new). Honouring Execute there would silently`,
2060
+ ` // /plan, Shift+Tab, /new). Honouring Execute there would silently`,
1856
2061
  ` // re-enter a mode they just exited.`,
1857
2062
  ` if (!planEnabled) return;`,
1858
2063
  ` if (String(choice).indexOf("Execute") === 0) {`,
@@ -1886,6 +2091,11 @@ function buildPiPlanModeSection() {
1886
2091
  ` pi.on("session_start", async (_event, ctx) => {`,
1887
2092
  ` try {`,
1888
2093
  ` if (ctx && typeof ctx.cwd === "string" && ctx.cwd) planCwd = ctx.cwd;`,
2094
+ ` // Re-resolve the plan file for THIS session. The id is stable across`,
2095
+ ` // resume, so a resumed session lands back on the file it started; a`,
2096
+ ` // fork or a new session gets its own, which is the whole point.`,
2097
+ ` planRel = "";`,
2098
+ ` planRelFor(ctx);`,
1889
2099
  ` const entries = ctx.sessionManager && typeof ctx.sessionManager.getEntries === "function"`,
1890
2100
  ` ? ctx.sessionManager.getEntries()`,
1891
2101
  ` : [];`,
@@ -1918,8 +2128,7 @@ function buildPiPlanModeSection() {
1918
2128
  ``
1919
2129
  ];
1920
2130
  }
1921
- //#endregion
1922
- //#region src/lib/pi-extension.ts
2131
+ // src/lib/pi-extension.ts
1923
2132
  /**
1924
2133
  * The gh-router Pi extension source, generated per launch into the
1925
2134
  * isolated mirror (`extensions/gh-router-pi/index.ts`).
@@ -2524,8 +2733,7 @@ function buildPiPrompts(opts) {
2524
2733
  });
2525
2734
  return prompts;
2526
2735
  }
2527
- //#endregion
2528
- //#region src/lib/pi-mcp-config.ts
2736
+ // src/lib/pi-mcp-config.ts
2529
2737
  /**
2530
2738
  * Pi's MCP surface for the router's scoped groups.
2531
2739
  *
@@ -2816,8 +3024,7 @@ async function findShadowedKeys(workspace, keys) {
2816
3024
  }
2817
3025
  return found;
2818
3026
  }
2819
- //#endregion
2820
- //#region src/pi.ts
3027
+ // src/pi.ts
2821
3028
  const piArgs = {
2822
3029
  ...sharedServerArgs,
2823
3030
  model: {
@@ -3109,6 +3316,16 @@ const pi = defineCommand({
3109
3316
  ...cosmeticOverrides,
3110
3317
  ...mergedSubagents ? { subagents: mergedSubagents } : {}
3111
3318
  });
3319
+ const keybindingsPath = path.join(mirror, "keybindings.json");
3320
+ let userKeybindings = {};
3321
+ try {
3322
+ const raw = await fs$1.readFile(keybindingsPath, "utf8");
3323
+ const parsedKeybindings = JSON.parse(raw);
3324
+ if (parsedKeybindings && typeof parsedKeybindings === "object") userKeybindings = parsedKeybindings;
3325
+ } catch {
3326
+ userKeybindings = {};
3327
+ }
3328
+ await writeJsonFile(keybindingsPath, { ...mergePiKeybindingsSettings(userKeybindings, buildPiKeybindingsJson()) });
3112
3329
  packagesForCache = [...builtSettings.packages];
3113
3330
  if (await seedPiPackageCache(mirror, packagesForCache)) consola.debug("Pi package cache hit: mirror pre-seeded, skipping registry install.");
3114
3331
  const bridgeDisabled = args["memory-bridge"] === false || process$1.env.GH_ROUTER_PI_BRIDGE === "0" || process$1.env.GH_ROUTER_DISABLE_PI_BRIDGE === "1";
@@ -3117,7 +3334,7 @@ const pi = defineCommand({
3117
3334
  if (!bridgeDisabled) {
3118
3335
  const passthrough = collectPiPassthroughArgs(rawArgs, piArgs);
3119
3336
  if (!(passthrough.includes("--no-context-files") || passthrough.includes("-nc"))) try {
3120
- const { collectBridgeInputs } = await import("./pi-memory-bridge-DEU1SUDz.js");
3337
+ const { collectBridgeInputs } = await import("./pi-memory-bridge-Dvj1T3e3.js");
3121
3338
  const collected = await collectBridgeInputs(process$1.cwd());
3122
3339
  bridgeStats = {
3123
3340
  staticFiles: collected.copilotInstructions.length + collected.unscopedRules.length + collected.userGlobal.length,
@@ -3168,7 +3385,7 @@ const pi = defineCommand({
3168
3385
  try {
3169
3386
  const collected = globalThis.__ghRouterBridgeCollected;
3170
3387
  if (collected) {
3171
- const { buildMirrorBridgeSection, mergeBridgeIntoAgentsMd } = await import("./pi-memory-bridge-DEU1SUDz.js");
3388
+ const { buildMirrorBridgeSection, mergeBridgeIntoAgentsMd } = await import("./pi-memory-bridge-Dvj1T3e3.js");
3172
3389
  const { section } = buildMirrorBridgeSection(collected, { repoRoot: process$1.cwd() });
3173
3390
  const agentsPath = path.join(mirror, "AGENTS.md");
3174
3391
  let existing;
@@ -3249,8 +3466,8 @@ const pi = defineCommand({
3249
3466
  serverUrl
3250
3467
  })}\n`);
3251
3468
  if (sweEnabled && !peersEnabled) process$1.stderr.write("Note: --swe without --peers emits no delegate/review skills or prompts (no agents behind them in a peerless launch).\n");
3252
- const { disposeBluebirdClients } = await import("./bluebird-client-CY6NBHQu.js");
3253
- const { disposeAdoClients } = await import("./ado-tools-CAtopk36.js");
3469
+ const { disposeBluebirdClients } = await import("./bluebird-client-BvoMTmEv.js");
3470
+ const { disposeAdoClients } = await import("./ado-tools-BOW1k1KW.js");
3254
3471
  launchChild({
3255
3472
  kind: "pi",
3256
3473
  envVars: {
@@ -3285,7 +3502,6 @@ const pi = defineCommand({
3285
3502
  });
3286
3503
  }
3287
3504
  });
3288
- //#endregion
3289
3505
  export { pi };
3290
3506
 
3291
- //# sourceMappingURL=pi-IYAvKF50.js.map
3507
+ //# sourceMappingURL=pi-DI2QtaiZ.js.map