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.
- package/dist/ado-tools-BOW1k1KW.js +1 -0
- package/dist/{aic-ledger-Cp7Yk9-Q.js → aic-ledger-CeSXqTEE.js} +5 -7
- package/dist/{aic-ledger-Cp7Yk9-Q.js.map → aic-ledger-CeSXqTEE.js.map} +1 -1
- package/dist/{aic-statusline-settings-B5EMMSFC.js → aic-statusline-settings-BKveu679.js} +3 -4
- package/dist/{aic-statusline-settings-B5EMMSFC.js.map → aic-statusline-settings-BKveu679.js.map} +1 -1
- package/dist/{attribution-settings-HI_5bN_-.js → attribution-settings-BLTnz2_A.js} +33 -53
- package/dist/{attribution-settings-HI_5bN_-.js.map → attribution-settings-BLTnz2_A.js.map} +1 -1
- package/dist/{auth-B1egtvt4.js → auth-BZHpTtfF.js} +5 -6
- package/dist/{auth-B1egtvt4.js.map → auth-BZHpTtfF.js.map} +1 -1
- package/dist/{balanced-profile-contract-Dm_usmw7.js → balanced-profile-contract-B6pSoWjm.js} +2 -3
- package/dist/{balanced-profile-contract-Dm_usmw7.js.map → balanced-profile-contract-B6pSoWjm.js.map} +1 -1
- package/dist/{bluebird-client-ByCRusGQ.js → bluebird-client-BasIdv5J.js} +8 -12
- package/dist/{bluebird-client-ByCRusGQ.js.map → bluebird-client-BasIdv5J.js.map} +1 -1
- package/dist/{bluebird-client-CY6NBHQu.js → bluebird-client-BvoMTmEv.js} +1 -1
- package/dist/browser-bridge/index.js +84 -55
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{check-usage-T_z84Pgc.js → check-usage-BlIWDuV2.js} +5 -6
- package/dist/{check-usage-T_z84Pgc.js.map → check-usage-BlIWDuV2.js.map} +1 -1
- package/dist/{claude-BBSsqwln.js → claude-DSXrdz0v.js} +37 -43
- package/dist/{claude-BBSsqwln.js.map → claude-DSXrdz0v.js.map} +1 -1
- package/dist/{claude-md-injection-BMon6WUD.js → claude-md-injection-DU5KYXNc.js} +6 -7
- package/dist/{claude-md-injection-BMon6WUD.js.map → claude-md-injection-DU5KYXNc.js.map} +1 -1
- package/dist/{client-CQMfroGV.js → client-Bjp3XAMK.js} +3 -5
- package/dist/{client-CQMfroGV.js.map → client-Bjp3XAMK.js.map} +1 -1
- package/dist/{codex-PRWoBiOH.js → codex-DGMUk65v.js} +10 -11
- package/dist/{codex-PRWoBiOH.js.map → codex-DGMUk65v.js.map} +1 -1
- package/dist/{copilot-discount-T-cfWmc4.js → copilot-discount-CHNQLYDJ.js} +3 -4
- package/dist/{copilot-discount-T-cfWmc4.js.map → copilot-discount-CHNQLYDJ.js.map} +1 -1
- package/dist/{debug-DL2JsRqY.js → debug-1HUHCWFl.js} +3 -4
- package/dist/{debug-DL2JsRqY.js.map → debug-1HUHCWFl.js.map} +1 -1
- package/dist/engine-BC4TF4pt.js +1 -0
- package/dist/{exec-Bf8g_bIR.js → exec-BC0MAnoA.js} +2 -3
- package/dist/{exec-Bf8g_bIR.js.map → exec-BC0MAnoA.js.map} +1 -1
- package/dist/{fast-profile-contract-JOnZBgFB.js → fast-profile-contract-BLnKg0Ay.js} +2 -3
- package/dist/{fast-profile-contract-JOnZBgFB.js.map → fast-profile-contract-BLnKg0Ay.js.map} +1 -1
- package/dist/{gate-discovery-BNy8GKsC.js → gate-discovery-DiXu_olc.js} +8 -10
- package/dist/{gate-discovery-BNy8GKsC.js.map → gate-discovery-DiXu_olc.js.map} +1 -1
- package/dist/{get-copilot-usage-BSXeQEx8.js → get-copilot-usage-CKg42gSH.js} +5 -6
- package/dist/{get-copilot-usage-BSXeQEx8.js.map → get-copilot-usage-CKg42gSH.js.map} +1 -1
- package/dist/{hook-mcp-client-DERIkeR7.js → hook-mcp-client-CYx10nlU.js} +2 -3
- package/dist/hook-mcp-client-CYx10nlU.js.map +1 -0
- package/dist/hooks.mjs +1766 -1548
- package/dist/hooks.sha256 +1 -1
- package/dist/{index-cmd-CjRcmYk3.js → index-cmd-BPXhTfGQ.js} +8 -9
- package/dist/index-cmd-BPXhTfGQ.js.map +1 -0
- package/dist/{internal-aic-status-CY0QxSa7.js → internal-aic-status-FQB1DQzX.js} +6 -8
- package/dist/{internal-aic-status-CY0QxSa7.js.map → internal-aic-status-FQB1DQzX.js.map} +1 -1
- package/dist/{internal-artifact-open-NAGn9Mgt.js → internal-artifact-open-DbHjipxU.js} +5 -7
- package/dist/{internal-artifact-open-NAGn9Mgt.js.map → internal-artifact-open-DbHjipxU.js.map} +1 -1
- package/dist/{internal-fast-dispatch-guard-De_DJOyZ.js → internal-fast-dispatch-guard-DMzqs-r8.js} +1 -1
- package/dist/{internal-fast-dispatch-guard-_n-A8hgo.js → internal-fast-dispatch-guard-PDdlkPU3.js} +6 -8
- package/dist/{internal-fast-dispatch-guard-_n-A8hgo.js.map → internal-fast-dispatch-guard-PDdlkPU3.js.map} +1 -1
- package/dist/{internal-first-mate-guard-GufCUMl3.js → internal-first-mate-guard-4Yro9xNM.js} +5 -7
- package/dist/{internal-first-mate-guard-GufCUMl3.js.map → internal-first-mate-guard-4Yro9xNM.js.map} +1 -1
- package/dist/{internal-first-mate-guard-C8GwLbaX.js → internal-first-mate-guard-BxPDUsV3.js} +1 -1
- package/dist/{internal-max-dispatch-guard-4rh6KSd8.js → internal-max-dispatch-guard-D3L00YXj.js} +5 -7
- package/dist/{internal-max-dispatch-guard-4rh6KSd8.js.map → internal-max-dispatch-guard-D3L00YXj.js.map} +1 -1
- package/dist/{internal-max-dispatch-guard-CKnzgJje.js → internal-max-dispatch-guard-fhBX_w49.js} +1 -1
- package/dist/{internal-plan-review-ChFx8wTX.js → internal-plan-review-BfHLeszV.js} +6 -7
- package/dist/{internal-plan-review-ChFx8wTX.js.map → internal-plan-review-BfHLeszV.js.map} +1 -1
- package/dist/{internal-prompt-submit-BW5g3MjD.js → internal-prompt-submit-BbnaMF2R.js} +7 -8
- package/dist/{internal-prompt-submit-BW5g3MjD.js.map → internal-prompt-submit-BbnaMF2R.js.map} +1 -1
- package/dist/{internal-prompt-submit-C4uDwr7G.js → internal-prompt-submit-DKzCckz-.js} +2 -2
- package/dist/{internal-rebrief-DvBS8myn.js → internal-rebrief-aEvxp7jw.js} +7 -9
- package/dist/{internal-rebrief-DvBS8myn.js.map → internal-rebrief-aEvxp7jw.js.map} +1 -1
- package/dist/{internal-session-bind-dsUOcKxU.js → internal-session-bind-pN1V11Mn.js} +3 -4
- package/dist/{internal-session-bind-dsUOcKxU.js.map → internal-session-bind-pN1V11Mn.js.map} +1 -1
- package/dist/{internal-stop-hook-CXlOsW63.js → internal-stop-hook-VQuOYpUC.js} +9 -10
- package/dist/{internal-stop-hook-CXlOsW63.js.map → internal-stop-hook-VQuOYpUC.js.map} +1 -1
- package/dist/{internal-stop-review-D_KEV_04.js → internal-stop-review-BWp-4XWW.js} +4 -5
- package/dist/{internal-stop-review-D_KEV_04.js.map → internal-stop-review-BWp-4XWW.js.map} +1 -1
- package/dist/{internal-worker-guard-DB6shBIn.js → internal-worker-guard-C9OZPgzu.js} +3 -4
- package/dist/{internal-worker-guard-DB6shBIn.js.map → internal-worker-guard-C9OZPgzu.js.map} +1 -1
- package/dist/{internal-workspace-header-DBg5Y7oN.js → internal-workspace-header-B4TXFBLU.js} +3 -4
- package/dist/{internal-workspace-header-DBg5Y7oN.js.map → internal-workspace-header-B4TXFBLU.js.map} +1 -1
- package/dist/lib/tree-sitter-pool/{lifecycle-Dx0SnP7Z.js → lifecycle-BPpOigPZ.js} +1 -2
- package/dist/lib/tree-sitter-pool/{lifecycle-C7W8D2lx.js → lifecycle-C3vsqXjS.js} +1 -3
- package/dist/lib/tree-sitter-pool/worker.js +29 -35
- package/dist/lifecycle-BENRuuX6.js +1 -0
- package/dist/{lifecycle-K9oVtGde.mjs → lifecycle-DBKu1T5r.mjs} +0 -1
- package/dist/{lifecycle-Gge2Dadd.js → lifecycle-Dh9y8OF1.js} +3 -4
- package/dist/{lifecycle-Gge2Dadd.js.map → lifecycle-Dh9y8OF1.js.map} +1 -1
- package/dist/lifecycle-Dli9vGI2.js +1 -0
- package/dist/{lifecycle-9nX09dBl.js → lifecycle-vjHAFCaY.js} +4 -6
- package/dist/{lifecycle-9nX09dBl.js.map → lifecycle-vjHAFCaY.js.map} +1 -1
- package/dist/main.js +26 -27
- package/dist/{max-profile-contract-CRj7N211.js → max-profile-contract-DLLTsSs2.js} +5 -8
- package/dist/{max-profile-contract-CRj7N211.js.map → max-profile-contract-DLLTsSs2.js.map} +1 -1
- package/dist/{mcp-workspace-header-Xw9B1W6T.js → mcp-workspace-header-C5-dOWNa.js} +3 -4
- package/dist/{mcp-workspace-header-Xw9B1W6T.js.map → mcp-workspace-header-C5-dOWNa.js.map} +1 -1
- package/dist/{models-Ca-HQTYi.js → models-B6nH1sS6.js} +4 -5
- package/dist/{models-Ca-HQTYi.js.map → models-B6nH1sS6.js.map} +1 -1
- package/dist/{orchestration-D3-2ulhX.js → orchestration-B93jxrWI.js} +4 -5
- package/dist/{orchestration-D3-2ulhX.js.map → orchestration-B93jxrWI.js.map} +1 -1
- package/dist/{package-root-B-osctCk.js → package-root-BXgdIM3q.js} +2 -3
- package/dist/{package-root-B-osctCk.js.map → package-root-BXgdIM3q.js.map} +1 -1
- package/dist/paths-Be9_ujQ3.js +1 -0
- package/dist/{paths-C5477RGC.js → paths-CVEO8jEH.js} +5 -7
- package/dist/{paths-C5477RGC.js.map → paths-CVEO8jEH.js.map} +1 -1
- package/dist/{peer-mcp-personas-Dxxw5X1g.js → peer-mcp-personas-Cv21q_YR.js} +244 -372
- package/dist/peer-mcp-personas-Cv21q_YR.js.map +1 -0
- package/dist/{pi-IYAvKF50.js → pi-DI2QtaiZ.js} +305 -89
- package/dist/pi-DI2QtaiZ.js.map +1 -0
- package/dist/{pi-memory-bridge-DEU1SUDz.js → pi-memory-bridge-Dvj1T3e3.js} +2 -3
- package/dist/{pi-memory-bridge-DEU1SUDz.js.map → pi-memory-bridge-Dvj1T3e3.js.map} +1 -1
- package/dist/{plan-review-hook-C9K-em4D.js → plan-review-hook-MhjK92wq.js} +5 -6
- package/dist/{plan-review-hook-C9K-em4D.js.map → plan-review-hook-MhjK92wq.js.map} +1 -1
- package/dist/{provision-CIn6I4w_.js → provision-CRmtV6ew.js} +10 -14
- package/dist/{provision-CIn6I4w_.js.map → provision-CRmtV6ew.js.map} +1 -1
- package/dist/rolldown-runtime-D3PmRqjj.js +4 -0
- package/dist/{self-invocation-BtcGj-lY.js → self-invocation-DMUnXVGT.js} +5 -7
- package/dist/{self-invocation-BtcGj-lY.js.map → self-invocation-DMUnXVGT.js.map} +1 -1
- package/dist/{serve-CttHP8dJ.js → serve-DRASJ-ZO.js} +24 -30
- package/dist/{serve-CttHP8dJ.js.map → serve-DRASJ-ZO.js.map} +1 -1
- package/dist/{server-setup-D7XHUrhM.js → server-setup-DldGizZR.js} +67 -117
- package/dist/{server-setup-D7XHUrhM.js.map → server-setup-DldGizZR.js.map} +1 -1
- package/dist/{service-backend-B6D_DY1Z.js → service-backend-Ce6b2XEe.js} +146 -146
- package/dist/service-backend-Ce6b2XEe.js.map +1 -0
- package/dist/{start-XU5HwLd9.js → start-C0gngUPK.js} +6 -8
- package/dist/{start-XU5HwLd9.js.map → start-C0gngUPK.js.map} +1 -1
- package/dist/{state-DzsaGHr9.js → state-CCGDJ43X.js} +2 -3
- package/dist/{state-DzsaGHr9.js.map → state-CCGDJ43X.js.map} +1 -1
- package/dist/{static-context-pack-CsOAC87F.js → static-context-pack-DwC69_VA.js} +14 -24
- package/dist/{static-context-pack-CsOAC87F.js.map → static-context-pack-DwC69_VA.js.map} +1 -1
- package/dist/{stop-gate-hook-DnLC09Lg.js → stop-gate-hook-CBVLD8iB.js} +9 -14
- package/dist/{stop-gate-hook-DnLC09Lg.js.map → stop-gate-hook-CBVLD8iB.js.map} +1 -1
- package/dist/{stop-gate-policy-Dx9c98_d.js → stop-gate-policy-BehNiNix.js} +4 -5
- package/dist/{stop-gate-policy-Dx9c98_d.js.map → stop-gate-policy-BehNiNix.js.map} +1 -1
- package/dist/{token-Dqjs5ixP.js → token-CPzYxU4Y.js} +16 -28
- package/dist/{token-Dqjs5ixP.js.map → token-CPzYxU4Y.js.map} +1 -1
- package/dist/{token-CVG0yI_j.js → token-DHEkiO4g.js} +3 -4
- package/dist/{token-CVG0yI_j.js.map → token-DHEkiO4g.js.map} +1 -1
- package/dist/{upstream-retry-i1k1Xai2.js → upstream-retry-VNR-bCuT.js} +2 -3
- package/dist/{upstream-retry-i1k1Xai2.js.map → upstream-retry-VNR-bCuT.js.map} +1 -1
- package/dist/{version-C8x2hQrZ.js → version-CTqwKr26.js} +3 -4
- package/dist/{version-C8x2hQrZ.js.map → version-CTqwKr26.js.map} +1 -1
- package/dist/{worker-dispatch-B1w2qfjX.js → worker-dispatch-C7RtNOXv.js} +3 -4
- package/dist/{worker-dispatch-B1w2qfjX.js.map → worker-dispatch-C7RtNOXv.js.map} +1 -1
- package/dist/{workiq-qnJR5_n2.js → workiq-CQauEAMc.js} +3 -4
- package/dist/{workiq-qnJR5_n2.js.map → workiq-CQauEAMc.js.map} +1 -1
- package/dist/{workiq-tools-CMoDjrO0.js → workiq-tools-7n2xXMrQ.js} +1 -1
- package/package.json +19 -17
- package/dist/ado-tools-CAtopk36.js +0 -1
- package/dist/engine-CDZdAx8N.js +0 -1
- package/dist/hook-mcp-client-DERIkeR7.js.map +0 -1
- package/dist/index-cmd-CjRcmYk3.js.map +0 -1
- package/dist/lifecycle-C_CT13c9.js +0 -1
- package/dist/lifecycle-DibiH857.js +0 -1
- package/dist/paths-CEswtFj5.js +0 -1
- package/dist/peer-mcp-personas-Dxxw5X1g.js.map +0 -1
- package/dist/pi-IYAvKF50.js.map +0 -1
- package/dist/service-backend-B6D_DY1Z.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
1418
|
-
*
|
|
1419
|
-
*
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
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
|
|
1424
|
-
|
|
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 `
|
|
1451
|
-
* relative plan path is a PARAMETER: a `toString()`-serialized function
|
|
1452
|
-
* see module scope, and a captured constant would be `undefined` at
|
|
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
|
|
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
|
|
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 " +
|
|
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
|
|
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
|
-
`
|
|
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
|
-
`
|
|
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 " +
|
|
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
|
-
`
|
|
1726
|
-
`
|
|
1727
|
-
`
|
|
1728
|
-
`
|
|
1729
|
-
`
|
|
1730
|
-
`
|
|
1731
|
-
`
|
|
1732
|
-
`
|
|
1733
|
-
`
|
|
1734
|
-
`
|
|
1735
|
-
`
|
|
1736
|
-
`
|
|
1737
|
-
`
|
|
1738
|
-
`
|
|
1739
|
-
`
|
|
1740
|
-
`
|
|
1741
|
-
`
|
|
1742
|
-
`
|
|
1743
|
-
`
|
|
1744
|
-
`
|
|
1745
|
-
`
|
|
1746
|
-
`
|
|
1747
|
-
`
|
|
1748
|
-
`
|
|
1749
|
-
`
|
|
1750
|
-
`
|
|
1751
|
-
`
|
|
1752
|
-
`
|
|
1753
|
-
`
|
|
1754
|
-
`
|
|
1755
|
-
`
|
|
1756
|
-
`
|
|
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:
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
3253
|
-
const { disposeAdoClients } = await import("./ado-tools-
|
|
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-
|
|
3507
|
+
//# sourceMappingURL=pi-DI2QtaiZ.js.map
|