@herbertgao/pi-extensions 2026.11.3 → 2026.11.4
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/CHANGELOG.md +9 -0
- package/README.md +7 -7
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +33 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +72 -17
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +10 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +16 -7
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +7 -5
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark-hc.json +92 -0
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light-hc.json +92 -0
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +27 -0
- package/node_modules/pi-commandcode-provider/CONTRIBUTING.md +64 -5
- package/node_modules/pi-commandcode-provider/README.md +40 -26
- package/node_modules/pi-commandcode-provider/RELEASE.md +25 -0
- package/node_modules/pi-commandcode-provider/index.ts +212 -38
- package/node_modules/pi-commandcode-provider/package.json +9 -8
- package/node_modules/pi-commandcode-provider/scripts/live-e2e-profile.mjs +6 -13
- package/node_modules/pi-commandcode-provider/scripts/typecheck-entrypoint.mjs +88 -0
- package/node_modules/pi-commandcode-provider/src/api-key.ts +43 -2
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog-overrides.ts +1 -1
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +9 -2
- package/node_modules/pi-commandcode-provider/src/cost.ts +3 -37
- package/node_modules/pi-commandcode-provider/src/diagnostics.ts +215 -0
- package/node_modules/pi-commandcode-provider/src/oauth.ts +1 -1
- package/node_modules/pi-commandcode-provider/src/quota-command.ts +1 -1
- package/node_modules/pi-commandcode-provider/src/routing.ts +166 -0
- package/node_modules/pi-commandcode-provider/src/runtime.ts +15 -9
- package/node_modules/pi-commandcode-provider/src/transport.ts +79 -85
- package/node_modules/pi-commandcode-provider/src/types.ts +20 -39
- package/node_modules/pi-commandcode-provider/src/usage.ts +1 -1
- package/node_modules/pi-lens/CHANGELOG-USER.md +31 -0
- package/node_modules/pi-lens/CHANGELOG.md +178 -0
- package/node_modules/pi-lens/README.md +2 -1
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +1 -1
- package/node_modules/pi-lens/dist/{chunk-3O5EII3W.js → chunk-2VZ3VN3N.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-SDFKOLSF.js → chunk-3HTZDY3C.js} +8 -6
- package/node_modules/pi-lens/dist/{chunk-A5GRLYPZ.js → chunk-3NPWO5UO.js} +7 -13
- package/node_modules/pi-lens/dist/{chunk-AGGUWKRK.js → chunk-47UCC4MM.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-4ENEJHF4.js +198 -0
- package/node_modules/pi-lens/dist/{chunk-WXUDRAG6.js → chunk-5GEYJJHG.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-HHR7WGCI.js → chunk-5YSEQHJN.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-L3CLUGDY.js → chunk-6GPB3JLL.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-5F3XF3SX.js → chunk-7R5GZIA6.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-CUDD35TW.js → chunk-7UTSNTWM.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-DYRZGUMA.js → chunk-7YTRG6YW.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-JZRP4DGP.js → chunk-AACN5GNE.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7ANZ7XDD.js → chunk-ACRJ2GZ5.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6FIRFP6A.js → chunk-C3YRO3EU.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-GMROJJRN.js → chunk-CB7PEVOJ.js} +9 -1
- package/node_modules/pi-lens/dist/{chunk-BBET6HD6.js → chunk-CDFJF5YD.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-NSPVR3FN.js → chunk-CJS6WE66.js} +17 -19
- package/node_modules/pi-lens/dist/{chunk-6YUNI7B5.js → chunk-CM6BDY4E.js} +14 -60
- package/node_modules/pi-lens/dist/{chunk-G5GV2Q7K.js → chunk-CZCAZVTD.js} +16 -2
- package/node_modules/pi-lens/dist/chunk-DGKFWQK4.js +23 -0
- package/node_modules/pi-lens/dist/{chunk-VOP4PJKA.js → chunk-E65WJVI5.js} +7 -9
- package/node_modules/pi-lens/dist/{chunk-TV6RXRYH.js → chunk-EKNYSXFB.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-4LL2VRNY.js → chunk-EY6LY2HO.js} +16 -18
- package/node_modules/pi-lens/dist/{chunk-MC6VB2E5.js → chunk-F6BEQWAK.js} +17 -5
- package/node_modules/pi-lens/dist/{chunk-R2QQC33W.js → chunk-FGNSESAC.js} +12 -14
- package/node_modules/pi-lens/dist/{chunk-OC7VWJBZ.js → chunk-FRUBVFXV.js} +35 -37
- package/node_modules/pi-lens/dist/{chunk-7CGIDRIK.js → chunk-G22UNQID.js} +14 -16
- package/node_modules/pi-lens/dist/{chunk-L4NEVZ4T.js → chunk-GQTQUNCG.js} +25 -27
- package/node_modules/pi-lens/dist/{chunk-ZKLTNLAW.js → chunk-H3BVMK47.js} +6 -6
- package/node_modules/pi-lens/dist/chunk-H6FLQ5NW.js +28 -0
- package/node_modules/pi-lens/dist/{chunk-2ZE3AUJQ.js → chunk-HEA3EM23.js} +13 -15
- package/node_modules/pi-lens/dist/{chunk-CZL44WFN.js → chunk-HSOBIN22.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-PKSUMEPT.js → chunk-HYSKJMZK.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-VN3L2JWZ.js → chunk-IICERRFF.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-O4N5BQ3T.js → chunk-IILEH3ZC.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-WC6WRNQT.js → chunk-J3Q2NYJR.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-SFLHSL5R.js → chunk-JUZ67QZQ.js} +18 -7
- package/node_modules/pi-lens/dist/chunk-KR5VGMVT.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-UHHLR2VY.js → chunk-KV6GQOGN.js} +38 -41
- package/node_modules/pi-lens/dist/{chunk-HUAM7QG3.js → chunk-KXMJLOZF.js} +25 -23
- package/node_modules/pi-lens/dist/{chunk-BUZIQDFS.js → chunk-L4Y3ROKQ.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-JBP7KESM.js → chunk-L6WBJGQS.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-35WKJWO5.js → chunk-L7O774U7.js} +14 -14
- package/node_modules/pi-lens/dist/{chunk-BOPDQ7AZ.js → chunk-LAHHGNAY.js} +19 -21
- package/node_modules/pi-lens/dist/{chunk-RGGH6M34.js → chunk-LT62P654.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-5T5A6YAJ.js → chunk-LWOM6LVS.js} +33 -34
- package/node_modules/pi-lens/dist/{chunk-JYLOYTZD.js → chunk-MKPDIAZH.js} +5 -1
- package/node_modules/pi-lens/dist/{chunk-CM73PPGD.js → chunk-MN635QYA.js} +3 -4
- package/node_modules/pi-lens/dist/{chunk-BQG2QFVO.js → chunk-MQ4PPCJB.js} +21 -29
- package/node_modules/pi-lens/dist/{chunk-HXFUTMX2.js → chunk-MRLH4MYU.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-XOMGO63G.js → chunk-N56BNAA6.js} +19 -21
- package/node_modules/pi-lens/dist/{chunk-7MAD5ZAY.js → chunk-N5CEGQPG.js} +14 -16
- package/node_modules/pi-lens/dist/{chunk-ZFORSIED.js → chunk-NCLO6E6N.js} +13 -33
- package/node_modules/pi-lens/dist/{chunk-SQC7K3SP.js → chunk-NL5LSKVD.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-I22THIHI.js → chunk-NMUSOZ2D.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-4NBWFYWW.js → chunk-NOWH2VA2.js} +8 -33
- package/node_modules/pi-lens/dist/{chunk-NM2NWH55.js → chunk-NUSXS6YB.js} +6 -5
- package/node_modules/pi-lens/dist/{chunk-OZWXLJMX.js → chunk-OSEKJEUU.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-2BKUFQKR.js → chunk-OUYAUXAT.js} +405 -181
- package/node_modules/pi-lens/dist/{chunk-JPRDTY5S.js → chunk-PBZNYHMM.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-JE6HKLC7.js → chunk-PIIUNJIT.js} +2 -4
- package/node_modules/pi-lens/dist/{chunk-ZZDIOAAJ.js → chunk-PRHYIA6X.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-4W52ZKZX.js → chunk-PXQ45SGD.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-Q6JQKWPK.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-PIQQM32Y.js → chunk-QB7T2PHK.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-HKIL6DCL.js → chunk-QGITU23N.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-QJJKOHLH.js +57 -0
- package/node_modules/pi-lens/dist/{chunk-6LJOJ6EO.js → chunk-QP33NKYC.js} +14 -16
- package/node_modules/pi-lens/dist/{chunk-DIWK3LBC.js → chunk-QVBOXT3L.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-IYVYZQRL.js → chunk-RNJFRXEN.js} +5 -7
- package/node_modules/pi-lens/dist/{chunk-G6JKM4O7.js → chunk-RNXOWDM6.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-5RNB4HVK.js → chunk-RTFMDIKV.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-XWIME22V.js → chunk-SIQHOB6P.js} +11 -13
- package/node_modules/pi-lens/dist/{chunk-T2S3FNNJ.js → chunk-SLSMJPEF.js} +41 -42
- package/node_modules/pi-lens/dist/chunk-T5QSLSMM.js +50 -0
- package/node_modules/pi-lens/dist/chunk-TGQDAG4B.js +88 -0
- package/node_modules/pi-lens/dist/{chunk-6GMGEKQN.js → chunk-THYHUIDR.js} +39 -12
- package/node_modules/pi-lens/dist/{chunk-WMDUT4KH.js → chunk-TMNUTMT5.js} +72 -89
- package/node_modules/pi-lens/dist/{chunk-7TNILKGY.js → chunk-TOE2RRCS.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-TYHPVE5H.js +25 -0
- package/node_modules/pi-lens/dist/chunk-UAKO2M6B.js +73 -0
- package/node_modules/pi-lens/dist/chunk-UC5AXW5Z.js +20 -0
- package/node_modules/pi-lens/dist/chunk-UTJP6WOS.js +28 -0
- package/node_modules/pi-lens/dist/{chunk-FRLAUP2B.js → chunk-UXTQ3QPD.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-4QG55RRC.js → chunk-V2WDBOLZ.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-FHEV6T4L.js → chunk-V67D6TMU.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-VLQ7UKZH.js → chunk-VCRVNLE7.js} +135 -2
- package/node_modules/pi-lens/dist/{chunk-KZ4ALBCH.js → chunk-VO4JFPTV.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-GIRBSBGL.js → chunk-VWLSU3XV.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-2453RRJ2.js → chunk-W5E72HJA.js} +59 -22
- package/node_modules/pi-lens/dist/{chunk-VPLBLWFO.js → chunk-W7TY6HYX.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-SP4TFY5F.js → chunk-WSSLVMDA.js} +11 -13
- package/node_modules/pi-lens/dist/{chunk-PPKECBPP.js → chunk-WTB4GKMH.js} +10 -1
- package/node_modules/pi-lens/dist/{chunk-X35S7HSB.js → chunk-X5BJ3G2P.js} +41 -30
- package/node_modules/pi-lens/dist/{chunk-X66YJ2SS.js → chunk-XKFO2SZV.js} +33 -34
- package/node_modules/pi-lens/dist/{chunk-OWTG6UMO.js → chunk-XLAI7UYY.js} +75 -22
- package/node_modules/pi-lens/dist/{chunk-4B2YFN4U.js → chunk-XO756WE5.js} +45 -33
- package/node_modules/pi-lens/dist/{chunk-VOXTCULR.js → chunk-XVB3Q2PG.js} +2 -4
- package/node_modules/pi-lens/dist/{chunk-XYLC35E4.js → chunk-YOXCCJDF.js} +517 -308
- package/node_modules/pi-lens/dist/{chunk-O2ARHQKF.js → chunk-ZCQBNPRH.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-ZD4KVFXI.js +234 -0
- package/node_modules/pi-lens/dist/{chunk-LSFXZLPW.js → chunk-ZDMFGACN.js} +184 -235
- package/node_modules/pi-lens/dist/{chunk-4BKU7PV3.js → chunk-ZMMHHXSW.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-OY7WZI7Q.js → chunk-ZPM7ZIFL.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-R4QWJQ2H.js → chunk-ZVCDHYWZ.js} +9 -11
- package/node_modules/pi-lens/dist/{chunk-RZG472YW.js → chunk-ZZN74OGD.js} +83 -46
- package/node_modules/pi-lens/dist/{chunk-BHWW6FAX.js → chunk-ZZSJAR76.js} +37 -19
- package/node_modules/pi-lens/dist/index.js +4910 -4218
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +12 -17
- package/node_modules/pi-lens/dist/mcp/cli.js +41 -42
- package/node_modules/pi-lens/dist/mcp/server.js +1451 -648
- package/node_modules/pi-lens/dist/mcp/worker.js +59 -60
- package/node_modules/pi-lens/dist/probes/installer.js +17 -19
- package/node_modules/pi-lens/docs/agent-tools.md +40 -8
- package/node_modules/pi-lens/docs/analysisall.md +1 -1
- package/node_modules/pi-lens/docs/ci-bot-pr-checks.md +7 -5
- package/node_modules/pi-lens/docs/configuration.md +51 -9
- package/node_modules/pi-lens/docs/defect-shapes.md +52 -3
- package/node_modules/pi-lens/docs/environment-variables.md +18 -1
- package/node_modules/pi-lens/docs/features.md +12 -5
- package/node_modules/pi-lens/docs/globalconfig.md +11 -3
- package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +9 -2
- package/node_modules/pi-lens/docs/invariants/session-telemetry.md +2 -2
- package/node_modules/pi-lens/docs/language-coverage.md +1 -0
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +57 -35
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +4 -1
- package/node_modules/pi-lens/docs/merge-queue-rollout.md +10 -8
- package/node_modules/pi-lens/docs/module-report-read-symbol.md +34 -23
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +11 -1
- package/node_modules/pi-lens/docs/pi-lens-investigator.md +3 -0
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +15 -7
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +1 -1
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +13 -0
- package/node_modules/pi-lens/docs/public-api-stability.md +39 -5
- package/node_modules/pi-lens/docs/release-qa-baseline.md +7 -4
- package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +11 -2
- package/node_modules/pi-lens/docs/servercapabilities.md +3 -1
- package/node_modules/pi-lens/docs/settings.md +2 -2
- package/node_modules/pi-lens/docs/word-index.md +3 -2
- package/node_modules/pi-lens/package.json +8 -3
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
- package/node_modules/pi-lens/scripts/download-grammars.js +3 -2
- package/node_modules/pi-lens/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
- package/node_modules/pi-provider-qoder/dist/index.js +473 -62
- package/node_modules/pi-provider-qoder/package.json +1 -1
- package/package.json +10 -8
- package/node_modules/pi-commandcode-provider/src/converters.ts +0 -419
- package/node_modules/pi-commandcode-provider/src/core.ts +0 -861
- package/node_modules/pi-commandcode-provider/src/json-schema.ts +0 -417
- package/node_modules/pi-commandcode-provider/src/transcript.ts +0 -56
- package/node_modules/pi-lens/dist/chunk-2TS4GLOJ.js +0 -31
- package/node_modules/pi-lens/dist/chunk-3JAHQBSY.js +0 -27
- package/node_modules/pi-lens/dist/chunk-447YZL4S.js +0 -25
- package/node_modules/pi-lens/dist/chunk-565VRUP4.js +0 -136
- package/node_modules/pi-lens/dist/chunk-57X2CDRX.js +0 -49
- package/node_modules/pi-lens/dist/chunk-GGYOZWHW.js +0 -27
- package/node_modules/pi-lens/dist/chunk-IE5D3RA5.js +0 -58
- package/node_modules/pi-lens/dist/chunk-LPYTPNOJ.js +0 -22
- package/node_modules/pi-lens/dist/chunk-OFNMHPBT.js +0 -89
- package/node_modules/pi-lens/dist/chunk-U3AS2FR6.js +0 -106
- package/node_modules/pi-lens/dist/chunk-W3BGKBBK.js +0 -27
- package/node_modules/pi-lens/dist/chunk-WQV6BI4Q.js +0 -48
- package/node_modules/pi-lens/dist/chunk-YHGYAEFH.js +0 -443
- package/node_modules/pi-lens/dist/chunk-ZONZ6YY3.js +0 -74
- package/node_modules/pi-lens/dist/chunk-ZSM35JF4.js +0 -30
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
GitleaksClient,
|
|
5
|
-
classifyAndFilterFindings
|
|
6
|
-
} from "../chunk-VN3L2JWZ.js";
|
|
7
3
|
import {
|
|
8
4
|
DEAD_CODE_DELTA_MAX_SHOWN,
|
|
9
5
|
deadCodeIssueCount,
|
|
@@ -11,31 +7,36 @@ import {
|
|
|
11
7
|
deadCodeIssues,
|
|
12
8
|
formatDeadCodeDelta,
|
|
13
9
|
stableFindingKey
|
|
14
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-HEA3EM23.js";
|
|
15
11
|
import {
|
|
16
12
|
clearFormatterCache
|
|
17
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-EY6LY2HO.js";
|
|
18
14
|
import {
|
|
19
15
|
findNearestProjectRoot,
|
|
20
16
|
isStartupScanVerdictFresh,
|
|
21
17
|
resolveStartupScanContext
|
|
22
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-ZPM7ZIFL.js";
|
|
23
19
|
import {
|
|
24
20
|
loadCallGraph
|
|
25
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-6GPB3JLL.js";
|
|
26
22
|
import {
|
|
27
23
|
isHardFailureSummary
|
|
28
24
|
} from "../chunk-7U2IDNXN.js";
|
|
29
25
|
import {
|
|
30
26
|
RUNNERS,
|
|
31
27
|
formatRunDurationMs,
|
|
28
|
+
isCompletedPassResult,
|
|
32
29
|
isExcludedTestTarget,
|
|
33
30
|
isRunnerErrorResult
|
|
34
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-XLAI7UYY.js";
|
|
35
32
|
import {
|
|
36
33
|
GovulncheckClient
|
|
37
|
-
} from "../chunk-
|
|
38
|
-
import
|
|
34
|
+
} from "../chunk-JUZ67QZQ.js";
|
|
35
|
+
import {
|
|
36
|
+
GitleaksClient,
|
|
37
|
+
classifyAndFilterFindings
|
|
38
|
+
} from "../chunk-IICERRFF.js";
|
|
39
|
+
import "../chunk-OSEKJEUU.js";
|
|
39
40
|
import {
|
|
40
41
|
resetManagedToolRefreshSession
|
|
41
42
|
} from "../chunk-UXVNL3D7.js";
|
|
@@ -44,6 +45,7 @@ import {
|
|
|
44
45
|
acknowledgeTestFindings,
|
|
45
46
|
acknowledgeTurnEndFindings,
|
|
46
47
|
advisoryPathKey,
|
|
48
|
+
blockerRepeatContent,
|
|
47
49
|
consumeSessionStartGuidance,
|
|
48
50
|
consumeTestFindings,
|
|
49
51
|
consumeTurnEndFindings,
|
|
@@ -53,7 +55,7 @@ import {
|
|
|
53
55
|
peekTurnEndFindings,
|
|
54
56
|
snapshotAdvisoryProvenance,
|
|
55
57
|
validateAdvisoryProvenance
|
|
56
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-THYHUIDR.js";
|
|
57
59
|
import {
|
|
58
60
|
CacheManager,
|
|
59
61
|
DEFAULT_MAX_AGE_MS,
|
|
@@ -115,52 +117,49 @@ import {
|
|
|
115
117
|
resetPsScriptAnalyzerAvailability,
|
|
116
118
|
runProviders,
|
|
117
119
|
stampLineHashes
|
|
118
|
-
} from "../chunk-
|
|
120
|
+
} from "../chunk-ZDMFGACN.js";
|
|
119
121
|
import {
|
|
120
122
|
resetLazyInstallAttempts
|
|
121
|
-
} from "../chunk-
|
|
123
|
+
} from "../chunk-F6BEQWAK.js";
|
|
122
124
|
import {
|
|
123
125
|
isTestRoleCollateral
|
|
124
|
-
} from "../chunk-
|
|
125
|
-
import "../chunk-
|
|
126
|
+
} from "../chunk-47UCC4MM.js";
|
|
127
|
+
import "../chunk-HYSKJMZK.js";
|
|
126
128
|
import {
|
|
127
129
|
resetGoAvailability
|
|
128
|
-
} from "../chunk-
|
|
130
|
+
} from "../chunk-2VZ3VN3N.js";
|
|
129
131
|
import {
|
|
130
132
|
TrivyClient,
|
|
131
133
|
trivyEvidenceFiles
|
|
132
|
-
} from "../chunk-
|
|
133
|
-
import "../chunk-
|
|
134
|
-
import "../chunk-
|
|
135
|
-
import {
|
|
136
|
-
scannerReportParentDir
|
|
137
|
-
} from "../chunk-RGGH6M34.js";
|
|
134
|
+
} from "../chunk-H3BVMK47.js";
|
|
135
|
+
import "../chunk-VO4JFPTV.js";
|
|
136
|
+
import "../chunk-PBZNYHMM.js";
|
|
138
137
|
import {
|
|
139
138
|
findingsResult,
|
|
140
139
|
hasUsableResult,
|
|
141
140
|
reachedNoVerdict
|
|
142
|
-
} from "../chunk-
|
|
141
|
+
} from "../chunk-ZZN74OGD.js";
|
|
143
142
|
import {
|
|
144
143
|
resetRustAvailability
|
|
145
|
-
} from "../chunk-
|
|
146
|
-
import "../chunk-
|
|
147
|
-
import "../chunk-
|
|
144
|
+
} from "../chunk-PXQ45SGD.js";
|
|
145
|
+
import "../chunk-L4Y3ROKQ.js";
|
|
146
|
+
import "../chunk-QVBOXT3L.js";
|
|
148
147
|
import {
|
|
149
|
-
getSgCommand,
|
|
150
148
|
resetDispatchAvailabilityState,
|
|
151
149
|
resolveManagedToolClient
|
|
152
|
-
} from "../chunk-
|
|
153
|
-
import "../chunk-
|
|
154
|
-
import "../chunk-
|
|
155
|
-
import "../chunk-
|
|
156
|
-
import "../chunk-
|
|
150
|
+
} from "../chunk-NCLO6E6N.js";
|
|
151
|
+
import "../chunk-7R5GZIA6.js";
|
|
152
|
+
import "../chunk-UXTQ3QPD.js";
|
|
153
|
+
import "../chunk-CM6BDY4E.js";
|
|
154
|
+
import "../chunk-ZD4KVFXI.js";
|
|
155
|
+
import "../chunk-TOE2RRCS.js";
|
|
157
156
|
import {
|
|
158
157
|
SYMBOL_KIND_NAMES,
|
|
159
158
|
captureReviewGraphStructuralIr,
|
|
160
159
|
formatReviewGraphRevisionDriftNote,
|
|
161
160
|
publishReviewGraphFileIr,
|
|
162
161
|
reviewGraphIrContentHash
|
|
163
|
-
} from "../chunk-
|
|
162
|
+
} from "../chunk-XO756WE5.js";
|
|
164
163
|
import {
|
|
165
164
|
buildSymbolId
|
|
166
165
|
} from "../chunk-3MED75HT.js";
|
|
@@ -192,6 +191,7 @@ import {
|
|
|
192
191
|
combinePrimaryUnavailableCauses,
|
|
193
192
|
configDisabledAuxiliaryLspServerIds,
|
|
194
193
|
countRetainedSuppressedRows,
|
|
194
|
+
createBusPublisher,
|
|
195
195
|
createLazyImport,
|
|
196
196
|
createLiveBusEmitter,
|
|
197
197
|
createWorkspaceDiagnosticsCacheContext,
|
|
@@ -219,13 +219,17 @@ import {
|
|
|
219
219
|
hashDiagnosticContent,
|
|
220
220
|
importTargetsToAnnounce,
|
|
221
221
|
incrementWidgetDependencyDriftDelivery,
|
|
222
|
+
inlineBlockerLines,
|
|
223
|
+
inlineBlockerSourceOf,
|
|
224
|
+
inlineBlockerSources,
|
|
222
225
|
isAuxBacklogPublished,
|
|
223
226
|
isBlocking,
|
|
227
|
+
isCrossFileBlocker,
|
|
228
|
+
isLspRequestTimeoutError,
|
|
224
229
|
isOptInAuxiliaryServerId,
|
|
225
230
|
isPendingAuxiliaryPastRearmTtl,
|
|
226
231
|
isWarmAttached,
|
|
227
232
|
loadLspService,
|
|
228
|
-
logBusEvent,
|
|
229
233
|
markWidgetFileBlockersStale,
|
|
230
234
|
newLspMutationCorrelationId,
|
|
231
235
|
nextOrderTurn,
|
|
@@ -241,7 +245,6 @@ import {
|
|
|
241
245
|
reconcileStaleWidgetFiles,
|
|
242
246
|
recordLspMutationOutcome,
|
|
243
247
|
recordRunner,
|
|
244
|
-
recordStaleBusFailure,
|
|
245
248
|
registerDeferredLspWork,
|
|
246
249
|
resetDeferredDispositions,
|
|
247
250
|
resetLSPService,
|
|
@@ -250,10 +253,10 @@ import {
|
|
|
250
253
|
resetOpaqueMutationState,
|
|
251
254
|
resetPendingAuxiliaryCoverage,
|
|
252
255
|
resetWorkspaceDiagnosticsCacheSession,
|
|
253
|
-
resolveLiveBusEmitter,
|
|
254
256
|
resyncDocumentOnPastEof,
|
|
255
257
|
retagAuxiliaryDiagnostics,
|
|
256
258
|
retireScope,
|
|
259
|
+
retireWidgetCitedRows,
|
|
257
260
|
retireWidgetDependencyDriftBlockers,
|
|
258
261
|
runPerServerGroups,
|
|
259
262
|
scopeCell,
|
|
@@ -267,7 +270,7 @@ import {
|
|
|
267
270
|
warmAnswerBinding,
|
|
268
271
|
widgetDiagnosticUri,
|
|
269
272
|
writeOrderToken
|
|
270
|
-
} from "../chunk-
|
|
273
|
+
} from "../chunk-OUYAUXAT.js";
|
|
271
274
|
import {
|
|
272
275
|
ANY_POSITION,
|
|
273
276
|
foldedFindingIdentity,
|
|
@@ -277,7 +280,7 @@ import {
|
|
|
277
280
|
resetMutationAttribution,
|
|
278
281
|
retainRecordedFindings,
|
|
279
282
|
stableFindingId
|
|
280
|
-
} from "../chunk-
|
|
283
|
+
} from "../chunk-VWLSU3XV.js";
|
|
281
284
|
import {
|
|
282
285
|
mapWithConcurrency
|
|
283
286
|
} from "../chunk-XIMYZ3JA.js";
|
|
@@ -287,6 +290,7 @@ import {
|
|
|
287
290
|
customServerSpecsOf,
|
|
288
291
|
describeRootFallback,
|
|
289
292
|
disabledPrimaries,
|
|
293
|
+
disabledServerRecords,
|
|
290
294
|
explainServersForFile,
|
|
291
295
|
getAstGrepRuleFingerprint,
|
|
292
296
|
getServersForFileWithConfig,
|
|
@@ -295,14 +299,15 @@ import {
|
|
|
295
299
|
isSameOrWithin,
|
|
296
300
|
loadLSPConfig,
|
|
297
301
|
lspConfigOf,
|
|
302
|
+
newLspConfigProblems,
|
|
298
303
|
primaryServerId,
|
|
299
304
|
registerLSPConfig,
|
|
300
305
|
resetDirectLspCommandAvailability,
|
|
301
306
|
resetLSPCaseSensitivityState,
|
|
302
307
|
resolveLspCwdForFile,
|
|
303
308
|
shouldInitializeSessionRoot
|
|
304
|
-
} from "../chunk-
|
|
305
|
-
import "../chunk-
|
|
309
|
+
} from "../chunk-YOXCCJDF.js";
|
|
310
|
+
import "../chunk-7YTRG6YW.js";
|
|
306
311
|
import {
|
|
307
312
|
PROJECT_VENV_DIR_NAMES,
|
|
308
313
|
PYTHON_DECLARATION_CONCURRENCY,
|
|
@@ -314,7 +319,10 @@ import {
|
|
|
314
319
|
partitionOutrankedPythonCompileVerdicts,
|
|
315
320
|
recordPythonCompileVerdictDrop,
|
|
316
321
|
resetBoundedTelemetry
|
|
317
|
-
} from "../chunk-
|
|
322
|
+
} from "../chunk-V67D6TMU.js";
|
|
323
|
+
import {
|
|
324
|
+
scannerReportParentDir
|
|
325
|
+
} from "../chunk-LT62P654.js";
|
|
318
326
|
import {
|
|
319
327
|
PROJECT_SNAPSHOT_VERSION,
|
|
320
328
|
getProjectSnapshotLegacyPath,
|
|
@@ -329,13 +337,13 @@ import {
|
|
|
329
337
|
readJsonCache,
|
|
330
338
|
readProjectSnapshotMeta,
|
|
331
339
|
saveRuntimeProjectSnapshot
|
|
332
|
-
} from "../chunk-
|
|
340
|
+
} from "../chunk-PRHYIA6X.js";
|
|
333
341
|
import {
|
|
334
342
|
SWEEP_IDLE_SAFETY_MARGIN_MS,
|
|
335
343
|
getFullScanWallClockMs,
|
|
336
344
|
isWorkspaceSweepActive,
|
|
337
345
|
runWhenWorkspaceSweepIdle
|
|
338
|
-
} from "../chunk-
|
|
346
|
+
} from "../chunk-XVB3Q2PG.js";
|
|
339
347
|
import "../chunk-5W3R6LFT.js";
|
|
340
348
|
import {
|
|
341
349
|
DEPENDENCY_DRIFT_MAX_DELIVERIES,
|
|
@@ -346,10 +354,10 @@ import {
|
|
|
346
354
|
resolveImportToFiles,
|
|
347
355
|
sweepInlineBlockerFreshness,
|
|
348
356
|
symbolExtractionGrammar
|
|
349
|
-
} from "../chunk-
|
|
350
|
-
import "../chunk-
|
|
351
|
-
import "../chunk-
|
|
352
|
-
import "../chunk-
|
|
357
|
+
} from "../chunk-L7O774U7.js";
|
|
358
|
+
import "../chunk-7UTSNTWM.js";
|
|
359
|
+
import "../chunk-ACRJ2GZ5.js";
|
|
360
|
+
import "../chunk-J3Q2NYJR.js";
|
|
353
361
|
import {
|
|
354
362
|
EXT_TO_LANG,
|
|
355
363
|
classifyTreeSitterWasmError,
|
|
@@ -362,42 +370,37 @@ import {
|
|
|
362
370
|
queryLoader,
|
|
363
371
|
reportBundledResourceDirHealth,
|
|
364
372
|
resolveTreeSitterLanguage
|
|
365
|
-
} from "../chunk-
|
|
373
|
+
} from "../chunk-ZZSJAR76.js";
|
|
366
374
|
import "../chunk-Z54ZSOBZ.js";
|
|
367
375
|
import {
|
|
368
376
|
getUserRuleRoot
|
|
369
|
-
} from "../chunk-
|
|
377
|
+
} from "../chunk-5YSEQHJN.js";
|
|
370
378
|
import {
|
|
371
379
|
dump,
|
|
372
380
|
resolvePackagePath
|
|
373
|
-
} from "../chunk-
|
|
381
|
+
} from "../chunk-QGITU23N.js";
|
|
374
382
|
import {
|
|
375
383
|
SCAN_LANGUAGE_PRIORITY,
|
|
376
384
|
extensionsForLanguage,
|
|
377
385
|
extensionsForLanguageToken,
|
|
386
|
+
resolveFilenameLanguage,
|
|
378
387
|
resolveLanguage
|
|
379
|
-
} from "../chunk-
|
|
388
|
+
} from "../chunk-WTB4GKMH.js";
|
|
380
389
|
import "../chunk-6HWVI6MI.js";
|
|
381
|
-
import "../chunk-
|
|
390
|
+
import "../chunk-RTFMDIKV.js";
|
|
382
391
|
import {
|
|
383
392
|
HOOK_WALL_BUDGET_MS
|
|
384
393
|
} from "../chunk-CKEQFGLT.js";
|
|
385
|
-
import {
|
|
386
|
-
bounded,
|
|
387
|
-
combineAbortSignals,
|
|
388
|
-
untilAborted,
|
|
389
|
-
withDeadline
|
|
390
|
-
} from "../chunk-JYLOYTZD.js";
|
|
391
394
|
import {
|
|
392
395
|
centralityFromReverseDeps,
|
|
393
396
|
getWordIndexBuildStatus,
|
|
394
397
|
logWordIndex,
|
|
395
398
|
searchWordIndex,
|
|
396
399
|
triggerBackgroundWordIndexBuild
|
|
397
|
-
} from "../chunk-
|
|
400
|
+
} from "../chunk-KXMJLOZF.js";
|
|
398
401
|
import {
|
|
399
402
|
getProjectDiagnosticsScannerMaxFiles
|
|
400
|
-
} from "../chunk-
|
|
403
|
+
} from "../chunk-MRLH4MYU.js";
|
|
401
404
|
import {
|
|
402
405
|
WARM_TURN_END_SCHEMA_VERSION,
|
|
403
406
|
createWarmIpcLineReader,
|
|
@@ -405,33 +408,40 @@ import {
|
|
|
405
408
|
ipcPathForCwd,
|
|
406
409
|
readTurnEndStatus,
|
|
407
410
|
unlinkStaleUnixSocket
|
|
408
|
-
} from "../chunk-
|
|
411
|
+
} from "../chunk-HSOBIN22.js";
|
|
409
412
|
import {
|
|
410
413
|
hashContentBytes,
|
|
411
414
|
resolveRunnerPath,
|
|
412
415
|
toRunnerDisplayPath
|
|
413
|
-
} from "../chunk-
|
|
416
|
+
} from "../chunk-W7TY6HYX.js";
|
|
417
|
+
import {
|
|
418
|
+
bounded,
|
|
419
|
+
combineAbortSignals,
|
|
420
|
+
untilAborted,
|
|
421
|
+
withBudget,
|
|
422
|
+
withDeadline
|
|
423
|
+
} from "../chunk-MKPDIAZH.js";
|
|
414
424
|
import "../chunk-2BEMIWEW.js";
|
|
415
425
|
import "../chunk-IJYGIDF4.js";
|
|
416
426
|
import {
|
|
417
427
|
commitDurableStore,
|
|
418
428
|
resetResolvedPathCache,
|
|
419
429
|
resetZizmorTokenAvailability
|
|
420
|
-
} from "../chunk-
|
|
430
|
+
} from "../chunk-MQ4PPCJB.js";
|
|
421
431
|
import {
|
|
422
432
|
resolveToolCwd
|
|
423
|
-
} from "../chunk-
|
|
433
|
+
} from "../chunk-RNJFRXEN.js";
|
|
424
434
|
import {
|
|
425
435
|
_resetPackageManagerCache,
|
|
426
436
|
findGlobalBinary,
|
|
427
437
|
pmBinary,
|
|
428
438
|
resolveNodePackageManager,
|
|
429
439
|
runScriptArgs
|
|
430
|
-
} from "../chunk-
|
|
440
|
+
} from "../chunk-E65WJVI5.js";
|
|
431
441
|
import {
|
|
432
442
|
getIsolatedNpxSpawnOptions,
|
|
433
443
|
probeToolAsync
|
|
434
|
-
} from "../chunk-
|
|
444
|
+
} from "../chunk-L6WBJGQS.js";
|
|
435
445
|
import "../chunk-UYXV5NIS.js";
|
|
436
446
|
import {
|
|
437
447
|
classifyProbeFailure,
|
|
@@ -440,20 +450,20 @@ import {
|
|
|
440
450
|
logAvailabilityDecision,
|
|
441
451
|
resetInstallRetryLatches,
|
|
442
452
|
startHostStallSampler
|
|
443
|
-
} from "../chunk-
|
|
453
|
+
} from "../chunk-AACN5GNE.js";
|
|
444
454
|
import {
|
|
445
455
|
canRunStartupHeavyScans,
|
|
446
456
|
detectProjectLanguageProfile,
|
|
447
457
|
getDefaultStartupTools
|
|
448
|
-
} from "../chunk-
|
|
449
|
-
import "../chunk-
|
|
458
|
+
} from "../chunk-3HTZDY3C.js";
|
|
459
|
+
import "../chunk-CDFJF5YD.js";
|
|
450
460
|
import {
|
|
451
461
|
collectSourceFilesWithBudgetAsync,
|
|
452
462
|
getSlowFsVerdict,
|
|
453
463
|
isSlowFs,
|
|
454
464
|
slowFsDegradationNotice
|
|
455
|
-
} from "../chunk-
|
|
456
|
-
import "../chunk-
|
|
465
|
+
} from "../chunk-RNXOWDM6.js";
|
|
466
|
+
import "../chunk-ZCQBNPRH.js";
|
|
457
467
|
import {
|
|
458
468
|
displayProjectDataPath,
|
|
459
469
|
drainProjectDataDirMigrations,
|
|
@@ -483,7 +493,7 @@ import {
|
|
|
483
493
|
sweepDeadEphemeralDataDirs,
|
|
484
494
|
updateHeartbeat,
|
|
485
495
|
withGenerationLockSync
|
|
486
|
-
} from "../chunk-
|
|
496
|
+
} from "../chunk-TMNUTMT5.js";
|
|
487
497
|
import {
|
|
488
498
|
createSingleFlight
|
|
489
499
|
} from "../chunk-AWQWXSW4.js";
|
|
@@ -492,8 +502,9 @@ import {
|
|
|
492
502
|
yieldIfOverBudget
|
|
493
503
|
} from "../chunk-QYF5S6P6.js";
|
|
494
504
|
import {
|
|
505
|
+
SPECIAL_FILENAMES,
|
|
495
506
|
detectFileKind
|
|
496
|
-
} from "../chunk-
|
|
507
|
+
} from "../chunk-CZCAZVTD.js";
|
|
497
508
|
import {
|
|
498
509
|
PathKeyedMap,
|
|
499
510
|
compareKeys,
|
|
@@ -504,12 +515,12 @@ import {
|
|
|
504
515
|
provenanceView,
|
|
505
516
|
resolvePiLensConfig,
|
|
506
517
|
summarizeConfigResolution
|
|
507
|
-
} from "../chunk-
|
|
518
|
+
} from "../chunk-X5BJ3G2P.js";
|
|
508
519
|
import {
|
|
509
520
|
LSP_NAMESPACE_KEY,
|
|
510
521
|
getPiLensGlobalConfigPath,
|
|
511
522
|
resetWorkspaceTopology
|
|
512
|
-
} from "../chunk-
|
|
523
|
+
} from "../chunk-NL5LSKVD.js";
|
|
513
524
|
import {
|
|
514
525
|
DEFAULT_MAX_OUTPUT_BYTES,
|
|
515
526
|
createBoundedOutputSink,
|
|
@@ -519,15 +530,18 @@ import {
|
|
|
519
530
|
setProjectTrustState,
|
|
520
531
|
truncatedByOutputCap,
|
|
521
532
|
writeFileAtomic
|
|
522
|
-
} from "../chunk-
|
|
533
|
+
} from "../chunk-PIIUNJIT.js";
|
|
523
534
|
import {
|
|
524
535
|
LENS_TOOL_NAMES,
|
|
525
536
|
TOOL_REGISTRY,
|
|
526
537
|
compareOrdinal,
|
|
538
|
+
createSubsystemLogger,
|
|
527
539
|
escapeRegExp,
|
|
540
|
+
flushExtensionLog,
|
|
528
541
|
getDegradationLedgerGeneration,
|
|
529
542
|
getDegradationSummary,
|
|
530
543
|
incrementDegradationCount,
|
|
544
|
+
logExtension,
|
|
531
545
|
recordDegradationOnce,
|
|
532
546
|
renderDegradationLines,
|
|
533
547
|
resetDegradationLedger,
|
|
@@ -535,35 +549,29 @@ import {
|
|
|
535
549
|
resolveLensToolName,
|
|
536
550
|
toolRegistryEntryForMcp,
|
|
537
551
|
translateGuidanceToolNames
|
|
538
|
-
} from "../chunk-
|
|
539
|
-
import {
|
|
540
|
-
createSubsystemLogger,
|
|
541
|
-
flushExtensionLog,
|
|
542
|
-
logExtension
|
|
543
|
-
} from "../chunk-WQV6BI4Q.js";
|
|
552
|
+
} from "../chunk-W5E72HJA.js";
|
|
544
553
|
import {
|
|
545
554
|
freshnessFromMtime
|
|
546
555
|
} from "../chunk-S26LC76R.js";
|
|
547
|
-
import {
|
|
548
|
-
claimPhaseOncePerSession,
|
|
549
|
-
logLatency
|
|
550
|
-
} from "../chunk-565VRUP4.js";
|
|
551
556
|
import {
|
|
552
557
|
beginTurnContext,
|
|
558
|
+
claimPhaseOncePerSession,
|
|
553
559
|
createNdjsonLogger,
|
|
554
560
|
getGlobalPiLensLogDir,
|
|
555
561
|
getProcessSingleton,
|
|
556
562
|
isTestMode,
|
|
563
|
+
logLatency,
|
|
557
564
|
runLogCleanup,
|
|
558
565
|
setTurnContextSession
|
|
559
|
-
} from "../chunk-
|
|
566
|
+
} from "../chunk-VCRVNLE7.js";
|
|
560
567
|
import "../chunk-LJDODBBZ.js";
|
|
561
568
|
import {
|
|
562
569
|
FactStore
|
|
563
|
-
} from "../chunk-
|
|
570
|
+
} from "../chunk-ZMMHHXSW.js";
|
|
564
571
|
import {
|
|
565
572
|
BoundedFifoMap,
|
|
566
573
|
BoundedLruCache,
|
|
574
|
+
createProjectRelativePathResolver,
|
|
567
575
|
homeRelativePath,
|
|
568
576
|
isAtOrAboveHomeDir,
|
|
569
577
|
isUnderDir,
|
|
@@ -577,9 +585,10 @@ import {
|
|
|
577
585
|
resolveHostToolPath,
|
|
578
586
|
toPosix,
|
|
579
587
|
toProjectRelativePath,
|
|
588
|
+
uriToDiskPath,
|
|
580
589
|
uriToPath,
|
|
581
590
|
walkUpDirs
|
|
582
|
-
} from "../chunk-
|
|
591
|
+
} from "../chunk-CB7PEVOJ.js";
|
|
583
592
|
import "../chunk-NXL4FFQQ.js";
|
|
584
593
|
|
|
585
594
|
// dist/mcp/server.js
|
|
@@ -603,6 +612,11 @@ result error
|
|
|
603
612
|
${"x".repeat(FOOTER_DIAG_SECTION_MAX_BYTES)}
|
|
604
613
|
usage tokens=${"9".repeat(FOOTER_MAX_DIGITS)} elapsed-ms=${"9".repeat(FOOTER_MAX_DIGITS)} bytes=${"9".repeat(FOOTER_MAX_DIGITS)} truncated=false`, "utf8");
|
|
605
614
|
var RESULT_PAYLOAD_BUDGET_BYTES = MAX_RESULT_BYTES - RESULT_FOOTER_RESERVE_BYTES;
|
|
615
|
+
var JSON_CELL_DETAILS_KEY = "jsonCell";
|
|
616
|
+
function isJsonCell(result) {
|
|
617
|
+
const details = result.details;
|
|
618
|
+
return typeof details === "object" && details !== null && details[JSON_CELL_DETAILS_KEY] === true;
|
|
619
|
+
}
|
|
606
620
|
function renderHeadTail(text, maxBytes, markerFor) {
|
|
607
621
|
const render3 = (kept) => {
|
|
608
622
|
const head = Math.floor(kept / 2);
|
|
@@ -737,6 +751,9 @@ function boundResultPayload(result) {
|
|
|
737
751
|
if (!result.content) {
|
|
738
752
|
return { result, deliveredBytes: 0, truncated: false };
|
|
739
753
|
}
|
|
754
|
+
if (isJsonCell(result)) {
|
|
755
|
+
return boundJsonCellPayload(result);
|
|
756
|
+
}
|
|
740
757
|
const joined = fullTextOf(result);
|
|
741
758
|
const bound = boundToolText(joined, RESULT_PAYLOAD_BUDGET_BYTES);
|
|
742
759
|
const firstText = result.content.findIndex((block) => block.type === "text" && typeof block.text === "string");
|
|
@@ -755,6 +772,30 @@ function boundResultPayload(result) {
|
|
|
755
772
|
truncated: bound.truncated
|
|
756
773
|
};
|
|
757
774
|
}
|
|
775
|
+
function boundJsonCellPayload(result) {
|
|
776
|
+
const content = result.content ?? [];
|
|
777
|
+
const textBlocks = [];
|
|
778
|
+
for (const [index, block] of content.entries()) {
|
|
779
|
+
if (block.type === "text" && typeof block.text === "string") {
|
|
780
|
+
textBlocks.push({ block, index });
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
const payload = textBlocks[0];
|
|
784
|
+
if (!payload) {
|
|
785
|
+
return { result, deliveredBytes: 0, truncated: false };
|
|
786
|
+
}
|
|
787
|
+
const annotationBytes = textBlocks.slice(1).reduce((sum, entry) => sum + Buffer.byteLength(entry.block.text, "utf8"), 0);
|
|
788
|
+
const separators = textBlocks.length - 1;
|
|
789
|
+
const payloadBudget = Math.max(0, RESULT_PAYLOAD_BUDGET_BYTES - annotationBytes - separators);
|
|
790
|
+
const bound = boundToolText(payload.block.text, payloadBudget);
|
|
791
|
+
const bounded2 = content.map((block, index) => index === payload.index ? { ...block, text: bound.text } : block);
|
|
792
|
+
const deliveredBytes = Buffer.byteLength(fullTextOf({ content: bounded2 }), "utf8");
|
|
793
|
+
return {
|
|
794
|
+
result: { ...result, content: bounded2 },
|
|
795
|
+
deliveredBytes,
|
|
796
|
+
truncated: bound.truncated
|
|
797
|
+
};
|
|
798
|
+
}
|
|
758
799
|
function renderToolText(summary, structured, compact = false) {
|
|
759
800
|
const rawText = structured === void 0 ? summary : `${summary}
|
|
760
801
|
|
|
@@ -1000,6 +1041,7 @@ function sgExcludeArgsForProject(rootDir) {
|
|
|
1000
1041
|
`!${glob}`
|
|
1001
1042
|
]);
|
|
1002
1043
|
}
|
|
1044
|
+
var resolvedSgBrand = /* @__PURE__ */ Symbol("resolved-sg-command");
|
|
1003
1045
|
var DEFAULT_EXEC_TIMEOUT_MS = 3e4;
|
|
1004
1046
|
var PROBE_TIMEOUT_MS = 5e3;
|
|
1005
1047
|
var MAX_SG_OUTPUT_BYTES = 8 * 1024 * 1024;
|
|
@@ -1396,10 +1438,22 @@ ${result.stderr}`)) {
|
|
|
1396
1438
|
*/
|
|
1397
1439
|
getSgCommand() {
|
|
1398
1440
|
return {
|
|
1441
|
+
[resolvedSgBrand]: true,
|
|
1399
1442
|
cmd: this.sgPath || "ast-grep",
|
|
1400
1443
|
argsPrefix: this.sgArgsPrefix
|
|
1401
1444
|
};
|
|
1402
1445
|
}
|
|
1446
|
+
/**
|
|
1447
|
+
* THE spawn for a temp-rule scan: it takes a `ResolvedSgCommand`, so the
|
|
1448
|
+
* binary and its (possibly EMPTY) prefix come from this runner's resolution
|
|
1449
|
+
* and nowhere else, and `...this.sgSpawnOptions` isolates the npx case.
|
|
1450
|
+
*/
|
|
1451
|
+
spawnResolved(command, args, options) {
|
|
1452
|
+
return safeSpawnAsync(command.cmd, [...command.argsPrefix, ...args], {
|
|
1453
|
+
...this.sgSpawnOptions,
|
|
1454
|
+
...options
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1403
1457
|
failureForSpawnResult(result) {
|
|
1404
1458
|
if (result.failure === "aborted")
|
|
1405
1459
|
return "aborted";
|
|
@@ -1610,9 +1664,7 @@ Original error: ${stderr}`;
|
|
|
1610
1664
|
try {
|
|
1611
1665
|
({ sessionDir } = this.prepareTempScan(ruleId, ruleYaml));
|
|
1612
1666
|
const configFile = path3.join(sessionDir, ".sgconfig.yml");
|
|
1613
|
-
const
|
|
1614
|
-
const result = await safeSpawnAsync(sgCmd, [
|
|
1615
|
-
...sgPre,
|
|
1667
|
+
const result = await this.spawnResolved(this.getSgCommand(), [
|
|
1616
1668
|
"scan",
|
|
1617
1669
|
"--config",
|
|
1618
1670
|
configFile,
|
|
@@ -1620,7 +1672,6 @@ Original error: ${stderr}`;
|
|
|
1620
1672
|
...sgExcludeArgsForProject(dir),
|
|
1621
1673
|
dir
|
|
1622
1674
|
], {
|
|
1623
|
-
...sgCmd === "npx" ? getIsolatedNpxSpawnOptions() : {},
|
|
1624
1675
|
timeout,
|
|
1625
1676
|
deadlineAt: options.deadlineAt,
|
|
1626
1677
|
signal: options.signal,
|
|
@@ -1647,9 +1698,8 @@ Original error: ${stderr}`;
|
|
|
1647
1698
|
try {
|
|
1648
1699
|
({ sessionDir } = this.prepareTempScan(ruleId, ruleYaml));
|
|
1649
1700
|
const configFile = path3.join(sessionDir, ".sgconfig.yml");
|
|
1650
|
-
const
|
|
1701
|
+
const command = this.getSgCommand();
|
|
1651
1702
|
const scanArgs = [
|
|
1652
|
-
...sgPre,
|
|
1653
1703
|
"scan",
|
|
1654
1704
|
"--config",
|
|
1655
1705
|
configFile,
|
|
@@ -1658,24 +1708,22 @@ Original error: ${stderr}`;
|
|
|
1658
1708
|
dir
|
|
1659
1709
|
];
|
|
1660
1710
|
const spawnOptions = {
|
|
1661
|
-
...sgCmd === "npx" ? getIsolatedNpxSpawnOptions() : {},
|
|
1662
1711
|
timeout,
|
|
1663
1712
|
deadlineAt: options.deadlineAt,
|
|
1664
1713
|
signal: options.signal,
|
|
1665
1714
|
maxOutputBytes: MAX_SG_OUTPUT_BYTES
|
|
1666
1715
|
};
|
|
1667
1716
|
if (!applyFixes) {
|
|
1668
|
-
const result = await
|
|
1717
|
+
const result = await this.spawnResolved(command, scanArgs, spawnOptions);
|
|
1669
1718
|
const scan2 = this.interpretScanResult(result, ["scan"]);
|
|
1670
1719
|
return scan2.failure || scan2.error ? { matches: [], error: scan2.error } : { matches: scan2.matches };
|
|
1671
1720
|
}
|
|
1672
|
-
const jsonResult = await
|
|
1721
|
+
const jsonResult = await this.spawnResolved(command, scanArgs, spawnOptions);
|
|
1673
1722
|
const scan = this.interpretScanResult(jsonResult, ["scan"]);
|
|
1674
1723
|
if (scan.failure || scan.error) {
|
|
1675
1724
|
return { matches: [], error: scan.error };
|
|
1676
1725
|
}
|
|
1677
|
-
const applyResult = await
|
|
1678
|
-
...sgPre,
|
|
1726
|
+
const applyResult = await this.spawnResolved(command, [
|
|
1679
1727
|
"scan",
|
|
1680
1728
|
"--config",
|
|
1681
1729
|
configFile,
|
|
@@ -1751,7 +1799,7 @@ function reportAstGrepRulesHealth(bundledRuleDir) {
|
|
|
1751
1799
|
function recordAstGrepApply(matches, { lineage, toolCallId, sessionId } = {}) {
|
|
1752
1800
|
const bridge = getMutationBridge();
|
|
1753
1801
|
if (!bridge || matches.length === 0)
|
|
1754
|
-
return;
|
|
1802
|
+
return [];
|
|
1755
1803
|
const rangesByFile = /* @__PURE__ */ new Map();
|
|
1756
1804
|
for (const match of matches) {
|
|
1757
1805
|
const start = (match.range?.start?.line ?? 0) + 1;
|
|
@@ -1762,12 +1810,11 @@ function recordAstGrepApply(matches, { lineage, toolCallId, sessionId } = {}) {
|
|
|
1762
1810
|
else
|
|
1763
1811
|
rangesByFile.set(match.file, [[start, end]]);
|
|
1764
1812
|
}
|
|
1813
|
+
const accepted = [];
|
|
1765
1814
|
for (const [filePath, editRanges] of rangesByFile) {
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
// existing canonical path seam before recordability is checked (#4140).
|
|
1770
|
-
filePath: normalizeFilePath(path4.resolve(process.cwd(), filePath)),
|
|
1815
|
+
const resolved = normalizeFilePath(path4.resolve(process.cwd(), filePath));
|
|
1816
|
+
const recorded = bridge.recordMutation({
|
|
1817
|
+
filePath: resolved,
|
|
1771
1818
|
kind: "edit",
|
|
1772
1819
|
editRanges,
|
|
1773
1820
|
consumer: "ast_grep_replace",
|
|
@@ -1783,7 +1830,10 @@ function recordAstGrepApply(matches, { lineage, toolCallId, sessionId } = {}) {
|
|
|
1783
1830
|
// #4943: the calling session owns the deferred pass of what it rewrote.
|
|
1784
1831
|
...sessionId !== void 0 && { sessionId }
|
|
1785
1832
|
});
|
|
1833
|
+
if (recorded)
|
|
1834
|
+
accepted.push(resolved);
|
|
1786
1835
|
}
|
|
1836
|
+
return accepted;
|
|
1787
1837
|
}
|
|
1788
1838
|
function extractDebugAst(raw) {
|
|
1789
1839
|
const lines = raw.split(/\r?\n/);
|
|
@@ -1862,10 +1912,10 @@ function formatDebugAst(tree, source) {
|
|
|
1862
1912
|
const match = /^([ \t]*)([^ \t(][^(]*)? \((\d+),(\d+)\)-\((\d+),(\d+)\)$/.exec(line);
|
|
1863
1913
|
if (!match)
|
|
1864
1914
|
return line;
|
|
1865
|
-
const [, indent = "", label = "", startLine, startCol,
|
|
1915
|
+
const [, indent = "", label = "", startLine, startCol, endLine2, endCol] = match;
|
|
1866
1916
|
const sl = Number(startLine);
|
|
1867
1917
|
const sc = Number(startCol);
|
|
1868
|
-
const el = Number(
|
|
1918
|
+
const el = Number(endLine2);
|
|
1869
1919
|
const ec = Number(endCol);
|
|
1870
1920
|
const snippet = snippetForRange(source, offsets, sl, sc, el, ec);
|
|
1871
1921
|
return `${indent}${label} [${sl + 1},${sc + 1}] - [${el + 1},${ec + 1}] ${JSON.stringify(snippet)}`;
|
|
@@ -1933,6 +1983,7 @@ var AstGrepClient = class {
|
|
|
1933
1983
|
*/
|
|
1934
1984
|
async replaceWithRule(ruleYaml, paths, apply, options) {
|
|
1935
1985
|
const allMatches = [];
|
|
1986
|
+
const recordWritten = () => apply ? recordAstGrepApply(allMatches, options) : [];
|
|
1936
1987
|
for (const scanPath of paths) {
|
|
1937
1988
|
if (apply) {
|
|
1938
1989
|
const preCheck = await this.tempScanDetailed(scanPath, ruleYaml);
|
|
@@ -1941,7 +1992,8 @@ var AstGrepClient = class {
|
|
|
1941
1992
|
matches: allMatches,
|
|
1942
1993
|
totalMatches: allMatches.length,
|
|
1943
1994
|
applied: false,
|
|
1944
|
-
error: preCheck.error ?? "ast-grep preview failed"
|
|
1995
|
+
error: preCheck.error ?? "ast-grep preview failed",
|
|
1996
|
+
appliedFiles: recordWritten()
|
|
1945
1997
|
};
|
|
1946
1998
|
}
|
|
1947
1999
|
if (preCheck.matches.length === 0) {
|
|
@@ -1949,7 +2001,8 @@ var AstGrepClient = class {
|
|
|
1949
2001
|
matches: [],
|
|
1950
2002
|
totalMatches: 0,
|
|
1951
2003
|
applied: false,
|
|
1952
|
-
stalePreview: true
|
|
2004
|
+
stalePreview: true,
|
|
2005
|
+
appliedFiles: recordWritten()
|
|
1953
2006
|
};
|
|
1954
2007
|
}
|
|
1955
2008
|
}
|
|
@@ -1959,17 +2012,17 @@ var AstGrepClient = class {
|
|
|
1959
2012
|
matches: allMatches,
|
|
1960
2013
|
totalMatches: allMatches.length,
|
|
1961
2014
|
applied: false,
|
|
1962
|
-
error: result.error
|
|
2015
|
+
error: result.error,
|
|
2016
|
+
appliedFiles: recordWritten()
|
|
1963
2017
|
};
|
|
1964
2018
|
}
|
|
1965
2019
|
allMatches.push(...result.matches);
|
|
1966
2020
|
}
|
|
1967
|
-
if (apply)
|
|
1968
|
-
recordAstGrepApply(allMatches, options);
|
|
1969
2021
|
return {
|
|
1970
2022
|
matches: allMatches,
|
|
1971
2023
|
totalMatches: allMatches.length,
|
|
1972
|
-
applied: apply
|
|
2024
|
+
applied: apply,
|
|
2025
|
+
appliedFiles: recordWritten()
|
|
1973
2026
|
};
|
|
1974
2027
|
}
|
|
1975
2028
|
/**
|
|
@@ -2232,13 +2285,14 @@ var AstGrepClient = class {
|
|
|
2232
2285
|
error: applyResult.error
|
|
2233
2286
|
};
|
|
2234
2287
|
}
|
|
2235
|
-
recordAstGrepApply(preCheck.matches, options);
|
|
2288
|
+
const appliedFiles = recordAstGrepApply(preCheck.matches, options);
|
|
2236
2289
|
return {
|
|
2237
2290
|
matches: preCheck.matches,
|
|
2238
2291
|
totalMatches: preCheck.totalMatches,
|
|
2239
2292
|
truncated: preCheck.truncated,
|
|
2240
2293
|
applied: true,
|
|
2241
|
-
error: void 0
|
|
2294
|
+
error: void 0,
|
|
2295
|
+
appliedFiles
|
|
2242
2296
|
};
|
|
2243
2297
|
}
|
|
2244
2298
|
/**
|
|
@@ -2998,30 +3052,29 @@ async function buildBootstrapClients() {
|
|
|
2998
3052
|
return [];
|
|
2999
3053
|
}
|
|
3000
3054
|
}
|
|
3001
|
-
const [ruffClient, biomeClient, knipClient, todoScanner, jscpdClient, depChecker, testRunnerClient,
|
|
3002
|
-
load("ruff", async () => new (await import("../chunk-
|
|
3003
|
-
load("biome", async () => new (await import("../chunk-
|
|
3004
|
-
load("knip", async () => new (await import("../chunk-
|
|
3005
|
-
load("todo", async () => new (await import("../chunk-
|
|
3006
|
-
load("jscpd", async () => new (await import("../chunk-
|
|
3007
|
-
load("dependency-checker", async () => new (await import("../chunk-
|
|
3008
|
-
load("test-runner", async () => new (await import("../chunk-
|
|
3009
|
-
load("
|
|
3010
|
-
load("complexity", async () => new (await import("../chunk-YHGYAEFH.js")).ComplexityClient()),
|
|
3055
|
+
const [ruffClient, biomeClient, knipClient, todoScanner, jscpdClient, depChecker, testRunnerClient, complexityClient, goClient, govulncheckClient, gitleaksClient, trivyClient, opengrepClient, rustClient, agentBehaviorClient2, deadCodeClients] = await Promise.all([
|
|
3056
|
+
load("ruff", async () => new (await import("../chunk-XKFO2SZV.js")).RuffClient()),
|
|
3057
|
+
load("biome", async () => new (await import("../chunk-LWOM6LVS.js")).BiomeClient()),
|
|
3058
|
+
load("knip", async () => new (await import("../chunk-FRUBVFXV.js")).KnipClient()),
|
|
3059
|
+
load("todo", async () => new (await import("../chunk-C3YRO3EU.js")).TodoScanner()),
|
|
3060
|
+
load("jscpd", async () => new (await import("../chunk-KV6GQOGN.js")).JscpdClient()),
|
|
3061
|
+
load("dependency-checker", async () => new (await import("../chunk-QJJKOHLH.js")).DependencyChecker()),
|
|
3062
|
+
load("test-runner", async () => new (await import("../chunk-T5QSLSMM.js")).TestRunnerClient()),
|
|
3063
|
+
load("complexity", async () => new (await import("../chunk-4ENEJHF4.js")).ComplexityClient()),
|
|
3011
3064
|
// The process-wide singleton, NOT a fresh instance (#2455 fix round 4,
|
|
3012
3065
|
// F2). `handleSessionStart` reads this object for its "Active tools"
|
|
3013
3066
|
// line while `resetGoAvailability` re-arms the singleton's latch; a
|
|
3014
3067
|
// second instance here meant the reset never reached the surface a
|
|
3015
3068
|
// user actually sees.
|
|
3016
|
-
load("go", async () => (await import("../chunk-
|
|
3017
|
-
load("govulncheck", async () => new (await import("../chunk-
|
|
3018
|
-
load("gitleaks", async () => new (await import("../chunk-
|
|
3019
|
-
load("trivy", async () => new (await import("../chunk-
|
|
3020
|
-
load("opengrep", async () => new (await import("../chunk-
|
|
3069
|
+
load("go", async () => (await import("../chunk-TYHPVE5H.js")).goClient),
|
|
3070
|
+
load("govulncheck", async () => new (await import("../chunk-KR5VGMVT.js")).GovulncheckClient()),
|
|
3071
|
+
load("gitleaks", async () => new (await import("../chunk-G22UNQID.js")).GitleaksClient()),
|
|
3072
|
+
load("trivy", async () => new (await import("../chunk-QP33NKYC.js")).TrivyClient()),
|
|
3073
|
+
load("opengrep", async () => new (await import("../chunk-CJS6WE66.js")).OpengrepClient()),
|
|
3021
3074
|
// The process-wide singleton, for the same reason as "go" above.
|
|
3022
|
-
load("rust", async () => (await import("../chunk-
|
|
3023
|
-
load("agent-behavior", async () => (await import("../chunk-
|
|
3024
|
-
loadList("dead-code", async () => (await import("../chunk-
|
|
3075
|
+
load("rust", async () => (await import("../chunk-Q6JQKWPK.js")).rustClient),
|
|
3076
|
+
load("agent-behavior", async () => (await import("../chunk-UC5AXW5Z.js")).agentBehaviorClient),
|
|
3077
|
+
loadList("dead-code", async () => (await import("../chunk-N5CEGQPG.js")).getDeadCodeClients())
|
|
3025
3078
|
]);
|
|
3026
3079
|
if (failures.length > 0)
|
|
3027
3080
|
await logBootstrapFailures(failures);
|
|
@@ -3033,7 +3086,6 @@ async function buildBootstrapClients() {
|
|
|
3033
3086
|
jscpdClient,
|
|
3034
3087
|
depChecker,
|
|
3035
3088
|
testRunnerClient,
|
|
3036
|
-
metricsClient,
|
|
3037
3089
|
complexityClient,
|
|
3038
3090
|
goClient,
|
|
3039
3091
|
govulncheckClient,
|
|
@@ -3108,7 +3160,7 @@ function resetAnalyzerBootstrapSessionState() {
|
|
|
3108
3160
|
}
|
|
3109
3161
|
|
|
3110
3162
|
// dist/clients/formatters-lazy.js
|
|
3111
|
-
var lazyFormatters = createLazyImport(() => import("../chunk-
|
|
3163
|
+
var lazyFormatters = createLazyImport(() => import("../chunk-GQTQUNCG.js"));
|
|
3112
3164
|
function warmFormatters() {
|
|
3113
3165
|
return lazyFormatters.get();
|
|
3114
3166
|
}
|
|
@@ -3288,48 +3340,6 @@ function appendProjectChangesAllocated(cwd, buildAll) {
|
|
|
3288
3340
|
append(false);
|
|
3289
3341
|
}
|
|
3290
3342
|
|
|
3291
|
-
// dist/clients/inline-blocker-fields.js
|
|
3292
|
-
function inlineBlockerSourceOf(diagnostic) {
|
|
3293
|
-
return diagnostic.tool?.trim() || "unknown";
|
|
3294
|
-
}
|
|
3295
|
-
function inlineBlockerSources(blockers) {
|
|
3296
|
-
return [...new Set(blockers.map(inlineBlockerSourceOf))];
|
|
3297
|
-
}
|
|
3298
|
-
function inlineBlockerLines(blockers, filePath) {
|
|
3299
|
-
return inlineBlockerPlaces(blockers, filePath).map((place) => place.line);
|
|
3300
|
-
}
|
|
3301
|
-
function isCrossFileBlocker(d, filePath) {
|
|
3302
|
-
return !!d.filePath && normalizeEphemeralMapKey(d.filePath) !== normalizeEphemeralMapKey(filePath);
|
|
3303
|
-
}
|
|
3304
|
-
function inlineBlockerPlacement(blockers, filePath) {
|
|
3305
|
-
const places = [];
|
|
3306
|
-
let movedLine = 0;
|
|
3307
|
-
for (const d of blockers) {
|
|
3308
|
-
if (isCrossFileBlocker(d, filePath))
|
|
3309
|
-
continue;
|
|
3310
|
-
if (typeof d.line !== "number")
|
|
3311
|
-
continue;
|
|
3312
|
-
if (d.positionStale) {
|
|
3313
|
-
movedLine += 1;
|
|
3314
|
-
continue;
|
|
3315
|
-
}
|
|
3316
|
-
places.push({
|
|
3317
|
-
line: d.line,
|
|
3318
|
-
rule: d.rule?.trim() || inlineBlockerSourceOf(d)
|
|
3319
|
-
});
|
|
3320
|
-
}
|
|
3321
|
-
return {
|
|
3322
|
-
places,
|
|
3323
|
-
unplaced: {
|
|
3324
|
-
movedLine,
|
|
3325
|
-
noLineInThisFile: blockers.length - places.length - movedLine
|
|
3326
|
-
}
|
|
3327
|
-
};
|
|
3328
|
-
}
|
|
3329
|
-
function inlineBlockerPlaces(blockers, filePath) {
|
|
3330
|
-
return inlineBlockerPlacement(blockers, filePath).places;
|
|
3331
|
-
}
|
|
3332
|
-
|
|
3333
3343
|
// dist/clients/turn-summary.js
|
|
3334
3344
|
var TurnSummaryCollector = class {
|
|
3335
3345
|
filesByKey = /* @__PURE__ */ new Map();
|
|
@@ -3609,6 +3619,16 @@ var RuntimeCoordinator = class {
|
|
|
3609
3619
|
* widening stays separate because it outlives a blocked call's attribution.
|
|
3610
3620
|
*/
|
|
3611
3621
|
_readWidenings = new BoundedLruCache(TOOL_CALL_ATTRIBUTION_CAPACITY);
|
|
3622
|
+
/**
|
|
3623
|
+
* #5120: a call whose `edits` were rewritten to the matched subset of a
|
|
3624
|
+
* partly matching batch, keyed by that call's own `event.input`. pi hands
|
|
3625
|
+
* both hooks one `args` object per call (a fresh clone), so only that
|
|
3626
|
+
* call's `tool_result` finds the record: a call a later handler blocked
|
|
3627
|
+
* or an abort ended gets no `tool_result`, and a later call reusing its id
|
|
3628
|
+
* carries other `args`. The entry dies with its `args`; no id, TTL or
|
|
3629
|
+
* session reset is involved.
|
|
3630
|
+
*/
|
|
3631
|
+
_partialApplies = /* @__PURE__ */ new WeakMap();
|
|
3612
3632
|
_lspReadWarmState = /* @__PURE__ */ new Map();
|
|
3613
3633
|
_pendingInlineBlockers = new PathKeyedMap(normalizeMapKey);
|
|
3614
3634
|
/**
|
|
@@ -5007,9 +5027,14 @@ var RuntimeCoordinator = class {
|
|
|
5007
5027
|
const diagnostics = existing.diagnostics;
|
|
5008
5028
|
if (!diagnostics)
|
|
5009
5029
|
continue;
|
|
5010
|
-
const
|
|
5011
|
-
|
|
5030
|
+
const retired = [];
|
|
5031
|
+
const kept = [];
|
|
5032
|
+
for (const row of diagnostics) {
|
|
5033
|
+
(isCrossFileBlocker(row, existing.filePath) && shouldRetire(row) ? retired : kept).push(row);
|
|
5034
|
+
}
|
|
5035
|
+
if (retired.length === 0)
|
|
5012
5036
|
continue;
|
|
5037
|
+
retireWidgetCitedRows(existing.filePath, retired);
|
|
5013
5038
|
changed.push({
|
|
5014
5039
|
filePath: existing.filePath,
|
|
5015
5040
|
owner: existing.session ?? this._telemetrySessionId
|
|
@@ -5303,6 +5328,17 @@ var RuntimeCoordinator = class {
|
|
|
5303
5328
|
if (attribution)
|
|
5304
5329
|
attribution.fileTimeStale = true;
|
|
5305
5330
|
}
|
|
5331
|
+
/** #5120: see {@link RuntimeCoordinator._partialApplies}. */
|
|
5332
|
+
markToolCallPartialApply(input, pending2) {
|
|
5333
|
+
this._partialApplies.set(input, pending2);
|
|
5334
|
+
}
|
|
5335
|
+
/**
|
|
5336
|
+
* #5120: the partial apply of the call whose `tool_result` carries
|
|
5337
|
+
* `input`. A non-object key is a miss: `WeakMap.get` answers undefined.
|
|
5338
|
+
*/
|
|
5339
|
+
toolCallPartialApply(input) {
|
|
5340
|
+
return this._partialApplies.get(input);
|
|
5341
|
+
}
|
|
5306
5342
|
/**
|
|
5307
5343
|
* One-shot claim of a previously recorded tool-call attribution. Removed
|
|
5308
5344
|
* on read: a given `tool_call`/`tool_result` pair correlates exactly once,
|
|
@@ -6075,18 +6111,8 @@ var UNKNOWN_PROJECT_SEQ = -1;
|
|
|
6075
6111
|
async function readSequenceWithBudget(args) {
|
|
6076
6112
|
const { snapshotRoot, base, cwd, runtime, sessionGeneration, dbg, onDeferredSequenceResolved } = args;
|
|
6077
6113
|
const readPromise = readLatestProjectSequenceAsync(snapshotRoot, base);
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
timeoutHandle = setTimeout(() => resolve32({ timedOut: true }), sequenceReadBudgetMs());
|
|
6081
|
-
timeoutHandle.unref();
|
|
6082
|
-
});
|
|
6083
|
-
const raced = await Promise.race([
|
|
6084
|
-
readPromise.then((latestSeq) => ({ timedOut: false, latestSeq })),
|
|
6085
|
-
timeoutPromise
|
|
6086
|
-
]);
|
|
6087
|
-
if (timeoutHandle)
|
|
6088
|
-
clearTimeout(timeoutHandle);
|
|
6089
|
-
if (!raced.timedOut) {
|
|
6114
|
+
const raced = await withBudget(readPromise.then((latestSeq) => ({ latestSeq })), sequenceReadBudgetMs());
|
|
6115
|
+
if (raced !== void 0) {
|
|
6090
6116
|
return { latestSeq: raced.latestSeq, timedOut: false };
|
|
6091
6117
|
}
|
|
6092
6118
|
dbg(`session_start: sequence read exceeded ${sequenceReadBudgetMs()}ms budget \u2014 falling back to cold-start sequence`);
|
|
@@ -6180,8 +6206,8 @@ async function igniteDominantLanguageWarm(cwd, runtime, sessionGeneration, dbg)
|
|
|
6180
6206
|
if (!runtime.isCurrentSession(sessionGeneration))
|
|
6181
6207
|
return;
|
|
6182
6208
|
const lspService = (await loadLspService()).getLSPService();
|
|
6183
|
-
const { collectSourceFilesAsync } = await import("../chunk-
|
|
6184
|
-
const { CODE_KINDS, detectFileKind: detectFileKind2 } = await import("../chunk-
|
|
6209
|
+
const { collectSourceFilesAsync } = await import("../chunk-NMUSOZ2D.js");
|
|
6210
|
+
const { CODE_KINDS, detectFileKind: detectFileKind2 } = await import("../chunk-NUSXS6YB.js");
|
|
6185
6211
|
const files = await collectSourceFilesAsync(cwd, {
|
|
6186
6212
|
inspectGeneratedHeaders: false
|
|
6187
6213
|
});
|
|
@@ -6255,7 +6281,7 @@ function scheduleManagedToolRefresh(dbg, rulePack) {
|
|
|
6255
6281
|
managedToolRefreshTimer = void 0;
|
|
6256
6282
|
void (async () => {
|
|
6257
6283
|
try {
|
|
6258
|
-
const refresh = await import("../chunk-
|
|
6284
|
+
const refresh = await import("../chunk-N56BNAA6.js");
|
|
6259
6285
|
const outcome = await refresh.runManagedToolRefresh(void 0, {
|
|
6260
6286
|
rulePack
|
|
6261
6287
|
});
|
|
@@ -6305,7 +6331,7 @@ function scanOneTodoFile(scanner, filePath, items) {
|
|
|
6305
6331
|
async function collectTodoBaselineItems(scanner, analysisRoot, stillCurrent) {
|
|
6306
6332
|
const items = [];
|
|
6307
6333
|
try {
|
|
6308
|
-
const { getSourceFilesAsync } = await import("../chunk-
|
|
6334
|
+
const { getSourceFilesAsync } = await import("../chunk-DGKFWQK4.js");
|
|
6309
6335
|
const files = await getSourceFilesAsync(analysisRoot, true);
|
|
6310
6336
|
if (!stillCurrent())
|
|
6311
6337
|
return items;
|
|
@@ -6334,7 +6360,7 @@ async function buildOrRefreshWordIndex(args) {
|
|
|
6334
6360
|
const snapshot = loadProjectSnapshot(snapshotRoot);
|
|
6335
6361
|
const snapshotLoadMs = Date.now() - snapshotLoadStartMs;
|
|
6336
6362
|
if (snapshot?.wordIndex) {
|
|
6337
|
-
const { deserializeWordIndex, refreshWordIndexIncrementally, countWordIndexPostingEntries: countWordIndexPostingEntries2, estimateWordIndexResidentBytes: estimateWordIndexResidentBytes2, notifyWordIndexPublished: notifyWordIndexPublished2 } = await import("../chunk-
|
|
6363
|
+
const { deserializeWordIndex, refreshWordIndexIncrementally, countWordIndexPostingEntries: countWordIndexPostingEntries2, estimateWordIndexResidentBytes: estimateWordIndexResidentBytes2, notifyWordIndexPublished: notifyWordIndexPublished2 } = await import("../chunk-IILEH3ZC.js");
|
|
6338
6364
|
const deserializeStartMs = Date.now();
|
|
6339
6365
|
const index = deserializeWordIndex(snapshot.wordIndex);
|
|
6340
6366
|
const deserializeMs = Date.now() - deserializeStartMs;
|
|
@@ -6407,7 +6433,7 @@ async function buildOrRefreshWordIndex(args) {
|
|
|
6407
6433
|
}
|
|
6408
6434
|
}
|
|
6409
6435
|
}
|
|
6410
|
-
const { buildWordIndexAsync, collectWordIndexDocs, countWordIndexPostingEntries, estimateWordIndexResidentBytes, notifyWordIndexPublished } = await import("../chunk-
|
|
6436
|
+
const { buildWordIndexAsync, collectWordIndexDocs, countWordIndexPostingEntries, estimateWordIndexResidentBytes, notifyWordIndexPublished } = await import("../chunk-IILEH3ZC.js");
|
|
6411
6437
|
const docs = await collectWordIndexDocs(analysisRoot, () => runtime.isCurrentSession(sessionGeneration), rebuildPreflightFiles);
|
|
6412
6438
|
if (!runtime.isCurrentSession(sessionGeneration))
|
|
6413
6439
|
return;
|
|
@@ -6786,9 +6812,9 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
|
|
|
6786
6812
|
});
|
|
6787
6813
|
let callGraphIdentity;
|
|
6788
6814
|
const callGraphTask = runTask("call-graph", async () => {
|
|
6789
|
-
const { FactStore: FactStore2 } = await import("../chunk-
|
|
6790
|
-
const { buildOrUpdateGraph, extractSymbolsAndRefsFromGraph, getReviewGraphCacheIdentity } = await import("../chunk-
|
|
6791
|
-
const { buildCallGraph, saveCallGraph, loadCallGraph: loadCallGraph2 } = await import("../chunk-
|
|
6815
|
+
const { FactStore: FactStore2 } = await import("../chunk-QB7T2PHK.js");
|
|
6816
|
+
const { buildOrUpdateGraph, extractSymbolsAndRefsFromGraph, getReviewGraphCacheIdentity } = await import("../chunk-SLSMJPEF.js");
|
|
6817
|
+
const { buildCallGraph, saveCallGraph, loadCallGraph: loadCallGraph2 } = await import("../chunk-EKNYSXFB.js");
|
|
6792
6818
|
if (!runtime.isCurrentSession(sessionGeneration))
|
|
6793
6819
|
return;
|
|
6794
6820
|
const startMs = Date.now();
|
|
@@ -6829,7 +6855,7 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
|
|
|
6829
6855
|
return;
|
|
6830
6856
|
if (!runtime.callGraph)
|
|
6831
6857
|
return;
|
|
6832
|
-
const { buildCodebaseModel, saveCodebaseModel, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET } = await import("../chunk-
|
|
6858
|
+
const { buildCodebaseModel, saveCodebaseModel, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET } = await import("../chunk-SIQHOB6P.js");
|
|
6833
6859
|
if (!callGraphIdentity)
|
|
6834
6860
|
return;
|
|
6835
6861
|
const model = buildCodebaseModel(runtime.callGraph, analysisRoot, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET, callGraphIdentity);
|
|
@@ -7038,8 +7064,8 @@ async function handleSessionStart(deps) {
|
|
|
7038
7064
|
try {
|
|
7039
7065
|
warmupDbg("warmup: starting background warmup");
|
|
7040
7066
|
const scanContextStartedAt = Date.now();
|
|
7041
|
-
const startupScanModule = await import("../chunk-
|
|
7042
|
-
const languageProfileModule = await import("../chunk-
|
|
7067
|
+
const startupScanModule = await import("../chunk-V2WDBOLZ.js");
|
|
7068
|
+
const languageProfileModule = await import("../chunk-FGNSESAC.js");
|
|
7043
7069
|
const warmupSnapshotRoot = resolveSnapshotRoot(warmupCwd);
|
|
7044
7070
|
const cachedSnapshot = loadProjectSnapshot(warmupSnapshotRoot);
|
|
7045
7071
|
warmupOwnSnapshotRead = cachedSnapshot ? {
|
|
@@ -7170,7 +7196,6 @@ async function handleSessionStart(deps) {
|
|
|
7170
7196
|
dbg(`session_start phase ${name}: ${Date.now() - _phaseT}ms`);
|
|
7171
7197
|
_phaseT = Date.now();
|
|
7172
7198
|
};
|
|
7173
|
-
deps.bootstrap.peek()?.metricsClient.reset();
|
|
7174
7199
|
getDiagnosticTracker().reset();
|
|
7175
7200
|
clearAllSessions();
|
|
7176
7201
|
runtime.complexityBaselines.clear();
|
|
@@ -8143,9 +8168,9 @@ function assembleReport(cwd, args, records2, stamps) {
|
|
|
8143
8168
|
const reportWarnings = merged.map(({ legacyId: _legacyId, ...rest }) => rest);
|
|
8144
8169
|
const byFile = /* @__PURE__ */ new Map();
|
|
8145
8170
|
for (const warning of reportWarnings) {
|
|
8146
|
-
const
|
|
8147
|
-
|
|
8148
|
-
byFile.set(warning.filePath,
|
|
8171
|
+
const arr2 = byFile.get(warning.filePath) ?? [];
|
|
8172
|
+
arr2.push(warning);
|
|
8173
|
+
byFile.set(warning.filePath, arr2);
|
|
8149
8174
|
}
|
|
8150
8175
|
const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
8151
8176
|
const files = [...byFile.entries()].map(([filePath, warnings]) => ({
|
|
@@ -8493,9 +8518,9 @@ function buildCodeQualityWarningsReport(args) {
|
|
|
8493
8518
|
merged.sort(byDisplayOrder);
|
|
8494
8519
|
const byFile = /* @__PURE__ */ new Map();
|
|
8495
8520
|
for (const warning of merged) {
|
|
8496
|
-
const
|
|
8497
|
-
|
|
8498
|
-
byFile.set(warning.filePath,
|
|
8521
|
+
const arr2 = byFile.get(warning.filePath) ?? [];
|
|
8522
|
+
arr2.push(warning);
|
|
8523
|
+
byFile.set(warning.filePath, arr2);
|
|
8499
8524
|
}
|
|
8500
8525
|
const files = [...byFile.entries()].map(([filePath, warnings]) => ({
|
|
8501
8526
|
filePath,
|
|
@@ -9812,47 +9837,24 @@ function truncateText(value, maxChars) {
|
|
|
9812
9837
|
return value;
|
|
9813
9838
|
return `${value.slice(0, maxChars)}\u2026`;
|
|
9814
9839
|
}
|
|
9815
|
-
var
|
|
9816
|
-
|
|
9840
|
+
var publisher = createBusPublisher(liveEmitter, {
|
|
9841
|
+
module: "lens-events",
|
|
9842
|
+
onUnwired: (eventName) => logExtension({
|
|
9843
|
+
subsystem: "lens-events",
|
|
9844
|
+
level: "warn",
|
|
9845
|
+
message: `lens event dropped (no live bus): ${eventName} \u2014 further drops logged once per process`,
|
|
9846
|
+
metadata: { eventName }
|
|
9847
|
+
})
|
|
9848
|
+
});
|
|
9817
9849
|
function emitLensEvent(eventName, payload) {
|
|
9818
9850
|
setImmediate(() => {
|
|
9819
|
-
|
|
9820
|
-
const resolution = resolveLiveBusEmitter(liveEmitter, () => ({
|
|
9851
|
+
publisher.publish({
|
|
9821
9852
|
event: eventName,
|
|
9822
|
-
cwd:
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
if (!_droppedEmitLogged) {
|
|
9828
|
-
_droppedEmitLogged = true;
|
|
9829
|
-
logExtension({
|
|
9830
|
-
subsystem: "lens-events",
|
|
9831
|
-
level: "warn",
|
|
9832
|
-
message: `lens event dropped (no live bus): ${eventName} \u2014 further drops logged once per process`,
|
|
9833
|
-
metadata: { eventName }
|
|
9834
|
-
});
|
|
9835
|
-
}
|
|
9836
|
-
return;
|
|
9837
|
-
}
|
|
9838
|
-
const cwd = normalizeFilePath(rawCwd);
|
|
9839
|
-
try {
|
|
9840
|
-
resolution.emit(eventName, payload);
|
|
9841
|
-
hasLoggedFailure = false;
|
|
9842
|
-
logBusEvent({ event: eventName, outcome: "emitted", cwd });
|
|
9843
|
-
} catch (err) {
|
|
9844
|
-
logBusEvent({
|
|
9845
|
-
event: eventName,
|
|
9846
|
-
outcome: "emit_failed",
|
|
9847
|
-
cwd,
|
|
9848
|
-
error: String(err),
|
|
9849
|
-
ctxSource: resolution.ctxSource
|
|
9850
|
-
});
|
|
9851
|
-
if (!hasLoggedFailure) {
|
|
9852
|
-
hasLoggedFailure = true;
|
|
9853
|
-
recordStaleBusFailure(eventName, err);
|
|
9854
|
-
}
|
|
9855
|
-
}
|
|
9853
|
+
cwd: payload.cwd ?? process.cwd(),
|
|
9854
|
+
// Inter-extension events are observational. A listener must never break
|
|
9855
|
+
// the pi-lens hook path or delay agent progress.
|
|
9856
|
+
build: () => payload
|
|
9857
|
+
});
|
|
9856
9858
|
});
|
|
9857
9859
|
}
|
|
9858
9860
|
function emitLensTurnFindings(payload) {
|
|
@@ -10616,6 +10618,9 @@ function driftDeliveryCap(staleReason) {
|
|
|
10616
10618
|
function suppressedByDispositionNote(suppressed) {
|
|
10617
10619
|
return suppressed > 0 ? ` (suppressed by disposition: ${suppressed} finding(s))` : "";
|
|
10618
10620
|
}
|
|
10621
|
+
function readLastDelivery(cacheManager2, cwd) {
|
|
10622
|
+
return cacheManager2.readCache("turn-end-findings-last", cwd)?.data;
|
|
10623
|
+
}
|
|
10619
10624
|
async function handleTurnEnd(deps) {
|
|
10620
10625
|
const { ctxCwd, getFlag, dbg, runtime, cacheManager: cacheManager2, knipClient, deadCodeClients, depChecker, testRunnerClient, sessionId, host = "pi", owner, resetLSPService: resetLSPService2, resetFormatService: resetFormatService2 } = deps;
|
|
10621
10626
|
const turnIndexAtDispatch = runtime.turnIndex;
|
|
@@ -10699,7 +10704,7 @@ async function handleTurnEnd(deps) {
|
|
|
10699
10704
|
});
|
|
10700
10705
|
}
|
|
10701
10706
|
resetFormatService2();
|
|
10702
|
-
if (pendingRunnerFindingsSize() === 0 && !runtime.hasResolvedBlockerFiles())
|
|
10707
|
+
if (pendingRunnerFindingsSize() === 0 && !runtime.hasResolvedBlockerFiles() && (runtime.getInlineBlockersSnapshot({ sessionId }).length === 0 || readLastDelivery(cacheManager2, cwd)?.sessionId !== (sessionId ?? runtime.telemetrySessionId)))
|
|
10703
10708
|
return;
|
|
10704
10709
|
}
|
|
10705
10710
|
if (files.length > 0 && (lspIdleResetTimeout || pendingSweepRearm)) {
|
|
@@ -12637,7 +12642,7 @@ ${lines.join("\n")}`;
|
|
|
12637
12642
|
dbg(`turn_end: test delivery staging failed \u2014 ${deliveryErr}`);
|
|
12638
12643
|
}
|
|
12639
12644
|
if (getFlag("lens-guard") && firedSessionId === runtime.telemetrySessionId) {
|
|
12640
|
-
const cleanFiles = resultValues.filter(
|
|
12645
|
+
const cleanFiles = resultValues.filter(isCompletedPassResult).map((value) => value.file);
|
|
12641
12646
|
if (cleanFiles.length > 0) {
|
|
12642
12647
|
clearGitGuardTestFailure(cacheManager2, cwd, runtime, cleanFiles);
|
|
12643
12648
|
}
|
|
@@ -12695,10 +12700,11 @@ ${lines.join("\n")}`;
|
|
|
12695
12700
|
} else if (results.length > 0) {
|
|
12696
12701
|
if (supersededByNewerGeneration("clean "))
|
|
12697
12702
|
return;
|
|
12703
|
+
const completedFiles = resultValues.filter(isCompletedPassResult).map((value) => value.file);
|
|
12698
12704
|
writeTestFindings(
|
|
12699
12705
|
{
|
|
12700
12706
|
...priorTestCache ?? { content: "" },
|
|
12701
|
-
content: "",
|
|
12707
|
+
content: completedFiles.length > 0 ? "" : priorTestCache?.content ?? "",
|
|
12702
12708
|
stale: false,
|
|
12703
12709
|
results: resultValues,
|
|
12704
12710
|
testRunGeneration,
|
|
@@ -12723,10 +12729,17 @@ ${lines.join("\n")}`;
|
|
|
12723
12729
|
} catch (deliveryErr) {
|
|
12724
12730
|
dbg(`turn_end: test delivery staging failed \u2014 ${deliveryErr}`);
|
|
12725
12731
|
}
|
|
12726
|
-
if (getFlag("lens-guard") && firedSessionId === runtime.telemetrySessionId) {
|
|
12727
|
-
clearGitGuardTestFailure(cacheManager2, cwd, runtime,
|
|
12732
|
+
if (completedFiles.length > 0 && getFlag("lens-guard") && firedSessionId === runtime.telemetrySessionId) {
|
|
12733
|
+
clearGitGuardTestFailure(cacheManager2, cwd, runtime, completedFiles);
|
|
12734
|
+
}
|
|
12735
|
+
if (completedFiles.length === 0) {
|
|
12736
|
+
recordDegradationOnce({
|
|
12737
|
+
kind: "test-run-no-completed-result",
|
|
12738
|
+
subject: cwd,
|
|
12739
|
+
reason: "no test target completed with a parsed passing result; the test-failure blocker was left in place"
|
|
12740
|
+
});
|
|
12728
12741
|
}
|
|
12729
|
-
dbg(`turn_end: all tests passed${stale ? " (stale \u2014 turn advanced while tests ran)" : ""}`);
|
|
12742
|
+
dbg(completedFiles.length > 0 ? `turn_end: all tests passed${stale ? " (stale \u2014 turn advanced while tests ran)" : ""}` : "turn_end: no completed test result \u2014 NOT recorded as a clean run; the test-failure blocker is untouched");
|
|
12730
12743
|
}
|
|
12731
12744
|
}).catch(() => {
|
|
12732
12745
|
});
|
|
@@ -12750,8 +12763,8 @@ ${lines.join("\n")}`;
|
|
|
12750
12763
|
} else {
|
|
12751
12764
|
const callGraphStart = Date.now();
|
|
12752
12765
|
try {
|
|
12753
|
-
const { impact, formatImpact, parseSymbolKey } = await import("../chunk-
|
|
12754
|
-
const { callGraphImpactToProjectDiagnostics } = await import("../chunk-
|
|
12766
|
+
const { impact, formatImpact, parseSymbolKey } = await import("../chunk-EKNYSXFB.js");
|
|
12767
|
+
const { callGraphImpactToProjectDiagnostics } = await import("../chunk-ZVCDHYWZ.js");
|
|
12755
12768
|
const impactLines = [];
|
|
12756
12769
|
let callGraphDispositionSuppressed = 0;
|
|
12757
12770
|
const impactFindings = [];
|
|
@@ -13397,7 +13410,7 @@ ${raw}`
|
|
|
13397
13410
|
];
|
|
13398
13411
|
const findingParts = composedParts.map((part) => part.text);
|
|
13399
13412
|
let heldSections = 0;
|
|
13400
|
-
const logTurnEndRow = (
|
|
13413
|
+
const logTurnEndRow = (delivery) => {
|
|
13401
13414
|
let turnResult = "clean";
|
|
13402
13415
|
if (blockerParts.length > 0)
|
|
13403
13416
|
turnResult = "blockers_found";
|
|
@@ -13435,10 +13448,14 @@ ${raw}`
|
|
|
13435
13448
|
widgetDemotedFindingsRetired,
|
|
13436
13449
|
// #4921: a turn whose content the agent already received is not
|
|
13437
13450
|
// re-sent; this row, the turn's only one, is where that is visible.
|
|
13438
|
-
...
|
|
13451
|
+
...delivery === "duplicate" ? { deliverySuppressed: delivery } : {},
|
|
13452
|
+
// #5240: the blockers were staged again for the next prompt, not
|
|
13453
|
+
// suppressed: this row is where a repeat is visible.
|
|
13454
|
+
...delivery === "repeat" ? { blockerRepeat: true } : {}
|
|
13439
13455
|
}
|
|
13440
13456
|
});
|
|
13441
13457
|
};
|
|
13458
|
+
let repeatStaged = false;
|
|
13442
13459
|
if (findingParts.length > 0) {
|
|
13443
13460
|
dbg(`turn_end: ${blockerParts.length} blocker section(s), ${advisoryParts.length} advisory section(s) found, persisting for next context`);
|
|
13444
13461
|
const joined = findingParts.join("\n\n");
|
|
@@ -13481,12 +13498,15 @@ ${raw}`
|
|
|
13481
13498
|
const content = capTurnEndMessage(joined, holdPlan.heldCount);
|
|
13482
13499
|
const countDrivenFileSet = deliveryHolds.some((hold) => hold.skipOnSuppressed === true && holdPlan.reachedParts.some((part) => part.raw === hold.part)) ? files.slice().sort((a, b) => compareOrdinal(a, b)).join("|") : "";
|
|
13483
13500
|
const signature = `${countDrivenFileSet}::${content}`;
|
|
13484
|
-
const last = cacheManager2
|
|
13485
|
-
|
|
13501
|
+
const last = readLastDelivery(cacheManager2, cwd);
|
|
13502
|
+
const duplicate = last?.signature === signature && last?.sessionId === deliverySessionId && // #3813: a retirement is an event, not a persisting finding. The
|
|
13486
13503
|
// coordinator already consumed these entries, so an identical
|
|
13487
13504
|
// second retirement on consecutive turns (same file, count and
|
|
13488
13505
|
// ordinal) would be consumed and never shown (#3776 verify r3 F6).
|
|
13489
|
-
resolvedBlockerFileList.length === 0
|
|
13506
|
+
resolvedBlockerFileList.length === 0;
|
|
13507
|
+
const waiting = duplicate ? readTurnEndGuardRecord(cacheManager2, runtime, cwd, sessionId).stored : void 0;
|
|
13508
|
+
const repeatContent = duplicate && blockerParts.length > 0 && deps.deliveryAddress === void 0 && !(waiting && waiting.consumed !== true && waiting.repeat !== true) ? blockerRepeatContent(capTurnEndMessage(blockerParts.join("\n\n"))) : void 0;
|
|
13509
|
+
if (duplicate && repeatContent === void 0) {
|
|
13490
13510
|
dbg("turn_end: duplicate findings detected (same session), suppressing re-prompt");
|
|
13491
13511
|
if (getFlag("lens-guard")) {
|
|
13492
13512
|
const { stored: existingGuard2, carried: carried2, dropped: dropped2 } = readTurnEndGuardRecord(cacheManager2, runtime, cwd, sessionId);
|
|
@@ -13531,7 +13551,9 @@ ${raw}`
|
|
|
13531
13551
|
resetFormatService2();
|
|
13532
13552
|
return;
|
|
13533
13553
|
}
|
|
13534
|
-
settleHolds(
|
|
13554
|
+
settleHolds(repeatContent !== void 0);
|
|
13555
|
+
const stagedContent = repeatContent ?? content;
|
|
13556
|
+
repeatStaged = repeatContent !== void 0;
|
|
13535
13557
|
const fileSeqByPath2 = {};
|
|
13536
13558
|
for (const [filePath, seq] of runtime.getFileSeqEntries()) {
|
|
13537
13559
|
fileSeqByPath2[normalizeMapKey(path24.resolve(filePath))] = seq;
|
|
@@ -13583,7 +13605,7 @@ ${raw}`
|
|
|
13583
13605
|
] : [];
|
|
13584
13606
|
const blockers = blockerPartitionFields([...own, ...carried]);
|
|
13585
13607
|
writeGitGuardRecord(cacheManager2, runtime, cwd, {
|
|
13586
|
-
content: [
|
|
13608
|
+
content: [stagedContent, existingGuard?.testFailureContent].filter((value) => !!value).join("\n\n"),
|
|
13587
13609
|
blockerContent: blockers.blockerContent,
|
|
13588
13610
|
blockingFiles: blockers.blockingFiles,
|
|
13589
13611
|
carriedBlockers: blockers.carriedBlockers,
|
|
@@ -13600,6 +13622,7 @@ ${raw}`
|
|
|
13600
13622
|
fileSeqByPath: fileSeqByPath2,
|
|
13601
13623
|
fileContentHashes: {},
|
|
13602
13624
|
consumed: false,
|
|
13625
|
+
...repeatContent === void 0 ? {} : { repeat: true },
|
|
13603
13626
|
testFailures: existingGuard?.testFailures,
|
|
13604
13627
|
testFailureContent: existingGuard?.testFailureContent,
|
|
13605
13628
|
testFailureFiles: existingGuard?.testFailureFiles
|
|
@@ -13612,7 +13635,8 @@ ${raw}`
|
|
|
13612
13635
|
const affectedFiles = [...new Set(allAffectedFiles)].slice(0, MAX_ADVISORY_AFFECTED_FILES);
|
|
13613
13636
|
const affectedFilesTruncated = new Set(allAffectedFiles).size > affectedFiles.length;
|
|
13614
13637
|
cacheManager2.writeCache("turn-end-findings", {
|
|
13615
|
-
content,
|
|
13638
|
+
content: stagedContent,
|
|
13639
|
+
...repeatContent === void 0 ? {} : { repeat: true },
|
|
13616
13640
|
affectedFiles,
|
|
13617
13641
|
affectedFilesTruncated,
|
|
13618
13642
|
provenance: stampProvenance(affectedFiles, affectedFilesTruncated),
|
|
@@ -13621,22 +13645,26 @@ ${raw}`
|
|
|
13621
13645
|
}, cwd);
|
|
13622
13646
|
}
|
|
13623
13647
|
logCarriedDrops(cwd, dropped);
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13648
|
+
if (repeatContent === void 0) {
|
|
13649
|
+
cacheManager2.writeCache("turn-end-findings-last", {
|
|
13650
|
+
signature,
|
|
13651
|
+
// #4921: the dedupe is per turn session (`last.sessionId` above).
|
|
13652
|
+
sessionId: deliverySessionId,
|
|
13653
|
+
projectSeqStart: runtime.turnStartProjectSeq,
|
|
13654
|
+
projectSeqEnd: runtime.projectSeq
|
|
13655
|
+
}, cwd);
|
|
13656
|
+
emitLensTurnFindings({
|
|
13657
|
+
cwd,
|
|
13658
|
+
filePaths: files.map((file) => resolveRunnerPath(cwd, file)),
|
|
13659
|
+
sessionId: deliverySessionId,
|
|
13660
|
+
turnIndex: runtime.turnIndex,
|
|
13661
|
+
blockerSections: blockerParts.length,
|
|
13662
|
+
advisorySections: advisoryParts.length,
|
|
13663
|
+
content
|
|
13664
|
+
});
|
|
13665
|
+
} else {
|
|
13666
|
+
clearOwnedTurnState();
|
|
13667
|
+
}
|
|
13640
13668
|
}
|
|
13641
13669
|
if (blockerParts.length === 0) {
|
|
13642
13670
|
clearOwnedTurnState();
|
|
@@ -13653,7 +13681,7 @@ ${raw}`
|
|
|
13653
13681
|
if (demotedFindingsRetired > 0) {
|
|
13654
13682
|
cacheManager2.clearCache("turn-end-findings-last", cwd);
|
|
13655
13683
|
}
|
|
13656
|
-
logTurnEndRow();
|
|
13684
|
+
logTurnEndRow(repeatStaged ? "repeat" : void 0);
|
|
13657
13685
|
resetFormatService2();
|
|
13658
13686
|
}
|
|
13659
13687
|
|
|
@@ -14213,9 +14241,9 @@ async function extractFile(absPath, languageId, content) {
|
|
|
14213
14241
|
return { symbols: [], imports: [], callbacks: [], error: message };
|
|
14214
14242
|
}
|
|
14215
14243
|
}
|
|
14216
|
-
function readArgsFor(filePath, startLine,
|
|
14244
|
+
function readArgsFor(filePath, startLine, endLine2) {
|
|
14217
14245
|
const offset = Math.max(1, startLine);
|
|
14218
|
-
const limit = Math.max(1,
|
|
14246
|
+
const limit = Math.max(1, endLine2 - startLine + 1);
|
|
14219
14247
|
return { path: filePath, offset, limit };
|
|
14220
14248
|
}
|
|
14221
14249
|
function resolveUsedBy(graph, symbolNodeId, cap, projectRoot) {
|
|
@@ -14320,7 +14348,7 @@ function coldImports(imports, languageId, absPath, projectRoot) {
|
|
|
14320
14348
|
}
|
|
14321
14349
|
function toEntry(sym, normalizedPath, graph, maxRefs, projectRoot, fileKind) {
|
|
14322
14350
|
const startLine = sym.line;
|
|
14323
|
-
const
|
|
14351
|
+
const endLine2 = sym.endLine ?? sym.line;
|
|
14324
14352
|
const idKind = fileKind === "jsts" ? "function" : sym.kind;
|
|
14325
14353
|
const symbolNodeId = buildSymbolId(normalizedPath, sym.name, idKind, sym.line);
|
|
14326
14354
|
const node = graph?.nodes.get(symbolNodeId);
|
|
@@ -14343,7 +14371,7 @@ function toEntry(sym, normalizedPath, graph, maxRefs, projectRoot, fileKind) {
|
|
|
14343
14371
|
name: sym.name,
|
|
14344
14372
|
kind: sym.kind,
|
|
14345
14373
|
startLine,
|
|
14346
|
-
endLine,
|
|
14374
|
+
endLine: endLine2,
|
|
14347
14375
|
exported,
|
|
14348
14376
|
...sym.visibility ? { visibility: sym.visibility } : {},
|
|
14349
14377
|
...sym.decorators?.length ? { decorators: sym.decorators } : {},
|
|
@@ -14387,30 +14415,49 @@ function nestEntries(entries) {
|
|
|
14387
14415
|
}
|
|
14388
14416
|
return entries.filter((e) => !containerOf.get(e));
|
|
14389
14417
|
}
|
|
14390
|
-
function
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
...entry.
|
|
14398
|
-
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
}
|
|
14418
|
+
function stripEntryMetrics(entry) {
|
|
14419
|
+
const { usedBy: _usedBy, fanout: _fanout, complexity: _complexity, ...kept } = entry;
|
|
14420
|
+
void _usedBy;
|
|
14421
|
+
void _fanout;
|
|
14422
|
+
void _complexity;
|
|
14423
|
+
return {
|
|
14424
|
+
...kept,
|
|
14425
|
+
...entry.members ? { members: entry.members.map(stripEntryMetrics) } : {}
|
|
14426
|
+
};
|
|
14427
|
+
}
|
|
14428
|
+
function projectModuleReport(report, projection) {
|
|
14429
|
+
if (projection === "full")
|
|
14430
|
+
return report;
|
|
14431
|
+
return {
|
|
14432
|
+
...report,
|
|
14433
|
+
api: report.api.map(stripEntryMetrics),
|
|
14434
|
+
internal: report.internal.map(stripEntryMetrics)
|
|
14435
|
+
};
|
|
14436
|
+
}
|
|
14437
|
+
var PRESET_AXES = {
|
|
14438
|
+
"summary-text": { projection: "summary", format: "text" },
|
|
14439
|
+
"summary-json": { projection: "summary", format: "json" },
|
|
14440
|
+
"full-text": { projection: "full", format: "text" },
|
|
14441
|
+
"full-json": { projection: "full", format: "json" }
|
|
14442
|
+
};
|
|
14443
|
+
function resolveModuleReportPreset(view, maxRefsPerSymbol) {
|
|
14444
|
+
const axes = typeof view === "string" && Object.hasOwn(PRESET_AXES, view) ? PRESET_AXES[view] : PRESET_AXES["summary-text"];
|
|
14445
|
+
if (typeof maxRefsPerSymbol === "number" && Number.isFinite(maxRefsPerSymbol)) {
|
|
14446
|
+
const format = axes.format;
|
|
14447
|
+
return {
|
|
14448
|
+
preset: `full-${format}`,
|
|
14449
|
+
projection: "full",
|
|
14450
|
+
format
|
|
14451
|
+
};
|
|
14452
|
+
}
|
|
14453
|
+
const preset = `${axes.projection}-${axes.format}`;
|
|
14454
|
+
return { preset, projection: axes.projection, format: axes.format };
|
|
14455
|
+
}
|
|
14456
|
+
function renderModuleReportPreset(report, choice) {
|
|
14457
|
+
const projected = projectModuleReport(report, choice.projection);
|
|
14458
|
+
return choice.format === "text" ? renderCompactModuleReport(projected, {
|
|
14459
|
+
projection: choice.projection
|
|
14460
|
+
}) : JSON.stringify(projected);
|
|
14414
14461
|
}
|
|
14415
14462
|
function normalizeFocus(focus) {
|
|
14416
14463
|
return (focus ?? "").toLowerCase().split(/[^a-z0-9_.]+/).map((part) => part.trim()).filter((part) => part.length >= 3).slice(0, 8);
|
|
@@ -14495,7 +14542,7 @@ function blastReadArgs(graph, normalizedFile) {
|
|
|
14495
14542
|
return { path: normalizedFile, offset: 1, limit };
|
|
14496
14543
|
}
|
|
14497
14544
|
async function computeBlastRadius(graph, normalizedPath, projectRoot, maxDepth) {
|
|
14498
|
-
const { computeTransitiveImpact } = await import("../chunk-
|
|
14545
|
+
const { computeTransitiveImpact } = await import("../chunk-5GEYJJHG.js");
|
|
14499
14546
|
const result = computeTransitiveImpact(graph, normalizedPath, { maxDepth });
|
|
14500
14547
|
const byFile = /* @__PURE__ */ new Map();
|
|
14501
14548
|
for (const hit of result.hits) {
|
|
@@ -14538,10 +14585,10 @@ function nodeEndLine(node) {
|
|
|
14538
14585
|
function firstLine(text) {
|
|
14539
14586
|
return text.split(/\r?\n/, 1)[0]?.trim() ?? "";
|
|
14540
14587
|
}
|
|
14541
|
-
function findNearestSymbolName(entries, startLine,
|
|
14588
|
+
function findNearestSymbolName(entries, startLine, endLine2) {
|
|
14542
14589
|
let best;
|
|
14543
14590
|
for (const entry of entries) {
|
|
14544
|
-
if (entry.startLine > startLine || entry.endLine <
|
|
14591
|
+
if (entry.startLine > startLine || entry.endLine < endLine2)
|
|
14545
14592
|
continue;
|
|
14546
14593
|
if (!best || entry.endLine - entry.startLine < best.endLine - best.startLine) {
|
|
14547
14594
|
best = entry;
|
|
@@ -14932,12 +14979,12 @@ function extractCallbacks(root, entries, languageId, warnings) {
|
|
|
14932
14979
|
}
|
|
14933
14980
|
if (INLINE_EXECUTABLE_NODE_KINDS.has(node.type)) {
|
|
14934
14981
|
const startLine = nodeLine(node);
|
|
14935
|
-
const
|
|
14982
|
+
const endLine2 = nodeEndLine(node);
|
|
14936
14983
|
const callName = callNameForCallback(node);
|
|
14937
14984
|
const eventName = eventNameForCallback(node);
|
|
14938
14985
|
const propertyName = propertyNameForCallback(node);
|
|
14939
14986
|
const assignedName = assignedNameForCallback(node);
|
|
14940
|
-
const owner = findNearestSymbolName(entries, startLine,
|
|
14987
|
+
const owner = findNearestSymbolName(entries, startLine, endLine2);
|
|
14941
14988
|
const cls = rules.classify({ node, callName, eventName, propertyName, assignedName }, owner);
|
|
14942
14989
|
if (cls.include) {
|
|
14943
14990
|
const base = cls.nameBase ?? (propertyName ? owner ? `${owner}.${propertyName}` : propertyName : assignedName ? owner ? `${owner}.${assignedName}` : assignedName : eventName && callName ? `${callName}(${eventName})` : callName ?? "callback");
|
|
@@ -14946,7 +14993,7 @@ function extractCallbacks(root, entries, languageId, warnings) {
|
|
|
14946
14993
|
kind: cls.kind,
|
|
14947
14994
|
rawKind: node.type,
|
|
14948
14995
|
startLine,
|
|
14949
|
-
endLine,
|
|
14996
|
+
endLine: endLine2,
|
|
14950
14997
|
signature: firstLine(node.text),
|
|
14951
14998
|
...owner ? { parentChain: [owner] } : {},
|
|
14952
14999
|
...cls.flags ? { flags: cls.flags } : {}
|
|
@@ -15112,7 +15159,7 @@ async function moduleReport(file, cwd, options) {
|
|
|
15112
15159
|
let callGraphIdentity;
|
|
15113
15160
|
let revisionDriftNote;
|
|
15114
15161
|
try {
|
|
15115
|
-
const { getCachedReviewGraph, getReviewGraphCacheIdentity, getReviewGraphSizeSkipVerdict, getReviewGraphRevisionDrift, formatReviewGraphRevisionDriftNote: formatReviewGraphRevisionDriftNote2 } = await import("../chunk-
|
|
15162
|
+
const { getCachedReviewGraph, getReviewGraphCacheIdentity, getReviewGraphSizeSkipVerdict, getReviewGraphRevisionDrift, formatReviewGraphRevisionDriftNote: formatReviewGraphRevisionDriftNote2 } = await import("../chunk-SLSMJPEF.js");
|
|
15116
15163
|
graph = getCachedReviewGraph(cwd);
|
|
15117
15164
|
graphFileCap = getReviewGraphSizeSkipVerdict(cwd)?.maxFileCount;
|
|
15118
15165
|
const drift = graph ? getReviewGraphRevisionDrift(cwd) : void 0;
|
|
@@ -15165,9 +15212,6 @@ async function moduleReport(file, cwd, options) {
|
|
|
15165
15212
|
}
|
|
15166
15213
|
const blastRadius = options?.blastRadius && graph && hasGraphNode ? await computeBlastRadius(graph, normalizedPath, cwd, Math.max(1, options.blastRadiusDepth ?? 3)) : void 0;
|
|
15167
15214
|
const callGraph = options?.callGraph ? readCallGraph(cwd, normalizedPath, maxCallGraphEntries, graphFileCap, callGraphIdentity, graph) : void 0;
|
|
15168
|
-
const view = options?.view ?? "default";
|
|
15169
|
-
const summaryView = view === "summary";
|
|
15170
|
-
const compactView = view === "compact";
|
|
15171
15215
|
let importsProvenance = "none";
|
|
15172
15216
|
if (coldImportResult) {
|
|
15173
15217
|
importsProvenance = "syntax";
|
|
@@ -15190,21 +15234,19 @@ async function moduleReport(file, cwd, options) {
|
|
|
15190
15234
|
},
|
|
15191
15235
|
imports,
|
|
15192
15236
|
...warnings.length > 0 ? { warnings } : {},
|
|
15193
|
-
api
|
|
15194
|
-
internal
|
|
15195
|
-
callbacks
|
|
15237
|
+
api,
|
|
15238
|
+
internal,
|
|
15239
|
+
callbacks,
|
|
15196
15240
|
callbackSupport: callbackSupportFor(languageId),
|
|
15197
15241
|
recommendedReads: rankRecommendedReads(entries, callbacks, 5, options?.focus),
|
|
15198
|
-
...
|
|
15199
|
-
...compactView ? { view: "compact" } : {},
|
|
15200
|
-
...blastRadius && !summaryView ? { blastRadius } : {},
|
|
15242
|
+
...blastRadius ? { blastRadius } : {},
|
|
15201
15243
|
...callGraph ? { callGraph } : {},
|
|
15202
15244
|
...graph ? { graphBuiltAt: graph.builtAt } : {},
|
|
15203
15245
|
provenance: {
|
|
15204
15246
|
symbols: languageId ? "syntax" : "none",
|
|
15205
15247
|
imports: importsProvenance,
|
|
15206
15248
|
usedBy: hasGraphNode ? "cached-review-graph" : unavailableGraphProvenance,
|
|
15207
|
-
callbacks: languageId
|
|
15249
|
+
callbacks: languageId ? "heuristic-tree-sitter" : "none",
|
|
15208
15250
|
...options?.blastRadius ? { blastRadius: blastRadiusProvenance } : {},
|
|
15209
15251
|
...options?.callGraph ? { callGraph: callGraphProvenance } : {}
|
|
15210
15252
|
},
|
|
@@ -15217,6 +15259,7 @@ async function moduleReport(file, cwd, options) {
|
|
|
15217
15259
|
implementations: false
|
|
15218
15260
|
}
|
|
15219
15261
|
};
|
|
15262
|
+
const presetChoice = resolveModuleReportPreset(options?.view, options?.maxRefsPerSymbol);
|
|
15220
15263
|
logLatency({
|
|
15221
15264
|
type: "phase",
|
|
15222
15265
|
phase: "module_report",
|
|
@@ -15225,129 +15268,223 @@ async function moduleReport(file, cwd, options) {
|
|
|
15225
15268
|
metadata: {
|
|
15226
15269
|
graph: graph ? "cached" : "cold",
|
|
15227
15270
|
symbols: entries.length,
|
|
15228
|
-
exported: api.length
|
|
15271
|
+
exported: api.length,
|
|
15272
|
+
preset: presetChoice.preset,
|
|
15273
|
+
...typeof options?.view === "string" && options.view.length > 0 && options.view !== presetChoice.preset ? { view: options.view.slice(0, 32) } : {}
|
|
15229
15274
|
}
|
|
15230
15275
|
});
|
|
15231
15276
|
return report;
|
|
15232
15277
|
}
|
|
15233
|
-
function padRange(startLine,
|
|
15234
|
-
return `${startLine}-${
|
|
15235
|
-
}
|
|
15236
|
-
var KIND_ABBREV = {
|
|
15237
|
-
function: "fn",
|
|
15238
|
-
method: "fn",
|
|
15239
|
-
class: "class",
|
|
15240
|
-
interface: "iface",
|
|
15241
|
-
type: "type",
|
|
15242
|
-
variable: "var",
|
|
15243
|
-
property: "prop"
|
|
15244
|
-
};
|
|
15245
|
-
function compactKind(kind) {
|
|
15246
|
-
return KIND_ABBREV[kind] ?? kind;
|
|
15278
|
+
function padRange(startLine, endLine2, width) {
|
|
15279
|
+
return `${startLine}-${endLine2}`.padEnd(width);
|
|
15247
15280
|
}
|
|
15248
|
-
function
|
|
15249
|
-
if (!
|
|
15281
|
+
function compactFlagsSuffix(flags) {
|
|
15282
|
+
if (!flags || flags.length === 0)
|
|
15250
15283
|
return "";
|
|
15251
|
-
|
|
15252
|
-
for (const u of usedBy)
|
|
15253
|
-
counts.set(u.file, (counts.get(u.file) ?? 0) + 1);
|
|
15254
|
-
const parts = [...counts.entries()].map(([file, n]) => n > 1 ? `${file}\xD7${n}` : file);
|
|
15255
|
-
return ` used-by: ${parts.join(", ")}`;
|
|
15284
|
+
return ` ${flags.map((flag) => `[${flag}]`).join(" ")}`;
|
|
15256
15285
|
}
|
|
15257
|
-
function
|
|
15286
|
+
function compactMetricsSuffix(entry) {
|
|
15287
|
+
const parts = [];
|
|
15288
|
+
if (entry.complexity !== void 0)
|
|
15289
|
+
parts.push(`cx:${entry.complexity}`);
|
|
15290
|
+
if (entry.fanout !== void 0)
|
|
15291
|
+
parts.push(`fan:${entry.fanout}`);
|
|
15292
|
+
return parts.length > 0 ? ` ${parts.join(" ")}` : "";
|
|
15293
|
+
}
|
|
15294
|
+
function compactUsedByLines(usedBy, indent) {
|
|
15295
|
+
if (!usedBy || usedBy.length === 0)
|
|
15296
|
+
return [];
|
|
15297
|
+
return usedBy.map((u) => `${indent}used-by: ${u.file} ${u.symbol} ${u.line} ${u.relation}${u.provenance ? ` ${u.provenance}` : ""}${u.resolution ? ` ${u.resolution}` : ""}`);
|
|
15298
|
+
}
|
|
15299
|
+
function compactEntryLines(entry, width, indent) {
|
|
15258
15300
|
const range = padRange(entry.startLine, entry.endLine, width);
|
|
15259
|
-
const kind =
|
|
15301
|
+
const kind = entry.kind.padEnd(10);
|
|
15260
15302
|
const sig = entry.signature ? `${entry.name}${entry.signature}` : entry.name;
|
|
15261
|
-
const flagsSuffix = entry.flags && entry.flags.length > 0 ? ` [${entry.flags.join(", ")}]` : "";
|
|
15262
15303
|
const docSuffix = entry.doc ? ` \u2014 ${entry.doc}` : "";
|
|
15263
|
-
const
|
|
15264
|
-
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15304
|
+
const out = [
|
|
15305
|
+
`${indent}${range}${kind}${sig}${compactMetricsSuffix(entry)}${compactFlagsSuffix(entry.flags)}${docSuffix}`
|
|
15306
|
+
];
|
|
15307
|
+
if (entry.visibility)
|
|
15308
|
+
out.push(`${indent} visibility: ${entry.visibility}`);
|
|
15309
|
+
if (entry.decorators && entry.decorators.length > 0)
|
|
15310
|
+
out.push(`${indent} decorators: ${entry.decorators.join(", ")}`);
|
|
15311
|
+
if (entry.delegationRatio !== void 0)
|
|
15312
|
+
out.push(`${indent} delegationRatio: ${entry.delegationRatio}`);
|
|
15313
|
+
out.push(...compactUsedByLines(entry.usedBy, `${indent} `));
|
|
15314
|
+
for (const member of entry.members ?? [])
|
|
15315
|
+
out.push(...compactEntryLines(member, width, `${indent} `));
|
|
15316
|
+
return out;
|
|
15270
15317
|
}
|
|
15271
|
-
function
|
|
15318
|
+
function compactCallbackLines(callback, width) {
|
|
15272
15319
|
const range = padRange(callback.startLine, callback.endLine, width);
|
|
15273
|
-
const kind = callback.kind.padEnd(
|
|
15274
|
-
const
|
|
15320
|
+
const kind = callback.kind.padEnd(24);
|
|
15321
|
+
const sigSuffix = callback.signature ? ` sig: ${callback.signature}` : "";
|
|
15275
15322
|
const ownerSuffix = callback.parentChain?.length ? ` (in ${callback.parentChain.join(".")})` : "";
|
|
15276
|
-
|
|
15323
|
+
const head = ` ${range}${kind} ${callback.name} raw:${callback.rawKind}${sigSuffix}${compactFlagsSuffix(callback.flags)}${ownerSuffix}`;
|
|
15324
|
+
return [head];
|
|
15325
|
+
}
|
|
15326
|
+
function compactCallGraphRelationLine(relation, role) {
|
|
15327
|
+
const where = `${relation.file}${relation.line !== void 0 ? `:${relation.line}` : ""}`;
|
|
15328
|
+
const what = `${relation.symbol ?? "?"}${relation.kind ? ` (${relation.kind})` : ""}`;
|
|
15329
|
+
const evidence = [
|
|
15330
|
+
relation.evidenceKind ?? "?",
|
|
15331
|
+
relation.resolution ?? "?",
|
|
15332
|
+
relation.evidenceCount !== void 0 ? `n:${relation.evidenceCount}` : "?",
|
|
15333
|
+
relation.weight !== void 0 ? `w:${relation.weight}` : "?"
|
|
15334
|
+
].join(" ");
|
|
15335
|
+
return ` ${role} ${what} ${where} id:${relation.symbolId} -> ${relation.targetSymbolId} ${evidence}`;
|
|
15336
|
+
}
|
|
15337
|
+
function compactCallGraphCoverageLine(coverage) {
|
|
15338
|
+
const counts = [
|
|
15339
|
+
`total:${coverage.totalEvidence ?? "?"}`,
|
|
15340
|
+
`calls:${coverage.callsEvidence ?? "?"}`,
|
|
15341
|
+
`refs:${coverage.referencesEvidence ?? "?"}`,
|
|
15342
|
+
`eligible:${coverage.eligibleEvidence ?? "?"}`,
|
|
15343
|
+
`resolved:${coverage.resolvedEvidence ?? "?"}`,
|
|
15344
|
+
`unresolved:${coverage.unresolvedEvidence ?? "?"}`,
|
|
15345
|
+
`typeOnly:${coverage.typeOnlyEvidence ?? "?"}`,
|
|
15346
|
+
`unsupported:${coverage.unsupportedEvidence ?? "?"}`,
|
|
15347
|
+
`sameFile:${coverage.sameFileEvidence ?? "?"}`,
|
|
15348
|
+
`duplicate:${coverage.duplicateEvidence ?? "?"}`
|
|
15349
|
+
].join(" ");
|
|
15350
|
+
const languages = coverage.languages ? ` langs: ${Object.entries(coverage.languages).map(([language, status]) => `${language}=${status}`).join(",")}` : "";
|
|
15351
|
+
return ` coverage: ${coverage.status} complete:${coverage.complete} ${counts}${languages}`;
|
|
15352
|
+
}
|
|
15353
|
+
function appendCallbacksSection(lines, report, width) {
|
|
15354
|
+
if (report.callbacks.length === 0)
|
|
15355
|
+
return;
|
|
15356
|
+
lines.push("CALLBACKS:");
|
|
15357
|
+
for (const callback of report.callbacks)
|
|
15358
|
+
lines.push(...compactCallbackLines(callback, width));
|
|
15359
|
+
}
|
|
15360
|
+
function appendRecommendedSection(lines, report, width) {
|
|
15361
|
+
if (report.recommendedReads.length === 0)
|
|
15362
|
+
return;
|
|
15363
|
+
lines.push("RECOMMENDED:");
|
|
15364
|
+
for (const r of report.recommendedReads) {
|
|
15365
|
+
lines.push(` ${padRange(r.startLine, r.endLine, width)}${r.symbol ?? ""} \u2014 ${r.reason}`);
|
|
15366
|
+
}
|
|
15367
|
+
}
|
|
15368
|
+
function callbackSupportSuffix(report) {
|
|
15369
|
+
return report.callbackSupport ? ` (callbackSupport: ${report.callbackSupport})` : "";
|
|
15277
15370
|
}
|
|
15278
|
-
function
|
|
15371
|
+
function provenanceLine(report, projection) {
|
|
15372
|
+
const provenanceParts = [];
|
|
15373
|
+
if (report.provenance) {
|
|
15374
|
+
for (const [key, value] of Object.entries(report.provenance)) {
|
|
15375
|
+
if (value !== void 0)
|
|
15376
|
+
provenanceParts.push(`${key}=${String(value)}`);
|
|
15377
|
+
}
|
|
15378
|
+
}
|
|
15379
|
+
if (report.semantic) {
|
|
15380
|
+
for (const [key, value] of Object.entries(report.semantic)) {
|
|
15381
|
+
provenanceParts.push(`semantic.${key}=${String(value)}`);
|
|
15382
|
+
}
|
|
15383
|
+
}
|
|
15384
|
+
provenanceParts.push(`graphBuiltAt=${report.graphBuiltAt ?? "unknown"}`);
|
|
15385
|
+
if (projection === "summary")
|
|
15386
|
+
provenanceParts.push("metrics=omitted (view=full-text)");
|
|
15387
|
+
return `PROVENANCE: ${provenanceParts.join(" ")}`;
|
|
15388
|
+
}
|
|
15389
|
+
function renderCompactModuleReport(report, options = {}) {
|
|
15279
15390
|
if (!report.available) {
|
|
15280
|
-
|
|
15281
|
-
`${report.path} \u2014 unavailable${report.error ? `: ${report.error}` : ""}`,
|
|
15391
|
+
const unavailable = [
|
|
15392
|
+
`${report.path} \u2014 unavailable${report.error ? `: ${report.error}` : ""}${callbackSupportSuffix(report)}`,
|
|
15282
15393
|
...(report.warnings ?? []).map((note) => `WARNING: ${note}`)
|
|
15283
|
-
]
|
|
15394
|
+
];
|
|
15395
|
+
const handleWidth = Math.max(5, ...report.callbacks.map((c) => `${c.startLine}-${c.endLine}`.length)) + 2;
|
|
15396
|
+
appendCallbacksSection(unavailable, report, handleWidth);
|
|
15397
|
+
appendRecommendedSection(unavailable, report, handleWidth);
|
|
15398
|
+
unavailable.push(provenanceLine(report, options.projection));
|
|
15399
|
+
return unavailable.join("\n");
|
|
15284
15400
|
}
|
|
15285
15401
|
const allEntries = [...report.api, ...report.internal];
|
|
15286
15402
|
const allRanges = allEntries.flatMap((e) => [e, ...e.members ?? []]);
|
|
15287
15403
|
const width = Math.max(5, ...allRanges.map((e) => `${e.startLine}-${e.endLine}`.length), ...report.callbacks.map((c) => `${c.startLine}-${c.endLine}`.length)) + 2;
|
|
15288
|
-
const importsList = [...report.imports.internal, ...report.imports.external];
|
|
15289
|
-
const importsSuffix = importsList.length > 0 ? ` | imports: ${importsList.slice(0, 6).map((i) => baseNameNoExt(i)).join(", ")}${importsList.length > 6 ? ", \u2026" : ""}` : "";
|
|
15290
15404
|
const lines = [
|
|
15291
|
-
`${report.path} ${report.language ?? "?"} ${report.lineCount ?? "?"}L \u2014 ${report.summary.symbols} symbols, ${report.summary.exports} exported${
|
|
15405
|
+
`${report.path} ${report.language ?? "?"} ${report.lineCount ?? "?"}L [${report.staleness}] \u2014 ${report.summary.symbols} symbols, ${report.summary.exports} exported, ${report.summary.imports} imports${callbackSupportSuffix(report)}`
|
|
15292
15406
|
];
|
|
15407
|
+
if (report.error)
|
|
15408
|
+
lines.push(`INCOMPLETE: ${report.error}`);
|
|
15293
15409
|
for (const warning of report.warnings ?? []) {
|
|
15294
15410
|
lines.push(`WARNING: ${warning}`);
|
|
15295
15411
|
}
|
|
15296
15412
|
if (report.api.length > 0) {
|
|
15297
15413
|
lines.push("API:");
|
|
15298
|
-
for (const entry of report.api)
|
|
15299
|
-
lines.push(
|
|
15300
|
-
lines.push(...compactMemberLines(entry, width, " "));
|
|
15301
|
-
}
|
|
15414
|
+
for (const entry of report.api)
|
|
15415
|
+
lines.push(...compactEntryLines(entry, width, " "));
|
|
15302
15416
|
}
|
|
15303
15417
|
if (report.internal.length > 0) {
|
|
15304
15418
|
lines.push("INTERNAL:");
|
|
15305
|
-
for (const entry of report.internal)
|
|
15306
|
-
lines.push(
|
|
15307
|
-
lines.push(...compactMemberLines(entry, width, " "));
|
|
15308
|
-
}
|
|
15419
|
+
for (const entry of report.internal)
|
|
15420
|
+
lines.push(...compactEntryLines(entry, width, " "));
|
|
15309
15421
|
}
|
|
15310
|
-
|
|
15311
|
-
|
|
15312
|
-
|
|
15313
|
-
|
|
15314
|
-
|
|
15422
|
+
appendCallbacksSection(lines, report, width);
|
|
15423
|
+
if (report.imports.external.length + report.imports.internal.length > 0) {
|
|
15424
|
+
lines.push("IMPORTS:");
|
|
15425
|
+
if (report.imports.external.length > 0)
|
|
15426
|
+
lines.push(` external: ${report.imports.external.join(", ")}`);
|
|
15427
|
+
if (report.imports.internal.length > 0)
|
|
15428
|
+
lines.push(` internal: ${report.imports.internal.join(", ")}`);
|
|
15315
15429
|
}
|
|
15316
15430
|
if (report.callGraph) {
|
|
15317
15431
|
const callGraph = report.callGraph;
|
|
15318
|
-
|
|
15319
|
-
lines.push("CALL GRAPH:");
|
|
15432
|
+
lines.push(`CALL GRAPH:${callGraph.truncated ? " (truncated)" : ""}`);
|
|
15320
15433
|
if (!callGraph.available) {
|
|
15321
15434
|
lines.push(` unavailable (${callGraph.reason ?? "unknown"})`);
|
|
15322
15435
|
} else {
|
|
15323
|
-
lines.push(` callers: ${callGraph.callers.length} \xB7 callees: ${callGraph.callees.length} \xB7 coverage: ${callGraph.coverage.status}
|
|
15436
|
+
lines.push(` callers: ${callGraph.callers.length} \xB7 callees: ${callGraph.callees.length} \xB7 coverage: ${callGraph.coverage.status}`);
|
|
15437
|
+
lines.push(compactCallGraphCoverageLine(callGraph.coverage));
|
|
15438
|
+
for (const caller of callGraph.callers)
|
|
15439
|
+
lines.push(compactCallGraphRelationLine(caller, "caller"));
|
|
15440
|
+
for (const callee of callGraph.callees)
|
|
15441
|
+
lines.push(compactCallGraphRelationLine(callee, "callee"));
|
|
15324
15442
|
}
|
|
15325
15443
|
}
|
|
15326
|
-
if (report.
|
|
15327
|
-
|
|
15328
|
-
|
|
15329
|
-
|
|
15444
|
+
if (report.blastRadius) {
|
|
15445
|
+
const blastRadius = report.blastRadius;
|
|
15446
|
+
lines.push(`BLAST RADIUS:${blastRadius.truncated ? " (truncated)" : ""}`);
|
|
15447
|
+
lines.push(` maxDepth: ${blastRadius.maxDepth} truncated: ${blastRadius.truncated}`);
|
|
15448
|
+
for (const file of blastRadius.files) {
|
|
15449
|
+
lines.push(` ${file.file} dependents: ${file.dependents} minDepth: ${file.minDepth} relations: ${file.relations.join(",")} read: ${file.read.path} ${file.read.offset} ${file.read.limit}`);
|
|
15330
15450
|
}
|
|
15331
15451
|
}
|
|
15452
|
+
appendRecommendedSection(lines, report, width);
|
|
15453
|
+
lines.push(provenanceLine(report, options.projection));
|
|
15332
15454
|
return lines.join("\n");
|
|
15333
15455
|
}
|
|
15334
|
-
function baseNameNoExt(p) {
|
|
15335
|
-
const base = p.split(/[\\/]/).pop() ?? p;
|
|
15336
|
-
return base.replace(/\.[^./\\]+$/, "");
|
|
15337
|
-
}
|
|
15338
15456
|
function selectMatch(candidates, kind) {
|
|
15339
15457
|
if (candidates.length === 0)
|
|
15340
15458
|
return {};
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15459
|
+
if (!kind) {
|
|
15460
|
+
const match2 = candidates[0];
|
|
15461
|
+
if (candidates.length <= 1)
|
|
15462
|
+
return { match: match2 };
|
|
15463
|
+
return {
|
|
15464
|
+
match: match2,
|
|
15465
|
+
ambiguous: {
|
|
15466
|
+
count: candidates.length,
|
|
15467
|
+
kinds: [...new Set(candidates.map((c) => c.kind))]
|
|
15468
|
+
}
|
|
15469
|
+
};
|
|
15470
|
+
}
|
|
15471
|
+
const filtered = candidates.filter((c) => c.kind === kind);
|
|
15472
|
+
if (filtered.length === 0) {
|
|
15473
|
+
return {
|
|
15474
|
+
kindMismatch: {
|
|
15475
|
+
requested: kind,
|
|
15476
|
+
available: [...new Set(candidates.map((c) => c.kind))]
|
|
15477
|
+
}
|
|
15478
|
+
};
|
|
15479
|
+
}
|
|
15480
|
+
const match = filtered[0];
|
|
15481
|
+
if (filtered.length <= 1)
|
|
15345
15482
|
return { match };
|
|
15346
15483
|
return {
|
|
15347
15484
|
match,
|
|
15348
15485
|
ambiguous: {
|
|
15349
|
-
count:
|
|
15350
|
-
kinds: [...new Set(
|
|
15486
|
+
count: filtered.length,
|
|
15487
|
+
kinds: [...new Set(filtered.map((c) => c.kind))]
|
|
15351
15488
|
}
|
|
15352
15489
|
};
|
|
15353
15490
|
}
|
|
@@ -15418,9 +15555,14 @@ async function readSymbol(file, symbolName, cwd, options = {}) {
|
|
|
15418
15555
|
let content;
|
|
15419
15556
|
try {
|
|
15420
15557
|
content = fs18.readFileSync(absPath, "utf-8");
|
|
15421
|
-
} catch {
|
|
15558
|
+
} catch (err) {
|
|
15422
15559
|
log(false);
|
|
15423
|
-
return {
|
|
15560
|
+
return {
|
|
15561
|
+
found: false,
|
|
15562
|
+
path: absPath,
|
|
15563
|
+
name: symbolName,
|
|
15564
|
+
error: diagnosticMessage(err)
|
|
15565
|
+
};
|
|
15424
15566
|
}
|
|
15425
15567
|
const kind = detectFileKind(absPath);
|
|
15426
15568
|
const languageId = tsLangForFile(absPath, kind);
|
|
@@ -15442,11 +15584,20 @@ async function readSymbol(file, symbolName, cwd, options = {}) {
|
|
|
15442
15584
|
const qualified = resolveQualifiedMatch(symbols, symbolName, symbolKindFilter);
|
|
15443
15585
|
const unqualifiedMatches = symbols.filter((candidate) => candidate.name === symbolName);
|
|
15444
15586
|
const selection = qualified ?? selectMatch(unqualifiedMatches, symbolKindFilter);
|
|
15587
|
+
if (selection.kindMismatch) {
|
|
15588
|
+
log(false);
|
|
15589
|
+
return {
|
|
15590
|
+
found: false,
|
|
15591
|
+
path: absPath,
|
|
15592
|
+
name: symbolName,
|
|
15593
|
+
error: `Kind "${selection.kindMismatch.requested}" does not match "${symbolName}". Accepted kinds: ${selection.kindMismatch.available.join(", ")}.`
|
|
15594
|
+
};
|
|
15595
|
+
}
|
|
15445
15596
|
if (selection.match) {
|
|
15446
15597
|
const sym = selection.match;
|
|
15447
15598
|
const startLine = sym.docStartLine ?? sym.line;
|
|
15448
|
-
const
|
|
15449
|
-
const source2 = lines.slice(startLine - 1,
|
|
15599
|
+
const endLine2 = sym.endLine ?? sym.line;
|
|
15600
|
+
const source2 = lines.slice(startLine - 1, endLine2).join("\n");
|
|
15450
15601
|
log(true);
|
|
15451
15602
|
return {
|
|
15452
15603
|
found: true,
|
|
@@ -15454,7 +15605,7 @@ async function readSymbol(file, symbolName, cwd, options = {}) {
|
|
|
15454
15605
|
name: sym.name,
|
|
15455
15606
|
kind: sym.kind,
|
|
15456
15607
|
startLine,
|
|
15457
|
-
endLine,
|
|
15608
|
+
endLine: endLine2,
|
|
15458
15609
|
signature: sym.signature,
|
|
15459
15610
|
source: source2,
|
|
15460
15611
|
...selection.ambiguous ? { ambiguous: selection.ambiguous } : {}
|
|
@@ -15495,6 +15646,15 @@ async function readSymbol(file, symbolName, cwd, options = {}) {
|
|
|
15495
15646
|
...suggestions.length > 0 ? { suggestions } : {}
|
|
15496
15647
|
};
|
|
15497
15648
|
}
|
|
15649
|
+
if (symbolKindFilter && callback.kind !== symbolKindFilter) {
|
|
15650
|
+
log(false);
|
|
15651
|
+
return {
|
|
15652
|
+
found: false,
|
|
15653
|
+
path: absPath,
|
|
15654
|
+
name: symbolName,
|
|
15655
|
+
error: `Kind "${symbolKindFilter}" does not match "${symbolName}". Accepted kinds: ${callback.kind}.`
|
|
15656
|
+
};
|
|
15657
|
+
}
|
|
15498
15658
|
const source = lines.slice(callback.startLine - 1, callback.endLine).join("\n");
|
|
15499
15659
|
log(true);
|
|
15500
15660
|
return {
|
|
@@ -15540,20 +15700,20 @@ function symbolParentChain(symbol, symbols) {
|
|
|
15540
15700
|
}).sort((a, b) => a.line - b.line || (b.endLine ?? b.line) - b.line - ((a.endLine ?? a.line) - a.line)).map((candidate) => candidate.name);
|
|
15541
15701
|
return chain.length > 0 ? chain : void 0;
|
|
15542
15702
|
}
|
|
15543
|
-
function clampSliceRange(targetLine, startLine,
|
|
15544
|
-
const boundedLimit = Math.max(1, Math.min(
|
|
15703
|
+
function clampSliceRange(targetLine, startLine, endLine2, limit) {
|
|
15704
|
+
const boundedLimit = Math.max(1, Math.min(endLine2 - startLine + 1, limit));
|
|
15545
15705
|
let sliceStart = targetLine - Math.floor(boundedLimit / 2);
|
|
15546
|
-
sliceStart = Math.max(startLine, Math.min(sliceStart,
|
|
15706
|
+
sliceStart = Math.max(startLine, Math.min(sliceStart, endLine2 - boundedLimit + 1));
|
|
15547
15707
|
return { startLine: sliceStart, endLine: sliceStart + boundedLimit - 1 };
|
|
15548
15708
|
}
|
|
15549
15709
|
function enclosingOutline(selected, symbols, callbacks, filters, filePath) {
|
|
15550
15710
|
const items = [];
|
|
15551
15711
|
for (const sym of symbols) {
|
|
15552
15712
|
const startLine = sym.line;
|
|
15553
|
-
const
|
|
15554
|
-
if (startLine === selected.startLine &&
|
|
15713
|
+
const endLine2 = sym.endLine ?? sym.line;
|
|
15714
|
+
if (startLine === selected.startLine && endLine2 === selected.endLine)
|
|
15555
15715
|
continue;
|
|
15556
|
-
if (startLine < selected.startLine ||
|
|
15716
|
+
if (startLine < selected.startLine || endLine2 > selected.endLine)
|
|
15557
15717
|
continue;
|
|
15558
15718
|
if (!symbolMatchesKind(sym.kind, filters))
|
|
15559
15719
|
continue;
|
|
@@ -15561,10 +15721,10 @@ function enclosingOutline(selected, symbols, callbacks, filters, filePath) {
|
|
|
15561
15721
|
name: sym.name,
|
|
15562
15722
|
kind: sym.kind,
|
|
15563
15723
|
startLine,
|
|
15564
|
-
endLine,
|
|
15724
|
+
endLine: endLine2,
|
|
15565
15725
|
signature: sym.signature,
|
|
15566
15726
|
parentChain: symbolParentChain(sym, symbols),
|
|
15567
|
-
read: readArgsFor(filePath, startLine,
|
|
15727
|
+
read: readArgsFor(filePath, startLine, endLine2)
|
|
15568
15728
|
});
|
|
15569
15729
|
}
|
|
15570
15730
|
for (const callback of callbacks) {
|
|
@@ -15636,8 +15796,8 @@ async function readEnclosing(file, line, cwd, options) {
|
|
|
15636
15796
|
const candidates = [];
|
|
15637
15797
|
for (const sym of symbols.filter((candidate) => !candidate.local)) {
|
|
15638
15798
|
const startLine = sym.line;
|
|
15639
|
-
const
|
|
15640
|
-
if (targetLine < startLine || targetLine >
|
|
15799
|
+
const endLine2 = sym.endLine ?? sym.line;
|
|
15800
|
+
if (targetLine < startLine || targetLine > endLine2)
|
|
15641
15801
|
continue;
|
|
15642
15802
|
if (!symbolMatchesKind(sym.kind, filters))
|
|
15643
15803
|
continue;
|
|
@@ -15645,7 +15805,7 @@ async function readEnclosing(file, line, cwd, options) {
|
|
|
15645
15805
|
name: sym.name,
|
|
15646
15806
|
kind: sym.kind,
|
|
15647
15807
|
startLine,
|
|
15648
|
-
endLine,
|
|
15808
|
+
endLine: endLine2,
|
|
15649
15809
|
signature: sym.signature,
|
|
15650
15810
|
parentChain: symbolParentChain(sym, symbols),
|
|
15651
15811
|
priority: 1
|
|
@@ -15905,7 +16065,7 @@ function roleFor(graph, filePath) {
|
|
|
15905
16065
|
return top.length > 0 ? top.map((s) => s.name).join(", ") : void 0;
|
|
15906
16066
|
}
|
|
15907
16067
|
async function computeHubs(graph, degrees, cwd, limit, focusTerms) {
|
|
15908
|
-
const { computeTransitiveImpact } = await import("../chunk-
|
|
16068
|
+
const { computeTransitiveImpact } = await import("../chunk-5GEYJJHG.js");
|
|
15909
16069
|
const ranked = [...graph.fileNodes.entries()].map(([filePath, fileNodeId]) => ({
|
|
15910
16070
|
filePath,
|
|
15911
16071
|
fileNodeId,
|
|
@@ -16156,8 +16316,7 @@ function triggerBackgroundGraphBuild(cwd, deps) {
|
|
|
16156
16316
|
async function projectReport(cwd, options) {
|
|
16157
16317
|
const limit = clampLimit(options?.limit);
|
|
16158
16318
|
const focusTerms = normalizeFocus2(options?.focus);
|
|
16159
|
-
const
|
|
16160
|
-
const { getCachedReviewGraph, getReviewGraphSizeSkipVerdict, getLastReviewGraphBuildAttempt, buildOrUpdateGraph, isGraphBuildInFlight, getReviewGraphRevisionDrift } = await import("../chunk-T2S3FNNJ.js");
|
|
16319
|
+
const { getCachedReviewGraph, getReviewGraphSizeSkipVerdict, getLastReviewGraphBuildAttempt, buildOrUpdateGraph, isGraphBuildInFlight, getReviewGraphRevisionDrift } = await import("../chunk-SLSMJPEF.js");
|
|
16161
16320
|
let graph;
|
|
16162
16321
|
try {
|
|
16163
16322
|
graph = getCachedReviewGraph(cwd);
|
|
@@ -16176,12 +16335,11 @@ async function projectReport(cwd, options) {
|
|
|
16176
16335
|
return {
|
|
16177
16336
|
available: false,
|
|
16178
16337
|
hint: `review graph disabled: project has more than ${sizeSkip.maxFileCount} files (cap ${sizeSkip.maxFileCount}) \u2014 raise maxProjectFiles in .pi-lens.json or set PI_LENS_REVIEW_GRAPH_MAX_FILES; for CI/cron, run npx pi-lens build-graph after configuring the cap`,
|
|
16179
|
-
...lastBuildAttempt3 ? { lastBuildAttempt: lastBuildAttempt3 } : {}
|
|
16180
|
-
...view ? { view } : {}
|
|
16338
|
+
...lastBuildAttempt3 ? { lastBuildAttempt: lastBuildAttempt3 } : {}
|
|
16181
16339
|
};
|
|
16182
16340
|
}
|
|
16183
16341
|
const previousAttempt = getLastReviewGraphBuildAttempt(cwd);
|
|
16184
|
-
const { FactStore: FactStore2 } = await import("../chunk-
|
|
16342
|
+
const { FactStore: FactStore2 } = await import("../chunk-QB7T2PHK.js");
|
|
16185
16343
|
const trigger = triggerBackgroundGraphBuild(cwd, {
|
|
16186
16344
|
buildOrUpdateGraph,
|
|
16187
16345
|
isGraphBuildInFlight,
|
|
@@ -16194,8 +16352,7 @@ async function projectReport(cwd, options) {
|
|
|
16194
16352
|
return {
|
|
16195
16353
|
available: false,
|
|
16196
16354
|
hint: started ? terminal ? `${cause}A retry was started.` : "No review graph cached for this workspace yet \u2014 a build was kicked off in the background; retry this call shortly." : `${cause}A build is already running for this workspace; retry this call shortly.`,
|
|
16197
|
-
...lastBuildAttempt2 ? { lastBuildAttempt: lastBuildAttempt2 } : {}
|
|
16198
|
-
...view ? { view } : {}
|
|
16355
|
+
...lastBuildAttempt2 ? { lastBuildAttempt: lastBuildAttempt2 } : {}
|
|
16199
16356
|
};
|
|
16200
16357
|
}
|
|
16201
16358
|
const degrees = buildFileDegrees(graph);
|
|
@@ -16209,7 +16366,6 @@ async function projectReport(cwd, options) {
|
|
|
16209
16366
|
return {
|
|
16210
16367
|
available: true,
|
|
16211
16368
|
...lastBuildAttempt ? { lastBuildAttempt } : {},
|
|
16212
|
-
...view ? { view } : {},
|
|
16213
16369
|
trust,
|
|
16214
16370
|
hubs,
|
|
16215
16371
|
entryPoints,
|
|
@@ -16218,68 +16374,156 @@ async function projectReport(cwd, options) {
|
|
|
16218
16374
|
deadWeight
|
|
16219
16375
|
};
|
|
16220
16376
|
}
|
|
16221
|
-
function
|
|
16222
|
-
return `${Math.round(n * 100)}%`;
|
|
16223
|
-
}
|
|
16224
|
-
function renderCompactProjectReport(report) {
|
|
16377
|
+
function renderTextProjectReport(report) {
|
|
16225
16378
|
if (!report.available) {
|
|
16226
|
-
|
|
16227
|
-
|
|
16228
|
-
|
|
16229
|
-
|
|
16230
|
-
|
|
16379
|
+
const lines2 = [
|
|
16380
|
+
`project_report \u2014 unavailable${report.hint ? `: ${report.hint}` : ""}`
|
|
16381
|
+
];
|
|
16382
|
+
lines2.push(...renderLastBuildLines(report));
|
|
16383
|
+
lines2.push(renderUnrenderedLine(report));
|
|
16384
|
+
return lines2.join("\n");
|
|
16231
16385
|
}
|
|
16232
16386
|
const t = report.trust;
|
|
16233
|
-
|
|
16234
|
-
|
|
16235
|
-
|
|
16236
|
-
|
|
16387
|
+
const lines = [
|
|
16388
|
+
`project_report \u2014 ${t.filesCovered}/${t.filesTotal} files (${fmtPct(t.coverage)} coverage), built ${t.graphBuiltAt}`,
|
|
16389
|
+
"TRUST:",
|
|
16390
|
+
` built: ${t.graphBuiltAt}`,
|
|
16391
|
+
` coverage: ${t.filesCovered}/${t.filesTotal} (${fmtPct(t.coverage)})`
|
|
16392
|
+
];
|
|
16393
|
+
if (t.resolution.sampleSize > 0) {
|
|
16394
|
+
lines.push(` resolution: exact ${fmtPct(t.resolution.exact)}, import ${fmtPct(t.resolution.import)}, receiver-type ${fmtPct(t.resolution.receiverType)}, name-only ${fmtPct(t.resolution.nameOnly)} (${t.resolution.sampleSize} tagged edges)`);
|
|
16395
|
+
} else {
|
|
16396
|
+
lines.push(" resolution: no resolution-tagged edges yet");
|
|
16397
|
+
}
|
|
16398
|
+
const stalenessNotes = stalenessNotesOf(t);
|
|
16399
|
+
for (const note of t.notes) {
|
|
16400
|
+
if (stalenessNotes.has(note))
|
|
16401
|
+
continue;
|
|
16402
|
+
lines.push(` note: ${note}`);
|
|
16237
16403
|
}
|
|
16238
|
-
|
|
16239
|
-
|
|
16404
|
+
lines.push("HUBS:");
|
|
16405
|
+
if (report.hubs.length === 0) {
|
|
16406
|
+
lines.push(" (none found)");
|
|
16407
|
+
} else {
|
|
16240
16408
|
for (const h of report.hubs) {
|
|
16241
16409
|
const role = h.role ? ` \u2014 ${h.role}` : "";
|
|
16242
|
-
lines.push(` ${h.file}${role}; ${h.fanIn} importer(s),
|
|
16410
|
+
lines.push(` - ${h.file}${role}; ${h.fanIn} importer(s), blast radius ${h.blastRadius}`);
|
|
16243
16411
|
}
|
|
16244
16412
|
}
|
|
16245
|
-
|
|
16246
|
-
|
|
16413
|
+
lines.push("ENTRY POINTS:");
|
|
16414
|
+
if (report.entryPoints.length === 0) {
|
|
16415
|
+
lines.push(" (none found)");
|
|
16416
|
+
} else {
|
|
16247
16417
|
for (const e of report.entryPoints) {
|
|
16248
|
-
lines.push(` ${e.file}; fan-out ${e.fanOut}`);
|
|
16418
|
+
lines.push(` - ${e.file}; fan-out ${e.fanOut}`);
|
|
16249
16419
|
}
|
|
16250
16420
|
}
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16421
|
+
const s = report.subsystems;
|
|
16422
|
+
lines.push("SUBSYSTEMS:", " DIRECTORIES:");
|
|
16423
|
+
if (s.directories.length === 0) {
|
|
16424
|
+
lines.push(" (none)");
|
|
16425
|
+
} else {
|
|
16426
|
+
for (const dir of s.directories)
|
|
16427
|
+
lines.push(` - ${dir}`);
|
|
16428
|
+
}
|
|
16429
|
+
lines.push(" EDGES:");
|
|
16430
|
+
if (s.edges.length === 0) {
|
|
16431
|
+
lines.push(" (none)");
|
|
16432
|
+
} else {
|
|
16433
|
+
for (const edge of s.edges) {
|
|
16434
|
+
lines.push(` - ${edge.from} -> ${edge.to} (${edge.count} edge(s))`);
|
|
16259
16435
|
}
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16263
|
-
|
|
16264
|
-
|
|
16436
|
+
}
|
|
16437
|
+
lines.push(" CYCLES:");
|
|
16438
|
+
if (s.cycles.length === 0) {
|
|
16439
|
+
lines.push(" (none)");
|
|
16440
|
+
} else {
|
|
16441
|
+
for (const c of s.cycles) {
|
|
16442
|
+
lines.push(` - ${c.dirs.join(" <-> ")} (${c.edgeCount} edges)`);
|
|
16265
16443
|
}
|
|
16266
16444
|
}
|
|
16267
|
-
|
|
16268
|
-
|
|
16269
|
-
|
|
16270
|
-
|
|
16445
|
+
lines.push(" LAYERING VIOLATIONS:");
|
|
16446
|
+
if (s.violations.length === 0) {
|
|
16447
|
+
lines.push(" (none)");
|
|
16448
|
+
} else {
|
|
16449
|
+
for (const v of s.violations) {
|
|
16450
|
+
lines.push(` - ${v.from} -> ${v.to} (${v.count} edge(s), against ${v.to} -> ${v.from} ${v.dominantCount} edge(s))`);
|
|
16271
16451
|
}
|
|
16272
16452
|
}
|
|
16273
|
-
|
|
16274
|
-
|
|
16275
|
-
|
|
16276
|
-
|
|
16453
|
+
lines.push("RISK HOTSPOTS:");
|
|
16454
|
+
if (report.riskHotspots.length === 0) {
|
|
16455
|
+
lines.push(" (none found)");
|
|
16456
|
+
} else {
|
|
16457
|
+
for (const r of report.riskHotspots) {
|
|
16458
|
+
lines.push(` - ${r.file}; fan-in ${r.fanIn} x max complexity ${r.maxComplexity} = ${r.score}`);
|
|
16277
16459
|
}
|
|
16278
|
-
if (report.deadWeight.files.length === 0)
|
|
16279
|
-
lines.push(" (none found)");
|
|
16280
16460
|
}
|
|
16461
|
+
lines.push("DEAD WEIGHT:", ` disclaimer: ${report.deadWeight.disclaimer}`);
|
|
16462
|
+
if (report.deadWeight.files.length === 0) {
|
|
16463
|
+
lines.push(" (none found)");
|
|
16464
|
+
} else {
|
|
16465
|
+
for (const d of report.deadWeight.files)
|
|
16466
|
+
lines.push(` - ${d.file}`);
|
|
16467
|
+
}
|
|
16468
|
+
lines.push(...renderLastBuildLines(report));
|
|
16469
|
+
if (stalenessNotes.size > 0) {
|
|
16470
|
+
lines.push("STALENESS:");
|
|
16471
|
+
for (const note of stalenessNotes)
|
|
16472
|
+
lines.push(` - ${note}`);
|
|
16473
|
+
}
|
|
16474
|
+
lines.push(renderUnrenderedLine(report));
|
|
16281
16475
|
return lines.join("\n");
|
|
16282
16476
|
}
|
|
16477
|
+
function stalenessNotesOf(trust) {
|
|
16478
|
+
const owned = /* @__PURE__ */ new Set();
|
|
16479
|
+
for (const note of trust.notes) {
|
|
16480
|
+
if (/^Graph is stale: built \d+m ago\./.test(note))
|
|
16481
|
+
owned.add(note);
|
|
16482
|
+
}
|
|
16483
|
+
if (trust.revisionDrift)
|
|
16484
|
+
owned.add(formatReviewGraphRevisionDriftNote(trust.revisionDrift));
|
|
16485
|
+
return owned;
|
|
16486
|
+
}
|
|
16487
|
+
function renderLastBuildLines(report) {
|
|
16488
|
+
const lines = ["LAST BUILD:"];
|
|
16489
|
+
const attempt = report.lastBuildAttempt;
|
|
16490
|
+
if (!attempt) {
|
|
16491
|
+
lines.push(" no build attempt recorded");
|
|
16492
|
+
return lines;
|
|
16493
|
+
}
|
|
16494
|
+
const reason = attempt.reason ? ` \u2014 ${attempt.reason}` : "";
|
|
16495
|
+
const buildId = attempt.buildId !== void 0 ? ` (build ${attempt.buildId})` : "";
|
|
16496
|
+
lines.push(` ${attempt.outcome} ${attempt.when}${reason}${buildId}`);
|
|
16497
|
+
return lines;
|
|
16498
|
+
}
|
|
16499
|
+
function renderUnrenderedLine(report) {
|
|
16500
|
+
const tokens = [];
|
|
16501
|
+
const leaves = [];
|
|
16502
|
+
collectLeafPaths(report, "report", leaves);
|
|
16503
|
+
if (leaves.some((leaf) => leaf.endsWith(".suggestedNext.tool")))
|
|
16504
|
+
tokens.push("suggestedNext.tool");
|
|
16505
|
+
if (leaves.some((leaf) => leaf.endsWith(".suggestedNext.path")))
|
|
16506
|
+
tokens.push("suggestedNext.path");
|
|
16507
|
+
if (tokens.length === 0)
|
|
16508
|
+
return "UNRENDERED: none \u2014 every artifact field is rendered above";
|
|
16509
|
+
return `UNRENDERED: ${tokens.join(", ")} (per-item module_report navigation hints repeat their item's file path)`;
|
|
16510
|
+
}
|
|
16511
|
+
function collectLeafPaths(value, prefix, out) {
|
|
16512
|
+
if (Array.isArray(value)) {
|
|
16513
|
+
for (const v of value)
|
|
16514
|
+
collectLeafPaths(v, `${prefix}[]`, out);
|
|
16515
|
+
return;
|
|
16516
|
+
}
|
|
16517
|
+
if (value !== null && typeof value === "object") {
|
|
16518
|
+
for (const [k, v] of Object.entries(value))
|
|
16519
|
+
collectLeafPaths(v, prefix ? `${prefix}.${k}` : k, out);
|
|
16520
|
+
return;
|
|
16521
|
+
}
|
|
16522
|
+
out.push(prefix);
|
|
16523
|
+
}
|
|
16524
|
+
function fmtPct(n) {
|
|
16525
|
+
return `${Math.round(n * 100)}%`;
|
|
16526
|
+
}
|
|
16283
16527
|
|
|
16284
16528
|
// dist/clients/effective-config.js
|
|
16285
16529
|
import * as os3 from "node:os";
|
|
@@ -16373,6 +16617,8 @@ async function effectiveConfig(options = {}) {
|
|
|
16373
16617
|
};
|
|
16374
16618
|
const summary = summarizeConfigResolution(resolution, homeDir);
|
|
16375
16619
|
const homeRelativeCwd = homeRelativePath(cwd, homeDir);
|
|
16620
|
+
const lspProblems = newLspConfigProblems();
|
|
16621
|
+
lspConfigOf(resolution.value, lspProblems);
|
|
16376
16622
|
const view = {
|
|
16377
16623
|
cwd: homeRelativeCwd,
|
|
16378
16624
|
documents: summary.documents,
|
|
@@ -16381,7 +16627,13 @@ async function effectiveConfig(options = {}) {
|
|
|
16381
16627
|
// The unknown `dispatch.disabledRunners` ids are records too: the pure
|
|
16382
16628
|
// `disabledRunnersOf` derives them without reporting (this query is not a
|
|
16383
16629
|
// dispatch), so a typo'd id shows here even where notifications are off.
|
|
16384
|
-
|
|
16630
|
+
// The unknown `lsp.disabledServers` ids are the same, through the pure
|
|
16631
|
+
// `disabledServerRecords` (#5141).
|
|
16632
|
+
recordCounts: countBy([
|
|
16633
|
+
...resolution.records,
|
|
16634
|
+
...disabledRunnersOf(resolution).records,
|
|
16635
|
+
...disabledServerRecords(resolution, lspProblems)
|
|
16636
|
+
], (record) => record.code),
|
|
16385
16637
|
tools: LENS_TOOL_NAMES.map((name) => ({
|
|
16386
16638
|
name,
|
|
16387
16639
|
enabled: resolveLensToolEnabled(name, resolved.value, void 0, options.noTools)
|
|
@@ -16539,7 +16791,16 @@ function resourceFootprint() {
|
|
|
16539
16791
|
return getResourceFootprint();
|
|
16540
16792
|
}
|
|
16541
16793
|
function symbolSearchFileMatchesLang(file, lang) {
|
|
16542
|
-
const
|
|
16794
|
+
const token = lang.toLowerCase();
|
|
16795
|
+
const declared = resolveFilenameLanguage(file);
|
|
16796
|
+
if (declared && (declared.id === token || declared.grammar === token)) {
|
|
16797
|
+
return true;
|
|
16798
|
+
}
|
|
16799
|
+
const base = path29.basename(file);
|
|
16800
|
+
if (SPECIAL_FILENAMES.some((entry) => entry.kind === token && entry.pattern.test(base))) {
|
|
16801
|
+
return true;
|
|
16802
|
+
}
|
|
16803
|
+
const exts = extensionsForLanguageToken(token);
|
|
16543
16804
|
if (exts.length === 0)
|
|
16544
16805
|
return false;
|
|
16545
16806
|
return exts.includes(path29.extname(file).toLowerCase());
|
|
@@ -16630,7 +16891,7 @@ async function symbolSearch(query, cwd, limit = 20, options = {}) {
|
|
|
16630
16891
|
warmLease.release();
|
|
16631
16892
|
}
|
|
16632
16893
|
const hits = results.map(toSymbolSearchHit);
|
|
16633
|
-
const { getCachedReviewGraph } = await import("../chunk-
|
|
16894
|
+
const { getCachedReviewGraph } = await import("../chunk-SLSMJPEF.js");
|
|
16634
16895
|
const graph = getCachedReviewGraph(cwd);
|
|
16635
16896
|
if (graph)
|
|
16636
16897
|
annotateSymbolSearchHitsWithGraph(hits, centrality, graph);
|
|
@@ -17168,7 +17429,11 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17168
17429
|
}
|
|
17169
17430
|
],
|
|
17170
17431
|
isError: true,
|
|
17171
|
-
|
|
17432
|
+
// #5244 r4: files an earlier path already rewrote still dispatch.
|
|
17433
|
+
details: {
|
|
17434
|
+
stalePreview: true,
|
|
17435
|
+
appliedFiles: ruleResult.appliedFiles ?? []
|
|
17436
|
+
}
|
|
17172
17437
|
};
|
|
17173
17438
|
}
|
|
17174
17439
|
if (ruleResult.error) {
|
|
@@ -17181,7 +17446,7 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17181
17446
|
}
|
|
17182
17447
|
],
|
|
17183
17448
|
isError: true,
|
|
17184
|
-
details: {}
|
|
17449
|
+
details: { appliedFiles: ruleResult.appliedFiles ?? [] }
|
|
17185
17450
|
};
|
|
17186
17451
|
}
|
|
17187
17452
|
const output2 = astGrepClient2.formatMatches(ruleResult.matches, !applyFlag, true, resultMaxItems);
|
|
@@ -17192,7 +17457,10 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17192
17457
|
content: [{ type: "text", text: output2 }],
|
|
17193
17458
|
details: {
|
|
17194
17459
|
matchCount: ruleResult.matches.length,
|
|
17195
|
-
applied: applyFlag
|
|
17460
|
+
applied: applyFlag,
|
|
17461
|
+
// #5239: the files the apply rewrote, for the `tool_result`
|
|
17462
|
+
// handler's dispatch.
|
|
17463
|
+
appliedFiles: ruleResult.appliedFiles ?? []
|
|
17196
17464
|
}
|
|
17197
17465
|
};
|
|
17198
17466
|
}
|
|
@@ -17238,7 +17506,10 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
17238
17506
|
matchCount: result.matches.length,
|
|
17239
17507
|
totalMatches: result.totalMatches,
|
|
17240
17508
|
truncated: result.truncated,
|
|
17241
|
-
applied: applyFlag
|
|
17509
|
+
applied: applyFlag,
|
|
17510
|
+
// #5239: the files the apply rewrote, for the `tool_result`
|
|
17511
|
+
// handler's dispatch.
|
|
17512
|
+
appliedFiles: result.appliedFiles ?? []
|
|
17242
17513
|
}
|
|
17243
17514
|
};
|
|
17244
17515
|
}
|
|
@@ -18672,7 +18943,7 @@ import * as path37 from "node:path";
|
|
|
18672
18943
|
// dist/clients/out-of-band-changes.js
|
|
18673
18944
|
import { promises as fsp } from "node:fs";
|
|
18674
18945
|
import * as os6 from "node:os";
|
|
18675
|
-
import { basename as
|
|
18946
|
+
import { basename as basename8, join as join17 } from "node:path";
|
|
18676
18947
|
|
|
18677
18948
|
// dist/clients/disk-changes.js
|
|
18678
18949
|
var DISK_CHANGE_ORIGINS = [
|
|
@@ -19354,7 +19625,7 @@ async function lookOnce(root, key, trigger, runtime, options, skipWalk) {
|
|
|
19354
19625
|
changed: count(2),
|
|
19355
19626
|
deleted: count(3),
|
|
19356
19627
|
// The server config files this look forwarded (#4532), by name.
|
|
19357
|
-
configs: configChanges.map((change) => `${CHANGE_TYPE[change.type]}:${
|
|
19628
|
+
configs: configChanges.map((change) => `${CHANGE_TYPE[change.type]}:${basename8(change.filePath)}`)
|
|
19358
19629
|
}
|
|
19359
19630
|
});
|
|
19360
19631
|
}
|
|
@@ -19494,6 +19765,18 @@ function createLspDiagnosticsTool(nextWriteIndex, onConfirmedNoBlockers, getServ
|
|
|
19494
19765
|
const onProgress = makeProgressReporter(onUpdate, "Scanning LSP diagnostics");
|
|
19495
19766
|
const typedParams = params;
|
|
19496
19767
|
const severity = typedParams.severity ?? "all";
|
|
19768
|
+
if (!LSP_SEVERITY_FILTERS.includes(severity)) {
|
|
19769
|
+
return {
|
|
19770
|
+
content: [
|
|
19771
|
+
{
|
|
19772
|
+
type: "text",
|
|
19773
|
+
text: `Unknown severity "${severity}". Accepted tiers: ${LSP_SEVERITY_FILTERS.join(", ")}.`
|
|
19774
|
+
}
|
|
19775
|
+
],
|
|
19776
|
+
isError: true,
|
|
19777
|
+
details: {}
|
|
19778
|
+
};
|
|
19779
|
+
}
|
|
19497
19780
|
const cwd = ctx.cwd ?? process.cwd();
|
|
19498
19781
|
const concurrency = boundedPositiveInt(typedParams.concurrency, DEFAULT_BATCH_CONCURRENCY, 1, MAX_BATCH_CONCURRENCY);
|
|
19499
19782
|
const waitMs = typeof typedParams.waitMs === "number" && typedParams.waitMs >= 0 ? Math.floor(typedParams.waitMs) : void 0;
|
|
@@ -21049,6 +21332,18 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
|
|
|
21049
21332
|
const repaintLspStatus = captureLspStatusRepaint?.(ctx);
|
|
21050
21333
|
const mode = params.mode ?? "delta";
|
|
21051
21334
|
const severity = params.severity ?? "all";
|
|
21335
|
+
if (!LSP_SEVERITY_FILTERS.includes(severity)) {
|
|
21336
|
+
return {
|
|
21337
|
+
content: [
|
|
21338
|
+
{
|
|
21339
|
+
type: "text",
|
|
21340
|
+
text: `Unknown severity "${severity}". Accepted tiers: ${LSP_SEVERITY_FILTERS.join(", ")}.`
|
|
21341
|
+
}
|
|
21342
|
+
],
|
|
21343
|
+
isError: true,
|
|
21344
|
+
details: {}
|
|
21345
|
+
};
|
|
21346
|
+
}
|
|
21052
21347
|
const refreshRunners = params.refreshRunners;
|
|
21053
21348
|
const parsePositiveInt = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : void 0;
|
|
21054
21349
|
const maxProjectFiles = parsePositiveInt(params.maxProjectFiles);
|
|
@@ -21237,19 +21532,19 @@ function applyDeltaFreshnessGate(files, cwd, generatedAt) {
|
|
|
21237
21532
|
});
|
|
21238
21533
|
const byFile = /* @__PURE__ */ new Map();
|
|
21239
21534
|
for (const f of gated.live) {
|
|
21240
|
-
const
|
|
21241
|
-
|
|
21242
|
-
byFile.set(f.filePath,
|
|
21535
|
+
const arr2 = byFile.get(f.filePath) ?? [];
|
|
21536
|
+
arr2.push(f.warning);
|
|
21537
|
+
byFile.set(f.filePath, arr2);
|
|
21243
21538
|
}
|
|
21244
21539
|
for (const f of gated.stale) {
|
|
21245
|
-
const
|
|
21246
|
-
|
|
21540
|
+
const arr2 = byFile.get(f.filePath) ?? [];
|
|
21541
|
+
arr2.push({
|
|
21247
21542
|
...f.warning,
|
|
21248
21543
|
stale: true,
|
|
21249
21544
|
line: void 0,
|
|
21250
21545
|
staleAsOf: effectiveAt
|
|
21251
21546
|
});
|
|
21252
|
-
byFile.set(f.filePath,
|
|
21547
|
+
byFile.set(f.filePath, arr2);
|
|
21253
21548
|
}
|
|
21254
21549
|
return files.map((file) => ({
|
|
21255
21550
|
filePath: file.filePath,
|
|
@@ -22552,7 +22847,7 @@ function finiteNumber(value) {
|
|
|
22552
22847
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
22553
22848
|
}
|
|
22554
22849
|
function lspStatusFromFailureKind(failureKind) {
|
|
22555
|
-
if (failureKind === "success" || failureKind === "fallback_success") {
|
|
22850
|
+
if (failureKind === "success" || failureKind === "fallback_success" || failureKind === "fallback_after_timeout") {
|
|
22556
22851
|
return "success";
|
|
22557
22852
|
}
|
|
22558
22853
|
if (failureKind === "empty_result")
|
|
@@ -22570,6 +22865,8 @@ function lspStatusFromFailureKind(failureKind) {
|
|
|
22570
22865
|
return "filepath_is_directory";
|
|
22571
22866
|
if (failureKind === "tracked_snapshot")
|
|
22572
22867
|
return "tracked_snapshot";
|
|
22868
|
+
if (failureKind === "timeout")
|
|
22869
|
+
return "timeout";
|
|
22573
22870
|
return "error";
|
|
22574
22871
|
}
|
|
22575
22872
|
function lspToolLocationFromUriRange(uri, range) {
|
|
@@ -22578,9 +22875,9 @@ function lspToolLocationFromUriRange(uri, range) {
|
|
|
22578
22875
|
const rangeLike = asRecord(range);
|
|
22579
22876
|
const startLine = finiteNumber(rangeLike?.start?.line);
|
|
22580
22877
|
const startCharacter = finiteNumber(rangeLike?.start?.character);
|
|
22581
|
-
const
|
|
22878
|
+
const endLine2 = finiteNumber(rangeLike?.end?.line);
|
|
22582
22879
|
const endCharacter = finiteNumber(rangeLike?.end?.character);
|
|
22583
|
-
if (startLine === void 0 || startCharacter === void 0 ||
|
|
22880
|
+
if (startLine === void 0 || startCharacter === void 0 || endLine2 === void 0 || endCharacter === void 0) {
|
|
22584
22881
|
return void 0;
|
|
22585
22882
|
}
|
|
22586
22883
|
try {
|
|
@@ -22594,7 +22891,7 @@ function lspToolLocationFromUriRange(uri, range) {
|
|
|
22594
22891
|
character: Math.floor(startCharacter) + 1
|
|
22595
22892
|
},
|
|
22596
22893
|
end: {
|
|
22597
|
-
line: Math.floor(
|
|
22894
|
+
line: Math.floor(endLine2) + 1,
|
|
22598
22895
|
character: Math.floor(endCharacter) + 1
|
|
22599
22896
|
}
|
|
22600
22897
|
}
|
|
@@ -22609,9 +22906,9 @@ function lspToolLocationFromFileRange(filePath, range) {
|
|
|
22609
22906
|
const rangeLike = asRecord(range);
|
|
22610
22907
|
const startLine = finiteNumber(rangeLike?.start?.line);
|
|
22611
22908
|
const startCharacter = finiteNumber(rangeLike?.start?.character);
|
|
22612
|
-
const
|
|
22909
|
+
const endLine2 = finiteNumber(rangeLike?.end?.line);
|
|
22613
22910
|
const endCharacter = finiteNumber(rangeLike?.end?.character);
|
|
22614
|
-
if (startLine === void 0 || startCharacter === void 0 ||
|
|
22911
|
+
if (startLine === void 0 || startCharacter === void 0 || endLine2 === void 0 || endCharacter === void 0) {
|
|
22615
22912
|
return void 0;
|
|
22616
22913
|
}
|
|
22617
22914
|
return {
|
|
@@ -22623,7 +22920,7 @@ function lspToolLocationFromFileRange(filePath, range) {
|
|
|
22623
22920
|
character: Math.floor(startCharacter) + 1
|
|
22624
22921
|
},
|
|
22625
22922
|
end: {
|
|
22626
|
-
line: Math.floor(
|
|
22923
|
+
line: Math.floor(endLine2) + 1,
|
|
22627
22924
|
character: Math.floor(endCharacter) + 1
|
|
22628
22925
|
}
|
|
22629
22926
|
}
|
|
@@ -22742,52 +23039,55 @@ function parseBalancedJsonPrefix(text) {
|
|
|
22742
23039
|
}
|
|
22743
23040
|
return void 0;
|
|
22744
23041
|
}
|
|
22745
|
-
function
|
|
22746
|
-
const
|
|
22747
|
-
const hints = [];
|
|
22748
|
-
const errors = [];
|
|
23042
|
+
function splitLspNavigationTextPayload(text) {
|
|
23043
|
+
const leading = [];
|
|
22749
23044
|
const trimmed = text.trim();
|
|
22750
23045
|
if (!trimmed)
|
|
22751
|
-
return {
|
|
23046
|
+
return { leading, trailing: [], hasResult: false };
|
|
22752
23047
|
try {
|
|
22753
|
-
return {
|
|
23048
|
+
return {
|
|
23049
|
+
leading,
|
|
23050
|
+
trailing: [],
|
|
23051
|
+
hasResult: true,
|
|
23052
|
+
result: JSON.parse(trimmed)
|
|
23053
|
+
};
|
|
22754
23054
|
} catch {
|
|
22755
23055
|
}
|
|
22756
23056
|
const lines = trimmed.split(/\r?\n/);
|
|
22757
|
-
let jsonCandidate = trimmed;
|
|
22758
23057
|
if (/^Note:/i.test(lines[0] ?? "") && lines.length > 1) {
|
|
22759
|
-
|
|
22760
|
-
jsonCandidate = lines.join("\n").trim();
|
|
22761
|
-
}
|
|
22762
|
-
const parsed = parseBalancedJsonPrefix(jsonCandidate);
|
|
22763
|
-
if (parsed) {
|
|
22764
|
-
for (const entry of parsed.rest.split(/\r?\n/)) {
|
|
22765
|
-
const line = entry.trim();
|
|
22766
|
-
if (!line)
|
|
22767
|
-
continue;
|
|
22768
|
-
if (/^Hint:/i.test(line))
|
|
22769
|
-
hints.push(line.replace(/^Hint:\s*/i, ""));
|
|
22770
|
-
else if (/^Note:/i.test(line))
|
|
22771
|
-
notes.push(line.replace(/^Note:\s*/i, ""));
|
|
22772
|
-
else
|
|
22773
|
-
notes.push(line);
|
|
22774
|
-
}
|
|
22775
|
-
return { result: parsed.value, notes, hints, errors };
|
|
23058
|
+
leading.push((lines.shift() ?? "").trim());
|
|
22776
23059
|
}
|
|
22777
|
-
|
|
22778
|
-
|
|
22779
|
-
|
|
22780
|
-
|
|
23060
|
+
const rest = lines.join("\n").trim();
|
|
23061
|
+
if (!rest)
|
|
23062
|
+
return { leading, trailing: [], hasResult: false };
|
|
23063
|
+
const parsed = parseBalancedJsonPrefix(rest);
|
|
23064
|
+
const tail = parsed ? parsed.rest : rest;
|
|
23065
|
+
const trailing = tail.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
23066
|
+
return parsed ? { leading, trailing, hasResult: true, result: parsed.value } : { leading, trailing, hasResult: false };
|
|
23067
|
+
}
|
|
23068
|
+
function parseLspNavigationTextPayload(text) {
|
|
23069
|
+
const split = splitLspNavigationTextPayload(text);
|
|
23070
|
+
const notes = [];
|
|
23071
|
+
const hints = [];
|
|
23072
|
+
const errors = [];
|
|
23073
|
+
for (const line of [...split.leading, ...split.trailing]) {
|
|
22781
23074
|
if (/^Hint:/i.test(line))
|
|
22782
23075
|
hints.push(line.replace(/^Hint:\s*/i, ""));
|
|
22783
23076
|
else if (/^Note:/i.test(line))
|
|
22784
23077
|
notes.push(line.replace(/^Note:\s*/i, ""));
|
|
22785
|
-
else if (/^LSP error:/i.test(line))
|
|
23078
|
+
else if (!split.hasResult && /^LSP error:/i.test(line))
|
|
22786
23079
|
errors.push(line);
|
|
22787
23080
|
else
|
|
22788
23081
|
notes.push(line);
|
|
22789
23082
|
}
|
|
22790
|
-
|
|
23083
|
+
const payload = { notes, hints, errors };
|
|
23084
|
+
if (split.hasResult)
|
|
23085
|
+
payload.result = split.result;
|
|
23086
|
+
return payload;
|
|
23087
|
+
}
|
|
23088
|
+
function lspNavigationTextSurround(text) {
|
|
23089
|
+
const { leading, trailing } = splitLspNavigationTextPayload(text);
|
|
23090
|
+
return { leading, trailing };
|
|
22791
23091
|
}
|
|
22792
23092
|
function withoutUndefined(value) {
|
|
22793
23093
|
for (const key of Object.keys(value)) {
|
|
@@ -22823,6 +23123,423 @@ function buildLspNavigationEnvelope(options) {
|
|
|
22823
23123
|
});
|
|
22824
23124
|
}
|
|
22825
23125
|
|
|
23126
|
+
// dist/tools/lsp-navigation-text.js
|
|
23127
|
+
function rec(value) {
|
|
23128
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
23129
|
+
}
|
|
23130
|
+
function arr(value) {
|
|
23131
|
+
return Array.isArray(value) ? value : [];
|
|
23132
|
+
}
|
|
23133
|
+
function str(value) {
|
|
23134
|
+
return typeof value === "string" ? value : void 0;
|
|
23135
|
+
}
|
|
23136
|
+
function num(value) {
|
|
23137
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
23138
|
+
}
|
|
23139
|
+
function stringArray(value) {
|
|
23140
|
+
return arr(value).filter((entry) => typeof entry === "string");
|
|
23141
|
+
}
|
|
23142
|
+
function symbolKindLabel(kind) {
|
|
23143
|
+
return kind == null ? "symbol" : SYMBOL_KIND_NAMES[kind] ?? "symbol";
|
|
23144
|
+
}
|
|
23145
|
+
function createDisplay(cwd) {
|
|
23146
|
+
const resolveDisplay = createProjectRelativePathResolver(cwd);
|
|
23147
|
+
const file = (filePath) => resolveDisplay(filePath) || filePath;
|
|
23148
|
+
return { file, uri: (uri) => file(uriToDiskPath(uri)) };
|
|
23149
|
+
}
|
|
23150
|
+
function startOf(range) {
|
|
23151
|
+
const start = rec(rec(range)?.start);
|
|
23152
|
+
const line = num(start?.line);
|
|
23153
|
+
if (line === void 0)
|
|
23154
|
+
return void 0;
|
|
23155
|
+
return { line: line + 1, character: (num(start?.character) ?? 0) + 1 };
|
|
23156
|
+
}
|
|
23157
|
+
function endLine(range) {
|
|
23158
|
+
const end = rec(rec(range)?.end);
|
|
23159
|
+
const line = num(end?.line);
|
|
23160
|
+
return line === void 0 ? void 0 : line + 1;
|
|
23161
|
+
}
|
|
23162
|
+
function locationLine(uri, range, display) {
|
|
23163
|
+
const start = startOf(range);
|
|
23164
|
+
if (!start)
|
|
23165
|
+
return void 0;
|
|
23166
|
+
return `${display.uri(uri)}:${start.line}:${start.character}`;
|
|
23167
|
+
}
|
|
23168
|
+
function symbolLine(entry, display) {
|
|
23169
|
+
const location = rec(entry.location);
|
|
23170
|
+
const uri = str(entry.uri) ?? str(location?.uri) ?? str(entry.targetUri);
|
|
23171
|
+
const range = rec(location?.range) ?? rec(entry.selectionRange) ?? rec(entry.range) ?? rec(entry.targetSelectionRange) ?? rec(entry.targetRange);
|
|
23172
|
+
if (!uri || !range)
|
|
23173
|
+
return void 0;
|
|
23174
|
+
const line = locationLine(uri, range, display);
|
|
23175
|
+
if (!line)
|
|
23176
|
+
return void 0;
|
|
23177
|
+
const name = str(entry.name);
|
|
23178
|
+
return name ? `${line} ${symbolKindLabel(num(entry.kind))} ${name}` : line;
|
|
23179
|
+
}
|
|
23180
|
+
function renderLocations(result, display) {
|
|
23181
|
+
const items = Array.isArray(result) ? result : result == null ? [] : [result];
|
|
23182
|
+
const lines = [];
|
|
23183
|
+
for (const item of items) {
|
|
23184
|
+
const entry = rec(item);
|
|
23185
|
+
if (!entry)
|
|
23186
|
+
continue;
|
|
23187
|
+
const uri = str(entry.uri) ?? str(entry.targetUri);
|
|
23188
|
+
const range = rec(entry.targetSelectionRange) ?? rec(entry.targetRange) ?? rec(entry.range);
|
|
23189
|
+
if (!uri || !range)
|
|
23190
|
+
continue;
|
|
23191
|
+
const line = locationLine(uri, range, display);
|
|
23192
|
+
if (line)
|
|
23193
|
+
lines.push(line);
|
|
23194
|
+
}
|
|
23195
|
+
return lines.length > 0 ? lines.join("\n") : void 0;
|
|
23196
|
+
}
|
|
23197
|
+
function renderSymbolList(result, display) {
|
|
23198
|
+
const lines = [];
|
|
23199
|
+
for (const item of arr(result)) {
|
|
23200
|
+
const entry = rec(item);
|
|
23201
|
+
if (!entry)
|
|
23202
|
+
continue;
|
|
23203
|
+
const line = symbolLine(entry, display);
|
|
23204
|
+
if (line)
|
|
23205
|
+
lines.push(line);
|
|
23206
|
+
}
|
|
23207
|
+
return lines.length > 0 ? lines.join("\n") : void 0;
|
|
23208
|
+
}
|
|
23209
|
+
function renderCallHierarchyPreparation(result, display) {
|
|
23210
|
+
const lines = [];
|
|
23211
|
+
for (const item of arr(result)) {
|
|
23212
|
+
const entry = rec(item);
|
|
23213
|
+
if (!entry)
|
|
23214
|
+
continue;
|
|
23215
|
+
const line = symbolLine(entry, display);
|
|
23216
|
+
if (!line)
|
|
23217
|
+
continue;
|
|
23218
|
+
lines.push(line, `callHierarchyItem: ${JSON.stringify(entry)}`);
|
|
23219
|
+
}
|
|
23220
|
+
return lines.length > 0 ? lines.join("\n") : void 0;
|
|
23221
|
+
}
|
|
23222
|
+
function renderCalls(result, display, side, callSiteUri) {
|
|
23223
|
+
const lines = [];
|
|
23224
|
+
for (const item of arr(result)) {
|
|
23225
|
+
const entry = rec(item);
|
|
23226
|
+
const symbol = rec(entry?.[side]);
|
|
23227
|
+
if (!symbol)
|
|
23228
|
+
continue;
|
|
23229
|
+
const line = symbolLine(symbol, display);
|
|
23230
|
+
if (!line)
|
|
23231
|
+
continue;
|
|
23232
|
+
lines.push(line);
|
|
23233
|
+
const siteUri = side === "from" ? str(symbol.uri) : callSiteUri;
|
|
23234
|
+
if (!siteUri)
|
|
23235
|
+
continue;
|
|
23236
|
+
for (const range of arr(entry?.fromRanges)) {
|
|
23237
|
+
const site = locationLine(siteUri, range, display);
|
|
23238
|
+
if (site)
|
|
23239
|
+
lines.push(` ${site}`);
|
|
23240
|
+
}
|
|
23241
|
+
}
|
|
23242
|
+
return lines.length > 0 ? lines.join("\n") : void 0;
|
|
23243
|
+
}
|
|
23244
|
+
function renderDocumentSymbols(result, filePath, display) {
|
|
23245
|
+
const items = arr(result);
|
|
23246
|
+
if (items.length === 0)
|
|
23247
|
+
return void 0;
|
|
23248
|
+
const header = display.file(filePath);
|
|
23249
|
+
const lines = [header];
|
|
23250
|
+
const visit = (entries, depth) => {
|
|
23251
|
+
for (const item of entries) {
|
|
23252
|
+
const entry = rec(item);
|
|
23253
|
+
if (!entry)
|
|
23254
|
+
continue;
|
|
23255
|
+
const range = rec(entry.range) ?? rec(rec(entry.location)?.range);
|
|
23256
|
+
const start = startOf(range);
|
|
23257
|
+
const end = endLine(range);
|
|
23258
|
+
const name = str(entry.name) ?? "";
|
|
23259
|
+
const label = start ? `${start.line}-${end ?? start.line} ${symbolKindLabel(num(entry.kind))} ${name}` : `${symbolKindLabel(num(entry.kind))} ${name}`;
|
|
23260
|
+
lines.push(`${" ".repeat(depth + 1)}${label}`.trimEnd());
|
|
23261
|
+
const children = arr(entry.children);
|
|
23262
|
+
if (children.length > 0)
|
|
23263
|
+
visit(children, depth + 1);
|
|
23264
|
+
}
|
|
23265
|
+
};
|
|
23266
|
+
visit(items, 0);
|
|
23267
|
+
return lines.length > 1 ? lines.join("\n") : void 0;
|
|
23268
|
+
}
|
|
23269
|
+
function renderFindSymbols(result, filePath, display) {
|
|
23270
|
+
const items = arr(result);
|
|
23271
|
+
if (items.length === 0)
|
|
23272
|
+
return void 0;
|
|
23273
|
+
const header = display.file(filePath);
|
|
23274
|
+
const lines = [header];
|
|
23275
|
+
for (const item of items) {
|
|
23276
|
+
const entry = rec(item);
|
|
23277
|
+
if (!entry)
|
|
23278
|
+
continue;
|
|
23279
|
+
const depth = num(entry.depth) ?? 1;
|
|
23280
|
+
const ownLine = num(entry.line);
|
|
23281
|
+
const at = ownLine === void 0 ? startOf(rec(entry.location)?.range) : { line: ownLine, character: num(entry.character) ?? 1 };
|
|
23282
|
+
const where = at ? `${header}:${at.line}:${at.character}` : header;
|
|
23283
|
+
const kind = str(entry.kind) ?? symbolKindLabel(num(entry.kindCode));
|
|
23284
|
+
const name = str(entry.name) ?? "";
|
|
23285
|
+
lines.push(`${" ".repeat(depth)}${where} ${kind} ${name}`.trimEnd());
|
|
23286
|
+
}
|
|
23287
|
+
return lines.length > 1 ? lines.join("\n") : void 0;
|
|
23288
|
+
}
|
|
23289
|
+
function markupText(contents) {
|
|
23290
|
+
if (typeof contents === "string")
|
|
23291
|
+
return contents;
|
|
23292
|
+
if (Array.isArray(contents)) {
|
|
23293
|
+
const parts = contents.map((entry2) => markupText(entry2)).filter((part) => Boolean(part));
|
|
23294
|
+
return parts.length > 0 ? parts.join("\n\n") : void 0;
|
|
23295
|
+
}
|
|
23296
|
+
const entry = rec(contents);
|
|
23297
|
+
const value = str(entry?.value);
|
|
23298
|
+
if (value === void 0)
|
|
23299
|
+
return void 0;
|
|
23300
|
+
const language = str(entry?.language);
|
|
23301
|
+
return language ? `\`\`\`${language}
|
|
23302
|
+
${value}
|
|
23303
|
+
\`\`\`` : value;
|
|
23304
|
+
}
|
|
23305
|
+
function renderHover(result) {
|
|
23306
|
+
const text = markupText(rec(result)?.contents);
|
|
23307
|
+
const trimmed = text?.trim();
|
|
23308
|
+
return trimmed ? trimmed : void 0;
|
|
23309
|
+
}
|
|
23310
|
+
function renderSignatureHelp(result) {
|
|
23311
|
+
const entry = rec(result);
|
|
23312
|
+
if (!entry)
|
|
23313
|
+
return void 0;
|
|
23314
|
+
const signatures = arr(entry.signatures);
|
|
23315
|
+
if (signatures.length === 0)
|
|
23316
|
+
return void 0;
|
|
23317
|
+
const activeIndex = num(entry.activeSignature) ?? 0;
|
|
23318
|
+
const active = rec(signatures[activeIndex]) ?? rec(signatures[0]);
|
|
23319
|
+
if (!active)
|
|
23320
|
+
return void 0;
|
|
23321
|
+
const lines = [];
|
|
23322
|
+
const label = str(active.label);
|
|
23323
|
+
if (label)
|
|
23324
|
+
lines.push(label);
|
|
23325
|
+
const documentation = markupText(active.documentation)?.trim();
|
|
23326
|
+
if (documentation)
|
|
23327
|
+
lines.push(documentation);
|
|
23328
|
+
const activeParameter = num(entry.activeParameter);
|
|
23329
|
+
arr(active.parameters).forEach((parameter, index) => {
|
|
23330
|
+
const parameterLabel = str(rec(parameter)?.label);
|
|
23331
|
+
if (!parameterLabel)
|
|
23332
|
+
return;
|
|
23333
|
+
lines.push(`${index === activeParameter ? "\u2192" : " "} ${parameterLabel}`);
|
|
23334
|
+
});
|
|
23335
|
+
return lines.length > 0 ? lines.join("\n") : void 0;
|
|
23336
|
+
}
|
|
23337
|
+
function renderCodeActions(result) {
|
|
23338
|
+
const lines = [];
|
|
23339
|
+
for (const item of arr(result)) {
|
|
23340
|
+
const entry = rec(item);
|
|
23341
|
+
if (!entry)
|
|
23342
|
+
continue;
|
|
23343
|
+
const title = str(entry.title);
|
|
23344
|
+
if (!title)
|
|
23345
|
+
continue;
|
|
23346
|
+
const kind = str(entry.kind);
|
|
23347
|
+
lines.push(kind ? `${kind} ${title}` : title);
|
|
23348
|
+
}
|
|
23349
|
+
return lines.length > 0 ? lines.join("\n") : void 0;
|
|
23350
|
+
}
|
|
23351
|
+
function renderAppliedEdit(entry, display) {
|
|
23352
|
+
const descriptions = stringArray(entry.descriptions);
|
|
23353
|
+
const files = stringArray(entry.files);
|
|
23354
|
+
const total = num(entry.appliedOperationTotal) ?? num(entry.operationTotal);
|
|
23355
|
+
const lines = [];
|
|
23356
|
+
if (total !== void 0) {
|
|
23357
|
+
const across = files.length > 0 ? ` across ${files.length} file${files.length === 1 ? "" : "s"}` : "";
|
|
23358
|
+
lines.push(`Applied ${total} edit${total === 1 ? "" : "s"}${across}:`);
|
|
23359
|
+
} else {
|
|
23360
|
+
lines.push("Applied:");
|
|
23361
|
+
}
|
|
23362
|
+
if (descriptions.length > 0) {
|
|
23363
|
+
for (const description of descriptions)
|
|
23364
|
+
lines.push(` ${description}`);
|
|
23365
|
+
} else {
|
|
23366
|
+
for (const file of files) {
|
|
23367
|
+
lines.push(` ${display.file(file)}`);
|
|
23368
|
+
}
|
|
23369
|
+
}
|
|
23370
|
+
return lines.length > 1 ? lines.join("\n") : void 0;
|
|
23371
|
+
}
|
|
23372
|
+
function renderRename(result, display) {
|
|
23373
|
+
const entry = rec(result);
|
|
23374
|
+
if (!entry)
|
|
23375
|
+
return void 0;
|
|
23376
|
+
if (entry.applied !== true) {
|
|
23377
|
+
const summary = stringArray(entry.summary);
|
|
23378
|
+
const lines = summary.length > 0 ? summary : ["Rename preview"];
|
|
23379
|
+
lines.push("Preview only \u2014 pass apply:true to write the edits.");
|
|
23380
|
+
return lines.join("\n");
|
|
23381
|
+
}
|
|
23382
|
+
return renderAppliedEdit(entry, display);
|
|
23383
|
+
}
|
|
23384
|
+
function renameFailureLines(entry) {
|
|
23385
|
+
const lines = [];
|
|
23386
|
+
for (const failure of [
|
|
23387
|
+
...arr(entry.willRenameFailures),
|
|
23388
|
+
...arr(entry.didRenameFailures)
|
|
23389
|
+
]) {
|
|
23390
|
+
const row = rec(failure);
|
|
23391
|
+
const serverId = str(row?.serverId);
|
|
23392
|
+
const message = str(row?.error);
|
|
23393
|
+
if (!serverId || !message)
|
|
23394
|
+
continue;
|
|
23395
|
+
const disposition = str(row?.disposition);
|
|
23396
|
+
lines.push(` ${serverId}: ${message}${disposition ? ` (${disposition})` : ""}`);
|
|
23397
|
+
}
|
|
23398
|
+
return lines;
|
|
23399
|
+
}
|
|
23400
|
+
function renderRenameFile(result, display) {
|
|
23401
|
+
const entry = rec(result);
|
|
23402
|
+
if (!entry)
|
|
23403
|
+
return void 0;
|
|
23404
|
+
const summary = stringArray(entry.summary);
|
|
23405
|
+
const descriptions = stringArray(entry.descriptions);
|
|
23406
|
+
const failures = renameFailureLines(entry);
|
|
23407
|
+
const dropped = num(entry.droppedConflicts) ?? 0;
|
|
23408
|
+
const report = (lines) => {
|
|
23409
|
+
const out = [...lines];
|
|
23410
|
+
if (failures.length > 0)
|
|
23411
|
+
out.push("Server errors:", ...failures);
|
|
23412
|
+
if (dropped > 0)
|
|
23413
|
+
out.push(`Warning: ${dropped} conflicting edit${dropped === 1 ? "" : "s"} dropped.`);
|
|
23414
|
+
return out.join("\n");
|
|
23415
|
+
};
|
|
23416
|
+
if (entry.applied !== true) {
|
|
23417
|
+
return report([
|
|
23418
|
+
...summary.length > 0 ? summary : ["File rename preview"],
|
|
23419
|
+
"Preview only \u2014 pass apply:true to rename."
|
|
23420
|
+
]);
|
|
23421
|
+
}
|
|
23422
|
+
const applied = renderAppliedEdit(entry, display);
|
|
23423
|
+
if (descriptions.length > 0 && applied)
|
|
23424
|
+
return report([applied]);
|
|
23425
|
+
if (summary.length > 0)
|
|
23426
|
+
return report(summary);
|
|
23427
|
+
return report([applied ?? "Applied."]);
|
|
23428
|
+
}
|
|
23429
|
+
var TIMED_OUT_COMMAND_REASON = /\btimed out\b/i;
|
|
23430
|
+
function renderExecuteCommand(result) {
|
|
23431
|
+
const entry = rec(result);
|
|
23432
|
+
if (!entry)
|
|
23433
|
+
return void 0;
|
|
23434
|
+
if (entry.dryRun === true) {
|
|
23435
|
+
const command = str(entry.command) ?? "command";
|
|
23436
|
+
const lines = [
|
|
23437
|
+
`${command}: ${entry.advertised === true ? "advertised" : "NOT advertised"}`
|
|
23438
|
+
];
|
|
23439
|
+
const note = str(entry.note);
|
|
23440
|
+
if (note)
|
|
23441
|
+
lines.push(note);
|
|
23442
|
+
return lines.join("\n");
|
|
23443
|
+
}
|
|
23444
|
+
if (entry.executed === false) {
|
|
23445
|
+
const reason = str(entry.reason);
|
|
23446
|
+
const lines = [`Not executed: ${reason ?? "no reason reported"}`];
|
|
23447
|
+
if (reason && TIMED_OUT_COMMAND_REASON.test(reason)) {
|
|
23448
|
+
lines.push("Warning: the command timed out; the server may still be changing files.");
|
|
23449
|
+
}
|
|
23450
|
+
return lines.join("\n");
|
|
23451
|
+
}
|
|
23452
|
+
if (entry.executed === true) {
|
|
23453
|
+
return entry.result === void 0 ? "Executed; the server returned no result." : JSON.stringify(entry.result);
|
|
23454
|
+
}
|
|
23455
|
+
return JSON.stringify(result);
|
|
23456
|
+
}
|
|
23457
|
+
function diagnosticCode(code) {
|
|
23458
|
+
if (typeof code === "string" || typeof code === "number")
|
|
23459
|
+
return String(code);
|
|
23460
|
+
return void 0;
|
|
23461
|
+
}
|
|
23462
|
+
function renderWorkspaceDiagnostics(result, display) {
|
|
23463
|
+
const lines = [];
|
|
23464
|
+
const empty = [];
|
|
23465
|
+
for (const item of arr(result)) {
|
|
23466
|
+
const file = rec(item);
|
|
23467
|
+
if (!file)
|
|
23468
|
+
continue;
|
|
23469
|
+
const filePath = str(file.filePath) ?? "";
|
|
23470
|
+
const where = display.file(filePath);
|
|
23471
|
+
const diagnostics = arr(file.diagnostics);
|
|
23472
|
+
const lag = str(file.lag);
|
|
23473
|
+
if (diagnostics.length === 0) {
|
|
23474
|
+
empty.push(`${lag ? `${where} (${lag})` : where}: 0 diagnostics`);
|
|
23475
|
+
continue;
|
|
23476
|
+
}
|
|
23477
|
+
if (lag)
|
|
23478
|
+
lines.push(`${where} (${lag})`);
|
|
23479
|
+
for (const diagnostic of diagnostics) {
|
|
23480
|
+
const entry = rec(diagnostic);
|
|
23481
|
+
if (!entry)
|
|
23482
|
+
continue;
|
|
23483
|
+
const start = startOf(entry.range);
|
|
23484
|
+
const severity = SEVERITY_NAMES[num(entry.severity) ?? 0] ?? "diagnostic";
|
|
23485
|
+
const message = (str(entry.message) ?? "").replace(/\s+/g, " ").trim();
|
|
23486
|
+
const code = diagnosticCode(entry.code);
|
|
23487
|
+
const location = start ? `${where}:${start.line}:${start.character}` : where;
|
|
23488
|
+
lines.push(`${location}: ${severity}${code ? ` [${code}]` : ""}: ${message}`);
|
|
23489
|
+
}
|
|
23490
|
+
}
|
|
23491
|
+
if (lines.length > 0)
|
|
23492
|
+
return lines.join("\n");
|
|
23493
|
+
if (empty.length > 0)
|
|
23494
|
+
return empty.join("\n");
|
|
23495
|
+
return Array.isArray(result) && result.length === 0 ? "0 diagnostics" : void 0;
|
|
23496
|
+
}
|
|
23497
|
+
function renderBody(options) {
|
|
23498
|
+
switch (options.operation) {
|
|
23499
|
+
case "definition":
|
|
23500
|
+
case "typeDefinition":
|
|
23501
|
+
case "declaration":
|
|
23502
|
+
case "references":
|
|
23503
|
+
case "implementation":
|
|
23504
|
+
return renderLocations(options.result, options.display);
|
|
23505
|
+
case "prepareCallHierarchy":
|
|
23506
|
+
return renderCallHierarchyPreparation(options.result, options.display);
|
|
23507
|
+
case "incomingCalls":
|
|
23508
|
+
return renderCalls(options.result, options.display, "from", void 0);
|
|
23509
|
+
case "outgoingCalls":
|
|
23510
|
+
return renderCalls(options.result, options.display, "to", options.callSiteUri);
|
|
23511
|
+
case "documentSymbol":
|
|
23512
|
+
return renderDocumentSymbols(options.result, options.filePath, options.display);
|
|
23513
|
+
case "findSymbol":
|
|
23514
|
+
return renderFindSymbols(options.result, options.filePath, options.display);
|
|
23515
|
+
case "workspaceSymbol":
|
|
23516
|
+
return renderSymbolList(options.result, options.display);
|
|
23517
|
+
case "hover":
|
|
23518
|
+
return renderHover(options.result);
|
|
23519
|
+
case "signatureHelp":
|
|
23520
|
+
return renderSignatureHelp(options.result);
|
|
23521
|
+
case "codeAction":
|
|
23522
|
+
return renderCodeActions(options.result);
|
|
23523
|
+
case "rename":
|
|
23524
|
+
return renderRename(options.result, options.display);
|
|
23525
|
+
case "rename_file":
|
|
23526
|
+
return renderRenameFile(options.result, options.display);
|
|
23527
|
+
case "executeCommand":
|
|
23528
|
+
return renderExecuteCommand(options.result);
|
|
23529
|
+
case "workspaceDiagnostics":
|
|
23530
|
+
return renderWorkspaceDiagnostics(options.result, options.display);
|
|
23531
|
+
default:
|
|
23532
|
+
return void 0;
|
|
23533
|
+
}
|
|
23534
|
+
}
|
|
23535
|
+
function renderLspNavigationText(options) {
|
|
23536
|
+
const body = renderBody({ ...options, display: createDisplay(options.cwd) });
|
|
23537
|
+
if (body === void 0 || body.length === 0)
|
|
23538
|
+
return options.text;
|
|
23539
|
+
const { leading, trailing } = lspNavigationTextSurround(options.text);
|
|
23540
|
+
return [...leading, body, ...trailing].join("\n\n");
|
|
23541
|
+
}
|
|
23542
|
+
|
|
22826
23543
|
// dist/tools/lsp-navigation.js
|
|
22827
23544
|
var VALID_OPERATIONS = [
|
|
22828
23545
|
"definition",
|
|
@@ -23104,9 +23821,6 @@ function tokenAtPosition(content, line1, char1) {
|
|
|
23104
23821
|
const token = chars.slice(left, right + 1).join("").trim();
|
|
23105
23822
|
return token.length > 0 ? token : void 0;
|
|
23106
23823
|
}
|
|
23107
|
-
function symbolKindLabel(kind) {
|
|
23108
|
-
return kind == null ? "symbol" : SYMBOL_KIND_NAMES[kind] ?? "symbol";
|
|
23109
|
-
}
|
|
23110
23824
|
function rangeStart(range) {
|
|
23111
23825
|
const start = range?.start;
|
|
23112
23826
|
return {
|
|
@@ -23217,12 +23931,12 @@ function searchReadFromUriRange(uri, range) {
|
|
|
23217
23931
|
if (typeof startLine !== "number" || !Number.isFinite(startLine)) {
|
|
23218
23932
|
return void 0;
|
|
23219
23933
|
}
|
|
23220
|
-
const
|
|
23934
|
+
const endLine2 = rangeLike?.end?.line;
|
|
23221
23935
|
try {
|
|
23222
23936
|
return {
|
|
23223
23937
|
file: fileURLToPath2(uri),
|
|
23224
23938
|
startLine: Math.max(1, Math.floor(startLine) + 1),
|
|
23225
|
-
endLine: typeof
|
|
23939
|
+
endLine: typeof endLine2 === "number" && Number.isFinite(endLine2) ? Math.max(1, Math.floor(endLine2) + 1) : void 0
|
|
23226
23940
|
};
|
|
23227
23941
|
} catch {
|
|
23228
23942
|
return void 0;
|
|
@@ -23375,7 +24089,7 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
23375
24089
|
return {
|
|
23376
24090
|
name: "lsp_navigation",
|
|
23377
24091
|
label: "LSP Navigate",
|
|
23378
|
-
description: 'Navigate source with language-server operations such as definition, references, hover, and rename. Example: use `{operation: "references", path: "src/app.ts", line: 12}`.',
|
|
24092
|
+
description: 'Navigate source with language-server operations such as definition, references, hover, and rename. Returns Neovim-style TEXT by default (path:line:col locations, symbol trees, diagnostics); pass view:"json" for the structured envelope. Example: use `{operation: "references", path: "src/app.ts", line: 12}`.',
|
|
23379
24093
|
promptSnippet: "Navigate definitions and references with LSP",
|
|
23380
24094
|
renderResult: compactRenderResult(({ details, args, isError, text }) => {
|
|
23381
24095
|
const op = details?.operation ?? (typeof args.operation === "string" ? args.operation : "lsp");
|
|
@@ -23447,6 +24161,10 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
23447
24161
|
// request); `checkCallHierarchyItem` checks the shape at execute.
|
|
23448
24162
|
callHierarchyItem: Type.Optional(Type.Object({}, {
|
|
23449
24163
|
description: "An item prepareCallHierarchy returned, passed back unchanged."
|
|
24164
|
+
})),
|
|
24165
|
+
view: Type.Optional(Type.String({
|
|
24166
|
+
// Plain string, no enum: "json" is the JSON hatch; anything else is text.
|
|
24167
|
+
description: 'Output format. "json" returns the structured envelope (machine-readable, byte-identical to the pre-text default); any other value (or omitting view) returns the default Neovim-style TEXT rendering (path:line:col locations, symbol trees, diagnostics).'
|
|
23450
24168
|
}))
|
|
23451
24169
|
}),
|
|
23452
24170
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
@@ -23461,7 +24179,14 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
23461
24179
|
let mutationContext;
|
|
23462
24180
|
let requestedApply = false;
|
|
23463
24181
|
const workspaceScopeAttribution = {};
|
|
23464
|
-
const finalize = (
|
|
24182
|
+
const finalize = (unreported, meta) => {
|
|
24183
|
+
const payload = mutationContext?.acceptedFiles && mutationContext.acceptedFiles.length > 0 ? {
|
|
24184
|
+
...unreported,
|
|
24185
|
+
details: {
|
|
24186
|
+
...unreported.details,
|
|
24187
|
+
appliedFiles: [...mutationContext.acceptedFiles]
|
|
24188
|
+
}
|
|
24189
|
+
} : unreported;
|
|
23465
24190
|
if (payload.isError && requestedApply && mutationContext && ["rename", "rename_file", "executeCommand"].includes(meta.operation)) {
|
|
23466
24191
|
recordLspMutationOutcome(mutationContext, "failed");
|
|
23467
24192
|
}
|
|
@@ -23482,24 +24207,49 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
23482
24207
|
}
|
|
23483
24208
|
});
|
|
23484
24209
|
const text = payload.content[0]?.text ?? "";
|
|
23485
|
-
|
|
23486
|
-
|
|
23487
|
-
|
|
23488
|
-
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
24210
|
+
if (params.view === "json") {
|
|
24211
|
+
const envelope = buildLspNavigationEnvelope({
|
|
24212
|
+
operation: meta.operation,
|
|
24213
|
+
filePath: meta.filePath,
|
|
24214
|
+
failureKind: meta.failureKind,
|
|
24215
|
+
resultCount: meta.resultCount,
|
|
24216
|
+
text,
|
|
24217
|
+
isError: payload.isError,
|
|
24218
|
+
details: payload.details
|
|
24219
|
+
});
|
|
24220
|
+
return {
|
|
24221
|
+
...payload,
|
|
24222
|
+
content: [
|
|
24223
|
+
{
|
|
24224
|
+
type: "text",
|
|
24225
|
+
// Compact JSON: omit indentation. Saves ~50% on rename / workspace-edits payloads
|
|
24226
|
+
// while keeping the envelope machine-parseable. Tests use JSON.parse so
|
|
24227
|
+
// they are agnostic to whitespace.
|
|
24228
|
+
text: JSON.stringify(envelope)
|
|
24229
|
+
}
|
|
24230
|
+
],
|
|
24231
|
+
details: {
|
|
24232
|
+
...payload.details,
|
|
24233
|
+
failureKind: meta.failureKind,
|
|
24234
|
+
// #5159: a JSON cell keeps block 0 parseable; a stale advisory
|
|
24235
|
+
// rides a trailing block instead of joining the envelope.
|
|
24236
|
+
[JSON_CELL_DETAILS_KEY]: true
|
|
24237
|
+
}
|
|
24238
|
+
};
|
|
24239
|
+
}
|
|
23494
24240
|
return {
|
|
23495
24241
|
...payload,
|
|
23496
24242
|
content: [
|
|
23497
24243
|
{
|
|
23498
24244
|
type: "text",
|
|
23499
|
-
|
|
23500
|
-
|
|
23501
|
-
|
|
23502
|
-
|
|
24245
|
+
text: renderLspNavigationText({
|
|
24246
|
+
operation: meta.operation,
|
|
24247
|
+
result: meta.result,
|
|
24248
|
+
filePath: meta.filePath,
|
|
24249
|
+
cwd: ctx.cwd || ".",
|
|
24250
|
+
...meta.callSiteUri === void 0 ? {} : { callSiteUri: meta.callSiteUri },
|
|
24251
|
+
text
|
|
24252
|
+
})
|
|
23503
24253
|
}
|
|
23504
24254
|
],
|
|
23505
24255
|
details: {
|
|
@@ -23538,7 +24288,7 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
23538
24288
|
}
|
|
23539
24289
|
if (pathRead.path)
|
|
23540
24290
|
params = { ...params, path: pathRead.path };
|
|
23541
|
-
const { operation: rawOperation, path: rawPath, line, character, symbol, endLine, endCharacter, newName, newFilePath, apply, command, commandArguments, query, kinds, exactMatch, topLevelOnly, maxResults, callHierarchyItem } = params;
|
|
24291
|
+
const { operation: rawOperation, path: rawPath, line, character, symbol, endLine: endLine2, endCharacter, newName, newFilePath, apply, command, commandArguments, query, kinds, exactMatch, topLevelOnly, maxResults, callHierarchyItem } = params;
|
|
23542
24292
|
const normalizedOperation = normalizeOperation(rawOperation);
|
|
23543
24293
|
if (!isValidOperation(normalizedOperation)) {
|
|
23544
24294
|
return finalize({
|
|
@@ -23570,6 +24320,7 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
23570
24320
|
cwd,
|
|
23571
24321
|
sessionId: ctx.sessionManager?.getSessionId?.(),
|
|
23572
24322
|
correlationId: newLspMutationCorrelationId(_toolCallId),
|
|
24323
|
+
acceptedFiles: [],
|
|
23573
24324
|
// #4187 R4-1: the call whose `tool_call` licensed the paths it
|
|
23574
24325
|
// named; the workspace edit's other files (a rename's importers)
|
|
23575
24326
|
// are unlicensed, so they end an authorship instead of advancing it.
|
|
@@ -23671,6 +24422,8 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
23671
24422
|
const pythonCompileTarget = await detectPythonTargetVersion(filePath);
|
|
23672
24423
|
const policy = applyProbeFindingPolicy(filePath, await lspService.getDiagnostics(filePath, void 0, excludeServerIds), policyCwd, openedContent, "all", "lsp_navigation", pythonCompileTarget);
|
|
23673
24424
|
const diagnostics = policy.kept;
|
|
24425
|
+
const diagnosticsTimedOut = lspService.getDiagnosticsHealth(filePath)?.failureKind === "timeout";
|
|
24426
|
+
const diagnosticsPartialTimeout = lspService.getDiagnosticsHealth(filePath)?.partialTimeout === true;
|
|
23674
24427
|
const suppressedLine = dispositionSuppressedLine(policy.suppressed);
|
|
23675
24428
|
const withheldLine = withheldCompileNote(policy.withheld);
|
|
23676
24429
|
const primaryUnavailable = describePrimaryUnavailable(void 0, lspService.getDiagnosticsHealth(filePath))?.text;
|
|
@@ -23687,17 +24440,23 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
23687
24440
|
};
|
|
23688
24441
|
const note2 = noteMap[diagnosticsMode] ?? "Note: workspace diagnostics mode unknown (no active capability snapshot)";
|
|
23689
24442
|
const resultCount2 = diagnostics.length;
|
|
24443
|
+
const unavailableNote = primaryUnavailable ? `
|
|
24444
|
+
Note: ${primaryUnavailable}` : "";
|
|
24445
|
+
const suppressedNote = suppressedLine ? `
|
|
24446
|
+
Note: ${suppressedLine}` : "";
|
|
24447
|
+
const withheldNote = withheldLine ? `
|
|
24448
|
+
Note: ${withheldLine}` : "";
|
|
24449
|
+
const timedOutNote = diagnosticsTimedOut || diagnosticsPartialTimeout ? `
|
|
24450
|
+
Note: LSP diagnostics timed out for ${filePath}` : "";
|
|
23690
24451
|
return finalize({
|
|
23691
24452
|
content: [
|
|
23692
24453
|
{
|
|
23693
24454
|
type: "text",
|
|
23694
24455
|
text: `${note2}
|
|
23695
|
-
${JSON.stringify(result3)}${
|
|
23696
|
-
Note: ${primaryUnavailable}` : ""}${suppressedLine ? `
|
|
23697
|
-
Note: ${suppressedLine}` : ""}${withheldLine ? `
|
|
23698
|
-
Note: ${withheldLine}` : ""}`
|
|
24456
|
+
${JSON.stringify(result3)}${timedOutNote}${unavailableNote}${suppressedNote}${withheldNote}`
|
|
23699
24457
|
}
|
|
23700
24458
|
],
|
|
24459
|
+
...diagnosticsTimedOut && resultCount2 === 0 ? { isError: true } : {},
|
|
23701
24460
|
details: {
|
|
23702
24461
|
operation,
|
|
23703
24462
|
resultCount: resultCount2,
|
|
@@ -23717,8 +24476,9 @@ Note: ${withheldLine}` : ""}`
|
|
|
23717
24476
|
}, {
|
|
23718
24477
|
operation,
|
|
23719
24478
|
filePath,
|
|
23720
|
-
failureKind: resultCount2 === 0 ? "empty_result" : "success",
|
|
23721
|
-
resultCount: resultCount2
|
|
24479
|
+
failureKind: diagnosticsTimedOut && resultCount2 === 0 ? "timeout" : resultCount2 === 0 ? "empty_result" : "success",
|
|
24480
|
+
resultCount: resultCount2,
|
|
24481
|
+
result: result3
|
|
23722
24482
|
});
|
|
23723
24483
|
}
|
|
23724
24484
|
const allDiagnostics = await lspService.getAllDiagnostics(configDisabledAuxiliaryLspServerIds((name) => getFlag(name, ctx.cwd)));
|
|
@@ -23784,7 +24544,8 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
23784
24544
|
operation,
|
|
23785
24545
|
filePath: rawPath ? filePath : "(workspace)",
|
|
23786
24546
|
failureKind: diagnosticsMode === "push-only" ? "tracked_snapshot" : "success",
|
|
23787
|
-
resultCount: result2.length
|
|
24547
|
+
resultCount: result2.length,
|
|
24548
|
+
result: result2
|
|
23788
24549
|
});
|
|
23789
24550
|
}
|
|
23790
24551
|
if (needsFilePath && filePathIsDirectory) {
|
|
@@ -23861,7 +24622,7 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
23861
24622
|
};
|
|
23862
24623
|
columnResolution = resolvedCharacter;
|
|
23863
24624
|
const lspChar = resolvedCharacter.character - 1;
|
|
23864
|
-
const lspEndLine = (
|
|
24625
|
+
const lspEndLine = (endLine2 ?? line ?? 1) - 1;
|
|
23865
24626
|
const lspEndChar = (endCharacter ?? resolvedCharacter.character) - 1;
|
|
23866
24627
|
const runWorkspaceSymbolOperation = async () => {
|
|
23867
24628
|
const support = rawPath ? await lspService.getOperationSupport(filePath) : await lspService.getOperationSupport(void 0, workspaceScopeAttribution);
|
|
@@ -24027,37 +24788,52 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
24027
24788
|
};
|
|
24028
24789
|
let result;
|
|
24029
24790
|
let usedDocumentSymbolFallback = false;
|
|
24791
|
+
let definitionTimeout;
|
|
24030
24792
|
try {
|
|
24031
|
-
|
|
24032
|
-
const isEmptyInitial = !result || Array.isArray(result) && result.length === 0;
|
|
24033
|
-
const shouldRetryOnEmpty = isEmptyInitial && needsFilePath && [
|
|
24034
|
-
"definition",
|
|
24035
|
-
"typeDefinition",
|
|
24036
|
-
"declaration",
|
|
24037
|
-
"references",
|
|
24038
|
-
"hover",
|
|
24039
|
-
"signatureHelp",
|
|
24040
|
-
"codeAction",
|
|
24041
|
-
"rename",
|
|
24042
|
-
"implementation"
|
|
24043
|
-
].includes(operation);
|
|
24044
|
-
if (shouldRetryOnEmpty) {
|
|
24045
|
-
openedFileContent = await openFileBestEffort(lspService, filePath, true);
|
|
24793
|
+
try {
|
|
24046
24794
|
result = await runOperation();
|
|
24795
|
+
const isEmptyInitial = !result || Array.isArray(result) && result.length === 0;
|
|
24796
|
+
const shouldRetryOnEmpty = isEmptyInitial && needsFilePath && [
|
|
24797
|
+
"definition",
|
|
24798
|
+
"typeDefinition",
|
|
24799
|
+
"declaration",
|
|
24800
|
+
"references",
|
|
24801
|
+
"hover",
|
|
24802
|
+
"signatureHelp",
|
|
24803
|
+
"codeAction",
|
|
24804
|
+
"rename",
|
|
24805
|
+
"implementation"
|
|
24806
|
+
].includes(operation);
|
|
24807
|
+
if (shouldRetryOnEmpty) {
|
|
24808
|
+
openedFileContent = await openFileBestEffort(lspService, filePath, true);
|
|
24809
|
+
result = await runOperation();
|
|
24810
|
+
}
|
|
24811
|
+
} catch (err) {
|
|
24812
|
+
if (needsFilePath && operation === "definition" && isLspRequestTimeoutError(err)) {
|
|
24813
|
+
definitionTimeout = err;
|
|
24814
|
+
} else {
|
|
24815
|
+
throw err;
|
|
24816
|
+
}
|
|
24047
24817
|
}
|
|
24048
24818
|
const stillEmpty = !result || Array.isArray(result) && result.length === 0;
|
|
24049
|
-
|
|
24050
|
-
|
|
24051
|
-
|
|
24052
|
-
|
|
24053
|
-
|
|
24054
|
-
|
|
24055
|
-
|
|
24056
|
-
|
|
24057
|
-
|
|
24819
|
+
try {
|
|
24820
|
+
if (stillEmpty && needsFilePath && operation === "definition") {
|
|
24821
|
+
const content = nodeFs4.readFileSync(filePath, "utf-8");
|
|
24822
|
+
const token = line && character ? tokenAtPosition(content, line, character) : void 0;
|
|
24823
|
+
if (token) {
|
|
24824
|
+
const docSymbols = await lspService.documentSymbol(filePath);
|
|
24825
|
+
const locations = pickLocalSymbolLocation(docSymbols, token, filePath);
|
|
24826
|
+
if (locations.length > 0) {
|
|
24827
|
+
result = locations;
|
|
24828
|
+
usedDocumentSymbolFallback = true;
|
|
24829
|
+
}
|
|
24058
24830
|
}
|
|
24059
24831
|
}
|
|
24832
|
+
} catch (err) {
|
|
24833
|
+
throw definitionTimeout ?? err;
|
|
24060
24834
|
}
|
|
24835
|
+
if (definitionTimeout && !usedDocumentSymbolFallback)
|
|
24836
|
+
throw definitionTimeout;
|
|
24061
24837
|
if (mutationContext && requestedApply && !mutationContext.summaryEmitted) {
|
|
24062
24838
|
const outcome = operation === "rename_file" && result && typeof result === "object" && "applied" in result && result.applied === false ? "failed" : operation === "executeCommand" && result && typeof result === "object" && "executed" in result && result.executed === false ? "failed" : "skipped";
|
|
24063
24839
|
recordLspMutationOutcome(mutationContext, outcome);
|
|
@@ -24092,6 +24868,17 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
24092
24868
|
details: {}
|
|
24093
24869
|
}, { operation, filePath, failureKind: "bad_input", resultCount: 0 });
|
|
24094
24870
|
}
|
|
24871
|
+
if (isLspRequestTimeoutError(err)) {
|
|
24872
|
+
return finalize({
|
|
24873
|
+
content: [{ type: "text", text: err.message }],
|
|
24874
|
+
isError: true,
|
|
24875
|
+
details: {
|
|
24876
|
+
method: err.method,
|
|
24877
|
+
timeoutMs: err.timeoutMs,
|
|
24878
|
+
elapsedMs: err.elapsedMs
|
|
24879
|
+
}
|
|
24880
|
+
}, { operation, filePath, failureKind: "timeout", resultCount: 0 });
|
|
24881
|
+
}
|
|
24095
24882
|
return finalize({
|
|
24096
24883
|
content: [
|
|
24097
24884
|
{
|
|
@@ -24119,7 +24906,7 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
24119
24906
|
output += "\nHint: provide path to scope workspaceSymbol to the active language server/root.";
|
|
24120
24907
|
}
|
|
24121
24908
|
if (usedDocumentSymbolFallback) {
|
|
24122
|
-
output += "\nNote: served from documentSymbol fallback due to empty primary result.";
|
|
24909
|
+
output += definitionTimeout ? "\nNote: served from documentSymbol fallback; definition timed out." : "\nNote: served from documentSymbol fallback due to empty primary result.";
|
|
24123
24910
|
}
|
|
24124
24911
|
if (operation === "references" && Array.isArray(result) && result.length <= 2) {
|
|
24125
24912
|
output += "\nHint: references from usage sites can be partial; retry from the symbol definition for broader cross-file results.";
|
|
@@ -24146,13 +24933,20 @@ Note: ${snapshotWithheldLine}` : ""}`
|
|
|
24146
24933
|
}, {
|
|
24147
24934
|
operation,
|
|
24148
24935
|
filePath: rawPath ? filePath : "(workspace)",
|
|
24149
|
-
failureKind: isEmpty ? "empty_result" : usedDocumentSymbolFallback ? "fallback_success" : "success",
|
|
24150
|
-
resultCount
|
|
24936
|
+
failureKind: isEmpty ? "empty_result" : usedDocumentSymbolFallback ? definitionTimeout ? "fallback_after_timeout" : "fallback_success" : "success",
|
|
24937
|
+
resultCount,
|
|
24938
|
+
result,
|
|
24939
|
+
// Outgoing call sites are written in the item the caller asked
|
|
24940
|
+
// about, whose uri the result does not carry.
|
|
24941
|
+
...isCallHierarchyTraversal && callHierarchyItem ? { callSiteUri: callHierarchyItem.uri } : {}
|
|
24151
24942
|
});
|
|
24152
24943
|
}
|
|
24153
24944
|
};
|
|
24154
24945
|
}
|
|
24155
24946
|
|
|
24947
|
+
// dist/tools/symbol-search.js
|
|
24948
|
+
var SYMBOL_SEARCH_DESCRIPTION = "Find relevant files by ranked identifier search. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: search `authenticate user` before module_report. Read a listed line with offset=<line>, limit=1. An `ext:` filter matches a path suffix, so `ext:test.ts` matches `foo.test.ts`.";
|
|
24949
|
+
|
|
24156
24950
|
// dist/mcp/tool-arguments.js
|
|
24157
24951
|
var MAX_REPORTED_KEYS = 8;
|
|
24158
24952
|
var MAX_REPORTED_KEY_CHARS = 64;
|
|
@@ -24256,13 +25050,21 @@ function ignoredArgumentsStructured(report) {
|
|
|
24256
25050
|
}
|
|
24257
25051
|
function withIgnoredArguments(result, tool, report) {
|
|
24258
25052
|
const line = ignoredArgumentsLine(tool, report);
|
|
25053
|
+
const structuredContent = ignoredArgumentsStructured(report);
|
|
24259
25054
|
const [first, ...rest] = result.content;
|
|
25055
|
+
if (isJsonCell(result)) {
|
|
25056
|
+
return {
|
|
25057
|
+
...result,
|
|
25058
|
+
content: first ? [first, { type: "text", text: line }, ...rest] : [{ type: "text", text: line }],
|
|
25059
|
+
structuredContent
|
|
25060
|
+
};
|
|
25061
|
+
}
|
|
24260
25062
|
return {
|
|
24261
25063
|
...result,
|
|
24262
25064
|
content: first ? [{ ...first, text: `${line}
|
|
24263
25065
|
|
|
24264
25066
|
${first.text}` }, ...rest] : [{ type: "text", text: line }],
|
|
24265
|
-
structuredContent
|
|
25067
|
+
structuredContent
|
|
24266
25068
|
};
|
|
24267
25069
|
}
|
|
24268
25070
|
function refusalResult(tool, report) {
|
|
@@ -24345,6 +25147,22 @@ function stalenessCheckEnabled(env = process.env) {
|
|
|
24345
25147
|
}
|
|
24346
25148
|
var STALE_SERVED_BY_FRESH = "fresh (warm code stale \u2014 restart the Claude session to re-warm)";
|
|
24347
25149
|
var STALE_WARN_ONLY = "warmCodeStale: this result was served by the warm server's loaded code, which is older than the on-disk build (a rebuild or merge landed after this session started). Restart the Claude session to re-warm, or use pilens_rebuild + a tool that supports mode=fresh if available.";
|
|
25150
|
+
var WARN_ONLY_STALE_TOOLS = /* @__PURE__ */ new Set([
|
|
25151
|
+
"pilens_module_report",
|
|
25152
|
+
"pilens_project_report",
|
|
25153
|
+
"pilens_symbol_search",
|
|
25154
|
+
"pilens_project_scan",
|
|
25155
|
+
"pilens_health",
|
|
25156
|
+
"pilens_latency",
|
|
25157
|
+
"pilens_session_start",
|
|
25158
|
+
"pilens_turn_end",
|
|
25159
|
+
"pilens_ast_grep_search",
|
|
25160
|
+
"pilens_ast_grep_replace",
|
|
25161
|
+
"pilens_lsp_navigation",
|
|
25162
|
+
"pilens_read_symbol",
|
|
25163
|
+
"pilens_read_enclosing",
|
|
25164
|
+
"pilens_effective_config"
|
|
25165
|
+
]);
|
|
24348
25166
|
|
|
24349
25167
|
// dist/mcp/server.js
|
|
24350
25168
|
console.log = (...args) => {
|
|
@@ -24709,7 +25527,7 @@ var ALL_TOOLS = [
|
|
|
24709
25527
|
},
|
|
24710
25528
|
{
|
|
24711
25529
|
name: "pilens_symbol_search",
|
|
24712
|
-
description:
|
|
25530
|
+
description: translateGuidanceToolNames(SYMBOL_SEARCH_DESCRIPTION, "mcp"),
|
|
24713
25531
|
inputSchema: {
|
|
24714
25532
|
type: "object",
|
|
24715
25533
|
properties: {
|
|
@@ -24737,7 +25555,7 @@ var ALL_TOOLS = [
|
|
|
24737
25555
|
},
|
|
24738
25556
|
{
|
|
24739
25557
|
name: "pilens_module_report",
|
|
24740
|
-
description: "Return a navigable source-module outline with references and read handles. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: use pilens_module_report on `src/app.ts` before pilens_read_symbol.",
|
|
25558
|
+
description: translateGuidanceToolNames("Return a navigable source-module outline with references and read handles. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: use pilens_module_report on `src/app.ts` before pilens_read_symbol.", "mcp"),
|
|
24741
25559
|
inputSchema: {
|
|
24742
25560
|
type: "object",
|
|
24743
25561
|
properties: {
|
|
@@ -24761,8 +25579,7 @@ var ALL_TOOLS = [
|
|
|
24761
25579
|
},
|
|
24762
25580
|
view: {
|
|
24763
25581
|
type: "string",
|
|
24764
|
-
|
|
24765
|
-
description: "Payload tier. summary returns top-level entries/recommendedReads with heavy callback/usedBy/blast-radius payloads omitted. compact (cheapest) returns a line-oriented TEXT rendering of the full report instead of JSON."
|
|
25582
|
+
description: 'Output preset: projection \xD7 format. "summary-text" (default) = metric fields off (no usedBy/fanout/complexity fields), text. "summary-json" = same fields, JSON. "full-text" = every field, text. "full-json" = every field, JSON (byte-identical to the pre-#5137 default). Metrics render as a cx:/fan: suffix and flags as [flag]; every field appears in the text cell, `kind` prints raw so it can be reused as read_symbol\'s kind filter, and an unavailable module still renders its callbacks and recommended reads. A summary cell states the omission in its PROVENANCE footer. A maxRefsPerSymbol argument promotes the projection to full and keeps the format.'
|
|
24766
25583
|
},
|
|
24767
25584
|
blastRadius: {
|
|
24768
25585
|
type: "boolean",
|
|
@@ -24785,7 +25602,7 @@ var ALL_TOOLS = [
|
|
|
24785
25602
|
},
|
|
24786
25603
|
{
|
|
24787
25604
|
name: "pilens_project_report",
|
|
24788
|
-
description:
|
|
25605
|
+
description: translateGuidanceToolNames('Orient in a project from its review graph. Returns a line-oriented TEXT report by default; pass view:"json" for the full JSON payload. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: use pilens_project_report before choosing a file.', "mcp"),
|
|
24789
25606
|
inputSchema: {
|
|
24790
25607
|
type: "object",
|
|
24791
25608
|
properties: {
|
|
@@ -24800,15 +25617,15 @@ var ALL_TOOLS = [
|
|
|
24800
25617
|
},
|
|
24801
25618
|
view: {
|
|
24802
25619
|
type: "string",
|
|
24803
|
-
enum:
|
|
24804
|
-
description:
|
|
25620
|
+
// Plain string, no enum: "json" is the JSON hatch; anything else is text.
|
|
25621
|
+
description: 'Payload tier. "json" returns the full JSON report; any other value (or omitting view) returns the default line-oriented TEXT rendering.'
|
|
24805
25622
|
}
|
|
24806
25623
|
}
|
|
24807
25624
|
}
|
|
24808
25625
|
},
|
|
24809
25626
|
{
|
|
24810
25627
|
name: "pilens_read_symbol",
|
|
24811
|
-
description: "Return one symbol's verbatim source. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use pilens_read_symbol after pilens_module_report identifies `parseConfig`.",
|
|
25628
|
+
description: translateGuidanceToolNames("Return one symbol's verbatim source. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use pilens_read_symbol after pilens_module_report identifies `parseConfig`.", "mcp"),
|
|
24812
25629
|
inputSchema: {
|
|
24813
25630
|
type: "object",
|
|
24814
25631
|
properties: {
|
|
@@ -24833,7 +25650,7 @@ var ALL_TOOLS = [
|
|
|
24833
25650
|
},
|
|
24834
25651
|
{
|
|
24835
25652
|
name: "pilens_read_enclosing",
|
|
24836
|
-
description: "Return the smallest symbol or callback enclosing a line. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use pilens_read_enclosing after a diagnostic points to line 42.",
|
|
25653
|
+
description: translateGuidanceToolNames("Return the smallest symbol or callback enclosing a line. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use pilens_read_enclosing after a diagnostic points to line 42.", "mcp"),
|
|
24837
25654
|
inputSchema: {
|
|
24838
25655
|
type: "object",
|
|
24839
25656
|
properties: {
|
|
@@ -24940,7 +25757,7 @@ var ALL_TOOLS = [
|
|
|
24940
25757
|
},
|
|
24941
25758
|
{
|
|
24942
25759
|
name: "pilens_lsp_navigation",
|
|
24943
|
-
description: 'Navigate source with language-server operations. Example: use `{operation: "references", path: "src/app.ts", line: 12}`.',
|
|
25760
|
+
description: 'Navigate source with language-server operations. Returns Neovim-style TEXT by default (path:line:col locations, symbol trees, diagnostics); pass view:"json" for the structured envelope. Example: use `{operation: "references", path: "src/app.ts", line: 12}`.',
|
|
24944
25761
|
inputSchema: schemaWithCwd(lspNavigationTool.parameters)
|
|
24945
25762
|
}
|
|
24946
25763
|
];
|
|
@@ -25159,72 +25976,57 @@ ${outcome.output}`, {
|
|
|
25159
25976
|
const blastRadiusDepth = typeof args.blastRadiusDepth === "number" && Number.isFinite(args.blastRadiusDepth) ? Math.max(1, Math.floor(args.blastRadiusDepth)) : void 0;
|
|
25160
25977
|
const callGraph = args.callGraph === true;
|
|
25161
25978
|
const maxCallGraphEntries = typeof args.maxCallGraphEntries === "number" && Number.isFinite(args.maxCallGraphEntries) ? Math.max(1, Math.floor(args.maxCallGraphEntries)) : void 0;
|
|
25162
|
-
const
|
|
25979
|
+
const choice = resolveModuleReportPreset(args.view, maxRefsPerSymbol);
|
|
25163
25980
|
const focus = typeof args.focus === "string" ? args.focus : void 0;
|
|
25164
25981
|
const report = await moduleReport(file, cwd, {
|
|
25165
25982
|
maxRefsPerSymbol,
|
|
25983
|
+
view: args.view,
|
|
25984
|
+
focus,
|
|
25166
25985
|
blastRadius,
|
|
25167
25986
|
blastRadiusDepth,
|
|
25168
25987
|
callGraph,
|
|
25169
|
-
maxCallGraphEntries
|
|
25170
|
-
view,
|
|
25171
|
-
focus
|
|
25988
|
+
maxCallGraphEntries
|
|
25172
25989
|
});
|
|
25173
|
-
|
|
25174
|
-
|
|
25175
|
-
|
|
25176
|
-
isError: true
|
|
25177
|
-
};
|
|
25178
|
-
}
|
|
25179
|
-
const graphStaleness = graphStalenessNote(report.graphBuiltAt, "Review graph");
|
|
25180
|
-
const summary = `${path40.relative(cwd, report.path) || report.path} [${report.staleness}] \u2014 ${report.summary.symbols} symbol(s), ${report.summary.exports} exported, ${report.api.length} in public API` + (graphStaleness ? `
|
|
25990
|
+
const rendered = renderModuleReportPreset(report, choice);
|
|
25991
|
+
const graphStaleness = choice.format === "text" ? graphStalenessNote(report.graphBuiltAt, "Review graph") : void 0;
|
|
25992
|
+
const text = graphStaleness ? `${rendered}
|
|
25181
25993
|
|
|
25182
|
-
${graphStaleness}` :
|
|
25183
|
-
if (
|
|
25184
|
-
const compactText = renderCompactModuleReport(report);
|
|
25994
|
+
${graphStaleness}` : rendered;
|
|
25995
|
+
if (!report.available)
|
|
25185
25996
|
return {
|
|
25186
|
-
content: [
|
|
25187
|
-
|
|
25188
|
-
|
|
25189
|
-
text: graphStaleness ? `${compactText}
|
|
25190
|
-
|
|
25191
|
-
${graphStaleness}` : compactText
|
|
25192
|
-
}
|
|
25193
|
-
]
|
|
25997
|
+
content: [{ type: "text", text }],
|
|
25998
|
+
isError: true,
|
|
25999
|
+
details: choice.format === "json" ? { [JSON_CELL_DETAILS_KEY]: true } : void 0
|
|
25194
26000
|
};
|
|
25195
|
-
|
|
25196
|
-
|
|
26001
|
+
return {
|
|
26002
|
+
content: [{ type: "text", text }],
|
|
26003
|
+
details: choice.format === "json" ? { [JSON_CELL_DETAILS_KEY]: true } : void 0
|
|
26004
|
+
};
|
|
25197
26005
|
}
|
|
25198
26006
|
if (name === "pilens_project_report") {
|
|
25199
26007
|
const cwd = typeof args.cwd === "string" ? args.cwd : DEFAULT_CWD;
|
|
25200
26008
|
const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? Math.max(1, Math.floor(args.limit)) : void 0;
|
|
25201
26009
|
const focus = typeof args.focus === "string" ? args.focus : void 0;
|
|
25202
|
-
const
|
|
25203
|
-
const report = await projectReport(cwd, { limit, focus, view });
|
|
26010
|
+
const report = await projectReport(cwd, { limit, focus });
|
|
25204
26011
|
if (!report.available) {
|
|
25205
26012
|
return {
|
|
25206
|
-
|
|
26013
|
+
content: [
|
|
26014
|
+
{ type: "text", text: renderTextProjectReport(report) }
|
|
26015
|
+
],
|
|
25207
26016
|
isError: true
|
|
25208
26017
|
};
|
|
25209
26018
|
}
|
|
25210
|
-
|
|
25211
|
-
if (view === "compact") {
|
|
25212
|
-
const compactText = renderCompactProjectReport(report);
|
|
26019
|
+
if (args.view === "json") {
|
|
25213
26020
|
return {
|
|
25214
|
-
content: [
|
|
25215
|
-
|
|
25216
|
-
type: "text",
|
|
25217
|
-
text: graphStaleness ? `${compactText}
|
|
25218
|
-
|
|
25219
|
-
${graphStaleness}` : compactText
|
|
25220
|
-
}
|
|
25221
|
-
]
|
|
26021
|
+
content: [{ type: "text", text: JSON.stringify(report) }],
|
|
26022
|
+
details: { [JSON_CELL_DETAILS_KEY]: true }
|
|
25222
26023
|
};
|
|
25223
26024
|
}
|
|
25224
|
-
|
|
25225
|
-
|
|
25226
|
-
|
|
25227
|
-
|
|
26025
|
+
return {
|
|
26026
|
+
content: [
|
|
26027
|
+
{ type: "text", text: renderTextProjectReport(report) }
|
|
26028
|
+
]
|
|
26029
|
+
};
|
|
25228
26030
|
}
|
|
25229
26031
|
if (name === "pilens_read_symbol") {
|
|
25230
26032
|
const fileRead = readFilePath(args);
|
|
@@ -25238,6 +26040,16 @@ ${graphStaleness}` : "");
|
|
|
25238
26040
|
const cwd = typeof args.cwd === "string" ? args.cwd : DEFAULT_CWD;
|
|
25239
26041
|
const kind = typeof args.kind === "string" ? args.kind : void 0;
|
|
25240
26042
|
const result = await readSymbol(file, symbol, cwd, { kind });
|
|
26043
|
+
if (!result.found && result.error) {
|
|
26044
|
+
return {
|
|
26045
|
+
...renderToolText(`Could not inspect ${path40.basename(file)}: ${result.error}`, {
|
|
26046
|
+
found: false,
|
|
26047
|
+
error: result.error,
|
|
26048
|
+
...result.warnings ? { warnings: result.warnings } : {}
|
|
26049
|
+
}),
|
|
26050
|
+
isError: true
|
|
26051
|
+
};
|
|
26052
|
+
}
|
|
25241
26053
|
if (!result.found) {
|
|
25242
26054
|
const suggestionSuffix = result.suggestions?.length ? ` Did you mean: ${result.suggestions.join(", ")}?` : " Use pilens_module_report to list symbols.";
|
|
25243
26055
|
return {
|
|
@@ -25458,25 +26270,17 @@ ${outcome.tests}` : ""
|
|
|
25458
26270
|
}
|
|
25459
26271
|
return { ...renderToolText(`Unknown tool: ${name}`), isError: true };
|
|
25460
26272
|
}
|
|
25461
|
-
var WARN_ONLY_STALE_TOOLS = /* @__PURE__ */ new Set([
|
|
25462
|
-
"pilens_module_report",
|
|
25463
|
-
"pilens_project_report",
|
|
25464
|
-
"pilens_symbol_search",
|
|
25465
|
-
"pilens_project_scan",
|
|
25466
|
-
"pilens_health",
|
|
25467
|
-
"pilens_latency",
|
|
25468
|
-
"pilens_session_start",
|
|
25469
|
-
"pilens_turn_end",
|
|
25470
|
-
"pilens_ast_grep_search",
|
|
25471
|
-
"pilens_ast_grep_replace",
|
|
25472
|
-
"pilens_lsp_navigation",
|
|
25473
|
-
"pilens_read_symbol",
|
|
25474
|
-
"pilens_read_enclosing",
|
|
25475
|
-
"pilens_effective_config"
|
|
25476
|
-
]);
|
|
25477
26273
|
function withStaleWarning(result) {
|
|
25478
26274
|
if (result.content.length === 0)
|
|
25479
26275
|
return result;
|
|
26276
|
+
const advisory = `warmCodeStale: true
|
|
26277
|
+
${STALE_WARN_ONLY}`;
|
|
26278
|
+
if (isJsonCell(result)) {
|
|
26279
|
+
return {
|
|
26280
|
+
...result,
|
|
26281
|
+
content: [...result.content, { type: "text", text: advisory }]
|
|
26282
|
+
};
|
|
26283
|
+
}
|
|
25480
26284
|
const last = result.content[result.content.length - 1];
|
|
25481
26285
|
return {
|
|
25482
26286
|
...result,
|
|
@@ -25486,8 +26290,7 @@ function withStaleWarning(result) {
|
|
|
25486
26290
|
...last,
|
|
25487
26291
|
text: `${last.text}
|
|
25488
26292
|
|
|
25489
|
-
|
|
25490
|
-
${STALE_WARN_ONLY}`
|
|
26293
|
+
${advisory}`
|
|
25491
26294
|
}
|
|
25492
26295
|
]
|
|
25493
26296
|
};
|