pi-lens 4.4.6 → 4.4.7
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 +83 -0
- package/README.md +5 -1
- package/dist/{chunk-JL6CXUMW.js → chunk-24BILSZW.js} +1 -1
- package/dist/{chunk-S67UJDGQ.js → chunk-2TF6RXWB.js} +5 -5
- package/dist/{chunk-ARD426WI.js → chunk-3F6BMY53.js} +1 -1
- package/dist/{chunk-5ZR3APIM.js → chunk-3FRLWYBG.js} +26 -26
- package/dist/{chunk-T7FTXGS3.js → chunk-3K2F6UDZ.js} +30 -30
- package/dist/{chunk-HK6JVFZC.js → chunk-3YY7IXIL.js} +2 -2
- package/dist/chunk-46TNM7XZ.js +88 -0
- package/dist/{chunk-4AVZ3TG7.js → chunk-4L36HG27.js} +8 -8
- package/dist/{chunk-PO45POGF.js → chunk-4LM3VAZH.js} +1 -1
- package/dist/{chunk-UN4TEBWN.js → chunk-4LOE5R5P.js} +9 -9
- package/dist/{chunk-KLQVC3XC.js → chunk-4YHYPW2G.js} +30 -7
- package/dist/{chunk-W5LGKNET.js → chunk-4ZYJHQMB.js} +6 -6
- package/dist/{chunk-W2V54OCL.js → chunk-6IR3ZYIB.js} +2 -2
- package/dist/{chunk-FJIVKLPH.js → chunk-72OKUXSD.js} +10 -10
- package/dist/{chunk-7RQXA5GG.js → chunk-75GAYVNO.js} +10 -9
- package/dist/{chunk-V3APN3DY.js → chunk-7E2563GA.js} +12 -12
- package/dist/{chunk-4WX4CTUE.js → chunk-7GLOLOSH.js} +25 -25
- package/dist/{chunk-BWYQUPOS.js → chunk-ABPKUVA4.js} +1 -1
- package/dist/{chunk-IPDG45G5.js → chunk-AKUUMGD5.js} +9 -9
- package/dist/{chunk-Q6D6VMI4.js → chunk-ASUXV767.js} +6 -6
- package/dist/{chunk-BM5GS6ZH.js → chunk-AWDSEDER.js} +2 -2
- package/dist/{chunk-MA77RSFN.js → chunk-BZARLRJW.js} +4 -4
- package/dist/{chunk-EVDGNG4F.js → chunk-CB4WHS4H.js} +3 -3
- package/dist/{chunk-FA5LDARD.js → chunk-CCV2EU7T.js} +7 -7
- package/dist/{chunk-U6OC3QEM.js → chunk-CE6VMBCB.js} +15 -15
- package/dist/{chunk-AMXIUN2R.js → chunk-CPSR3AVL.js} +2 -2
- package/dist/{chunk-SXGD4ANG.js → chunk-CTADOKYM.js} +7 -7
- package/dist/{chunk-63RIVFQI.js → chunk-DH5JPM3K.js} +1 -1
- package/dist/{chunk-MT6BVNFW.js → chunk-DPGEAHZT.js} +3 -3
- package/dist/{chunk-4PCQCU47.js → chunk-DQZFQSR5.js} +2 -2
- package/dist/{chunk-BHUWL2Y3.js → chunk-E7HJ56Y7.js} +5 -5
- package/dist/{chunk-DQXSPYRI.js → chunk-EAOK7MIZ.js} +2 -2
- package/dist/{chunk-2RLWJO5K.js → chunk-EKWX4WD3.js} +3 -3
- package/dist/{chunk-WIZWZR4C.js → chunk-F7K5IBZG.js} +30 -28
- package/dist/{chunk-VQH24FIP.js → chunk-FB5SCCPT.js} +9 -9
- package/dist/{chunk-GZE7WOI4.js → chunk-FZKFVUEC.js} +438 -140
- package/dist/{chunk-TIYGSODX.js → chunk-H7OR7DFZ.js} +15 -13
- package/dist/{chunk-CJYKEW2L.js → chunk-HO6LWE2E.js} +1 -1
- package/dist/{chunk-YSBHPOY6.js → chunk-HR3OJ3TH.js} +8 -8
- package/dist/{chunk-CFRQMBGP.js → chunk-HWDAVBFU.js} +14 -14
- package/dist/{chunk-2X4VLOCC.js → chunk-JJ2RRESP.js} +8 -5
- package/dist/{chunk-YBSONGSZ.js → chunk-JMEKXFOL.js} +24 -24
- package/dist/{chunk-MKVZQUEG.js → chunk-KDX35VXP.js} +69 -13
- package/dist/{chunk-75SY4F24.js → chunk-KKCK636N.js} +7 -7
- package/dist/{chunk-OLAWH5UQ.js → chunk-KPPJTH44.js} +2 -1
- package/dist/{chunk-5APMQ2IJ.js → chunk-KW5JQPO5.js} +1 -1
- package/dist/{chunk-SCIUNBPF.js → chunk-L3CMBQMH.js} +11 -11
- package/dist/{chunk-GAACZY6R.js → chunk-L5JYIU47.js} +7 -7
- package/dist/{chunk-2DDDCJDL.js → chunk-LBLBAFG3.js} +3 -3
- package/dist/{chunk-NNKXDXXS.js → chunk-LLS45EWB.js} +8 -0
- package/dist/{chunk-WQOIR3QY.js → chunk-LS3QJRUB.js} +7 -7
- package/dist/{chunk-XCUHKYCQ.js → chunk-LSC3VADM.js} +6 -6
- package/dist/{chunk-GMTFDAOK.js → chunk-LUBPZN36.js} +6 -6
- package/dist/{chunk-DMSLNKF7.js → chunk-LV4UMYVH.js} +19 -19
- package/dist/{chunk-XAIT2YGS.js → chunk-MB6PXBUA.js} +2 -2
- package/dist/{chunk-AE37FEGH.js → chunk-MNJIXFX4.js} +1 -1
- package/dist/{chunk-OJLTLYHB.js → chunk-MPKRJBPK.js} +30 -10
- package/dist/{chunk-QGSTQH4D.js → chunk-N5WSK2K7.js} +6 -6
- package/dist/{chunk-Z7IGUAXL.js → chunk-NA7SEXHE.js} +10 -6
- package/dist/{chunk-UHGF5UT5.js → chunk-O4BJFESU.js} +1 -1
- package/dist/{chunk-UCGQT677.js → chunk-OE5ZBP7F.js} +10 -10
- package/dist/{chunk-KSR7RGQY.js → chunk-OXOI55RU.js} +4 -4
- package/dist/{chunk-NDMCVUYK.js → chunk-PR6PO3ES.js} +2 -2
- package/dist/{chunk-NIU2IPC5.js → chunk-PUZ3E2J4.js} +3 -3
- package/dist/{chunk-2DMLM3ZO.js → chunk-QHSNL7B2.js} +8 -8
- package/dist/{chunk-ZYNI26MI.js → chunk-QOE342SU.js} +1 -1
- package/dist/{chunk-3WEPUD2V.js → chunk-R5MOQM2H.js} +98 -31
- package/dist/{chunk-PPIBVH4R.js → chunk-RC2Z6K47.js} +4 -4
- package/dist/{chunk-LEJOJDXL.js → chunk-RORGS5II.js} +4 -4
- package/dist/{chunk-K2YGBXOA.js → chunk-RQS4QQSD.js} +1 -1
- package/dist/{chunk-XQCSWV2G.js → chunk-RRV3FNNM.js} +10 -10
- package/dist/{chunk-GTAI2J6U.js → chunk-SHLDT3OI.js} +8 -8
- package/dist/{chunk-VPBIMOAQ.js → chunk-SNDXCFRS.js} +11 -9
- package/dist/{chunk-Q4FCYCRE.js → chunk-T7A2HK2B.js} +10 -10
- package/dist/{chunk-MN7MHUXQ.js → chunk-U5HPROLA.js} +1 -1
- package/dist/{chunk-ZUUI3ZSA.js → chunk-U6VN4NVL.js} +1 -1
- package/dist/{chunk-W5R5SABV.js → chunk-U7BD2QL7.js} +6 -6
- package/dist/{chunk-P4QNXS6I.js → chunk-UF7RTZSO.js} +8 -8
- package/dist/{chunk-A3YNG5KP.js → chunk-URCQWAQ4.js} +11 -11
- package/dist/{chunk-FFL3A2VP.js → chunk-VUZWQ7UG.js} +4 -4
- package/dist/{chunk-YRD4ISED.js → chunk-W4WP2ERB.js} +10 -10
- package/dist/{chunk-OOU2WZZE.js → chunk-WDBICWH3.js} +1 -1
- package/dist/{chunk-BI5LAQ3Y.js → chunk-WGRJOXED.js} +114 -148
- package/dist/{chunk-ZQ6NZZTB.js → chunk-WME2OQST.js} +33 -0
- package/dist/{chunk-DC4CFXM5.js → chunk-XT2HTCJ5.js} +1 -1
- package/dist/{chunk-SJJYRZB4.js → chunk-Y7F7IEE3.js} +55 -23
- package/dist/{chunk-2F47TQOA.js → chunk-YES5CACN.js} +29 -29
- package/dist/{chunk-H7HTEQUZ.js → chunk-YHC2O2WO.js} +7 -7
- package/dist/{chunk-Q3UZHW6N.js → chunk-YVHBNSME.js} +6 -10
- package/dist/{chunk-3MYEA7QD.js → chunk-ZE3KXHS7.js} +2 -2
- package/dist/{chunk-VG5JS5SW.js → chunk-ZGSJDWQU.js} +2 -2
- package/dist/{chunk-5CV5ITZF.js → chunk-ZJTT47IG.js} +1 -1
- package/dist/{chunk-Q4EMRFNA.js → chunk-ZMAUPOMG.js} +24 -24
- package/dist/index.js +1925 -944
- package/dist/mcp/analyze-cli.js +6 -6
- package/dist/mcp/cli.js +30 -30
- package/dist/mcp/server.js +707 -455
- package/dist/mcp/worker.js +48 -48
- package/dist/probes/installer.js +13 -13
- package/docs/agent-tools.md +11 -3
- package/docs/defect-shapes.md +15 -1
- package/docs/dependencies.md +1 -0
- package/docs/environment-variables.md +14 -0
- package/docs/features.md +11 -1
- package/docs/globalconfig.md +12 -1
- package/docs/invariants/git-guard-host.md +34 -0
- package/docs/invariants/lsp-trust-exec.md +6 -0
- package/docs/invariants/session-telemetry.md +42 -2
- package/docs/lsp-capability-matrix.md +89 -45
- package/docs/lsp-idle-eviction.md +3 -5
- package/docs/pi-lens-fixer.md +8 -1
- package/docs/pi-lens-merge-policy.md +7 -4
- package/docs/pi-lens-subagent.md +7 -4
- package/docs/schema/pi-lens-config-v1.json +23 -0
- package/docs/servercapabilities.md +1 -1
- package/docs/settings.md +5 -0
- package/docs/usage.md +5 -0
- package/package.json +1 -1
- package/dist/chunk-G2B7F6ZU.js +0 -88
package/dist/mcp/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
|
|
|
3
3
|
import {
|
|
4
4
|
GitleaksClient,
|
|
5
5
|
classifyAndFilterFindings
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-VUZWQ7UG.js";
|
|
7
7
|
import {
|
|
8
8
|
DEAD_CODE_DELTA_MAX_SHOWN,
|
|
9
9
|
deadCodeIssueCount,
|
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
deadCodeIssues,
|
|
12
12
|
formatDeadCodeDelta,
|
|
13
13
|
stableFindingKey
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-QHSNL7B2.js";
|
|
15
15
|
import {
|
|
16
16
|
clearFormatterCache
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-RRV3FNNM.js";
|
|
18
18
|
import {
|
|
19
19
|
findNearestProjectRoot,
|
|
20
20
|
isStartupScanVerdictFresh,
|
|
21
21
|
resolveStartupScanContext
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-75GAYVNO.js";
|
|
23
23
|
import {
|
|
24
24
|
loadCallGraph
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-6IR3ZYIB.js";
|
|
26
26
|
import {
|
|
27
27
|
isHardFailureSummary
|
|
28
28
|
} from "../chunk-7U2IDNXN.js";
|
|
@@ -31,11 +31,11 @@ import {
|
|
|
31
31
|
formatRunDurationMs,
|
|
32
32
|
isExcludedTestTarget,
|
|
33
33
|
isRunnerErrorResult
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-HR3OJ3TH.js";
|
|
35
35
|
import {
|
|
36
36
|
GovulncheckClient
|
|
37
|
-
} from "../chunk-
|
|
38
|
-
import "../chunk-
|
|
37
|
+
} from "../chunk-YHC2O2WO.js";
|
|
38
|
+
import "../chunk-ZJTT47IG.js";
|
|
39
39
|
import {
|
|
40
40
|
resetManagedToolRefreshSession
|
|
41
41
|
} from "../chunk-UXVNL3D7.js";
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
peekTurnEndFindings,
|
|
54
54
|
snapshotAdvisoryProvenance,
|
|
55
55
|
validateAdvisoryProvenance
|
|
56
|
-
} from "../chunk-
|
|
56
|
+
} from "../chunk-4YHYPW2G.js";
|
|
57
57
|
import {
|
|
58
58
|
CacheManager,
|
|
59
59
|
DEFAULT_MAX_AGE_MS,
|
|
@@ -113,52 +113,52 @@ import {
|
|
|
113
113
|
resetPsScriptAnalyzerAvailability,
|
|
114
114
|
runProviders,
|
|
115
115
|
stampLineHashes
|
|
116
|
-
} from "../chunk-
|
|
116
|
+
} from "../chunk-WGRJOXED.js";
|
|
117
117
|
import {
|
|
118
118
|
resetLazyInstallAttempts
|
|
119
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-LBLBAFG3.js";
|
|
120
120
|
import {
|
|
121
121
|
isTestRoleCollateral
|
|
122
|
-
} from "../chunk-
|
|
122
|
+
} from "../chunk-MNJIXFX4.js";
|
|
123
123
|
import {
|
|
124
124
|
findingsResult,
|
|
125
125
|
hasUsableResult,
|
|
126
126
|
reachedNoVerdict
|
|
127
|
-
} from "../chunk-
|
|
128
|
-
import "../chunk-
|
|
129
|
-
import "../chunk-
|
|
127
|
+
} from "../chunk-Y7F7IEE3.js";
|
|
128
|
+
import "../chunk-JJ2RRESP.js";
|
|
129
|
+
import "../chunk-EAOK7MIZ.js";
|
|
130
130
|
import {
|
|
131
131
|
resetGoAvailability
|
|
132
|
-
} from "../chunk-
|
|
132
|
+
} from "../chunk-4LM3VAZH.js";
|
|
133
133
|
import {
|
|
134
134
|
TrivyClient
|
|
135
|
-
} from "../chunk-
|
|
135
|
+
} from "../chunk-E7HJ56Y7.js";
|
|
136
136
|
import {
|
|
137
137
|
scannerReportParentDir
|
|
138
138
|
} from "../chunk-V63BC55Q.js";
|
|
139
|
-
import "../chunk-
|
|
140
|
-
import "../chunk-
|
|
139
|
+
import "../chunk-CPSR3AVL.js";
|
|
140
|
+
import "../chunk-ZE3KXHS7.js";
|
|
141
141
|
import {
|
|
142
142
|
resetRustAvailability
|
|
143
|
-
} from "../chunk-
|
|
144
|
-
import "../chunk-
|
|
145
|
-
import "../chunk-
|
|
143
|
+
} from "../chunk-RQS4QQSD.js";
|
|
144
|
+
import "../chunk-CB4WHS4H.js";
|
|
145
|
+
import "../chunk-N5WSK2K7.js";
|
|
146
146
|
import {
|
|
147
147
|
getSgCommand,
|
|
148
148
|
resetDispatchAvailabilityState,
|
|
149
149
|
resolveManagedToolClient
|
|
150
|
-
} from "../chunk-
|
|
151
|
-
import "../chunk-
|
|
152
|
-
import "../chunk-
|
|
153
|
-
import "../chunk-
|
|
154
|
-
import "../chunk-
|
|
150
|
+
} from "../chunk-7E2563GA.js";
|
|
151
|
+
import "../chunk-MB6PXBUA.js";
|
|
152
|
+
import "../chunk-DQZFQSR5.js";
|
|
153
|
+
import "../chunk-3YY7IXIL.js";
|
|
154
|
+
import "../chunk-WDBICWH3.js";
|
|
155
155
|
import {
|
|
156
156
|
SYMBOL_KIND_NAMES,
|
|
157
157
|
captureReviewGraphStructuralIr,
|
|
158
158
|
formatReviewGraphRevisionDriftNote,
|
|
159
159
|
publishReviewGraphFileIr,
|
|
160
160
|
reviewGraphIrContentHash
|
|
161
|
-
} from "../chunk-
|
|
161
|
+
} from "../chunk-H7OR7DFZ.js";
|
|
162
162
|
import {
|
|
163
163
|
buildSymbolId
|
|
164
164
|
} from "../chunk-3MED75HT.js";
|
|
@@ -197,6 +197,8 @@ import {
|
|
|
197
197
|
drainPendingAuxCapEvictedCount,
|
|
198
198
|
drainPendingAuxiliaryCoverage,
|
|
199
199
|
drainRenderedDependencyDriftFilePaths,
|
|
200
|
+
dropExcludedServers,
|
|
201
|
+
enabledOptInAuxiliaryLspServerIds,
|
|
200
202
|
findAuxiliaryProfileForSource,
|
|
201
203
|
getActiveSessionId,
|
|
202
204
|
getDisposition,
|
|
@@ -215,6 +217,7 @@ import {
|
|
|
215
217
|
incrementWidgetDependencyDriftDelivery,
|
|
216
218
|
isAuxBacklogPublished,
|
|
217
219
|
isBlocking,
|
|
220
|
+
isOptInAuxiliaryServerId,
|
|
218
221
|
isPendingAuxiliaryPastRearmTtl,
|
|
219
222
|
isWarmAttached,
|
|
220
223
|
loadLspService,
|
|
@@ -247,6 +250,7 @@ import {
|
|
|
247
250
|
retireWidgetDependencyDriftBlockers,
|
|
248
251
|
runPerServerGroups,
|
|
249
252
|
scopeCell,
|
|
253
|
+
sessionCell,
|
|
250
254
|
setSessionLanguages,
|
|
251
255
|
shouldShortenLspIdleTimeout,
|
|
252
256
|
summarizeWorkspaceEdit,
|
|
@@ -255,7 +259,7 @@ import {
|
|
|
255
259
|
tryWarmAttachedDiagnostics,
|
|
256
260
|
widgetDiagnosticUri,
|
|
257
261
|
writeOrderToken
|
|
258
|
-
} from "../chunk-
|
|
262
|
+
} from "../chunk-FZKFVUEC.js";
|
|
259
263
|
import {
|
|
260
264
|
ANY_POSITION,
|
|
261
265
|
foldedFindingIdentity,
|
|
@@ -265,7 +269,7 @@ import {
|
|
|
265
269
|
resetMutationAttribution,
|
|
266
270
|
retainRecordedFindings,
|
|
267
271
|
stableFindingId
|
|
268
|
-
} from "../chunk-
|
|
272
|
+
} from "../chunk-XT2HTCJ5.js";
|
|
269
273
|
import {
|
|
270
274
|
mapWithConcurrency
|
|
271
275
|
} from "../chunk-XIMYZ3JA.js";
|
|
@@ -289,8 +293,8 @@ import {
|
|
|
289
293
|
resetLSPCaseSensitivityState,
|
|
290
294
|
resolveLspCwdForFile,
|
|
291
295
|
shouldInitializeSessionRoot
|
|
292
|
-
} from "../chunk-
|
|
293
|
-
import "../chunk-
|
|
296
|
+
} from "../chunk-R5MOQM2H.js";
|
|
297
|
+
import "../chunk-24BILSZW.js";
|
|
294
298
|
import {
|
|
295
299
|
PYTHON_DECLARATION_CONCURRENCY,
|
|
296
300
|
describePythonCompileWithheld,
|
|
@@ -301,7 +305,7 @@ import {
|
|
|
301
305
|
partitionOutrankedPythonCompileVerdicts,
|
|
302
306
|
recordPythonCompileVerdictDrop,
|
|
303
307
|
resetBoundedTelemetry
|
|
304
|
-
} from "../chunk-
|
|
308
|
+
} from "../chunk-PR6PO3ES.js";
|
|
305
309
|
import {
|
|
306
310
|
PROJECT_SNAPSHOT_VERSION,
|
|
307
311
|
getProjectSnapshotLegacyPath,
|
|
@@ -316,7 +320,7 @@ import {
|
|
|
316
320
|
readJsonCache,
|
|
317
321
|
readProjectSnapshotMeta,
|
|
318
322
|
saveRuntimeProjectSnapshot
|
|
319
|
-
} from "../chunk-
|
|
323
|
+
} from "../chunk-RC2Z6K47.js";
|
|
320
324
|
import {
|
|
321
325
|
SWEEP_IDLE_SAFETY_MARGIN_MS,
|
|
322
326
|
getFullScanWallClockMs,
|
|
@@ -332,8 +336,8 @@ import {
|
|
|
332
336
|
resolveImportToFiles,
|
|
333
337
|
sweepInlineBlockerFreshness,
|
|
334
338
|
symbolExtractionGrammar
|
|
335
|
-
} from "../chunk-
|
|
336
|
-
import "../chunk-
|
|
339
|
+
} from "../chunk-MPKRJBPK.js";
|
|
340
|
+
import "../chunk-DH5JPM3K.js";
|
|
337
341
|
import "../chunk-PKES3ISE.js";
|
|
338
342
|
import "../chunk-ZKXQKGWZ.js";
|
|
339
343
|
import {
|
|
@@ -348,11 +352,11 @@ import {
|
|
|
348
352
|
queryLoader,
|
|
349
353
|
reportBundledResourceDirHealth,
|
|
350
354
|
resolveTreeSitterLanguage
|
|
351
|
-
} from "../chunk-
|
|
355
|
+
} from "../chunk-L5JYIU47.js";
|
|
352
356
|
import "../chunk-Z54ZSOBZ.js";
|
|
353
357
|
import {
|
|
354
358
|
getUserRuleRoot
|
|
355
|
-
} from "../chunk-
|
|
359
|
+
} from "../chunk-U6VN4NVL.js";
|
|
356
360
|
import {
|
|
357
361
|
dump,
|
|
358
362
|
resolvePackagePath
|
|
@@ -364,7 +368,7 @@ import {
|
|
|
364
368
|
resolveLanguage
|
|
365
369
|
} from "../chunk-YISME6ON.js";
|
|
366
370
|
import "../chunk-6HWVI6MI.js";
|
|
367
|
-
import "../chunk-
|
|
371
|
+
import "../chunk-O4BJFESU.js";
|
|
368
372
|
import {
|
|
369
373
|
HOOK_WALL_BUDGET_MS
|
|
370
374
|
} from "../chunk-CKEQFGLT.js";
|
|
@@ -372,17 +376,17 @@ import {
|
|
|
372
376
|
bounded,
|
|
373
377
|
combineAbortSignals,
|
|
374
378
|
withDeadline
|
|
375
|
-
} from "../chunk-
|
|
379
|
+
} from "../chunk-HO6LWE2E.js";
|
|
376
380
|
import {
|
|
377
381
|
centralityFromReverseDeps,
|
|
378
382
|
getWordIndexBuildStatus,
|
|
379
383
|
logWordIndex,
|
|
380
384
|
searchWordIndex,
|
|
381
385
|
triggerBackgroundWordIndexBuild
|
|
382
|
-
} from "../chunk-
|
|
386
|
+
} from "../chunk-SNDXCFRS.js";
|
|
383
387
|
import {
|
|
384
388
|
getProjectDiagnosticsScannerMaxFiles
|
|
385
|
-
} from "../chunk-
|
|
389
|
+
} from "../chunk-QOE342SU.js";
|
|
386
390
|
import {
|
|
387
391
|
WARM_TURN_END_SCHEMA_VERSION,
|
|
388
392
|
createWarmIpcLineReader,
|
|
@@ -390,33 +394,33 @@ import {
|
|
|
390
394
|
ipcPathForCwd,
|
|
391
395
|
readTurnEndStatus,
|
|
392
396
|
unlinkStaleUnixSocket
|
|
393
|
-
} from "../chunk-
|
|
397
|
+
} from "../chunk-AWDSEDER.js";
|
|
394
398
|
import {
|
|
395
399
|
hashContentBytes,
|
|
396
400
|
resolveRunnerPath,
|
|
397
401
|
toRunnerDisplayPath
|
|
398
|
-
} from "../chunk-
|
|
402
|
+
} from "../chunk-LLS45EWB.js";
|
|
399
403
|
import "../chunk-2BEMIWEW.js";
|
|
400
404
|
import "../chunk-IJYGIDF4.js";
|
|
401
405
|
import {
|
|
402
406
|
commitDurableStore,
|
|
403
407
|
resetResolvedPathCache,
|
|
404
408
|
resetZizmorTokenAvailability
|
|
405
|
-
} from "../chunk-
|
|
409
|
+
} from "../chunk-KDX35VXP.js";
|
|
406
410
|
import {
|
|
407
411
|
resolveToolCwd
|
|
408
|
-
} from "../chunk-
|
|
412
|
+
} from "../chunk-DPGEAHZT.js";
|
|
409
413
|
import {
|
|
410
414
|
_resetPackageManagerCache,
|
|
411
415
|
findGlobalBinary,
|
|
412
416
|
pmBinary,
|
|
413
417
|
resolveNodePackageManager,
|
|
414
418
|
runScriptArgs
|
|
415
|
-
} from "../chunk-
|
|
419
|
+
} from "../chunk-NA7SEXHE.js";
|
|
416
420
|
import {
|
|
417
421
|
getIsolatedNpxSpawnOptions,
|
|
418
422
|
probeToolAsync
|
|
419
|
-
} from "../chunk-
|
|
423
|
+
} from "../chunk-3F6BMY53.js";
|
|
420
424
|
import {
|
|
421
425
|
classifyProbeFailure,
|
|
422
426
|
createAvailabilityLatch,
|
|
@@ -424,20 +428,20 @@ import {
|
|
|
424
428
|
logAvailabilityDecision,
|
|
425
429
|
resetInstallRetryLatches,
|
|
426
430
|
startHostStallSampler
|
|
427
|
-
} from "../chunk-
|
|
431
|
+
} from "../chunk-KW5JQPO5.js";
|
|
428
432
|
import {
|
|
429
433
|
canRunStartupHeavyScans,
|
|
430
434
|
detectProjectLanguageProfile,
|
|
431
435
|
getDefaultStartupTools
|
|
432
|
-
} from "../chunk-
|
|
433
|
-
import "../chunk-
|
|
436
|
+
} from "../chunk-PUZ3E2J4.js";
|
|
437
|
+
import "../chunk-ABPKUVA4.js";
|
|
434
438
|
import {
|
|
435
439
|
collectSourceFilesWithBudgetAsync,
|
|
436
440
|
getSlowFsVerdict,
|
|
437
441
|
isSlowFs,
|
|
438
442
|
slowFsDegradationNotice
|
|
439
|
-
} from "../chunk-
|
|
440
|
-
import "../chunk-
|
|
443
|
+
} from "../chunk-EKWX4WD3.js";
|
|
444
|
+
import "../chunk-ZGSJDWQU.js";
|
|
441
445
|
import {
|
|
442
446
|
displayProjectDataPath,
|
|
443
447
|
drainProjectDataDirMigrations,
|
|
@@ -466,7 +470,7 @@ import {
|
|
|
466
470
|
sweepDeadEphemeralDataDirs,
|
|
467
471
|
updateHeartbeat,
|
|
468
472
|
withGenerationLockSync
|
|
469
|
-
} from "../chunk-
|
|
473
|
+
} from "../chunk-YVHBNSME.js";
|
|
470
474
|
import {
|
|
471
475
|
createSingleFlight
|
|
472
476
|
} from "../chunk-AWQWXSW4.js";
|
|
@@ -487,7 +491,7 @@ import {
|
|
|
487
491
|
provenanceView,
|
|
488
492
|
resolvePiLensConfig,
|
|
489
493
|
summarizeConfigResolution
|
|
490
|
-
} from "../chunk-
|
|
494
|
+
} from "../chunk-KPPJTH44.js";
|
|
491
495
|
import {
|
|
492
496
|
LSP_NAMESPACE_KEY,
|
|
493
497
|
getPiLensGlobalConfigPath,
|
|
@@ -502,7 +506,7 @@ import {
|
|
|
502
506
|
setProjectTrustState,
|
|
503
507
|
truncatedByOutputCap,
|
|
504
508
|
writeFileAtomic
|
|
505
|
-
} from "../chunk-
|
|
509
|
+
} from "../chunk-U5HPROLA.js";
|
|
506
510
|
import {
|
|
507
511
|
LENS_TOOL_NAMES,
|
|
508
512
|
TOOL_REGISTRY,
|
|
@@ -518,7 +522,7 @@ import {
|
|
|
518
522
|
resolveLensToolName,
|
|
519
523
|
toolRegistryEntryForMcp,
|
|
520
524
|
translateGuidanceToolNames
|
|
521
|
-
} from "../chunk-
|
|
525
|
+
} from "../chunk-WME2OQST.js";
|
|
522
526
|
import {
|
|
523
527
|
createSubsystemLogger,
|
|
524
528
|
flushExtensionLog,
|
|
@@ -2346,6 +2350,7 @@ import * as path29 from "node:path";
|
|
|
2346
2350
|
|
|
2347
2351
|
// dist/clients/project-diagnostics/scanner.js
|
|
2348
2352
|
import * as fs6 from "node:fs";
|
|
2353
|
+
import * as os2 from "node:os";
|
|
2349
2354
|
import * as path6 from "node:path";
|
|
2350
2355
|
|
|
2351
2356
|
// dist/clients/project-diagnostics/cache.js
|
|
@@ -2699,7 +2704,7 @@ async function scanFileMajorRules(cwd, files, signal) {
|
|
|
2699
2704
|
async function scanProjectDiagnostics(options) {
|
|
2700
2705
|
const cwd = path6.resolve(options.cwd);
|
|
2701
2706
|
const { signal } = options;
|
|
2702
|
-
if (!options.files && isAtOrAboveHomeDir(cwd, options.homeDir)) {
|
|
2707
|
+
if (!options.files && isAtOrAboveHomeDir(realpathOrResolve(cwd), realpathOrResolve(options.homeDir ?? os2.homedir()))) {
|
|
2703
2708
|
return {
|
|
2704
2709
|
version: PROJECT_DIAGNOSTICS_CACHE_VERSION,
|
|
2705
2710
|
cwd,
|
|
@@ -2978,29 +2983,29 @@ async function buildBootstrapClients() {
|
|
|
2978
2983
|
}
|
|
2979
2984
|
}
|
|
2980
2985
|
const [ruffClient, biomeClient, knipClient, todoScanner, jscpdClient, depChecker, testRunnerClient, metricsClient, complexityClient, goClient, govulncheckClient, gitleaksClient, trivyClient, opengrepClient, rustClient, agentBehaviorClient2, deadCodeClients] = await Promise.all([
|
|
2981
|
-
load("ruff", async () => new (await import("../chunk-
|
|
2982
|
-
load("biome", async () => new (await import("../chunk-
|
|
2983
|
-
load("knip", async () => new (await import("../chunk-
|
|
2984
|
-
load("todo", async () => new (await import("../chunk-
|
|
2985
|
-
load("jscpd", async () => new (await import("../chunk-
|
|
2986
|
-
load("dependency-checker", async () => new (await import("../chunk-
|
|
2987
|
-
load("test-runner", async () => new (await import("../chunk-
|
|
2986
|
+
load("ruff", async () => new (await import("../chunk-JMEKXFOL.js")).RuffClient()),
|
|
2987
|
+
load("biome", async () => new (await import("../chunk-ZMAUPOMG.js")).BiomeClient()),
|
|
2988
|
+
load("knip", async () => new (await import("../chunk-3FRLWYBG.js")).KnipClient()),
|
|
2989
|
+
load("todo", async () => new (await import("../chunk-4ZYJHQMB.js")).TodoScanner()),
|
|
2990
|
+
load("jscpd", async () => new (await import("../chunk-F7K5IBZG.js")).JscpdClient()),
|
|
2991
|
+
load("dependency-checker", async () => new (await import("../chunk-7GLOLOSH.js")).DependencyChecker()),
|
|
2992
|
+
load("test-runner", async () => new (await import("../chunk-HWDAVBFU.js")).TestRunnerClient()),
|
|
2988
2993
|
load("metrics", async () => new (await import("../chunk-GNSIWBAT.js")).MetricsClient()),
|
|
2989
|
-
load("complexity", async () => new (await import("../chunk-
|
|
2994
|
+
load("complexity", async () => new (await import("../chunk-OE5ZBP7F.js")).ComplexityClient()),
|
|
2990
2995
|
// The process-wide singleton, NOT a fresh instance (#2455 fix round 4,
|
|
2991
2996
|
// F2). `handleSessionStart` reads this object for its "Active tools"
|
|
2992
2997
|
// line while `resetGoAvailability` re-arms the singleton's latch; a
|
|
2993
2998
|
// second instance here meant the reset never reached the surface a
|
|
2994
2999
|
// user actually sees.
|
|
2995
|
-
load("go", async () => (await import("../chunk-
|
|
2996
|
-
load("govulncheck", async () => new (await import("../chunk-
|
|
2997
|
-
load("gitleaks", async () => new (await import("../chunk-
|
|
2998
|
-
load("trivy", async () => new (await import("../chunk-
|
|
2999
|
-
load("opengrep", async () => new (await import("../chunk-
|
|
3000
|
+
load("go", async () => (await import("../chunk-SHLDT3OI.js")).goClient),
|
|
3001
|
+
load("govulncheck", async () => new (await import("../chunk-AKUUMGD5.js")).GovulncheckClient()),
|
|
3002
|
+
load("gitleaks", async () => new (await import("../chunk-FB5SCCPT.js")).GitleaksClient()),
|
|
3003
|
+
load("trivy", async () => new (await import("../chunk-4LOE5R5P.js")).TrivyClient()),
|
|
3004
|
+
load("opengrep", async () => new (await import("../chunk-T7A2HK2B.js")).OpengrepClient()),
|
|
3000
3005
|
// The process-wide singleton, for the same reason as "go" above.
|
|
3001
|
-
load("rust", async () => (await import("../chunk-
|
|
3002
|
-
load("agent-behavior", async () => (await import("../chunk-
|
|
3003
|
-
loadList("dead-code", async () => (await import("../chunk-
|
|
3006
|
+
load("rust", async () => (await import("../chunk-UF7RTZSO.js")).rustClient),
|
|
3007
|
+
load("agent-behavior", async () => (await import("../chunk-ASUXV767.js")).agentBehaviorClient),
|
|
3008
|
+
loadList("dead-code", async () => (await import("../chunk-L3CMBQMH.js")).getDeadCodeClients())
|
|
3004
3009
|
]);
|
|
3005
3010
|
if (failures.length > 0)
|
|
3006
3011
|
await logBootstrapFailures(failures);
|
|
@@ -3087,7 +3092,7 @@ function resetAnalyzerBootstrapSessionState() {
|
|
|
3087
3092
|
}
|
|
3088
3093
|
|
|
3089
3094
|
// dist/clients/formatters-lazy.js
|
|
3090
|
-
var lazyFormatters = createLazyImport(() => import("../chunk-
|
|
3095
|
+
var lazyFormatters = createLazyImport(() => import("../chunk-LV4UMYVH.js"));
|
|
3091
3096
|
function warmFormatters() {
|
|
3092
3097
|
return lazyFormatters.get();
|
|
3093
3098
|
}
|
|
@@ -3395,28 +3400,19 @@ function recordViewIncomplete(cwd, cause) {
|
|
|
3395
3400
|
reason: `snapshots are stamped incomplete (never fresh) until the next seed from the change log: ${why}`
|
|
3396
3401
|
});
|
|
3397
3402
|
}
|
|
3403
|
+
var EMPTY_GIT_GUARD_MEMO = {
|
|
3404
|
+
entries: [],
|
|
3405
|
+
verdict: void 0,
|
|
3406
|
+
firstLine: void 0
|
|
3407
|
+
};
|
|
3398
3408
|
var MAX_RESOLVED_BLOCKER_FILES = 10;
|
|
3399
3409
|
var MAX_OWED_ANCHORS = 16;
|
|
3400
3410
|
var TOOL_CALL_ATTRIBUTION_CAPACITY = 256;
|
|
3401
3411
|
var TOOL_CALL_ATTRIBUTION_TTL_MS = 5 * 6e4;
|
|
3402
|
-
var
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
if (!partition) {
|
|
3407
|
-
partition = /* @__PURE__ */ new Map();
|
|
3408
|
-
this.bySession.set(sessionId, partition);
|
|
3409
|
-
}
|
|
3410
|
-
for (const item of items)
|
|
3411
|
-
partition.set(item.id, item);
|
|
3412
|
-
}
|
|
3413
|
-
peek(sessionId) {
|
|
3414
|
-
return [...this.bySession.get(sessionId)?.values() ?? []];
|
|
3415
|
-
}
|
|
3416
|
-
clear(sessionId) {
|
|
3417
|
-
this.bySession.delete(sessionId);
|
|
3418
|
-
}
|
|
3419
|
-
};
|
|
3412
|
+
var TURN_WARNINGS_CELL = "turn-warnings";
|
|
3413
|
+
function newTurnWarningsCell() {
|
|
3414
|
+
return { actionable: /* @__PURE__ */ new Map(), codeQuality: /* @__PURE__ */ new Map() };
|
|
3415
|
+
}
|
|
3420
3416
|
var RuntimeCoordinator = class {
|
|
3421
3417
|
_projectRoot = normalizeMapKey(process.cwd());
|
|
3422
3418
|
// #3611: the session generation is this scope's ticket, drawn from one
|
|
@@ -3517,9 +3513,20 @@ var RuntimeCoordinator = class {
|
|
|
3517
3513
|
// skip its per-build O(project) walk+stat sweep when only pi-observed edits
|
|
3518
3514
|
// occurred. Keyed identically to _fileSeq (normalizeMapKey + path.resolve).
|
|
3519
3515
|
_fileLastProjectSeq = /* @__PURE__ */ new Map();
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3516
|
+
/**
|
|
3517
|
+
* The commit gate's memo of the last {@link updateGitGuardStatus}: the
|
|
3518
|
+
* unsuppressed blocker records it counted, each with its file, so the gate
|
|
3519
|
+
* can answer for one repository's tree (#4941) and the turn-end readers
|
|
3520
|
+
* for all of them.
|
|
3521
|
+
*/
|
|
3522
|
+
_gitGuardMemo = EMPTY_GIT_GUARD_MEMO;
|
|
3523
|
+
/**
|
|
3524
|
+
* Per project (the `cwd` whose stored record the reason is about), the
|
|
3525
|
+
* reason that record cannot be confirmed (#4941 r2 F1). One record per
|
|
3526
|
+
* repository: a failure about B must not replace, and a write about B must
|
|
3527
|
+
* not clear, the uncertainty about A.
|
|
3528
|
+
*/
|
|
3529
|
+
_gitGuardCacheUnknown = new PathKeyedMap(normalizeMapKey);
|
|
3523
3530
|
/**
|
|
3524
3531
|
* #4733 r2 F12: per file, a dispatch that never answered
|
|
3525
3532
|
* (`pipeline_crash`, `pipeline_error`). It is about that file, not the
|
|
@@ -3531,6 +3538,13 @@ var RuntimeCoordinator = class {
|
|
|
3531
3538
|
callGraph = null;
|
|
3532
3539
|
wordIndex = null;
|
|
3533
3540
|
_readGuard = null;
|
|
3541
|
+
/**
|
|
3542
|
+
* #4942: the read guard of each concurrent in-process session, keyed by the
|
|
3543
|
+
* owner `recordSession` names (its session id, opaque here). Entries go at
|
|
3544
|
+
* the session's shutdown (`forgetTurnSession`) and with the coordinator's
|
|
3545
|
+
* own reset.
|
|
3546
|
+
*/
|
|
3547
|
+
_foreignReadGuards = /* @__PURE__ */ new Map();
|
|
3534
3548
|
_pendingDeferredMutations = new PathKeyedMap(normalizeMapKey);
|
|
3535
3549
|
/** tool_call → tool_result path-attribution correlation (#1642). */
|
|
3536
3550
|
_toolCallAttributions = new BoundedLruCache(TOOL_CALL_ATTRIBUTION_CAPACITY);
|
|
@@ -3583,8 +3597,6 @@ var RuntimeCoordinator = class {
|
|
|
3583
3597
|
*/
|
|
3584
3598
|
_resolvedBlockerFilesThisTurn = new PathKeyedMap(normalizeMapKey);
|
|
3585
3599
|
_resolvedBlockerFilesDropped = 0;
|
|
3586
|
-
_actionableWarningsThisTurn = new TurnWarningsBySession();
|
|
3587
|
-
_codeQualityWarningsThisTurn = new TurnWarningsBySession();
|
|
3588
3600
|
// #484: opt-in per-RUN summary of diagnostics/autofixes/formats,
|
|
3589
3601
|
// accumulated across the run's turns and consumed once at the
|
|
3590
3602
|
// agent_settled quiet window. The collector itself is always constructed
|
|
@@ -3625,8 +3637,6 @@ var RuntimeCoordinator = class {
|
|
|
3625
3637
|
this._reportedThisTurn.clear();
|
|
3626
3638
|
this._mutationReceipts = [];
|
|
3627
3639
|
this._droppedMutationReceipts = 0;
|
|
3628
|
-
this._actionableWarningsThisTurn.clear(this._telemetrySessionId);
|
|
3629
|
-
this._codeQualityWarningsThisTurn.clear(this._telemetrySessionId);
|
|
3630
3640
|
this._telemetrySessionId = nextTelemetrySessionId();
|
|
3631
3641
|
this._hasStableSessionId = false;
|
|
3632
3642
|
this._telemetryModel = "unknown";
|
|
@@ -3642,11 +3652,11 @@ var RuntimeCoordinator = class {
|
|
|
3642
3652
|
this._turnStartProjectSeq = 0;
|
|
3643
3653
|
this._fileSeq.clear();
|
|
3644
3654
|
this._fileLastProjectSeq.clear();
|
|
3645
|
-
this.
|
|
3646
|
-
this.
|
|
3647
|
-
this._gitGuardCacheUnknownReason = void 0;
|
|
3655
|
+
this._gitGuardMemo = EMPTY_GIT_GUARD_MEMO;
|
|
3656
|
+
this._gitGuardCacheUnknown.clear();
|
|
3648
3657
|
this._gitGuardUnansweredDispatches.clear();
|
|
3649
3658
|
this._readGuard = null;
|
|
3659
|
+
this._foreignReadGuards.clear();
|
|
3650
3660
|
this._pendingDeferredMutations.clear();
|
|
3651
3661
|
this._toolCallAttributions.clear();
|
|
3652
3662
|
this._readWidenings.clear();
|
|
@@ -3683,13 +3693,18 @@ var RuntimeCoordinator = class {
|
|
|
3683
3693
|
* dispatch replaces the record wholesale (`recordInlineBlockers`), so a NEW
|
|
3684
3694
|
* blocker is never born pre-suppressed (#1198 ordering).
|
|
3685
3695
|
*
|
|
3696
|
+
* #4921: `of` names the turn session whose pass this is; it rewrites only
|
|
3697
|
+
* that session's records, the ones its pass judged. Omitted: every record.
|
|
3698
|
+
*
|
|
3686
3699
|
* @returns how many records this call CHANGED — 0 means the gate's view of
|
|
3687
3700
|
* the map is already what the policy just decided.
|
|
3688
3701
|
*/
|
|
3689
|
-
applyInlineBlockerPolicyVerdicts(suppressedFilePaths) {
|
|
3702
|
+
applyInlineBlockerPolicyVerdicts(suppressedFilePaths, of) {
|
|
3690
3703
|
const suppressed = new Set(suppressedFilePaths.map((filePath) => path8.resolve(filePath)));
|
|
3691
3704
|
let changed = 0;
|
|
3692
3705
|
for (const [key, entry] of this._pendingInlineBlockers.entries()) {
|
|
3706
|
+
if (of && !this.ownedBy(entry, of.sessionId))
|
|
3707
|
+
continue;
|
|
3693
3708
|
const policySuppressed = suppressed.has(path8.resolve(entry.filePath));
|
|
3694
3709
|
if ((entry.policySuppressed ?? false) === policySuppressed)
|
|
3695
3710
|
continue;
|
|
@@ -3698,31 +3713,64 @@ var RuntimeCoordinator = class {
|
|
|
3698
3713
|
}
|
|
3699
3714
|
return changed;
|
|
3700
3715
|
}
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3716
|
+
/**
|
|
3717
|
+
* `blockerFile` is the file `hasBlockers` speaks for (the write's own); a
|
|
3718
|
+
* verdict with no file is a repository-less blocker, which every tree's
|
|
3719
|
+
* commit gate counts (#4941).
|
|
3720
|
+
*/
|
|
3721
|
+
updateGitGuardStatus(hasBlockers, output, blockerFile) {
|
|
3722
|
+
this._gitGuardMemo = {
|
|
3723
|
+
entries: this.getInlineBlockersSnapshot().filter((entry) => !entry.policySuppressed).map((entry) => ({
|
|
3724
|
+
filePath: entry.filePath,
|
|
3725
|
+
summary: entry.summary.trim()
|
|
3726
|
+
})),
|
|
3727
|
+
verdict: hasBlockers ? { filePath: blockerFile } : void 0,
|
|
3728
|
+
firstLine: output.split("\n").map((line) => line.trim()).find((line) => line.length > 0)
|
|
3729
|
+
};
|
|
3730
|
+
}
|
|
3731
|
+
/**
|
|
3732
|
+
* The commit gate's status over the blockers `inScope` admits (every one
|
|
3733
|
+
* when omitted): whether any counts, and the first one's summary. #4941:
|
|
3734
|
+
* the gate asks for the tree being committed, so a blocker in another
|
|
3735
|
+
* repository neither refuses the commit nor names its file.
|
|
3736
|
+
*/
|
|
3737
|
+
gitGuardStatus(inScope) {
|
|
3738
|
+
const { entries, verdict, firstLine: firstLine2 } = this._gitGuardMemo;
|
|
3739
|
+
const counted = inScope ? entries.filter((entry) => inScope(entry.filePath)) : entries;
|
|
3740
|
+
const verdictCounts = verdict !== void 0 && (!inScope || verdict.filePath === void 0 || inScope(verdict.filePath));
|
|
3741
|
+
if (!verdictCounts && counted.length === 0) {
|
|
3742
|
+
return { hasBlockers: false, summary: "" };
|
|
3707
3743
|
}
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3744
|
+
return {
|
|
3745
|
+
hasBlockers: true,
|
|
3746
|
+
summary: (counted.map((entry) => entry.summary).find(Boolean) ?? firstLine2 ?? "Unresolved blockers detected").slice(0, 160)
|
|
3747
|
+
};
|
|
3711
3748
|
}
|
|
3712
3749
|
get gitGuardHasBlockers() {
|
|
3713
|
-
return this.
|
|
3750
|
+
return this.gitGuardStatus().hasBlockers;
|
|
3714
3751
|
}
|
|
3715
3752
|
get gitGuardSummary() {
|
|
3716
|
-
return this.
|
|
3753
|
+
return this.gitGuardStatus().summary;
|
|
3717
3754
|
}
|
|
3718
|
-
|
|
3719
|
-
|
|
3755
|
+
/** `cwd` is the project whose stored record the reason is about (#4941). */
|
|
3756
|
+
markGitGuardCacheUnknown(reason, cwd) {
|
|
3757
|
+
this._gitGuardCacheUnknown.set(cwd, reason);
|
|
3720
3758
|
}
|
|
3721
|
-
|
|
3722
|
-
|
|
3759
|
+
/** A write or retirement of `cwd`'s record answers that project's reason only. */
|
|
3760
|
+
clearGitGuardCacheUnknown(cwd) {
|
|
3761
|
+
this._gitGuardCacheUnknown.delete(cwd);
|
|
3723
3762
|
}
|
|
3724
|
-
|
|
3725
|
-
|
|
3763
|
+
/**
|
|
3764
|
+
* The first latched reason about a project `inScope` accepts, or the first
|
|
3765
|
+
* of all when `inScope` is absent (a command the gate cannot place in a
|
|
3766
|
+
* tree is judged by every project's reason).
|
|
3767
|
+
*/
|
|
3768
|
+
gitGuardCacheUnknownFor(inScope) {
|
|
3769
|
+
for (const [cwd, reason] of this._gitGuardCacheUnknown) {
|
|
3770
|
+
if (!inScope || inScope(cwd))
|
|
3771
|
+
return reason;
|
|
3772
|
+
}
|
|
3773
|
+
return void 0;
|
|
3726
3774
|
}
|
|
3727
3775
|
markGitGuardDispatchUnanswered(filePath, reason) {
|
|
3728
3776
|
this._gitGuardUnansweredDispatches.set(filePath, reason);
|
|
@@ -3739,6 +3787,30 @@ var RuntimeCoordinator = class {
|
|
|
3739
3787
|
hasInlineBlocker(filePath) {
|
|
3740
3788
|
return this._pendingInlineBlockers.has(filePath);
|
|
3741
3789
|
}
|
|
3790
|
+
/**
|
|
3791
|
+
* #4921: the turn session that owns the file's inline-blocker record, or
|
|
3792
|
+
* undefined when the file has none.
|
|
3793
|
+
*/
|
|
3794
|
+
inlineBlockerOwner(filePath) {
|
|
3795
|
+
const entry = this._pendingInlineBlockers.get(filePath);
|
|
3796
|
+
return entry ? entry.session ?? this._telemetrySessionId : void 0;
|
|
3797
|
+
}
|
|
3798
|
+
/**
|
|
3799
|
+
* #4921: whether `sessionId`'s turn is this coordinator's own session, the
|
|
3800
|
+
* rule {@link beginTurn} applies: a turn with no session id of its own is
|
|
3801
|
+
* the coordinator's. A concurrent in-process secondary's is not.
|
|
3802
|
+
*/
|
|
3803
|
+
isCoordinatorSession(sessionId) {
|
|
3804
|
+
return this.turnSession(sessionId) === this._telemetrySessionId;
|
|
3805
|
+
}
|
|
3806
|
+
/** #4921: the `session` a record written by `sessionId`'s turn carries. */
|
|
3807
|
+
recordSession(sessionId) {
|
|
3808
|
+
return sessionId === void 0 || this.isCoordinatorSession(sessionId) ? {} : { session: sessionId };
|
|
3809
|
+
}
|
|
3810
|
+
/** #4921: whether a record (or its Resolved note) is `sessionId`'s turn's. */
|
|
3811
|
+
ownedBy(entry, sessionId) {
|
|
3812
|
+
return (entry.session ?? this._telemetrySessionId) === this.turnSession(sessionId);
|
|
3813
|
+
}
|
|
3742
3814
|
/**
|
|
3743
3815
|
* Start a turn. `sessionId` is the turn's own session (its ctx's stable id);
|
|
3744
3816
|
* omitted, or equal to this coordinator's session, the turn is the
|
|
@@ -3754,8 +3826,7 @@ var RuntimeCoordinator = class {
|
|
|
3754
3826
|
beginTurnContext(turnSession);
|
|
3755
3827
|
this._foreignTurns += 1;
|
|
3756
3828
|
this._foreignTurnKeys.set(turnSession, this._turnIndex + this._foreignTurns / (this._foreignTurns + 1));
|
|
3757
|
-
this.
|
|
3758
|
-
this._codeQualityWarningsThisTurn.clear(turnSession);
|
|
3829
|
+
this.clearTurnWarnings(turnSession);
|
|
3759
3830
|
return;
|
|
3760
3831
|
}
|
|
3761
3832
|
this._cascadeRuns = this._cascadeRuns.flatMap((run) => {
|
|
@@ -3772,8 +3843,7 @@ var RuntimeCoordinator = class {
|
|
|
3772
3843
|
}
|
|
3773
3844
|
return [{ ...run, carriedTurns }];
|
|
3774
3845
|
});
|
|
3775
|
-
this.
|
|
3776
|
-
this._codeQualityWarningsThisTurn.clear(turnSession);
|
|
3846
|
+
this.clearTurnWarnings(turnSession);
|
|
3777
3847
|
this._turnStartProjectSeq = this._projectSeq;
|
|
3778
3848
|
this._turnIndex += 1;
|
|
3779
3849
|
this._writeOrderTurn = nextOrderTurn();
|
|
@@ -3809,7 +3879,7 @@ var RuntimeCoordinator = class {
|
|
|
3809
3879
|
return {
|
|
3810
3880
|
seq: logged.projectSeq,
|
|
3811
3881
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3812
|
-
sessionId: this.
|
|
3882
|
+
sessionId: this.turnSession(args.sessionId),
|
|
3813
3883
|
turnIndex: this.turnIndex,
|
|
3814
3884
|
source: args.source,
|
|
3815
3885
|
filePath: path8.resolve(args.filePath),
|
|
@@ -4315,7 +4385,7 @@ var RuntimeCoordinator = class {
|
|
|
4315
4385
|
* cleared it (#3507). `recordedAtMs` is the pipeline's analysis read time
|
|
4316
4386
|
* (#3503); a caller without one stamps now.
|
|
4317
4387
|
*/
|
|
4318
|
-
recordInlineBlockers(filePath, summary, writeIndex, sources, lines, contentBaseline, diagnostics, orderTurn = this._writeOrderTurn, recordedAtMs = Date.now()) {
|
|
4388
|
+
recordInlineBlockers(filePath, summary, writeIndex, sources, lines, contentBaseline, diagnostics, orderTurn = this._writeOrderTurn, recordedAtMs = Date.now(), sessionId) {
|
|
4319
4389
|
const writeOrder = writeOrderToken(orderTurn, writeIndex);
|
|
4320
4390
|
if (!this._inlineBlockerWriteOrder.shouldWrite(normalizeMapKey(filePath), writeOrder))
|
|
4321
4391
|
return void 0;
|
|
@@ -4333,7 +4403,8 @@ var RuntimeCoordinator = class {
|
|
|
4333
4403
|
...contentBaseline ? {
|
|
4334
4404
|
recordedSize: contentBaseline.size,
|
|
4335
4405
|
recordedHash: contentBaseline.sha256
|
|
4336
|
-
} : {}
|
|
4406
|
+
} : {},
|
|
4407
|
+
...this.recordSession(sessionId)
|
|
4337
4408
|
});
|
|
4338
4409
|
return recordedAtMs;
|
|
4339
4410
|
}
|
|
@@ -4358,7 +4429,7 @@ var RuntimeCoordinator = class {
|
|
|
4358
4429
|
*
|
|
4359
4430
|
* @returns how many findings were new to the record (0 = a replay).
|
|
4360
4431
|
*/
|
|
4361
|
-
recordDeferredInlineBlockers(filePath, blocking, analysed) {
|
|
4432
|
+
recordDeferredInlineBlockers(filePath, blocking, analysed, sessionId) {
|
|
4362
4433
|
const key = filePath;
|
|
4363
4434
|
const existing = this._pendingInlineBlockers.get(key);
|
|
4364
4435
|
if (existing && !existing.diagnostics)
|
|
@@ -4377,7 +4448,8 @@ var RuntimeCoordinator = class {
|
|
|
4377
4448
|
...analysed.contentBaseline ? {
|
|
4378
4449
|
recordedSize: analysed.contentBaseline.size,
|
|
4379
4450
|
recordedHash: analysed.contentBaseline.sha256
|
|
4380
|
-
} : {}
|
|
4451
|
+
} : {},
|
|
4452
|
+
...this.recordSession(sessionId)
|
|
4381
4453
|
},
|
|
4382
4454
|
summary: formatDiagnostics(diagnostics, "blocking").trim(),
|
|
4383
4455
|
diagnostics,
|
|
@@ -4505,7 +4577,8 @@ var RuntimeCoordinator = class {
|
|
|
4505
4577
|
// (`writeOrderToken`); the line names only the write.
|
|
4506
4578
|
writeIndex: confirmedClean || retiringWriteOrder === void 0 ? void 0 : retiringWriteOrder % 2 ** 32,
|
|
4507
4579
|
confirmedClean,
|
|
4508
|
-
turnIndex: this._turnIndex
|
|
4580
|
+
turnIndex: this._turnIndex,
|
|
4581
|
+
...record.session === void 0 ? {} : { session: record.session }
|
|
4509
4582
|
});
|
|
4510
4583
|
}
|
|
4511
4584
|
/**
|
|
@@ -4837,12 +4910,18 @@ var RuntimeCoordinator = class {
|
|
|
4837
4910
|
* and a line that would not fit the message cap (called in list order).
|
|
4838
4911
|
* The "… and N more" overflow count rides with a batch that lists files and
|
|
4839
4912
|
* is otherwise kept, so a bare tail is never delivered.
|
|
4913
|
+
*
|
|
4914
|
+
* #4921: `of` names the consuming turn session; another session's note
|
|
4915
|
+
* stays for that session's turn end, unseen by `holdBack`.
|
|
4840
4916
|
*/
|
|
4841
|
-
consumeResolvedBlockerFiles(holdBack) {
|
|
4917
|
+
consumeResolvedBlockerFiles(holdBack, of) {
|
|
4842
4918
|
const files = [];
|
|
4843
4919
|
const held = [];
|
|
4844
4920
|
for (const entry of this._resolvedBlockerFilesThisTurn.values()) {
|
|
4845
|
-
(
|
|
4921
|
+
if (of && !this.ownedBy(entry, of.sessionId))
|
|
4922
|
+
held.push(entry);
|
|
4923
|
+
else
|
|
4924
|
+
(holdBack(entry) ? held : files).push(entry);
|
|
4846
4925
|
}
|
|
4847
4926
|
this._resolvedBlockerFilesThisTurn.clear();
|
|
4848
4927
|
for (const entry of held) {
|
|
@@ -4878,10 +4957,16 @@ var RuntimeCoordinator = class {
|
|
|
4878
4957
|
* turn or gate a commit. The map is tiny (per-turn blockers) and reads are
|
|
4879
4958
|
* bounded (once per turn_end / tool_result), so the probe cost is
|
|
4880
4959
|
* negligible.
|
|
4960
|
+
*
|
|
4961
|
+
* #4921: `of` names a turn session, and the snapshot holds only that
|
|
4962
|
+
* session's records: what its turn end may deliver, sweep or re-judge.
|
|
4963
|
+
* Omitted, every record: the commit gate's view, which answers for the
|
|
4964
|
+
* tree whichever session wrote the blocker.
|
|
4881
4965
|
*/
|
|
4882
|
-
getInlineBlockersSnapshot() {
|
|
4966
|
+
getInlineBlockersSnapshot(of) {
|
|
4883
4967
|
this.reconcileInlineBlockers();
|
|
4884
|
-
|
|
4968
|
+
const records = [...this._pendingInlineBlockers.values()];
|
|
4969
|
+
return of ? records.filter((entry) => this.ownedBy(entry, of.sessionId)) : records;
|
|
4885
4970
|
}
|
|
4886
4971
|
consumeInlineBlockers() {
|
|
4887
4972
|
const entries = this.getInlineBlockersSnapshot();
|
|
@@ -4896,23 +4981,49 @@ var RuntimeCoordinator = class {
|
|
|
4896
4981
|
turnSession(sessionId) {
|
|
4897
4982
|
return sessionId ?? this._telemetrySessionId;
|
|
4898
4983
|
}
|
|
4984
|
+
/**
|
|
4985
|
+
* The cell holding `sessionId`'s turn's warnings. The coordinator's own turn
|
|
4986
|
+
* is its scope's; a concurrent session's is found by id. `create` builds it
|
|
4987
|
+
* on first write; without it a missing cell is `undefined`.
|
|
4988
|
+
*/
|
|
4989
|
+
turnWarnings(sessionId, create) {
|
|
4990
|
+
const turnSession = this.turnSession(sessionId);
|
|
4991
|
+
const init = create ? newTurnWarningsCell : void 0;
|
|
4992
|
+
return turnSession === this._telemetrySessionId ? scopeCell(this._scope, TURN_WARNINGS_CELL, init) : sessionCell(turnSession, TURN_WARNINGS_CELL, init);
|
|
4993
|
+
}
|
|
4994
|
+
/** Drain both warning maps of `turnSession`; other sessions' cells are theirs. */
|
|
4995
|
+
clearTurnWarnings(turnSession) {
|
|
4996
|
+
const cell = this.turnWarnings(turnSession, false);
|
|
4997
|
+
cell?.actionable.clear();
|
|
4998
|
+
cell?.codeQuality.clear();
|
|
4999
|
+
}
|
|
4899
5000
|
recordActionableWarnings(warnings, sessionId) {
|
|
4900
|
-
this.
|
|
5001
|
+
const cell = this.turnWarnings(sessionId, true);
|
|
5002
|
+
if (cell)
|
|
5003
|
+
for (const item of warnings)
|
|
5004
|
+
cell.actionable.set(item.id, item);
|
|
4901
5005
|
}
|
|
4902
5006
|
peekActionableWarnings(sessionId) {
|
|
4903
|
-
return
|
|
5007
|
+
return [
|
|
5008
|
+
...this.turnWarnings(sessionId, false)?.actionable.values() ?? []
|
|
5009
|
+
];
|
|
4904
5010
|
}
|
|
4905
5011
|
clearActionableWarnings(sessionId) {
|
|
4906
|
-
this.
|
|
5012
|
+
this.turnWarnings(sessionId, false)?.actionable.clear();
|
|
4907
5013
|
}
|
|
4908
5014
|
recordCodeQualityWarnings(warnings, sessionId) {
|
|
4909
|
-
this.
|
|
5015
|
+
const cell = this.turnWarnings(sessionId, true);
|
|
5016
|
+
if (cell)
|
|
5017
|
+
for (const item of warnings)
|
|
5018
|
+
cell.codeQuality.set(item.id, item);
|
|
4910
5019
|
}
|
|
4911
5020
|
peekCodeQualityWarnings(sessionId) {
|
|
4912
|
-
return
|
|
5021
|
+
return [
|
|
5022
|
+
...this.turnWarnings(sessionId, false)?.codeQuality.values() ?? []
|
|
5023
|
+
];
|
|
4913
5024
|
}
|
|
4914
5025
|
clearCodeQualityWarnings(sessionId) {
|
|
4915
|
-
this.
|
|
5026
|
+
this.turnWarnings(sessionId, false)?.codeQuality.clear();
|
|
4916
5027
|
}
|
|
4917
5028
|
/**
|
|
4918
5029
|
* #3613 F2: the key a per-turn cap (the observed-mutation budget, a
|
|
@@ -4949,8 +5060,9 @@ var RuntimeCoordinator = class {
|
|
|
4949
5060
|
if (turnSession === this._telemetrySessionId)
|
|
4950
5061
|
return;
|
|
4951
5062
|
this._foreignTurnKeys.delete(turnSession);
|
|
4952
|
-
this.
|
|
4953
|
-
this.
|
|
5063
|
+
this._foreignReadGuards.get(turnSession)?.releaseFileTime();
|
|
5064
|
+
this._foreignReadGuards.delete(turnSession);
|
|
5065
|
+
this.clearTurnWarnings(turnSession);
|
|
4954
5066
|
}
|
|
4955
5067
|
/** #484: the per-run diagnostics/autofix/format collector (accumulates
|
|
4956
5068
|
* across turns; consumed once at the agent_settled quiet window). Always
|
|
@@ -4984,6 +5096,24 @@ var RuntimeCoordinator = class {
|
|
|
4984
5096
|
this._readGuard ??= new ReadGuard(this._telemetrySessionId, {}, this._scope);
|
|
4985
5097
|
return this._readGuard;
|
|
4986
5098
|
}
|
|
5099
|
+
/**
|
|
5100
|
+
* #4942: the read guard of `sessionId`'s turn, so an edit is judged by the
|
|
5101
|
+
* reads of the session that edits. The owner is the one `recordSession`
|
|
5102
|
+
* names for the inline blockers (#4921): a turn with no session id of its
|
|
5103
|
+
* own is the coordinator's, whose guard is {@link readGuard}; a concurrent
|
|
5104
|
+
* in-process secondary's is its own, built on first use.
|
|
5105
|
+
*/
|
|
5106
|
+
readGuardFor(sessionId) {
|
|
5107
|
+
const owner = this.recordSession(sessionId).session;
|
|
5108
|
+
if (owner === void 0)
|
|
5109
|
+
return this.readGuard;
|
|
5110
|
+
let guard = this._foreignReadGuards.get(owner);
|
|
5111
|
+
if (guard === void 0) {
|
|
5112
|
+
guard = new ReadGuard(owner, {}, this._scope);
|
|
5113
|
+
this._foreignReadGuards.set(owner, guard);
|
|
5114
|
+
}
|
|
5115
|
+
return guard;
|
|
5116
|
+
}
|
|
4987
5117
|
/**
|
|
4988
5118
|
* Record the canonical target `tool_call` resolved for `toolCallId`
|
|
4989
5119
|
* (#1642). The paired `tool_result` claims this exactly once via
|
|
@@ -5220,6 +5350,7 @@ var RuntimeCoordinator = class {
|
|
|
5220
5350
|
|
|
5221
5351
|
// dist/clients/runtime-session.js
|
|
5222
5352
|
import * as nodeFs from "node:fs";
|
|
5353
|
+
import * as os3 from "node:os";
|
|
5223
5354
|
import * as path13 from "node:path";
|
|
5224
5355
|
|
|
5225
5356
|
// dist/clients/message-end-attribution.js
|
|
@@ -5594,7 +5725,7 @@ function logHostReadyDelay(deps, cwd) {
|
|
|
5594
5725
|
function resolveSnapshotRoot(cwd) {
|
|
5595
5726
|
const resolvedCwd = path13.resolve(cwd);
|
|
5596
5727
|
const nearest = findNearestProjectRoot(resolvedCwd);
|
|
5597
|
-
if (!nearest || isAtOrAboveHomeDir(nearest)) {
|
|
5728
|
+
if (!nearest || isAtOrAboveHomeDir(realpathOrResolve(nearest), realpathOrResolve(os3.homedir()))) {
|
|
5598
5729
|
return resolvedCwd;
|
|
5599
5730
|
}
|
|
5600
5731
|
return nearest;
|
|
@@ -5673,6 +5804,91 @@ function logProjectSnapshotProbe(args) {
|
|
|
5673
5804
|
args.dbg(`project_snapshot: miss reason=${args.missReason}`);
|
|
5674
5805
|
}
|
|
5675
5806
|
}
|
|
5807
|
+
async function readSequenceAndHydrateFreshSnapshot(args) {
|
|
5808
|
+
const { snapshotRoot, cwd, runtime, sessionGeneration, dbg, onDeferredSequenceResolved } = args;
|
|
5809
|
+
const sequenceReadStartedAt = Date.now();
|
|
5810
|
+
const { latestSeq, timedOut } = await bounded(readSequenceWithBudget({
|
|
5811
|
+
snapshotRoot,
|
|
5812
|
+
base: snapshotSequenceBase(snapshotRoot),
|
|
5813
|
+
cwd,
|
|
5814
|
+
runtime,
|
|
5815
|
+
sessionGeneration,
|
|
5816
|
+
dbg,
|
|
5817
|
+
onDeferredSequenceResolved
|
|
5818
|
+
}), {
|
|
5819
|
+
ms: HOOK_WALL_BUDGET_MS.session_start,
|
|
5820
|
+
signal: void 0,
|
|
5821
|
+
hook: "session_start",
|
|
5822
|
+
label: "readSequenceWithBudget"
|
|
5823
|
+
}) ?? coldSequenceRead();
|
|
5824
|
+
logLatency({
|
|
5825
|
+
type: "phase",
|
|
5826
|
+
phase: "session_start_sequence_read",
|
|
5827
|
+
filePath: cwd,
|
|
5828
|
+
startedAt: new Date(sequenceReadStartedAt).toISOString(),
|
|
5829
|
+
durationMs: Date.now() - sequenceReadStartedAt,
|
|
5830
|
+
metadata: { entries: latestSeq.fileSeqByPath.size, timedOut }
|
|
5831
|
+
});
|
|
5832
|
+
if (timedOut) {
|
|
5833
|
+
recordSnapshotSequenceTimeout({
|
|
5834
|
+
snapshotRoot,
|
|
5835
|
+
snapshotPath: getProjectSnapshotPath(snapshotRoot)
|
|
5836
|
+
});
|
|
5837
|
+
}
|
|
5838
|
+
runtime.seedProjectSequence?.(latestSeq.projectSeq, latestSeq.fileSeqByPath, latestSeq.logEntries);
|
|
5839
|
+
const effectiveSeq = runtime.projectSeq ?? latestSeq.projectSeq;
|
|
5840
|
+
dbg(`session_start sequence: projectSeq=${effectiveSeq} fileSeqEntries=${latestSeq.fileSeqByPath.size}`);
|
|
5841
|
+
const freshnessSeq = timedOut ? UNKNOWN_PROJECT_SEQ : effectiveSeq;
|
|
5842
|
+
const snapshotLoadStartedAt = Date.now();
|
|
5843
|
+
const snapshotPath = getProjectSnapshotPath(snapshotRoot);
|
|
5844
|
+
let snapshotBytes = 0;
|
|
5845
|
+
try {
|
|
5846
|
+
snapshotBytes = nodeFs.statSync(snapshotPath).size;
|
|
5847
|
+
} catch {
|
|
5848
|
+
}
|
|
5849
|
+
const snapshotBodyPresent = nodeFs.existsSync(snapshotPath) || nodeFs.existsSync(getProjectSnapshotLegacyPath(snapshotRoot));
|
|
5850
|
+
const snapshotGate = loadSnapshotBodyUnlessStale({
|
|
5851
|
+
root: snapshotRoot,
|
|
5852
|
+
currentProjectSeq: freshnessSeq,
|
|
5853
|
+
unlockedThrough: latestSeq.unlockedThrough ?? 0,
|
|
5854
|
+
dbg
|
|
5855
|
+
});
|
|
5856
|
+
const snapshot = snapshotGate.snapshot;
|
|
5857
|
+
const snapshotFresh = isProjectSnapshotFresh(snapshot, freshnessSeq, latestSeq.unlockedThrough);
|
|
5858
|
+
const snapshotMissReason = describeSnapshotMiss(snapshot, freshnessSeq, {
|
|
5859
|
+
skippedStale: snapshotGate.skippedStale,
|
|
5860
|
+
bodyPresent: snapshotBodyPresent,
|
|
5861
|
+
unlockedThrough: latestSeq.unlockedThrough ?? 0
|
|
5862
|
+
});
|
|
5863
|
+
logLatency({
|
|
5864
|
+
type: "phase",
|
|
5865
|
+
phase: "session_start_snapshot_load",
|
|
5866
|
+
filePath: cwd,
|
|
5867
|
+
startedAt: new Date(snapshotLoadStartedAt).toISOString(),
|
|
5868
|
+
durationMs: Date.now() - snapshotLoadStartedAt,
|
|
5869
|
+
metadata: {
|
|
5870
|
+
bytes: snapshotBytes,
|
|
5871
|
+
fresh: snapshotFresh,
|
|
5872
|
+
seq: snapshot?.seq ?? null,
|
|
5873
|
+
reason: snapshotFresh ? void 0 : snapshotMissReason,
|
|
5874
|
+
...snapshotGate.skippedStale ? { skippedStale: true } : {},
|
|
5875
|
+
...timedOut ? { sequenceUnknown: true } : {}
|
|
5876
|
+
}
|
|
5877
|
+
});
|
|
5878
|
+
logProjectSnapshotProbe({
|
|
5879
|
+
dbg,
|
|
5880
|
+
root: snapshotRoot,
|
|
5881
|
+
currentProjectSeq: freshnessSeq,
|
|
5882
|
+
unlockedThrough: latestSeq.unlockedThrough ?? 0,
|
|
5883
|
+
snapshot,
|
|
5884
|
+
missReason: snapshotMissReason
|
|
5885
|
+
});
|
|
5886
|
+
const freshSnapshot = snapshotFresh ? snapshot : null;
|
|
5887
|
+
if (freshSnapshot) {
|
|
5888
|
+
hydrateRuntimeFromProjectSnapshot(runtime, freshSnapshot);
|
|
5889
|
+
}
|
|
5890
|
+
return freshSnapshot;
|
|
5891
|
+
}
|
|
5676
5892
|
function resolveStartupMode(projectConfig, globalConfig) {
|
|
5677
5893
|
const envMode = (process.env.PI_LENS_STARTUP_MODE ?? "").trim().toLowerCase();
|
|
5678
5894
|
if (envMode === "full" || envMode === "minimal" || envMode === "quick") {
|
|
@@ -5688,7 +5904,8 @@ function resolveStartupMode(projectConfig, globalConfig) {
|
|
|
5688
5904
|
}
|
|
5689
5905
|
function sequenceReadBudgetMs() {
|
|
5690
5906
|
const raw = Number(process.env.PI_LENS_SEQUENCE_READ_BUDGET_MS ?? 250);
|
|
5691
|
-
|
|
5907
|
+
const budget = Number.isFinite(raw) && raw > 0 ? raw : 250;
|
|
5908
|
+
return Math.min(budget, HOOK_WALL_BUDGET_MS.session_start);
|
|
5692
5909
|
}
|
|
5693
5910
|
var UNKNOWN_PROJECT_SEQ = -1;
|
|
5694
5911
|
async function readSequenceWithBudget(args) {
|
|
@@ -5747,6 +5964,9 @@ async function readSequenceWithBudget(args) {
|
|
|
5747
5964
|
dbg(`session_start: deferred sequence read failed: ${err}`);
|
|
5748
5965
|
});
|
|
5749
5966
|
}
|
|
5967
|
+
return coldSequenceRead();
|
|
5968
|
+
}
|
|
5969
|
+
function coldSequenceRead() {
|
|
5750
5970
|
return {
|
|
5751
5971
|
latestSeq: { projectSeq: 0, fileSeqByPath: /* @__PURE__ */ new Map() },
|
|
5752
5972
|
timedOut: true
|
|
@@ -5796,7 +6016,7 @@ async function igniteDominantLanguageWarm(cwd, runtime, sessionGeneration, dbg)
|
|
|
5796
6016
|
if (!runtime.isCurrentSession(sessionGeneration))
|
|
5797
6017
|
return;
|
|
5798
6018
|
const lspService = (await loadLspService()).getLSPService();
|
|
5799
|
-
const { collectSourceFilesAsync } = await import("../chunk-
|
|
6019
|
+
const { collectSourceFilesAsync } = await import("../chunk-U7BD2QL7.js");
|
|
5800
6020
|
const { CODE_KINDS, detectFileKind: detectFileKind2 } = await import("../chunk-U2SDMG7C.js");
|
|
5801
6021
|
const files = await collectSourceFilesAsync(cwd, {
|
|
5802
6022
|
inspectGeneratedHeaders: false
|
|
@@ -5871,7 +6091,7 @@ function scheduleManagedToolRefresh(dbg, rulePack) {
|
|
|
5871
6091
|
managedToolRefreshTimer = void 0;
|
|
5872
6092
|
void (async () => {
|
|
5873
6093
|
try {
|
|
5874
|
-
const refresh = await import("../chunk-
|
|
6094
|
+
const refresh = await import("../chunk-CE6VMBCB.js");
|
|
5875
6095
|
const outcome = await refresh.runManagedToolRefresh(void 0, {
|
|
5876
6096
|
rulePack
|
|
5877
6097
|
});
|
|
@@ -5921,7 +6141,7 @@ function scanOneTodoFile(scanner, filePath, items) {
|
|
|
5921
6141
|
async function collectTodoBaselineItems(scanner, analysisRoot, stillCurrent) {
|
|
5922
6142
|
const items = [];
|
|
5923
6143
|
try {
|
|
5924
|
-
const { getSourceFilesAsync } = await import("../chunk-
|
|
6144
|
+
const { getSourceFilesAsync } = await import("../chunk-CTADOKYM.js");
|
|
5925
6145
|
const files = await getSourceFilesAsync(analysisRoot, true);
|
|
5926
6146
|
if (!stillCurrent())
|
|
5927
6147
|
return items;
|
|
@@ -5950,7 +6170,7 @@ async function buildOrRefreshWordIndex(args) {
|
|
|
5950
6170
|
const snapshot = loadProjectSnapshot(snapshotRoot);
|
|
5951
6171
|
const snapshotLoadMs = Date.now() - snapshotLoadStartMs;
|
|
5952
6172
|
if (snapshot?.wordIndex) {
|
|
5953
|
-
const { deserializeWordIndex, refreshWordIndexIncrementally, countWordIndexPostingEntries: countWordIndexPostingEntries2, estimateWordIndexResidentBytes: estimateWordIndexResidentBytes2, notifyWordIndexPublished: notifyWordIndexPublished2 } = await import("../chunk-
|
|
6173
|
+
const { deserializeWordIndex, refreshWordIndexIncrementally, countWordIndexPostingEntries: countWordIndexPostingEntries2, estimateWordIndexResidentBytes: estimateWordIndexResidentBytes2, notifyWordIndexPublished: notifyWordIndexPublished2 } = await import("../chunk-OXOI55RU.js");
|
|
5954
6174
|
const deserializeStartMs = Date.now();
|
|
5955
6175
|
const index = deserializeWordIndex(snapshot.wordIndex);
|
|
5956
6176
|
const deserializeMs = Date.now() - deserializeStartMs;
|
|
@@ -6023,7 +6243,7 @@ async function buildOrRefreshWordIndex(args) {
|
|
|
6023
6243
|
}
|
|
6024
6244
|
}
|
|
6025
6245
|
}
|
|
6026
|
-
const { buildWordIndexAsync, collectWordIndexDocs, countWordIndexPostingEntries, estimateWordIndexResidentBytes, notifyWordIndexPublished } = await import("../chunk-
|
|
6246
|
+
const { buildWordIndexAsync, collectWordIndexDocs, countWordIndexPostingEntries, estimateWordIndexResidentBytes, notifyWordIndexPublished } = await import("../chunk-OXOI55RU.js");
|
|
6027
6247
|
const docs = await collectWordIndexDocs(analysisRoot, () => runtime.isCurrentSession(sessionGeneration), rebuildPreflightFiles);
|
|
6028
6248
|
if (!runtime.isCurrentSession(sessionGeneration))
|
|
6029
6249
|
return;
|
|
@@ -6403,8 +6623,8 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
|
|
|
6403
6623
|
let callGraphIdentity;
|
|
6404
6624
|
const callGraphTask = runTask("call-graph", async () => {
|
|
6405
6625
|
const { FactStore: FactStore2 } = await import("../chunk-F6X3YJWD.js");
|
|
6406
|
-
const { buildOrUpdateGraph, extractSymbolsAndRefsFromGraph, getReviewGraphCacheIdentity } = await import("../chunk-
|
|
6407
|
-
const { buildCallGraph, saveCallGraph, loadCallGraph: loadCallGraph2 } = await import("../chunk-
|
|
6626
|
+
const { buildOrUpdateGraph, extractSymbolsAndRefsFromGraph, getReviewGraphCacheIdentity } = await import("../chunk-3K2F6UDZ.js");
|
|
6627
|
+
const { buildCallGraph, saveCallGraph, loadCallGraph: loadCallGraph2 } = await import("../chunk-2TF6RXWB.js");
|
|
6408
6628
|
if (!runtime.isCurrentSession(sessionGeneration))
|
|
6409
6629
|
return;
|
|
6410
6630
|
const startMs = Date.now();
|
|
@@ -6445,7 +6665,7 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
|
|
|
6445
6665
|
return;
|
|
6446
6666
|
if (!runtime.callGraph)
|
|
6447
6667
|
return;
|
|
6448
|
-
const { buildCodebaseModel, saveCodebaseModel, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET } = await import("../chunk-
|
|
6668
|
+
const { buildCodebaseModel, saveCodebaseModel, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET } = await import("../chunk-LS3QJRUB.js");
|
|
6449
6669
|
if (!callGraphIdentity)
|
|
6450
6670
|
return;
|
|
6451
6671
|
const model = buildCodebaseModel(runtime.callGraph, analysisRoot, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET, callGraphIdentity);
|
|
@@ -6654,8 +6874,8 @@ async function handleSessionStart(deps) {
|
|
|
6654
6874
|
try {
|
|
6655
6875
|
warmupDbg("warmup: starting background warmup");
|
|
6656
6876
|
const scanContextStartedAt = Date.now();
|
|
6657
|
-
const startupScanModule = await import("../chunk-
|
|
6658
|
-
const languageProfileModule = await import("../chunk-
|
|
6877
|
+
const startupScanModule = await import("../chunk-KKCK636N.js");
|
|
6878
|
+
const languageProfileModule = await import("../chunk-4L36HG27.js");
|
|
6659
6879
|
const warmupSnapshotRoot = resolveSnapshotRoot(warmupCwd);
|
|
6660
6880
|
const cachedSnapshot = loadProjectSnapshot(warmupSnapshotRoot);
|
|
6661
6881
|
warmupOwnSnapshotRead = cachedSnapshot ? {
|
|
@@ -6736,6 +6956,8 @@ async function handleSessionStart(deps) {
|
|
|
6736
6956
|
const lspPrewarmStartedAt = Date.now();
|
|
6737
6957
|
if (deps.getFlag("no-lsp")) {
|
|
6738
6958
|
warmupDbg("warmup: skipping LSP pre-warm (no-lsp)");
|
|
6959
|
+
} else if (deps.getFlag("no-lens")) {
|
|
6960
|
+
warmupDbg("warmup: skipping LSP pre-warm (no-lens)");
|
|
6739
6961
|
} else if (isSubagentSession()) {
|
|
6740
6962
|
warmupDbg("warmup: skipping LSP pre-warm (subagent session)");
|
|
6741
6963
|
} else if (isWarmAttached()) {
|
|
@@ -6873,11 +7095,9 @@ async function handleSessionStart(deps) {
|
|
|
6873
7095
|
});
|
|
6874
7096
|
if (quickMode) {
|
|
6875
7097
|
runtime.projectRoot = cwd;
|
|
6876
|
-
const sequenceReadStartedAt2 = Date.now();
|
|
6877
7098
|
const snapshotRoot2 = resolveSnapshotRoot(cwd);
|
|
6878
|
-
|
|
7099
|
+
await readSequenceAndHydrateFreshSnapshot({
|
|
6879
7100
|
snapshotRoot: snapshotRoot2,
|
|
6880
|
-
base: snapshotSequenceBase(snapshotRoot2),
|
|
6881
7101
|
cwd,
|
|
6882
7102
|
runtime,
|
|
6883
7103
|
sessionGeneration: runtime.sessionGeneration,
|
|
@@ -6889,71 +7109,6 @@ async function handleSessionStart(deps) {
|
|
|
6889
7109
|
dbg
|
|
6890
7110
|
})
|
|
6891
7111
|
});
|
|
6892
|
-
logLatency({
|
|
6893
|
-
type: "phase",
|
|
6894
|
-
phase: "session_start_sequence_read",
|
|
6895
|
-
filePath: cwd,
|
|
6896
|
-
startedAt: new Date(sequenceReadStartedAt2).toISOString(),
|
|
6897
|
-
durationMs: Date.now() - sequenceReadStartedAt2,
|
|
6898
|
-
metadata: { entries: latestSeq2.fileSeqByPath.size, timedOut: timedOut2 }
|
|
6899
|
-
});
|
|
6900
|
-
if (timedOut2) {
|
|
6901
|
-
recordSnapshotSequenceTimeout({
|
|
6902
|
-
snapshotRoot: snapshotRoot2,
|
|
6903
|
-
snapshotPath: getProjectSnapshotPath(snapshotRoot2)
|
|
6904
|
-
});
|
|
6905
|
-
}
|
|
6906
|
-
runtime.seedProjectSequence?.(latestSeq2.projectSeq, latestSeq2.fileSeqByPath, latestSeq2.logEntries);
|
|
6907
|
-
const effectiveSeq2 = runtime.projectSeq ?? latestSeq2.projectSeq;
|
|
6908
|
-
dbg(`session_start sequence: projectSeq=${effectiveSeq2} fileSeqEntries=${latestSeq2.fileSeqByPath.size}`);
|
|
6909
|
-
const freshnessSeq2 = timedOut2 ? UNKNOWN_PROJECT_SEQ : effectiveSeq2;
|
|
6910
|
-
const snapshotLoadStartedAt2 = Date.now();
|
|
6911
|
-
const snapshotPath2 = getProjectSnapshotPath(snapshotRoot2);
|
|
6912
|
-
let snapshotBytes2 = 0;
|
|
6913
|
-
try {
|
|
6914
|
-
snapshotBytes2 = nodeFs.statSync(snapshotPath2).size;
|
|
6915
|
-
} catch {
|
|
6916
|
-
}
|
|
6917
|
-
const snapshotBodyPresent2 = nodeFs.existsSync(snapshotPath2) || nodeFs.existsSync(getProjectSnapshotLegacyPath(snapshotRoot2));
|
|
6918
|
-
const snapshotGate2 = loadSnapshotBodyUnlessStale({
|
|
6919
|
-
root: snapshotRoot2,
|
|
6920
|
-
currentProjectSeq: freshnessSeq2,
|
|
6921
|
-
unlockedThrough: latestSeq2.unlockedThrough ?? 0,
|
|
6922
|
-
dbg
|
|
6923
|
-
});
|
|
6924
|
-
const snapshot2 = snapshotGate2.snapshot;
|
|
6925
|
-
const snapshotFresh2 = isProjectSnapshotFresh(snapshot2, freshnessSeq2, latestSeq2.unlockedThrough);
|
|
6926
|
-
const snapshotMissReason2 = describeSnapshotMiss(snapshot2, freshnessSeq2, {
|
|
6927
|
-
skippedStale: snapshotGate2.skippedStale,
|
|
6928
|
-
bodyPresent: snapshotBodyPresent2,
|
|
6929
|
-
unlockedThrough: latestSeq2.unlockedThrough ?? 0
|
|
6930
|
-
});
|
|
6931
|
-
logLatency({
|
|
6932
|
-
type: "phase",
|
|
6933
|
-
phase: "session_start_snapshot_load",
|
|
6934
|
-
filePath: cwd,
|
|
6935
|
-
startedAt: new Date(snapshotLoadStartedAt2).toISOString(),
|
|
6936
|
-
durationMs: Date.now() - snapshotLoadStartedAt2,
|
|
6937
|
-
metadata: {
|
|
6938
|
-
bytes: snapshotBytes2,
|
|
6939
|
-
fresh: snapshotFresh2,
|
|
6940
|
-
seq: snapshot2?.seq ?? null,
|
|
6941
|
-
reason: snapshotFresh2 ? void 0 : snapshotMissReason2,
|
|
6942
|
-
...snapshotGate2.skippedStale ? { skippedStale: true } : {},
|
|
6943
|
-
...timedOut2 ? { sequenceUnknown: true } : {}
|
|
6944
|
-
}
|
|
6945
|
-
});
|
|
6946
|
-
logProjectSnapshotProbe({
|
|
6947
|
-
dbg,
|
|
6948
|
-
root: snapshotRoot2,
|
|
6949
|
-
currentProjectSeq: freshnessSeq2,
|
|
6950
|
-
unlockedThrough: latestSeq2.unlockedThrough ?? 0,
|
|
6951
|
-
snapshot: snapshot2,
|
|
6952
|
-
missReason: snapshotMissReason2
|
|
6953
|
-
});
|
|
6954
|
-
if (snapshotFresh2) {
|
|
6955
|
-
hydrateRuntimeFromProjectSnapshot(runtime, snapshot2);
|
|
6956
|
-
}
|
|
6957
7112
|
const quickTools = [];
|
|
6958
7113
|
if (!getFlag("no-lsp")) {
|
|
6959
7114
|
quickTools.push("LSP Service");
|
|
@@ -7020,82 +7175,14 @@ async function handleSessionStart(deps) {
|
|
|
7020
7175
|
}
|
|
7021
7176
|
}
|
|
7022
7177
|
const sessionGeneration = runtime.sessionGeneration;
|
|
7023
|
-
const sequenceReadStartedAt = Date.now();
|
|
7024
7178
|
const snapshotRoot = resolveSnapshotRoot(cwd);
|
|
7025
|
-
const
|
|
7179
|
+
const freshSnapshot = await readSequenceAndHydrateFreshSnapshot({
|
|
7026
7180
|
snapshotRoot,
|
|
7027
|
-
base: snapshotSequenceBase(snapshotRoot),
|
|
7028
7181
|
cwd,
|
|
7029
7182
|
runtime,
|
|
7030
7183
|
sessionGeneration,
|
|
7031
7184
|
dbg
|
|
7032
7185
|
});
|
|
7033
|
-
logLatency({
|
|
7034
|
-
type: "phase",
|
|
7035
|
-
phase: "session_start_sequence_read",
|
|
7036
|
-
filePath: cwd,
|
|
7037
|
-
startedAt: new Date(sequenceReadStartedAt).toISOString(),
|
|
7038
|
-
durationMs: Date.now() - sequenceReadStartedAt,
|
|
7039
|
-
metadata: { entries: latestSeq.fileSeqByPath.size, timedOut }
|
|
7040
|
-
});
|
|
7041
|
-
if (timedOut) {
|
|
7042
|
-
recordSnapshotSequenceTimeout({
|
|
7043
|
-
snapshotRoot,
|
|
7044
|
-
snapshotPath: getProjectSnapshotPath(snapshotRoot)
|
|
7045
|
-
});
|
|
7046
|
-
}
|
|
7047
|
-
runtime.seedProjectSequence?.(latestSeq.projectSeq, latestSeq.fileSeqByPath, latestSeq.logEntries);
|
|
7048
|
-
const effectiveSeq = runtime.projectSeq ?? latestSeq.projectSeq;
|
|
7049
|
-
dbg(`session_start sequence: projectSeq=${effectiveSeq} fileSeqEntries=${latestSeq.fileSeqByPath.size}`);
|
|
7050
|
-
const freshnessSeq = timedOut ? UNKNOWN_PROJECT_SEQ : effectiveSeq;
|
|
7051
|
-
const snapshotLoadStartedAt = Date.now();
|
|
7052
|
-
const snapshotPath = getProjectSnapshotPath(snapshotRoot);
|
|
7053
|
-
let snapshotBytes = 0;
|
|
7054
|
-
try {
|
|
7055
|
-
snapshotBytes = nodeFs.statSync(snapshotPath).size;
|
|
7056
|
-
} catch {
|
|
7057
|
-
}
|
|
7058
|
-
const snapshotBodyPresent = nodeFs.existsSync(snapshotPath) || nodeFs.existsSync(getProjectSnapshotLegacyPath(snapshotRoot));
|
|
7059
|
-
const snapshotGate = loadSnapshotBodyUnlessStale({
|
|
7060
|
-
root: snapshotRoot,
|
|
7061
|
-
currentProjectSeq: freshnessSeq,
|
|
7062
|
-
unlockedThrough: latestSeq.unlockedThrough ?? 0,
|
|
7063
|
-
dbg
|
|
7064
|
-
});
|
|
7065
|
-
const snapshot = snapshotGate.snapshot;
|
|
7066
|
-
const snapshotFresh = isProjectSnapshotFresh(snapshot, freshnessSeq, latestSeq.unlockedThrough);
|
|
7067
|
-
const snapshotMissReason = describeSnapshotMiss(snapshot, freshnessSeq, {
|
|
7068
|
-
skippedStale: snapshotGate.skippedStale,
|
|
7069
|
-
bodyPresent: snapshotBodyPresent,
|
|
7070
|
-
unlockedThrough: latestSeq.unlockedThrough ?? 0
|
|
7071
|
-
});
|
|
7072
|
-
logLatency({
|
|
7073
|
-
type: "phase",
|
|
7074
|
-
phase: "session_start_snapshot_load",
|
|
7075
|
-
filePath: cwd,
|
|
7076
|
-
startedAt: new Date(snapshotLoadStartedAt).toISOString(),
|
|
7077
|
-
durationMs: Date.now() - snapshotLoadStartedAt,
|
|
7078
|
-
metadata: {
|
|
7079
|
-
bytes: snapshotBytes,
|
|
7080
|
-
fresh: snapshotFresh,
|
|
7081
|
-
seq: snapshot?.seq ?? null,
|
|
7082
|
-
reason: snapshotFresh ? void 0 : snapshotMissReason,
|
|
7083
|
-
...snapshotGate.skippedStale ? { skippedStale: true } : {},
|
|
7084
|
-
...timedOut ? { sequenceUnknown: true } : {}
|
|
7085
|
-
}
|
|
7086
|
-
});
|
|
7087
|
-
logProjectSnapshotProbe({
|
|
7088
|
-
dbg,
|
|
7089
|
-
root: snapshotRoot,
|
|
7090
|
-
currentProjectSeq: freshnessSeq,
|
|
7091
|
-
unlockedThrough: latestSeq.unlockedThrough ?? 0,
|
|
7092
|
-
snapshot,
|
|
7093
|
-
missReason: snapshotMissReason
|
|
7094
|
-
});
|
|
7095
|
-
const freshSnapshot = snapshotFresh ? snapshot : null;
|
|
7096
|
-
if (freshSnapshot) {
|
|
7097
|
-
hydrateRuntimeFromProjectSnapshot(runtime, freshSnapshot);
|
|
7098
|
-
}
|
|
7099
7186
|
const cachedStartupScan = freshSnapshot?.startupScan && isStartupScanVerdictFresh(freshSnapshot.startupScan) ? freshSnapshot.startupScan : void 0;
|
|
7100
7187
|
const startupScanSource = cachedStartupScan ? "snapshot" : "computed";
|
|
7101
7188
|
let startupScan;
|
|
@@ -7250,6 +7337,8 @@ async function handleSessionStart(deps) {
|
|
|
7250
7337
|
}
|
|
7251
7338
|
if (subagentSession) {
|
|
7252
7339
|
dbg("session_start lsp-warm: skipping pre-warm (subagent session)");
|
|
7340
|
+
} else if (getFlag("no-lens")) {
|
|
7341
|
+
dbg("session_start lsp-warm: skipping pre-warm (no-lens)");
|
|
7253
7342
|
} else if (!getFlag("no-lsp") && allowBootstrapTasks) {
|
|
7254
7343
|
setImmediate(() => {
|
|
7255
7344
|
void loadLSPConfig(cwd).then((lspConfig) => {
|
|
@@ -8345,7 +8434,7 @@ import * as path17 from "node:path";
|
|
|
8345
8434
|
import * as fs13 from "node:fs";
|
|
8346
8435
|
import { resolve as resolve9 } from "node:path";
|
|
8347
8436
|
function judgeDeferredRunnerFindings(pending2, cwd, options = {}) {
|
|
8348
|
-
const findings = pending2.result?.diagnostics ?? [];
|
|
8437
|
+
const findings = (pending2.result?.diagnostics ?? []).flatMap((d) => d.runnerFault === true ? [] : [d]);
|
|
8349
8438
|
if (findings.length === 0) {
|
|
8350
8439
|
return { stale: 0, live: 0, kept: [], suppressed: 0, bytes: void 0 };
|
|
8351
8440
|
}
|
|
@@ -8387,15 +8476,21 @@ function recordDeferredRunnerBlockers(runtime, pending2, survivors, bytes) {
|
|
|
8387
8476
|
const blocking = stampLineHashes(withoutLaneCopies(runtime, pending2, survivors).flatMap((d) => d.semantic === "blocking" ? [{ ...d, runnerId: d.runnerId ?? pending2.runnerId }] : []), bytes?.toString("utf-8"), (d) => !d.filePath || resolve9(d.filePath) === resolve9(pending2.filePath));
|
|
8388
8477
|
if (blocking.length === 0)
|
|
8389
8478
|
return 0;
|
|
8390
|
-
const recorded = runtime.recordDeferredInlineBlockers(
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8479
|
+
const recorded = runtime.recordDeferredInlineBlockers(
|
|
8480
|
+
pending2.filePath,
|
|
8481
|
+
blocking,
|
|
8482
|
+
{
|
|
8483
|
+
recordedAtMs: pending2.markedAtMs,
|
|
8484
|
+
...bytes ? {
|
|
8485
|
+
contentBaseline: {
|
|
8486
|
+
size: bytes.byteLength,
|
|
8487
|
+
sha256: hashContentBytes(bytes)
|
|
8488
|
+
}
|
|
8489
|
+
} : {}
|
|
8490
|
+
},
|
|
8491
|
+
// #4943: the producing write's session, stamped by the dispatch.
|
|
8492
|
+
pending2.sessionId
|
|
8493
|
+
);
|
|
8399
8494
|
if (recorded > 0)
|
|
8400
8495
|
runtime.updateGitGuardStatus(false, "");
|
|
8401
8496
|
return recorded;
|
|
@@ -8618,16 +8713,15 @@ function pastFreshnessWindow(partition, now) {
|
|
|
8618
8713
|
const writtenAt = partition.blockerWrittenAt;
|
|
8619
8714
|
return writtenAt !== void 0 && now - writtenAt > DEFAULT_MAX_AGE_MS;
|
|
8620
8715
|
}
|
|
8621
|
-
function readTurnEndGuardRecord(cacheManager2, runtime, cwd) {
|
|
8716
|
+
function readTurnEndGuardRecord(cacheManager2, runtime, cwd, sessionId) {
|
|
8622
8717
|
const stored = storedRecord(cacheManager2, cwd)?.fields;
|
|
8623
|
-
const { carried, dropped } = carriedTurnEndBlockers(stored,
|
|
8718
|
+
const { carried, dropped } = carriedTurnEndBlockers(stored, cwd, sessionId ?? runtime.telemetrySessionId);
|
|
8624
8719
|
return { stored, carried, dropped };
|
|
8625
8720
|
}
|
|
8626
|
-
function carriedTurnEndBlockers(stored,
|
|
8721
|
+
function carriedTurnEndBlockers(stored, cwd, me) {
|
|
8627
8722
|
const dropped = { gone: false, noFile: false };
|
|
8628
8723
|
if (!isTurnEndFindingsCache(stored))
|
|
8629
8724
|
return { carried: [], dropped, stamped: false };
|
|
8630
|
-
const me = runtime.telemetrySessionId;
|
|
8631
8725
|
const now = Date.now();
|
|
8632
8726
|
const carried = [];
|
|
8633
8727
|
let stamped = false;
|
|
@@ -8664,7 +8758,8 @@ var NO_CLAIM_FIELDS = [
|
|
|
8664
8758
|
"content",
|
|
8665
8759
|
"affectedFiles",
|
|
8666
8760
|
"affectedFilesTruncated",
|
|
8667
|
-
"provenance"
|
|
8761
|
+
"provenance",
|
|
8762
|
+
"deliverTo"
|
|
8668
8763
|
];
|
|
8669
8764
|
function makesNoClaim(fields) {
|
|
8670
8765
|
return !!fields && typeof fields.content === "string" && Object.keys(fields).every((key) => NO_CLAIM_FIELDS.some((field) => field === key));
|
|
@@ -8680,28 +8775,28 @@ function logRecordRetired(cwd, by, basis) {
|
|
|
8680
8775
|
metadata: { by, basis }
|
|
8681
8776
|
});
|
|
8682
8777
|
}
|
|
8683
|
-
function retireSettledGitGuardRecord(runtime, cacheManager2, cwd) {
|
|
8778
|
+
function retireSettledGitGuardRecord(runtime, cacheManager2, cwd, sessionId) {
|
|
8684
8779
|
const stored = storedRecord(cacheManager2, cwd)?.fields;
|
|
8685
8780
|
if (!stored)
|
|
8686
8781
|
return false;
|
|
8687
|
-
const
|
|
8782
|
+
const me = sessionId ?? runtime.telemetrySessionId;
|
|
8783
|
+
const own = stored.sessionId === me && stored.testFailures !== true && stored.carriedBlockers === void 0;
|
|
8688
8784
|
const basis = own ? "own_session" : claimsNoBlocker(stored) ? "no_blocker" : makesNoClaim(stored) ? "no_claim" : void 0;
|
|
8689
8785
|
if (basis) {
|
|
8690
8786
|
cacheManager2.clearCache("turn-end-findings", cwd);
|
|
8691
|
-
runtime.clearGitGuardCacheUnknown();
|
|
8787
|
+
runtime.clearGitGuardCacheUnknown(cwd);
|
|
8692
8788
|
logRecordRetired(cwd, "turn_end", basis);
|
|
8693
8789
|
return true;
|
|
8694
8790
|
}
|
|
8695
|
-
return retireOwnPartition(runtime, cacheManager2, cwd, stored);
|
|
8791
|
+
return retireOwnPartition(runtime, cacheManager2, cwd, stored, me);
|
|
8696
8792
|
}
|
|
8697
|
-
function retireOwnPartition(runtime, cacheManager2, cwd, stored) {
|
|
8793
|
+
function retireOwnPartition(runtime, cacheManager2, cwd, stored, me) {
|
|
8698
8794
|
if (!isTurnEndFindingsCache(stored))
|
|
8699
8795
|
return false;
|
|
8700
|
-
const me = runtime.telemetrySessionId;
|
|
8701
8796
|
if (stored.sessionId === me && stored.carriedBlockers === void 0)
|
|
8702
8797
|
return false;
|
|
8703
8798
|
const ownDropped = recordPartitions(stored).some((partition) => partition.sessionId === me);
|
|
8704
|
-
const { carried: kept, dropped, stamped } = carriedTurnEndBlockers(stored,
|
|
8799
|
+
const { carried: kept, dropped, stamped } = carriedTurnEndBlockers(stored, cwd, me);
|
|
8705
8800
|
if (!ownDropped && !dropped.gone && !dropped.noFile) {
|
|
8706
8801
|
if (stamped) {
|
|
8707
8802
|
const fields2 = blockerPartitionFields(kept);
|
|
@@ -8716,7 +8811,7 @@ function retireOwnPartition(runtime, cacheManager2, cwd, stored) {
|
|
|
8716
8811
|
const testFailures = stored.testFailures === true;
|
|
8717
8812
|
if (kept.length === 0 && !testFailures) {
|
|
8718
8813
|
cacheManager2.clearCache("turn-end-findings", cwd);
|
|
8719
|
-
runtime.clearGitGuardCacheUnknown();
|
|
8814
|
+
runtime.clearGitGuardCacheUnknown(cwd);
|
|
8720
8815
|
logRecordRetired(cwd, "turn_end", dropped.noFile ? "no_file" : "file_gone");
|
|
8721
8816
|
return true;
|
|
8722
8817
|
}
|
|
@@ -8738,12 +8833,15 @@ function retireOwnPartition(runtime, cacheManager2, cwd, stored) {
|
|
|
8738
8833
|
hasBlockers: kept.length > 0 || testFailures,
|
|
8739
8834
|
sessionId: owner,
|
|
8740
8835
|
// Nothing new to deliver: the sections kept were already in the record.
|
|
8741
|
-
consumed: stored.consumed === true
|
|
8836
|
+
consumed: stored.consumed === true,
|
|
8837
|
+
// #4943: the content is now the owner's blocker text, not the message
|
|
8838
|
+
// the composer addressed.
|
|
8839
|
+
deliverTo: void 0
|
|
8742
8840
|
});
|
|
8743
8841
|
return false;
|
|
8744
8842
|
}
|
|
8745
|
-
function markCacheUnknown(runtime, reason) {
|
|
8746
|
-
runtime.markGitGuardCacheUnknown(reason);
|
|
8843
|
+
function markCacheUnknown(runtime, reason, cwd) {
|
|
8844
|
+
runtime.markGitGuardCacheUnknown(reason, cwd);
|
|
8747
8845
|
}
|
|
8748
8846
|
function recordOwner(existing, runtime, storedSectionSurvives) {
|
|
8749
8847
|
return existing && storedSectionSurvives ? existing.sessionId : runtime.telemetrySessionId;
|
|
@@ -8782,43 +8880,44 @@ function writeGitGuardRecord(cacheManager2, runtime, cwd, record) {
|
|
|
8782
8880
|
};
|
|
8783
8881
|
try {
|
|
8784
8882
|
cacheManager2.writeCache("turn-end-findings", data, cwd);
|
|
8785
|
-
runtime.clearGitGuardCacheUnknown();
|
|
8883
|
+
runtime.clearGitGuardCacheUnknown(cwd);
|
|
8786
8884
|
return true;
|
|
8787
8885
|
} catch {
|
|
8788
|
-
markCacheUnknown(runtime, "cache_write_failed");
|
|
8886
|
+
markCacheUnknown(runtime, "cache_write_failed", cwd);
|
|
8789
8887
|
return false;
|
|
8790
8888
|
}
|
|
8791
8889
|
}
|
|
8792
8890
|
function retireInlineBlockerAndResyncGuard(args) {
|
|
8891
|
+
const owner = args.runtime.inlineBlockerOwner(args.filePath);
|
|
8793
8892
|
const retired = args.runtime.retireInlineBlockerOnConfirmedClean(args.filePath, args.writeIndex, args.coveredSources);
|
|
8794
8893
|
if (!retired)
|
|
8795
8894
|
return false;
|
|
8796
8895
|
args.runtime.updateGitGuardStatus(false, "");
|
|
8797
8896
|
if (args.lensGuardEnabled) {
|
|
8798
|
-
syncGitGuardRecord(args.runtime, args.cacheManager, args.cwd, args.filePath);
|
|
8897
|
+
syncGitGuardRecord(args.runtime, args.cacheManager, args.cwd, args.filePath, void 0, void 0, owner);
|
|
8799
8898
|
}
|
|
8800
8899
|
return true;
|
|
8801
8900
|
}
|
|
8802
8901
|
function resyncGitGuardAfterInlinePolicy(args) {
|
|
8803
|
-
const changed = args.runtime.applyInlineBlockerPolicyVerdicts(args.suppressedFilePaths);
|
|
8902
|
+
const changed = args.runtime.applyInlineBlockerPolicyVerdicts(args.suppressedFilePaths, { sessionId: args.sessionId });
|
|
8804
8903
|
if (args.suppressedFilePaths.length === 0 && changed === 0)
|
|
8805
8904
|
return;
|
|
8806
8905
|
args.runtime.updateGitGuardStatus(false, "");
|
|
8807
8906
|
}
|
|
8808
|
-
function syncGitGuardRecord(runtime, cacheManager2, cwd, editedFilePath, analysisRootMode = "session", editedCleanVerdict = false) {
|
|
8907
|
+
function syncGitGuardRecord(runtime, cacheManager2, cwd, editedFilePath, analysisRootMode = "session", editedCleanVerdict = false, sessionId) {
|
|
8809
8908
|
if (!canWriteAnalysisRoot(analysisRootMode))
|
|
8810
8909
|
return;
|
|
8811
|
-
const entries = (runtime.getInlineBlockersSnapshot?.() ?? []).filter((entry) => !entry.policySuppressed);
|
|
8910
|
+
const entries = (runtime.getInlineBlockersSnapshot?.({ sessionId }) ?? []).filter((entry) => !entry.policySuppressed);
|
|
8812
8911
|
const stored = storedRecord(cacheManager2, cwd)?.fields;
|
|
8813
8912
|
if (entries.length === 0 && claimsNoBlocker(stored)) {
|
|
8814
8913
|
cacheManager2.clearCache("turn-end-findings", cwd);
|
|
8815
|
-
runtime.clearGitGuardCacheUnknown();
|
|
8914
|
+
runtime.clearGitGuardCacheUnknown(cwd);
|
|
8816
8915
|
logRecordRetired(cwd, "write", "no_blocker");
|
|
8817
8916
|
return;
|
|
8818
8917
|
}
|
|
8819
8918
|
const existing = isTurnEndFindingsCache(stored) ? stored : void 0;
|
|
8820
8919
|
const editedKey = editedFilePath ? guardPathKey(editedFilePath, cwd) : void 0;
|
|
8821
|
-
const me = runtime.telemetrySessionId;
|
|
8920
|
+
const me = sessionId ?? runtime.telemetrySessionId;
|
|
8822
8921
|
const blockerSections = existing?.blockerContent ? blockingProvenance(existing.blockerContent, existing.blockingFiles ?? [], cwd) : void 0;
|
|
8823
8922
|
const dropKey = new Set(editedKey ? [editedKey] : []);
|
|
8824
8923
|
let droppedForeign = 0;
|
|
@@ -8845,13 +8944,21 @@ function syncGitGuardRecord(runtime, cacheManager2, cwd, editedFilePath, analysi
|
|
|
8845
8944
|
}
|
|
8846
8945
|
const foreign = !!existing && existing.sessionId !== me;
|
|
8847
8946
|
if (foreign && entries.length === 0 && droppedForeign === 0 && droppedOwn === 0) {
|
|
8848
|
-
|
|
8947
|
+
if (sessionId !== void 0 && !runtime.isCoordinatorSession(sessionId)) {
|
|
8948
|
+
recordDegradationOnce({
|
|
8949
|
+
kind: "git-guard-non-owner-write",
|
|
8950
|
+
subject: sessionId,
|
|
8951
|
+
reason: "a concurrent session's write left another session's commit-gate record and latch untouched"
|
|
8952
|
+
});
|
|
8953
|
+
return;
|
|
8954
|
+
}
|
|
8955
|
+
markCacheUnknown(runtime, "session_mismatch", cwd);
|
|
8849
8956
|
return;
|
|
8850
8957
|
}
|
|
8851
8958
|
if (!existing && entries.length === 0) {
|
|
8852
8959
|
const inspection = cacheManager2.inspectCache("turn-end-findings", cwd);
|
|
8853
8960
|
if (inspection !== "missing") {
|
|
8854
|
-
markCacheUnknown(runtime, `cache_${inspection}
|
|
8961
|
+
markCacheUnknown(runtime, `cache_${inspection}`, cwd);
|
|
8855
8962
|
return;
|
|
8856
8963
|
}
|
|
8857
8964
|
}
|
|
@@ -8861,7 +8968,7 @@ function syncGitGuardRecord(runtime, cacheManager2, cwd, editedFilePath, analysi
|
|
|
8861
8968
|
}
|
|
8862
8969
|
const inlineFiles = entries.map((entry) => resolveGuardPath(entry.filePath, cwd));
|
|
8863
8970
|
if (existing?.blockerContent && !blockerSections) {
|
|
8864
|
-
markCacheUnknown(runtime, "blocking_provenance_untrusted");
|
|
8971
|
+
markCacheUnknown(runtime, "blocking_provenance_untrusted", cwd);
|
|
8865
8972
|
return;
|
|
8866
8973
|
}
|
|
8867
8974
|
const partitions = entries.length > 0 ? [
|
|
@@ -8891,7 +8998,7 @@ function syncGitGuardRecord(runtime, cacheManager2, cwd, editedFilePath, analysi
|
|
|
8891
8998
|
].filter((value) => !!value).join("\n\n");
|
|
8892
8999
|
if (!hasBlockers && !content) {
|
|
8893
9000
|
cacheManager2.clearCache("turn-end-findings", cwd);
|
|
8894
|
-
runtime.clearGitGuardCacheUnknown();
|
|
9001
|
+
runtime.clearGitGuardCacheUnknown(cwd);
|
|
8895
9002
|
if (droppedForeign > goneForeign)
|
|
8896
9003
|
logRecordRetired(cwd, "write", "rechecked");
|
|
8897
9004
|
else if (goneForeign > 0)
|
|
@@ -8962,7 +9069,7 @@ function clearGitGuardTestFailure(cacheManager2, cwd, runtime, passedFiles = [])
|
|
|
8962
9069
|
const blockerContent = existing.blockerContent ?? "";
|
|
8963
9070
|
if (!blockerContent && remainingFiles.length === 0) {
|
|
8964
9071
|
cacheManager2.clearCache("turn-end-findings", cwd);
|
|
8965
|
-
runtime.clearGitGuardCacheUnknown();
|
|
9072
|
+
runtime.clearGitGuardCacheUnknown(cwd);
|
|
8966
9073
|
return;
|
|
8967
9074
|
}
|
|
8968
9075
|
const blockingKeys = new Set([
|
|
@@ -8985,7 +9092,9 @@ function clearGitGuardTestFailure(cacheManager2, cwd, runtime, passedFiles = [])
|
|
|
8985
9092
|
projectSeqStart: runtime.turnStartProjectSeq,
|
|
8986
9093
|
projectSeqEnd: runtime.projectSeq,
|
|
8987
9094
|
fileSeqByPath: Object.fromEntries(runtime.getFileSeqEntries().map(([filePath, seq]) => [guardPathKey(filePath, cwd), seq])),
|
|
8988
|
-
fileContentHashes: {}
|
|
9095
|
+
fileContentHashes: {},
|
|
9096
|
+
// #4943: the content is now the owner's blocker text.
|
|
9097
|
+
deliverTo: void 0
|
|
8989
9098
|
});
|
|
8990
9099
|
}
|
|
8991
9100
|
|
|
@@ -9341,14 +9450,17 @@ function planDeliveryHolds(args) {
|
|
|
9341
9450
|
byPart.set(hold.part, [hold]);
|
|
9342
9451
|
}
|
|
9343
9452
|
const settled = [];
|
|
9453
|
+
const reachedParts = [];
|
|
9344
9454
|
let start = 0;
|
|
9345
9455
|
for (const part of args.parts) {
|
|
9346
9456
|
const end = start + part.text.length;
|
|
9457
|
+
const whole = end <= args.keptChars;
|
|
9458
|
+
const leadsOversized = start === 0;
|
|
9459
|
+
const reached = whole || leadsOversized;
|
|
9460
|
+
if (reached)
|
|
9461
|
+
reachedParts.push(part);
|
|
9347
9462
|
const hold = byPart.get(part.raw)?.shift();
|
|
9348
9463
|
if (hold) {
|
|
9349
|
-
const whole = end <= args.keptChars;
|
|
9350
|
-
const leadsOversized = start === 0;
|
|
9351
|
-
const reached = whole || leadsOversized;
|
|
9352
9464
|
settled.push({
|
|
9353
9465
|
hold,
|
|
9354
9466
|
reached,
|
|
@@ -9358,6 +9470,7 @@ function planDeliveryHolds(args) {
|
|
|
9358
9470
|
start = end + args.separatorLength;
|
|
9359
9471
|
}
|
|
9360
9472
|
return {
|
|
9473
|
+
reachedParts,
|
|
9361
9474
|
heldCount: settled.reduce((n, entry) => n + (entry.reached || !entry.keeps ? 0 : 1), 0),
|
|
9362
9475
|
settle: ({ suppressed, isCurrentSession, onFault }) => {
|
|
9363
9476
|
let delivered = 0;
|
|
@@ -9601,7 +9714,9 @@ function sweepInlineBlockerPastEof(runtime, cwd, options) {
|
|
|
9601
9714
|
const resync = options?.resync ?? resyncDocumentOnPastEof;
|
|
9602
9715
|
let entries;
|
|
9603
9716
|
try {
|
|
9604
|
-
entries = runtime.getInlineBlockersSnapshot(
|
|
9717
|
+
entries = runtime.getInlineBlockersSnapshot({
|
|
9718
|
+
sessionId: options?.sessionId
|
|
9719
|
+
});
|
|
9605
9720
|
} catch {
|
|
9606
9721
|
return counts;
|
|
9607
9722
|
}
|
|
@@ -10280,7 +10395,9 @@ function resyncCommitGateForReadOnlyTurn(args) {
|
|
|
10280
10395
|
const inlinePolicyEntries = [];
|
|
10281
10396
|
const policySuppressedPaths = [];
|
|
10282
10397
|
const inlinePolicyStart = Date.now();
|
|
10283
|
-
for (const entry of args.runtime.getInlineBlockersSnapshot(
|
|
10398
|
+
for (const entry of args.runtime.getInlineBlockersSnapshot({
|
|
10399
|
+
sessionId: args.sessionId
|
|
10400
|
+
})) {
|
|
10284
10401
|
const tally = {
|
|
10285
10402
|
displayPath: toRunnerDisplayPath(args.cwd, entry.filePath),
|
|
10286
10403
|
sources: entry.sources
|
|
@@ -10299,7 +10416,8 @@ function resyncCommitGateForReadOnlyTurn(args) {
|
|
|
10299
10416
|
const guardLatchBefore = args.runtime.gitGuardHasBlockers;
|
|
10300
10417
|
resyncGitGuardAfterInlinePolicy({
|
|
10301
10418
|
runtime: args.runtime,
|
|
10302
|
-
suppressedFilePaths: policySuppressedPaths
|
|
10419
|
+
suppressedFilePaths: policySuppressedPaths,
|
|
10420
|
+
sessionId: args.sessionId
|
|
10303
10421
|
});
|
|
10304
10422
|
logLatency({
|
|
10305
10423
|
type: "phase",
|
|
@@ -10374,10 +10492,11 @@ async function handleTurnEnd(deps) {
|
|
|
10374
10492
|
resyncCommitGateForReadOnlyTurn({
|
|
10375
10493
|
runtime,
|
|
10376
10494
|
cwd,
|
|
10377
|
-
lensGuardEnabled: Boolean(getFlag("lens-guard"))
|
|
10495
|
+
lensGuardEnabled: Boolean(getFlag("lens-guard")),
|
|
10496
|
+
sessionId
|
|
10378
10497
|
});
|
|
10379
10498
|
if (getFlag("lens-guard") && !runtime.gitGuardHasBlockers) {
|
|
10380
|
-
retireSettledGitGuardRecord(runtime, cacheManager2, cwd);
|
|
10499
|
+
retireSettledGitGuardRecord(runtime, cacheManager2, cwd, sessionId);
|
|
10381
10500
|
}
|
|
10382
10501
|
const idleResetMs = getEffectiveLspIdleResetMs();
|
|
10383
10502
|
dbg(`turn_end: no modified files, scheduling LSP idle reset (${idleResetMs / 1e3}s)`);
|
|
@@ -10415,6 +10534,10 @@ async function handleTurnEnd(deps) {
|
|
|
10415
10534
|
const blockerParts = [];
|
|
10416
10535
|
const staleSecretParts = [];
|
|
10417
10536
|
const advisoryParts = [];
|
|
10537
|
+
const provenanceCitations = /* @__PURE__ */ new Map();
|
|
10538
|
+
const citePart = (part, files2) => {
|
|
10539
|
+
provenanceCitations.set(part, [...files2]);
|
|
10540
|
+
};
|
|
10418
10541
|
const deliveryHolds = [];
|
|
10419
10542
|
const turnScope = deps.sessionScope ?? runtime.sessionScope;
|
|
10420
10543
|
const holdScope = runtime.captureSessionGeneration();
|
|
@@ -10519,6 +10642,9 @@ ${lines.join("\n")}`;
|
|
|
10519
10642
|
})
|
|
10520
10643
|
});
|
|
10521
10644
|
advisoryParts.push(lateRunnerPart);
|
|
10645
|
+
citePart(lateRunnerPart, [
|
|
10646
|
+
...new Set(advisoryKept.map((f) => f.filePath ?? pending2.filePath))
|
|
10647
|
+
]);
|
|
10522
10648
|
}
|
|
10523
10649
|
logLatency({
|
|
10524
10650
|
type: "phase",
|
|
@@ -10539,7 +10665,9 @@ ${lines.join("\n")}`;
|
|
|
10539
10665
|
}
|
|
10540
10666
|
});
|
|
10541
10667
|
const blockerPastEofStart = Date.now();
|
|
10542
|
-
const blockerPastEof = sweepInlineBlockerPastEof(runtime, cwd
|
|
10668
|
+
const blockerPastEof = sweepInlineBlockerPastEof(runtime, cwd, {
|
|
10669
|
+
sessionId
|
|
10670
|
+
});
|
|
10543
10671
|
logLatency({
|
|
10544
10672
|
type: "phase",
|
|
10545
10673
|
toolName: "turn_end",
|
|
@@ -10586,6 +10714,7 @@ ${lines.join("\n")}`;
|
|
|
10586
10714
|
// #2982: the hook's own signal, so the self axis's filesystem work is
|
|
10587
10715
|
// bounded by the same abort everything else in this handler honours.
|
|
10588
10716
|
...deps.signal === void 0 ? {} : { signal: deps.signal },
|
|
10717
|
+
sessionId,
|
|
10589
10718
|
additionalEntries: getWidgetBlockingFilesForSweep().map((row) => ({
|
|
10590
10719
|
filePath: row.filePath,
|
|
10591
10720
|
recordedAtMs: row.recordedAtMs,
|
|
@@ -10609,7 +10738,7 @@ ${lines.join("\n")}`;
|
|
|
10609
10738
|
hashBudgetExhausted: blockerFreshness.hashBudgetExhausted
|
|
10610
10739
|
}
|
|
10611
10740
|
});
|
|
10612
|
-
const unresolvedBlockers = runtime.getInlineBlockersSnapshot();
|
|
10741
|
+
const unresolvedBlockers = runtime.getInlineBlockersSnapshot({ sessionId });
|
|
10613
10742
|
const inlinePolicyEntries = [];
|
|
10614
10743
|
const policySuppressedPaths = [];
|
|
10615
10744
|
const inlinePolicyStart = Date.now();
|
|
@@ -10655,14 +10784,17 @@ ${retirementNote}` : "");
|
|
|
10655
10784
|
continue;
|
|
10656
10785
|
}
|
|
10657
10786
|
const suppressedNote = policy.suppressed > 0 ? ` (suppressed by disposition: ${policy.suppressed} finding(s))` : "";
|
|
10658
|
-
|
|
10659
|
-
${policy.body}
|
|
10787
|
+
const replayPart = `Unresolved from this turn \u2014 ${displayPath}${suppressedNote}:
|
|
10788
|
+
${policy.body}`;
|
|
10789
|
+
blockerParts.push(replayPart);
|
|
10790
|
+
citePart(replayPart, [bPath]);
|
|
10660
10791
|
}
|
|
10661
10792
|
}
|
|
10662
10793
|
const guardLatchBefore = runtime.gitGuardHasBlockers;
|
|
10663
10794
|
resyncGitGuardAfterInlinePolicy({
|
|
10664
10795
|
runtime,
|
|
10665
|
-
suppressedFilePaths: policySuppressedPaths
|
|
10796
|
+
suppressedFilePaths: policySuppressedPaths,
|
|
10797
|
+
sessionId
|
|
10666
10798
|
});
|
|
10667
10799
|
if (inlinePolicyEntries.length > 0) {
|
|
10668
10800
|
logLatency({
|
|
@@ -10791,6 +10923,7 @@ ${policy.body}`);
|
|
|
10791
10923
|
let suppressedByOwnership = 0;
|
|
10792
10924
|
const sectionObservations = [];
|
|
10793
10925
|
const shownUnansweredServerIds = /* @__PURE__ */ new Set();
|
|
10926
|
+
const sectionPrimaries = [];
|
|
10794
10927
|
const unansweredLines = [];
|
|
10795
10928
|
for (const result of seen.values()) {
|
|
10796
10929
|
const ownedNeighbors = result.neighbors.filter((n) => lastObserver.get(normalizeMapKey(n.filePath))?.run.result === result);
|
|
@@ -10825,6 +10958,7 @@ ${carrySuffix}` : rendered.text);
|
|
|
10825
10958
|
const sectionRun = runByResult.get(result);
|
|
10826
10959
|
if (sectionRun)
|
|
10827
10960
|
sectionRuns.push(sectionRun);
|
|
10961
|
+
sectionPrimaries.push(result.filePath);
|
|
10828
10962
|
for (const n of ownedNeighbors) {
|
|
10829
10963
|
if (n.diagnostics.length === 0)
|
|
10830
10964
|
continue;
|
|
@@ -10876,6 +11010,7 @@ ${testLines.join("\n")}`;
|
|
|
10876
11010
|
if (parts.length > 0) {
|
|
10877
11011
|
const section = parts.join("\n\n");
|
|
10878
11012
|
blockerParts.push(section);
|
|
11013
|
+
citePart(section, sectionPrimaries);
|
|
10879
11014
|
const shownServerIds = [...shownUnansweredServerIds];
|
|
10880
11015
|
deliveryHolds.push({
|
|
10881
11016
|
part: section,
|
|
@@ -10965,6 +11100,10 @@ ${lines.join("\n")}`);
|
|
|
10965
11100
|
if (pendingBlocks.length > 0) {
|
|
10966
11101
|
const pendingSection = pendingBlocks.join("\n");
|
|
10967
11102
|
blockerParts.push(pendingSection);
|
|
11103
|
+
citePart(pendingSection, [
|
|
11104
|
+
...unresolvedNeighbors.slice(-maxShown).map((entry) => entry.filePath),
|
|
11105
|
+
...changedShown.map((entry) => entry.filePath)
|
|
11106
|
+
]);
|
|
10968
11107
|
if (changedShown.length > 0) {
|
|
10969
11108
|
deliveryHolds.push({
|
|
10970
11109
|
part: pendingSection,
|
|
@@ -11033,19 +11172,25 @@ ${suffix}`;
|
|
|
11033
11172
|
};
|
|
11034
11173
|
const indeterminateRuns = cascadeRuns.filter((r) => r.indeterminate);
|
|
11035
11174
|
if (indeterminateRuns.length > 0) {
|
|
11036
|
-
const buildAdvisory = (runs, frame) => {
|
|
11175
|
+
const buildAdvisory = (runs, frame, named) => {
|
|
11037
11176
|
if (runs.length === 0)
|
|
11038
11177
|
return void 0;
|
|
11039
11178
|
const byDetail = /* @__PURE__ */ new Map();
|
|
11179
|
+
const runPathOf = /* @__PURE__ */ new Map();
|
|
11040
11180
|
for (const r of runs) {
|
|
11041
11181
|
const detail = r.indeterminate?.detail ?? frame.fallbackDetail(r);
|
|
11042
11182
|
const files2 = byDetail.get(detail) ?? [];
|
|
11043
|
-
|
|
11183
|
+
const display = toRunnerDisplayPath(cwd, r.filePath);
|
|
11184
|
+
files2.push(display);
|
|
11185
|
+
runPathOf.set(display, r.filePath);
|
|
11044
11186
|
byDetail.set(detail, files2);
|
|
11045
11187
|
}
|
|
11046
11188
|
const lines = [];
|
|
11047
11189
|
for (const [detail, filesRaw] of byDetail) {
|
|
11048
11190
|
const files2 = [...new Set(filesRaw)];
|
|
11191
|
+
for (const display of files2.slice(0, 5)) {
|
|
11192
|
+
named.push(runPathOf.get(display) ?? display);
|
|
11193
|
+
}
|
|
11049
11194
|
const shown2 = files2.slice(0, 5).join(", ");
|
|
11050
11195
|
const more = files2.length > 5 ? ` (+${files2.length - 5} more)` : "";
|
|
11051
11196
|
lines.push(` \u2022 ${detail}: ${shown2}${more}`);
|
|
@@ -11058,20 +11203,27 @@ ${lines.join("\n")}`;
|
|
|
11058
11203
|
const graphRuns = indeterminateRuns.filter((r) => r.indeterminate?.reason !== "lsp_binding_rejected" && r.indeterminate?.reason !== "excluded_by_role" && r.indeterminate?.reason !== "budget_truncated" && r.indeterminate?.budget === void 0);
|
|
11059
11204
|
const bindingRuns = indeterminateRuns.filter((r) => r.indeterminate?.reason === "lsp_binding_rejected" && r.indeterminate?.budget === void 0);
|
|
11060
11205
|
const budgetRuns = indeterminateRuns.filter((r) => r.indeterminate?.reason === "budget_truncated" || r.indeterminate?.budget !== void 0);
|
|
11206
|
+
const graphNamed = [];
|
|
11061
11207
|
const graphAdvisory = withCarryLabel(buildAdvisory(graphRuns, {
|
|
11062
11208
|
lead: (fileCount2, reasons) => `Cascade could not compute downstream impact for ${fileCount2} edited file(s) this turn \u2014 the review graph was unavailable (${reasons}), so their dependents were not cascade-checked and a clean cascade result does not cover them.`,
|
|
11063
11209
|
fallbackDetail: (r) => r.indeterminate?.reason === "missing_node" ? "changed file not in the review graph" : "review graph unavailable"
|
|
11064
|
-
}), graphRuns);
|
|
11210
|
+
}, graphNamed), graphRuns);
|
|
11065
11211
|
if (graphAdvisory)
|
|
11066
11212
|
advisoryParts.push(graphAdvisory);
|
|
11213
|
+
if (graphAdvisory)
|
|
11214
|
+
citePart(graphAdvisory, graphNamed);
|
|
11067
11215
|
holdAdvisory(graphAdvisory, graphRuns, "indeterminate");
|
|
11216
|
+
const bindingNamed = [];
|
|
11068
11217
|
const bindingAdvisory = withCarryLabel(buildAdvisory(bindingRuns, {
|
|
11069
11218
|
lead: (fileCount2, reasons) => `Cascade identified dependents for ${fileCount2} edited file(s) this turn, but their diagnostics could not be freshly confirmed (${reasons}) and were withheld \u2014 a clean cascade result does not cover them.`,
|
|
11070
11219
|
fallbackDetail: () => "cascade diagnostics withheld (binding rejected)"
|
|
11071
|
-
}), bindingRuns);
|
|
11220
|
+
}, bindingNamed), bindingRuns);
|
|
11072
11221
|
if (bindingAdvisory)
|
|
11073
11222
|
advisoryParts.push(bindingAdvisory);
|
|
11223
|
+
if (bindingAdvisory)
|
|
11224
|
+
citePart(bindingAdvisory, bindingNamed);
|
|
11074
11225
|
holdAdvisory(bindingAdvisory, bindingRuns, "indeterminate");
|
|
11226
|
+
const budgetNamed = [];
|
|
11075
11227
|
const budgetAdvisory = withCarryLabel(buildAdvisory(budgetRuns, {
|
|
11076
11228
|
lead: (fileCount2, reasons) => `Cascade checked the selected neighbors for ${fileCount2} edited file(s) this turn, but some eligible dependents were not checked because the cascade budget was exhausted (${reasons}); a clean cascade result does not cover them.`,
|
|
11077
11229
|
fallbackDetail: (r) => {
|
|
@@ -11081,9 +11233,11 @@ ${lines.join("\n")}`;
|
|
|
11081
11233
|
const detail = `cascade budget checked ${budget.selectedCount} of ${budget.eligibleCount} eligible dependents (${budget.truncatedCount} omitted)`;
|
|
11082
11234
|
return budget.transitiveTruncated ? `${detail}; transitive expansion was capped before all eligible dependents were enumerated` : detail;
|
|
11083
11235
|
}
|
|
11084
|
-
}), budgetRuns);
|
|
11236
|
+
}, budgetNamed), budgetRuns);
|
|
11085
11237
|
if (budgetAdvisory)
|
|
11086
11238
|
advisoryParts.push(budgetAdvisory);
|
|
11239
|
+
if (budgetAdvisory)
|
|
11240
|
+
citePart(budgetAdvisory, budgetNamed);
|
|
11087
11241
|
holdAdvisory(budgetAdvisory, budgetRuns, "indeterminate");
|
|
11088
11242
|
const fileCount = new Set(indeterminateRuns.map((r) => normalizeMapKey(r.filePath))).size;
|
|
11089
11243
|
const byFile = indeterminateRuns.map((r) => ({
|
|
@@ -11124,20 +11278,32 @@ ${lines.join("\n")}`;
|
|
|
11124
11278
|
const bucket = byServer.get(group.serverId) ?? {
|
|
11125
11279
|
waitMs: group.waitMs,
|
|
11126
11280
|
primaries: /* @__PURE__ */ new Set(),
|
|
11127
|
-
paths: /* @__PURE__ */ new Map()
|
|
11281
|
+
paths: /* @__PURE__ */ new Map(),
|
|
11282
|
+
raw: /* @__PURE__ */ new Map()
|
|
11128
11283
|
};
|
|
11129
11284
|
bucket.waitMs = Math.max(bucket.waitMs, group.waitMs);
|
|
11130
|
-
|
|
11131
|
-
|
|
11285
|
+
const primaryDisplay = toRunnerDisplayPath(cwd, run.filePath);
|
|
11286
|
+
const neighborDisplay = toRunnerDisplayPath(cwd, neighborPath);
|
|
11287
|
+
bucket.primaries.add(primaryDisplay);
|
|
11288
|
+
bucket.paths.set(nk, neighborDisplay);
|
|
11289
|
+
bucket.raw.set(primaryDisplay, run.filePath);
|
|
11290
|
+
bucket.raw.set(neighborDisplay, neighborPath);
|
|
11132
11291
|
byServer.set(group.serverId, bucket);
|
|
11133
11292
|
}
|
|
11134
11293
|
}
|
|
11135
11294
|
}
|
|
11136
11295
|
const capped = (items, max) => items.length > max ? `${items.slice(0, max).join(", ")} (+${items.length - max} more)` : items.join(", ");
|
|
11137
11296
|
const blocks = [];
|
|
11297
|
+
const unconfirmedNamed = [];
|
|
11138
11298
|
let pathCount = 0;
|
|
11139
11299
|
for (const [serverId, bucket] of byServer) {
|
|
11140
11300
|
const paths = [...bucket.paths.values()];
|
|
11301
|
+
for (const display of [
|
|
11302
|
+
...[...bucket.primaries].slice(0, 3),
|
|
11303
|
+
...paths.slice(0, 5)
|
|
11304
|
+
]) {
|
|
11305
|
+
unconfirmedNamed.push(bucket.raw.get(display) ?? display);
|
|
11306
|
+
}
|
|
11141
11307
|
pathCount += paths.length;
|
|
11142
11308
|
const within = bucket.waitMs > 0 ? ` within ${bucket.waitMs} ms` : "";
|
|
11143
11309
|
blocks.push(`Cascade sent ${paths.length} dependent(s) of ${capped([...bucket.primaries], 3)} to ${serverId}, but no answer arrived${within}; a clean cascade result does not cover them.
|
|
@@ -11147,6 +11313,8 @@ ${lines.join("\n")}`;
|
|
|
11147
11313
|
const pendingAdvisory = withCarryLabel(blocks.join("\n"), unconfirmedRuns);
|
|
11148
11314
|
if (pendingAdvisory)
|
|
11149
11315
|
advisoryParts.push(pendingAdvisory);
|
|
11316
|
+
if (pendingAdvisory)
|
|
11317
|
+
citePart(pendingAdvisory, unconfirmedNamed);
|
|
11150
11318
|
holdAdvisory(pendingAdvisory, unconfirmedRuns, "unconfirmed");
|
|
11151
11319
|
logCascade({
|
|
11152
11320
|
phase: "cascade_unconfirmed_rendered",
|
|
@@ -12305,8 +12473,8 @@ ${lines.join("\n")}`;
|
|
|
12305
12473
|
} else {
|
|
12306
12474
|
const callGraphStart = Date.now();
|
|
12307
12475
|
try {
|
|
12308
|
-
const { impact, formatImpact, parseSymbolKey } = await import("../chunk-
|
|
12309
|
-
const { callGraphImpactToProjectDiagnostics } = await import("../chunk-
|
|
12476
|
+
const { impact, formatImpact, parseSymbolKey } = await import("../chunk-2TF6RXWB.js");
|
|
12477
|
+
const { callGraphImpactToProjectDiagnostics } = await import("../chunk-LUBPZN36.js");
|
|
12310
12478
|
const impactLines = [];
|
|
12311
12479
|
let callGraphDispositionSuppressed = 0;
|
|
12312
12480
|
const impactFindings = [];
|
|
@@ -12801,6 +12969,7 @@ ${impactLines.join("\n")}`;
|
|
|
12801
12969
|
const lateAuxPart = `\u{1F550} Late auxiliary diagnostics (${pair.serverId} answered after its grace window${lateAuxSuppressedNote}):
|
|
12802
12970
|
${lines.join("\n")}`;
|
|
12803
12971
|
advisoryParts.push(lateAuxPart);
|
|
12972
|
+
citePart(lateAuxPart, [lateAuxPath]);
|
|
12804
12973
|
deliveryHolds.push({
|
|
12805
12974
|
part: lateAuxPart,
|
|
12806
12975
|
canHold: () => canRearmPendingAuxiliary(pair),
|
|
@@ -12914,12 +13083,14 @@ ${lines.join("\n")}`;
|
|
|
12914
13083
|
resolvedChars += cost;
|
|
12915
13084
|
resolvedCount += 1;
|
|
12916
13085
|
return false;
|
|
12917
|
-
});
|
|
13086
|
+
}, { sessionId });
|
|
12918
13087
|
const resolvedLines = resolvedBlockerFileList.map(formatResolvedLine);
|
|
12919
13088
|
if (resolvedBlockerFilesDropped > 0) {
|
|
12920
13089
|
resolvedLines.push(formatResolvedTail(resolvedBlockerFilesDropped));
|
|
12921
13090
|
}
|
|
12922
13091
|
const resolvedParts = resolvedLines.length > 0 ? [resolvedLines.join("\n")] : [];
|
|
13092
|
+
if (resolvedParts[0] !== void 0)
|
|
13093
|
+
citePart(resolvedParts[0], resolvedBlockerFileList.map((entry) => entry.filePath));
|
|
12923
13094
|
const asIs = (raw) => ({ raw, text: raw });
|
|
12924
13095
|
const composedParts = [
|
|
12925
13096
|
// #3218 criterion 2: the resolution lines ride FIRST, inside their
|
|
@@ -12942,6 +13113,46 @@ ${raw}`
|
|
|
12942
13113
|
];
|
|
12943
13114
|
const findingParts = composedParts.map((part) => part.text);
|
|
12944
13115
|
let heldSections = 0;
|
|
13116
|
+
const logTurnEndRow = (deliverySuppressed) => {
|
|
13117
|
+
logLatency({
|
|
13118
|
+
type: "tool_result",
|
|
13119
|
+
toolName: "turn_end",
|
|
13120
|
+
filePath: cwd,
|
|
13121
|
+
durationMs: Date.now() - turnEndStart,
|
|
13122
|
+
// #1622 review M2: a pending stale secret is NOT a clean turn. It gets its
|
|
13123
|
+
// own result rather than being promoted to `blockers_found`, which would
|
|
13124
|
+
// undo the demotion the freshness gate just made.
|
|
13125
|
+
result: blockerParts.length > 0 ? "blockers_found" : staleSecretParts.length > 0 ? "stale_secrets_pending" : "clean",
|
|
13126
|
+
metadata: {
|
|
13127
|
+
fileCount: files.length,
|
|
13128
|
+
blockerSections: blockerParts.length,
|
|
13129
|
+
staleSecretSections: staleSecretParts.length,
|
|
13130
|
+
advisorySections: advisoryParts.length,
|
|
13131
|
+
// #3218 criterion 2: how many files this turn LISTED as resolved
|
|
13132
|
+
// (held-back entries are not counted), and how many retire events
|
|
13133
|
+
// fell past the cap. The line itself is in the delivered content;
|
|
13134
|
+
// these make the feature visible in latency.log even when the block
|
|
13135
|
+
// is suppressed or the agent reads only telemetry.
|
|
13136
|
+
resolvedBlockerFiles: resolvedBlockerFileList.length,
|
|
13137
|
+
resolvedBlockerFilesDropped,
|
|
13138
|
+
// #3813: one-shot parts the cap cut that stay pending for the next turn.
|
|
13139
|
+
heldSections,
|
|
13140
|
+
// #1944 AC3: an empty advisory section on its own cannot say whether
|
|
13141
|
+
// the turn had nothing to report or dropped something. This counter
|
|
13142
|
+
// answers that from latency.log even when the payload is empty, and
|
|
13143
|
+
// the payload itself carries the retirement note when it is not.
|
|
13144
|
+
demotedFindingsRetired,
|
|
13145
|
+
// #2275: the widget-footer store's own dependency-drift retirements —
|
|
13146
|
+
// a separate surface/counter from `demotedFindingsRetired` above,
|
|
13147
|
+
// since a widget retirement never touches `advisoryParts` or the
|
|
13148
|
+
// `turn-end-findings-last` suppression cache the block below clears.
|
|
13149
|
+
widgetDemotedFindingsRetired,
|
|
13150
|
+
// #4921: a turn whose content the agent already received is not
|
|
13151
|
+
// re-sent; this row, the turn's only one, is where that is visible.
|
|
13152
|
+
...deliverySuppressed ? { deliverySuppressed } : {}
|
|
13153
|
+
}
|
|
13154
|
+
});
|
|
13155
|
+
};
|
|
12945
13156
|
if (findingParts.length > 0) {
|
|
12946
13157
|
dbg(`turn_end: ${blockerParts.length} blocker section(s), ${advisoryParts.length} advisory section(s) found, persisting for next context`);
|
|
12947
13158
|
const joined = findingParts.join("\n\n");
|
|
@@ -12982,20 +13193,21 @@ ${raw}`
|
|
|
12982
13193
|
}
|
|
12983
13194
|
};
|
|
12984
13195
|
const content = capTurnEndMessage(joined, holdPlan.heldCount);
|
|
12985
|
-
const
|
|
13196
|
+
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("|") : "";
|
|
13197
|
+
const signature = `${countDrivenFileSet}::${content}`;
|
|
12986
13198
|
const last = cacheManager2.readCache("turn-end-findings-last", cwd);
|
|
12987
|
-
if (last?.data?.signature === signature && last?.data?.sessionId ===
|
|
13199
|
+
if (last?.data?.signature === signature && last?.data?.sessionId === deliverySessionId && // #3813: a retirement is an event, not a persisting finding. The
|
|
12988
13200
|
// coordinator already consumed these entries, so an identical
|
|
12989
13201
|
// second retirement on consecutive turns (same file, count and
|
|
12990
13202
|
// ordinal) would be consumed and never shown (#3776 verify r3 F6).
|
|
12991
13203
|
resolvedBlockerFileList.length === 0) {
|
|
12992
13204
|
dbg("turn_end: duplicate findings detected (same session), suppressing re-prompt");
|
|
12993
13205
|
if (getFlag("lens-guard")) {
|
|
12994
|
-
const { stored: existingGuard2, carried: carried2, dropped: dropped2 } = readTurnEndGuardRecord(cacheManager2, runtime, cwd);
|
|
13206
|
+
const { stored: existingGuard2, carried: carried2, dropped: dropped2 } = readTurnEndGuardRecord(cacheManager2, runtime, cwd, sessionId);
|
|
12995
13207
|
if (existingGuard2) {
|
|
12996
13208
|
const own = blockerParts.length > 0 ? [
|
|
12997
13209
|
{
|
|
12998
|
-
sessionId:
|
|
13210
|
+
sessionId: deliverySessionId,
|
|
12999
13211
|
blockerContent: capTurnEndMessage(blockerParts.join("\n\n")),
|
|
13000
13212
|
blockingFiles: existingGuard2.affectedFiles ?? [],
|
|
13001
13213
|
blockerWrittenAt: Date.now()
|
|
@@ -13004,7 +13216,7 @@ ${raw}`
|
|
|
13004
13216
|
const blockers = blockerPartitionFields([...own, ...carried2]);
|
|
13005
13217
|
writeGitGuardRecord(cacheManager2, runtime, cwd, {
|
|
13006
13218
|
...existingGuard2,
|
|
13007
|
-
sessionId: blockers.owner ??
|
|
13219
|
+
sessionId: blockers.owner ?? deliverySessionId,
|
|
13008
13220
|
content,
|
|
13009
13221
|
blockerContent: blockers.blockerContent,
|
|
13010
13222
|
carriedBlockers: blockers.carriedBlockers,
|
|
@@ -13018,7 +13230,10 @@ ${raw}`
|
|
|
13018
13230
|
seq
|
|
13019
13231
|
])),
|
|
13020
13232
|
fileContentHashes: {},
|
|
13021
|
-
|
|
13233
|
+
// #4921: this turn's content was already delivered (the signature
|
|
13234
|
+
// matched), so the rewrite keeps the record current for the gate
|
|
13235
|
+
// without handing the same text to the model again.
|
|
13236
|
+
consumed: true
|
|
13022
13237
|
});
|
|
13023
13238
|
logCarriedDrops(cwd, dropped2);
|
|
13024
13239
|
}
|
|
@@ -13026,6 +13241,7 @@ ${raw}`
|
|
|
13026
13241
|
settleHolds(true);
|
|
13027
13242
|
clearOwnedTurnState();
|
|
13028
13243
|
runtime.fixedThisTurn.clear();
|
|
13244
|
+
logTurnEndRow("duplicate");
|
|
13029
13245
|
resetFormatService2();
|
|
13030
13246
|
return;
|
|
13031
13247
|
}
|
|
@@ -13034,7 +13250,33 @@ ${raw}`
|
|
|
13034
13250
|
for (const [filePath, seq] of runtime.getFileSeqEntries()) {
|
|
13035
13251
|
fileSeqByPath2[normalizeMapKey(path24.resolve(filePath))] = seq;
|
|
13036
13252
|
}
|
|
13037
|
-
const { stored: existingGuard, carried, dropped } = readTurnEndGuardRecord(cacheManager2, runtime, cwd);
|
|
13253
|
+
const { stored: existingGuard, carried, dropped } = readTurnEndGuardRecord(cacheManager2, runtime, cwd, sessionId);
|
|
13254
|
+
const deliveredCitedFiles = holdPlan.reachedParts.flatMap((part) => provenanceCitations.get(part.raw) ?? []);
|
|
13255
|
+
const uncitedPartReached = holdPlan.reachedParts.some((part) => (provenanceCitations.get(part.raw)?.length ?? 0) === 0);
|
|
13256
|
+
const stampProvenance = (affectedFiles, affectedTruncated = false) => {
|
|
13257
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
13258
|
+
const add = (file, role) => {
|
|
13259
|
+
const resolved = resolveRunnerPath(cwd, file);
|
|
13260
|
+
const key = advisoryPathKey(resolved, cwd);
|
|
13261
|
+
if (!byKey.has(key))
|
|
13262
|
+
byKey.set(key, { path: resolved, role });
|
|
13263
|
+
};
|
|
13264
|
+
for (const file of affectedFiles)
|
|
13265
|
+
add(file, "affected");
|
|
13266
|
+
for (const file of [
|
|
13267
|
+
...resolvedBlockerFileList.map((entry) => entry.filePath),
|
|
13268
|
+
...deliveredCitedFiles
|
|
13269
|
+
])
|
|
13270
|
+
add(file, "cited");
|
|
13271
|
+
const stamped = [...byKey.values()].slice(0, MAX_ADVISORY_AFFECTED_FILES);
|
|
13272
|
+
return snapshotAdvisoryProvenance({
|
|
13273
|
+
cwd,
|
|
13274
|
+
runtime,
|
|
13275
|
+
generation: 0,
|
|
13276
|
+
files: stamped,
|
|
13277
|
+
truncated: affectedTruncated || byKey.size > stamped.length || affectedFiles.length === 0 && uncitedPartReached
|
|
13278
|
+
});
|
|
13279
|
+
};
|
|
13038
13280
|
if (getFlag("lens-guard") || carried.length > 0) {
|
|
13039
13281
|
const blockingContent = getFlag("lens-guard") && blockerParts.length > 0 ? capTurnEndMessage(blockerParts.join("\n\n")) : void 0;
|
|
13040
13282
|
const affectedFiles = [
|
|
@@ -13044,7 +13286,7 @@ ${raw}`
|
|
|
13044
13286
|
];
|
|
13045
13287
|
const own = blockingContent ? [
|
|
13046
13288
|
{
|
|
13047
|
-
sessionId:
|
|
13289
|
+
sessionId: deliverySessionId,
|
|
13048
13290
|
blockerContent: blockingContent,
|
|
13049
13291
|
blockingFiles: affectedFiles,
|
|
13050
13292
|
blockerWrittenAt: Date.now()
|
|
@@ -13059,7 +13301,11 @@ ${raw}`
|
|
|
13059
13301
|
blockerWrittenAt: blockers.blockerWrittenAt,
|
|
13060
13302
|
hasBlockers: blockers.owner !== void 0 || existingGuard?.testFailures === true,
|
|
13061
13303
|
affectedFiles,
|
|
13062
|
-
|
|
13304
|
+
provenance: stampProvenance(affectedFiles),
|
|
13305
|
+
sessionId: blockers.owner ?? deliverySessionId,
|
|
13306
|
+
// #4943: only this turn's session's next request takes the message,
|
|
13307
|
+
// whoever owns the blocker sections the record leads with.
|
|
13308
|
+
deliverTo: deps.deliveryAddress ?? deliverySessionId,
|
|
13063
13309
|
projectSeqStart: runtime.turnStartProjectSeq,
|
|
13064
13310
|
projectSeqEnd: runtime.projectSeq,
|
|
13065
13311
|
fileSeqByPath: fileSeqByPath2,
|
|
@@ -13071,8 +13317,6 @@ ${raw}`
|
|
|
13071
13317
|
});
|
|
13072
13318
|
} else {
|
|
13073
13319
|
const allAffectedFiles = [
|
|
13074
|
-
// #4617: confirmed-clean checks can resolve a file without writing it.
|
|
13075
|
-
...resolvedBlockerFileList.map((entry) => entry.filePath),
|
|
13076
13320
|
...files.map((file) => resolveRunnerPath(cwd, file)),
|
|
13077
13321
|
...cascadeResults.flatMap((result) => result.neighbors.filter((neighbor) => neighbor.diagnostics.length > 0).map((neighbor) => resolveRunnerPath(cwd, neighbor.filePath)))
|
|
13078
13322
|
];
|
|
@@ -13082,29 +13326,23 @@ ${raw}`
|
|
|
13082
13326
|
content,
|
|
13083
13327
|
affectedFiles,
|
|
13084
13328
|
affectedFilesTruncated,
|
|
13085
|
-
provenance:
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
generation: 0,
|
|
13089
|
-
files: affectedFiles.map((file) => ({
|
|
13090
|
-
path: file,
|
|
13091
|
-
role: "affected"
|
|
13092
|
-
})),
|
|
13093
|
-
truncated: affectedFilesTruncated
|
|
13094
|
-
})
|
|
13329
|
+
provenance: stampProvenance(affectedFiles, affectedFilesTruncated),
|
|
13330
|
+
// #4943: only this turn's session's next request takes it.
|
|
13331
|
+
deliverTo: deps.deliveryAddress ?? deliverySessionId
|
|
13095
13332
|
}, cwd);
|
|
13096
13333
|
}
|
|
13097
13334
|
logCarriedDrops(cwd, dropped);
|
|
13098
13335
|
cacheManager2.writeCache("turn-end-findings-last", {
|
|
13099
13336
|
signature,
|
|
13100
|
-
|
|
13337
|
+
// #4921: the dedupe is per turn session (`last.sessionId` above).
|
|
13338
|
+
sessionId: deliverySessionId,
|
|
13101
13339
|
projectSeqStart: runtime.turnStartProjectSeq,
|
|
13102
13340
|
projectSeqEnd: runtime.projectSeq
|
|
13103
13341
|
}, cwd);
|
|
13104
13342
|
emitLensTurnFindings({
|
|
13105
13343
|
cwd,
|
|
13106
13344
|
filePaths: files.map((file) => resolveRunnerPath(cwd, file)),
|
|
13107
|
-
sessionId:
|
|
13345
|
+
sessionId: deliverySessionId,
|
|
13108
13346
|
turnIndex: runtime.turnIndex,
|
|
13109
13347
|
blockerSections: blockerParts.length,
|
|
13110
13348
|
advisorySections: advisoryParts.length,
|
|
@@ -13117,7 +13355,7 @@ ${raw}`
|
|
|
13117
13355
|
// so it must not be erased by the no-blockers clean-up. The
|
|
13118
13356
|
// reader clears it after delivery because `hasBlockers` is false.
|
|
13119
13357
|
resolvedParts.length === 0 && !runtime.gitGuardHasBlockers) {
|
|
13120
|
-
retireSettledGitGuardRecord(runtime, cacheManager2, cwd);
|
|
13358
|
+
retireSettledGitGuardRecord(runtime, cacheManager2, cwd, sessionId);
|
|
13121
13359
|
}
|
|
13122
13360
|
}
|
|
13123
13361
|
runtime.fixedThisTurn.clear();
|
|
@@ -13126,41 +13364,7 @@ ${raw}`
|
|
|
13126
13364
|
if (demotedFindingsRetired > 0) {
|
|
13127
13365
|
cacheManager2.clearCache("turn-end-findings-last", cwd);
|
|
13128
13366
|
}
|
|
13129
|
-
|
|
13130
|
-
type: "tool_result",
|
|
13131
|
-
toolName: "turn_end",
|
|
13132
|
-
filePath: cwd,
|
|
13133
|
-
durationMs: Date.now() - turnEndStart,
|
|
13134
|
-
// #1622 review M2: a pending stale secret is NOT a clean turn. It gets its
|
|
13135
|
-
// own result rather than being promoted to `blockers_found`, which would
|
|
13136
|
-
// undo the demotion the freshness gate just made.
|
|
13137
|
-
result: blockerParts.length > 0 ? "blockers_found" : staleSecretParts.length > 0 ? "stale_secrets_pending" : "clean",
|
|
13138
|
-
metadata: {
|
|
13139
|
-
fileCount: files.length,
|
|
13140
|
-
blockerSections: blockerParts.length,
|
|
13141
|
-
staleSecretSections: staleSecretParts.length,
|
|
13142
|
-
advisorySections: advisoryParts.length,
|
|
13143
|
-
// #3218 criterion 2: how many files this turn LISTED as resolved
|
|
13144
|
-
// (held-back entries are not counted), and how many retire events
|
|
13145
|
-
// fell past the cap. The line itself is in the delivered content;
|
|
13146
|
-
// these make the feature visible in latency.log even when the block
|
|
13147
|
-
// is suppressed or the agent reads only telemetry.
|
|
13148
|
-
resolvedBlockerFiles: resolvedBlockerFileList.length,
|
|
13149
|
-
resolvedBlockerFilesDropped,
|
|
13150
|
-
// #3813: one-shot parts the cap cut that stay pending for the next turn.
|
|
13151
|
-
heldSections,
|
|
13152
|
-
// #1944 AC3: an empty advisory section on its own cannot say whether
|
|
13153
|
-
// the turn had nothing to report or dropped something. This counter
|
|
13154
|
-
// answers that from latency.log even when the payload is empty, and
|
|
13155
|
-
// the payload itself carries the retirement note when it is not.
|
|
13156
|
-
demotedFindingsRetired,
|
|
13157
|
-
// #2275: the widget-footer store's own dependency-drift retirements —
|
|
13158
|
-
// a separate surface/counter from `demotedFindingsRetired` above,
|
|
13159
|
-
// since a widget retirement never touches `advisoryParts` or the
|
|
13160
|
-
// `turn-end-findings-last` suppression cache the block below clears.
|
|
13161
|
-
widgetDemotedFindingsRetired
|
|
13162
|
-
}
|
|
13163
|
-
});
|
|
13367
|
+
logTurnEndRow();
|
|
13164
13368
|
resetFormatService2();
|
|
13165
13369
|
}
|
|
13166
13370
|
|
|
@@ -13188,6 +13392,7 @@ function peekMcpSessionRuntime() {
|
|
|
13188
13392
|
}
|
|
13189
13393
|
var noop = () => {
|
|
13190
13394
|
};
|
|
13395
|
+
var MCP_DELIVERY_ADDRESS = "mcp-host";
|
|
13191
13396
|
function joinMessages(consumed) {
|
|
13192
13397
|
if (!consumed?.messages?.length)
|
|
13193
13398
|
return void 0;
|
|
@@ -13338,14 +13543,16 @@ async function runTurnEndNowImpl(cwd, files = [], deferredDelivery = false) {
|
|
|
13338
13543
|
host: "mcp",
|
|
13339
13544
|
owner,
|
|
13340
13545
|
resetLSPService,
|
|
13341
|
-
resetFormatService
|
|
13546
|
+
resetFormatService,
|
|
13547
|
+
deliveryAddress: MCP_DELIVERY_ADDRESS
|
|
13342
13548
|
});
|
|
13549
|
+
const reader = ctx.runtime.telemetrySessionId;
|
|
13343
13550
|
const outcome = deferredDelivery ? {
|
|
13344
|
-
turnEnd: joinMessages(peekTurnEndFindings(ctx.cacheManager, cwd, ctx.runtime, true)),
|
|
13551
|
+
turnEnd: joinMessages(peekTurnEndFindings(ctx.cacheManager, cwd, ctx.runtime, true, reader, MCP_DELIVERY_ADDRESS)),
|
|
13345
13552
|
tests: joinMessages(peekTestFindings(ctx.cacheManager, cwd, ctx.runtime, true)),
|
|
13346
13553
|
filesRegistered: registered
|
|
13347
13554
|
} : {
|
|
13348
|
-
turnEnd: joinMessages(consumeTurnEndFindings(ctx.cacheManager, cwd, ctx.runtime)),
|
|
13555
|
+
turnEnd: joinMessages(consumeTurnEndFindings(ctx.cacheManager, cwd, ctx.runtime, reader, MCP_DELIVERY_ADDRESS)),
|
|
13349
13556
|
tests: joinMessages(consumeTestFindings(ctx.cacheManager, cwd, ctx.runtime)),
|
|
13350
13557
|
filesRegistered: registered
|
|
13351
13558
|
};
|
|
@@ -13354,7 +13561,7 @@ async function runTurnEndNowImpl(cwd, files = [], deferredDelivery = false) {
|
|
|
13354
13561
|
commit: () => {
|
|
13355
13562
|
if (!deferredDelivery)
|
|
13356
13563
|
return;
|
|
13357
|
-
acknowledgeTurnEndFindings(ctx.cacheManager, cwd);
|
|
13564
|
+
acknowledgeTurnEndFindings(ctx.cacheManager, cwd, reader, MCP_DELIVERY_ADDRESS);
|
|
13358
13565
|
acknowledgeTestFindings(ctx.cacheManager, cwd);
|
|
13359
13566
|
}
|
|
13360
13567
|
};
|
|
@@ -13409,15 +13616,16 @@ function runTurnEndForIpcNow(cwd) {
|
|
|
13409
13616
|
};
|
|
13410
13617
|
}
|
|
13411
13618
|
const ctx = await getMcpSessionContext();
|
|
13619
|
+
const reader = ctx.runtime.telemetrySessionId;
|
|
13412
13620
|
const cachedOutcome = {
|
|
13413
|
-
turnEnd: joinMessages(peekTurnEndFindings(ctx.cacheManager, cwd, ctx.runtime, true)),
|
|
13621
|
+
turnEnd: joinMessages(peekTurnEndFindings(ctx.cacheManager, cwd, ctx.runtime, true, reader, MCP_DELIVERY_ADDRESS)),
|
|
13414
13622
|
tests: joinMessages(peekTestFindings(ctx.cacheManager, cwd, ctx.runtime, true)),
|
|
13415
13623
|
filesRegistered: 0
|
|
13416
13624
|
};
|
|
13417
13625
|
const transaction = hasTurnEndFindings(cachedOutcome) ? {
|
|
13418
13626
|
outcome: cachedOutcome,
|
|
13419
13627
|
commit: () => {
|
|
13420
|
-
acknowledgeTurnEndFindings(ctx.cacheManager, cwd);
|
|
13628
|
+
acknowledgeTurnEndFindings(ctx.cacheManager, cwd, reader, MCP_DELIVERY_ADDRESS);
|
|
13421
13629
|
acknowledgeTestFindings(ctx.cacheManager, cwd);
|
|
13422
13630
|
}
|
|
13423
13631
|
} : await runTurnEndNow(cwd, [], true);
|
|
@@ -13643,6 +13851,7 @@ async function getExtractor(languageId) {
|
|
|
13643
13851
|
function diagnosticMessage(err) {
|
|
13644
13852
|
return err instanceof Error ? err.message : String(err);
|
|
13645
13853
|
}
|
|
13854
|
+
var SYNTAX_ERRORS_WARNING = "tree-sitter could not parse part of this file; the symbol list may be incomplete.";
|
|
13646
13855
|
async function extractFile(absPath, languageId, content) {
|
|
13647
13856
|
try {
|
|
13648
13857
|
const tsClient = getSharedTreeSitterClient();
|
|
@@ -13667,6 +13876,8 @@ async function extractFile(absPath, languageId, content) {
|
|
|
13667
13876
|
const extracted = await tsClient.withParsedTree(absPath, languageId, content, (tree) => {
|
|
13668
13877
|
const warnings = extractor ? [] : [`Symbol extractor not available for ${languageId}`];
|
|
13669
13878
|
const result = extractor ? extractor.extract(tree, absPath, content) : { symbols: [], imports: [] };
|
|
13879
|
+
if (result.syntaxErrors)
|
|
13880
|
+
warnings.push(SYNTAX_ERRORS_WARNING);
|
|
13670
13881
|
const owners = result.symbols.filter((candidate) => !candidate.local).map((candidate) => ({
|
|
13671
13882
|
name: candidate.name,
|
|
13672
13883
|
startLine: candidate.line,
|
|
@@ -13995,7 +14206,7 @@ function blastReadArgs(graph, normalizedFile) {
|
|
|
13995
14206
|
return { path: normalizedFile, offset: 1, limit };
|
|
13996
14207
|
}
|
|
13997
14208
|
async function computeBlastRadius(graph, normalizedPath, projectRoot, maxDepth) {
|
|
13998
|
-
const { computeTransitiveImpact } = await import("../chunk-
|
|
14209
|
+
const { computeTransitiveImpact } = await import("../chunk-LSC3VADM.js");
|
|
13999
14210
|
const result = computeTransitiveImpact(graph, normalizedPath, { maxDepth });
|
|
14000
14211
|
const byFile = /* @__PURE__ */ new Map();
|
|
14001
14212
|
for (const hit of result.hits) {
|
|
@@ -14612,7 +14823,7 @@ async function moduleReport(file, cwd, options) {
|
|
|
14612
14823
|
let callGraphIdentity;
|
|
14613
14824
|
let revisionDriftNote;
|
|
14614
14825
|
try {
|
|
14615
|
-
const { getCachedReviewGraph, getReviewGraphCacheIdentity, getReviewGraphSizeSkipVerdict, getReviewGraphRevisionDrift, formatReviewGraphRevisionDriftNote: formatReviewGraphRevisionDriftNote2 } = await import("../chunk-
|
|
14826
|
+
const { getCachedReviewGraph, getReviewGraphCacheIdentity, getReviewGraphSizeSkipVerdict, getReviewGraphRevisionDrift, formatReviewGraphRevisionDriftNote: formatReviewGraphRevisionDriftNote2 } = await import("../chunk-3K2F6UDZ.js");
|
|
14616
14827
|
graph = getCachedReviewGraph(cwd);
|
|
14617
14828
|
graphFileCap = getReviewGraphSizeSkipVerdict(cwd)?.maxFileCount;
|
|
14618
14829
|
const drift = graph ? getReviewGraphRevisionDrift(cwd) : void 0;
|
|
@@ -14777,7 +14988,10 @@ function compactCallbackLine(callback, width) {
|
|
|
14777
14988
|
}
|
|
14778
14989
|
function renderCompactModuleReport(report) {
|
|
14779
14990
|
if (!report.available) {
|
|
14780
|
-
return
|
|
14991
|
+
return [
|
|
14992
|
+
`${report.path} \u2014 unavailable${report.error ? `: ${report.error}` : ""}`,
|
|
14993
|
+
...(report.warnings ?? []).map((note) => `WARNING: ${note}`)
|
|
14994
|
+
].join("\n");
|
|
14781
14995
|
}
|
|
14782
14996
|
const allEntries = [...report.api, ...report.internal];
|
|
14783
14997
|
const allRanges = allEntries.flatMap((e) => [e, ...e.members ?? []]);
|
|
@@ -14967,7 +15181,13 @@ async function readSymbol(file, symbolName, cwd, options = {}) {
|
|
|
14967
15181
|
metadata: { symbol: symbolName, error: message }
|
|
14968
15182
|
});
|
|
14969
15183
|
log(false);
|
|
14970
|
-
return {
|
|
15184
|
+
return {
|
|
15185
|
+
found: false,
|
|
15186
|
+
path: absPath,
|
|
15187
|
+
name: symbolName,
|
|
15188
|
+
error: message,
|
|
15189
|
+
...extractionWarnings?.length ? { warnings: [...extractionWarnings] } : {}
|
|
15190
|
+
};
|
|
14971
15191
|
}
|
|
14972
15192
|
const callbackWarnings = [...extractionWarnings ?? []];
|
|
14973
15193
|
const callback = allCallbacks.find((candidate) => candidate.name === symbolName);
|
|
@@ -15396,7 +15616,7 @@ function roleFor(graph, filePath) {
|
|
|
15396
15616
|
return top.length > 0 ? top.map((s) => s.name).join(", ") : void 0;
|
|
15397
15617
|
}
|
|
15398
15618
|
async function computeHubs(graph, degrees, cwd, limit, focusTerms) {
|
|
15399
|
-
const { computeTransitiveImpact } = await import("../chunk-
|
|
15619
|
+
const { computeTransitiveImpact } = await import("../chunk-LSC3VADM.js");
|
|
15400
15620
|
const ranked = [...graph.fileNodes.entries()].map(([filePath, fileNodeId]) => ({
|
|
15401
15621
|
filePath,
|
|
15402
15622
|
fileNodeId,
|
|
@@ -15648,7 +15868,7 @@ async function projectReport(cwd, options) {
|
|
|
15648
15868
|
const limit = clampLimit(options?.limit);
|
|
15649
15869
|
const focusTerms = normalizeFocus2(options?.focus);
|
|
15650
15870
|
const view = options?.view;
|
|
15651
|
-
const { getCachedReviewGraph, getReviewGraphSizeSkipVerdict, getLastReviewGraphBuildAttempt, buildOrUpdateGraph, isGraphBuildInFlight, getReviewGraphRevisionDrift } = await import("../chunk-
|
|
15871
|
+
const { getCachedReviewGraph, getReviewGraphSizeSkipVerdict, getLastReviewGraphBuildAttempt, buildOrUpdateGraph, isGraphBuildInFlight, getReviewGraphRevisionDrift } = await import("../chunk-3K2F6UDZ.js");
|
|
15652
15872
|
let graph;
|
|
15653
15873
|
try {
|
|
15654
15874
|
graph = getCachedReviewGraph(cwd);
|
|
@@ -15773,7 +15993,7 @@ function renderCompactProjectReport(report) {
|
|
|
15773
15993
|
}
|
|
15774
15994
|
|
|
15775
15995
|
// dist/clients/effective-config.js
|
|
15776
|
-
import * as
|
|
15996
|
+
import * as os4 from "node:os";
|
|
15777
15997
|
import * as path28 from "node:path";
|
|
15778
15998
|
function isEffectiveFileViewError(file) {
|
|
15779
15999
|
return "error" in file;
|
|
@@ -15839,7 +16059,7 @@ function decidedByOrNothing(entry) {
|
|
|
15839
16059
|
}
|
|
15840
16060
|
async function effectiveConfig(options = {}) {
|
|
15841
16061
|
const cwd = options.cwd ?? process.cwd();
|
|
15842
|
-
const homeDir = options.homeDir ??
|
|
16062
|
+
const homeDir = options.homeDir ?? os4.homedir();
|
|
15843
16063
|
const resolveAt = (dir) => resolvePiLensConfig({
|
|
15844
16064
|
cwd: dir,
|
|
15845
16065
|
globalDir: getGlobalPiLensDir(),
|
|
@@ -16097,7 +16317,7 @@ async function symbolSearch(query, cwd, limit = 20, options = {}) {
|
|
|
16097
16317
|
warmLease.release();
|
|
16098
16318
|
}
|
|
16099
16319
|
const hits = results.map(toSymbolSearchHit);
|
|
16100
|
-
const { getCachedReviewGraph } = await import("../chunk-
|
|
16320
|
+
const { getCachedReviewGraph } = await import("../chunk-3K2F6UDZ.js");
|
|
16101
16321
|
const graph = getCachedReviewGraph(cwd);
|
|
16102
16322
|
if (graph)
|
|
16103
16323
|
annotateSymbolSearchHitsWithGraph(hits, centrality, graph);
|
|
@@ -16578,6 +16798,7 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
|
|
|
16578
16798
|
}
|
|
16579
16799
|
|
|
16580
16800
|
// dist/tools/ast-grep-search.js
|
|
16801
|
+
import * as os5 from "node:os";
|
|
16581
16802
|
function errorTextWithHint2(raw, host) {
|
|
16582
16803
|
const hint = astGrepRemediationHint(classifyAstGrepError(raw));
|
|
16583
16804
|
return hint ? `Error: ${raw}
|
|
@@ -17040,7 +17261,7 @@ function createAstGrepSearchTool(astGrepClient2) {
|
|
|
17040
17261
|
details: {}
|
|
17041
17262
|
};
|
|
17042
17263
|
}
|
|
17043
|
-
if (!paths?.length && isAtOrAboveHomeDir(ctx.cwd || ".")) {
|
|
17264
|
+
if (!paths?.length && isAtOrAboveHomeDir(realpathOrResolve(ctx.cwd || "."), realpathOrResolve(os5.homedir()))) {
|
|
17044
17265
|
logOutcome("error", {
|
|
17045
17266
|
errorRaw: "defaulted cwd resolves at or above home directory"
|
|
17046
17267
|
});
|
|
@@ -17269,6 +17490,7 @@ ${hint}` : `${output}${paginationNote}`;
|
|
|
17269
17490
|
// dist/tools/lens-diagnostics.js
|
|
17270
17491
|
import { promises as fs22 } from "node:fs";
|
|
17271
17492
|
import * as fsSync from "node:fs";
|
|
17493
|
+
import * as os7 from "node:os";
|
|
17272
17494
|
import * as path38 from "node:path";
|
|
17273
17495
|
|
|
17274
17496
|
// dist/clients/project-diagnostics/extractors.js
|
|
@@ -17328,7 +17550,7 @@ function reasonFromAvailabilityVerdict(tool, verdict) {
|
|
|
17328
17550
|
|
|
17329
17551
|
// dist/clients/project-diagnostics/fresh-fetch.js
|
|
17330
17552
|
import * as fs20 from "node:fs";
|
|
17331
|
-
import * as
|
|
17553
|
+
import * as os6 from "node:os";
|
|
17332
17554
|
import * as path36 from "node:path";
|
|
17333
17555
|
|
|
17334
17556
|
// dist/clients/project-diagnostics/runner-adapters/jscpd.js
|
|
@@ -17567,7 +17789,7 @@ async function fetchFreshProjectDiagnostics(cacheManager2, cwd, clients, signal,
|
|
|
17567
17789
|
analysisRoot = realpathOrResolve(cwd);
|
|
17568
17790
|
}
|
|
17569
17791
|
const unsafeRootReason = "the analysis root resolves at or above the home directory; heavyweight analyzers refuse to walk from there (#747)";
|
|
17570
|
-
const homeRoot = realpathOrResolve(options.homeDir ??
|
|
17792
|
+
const homeRoot = realpathOrResolve(options.homeDir ?? os6.homedir());
|
|
17571
17793
|
if (options.analysisRoot !== void 0) {
|
|
17572
17794
|
const unsafeExplicitRoot = !isSameOrWithin(homeRoot, analysisRoot) || isSameOrWithin(analysisRoot, homeRoot);
|
|
17573
17795
|
analysisRootValidation = unsafeExplicitRoot ? {
|
|
@@ -17575,7 +17797,7 @@ async function fetchFreshProjectDiagnostics(cacheManager2, cwd, clients, signal,
|
|
|
17575
17797
|
root: analysisRoot,
|
|
17576
17798
|
reason: "explicit analysis root must be strictly contained by the canonical home directory"
|
|
17577
17799
|
} : { state: "safe", root: analysisRoot };
|
|
17578
|
-
} else if (isAtOrAboveHomeDir(analysisRoot,
|
|
17800
|
+
} else if (isAtOrAboveHomeDir(analysisRoot, homeRoot)) {
|
|
17579
17801
|
analysisRootValidation = {
|
|
17580
17802
|
state: "unsafe",
|
|
17581
17803
|
root: analysisRoot,
|
|
@@ -18151,7 +18373,10 @@ function createLspDiagnosticsTool(nextWriteIndex, onConfirmedNoBlockers, getServ
|
|
|
18151
18373
|
const concurrency = boundedPositiveInt(typedParams.concurrency, DEFAULT_BATCH_CONCURRENCY, 1, MAX_BATCH_CONCURRENCY);
|
|
18152
18374
|
const waitMs = typeof typedParams.waitMs === "number" && typedParams.waitMs >= 0 ? Math.floor(typedParams.waitMs) : void 0;
|
|
18153
18375
|
const serverScope = typedParams.serverScope === "primary" ? "primary" : "all";
|
|
18154
|
-
const excludeServerIds = getFlag ?
|
|
18376
|
+
const excludeServerIds = getFlag ? /* @__PURE__ */ new Set([
|
|
18377
|
+
...configDisabledAuxiliaryLspServerIds((name) => getFlag(name, cwd)),
|
|
18378
|
+
...enabledOptInAuxiliaryLspServerIds((name) => getFlag(name, cwd))
|
|
18379
|
+
]) : void 0;
|
|
18155
18380
|
const lspService = getService();
|
|
18156
18381
|
if (!lspService) {
|
|
18157
18382
|
return {
|
|
@@ -18162,6 +18387,7 @@ function createLspDiagnosticsTool(nextWriteIndex, onConfirmedNoBlockers, getServ
|
|
|
18162
18387
|
details: {}
|
|
18163
18388
|
};
|
|
18164
18389
|
}
|
|
18390
|
+
await lspService.sweepDocumentDrift({ force: true, full: true });
|
|
18165
18391
|
if (Array.isArray(typedParams.paths) && typedParams.paths.length > 0) {
|
|
18166
18392
|
if (typedParams.paths.length > MAX_BATCH_FILES) {
|
|
18167
18393
|
return {
|
|
@@ -18284,7 +18510,8 @@ async function collectDiagnosticsForFile(absPath, lspService, scanRoot, waitMs,
|
|
|
18284
18510
|
const attachedBudgetMs = waitMs ?? 15e3;
|
|
18285
18511
|
const attached = await tryWarmAttachedDiagnostics(absPath, content, attachedBudgetMs, "sweep");
|
|
18286
18512
|
if (attached?.available) {
|
|
18287
|
-
const
|
|
18513
|
+
const answer = dropExcludedServers(attached.response, excludeServerIds);
|
|
18514
|
+
const scopedDiagnostics = serverScope === "primary" ? answer.diagnostics.filter((item) => item.serverId === primaryServerId(absPath)) : answer.diagnostics;
|
|
18288
18515
|
const filtered2 = applyAuxiliarySuppressions(scopedDiagnostics, content, {
|
|
18289
18516
|
fileRole: detectFileRole(absPath, content),
|
|
18290
18517
|
filePath: absPath,
|
|
@@ -18309,7 +18536,7 @@ async function collectDiagnosticsForFile(absPath, lspService, scanRoot, waitMs,
|
|
|
18309
18536
|
// #1470: the incumbent's narrowed verdict, carried as an explicit DTO
|
|
18310
18537
|
// field across the socket. An older incumbent omits it → empty → the
|
|
18311
18538
|
// pre-#1470 handling, unchanged.
|
|
18312
|
-
unconfirmedServerIds:
|
|
18539
|
+
unconfirmedServerIds: answer.unconfirmedServerIds ?? [],
|
|
18313
18540
|
diagnosticsUnsupportedServerIds: [],
|
|
18314
18541
|
content,
|
|
18315
18542
|
...attached.response.projectIdentity !== void 0 && {
|
|
@@ -18448,6 +18675,8 @@ function coveredSourcesForCheck(file, serverScope, unconfirmedServerIds, exclude
|
|
|
18448
18675
|
continue;
|
|
18449
18676
|
if (excludeServerIds?.has(server.id))
|
|
18450
18677
|
continue;
|
|
18678
|
+
if (isOptInAuxiliaryServerId(server.id))
|
|
18679
|
+
continue;
|
|
18451
18680
|
covered.add(auxiliary ? server.id : "lsp");
|
|
18452
18681
|
}
|
|
18453
18682
|
return [...covered];
|
|
@@ -18682,10 +18911,7 @@ async function collectFileDiagnosticResult(file, severity, lspService, waitMs, n
|
|
|
18682
18911
|
async function runFileDiagnostics(absPath, severity, lspService, waitMs, nextWriteIndex, serverScope = "all", cwd = process.cwd(), onConfirmedNoBlockers, excludeServerIds) {
|
|
18683
18912
|
const writeIndex = nextWriteIndex?.();
|
|
18684
18913
|
const pythonCompileTarget = await detectPythonTargetVersion(absPath);
|
|
18685
|
-
lspService.announceCreatedFiles([
|
|
18686
|
-
...goPackageFilesToAnnounce([absPath]),
|
|
18687
|
-
...await importTargetsToAnnounce(cwd, [absPath])
|
|
18688
|
-
]);
|
|
18914
|
+
lspService.announceCreatedFiles(goPackageFilesToAnnounce([absPath]), await importTargetsToAnnounce(cwd, [absPath]));
|
|
18689
18915
|
const observedAt = Date.now();
|
|
18690
18916
|
const { diagnostics: rawDiags, timedOut, confirmedByTouch, unconfirmedServerIds, diagnosticsUnsupportedServerIds, content: collectedContent, binding, tooLargeReason, skipReason, primaryUnavailable, projectIdentity } = await collectDiagnosticsForFile(absPath, lspService, cwd, waitMs, serverScope, excludeServerIds);
|
|
18691
18917
|
if (tooLargeReason !== void 0) {
|
|
@@ -18786,8 +19012,14 @@ async function runFileDiagnostics(absPath, severity, lspService, waitMs, nextWri
|
|
|
18786
19012
|
const coverageLine = unconfirmedServerIds.length > 0 ? `Auxiliary coverage INCOMPLETE \u2014 ${[...unconfirmedServerIds].join(", ")} did not answer within the wait budget, so ${unconfirmedServerIds.length === 1 ? "its findings are" : "their findings are"} NOT included here. This is not a clean bill of health for ${unconfirmedServerIds.length === 1 ? "that scanner" : "those scanners"}; re-check after the next edit. waitMs can extend an ordinary wait, but it cannot override a session-demoted scanner.` : void 0;
|
|
18787
19013
|
const suppressedLine = dispositionSuppressedLine(policy.suppressed);
|
|
18788
19014
|
const withheldLine = withheldCompileNote(policy.withheld);
|
|
18789
|
-
const
|
|
18790
|
-
const
|
|
19015
|
+
const notRunServerIds = serverScope === "all" && excludeServerIds && excludeServerIds.size > 0 ? getServersForFileWithConfig(absPath).flatMap((server) => excludeServerIds.has(server.id) ? [server.id] : []) : [];
|
|
19016
|
+
const switchedOffServerIds = notRunServerIds.flatMap((id) => isOptInAuxiliaryServerId(id) ? [] : [id]);
|
|
19017
|
+
const optInNotRunServerIds = notRunServerIds.flatMap((id) => isOptInAuxiliaryServerId(id) ? [id] : []);
|
|
19018
|
+
const noAuxiliaryLine = [
|
|
19019
|
+
"No auxiliary findings.",
|
|
19020
|
+
...switchedOffServerIds.length > 0 ? [`Switched off, not run: ${switchedOffServerIds.join(", ")}.`] : [],
|
|
19021
|
+
...optInNotRunServerIds.length > 0 ? [`Opt-in, not run by this check: ${optInNotRunServerIds.join(", ")}.`] : []
|
|
19022
|
+
].join(" ");
|
|
18791
19023
|
let text;
|
|
18792
19024
|
if (total === 0) {
|
|
18793
19025
|
text = [
|
|
@@ -19001,10 +19233,17 @@ async function collectBatchDiagnostics(files, severity, lspService, options) {
|
|
|
19001
19233
|
else
|
|
19002
19234
|
pendingIndices.set(file, [index]);
|
|
19003
19235
|
});
|
|
19004
|
-
|
|
19005
|
-
|
|
19006
|
-
|
|
19007
|
-
|
|
19236
|
+
const servedClean = [];
|
|
19237
|
+
const unanswered = files.filter((file) => {
|
|
19238
|
+
if (!cacheCtx.servesClean(file, scopeKey))
|
|
19239
|
+
return true;
|
|
19240
|
+
servedClean.push(file);
|
|
19241
|
+
return false;
|
|
19242
|
+
});
|
|
19243
|
+
const noteScope = (file, scope) => cacheCtx.noteImportScope(file, scope);
|
|
19244
|
+
lspService.announceCreatedFiles([...files, ...goPackageFilesToAnnounce(files)], [
|
|
19245
|
+
...await importTargetsToAnnounce(resolvedCwd, unanswered, noteScope),
|
|
19246
|
+
...await importTargetsToAnnounce(resolvedCwd, servedClean, noteScope)
|
|
19008
19247
|
]);
|
|
19009
19248
|
const groups = groupFilesByPrimaryServer(files);
|
|
19010
19249
|
await runPerServerGroups(groups, options.concurrency, async (group) => {
|
|
@@ -19742,7 +19981,13 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
|
|
|
19742
19981
|
nextWriteIndex,
|
|
19743
19982
|
runtime: getRuntime?.(),
|
|
19744
19983
|
analysisRoot: typeof params.analysisRoot === "string" ? params.analysisRoot : void 0,
|
|
19745
|
-
host: ctx.host ?? "pi"
|
|
19984
|
+
host: ctx.host ?? "pi",
|
|
19985
|
+
// #4944: the sweep leaves an auxiliary the operator turned off
|
|
19986
|
+
// (`--no-ast-grep`, `astGrep.enabled=false`) unstarted, as the
|
|
19987
|
+
// `source=lsp` probe does.
|
|
19988
|
+
...getFlag && {
|
|
19989
|
+
excludeServerIds: configDisabledAuxiliaryLspServerIds((name) => getFlag(name, cwd))
|
|
19990
|
+
}
|
|
19746
19991
|
});
|
|
19747
19992
|
}
|
|
19748
19993
|
return formatDeltaMode(cacheManager2, cwd, severity, pathsScope);
|
|
@@ -20580,7 +20825,8 @@ async function formatFullMode(cwd, severity, lspService, cacheManager2, options
|
|
|
20580
20825
|
onProgress: options.onProgress,
|
|
20581
20826
|
onServerReady: options.onServerReady,
|
|
20582
20827
|
nextWriteIndex: options.nextWriteIndex,
|
|
20583
|
-
files: explicitFiles
|
|
20828
|
+
files: explicitFiles,
|
|
20829
|
+
excludeServerIds: options.excludeServerIds
|
|
20584
20830
|
}),
|
|
20585
20831
|
getProjectDiagnosticsSnapshotForFullMode(cwd, {
|
|
20586
20832
|
...options,
|
|
@@ -20799,6 +21045,10 @@ ${withheldText}`
|
|
|
20799
21045
|
const auxiliaryCoverageNote = uncoveredScannerIds.length > 0 ? `
|
|
20800
21046
|
|
|
20801
21047
|
\u26A0 Auxiliary coverage incomplete: ${uncoveredScannerIds.join(", ")} did not answer for ${partiallyCoveredLspResults.length} file(s). Findings from answering servers are included; this is not a clean verdict for the named scanner lane(s).` : "";
|
|
21048
|
+
const switchedOffServerIds = [...options.excludeServerIds ?? []].sort((a, b) => Number(a > b) - Number(a < b));
|
|
21049
|
+
const switchedOffNote = switchedOffServerIds.length > 0 ? `
|
|
21050
|
+
|
|
21051
|
+
Switched off, not run (auxiliary LSP): ${switchedOffServerIds.join(", ")}.` : "";
|
|
20802
21052
|
const lspPrimaryVsAuxiliary = tallyLspPrimaryVsAuxiliary(confirmedLspResults);
|
|
20803
21053
|
logExtension({
|
|
20804
21054
|
subsystem: "lsp-diagnostics",
|
|
@@ -20840,7 +21090,7 @@ test-runner coverage is edit-scoped, NOT a full-project run: its findings only r
|
|
|
20840
21090
|
const failedNote = failedAnalyzers.length > 0 ? `
|
|
20841
21091
|
|
|
20842
21092
|
failed (ran, but no trustworthy result): ${failedAnalyzers.map(({ id, summary }) => `${id} \u2014 ${summary}`).join(", ")}. These analyzers were not cached and will be retried; absence of their findings is NOT a clean verdict.` : "";
|
|
20843
|
-
const walkUnsafeRoot = explicitFiles === void 0 && isAtOrAboveHomeDir(cwd);
|
|
21093
|
+
const walkUnsafeRoot = explicitFiles === void 0 && isAtOrAboveHomeDir(realpathOrResolve(cwd), realpathOrResolve(os7.homedir()));
|
|
20844
21094
|
const walkUnsafeRootNote = walkUnsafeRoot ? `
|
|
20845
21095
|
|
|
20846
21096
|
project file walk skipped: the working directory resolves at or above the home directory, so the cheap project scan and the LSP workspace sweep would each enumerate every unrelated tree under it. Re-run from inside a project directory. Absence of their findings is NOT a clean verdict.` : "";
|
|
@@ -20944,18 +21194,18 @@ served from cache this call (not re-run): ${cachedAgeEntries.map(([id, ms]) => `
|
|
|
20944
21194
|
content: [
|
|
20945
21195
|
{
|
|
20946
21196
|
type: "text",
|
|
20947
|
-
text: result.content[0].text + note + unconfirmedLspNote + auxiliaryCoverageNote + lspPrimaryVsAuxiliaryNote + partialNote + coldNote + testRunnerEditScopedNote + failedNote + walkUnsafeRootNote + scanTruncatedNote + generatedSkipNote + abortedNote + freshNote + cachedAgeNote + cheapScanStatusNote + missingNote
|
|
21197
|
+
text: result.content[0].text + note + unconfirmedLspNote + auxiliaryCoverageNote + switchedOffNote + lspPrimaryVsAuxiliaryNote + partialNote + coldNote + testRunnerEditScopedNote + failedNote + walkUnsafeRootNote + scanTruncatedNote + generatedSkipNote + abortedNote + freshNote + cachedAgeNote + cheapScanStatusNote + missingNote
|
|
20948
21198
|
}
|
|
20949
21199
|
],
|
|
20950
21200
|
details: { ...resultWithCold.details, timedOut }
|
|
20951
21201
|
};
|
|
20952
21202
|
}
|
|
20953
|
-
if (missingNote || coldNote || partialNote || testRunnerEditScopedNote || failedNote || walkUnsafeRootNote || scanTruncatedNote || generatedSkipNote || abortedNote || freshNote || cachedAgeNote || cheapScanStatusNote || unconfirmedLspNote || auxiliaryCoverageNote || lspPrimaryVsAuxiliaryNote) {
|
|
21203
|
+
if (missingNote || coldNote || partialNote || testRunnerEditScopedNote || failedNote || walkUnsafeRootNote || scanTruncatedNote || generatedSkipNote || abortedNote || freshNote || cachedAgeNote || cheapScanStatusNote || unconfirmedLspNote || auxiliaryCoverageNote || switchedOffNote || lspPrimaryVsAuxiliaryNote) {
|
|
20954
21204
|
return {
|
|
20955
21205
|
content: [
|
|
20956
21206
|
{
|
|
20957
21207
|
type: "text",
|
|
20958
|
-
text: result.content[0].text + unconfirmedLspNote + auxiliaryCoverageNote + lspPrimaryVsAuxiliaryNote + partialNote + coldNote + testRunnerEditScopedNote + failedNote + walkUnsafeRootNote + scanTruncatedNote + generatedSkipNote + abortedNote + freshNote + cachedAgeNote + cheapScanStatusNote + missingNote
|
|
21208
|
+
text: result.content[0].text + unconfirmedLspNote + auxiliaryCoverageNote + switchedOffNote + lspPrimaryVsAuxiliaryNote + partialNote + coldNote + testRunnerEditScopedNote + failedNote + walkUnsafeRootNote + scanTruncatedNote + generatedSkipNote + abortedNote + freshNote + cachedAgeNote + cheapScanStatusNote + missingNote
|
|
20959
21209
|
}
|
|
20960
21210
|
],
|
|
20961
21211
|
details: resultWithCold.details
|
|
@@ -22206,7 +22456,7 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
22206
22456
|
source: mutationSource,
|
|
22207
22457
|
...mutationDeps,
|
|
22208
22458
|
session,
|
|
22209
|
-
readGuard: getFlag("no-read-guard", cwd) ? void 0 : mutationDeps?.readGuard,
|
|
22459
|
+
readGuard: getFlag("no-read-guard", cwd) ? void 0 : mutationDeps?.readGuardFor?.(ctx.sessionManager?.getSessionId?.()) ?? mutationDeps?.readGuard,
|
|
22210
22460
|
// #2450 review round 2 (F4)/round 3 (F2, F4): the SAME gate
|
|
22211
22461
|
// `registerMutationBridge` applies internally in `index.ts`, so
|
|
22212
22462
|
// this directly-threaded path and the bridge fallback
|
|
@@ -22294,6 +22544,7 @@ function createLspNavigationTool(getFlag, mutationDeps) {
|
|
|
22294
22544
|
});
|
|
22295
22545
|
}
|
|
22296
22546
|
const excludeServerIds = configDisabledAuxiliaryLspServerIds((name) => getFlag(name, ctx.cwd));
|
|
22547
|
+
await lspService.sweepDocumentDrift({ force: true, full: true });
|
|
22297
22548
|
const openedContent = await openFileBestEffort(lspService, filePath, true, excludeServerIds);
|
|
22298
22549
|
const pythonCompileTarget = await detectPythonTargetVersion(filePath);
|
|
22299
22550
|
const policy = applyProbeFindingPolicy(filePath, await lspService.getDiagnostics(filePath, void 0, excludeServerIds), policyCwd, openedContent, "all", "lsp_navigation", pythonCompileTarget);
|
|
@@ -23875,7 +24126,8 @@ ${graphStaleness}` : "");
|
|
|
23875
24126
|
return {
|
|
23876
24127
|
...renderToolText(`Symbol "${symbol}" not found in ${path40.basename(file)}.${suggestionSuffix}`, {
|
|
23877
24128
|
found: false,
|
|
23878
|
-
...result.suggestions ? { suggestions: result.suggestions } : {}
|
|
24129
|
+
...result.suggestions ? { suggestions: result.suggestions } : {},
|
|
24130
|
+
...result.warnings ? { warnings: result.warnings } : {}
|
|
23879
24131
|
}),
|
|
23880
24132
|
isError: true
|
|
23881
24133
|
};
|