pi-agent-ide 0.6.2 → 0.6.4
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 +66 -0
- package/README.md +8 -1
- package/dist/chunk-2P2OGO3G.js +2 -0
- package/dist/{chunk-5QQABP47.js → chunk-3BBJZSMS.js} +1 -1
- package/dist/chunk-5J43L2RL.js +11 -0
- package/dist/{chunk-ITSNK5YG.js → chunk-7AVXUV4A.js} +2 -2
- package/dist/chunk-BAYETTZZ.js +16 -0
- package/dist/{chunk-VCTK4JSN.js → chunk-BSICWXMH.js} +1 -1
- package/dist/chunk-BVK5A7ED.js +28 -0
- package/dist/{chunk-ZM4L5AGN.js → chunk-EDURPQAV.js} +3 -2
- package/dist/{chunk-L7JMDDSD.js → chunk-FBOW7XOV.js} +1 -1
- package/dist/{chunk-25CZ5ZIU.js → chunk-FUG2TEKI.js} +1 -1
- package/dist/chunk-FZBCKIJJ.js +1 -0
- package/dist/chunk-HPUAIWIH.js +25 -0
- package/dist/chunk-I5JLCFUX.js +1 -0
- package/dist/chunk-KUPHNMUK.js +2 -0
- package/dist/{chunk-NTYXZ3EL.js → chunk-KVHDMIZS.js} +1 -1
- package/dist/{chunk-QDST6VIU.js → chunk-KZC7TI5M.js} +1 -1
- package/dist/chunk-MIZAFRDR.js +1 -0
- package/dist/chunk-PJPA5EEE.js +2 -0
- package/dist/{chunk-GUTQ3PWL.js → chunk-PLKYHUNT.js} +1 -1
- package/dist/chunk-QEJGED4V.js +28 -0
- package/dist/chunk-SILJ3OL4.js +9 -0
- package/dist/{chunk-VXD6FZP5.js → chunk-TQZBVOTT.js} +3 -3
- package/dist/chunk-VBICI5YA.js +1 -0
- package/dist/chunk-VWW3RLUX.js +12 -0
- package/dist/{chunk-O6LE42GK.js → chunk-WJTHY6AG.js} +1 -1
- package/dist/chunk-YGGKGZO2.js +1 -0
- package/dist/chunk-ZODCBFBL.js +2 -0
- package/dist/chunk-ZPT5D4VP.js +2 -0
- package/dist/entry-0.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-16.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +2 -2
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +1 -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 +11 -11
- package/dist/entry-33.js +1 -1
- package/dist/entry-37.js +2 -2
- package/dist/entry-42.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +13 -12
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +4 -4
- package/dist/entry-51.js +9 -9
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-55.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -0
- package/dist/entry-72.js +0 -1
- package/dist/entry-73.js +1 -0
- package/dist/entry-74.js +0 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +1 -315
- package/dist/entry-78.js +324 -25
- package/dist/entry-79.js +18 -2
- package/dist/entry-80.js +2 -1
- package/dist/entry-81.js +1 -1
- package/dist/entry-82.js +1 -3
- package/dist/entry-83.js +5 -3
- package/dist/entry-84.js +3 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -0
- package/dist/pi-agent-ide.js +15 -3
- package/docs/agent-guides/apply.md +1 -1
- package/docs/agent-guides/editing.md +16 -0
- package/docs/agent-guides/json-reading.md +19 -3
- package/docs/agent-guides/read-resources.md +6 -0
- package/docs/agent-guides/search-code.md +5 -1
- package/docs/agent-guides/terminal.md +1 -1
- package/docs/code-review.md +99 -0
- package/docs/configuration.md +34 -0
- package/docs/development.md +15 -19
- package/docs/nightly.md +7 -0
- package/docs/releases.md +42 -0
- package/docs/research/native-codemode-batch-decision.md +27 -0
- package/docs/research/native-codemode-batching.md +65 -0
- package/docs/structured-results.md +59 -0
- package/docs/tools.md +18 -2
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-documentation/src/index.ts +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +6 -1
- package/node_modules/pi-agent-filesystem/package.json +7 -6
- package/node_modules/pi-agent-filesystem/src/path-recovery.ts +109 -0
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- 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 +10 -10
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +6 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +17 -0
- package/node_modules/pi-agent-ide-changes/index.ts +3 -9
- package/node_modules/pi-agent-ide-changes/package.json +8 -7
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +125 -47
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +19 -0
- 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 +7 -7
- package/node_modules/pi-agent-read/src/api/tools/read.ts +31 -2
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +216 -0
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +119 -72
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +12 -0
- package/node_modules/pi-agent-resource/src/resource-access.ts +55 -0
- package/node_modules/pi-agent-resource/src/resource-scheduler.ts +204 -0
- package/node_modules/pi-agent-resource/src/tool-result.ts +125 -0
- package/node_modules/pi-agent-search/package.json +5 -4
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/node_modules/pi-agent-search/src/api/search.ts +11 -0
- package/node_modules/pi-agent-search/src/api/structured-result.ts +93 -0
- package/node_modules/pi-agent-search/src/core/extension.ts +40 -14
- package/node_modules/pi-agent-search/src/core/search-core.ts +136 -77
- package/node_modules/pi-agent-search-text/index.ts +3 -0
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/resolvers.ts +17 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +104 -8
- package/node_modules/pi-agent-search-text/src/search-query.ts +42 -34
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +18 -4
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +37 -3
- package/node_modules/pi-agent-search-text/src/search-session.ts +21 -13
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-document.ts +15 -10
- 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-exact/src/anchor.ts +4 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/index.ts +4 -2
- package/node_modules/pi-agent-text-editor/package.json +21 -17
- package/node_modules/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +95 -34
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +20 -11
- package/node_modules/pi-agent-text-editor/src/core/apply/structured-result.ts +251 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +32 -12
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +154 -132
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +74 -18
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +640 -0
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +314 -0
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +52 -11
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +143 -138
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +242 -116
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +109 -47
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +24 -3
- package/node_modules/pi-agent-text-editor-renderer/index.ts +8 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +7 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +262 -129
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
- package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +16 -1
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.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-82.js +1 -0
- package/node_modules/pi-agent-web/index.ts +20 -0
- package/node_modules/pi-agent-web/package.json +8 -7
- package/node_modules/pi-agent-web/src/search.ts +112 -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/node_modules/pi-agent-web-text/runtime/entry-87.js +2 -0
- package/package.json +42 -36
- package/skills/capture-code-review-rule/SKILL.md +60 -0
- package/src/code-review/config.ts +68 -0
- package/src/code-review/extension.ts +105 -0
- package/src/code-review/fragments.ts +26 -0
- package/src/code-review/reviewer.ts +198 -0
- package/src/composite/host-version.ts +13 -0
- package/src/composite/nested-tool-rendering.ts +298 -0
- package/src/composite/tool-availability.ts +90 -0
- package/src/core/extension.ts +2 -0
- package/src/documentation/extension.ts +81 -145
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +6 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -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-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/path-recovery.ts +109 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +20 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -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-87.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-83.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +112 -0
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +31 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +216 -0
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +119 -72
- package/src/extensions/pi-agent-search/package.json +5 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +3 -0
- 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/resolvers.ts +17 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +104 -8
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +42 -34
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +18 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +37 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +21 -13
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/src/extensions/pi-agent-search/src/api/search.ts +11 -0
- package/src/extensions/pi-agent-search/src/api/structured-result.ts +93 -0
- package/src/extensions/pi-agent-search/src/core/extension.ts +40 -14
- package/src/extensions/pi-agent-search/src/core/search-core.ts +136 -77
- package/src/extensions/pi-agent-text-editor/index.ts +4 -2
- package/src/extensions/pi-agent-text-editor/package.json +21 -17
- 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-exact/src/anchor.ts +4 -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-editor-renderer/index.ts +8 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +7 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +262 -129
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +16 -1
- 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-80.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +95 -34
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +20 -11
- package/src/extensions/pi-agent-text-editor/src/core/apply/structured-result.ts +251 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +32 -12
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +154 -132
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +74 -18
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +640 -0
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +314 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +52 -11
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +143 -138
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +242 -116
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +109 -47
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +24 -3
- package/src/pi-agent-ide.ts +61 -2
- package/src/plugins/pi-agent-ide-ast/package.json +10 -10
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +6 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +17 -0
- package/src/plugins/pi-agent-ide-changes/index.ts +3 -9
- package/src/plugins/pi-agent-ide-changes/package.json +8 -7
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +125 -47
- package/src/plugins/pi-agent-ide-debugger/index.ts +63 -17
- package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +18 -2
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +24 -4
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +68 -2
- package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +357 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -3
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +13 -13
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +19 -0
- package/src/plugins/pi-agent-ide-terminal/index.ts +12 -2
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +65 -30
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +13 -8
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +1 -0
- package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +100 -0
- package/src/plugins/pi-agent-ide-terminal/src/steering.ts +62 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +97 -45
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +3 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +15 -6
- package/src/plugins/pi-agent-ide-vision/index.ts +16 -1
- package/dist/chunk-3E2NTWCN.js +0 -2
- package/dist/chunk-4LUW26BX.js +0 -10
- package/dist/chunk-5VSE5X5R.js +0 -2
- package/dist/chunk-CEX3VOJ7.js +0 -2
- package/dist/chunk-FA6BKC5Y.js +0 -1
- package/dist/chunk-FEDVTZJG.js +0 -1
- package/dist/chunk-HMLH43ZS.js +0 -4
- package/dist/chunk-KII2JQC5.js +0 -1
- package/dist/chunk-LVWMWWWF.js +0 -28
- package/dist/chunk-P7XO5CIP.js +0 -2
- package/dist/chunk-PZFOOHY2.js +0 -15
- package/dist/chunk-S3ZPXWX7.js +0 -2
- package/dist/chunk-T7CZIACQ.js +0 -27
- package/dist/chunk-YT42LKFV.js +0 -16
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
- /package/dist/{chunk-4U2GUKNJ.js → chunk-F7NVAC4Q.js} +0 -0
- /package/dist/{chunk-ROXXK6TW.js → chunk-PXWDDBBC.js} +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-81.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import spawn from "cross-spawn";
|
|
2
|
+
import type { ChildProcessWithoutNullStreams } from "node:child_process";
|
|
3
|
+
import { cp, mkdtemp, readdir, rm, stat } from "node:fs/promises";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import net from "node:net";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
import {
|
|
9
|
+
createMessageConnection,
|
|
10
|
+
StreamMessageReader,
|
|
11
|
+
StreamMessageWriter,
|
|
12
|
+
type Message,
|
|
13
|
+
type MessageConnection,
|
|
14
|
+
} from "vscode-jsonrpc/node";
|
|
15
|
+
|
|
16
|
+
import { DapClient } from "./dap-client.js";
|
|
17
|
+
import type { DebugSessionOptions } from "./session-manager.js";
|
|
18
|
+
|
|
19
|
+
/** Java executable shared by the owned language server and target JVM. */
|
|
20
|
+
export function javaExecutable(env: NodeJS.ProcessEnv = process.env): string {
|
|
21
|
+
return (
|
|
22
|
+
env.PI_JAVA_PATH ??
|
|
23
|
+
(env.JAVA_HOME === undefined
|
|
24
|
+
? "java"
|
|
25
|
+
: path.join(env.JAVA_HOME, "bin", process.platform === "win32" ? "java.exe" : "java"))
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Resolve the actual Java debugger files, with no dependency on the Kotlin adapter. */
|
|
30
|
+
export async function javaDebuggerFiles(
|
|
31
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
32
|
+
platform: NodeJS.Platform = process.platform,
|
|
33
|
+
): Promise<{ launcher: string; configuration: string; plugin: string }> {
|
|
34
|
+
const home = env.PI_JDTLS_HOME ?? "/opt/pi-debug-adapters/jdtls";
|
|
35
|
+
const plugin =
|
|
36
|
+
env.PI_JAVA_DEBUG_PLUGIN_PATH ??
|
|
37
|
+
"/opt/pi-debug-adapters/java-debug/com.microsoft.java.debug.plugin-0.53.2.jar";
|
|
38
|
+
const configuration = path.join(home, platform === "win32" ? "config_win" : "config_linux");
|
|
39
|
+
try {
|
|
40
|
+
const launchers = (await readdir(path.join(home, "plugins"))).filter((name) =>
|
|
41
|
+
/^org\.eclipse\.equinox\.launcher_[^/]+\.jar$/u.test(name),
|
|
42
|
+
);
|
|
43
|
+
if (launchers.length !== 1) throw new Error("Expected one Equinox launcher jar");
|
|
44
|
+
const launcher = path.join(home, "plugins", launchers[0] as string);
|
|
45
|
+
if (
|
|
46
|
+
!(await stat(launcher)).isFile() ||
|
|
47
|
+
!(await stat(plugin)).isFile() ||
|
|
48
|
+
!(await stat(configuration)).isDirectory()
|
|
49
|
+
) {
|
|
50
|
+
throw new Error("Expected JDT LS configuration and Java debug plugin files");
|
|
51
|
+
}
|
|
52
|
+
return { launcher, configuration, plugin };
|
|
53
|
+
} catch (error) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`Java debugger requires JDT LS (PI_JDTLS_HOME) and java-debug plugin (PI_JAVA_DEBUG_PLUGIN_PATH): ${error instanceof Error ? error.message : String(error)}`,
|
|
56
|
+
{ cause: error },
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Own one JDT LS/java-debug server and a suspended target JVM for a Java session. */
|
|
62
|
+
export class JavaDebugRuntime {
|
|
63
|
+
#server?: ChildProcessWithoutNullStreams;
|
|
64
|
+
#target?: ChildProcessWithoutNullStreams;
|
|
65
|
+
#connection?: MessageConnection;
|
|
66
|
+
#client?: DapClient;
|
|
67
|
+
#directory?: string;
|
|
68
|
+
#closing?: Promise<void>;
|
|
69
|
+
|
|
70
|
+
/** Owned JVM ids, useful for checking cleanup without searching by process name. */
|
|
71
|
+
get processIds(): readonly number[] {
|
|
72
|
+
return [this.#server?.pid, this.#target?.pid].filter((pid): pid is number => pid !== undefined);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Start the documented JDT LS bridge and target; neither attach nor resume the target yet. */
|
|
76
|
+
async start(
|
|
77
|
+
options: DebugSessionOptions,
|
|
78
|
+
signal: AbortSignal,
|
|
79
|
+
): Promise<{
|
|
80
|
+
client: DapClient;
|
|
81
|
+
attach: Readonly<Record<string, unknown>>;
|
|
82
|
+
}> {
|
|
83
|
+
signal.throwIfAborted();
|
|
84
|
+
if (options.mainClass === undefined) throw new Error("Java debug sessions require mainClass");
|
|
85
|
+
const classPaths = await javaClassPaths(options);
|
|
86
|
+
const client = await this.connect(options.cwd, signal);
|
|
87
|
+
// Port 0 is allocated by the target itself. suspend=y protects the first breakpoint
|
|
88
|
+
// until java-debug attaches, installs listeners, and receives configurationDone.
|
|
89
|
+
signal.throwIfAborted();
|
|
90
|
+
this.#target = this.#spawn(
|
|
91
|
+
[
|
|
92
|
+
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=127.0.0.1:0",
|
|
93
|
+
"-cp",
|
|
94
|
+
classPaths.join(path.delimiter),
|
|
95
|
+
options.mainClass,
|
|
96
|
+
...options.args,
|
|
97
|
+
],
|
|
98
|
+
options.cwd,
|
|
99
|
+
process.env,
|
|
100
|
+
);
|
|
101
|
+
const targetPort = await targetReady(this.#target, signal);
|
|
102
|
+
let sourceRoot = path.dirname(options.sourceFile);
|
|
103
|
+
for (const _segment of options.mainClass.split(".").slice(1))
|
|
104
|
+
sourceRoot = path.dirname(sourceRoot);
|
|
105
|
+
return {
|
|
106
|
+
client,
|
|
107
|
+
attach: {
|
|
108
|
+
hostName: "127.0.0.1",
|
|
109
|
+
port: targetPort,
|
|
110
|
+
timeout: 10_000,
|
|
111
|
+
sourcePaths: [sourceRoot],
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Open the documented Java DAP bridge without launching a target, also used by Doctor. */
|
|
117
|
+
async connect(
|
|
118
|
+
cwd: string,
|
|
119
|
+
signal: AbortSignal,
|
|
120
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
121
|
+
): Promise<DapClient> {
|
|
122
|
+
signal.throwIfAborted();
|
|
123
|
+
const files = await javaDebuggerFiles(env);
|
|
124
|
+
this.#directory = await mkdtemp(path.join(tmpdir(), "pi-java-debug-"));
|
|
125
|
+
const configuration = path.join(this.#directory, "configuration");
|
|
126
|
+
await cp(files.configuration, configuration, { recursive: true });
|
|
127
|
+
const serverEnv = { ...env };
|
|
128
|
+
delete serverEnv.CLIENT_PORT;
|
|
129
|
+
delete serverEnv.CLIENT_HOST;
|
|
130
|
+
signal.throwIfAborted();
|
|
131
|
+
this.#server = this.#spawn(
|
|
132
|
+
[
|
|
133
|
+
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
|
|
134
|
+
"-Dosgi.bundles.defaultStartLevel=4",
|
|
135
|
+
"-Declipse.product=org.eclipse.jdt.ls.core.product",
|
|
136
|
+
"-Xmx512m",
|
|
137
|
+
"--add-modules=ALL-SYSTEM",
|
|
138
|
+
"--add-opens",
|
|
139
|
+
"java.base/java.util=ALL-UNNAMED",
|
|
140
|
+
"--add-opens",
|
|
141
|
+
"java.base/java.lang=ALL-UNNAMED",
|
|
142
|
+
"-jar",
|
|
143
|
+
files.launcher,
|
|
144
|
+
"-configuration",
|
|
145
|
+
configuration,
|
|
146
|
+
"-data",
|
|
147
|
+
path.join(this.#directory, "workspace"),
|
|
148
|
+
],
|
|
149
|
+
cwd,
|
|
150
|
+
serverEnv,
|
|
151
|
+
);
|
|
152
|
+
const server = this.#server;
|
|
153
|
+
// Do not enqueue JSON-RPC writes until spawn succeeds; failed spawns destroy stdin.
|
|
154
|
+
await bounded(
|
|
155
|
+
new Promise<void>((resolve, reject) => {
|
|
156
|
+
server.once("spawn", resolve);
|
|
157
|
+
server.once("error", reject);
|
|
158
|
+
}),
|
|
159
|
+
signal,
|
|
160
|
+
);
|
|
161
|
+
const crashed = new AbortController();
|
|
162
|
+
const writer = new (class extends StreamMessageWriter {
|
|
163
|
+
override async write(message: Message): Promise<void> {
|
|
164
|
+
try {
|
|
165
|
+
await super.write(message);
|
|
166
|
+
} catch (error) {
|
|
167
|
+
// jsonrpc's async request executor rethrows writer failures as unhandled promises.
|
|
168
|
+
// Route the transport failure to the bounded startup instead.
|
|
169
|
+
crashed.abort(error);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
})(server.stdin);
|
|
173
|
+
const connection = createMessageConnection(new StreamMessageReader(server.stdout), writer);
|
|
174
|
+
this.#connection = connection;
|
|
175
|
+
let stderr = "";
|
|
176
|
+
server.stderr.on("data", (chunk: Buffer) => {
|
|
177
|
+
stderr = (stderr + chunk.toString()).slice(-4_000);
|
|
178
|
+
});
|
|
179
|
+
server.once("error", (error) => crashed.abort(error));
|
|
180
|
+
server.once("exit", (code) =>
|
|
181
|
+
crashed.abort(new Error(`Java debugger language server exited (${String(code)}): ${stderr}`)),
|
|
182
|
+
);
|
|
183
|
+
const startupSignal = AbortSignal.any([signal, crashed.signal]);
|
|
184
|
+
connection.onRequest("workspace/configuration", (parameters: { items: unknown[] }) =>
|
|
185
|
+
parameters.items.map(() => null),
|
|
186
|
+
);
|
|
187
|
+
connection.onRequest("client/registerCapability", () => null);
|
|
188
|
+
connection.onRequest("window/workDoneProgress/create", () => null);
|
|
189
|
+
connection.listen();
|
|
190
|
+
await bounded(
|
|
191
|
+
connection.sendRequest("initialize", {
|
|
192
|
+
processId: process.pid,
|
|
193
|
+
rootUri: pathToFileURL(cwd).href,
|
|
194
|
+
capabilities: {},
|
|
195
|
+
initializationOptions: {
|
|
196
|
+
bundles: [files.plugin],
|
|
197
|
+
settings: { java: { import: { gradle: { enabled: false }, maven: { enabled: false } } } },
|
|
198
|
+
},
|
|
199
|
+
}),
|
|
200
|
+
startupSignal,
|
|
201
|
+
);
|
|
202
|
+
await connection.sendNotification("initialized", {});
|
|
203
|
+
const port = await bounded(
|
|
204
|
+
connection.sendRequest<unknown>("workspace/executeCommand", {
|
|
205
|
+
command: "vscode.java.startDebugSession",
|
|
206
|
+
arguments: [],
|
|
207
|
+
}),
|
|
208
|
+
startupSignal,
|
|
209
|
+
);
|
|
210
|
+
if (typeof port !== "number" || !Number.isInteger(port) || port < 1 || port > 65_535) {
|
|
211
|
+
throw new Error("JDT LS did not return a Java DAP port; check PI_JAVA_DEBUG_PLUGIN_PATH");
|
|
212
|
+
}
|
|
213
|
+
this.#client = await connectDap(port, startupSignal);
|
|
214
|
+
return this.#client;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Stop only the two owned JVMs, close transports, and remove the private server workspace. */
|
|
218
|
+
close(): Promise<void> {
|
|
219
|
+
this.#closing ??= this.#close();
|
|
220
|
+
return this.#closing;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async #close(): Promise<void> {
|
|
224
|
+
this.#client?.close();
|
|
225
|
+
this.#connection?.dispose();
|
|
226
|
+
await Promise.all([stopProcess(this.#target), stopProcess(this.#server)]);
|
|
227
|
+
if (this.#directory !== undefined)
|
|
228
|
+
await rm(this.#directory, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
#spawn(
|
|
232
|
+
args: readonly string[],
|
|
233
|
+
cwd: string,
|
|
234
|
+
env: NodeJS.ProcessEnv,
|
|
235
|
+
): ChildProcessWithoutNullStreams {
|
|
236
|
+
const child = spawn(javaExecutable(env), [...args], {
|
|
237
|
+
cwd,
|
|
238
|
+
env,
|
|
239
|
+
stdio: "pipe",
|
|
240
|
+
windowsHide: true,
|
|
241
|
+
}) as ChildProcessWithoutNullStreams;
|
|
242
|
+
// Closing a failed server can race its pending JSON-RPC writes.
|
|
243
|
+
child.stdin.on("error", () => {});
|
|
244
|
+
return child;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function connectDap(port: number, signal: AbortSignal): Promise<DapClient> {
|
|
249
|
+
signal.throwIfAborted();
|
|
250
|
+
return new Promise((resolve, reject) => {
|
|
251
|
+
const socket = net.createConnection({ port, host: "127.0.0.1" });
|
|
252
|
+
const abort = (): void => {
|
|
253
|
+
socket.destroy();
|
|
254
|
+
reject(signal.reason);
|
|
255
|
+
};
|
|
256
|
+
const cleanup = (): void => {
|
|
257
|
+
signal.removeEventListener("abort", abort);
|
|
258
|
+
};
|
|
259
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
260
|
+
socket.once("error", (error) => {
|
|
261
|
+
cleanup();
|
|
262
|
+
reject(error);
|
|
263
|
+
});
|
|
264
|
+
socket.once("connect", () => {
|
|
265
|
+
cleanup();
|
|
266
|
+
resolve(DapClient.fromSocket(socket));
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
async function javaClassPaths(options: DebugSessionOptions): Promise<string[]> {
|
|
271
|
+
const mainFile = `${(options.mainClass as string).replaceAll(".", path.sep)}.class`;
|
|
272
|
+
const candidates = ["build/classes/java/main", "target/classes", "out/production", "bin", "."];
|
|
273
|
+
const paths: string[] = [];
|
|
274
|
+
for (const candidate of candidates) {
|
|
275
|
+
const directory = path.resolve(options.cwd, candidate);
|
|
276
|
+
try {
|
|
277
|
+
if ((await stat(path.join(directory, mainFile))).isFile()) paths.push(directory);
|
|
278
|
+
} catch {
|
|
279
|
+
/* This build output is not present. */
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (paths.length === 0)
|
|
283
|
+
throw new Error(
|
|
284
|
+
`Java main class ${options.mainClass} is not compiled. Compile with javac -g into build/classes/java/main, target/classes, out/production, bin, or the project directory.`,
|
|
285
|
+
);
|
|
286
|
+
return paths;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
async function bounded<T>(operation: Promise<T>, signal: AbortSignal): Promise<T> {
|
|
290
|
+
let abort: () => void = () => {};
|
|
291
|
+
const cancelled = new Promise<never>((_resolve, reject) => {
|
|
292
|
+
abort = () => reject(signal.reason);
|
|
293
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
294
|
+
if (signal.aborted) abort();
|
|
295
|
+
});
|
|
296
|
+
try {
|
|
297
|
+
return await Promise.race([operation, cancelled]);
|
|
298
|
+
} finally {
|
|
299
|
+
signal.removeEventListener("abort", abort);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function targetReady(child: ChildProcessWithoutNullStreams, signal: AbortSignal): Promise<number> {
|
|
304
|
+
return bounded(
|
|
305
|
+
new Promise<number>((resolve, reject) => {
|
|
306
|
+
let output = "";
|
|
307
|
+
const consume = (chunk: Buffer): void => {
|
|
308
|
+
output = (output + chunk.toString()).slice(-4_000);
|
|
309
|
+
const match = /Listening for transport dt_socket at address: (\d+)/u.exec(output);
|
|
310
|
+
if (match !== null) resolve(Number(match[1]));
|
|
311
|
+
};
|
|
312
|
+
child.stdout.on("data", consume);
|
|
313
|
+
child.stderr.on("data", consume);
|
|
314
|
+
child.once("error", reject);
|
|
315
|
+
child.once("exit", (code) =>
|
|
316
|
+
reject(new Error(`Java target exited before JDWP was ready (${String(code)}): ${output}`)),
|
|
317
|
+
);
|
|
318
|
+
}),
|
|
319
|
+
signal,
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
async function stopProcess(child: ChildProcessWithoutNullStreams | undefined): Promise<void> {
|
|
324
|
+
if (
|
|
325
|
+
child === undefined ||
|
|
326
|
+
child.pid === undefined ||
|
|
327
|
+
child.exitCode !== null ||
|
|
328
|
+
child.signalCode !== null
|
|
329
|
+
)
|
|
330
|
+
return;
|
|
331
|
+
await new Promise<void>((resolve, reject) => {
|
|
332
|
+
const cleanup = (): void => {
|
|
333
|
+
clearTimeout(force);
|
|
334
|
+
clearTimeout(deadline);
|
|
335
|
+
child.removeListener("exit", exited);
|
|
336
|
+
child.removeListener("error", failed);
|
|
337
|
+
};
|
|
338
|
+
const exited = (): void => {
|
|
339
|
+
cleanup();
|
|
340
|
+
resolve();
|
|
341
|
+
};
|
|
342
|
+
const failed = (error: Error): void => {
|
|
343
|
+
cleanup();
|
|
344
|
+
reject(error);
|
|
345
|
+
};
|
|
346
|
+
const force = setTimeout(() => {
|
|
347
|
+
child.kill("SIGKILL");
|
|
348
|
+
}, 500);
|
|
349
|
+
const deadline = setTimeout(() => {
|
|
350
|
+
cleanup();
|
|
351
|
+
reject(new Error(`Could not stop owned Java process ${String(child.pid)} within 2 seconds`));
|
|
352
|
+
}, 2_000);
|
|
353
|
+
child.once("exit", exited);
|
|
354
|
+
child.once("error", failed);
|
|
355
|
+
child.kill();
|
|
356
|
+
});
|
|
357
|
+
}
|
|
@@ -9,6 +9,7 @@ import { tmpdir } from "node:os";
|
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
|
|
11
11
|
import { resolvePythonDebuggerCommand } from "./adapter-executables.js";
|
|
12
|
+
import { JavaDebugRuntime } from "./java-runtime.js";
|
|
12
13
|
import { sameFilePath } from "pi-agent-ide/api/path-identity";
|
|
13
14
|
import {
|
|
14
15
|
DapClient,
|
|
@@ -100,6 +101,7 @@ export interface DebugSession {
|
|
|
100
101
|
controlClient?: DapClient;
|
|
101
102
|
clients?: DapClient[];
|
|
102
103
|
adapterProcess?: ChildProcess;
|
|
104
|
+
javaRuntime?: JavaDebugRuntime;
|
|
103
105
|
adapterTemporaryDirectory?: string;
|
|
104
106
|
targetReady?: Promise<void>;
|
|
105
107
|
resolveTargetReady?: () => void;
|
|
@@ -263,9 +265,54 @@ export class DebugSessionManager {
|
|
|
263
265
|
|
|
264
266
|
/** Launch the debuggee, configure breakpoints, and wait for a stop or termination. */
|
|
265
267
|
async start(session: DebugSession, signal?: AbortSignal): Promise<DebugSession> {
|
|
268
|
+
if (session.options.adapter === "java") return this.#startJava(session, signal);
|
|
266
269
|
return this.#start(session, signal, 2);
|
|
267
270
|
}
|
|
268
271
|
|
|
272
|
+
async #startJava(session: DebugSession, signal?: AbortSignal): Promise<DebugSession> {
|
|
273
|
+
if (session.status !== "configured") throw new Error(`Session is already ${session.status}`);
|
|
274
|
+
const runtime = new JavaDebugRuntime();
|
|
275
|
+
session.javaRuntime = runtime;
|
|
276
|
+
const startupSignal = AbortSignal.any([
|
|
277
|
+
...(signal === undefined ? [] : [signal]),
|
|
278
|
+
AbortSignal.timeout(30_000),
|
|
279
|
+
]);
|
|
280
|
+
const abortStartup = (): void => {
|
|
281
|
+
void runtime.close();
|
|
282
|
+
};
|
|
283
|
+
session.status = "running";
|
|
284
|
+
this.#notify(session);
|
|
285
|
+
try {
|
|
286
|
+
const { client, attach } = await runtime.start(session.options, startupSignal);
|
|
287
|
+
session.client = client;
|
|
288
|
+
session.controlClient = client;
|
|
289
|
+
startupSignal.addEventListener("abort", abortStartup, { once: true });
|
|
290
|
+
session.clients = [client];
|
|
291
|
+
await initializeClient(client, "java", startupSignal);
|
|
292
|
+
await Promise.all([
|
|
293
|
+
client.waitForAnyEvent(["initialized"], 30_000, startupSignal),
|
|
294
|
+
client.request("attach", attach, { signal: startupSignal }),
|
|
295
|
+
]);
|
|
296
|
+
await this.#configureBreakpoints(session, client, startupSignal);
|
|
297
|
+
// java-debug installs its event listeners before configurationDone resumes the JVM.
|
|
298
|
+
await client.request("configurationDone", undefined, { signal: startupSignal });
|
|
299
|
+
await this.#waitForStop(session, startupSignal);
|
|
300
|
+
if (this.snapshot(session).status === "terminated") await runtime.close();
|
|
301
|
+
return session;
|
|
302
|
+
} catch (error) {
|
|
303
|
+
await runtime.close();
|
|
304
|
+
session.javaRuntime = undefined;
|
|
305
|
+
session.client = undefined;
|
|
306
|
+
session.controlClient = undefined;
|
|
307
|
+
session.clients = undefined;
|
|
308
|
+
session.status = "configured";
|
|
309
|
+
this.#notify(session);
|
|
310
|
+
throw error;
|
|
311
|
+
} finally {
|
|
312
|
+
startupSignal.removeEventListener("abort", abortStartup);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
269
316
|
async #start(
|
|
270
317
|
session: DebugSession,
|
|
271
318
|
signal: AbortSignal | undefined,
|
|
@@ -309,7 +356,7 @@ export class DebugSessionManager {
|
|
|
309
356
|
await initialized;
|
|
310
357
|
await this.#configureBreakpoints(session, client, signal);
|
|
311
358
|
const configurationDone = client.request("configurationDone", undefined, { signal });
|
|
312
|
-
if (session.options.adapter === "
|
|
359
|
+
if (session.options.adapter === "kotlin") {
|
|
313
360
|
// kotlin-debug-adapter deliberately keeps this response pending for the session lifetime.
|
|
314
361
|
void configurationDone.catch(() => {});
|
|
315
362
|
} else {
|
|
@@ -372,6 +419,7 @@ export class DebugSessionManager {
|
|
|
372
419
|
session.status = "running";
|
|
373
420
|
this.#notify(session);
|
|
374
421
|
await this.#waitForStop(session, signal);
|
|
422
|
+
if (this.snapshot(session).status === "terminated") await session.javaRuntime?.close();
|
|
375
423
|
return session;
|
|
376
424
|
}
|
|
377
425
|
|
|
@@ -424,6 +472,7 @@ export class DebugSessionManager {
|
|
|
424
472
|
.catch(() => {});
|
|
425
473
|
for (const client of session.clients ?? [session.client]) client.close();
|
|
426
474
|
}
|
|
475
|
+
await session.javaRuntime?.close();
|
|
427
476
|
await terminateOwnedAdapterProcess(session.adapterProcess);
|
|
428
477
|
await removeAdapterTemporaryDirectory(session);
|
|
429
478
|
session.status = "terminated";
|
|
@@ -432,18 +481,21 @@ export class DebugSessionManager {
|
|
|
432
481
|
}
|
|
433
482
|
|
|
434
483
|
/** Stop all owned adapter processes during Pi shutdown. */
|
|
435
|
-
dispose(): void {
|
|
484
|
+
async dispose(): Promise<void> {
|
|
485
|
+
const javaCleanup: Promise<void>[] = [];
|
|
436
486
|
for (const session of this.#sessions.values()) {
|
|
437
487
|
for (const client of session.clients ??
|
|
438
488
|
(session.client === undefined ? [] : [session.client])) {
|
|
439
489
|
client.close();
|
|
440
490
|
}
|
|
491
|
+
if (session.javaRuntime !== undefined) javaCleanup.push(session.javaRuntime.close());
|
|
441
492
|
void terminateOwnedAdapterProcess(session.adapterProcess);
|
|
442
493
|
if (session.adapterTemporaryDirectory !== undefined) {
|
|
443
494
|
rmSync(session.adapterTemporaryDirectory, { recursive: true, force: true });
|
|
444
495
|
}
|
|
445
496
|
}
|
|
446
497
|
this.#sessions.clear();
|
|
498
|
+
await Promise.all(javaCleanup);
|
|
447
499
|
}
|
|
448
500
|
|
|
449
501
|
async #startRubyAdapter(session: DebugSession): Promise<DapClient> {
|
|
@@ -1193,7 +1245,7 @@ async function adapterRecipe(
|
|
|
1193
1245
|
launch: { ...common, type: "python", console: "internalConsole", justMyCode: false },
|
|
1194
1246
|
};
|
|
1195
1247
|
}
|
|
1196
|
-
if (options.adapter === "
|
|
1248
|
+
if (options.adapter === "kotlin") {
|
|
1197
1249
|
if (options.mainClass === undefined) {
|
|
1198
1250
|
throw new Error("Java and Kotlin debug sessions require mainClass");
|
|
1199
1251
|
}
|
|
@@ -106,13 +106,11 @@ export default async function registerDiagnostics(pi: ExtensionAPI): Promise<voi
|
|
|
106
106
|
if (check && context.result) {
|
|
107
107
|
return {
|
|
108
108
|
kind: "continue",
|
|
109
|
-
context
|
|
110
|
-
|
|
111
|
-
result
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
},
|
|
115
|
-
},
|
|
109
|
+
context,
|
|
110
|
+
transform: (result) => ({
|
|
111
|
+
...result,
|
|
112
|
+
details: { ...result.details, diagnosticCheck: check },
|
|
113
|
+
}),
|
|
116
114
|
};
|
|
117
115
|
}
|
|
118
116
|
const document = documents.get(context.request);
|
|
@@ -122,15 +120,17 @@ export default async function registerDiagnostics(pi: ExtensionAPI): Promise<voi
|
|
|
122
120
|
if (!status || !result || first?.type !== "text") return { kind: "continue", context };
|
|
123
121
|
return {
|
|
124
122
|
kind: "continue",
|
|
125
|
-
context
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
context,
|
|
124
|
+
transform(updated) {
|
|
125
|
+
const first = updated.content[0];
|
|
126
|
+
if (first?.type !== "text") return updated;
|
|
127
|
+
return {
|
|
128
|
+
...updated,
|
|
129
129
|
content: [
|
|
130
130
|
{ ...first, text: `${status}\n${first.text}` },
|
|
131
|
-
...
|
|
131
|
+
...updated.content.slice(1),
|
|
132
132
|
],
|
|
133
|
-
}
|
|
133
|
+
};
|
|
134
134
|
},
|
|
135
135
|
};
|
|
136
136
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-formatter",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-doctor": "0.6.
|
|
6
|
+
"pi-agent-doctor": "0.6.4"
|
|
7
7
|
},
|
|
8
8
|
"pi": {
|
|
9
9
|
"extensions": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"@earendil-works/pi-coding-agent": "*",
|
|
15
|
-
"pi-agent-ide": "0.6.
|
|
15
|
+
"pi-agent-ide": "0.6.4"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"pi-agent-ide": {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-lint",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-doctor": "0.6.
|
|
7
|
-
"pi-agent-invariant": "0.6.
|
|
8
|
-
"pi-agent-read": "0.6.
|
|
9
|
-
"pi-agent-resource": "0.6.
|
|
10
|
-
"pi-agent-text": "0.6.
|
|
6
|
+
"pi-agent-doctor": "0.6.4",
|
|
7
|
+
"pi-agent-invariant": "0.6.4",
|
|
8
|
+
"pi-agent-read": "0.6.4",
|
|
9
|
+
"pi-agent-resource": "0.6.4",
|
|
10
|
+
"pi-agent-text": "0.6.4"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@earendil-works/pi-coding-agent": "*",
|
|
19
|
-
"pi-agent-ide": "0.6.
|
|
19
|
+
"pi-agent-ide": "0.6.4"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
22
22
|
"pi-agent-ide": {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-lsp",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"cross-spawn": "^7.0.6",
|
|
7
|
-
"pi-agent-doctor": "0.6.
|
|
8
|
-
"pi-agent-invariant": "0.6.
|
|
9
|
-
"pi-agent-read": "0.6.
|
|
10
|
-
"pi-agent-resource": "0.6.
|
|
11
|
-
"pi-agent-search": "0.6.
|
|
12
|
-
"pi-agent-text": "0.6.
|
|
13
|
-
"pi-agent-text-editor": "0.6.
|
|
7
|
+
"pi-agent-doctor": "0.6.4",
|
|
8
|
+
"pi-agent-invariant": "0.6.4",
|
|
9
|
+
"pi-agent-read": "0.6.4",
|
|
10
|
+
"pi-agent-resource": "0.6.4",
|
|
11
|
+
"pi-agent-search": "0.6.4",
|
|
12
|
+
"pi-agent-text": "0.6.4",
|
|
13
|
+
"pi-agent-text-editor": "0.6.4",
|
|
14
14
|
"vscode-jsonrpc": "^9.0.0",
|
|
15
15
|
"vscode-uri": "^3.1.0"
|
|
16
16
|
},
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@earendil-works/pi-coding-agent": "*",
|
|
24
|
-
"pi-agent-ide": "0.6.
|
|
24
|
+
"pi-agent-ide": "0.6.4"
|
|
25
25
|
},
|
|
26
26
|
"peerDependenciesMeta": {
|
|
27
27
|
"pi-agent-ide": {
|
|
@@ -9,6 +9,25 @@ export function createLspSearchResolver(
|
|
|
9
9
|
): SearchResolver {
|
|
10
10
|
return {
|
|
11
11
|
id: "symbols",
|
|
12
|
+
// Workspace symbol backends may read beyond the requested path.
|
|
13
|
+
readResources: (request) => (request.query.startsWith("symbols:") ? undefined : []),
|
|
14
|
+
toScriptData(payload) {
|
|
15
|
+
const { query, hits } = payload as { query: string; hits: readonly SymbolHit[] };
|
|
16
|
+
return {
|
|
17
|
+
kind: "custom",
|
|
18
|
+
resolverId: "symbols",
|
|
19
|
+
value: {
|
|
20
|
+
query,
|
|
21
|
+
hits: hits.map((hit) => ({
|
|
22
|
+
source: hit.filePath,
|
|
23
|
+
lineNumber: hit.lineNumber,
|
|
24
|
+
column: hit.column,
|
|
25
|
+
kind: hit.kind,
|
|
26
|
+
name: hit.name,
|
|
27
|
+
})),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
},
|
|
12
31
|
async tryResolve(request, context) {
|
|
13
32
|
if (!request.query.startsWith("symbols:")) {
|
|
14
33
|
return { kind: "not-handled" };
|