pi-agent-ide 0.9.4 → 0.9.6
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 +38 -0
- package/README.md +1 -1
- package/dist/{chunk-ZXO4D5UB.js → chunk-2AANEKFS.js} +1 -1
- package/dist/{chunk-BU7IZLKB.js → chunk-2DSY4U73.js} +1 -1
- package/dist/chunk-2YO6RVX4.js +1 -0
- package/dist/{chunk-WES2E4VR.js → chunk-33U3RUM3.js} +1 -1
- package/dist/{chunk-CJPS4GXD.js → chunk-34IYWKY5.js} +1 -1
- package/dist/{chunk-2TTSJOLO.js → chunk-4CSNQX54.js} +1 -1
- package/dist/{chunk-DAZQSXUW.js → chunk-53IV6EKV.js} +1 -1
- package/dist/{chunk-7PVDTMEM.js → chunk-5AROEOJB.js} +1 -1
- package/dist/{chunk-IG5DXVDJ.js → chunk-5D4C225L.js} +1 -1
- package/dist/{chunk-GHO6TCPJ.js → chunk-5DN2XBVI.js} +1 -1
- package/dist/{chunk-FHRHYY4M.js → chunk-5W6QQZFI.js} +1 -1
- package/dist/{chunk-5PC5INOL.js → chunk-6W4OJLCJ.js} +1 -1
- package/dist/chunk-6ZYCTWQE.js +1 -0
- package/dist/{chunk-B25LXXNV.js → chunk-72FL5FHZ.js} +1 -1
- package/dist/{chunk-BB4A5UI3.js → chunk-7JWZPJI5.js} +1 -1
- package/dist/{chunk-T3Z4KXOX.js → chunk-AMSNDWBT.js} +1 -1
- package/dist/{chunk-DFXXT6MJ.js → chunk-APWMLLSE.js} +6 -6
- package/dist/{chunk-NA2NEU4V.js → chunk-B5UJCNQU.js} +1 -1
- package/dist/chunk-BMSAVDRD.js +13 -0
- package/dist/{chunk-MPNE25CY.js → chunk-BRJIXNFU.js} +1 -1
- package/dist/chunk-C2GZLLSP.js +5 -0
- package/dist/{chunk-XCPIIDFS.js → chunk-DHOIQZUF.js} +1 -1
- package/dist/chunk-ECSMTGVM.js +6 -0
- package/dist/{chunk-DEP55R35.js → chunk-EHFWODRT.js} +1 -1
- package/dist/{chunk-6WCHBHFW.js → chunk-EWTVVPUA.js} +1 -1
- package/dist/{chunk-H3GEEOOL.js → chunk-FBR7ZLLN.js} +1 -1
- package/dist/{chunk-UD3DMY3Q.js → chunk-FGN2ZMEN.js} +1 -1
- package/dist/{chunk-MKDOT76B.js → chunk-FJSYWOE6.js} +1 -1
- package/dist/{chunk-LF325WYO.js → chunk-FTECKRK6.js} +1 -1
- package/dist/chunk-GRZTKMXQ.js +1 -0
- package/dist/chunk-H6FEBUAP.js +1 -0
- package/dist/{chunk-FYOU4RBH.js → chunk-HFCHOFLV.js} +1 -1
- package/dist/chunk-HFF4GY7R.js +3 -0
- package/dist/{chunk-QJ6V5IAY.js → chunk-HJXSEPO7.js} +14 -12
- package/dist/{chunk-SRFWT562.js → chunk-HSEDKYH4.js} +1 -1
- package/dist/{chunk-6P7LTQZT.js → chunk-II7AOJNH.js} +1 -1
- package/dist/chunk-J6CDIH3S.js +84 -0
- package/dist/{chunk-USG6WHAT.js → chunk-JHWLRL4U.js} +1 -1
- package/dist/{chunk-35LZOKEW.js → chunk-JMQ67UNK.js} +1 -1
- package/dist/{chunk-7OUML24Z.js → chunk-JRIP33PC.js} +1 -1
- package/dist/chunk-JXULBI4S.js +2 -0
- package/dist/chunk-JYITLCXC.js +1 -0
- package/dist/{chunk-4IWEKRSP.js → chunk-KJAR2WDO.js} +1 -1
- package/dist/{chunk-GS5ZRTUG.js → chunk-KQV2ZXLP.js} +1 -1
- package/dist/{chunk-AMIIOWFL.js → chunk-KX7MG72M.js} +1 -1
- package/dist/{chunk-HGCJDIRR.js → chunk-LIGOOMJS.js} +5 -5
- package/dist/{chunk-OMNKD7WW.js → chunk-LY2UANKU.js} +3 -3
- package/dist/chunk-M7P7V4WI.js +25 -0
- package/dist/chunk-N2NEFXHB.js +13 -0
- package/dist/{chunk-2TZDG2JH.js → chunk-NF74ITWT.js} +2 -2
- package/dist/{chunk-AP2BOC24.js → chunk-NQYUIQRH.js} +1 -1
- package/dist/{chunk-7C73WVPB.js → chunk-OCU6NW5Y.js} +1 -1
- package/dist/chunk-OIEA4QWF.js +4 -0
- package/dist/{chunk-FXPY3V4L.js → chunk-ON5HDFNL.js} +1 -1
- package/dist/{chunk-U2N73BUY.js → chunk-P43GGKUC.js} +5 -5
- package/dist/{chunk-5BGWNYQS.js → chunk-P7FUD4WY.js} +1 -1
- package/dist/{chunk-VMLPXSMK.js → chunk-PPCWY4BB.js} +1 -1
- package/dist/{chunk-YPYROPQF.js → chunk-QGXZ4RWX.js} +1 -1
- package/dist/chunk-S3T5NOSL.js +1 -0
- package/dist/chunk-S7E2D5K7.js +5 -0
- package/dist/{chunk-DDH3FP4G.js → chunk-SIYPD5MM.js} +3 -3
- package/dist/{chunk-6A3ORNW3.js → chunk-T5ACAOKJ.js} +3 -3
- package/dist/chunk-TILMPAF2.js +1 -0
- package/dist/{chunk-RIJRPAL2.js → chunk-TSNY2FSU.js} +1 -1
- package/dist/{chunk-UI4KSKS3.js → chunk-TWJINFQB.js} +4 -4
- package/dist/chunk-TWQ6ACOI.js +1 -0
- package/dist/chunk-UDVVKVG4.js +1 -0
- package/dist/{chunk-WQIMM4SU.js → chunk-V2D5MLGE.js} +1 -1
- package/dist/{chunk-PQWANILR.js → chunk-VDSSAP6Y.js} +1 -1
- package/dist/{chunk-AVJVTF5H.js → chunk-VHYJTAXX.js} +1 -1
- package/dist/{chunk-MJFY4RGT.js → chunk-WCSWQDJ2.js} +1 -1
- package/dist/{chunk-JWSJCEIB.js → chunk-WQTF6Q2X.js} +1 -1
- package/dist/chunk-YFPU2LRR.js +23 -0
- package/dist/{chunk-KWJD7FBS.js → chunk-YLEERRX3.js} +14 -14
- package/dist/chunk-YNOR4LIE.js +1 -0
- package/dist/{chunk-WEE3NM6L.js → chunk-YOJHCARZ.js} +1 -1
- package/dist/chunk-YPTDPMK5.js +1 -0
- package/dist/{chunk-GXL4NMHR.js → chunk-YZTVC7ME.js} +1 -1
- package/dist/entry-0.js +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -1
- package/dist/entry-22.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-31.js +2 -2
- package/dist/entry-32.js +1 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +13 -13
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +1 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -1
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-72.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-77.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-82.js +1 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -1
- package/dist/entry-90.js +1 -1
- package/dist/entry-91.js +1 -1
- package/dist/entry-92.js +1 -1
- package/dist/entry-93.js +1 -1
- package/dist/entry-94.js +1 -1
- package/dist/pi-agent-ide.js +11 -11
- package/docs/development.md +2 -0
- package/docs/generated/tool-catalog/python.md +1 -0
- package/docs/tools.md +2 -0
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-doctor/src/connect-plugin.ts +2 -2
- package/node_modules/pi-agent-doctor/src/evidence.ts +1 -1
- package/node_modules/pi-agent-doctor/src/fixtures/executable-probe.ts +2 -2
- package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +4 -4
- package/node_modules/pi-agent-doctor/src/project-probes.ts +2 -2
- package/node_modules/pi-agent-doctor/src/workspace.ts +2 -2
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +2 -2
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem/src/file-write-lock.ts +70 -0
- package/node_modules/pi-agent-filesystem/src/replace-file.ts +50 -0
- package/node_modules/pi-agent-filesystem/src/resolver.ts +28 -8
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/index.ts +1 -1
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +1 -1
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/index.ts +1 -1
- package/node_modules/pi-agent-ide-ast/package.json +13 -13
- package/node_modules/pi-agent-ide-ast/src/api/scope.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +33 -11
- package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +60 -55
- package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +4 -3
- package/node_modules/pi-agent-ide-ast/src/extension.ts +10 -10
- package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +3 -3
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +35 -8
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +161 -23
- package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +1 -1
- package/node_modules/pi-agent-ide-changes/index.ts +9 -9
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/src/change-anchor.ts +4 -4
- package/node_modules/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
- package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +4 -4
- package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -1
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +4 -4
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +5 -5
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -6
- package/node_modules/pi-agent-ide-formatter/index.ts +5 -5
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/doctor-plugin.ts +2 -2
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +2 -2
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +1 -1
- package/node_modules/pi-agent-ide-languages/index.ts +1 -1
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/index.ts +9 -9
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lint/src/catalog.ts +4 -0
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +15 -6
- package/node_modules/pi-agent-ide-lint/src/diagnostics.ts +8 -14
- package/node_modules/pi-agent-ide-lint/src/doctor-plugin.ts +3 -3
- package/node_modules/pi-agent-ide-lint/src/registry.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/index.ts +37 -16
- package/node_modules/pi-agent-ide-lsp/package.json +12 -12
- package/node_modules/pi-agent-ide-lsp/src/catalog.ts +12 -1
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +21 -14
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +63 -20
- package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +4 -4
- package/node_modules/pi-agent-ide-lsp/src/idle-timeout.ts +15 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/abort.ts +11 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +434 -80
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +121 -35
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostics.ts +26 -12
- package/node_modules/pi-agent-ide-lsp/src/lsp/document-leases.ts +31 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/errors.ts +4 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/file-watchers.ts +1 -77
- package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +19 -19
- package/node_modules/pi-agent-ide-lsp/src/lsp/language-map.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +5 -4
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +59 -28
- package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +42 -22
- package/node_modules/pi-agent-ide-lsp/src/lsp/owner-transport.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/position-map.ts +52 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +2 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +2 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/server-request-handlers.mjs +325 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +797 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/shared-servers.ts +322 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/source-changes.ts +29 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +76 -17
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +3 -3
- package/node_modules/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +16 -8
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +149 -134
- package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +1 -1
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-image/src/index.ts +1 -1
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-pdf/src/index.ts +1 -1
- package/node_modules/pi-agent-read/index.ts +1 -1
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-read/src/api/connect-plugin.ts +1 -1
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +1 -1
- package/node_modules/pi-agent-read/src/api/rendering.ts +2 -2
- package/node_modules/pi-agent-read/src/api/tools/read.ts +8 -2
- package/node_modules/pi-agent-read/src/core/extension.ts +4 -4
- package/node_modules/pi-agent-read/src/core/read-core.ts +4 -4
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +2 -2
- package/node_modules/pi-agent-read/src/core/tools/read/persisted-result.ts +1 -1
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +3 -3
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +4 -4
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +21 -14
- package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +24 -18
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +2 -2
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +44 -18
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/connect-plugin.ts +4 -4
- package/node_modules/pi-agent-resource/src/content-conversion/content-converter.ts +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-host.ts +4 -4
- package/node_modules/pi-agent-resource/src/content-conversion/content-runner.ts +3 -3
- package/node_modules/pi-agent-resource/src/content-conversion/plugin-protocol.ts +2 -2
- package/node_modules/pi-agent-resource/src/content-conversion/validation.ts +2 -2
- package/node_modules/pi-agent-resource/src/index.ts +19 -19
- package/node_modules/pi-agent-resource/src/resolver.ts +1 -1
- package/node_modules/pi-agent-resource/src/resource-access.ts +1 -1
- package/node_modules/pi-agent-resource/src/resource-error.ts +1 -1
- package/node_modules/pi-agent-resource/src/resource.ts +1 -1
- package/node_modules/pi-agent-resource/src/result-images.ts +1 -1
- package/node_modules/pi-agent-resource/src/result-targets.ts +23 -2
- package/node_modules/pi-agent-resource/src/temp-resource-store.ts +2 -2
- package/node_modules/pi-agent-resource/src/tool-result.ts +2 -2
- package/node_modules/pi-agent-resource/src/validation.ts +3 -3
- package/node_modules/pi-agent-search/index.ts +1 -1
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search/src/api/connect-plugin.ts +1 -1
- package/node_modules/pi-agent-search/src/api/fuzzy.ts +2 -2
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/presentation.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search-scope.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search.ts +7 -7
- package/node_modules/pi-agent-search/src/core/extension.ts +7 -7
- package/node_modules/pi-agent-search/src/core/search-core.ts +3 -3
- package/node_modules/pi-agent-search-text/index.ts +8 -8
- package/node_modules/pi-agent-search-text/package.json +10 -10
- package/node_modules/pi-agent-search-text/src/doctor-plugin.ts +1 -1
- package/node_modules/pi-agent-search-text/src/file-search.ts +1 -1
- package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +2 -2
- package/node_modules/pi-agent-search-text/src/persisted-result.ts +1 -1
- package/node_modules/pi-agent-search-text/src/resolvers.ts +9 -9
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +4 -4
- package/node_modules/pi-agent-search-text/src/search-backend.ts +3 -3
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -2
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +3 -3
- package/node_modules/pi-agent-search-text/src/search-result.ts +2 -2
- package/node_modules/pi-agent-search-text/src/search-session.ts +132 -67
- package/node_modules/pi-agent-search-text/src/tool-file-search.ts +1 -1
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/index.ts +7 -7
- package/node_modules/pi-agent-text/src/source-line.ts +1 -1
- package/node_modules/pi-agent-text/src/text-document.ts +50 -2
- package/node_modules/pi-agent-text-anchor-constant/index.ts +1 -1
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/index.ts +2 -2
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +63 -48
- package/node_modules/pi-agent-text-anchor-exact/src/recovery.ts +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -2
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +23 -12
- package/node_modules/pi-agent-text-editor/index.ts +5 -5
- package/node_modules/pi-agent-text-editor/package.json +9 -9
- package/node_modules/pi-agent-text-editor/src/api/connect-plugin.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/file-operations.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/file-transfers.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/native-files.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +14 -14
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -13
- package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -6
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/image-write.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +11 -6
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +213 -20
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +39 -3
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +6 -6
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +22 -22
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/read-fragment-resolver.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/result-input.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/source-change-retry.ts +41 -0
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-recovery.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +4 -7
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +34 -21
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/text-edit-origin.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +72 -30
- package/node_modules/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +211 -159
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/tools/extension.ts +7 -7
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -5
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +3 -3
- package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +2 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -4
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +2 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +3 -3
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +2 -2
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +7 -7
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +32 -9
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- package/node_modules/pi-agent-tool-ui/src/index.ts +1 -1
- package/node_modules/pi-agent-tool-ui/src/result-panel.ts +1 -1
- package/node_modules/pi-agent-web/index.ts +3 -3
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/src/doctor-plugin.ts +1 -1
- package/node_modules/pi-agent-web/src/resolver.ts +1 -1
- package/node_modules/pi-agent-web-html/index.ts +1 -1
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- package/node_modules/pi-agent-web-image/package.json +3 -3
- package/node_modules/pi-agent-web-pdf/package.json +3 -3
- package/node_modules/pi-agent-web-text/package.json +3 -3
- package/package.json +36 -36
- package/src/api/code-view.ts +3 -3
- package/src/api/connect-plugin.ts +1 -1
- package/src/api/connect-tip-provider.ts +2 -2
- package/src/api/doctor-runtime.ts +1 -1
- package/src/api/doctor.ts +1 -1
- package/src/api/hooks.ts +2 -2
- package/src/api/plugin-protocol.ts +1 -1
- package/src/api/settings.ts +6 -1
- package/src/api/standalone.ts +1 -1
- package/src/api/tips.ts +1 -1
- package/src/api/tool-config/linters.json +1 -1
- package/src/api/tool-config/lsp-servers.json +11 -0
- package/src/api/tool-config.ts +45 -5
- package/src/api/toolchain.ts +3 -3
- package/src/backend/config.ts +2 -2
- package/src/backend/configured-process.ts +5 -5
- package/src/backend/dap-java-transport.ts +6 -6
- package/src/backend/dap-node-transport.ts +5 -5
- package/src/backend/dap-tcp-transport.ts +3 -3
- package/src/backend/dap-transport.ts +5 -5
- package/src/backend/debugger-registration.ts +7 -7
- package/src/backend/debugger-workspace-owner.ts +10 -10
- package/src/backend/doctor-registration.ts +5 -5
- package/src/backend/doctor-workspace.ts +13 -13
- package/src/backend/file-operation-resolver.ts +5 -5
- package/src/backend/file-revision.ts +1 -1
- package/src/backend/file-transfer.ts +4 -4
- package/src/backend/formatter-registration.ts +11 -11
- package/src/backend/git-registration.ts +4 -4
- package/src/backend/index.ts +3 -3
- package/src/backend/lint-registration.ts +11 -11
- package/src/backend/lsp-file-watchers.ts +5 -5
- package/src/backend/lsp-registration.ts +11 -11
- package/src/backend/lsp-transport.ts +7 -7
- package/src/backend/lsp-workspace-owner.ts +4 -4
- package/src/backend/object-transfer.ts +5 -5
- package/src/backend/owned-command.ts +2 -2
- package/src/backend/owned-process-stop.ts +4 -4
- package/src/backend/owned-read-command.ts +2 -2
- package/src/backend/process-environment.ts +2 -2
- package/src/backend/process-metadata.ts +2 -2
- package/src/backend/recipe-evidence.ts +2 -2
- package/src/backend/registration.ts +8 -8
- package/src/backend/registry.ts +2 -2
- package/src/backend/resource-resolver.ts +2 -2
- package/src/backend/search-environment.ts +3 -3
- package/src/backend/ssh-channel.ts +3 -3
- package/src/backend/ssh-transport.ts +2 -2
- package/src/backend/ssh.ts +6 -6
- package/src/backend/tool-config-access.ts +4 -4
- package/src/backend/tool-project.ts +5 -5
- package/src/backend/web-browser.ts +3 -3
- package/src/backend/web-http.ts +2 -2
- package/src/backend/web-owner.ts +5 -5
- package/src/backend/web-registration.ts +5 -5
- package/src/code-review/extension.ts +3 -3
- package/src/code-review/reviewer.ts +2 -2
- package/src/code-view/diagnostic-view.ts +4 -4
- package/src/composite/builtin-extensions.ts +37 -37
- package/src/composite/capabilities.ts +2 -2
- package/src/composite/capability-schemas.ts +1 -1
- package/src/composite/detached-results.ts +32 -0
- package/src/composite/extensions-config.ts +2 -2
- package/src/composite/module-settings-store.ts +2 -2
- package/src/composite/module-settings.ts +12 -12
- package/src/composite/nested-tool-rendering.ts +3 -3
- package/src/composite/output-limits.ts +6 -1
- package/src/composite/preferences.ts +10 -0
- package/src/composite/presets.ts +1 -1
- package/src/composite/reload-required.ts +6 -6
- package/src/composite/settings-documentation.ts +5 -5
- package/src/composite/settings-registry.ts +4 -4
- package/src/composite/text-results.ts +2 -2
- package/src/core/diagnostic-entry.ts +2 -2
- package/src/core/diagnostic-store.ts +3 -3
- package/src/core/extension.ts +8 -8
- package/src/core/ide-core.ts +4 -4
- package/src/doctor/config-writer.ts +3 -3
- package/src/doctor/core.ts +2 -2
- package/src/doctor/discovery.ts +4 -4
- package/src/doctor/extension.ts +7 -7
- package/src/doctor/index.ts +1 -1
- package/src/doctor/inventory.ts +1 -1
- package/src/doctor/run.ts +6 -6
- package/src/doctor/tip-provider.ts +2 -2
- package/src/documentation/extension.ts +3 -3
- package/src/documentation/registry.ts +1 -1
- package/src/documentation/search.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/file-write-lock.ts +70 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/replace-file.ts +50 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +28 -8
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/index.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/doctor-plugin.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +1 -1
- package/src/extensions/pi-agent-read/index.ts +1 -1
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/connect-plugin.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/rendering.ts +2 -2
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/extension.ts +4 -4
- package/src/extensions/pi-agent-read/src/core/read-core.ts +4 -4
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +2 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/persisted-result.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +3 -3
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +4 -4
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +21 -14
- package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +24 -18
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +2 -2
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +44 -18
- package/src/extensions/pi-agent-search/index.ts +1 -1
- package/src/extensions/pi-agent-search/package.json +5 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +8 -8
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +10 -10
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/doctor-plugin.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +2 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/persisted-result.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +4 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +2 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +132 -67
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/connect-plugin.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +2 -2
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/presentation.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search-scope.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search.ts +7 -7
- package/src/extensions/pi-agent-search/src/core/extension.ts +7 -7
- package/src/extensions/pi-agent-search/src/core/search-core.ts +3 -3
- package/src/extensions/pi-agent-text-editor/index.ts +5 -5
- package/src/extensions/pi-agent-text-editor/package.json +9 -9
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/index.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +63 -48
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/recovery.ts +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +23 -12
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/src/api/connect-plugin.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/file-operations.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/file-transfers.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/native-files.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +14 -14
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -13
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -6
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +11 -6
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +213 -20
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +39 -3
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +6 -6
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +22 -22
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/read-fragment-resolver.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/source-change-retry.ts +41 -0
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-recovery.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +4 -7
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +34 -21
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-origin.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +72 -30
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +211 -159
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/tools/extension.ts +7 -7
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +1 -1
- package/src/index.ts +1 -1
- package/src/pi-agent-ide.ts +22 -20
- package/src/plugins/pi-agent-ide-ast/index.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/api/scope.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +33 -11
- package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +60 -55
- package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +4 -3
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +10 -10
- package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +3 -3
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +35 -8
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +161 -23
- package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +9 -9
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/src/change-anchor.ts +4 -4
- package/src/plugins/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +4 -4
- package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +4 -4
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +5 -5
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -6
- package/src/plugins/pi-agent-ide-debugger/index.ts +21 -13
- package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +1 -1
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +4 -4
- package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +2 -2
- package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +3 -3
- package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +1 -1
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +5 -5
- package/src/plugins/pi-agent-ide-debugger/src/ui.ts +1 -1
- package/src/plugins/pi-agent-ide-debugger/src/vscode-backend.ts +1 -1
- package/src/plugins/pi-agent-ide-debugger/src/workspace-owner.ts +2 -2
- package/src/plugins/pi-agent-ide-diagnostics/index.ts +1 -1
- package/src/plugins/pi-agent-ide-formatter/index.ts +5 -5
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/doctor-plugin.ts +2 -2
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +2 -2
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +1 -1
- package/src/plugins/pi-agent-ide-languages/index.ts +1 -1
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/index.ts +9 -9
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lint/src/catalog.ts +4 -0
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +15 -6
- package/src/plugins/pi-agent-ide-lint/src/diagnostics.ts +8 -14
- package/src/plugins/pi-agent-ide-lint/src/doctor-plugin.ts +3 -3
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/index.ts +37 -16
- package/src/plugins/pi-agent-ide-lsp/package.json +12 -12
- package/src/plugins/pi-agent-ide-lsp/src/catalog.ts +12 -1
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +21 -14
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +63 -20
- package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +4 -4
- package/src/plugins/pi-agent-ide-lsp/src/idle-timeout.ts +15 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/abort.ts +11 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +434 -80
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +121 -35
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostics.ts +26 -12
- package/src/plugins/pi-agent-ide-lsp/src/lsp/document-leases.ts +31 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/errors.ts +4 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/file-watchers.ts +1 -77
- package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +19 -19
- package/src/plugins/pi-agent-ide-lsp/src/lsp/language-map.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +5 -4
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +59 -28
- package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +42 -22
- package/src/plugins/pi-agent-ide-lsp/src/lsp/owner-transport.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/position-map.ts +52 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +2 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +2 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/server-request-handlers.mjs +325 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +797 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-servers.ts +322 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/source-changes.ts +29 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +76 -17
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +3 -3
- package/src/plugins/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +16 -8
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +149 -134
- package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +1 -1
- package/src/plugins/pi-agent-ide-processes/index.ts +4 -4
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +1 -1
- package/src/plugins/pi-agent-ide-semantic/src/vera-backend.ts +2 -2
- package/src/plugins/pi-agent-ide-terminal/index.ts +17 -17
- package/src/plugins/pi-agent-ide-terminal/src/origin.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -5
- package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +2 -2
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +9 -9
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +3 -3
- package/src/post-edit/gate.ts +1 -1
- package/src/semantic/extension.ts +2 -2
- package/src/semantic/index.ts +4 -4
- package/src/standalone/resource-host.ts +13 -13
- package/src/standalone/scoped-api.ts +2 -2
- package/src/tips/core.ts +1 -1
- package/src/tips/extension.ts +6 -6
- package/src/tips/setup-hint.ts +1 -1
- package/src/toolchain/diagnostic.ts +1 -1
- package/src/toolchain/registry.ts +1 -1
- package/dist/chunk-2AY526TN.js +0 -3
- package/dist/chunk-52PFWQMU.js +0 -5
- package/dist/chunk-57F5GTHO.js +0 -1
- package/dist/chunk-5S74Z6Y4.js +0 -7
- package/dist/chunk-7D7PXIVV.js +0 -1
- package/dist/chunk-BT2CFM7D.js +0 -11
- package/dist/chunk-C2JT2G5K.js +0 -1
- package/dist/chunk-DEWWWKUF.js +0 -6
- package/dist/chunk-FEZLTM4L.js +0 -1
- package/dist/chunk-G4PRFO6G.js +0 -1
- package/dist/chunk-H5Z54BEU.js +0 -25
- package/dist/chunk-HISGZD3C.js +0 -81
- package/dist/chunk-HRBUY2FF.js +0 -4
- package/dist/chunk-ICIRQLZ4.js +0 -23
- package/dist/chunk-LIQ4BVOB.js +0 -1
- package/dist/chunk-LXDF2NWX.js +0 -1
- package/dist/chunk-MDD5ORB6.js +0 -1
- package/dist/chunk-OJEIX7OZ.js +0 -1
- package/dist/chunk-S5PL5DFQ.js +0 -1
- package/dist/chunk-U7YDLVFL.js +0 -1
- package/dist/chunk-VDJSH3DQ.js +0 -2
- package/dist/chunk-XH5WN5XA.js +0 -2
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { spawn, type ChildProcess } from "node:child_process";
|
|
2
|
+
import { closeSync, openSync, renameSync, statSync } from "node:fs";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { lstat, mkdir } from "node:fs/promises";
|
|
5
|
+
import net from "node:net";
|
|
6
|
+
import os from "node:os";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { PassThrough, type Readable, type Writable } from "node:stream";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
|
|
11
|
+
import { SHARED_SERVER_PROTOCOL } from "./server-request-handlers.mjs";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Pi sessions on one machine share language servers through host processes.
|
|
15
|
+
*
|
|
16
|
+
* A host (shared-server-host.mjs) runs one language server for one configuration: server ID,
|
|
17
|
+
* command, configured environment, workspace root, initialization options and settings. Its
|
|
18
|
+
* socket name is a hash of that configuration in a directory only this user can access. The
|
|
19
|
+
* first session that finds no host starts one detached, so the server outlives that session.
|
|
20
|
+
*
|
|
21
|
+
* A session connects, sends one JSON line with the configuration and its initialize parameters,
|
|
22
|
+
* and receives one JSON line with the server PID once the server is initialized. After that the
|
|
23
|
+
* socket carries ordinary LSP messages. The host initializes the server once, answers server
|
|
24
|
+
* requests itself, keeps one server copy of each document open while any session has it open,
|
|
25
|
+
* gives the server the requesting session's text before each request, and reports document
|
|
26
|
+
* versions in each session's own numbering. It stops the server after its last session has been
|
|
27
|
+
* gone for the linger time.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** Stop a shared server this long after its last session disconnects, unless configured. */
|
|
31
|
+
export const DEFAULT_SHARED_SERVER_LINGER_MS = 10 * 60_000;
|
|
32
|
+
|
|
33
|
+
const HOST_SCRIPT = fileURLToPath(new URL("shared-server-host.mjs", import.meta.url));
|
|
34
|
+
const HOST_START_TIMEOUT_MS = 10_000;
|
|
35
|
+
const HOST_POLL_INTERVAL_MS = 25;
|
|
36
|
+
|
|
37
|
+
/** A language server reached through a shared host, presented like a process's stdio. */
|
|
38
|
+
export interface LspSharedServer {
|
|
39
|
+
readonly stdin: Writable;
|
|
40
|
+
readonly stdout: Readable;
|
|
41
|
+
readonly stderr: Readable;
|
|
42
|
+
/** Local PID of the shared language server process. */
|
|
43
|
+
readonly pid: number;
|
|
44
|
+
/** Settles when the session is disconnected; exit code 0 only after stop(). */
|
|
45
|
+
readonly completion: Promise<{ readonly exitCode: number | null }>;
|
|
46
|
+
stop(): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface LspSharedServerRequest {
|
|
50
|
+
readonly serverId: string;
|
|
51
|
+
readonly command: readonly string[];
|
|
52
|
+
/** Working directory of a server this request starts. */
|
|
53
|
+
readonly cwd: string;
|
|
54
|
+
/** Configured environment overrides; part of the shared server configuration. */
|
|
55
|
+
readonly configuredEnv: Readonly<Record<string, string>>;
|
|
56
|
+
/** Complete environment of a server this request starts. */
|
|
57
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
58
|
+
readonly settings?: unknown;
|
|
59
|
+
/** Initialize parameters; the root and initialization options select the shared server. */
|
|
60
|
+
readonly initialize: Readonly<Record<string, unknown>>;
|
|
61
|
+
readonly lingerMs: number;
|
|
62
|
+
readonly timeoutMs: number;
|
|
63
|
+
readonly signal?: AbortSignal;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Attach Pi sessions to shared language servers of the current user. */
|
|
67
|
+
export class LspSharedServers {
|
|
68
|
+
private readonly _directory: string;
|
|
69
|
+
|
|
70
|
+
constructor(options: { readonly directory?: string } = {}) {
|
|
71
|
+
this._directory =
|
|
72
|
+
options.directory ?? path.join(os.tmpdir(), `pi-agent-ide-lsp-${os.userInfo().uid}`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Connect to the host for this configuration, starting it when none runs. */
|
|
76
|
+
async attach(request: LspSharedServerRequest): Promise<LspSharedServer> {
|
|
77
|
+
const key = sharedServerKey(request);
|
|
78
|
+
const socketPath = await this._socketPath(key);
|
|
79
|
+
let socket = await connect(socketPath, request.signal);
|
|
80
|
+
if (!socket) {
|
|
81
|
+
const host = startHost(socketPath, key, this._directory);
|
|
82
|
+
socket = await waitForHost(socketPath, host, request.signal);
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const reply = await exchange(
|
|
86
|
+
socket,
|
|
87
|
+
{
|
|
88
|
+
protocol: SHARED_SERVER_PROTOCOL,
|
|
89
|
+
key,
|
|
90
|
+
command: request.command,
|
|
91
|
+
cwd: request.cwd,
|
|
92
|
+
env: request.env,
|
|
93
|
+
settings: request.settings,
|
|
94
|
+
initialize: request.initialize,
|
|
95
|
+
lingerMs: request.lingerMs,
|
|
96
|
+
timeoutMs: request.timeoutMs,
|
|
97
|
+
},
|
|
98
|
+
request.timeoutMs + HOST_START_TIMEOUT_MS,
|
|
99
|
+
request.signal,
|
|
100
|
+
);
|
|
101
|
+
if (typeof reply.pid !== "number")
|
|
102
|
+
throw new Error(
|
|
103
|
+
typeof reply.error === "string" ? reply.error : "Shared language server did not attach",
|
|
104
|
+
);
|
|
105
|
+
return sharedServer(socket, reply.pid);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
socket.destroy();
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private async _socketPath(key: string): Promise<string> {
|
|
113
|
+
await mkdir(this._directory, { recursive: true, mode: 0o700 });
|
|
114
|
+
if (process.platform === "win32")
|
|
115
|
+
return `\\\\.\\pipe\\pi-agent-ide-lsp-${hash(os.userInfo().username)}-${key}`;
|
|
116
|
+
const directory = await lstat(this._directory);
|
|
117
|
+
if (
|
|
118
|
+
!directory.isDirectory() ||
|
|
119
|
+
directory.uid !== os.userInfo().uid ||
|
|
120
|
+
(directory.mode & 0o077) !== 0
|
|
121
|
+
)
|
|
122
|
+
throw new Error(`Shared language server directory is not private: ${this._directory}`);
|
|
123
|
+
return path.join(this._directory, `${key}.sock`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Hash of everything that makes two sessions' servers interchangeable. */
|
|
128
|
+
function sharedServerKey(request: LspSharedServerRequest): string {
|
|
129
|
+
return hash(
|
|
130
|
+
JSON.stringify([
|
|
131
|
+
SHARED_SERVER_PROTOCOL,
|
|
132
|
+
request.serverId,
|
|
133
|
+
request.command,
|
|
134
|
+
request.configuredEnv,
|
|
135
|
+
request.initialize.rootUri,
|
|
136
|
+
request.initialize.initializationOptions ?? null,
|
|
137
|
+
request.settings ?? null,
|
|
138
|
+
]),
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function hash(value: string): string {
|
|
143
|
+
return createHash("sha256").update(value).digest("hex").slice(0, 24);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Start a detached host with the runtime that runs Pi. */
|
|
147
|
+
function startHost(socketPath: string, key: string, directory: string): ChildProcess {
|
|
148
|
+
// A single-executable Pi cannot run scripts, so its host runs on the installed Node.js.
|
|
149
|
+
const command = process.versions.bun || !singleExecutable() ? process.execPath : "node";
|
|
150
|
+
// Runtime failures such as heap exhaustion are written here; a clean stop removes the file.
|
|
151
|
+
const log = path.join(directory, `${key}.log`);
|
|
152
|
+
keepFailureLog(log);
|
|
153
|
+
const output = openSync(log, "w", 0o600);
|
|
154
|
+
try {
|
|
155
|
+
const host = spawn(command, [HOST_SCRIPT, socketPath, key, log], {
|
|
156
|
+
cwd: directory,
|
|
157
|
+
detached: true,
|
|
158
|
+
env: hostEnvironment(),
|
|
159
|
+
stdio: ["ignore", "ignore", output],
|
|
160
|
+
windowsHide: true,
|
|
161
|
+
});
|
|
162
|
+
host.unref();
|
|
163
|
+
return host;
|
|
164
|
+
} finally {
|
|
165
|
+
closeSync(output);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* A log left with content records why the previous host for this key failed. Keep it under its own
|
|
171
|
+
* name so the new host does not truncate it; the host sweep removes it after a day.
|
|
172
|
+
*/
|
|
173
|
+
function keepFailureLog(log: string): void {
|
|
174
|
+
try {
|
|
175
|
+
const { mtimeMs, size } = statSync(log);
|
|
176
|
+
if (size > 0) renameSync(log, log.replace(/\.log$/u, `.${String(Math.round(mtimeMs))}.log`));
|
|
177
|
+
} catch {
|
|
178
|
+
// No earlier log.
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The host outlives the session that starts it and runs only its own script, so it takes none
|
|
184
|
+
* of that session's variables. NODE_OPTIONS in particular could preload code, open an
|
|
185
|
+
* inspector port or change heap limits. Servers get each session's environment separately.
|
|
186
|
+
*/
|
|
187
|
+
function hostEnvironment(): Record<string, string> {
|
|
188
|
+
const environment: Record<string, string> = {};
|
|
189
|
+
for (const name of HOST_ENVIRONMENT) {
|
|
190
|
+
const value = process.env[name];
|
|
191
|
+
if (value !== undefined) environment[name] = value;
|
|
192
|
+
}
|
|
193
|
+
if (process.versions.bun) environment.BUN_BE_BUN = "1";
|
|
194
|
+
return environment;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const HOST_ENVIRONMENT = [
|
|
198
|
+
"PATH",
|
|
199
|
+
"Path",
|
|
200
|
+
"HOME",
|
|
201
|
+
"USERPROFILE",
|
|
202
|
+
"TMPDIR",
|
|
203
|
+
"TMP",
|
|
204
|
+
"TEMP",
|
|
205
|
+
"SystemRoot",
|
|
206
|
+
"LANG",
|
|
207
|
+
];
|
|
208
|
+
|
|
209
|
+
function singleExecutable(): boolean {
|
|
210
|
+
const sea = process.getBuiltinModule("node:sea") as { isSea?(): boolean } | undefined;
|
|
211
|
+
return sea?.isSea?.() ?? false;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Connect, or report that no host listens on this socket. */
|
|
215
|
+
function connect(socketPath: string, signal?: AbortSignal): Promise<net.Socket | undefined> {
|
|
216
|
+
signal?.throwIfAborted();
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
const socket = net.connect(socketPath);
|
|
219
|
+
socket.once("connect", () => {
|
|
220
|
+
socket.removeAllListeners("error");
|
|
221
|
+
socket.on("error", () => void 0);
|
|
222
|
+
resolve(socket);
|
|
223
|
+
});
|
|
224
|
+
socket.once("error", (error: NodeJS.ErrnoException) => {
|
|
225
|
+
socket.destroy();
|
|
226
|
+
if (error.code === "ENOENT" || error.code === "ECONNREFUSED") resolve(undefined);
|
|
227
|
+
else reject(error);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** Wait until the started host, or another host that won the start race, listens. */
|
|
233
|
+
async function waitForHost(
|
|
234
|
+
socketPath: string,
|
|
235
|
+
host: ChildProcess,
|
|
236
|
+
signal?: AbortSignal,
|
|
237
|
+
): Promise<net.Socket> {
|
|
238
|
+
let failure: Error | undefined;
|
|
239
|
+
host.once("error", (error) => (failure = error));
|
|
240
|
+
host.once("exit", (code) => {
|
|
241
|
+
// Exit code 0 means another host for this key already listens.
|
|
242
|
+
if (code !== 0) failure = new Error(`Shared language server host exited with code ${code}`);
|
|
243
|
+
});
|
|
244
|
+
const deadline = Date.now() + HOST_START_TIMEOUT_MS;
|
|
245
|
+
for (;;) {
|
|
246
|
+
if (failure) throw failure;
|
|
247
|
+
const socket = await connect(socketPath, signal);
|
|
248
|
+
if (socket) return socket;
|
|
249
|
+
if (Date.now() > deadline) throw new Error("Shared language server host did not start");
|
|
250
|
+
await new Promise((resolve) => setTimeout(resolve, HOST_POLL_INTERVAL_MS));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Send the attach line and read the host's reply line, leaving later bytes on the socket. */
|
|
255
|
+
function exchange(
|
|
256
|
+
socket: net.Socket,
|
|
257
|
+
request: Record<string, unknown>,
|
|
258
|
+
timeoutMs: number,
|
|
259
|
+
signal?: AbortSignal,
|
|
260
|
+
): Promise<{ pid?: unknown; error?: unknown }> {
|
|
261
|
+
return new Promise((resolve, reject) => {
|
|
262
|
+
let buffered = Buffer.alloc(0);
|
|
263
|
+
const onData = (chunk: Buffer) => {
|
|
264
|
+
buffered = Buffer.concat([buffered, chunk]);
|
|
265
|
+
const end = buffered.indexOf(10);
|
|
266
|
+
if (end === -1) return;
|
|
267
|
+
finish();
|
|
268
|
+
socket.pause();
|
|
269
|
+
if (end + 1 < buffered.length) socket.unshift(buffered.subarray(end + 1));
|
|
270
|
+
try {
|
|
271
|
+
resolve(JSON.parse(buffered.subarray(0, end).toString("utf8")) as { pid?: unknown });
|
|
272
|
+
} catch (error) {
|
|
273
|
+
reject(error);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const onClose = () => {
|
|
277
|
+
finish();
|
|
278
|
+
reject(new Error("Shared language server host closed the connection"));
|
|
279
|
+
};
|
|
280
|
+
const onAbort = () => {
|
|
281
|
+
finish();
|
|
282
|
+
reject(signal?.reason);
|
|
283
|
+
};
|
|
284
|
+
const timeout = setTimeout(() => {
|
|
285
|
+
finish();
|
|
286
|
+
reject(new Error("Shared language server attach timed out"));
|
|
287
|
+
}, timeoutMs);
|
|
288
|
+
const finish = () => {
|
|
289
|
+
clearTimeout(timeout);
|
|
290
|
+
socket.off("data", onData);
|
|
291
|
+
socket.off("close", onClose);
|
|
292
|
+
signal?.removeEventListener("abort", onAbort);
|
|
293
|
+
};
|
|
294
|
+
socket.on("data", onData);
|
|
295
|
+
socket.once("close", onClose);
|
|
296
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
297
|
+
socket.write(`${JSON.stringify(request)}\n`);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function sharedServer(socket: net.Socket, pid: number): LspSharedServer {
|
|
302
|
+
let stopped = false;
|
|
303
|
+
const closed = new Promise<void>((resolve) => socket.once("close", () => resolve()));
|
|
304
|
+
const stderr = new PassThrough();
|
|
305
|
+
stderr.end();
|
|
306
|
+
// Holds LSP bytes until the client's reader attaches; exchange() left the socket paused.
|
|
307
|
+
const stdout = socket.pipe(new PassThrough());
|
|
308
|
+
return {
|
|
309
|
+
stdin: socket,
|
|
310
|
+
stdout,
|
|
311
|
+
stderr,
|
|
312
|
+
pid,
|
|
313
|
+
completion: closed.then(() => ({ exitCode: stopped ? 0 : 1 })),
|
|
314
|
+
async stop() {
|
|
315
|
+
stopped = true;
|
|
316
|
+
socket.end();
|
|
317
|
+
const timer = setTimeout(() => socket.destroy(), 1000);
|
|
318
|
+
await closed;
|
|
319
|
+
clearTimeout(timer);
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Error code of a server answer that does not fit the file text it was compared with. */
|
|
2
|
+
export const SOURCE_CHANGED = "SOURCE_CHANGED";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Pauses before each new attempt. Another Pi process can keep writing the file, and a server
|
|
6
|
+
* index, such as clangd's for workspace symbols, catches up only after a moment.
|
|
7
|
+
*/
|
|
8
|
+
const RETRY_DELAYS_MS = [0, 100, 250, 500];
|
|
9
|
+
|
|
10
|
+
export function sourceChanged(message: string): Error {
|
|
11
|
+
return Object.assign(new Error(message), { code: SOURCE_CHANGED });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Runs `action` again while it fails because the file changed under it. */
|
|
15
|
+
export async function retryWhileSourceChanges<T>(
|
|
16
|
+
action: () => Promise<T>,
|
|
17
|
+
signal: AbortSignal | undefined,
|
|
18
|
+
): Promise<T> {
|
|
19
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
20
|
+
try {
|
|
21
|
+
return await action();
|
|
22
|
+
} catch (error) {
|
|
23
|
+
const delay = RETRY_DELAYS_MS[attempt];
|
|
24
|
+
const changed = (error as { code?: unknown } | null)?.code === SOURCE_CHANGED;
|
|
25
|
+
if (!changed || delay === undefined || signal?.aborted) throw error;
|
|
26
|
+
if (delay > 0) await new Promise((resolve) => setTimeout(resolve, delay));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { LinePositionMap } from "./position-map.ts";
|
|
3
|
+
import { retryWhileSourceChanges, sourceChanged } from "./source-changes.ts";
|
|
2
4
|
import { requiredValue } from "pi-agent-invariant";
|
|
3
5
|
import { URI } from "vscode-uri";
|
|
4
|
-
import { documentUri } from "./document-uri.
|
|
6
|
+
import { documentUri } from "./document-uri.ts";
|
|
5
7
|
import { createTextDocument } from "pi-agent-text";
|
|
6
8
|
import { verifyResultTargets, type ResolvedResultTargets } from "pi-agent-resource";
|
|
7
9
|
import {
|
|
@@ -10,14 +12,14 @@ import {
|
|
|
10
12
|
type SearchSelectionMatch,
|
|
11
13
|
} from "pi-agent-search/api/search";
|
|
12
14
|
|
|
13
|
-
import { LspManager } from "./manager.
|
|
14
|
-
import { requestReferences, type LspLocation } from "./navigation.
|
|
15
|
+
import { LspManager } from "./manager.ts";
|
|
16
|
+
import { requestReferences, type LspLocation } from "./navigation.ts";
|
|
15
17
|
import {
|
|
16
18
|
requestWorkspaceSymbols,
|
|
17
19
|
requestDocumentSymbols,
|
|
18
20
|
type LspDocumentSymbol,
|
|
19
|
-
} from "./symbols.
|
|
20
|
-
import type { LspRange } from "./types.
|
|
21
|
+
} from "./symbols.ts";
|
|
22
|
+
import type { LspRange } from "./types.ts";
|
|
21
23
|
|
|
22
24
|
/** Strict discovery scope, or an explicit seed scope for reference navigation. */
|
|
23
25
|
export interface SymbolSearchScope {
|
|
@@ -106,6 +108,12 @@ function declarationNames(
|
|
|
106
108
|
...declarationNames(symbol.children ?? [], name, range),
|
|
107
109
|
]);
|
|
108
110
|
}
|
|
111
|
+
function declarationsNamed(symbols: readonly LspDocumentSymbol[], name: string): LspRange[] {
|
|
112
|
+
return symbols.flatMap((symbol) => [
|
|
113
|
+
...(symbol.name === name && symbol.selectionRange !== undefined ? [symbol.selectionRange] : []),
|
|
114
|
+
...declarationsNamed(symbol.children ?? [], name),
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
109
117
|
/** Search workspace declarations/references, keeping real provider ranges and honest completeness. */
|
|
110
118
|
export async function searchSymbols(
|
|
111
119
|
query: string,
|
|
@@ -114,6 +122,22 @@ export async function searchSymbols(
|
|
|
114
122
|
signal?: AbortSignal,
|
|
115
123
|
scope: SymbolSearchScope = {},
|
|
116
124
|
manager = LspManager.getInstance(),
|
|
125
|
+
): Promise<{ readonly hits: SymbolHit[]; readonly complete: boolean }> {
|
|
126
|
+
// Another Pi process may edit a searched file while the server answers. Its ranges then fit
|
|
127
|
+
// neither version, so search again on the current text.
|
|
128
|
+
return retryWhileSourceChanges(
|
|
129
|
+
() => searchSymbolsOnce(query, cwd, limit, signal, scope, manager),
|
|
130
|
+
signal,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function searchSymbolsOnce(
|
|
135
|
+
query: string,
|
|
136
|
+
cwd: string,
|
|
137
|
+
limit: number,
|
|
138
|
+
signal: AbortSignal | undefined,
|
|
139
|
+
scope: SymbolSearchScope,
|
|
140
|
+
manager: LspManager,
|
|
117
141
|
): Promise<{ readonly hits: SymbolHit[]; readonly complete: boolean }> {
|
|
118
142
|
signal?.throwIfAborted();
|
|
119
143
|
const resultScope = scope.resultScope;
|
|
@@ -155,7 +179,12 @@ export async function searchSymbols(
|
|
|
155
179
|
string,
|
|
156
180
|
{ document: ReturnType<typeof createTextDocument>; version: string }
|
|
157
181
|
>();
|
|
158
|
-
|
|
182
|
+
// A server answers for the text its client synced. Another Pi process may have written the
|
|
183
|
+
// file since; ranges then move with their unchanged lines to the file text read here.
|
|
184
|
+
const toMatch = async (
|
|
185
|
+
location: LspLocation,
|
|
186
|
+
client?: { documentContent(uri: string): string | undefined },
|
|
187
|
+
): Promise<SearchSelectionMatch> => {
|
|
159
188
|
signal?.throwIfAborted();
|
|
160
189
|
const source = sourceOf(location.uri, cwd);
|
|
161
190
|
let snapshot = contents.get(source);
|
|
@@ -165,7 +194,13 @@ export async function searchSymbols(
|
|
|
165
194
|
contents.set(source, snapshot);
|
|
166
195
|
}
|
|
167
196
|
const { document } = snapshot;
|
|
168
|
-
const
|
|
197
|
+
const served = client?.documentContent(location.uri);
|
|
198
|
+
const range =
|
|
199
|
+
served === undefined || served === document.content
|
|
200
|
+
? location.range
|
|
201
|
+
: LinePositionMap.between(served, document.content).mapRange(location.range);
|
|
202
|
+
if (range === undefined) throw sourceChanged("LSP range does not match its source snapshot.");
|
|
203
|
+
const { start, end } = range;
|
|
169
204
|
const positions = [start, end];
|
|
170
205
|
for (const position of positions) {
|
|
171
206
|
const line = document.lines[position.line];
|
|
@@ -176,7 +211,7 @@ export async function searchSymbols(
|
|
|
176
211
|
position.character < 0 ||
|
|
177
212
|
position.character > line.content.length
|
|
178
213
|
)
|
|
179
|
-
throw
|
|
214
|
+
throw sourceChanged("LSP range does not match its source snapshot.");
|
|
180
215
|
}
|
|
181
216
|
const first = requiredValue(document.lines[start.line]);
|
|
182
217
|
const offset = (line: number) =>
|
|
@@ -212,21 +247,33 @@ export async function searchSymbols(
|
|
|
212
247
|
for (const definition of definitions) {
|
|
213
248
|
signal?.throwIfAborted();
|
|
214
249
|
if (!withinScope(sourceOf(definition.location.uri, cwd), cwd, {})) continue;
|
|
215
|
-
|
|
216
|
-
const
|
|
250
|
+
// The server's symbol index can lag behind edits; a stale position is looked up by name.
|
|
251
|
+
const workspaceMatch = await toMatch(definition.location, client).catch((error: unknown) => {
|
|
252
|
+
if ((error as { code?: unknown } | null)?.code === "SOURCE_CHANGED") return undefined;
|
|
253
|
+
throw error;
|
|
254
|
+
});
|
|
255
|
+
const opened = await manager.openFile(
|
|
256
|
+
sourceOf(definition.location.uri, cwd),
|
|
257
|
+
cwd,
|
|
258
|
+
"symbols",
|
|
259
|
+
signal,
|
|
260
|
+
);
|
|
217
261
|
if (opened === null)
|
|
218
262
|
throw new Error("LSP references are unavailable for a discovered declaration.");
|
|
219
263
|
let location = definition.location;
|
|
220
|
-
if (workspaceMatch
|
|
264
|
+
if (workspaceMatch?.matchedText !== definition.name) {
|
|
221
265
|
const symbols = await requestDocumentSymbols(opened.client, opened.uri, signal);
|
|
222
|
-
|
|
266
|
+
let names = declarationNames(symbols, definition.name, definition.location.range);
|
|
267
|
+
// The server's symbol index can lag behind edits, so its range may belong to an older
|
|
268
|
+
// text. A name declared once in the file still identifies the declaration.
|
|
269
|
+
if (names.length !== 1) names = declarationsNamed(symbols, definition.name);
|
|
223
270
|
if (names.length !== 1)
|
|
224
|
-
throw
|
|
271
|
+
throw sourceChanged(
|
|
225
272
|
"LSP declaration has no unique provider selectionRange; cannot search its references.",
|
|
226
273
|
);
|
|
227
274
|
location = { uri: opened.uri, range: requiredValue(names[0]) };
|
|
228
275
|
}
|
|
229
|
-
const declared = await toMatch(location);
|
|
276
|
+
const declared = await toMatch(location, opened.client);
|
|
230
277
|
const symbol: SearchSymbol = {
|
|
231
278
|
id: JSON.stringify([client.serverId, declared.source, definition.location.range]),
|
|
232
279
|
name: definition.name,
|
|
@@ -249,7 +296,7 @@ export async function searchSymbols(
|
|
|
249
296
|
const candidates: SymbolHit[] = [{ ...declared, role: "definition", symbol }];
|
|
250
297
|
for (const location of references) {
|
|
251
298
|
if (!withinScope(sourceOf(location.uri, cwd), cwd, {})) continue;
|
|
252
|
-
const reference = await toMatch(location);
|
|
299
|
+
const reference = await toMatch(location, opened.client);
|
|
253
300
|
if (
|
|
254
301
|
reference.source === declared.source &&
|
|
255
302
|
reference.lineNumber === declared.lineNumber &&
|
|
@@ -280,10 +327,22 @@ export async function searchSymbols(
|
|
|
280
327
|
}
|
|
281
328
|
}
|
|
282
329
|
signal?.throwIfAborted();
|
|
330
|
+
// Files edited during the search keep the hits whose lines are unchanged, at their new lines.
|
|
331
|
+
const moved = new Map<string, LinePositionMap>();
|
|
283
332
|
for (const [source, snapshot] of contents) {
|
|
284
333
|
const current = await manager.readSourceSnapshot(source, signal);
|
|
285
|
-
if (current.version !== snapshot.version
|
|
286
|
-
|
|
334
|
+
if (current.version !== snapshot.version && current.content !== snapshot.document.content)
|
|
335
|
+
moved.set(source, LinePositionMap.between(snapshot.document.content, current.content));
|
|
336
|
+
}
|
|
337
|
+
for (const [index, hit] of hits.entries()) {
|
|
338
|
+
const map = moved.get(hit.source);
|
|
339
|
+
if (map === undefined) continue;
|
|
340
|
+
const range = map.mapRange({
|
|
341
|
+
start: { line: hit.lineNumber - 1, character: hit.startColumn },
|
|
342
|
+
end: { line: (hit.endLineNumber ?? hit.lineNumber) - 1, character: hit.endColumn },
|
|
343
|
+
});
|
|
344
|
+
if (range === undefined) throw sourceChanged("LSP source changed during search.");
|
|
345
|
+
hits[index] = { ...hit, lineNumber: range.start.line + 1, endLineNumber: range.end.line + 1 };
|
|
287
346
|
}
|
|
288
347
|
if (resultScope !== undefined) await verifyResultTargets(resultScope, signal);
|
|
289
348
|
hits.sort(
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Language-agnostic — works with any LSP server that supports
|
|
5
5
|
* documentSymbolProvider.
|
|
6
6
|
*/
|
|
7
|
-
import type { LspClient } from "./client.
|
|
8
|
-
import type { LspManager } from "./manager.
|
|
9
|
-
import type { LspRange } from "./types.
|
|
7
|
+
import type { LspClient } from "./client.ts";
|
|
8
|
+
import type { LspManager } from "./manager.ts";
|
|
9
|
+
import type { LspRange } from "./types.ts";
|
|
10
10
|
|
|
11
11
|
// ── Types ────────────────────────────────────────────────────────────
|
|
12
12
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import { parseCodeViewReference, resolveCodeViewPath } from "pi-agent-ide/api/code-view";
|
|
3
3
|
import type { TextEditPlan, TextPreEditState } from "pi-agent-text-editor/api/edit-pipeline";
|
|
4
|
-
import type { LspManagerProvider } from "./manager-provider.
|
|
5
|
-
import { resolveLspRenameTarget } from "./lsp/code-views.
|
|
6
|
-
import {
|
|
7
|
-
import type
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
4
|
+
import type { LspManagerProvider } from "./manager-provider.ts";
|
|
5
|
+
import { resolveLspRenameTarget } from "./lsp/code-views.ts";
|
|
6
|
+
import { withLspDocuments } from "./lsp/document-leases.ts";
|
|
7
|
+
import { requestRename, type LspWorkspaceEdit } from "./lsp/rename.ts";
|
|
8
|
+
import type { LspClient } from "./lsp/client.ts";
|
|
9
|
+
import type { LspPosition } from "./lsp/types.ts";
|
|
10
|
+
import { documentUri } from "./lsp/document-uri.ts";
|
|
11
|
+
import { loadQueryProject } from "./lsp/navigation.ts";
|
|
11
12
|
|
|
12
13
|
function renameEntries(edit: LspWorkspaceEdit | null, client: LspClient) {
|
|
13
14
|
if (edit === null)
|
|
@@ -48,7 +49,14 @@ function offset(content: string, position: LspPosition): number {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/** Prepare server rename edits for the shared guarded editor, never a textual rename fallback. */
|
|
51
|
-
export
|
|
52
|
+
export function prepareSymbolRename(
|
|
53
|
+
state: TextPreEditState,
|
|
54
|
+
managerFor: LspManagerProvider,
|
|
55
|
+
): Promise<TextPreEditState | undefined> {
|
|
56
|
+
return withLspDocuments(() => prepareRename(state, managerFor));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function prepareRename(
|
|
52
60
|
state: TextPreEditState,
|
|
53
61
|
managerFor: LspManagerProvider,
|
|
54
62
|
): Promise<TextPreEditState | undefined> {
|