pi-agent-ide 0.4.0 → 0.5.1
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 +41 -0
- package/README.md +74 -22
- package/assets/gallery/apply-editing.png +0 -0
- package/assets/gallery/debugging.png +0 -0
- package/assets/gallery/read-web.png +0 -0
- package/assets/gallery/search-replace.png +0 -0
- package/assets/gallery/terminal.png +0 -0
- package/assets/gallery/tool-editing.png +0 -0
- package/dist/chunk-25CZ5ZIU.js +3 -0
- package/dist/chunk-526E364R.js +3 -0
- package/dist/chunk-5PLV4HLG.js +1 -0
- package/dist/chunk-5QQABP47.js +14 -0
- package/dist/{chunk-72EEL2DW.js → chunk-6CZO43OH.js} +1 -1
- package/dist/chunk-7ALCBKCW.js +26 -0
- package/dist/chunk-AWXVJ5AC.js +1 -0
- package/dist/{chunk-GFW5QPQV.js → chunk-DQXPQOF7.js} +1 -1
- package/dist/chunk-ESPNEJHK.js +1 -0
- package/dist/chunk-G725MARR.js +16 -0
- package/dist/{chunk-M5L42DWE.js → chunk-HKXDP2FD.js} +2 -2
- package/dist/chunk-IQD6PON5.js +0 -0
- package/dist/chunk-IRECDTJG.js +27 -0
- package/dist/chunk-J4RTW44E.js +1 -0
- package/dist/{chunk-HGPUI7F3.js → chunk-KII2JQC5.js} +1 -1
- package/dist/{chunk-TI5GMJ7Q.js → chunk-L7JMDDSD.js} +1 -1
- package/dist/{chunk-6DZA4CLO.js → chunk-LY6U5EAD.js} +1 -1
- package/dist/{chunk-ERVMDQGX.js → chunk-MGCHOGQD.js} +1 -1
- package/dist/chunk-NZYDMBM6.js +1 -0
- package/dist/{chunk-Y7ZMR4LT.js → chunk-O6LE42GK.js} +1 -1
- package/dist/{chunk-KAB3AYA2.js → chunk-OBNING2A.js} +1 -1
- package/dist/chunk-P7XO5CIP.js +2 -0
- package/dist/{chunk-VFBLX4TG.js → chunk-T6LX2RX5.js} +1 -1
- package/dist/{chunk-AADJ2KIB.js → chunk-U22JNO6N.js} +1 -1
- package/dist/chunk-U2JKHKLK.js +0 -0
- package/dist/{chunk-DQF5QMJ2.js → chunk-WGGIQ7IJ.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-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -0
- package/dist/entry-17.js +1 -1
- package/dist/entry-18.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -2
- package/dist/entry-22.js +2 -1
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +1 -12
- package/dist/entry-27.js +12 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +1 -4
- package/dist/entry-32.js +3 -8
- package/dist/entry-33.js +9 -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 +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-40.js +1 -18
- package/dist/entry-41.js +18 -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-45.js +1 -7
- package/dist/entry-46.js +7 -11
- package/dist/entry-47.js +11 -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 -1
- package/dist/entry-55.js +1 -0
- package/dist/entry-56.js +0 -1
- package/dist/entry-57.js +1 -0
- package/dist/entry-58.js +0 -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 -0
- package/dist/entry-65.js +0 -1
- package/dist/entry-66.js +1 -0
- package/dist/entry-67.js +0 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +1 -123
- package/dist/entry-71.js +198 -25
- package/dist/entry-72.js +30 -2
- package/dist/entry-73.js +2 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +3 -3
- package/dist/entry-77.js +3 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +1 -0
- package/dist/entry-9.js +1 -1
- package/dist/pi-agent-ide.js +3 -3
- package/docs/configuration.md +1 -1
- package/docs/development.md +0 -6
- package/docs/user-hooks.md +68 -0
- package/node_modules/pi-agent-doctor/package.json +6 -6
- package/node_modules/pi-agent-doctor/runtime/entry-21.js +1 -0
- package/node_modules/pi-agent-doctor/src/catalog.ts +9 -1
- package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +5 -0
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +32 -11
- package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/node_modules/pi-agent-ide-ast/runtime/entry-27.js +2 -0
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +16 -8
- package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +22 -17
- package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
- package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +4 -1
- package/node_modules/pi-agent-ide-changes/index.ts +3 -1
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
- package/node_modules/pi-agent-ide-formatter/package.json +9 -4
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/package.json +13 -8
- package/node_modules/pi-agent-ide-lsp/index.ts +4 -1
- package/node_modules/pi-agent-ide-lsp/package.json +15 -10
- package/node_modules/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-read/package.json +11 -11
- package/node_modules/pi-agent-read/runtime/entry-40.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-41.js +2 -0
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/rendering.ts +1 -1
- package/node_modules/pi-agent-read/src/api/tools/read.ts +32 -0
- package/node_modules/pi-agent-read/src/core/read-core.ts +8 -0
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +63 -4
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +105 -5
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-search/package.json +7 -7
- package/node_modules/pi-agent-search/runtime/entry-45.js +0 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +5 -1
- package/node_modules/pi-agent-search-text/index.ts +1 -1
- package/node_modules/pi-agent-search-text/package.json +9 -9
- package/node_modules/pi-agent-search-text/runtime/entry-47.js +1 -0
- package/node_modules/pi-agent-search-text/src/resolvers.ts +72 -39
- package/node_modules/pi-agent-search-text/src/search-backend.ts +6 -15
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +80 -0
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +17 -1
- package/node_modules/pi-agent-search-text/src/search-result.ts +32 -12
- package/node_modules/pi-agent-search-text/src/search-session.ts +33 -4
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-49.js +1 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
- package/node_modules/pi-agent-text-editor/package.json +25 -25
- package/node_modules/pi-agent-text-editor/runtime/entry-70.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +37 -8
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +3 -2
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +141 -6
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +123 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
- package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -0
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +59 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +1 -0
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/src/resolver.ts +128 -1
- 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/node_modules/pi-agent-web-text/runtime/entry-80.js +2 -0
- package/package.json +59 -39
- package/src/api/hooks.ts +168 -0
- package/src/api/text-editor.ts +2 -0
- package/src/composite/builtin-extensions.ts +7 -0
- package/src/composite/module-labels.ts +8 -0
- package/src/composite/preferences.ts +3 -3
- package/src/core/reload-resource-store.ts +34 -0
- package/src/doctor/tip-provider.ts +1 -0
- 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 +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +2 -0
- 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-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/plugins/pi-agent-web-text/runtime/entry-80.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +128 -1
- package/src/extensions/pi-agent-read/package.json +11 -11
- package/src/extensions/pi-agent-read/runtime/entry-40.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-41.js +2 -0
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/rendering.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +32 -0
- package/src/extensions/pi-agent-read/src/core/read-core.ts +8 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +63 -4
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +105 -5
- package/src/extensions/pi-agent-search/package.json +7 -7
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-48.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +72 -39
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +6 -15
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +80 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +17 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +32 -12
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +33 -4
- package/src/extensions/pi-agent-search/runtime/entry-45.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-46.js +2 -0
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +5 -1
- package/src/extensions/pi-agent-text-editor/package.json +25 -25
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -0
- 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/renderer.ts +59 -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/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +37 -8
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +3 -2
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +141 -6
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +123 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
- package/src/plugins/pi-agent-ide-ast/package.json +32 -11
- package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +2 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +16 -8
- package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +22 -17
- package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
- package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +4 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +3 -1
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
- package/src/plugins/pi-agent-ide-debugger/index.ts +573 -0
- package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +73 -0
- package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +306 -0
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +338 -0
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +349 -0
- package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +39 -0
- package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +152 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +1344 -0
- package/src/plugins/pi-agent-ide-debugger/src/ui.ts +14 -0
- package/src/plugins/pi-agent-ide-formatter/package.json +9 -4
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/package.json +13 -8
- package/src/plugins/pi-agent-ide-lsp/index.ts +4 -1
- package/src/plugins/pi-agent-ide-lsp/package.json +15 -10
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
- package/src/plugins/pi-agent-ide-processes/index.ts +28 -0
- package/src/plugins/pi-agent-ide-processes/src/registry.ts +83 -0
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +260 -0
- package/src/plugins/pi-agent-ide-terminal/index.ts +19 -13
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +52 -0
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +31 -0
- package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +24 -58
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -14
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +32 -2
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +114 -1
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +23 -29
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +14 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +116 -240
- package/dist/chunk-3SE372WC.js +0 -3
- package/dist/chunk-5MSNYFDE.js +0 -1
- package/dist/chunk-7JYQMAEL.js +0 -14
- package/dist/chunk-B5KB2I7J.js +0 -3
- package/dist/chunk-NMFQGKPE.js +0 -2
- package/dist/chunk-OVUYPHDE.js +0 -1
- package/dist/chunk-TPIHQYK2.js +0 -14
- package/dist/chunk-XSTHESNR.js +0 -25
- package/dist/entry-16.js +0 -1
- package/docs/evaluation.md +0 -14
- package/node_modules/pi-agent-doctor/runtime/entry-16.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-21.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-25.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-27.js +0 -1
- package/node_modules/pi-agent-image/runtime/entry-33.js +0 -1
- package/node_modules/pi-agent-resource/runtime/entry-41.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-54.js +0 -1
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-75.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-22.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-21.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-36.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-46.js +0 -2
- package/src/extensions/pi-agent-search/runtime/entry-42.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-71.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-54.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-25.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-27.js +0 -1
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-22.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
- /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-34.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-36.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-42.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-46.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-48.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.
|
|
10
|
-
"pi-agent-read": "0.
|
|
11
|
-
"pi-agent-resource": "0.
|
|
12
|
-
"pi-agent-text": "0.
|
|
13
|
-
"pi-agent-text-editor": "0.
|
|
9
|
+
"pi-agent-image": "0.5.1",
|
|
10
|
+
"pi-agent-read": "0.5.1",
|
|
11
|
+
"pi-agent-resource": "0.5.1",
|
|
12
|
+
"pi-agent-text": "0.5.1",
|
|
13
|
+
"pi-agent-text-editor": "0.5.1"
|
|
14
14
|
},
|
|
15
15
|
"pi": {
|
|
16
16
|
"extensions": [
|
|
17
|
-
"./runtime/entry-
|
|
17
|
+
"./runtime/entry-22.js"
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.
|
|
10
|
-
"pi-agent-resource": "0.
|
|
9
|
+
"pi-agent-image": "0.5.1",
|
|
10
|
+
"pi-agent-resource": "0.5.1"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
14
|
-
"./runtime/entry-
|
|
14
|
+
"./runtime/entry-23.js"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.
|
|
7
|
-
"pi-agent-resource": "0.
|
|
6
|
+
"pi-agent-pdf": "0.5.1",
|
|
7
|
+
"pi-agent-resource": "0.5.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-24.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.
|
|
10
|
-
"pi-agent-text": "0.
|
|
9
|
+
"pi-agent-resource": "0.5.1",
|
|
10
|
+
"pi-agent-text": "0.5.1"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
14
|
-
"./runtime/entry-
|
|
14
|
+
"./runtime/entry-25.js"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-ast",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,19 +8,35 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./api/scope": {
|
|
10
10
|
"types": "./src/api/scope.ts",
|
|
11
|
-
"default": "./runtime/entry-
|
|
11
|
+
"default": "./runtime/entry-26.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
+
"@ast-grep/lang-bash": "^0.0.8",
|
|
16
|
+
"@ast-grep/lang-csharp": "^0.0.6",
|
|
17
|
+
"@ast-grep/lang-dart": "^0.0.7",
|
|
18
|
+
"@ast-grep/lang-elixir": "^0.0.7",
|
|
19
|
+
"@ast-grep/lang-go": "^0.0.6",
|
|
20
|
+
"@ast-grep/lang-html": "^0.0.7",
|
|
21
|
+
"@ast-grep/lang-java": "^0.0.7",
|
|
22
|
+
"@ast-grep/lang-kotlin": "^0.0.7",
|
|
23
|
+
"@ast-grep/lang-lua": "^0.0.7",
|
|
24
|
+
"@ast-grep/lang-markdown": "^0.0.6",
|
|
25
|
+
"@ast-grep/lang-php": "^0.0.7",
|
|
26
|
+
"@ast-grep/lang-ruby": "^0.0.7",
|
|
27
|
+
"@ast-grep/lang-scala": "^0.0.7",
|
|
28
|
+
"@ast-grep/lang-sql": "^0.0.8",
|
|
29
|
+
"@ast-grep/lang-swift": "^0.0.8",
|
|
30
|
+
"@ast-grep/napi": "^0.42.3",
|
|
15
31
|
"@tree-sitter-grammars/tree-sitter-toml": "^0.7.0",
|
|
16
32
|
"@tree-sitter-grammars/tree-sitter-yaml": "^0.7.1",
|
|
17
|
-
"pi-agent-doctor": "0.
|
|
18
|
-
"pi-agent-invariant": "0.
|
|
19
|
-
"pi-agent-read": "0.
|
|
20
|
-
"pi-agent-resource": "0.
|
|
21
|
-
"pi-agent-search": "0.
|
|
22
|
-
"pi-agent-text": "0.
|
|
23
|
-
"pi-agent-text-editor": "0.
|
|
33
|
+
"pi-agent-doctor": "0.5.1",
|
|
34
|
+
"pi-agent-invariant": "0.5.1",
|
|
35
|
+
"pi-agent-read": "0.5.1",
|
|
36
|
+
"pi-agent-resource": "0.5.1",
|
|
37
|
+
"pi-agent-search": "0.5.1",
|
|
38
|
+
"pi-agent-text": "0.5.1",
|
|
39
|
+
"pi-agent-text-editor": "0.5.1",
|
|
24
40
|
"tree-sitter-cpp": "^0.23.4",
|
|
25
41
|
"tree-sitter-javascript": "^0.25.0",
|
|
26
42
|
"tree-sitter-json": "^0.24.8",
|
|
@@ -31,11 +47,16 @@
|
|
|
31
47
|
},
|
|
32
48
|
"pi": {
|
|
33
49
|
"extensions": [
|
|
34
|
-
"./runtime/entry-
|
|
50
|
+
"./runtime/entry-27.js"
|
|
35
51
|
]
|
|
36
52
|
},
|
|
37
53
|
"peerDependencies": {
|
|
38
54
|
"@earendil-works/pi-coding-agent": "*",
|
|
39
|
-
"pi-agent-ide": "0.
|
|
55
|
+
"pi-agent-ide": "0.5.1"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"pi-agent-ide": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
40
61
|
}
|
|
41
62
|
}
|
|
@@ -5,6 +5,9 @@ import path from "node:path";
|
|
|
5
5
|
import { TextAnchor } from "pi-agent-text";
|
|
6
6
|
import * as WTS from "web-tree-sitter";
|
|
7
7
|
|
|
8
|
+
import { parseNativeDocument } from "./native-parser.js";
|
|
9
|
+
import type { SyntaxNode, SyntaxTree } from "./syntax-tree.js";
|
|
10
|
+
|
|
8
11
|
export interface ScopeEntry {
|
|
9
12
|
readonly name: string;
|
|
10
13
|
readonly kind: string;
|
|
@@ -45,7 +48,9 @@ const loadedLanguages = new Map<string, Promise<WTS.Language>>();
|
|
|
45
48
|
function grammarWasmPath(extension: string): string | undefined {
|
|
46
49
|
switch (extension) {
|
|
47
50
|
case ".ts":
|
|
48
|
-
case ".tsx":
|
|
51
|
+
case ".tsx":
|
|
52
|
+
case ".mts":
|
|
53
|
+
case ".cts": {
|
|
49
54
|
return "tree-sitter-typescript/tree-sitter-typescript.wasm";
|
|
50
55
|
}
|
|
51
56
|
|
|
@@ -56,7 +61,8 @@ function grammarWasmPath(extension: string): string | undefined {
|
|
|
56
61
|
return "tree-sitter-javascript/tree-sitter-javascript.wasm";
|
|
57
62
|
}
|
|
58
63
|
|
|
59
|
-
case ".py":
|
|
64
|
+
case ".py":
|
|
65
|
+
case ".pyi": {
|
|
60
66
|
return "tree-sitter-python/tree-sitter-python.wasm";
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -123,19 +129,21 @@ export async function parseDocument(
|
|
|
123
129
|
filePath: string,
|
|
124
130
|
cwd: string,
|
|
125
131
|
lines: readonly string[],
|
|
126
|
-
): Promise<
|
|
132
|
+
): Promise<SyntaxTree | undefined> {
|
|
127
133
|
if (lines.length === 0) {
|
|
128
134
|
return undefined;
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
const absolutePath = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
|
|
132
|
-
const
|
|
138
|
+
const extension = path.extname(absolutePath).toLowerCase();
|
|
139
|
+
const source = lines.join("\n");
|
|
140
|
+
const parser = await ensureParser(extension);
|
|
133
141
|
|
|
134
|
-
if (
|
|
135
|
-
return undefined;
|
|
142
|
+
if (parser) {
|
|
143
|
+
return parser.parse(source) ?? undefined;
|
|
136
144
|
}
|
|
137
145
|
|
|
138
|
-
return
|
|
146
|
+
return parseNativeDocument(extension, source);
|
|
139
147
|
}
|
|
140
148
|
|
|
141
149
|
function hashScope(lines: readonly string[], startLine: number, endLine: number): string {
|
|
@@ -192,7 +200,7 @@ export class AstScopeManager {
|
|
|
192
200
|
}
|
|
193
201
|
|
|
194
202
|
private collectCandidates(
|
|
195
|
-
node:
|
|
203
|
+
node: SyntaxNode,
|
|
196
204
|
candidates: ScopeCandidate[],
|
|
197
205
|
depth = 0,
|
|
198
206
|
isBodyChild = false,
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
import { Lang, parse, registerDynamicLanguage, type SgNode } from "@ast-grep/napi";
|
|
4
|
+
|
|
5
|
+
import type { SyntaxNode, SyntaxTree } from "./syntax-tree.js";
|
|
6
|
+
|
|
7
|
+
interface DynamicLanguagePackage {
|
|
8
|
+
readonly libraryPath: string;
|
|
9
|
+
readonly extensions: string[];
|
|
10
|
+
readonly languageSymbol?: string;
|
|
11
|
+
readonly expandoChar?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const require = createRequire(import.meta.url);
|
|
15
|
+
const LANGUAGE_PACKAGES = {
|
|
16
|
+
bash: "@ast-grep/lang-bash",
|
|
17
|
+
csharp: "@ast-grep/lang-csharp",
|
|
18
|
+
dart: "@ast-grep/lang-dart",
|
|
19
|
+
elixir: "@ast-grep/lang-elixir",
|
|
20
|
+
go: "@ast-grep/lang-go",
|
|
21
|
+
html: "@ast-grep/lang-html",
|
|
22
|
+
java: "@ast-grep/lang-java",
|
|
23
|
+
kotlin: "@ast-grep/lang-kotlin",
|
|
24
|
+
lua: "@ast-grep/lang-lua",
|
|
25
|
+
markdown: "@ast-grep/lang-markdown",
|
|
26
|
+
php: "@ast-grep/lang-php",
|
|
27
|
+
ruby: "@ast-grep/lang-ruby",
|
|
28
|
+
scala: "@ast-grep/lang-scala",
|
|
29
|
+
sql: "@ast-grep/lang-sql",
|
|
30
|
+
swift: "@ast-grep/lang-swift",
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
export const EXTENSION_LANGUAGES: Readonly<Record<string, string>> = {
|
|
34
|
+
".bash": "bash",
|
|
35
|
+
".cs": "csharp",
|
|
36
|
+
".css": Lang.Css,
|
|
37
|
+
".less": Lang.Css,
|
|
38
|
+
".scss": Lang.Css,
|
|
39
|
+
".dart": "dart",
|
|
40
|
+
".ex": "elixir",
|
|
41
|
+
".exs": "elixir",
|
|
42
|
+
".go": "go",
|
|
43
|
+
".htm": "html",
|
|
44
|
+
".html": "html",
|
|
45
|
+
".java": "java",
|
|
46
|
+
".kt": "kotlin",
|
|
47
|
+
".kts": "kotlin",
|
|
48
|
+
".lua": "lua",
|
|
49
|
+
".md": "markdown",
|
|
50
|
+
".mdx": "markdown",
|
|
51
|
+
".php": "php",
|
|
52
|
+
".rb": "ruby",
|
|
53
|
+
".rake": "ruby",
|
|
54
|
+
".scala": "scala",
|
|
55
|
+
".sc": "scala",
|
|
56
|
+
".sql": "sql",
|
|
57
|
+
".sh": "bash",
|
|
58
|
+
".swift": "swift",
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
let registered = false;
|
|
62
|
+
|
|
63
|
+
function ensureLanguagesRegistered(): void {
|
|
64
|
+
if (registered) return;
|
|
65
|
+
const registrations: Record<string, DynamicLanguagePackage> = {};
|
|
66
|
+
for (const [language, packageName] of Object.entries(LANGUAGE_PACKAGES)) {
|
|
67
|
+
registrations[language] = require(packageName) as DynamicLanguagePackage;
|
|
68
|
+
}
|
|
69
|
+
registerDynamicLanguage(registrations);
|
|
70
|
+
registered = true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function supportsNativeExtension(extension: string): boolean {
|
|
74
|
+
return extension in EXTENSION_LANGUAGES;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function parseNativeDocument(extension: string, source: string): SyntaxTree | undefined {
|
|
78
|
+
const language = EXTENSION_LANGUAGES[extension];
|
|
79
|
+
if (!language) return undefined;
|
|
80
|
+
ensureLanguagesRegistered();
|
|
81
|
+
return { rootNode: new NativeSyntaxNode(parse(language, source).root(), source) };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
class NativeSyntaxNode implements SyntaxNode {
|
|
85
|
+
public constructor(
|
|
86
|
+
private readonly node: SgNode,
|
|
87
|
+
private readonly source: string,
|
|
88
|
+
) {}
|
|
89
|
+
|
|
90
|
+
public get type(): string {
|
|
91
|
+
return String(this.node.kind());
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public get text(): string {
|
|
95
|
+
return this.node.text();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public get isNamed(): boolean {
|
|
99
|
+
return this.node.isNamed();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public get hasError(): boolean {
|
|
103
|
+
return (
|
|
104
|
+
this.type === "ERROR" ||
|
|
105
|
+
this.node.children().some((child) => new NativeSyntaxNode(child, this.source).hasError)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
public get startIndex(): number {
|
|
110
|
+
return byteOffsetToStringIndex(this.source, this.node.range().start.index);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
public get endIndex(): number {
|
|
114
|
+
return byteOffsetToStringIndex(this.source, this.node.range().end.index);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public get startPosition(): { row: number; column: number } {
|
|
118
|
+
const { line: row, column } = this.node.range().start;
|
|
119
|
+
return { row, column };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
public get endPosition(): { row: number; column: number } {
|
|
123
|
+
const { line: row, column } = this.node.range().end;
|
|
124
|
+
return { row, column };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
public get parent(): SyntaxNode | null {
|
|
128
|
+
const parent = this.node.parent();
|
|
129
|
+
return parent ? new NativeSyntaxNode(parent, this.source) : null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public get namedChildCount(): number {
|
|
133
|
+
return this.namedChildren.length;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public get namedChildren(): readonly SyntaxNode[] {
|
|
137
|
+
return this.node
|
|
138
|
+
.children()
|
|
139
|
+
.filter((child) => child.isNamed())
|
|
140
|
+
.map((child) => new NativeSyntaxNode(child, this.source));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public childForFieldName(name: string): SyntaxNode | null {
|
|
144
|
+
const child = this.node.field(name);
|
|
145
|
+
return child ? new NativeSyntaxNode(child, this.source) : null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function byteOffsetToStringIndex(source: string, byteOffset: number): number {
|
|
150
|
+
return Buffer.from(source).subarray(0, byteOffset).toString("utf8").length;
|
|
151
|
+
}
|
|
@@ -11,18 +11,23 @@ import {
|
|
|
11
11
|
|
|
12
12
|
import { collectFiles } from "./collect-files.js";
|
|
13
13
|
import { AstScopeManager, parseDocument, type ScopeEntry } from "./manager.js";
|
|
14
|
+
import { EXTENSION_LANGUAGES } from "./native-parser.js";
|
|
14
15
|
import { readTextFile } from "./read-text.js";
|
|
15
16
|
|
|
16
|
-
import type
|
|
17
|
+
import type { SyntaxNode } from "./syntax-tree.js";
|
|
17
18
|
|
|
18
19
|
const SUPPORTED_EXTENSIONS = new Set([
|
|
20
|
+
...Object.keys(EXTENSION_LANGUAGES),
|
|
19
21
|
".ts",
|
|
20
22
|
".tsx",
|
|
23
|
+
".mts",
|
|
24
|
+
".cts",
|
|
21
25
|
".js",
|
|
22
26
|
".jsx",
|
|
23
27
|
".mjs",
|
|
24
28
|
".cjs",
|
|
25
29
|
".py",
|
|
30
|
+
".pyi",
|
|
26
31
|
".rs",
|
|
27
32
|
".c",
|
|
28
33
|
".cc",
|
|
@@ -271,7 +276,7 @@ export class AstOutlineManager {
|
|
|
271
276
|
}
|
|
272
277
|
|
|
273
278
|
private async createSourceViewBlock(
|
|
274
|
-
node:
|
|
279
|
+
node: SyntaxNode,
|
|
275
280
|
filePath: string,
|
|
276
281
|
displayPath: string,
|
|
277
282
|
cwd: string,
|
|
@@ -387,10 +392,10 @@ function resolvePath(filePath: string, cwd: string): string {
|
|
|
387
392
|
return path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
|
|
388
393
|
}
|
|
389
394
|
|
|
390
|
-
function findSymbol(root:
|
|
391
|
-
let result:
|
|
395
|
+
function findSymbol(root: SyntaxNode, symbol: string): SyntaxNode | undefined {
|
|
396
|
+
let result: SyntaxNode | undefined;
|
|
392
397
|
|
|
393
|
-
const visit = (node:
|
|
398
|
+
const visit = (node: SyntaxNode): void => {
|
|
394
399
|
if (result) {
|
|
395
400
|
return;
|
|
396
401
|
}
|
|
@@ -409,7 +414,7 @@ function findSymbol(root: WTS.Node, symbol: string): WTS.Node | undefined {
|
|
|
409
414
|
return result;
|
|
410
415
|
}
|
|
411
416
|
|
|
412
|
-
function getNodeName(node:
|
|
417
|
+
function getNodeName(node: SyntaxNode): string | undefined {
|
|
413
418
|
const nameField = node.childForFieldName("name");
|
|
414
419
|
|
|
415
420
|
if (nameField && NAME_TYPES.has(nameField.type)) {
|
|
@@ -436,7 +441,7 @@ function getNodeName(node: WTS.Node): string | undefined {
|
|
|
436
441
|
return undefined;
|
|
437
442
|
}
|
|
438
443
|
|
|
439
|
-
function findNestedName(node:
|
|
444
|
+
function findNestedName(node: SyntaxNode): string | undefined {
|
|
440
445
|
if (NAME_TYPES.has(node.type)) {
|
|
441
446
|
return node.text;
|
|
442
447
|
}
|
|
@@ -452,7 +457,7 @@ function findNestedName(node: WTS.Node): string | undefined {
|
|
|
452
457
|
return undefined;
|
|
453
458
|
}
|
|
454
459
|
|
|
455
|
-
function unwrapDeclaration(node:
|
|
460
|
+
function unwrapDeclaration(node: SyntaxNode): SyntaxNode {
|
|
456
461
|
const parent = node.parent;
|
|
457
462
|
|
|
458
463
|
if (
|
|
@@ -473,7 +478,7 @@ interface MappedCharacter {
|
|
|
473
478
|
}
|
|
474
479
|
|
|
475
480
|
function renderNodeLines(
|
|
476
|
-
node:
|
|
481
|
+
node: SyntaxNode,
|
|
477
482
|
source: string,
|
|
478
483
|
extension: string,
|
|
479
484
|
maxDepth: number,
|
|
@@ -573,7 +578,7 @@ function mapReplacement(replacement: Replacement): MappedCharacter[] {
|
|
|
573
578
|
}
|
|
574
579
|
|
|
575
580
|
function collapseDeepNode(
|
|
576
|
-
node:
|
|
581
|
+
node: SyntaxNode,
|
|
577
582
|
replacements: Replacement[],
|
|
578
583
|
depth: number,
|
|
579
584
|
maxDepth: number,
|
|
@@ -588,7 +593,7 @@ function collapseDeepNode(
|
|
|
588
593
|
return true;
|
|
589
594
|
}
|
|
590
595
|
function collectDataReplacements(
|
|
591
|
-
node:
|
|
596
|
+
node: SyntaxNode,
|
|
592
597
|
extension: string,
|
|
593
598
|
replacements: Replacement[],
|
|
594
599
|
maxDepth: number,
|
|
@@ -613,7 +618,7 @@ function collectDataReplacements(
|
|
|
613
618
|
}
|
|
614
619
|
}
|
|
615
620
|
|
|
616
|
-
function isDataScalar(node:
|
|
621
|
+
function isDataScalar(node: SyntaxNode, extension: string): boolean {
|
|
617
622
|
const scalarTypes =
|
|
618
623
|
extension === ".json" || extension === ".jsonc"
|
|
619
624
|
? ["string", "number", "true", "false", "null"]
|
|
@@ -641,7 +646,7 @@ function isDataScalar(node: WTS.Node, extension: string): boolean {
|
|
|
641
646
|
return scalarTypes.includes(node.type);
|
|
642
647
|
}
|
|
643
648
|
|
|
644
|
-
function isDataKey(node:
|
|
649
|
+
function isDataKey(node: SyntaxNode): boolean {
|
|
645
650
|
let ancestor = node.parent;
|
|
646
651
|
|
|
647
652
|
while (
|
|
@@ -658,7 +663,7 @@ function isDataKey(node: WTS.Node): boolean {
|
|
|
658
663
|
}
|
|
659
664
|
|
|
660
665
|
function collectReplacements(
|
|
661
|
-
node:
|
|
666
|
+
node: SyntaxNode,
|
|
662
667
|
extension: string,
|
|
663
668
|
replacements: Replacement[],
|
|
664
669
|
topLevel: boolean,
|
|
@@ -718,7 +723,7 @@ function collectReplacements(
|
|
|
718
723
|
}
|
|
719
724
|
}
|
|
720
725
|
|
|
721
|
-
function isTopLevelInterfaceNode(node:
|
|
726
|
+
function isTopLevelInterfaceNode(node: SyntaxNode): boolean {
|
|
722
727
|
return (
|
|
723
728
|
DECLARATION_TYPES.has(node.type) ||
|
|
724
729
|
IMPORT_TYPES.has(node.type) ||
|
|
@@ -727,7 +732,7 @@ function isTopLevelInterfaceNode(node: WTS.Node): boolean {
|
|
|
727
732
|
);
|
|
728
733
|
}
|
|
729
734
|
|
|
730
|
-
function findBody(node:
|
|
735
|
+
function findBody(node: SyntaxNode): SyntaxNode | undefined {
|
|
731
736
|
const fieldBody = node.childForFieldName("body");
|
|
732
737
|
|
|
733
738
|
if (fieldBody) {
|
|
@@ -747,7 +752,7 @@ interface BodyPlaceholder {
|
|
|
747
752
|
readonly lineSourceLines: readonly (number | undefined)[];
|
|
748
753
|
}
|
|
749
754
|
|
|
750
|
-
function renderBodyPlaceholder(body:
|
|
755
|
+
function renderBodyPlaceholder(body: SyntaxNode, extension: string): BodyPlaceholder {
|
|
751
756
|
const startLine = body.startPosition.row + 1;
|
|
752
757
|
const endLine = body.endPosition.row + 1;
|
|
753
758
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface SyntaxPosition {
|
|
2
|
+
readonly row: number;
|
|
3
|
+
readonly column: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** Parser-neutral syntax node used by AST outlines and scope anchors. */
|
|
7
|
+
export interface SyntaxNode {
|
|
8
|
+
readonly type: string;
|
|
9
|
+
readonly text: string;
|
|
10
|
+
readonly isNamed: boolean;
|
|
11
|
+
readonly hasError: boolean;
|
|
12
|
+
readonly startIndex: number;
|
|
13
|
+
readonly endIndex: number;
|
|
14
|
+
readonly startPosition: SyntaxPosition;
|
|
15
|
+
readonly endPosition: SyntaxPosition;
|
|
16
|
+
readonly parent: SyntaxNode | null;
|
|
17
|
+
readonly namedChildren: readonly SyntaxNode[];
|
|
18
|
+
readonly namedChildCount: number;
|
|
19
|
+
childForFieldName(name: string): SyntaxNode | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Parser-neutral syntax tree used by AST read views. */
|
|
23
|
+
export interface SyntaxTree {
|
|
24
|
+
readonly rootNode: SyntaxNode;
|
|
25
|
+
}
|
|
@@ -9,9 +9,38 @@ import { parseDocument } from "./ast/manager.js";
|
|
|
9
9
|
|
|
10
10
|
import type { DoctorPlugin } from "pi-agent-doctor/api/plugin-protocol";
|
|
11
11
|
|
|
12
|
+
const unsupportedReasons: Readonly<Record<string, string>> = {
|
|
13
|
+
cmake: "no compatible Tree-sitter parser is packaged",
|
|
14
|
+
dockerfile: "no compatible Tree-sitter parser is packaged",
|
|
15
|
+
julia: "no compatible Tree-sitter parser is packaged",
|
|
16
|
+
powershell: "no compatible Tree-sitter parser is packaged",
|
|
17
|
+
r: "no compatible Tree-sitter parser is packaged",
|
|
18
|
+
svelte: "the container grammar is not available as an ast-grep language package",
|
|
19
|
+
terraform: "the HCL grammar is not available as an ast-grep language package",
|
|
20
|
+
vue: "the container grammar is not available as an ast-grep language package",
|
|
21
|
+
xml: "no compatible Tree-sitter parser is packaged",
|
|
22
|
+
zig: "no compatible Tree-sitter parser is packaged",
|
|
23
|
+
};
|
|
24
|
+
|
|
12
25
|
const supported = new Set([
|
|
13
26
|
"c",
|
|
14
27
|
"cpp",
|
|
28
|
+
"csharp",
|
|
29
|
+
"css",
|
|
30
|
+
"dart",
|
|
31
|
+
"elixir",
|
|
32
|
+
"go",
|
|
33
|
+
"html",
|
|
34
|
+
"java",
|
|
35
|
+
"kotlin",
|
|
36
|
+
"lua",
|
|
37
|
+
"markdown",
|
|
38
|
+
"php",
|
|
39
|
+
"ruby",
|
|
40
|
+
"scala",
|
|
41
|
+
"shell",
|
|
42
|
+
"sql",
|
|
43
|
+
"swift",
|
|
15
44
|
"javascript",
|
|
16
45
|
"typescript",
|
|
17
46
|
"python",
|
|
@@ -59,9 +88,15 @@ export const astDoctorPlugin: DoctorPlugin = {
|
|
|
59
88
|
const findings = [];
|
|
60
89
|
|
|
61
90
|
for (const language of context.detectedLanguageIds) {
|
|
62
|
-
|
|
91
|
+
const unsupportedReason = unsupportedReasons[language];
|
|
92
|
+
if (unsupportedReason !== undefined) {
|
|
93
|
+
findings.push({
|
|
94
|
+
status: "skip" as const,
|
|
95
|
+
message: `${language} AST is unavailable: ${unsupportedReason}`,
|
|
96
|
+
});
|
|
63
97
|
continue;
|
|
64
98
|
}
|
|
99
|
+
if (!supported.has(language)) continue;
|
|
65
100
|
|
|
66
101
|
const file = context.files.find((candidate) => matchesLanguage(candidate, language));
|
|
67
102
|
|
|
@@ -118,6 +153,22 @@ function matchesLanguage(file: string, language: string): boolean {
|
|
|
118
153
|
const extensions: Record<string, readonly string[]> = {
|
|
119
154
|
c: [".c", ".h"],
|
|
120
155
|
cpp: [".cc", ".cpp", ".cxx", ".hh", ".hpp", ".hxx"],
|
|
156
|
+
csharp: [".cs"],
|
|
157
|
+
css: [".css", ".scss", ".less"],
|
|
158
|
+
dart: [".dart"],
|
|
159
|
+
elixir: [".ex", ".exs"],
|
|
160
|
+
go: [".go"],
|
|
161
|
+
html: [".html", ".htm"],
|
|
162
|
+
java: [".java"],
|
|
163
|
+
kotlin: [".kt", ".kts"],
|
|
164
|
+
lua: [".lua"],
|
|
165
|
+
markdown: [".md", ".mdx"],
|
|
166
|
+
php: [".php"],
|
|
167
|
+
ruby: [".rb", ".rake"],
|
|
168
|
+
scala: [".scala", ".sc"],
|
|
169
|
+
shell: [".sh", ".bash"],
|
|
170
|
+
sql: [".sql"],
|
|
171
|
+
swift: [".swift"],
|
|
121
172
|
javascript: [".js", ".jsx", ".mjs", ".cjs"],
|
|
122
173
|
typescript: [".ts", ".tsx", ".mts", ".cts"],
|
|
123
174
|
python: [".py", ".pyi"],
|
|
@@ -59,7 +59,10 @@ export function createAstSearchResolver(
|
|
|
59
59
|
kind: "resolved",
|
|
60
60
|
payload: {
|
|
61
61
|
pattern,
|
|
62
|
-
matches: selected.raw,
|
|
62
|
+
matches: selected.raw.map((match, index) => ({
|
|
63
|
+
...match,
|
|
64
|
+
selection: selected.matches[index],
|
|
65
|
+
})),
|
|
63
66
|
complete: selected.complete,
|
|
64
67
|
sessionId: session.id,
|
|
65
68
|
},
|
|
@@ -57,7 +57,9 @@ export default async function registerGitChanges(pi: ExtensionAPI): Promise<void
|
|
|
57
57
|
api.onDidEdit((completion) => {
|
|
58
58
|
transactions.observe(completion);
|
|
59
59
|
});
|
|
60
|
-
api.addMutationTool(
|
|
60
|
+
api.addMutationTool(
|
|
61
|
+
createUndoMutationTool(executor, transactions, indexQueue, api.restoreApplyUndo),
|
|
62
|
+
);
|
|
61
63
|
for (const action of ["stage", "unstage"] as const) {
|
|
62
64
|
const tool = createIndexChangeTool(action, executor, indexQueue);
|
|
63
65
|
api.addScriptIndexOperation({
|