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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { withFileMutationQueue } from "@earendil-works/pi-coding-agent";
|
|
4
|
-
import { readExtensionSettingsScope } from "./extensions-config.
|
|
5
|
-
import type { AgentIdePreset } from "./presets.
|
|
4
|
+
import { readExtensionSettingsScope } from "./extensions-config.ts";
|
|
5
|
+
import type { AgentIdePreset } from "./presets.ts";
|
|
6
6
|
|
|
7
7
|
/** A scope override; default removes this scope's explicit choice. */
|
|
8
8
|
export type ModuleChoice = "default" | "enabled" | "disabled";
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { Input } from "@earendil-works/pi-tui";
|
|
3
|
-
import { BUILTIN_EXTENSIONS } from "./builtin-extensions.
|
|
3
|
+
import { BUILTIN_EXTENSIONS } from "./builtin-extensions.ts";
|
|
4
4
|
import {
|
|
5
5
|
configuredFeatureFlags,
|
|
6
6
|
readExtensionSettingsScope,
|
|
7
7
|
readPiAgentIdeExtensionsConfig,
|
|
8
8
|
resolvePiAgentIdeExtensionsConfigPaths,
|
|
9
9
|
type PiAgentIdeExtensionsConfig,
|
|
10
|
-
} from "./extensions-config.
|
|
11
|
-
import type { FeatureFlag } from "./feature-flags.
|
|
12
|
-
import type { AgentIdePreference } from "./preferences.
|
|
13
|
-
import { AGENT_IDE_PRESET_OPTIONS, disabledByPreset, type AgentIdePreset } from "./presets.
|
|
14
|
-
import { saveModuleChoices, type ModuleChoice } from "./module-settings-store.
|
|
15
|
-
import { createSettingsPanel } from "./settings-panel.
|
|
16
|
-
import { selectBuiltinExtensions } from "./selection.
|
|
10
|
+
} from "./extensions-config.ts";
|
|
11
|
+
import type { FeatureFlag } from "./feature-flags.ts";
|
|
12
|
+
import type { AgentIdePreference } from "./preferences.ts";
|
|
13
|
+
import { AGENT_IDE_PRESET_OPTIONS, disabledByPreset, type AgentIdePreset } from "./presets.ts";
|
|
14
|
+
import { saveModuleChoices, type ModuleChoice } from "./module-settings-store.ts";
|
|
15
|
+
import { createSettingsPanel } from "./settings-panel.ts";
|
|
16
|
+
import { selectBuiltinExtensions } from "./selection.ts";
|
|
17
17
|
import {
|
|
18
18
|
flagRequiresReload,
|
|
19
19
|
pendingReloadChanges,
|
|
20
20
|
preferenceRequiresReload,
|
|
21
|
-
} from "./reload-required.
|
|
22
|
-
import { IDE_PRESENTATION_CHANGED } from "./live-presentation.
|
|
23
|
-
import { IDE_FEATURE_FLAGS_CHANGED } from "#src/core/live-feature-flag.
|
|
21
|
+
} from "./reload-required.ts";
|
|
22
|
+
import { IDE_PRESENTATION_CHANGED } from "./live-presentation.ts";
|
|
23
|
+
import { IDE_FEATURE_FLAGS_CHANGED } from "#src/core/live-feature-flag.ts";
|
|
24
24
|
import {
|
|
25
25
|
SEMANTIC_SETTINGS_CHANGED_EVENT,
|
|
26
26
|
type SemanticSettingsChanged,
|
|
27
|
-
} from "#src/semantic/extension.
|
|
27
|
+
} from "#src/semantic/extension.ts";
|
|
28
28
|
|
|
29
29
|
/** Keep settings available even when every optional module is disabled. */
|
|
30
30
|
export function registerModuleSettings(
|
|
@@ -8,10 +8,10 @@ import { Container, Spacer, Text, type Component, type TUI } from "@earendil-wor
|
|
|
8
8
|
import {
|
|
9
9
|
NATIVE_EDIT_BATCH_EVENT,
|
|
10
10
|
type NativeEditBatchEvent,
|
|
11
|
-
} from "#src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.
|
|
12
|
-
import { compactMutationDetails } from "#src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.
|
|
11
|
+
} from "#src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts";
|
|
12
|
+
import { compactMutationDetails } from "#src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts";
|
|
13
13
|
import type { FileMutationBatchResult } from "pi-agent-text-editor/api/mutation-result";
|
|
14
|
-
import { registerIdeAliasCompatibility } from "./ide-alias-rendering.
|
|
14
|
+
import { registerIdeAliasCompatibility } from "./ide-alias-rendering.ts";
|
|
15
15
|
|
|
16
16
|
const ENTRY_TYPE = "ide-nested-results";
|
|
17
17
|
const MAX_CALLS = 256;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type * as canvas from "@napi-rs/canvas";
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_MAX_BYTES,
|
|
4
4
|
DEFAULT_MAX_LINES,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "@earendil-works/pi-coding-agent";
|
|
8
8
|
|
|
9
9
|
type Content = AgentToolResult<unknown>["content"];
|
|
10
|
+
type CanvasModule = typeof canvas;
|
|
10
11
|
|
|
11
12
|
/** Shared useful-content budgets. Notices and composition metadata are added afterward. */
|
|
12
13
|
export const IDE_OUTPUT_LIMITS = {
|
|
@@ -64,8 +65,12 @@ export async function limitIdeOutput(
|
|
|
64
65
|
const pixelShare = Math.floor(IDE_OUTPUT_LIMITS.pixels / Math.max(1, selected.length));
|
|
65
66
|
let bytes = 0;
|
|
66
67
|
let omitted = candidates.length - selected.length;
|
|
68
|
+
// The native canvas module takes noticeable time to load, so it loads with the first image.
|
|
69
|
+
let canvasModule: CanvasModule | undefined;
|
|
67
70
|
for (const [index, block] of selected.entries()) {
|
|
68
71
|
try {
|
|
72
|
+
canvasModule ??= await import("@napi-rs/canvas");
|
|
73
|
+
const { createCanvas, loadImage } = canvasModule;
|
|
69
74
|
const original = Buffer.from(block.data, "base64");
|
|
70
75
|
const decoded = await loadImage(original);
|
|
71
76
|
const scale = Math.min(1, Math.sqrt(pixelShare / (decoded.width * decoded.height)));
|
|
@@ -87,4 +87,14 @@ export const AGENT_IDE_PREFERENCES: readonly AgentIdePreference[] = [
|
|
|
87
87
|
{ value: "off", label: "Off" },
|
|
88
88
|
],
|
|
89
89
|
},
|
|
90
|
+
{
|
|
91
|
+
kind: "text",
|
|
92
|
+
id: "lsp.idle-timeout",
|
|
93
|
+
name: "Language server idle timeout",
|
|
94
|
+
description:
|
|
95
|
+
"Minutes without requests before a language server stops; the next request starts it again. Use a positive number.",
|
|
96
|
+
default: "10",
|
|
97
|
+
group: "features",
|
|
98
|
+
placeholder: "10",
|
|
99
|
+
},
|
|
90
100
|
];
|
package/src/composite/presets.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { PiAgentIdeExtensionsConfig } from "./extensions-config.
|
|
2
|
-
import { configuredFeatureFlags } from "./extensions-config.
|
|
3
|
-
import type { FeatureFlag } from "./feature-flags.
|
|
4
|
-
import type { AgentIdePreference } from "./preferences.
|
|
5
|
-
import { disabledByPreset } from "./presets.
|
|
6
|
-
import { selectBuiltinExtensions, type BuiltinExtension } from "./selection.
|
|
1
|
+
import type { PiAgentIdeExtensionsConfig } from "./extensions-config.ts";
|
|
2
|
+
import { configuredFeatureFlags } from "./extensions-config.ts";
|
|
3
|
+
import type { FeatureFlag } from "./feature-flags.ts";
|
|
4
|
+
import type { AgentIdePreference } from "./preferences.ts";
|
|
5
|
+
import { disabledByPreset } from "./presets.ts";
|
|
6
|
+
import { selectBuiltinExtensions, type BuiltinExtension } from "./selection.ts";
|
|
7
7
|
|
|
8
8
|
// These settings are consumed dynamically. Unknown extension settings are conservative:
|
|
9
9
|
// their owner may have read the value only during registration.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AgentDocumentation } from "#src/api/documentation.
|
|
2
|
-
import { BUILTIN_EXTENSIONS } from "./builtin-extensions.
|
|
3
|
-
import type { FeatureFlag } from "./feature-flags.
|
|
4
|
-
import { AGENT_IDE_PREFERENCES, type AgentIdePreference } from "./preferences.
|
|
5
|
-
import { AGENT_IDE_PRESET_OPTIONS } from "./presets.
|
|
1
|
+
import type { AgentDocumentation } from "#src/api/documentation.ts";
|
|
2
|
+
import { BUILTIN_EXTENSIONS } from "./builtin-extensions.ts";
|
|
3
|
+
import type { FeatureFlag } from "./feature-flags.ts";
|
|
4
|
+
import { AGENT_IDE_PREFERENCES, type AgentIdePreference } from "./preferences.ts";
|
|
5
|
+
import { AGENT_IDE_PRESET_OPTIONS } from "./presets.ts";
|
|
6
6
|
|
|
7
7
|
/** Build an explicit, read-only guide from the same descriptors as the settings menu. */
|
|
8
8
|
export function createIdeSettingsDocumentation(
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
type AgentIdeSettingValue,
|
|
9
9
|
type SettingsReadRequest,
|
|
10
10
|
type SettingsRegistration,
|
|
11
|
-
} from "#src/api/settings.
|
|
11
|
+
} from "#src/api/settings.ts";
|
|
12
12
|
import {
|
|
13
13
|
configuredFeatureFlags,
|
|
14
14
|
readExtensionSettingsScope,
|
|
15
15
|
resolvePiAgentIdeExtensionsConfigPaths,
|
|
16
|
-
} from "./extensions-config.
|
|
17
|
-
import type { FeatureFlag } from "./feature-flags.
|
|
18
|
-
import type { AgentIdePreference } from "./preferences.
|
|
16
|
+
} from "./extensions-config.ts";
|
|
17
|
+
import type { FeatureFlag } from "./feature-flags.ts";
|
|
18
|
+
import type { AgentIdePreference } from "./preferences.ts";
|
|
19
19
|
|
|
20
20
|
/** One host-owned registry supplies the menu, catalog and effective settings reads. */
|
|
21
21
|
export function createAgentIdeSettingsRegistry(
|
|
@@ -19,8 +19,8 @@ import { Type } from "typebox";
|
|
|
19
19
|
import { Value } from "typebox/value";
|
|
20
20
|
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
21
21
|
import { READ_PROTOCOL, READ_API_VERSION } from "pi-agent-read/api/plugin-protocol";
|
|
22
|
-
import { limitIdeOutput } from "./output-limits.
|
|
23
|
-
import { searchFacts, searchFactsSchema } from "./search-facts.
|
|
22
|
+
import { limitIdeOutput } from "./output-limits.ts";
|
|
23
|
+
import { searchFacts, searchFactsSchema } from "./search-facts.ts";
|
|
24
24
|
|
|
25
25
|
/** Tools whose Codemode value is `{ result, hasMatches, complete }`. */
|
|
26
26
|
const searchTools = new Set(["search", "ast_search", "lsp_search", "file_search"]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { requiredValue } from "pi-agent-invariant";
|
|
2
2
|
import type { ExtensionAPI, Theme } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { Text, type Component } from "@earendil-works/pi-tui";
|
|
4
|
-
import type { IdeDiagnosticResult } from "#src/api/plugin-protocol.
|
|
5
|
-
import type { DiagnosticNotification } from "#src/core/diagnostic-store.
|
|
4
|
+
import type { IdeDiagnosticResult } from "#src/api/plugin-protocol.ts";
|
|
5
|
+
import type { DiagnosticNotification } from "#src/core/diagnostic-store.ts";
|
|
6
6
|
|
|
7
7
|
export const DIAGNOSTIC_ENTRY_TYPE = "ide-diagnostic-summary";
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { resolveCodeViewPath } from "#src/code-view/reference.
|
|
3
|
+
import { resolveCodeViewPath } from "#src/code-view/reference.ts";
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
IdeDiagnosticReport,
|
|
@@ -9,8 +9,8 @@ import type {
|
|
|
9
9
|
IdeDiagnosticSnapshot,
|
|
10
10
|
IdeDiagnosticSource,
|
|
11
11
|
IdeDiagnosticFileReader,
|
|
12
|
-
} from "#src/api/plugin-protocol.
|
|
13
|
-
import type { ToolContext } from "#src/toolchain/types.
|
|
12
|
+
} from "#src/api/plugin-protocol.ts";
|
|
13
|
+
import type { ToolContext } from "#src/toolchain/types.ts";
|
|
14
14
|
|
|
15
15
|
/** Nonempty findings shared by hidden model delivery and a separate UI summary. */
|
|
16
16
|
export interface DiagnosticNotification {
|
package/src/core/extension.ts
CHANGED
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
IDE_PLUGIN_REGISTER_EVENT,
|
|
5
5
|
IDE_PROTOCOL,
|
|
6
6
|
isIdePluginRegistrationRequest,
|
|
7
|
-
} from "#src/api/plugin-protocol.
|
|
8
|
-
import { createIdeCore } from "#src/core/ide-core.
|
|
9
|
-
import { createLiveFeatureFlag } from "#src/core/live-feature-flag.
|
|
10
|
-
import { createDiagnosticDelivery } from "#src/core/diagnostic-delivery.
|
|
7
|
+
} from "#src/api/plugin-protocol.ts";
|
|
8
|
+
import { createIdeCore } from "#src/core/ide-core.ts";
|
|
9
|
+
import { createLiveFeatureFlag } from "#src/core/live-feature-flag.ts";
|
|
10
|
+
import { createDiagnosticDelivery } from "#src/core/diagnostic-delivery.ts";
|
|
11
11
|
import {
|
|
12
12
|
diagnosticEntryGroups,
|
|
13
13
|
DIAGNOSTIC_ENTRY_TYPE,
|
|
14
14
|
registerDiagnosticEntryRenderer,
|
|
15
|
-
} from "#src/core/diagnostic-entry.
|
|
16
|
-
import { runIdePostEditGate } from "#src/post-edit/gate.
|
|
17
|
-
import { resetRegistry } from "#src/toolchain/registry.
|
|
18
|
-
import registerCodeReview from "#src/code-review/extension.
|
|
15
|
+
} from "#src/core/diagnostic-entry.ts";
|
|
16
|
+
import { runIdePostEditGate } from "#src/post-edit/gate.ts";
|
|
17
|
+
import { resetRegistry } from "#src/toolchain/registry.ts";
|
|
18
|
+
import registerCodeReview from "#src/code-review/extension.ts";
|
|
19
19
|
import {
|
|
20
20
|
connectTextEditorPostEditHandler,
|
|
21
21
|
afterPostEditScope,
|
package/src/core/ide-core.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { registerTools } from "#src/toolchain/registry.
|
|
1
|
+
import { registerTools } from "#src/toolchain/registry.ts";
|
|
2
2
|
|
|
3
|
-
import { DiagnosticStore } from "#src/core/diagnostic-store.
|
|
3
|
+
import { DiagnosticStore } from "#src/core/diagnostic-store.ts";
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
IdeDiagnosticSource,
|
|
7
7
|
IdeDiagnosticFileReader,
|
|
8
8
|
IdePlugin,
|
|
9
9
|
IdePluginApi,
|
|
10
|
-
} from "#src/api/plugin-protocol.
|
|
11
|
-
import type { IdeTool } from "#src/toolchain/types.
|
|
10
|
+
} from "#src/api/plugin-protocol.ts";
|
|
11
|
+
import type { IdeTool } from "#src/toolchain/types.ts";
|
|
12
12
|
|
|
13
13
|
export interface IdeCore {
|
|
14
14
|
readonly diagnostics: DiagnosticStore;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { requiredValue } from "pi-agent-invariant";
|
|
2
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
|
|
4
|
-
import { projectIdeConfigDirectory, projectIdeConfigPath } from "#src/api/tool-config.
|
|
5
|
-
import type { DoctorWorkspace } from "#src/api/doctor.
|
|
4
|
+
import { projectIdeConfigDirectory, projectIdeConfigPath } from "#src/api/tool-config.ts";
|
|
5
|
+
import type { DoctorWorkspace } from "#src/api/doctor.ts";
|
|
6
6
|
|
|
7
|
-
import type { RecipeCandidate } from "./discovery.
|
|
7
|
+
import type { RecipeCandidate } from "./discovery.ts";
|
|
8
8
|
|
|
9
9
|
type ConfigAccess = Pick<DoctorWorkspace, "source" | "configPaths" | "readText" | "writeText">;
|
|
10
10
|
|
package/src/doctor/core.ts
CHANGED
|
@@ -7,8 +7,8 @@ import type {
|
|
|
7
7
|
DoctorSetupAction,
|
|
8
8
|
DoctorSetupCheck,
|
|
9
9
|
DoctorToolSelection,
|
|
10
|
-
} from "#src/api/doctor.
|
|
11
|
-
import type { LanguageDefinition, ToolRecipe } from "#src/api/tool-catalog.
|
|
10
|
+
} from "#src/api/doctor.ts";
|
|
11
|
+
import type { LanguageDefinition, ToolRecipe } from "#src/api/tool-catalog.ts";
|
|
12
12
|
|
|
13
13
|
export interface OwnedContribution<T> {
|
|
14
14
|
readonly pluginId: string;
|
package/src/doctor/discovery.ts
CHANGED
|
@@ -4,10 +4,10 @@ import { inspectRecipeEvidence } from "pi-agent-doctor/api/evidence";
|
|
|
4
4
|
|
|
5
5
|
import { isExecutableAvailable } from "pi-agent-doctor/api/executable";
|
|
6
6
|
|
|
7
|
-
import { projectIdeConfigPath } from "#src/api/tool-config.
|
|
8
|
-
import type { DoctorToolSelection, DoctorWorkspace } from "#src/api/doctor.
|
|
9
|
-
import type { ToolRecipe } from "#src/api/tool-catalog.
|
|
10
|
-
import type { OwnedContribution } from "./core.
|
|
7
|
+
import { projectIdeConfigPath } from "#src/api/tool-config.ts";
|
|
8
|
+
import type { DoctorToolSelection, DoctorWorkspace } from "#src/api/doctor.ts";
|
|
9
|
+
import type { ToolRecipe } from "#src/api/tool-catalog.ts";
|
|
10
|
+
import type { OwnedContribution } from "./core.ts";
|
|
11
11
|
|
|
12
12
|
export interface RecipeCandidate {
|
|
13
13
|
readonly pluginId: string;
|
package/src/doctor/extension.ts
CHANGED
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
DOCTOR_PLUGIN_REGISTER_EVENT,
|
|
5
5
|
DOCTOR_PROTOCOL,
|
|
6
6
|
isDoctorPluginRegistrationRequest,
|
|
7
|
-
} from "#src/api/doctor.
|
|
7
|
+
} from "#src/api/doctor.ts";
|
|
8
8
|
|
|
9
|
-
import { writeSuggestedConfigs } from "./config-writer.
|
|
10
|
-
import { parseDoctorArguments } from "./arguments.
|
|
11
|
-
import type { DoctorWorkspace } from "#src/api/doctor.
|
|
12
|
-
import { DoctorCore } from "./core.
|
|
9
|
+
import { writeSuggestedConfigs } from "./config-writer.ts";
|
|
10
|
+
import { parseDoctorArguments } from "./arguments.ts";
|
|
11
|
+
import type { DoctorWorkspace } from "#src/api/doctor.ts";
|
|
12
|
+
import { DoctorCore } from "./core.ts";
|
|
13
13
|
import {
|
|
14
14
|
buildDoctorAgentPrompt,
|
|
15
15
|
doctorNeedsWork,
|
|
16
16
|
formatDoctorReport,
|
|
17
17
|
inspectDoctorSetup,
|
|
18
18
|
runDoctor,
|
|
19
|
-
} from "./run.
|
|
20
|
-
import { registerDoctorTipProvider } from "./tip-provider.
|
|
19
|
+
} from "./run.ts";
|
|
20
|
+
import { registerDoctorTipProvider } from "./tip-provider.ts";
|
|
21
21
|
|
|
22
22
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
23
23
|
|
package/src/doctor/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./extension.
|
|
1
|
+
export { default } from "./extension.ts";
|
package/src/doctor/inventory.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { readdir } from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { promisify } from "node:util";
|
|
5
5
|
|
|
6
|
-
import type { LanguageDefinition } from "#src/api/tool-catalog.
|
|
6
|
+
import type { LanguageDefinition } from "#src/api/tool-catalog.ts";
|
|
7
7
|
|
|
8
8
|
const execFileAsync = promisify(execFile);
|
|
9
9
|
const skippedDirectories = new Set([
|
package/src/doctor/run.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
|
|
3
|
-
import { runContributedChecks, runContributedSetupChecks } from "./core.
|
|
4
|
-
import { discoverRecipeCandidates, selectSuggestedRecipes } from "./discovery.
|
|
5
|
-
import { collectProjectFiles, detectProjectLanguages } from "./inventory.
|
|
3
|
+
import { runContributedChecks, runContributedSetupChecks } from "./core.ts";
|
|
4
|
+
import { discoverRecipeCandidates, selectSuggestedRecipes } from "./discovery.ts";
|
|
5
|
+
import { collectProjectFiles, detectProjectLanguages } from "./inventory.ts";
|
|
6
6
|
|
|
7
7
|
import type {
|
|
8
8
|
DoctorFinding,
|
|
9
9
|
DoctorSetupAction,
|
|
10
10
|
DoctorToolSelection,
|
|
11
11
|
DoctorWorkspace,
|
|
12
|
-
} from "#src/api/doctor.
|
|
13
|
-
import type { DoctorSnapshot } from "./core.
|
|
14
|
-
import type { RecipeCandidate } from "./discovery.
|
|
12
|
+
} from "#src/api/doctor.ts";
|
|
13
|
+
import type { DoctorSnapshot } from "./core.ts";
|
|
14
|
+
import type { RecipeCandidate } from "./discovery.ts";
|
|
15
15
|
|
|
16
16
|
function assertWorkspace(cwd: string, workspace?: DoctorWorkspace): void {
|
|
17
17
|
if ((cwd.includes("://") && !workspace) || (workspace && workspace.source !== cwd))
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
TIP_PROTOCOL,
|
|
7
7
|
type TipContext,
|
|
8
8
|
type TipProvider,
|
|
9
|
-
} from "#src/api/tips.
|
|
9
|
+
} from "#src/api/tips.ts";
|
|
10
10
|
|
|
11
|
-
import type { DoctorSetupRun } from "./run.
|
|
11
|
+
import type { DoctorSetupRun } from "./run.ts";
|
|
12
12
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
13
13
|
|
|
14
14
|
const DOCTOR_TIP_PROVIDER_ID = "doctor";
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
DOCUMENTATION_READY_EVENT,
|
|
8
8
|
DOCUMENTATION_REGISTER_EVENT,
|
|
9
9
|
type AgentDocumentation,
|
|
10
|
-
} from "#src/api/documentation.
|
|
11
|
-
import { AgentDocumentationRegistry } from "#src/documentation/registry.
|
|
10
|
+
} from "#src/api/documentation.ts";
|
|
11
|
+
import { AgentDocumentationRegistry } from "#src/documentation/registry.ts";
|
|
12
12
|
import { connectSearchPlugin } from "pi-agent-search/api/connect-plugin";
|
|
13
13
|
import { SEARCH_API_VERSION, SEARCH_PROTOCOL } from "pi-agent-search/api/plugin-protocol";
|
|
14
|
-
import { createDocumentationSearchResolver } from "#src/documentation/search.
|
|
14
|
+
import { createDocumentationSearchResolver } from "#src/documentation/search.ts";
|
|
15
15
|
|
|
16
16
|
interface RegistrationRequest {
|
|
17
17
|
readonly documents: readonly AgentDocumentation[];
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type SearchResolver,
|
|
6
6
|
type SearchSelectionMatch,
|
|
7
7
|
} from "pi-agent-search/api/search";
|
|
8
|
-
import type { AgentDocumentationRegistry } from "#src/documentation/registry.
|
|
8
|
+
import type { AgentDocumentationRegistry } from "#src/documentation/registry.ts";
|
|
9
9
|
|
|
10
10
|
interface DocumentationSearchResult {
|
|
11
11
|
readonly source: string;
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
type TextEditorPlugin,
|
|
15
15
|
} from "pi-agent-text-editor/api/plugin-protocol";
|
|
16
16
|
|
|
17
|
-
import { createFilesystemReadResolver, createFilesystemWriteResolver } from "#src/resolver.
|
|
18
|
-
import { recoverFilesystemPath } from "#src/path-recovery.
|
|
17
|
+
import { createFilesystemReadResolver, createFilesystemWriteResolver } from "#src/resolver.ts";
|
|
18
|
+
import { recoverFilesystemPath } from "#src/path-recovery.ts";
|
|
19
19
|
|
|
20
20
|
const readTarget = { provider: "filesystem", capability: "read" } satisfies ContentTarget;
|
|
21
21
|
const writeTarget = { provider: "filesystem", capability: "write" } satisfies ContentTarget;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.9.
|
|
10
|
-
"pi-agent-invariant": "0.9.
|
|
11
|
-
"pi-agent-read": "0.9.
|
|
12
|
-
"pi-agent-resource": "0.9.
|
|
13
|
-
"pi-agent-text": "0.9.
|
|
14
|
-
"pi-agent-text-editor": "0.9.
|
|
9
|
+
"pi-agent-image": "0.9.6",
|
|
10
|
+
"pi-agent-invariant": "0.9.6",
|
|
11
|
+
"pi-agent-read": "0.9.6",
|
|
12
|
+
"pi-agent-resource": "0.9.6",
|
|
13
|
+
"pi-agent-text": "0.9.6",
|
|
14
|
+
"pi-agent-text-editor": "0.9.6"
|
|
15
15
|
},
|
|
16
16
|
"pi": {
|
|
17
17
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.9.
|
|
10
|
-
"pi-agent-resource": "0.9.
|
|
9
|
+
"pi-agent-image": "0.9.6",
|
|
10
|
+
"pi-agent-resource": "0.9.6"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
READ_PROTOCOL,
|
|
13
13
|
type ReadPlugin,
|
|
14
14
|
} from "pi-agent-read/api/plugin-protocol";
|
|
15
|
-
import { createJqReadHandler } from "#src/api/jq.
|
|
15
|
+
import { createJqReadHandler } from "#src/api/jq.ts";
|
|
16
16
|
|
|
17
17
|
export default async function registerFilesystemJq(pi: ExtensionAPI): Promise<void> {
|
|
18
18
|
await Promise.all([connectReadPlugin(pi, readPlugin), connectDoctorPlugin(pi, doctorPlugin)]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-jq",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"pi-agent-doctor": "0.9.
|
|
16
|
-
"pi-agent-documentation": "0.9.
|
|
17
|
-
"pi-agent-read": "0.9.
|
|
18
|
-
"pi-agent-text": "0.9.
|
|
15
|
+
"pi-agent-doctor": "0.9.6",
|
|
16
|
+
"pi-agent-documentation": "0.9.6",
|
|
17
|
+
"pi-agent-read": "0.9.6",
|
|
18
|
+
"pi-agent-text": "0.9.6"
|
|
19
19
|
},
|
|
20
20
|
"pi": {
|
|
21
21
|
"extensions": [
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from "pi-agent-read/api/tools/read";
|
|
8
8
|
import { createTextDocument } from "pi-agent-text";
|
|
9
9
|
|
|
10
|
-
import { executeJq, parseJqView } from "#src/jq.
|
|
10
|
+
import { executeJq, parseJqView } from "#src/jq.ts";
|
|
11
11
|
|
|
12
12
|
export interface JqReadHandlerOptions {
|
|
13
13
|
readonly pluginId: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.9.
|
|
7
|
-
"pi-agent-resource": "0.9.
|
|
6
|
+
"pi-agent-pdf": "0.9.6",
|
|
7
|
+
"pi-agent-resource": "0.9.6"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.9.
|
|
10
|
-
"pi-agent-text": "0.9.
|
|
9
|
+
"pi-agent-resource": "0.9.6",
|
|
10
|
+
"pi-agent-text": "0.9.6"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdir, rm, stat } from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
/** A lock older than this belongs to a process that died while holding it. */
|
|
7
|
+
const STALE_LOCK_MS = 10_000;
|
|
8
|
+
const WAIT_TIMEOUT_MS = 30_000;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Runs `action` while no other Pi process on this machine reads or writes the same file through
|
|
12
|
+
* Pi Agent IDE. The lock is a directory in the temporary folder, so it leaves nothing in the
|
|
13
|
+
* project. When that folder is not writable, `action` runs without the lock, as it would
|
|
14
|
+
* without this guard.
|
|
15
|
+
*/
|
|
16
|
+
export async function withFileWriteLock<T>(
|
|
17
|
+
filePath: string,
|
|
18
|
+
signal: AbortSignal | undefined,
|
|
19
|
+
action: () => Promise<T>,
|
|
20
|
+
): Promise<T> {
|
|
21
|
+
const directory = path.join(
|
|
22
|
+
os.tmpdir(),
|
|
23
|
+
`pi-agent-ide-write-locks${process.getuid ? `-${String(process.getuid())}` : ""}`,
|
|
24
|
+
);
|
|
25
|
+
const lock = path.join(
|
|
26
|
+
directory,
|
|
27
|
+
createHash("sha256").update(path.resolve(filePath)).digest("hex").slice(0, 32),
|
|
28
|
+
);
|
|
29
|
+
if (!(await acquire(directory, lock, filePath, signal))) return action();
|
|
30
|
+
try {
|
|
31
|
+
return await action();
|
|
32
|
+
} finally {
|
|
33
|
+
await rm(lock, { recursive: true, force: true });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Waits for the lock; false when the lock folder cannot be created. */
|
|
38
|
+
async function acquire(
|
|
39
|
+
directory: string,
|
|
40
|
+
lock: string,
|
|
41
|
+
filePath: string,
|
|
42
|
+
signal: AbortSignal | undefined,
|
|
43
|
+
): Promise<boolean> {
|
|
44
|
+
try {
|
|
45
|
+
await mkdir(directory, { recursive: true });
|
|
46
|
+
} catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const started = Date.now();
|
|
50
|
+
for (;;) {
|
|
51
|
+
signal?.throwIfAborted();
|
|
52
|
+
try {
|
|
53
|
+
await mkdir(lock);
|
|
54
|
+
return true;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if ((error as NodeJS.ErrnoException).code !== "EEXIST") return false;
|
|
57
|
+
}
|
|
58
|
+
const changed = await stat(lock).then(
|
|
59
|
+
(stats) => stats.mtimeMs,
|
|
60
|
+
() => undefined,
|
|
61
|
+
);
|
|
62
|
+
if (changed !== undefined && Date.now() - changed > STALE_LOCK_MS) {
|
|
63
|
+
await rm(lock, { recursive: true, force: true });
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (Date.now() - started > WAIT_TIMEOUT_MS)
|
|
67
|
+
throw new Error(`Timed out waiting for another Pi process to finish with ${filePath}`);
|
|
68
|
+
await new Promise((resolve) => setTimeout(resolve, 5 + Math.random() * 20));
|
|
69
|
+
}
|
|
70
|
+
}
|