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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.6 — 2026-11-08
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Pi starts faster with pi-agent-ide installed: the image processing module loads on first use instead of at startup.
|
|
8
|
+
- Pi loads pi-agent-ide from a local checkout about four times faster.
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Renames and other edits from a language server shared by several Pi sessions are no longer rejected as stale when another session's text reaches the server during the request.
|
|
13
|
+
|
|
14
|
+
## 0.9.5 — 2026-11-08
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Pi sessions on one machine share a local language server with the same configuration.
|
|
19
|
+
- Language servers stop after 10 idle minutes. New setting `lsp.idle-timeout` sets the delay.
|
|
20
|
+
- Python falls back to `pyright` when `basedpyright` is not installed.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Several Pi sessions can edit the same file at once without losing edits.
|
|
25
|
+
- Edits replace files in one step, so other programs never read a half-written file.
|
|
26
|
+
- `symbol:` targets, `lsp_search` and `ast_search` work on files that other sessions edit at the same time.
|
|
27
|
+
- Language servers watch only files inside the project.
|
|
28
|
+
- Reading and editing large files uses less memory and CPU.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- pyright and basedpyright no longer report a file with errors as clean.
|
|
33
|
+
- rust-analyzer no longer returns missing symbols or diagnostics while the project loads, and no longer exits on saves during startup.
|
|
34
|
+
- Requests cancelled by a language server because the file changed are sent again.
|
|
35
|
+
- `lsp_search` with `calls` no longer fails when the server supports only one call direction.
|
|
36
|
+
- A language server that exits during startup is reported at once with its error.
|
|
37
|
+
- Clippy findings are reported when Cargo stops on a compile error.
|
|
38
|
+
- Cancelled or timed-out lint and format commands stop all processes they started.
|
|
39
|
+
- Pi's memory no longer grows with every edit of a large file.
|
|
40
|
+
|
|
3
41
|
## 0.9.4 — 2026-11-03
|
|
4
42
|
|
|
5
43
|
### Fixed
|
package/README.md
CHANGED
|
@@ -204,7 +204,7 @@ Pi Agent IDE is experimental and under active development. Interfaces and behavi
|
|
|
204
204
|
|
|
205
205
|
## Installation
|
|
206
206
|
|
|
207
|
-
Install [Pi](https://pi.dev/) **0.99.1 or newer** first, then install Pi Agent IDE from npm. Development and integration tests use Pi 1.
|
|
207
|
+
Install [Pi](https://pi.dev/) **0.99.1 or newer** first, then install Pi Agent IDE from npm. Development and integration tests use Pi 1.5.0. Older hosts are rejected with an upgrade message.
|
|
208
208
|
|
|
209
209
|
```bash
|
|
210
210
|
pi install npm:pi-agent-ide
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-PPCWY4BB.js";import{g as o}from"./chunk-KJAR2WDO.js";import{a as m}from"./chunk-EI7MMDWY.js";async function w(i,n,e,t,s){return d(i,n,e,t,{...s,effect:"not-applied"})}m(w,"readOwnedSshCommand");import{readFile as u}from"node:fs/promises";import{Type as p}from"typebox";import{Value as f}from"typebox/value";var S=p.Object({html:p.String(),source:p.String()}),c=new Set(["CAPABILITY_UNAVAILABLE","INVALID_SOURCE","BYTE_LIMIT","TIMEOUT","HTTP_FAILED","BROWSER_FAILED","CANCELLED"]),l;async function B(i,n,e,t){let s=await h(i,n,e,t,"html");if(!f.Check(S,s)||Buffer.byteLength(s.html,"utf8")>16*1024*1024)throw new o("INVALID_RESPONSE",e,"not-applied");let r=new URL(s.source);if(!["http:","https:"].includes(r.protocol)||r.username||r.password)throw new o("INVALID_RESPONSE",e,"not-applied");return s}m(B,"readSshBrowserPage");async function N(i,n,e){let t=await h(i,new URL("about:blank"),n,{signal:e,timeoutMs:3e4},"probe");if(!f.Check(p.Object({ready:p.Literal(!0)}),t))throw new o("INVALID_RESPONSE",n,"not-applied")}m(N,"probeSshBrowser");async function h(i,n,e,t,s){t.signal?.throwIfAborted(),l??=u(new URL("./web-browser-worker.mjs",new URL("../src/backend/web-browser.ts",import.meta.url).href),"utf8");try{let r=await w(i,"node",["--input-type=module","-e",await l,JSON.stringify({kind:s,url:n.href,timeoutMs:t.timeoutMs})],e,{signal:t.signal,timeoutMs:t.timeoutMs,maxBytes:33554432});if(r.exitCode!==0)throw new o("BROWSER_FAILED",e,"not-applied");let a;try{a=JSON.parse(r.stdout.toString("utf8"))}catch{throw new o("INVALID_RESPONSE",e,"not-applied")}if(typeof a=="object"&&a!==null&&"error"in a)throw new o(typeof a.error=="string"&&c.has(a.error)?a.error:"INVALID_RESPONSE",e,"not-applied");return a}catch(r){throw r instanceof o?new o(r.code==="ENOENT"?"CAPABILITY_UNAVAILABLE":r.code,e,r.effect):r}}m(h,"runBrowser");export{w as a,B as b,N as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,d as u,e as c}from"./chunk-
|
|
1
|
+
import{c as a,d as u,e as c}from"./chunk-H6FEBUAP.js";import{a as t}from"./chunk-EI7MMDWY.js";function E(o,r){let s=t(()=>{let e,i={plugin:r,accept(R){if(e!==void 0)throw new Error(`Plugin ${r.id} registration was accepted more than once`);e=R}};return o.events.emit(u,i),e},"announce"),n=t(()=>{},"unsubscribe");n=o.events.on(a,e=>{if(!c(e))throw new Error("Invalid pi-agent-read core readiness event");let i=s();if(i===void 0)throw new Error("pi-agent-read core announced readiness without accepting the plugin");n(),i.catch(()=>{})}),o.on("session_shutdown",n);let d=s();if(d!==void 0)return n(),d}t(E,"connectReadPlugin");export{E as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d,e as u,f as a}from"./chunk-MLFJU2US.js";import{a as n}from"./chunk-EI7MMDWY.js";function E(r,i){let s=n(()=>{let o,t={plugin:i,accept(f){if(o!==void 0)throw new Error(`Doctor plugin ${i.id} was accepted more than once`);o=f}};return r.events.emit(u,t),o},"announce"),e=n(()=>{},"unsubscribe");e=r.events.on(d,o=>{if(!a(o))throw new Error("Invalid doctor core readiness event");let t=s();if(t===void 0)throw new Error("Doctor core did not accept the plugin");e(),t.catch(()=>{})}),r.on("session_shutdown",e);let c=s();if(c!==void 0)return e(),c}n(E,"connectDoctorPlugin");export{E as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as C}from"./chunk-
|
|
1
|
+
import{b as C}from"./chunk-N2NEFXHB.js";import{a as b}from"./chunk-ZC65Z3CK.js";import{a as m}from"./chunk-EI7MMDWY.js";import{diffChars as j}from"diff";import{DefaultLinesDiffComputer as J}from"vscode-diff";var N=2,P=.5,S=100,Q=16e3,H=1e6,Z=new J,ee=new Set(["async","boolean","const","export","false","function","interface","let","new","null","number","private","protected","public","readonly","return","static","string","true","type","undefined","var"]);function E(e,n,t=[],r={}){let o=ne(e,n,(r.beforeLineOffset??0)+1,(r.afterLineOffset??0)+1);if(o===void 0)return{rows:[],added:0,modified:0,removed:0,focusRow:0,omittedChanges:{outside:0,ambiguous:0,unavailable:!0}};let i=r.project===!1?o:oe(o),f=r.focusAfterLine??(t.length===0?void 0:fe(n,b(t.at(-1)).to)+(r.afterLineOffset??0));return{rows:i,added:o.filter(({kind:d})=>d==="added").length,modified:o.filter(({kind:d})=>d==="modified").length,removed:o.filter(({kind:d})=>d==="removed").length,focusRow:se(i,f)}}m(E,"createDiffModel");function ne(e,n,t=1,r=1){if(e.length+n.length>H)return;let o=performance.now()+S,i=W(e),f=W(n),d=[];if(i.length===0||f.length===0)return[...i.map((u,y)=>({kind:"removed",text:u,beforeLine:t+y,changed:!0})),...f.map((u,y)=>({kind:"added",text:u,afterLine:r+y,changed:!0}))];let a=new Set(i.map(u=>u.trim())),c=f.some(u=>a.has(u.trim()))?Z.computeDiff([...i],[...f],{ignoreTrimWhitespace:!0,computeMoves:!1,maxComputationTimeMs:S}):{hitTimeout:!1,changes:[{original:{startLineNumber:1,endLineNumberExclusive:i.length+1},modified:{startLineNumber:1,endLineNumberExclusive:f.length+1}}]};if(c.hitTimeout||performance.now()>=o)return;let g=0,s=0,h=m(u=>{for(;s<u;)d.push({kind:"context",text:b(f[s]),beforeLine:t+g++,afterLine:r+s++,changed:!1})},"appendContext");for(let u of c.changes){h(u.modified.startLineNumber-1);let y=i.slice(u.original.startLineNumber-1,u.original.endLineNumberExclusive-1).map((x,R)=>({text:x,line:t+g+R})),w=f.slice(u.modified.startLineNumber-1,u.modified.endLineNumberExclusive-1).map((x,R)=>({text:x,line:r+s+R})),D=te(y,w,o);d.push(...D??[...y.map(({text:x,line:R})=>({kind:"removed",text:x,beforeLine:R,changed:!0})),...w.map(({text:x,line:R})=>({kind:"added",text:x,afterLine:R,changed:!0}))]),g+=y.length,s+=w.length}if(h(f.length),e.endsWith(`
|
|
2
2
|
`)!==n.endsWith(`
|
|
3
3
|
`)){let u=d.at(-1);u?.kind==="context"&&(d[d.length-1]={...u,kind:"modified",changed:!0,addedRanges:[],deletedOffsets:e.endsWith(`
|
|
4
4
|
`)?[u.text.length]:[]})}return d}m(ne,"createSemanticRows");function T(e,n,t){let r=e[n]?.[t];if(r===void 0)throw new RangeError(`Score [${n}, ${t}] is outside the alignment matrix.`);return r}m(T,"scoreAt");function te(e,n,t){let r=new Map,o=m((c,g)=>{if(performance.now()>=t)return;let s=r.get(c)?.get(g);if(s!==void 0)return s;let h=ie(c,g,t);if(h!==void 0){let u=r.get(c);u===void 0&&(u=new Map,r.set(c,u)),u.set(g,h)}return h},"compareCharacters");if(e.length>1&&e.length===n.length){let c=[];for(let[g,s]of e.entries()){let h=b(n[g]),u=z(s.text,h.text,o);if(u===void 0)return;if(u<P)break;let y=_(s,h,t);if(y===void 0)return;c.push(y)}if(c.length===e.length)return c}if(e.length===1&&n.length===1){let c=_(b(e[0]),b(n[0]),t);return c===void 0?void 0:[c]}if(e.length*n.length>Q)return;let i=Array.from({length:e.length},()=>Array(n.length).fill(0)),f=Array.from({length:e.length+1},()=>Array.from({length:n.length+1}).fill(0));for(let c=1;c<=e.length;c++)for(let g=1;g<=n.length;g++){let s=z(b(e[c-1]).text,b(n[g-1]).text,o);if(s===void 0)return;b(i[c-1])[g-1]=s;let h=s>=P?T(f,c-1,g-1)+s:Number.NEGATIVE_INFINITY;b(f[c])[g]=Math.max(T(f,c-1,g),T(f,c,g-1),h)}let d=[],a=e.length,l=n.length;for(;a>0||l>0;){let c=a>0&&l>0?T(i,a-1,l-1):0;if((a>0&&l>0&&c>=P?T(f,a-1,l-1)+c:Number.NEGATIVE_INFINITY)===T(f,a,l)){let s=_(b(e[a-1]),b(n[l-1]),t);if(s===void 0)return;d.push(s),a--,l--}else if(l>0&&T(f,a,l-1)>=(a>0?T(f,a-1,l):Number.NEGATIVE_INFINITY)){let s=b(n[l-1]);d.push({kind:"added",text:s.text,afterLine:s.line,changed:!0}),l--}else{let s=b(e[a-1]);d.push({kind:"removed",text:s.text,beforeLine:s.line,changed:!0}),a--}}return d.reverse()}m(te,"alignChangedLines");function _(e,n,t){let r=re(e.text,n.text,t);if(r!==void 0)return{kind:"modified",text:n.text,beforeLine:e.line,afterLine:n.line,changed:!0,...r}}m(_,"modifiedRow");function re(e,n,t=performance.now()+S){let r=t-performance.now();if(r<=0||e.length+n.length>H)return;let o=j(e.trim(),n.trim(),{timeout:r,maxEditLength:5e3});if(o===void 0)return;let i=[],f=[],d=n.length-n.trimStart().length;for(let a=0;a<o.length;a++){let l=b(o[a]);l.removed?o[a+1]?.added||f.push(d):(l.added&&i.push({from:d,to:d+l.value.length}),d+=l.value.length)}return{addedRanges:i,deletedOffsets:f}}m(re,"compareInlineText");function z(e,n,t){let r=t(e,n);if(r===void 0)return;let o=V(e),i=V(n);if(o.length===0&&i.length===0)return r;let f=B(o,i,t),d=B(i,o,t);if(f===void 0||d===void 0)return;let a=(f+d)/2;return r*.35+a*.65}m(z,"lineSimilarity");function V(e){return(e.toLowerCase().match(/[\p{L}\p{N}_$]+/gu)??[]).filter(n=>!ee.has(n))}m(V,"semanticTokens");function B(e,n,t){if(e.length===0||n.length===0)return 0;let r=0;for(let o of e){let i=0;for(let f of n){let d=t(o,f);if(d===void 0)return;i=Math.max(i,d)}r+=i}return r/e.length}m(B,"directionalTokenSimilarity");function ie(e,n,t){if(t-performance.now()<=0)return;let o=Math.max(e.length,n.length);if(o===0||e===n)return 1;let i=Array.from(e),f=Array.from(n),d=0,a=0;for(;d<i.length&&d<f.length&&i[d]===f[d];)a+=b(i[d]).length,d++;let l=i.length,c=f.length;for(;l>d&&c>d&&i[l-1]===f[c-1];)a+=b(i[--l]).length,c--;let g=i.slice(d,l),s=f.slice(d,c);if(s.length>g.length&&([g,s]=[s,g]),s.length<=31&&g.every(y=>y.length===1)){let y=new Map;for(let[x,R]of s.entries())y.set(R,(y.get(R)??0)|1<<x);let w=0;for(let x of g){let R=(y.get(x)??0)|w;w=R&~(R-(w<<1|1))}let D=a;for(;w!==0;)w&=w-1,D++;return D/o}let h=j(e,n,{timeout:t-performance.now(),maxEditLength:2e3});return h===void 0?void 0:h.filter(y=>!y.added&&!y.removed).reduce((y,w)=>y+w.value.length,0)/o}m(ie,"characterSimilarity");function oe(e){let n=[];for(let t=0;t<e.length;t++){if(!b(e[t]).changed)continue;let r=t;for(;t+1<e.length&&b(e[t+1]).changed;)t++;let o={start:Math.max(0,r-N),end:Math.min(e.length-1,t+N)},i=n.at(-1);i!==void 0&&o.start<=i.end+1?n[n.length-1]={start:i.start,end:Math.max(i.end,o.end)}:n.push(o)}return n.flatMap((t,r)=>{let o=n[r-1];return[...o===void 0?[]:[de(t.start-o.end-1)],...e.slice(t.start,t.end+1)]})}m(oe,"projectHunks");function de(e){return{kind:"omitted",text:"",changed:!1,omitted:e}}m(de,"omittedRow");function W(e){if(e.length===0)return[];let n=e.replaceAll(`\r
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R}from"./chunk-L2B4DTVS.js";import{b as T}from"./chunk-OTVNO5SX.js";import{c as w,d as S}from"./chunk-XHFAV2NI.js";import{a as t}from"./chunk-EI7MMDWY.js";import{Container as W,Key as P,matchesKey as A,MouseRegion as O,SelectList as K,Text as I,truncateToWidth as D,visibleWidth as C}from"@earendil-works/pi-tui";var x=class{constructor(e,o,r){this.registry=e;this.activityMode=o;e.onDidChange(()=>this.#i()),r.registerCommand("agent-ide-processes",{description:"Show active terminal and debugger processes created by Agent IDE",handler:t(async(c,n)=>{if(this.bind(n),n.mode!=="tui"){n.ui.notify("The Agent IDE process overlay requires the TUI.","info");return}await this.#d(n)},"handler")})}static{t(this,"AgentIdeProcessesUi")}#t;#s=!1;#r;#e;setActivityMode(e){e!==this.activityMode&&(this.activityMode=e,this.#i())}bind(e){this.#s||(this.#t=e,this.#i())}dispose(){this.#s=!0,this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0,this.#t?.ui.setWidget("agent-ide-processes",void 0),this.#t?.ui.setStatus("agent-ide-processes",void 0),this.#t=void 0}#n(){return this.registry.list()}#i(){let e=this.#t;if(this.#s||e===void 0||!e.hasUI)return;let o=this.#n();if(this.activityMode==="off"||o.length===0){e.ui.setWidget("agent-ide-processes",void 0),e.ui.setStatus("agent-ide-processes",void 0),this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0;return}if(this.activityMode==="compact"){this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0,e.ui.setWidget("agent-ide-processes",void 0),e.ui.setStatus("agent-ide-processes",`Agent IDE processes: ${o.length}`);return}e.ui.setStatus("agent-ide-processes",void 0),e.ui.setWidget("agent-ide-processes",(r,c)=>U(o,c,n=>{this.#d(e,n).catch(p=>{e.ui.notify(`Could not open process details: ${String(p)}`,"error")})}),{placement:"belowEditor"}),this.#e??=setInterval(()=>this.#i(),1e3)}#d(e,o){return this.#r??=this.#o(e,o).finally(()=>{this.#r=void 0}),this.#r}async#o(e,o){for(;;){if(this.#n().length===0){e.ui.notify("No active Agent IDE processes.","info");return}let r=t(()=>{},"disposeRefresh"),c,n;try{n=await e.ui.custom((f,g,
|
|
1
|
+
import{a as R}from"./chunk-L2B4DTVS.js";import{b as T}from"./chunk-OTVNO5SX.js";import{c as w,d as S}from"./chunk-XHFAV2NI.js";import{a as t}from"./chunk-EI7MMDWY.js";import{Container as W,Key as P,matchesKey as A,MouseRegion as O,SelectList as K,Text as I,truncateToWidth as D,visibleWidth as C}from"@earendil-works/pi-tui";var x=class{constructor(e,o,r){this.registry=e;this.activityMode=o;e.onDidChange(()=>this.#i()),r.registerCommand("agent-ide-processes",{description:"Show active terminal and debugger processes created by Agent IDE",handler:t(async(c,n)=>{if(this.bind(n),n.mode!=="tui"){n.ui.notify("The Agent IDE process overlay requires the TUI.","info");return}await this.#d(n)},"handler")})}static{t(this,"AgentIdeProcessesUi")}#t;#s=!1;#r;#e;setActivityMode(e){e!==this.activityMode&&(this.activityMode=e,this.#i())}bind(e){this.#s||(this.#t=e,this.#i())}dispose(){this.#s=!0,this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0,this.#t?.ui.setWidget("agent-ide-processes",void 0),this.#t?.ui.setStatus("agent-ide-processes",void 0),this.#t=void 0}#n(){return this.registry.list()}#i(){let e=this.#t;if(this.#s||e===void 0||!e.hasUI)return;let o=this.#n();if(this.activityMode==="off"||o.length===0){e.ui.setWidget("agent-ide-processes",void 0),e.ui.setStatus("agent-ide-processes",void 0),this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0;return}if(this.activityMode==="compact"){this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0,e.ui.setWidget("agent-ide-processes",void 0),e.ui.setStatus("agent-ide-processes",`Agent IDE processes: ${o.length}`);return}e.ui.setStatus("agent-ide-processes",void 0),e.ui.setWidget("agent-ide-processes",(r,c)=>U(o,c,n=>{this.#d(e,n).catch(p=>{e.ui.notify(`Could not open process details: ${String(p)}`,"error")})}),{placement:"belowEditor"}),this.#e??=setInterval(()=>this.#i(),1e3)}#d(e,o){return this.#r??=this.#o(e,o).finally(()=>{this.#r=void 0}),this.#r}async#o(e,o){for(;;){if(this.#n().length===0){e.ui.notify("No active Agent IDE processes.","info");return}let r=t(()=>{},"disposeRefresh"),c,n;try{n=await e.ui.custom((f,g,H,E)=>{let h=this.#n(),a=h.find(d=>d.source===o),l=a?"detail":"list";o=void 0;let M=t(d=>{let u=h.map(i=>({value:i.source,label:`${i.status} ${i.kind} ${i.title}`,description:i.description})),y=new K(u,Math.min(u.length,12),{selectedPrefix:t(i=>g.fg("accent",i),"selectedPrefix"),selectedText:t(i=>g.fg("accent",i),"selectedText"),description:t(i=>g.fg("muted",i),"description"),scrollInfo:t(i=>g.fg("dim",i),"scrollInfo"),noMatch:t(i=>g.fg("warning",i),"noMatch")}),m=u.findIndex(i=>i.value===d);return m>=0&&y.setSelectedIndex(m),y.onSelect=i=>{a=h.find(L=>L.source===i.value),l="detail",f.requestRender()},y.onCancel=()=>E(null),y},"createList"),v=M(a?.source),$=t(()=>{let d=a?.source??v.getSelectedItem()?.value;h=this.#n(),a=l==="list"?void 0:h.find(u=>u.source===d),v=M(d),f.requestRender()},"refresh");return r=this.registry.onDidChange($),c=setInterval($,1e3),{invalidate:t(()=>v.invalidate(),"invalidate"),render(d){let u=new W;l==="list"?(u.addChild(v),u.addChild(new I(g.fg("dim",h.length===0?"esc close":"enter view \xB7 d stop \xB7 esc close"),1,0))):a===void 0?(u.addChild(new I(g.fg("warning","Process is no longer active."),1,0)),u.addChild(new I(g.fg("dim","esc back"),1,0))):(u.addChild(a.renderDetail(g)),u.addChild(new I(g.fg(l==="confirm"?"warning":"dim",l==="confirm"?"Stop this process? y confirm \xB7 n/esc cancel":l==="input"?"input mode \xB7 type to send \xB7 esc stop input":a.sendInput===void 0?"esc back \xB7 d stop":"i input \xB7 esc back \xB7 d stop"),1,0)));let y=t(i=>g.fg("accent",i),"accent"),m=Math.max(1,d-2);return[k("Agent IDE Processes",`${h.length} active`,d,y),...u.render(m).map(i=>b(i,d,y)),_(d,y)]},handleInput(d){l==="list"?d==="d"?(a=h.find(u=>u.source===v.getSelectedItem()?.value),a!==void 0&&(l="confirm")):v.handleInput(d):l==="detail"?A(d,P.escape)?l="list":d==="d"&&a!==void 0?l="confirm":d==="i"&&a?.sendInput!==void 0&&(l="input"):l==="input"?A(d,P.escape)?l="detail":a?.sendInput?.(d):d==="y"&&a!==void 0?E({source:a.source}):(d==="n"||A(d,P.escape))&&(l="detail"),f.requestRender()}}},{overlay:!0,overlayOptions:{width:"75%",maxHeight:"80%",minWidth:52}})}finally{r(),c!==void 0&&clearInterval(c)}if(n===null)return;let p=this.#n().find(f=>f.source===n.source);p!==void 0&&await p.stop()}}};function U(s,e,o){let r=new W;if(s.length===0)return r;let c=t(n=>e.fg("accent",n),"accent");r.addChild({invalidate(){},render:t(n=>[k("Agent IDE Processes",`${s.length} active`,n,c)],"render")});for(let[n,p]of s.entries())r.addChild(new O({invalidate(){},render:t(f=>p.renderSummary(e).map(g=>b(` ${g} `,f,c)),"render")},f=>{if(!(o===void 0||f.type!=="click"||f.button!=="left"))return o(p.source),{handled:!0}})),n<s.length-1&&r.addChild({invalidate(){},render:t(f=>[b("",f,c)],"render")});return r.addChild({invalidate(){},render:t(n=>[_(n,c)],"render")}),r}t(U,"createProcessWidget");function k(s,e,o,r){if(o<=1)return r("\u256D");let c=o-2,n=`\u2500 ${s} `,p=` ${e} \u2500`,f="\u2500".repeat(Math.max(0,c-C(n)-C(p)));return r(`\u256D${D(`${n}${f}${p}`,c).padEnd(c,"\u2500")}\u256E`)}t(k,"borderTop");function b(s,e,o){if(e<=1)return o("\u2502");let r=e-2,c=D(s,r);return`${o("\u2502")}${c}${" ".repeat(Math.max(0,r-C(c)))}${o("\u2502")}`}t(b,"borderLine");function _(s,e){return e(s<=1?"\u2570":`\u2570${"\u2500".repeat(s-2)}\u256F`)}t(_,"borderBottom");async function B(s){let e=R(s),o=await S(w()),r=new x(e,q(o.preferences?.["processes.activity"]),s);T(s,"processes.activity",c=>r.setActivityMode(q(c))),s.on("session_start",(c,n)=>r.bind(n)),s.on("session_shutdown",()=>r.dispose())}t(B,"registerAgentIdeProcesses");function q(s){return s==="compact"||s==="off"?s:"detailed"}t(q,"activityMode");export{B as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as x}from"./chunk-LLP3EIJL.js";import{a as C,m as X}from"./chunk-YPYROPQF.js";import{a as D}from"./chunk-GXL4NMHR.js";import{c as P,d as R}from"./chunk-PQWANILR.js";import"./chunk-DDH3FP4G.js";import{b as S}from"./chunk-T4FTT3U4.js";import"./chunk-VDJSH3DQ.js";import{a as H}from"./chunk-ZC65Z3CK.js";import{a as K,b as Q,c as Z,d as ee,g as te}from"./chunk-OFILFO6D.js";import{a as d}from"./chunk-EI7MMDWY.js";var $=[],k=[],J=[];function j(r,e,t){if(e.some(i=>i.name===t))throw new Error(`[pi-agent-ide] ${r} "${t}" is already registered. Use a unique name.`)}d(j,"assertUniqueName");function re(r){let e=new Set;for(let t of r){let i=`${t.kind}:${t.name}`;if(e.has(i))throw new Error(`[pi-agent-ide] ${t.kind} "${t.name}" is registered twice by one plugin.`);switch(e.add(i),t.kind){case"compiler":{j(t.kind,k,t.name);break}case"formatter":{j(t.kind,$,t.name);break}case"linter":{j(t.kind,J,t.name);break}}}for(let t of r)switch(t.kind){case"compiler":{k.push(t);break}case"formatter":{$.push(t);break}case"linter":{J.push(t);break}}}d(re,"registerTools");async function ie(r,e){let t=[];for(let i of r)try{await i.detect(e)&&t.push(i)}catch(o){console.error(`[pi-agent-ide] detect failed for "${i.name}":`,o)}return t.sort((i,o)=>o.priority-i.priority),ve(t),t}d(ie,"filterActive");function ve(r){let e=new Map;for(let t of r)for(let i of t.extensions){let o=`${i}@${t.priority}`,c=e.get(o);if(c!==void 0)throw new Error(`[pi-agent-ide] priority conflict: tools "${c}" and "${t.name}" both claim "${i}" at priority ${t.priority}.`);e.set(o,t.name)}}d(ve,"assertNoPriorityConflicts");async function ne(r){let[e,t]=await Promise.all([ie($,r),ie(k.filter(i=>i.syntaxOnly===!0),r)]);return{ctx:r,formatters:e,compilers:t,linters:[]}}d(ne,"warmupFormatting");function q(){$.length=0,k.length=0,J.length=0}d(q,"resetRegistry");import{readFile as be}from"node:fs/promises";import A from"node:path";var F=class{constructor(e,t={}){this.sources=e;this.options=t}static{d(this,"DiagnosticStore")}files=new Map;dirty=new Set;sent=new Map;queue=[];running=0;disposed=!1;changeListeners=new Set;onDidChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}schedule(e,t,{cwd:i,parentToolCallId:o}){this.disposed||this.ensure(e,t,i,o)}async read(e,{cwd:t,mode:i,signal:o}){o?.throwIfAborted(),this.assertActive();let c=S(e,t),a=await this.readText(c,t,o);this.assertActive();let n=this.ensure(c,a,t);i==="complete"?await this.waitComplete(n,o):i!=="snapshot"&&await Te(Promise.all(n.jobs),this.options.readWaitMs??5e3),o?.throwIfAborted(),this.assertActive();let l=await this.readText(c,t,o);this.assertActive();let s=this.ensure(c,l,t);if(i==="complete"&&s!==n)throw Object.assign(new Error("File changed during diagnostics"),{code:"DIAGNOSTICS_STALE"});return{filePath:c,content:s.content,results:[...s.results.values()]}}async waitComplete(e,t){let i=t?AbortSignal.any([t,e.controller.signal]):e.controller.signal;i.throwIfAborted();let o=[];await new Promise((c,a)=>{let n=d(p=>a(Object.assign(new Error(p),{code:p,details:[...e.results.values()]})),"fail"),l=d(()=>{let p=[...e.results.values()];p.some(g=>g.status==="unavailable")?n("DIAGNOSTICS_UNAVAILABLE"):p.every(g=>g.status==="ready")&&c()},"check"),s=d(()=>a(i.reason),"abort"),u=this.onDidChange(l),f=setTimeout(()=>n("DIAGNOSTICS_TIMEOUT"),this.options.checkTimeoutMs??3e4);i.addEventListener("abort",s,{once:!0});let h=d(()=>{clearTimeout(f),u(),i.removeEventListener("abort",s)},"cleanup");Promise.resolve().then(l),o.push(h)}).finally(()=>{for(let c of o)c()})}async takeNotifications(e){let t=[];for(let i of[...this.dirty]){if(i.cwd!==(e.includes("://")?e:A.resolve(e))||(this.dirty.delete(i),!await this.isCurrent(i)))continue;let o=[...i.results.values()].filter(s=>s.status!=="pending"&&s.status!=="unavailable"&&s.diagnostics.length>0),c=this.key(i.filePath,i.cwd),a=JSON.stringify(o);if(this.sent.get(c)===a||(this.sent.set(c,a),o.length===0))continue;let n=o.map(s=>{let u=["error","warning","info","hint"].flatMap(f=>{let h=s.diagnostics.filter(p=>p.severity===f).length;return h>0?[`${h} ${f}`]:[]});return`${s.source} ${u.join(", ")}${s.status==="snapshot"?" (snapshot; completion unknown)":s.status==="unversioned"?" (unversioned)":""}`}).join("; "),l=i.filePath.includes("://")?i.filePath:A.relative(e,i.filePath);t.push({filePath:l,...i.parentToolCallId===void 0?{}:{parentToolCallId:i.parentToolCallId},results:o,text:`${JSON.stringify(l)}: ${n}.`})}return t}dispose(){this.disposed=!0,this.changeListeners.clear();for(let e of this.files.values())e.controller.abort();this.files.clear(),this.dirty.clear(),this.sent.clear(),this.pump()}async readText(e,t,i){for(let o of this.options.readers??[]){let c=await o.readText(e,{cwd:t,signal:i});if(c!==void 0)return c}if(e.includes("://"))throw Object.assign(new Error("No diagnostic reader for resource owner"),{code:"UNSUPPORTED_SOURCE"});return be(e,{encoding:"utf8",signal:i})}key(e,t){return JSON.stringify([t.includes("://")?t:A.resolve(t),S(e,t)])}ensure(e,t,i,o){let c=this.key(e,i),a=this.files.get(c);if(a?.content===t)return a;a?.controller.abort(),a&&this.dirty.delete(a);let n={cwd:i.includes("://")?i:A.resolve(i),filePath:S(e,i),content:t,...o===void 0?{}:{parentToolCallId:o},controller:new AbortController,results:new Map,jobs:[],publications:new Map};this.files.set(c,n),this.sources.length===0&&n.results.set("diagnostics",{source:"diagnostics",status:"unavailable",diagnostics:[],reason:"No diagnostic sources registered"}),this.dirty.add(n);for(let l of this.sources){n.results.set(l.id,{source:l.id,status:"pending",diagnostics:[]});let s=new Promise(u=>{this.queue.push(async()=>{try{await this.check(n,l)}finally{u()}})});n.jobs.push(s)}return queueMicrotask(()=>this.pump()),n}pump(){for(;this.running<(this.options.concurrency??4)&&this.queue.length>0;){let e=this.queue.shift();if(!e)break;this.running++,e().finally(()=>{this.running--,this.pump()})}}active(e){return!this.disposed&&!e.controller.signal.aborted}assertActive(){if(this.disposed)throw new Error("Diagnostics session has ended")}async isCurrent(e){if(!this.active(e))return!1;let t=await this.readText(e.filePath,e.cwd,e.controller.signal).catch(()=>{});return this.active(e)&&t===e.content}async publish(e,t,i){let o=(e.publications.get(t)??0)+1;if(e.publications.set(t,o),!await this.isCurrent(e)||e.publications.get(t)!==o)return;let c={...i,source:i.source??t};if(JSON.stringify(e.results.get(t))===JSON.stringify(c))return;e.results.set(t,c),this.dirty.add(e);let a=[...e.results.values()].some(n=>n.status!=="pending"&&n.status!=="unavailable"&&n.diagnostics.length>0);a||this.sent.delete(this.key(e.filePath,e.cwd));for(let n of this.changeListeners)n(e.cwd,a)}async check(e,t){if(!await this.isCurrent(e))return;let i=new AbortController,o=AbortSignal.any([i.signal,e.controller.signal]);if(o.aborted)return;let c,a;try{let n=new Promise((s,u)=>{a=d(()=>u(o.reason),"onAbort"),o.addEventListener("abort",a,{once:!0}),c=setTimeout(()=>i.abort(new Error("Diagnostic check timed out")),this.options.checkTimeoutMs??3e4)}),l=await Promise.race([t.diagnose(e.filePath,{cwd:e.cwd,content:e.content,signal:o,publish:d(s=>{o.aborted||this.publish(e,t.id,s)},"publish")}),n]);await this.publish(e,t.id,l)}catch(n){await this.publish(e,t.id,{status:"unavailable",diagnostics:[],reason:n instanceof Error?n.message:String(n)})}finally{clearTimeout(c),a&&o.removeEventListener("abort",a)}}};async function Te(r,e){let t;try{await Promise.race([r,new Promise(i=>{t=setTimeout(i,e)})])}finally{clearTimeout(t)}}d(Te,"waitAtMost");function oe(){let r=new Map,e=[],t=[],i=new F(e,{readers:t}),o=Promise.resolve();return{diagnostics:i,registerPlugin(c){if(c.id.trim().length===0)return Promise.reject(new Error("Plugin ID must not be empty"));let a=r.get(c.id);if(a!==void 0)return a;let n=o.then(async()=>{let l=[],s=[],u=[],f=!0,h={addTool(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);xe(g),l.push(g)},addDiagnosticSource(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);Ie(g),s.push(g)},addDiagnosticFileReader(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);if(!g.id.trim()||typeof g.readText!="function")throw new TypeError("Invalid diagnostic file reader");u.push(g)},readDiagnostics(g,E){return i.read(g,E)}};try{await c.setup(h)}catch(g){throw f=!1,g}f=!1,Ee(e,s);let p=new Set(t.map(g=>g.id));for(let g of u){if(p.has(g.id))throw new Error(`Diagnostic file reader ${g.id} is already registered`);p.add(g.id)}re(l),e.push(...s),t.push(...u)});return r.set(c.id,n),o=n.catch(()=>{}),n.catch(()=>{r.delete(c.id)}),n},async waitForPendingPlugins(){await Promise.all(r.values())}}}d(oe,"createIdeCore");function Ee(r,e){let t=new Set(r.map(i=>i.id));for(let i of e){if(t.has(i.id))throw new Error(`Diagnostic source ${i.id} is already registered`);t.add(i.id)}}d(Ee,"assertUniqueDiagnosticSources");function xe(r){if(!se(r))throw new TypeError("IDE tool must be an object");let e=r.kind,t=e==="compiler"?r.compile:e==="formatter"?r.format:e==="linter"?r.lint:void 0;if(t===void 0||typeof t!="function"||typeof r.detect!="function"||typeof r.name!="string"||r.name.trim().length===0||typeof r.priority!="number"||!Number.isFinite(r.priority)||!Array.isArray(r.extensions)||r.extensions.length===0||r.extensions.some(i=>typeof i!="string"||i.length===0))throw new TypeError("Invalid pi-agent-ide tool contribution")}d(xe,"assertIdeTool");function Ie(r){if(!se(r)||typeof r.id!="string"||r.id.trim().length===0||typeof r.diagnose!="function")throw new TypeError("Invalid pi-agent-ide diagnostic source contribution")}d(Ie,"assertDiagnosticSource");function se(r){return typeof r=="object"&&r!==null}d(se,"isRecord");function ae(r,e,t=console.error){let i=new Map,o=!1,c=Promise.resolve();return{schedule(a){if(o||i.has(a))return;let n=setTimeout(()=>{i.delete(a),c=c.then(async()=>{o||await r(a)}).catch(t)},e);i.set(a,n)},dispose(){o=!0;for(let a of i.values())clearTimeout(a);i.clear()}}}d(ae,"createDiagnosticDelivery");import{Text as ce}from"@earendil-works/pi-tui";var B="ide-diagnostic-summary";function le(r){let e=new Map;for(let t of r){let i=t.parentToolCallId,o=e.get(i)??[];o.push(Pe(t)),e.set(i,o)}return[...e].map(([t,i])=>({files:i,...t===void 0?{}:{parentToolCallId:t}}))}d(le,"diagnosticEntryGroups");function Pe(r){return{filePath:r.filePath,sources:r.results.map(e=>{let t={error:0,warning:0,info:0,hint:0};for(let i of e.diagnostics)t[i.severity]++;return{source:e.source,status:e.status,counts:t}})}}d(Pe,"diagnosticEntryData");function U(r,e,t=!1){return{render(i){let o=r.sources.filter(n=>n.status!=="pending"&&n.status!=="unavailable"&&Object.values(n.counts).some(l=>l>0));if(o.length===0)return[];let c=o.map(n=>`${G(n.counts,e)} ${e.fg("dim",`(${V(n.source)})`)}`+(n.status==="ready"?"":` \xB7 ${e.fg("dim",n.status)}`)).join(" \xB7 "),a=[`${e.fg("accent","Diagnostics")} ${e.fg("toolTitle",V(r.filePath))} \xB7 ${c}`];if(t)for(let n of o)a.push(` ${e.fg("dim",V(n.source))} \xB7 ${G(n.counts,e)} \xB7 ${e.fg("dim",n.status)}`);return new ce(a.join(`
|
|
1
|
+
import{b as x}from"./chunk-LLP3EIJL.js";import{a as C,m as X}from"./chunk-QGXZ4RWX.js";import{a as D}from"./chunk-YZTVC7ME.js";import{c as P,d as R}from"./chunk-VDSSAP6Y.js";import"./chunk-SIYPD5MM.js";import{b as S}from"./chunk-T4FTT3U4.js";import"./chunk-S7E2D5K7.js";import{a as H}from"./chunk-ZC65Z3CK.js";import{a as K,b as Q,c as Z,d as ee,g as te}from"./chunk-OFILFO6D.js";import{a as d}from"./chunk-EI7MMDWY.js";var $=[],k=[],J=[];function j(r,e,t){if(e.some(i=>i.name===t))throw new Error(`[pi-agent-ide] ${r} "${t}" is already registered. Use a unique name.`)}d(j,"assertUniqueName");function re(r){let e=new Set;for(let t of r){let i=`${t.kind}:${t.name}`;if(e.has(i))throw new Error(`[pi-agent-ide] ${t.kind} "${t.name}" is registered twice by one plugin.`);switch(e.add(i),t.kind){case"compiler":{j(t.kind,k,t.name);break}case"formatter":{j(t.kind,$,t.name);break}case"linter":{j(t.kind,J,t.name);break}}}for(let t of r)switch(t.kind){case"compiler":{k.push(t);break}case"formatter":{$.push(t);break}case"linter":{J.push(t);break}}}d(re,"registerTools");async function ie(r,e){let t=[];for(let i of r)try{await i.detect(e)&&t.push(i)}catch(o){console.error(`[pi-agent-ide] detect failed for "${i.name}":`,o)}return t.sort((i,o)=>o.priority-i.priority),ve(t),t}d(ie,"filterActive");function ve(r){let e=new Map;for(let t of r)for(let i of t.extensions){let o=`${i}@${t.priority}`,c=e.get(o);if(c!==void 0)throw new Error(`[pi-agent-ide] priority conflict: tools "${c}" and "${t.name}" both claim "${i}" at priority ${t.priority}.`);e.set(o,t.name)}}d(ve,"assertNoPriorityConflicts");async function ne(r){let[e,t]=await Promise.all([ie($,r),ie(k.filter(i=>i.syntaxOnly===!0),r)]);return{ctx:r,formatters:e,compilers:t,linters:[]}}d(ne,"warmupFormatting");function q(){$.length=0,k.length=0,J.length=0}d(q,"resetRegistry");import{readFile as be}from"node:fs/promises";import A from"node:path";var F=class{constructor(e,t={}){this.sources=e;this.options=t}static{d(this,"DiagnosticStore")}files=new Map;dirty=new Set;sent=new Map;queue=[];running=0;disposed=!1;changeListeners=new Set;onDidChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}schedule(e,t,{cwd:i,parentToolCallId:o}){this.disposed||this.ensure(e,t,i,o)}async read(e,{cwd:t,mode:i,signal:o}){o?.throwIfAborted(),this.assertActive();let c=S(e,t),a=await this.readText(c,t,o);this.assertActive();let n=this.ensure(c,a,t);i==="complete"?await this.waitComplete(n,o):i!=="snapshot"&&await Te(Promise.all(n.jobs),this.options.readWaitMs??5e3),o?.throwIfAborted(),this.assertActive();let l=await this.readText(c,t,o);this.assertActive();let s=this.ensure(c,l,t);if(i==="complete"&&s!==n)throw Object.assign(new Error("File changed during diagnostics"),{code:"DIAGNOSTICS_STALE"});return{filePath:c,content:s.content,results:[...s.results.values()]}}async waitComplete(e,t){let i=t?AbortSignal.any([t,e.controller.signal]):e.controller.signal;i.throwIfAborted();let o=[];await new Promise((c,a)=>{let n=d(p=>a(Object.assign(new Error(p),{code:p,details:[...e.results.values()]})),"fail"),l=d(()=>{let p=[...e.results.values()];p.some(g=>g.status==="unavailable")?n("DIAGNOSTICS_UNAVAILABLE"):p.every(g=>g.status==="ready")&&c()},"check"),s=d(()=>a(i.reason),"abort"),u=this.onDidChange(l),f=setTimeout(()=>n("DIAGNOSTICS_TIMEOUT"),this.options.checkTimeoutMs??3e4);i.addEventListener("abort",s,{once:!0});let h=d(()=>{clearTimeout(f),u(),i.removeEventListener("abort",s)},"cleanup");Promise.resolve().then(l),o.push(h)}).finally(()=>{for(let c of o)c()})}async takeNotifications(e){let t=[];for(let i of[...this.dirty]){if(i.cwd!==(e.includes("://")?e:A.resolve(e))||(this.dirty.delete(i),!await this.isCurrent(i)))continue;let o=[...i.results.values()].filter(s=>s.status!=="pending"&&s.status!=="unavailable"&&s.diagnostics.length>0),c=this.key(i.filePath,i.cwd),a=JSON.stringify(o);if(this.sent.get(c)===a||(this.sent.set(c,a),o.length===0))continue;let n=o.map(s=>{let u=["error","warning","info","hint"].flatMap(f=>{let h=s.diagnostics.filter(p=>p.severity===f).length;return h>0?[`${h} ${f}`]:[]});return`${s.source} ${u.join(", ")}${s.status==="snapshot"?" (snapshot; completion unknown)":s.status==="unversioned"?" (unversioned)":""}`}).join("; "),l=i.filePath.includes("://")?i.filePath:A.relative(e,i.filePath);t.push({filePath:l,...i.parentToolCallId===void 0?{}:{parentToolCallId:i.parentToolCallId},results:o,text:`${JSON.stringify(l)}: ${n}.`})}return t}dispose(){this.disposed=!0,this.changeListeners.clear();for(let e of this.files.values())e.controller.abort();this.files.clear(),this.dirty.clear(),this.sent.clear(),this.pump()}async readText(e,t,i){for(let o of this.options.readers??[]){let c=await o.readText(e,{cwd:t,signal:i});if(c!==void 0)return c}if(e.includes("://"))throw Object.assign(new Error("No diagnostic reader for resource owner"),{code:"UNSUPPORTED_SOURCE"});return be(e,{encoding:"utf8",signal:i})}key(e,t){return JSON.stringify([t.includes("://")?t:A.resolve(t),S(e,t)])}ensure(e,t,i,o){let c=this.key(e,i),a=this.files.get(c);if(a?.content===t)return a;a?.controller.abort(),a&&this.dirty.delete(a);let n={cwd:i.includes("://")?i:A.resolve(i),filePath:S(e,i),content:t,...o===void 0?{}:{parentToolCallId:o},controller:new AbortController,results:new Map,jobs:[],publications:new Map};this.files.set(c,n),this.sources.length===0&&n.results.set("diagnostics",{source:"diagnostics",status:"unavailable",diagnostics:[],reason:"No diagnostic sources registered"}),this.dirty.add(n);for(let l of this.sources){n.results.set(l.id,{source:l.id,status:"pending",diagnostics:[]});let s=new Promise(u=>{this.queue.push(async()=>{try{await this.check(n,l)}finally{u()}})});n.jobs.push(s)}return queueMicrotask(()=>this.pump()),n}pump(){for(;this.running<(this.options.concurrency??4)&&this.queue.length>0;){let e=this.queue.shift();if(!e)break;this.running++,e().finally(()=>{this.running--,this.pump()})}}active(e){return!this.disposed&&!e.controller.signal.aborted}assertActive(){if(this.disposed)throw new Error("Diagnostics session has ended")}async isCurrent(e){if(!this.active(e))return!1;let t=await this.readText(e.filePath,e.cwd,e.controller.signal).catch(()=>{});return this.active(e)&&t===e.content}async publish(e,t,i){let o=(e.publications.get(t)??0)+1;if(e.publications.set(t,o),!await this.isCurrent(e)||e.publications.get(t)!==o)return;let c={...i,source:i.source??t};if(JSON.stringify(e.results.get(t))===JSON.stringify(c))return;e.results.set(t,c),this.dirty.add(e);let a=[...e.results.values()].some(n=>n.status!=="pending"&&n.status!=="unavailable"&&n.diagnostics.length>0);a||this.sent.delete(this.key(e.filePath,e.cwd));for(let n of this.changeListeners)n(e.cwd,a)}async check(e,t){if(!await this.isCurrent(e))return;let i=new AbortController,o=AbortSignal.any([i.signal,e.controller.signal]);if(o.aborted)return;let c,a;try{let n=new Promise((s,u)=>{a=d(()=>u(o.reason),"onAbort"),o.addEventListener("abort",a,{once:!0}),c=setTimeout(()=>i.abort(new Error("Diagnostic check timed out")),this.options.checkTimeoutMs??3e4)}),l=await Promise.race([t.diagnose(e.filePath,{cwd:e.cwd,content:e.content,signal:o,publish:d(s=>{o.aborted||this.publish(e,t.id,s)},"publish")}),n]);await this.publish(e,t.id,l)}catch(n){await this.publish(e,t.id,{status:"unavailable",diagnostics:[],reason:n instanceof Error?n.message:String(n)})}finally{clearTimeout(c),a&&o.removeEventListener("abort",a)}}};async function Te(r,e){let t;try{await Promise.race([r,new Promise(i=>{t=setTimeout(i,e)})])}finally{clearTimeout(t)}}d(Te,"waitAtMost");function oe(){let r=new Map,e=[],t=[],i=new F(e,{readers:t}),o=Promise.resolve();return{diagnostics:i,registerPlugin(c){if(c.id.trim().length===0)return Promise.reject(new Error("Plugin ID must not be empty"));let a=r.get(c.id);if(a!==void 0)return a;let n=o.then(async()=>{let l=[],s=[],u=[],f=!0,h={addTool(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);xe(g),l.push(g)},addDiagnosticSource(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);Ie(g),s.push(g)},addDiagnosticFileReader(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);if(!g.id.trim()||typeof g.readText!="function")throw new TypeError("Invalid diagnostic file reader");u.push(g)},readDiagnostics(g,E){return i.read(g,E)}};try{await c.setup(h)}catch(g){throw f=!1,g}f=!1,Ee(e,s);let p=new Set(t.map(g=>g.id));for(let g of u){if(p.has(g.id))throw new Error(`Diagnostic file reader ${g.id} is already registered`);p.add(g.id)}re(l),e.push(...s),t.push(...u)});return r.set(c.id,n),o=n.catch(()=>{}),n.catch(()=>{r.delete(c.id)}),n},async waitForPendingPlugins(){await Promise.all(r.values())}}}d(oe,"createIdeCore");function Ee(r,e){let t=new Set(r.map(i=>i.id));for(let i of e){if(t.has(i.id))throw new Error(`Diagnostic source ${i.id} is already registered`);t.add(i.id)}}d(Ee,"assertUniqueDiagnosticSources");function xe(r){if(!se(r))throw new TypeError("IDE tool must be an object");let e=r.kind,t=e==="compiler"?r.compile:e==="formatter"?r.format:e==="linter"?r.lint:void 0;if(t===void 0||typeof t!="function"||typeof r.detect!="function"||typeof r.name!="string"||r.name.trim().length===0||typeof r.priority!="number"||!Number.isFinite(r.priority)||!Array.isArray(r.extensions)||r.extensions.length===0||r.extensions.some(i=>typeof i!="string"||i.length===0))throw new TypeError("Invalid pi-agent-ide tool contribution")}d(xe,"assertIdeTool");function Ie(r){if(!se(r)||typeof r.id!="string"||r.id.trim().length===0||typeof r.diagnose!="function")throw new TypeError("Invalid pi-agent-ide diagnostic source contribution")}d(Ie,"assertDiagnosticSource");function se(r){return typeof r=="object"&&r!==null}d(se,"isRecord");function ae(r,e,t=console.error){let i=new Map,o=!1,c=Promise.resolve();return{schedule(a){if(o||i.has(a))return;let n=setTimeout(()=>{i.delete(a),c=c.then(async()=>{o||await r(a)}).catch(t)},e);i.set(a,n)},dispose(){o=!0;for(let a of i.values())clearTimeout(a);i.clear()}}}d(ae,"createDiagnosticDelivery");import{Text as ce}from"@earendil-works/pi-tui";var B="ide-diagnostic-summary";function le(r){let e=new Map;for(let t of r){let i=t.parentToolCallId,o=e.get(i)??[];o.push(Pe(t)),e.set(i,o)}return[...e].map(([t,i])=>({files:i,...t===void 0?{}:{parentToolCallId:t}}))}d(le,"diagnosticEntryGroups");function Pe(r){return{filePath:r.filePath,sources:r.results.map(e=>{let t={error:0,warning:0,info:0,hint:0};for(let i of e.diagnostics)t[i.severity]++;return{source:e.source,status:e.status,counts:t}})}}d(Pe,"diagnosticEntryData");function U(r,e,t=!1){return{render(i){let o=r.sources.filter(n=>n.status!=="pending"&&n.status!=="unavailable"&&Object.values(n.counts).some(l=>l>0));if(o.length===0)return[];let c=o.map(n=>`${G(n.counts,e)} ${e.fg("dim",`(${V(n.source)})`)}`+(n.status==="ready"?"":` \xB7 ${e.fg("dim",n.status)}`)).join(" \xB7 "),a=[`${e.fg("accent","Diagnostics")} ${e.fg("toolTitle",V(r.filePath))} \xB7 ${c}`];if(t)for(let n of o)a.push(` ${e.fg("dim",V(n.source))} \xB7 ${G(n.counts,e)} \xB7 ${e.fg("dim",n.status)}`);return new ce(a.join(`
|
|
2
2
|
`),0,0).render(i)},invalidate(){}}}d(U,"renderDiagnosticEntry");function de(r){r.registerEntryRenderer(B,(e,t,i)=>{let o=H(e.data);return"files"in o?Re(o.files,i,t.expanded):U(o,i,t.expanded)})}d(de,"registerDiagnosticEntryRenderer");function Re(r,e,t=!1){return{render(i){let o=r.filter(l=>l.sources.some(s=>s.status!=="pending"&&s.status!=="unavailable"&&Object.values(s.counts).some(u=>u>0)));if(o.length===1&&o[0])return U(o[0],e,t).render(i);if(o.length===0)return[];let c={error:0,warning:0,info:0,hint:0},a=new Set;for(let l of o)for(let s of l.sources)if(!(s.status==="pending"||s.status==="unavailable")){a.add(s.source);for(let u of["error","warning","info","hint"])c[u]+=s.counts[u]}let n=new ce(`${e.fg("accent","Diagnostics")} \xB7 ${o.length} files \xB7 ${G(c,e)} \xB7 ${a.size} tools`,0,0).render(i);return t?[...n,...o.flatMap(l=>U(l,e,!0).render(i))]:n},invalidate(){}}}d(Re,"renderDiagnosticBatch");function G(r,e){return["error","warning","info","hint"].filter(t=>r[t]>0).map(t=>{let i=r[t],o=t==="info"||i===1?t:`${t}s`,c=i>0&&(t==="error"||t==="warning")?t:"muted";return e.fg(c,`${i} ${o}`)}).join(", ")}d(G,"renderCounts");function V(r){return r.replace(/[\u0000-\u001f\u007f-\u009f]/g," ")}d(V,"plain");import ue from"node:path";async function fe(r){if(!ue.isAbsolute(r.resourceSource)&&!r.resourceSource.startsWith("ssh://"))return{formatting:{status:"unavailable"}};let e;try{let t=await ne({cwd:r.cwd}),i=ue.extname(r.resourceSource).toLowerCase(),o=d(l=>l.extensions.includes(i)||l.extensions.includes("*"),"matches"),c=t.compilers.find(o);if(c&&(await c.compile({filePath:r.resourceSource},t.ctx)).syntaxErrors.length>0)return{formatting:{status:"skipped-syntax"}};let a=t.formatters.find(o);if(!a)return{formatting:{status:"unavailable"}};e=a.name;let n=await a.format({filePath:r.resourceSource},t.ctx);return n.formatter===null?{formatting:{status:"unavailable"}}:(e=n.formatter??a.name,{formatting:{status:n.ok?n.edits>0?"changed":"unchanged":"failed",formatter:e},...n.ok?{diffStatuses:[{text:`Formatted (${e})`,tone:"success",formatter:e}]}:{diffStatuses:[{text:`Formatting failed (${e})`,formatter:e,tone:"error"}]}})}catch{return{diffStatuses:[{text:"Formatting failed",tone:"error",formattingStatus:"failed",...e===void 0?{}:{formatter:e}}],formatting:{status:"failed",...e===void 0?{}:{formatter:e}}}}}d(fe,"runIdePostEditGate");import{readFile as Oe}from"node:fs/promises";import he from"node:path";import{Text as Ne}from"@earendil-works/pi-tui";import{readFile as De}from"node:fs/promises";import Ce from"node:path";import{Type as v}from"typebox";import{Value as Se}from"typebox/value";import{parseDocument as $e}from"yaml";var _=".pi/pi-agent-ide/code-review.yaml",ke=v.Object({rules:v.Array(v.Object({id:v.String({pattern:"^[a-z][a-z0-9-]*$",maxLength:64}),description:v.String({minLength:1,maxLength:2048}),enabled:v.Optional(v.Boolean())},{additionalProperties:!1}),{maxItems:32})},{additionalProperties:!1});function Ae(r){if(Buffer.byteLength(r,"utf8")>65536)throw new Error("Review rules file is too large (64 KiB limit).");let e=$e(r),[t]=e.errors;if(t)throw new Error(t.message);let i=e.toJS({maxAliasCount:0});if(!Se.Check(ke,i))throw new Error("Expected rules: [{ id, description, enabled? }]; at most 32 rules with descriptions up to 2048 characters.");let o=new Set,c=[];for(let a of i.rules){if(o.has(a.id))throw new Error(`Duplicate review rule: ${a.id}`);if(o.add(a.id),!a.description.trim())throw new Error(`Empty description for ${a.id}`);a.enabled!==!1&&c.push({id:a.id,description:a.description.trim()})}return c}d(Ae,"parseReviewRules");async function ge(r){let e=Ce.resolve(r,_);try{return Ae(await De(e,"utf8"))}catch(t){if(t.code==="ENOENT")return[];throw new Error(`Cannot load ${e}: ${t instanceof Error?t.message:String(t)}`,{cause:t})}}d(ge,"readReviewRules");import{createHash as _e}from"node:crypto";import{structuredPatch as Fe}from"diff";function pe(r,e){if(r===e)return[];if(r.length+e.length>3e5)throw new Error("File is too large for automatic review.");let t=Fe("before","after",r,e,void 0,void 0,{context:3,timeout:100});if(!t)throw new Error("Diff exceeded the automatic review time limit.");if(t.hunks.length>16)throw new Error("Change has too many fragments for automatic review (16 limit).");return t.hunks.map(i=>{let o=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@
|
|
3
3
|
${i.lines.join(`
|
|
4
4
|
`)}`;if(o.length>12e3)throw new Error("Fragment is too large for automatic review (12000 character limit).");return{diff:o}})}d(pe,"reviewFragments");function me(r,e=300){let t=new Map,i=!1,o=Promise.resolve(),c=d(s=>!i&&r.enabled()&&t.get(s.edit.file)===s&&!s.controller.signal.aborted,"valid"),a=d(async s=>c(s)&&await r.current(s.edit.file)===s.edit.after&&c(s),"fresh");async function n(s){if(!c(s))return;s.started=!0;let{edit:u}=s;try{let f=r.runtime();if(!f)return;let h=AbortSignal.any([s.controller.signal,AbortSignal.timeout(15e3)]),p=await f.available(h),g=p.find(m=>m.provider==="typesafe"&&/jev/i.test(m.id))??p.find(m=>/jev/i.test(m.id));if(!g||!c(s))return;let E=await r.rules(u.cwd);if(E.length===0||!await a(s))return;let ye=Object.fromEntries(E.map(m=>[m.id,{type:"choice",instructions:`Check whether this change violates the following project rule: ${m.description}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-FBR7ZLLN.js";import{a as R}from"./chunk-TSNY2FSU.js";import{a as v,b as S}from"./chunk-JHWLRL4U.js";import{b as y}from"./chunk-FTECKRK6.js";import"./chunk-PPCWY4BB.js";import{a as w,b as E,c as b}from"./chunk-V2D5MLGE.js";import"./chunk-5W6QQZFI.js";import{g as s}from"./chunk-KJAR2WDO.js";import{a as p,b as k,d as C}from"./chunk-6W4OJLCJ.js";import{c as g}from"./chunk-XHFAV2NI.js";import"./chunk-72FL5FHZ.js";import{c as u,l as h,m as P}from"./chunk-S3T5NOSL.js";import"./chunk-BXGMMZT3.js";import"./chunk-2YO6RVX4.js";import"./chunk-MLFJU2US.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import{a as c}from"./chunk-EI7MMDWY.js";import T from"node:path";function A(i){let l=v(i),U=R(i),d=new Map;return{async resolveProject(r,o){if(r.startsWith("ssh://")||o.startsWith("ssh://")){let e=i.resolve(r,o);if(!e)throw new s("UNSUPPORTED_SOURCE",r,"not-applied");let t=i.resolve(o);if(t&&t.location.target!==e.location.target)throw new s("UNSUPPORTED_SOURCE",r,"not-applied");return O(e.backend,e.location.path,t?.location.path,"formatters",p)}if(r.includes("://")||o.includes("://"))throw new s("UNSUPPORTED_SOURCE",r,"not-applied");let n=await u(o,r,"formatters",p);return n===void 0?void 0:{cwd:n,external:n!==T.resolve(o)}},async loadRegistry(r,o){let n=JSON.stringify([r,o]),e=d.get(n);if(!e){let t=i.resolve(r);e=k.fromDirectory(r,{includeGlobal:!o,requireBuiltInEvidence:!0,...t?{layerAccess:l,executableAvailability:c(a=>y(t.backend,t.location.path,a),"executableAvailability"),recipeEvidence:c(a=>S(t.backend,t.location.path,a),"recipeEvidence")}:{}}),d.set(n,e)}return e},async run(r,o,n){let e=i.resolve(n);if(!e){if(n.includes("://")||o.includes("://"))throw new s("UNSUPPORTED_SOURCE",n,"not-applied");return P(r,{projectRoot:o,filePath:n})}let t=await e.backend.read(e.location.path),a=await h(r.run,{projectRoot:o,filePath:n,processAccess:U}),m=await e.backend.read(e.location.path);if(!a.ok)return{ok:!1,changed:!m.bytes.equals(t.bytes)};if(r.output==="stdout"){if(m.version!==t.version)throw new s("CONFLICT",n,"not-applied");let f=Buffer.from(a.stdout);return f.equals(t.bytes)||await e.backend.write(e.location.path,f,t.version),{ok:!0,changed:!f.equals(t.bytes)}}return{ok:!0,changed:!m.bytes.equals(t.bytes)}}}}c(A,"createOwnedFormatterRuntime");async function F(i){let l=new b(await E(w(g())));await C(i,A(l))}c(F,"registerOwnedFormatter");export{A as createOwnedFormatterRuntime,F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as d,j as c}from"./chunk-
|
|
1
|
+
import{K as d,j as c}from"./chunk-SIYPD5MM.js";import{a as s}from"./chunk-EI7MMDWY.js";import{Type as e}from"typebox";var u=e.Object({startLine:e.Integer(),startColumn:e.Integer(),endLine:e.Integer(),endColumn:e.Integer()},{additionalProperties:!1}),m=e.Object({line:e.Optional(e.String()),match:e.Optional(e.String())},{additionalProperties:!1}),p={source:e.String(),target:e.Optional(e.String()),range:u,matchedText:e.Optional(e.String()),textTruncated:e.Optional(e.Boolean()),references:e.Optional(m)},f=e.Object({...p,captures:e.Optional(e.Record(e.String(),e.Array(e.Object(p,{additionalProperties:!1})))),role:e.Optional(e.Union([e.Literal("definition"),e.Literal("reference")])),symbol:e.Optional(e.Object({id:e.String(),name:e.String(),kind:e.String(),source:e.String(),range:u},{additionalProperties:!1}))},{additionalProperties:!1}),g={target:e.Optional(e.String()),kind:e.Literal("matches"),truncated:e.Optional(e.Boolean()),fullResult:e.Optional(e.String()),complete:e.Boolean(),matches:e.Array(f),all:e.Optional(m),notices:e.Optional(e.Array(e.String()))},O=e.Object({status:e.Union([e.Literal("ready"),e.Literal("skipped")]),message:e.Optional(e.String()),candidates:e.Array(e.Object({identifier:e.String(),kind:e.Union([e.Literal("normalized"),e.Literal("component"),e.Literal("typo")]),reason:e.String(),matchCount:e.Integer(),fileCount:e.Integer(),selection:e.Object(g,{additionalProperties:!1})},{additionalProperties:!1}))},{additionalProperties:!1}),S=e.Union([e.Object({...g,fuzzy:e.Optional(O)},{additionalProperties:!1}),e.Object({kind:e.Literal("files"),complete:e.Boolean(),files:e.Array(e.String())},{additionalProperties:!1}),e.Object({kind:e.Literal("custom"),resolverId:e.String(),value:e.Unknown()},{additionalProperties:!1})]),y=c(S);function x(o,l,r,i){return{kind:"matches",...i?.target===void 0?{}:{target:i.target},truncated:o.length>100,complete:l,matches:o.slice(0,100).map((n,a)=>({source:n.source,...i?.matchTargets?.[a]===void 0?{}:{target:i.matchTargets[a]},range:{startLine:n.lineNumber,startColumn:n.startColumn,endLine:n.endLineNumber??n.lineNumber,endColumn:n.endColumn},...Buffer.byteLength(n.matchedText)<=4096?{matchedText:n.matchedText}:{textTruncated:!0},...r===void 0?{}:{references:{line:`SEARCH#${r}:${a+1}:line`,match:`SEARCH#${r}:${a+1}:match`}}})),...l&&r!==void 0?{all:{line:`SEARCH#${r}:all:line`,match:`SEARCH#${r}:all:match`}}:{}}}s(x,"selectionData");import{Type as t}from"typebox";var j=t.Object({query:t.String({minLength:1,description:"Text to find or a Boolean expression. Quote text to keep it literal. Use regex:<pattern> for regular expressions."}),path:t.Optional(t.Union(d.anyOf,{description:"File, directory, URL (no read needed first), docs:all for all packaged guide bodies, docs:<id> for one guide, unchanged Read/Search/edit result, its UUID, or an array of such results. Use literal text or regex: for docs: sources. Results select only their registered ranges."})),include:t.Optional(t.String({description:"Optional include glob for local or SSH files"})),exclude:t.Optional(t.String({description:"Optional exclude glob for local or SSH files"})),caseSensitive:t.Optional(t.Boolean({description:"Match letter case"})),wholeWord:t.Optional(t.Boolean({description:"Match complete words"})),multiline:t.Optional(t.Boolean({description:"Let text or regex:<pattern> match across lines; . also matches line breaks. Local or SSH files and result scopes only."})),limit:t.Optional(t.Integer({minimum:1,maximum:1e3,description:"Maximum displayed items, including compact file summaries (default 50)."}))},{additionalProperties:!1});export{O as a,S as b,y as c,x as d,j as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as S,e as b}from"./chunk-
|
|
1
|
+
import{d as S,e as b}from"./chunk-HFCHOFLV.js";import{a as h}from"./chunk-EI7MMDWY.js";import z from"node:path";import{pathToFileURL as R}from"node:url";function x(e,n){let r=new Map;for(let t of e){let i=r.get(t.source)??[];i.push(t),r.set(t.source,i)}let a=new Set,u=e.length,s=[...r].sort(([t,i],[m,d])=>d.length-i.length||t.localeCompare(m));for(let[t,i]of s){if(u<=n)break;a.add(t),u-=i.length-1}let c=[],o=n,l=[...r].sort(([t],[i])=>Number(a.has(t))-Number(a.has(i))||t.localeCompare(i));for(let[t,i]of l){if(!a.has(t)){if(i.length>o)continue;c.push({kind:"detailed",source:t,matches:i}),o-=i.length;continue}if(o<1)continue;o--;let m=new Map;for(let f of i){let p=m.get(f.lineText);p===void 0?m.set(f.lineText,{matchCount:1,first:f}):p.matchCount++}let d=[...m].sort(([f,p],[T,w])=>w.matchCount-p.matchCount||f.localeCompare(T)).map(([f,p])=>({text:f,...p})),C=r.size===1?Math.min(o,d.length-1):0,N=d.slice(0,1+C);o-=C,c.push({kind:"compacted",source:t,matchCount:i.length,uniqueLineCount:m.size,groups:N})}return c.sort((t,i)=>t.source.localeCompare(i.source)),{files:c}}h(x,"planSearchPresentation");function L(e,n,r,a,u,s=50){let c=x(n,s),o=new Set(n.map(t=>t.source)).size,l=c.files.map(t=>t.kind==="detailed"?P(t.source,t.matches,a):{path:F(t.source,a),link:R(t.source).href,matchCount:t.matchCount,uniqueLineCount:t.uniqueLineCount,groups:t.groups.map(({text:i,matchCount:m})=>({text:i,matchCount:m})),lines:[]});return{...u!==void 0&&{sessionId:u},query:e,matchCount:n.length,fileCount:o,...c.files.length<o?{omittedFileCount:o-l.length,omittedMatchCount:n.length-l.reduce((t,i)=>t+i.matchCount,0)}:{},complete:r,files:l}}h(L,"createSearchToolDetails");function U(e,n){return{fileCount:new Set(e.flatMap(r=>r.matches.map(a=>a.source))).size,groups:e.map(r=>{let u=L(r.identifier,r.matches.slice(0,S.previewMatches),r.complete,n).files.map(s=>{let c=s.lines.map(o=>{let l=Math.max(0,(o.ranges[0]?.from??0)-64),t=Math.min(o.text.length,(o.ranges[0]?.to??0)+64),i=l>0?"\u2026":"",m=o.ranges.filter(d=>d.from>=l&&d.to<=t).map(d=>({from:d.from-l+i.length,to:d.to-l+i.length}));return{...o,text:i+o.text.slice(l,t)+(t<o.text.length?"\u2026":""),ranges:m,matchCount:m.length}});return{...s,lines:c,matchCount:c.reduce((o,l)=>o+l.matchCount,0)}});return{identifier:r.identifier,files:u}})}}h(U,"createFuzzyPresentation");function k(e){return g(e)&&y(e.fileCount)&&Array.isArray(e.groups)&&e.groups.every(n=>g(n)&&typeof n.identifier=="string"&&Array.isArray(n.files)&&n.files.every(M))}h(k,"isFuzzyPresentation");function W(e){if(!g(e)||typeof e.query!="string"||!y(e.matchCount)||!y(e.fileCount)||e.omittedFileCount!==void 0&&!y(e.omittedFileCount)||e.omittedMatchCount!==void 0&&!y(e.omittedMatchCount)||typeof e.complete!="boolean"||e.sessionId!==void 0&&typeof e.sessionId!="string"||e.fuzzy!==void 0&&!b(e.fuzzy)||e.fuzzyPresentation!==void 0&&!k(e.fuzzyPresentation)||!Array.isArray(e.files)||!e.files.every(M))return!1;let n=e.files;return e.fileCount===n.length+(e.omittedFileCount??0)&&e.matchCount===n.reduce((r,a)=>r+a.matchCount,0)+(e.omittedMatchCount??0)}h(W,"isSearchToolDetails");function P(e,n,r){let a=new Map;for(let s of n){let c=a.get(s.lineNumber);if(c!==void 0&&c.text!==s.lineText)throw new Error(`Search results disagree about line ${String(s.lineNumber)} in ${e}.`);let o=c??{lineNumber:s.lineNumber,text:s.lineText,ranges:[]};o.ranges.push({from:s.startColumn,to:s.endLineNumber===void 0?s.endColumn:s.lineText.length}),a.set(s.lineNumber,o)}let u=[...a.values()].sort((s,c)=>s.lineNumber-c.lineNumber).map(s=>{let c=[...s.ranges].sort((o,l)=>o.from-l.from||o.to-l.to);return{lineNumber:s.lineNumber,text:s.text,matchCount:c.length,ranges:c}});return{path:F(e,r),link:R(e).href,matchCount:n.length,lines:u}}h(P,"createSearchResultFile");function M(e){if(!g(e)||typeof e.path!="string"||typeof e.link!="string"||!y(e.matchCount)||!Array.isArray(e.lines)||!e.lines.every(A))return!1;let n=e.lines,r=e.groups,a=new Set(n.flatMap(u=>u.logicalMatchIds??[]));return(r===void 0||Array.isArray(r)&&r.every(u=>g(u)&&typeof u.text=="string"&&y(u.matchCount)))&&(e.uniqueLineCount===void 0||y(e.uniqueLineCount))&&(n.length===0||(a.size>0?a.size===e.matchCount:e.matchCount===n.reduce((u,s)=>u+s.matchCount,0)))}h(M,"isSearchResultFile");function A(e){return g(e)&&Number.isSafeInteger(e.lineNumber)&&e.lineNumber>=1&&typeof e.text=="string"&&y(e.matchCount)&&Array.isArray(e.ranges)&&e.ranges.length===e.matchCount&&(e.logicalMatchIds===void 0||Array.isArray(e.logicalMatchIds)&&e.logicalMatchIds.every(n=>typeof n=="string"))&&e.ranges.every(n=>I(n,e.text))}h(A,"isSearchResultLine");function I(e,n){return g(e)&&Number.isSafeInteger(e.from)&&Number.isSafeInteger(e.to)&&e.from>=0&&e.to>e.from&&e.to<=n.length}h(I,"isSearchResultRange");function g(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}h(g,"isRecord");function y(e){return Number.isSafeInteger(e)&&e>=0}h(y,"isCount");function F(e,n){if(e.includes("://"))return e;let r=z.relative(n,e);return r.length>0&&!r.startsWith("..")&&!z.isAbsolute(r)?r:e}h(F,"displaySource");export{x as a,L as b,U as c,W as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as u,c as w}from"./chunk-
|
|
1
|
+
import{a as d,b as u,c as w}from"./chunk-V2D5MLGE.js";import"./chunk-KJAR2WDO.js";import{b as f}from"./chunk-T5ACAOKJ.js";import"./chunk-EHFWODRT.js";import{c}from"./chunk-XHFAV2NI.js";import"./chunk-R2U5WXYR.js";import"./chunk-KN6VPARZ.js";import"./chunk-2YO6RVX4.js";import"./chunk-MLFJU2US.js";import"./chunk-YZTVC7ME.js";import"./chunk-VDSSAP6Y.js";import"./chunk-2DSY4U73.js";import"./chunk-H6FEBUAP.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-S7E2D5K7.js";import"./chunk-ZC65Z3CK.js";import{a as i}from"./chunk-EI7MMDWY.js";import{readFile as x}from"node:fs/promises";async function g(o){let n=new w(await u(d(c())));await f(o,m(o,n))}i(g,"registerOwnedGit");function m(o,n){return{exec:i(async(t,r,e)=>{let a=n.resolve(e.cwd);if(!a){if(/^[a-z][a-z0-9+.-]*:\/\//iu.test(e.cwd))throw new Error(`Unsupported Git resource: ${e.cwd}`);return o.exec(t,r,e)}let s=await a.backend.execute(t,r,a.location.path,e);return{code:s.exitCode,stdout:s.stdout.toString("utf8"),stderr:s.stderr.toString("utf8")}},"exec"),async writeIndex(t,r){let e=n.resolve(r.cwd);return e?(await e.backend.writeGitIndex(e.location.path,t,r),!0):!1},async readText(t,r){let e=n.resolve(t);if(e)return(await e.backend.read(e.location.path,{signal:r})).bytes.toString("utf8");if(/^[a-z][a-z0-9+.-]*:\/\//iu.test(t))throw new Error(`Unsupported Git resource: ${t}`);return x(t,{encoding:"utf8",signal:r})}}}i(m,"createOwnedGitExecutor");export{m as createOwnedGitExecutor,g as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p,c as y,d as w,e as g,f as b,g as l}from"./chunk-
|
|
1
|
+
import{a as p,c as y,d as w,e as g,f as b,g as l}from"./chunk-KJAR2WDO.js";import{a as c}from"./chunk-EI7MMDWY.js";import{spawn as v}from"node:child_process";import{PassThrough as S}from"node:stream";import{Type as r}from"typebox";import{Value as L}from"typebox/value";var I=r.Union([r.Object({kind:r.Literal("ready"),pid:r.Integer({minimum:1}),identity:r.Optional(r.String({pattern:"^[a-f0-9-]+:[0-9]+$"}))}),r.Object({kind:r.Literal("ack"),id:r.Integer({minimum:1})}),r.Object({kind:r.Union([r.Literal("stdout"),r.Literal("stderr")]),bytes:r.String({maxLength:32768})}),r.Object({kind:r.Literal("exit"),exitCode:r.Integer()}),r.Object({kind:r.Literal("error"),code:r.String({pattern:"^[A-Z][A-Z0-9_]*$"}),effect:r.Union([r.Literal("not-applied"),r.Literal("unknown")])})]);async function R(a,e,t,s,i={}){y(a),i.pty&&E(i.pty.cols,i.pty.rows);let d=p(a.id,s).source,n=i.timeoutMs??3e4;if(!Number.isFinite(n)||n<=0)throw new TypeError("SSH startup deadline must be positive");i.signal?.throwIfAborted();let o=await w(new URL("./ssh-channel-worker.py",new URL("../src/backend/ssh-channel.ts",import.meta.url).href));i.signal?.throwIfAborted();let u=JSON.stringify({command:e,args:t,cwd:s,...i.pty?{pty:i.pty}:{}});if(Buffer.byteLength(u)>48*1024*1024)throw new l("FRAME_LIMIT",d,"not-applied");let h=v("ssh",g(a,o),{stdio:"pipe"}),f=new m(h,d,i.pty!==void 0,i.signal),P=setTimeout(()=>f.cancel("TIMEOUT"),n);try{return await f.sendInitial(u),await f.ready,f}finally{clearTimeout(P)}}c(R,"startSshProcess");function E(a,e){if(![a,e].every(t=>Number.isSafeInteger(t)&&t>0&&t<=1e3))throw new TypeError("PTY dimensions must be integers between 1 and 1000")}c(E,"validateDimensions");var m=class{constructor(e,t,s,i){this.child=e;this.source=t;this.pty=s;this.ready=new Promise((n,o)=>{this.#c=n,this.#l=o}),this.completion=new Promise((n,o)=>{this.#u=n,this.#f=o}),this.ready.catch(()=>{}),this.completion.catch(()=>{}),e.stdout.on("data",n=>{this.#e=Buffer.concat([this.#e,n]),this.parse()}),e.stderr.on("data",n=>{this.#d.length<16384&&(this.#d+=n.toString())}),e.stdin.on("error",()=>{}),e.once("error",()=>{this.#i="DEPENDENCY_UNAVAILABLE"});let d=c(()=>this.cancel("CANCELLED"),"abort");i?.addEventListener("abort",d,{once:!0}),e.once("close",n=>{this.#r=!0,this.#S=n,clearTimeout(this.#E),i?.removeEventListener("abort",d);let o=this.#i??(n!==0?b(n,this.#d):this.#s===void 0?"TRANSPORT_FAILED":void 0);this.stdout.end(),this.stderr.end();let u=this.error(o??"INPUT_CLOSED");for(let h of this.#t.values())h.reject(u);if(this.#t.clear(),o){let h=this.error(o);this.#l(h),this.#f(h)}else this.#s!==void 0&&this.#u({exitCode:this.#s})});for(let n of[this.stdout,this.stderr]){let o=c(()=>{this.#n.delete(n),this.parse(),this.#n.size===0&&e.stdout.resume()},"resume");n.on("drain",o),n.on("close",o)}i?.aborted&&d()}static{c(this,"ProcessChannel")}stdout=new S({highWaterMark:65536});stderr=new S({highWaterMark:65536});completion;ready;#t=new Map;#n=new Set;#c;#l;#u;#f;#e=Buffer.alloc(0);#d="";#i;#m;#p=!1;#y=!1;#w=0;#g;#r=!1;#b=!1;#o=!1;#s;#S;#P=0;#a=0;#h=Promise.resolve();#E;get pid(){return this.#w}get identity(){return this.#g}async sendInitial(e){this.#p=!0,await this.sendLine(e)}async write(e){if(this.#r||this.#b||this.#o)throw this.error("INPUT_CLOSED");if(this.#a+e.length>1024*1024)throw this.error("INPUT_LIMIT");let t=Buffer.from(e);this.#a+=t.length;let s=this.#h.then(async()=>{for(let i=0;i<t.length;i+=16384){if(this.#o||this.#r)throw this.error("INPUT_CLOSED");await this.sendAcknowledged({kind:"input",bytes:t.subarray(i,i+16384).toString("base64")})}});this.#h=s.catch(()=>{});try{await s}finally{this.#a-=t.length}}async end(){if(this.pty)throw new l("PTY_INPUT_NOT_CLOSABLE",this.source,"not-applied");this.#b=!0,await this.#h,await this.send({kind:"end"})}async resize(e,t){if(!this.pty)throw new l("PTY_REQUIRED",this.source,"not-applied");E(e,t),await this.sendAcknowledged({kind:"resize",cols:e,rows:t})}stop(){return!this.#r&&!this.#o&&(this.#o=!0,this.send({kind:"stop"}).catch(()=>{}),this.#E=setTimeout(()=>{this.#i??="TRANSPORT_FAILED",this.child.kill("SIGKILL")},5e3),this.child.stdout.resume(),this.stdout.resume(),this.stderr.resume()),this.completion.catch(e=>{if(this.#i==="CANCELLED"&&this.#S===0&&this.#s!==void 0)return{exitCode:this.#s};throw e})}cancel(e){this.#r||(this.#i??=e,this.stop().catch(()=>{}))}error(e){let t=["HOST_KEY_FAILED","AUTH_FAILED","DEPENDENCY_UNAVAILABLE"].includes(e),s=this.#m??(!this.#p||t?"not-applied":"unknown");return new l(e,this.source,s)}async sendAcknowledged(e){let t=++this.#P,s=new Promise((i,d)=>{this.#t.set(t,{resolve:i,reject:d})});s.catch(()=>{});try{await this.send({...e,id:t}),await s}finally{this.#t.delete(t)}}async send(e){await this.sendLine(JSON.stringify(e))}sendLine(e){return this.#r?Promise.reject(this.error("INPUT_CLOSED")):new Promise((t,s)=>{this.child.stdin.write(`${e}
|
|
2
2
|
`,i=>{i?s(this.error("INPUT_CLOSED")):t()})})}parse(){for(;this.#n.size===0;){let e=this.#e.indexOf(10);if(e<0){this.#e.length>65536&&this.cancel("FRAME_LIMIT");return}if(e>65536){this.cancel("FRAME_LIMIT");return}let t=this.#e.subarray(0,e);this.#e=this.#e.subarray(e+1);let s;try{s=JSON.parse(t.toString("utf8"))}catch{this.cancel("INVALID_RESPONSE");return}if(!L.Check(I,s)){this.cancel("INVALID_RESPONSE");return}this.receive(s)}this.child.stdout.pause()}receive(e){if(e.kind==="ready"){if(this.#y){this.cancel("INVALID_RESPONSE");return}this.#y=!0,this.#w=e.pid,this.#g=e.identity,this.#c()}else if(e.kind==="ack"){let t=this.#t.get(e.id);if(!t){this.cancel("INVALID_RESPONSE");return}this.#t.delete(e.id),t.resolve()}else if(e.kind==="exit")this.#s=e.exitCode;else if(e.kind==="error")this.#i=e.code,this.#m=e.effect;else{let t=Buffer.from(e.bytes,"base64");if(t.toString("base64")!==e.bytes){this.cancel("INVALID_RESPONSE");return}let s=e.kind==="stdout"?this.stdout:this.stderr;!s.destroyed&&!s.write(t)&&this.#n.add(s)}}};export{R as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g,c as P,d as T}from"./chunk-B25LXXNV.js";import{b as C,c as k,g as R,i as E,k as F,m as d,n as x}from"./chunk-7D7PXIVV.js";import{a as w}from"./chunk-MDD5ORB6.js";import{b as y,c as h}from"./chunk-MLFJU2US.js";import{a as v}from"./chunk-ZAWRSA7N.js";import{a as b,b as j}from"./chunk-OFILFO6D.js";import{a as f}from"./chunk-EI7MMDWY.js";var A=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".html",".md",".yaml",".yml",".vue",".svelte"],z=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".less",".html",".htm",".md",".markdown",".mdx",".yaml",".yml",".toml"],p=[e("dart-format",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],[".dart"],["dart","format","{file}"],"https://dart.dev/tools/dart-format"),e("zig-format",["zig"],["zig"],["build.zig","build.zig.zon","zls.json"],[".zig",".zon"],["zig","fmt","{file}"],"https://ziglang.org/documentation/master/"),e("styler",["r"],["Rscript"],[".Rprofile","DESCRIPTION"],[".r"],["Rscript","-e","styler::style_file(commandArgs(TRUE)[1])","{file}"],"https://styler.r-lib.org/"),e("clang-format",["c","cpp"],["clang-format"],[".clang-format","_clang-format"],[".c",".h",".cc",".cpp",".cxx",".hh",".hpp",".hxx"],["clang-format","-i","{file}"],"https://clang.llvm.org/docs/ClangFormat.html"),e("prettier",["javascript","typescript","html","css","json","yaml","markdown","vue","svelte"],["prettier"],[".prettierrc",".prettierrc.json",".prettierrc.json5",".prettierrc.yaml",".prettierrc.yml",".prettierrc.toml",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs","prettier.config.js","prettier.config.cjs","prettier.config.mjs","prettier.config.ts","prettier.config.mts","prettier.config.cts"],A,["prettier","--write","{file}"],"https://prettier.io/docs/",["prettier"],{"package.json":["prettier"]}),e("biome",["javascript","typescript","json","css"],["biome"],["biome.json","biome.jsonc"],[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css"],["biome","format","--write","{file}"],"https://biomejs.dev/",["@biomejs/biome"]),e("oxfmt",["javascript","typescript","json","css","html","markdown","yaml","toml"],["oxfmt"],[".oxfmtrc.json",".oxfmtrc.jsonc","oxfmt.config.ts","oxfmt.config.mts"],z,["oxfmt","--write","{file}"],"https://oxc.rs/docs/guide/usage/formatter.html",["oxfmt"]),e("ruff-format",["python"],["ruff"],["ruff.toml",".ruff.toml"],[".py",".pyi"],["ruff","format","{file}"],"https://docs.astral.sh/ruff/formatter/",["ruff"],{"pyproject.toml":["tool.ruff"]}),e("black",["python"],["black"],[],[".py",".pyi"],["black","--quiet","{file}"],"https://black.readthedocs.io/",["black"],{"pyproject.toml":["tool.black"]}),e("gofmt",["go"],["gofmt"],["go.mod"],[".go"],["gofmt","-w","{file}"],"https://pkg.go.dev/cmd/gofmt"),e("goimports",["go"],["goimports"],["go.mod"],[".go"],["goimports","-w","{file}"],"https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),e("rustfmt",["rust"],["rustfmt"],["rustfmt.toml",".rustfmt.toml","Cargo.toml"],[".rs"],["rustfmt","{file}"],"https://github.com/rust-lang/rustfmt"),e("csharpier",["csharp"],["csharpier"],[".csharpierrc",".csharpierrc.json",".csharpierrc.yaml",".csharpierrc.yml"],[".cs"],["csharpier","format","{file}"],"https://csharpier.com/"),e("google-java-format",["java"],["google-java-format"],["pom.xml","build.gradle"],[".java"],["google-java-format","--replace","{file}"],"https://github.com/google/google-java-format"),e("ktlint-format",["kotlin"],["ktlint"],[".editorconfig","build.gradle.kts"],[".kt",".kts"],["ktlint","-F","{file}"],"https://pinterest.github.io/ktlint/"),e("rubocop-format",["ruby"],["rubocop"],[".rubocop.yml","Gemfile"],[".rb",".rake"],["rubocop","--fix-layout","{file}"],"https://docs.rubocop.org/"),e("pint",["php"],["pint"],["pint.json","composer.json"],[".php"],["pint","{file}"],"https://laravel.com/docs/pint"),e("swift-format",["swift"],["swift-format"],[".swift-format","Package.swift"],[".swift"],["swift-format","format","--in-place","{file}"],"https://github.com/swiftlang/swift-format"),e("stylua",["lua"],["stylua"],["stylua.toml",".stylua.toml"],[".lua"],["stylua","{file}"],"https://github.com/JohnnyMorganz/StyLua"),e("shfmt",["shell"],["shfmt"],[".editorconfig"],[".sh",".bash",".zsh"],["shfmt","-w","{file}"],"https://github.com/mvdan/sh"),e("taplo",["toml"],["taplo"],["taplo.toml"],[".toml"],["taplo","format","{file}"],"https://taplo.tamasfe.dev/"),e("sqlfluff-format",["sql"],["sqlfluff"],[".sqlfluff","pyproject.toml"],[".sql"],["sqlfluff","format","{file}"],"https://docs.sqlfluff.com/"),e("terraform-fmt",["terraform"],["terraform"],[".terraform.lock.hcl"],[".tf",".tfvars"],["terraform","fmt","{file}"],"https://developer.hashicorp.com/terraform/cli/commands/fmt"),e("cmake-format",["cmake"],["cmake-format"],[".cmake-format.py","CMakeLists.txt"],[".cmake"],["cmake-format","-i","{file}"],"https://cmake-format.readthedocs.io/",void 0,void 0,["CMakeLists.txt"]),e("xmlformat",["xml"],["xmlformat"],[".xmlformat.conf"],[".xml",".xsd",".xsl"],["xmlformat","--overwrite","{file}"],"https://github.com/pamoller/xmlformatter"),e("mix-format",["elixir"],["mix"],["mix.exs",".formatter.exs"],[".ex",".exs"],["mix","format","{file}"],"https://hexdocs.pm/mix/Mix.Tasks.Format.html"),e("scalafmt",["scala"],["scalafmt"],[".scalafmt.conf"],[".scala",".sc",".sbt"],["scalafmt","{file}"],"https://scalameta.org/scalafmt/"),e("julia-format",["julia"],["julia"],[".JuliaFormatter.toml","Project.toml"],[".jl"],["julia","--startup-file=no","--history-file=no","-e","using JuliaFormatter; format_file(ARGS[1])","{file}"],"https://github.com/domluna/JuliaFormatter.jl"),e("powershell-format",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],[".ps1",".psm1",".psd1"],["pwsh","-NoProfile","-NonInteractive","-CommandWithArgs",'$ErrorActionPreference="Stop";$p=$args[0];$options=@{};if(Test-Path -LiteralPath PSScriptAnalyzerSettings.psd1){$options.Settings="PSScriptAnalyzerSettings.psd1"};[IO.File]::WriteAllText($p,(Invoke-Formatter -ScriptDefinition ([IO.File]::ReadAllText($p)) @options))',"{file}"],"https://learn.microsoft.com/powershell/module/psscriptanalyzer/invoke-formatter"),e("dockfmt",["dockerfile"],["dockfmt"],["Dockerfile","Containerfile"],[".dockerfile"],["dockfmt","fmt","--write","{file}"],"https://github.com/jessfraz/dockfmt",void 0,void 0,["Dockerfile","Containerfile"])];function e(r,t,o,i,a,l,n,s,m,u){return{id:r,name:r,kind:"formatter",languages:t,executables:o,configFiles:i,documentation:n,...s&&{dependencies:s},...m&&{configSections:m},formatter:{extensions:a,...u&&{fileNames:u},run:{command:l},output:"in-place"}}}f(e,"recipe");var c=class r{constructor(t,o,i=new Map){this.formatters=t;this.availableBuiltIns=o;this.evidence=i}static{f(this,"FormatterCommandRegistry")}static async fromDirectory(t,o={}){let i=await R(t,"formatters",s=>x(s).formatters,o),{available:a,evidence:l}=await F(t,i.entries.filter(s=>s.layer==="built-in").map(s=>({id:s.id,config:s.config.run})),p,o),n=[...i.entries].sort((s,m)=>s.layer==="built-in"&&m.layer==="built-in"?(l.get(m.id)?.score??0)-(l.get(s.id)?.score??0):0);return new r(n,a,l)}static fromConfig(t){return new r(Object.entries(t.formatters).map(([o,i])=>({id:o,config:i,layer:"project",sourcePath:"<memory>"})),new Set)}resolve(t,o){return this.resolveEntry(t,o)?.config}resolveEntry(t,o){return E(this.formatters,this.availableBuiltIns,this.evidence,t,o)}get entries(){return this.formatters}};var I={protocol:y,apiVersion:h,id:"formatter",setup(r){for(let t of p)r.addToolRecipe(t);r.addSetupCheck({id:"effective-config",inspect:$}),r.addCheck({id:"config",title:"Formatter",async run(t){try{let o=await c.fromDirectory(t.cwd,g(t)),i=M(o,t.files,t.cwd);return i.length===0?[{status:"skip",message:"No formatter matches the inspected project files"}]:await Promise.all(i.map(async({entry:a,source:l})=>{let n=`${a.id} [${a.layer}] command ${JSON.stringify(a.config.run.command)}`;return T(t,l,async s=>{try{let m=t.workspace?await t.workspace.run(a.config.run,s,t.signal):await d(a.config,{projectRoot:t.cwd,filePath:s,env:t.env});return t.signal?.throwIfAborted(),m.ok?{status:"pass",message:`${n}: probe passed`,detail:a.sourcePath}:{status:"fail",message:`${n}: probe failed`,detail:a.sourcePath}}catch(m){return t.signal?.throwIfAborted(),{status:"fail",message:`${n}: ${m instanceof Error?m.message:String(m)}`,detail:a.sourcePath}}})}))}catch(o){return t.signal?.throwIfAborted(),[{status:"fail",message:o instanceof Error?o.message:String(o)}]}}})}};async function $(r){try{let t=await c.fromDirectory(r.cwd,g(r)),o=[],i=new Map;for(let[a,l]of r.detectedLanguages){let n=l.map(s=>t.resolveEntry(s,r.cwd)).find(s=>s!==void 0);n!==void 0&&(o.push({kind:"formatter",languageId:a,toolId:n.id}),await P(r,n.config.run)||i.set(n.id,{id:`formatter-${n.id}-unavailable`,message:`Configured formatter ${n.id} cannot run ${JSON.stringify(n.config.run.command)}`}))}return{selections:o,actions:[...i.values()]}}catch(t){return r.signal?.throwIfAborted(),{actions:[{id:"formatter-config-invalid",message:`Formatter configuration cannot load: ${t instanceof Error?t.message:String(t)}`}]}}}f($,"inspectFormatterSetup");function M(r,t,o){let i=new Map;for(let a of t){let l=r.resolveEntry(a,o);l!==void 0&&!i.has(l.id)&&i.set(l.id,{entry:l,source:a})}return[...i.values()]}f(M,"applicableFormatters");import _ from"node:path";var S=new Map;function D(r){return{kind:"formatter",name:"formatter",priority:100,extensions:["*"],detect:f(async t=>(r?await r.loadRegistry(t.cwd,!1):await O(t.cwd),!0),"detect"),async format({filePath:t},o){if(!r&&(t.includes("://")||o.cwd.includes("://")))throw Object.assign(new Error("Formatter requires its resource owner"),{code:"UNSUPPORTED_SOURCE"});let i=r?await r.resolveProject(t,o.cwd):await k(o.cwd,t,"formatters",p).then(m=>m===void 0?void 0:{cwd:m,external:m!==_.resolve(o.cwd)});if(i===void 0)return{ok:!0,edits:0,formatter:null};let a=i.cwd,n=(r?await r.loadRegistry(a,i.external):await O(a,i.external)).resolve(t,a);if(n===void 0)return{ok:!0,edits:0,formatter:null};let s=C(n.run.command);if(r){let m=await r.run(n,a,t);return{ok:m.ok,edits:m.changed?1:0,formatter:s}}try{let m=await d(n,{projectRoot:a,filePath:t});return{ok:m.ok,edits:m.changed?1:0,formatter:s}}catch{return{ok:!1,edits:0,formatter:s}}}}}f(D,"createFormatter");async function O(r,t=!1){let o=JSON.stringify([r,t]),i=S.get(o);return i===void 0&&(i=c.fromDirectory(r,{includeGlobal:!t,requireBuiltInEvidence:!0}),S.set(o,i)),i}f(O,"loadRegistry");async function q(r){await N(r)}f(q,"registerFormatter");async function N(r,t){let o=D(t),i={kind:"formatter",name:"pi-agent-ide-formatter",priority:200,extensions:["*"],detect:f(()=>Promise.resolve(!0),"detect"),async format(l,n){return o.format(l,n)}},a={protocol:b,apiVersion:5,id:"formatter",setup(l){l.addTool(i)}};await Promise.all([v(r,a),w(r,I)])}f(N,"registerFormatterWithOwner");export{p as a,c as b,q as c,N as d};
|
|
1
|
+
import{a as g,c as P,d as T}from"./chunk-72FL5FHZ.js";import{b as C,c as k,g as R,i as E,k as F,m as d,n as x}from"./chunk-S3T5NOSL.js";import{a as w}from"./chunk-2YO6RVX4.js";import{b as y,c as h}from"./chunk-MLFJU2US.js";import{a as v}from"./chunk-ZAWRSA7N.js";import{a as b,b as j}from"./chunk-OFILFO6D.js";import{a as f}from"./chunk-EI7MMDWY.js";var A=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".html",".md",".yaml",".yml",".vue",".svelte"],z=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".less",".html",".htm",".md",".markdown",".mdx",".yaml",".yml",".toml"],p=[e("dart-format",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],[".dart"],["dart","format","{file}"],"https://dart.dev/tools/dart-format"),e("zig-format",["zig"],["zig"],["build.zig","build.zig.zon","zls.json"],[".zig",".zon"],["zig","fmt","{file}"],"https://ziglang.org/documentation/master/"),e("styler",["r"],["Rscript"],[".Rprofile","DESCRIPTION"],[".r"],["Rscript","-e","styler::style_file(commandArgs(TRUE)[1])","{file}"],"https://styler.r-lib.org/"),e("clang-format",["c","cpp"],["clang-format"],[".clang-format","_clang-format"],[".c",".h",".cc",".cpp",".cxx",".hh",".hpp",".hxx"],["clang-format","-i","{file}"],"https://clang.llvm.org/docs/ClangFormat.html"),e("prettier",["javascript","typescript","html","css","json","yaml","markdown","vue","svelte"],["prettier"],[".prettierrc",".prettierrc.json",".prettierrc.json5",".prettierrc.yaml",".prettierrc.yml",".prettierrc.toml",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs","prettier.config.js","prettier.config.cjs","prettier.config.mjs","prettier.config.ts","prettier.config.mts","prettier.config.cts"],A,["prettier","--write","{file}"],"https://prettier.io/docs/",["prettier"],{"package.json":["prettier"]}),e("biome",["javascript","typescript","json","css"],["biome"],["biome.json","biome.jsonc"],[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css"],["biome","format","--write","{file}"],"https://biomejs.dev/",["@biomejs/biome"]),e("oxfmt",["javascript","typescript","json","css","html","markdown","yaml","toml"],["oxfmt"],[".oxfmtrc.json",".oxfmtrc.jsonc","oxfmt.config.ts","oxfmt.config.mts"],z,["oxfmt","--write","{file}"],"https://oxc.rs/docs/guide/usage/formatter.html",["oxfmt"]),e("ruff-format",["python"],["ruff"],["ruff.toml",".ruff.toml"],[".py",".pyi"],["ruff","format","{file}"],"https://docs.astral.sh/ruff/formatter/",["ruff"],{"pyproject.toml":["tool.ruff"]}),e("black",["python"],["black"],[],[".py",".pyi"],["black","--quiet","{file}"],"https://black.readthedocs.io/",["black"],{"pyproject.toml":["tool.black"]}),e("gofmt",["go"],["gofmt"],["go.mod"],[".go"],["gofmt","-w","{file}"],"https://pkg.go.dev/cmd/gofmt"),e("goimports",["go"],["goimports"],["go.mod"],[".go"],["goimports","-w","{file}"],"https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),e("rustfmt",["rust"],["rustfmt"],["rustfmt.toml",".rustfmt.toml","Cargo.toml"],[".rs"],["rustfmt","{file}"],"https://github.com/rust-lang/rustfmt"),e("csharpier",["csharp"],["csharpier"],[".csharpierrc",".csharpierrc.json",".csharpierrc.yaml",".csharpierrc.yml"],[".cs"],["csharpier","format","{file}"],"https://csharpier.com/"),e("google-java-format",["java"],["google-java-format"],["pom.xml","build.gradle"],[".java"],["google-java-format","--replace","{file}"],"https://github.com/google/google-java-format"),e("ktlint-format",["kotlin"],["ktlint"],[".editorconfig","build.gradle.kts"],[".kt",".kts"],["ktlint","-F","{file}"],"https://pinterest.github.io/ktlint/"),e("rubocop-format",["ruby"],["rubocop"],[".rubocop.yml","Gemfile"],[".rb",".rake"],["rubocop","--fix-layout","{file}"],"https://docs.rubocop.org/"),e("pint",["php"],["pint"],["pint.json","composer.json"],[".php"],["pint","{file}"],"https://laravel.com/docs/pint"),e("swift-format",["swift"],["swift-format"],[".swift-format","Package.swift"],[".swift"],["swift-format","format","--in-place","{file}"],"https://github.com/swiftlang/swift-format"),e("stylua",["lua"],["stylua"],["stylua.toml",".stylua.toml"],[".lua"],["stylua","{file}"],"https://github.com/JohnnyMorganz/StyLua"),e("shfmt",["shell"],["shfmt"],[".editorconfig"],[".sh",".bash",".zsh"],["shfmt","-w","{file}"],"https://github.com/mvdan/sh"),e("taplo",["toml"],["taplo"],["taplo.toml"],[".toml"],["taplo","format","{file}"],"https://taplo.tamasfe.dev/"),e("sqlfluff-format",["sql"],["sqlfluff"],[".sqlfluff","pyproject.toml"],[".sql"],["sqlfluff","format","{file}"],"https://docs.sqlfluff.com/"),e("terraform-fmt",["terraform"],["terraform"],[".terraform.lock.hcl"],[".tf",".tfvars"],["terraform","fmt","{file}"],"https://developer.hashicorp.com/terraform/cli/commands/fmt"),e("cmake-format",["cmake"],["cmake-format"],[".cmake-format.py","CMakeLists.txt"],[".cmake"],["cmake-format","-i","{file}"],"https://cmake-format.readthedocs.io/",void 0,void 0,["CMakeLists.txt"]),e("xmlformat",["xml"],["xmlformat"],[".xmlformat.conf"],[".xml",".xsd",".xsl"],["xmlformat","--overwrite","{file}"],"https://github.com/pamoller/xmlformatter"),e("mix-format",["elixir"],["mix"],["mix.exs",".formatter.exs"],[".ex",".exs"],["mix","format","{file}"],"https://hexdocs.pm/mix/Mix.Tasks.Format.html"),e("scalafmt",["scala"],["scalafmt"],[".scalafmt.conf"],[".scala",".sc",".sbt"],["scalafmt","{file}"],"https://scalameta.org/scalafmt/"),e("julia-format",["julia"],["julia"],[".JuliaFormatter.toml","Project.toml"],[".jl"],["julia","--startup-file=no","--history-file=no","-e","using JuliaFormatter; format_file(ARGS[1])","{file}"],"https://github.com/domluna/JuliaFormatter.jl"),e("powershell-format",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],[".ps1",".psm1",".psd1"],["pwsh","-NoProfile","-NonInteractive","-CommandWithArgs",'$ErrorActionPreference="Stop";$p=$args[0];$options=@{};if(Test-Path -LiteralPath PSScriptAnalyzerSettings.psd1){$options.Settings="PSScriptAnalyzerSettings.psd1"};[IO.File]::WriteAllText($p,(Invoke-Formatter -ScriptDefinition ([IO.File]::ReadAllText($p)) @options))',"{file}"],"https://learn.microsoft.com/powershell/module/psscriptanalyzer/invoke-formatter"),e("dockfmt",["dockerfile"],["dockfmt"],["Dockerfile","Containerfile"],[".dockerfile"],["dockfmt","fmt","--write","{file}"],"https://github.com/jessfraz/dockfmt",void 0,void 0,["Dockerfile","Containerfile"])];function e(r,t,o,i,a,l,n,s,m,u){return{id:r,name:r,kind:"formatter",languages:t,executables:o,configFiles:i,documentation:n,...s&&{dependencies:s},...m&&{configSections:m},formatter:{extensions:a,...u&&{fileNames:u},run:{command:l},output:"in-place"}}}f(e,"recipe");var c=class r{constructor(t,o,i=new Map){this.formatters=t;this.availableBuiltIns=o;this.evidence=i}static{f(this,"FormatterCommandRegistry")}static async fromDirectory(t,o={}){let i=await R(t,"formatters",s=>x(s).formatters,o),{available:a,evidence:l}=await F(t,i.entries.filter(s=>s.layer==="built-in").map(s=>({id:s.id,config:s.config.run})),p,o),n=[...i.entries].sort((s,m)=>s.layer==="built-in"&&m.layer==="built-in"?(l.get(m.id)?.score??0)-(l.get(s.id)?.score??0):0);return new r(n,a,l)}static fromConfig(t){return new r(Object.entries(t.formatters).map(([o,i])=>({id:o,config:i,layer:"project",sourcePath:"<memory>"})),new Set)}resolve(t,o){return this.resolveEntry(t,o)?.config}resolveEntry(t,o){return E(this.formatters,this.availableBuiltIns,this.evidence,t,o)}get entries(){return this.formatters}};var I={protocol:y,apiVersion:h,id:"formatter",setup(r){for(let t of p)r.addToolRecipe(t);r.addSetupCheck({id:"effective-config",inspect:$}),r.addCheck({id:"config",title:"Formatter",async run(t){try{let o=await c.fromDirectory(t.cwd,g(t)),i=M(o,t.files,t.cwd);return i.length===0?[{status:"skip",message:"No formatter matches the inspected project files"}]:await Promise.all(i.map(async({entry:a,source:l})=>{let n=`${a.id} [${a.layer}] command ${JSON.stringify(a.config.run.command)}`;return T(t,l,async s=>{try{let m=t.workspace?await t.workspace.run(a.config.run,s,t.signal):await d(a.config,{projectRoot:t.cwd,filePath:s,env:t.env});return t.signal?.throwIfAborted(),m.ok?{status:"pass",message:`${n}: probe passed`,detail:a.sourcePath}:{status:"fail",message:`${n}: probe failed`,detail:a.sourcePath}}catch(m){return t.signal?.throwIfAborted(),{status:"fail",message:`${n}: ${m instanceof Error?m.message:String(m)}`,detail:a.sourcePath}}})}))}catch(o){return t.signal?.throwIfAborted(),[{status:"fail",message:o instanceof Error?o.message:String(o)}]}}})}};async function $(r){try{let t=await c.fromDirectory(r.cwd,g(r)),o=[],i=new Map;for(let[a,l]of r.detectedLanguages){let n=l.map(s=>t.resolveEntry(s,r.cwd)).find(s=>s!==void 0);n!==void 0&&(o.push({kind:"formatter",languageId:a,toolId:n.id}),await P(r,n.config.run)||i.set(n.id,{id:`formatter-${n.id}-unavailable`,message:`Configured formatter ${n.id} cannot run ${JSON.stringify(n.config.run.command)}`}))}return{selections:o,actions:[...i.values()]}}catch(t){return r.signal?.throwIfAborted(),{actions:[{id:"formatter-config-invalid",message:`Formatter configuration cannot load: ${t instanceof Error?t.message:String(t)}`}]}}}f($,"inspectFormatterSetup");function M(r,t,o){let i=new Map;for(let a of t){let l=r.resolveEntry(a,o);l!==void 0&&!i.has(l.id)&&i.set(l.id,{entry:l,source:a})}return[...i.values()]}f(M,"applicableFormatters");import _ from"node:path";var S=new Map;function D(r){return{kind:"formatter",name:"formatter",priority:100,extensions:["*"],detect:f(async t=>(r?await r.loadRegistry(t.cwd,!1):await O(t.cwd),!0),"detect"),async format({filePath:t},o){if(!r&&(t.includes("://")||o.cwd.includes("://")))throw Object.assign(new Error("Formatter requires its resource owner"),{code:"UNSUPPORTED_SOURCE"});let i=r?await r.resolveProject(t,o.cwd):await k(o.cwd,t,"formatters",p).then(m=>m===void 0?void 0:{cwd:m,external:m!==_.resolve(o.cwd)});if(i===void 0)return{ok:!0,edits:0,formatter:null};let a=i.cwd,n=(r?await r.loadRegistry(a,i.external):await O(a,i.external)).resolve(t,a);if(n===void 0)return{ok:!0,edits:0,formatter:null};let s=C(n.run.command);if(r){let m=await r.run(n,a,t);return{ok:m.ok,edits:m.changed?1:0,formatter:s}}try{let m=await d(n,{projectRoot:a,filePath:t});return{ok:m.ok,edits:m.changed?1:0,formatter:s}}catch{return{ok:!1,edits:0,formatter:s}}}}}f(D,"createFormatter");async function O(r,t=!1){let o=JSON.stringify([r,t]),i=S.get(o);return i===void 0&&(i=c.fromDirectory(r,{includeGlobal:!t,requireBuiltInEvidence:!0}),S.set(o,i)),i}f(O,"loadRegistry");async function q(r){await N(r)}f(q,"registerFormatter");async function N(r,t){let o=D(t),i={kind:"formatter",name:"pi-agent-ide-formatter",priority:200,extensions:["*"],detect:f(()=>Promise.resolve(!0),"detect"),async format(l,n){return o.format(l,n)}},a={protocol:b,apiVersion:5,id:"formatter",setup(l){l.addTool(i)}};await Promise.all([v(r,a),w(r,I)])}f(N,"registerFormatterWithOwner");export{p as a,c as b,q as c,N as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b}from"./chunk-FBR7ZLLN.js";import{a as y}from"./chunk-HSEDKYH4.js";import{a as k,b as E}from"./chunk-JHWLRL4U.js";import"./chunk-KX7MG72M.js";import{b as S}from"./chunk-FTECKRK6.js";import{a as u,b as w,c as v}from"./chunk-V2D5MLGE.js";import{g as c}from"./chunk-KJAR2WDO.js";import{a as p,b as h,d as P}from"./chunk-BMSAVDRD.js";import{c as f}from"./chunk-XHFAV2NI.js";import"./chunk-72FL5FHZ.js";import{c as m}from"./chunk-S3T5NOSL.js";import"./chunk-BXGMMZT3.js";import"./chunk-JXULBI4S.js";import"./chunk-HFCHOFLV.js";import"./chunk-5AROEOJB.js";import"./chunk-47SPPIXK.js";import"./chunk-VAXLSPPU.js";import"./chunk-2YO6RVX4.js";import"./chunk-MLFJU2US.js";import"./chunk-PS2B6THP.js";import"./chunk-YZTVC7ME.js";import"./chunk-VDSSAP6Y.js";import"./chunk-2DSY4U73.js";import"./chunk-H6FEBUAP.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-YNOR4LIE.js";import"./chunk-JMQ67UNK.js";import"./chunk-T4FTT3U4.js";import"./chunk-S7E2D5K7.js";import"./chunk-ZC65Z3CK.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import"./chunk-KINKBPPX.js";import{a as i}from"./chunk-EI7MMDWY.js";import R from"node:path";function g(d){let n=i(o=>{let e=d.resolve(o);if(!e)throw new c("UNSUPPORTED_SOURCE",o,"not-applied");return e},"resolve");return{transport:i(o=>y(d,o),"transport"),async readText(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes.toString("utf8")},async readSnapshot(o,e){let r=n(o),t=await r.backend.read(r.location.path,{signal:e});return{content:t.bytes.toString("utf8"),version:t.version}},async readBytes(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes},async exists(o,e){let r=n(o);try{return await r.backend.stat(r.location.path,{signal:e}),!0}catch(t){if(t instanceof c&&t.code==="ENOENT")return!1;throw t}},async isFile(o,e){let r=n(o);return(await r.backend.stat(r.location.path,{signal:e})).kind==="file"},async entries(o,e){let r=n(o);return(await r.backend.list(r.location.path,{signal:e})).map(t=>({name:t.name,kind:t.kind==="symlink"?"other":t.kind}))}}}i(g,"createSshLspWorkspaceOwner");async function O(d){let n=new v(await w(u(f()))),o=g(n);await P(d,{workspace:i(e=>e.startsWith("ssh://")?o:void 0,"workspace"),async loadRegistry(e,r,t){t?.throwIfAborted();let s=n.resolve(e);if(s)return h.fromPackageDir(e,{signal:t,layerAccess:k(n,t),includeGlobal:!r,requireBuiltInEvidence:r,recipes:p,recipeEvidence:i(a=>E(s.backend,s.location.path,a,t),"recipeEvidence"),executableAvailability:i(a=>S(s.backend,s.location.path,a,t),"executableAvailability")});if(e.includes("://"))throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return h.fromPackageDir(r?e:process.env.PI_AGENT_IDE_CONFIG_DIR??e,{signal:t,includeGlobal:!r,requireBuiltInEvidence:r,recipes:p})},async resolveProject(e,r,t){if(t?.throwIfAborted(),e.startsWith("ssh://")||r.startsWith("ssh://")){let a=n.resolve(e,r);if(!a)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");let l=n.resolve(r);if(l&&l.location.target!==a.location.target)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return b(a.backend,a.location.path,l?.location.path,"lsp-servers",p,t)}let s=await m(r,e,"lsp-servers",p,t);return s===void 0?void 0:{cwd:s,external:s!==R.resolve(r)}}})}i(O,"registerOwnedLsp");export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./chunk-
|
|
1
|
+
import{j as s}from"./chunk-S3T5NOSL.js";import{a as i}from"./chunk-EI7MMDWY.js";import{copyFile as c,mkdtemp as l,rm as p}from"node:fs/promises";import a from"node:path";function d(o){let e=o.workspace;return{environment:o.env,signal:o.signal,...e?{layerAccess:{paths:i((r,t,n)=>e.configPaths(t,n),"paths"),async readText(r,t){let n=await e.readText(r,t);if(n===void 0)throw Object.assign(new Error(`ENOENT: ${r}`),{code:"ENOENT"});return n}},executableAvailability:i((r,t)=>e.executableAvailability(r,t),"executableAvailability"),recipeEvidence:i((r,t)=>e.evidence(r,t),"recipeEvidence")}:{}}}i(d,"doctorRuntimeOptions");function f(o){let e=o.workspace;return e?{run:i((r,t)=>e.run(r,t.filePath,t.signal),"run")}:void 0}i(f,"doctorProcessAccess");async function u(o,e){if(o.signal?.throwIfAborted(),!o.workspace)return s(e,o.cwd,o.env,o.signal);let r=await o.workspace.executableAvailability([e],o.signal);if(o.signal?.throwIfAborted(),r.length!==1||typeof r[0]!="boolean")throw new TypeError("Invalid Doctor executable availability report");return r[0]}i(u,"doctorExecutableAvailable");async function w(o,e,r){if(o.signal?.throwIfAborted(),o.workspace)return o.workspace.withProbeCopy(e,r,o.signal);if(e.includes("://"))throw Object.assign(new Error(`Doctor requires the owner of ${e}`),{code:"UNSUPPORTED_SOURCE"});let t=await l(a.join(a.dirname(e),".pi-agent-ide-doctor-")),n=a.join(t,a.basename(e));try{return await c(e,n),o.signal?.throwIfAborted(),await r(n)}finally{await p(t,{recursive:!0,force:!0})}}i(w,"withDoctorProbeCopy");export{d as a,f as b,u as c,w as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as g,c as y,d as _,e as C,g as k}from"./chunk-
|
|
1
|
+
import{b as g,c as y,d as _,e as C,g as k}from"./chunk-JYITLCXC.js";import{a as i}from"./chunk-EI7MMDWY.js";import{truncateToWidth as N,wrapTextWithAnsi as L}from"@earendil-works/pi-tui";var x="PI AGENT IDE",U=/\/[a-z][\w-]*/giu,m=class{constructor(t,n){this.tip=t;this.theme=n}static{i(this,"TipCallout")}cached;render(t){if(this.cached?.width===t)return this.cached.lines;let n=$(this.tip,this.theme,t);return this.cached={width:t,lines:n},n}invalidate(){this.cached=void 0}};function $(e,t,n){if(n<=0)return[];if(n<=2)return[t.fg("accent",n===1?"\u2502":"\u2502 ")];let s=n-2,r=t.fg("accent",t.bold(x))+t.fg("dim"," \xB7 ")+t.bold(e.title),o=e.body.split(`
|
|
2
2
|
`).map(c=>c.length===0?"":z(c,t)),d=[r,...o].flatMap(c=>M(c,s)),a=t.fg("accent","\u2502");return d.map(c=>N(`${a} ${c}`,n))}i($,"renderTip");function M(e,t){return e.length===0?[""]:L(e,t)}i(M,"wrapLine");function z(e,t){let n="",s=0;for(let r of e.matchAll(U)){let o=r.index;n+=t.fg("muted",e.slice(s,o)),n+=t.fg("accent",t.bold(r[0])),s=o+r[0].length}return n+t.fg("muted",e.slice(s))}i(z,"styleBodyLine");var h=class{static{i(this,"TipCore")}providers=new Map;registerProvider(t){if(!/^[a-z0-9][a-z0-9.-]*$/u.test(t.id))return Promise.reject(new Error(`Invalid tip provider ID: ${t.id}`));let n=this.providers.get(t.id);return n!==void 0?n===t?Promise.resolve():Promise.reject(new Error(`Tip provider ${t.id} is already registered`)):(this.providers.set(t.id,t),Promise.resolve())}get isEmpty(){return this.providers.size===0}async collectTips(t){let n=[];for(let s of this.providers.values()){if(t.signal?.aborted)break;try{let r=await V(s,t);r!==void 0&&Y(r)&&n.push({providerId:s.id,tip:r})}catch{}}return n}};async function V(e,t){let n=t.signal;if(n===void 0)return e.getTip(t);if(n.aborted)return;let s=i(()=>{},"abort"),r=new Promise(o=>{s=i(()=>o(void 0),"abort"),n.addEventListener("abort",s,{once:!0})});try{return await Promise.race([e.getTip(t),r])}finally{n.removeEventListener("abort",s)}}i(V,"collectTip");function Y(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.id=="string"&&/^[a-z0-9][a-z0-9.-]*$/u.test(t.id)&&typeof t.title=="string"&&t.title.trim().length>0&&typeof t.body=="string"&&t.body.trim().length>0&&(t.scope===void 0||t.scope==="project"||t.scope==="global")}i(Y,"isTip");import{randomUUID as F}from"node:crypto";import{mkdir as I,readFile as G,rename as H,rm as S,stat as J,writeFile as K}from"node:fs/promises";import{setTimeout as W}from"node:timers/promises";import{homedir as B}from"node:os";import f from"node:path";var O=1,Q=10,X=5e3,q=6e4,p=Promise.resolve();function Z(e=process.env){let t=e.PI_CODING_AGENT_DIR??f.join(B(),".pi","agent");return f.join(t,"pi-agent-ide","tips.json")}i(Z,"resolveTipStatePath");var P=class{constructor(t=Z()){this.statePath=t}static{i(this,"TipStateStore")}async shownFor(t){let n=await T(this.statePath);return new Set(w(n,t))}async claimIfUnseen(t,n,s){let r=p.then(async()=>{try{return await v(this.statePath,async()=>{let o=await T(this.statePath),d=new Set(w(o,t));return d.has(n)||s!==void 0&&d.has(s)?!1:(d.add(n),await E(this.statePath,b(o,t,[...d])),!0)})}catch{return!0}});return p=r.then(()=>{},()=>{}),r}async markShown(t,n){if(n.length===0)return;p=p.then(async()=>{await v(this.statePath,async()=>{let r=await T(this.statePath),o=new Set(w(r,t));for(let d of n)o.add(d);await E(this.statePath,b(r,t,[...o]))})}).catch(()=>{}),await p}async unmarkShown(t,n){p=p.then(async()=>{try{await v(this.statePath,async()=>{let r=await T(this.statePath),o=new Set(w(r,t));o.delete(n)&&await E(this.statePath,b(r,t,[...o]))})}catch{}}).catch(()=>{}),await p}};function w(e,t){return t===void 0?e.global??[]:e.projects[t]??[]}i(w,"shownIds");function b(e,t,n){return t===void 0?{...e,global:n}:{...e,projects:{...e.projects,[t]:n}}}i(b,"withShown");function j(e){return f.resolve(e)}i(j,"normalizeProjectPath");async function T(e){try{let t=JSON.parse(await G(e,"utf8"));return et(t)?t:R()}catch{return R()}}i(T,"readState");async function v(e,t){let n=`${e}.lock`;await I(f.dirname(e),{recursive:!0});let s=Date.now();for(;;)try{await I(n);break}catch(r){if(tt(r)!=="EEXIST")throw r;try{if(Date.now()-(await J(n)).mtimeMs>q){await S(n,{recursive:!0,force:!0});continue}}catch{}if(Date.now()-s>=X)throw new Error(`Timed out waiting for startup-tip state lock: ${n}`,{cause:r});await W(Q)}try{return await t()}finally{await S(n,{recursive:!0,force:!0})}}i(v,"withStateLock");function tt(e){return typeof e=="object"&&e!==null&&"code"in e?String(e.code):void 0}i(tt,"errorCode");async function E(e,t){try{await I(f.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.${F()}.tmp`;try{await K(n,`${JSON.stringify(t,null,2)}
|
|
3
3
|
`,"utf8"),await H(n,e)}finally{await S(n,{force:!0})}}catch{}}i(E,"writeState");function R(){return{version:O,projects:{}}}i(R,"emptyState");function et(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version!==O||typeof t.projects!="object"||t.projects===null||Array.isArray(t.projects)||t.global!==void 0&&(!Array.isArray(t.global)||!t.global.every(n=>typeof n=="string"))?!1:Object.values(t.projects).every(n=>Array.isArray(n)&&n.every(s=>typeof s=="string"))}i(et,"isState");function D(e){return{protocol:g,apiVersion:y,id:"agent-setup",getTip(t){if(!(t.mode!=="tui"||!t.hasUI||!e()))return{id:"agent-setup-v1",scope:"global",title:"Agent-assisted setup",body:`You can ask your agent to configure Pi Agent IDE.
|
|
4
4
|
Try: \u201CHelp me configure Pi Agent IDE for this project.\u201D
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-NNCZYO4Q.js";import{d as k}from"./chunk-
|
|
1
|
+
import"./chunk-NNCZYO4Q.js";import{d as k}from"./chunk-LY2UANKU.js";import"./chunk-PS2B6THP.js";import{d as y}from"./chunk-QGXZ4RWX.js";import"./chunk-VDSSAP6Y.js";import{a as P}from"./chunk-2DSY4U73.js";import{a as h,b as w}from"./chunk-H6FEBUAP.js";import"./chunk-SIYPD5MM.js";import{a as I,b as v,c as C,d as A,e as E,h as b}from"./chunk-JMQ67UNK.js";import"./chunk-T4FTT3U4.js";import"./chunk-S7E2D5K7.js";import"./chunk-ZC65Z3CK.js";import{a as T}from"./chunk-ZAWRSA7N.js";import{a as N,b as O}from"./chunk-OFILFO6D.js";import"./chunk-KINKBPPX.js";import{a as l}from"./chunk-EI7MMDWY.js";import W from"node:path";var S="diagnostics",_=k({kind:"code-view",label:"Diagnostics"});async function q(c){let n,t=l((a,f,e)=>{if(n===void 0)throw new Error("IDE diagnostics are not connected");return n(a,{cwd:f,...e})},"collect"),s={protocol:N,apiVersion:5,id:"diagnostics",setup(a){n=a.readDiagnostics}},r=new WeakMap,i=new WeakMap,o=new WeakMap,u=new WeakMap,M={protocol:h,apiVersion:w,id:"diagnostics",setup(a){a.addResolver({resolver:H(t,i),renderResult:_});let f=b();a.addView({view:"diagnostics",priority:100,presenter:j(t,u)}),a.addHandler({stage:"read",when:{resolvedBy:"any",contentKind:"text"},handler(e){if(e.state?.resolvedBy==="diagnostics"){let p=e.state.content[0],g=i.get(p);return g&&r.set(e.request,g),f(e)}return e.state?.contentKind==="text"&&e.request.views?.includes("diagnostics")&&o.set(e.request,e.state.text),{kind:"continue",context:e}}}),a.addHandler({stage:"post-read",handler(e){let p=r.get(e.request);if(p&&e.result)return{kind:"continue",context:e,transform:l(d=>({...d,details:{...d.details,diagnosticCheck:p}}),"transform")};let g=o.get(e.request),R=g&&u.get(g),m=e.result,V=m?.content[0];return!R||!m||V?.type!=="text"?{kind:"continue",context:e}:{kind:"continue",context:e,transform(d){let D=d.content[0];return D?.type!=="text"?d:{...d,content:[{...D,text:`${R}
|
|
2
2
|
${D.text}`},...d.content.slice(1)],details:{...d.details,diagnosticStatus:R}}}}}}),a.describe({path:"diagnostics:<path> \u2014 lint and language-server diagnostics.",views:"diagnostics \u2014 diagnostics beside the text."})}};await Promise.all([T(c,s),P(c,M)])}l(q,"registerDiagnostics");function H(c,n){return{id:"diagnostics",tryResolve(t,s){return Promise.resolve(L(t,s.cwd,c,n,{signal:s.signal,...s.audience==="script"&&{mode:"complete"}}))}}}l(H,"createDiagnosticResolver");function L(c,n,t,s,r){let i;try{i=I(c,S,n)}catch(o){return{kind:"failed",error:o}}return i===void 0?{kind:"not-handled"}:{kind:"resolved",resource:{source:v(S,i),async read(){let o=await t(i,n,r),u=C(i,o.content,o.results);return s.set(u,u.diagnosticCheck),[u]}}}}l(L,"resolveDiagnosticSource");function j(c,n){return{id:"diagnostics",async present(t,s){if(s.purpose!=="read"||!W.isAbsolute(t.source)&&!t.source.startsWith("ssh://"))return t;let r=s.audience==="script"&&!s.requestedViews?.includes("diagnostics");if(r&&y(t.source))return t;let i=await c(t.source,s.cwd,{signal:s.signal,...s.audience==="script"&&{mode:r?"snapshot":"complete"}}).catch(o=>{if(s.signal?.throwIfAborted(),!r)throw o});if(i===void 0||r&&i.content!==t.content)return t;if(i.content!==t.content)throw new Error("File changed during diagnostic read; read it again for current source lines.");return n.set(t,E(i.results)),A(t,i.results)}}}l(j,"createDiagnosticPresenter");export{q as default};
|