pi-agent-ide 0.2.2 → 0.4.0
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 +46 -0
- package/README.md +13 -8
- package/dist/chunk-3SE372WC.js +3 -0
- package/dist/chunk-5MSNYFDE.js +1 -0
- package/dist/chunk-5VSE5X5R.js +2 -0
- package/dist/chunk-6DZA4CLO.js +4 -0
- package/dist/chunk-6EYWFBNG.js +0 -0
- package/dist/{chunk-ORAPGW7W.js → chunk-72EEL2DW.js} +1 -1
- package/dist/chunk-7JYQMAEL.js +14 -0
- package/dist/{chunk-T2RPMEM2.js → chunk-7UGNGK7Y.js} +1 -1
- package/dist/{chunk-STUZZM5B.js → chunk-AADJ2KIB.js} +1 -1
- package/dist/{chunk-XF5PVZOS.js → chunk-B5KB2I7J.js} +1 -1
- package/dist/chunk-DQF5QMJ2.js +1 -0
- package/dist/chunk-EJ5OACQM.js +1 -0
- package/dist/chunk-GFW5QPQV.js +2 -0
- package/dist/{chunk-LQYZG62K.js → chunk-GUTQ3PWL.js} +1 -1
- package/dist/chunk-HGPUI7F3.js +1 -0
- package/dist/{chunk-OBWZ5RYN.js → chunk-HKMBQLEK.js} +1 -1
- package/dist/chunk-ITSNK5YG.js +7 -0
- package/dist/chunk-J34VKQGJ.js +1 -0
- package/dist/chunk-KAB3AYA2.js +1 -0
- package/dist/{chunk-76WHES5H.js → chunk-M5L42DWE.js} +5 -5
- package/dist/chunk-M5MJP7Z2.js +1 -0
- package/dist/chunk-NMFQGKPE.js +2 -0
- package/dist/chunk-NTYXZ3EL.js +3 -0
- package/dist/{chunk-P6T3Q7LB.js → chunk-QDST6VIU.js} +1 -1
- package/dist/chunk-ROXXK6TW.js +0 -0
- package/dist/{chunk-WNMGUALD.js → chunk-TI5GMJ7Q.js} +1 -1
- package/dist/{chunk-4ZTEPMJO.js → chunk-TPIHQYK2.js} +1 -1
- package/dist/chunk-XSTHESNR.js +25 -0
- package/dist/{chunk-THSCUT2L.js → chunk-Y7ZMR4LT.js} +1 -1
- package/dist/chunk-YHADTHQM.js +1 -0
- package/dist/{chunk-KZBAJFCV.js → chunk-Z3VC3S2T.js} +1 -1
- package/dist/{chunk-ZXN3TWWW.js → chunk-ZM4L5AGN.js} +1 -1
- package/dist/{chunk-E2RESHYR.js → chunk-ZTYWHL2F.js} +1 -1
- package/dist/entry-0.js +1 -1
- package/dist/entry-1.js +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-21.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +10 -5
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-31.js +3 -3
- package/dist/entry-32.js +6 -5
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +12 -8
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +4 -4
- package/dist/entry-46.js +10 -10
- package/dist/entry-47.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-54.js +1 -0
- package/dist/entry-55.js +0 -1
- package/dist/entry-56.js +1 -0
- package/dist/entry-57.js +0 -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 -0
- package/dist/entry-64.js +0 -1
- package/dist/entry-65.js +1 -0
- package/dist/entry-66.js +0 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -59
- package/dist/entry-70.js +123 -4
- package/dist/entry-71.js +30 -1
- package/dist/entry-72.js +2 -29
- package/dist/entry-73.js +1 -2
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +3 -1
- package/dist/entry-77.js +1 -3
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/pi-agent-ide.js +3 -2
- package/docs/configuration.md +32 -11
- package/docs/tools.md +17 -0
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-filesystem/package.json +6 -6
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- 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/package.json +9 -9
- package/node_modules/pi-agent-ide-ast/src/extension.ts +4 -3
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +68 -45
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/node_modules/pi-agent-ide-changes/index.ts +21 -5
- package/node_modules/pi-agent-ide-changes/package.json +6 -6
- package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +4 -2
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +26 -8
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/index.ts +46 -17
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lint/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-lsp/index.ts +126 -8
- package/node_modules/pi-agent-ide-lsp/package.json +9 -8
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +18 -3
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +4 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/node_modules/pi-agent-image/package.json +2 -2
- 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-read/package.json +6 -6
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/node_modules/pi-agent-read/src/api/tools/read.ts +73 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +26 -2
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +64 -14
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/node_modules/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +73 -44
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/resolver.ts +2 -0
- package/node_modules/pi-agent-resource/src/resource.ts +2 -0
- package/node_modules/pi-agent-search/package.json +3 -3
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/node_modules/pi-agent-search/src/api/search.ts +55 -1
- package/node_modules/pi-agent-search/src/core/extension.ts +2 -23
- package/node_modules/pi-agent-search/src/core/search-core.ts +28 -3
- package/node_modules/pi-agent-search-text/index.ts +44 -4
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/search-session.ts +65 -25
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-document.ts +5 -0
- package/node_modules/pi-agent-text/src/text-target.ts +4 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- 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 +1 -0
- package/node_modules/pi-agent-text-editor/index.ts +1 -3
- package/node_modules/pi-agent-text-editor/package.json +34 -24
- package/node_modules/pi-agent-text-editor/runtime/entry-69.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/node_modules/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +6 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +6 -1
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +17 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +212 -51
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +273 -11
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/index.ts +88 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +42 -25
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +20 -12
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +1 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/runtime/entry-75.js +2 -0
- package/node_modules/pi-agent-web/src/browser-loader.ts +1 -0
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/package.json +41 -38
- package/src/api/plugin-protocol.ts +10 -2
- package/src/api/tool-config.ts +73 -2
- package/src/code-view/diagnostic-view.ts +22 -3
- package/src/composite/builtin-extensions.ts +10 -15
- package/src/composite/extensions-config.ts +59 -0
- package/src/composite/feature-flags.ts +32 -0
- package/src/composite/module-labels.ts +59 -0
- package/src/composite/module-settings-store.ts +60 -0
- package/src/composite/module-settings.ts +162 -0
- package/src/composite/preferences.ts +26 -0
- package/src/composite/selection.ts +4 -4
- package/src/composite/settings-panel.ts +103 -0
- package/src/core/diagnostic-delivery.ts +29 -0
- package/src/core/diagnostic-entry.ts +51 -3
- package/src/core/diagnostic-store.ts +56 -5
- package/src/core/extension.ts +34 -33
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
- 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-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-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/browser-loader.ts +1 -0
- package/src/extensions/pi-agent-read/package.json +6 -6
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +73 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +26 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +64 -14
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +73 -44
- package/src/extensions/pi-agent-search/package.json +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +44 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +65 -25
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +55 -1
- package/src/extensions/pi-agent-search/src/core/extension.ts +2 -23
- package/src/extensions/pi-agent-search/src/core/search-core.ts +28 -3
- package/src/extensions/pi-agent-text-editor/index.ts +1 -3
- package/src/extensions/pi-agent-text-editor/package.json +34 -24
- 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/package.json +3 -3
- 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 +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +88 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +42 -25
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +20 -12
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- 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/runtime/entry-69.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/src/extensions/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +6 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +6 -1
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +17 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +212 -51
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +273 -11
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +1 -1
- package/src/pi-agent-ide.ts +43 -8
- package/src/plugins/pi-agent-ide-ast/package.json +9 -9
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +4 -3
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +68 -45
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/src/plugins/pi-agent-ide-changes/index.ts +21 -5
- package/src/plugins/pi-agent-ide-changes/package.json +6 -6
- package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +4 -2
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +62 -11
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +26 -8
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/index.ts +46 -17
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-lsp/index.ts +126 -8
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -8
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +18 -3
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +4 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/src/plugins/pi-agent-ide-terminal/index.ts +34 -0
- package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +238 -0
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +461 -0
- package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +127 -0
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +159 -0
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +529 -0
- package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +56 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +157 -0
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +66 -0
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +336 -0
- package/src/post-edit/gate.ts +15 -2
- package/dist/chunk-4U6KGABH.js +0 -1
- package/dist/chunk-6ACQQBUY.js +0 -7
- package/dist/chunk-GFWDXTOB.js +0 -4
- package/dist/chunk-JASLOB2X.js +0 -1
- package/dist/chunk-JJVXUL5U.js +0 -2
- package/dist/chunk-KCEOTU5Z.js +0 -3
- package/dist/chunk-KVGQG43U.js +0 -1
- package/dist/chunk-QJFRAMK7.js +0 -2
- package/dist/chunk-RAZOACDD.js +0 -2
- package/dist/chunk-RIGRP3FD.js +0 -1
- package/dist/chunk-VCCMVQXU.js +0 -1
- package/dist/chunk-X6MPU7UO.js +0 -3
- package/dist/chunk-YPHXLAQF.js +0 -1
- package/dist/entry-80.js +0 -1
- package/node_modules/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- package/node_modules/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/node_modules/pi-agent-text-editor-argument-order/package.json +0 -16
- package/node_modules/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/node_modules/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/node_modules/pi-agent-text-editor-overwrite/package.json +0 -17
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +0 -1
- package/node_modules/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +0 -16
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/runtime/entry-70.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +0 -17
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- /package/dist/{chunk-3H2EU7VQ.js → chunk-4U2GUKNJ.js} +0 -0
- /package/node_modules/{pi-agent-text-editor-argument-order → pi-agent-text-editor}/runtime/entry-70.js +0 -0
- /package/node_modules/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
|
@@ -14,7 +14,8 @@ import type { ChangeIndexAction } from "#src/changes/change-types.js";
|
|
|
14
14
|
import type { GitCommandExecutor } from "#src/changes/git-changes-backend.js";
|
|
15
15
|
import type { IndexMutationQueue } from "#src/index-mutation-queue.js";
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/** Shared validation for standalone and composed index changes. */
|
|
18
|
+
export const indexChangeSchema = Type.Object(
|
|
18
19
|
{
|
|
19
20
|
file: Type.String({ description: "Path to the tracked text file" }),
|
|
20
21
|
change: Type.String({
|
|
@@ -42,7 +43,8 @@ export function registerIndexChangeTools(
|
|
|
42
43
|
pi.registerTool(createIndexChangeTool("unstage", executor, queue));
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
/** Build one guarded index change shared by standalone tools and Apply. */
|
|
47
|
+
export function createIndexChangeTool(
|
|
46
48
|
action: ChangeIndexAction,
|
|
47
49
|
executor: GitCommandExecutor,
|
|
48
50
|
queue: IndexMutationQueue,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-formatter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-doctor": "0.
|
|
6
|
+
"pi-agent-doctor": "0.4.0"
|
|
7
7
|
},
|
|
8
8
|
"pi": {
|
|
9
9
|
"extensions": [
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"@earendil-works/pi-coding-agent": "*",
|
|
15
|
-
"pi-agent-ide": "0.
|
|
15
|
+
"pi-agent-ide": "0.4.0"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
configuredExecutableName,
|
|
3
|
+
resolveExternalToolProjectRoot,
|
|
4
|
+
runConfiguredFormatter,
|
|
5
|
+
} from "pi-agent-ide/api/tool-config";
|
|
6
|
+
import path from "node:path";
|
|
2
7
|
|
|
8
|
+
import { FORMATTER_RECIPES } from "./catalog.js";
|
|
3
9
|
import { FormatterCommandRegistry } from "./registry.js";
|
|
4
10
|
|
|
5
11
|
import type { Formatter } from "pi-agent-ide/api/toolchain";
|
|
@@ -20,8 +26,16 @@ export function createFormatter(): Formatter {
|
|
|
20
26
|
return true;
|
|
21
27
|
},
|
|
22
28
|
async format({ filePath }, context) {
|
|
23
|
-
const
|
|
24
|
-
|
|
29
|
+
const projectRoot = await resolveExternalToolProjectRoot(
|
|
30
|
+
context.cwd,
|
|
31
|
+
filePath,
|
|
32
|
+
"formatters",
|
|
33
|
+
FORMATTER_RECIPES,
|
|
34
|
+
);
|
|
35
|
+
if (projectRoot === undefined) return { ok: true, edits: 0, formatter: null };
|
|
36
|
+
const external = projectRoot !== path.resolve(context.cwd);
|
|
37
|
+
const registry = await loadRegistry(projectRoot, external);
|
|
38
|
+
const formatter = registry.resolve(filePath, projectRoot);
|
|
25
39
|
|
|
26
40
|
if (formatter === undefined) {
|
|
27
41
|
return { ok: true, edits: 0, formatter: null };
|
|
@@ -30,7 +44,7 @@ export function createFormatter(): Formatter {
|
|
|
30
44
|
const name = configuredExecutableName(formatter.run.command);
|
|
31
45
|
try {
|
|
32
46
|
const result = await runConfiguredFormatter(formatter, {
|
|
33
|
-
projectRoot
|
|
47
|
+
projectRoot,
|
|
34
48
|
filePath,
|
|
35
49
|
});
|
|
36
50
|
return { ok: result.ok, edits: result.changed ? 1 : 0, formatter: name };
|
|
@@ -41,12 +55,16 @@ export function createFormatter(): Formatter {
|
|
|
41
55
|
};
|
|
42
56
|
}
|
|
43
57
|
|
|
44
|
-
async function loadRegistry(cwd: string): Promise<FormatterCommandRegistry> {
|
|
45
|
-
|
|
58
|
+
async function loadRegistry(cwd: string, external = false): Promise<FormatterCommandRegistry> {
|
|
59
|
+
const key = JSON.stringify([cwd, external]);
|
|
60
|
+
let registry = registries.get(key);
|
|
46
61
|
|
|
47
62
|
if (registry === undefined) {
|
|
48
|
-
registry = FormatterCommandRegistry.fromDirectory(cwd
|
|
49
|
-
|
|
63
|
+
registry = FormatterCommandRegistry.fromDirectory(cwd, {
|
|
64
|
+
includeGlobal: !external,
|
|
65
|
+
requireBuiltInEvidence: external,
|
|
66
|
+
});
|
|
67
|
+
registries.set(key, registry);
|
|
50
68
|
}
|
|
51
69
|
|
|
52
70
|
return registry;
|
|
@@ -56,7 +56,15 @@ export class FormatterCommandRegistry {
|
|
|
56
56
|
);
|
|
57
57
|
return new FormatterCommandRegistry(
|
|
58
58
|
entries,
|
|
59
|
-
new Set(
|
|
59
|
+
new Set(
|
|
60
|
+
available
|
|
61
|
+
.filter(
|
|
62
|
+
(entry) =>
|
|
63
|
+
entry.available &&
|
|
64
|
+
(!options.requireBuiltInEvidence || (evidence.get(entry.id)?.score ?? 0) > 0),
|
|
65
|
+
)
|
|
66
|
+
.map((entry) => entry.id),
|
|
67
|
+
),
|
|
60
68
|
|
|
61
69
|
evidence,
|
|
62
70
|
);
|
|
@@ -1,23 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
configuredExecutableName,
|
|
3
|
+
resolveExternalToolProjectRoot,
|
|
4
|
+
} from "pi-agent-ide/api/tool-config";
|
|
2
5
|
import { connectDoctorPlugin } from "pi-agent-doctor/api/connect-plugin";
|
|
3
6
|
import { connectIdePlugin } from "pi-agent-ide/api/connect-plugin";
|
|
4
7
|
import { IDE_API_VERSION, IDE_PROTOCOL, type IdePlugin } from "pi-agent-ide/api/plugin-protocol";
|
|
5
8
|
import type { IdeTool } from "pi-agent-ide/api/toolchain";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { LINTER_RECIPES } from "./src/catalog.js";
|
|
6
11
|
import { createCommandLinter, runConfiguredLinter } from "./src/command-linter.js";
|
|
7
12
|
import { lintDoctorPlugin } from "./src/doctor-plugin.js";
|
|
8
13
|
import { LintCommandRegistry } from "./src/registry.js";
|
|
9
14
|
|
|
10
15
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
16
|
+
|
|
11
17
|
export default async function registerLint(pi: ExtensionAPI): Promise<void> {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
const registries = new Map<string, Promise<LintCommandRegistry>>();
|
|
19
|
+
const registryFor = (cwd: string, external = false): Promise<LintCommandRegistry> => {
|
|
20
|
+
const key = JSON.stringify([cwd, external]);
|
|
21
|
+
let registry = registries.get(key);
|
|
22
|
+
if (registry === undefined) {
|
|
23
|
+
registry = loadRegistry(cwd, external);
|
|
24
|
+
registries.set(key, registry);
|
|
18
25
|
}
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
return registry;
|
|
27
|
+
};
|
|
28
|
+
const resolveProject = async (filePath: string, cwd: string) => {
|
|
29
|
+
const projectRoot = await resolveExternalToolProjectRoot(
|
|
30
|
+
cwd,
|
|
31
|
+
filePath,
|
|
32
|
+
"linters",
|
|
33
|
+
LINTER_RECIPES,
|
|
34
|
+
);
|
|
35
|
+
return projectRoot === undefined
|
|
36
|
+
? undefined
|
|
37
|
+
: { projectRoot, external: projectRoot !== path.resolve(cwd) };
|
|
21
38
|
};
|
|
22
39
|
|
|
23
40
|
const linter = {
|
|
@@ -30,8 +47,10 @@ export default async function registerLint(pi: ExtensionAPI): Promise<void> {
|
|
|
30
47
|
return true;
|
|
31
48
|
},
|
|
32
49
|
async lint(input, context) {
|
|
33
|
-
const
|
|
34
|
-
|
|
50
|
+
const project = await resolveProject(input.filePath, context.cwd);
|
|
51
|
+
if (project === undefined) return { ok: true, diagnostics: [] };
|
|
52
|
+
const readyRegistry = await registryFor(project.projectRoot, project.external);
|
|
53
|
+
return createCommandLinter(readyRegistry).lint(input, { cwd: project.projectRoot });
|
|
35
54
|
},
|
|
36
55
|
} satisfies IdeTool;
|
|
37
56
|
const idePlugin = {
|
|
@@ -44,9 +63,16 @@ export default async function registerLint(pi: ExtensionAPI): Promise<void> {
|
|
|
44
63
|
api.addDiagnosticSource({
|
|
45
64
|
id: "lint",
|
|
46
65
|
async diagnose(filePath, context) {
|
|
47
|
-
const
|
|
66
|
+
const project = await resolveProject(filePath, context.cwd);
|
|
67
|
+
if (project === undefined)
|
|
68
|
+
return {
|
|
69
|
+
status: "unavailable",
|
|
70
|
+
diagnostics: [],
|
|
71
|
+
reason: "No local linter project found for this file",
|
|
72
|
+
};
|
|
73
|
+
const registry = await registryFor(project.projectRoot, project.external);
|
|
48
74
|
context.signal.throwIfAborted();
|
|
49
|
-
const config = registry.resolve(filePath,
|
|
75
|
+
const config = registry.resolve(filePath, project.projectRoot);
|
|
50
76
|
if (!config)
|
|
51
77
|
return {
|
|
52
78
|
status: "unavailable",
|
|
@@ -55,7 +81,7 @@ export default async function registerLint(pi: ExtensionAPI): Promise<void> {
|
|
|
55
81
|
};
|
|
56
82
|
const source = configuredExecutableName(config.check.command);
|
|
57
83
|
const result = await runConfiguredLinter(config, {
|
|
58
|
-
projectRoot:
|
|
84
|
+
projectRoot: project.projectRoot,
|
|
59
85
|
filePath,
|
|
60
86
|
signal: context.signal,
|
|
61
87
|
});
|
|
@@ -75,7 +101,10 @@ export default async function registerLint(pi: ExtensionAPI): Promise<void> {
|
|
|
75
101
|
await Promise.all([connectIdePlugin(pi, idePlugin), connectDoctorPlugin(pi, lintDoctorPlugin)]);
|
|
76
102
|
}
|
|
77
103
|
|
|
78
|
-
async function loadRegistry(cwd: string): Promise<LintCommandRegistry> {
|
|
79
|
-
const configDirectory = process.env.PI_AGENT_IDE_CONFIG_DIR ?? cwd;
|
|
80
|
-
return LintCommandRegistry.fromDirectory(configDirectory
|
|
104
|
+
async function loadRegistry(cwd: string, external: boolean): Promise<LintCommandRegistry> {
|
|
105
|
+
const configDirectory = external ? cwd : (process.env.PI_AGENT_IDE_CONFIG_DIR ?? cwd);
|
|
106
|
+
return LintCommandRegistry.fromDirectory(configDirectory, {
|
|
107
|
+
includeGlobal: !external,
|
|
108
|
+
requireBuiltInEvidence: external,
|
|
109
|
+
});
|
|
81
110
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-lint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-doctor": "0.
|
|
7
|
-
"pi-agent-invariant": "0.
|
|
8
|
-
"pi-agent-read": "0.
|
|
9
|
-
"pi-agent-resource": "0.
|
|
10
|
-
"pi-agent-text": "0.
|
|
6
|
+
"pi-agent-doctor": "0.4.0",
|
|
7
|
+
"pi-agent-invariant": "0.4.0",
|
|
8
|
+
"pi-agent-read": "0.4.0",
|
|
9
|
+
"pi-agent-resource": "0.4.0",
|
|
10
|
+
"pi-agent-text": "0.4.0"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@earendil-works/pi-coding-agent": "*",
|
|
19
|
-
"pi-agent-ide": "0.
|
|
19
|
+
"pi-agent-ide": "0.4.0"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -56,7 +56,15 @@ export class LintCommandRegistry {
|
|
|
56
56
|
);
|
|
57
57
|
return new LintCommandRegistry(
|
|
58
58
|
entries,
|
|
59
|
-
new Set(
|
|
59
|
+
new Set(
|
|
60
|
+
available
|
|
61
|
+
.filter(
|
|
62
|
+
(entry) =>
|
|
63
|
+
entry.available &&
|
|
64
|
+
(!options.requireBuiltInEvidence || (evidence.get(entry.id)?.score ?? 0) > 0),
|
|
65
|
+
)
|
|
66
|
+
.map((entry) => entry.id),
|
|
67
|
+
),
|
|
60
68
|
|
|
61
69
|
evidence,
|
|
62
70
|
);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { connectDoctorPlugin } from "pi-agent-doctor/api/connect-plugin";
|
|
2
2
|
import { createSourceMappedTextReadHandler } from "pi-agent-ide/api/code-view";
|
|
3
3
|
import { connectIdePlugin } from "pi-agent-ide/api/connect-plugin";
|
|
4
|
+
import { resolveExternalToolProjectRoot } from "pi-agent-ide/api/tool-config";
|
|
5
|
+
import path from "node:path";
|
|
4
6
|
import { IDE_API_VERSION, IDE_PROTOCOL, type IdePlugin } from "pi-agent-ide/api/plugin-protocol";
|
|
5
7
|
import type { IdeTool } from "pi-agent-ide/api/toolchain";
|
|
6
8
|
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
@@ -13,11 +15,20 @@ import { createReadResultRenderer } from "pi-agent-read/api/rendering";
|
|
|
13
15
|
import { connectSearchPlugin } from "pi-agent-search/api/connect-plugin";
|
|
14
16
|
import { SEARCH_API_VERSION, SEARCH_PROTOCOL } from "pi-agent-search/api/plugin-protocol";
|
|
15
17
|
|
|
18
|
+
import { LSP_RECIPES } from "./src/catalog.js";
|
|
16
19
|
import { createLspGraphResolver, createLspSymbolResolver } from "./src/code-view-resolvers.js";
|
|
17
20
|
import { createLspDiagnosticSource } from "./src/diagnostic-source.js";
|
|
18
21
|
import { lspDoctorPlugin } from "./src/doctor-plugin.js";
|
|
19
22
|
import { createLspCompiler, LspManager, LspServerRegistry } from "./src/lsp/index.js";
|
|
20
23
|
import { createLspSearchResolver } from "./src/search-resolver.js";
|
|
24
|
+
import { createDeclarationTargets } from "./src/declaration-targets.js";
|
|
25
|
+
import { prepareSymbolRename } from "./src/rename-plan.js";
|
|
26
|
+
import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
|
|
27
|
+
import {
|
|
28
|
+
TEXT_EDITOR_PROTOCOL,
|
|
29
|
+
TEXT_EDITOR_API_VERSION,
|
|
30
|
+
TEXT_SEARCH_ANCHOR_KIND,
|
|
31
|
+
} from "pi-agent-text-editor/api/plugin-protocol";
|
|
21
32
|
|
|
22
33
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
23
34
|
|
|
@@ -26,18 +37,30 @@ const renderReadResult = createReadResultRenderer({ kind: "code-view", label: "L
|
|
|
26
37
|
export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
27
38
|
const managers = new Map<string, Promise<LspManager>>();
|
|
28
39
|
let disposed = false;
|
|
29
|
-
const managerFor = (cwd: string): Promise<LspManager> => {
|
|
40
|
+
const managerFor = (cwd: string, external = false): Promise<LspManager> => {
|
|
30
41
|
if (disposed) return Promise.reject(new Error("LSP session has ended"));
|
|
31
|
-
|
|
42
|
+
const key = JSON.stringify([cwd, external]);
|
|
43
|
+
let ready = managers.get(key);
|
|
32
44
|
if (!ready) {
|
|
33
|
-
ready = loadRegistry(cwd).then((registry) => {
|
|
45
|
+
ready = loadRegistry(cwd, external).then((registry) => {
|
|
34
46
|
if (disposed) throw new Error("LSP session has ended");
|
|
35
47
|
return LspManager.init(registry);
|
|
36
48
|
});
|
|
37
|
-
managers.set(
|
|
49
|
+
managers.set(key, ready);
|
|
38
50
|
}
|
|
39
51
|
return ready;
|
|
40
52
|
};
|
|
53
|
+
const resolveLspProject = async (filePath: string, cwd: string) => {
|
|
54
|
+
const projectRoot = await resolveExternalToolProjectRoot(
|
|
55
|
+
cwd,
|
|
56
|
+
filePath,
|
|
57
|
+
"lsp-servers",
|
|
58
|
+
LSP_RECIPES,
|
|
59
|
+
);
|
|
60
|
+
return projectRoot === undefined
|
|
61
|
+
? undefined
|
|
62
|
+
: { cwd: projectRoot, external: projectRoot !== path.resolve(cwd) };
|
|
63
|
+
};
|
|
41
64
|
|
|
42
65
|
const compiler = {
|
|
43
66
|
kind: "compiler",
|
|
@@ -60,7 +83,7 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
60
83
|
setup(api): void {
|
|
61
84
|
api.addTool(compiler);
|
|
62
85
|
|
|
63
|
-
api.addDiagnosticSource(createLspDiagnosticSource(managerFor));
|
|
86
|
+
api.addDiagnosticSource(createLspDiagnosticSource(managerFor, resolveLspProject));
|
|
64
87
|
},
|
|
65
88
|
} satisfies IdePlugin;
|
|
66
89
|
pi.on("session_shutdown", async () => {
|
|
@@ -97,6 +120,97 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
97
120
|
|
|
98
121
|
await Promise.all([
|
|
99
122
|
connectIdePlugin(pi, idePlugin),
|
|
123
|
+
connectTextEditorPlugin(pi, {
|
|
124
|
+
protocol: TEXT_EDITOR_PROTOCOL,
|
|
125
|
+
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
126
|
+
id: "lsp-declarations",
|
|
127
|
+
setup(api) {
|
|
128
|
+
api.addAnchorResolver({
|
|
129
|
+
kind: TEXT_SEARCH_ANCHOR_KIND,
|
|
130
|
+
type: "auxiliary",
|
|
131
|
+
resolver: {
|
|
132
|
+
id: "lsp-declaration",
|
|
133
|
+
description:
|
|
134
|
+
"symbol:<file>#<selector> selects an exact declaration for text fallback editing; imports and references are not rewritten.",
|
|
135
|
+
renderFull: (value) => value,
|
|
136
|
+
renderCompact: (value) => value,
|
|
137
|
+
tryResolve: () => Promise.resolve({ kind: "not-handled" }),
|
|
138
|
+
},
|
|
139
|
+
resources: createDeclarationTargets(managerFor),
|
|
140
|
+
describeInPrompt: false,
|
|
141
|
+
});
|
|
142
|
+
for (const operation of ["copy", "move", "delete", "replace"]) {
|
|
143
|
+
api
|
|
144
|
+
.tool(operation)
|
|
145
|
+
.describe(
|
|
146
|
+
"Use symbol:<file>#<selector> as path to select one exact declaration without start/end. Use parent/child for ambiguous names. Copy/move require an explicit target and destination anchor. This text fallback leaves imports and references unchanged; it is not semantic rename." +
|
|
147
|
+
(operation === "replace"
|
|
148
|
+
? " Use symbol:<file>#<selector>#name with text containing the new name for native LSP rename across references. Omit start/end. A failed server rename never falls back to identifier text replacement."
|
|
149
|
+
: ""),
|
|
150
|
+
);
|
|
151
|
+
api.tool(operation).addHandler({
|
|
152
|
+
stage: "text-pre-edit",
|
|
153
|
+
async handler(state) {
|
|
154
|
+
if (operation === "replace") {
|
|
155
|
+
const renamed = await prepareSymbolRename(state, managerFor);
|
|
156
|
+
if (renamed !== undefined) return renamed;
|
|
157
|
+
}
|
|
158
|
+
const input = state.input as Record<string, unknown>;
|
|
159
|
+
const selected = [
|
|
160
|
+
input.path,
|
|
161
|
+
input.start,
|
|
162
|
+
input.end,
|
|
163
|
+
input.target,
|
|
164
|
+
input.targetStart,
|
|
165
|
+
input.targetEnd,
|
|
166
|
+
].some((value) => typeof value === "string" && value.startsWith("symbol:"));
|
|
167
|
+
if (!selected) return state;
|
|
168
|
+
if (
|
|
169
|
+
(operation === "copy" || operation === "move") &&
|
|
170
|
+
typeof input.target !== "string"
|
|
171
|
+
)
|
|
172
|
+
throw new Error(
|
|
173
|
+
"Copying or moving a symbol requires an explicit target file and destination anchor.",
|
|
174
|
+
);
|
|
175
|
+
return {
|
|
176
|
+
...state,
|
|
177
|
+
metadata: {
|
|
178
|
+
...state.metadata,
|
|
179
|
+
semanticEdit: {
|
|
180
|
+
mode: "declaration-text",
|
|
181
|
+
referencesUpdated: false,
|
|
182
|
+
importsUpdated: false,
|
|
183
|
+
},
|
|
184
|
+
diffStatuses: [
|
|
185
|
+
{ text: "Text fallback: imports and references unchanged", tone: "warning" },
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
api
|
|
193
|
+
.tool("insert")
|
|
194
|
+
.describe(
|
|
195
|
+
"Symbol targets are unsupported for insert. Read the declaration and select an ordinary text line anchor instead.",
|
|
196
|
+
);
|
|
197
|
+
api.tool("insert").addHandler({
|
|
198
|
+
stage: "text-pre-edit",
|
|
199
|
+
handler(state) {
|
|
200
|
+
const input = state.input as Record<string, unknown>;
|
|
201
|
+
if (
|
|
202
|
+
[input.path, input.anchor].some(
|
|
203
|
+
(value) => typeof value === "string" && value.startsWith("symbol:"),
|
|
204
|
+
)
|
|
205
|
+
)
|
|
206
|
+
throw new Error(
|
|
207
|
+
"Semantic insert is not supported. Read the declaration and use an explicit text line anchor instead.",
|
|
208
|
+
);
|
|
209
|
+
return state;
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
}),
|
|
100
214
|
connectReadPlugin(pi, readPlugin),
|
|
101
215
|
connectDoctorPlugin(pi, lspDoctorPlugin),
|
|
102
216
|
connectSearchPlugin(pi, {
|
|
@@ -113,7 +227,11 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
113
227
|
]);
|
|
114
228
|
}
|
|
115
229
|
|
|
116
|
-
async function loadRegistry(cwd: string): Promise<LspServerRegistry> {
|
|
117
|
-
const configDirectory = process.env.PI_AGENT_IDE_CONFIG_DIR ?? cwd;
|
|
118
|
-
return LspServerRegistry.fromPackageDir(configDirectory
|
|
230
|
+
async function loadRegistry(cwd: string, external: boolean): Promise<LspServerRegistry> {
|
|
231
|
+
const configDirectory = external ? cwd : (process.env.PI_AGENT_IDE_CONFIG_DIR ?? cwd);
|
|
232
|
+
return LspServerRegistry.fromPackageDir(configDirectory, {
|
|
233
|
+
includeGlobal: !external,
|
|
234
|
+
requireBuiltInEvidence: external,
|
|
235
|
+
recipes: LSP_RECIPES,
|
|
236
|
+
});
|
|
119
237
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-lsp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"cross-spawn": "^7.0.6",
|
|
7
|
-
"pi-agent-doctor": "0.
|
|
8
|
-
"pi-agent-invariant": "0.
|
|
9
|
-
"pi-agent-read": "0.
|
|
10
|
-
"pi-agent-resource": "0.
|
|
11
|
-
"pi-agent-search": "0.
|
|
12
|
-
"pi-agent-text": "0.
|
|
7
|
+
"pi-agent-doctor": "0.4.0",
|
|
8
|
+
"pi-agent-invariant": "0.4.0",
|
|
9
|
+
"pi-agent-read": "0.4.0",
|
|
10
|
+
"pi-agent-resource": "0.4.0",
|
|
11
|
+
"pi-agent-search": "0.4.0",
|
|
12
|
+
"pi-agent-text": "0.4.0",
|
|
13
|
+
"pi-agent-text-editor": "0.4.0",
|
|
13
14
|
"vscode-jsonrpc": "^9.0.0",
|
|
14
15
|
"vscode-uri": "^3.1.0"
|
|
15
16
|
},
|
|
@@ -20,6 +21,6 @@
|
|
|
20
21
|
},
|
|
21
22
|
"peerDependencies": {
|
|
22
23
|
"@earendil-works/pi-coding-agent": "*",
|
|
23
|
-
"pi-agent-ide": "0.
|
|
24
|
+
"pi-agent-ide": "0.4.0"
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { parseCodeViewReference, resolveCodeViewPath } from "pi-agent-ide/api/code-view";
|
|
2
|
+
import type { TextTargetResolver } from "pi-agent-text";
|
|
3
|
+
import { resolveLspDeclaration } from "./lsp/code-views.js";
|
|
4
|
+
import type { LspManagerProvider } from "./code-view-resolvers.js";
|
|
5
|
+
|
|
6
|
+
/** Resolve a live symbol reference to its exact declaration, not matching identifier words. */
|
|
7
|
+
export function createDeclarationTargets(managerFor: LspManagerProvider): TextTargetResolver {
|
|
8
|
+
return {
|
|
9
|
+
id: "lsp-declaration-target",
|
|
10
|
+
async tryResolve(value, context) {
|
|
11
|
+
const reference = parseCodeViewReference(value, "symbol");
|
|
12
|
+
if (reference === undefined) return { kind: "not-handled" };
|
|
13
|
+
if (reference.selector === undefined)
|
|
14
|
+
return {
|
|
15
|
+
kind: "rejected",
|
|
16
|
+
rejection: {
|
|
17
|
+
code: "invalid",
|
|
18
|
+
reason: "Use symbol:<file>#<selector> to choose one declaration",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
try {
|
|
22
|
+
const declaration = await resolveLspDeclaration(
|
|
23
|
+
await managerFor(context.cwd),
|
|
24
|
+
resolveCodeViewPath(reference.path, context.cwd),
|
|
25
|
+
reference.selector,
|
|
26
|
+
context.cwd,
|
|
27
|
+
context.signal,
|
|
28
|
+
);
|
|
29
|
+
return {
|
|
30
|
+
kind: "resolved",
|
|
31
|
+
targets: [
|
|
32
|
+
{
|
|
33
|
+
source: declaration.source,
|
|
34
|
+
expectedContent: declaration.content,
|
|
35
|
+
ranges: [
|
|
36
|
+
{
|
|
37
|
+
start: {
|
|
38
|
+
lineNumber: declaration.range.start.line + 1,
|
|
39
|
+
column: declaration.range.start.character,
|
|
40
|
+
},
|
|
41
|
+
end: {
|
|
42
|
+
lineNumber: declaration.range.end.line + 1,
|
|
43
|
+
column: declaration.range.end.character,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
} catch (error) {
|
|
51
|
+
return {
|
|
52
|
+
kind: "failed",
|
|
53
|
+
error: new Error(
|
|
54
|
+
`${error instanceof Error ? error.message : String(error)} Read the physical file and use explicit text anchors if declaration resolution is unavailable.`,
|
|
55
|
+
{ cause: error },
|
|
56
|
+
),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -7,14 +7,29 @@ import type { IdeDiagnosticReport, IdeDiagnosticSource } from "pi-agent-ide/api/
|
|
|
7
7
|
export function createLspDiagnosticSource(
|
|
8
8
|
managerFor: (
|
|
9
9
|
cwd: string,
|
|
10
|
+
external?: boolean,
|
|
10
11
|
) => Promise<Pick<LspManager, "getOrStart" | "languageId" | "onPushDiagnostics">>,
|
|
12
|
+
resolveProject: (
|
|
13
|
+
filePath: string,
|
|
14
|
+
cwd: string,
|
|
15
|
+
) => Promise<{ readonly cwd: string; readonly external: boolean } | undefined> = (
|
|
16
|
+
filePath,
|
|
17
|
+
cwd,
|
|
18
|
+
) => Promise.resolve({ cwd, external: false }),
|
|
11
19
|
): IdeDiagnosticSource {
|
|
12
20
|
return {
|
|
13
21
|
id: "lsp",
|
|
14
22
|
async diagnose(filePath, context) {
|
|
15
|
-
const
|
|
23
|
+
const project = await resolveProject(filePath, context.cwd);
|
|
24
|
+
if (project === undefined)
|
|
25
|
+
return {
|
|
26
|
+
status: "unavailable",
|
|
27
|
+
diagnostics: [],
|
|
28
|
+
reason: "No local language-server project found for this file",
|
|
29
|
+
};
|
|
30
|
+
const manager = await managerFor(project.cwd, project.external);
|
|
16
31
|
context.signal.throwIfAborted();
|
|
17
|
-
const client = await manager.getOrStart(filePath,
|
|
32
|
+
const client = await manager.getOrStart(filePath, project.cwd, "diagnostics");
|
|
18
33
|
context.signal.throwIfAborted();
|
|
19
34
|
if (!client)
|
|
20
35
|
return {
|
|
@@ -60,7 +75,7 @@ export function createLspDiagnosticSource(
|
|
|
60
75
|
!current() ||
|
|
61
76
|
event.uri !== uri ||
|
|
62
77
|
event.serverId !== client.serverId ||
|
|
63
|
-
event.cwd !==
|
|
78
|
+
event.cwd !== project.cwd ||
|
|
64
79
|
(event.version !== undefined && event.version !== version)
|
|
65
80
|
)
|
|
66
81
|
return;
|
|
@@ -127,6 +127,10 @@ export class LspClient {
|
|
|
127
127
|
return provider === true || (typeof provider === "object" && provider !== null);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/** Text last synchronized to the server, used to reject edits against stale open buffers. */
|
|
131
|
+
documentContent(uri: string): string | undefined {
|
|
132
|
+
return this._documentContents.get(uri);
|
|
133
|
+
}
|
|
130
134
|
documentVersion(uri: string): number | undefined {
|
|
131
135
|
return this._documentVersions.get(uri);
|
|
132
136
|
}
|
|
@@ -51,6 +51,46 @@ interface LspCodeDocument {
|
|
|
51
51
|
readonly symbols: readonly LspCodeSymbol[];
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** Resolve a declaration's exact server range for guarded text operations. */
|
|
55
|
+
export async function resolveLspDeclaration(
|
|
56
|
+
manager: LspManager,
|
|
57
|
+
filePath: string,
|
|
58
|
+
selector: readonly string[],
|
|
59
|
+
cwd: string,
|
|
60
|
+
signal?: AbortSignal,
|
|
61
|
+
): Promise<{ readonly source: string; readonly range: LspRange; readonly content: string }> {
|
|
62
|
+
throwIfAborted(signal);
|
|
63
|
+
const before = await readFile(filePath, "utf8");
|
|
64
|
+
const document = await openCodeDocument(manager, filePath, cwd);
|
|
65
|
+
const symbol = resolveLspCodeSymbol(document.symbols, selector, document.displayPath);
|
|
66
|
+
const after = await readFile(document.filePath, "utf8");
|
|
67
|
+
throwIfAborted(signal);
|
|
68
|
+
if (before !== after)
|
|
69
|
+
throw new Error("The symbol source changed during resolution. Read it again before editing.");
|
|
70
|
+
return { source: document.filePath, range: symbol.range, content: after };
|
|
71
|
+
}
|
|
72
|
+
/** Resolve the native identifier position and client without guessing from declaration text. */
|
|
73
|
+
export async function resolveLspRenameTarget(
|
|
74
|
+
manager: LspManager,
|
|
75
|
+
filePath: string,
|
|
76
|
+
selector: readonly string[],
|
|
77
|
+
cwd: string,
|
|
78
|
+
signal?: AbortSignal,
|
|
79
|
+
) {
|
|
80
|
+
throwIfAborted(signal);
|
|
81
|
+
const content = await readFile(filePath, "utf8");
|
|
82
|
+
const document = await openCodeDocument(manager, filePath, cwd);
|
|
83
|
+
const symbol = resolveLspCodeSymbol(document.symbols, selector, document.displayPath);
|
|
84
|
+
if (content !== (await readFile(filePath, "utf8")))
|
|
85
|
+
throw new Error("The rename source changed during resolution.");
|
|
86
|
+
throwIfAborted(signal);
|
|
87
|
+
return {
|
|
88
|
+
client: document.client,
|
|
89
|
+
uri: document.uri,
|
|
90
|
+
position: symbol.selectionRange.start,
|
|
91
|
+
content,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
54
94
|
interface SymbolRelations {
|
|
55
95
|
readonly references: readonly LspLocation[];
|
|
56
96
|
readonly calls: LspCallHierarchyResult;
|