pi-agent-ide 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/README.md +24 -29
- package/dist/chunk-2AY526TN.js +3 -0
- package/dist/{chunk-LEJKDYCK.js → chunk-2TZDG2JH.js} +1 -1
- package/dist/{chunk-XBQR74IK.js → chunk-4GBFIGH3.js} +1 -1
- package/dist/{chunk-PJL3UVMJ.js → chunk-4IWEKRSP.js} +1 -1
- package/dist/chunk-52PFWQMU.js +5 -0
- package/dist/chunk-5BGWNYQS.js +1 -0
- package/dist/{chunk-QUYXINGZ.js → chunk-5S74Z6Y4.js} +3 -3
- package/dist/chunk-64JTD2DJ.js +1 -0
- package/dist/{chunk-XAHU42FP.js → chunk-6A3ORNW3.js} +2 -2
- package/dist/{chunk-ANM3Y5FO.js → chunk-6WCHBHFW.js} +5 -5
- package/dist/{chunk-IMGIDBCC.js → chunk-7D7PXIVV.js} +1 -1
- package/dist/chunk-7PVDTMEM.js +1 -0
- package/dist/chunk-7SG756UO.js +4 -0
- package/dist/{chunk-GBUJOR6V.js → chunk-7URANI6I.js} +14 -14
- package/dist/{chunk-4W7GH3T7.js → chunk-AJZVKDYC.js} +1 -1
- package/dist/chunk-AMIIOWFL.js +1 -0
- package/dist/{chunk-TOYN4W4F.js → chunk-B25LXXNV.js} +1 -1
- package/dist/chunk-C2JT2G5K.js +1 -0
- package/dist/chunk-CVOYSEBE.js +1 -0
- package/dist/chunk-DDH3FP4G.js +3 -0
- package/dist/chunk-FEZLTM4L.js +1 -0
- package/dist/{chunk-CPELC6JE.js → chunk-FHRHYY4M.js} +1 -1
- package/dist/chunk-FKKAHI62.js +11 -0
- package/dist/chunk-FS3KCKFX.js +9 -0
- package/dist/chunk-FYOU4RBH.js +2 -0
- package/dist/chunk-G4PRFO6G.js +1 -0
- package/dist/chunk-GS5ZRTUG.js +1 -0
- package/dist/{chunk-XXLLY66B.js → chunk-GXL4NMHR.js} +1 -1
- package/dist/{chunk-QT3EAHOG.js → chunk-H3GEEOOL.js} +1 -1
- package/dist/chunk-H5Z54BEU.js +25 -0
- package/dist/chunk-H7WAM5RH.js +23 -0
- package/dist/chunk-HT7LZN5A.js +9 -0
- package/dist/chunk-IG5DXVDJ.js +1 -0
- package/dist/chunk-K4UTEMDU.js +1 -0
- package/dist/chunk-KFBRL2V4.js +3 -0
- package/dist/chunk-KN6VPARZ.js +1 -0
- package/dist/{chunk-RW2GTYQI.js → chunk-LF325WYO.js} +1 -1
- package/dist/chunk-LTADNZKW.js +2 -0
- package/dist/{chunk-YJ6T3PEP.js → chunk-MDD5ORB6.js} +1 -1
- package/dist/{chunk-S72FVLUX.js → chunk-MLFJU2US.js} +1 -1
- package/dist/chunk-NA2NEU4V.js +1 -0
- package/dist/chunk-OBTT5INC.js +6 -0
- package/dist/{chunk-IICJXZBU.js → chunk-OMNKD7WW.js} +3 -3
- package/dist/chunk-PLMHBXWI.js +10 -0
- package/dist/{chunk-235QMMVA.js → chunk-PQWANILR.js} +1 -1
- package/dist/{chunk-QRJLIV6P.js → chunk-QJ6V5IAY.js} +6 -6
- package/dist/chunk-QM5WDEFI.js +1 -0
- package/dist/{chunk-SMIFCAAX.js → chunk-RIJRPAL2.js} +1 -1
- package/dist/chunk-RIOPUTUJ.js +6 -0
- package/dist/chunk-RVFMH77U.js +82 -0
- package/dist/{chunk-NJ7C4KMA.js → chunk-SRFWT562.js} +1 -1
- package/dist/{chunk-U22JNO6N.js → chunk-STUZZM5B.js} +1 -1
- package/dist/{chunk-PT35ZFLH.js → chunk-TNAUCNUT.js} +12 -12
- package/dist/{chunk-DUUOCBS3.js → chunk-TVH2ND35.js} +1 -1
- package/dist/chunk-TVSZYABY.js +5 -0
- package/dist/chunk-TVXZE4KW.js +4 -0
- package/dist/chunk-U7YDLVFL.js +1 -0
- package/dist/{chunk-KZC7TI5M.js → chunk-UD3DMY3Q.js} +1 -1
- package/dist/{chunk-VXP5BMW7.js → chunk-USG6WHAT.js} +1 -1
- package/dist/{chunk-RMI3NMQY.js → chunk-V4J3TLCV.js} +2 -2
- package/dist/{chunk-ZPT5D4VP.js → chunk-VDJSH3DQ.js} +2 -2
- package/dist/{chunk-VMTOFEXF.js → chunk-VMLPXSMK.js} +1 -1
- package/dist/{chunk-6T7PSDQW.js → chunk-VN3XBH2Q.js} +1 -1
- package/dist/chunk-WAJW4G4F.js +22 -0
- package/dist/chunk-WEE3NM6L.js +1 -0
- package/dist/{chunk-IM24DB3K.js → chunk-WES2E4VR.js} +1 -1
- package/dist/{chunk-RIJMXO43.js → chunk-WQIMM4SU.js} +1 -1
- package/dist/chunk-WUO3UW4J.js +17 -0
- package/dist/chunk-XE4W5YTE.js +2 -0
- package/dist/chunk-XUYIK4TX.js +1 -0
- package/dist/{chunk-ZJQRLVVV.js → chunk-Y74EKJOY.js} +1 -1
- package/dist/{chunk-AAC77UD4.js → chunk-YPYROPQF.js} +1 -1
- package/dist/chunk-ZXO4D5UB.js +1 -0
- package/dist/entry-0.js +1 -1
- package/dist/entry-1.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 -1
- package/dist/entry-16.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-18.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -0
- 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 -1
- package/dist/entry-27.js +1 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -2
- package/dist/entry-3.js +1 -1
- package/dist/entry-30.js +2 -1
- package/dist/entry-31.js +1 -4
- package/dist/entry-32.js +1 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -18
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +15 -1
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +1 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +1 -1
- package/dist/entry-46.js +1 -1
- package/dist/entry-47.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -25
- package/dist/entry-5.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 -3
- package/dist/entry-55.js +1 -13
- 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-6.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -1
- package/dist/entry-65.js +1 -0
- package/dist/entry-66.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +0 -1
- package/dist/entry-7.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -1
- package/dist/entry-72.js +1 -1
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -0
- package/dist/entry-76.js +1 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +0 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +1 -1
- package/dist/entry-81.js +1 -80
- package/dist/entry-82.js +1 -22
- package/dist/entry-83.js +1 -2
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +2 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -1
- package/dist/entry-88.js +1 -3
- package/dist/entry-89.js +1 -1
- package/dist/entry-9.js +1 -1
- package/dist/entry-90.js +3 -1
- package/dist/entry-91.js +1 -1
- package/dist/entry-92.js +1 -0
- package/dist/entry-93.js +1 -0
- package/dist/pi-agent-ide.js +10 -34
- package/docs/agent-guides/ast-search.md +58 -0
- package/docs/agent-guides/debugger.md +1 -1
- package/docs/agent-guides/editing.md +26 -58
- package/docs/agent-guides/git-changes.md +4 -14
- package/docs/agent-guides/search.md +38 -0
- package/docs/agent-guides/ssh.md +17 -49
- package/docs/agent-guides/terminal.md +9 -15
- package/docs/configuration.md +9 -13
- package/docs/extensions.md +82 -0
- package/docs/settings-help.md +2 -2
- package/docs/structured-results.md +33 -11
- package/docs/tools.md +23 -22
- package/node_modules/pi-agent-doctor/package.json +7 -7
- package/node_modules/pi-agent-doctor/src/workspace.ts +0 -5
- package/node_modules/pi-agent-documentation/package.json +2 -2
- package/node_modules/pi-agent-documentation/runtime/entry-29.js +1 -0
- package/node_modules/pi-agent-documentation/src/index.ts +26 -10
- package/node_modules/pi-agent-filesystem/index.ts +1 -1
- package/node_modules/pi-agent-filesystem/package.json +8 -8
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-jq/index.ts +9 -63
- package/node_modules/pi-agent-filesystem-jq/package.json +12 -6
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
- package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-ide-ast/package.json +15 -15
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +13 -1
- package/node_modules/pi-agent-ide-ast/src/extension.ts +8 -8
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +104 -26
- package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
- package/node_modules/pi-agent-ide-changes/index.ts +1 -2
- package/node_modules/pi-agent-ide-changes/package.json +10 -10
- package/node_modules/pi-agent-ide-changes/runtime/entry-38.js +1 -0
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/runtime/entry-42.js +2 -0
- package/node_modules/pi-agent-ide-lsp/index.ts +22 -28
- package/node_modules/pi-agent-ide-lsp/package.json +14 -10
- package/node_modules/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
- package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
- package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
- package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-image/src/image-converter.ts +24 -1
- 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-pdf/src/pdf-converter.ts +23 -1
- package/node_modules/pi-agent-read/package.json +12 -12
- package/node_modules/pi-agent-read/runtime/entry-49.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-51.js +2 -0
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -7
- package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -0
- package/node_modules/pi-agent-read/src/core/extension.ts +0 -8
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
- package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +21 -8
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-resource/src/index.ts +8 -0
- package/node_modules/pi-agent-resource/src/resource-error-metadata.ts +89 -0
- package/node_modules/pi-agent-resource/src/resource-error.ts +6 -1
- package/node_modules/pi-agent-resource/src/result-images.ts +87 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +9 -3
- package/node_modules/pi-agent-resource/src/tool-result.ts +17 -0
- package/node_modules/pi-agent-search/package.json +9 -9
- package/node_modules/pi-agent-search/runtime/entry-54.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-55.js +1 -0
- package/node_modules/pi-agent-search/runtime/entry-56.js +2 -0
- package/node_modules/pi-agent-search/src/api/glob-list.ts +35 -0
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +8 -8
- package/node_modules/pi-agent-search/src/api/search.ts +14 -2
- package/node_modules/pi-agent-search/src/core/extension.ts +11 -20
- package/node_modules/pi-agent-search/src/core/search-core.ts +30 -10
- package/node_modules/pi-agent-search-text/index.ts +34 -12
- package/node_modules/pi-agent-search-text/package.json +17 -15
- package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
- package/node_modules/pi-agent-search-text/runtime/entry-60.js +1 -0
- package/node_modules/pi-agent-search-text/src/file-search.ts +59 -25
- package/node_modules/pi-agent-search-text/src/resolvers.ts +61 -16
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +9 -3
- package/node_modules/pi-agent-search-text/src/search-backend.ts +44 -48
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +19 -15
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -1
- package/node_modules/pi-agent-search-text/src/search-result.ts +6 -2
- package/node_modules/pi-agent-search-text/src/search-session.ts +1 -0
- package/node_modules/pi-agent-search-text/src/tool-file-search.ts +146 -0
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +1 -2
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
- package/node_modules/pi-agent-text-editor/package.json +26 -26
- package/node_modules/pi-agent-text-editor/runtime/entry-81.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-82.js +1 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
- package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -7
- package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
- package/node_modules/pi-agent-text-editor/src/core/image-write.ts +111 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
- package/node_modules/pi-agent-text-editor-renderer/index.ts +6 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/runtime/entry-87.js +1 -0
- package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
- package/node_modules/pi-agent-web/index.ts +28 -6
- package/node_modules/pi-agent-web/package.json +8 -8
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- 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-pdf/runtime/entry-92.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-93.js +2 -0
- package/package.json +61 -58
- package/src/api/approval.ts +2 -0
- package/src/api/read.ts +2 -0
- package/src/api/standalone.ts +7 -0
- package/src/backend/doctor-workspace.ts +0 -3
- package/src/backend/process-metadata-worker.py +9 -18
- package/src/backend/process-metadata.ts +11 -44
- package/src/backend/registration.ts +0 -10
- package/src/backend/web-browser-worker.mjs +2 -17
- package/src/backend/web-browser.ts +1 -26
- package/src/composite/builtin-extensions.ts +8 -6
- package/src/composite/ide-alias-rendering.ts +18 -2
- package/src/composite/module-labels.ts +0 -4
- package/src/composite/preferences.ts +0 -36
- package/src/composite/settings-documentation.ts +1 -2
- package/src/composite/text-results.ts +61 -23
- package/src/documentation/extension.ts +39 -15
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
- 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-jq/index.ts +9 -63
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +12 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
- 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-pdf/runtime/entry-34.js +2 -0
- 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-35.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-30.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
- 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-pdf/runtime/entry-92.js +2 -0
- 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-93.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-89.js +2 -0
- package/src/extensions/pi-agent-read/package.json +12 -12
- package/src/extensions/pi-agent-read/runtime/entry-49.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-50.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-51.js +2 -0
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -7
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -0
- package/src/extensions/pi-agent-read/src/core/extension.ts +0 -8
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
- package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +21 -8
- package/src/extensions/pi-agent-search/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +34 -12
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +17 -15
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-60.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +59 -25
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +61 -16
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +9 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +44 -48
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +19 -15
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +6 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +146 -0
- package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-55.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-56.js +2 -0
- package/src/extensions/pi-agent-search/src/api/glob-list.ts +35 -0
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +8 -8
- package/src/extensions/pi-agent-search/src/api/search.ts +14 -2
- package/src/extensions/pi-agent-search/src/core/extension.ts +11 -20
- package/src/extensions/pi-agent-search/src/core/search-core.ts +30 -10
- package/src/extensions/pi-agent-text-editor/package.json +26 -26
- 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-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +1 -2
- 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-65.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +6 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-82.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
- package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -7
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
- package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +111 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
- package/src/pi-agent-ide.ts +8 -15
- package/src/plugins/pi-agent-ide-ast/package.json +15 -15
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +13 -1
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +104 -26
- package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
- package/src/plugins/pi-agent-ide-changes/index.ts +1 -2
- package/src/plugins/pi-agent-ide-changes/package.json +10 -10
- package/src/plugins/pi-agent-ide-changes/runtime/entry-38.js +1 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
- package/src/plugins/pi-agent-ide-debugger/index.ts +17 -4
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +2 -11
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/runtime/entry-42.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/index.ts +22 -28
- package/src/plugins/pi-agent-ide-lsp/package.json +14 -10
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
- package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
- package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
- package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +61 -16
- package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +10 -7
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -3
- package/src/standalone/resource-host.ts +147 -0
- package/src/standalone/scoped-api.ts +457 -0
- package/dist/chunk-2RTCSZB3.js +0 -1
- package/dist/chunk-4DIUPEDF.js +0 -2
- package/dist/chunk-6EDOLYOV.js +0 -1
- package/dist/chunk-6FGLAVPJ.js +0 -1
- package/dist/chunk-6H32W35W.js +0 -1
- package/dist/chunk-6OJ565FL.js +0 -2
- package/dist/chunk-6R3Y4AD3.js +0 -1
- package/dist/chunk-6TJPMBUQ.js +0 -1
- package/dist/chunk-6XFUICD7.js +0 -1
- package/dist/chunk-BHSO2MDK.js +0 -6
- package/dist/chunk-GSOYVIQS.js +0 -1
- package/dist/chunk-HSRH76JN.js +0 -3
- package/dist/chunk-HSZ4AQ6L.js +0 -9
- package/dist/chunk-I6NPILT5.js +0 -1
- package/dist/chunk-K7SRNBIV.js +0 -1
- package/dist/chunk-LCWBVOII.js +0 -3
- package/dist/chunk-MKEC3U2M.js +0 -4
- package/dist/chunk-NUM3YQGK.js +0 -1
- package/dist/chunk-OM4LYD3S.js +0 -1
- package/dist/chunk-PLKYHUNT.js +0 -1
- package/dist/chunk-QIJMV2P2.js +0 -2
- package/dist/chunk-RVU73VKN.js +0 -2
- package/dist/chunk-SDAH3ECM.js +0 -5
- package/dist/chunk-SGQWRIRJ.js +0 -10
- package/dist/chunk-SWBJS3U4.js +0 -1
- package/dist/chunk-T7I2VX3J.js +0 -1
- package/dist/chunk-T7MWQQIF.js +0 -3
- package/dist/chunk-UEVGZUII.js +0 -3
- package/dist/chunk-VDP5CQHM.js +0 -3
- package/dist/chunk-XG7QNAKW.js +0 -9
- package/dist/chunk-XLWCSJMR.js +0 -1
- package/dist/chunk-YFP4P2FV.js +0 -1
- package/dist/chunk-YIXP2ALP.js +0 -9
- package/dist/entry-22.js +0 -1
- package/docs/agent-guides/diagnostics.md +0 -5
- package/docs/agent-guides/json-reading.md +0 -57
- package/docs/agent-guides/read-resources.md +0 -17
- package/docs/agent-guides/search-code.md +0 -76
- package/docs/agent-guides/select-code.md +0 -119
- package/docs/agent-guides/vision.md +0 -11
- package/node_modules/pi-agent-doctor/runtime/entry-22.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +0 -1
- package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
- package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
- package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +0 -204
- package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +0 -105
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +0 -387
- package/node_modules/pi-agent-ide-ast/src/selection-region.ts +0 -41
- package/node_modules/pi-agent-ide-ast/src/source-text.ts +0 -92
- package/node_modules/pi-agent-ide-ast/src/text-selection.ts +0 -214
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +0 -277
- package/node_modules/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
- package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
- package/node_modules/pi-agent-image/runtime/entry-42.js +0 -1
- package/node_modules/pi-agent-invariant/runtime/entry-43.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-search-text/runtime/entry-55.js +0 -2
- package/node_modules/pi-agent-search-text/runtime/entry-56.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
- package/node_modules/pi-agent-text-editor/runtime/entry-66.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +0 -1
- package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-87.js +0 -2
- package/node_modules/pi-agent-web-html/runtime/entry-88.js +0 -2
- package/src/backend/vision-capture-worker.py +0 -319
- package/src/backend/vision-capture.ts +0 -165
- package/src/backend/vision-registration.ts +0 -104
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +0 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-35.js +0 -2
- package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
- package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
- package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +0 -204
- package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +0 -105
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +0 -387
- package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +0 -41
- package/src/plugins/pi-agent-ide-ast/src/source-text.ts +0 -92
- package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +0 -214
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +0 -277
- package/src/plugins/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
- package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
- package/src/plugins/pi-agent-ide-vision/index.ts +0 -439
- package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +0 -47
- package/src/plugins/pi-agent-ide-vision/src/vision.ts +0 -585
- package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +0 -30
- package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +0 -33
- /package/dist/{chunk-U2JKHKLK.js → chunk-3PMHFEJY.js} +0 -0
- /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-28.js +0 -0
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
- /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
- /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-44.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-45.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-46.js +0 -0
- /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-50.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-52.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-59.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-61.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-65.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-86.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-89.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
- /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
- /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { requiredValue } from "pi-agent-invariant";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { fileURLToPath } from "node:url";
|
|
5
4
|
|
|
6
5
|
import {
|
|
7
6
|
formatCodeViewReference,
|
|
8
7
|
resolveCodeViewPath,
|
|
9
|
-
formatSourceViewResults,
|
|
10
8
|
formatSymbolSelector,
|
|
11
|
-
renderSourceViewLine,
|
|
12
|
-
type SourceMappedTextContent,
|
|
13
|
-
type SourceViewBlock,
|
|
14
9
|
} from "pi-agent-ide/api/code-view";
|
|
15
10
|
|
|
16
11
|
import { requestCallHierarchy, requestReferences } from "./navigation.js";
|
|
@@ -27,10 +22,6 @@ import type {
|
|
|
27
22
|
import type { LspDocumentSymbol } from "./symbols.js";
|
|
28
23
|
import type { LspRange } from "./types.js";
|
|
29
24
|
|
|
30
|
-
const SOURCE_VIEW_FORMAT_OPTIONS = {
|
|
31
|
-
failureLabel: "SYMBOL_READ_FAILED",
|
|
32
|
-
emptyReason: "no symbol source was produced.",
|
|
33
|
-
} as const;
|
|
34
25
|
const MAX_GROUPS = 10;
|
|
35
26
|
const MAX_ITEMS_PER_GROUP = 5;
|
|
36
27
|
const MAX_CALLS = 10;
|
|
@@ -97,49 +88,6 @@ interface SymbolRelations {
|
|
|
97
88
|
readonly calls: LspCallHierarchyResult;
|
|
98
89
|
}
|
|
99
90
|
|
|
100
|
-
export async function readLspSymbolBody(
|
|
101
|
-
manager: LspManager,
|
|
102
|
-
filePath: string,
|
|
103
|
-
selector: readonly string[],
|
|
104
|
-
cwd: string,
|
|
105
|
-
signal?: AbortSignal,
|
|
106
|
-
): Promise<SourceMappedTextContent> {
|
|
107
|
-
throwIfAborted(signal);
|
|
108
|
-
const document = await openCodeDocument(manager, filePath, cwd, signal);
|
|
109
|
-
const symbol = resolveLspCodeSymbol(document.symbols, selector, document.displayPath);
|
|
110
|
-
const snapshot = await readTextFile(document.filePath, manager, signal);
|
|
111
|
-
throwIfAborted(signal);
|
|
112
|
-
|
|
113
|
-
const startLine = symbol.range.start.line + 1;
|
|
114
|
-
const endLine = Math.min(symbol.range.end.line + 1, snapshot.lines.length);
|
|
115
|
-
const renderedLines = snapshot.lines
|
|
116
|
-
.slice(Math.max(0, startLine - 1), Math.max(0, endLine))
|
|
117
|
-
.map((content, index) => {
|
|
118
|
-
const lineNumber = startLine + index;
|
|
119
|
-
|
|
120
|
-
return renderSourceViewLine({
|
|
121
|
-
content,
|
|
122
|
-
sourceLine: {
|
|
123
|
-
source: document.filePath,
|
|
124
|
-
lineNumber,
|
|
125
|
-
content,
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
const block: SourceViewBlock = {
|
|
130
|
-
path: document.displayPath,
|
|
131
|
-
heading: `symbol: ${formatSymbolSelector(symbol.selector)}`,
|
|
132
|
-
details: [
|
|
133
|
-
`defined in: ${document.displayPath}:${startLine}-${endLine} (${symbolKindName(symbol.kind)})`,
|
|
134
|
-
],
|
|
135
|
-
startLine,
|
|
136
|
-
endLine,
|
|
137
|
-
totalLines: snapshot.lines.length,
|
|
138
|
-
renderedLines,
|
|
139
|
-
};
|
|
140
|
-
return formatSourceViewResults([block], SOURCE_VIEW_FORMAT_OPTIONS);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
91
|
export async function readLspSymbolGraph(
|
|
144
92
|
manager: LspManager,
|
|
145
93
|
filePath: string,
|
|
@@ -322,7 +270,7 @@ async function formatSymbolGraph(
|
|
|
322
270
|
const lines = [
|
|
323
271
|
`## graph: ${selector}`,
|
|
324
272
|
`Definition: ${document.displayPath} ${definitionAnchor} (${symbolKindName(symbol.kind)})`,
|
|
325
|
-
`Source: ${
|
|
273
|
+
`Source: calls ${callsReference(document.displayPath, symbol.selector)}`,
|
|
326
274
|
"",
|
|
327
275
|
...(await formatReferences(relations.references, locations)),
|
|
328
276
|
"",
|
|
@@ -430,14 +378,19 @@ async function formatFileGraphSymbol(
|
|
|
430
378
|
lines.push("Members:");
|
|
431
379
|
|
|
432
380
|
for (const child of symbol.children) {
|
|
433
|
-
const source =
|
|
434
|
-
lines.push(`- ${symbolKindName(child.kind)} ${child.name} — ${source}`);
|
|
381
|
+
const source = callsReference(document.displayPath, child.selector);
|
|
382
|
+
lines.push(`- ${symbolKindName(child.kind)} ${child.name} — calls ${source}`);
|
|
435
383
|
}
|
|
436
384
|
}
|
|
437
385
|
|
|
438
386
|
return lines;
|
|
439
387
|
}
|
|
440
388
|
|
|
389
|
+
/** The `lsp_search` `calls` value for a declaration, with the same encoding as symbol references. */
|
|
390
|
+
function callsReference(filePath: string, selector: readonly string[]): string {
|
|
391
|
+
return formatCodeViewReference("graph", filePath, selector).slice("graph:".length);
|
|
392
|
+
}
|
|
393
|
+
|
|
441
394
|
function summarize(items: readonly string[], limit = 5): string {
|
|
442
395
|
if (items.length === 0) {
|
|
443
396
|
return "none";
|
|
@@ -471,35 +424,6 @@ function groupLocationsByUri(locations: readonly LspLocation[]): [string, LspLoc
|
|
|
471
424
|
.sort(([left], [right]) => left.localeCompare(right));
|
|
472
425
|
}
|
|
473
426
|
|
|
474
|
-
interface TextFileSnapshot {
|
|
475
|
-
readonly lines: string[];
|
|
476
|
-
readonly content: string;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
async function readTextFile(
|
|
480
|
-
filePath: string,
|
|
481
|
-
manager: LspManager,
|
|
482
|
-
signal?: AbortSignal,
|
|
483
|
-
): Promise<TextFileSnapshot> {
|
|
484
|
-
const buffer = filePath.startsWith("ssh://")
|
|
485
|
-
? Buffer.from(await manager.readSourceBytes(filePath, signal))
|
|
486
|
-
: await readFile(filePath, { signal });
|
|
487
|
-
|
|
488
|
-
if (buffer.byteLength > 256 * 1024) {
|
|
489
|
-
throw new Error(`File exceeds the 262144-byte code-view limit: ${filePath}`);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
if (buffer.includes(0)) {
|
|
493
|
-
throw new Error(`File appears to be binary and cannot be read as text: ${filePath}`);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
const content = buffer.toString("utf8").replaceAll("\r\n", "\n");
|
|
497
|
-
const withoutFinalNewline = content.endsWith("\n") ? content.slice(0, -1) : content;
|
|
498
|
-
const lines = withoutFinalNewline.length === 0 ? [] : withoutFinalNewline.split("\n");
|
|
499
|
-
|
|
500
|
-
return { content, lines };
|
|
501
|
-
}
|
|
502
|
-
|
|
503
427
|
class LocationPresenter {
|
|
504
428
|
readonly #cwd: string;
|
|
505
429
|
|
|
@@ -22,12 +22,7 @@ export type { LspWorkspaceSymbol } from "./symbols.js";
|
|
|
22
22
|
|
|
23
23
|
export { requestCallHierarchy, requestReferences } from "./navigation.js";
|
|
24
24
|
|
|
25
|
-
export {
|
|
26
|
-
readLspFileGraph,
|
|
27
|
-
readLspSymbolBody,
|
|
28
|
-
readLspSymbolGraph,
|
|
29
|
-
resolveLspCodeSymbol,
|
|
30
|
-
} from "./code-views.js";
|
|
25
|
+
export { readLspFileGraph, readLspSymbolGraph, resolveLspCodeSymbol } from "./code-views.js";
|
|
31
26
|
|
|
32
27
|
export type { LspCodeSymbol } from "./code-views.js";
|
|
33
28
|
|
|
@@ -4,7 +4,11 @@ import { URI } from "vscode-uri";
|
|
|
4
4
|
import { documentUri } from "./document-uri.js";
|
|
5
5
|
import { createTextDocument } from "pi-agent-text";
|
|
6
6
|
import { verifyResultTargets, type ResolvedResultTargets } from "pi-agent-resource";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
containsSearchMatch,
|
|
9
|
+
splitGlobList,
|
|
10
|
+
type SearchSelectionMatch,
|
|
11
|
+
} from "pi-agent-search/api/search";
|
|
8
12
|
|
|
9
13
|
import { LspManager } from "./manager.js";
|
|
10
14
|
import { requestReferences, type LspLocation } from "./navigation.js";
|
|
@@ -60,16 +64,12 @@ function withinScope(file: string, cwd: string, scope: SymbolSearchScope): boole
|
|
|
60
64
|
return false;
|
|
61
65
|
const candidate = filesystem.relative(native(cwd), native(file)).split(filesystem.sep).join("/");
|
|
62
66
|
const matches = (patterns: string) =>
|
|
63
|
-
patterns
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
glob
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
glob,
|
|
70
|
-
)
|
|
71
|
-
);
|
|
72
|
-
});
|
|
67
|
+
splitGlobList(patterns).some((glob) =>
|
|
68
|
+
filesystem.matchesGlob(
|
|
69
|
+
glob.includes("/") ? candidate : filesystem.basename(native(file)),
|
|
70
|
+
glob,
|
|
71
|
+
),
|
|
72
|
+
);
|
|
73
73
|
return (
|
|
74
74
|
(scope.include === undefined || matches(scope.include)) &&
|
|
75
75
|
(scope.exclude === undefined || !matches(scope.exclude))
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LspManager } from "./lsp/index.js";
|
|
2
|
+
|
|
3
|
+
/** Resolve the language-server manager that owns a source, starting it on first use. */
|
|
4
|
+
export type LspManagerProvider = (
|
|
5
|
+
cwd: string,
|
|
6
|
+
filePath?: string,
|
|
7
|
+
signal?: AbortSignal,
|
|
8
|
+
) => Promise<LspManager>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import { parseCodeViewReference, resolveCodeViewPath } from "pi-agent-ide/api/code-view";
|
|
3
3
|
import type { TextEditPlan, TextPreEditState } from "pi-agent-text-editor/api/edit-pipeline";
|
|
4
|
-
import type { LspManagerProvider } from "./
|
|
4
|
+
import type { LspManagerProvider } from "./manager-provider.js";
|
|
5
5
|
import { resolveLspRenameTarget } from "./lsp/code-views.js";
|
|
6
6
|
import { requestRename, type LspWorkspaceEdit } from "./lsp/rename.js";
|
|
7
7
|
import type { LspClient } from "./lsp/client.js";
|
|
@@ -1,32 +1,163 @@
|
|
|
1
|
+
import { ResultPanel } from "pi-agent-tool-ui";
|
|
2
|
+
import { parseCodeViewReference, resolveCodeViewPath } from "pi-agent-ide/api/code-view";
|
|
1
3
|
import { verifyResultTargets, type ResolvedResultTargets } from "pi-agent-resource";
|
|
2
4
|
import {
|
|
5
|
+
renderSearchMatches,
|
|
3
6
|
selectionData,
|
|
4
7
|
type SearchPluginApi,
|
|
8
|
+
type SearchRequest,
|
|
5
9
|
type SearchResolver,
|
|
10
|
+
type SearchSelectionMatch,
|
|
6
11
|
} from "pi-agent-search/api/search";
|
|
7
|
-
import { searchSymbols, type SymbolHit } from "./lsp/symbol-search.js";
|
|
8
12
|
import path from "node:path";
|
|
9
|
-
import {
|
|
13
|
+
import { readLspFileGraph, readLspSymbolGraph, resolveLspDeclaration } from "./lsp/code-views.js";
|
|
10
14
|
import type { LspManager } from "./lsp/manager.js";
|
|
15
|
+
import { searchSymbols, type SymbolHit } from "./lsp/symbol-search.js";
|
|
16
|
+
|
|
17
|
+
/** Options the `lsp_search` tool passes in `SearchRequest.options.lsp`; their presence selects this resolver. */
|
|
18
|
+
export interface LspSearchOptions {
|
|
19
|
+
/** Workspace symbol names to find. */
|
|
20
|
+
readonly query?: string;
|
|
21
|
+
/** Follow symbols found inside the path scope to references outside it. */
|
|
22
|
+
readonly references?: boolean;
|
|
23
|
+
/** `file#selector`: the exact declaration as an editable selection. */
|
|
24
|
+
readonly declaration?: string;
|
|
25
|
+
/** `file` or `file#selector`: incoming and outgoing calls and references. */
|
|
26
|
+
readonly calls?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type ManagerFor = (cwd: string, source?: string, signal?: AbortSignal) => Promise<LspManager>;
|
|
11
30
|
|
|
12
|
-
|
|
31
|
+
type Payload =
|
|
32
|
+
| {
|
|
33
|
+
readonly mode: "symbols";
|
|
34
|
+
readonly sessionId: string;
|
|
35
|
+
readonly hits: readonly SymbolHit[];
|
|
36
|
+
readonly complete: boolean;
|
|
37
|
+
readonly references: boolean;
|
|
38
|
+
readonly data: unknown;
|
|
39
|
+
}
|
|
40
|
+
| {
|
|
41
|
+
readonly mode: "declaration";
|
|
42
|
+
readonly sessionId: string;
|
|
43
|
+
readonly selector: string;
|
|
44
|
+
readonly match: SearchSelectionMatch;
|
|
45
|
+
readonly data: unknown;
|
|
46
|
+
}
|
|
47
|
+
| { readonly mode: "calls"; readonly text: string };
|
|
48
|
+
|
|
49
|
+
function lspOptions(request: SearchRequest): LspSearchOptions | undefined {
|
|
50
|
+
const value = request.options?.lsp;
|
|
51
|
+
return typeof value === "object" && value !== null ? value : undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Language-server queries the resolver runs; tests can supply faithful implementations. */
|
|
55
|
+
export interface LspSearchBackend {
|
|
56
|
+
readonly resolveLspDeclaration: typeof resolveLspDeclaration;
|
|
57
|
+
readonly readLspFileGraph: typeof readLspFileGraph;
|
|
58
|
+
readonly readLspSymbolGraph: typeof readLspSymbolGraph;
|
|
59
|
+
readonly searchSymbols: typeof searchSymbols;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const defaultBackend: LspSearchBackend = {
|
|
63
|
+
resolveLspDeclaration,
|
|
64
|
+
readLspFileGraph,
|
|
65
|
+
readLspSymbolGraph,
|
|
66
|
+
searchSymbols,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** Language-server discovery, declarations and call graphs as shared source targets. */
|
|
13
70
|
export function createLspSearchResolver(
|
|
14
|
-
managerFor:
|
|
71
|
+
managerFor: ManagerFor,
|
|
15
72
|
registerSelection: SearchPluginApi["registerSelection"],
|
|
73
|
+
backend: LspSearchBackend = defaultBackend,
|
|
16
74
|
): SearchResolver {
|
|
17
75
|
return {
|
|
18
|
-
id: "
|
|
76
|
+
id: "lsp",
|
|
19
77
|
supportsResultScope: true,
|
|
20
78
|
// Workspace symbol backends may read beyond the requested path.
|
|
21
|
-
readResources: (request) => (request
|
|
79
|
+
readResources: (request) => (lspOptions(request) === undefined ? [] : undefined),
|
|
22
80
|
toScriptData(payload) {
|
|
23
|
-
|
|
81
|
+
const result = payload as Payload;
|
|
82
|
+
return result.mode === "calls"
|
|
83
|
+
? { kind: "custom", resolverId: "lsp", value: { calls: result.text } }
|
|
84
|
+
: result.data;
|
|
24
85
|
},
|
|
25
86
|
async tryResolve(request, context) {
|
|
26
|
-
|
|
27
|
-
|
|
87
|
+
const options = lspOptions(request);
|
|
88
|
+
if (options === undefined) return { kind: "not-handled" };
|
|
89
|
+
const modes = [options.query, options.declaration, options.calls].filter(
|
|
90
|
+
(value) => value !== undefined,
|
|
91
|
+
);
|
|
92
|
+
if (modes.length !== 1)
|
|
93
|
+
return {
|
|
94
|
+
kind: "failed",
|
|
95
|
+
error: new Error("Pass exactly one of query, declaration or calls."),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
if (options.calls !== undefined) {
|
|
99
|
+
const reference = parseCodeViewReference(`graph:${options.calls}`, "graph");
|
|
100
|
+
if (reference === undefined) throw new Error("calls requires a file path.");
|
|
101
|
+
const filePath = resolveCodeViewPath(reference.path, context.cwd);
|
|
102
|
+
const manager = await managerFor(context.cwd, filePath, context.signal);
|
|
103
|
+
const text =
|
|
104
|
+
reference.selector === undefined
|
|
105
|
+
? await backend.readLspFileGraph(manager, filePath, context.cwd, context.signal)
|
|
106
|
+
: await backend.readLspSymbolGraph(
|
|
107
|
+
manager,
|
|
108
|
+
filePath,
|
|
109
|
+
reference.selector,
|
|
110
|
+
context.cwd,
|
|
111
|
+
context.signal,
|
|
112
|
+
);
|
|
113
|
+
return { kind: "resolved", payload: { mode: "calls", text } satisfies Payload };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (options.declaration !== undefined) {
|
|
117
|
+
const reference = options.declaration.includes("#")
|
|
118
|
+
? parseCodeViewReference(`symbol:${options.declaration}`, "symbol")
|
|
119
|
+
: undefined;
|
|
120
|
+
if (reference?.selector === undefined)
|
|
121
|
+
throw new Error("declaration requires file#selector, such as src/app.ts#App/start.");
|
|
122
|
+
const filePath = resolveCodeViewPath(reference.path, context.cwd);
|
|
123
|
+
const selector = reference.selector;
|
|
124
|
+
const resolve = async (signal?: AbortSignal) => {
|
|
125
|
+
const manager = await managerFor(context.cwd, filePath, signal);
|
|
126
|
+
const found = await backend.resolveLspDeclaration(
|
|
127
|
+
manager,
|
|
128
|
+
filePath,
|
|
129
|
+
selector,
|
|
130
|
+
context.cwd,
|
|
131
|
+
signal,
|
|
132
|
+
);
|
|
133
|
+
return declarationMatch(found.source, found.content, found.range);
|
|
134
|
+
};
|
|
135
|
+
const match = await resolve(context.signal);
|
|
136
|
+
const session = await registerSelection(
|
|
137
|
+
{
|
|
138
|
+
request,
|
|
139
|
+
matches: [match],
|
|
140
|
+
complete: true,
|
|
141
|
+
refresh: async (signal) => ({ matches: [await resolve(signal)], complete: true }),
|
|
142
|
+
},
|
|
143
|
+
context,
|
|
144
|
+
);
|
|
145
|
+
return {
|
|
146
|
+
kind: "resolved",
|
|
147
|
+
payload: {
|
|
148
|
+
mode: "declaration",
|
|
149
|
+
sessionId: session.id,
|
|
150
|
+
selector: options.declaration,
|
|
151
|
+
match,
|
|
152
|
+
data: selectionData([match], true, session.id, session),
|
|
153
|
+
} satisfies Payload,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const query = (options.query ?? "").trim();
|
|
28
158
|
if (query.length === 0)
|
|
29
|
-
return { kind: "failed", error: new Error("
|
|
159
|
+
return { kind: "failed", error: new Error("query must not be empty") };
|
|
160
|
+
const references = options.references === true;
|
|
30
161
|
const scope = context.scope;
|
|
31
162
|
const groups = new Map<LspManager, ResolvedResultTargets["targets"][number][]>();
|
|
32
163
|
if (scope !== undefined) {
|
|
@@ -45,13 +176,16 @@ export function createLspSearchResolver(
|
|
|
45
176
|
const hits: SymbolHit[] = [];
|
|
46
177
|
let complete = scope?.complete ?? true;
|
|
47
178
|
for (const [manager, targets] of groups) {
|
|
48
|
-
const found = await searchSymbols(
|
|
179
|
+
const found = await backend.searchSymbols(
|
|
49
180
|
query,
|
|
50
181
|
manager.workspaceRoot,
|
|
51
182
|
limit,
|
|
52
183
|
signal,
|
|
53
184
|
{
|
|
54
|
-
...request,
|
|
185
|
+
...(request.path === undefined ? {} : { path: request.path }),
|
|
186
|
+
...(request.include === undefined ? {} : { include: request.include }),
|
|
187
|
+
...(request.exclude === undefined ? {} : { exclude: request.exclude }),
|
|
188
|
+
...(references ? { navigation: "references" as const } : {}),
|
|
55
189
|
...(scope === undefined
|
|
56
190
|
? {}
|
|
57
191
|
: { resultScope: { targets, complete: scope.complete } }),
|
|
@@ -81,11 +215,11 @@ export function createLspSearchResolver(
|
|
|
81
215
|
return {
|
|
82
216
|
kind: "resolved",
|
|
83
217
|
payload: {
|
|
84
|
-
|
|
218
|
+
mode: "symbols",
|
|
85
219
|
sessionId: session.id,
|
|
86
220
|
hits: found.hits,
|
|
87
221
|
complete: found.complete,
|
|
88
|
-
|
|
222
|
+
references,
|
|
89
223
|
data: {
|
|
90
224
|
...data,
|
|
91
225
|
matches: data.matches.map((match, index) => ({
|
|
@@ -94,40 +228,70 @@ export function createLspSearchResolver(
|
|
|
94
228
|
symbol: found.hits[index]?.symbol,
|
|
95
229
|
})),
|
|
96
230
|
},
|
|
97
|
-
},
|
|
231
|
+
} satisfies Payload,
|
|
98
232
|
};
|
|
99
233
|
},
|
|
100
234
|
renderResult(result, options, theme) {
|
|
101
|
-
const data = result.details as {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
235
|
+
const data = result.details as Payload & { cwd: string };
|
|
236
|
+
if (data.mode === "calls")
|
|
237
|
+
return new ResultPanel(
|
|
238
|
+
{
|
|
239
|
+
summary: data.text.split("\n", 1)[0] ?? "Calls",
|
|
240
|
+
rows: data.text
|
|
241
|
+
.split("\n")
|
|
242
|
+
.slice(1)
|
|
243
|
+
.map((text) => ({ kind: "note" as const, text })),
|
|
244
|
+
},
|
|
245
|
+
theme,
|
|
246
|
+
options.expanded,
|
|
247
|
+
);
|
|
248
|
+
if (data.mode === "declaration")
|
|
249
|
+
return renderSearchMatches(
|
|
250
|
+
[data.match],
|
|
251
|
+
true,
|
|
252
|
+
theme,
|
|
253
|
+
options.expanded,
|
|
254
|
+
data.cwd,
|
|
255
|
+
[],
|
|
256
|
+
[data.selector],
|
|
257
|
+
);
|
|
107
258
|
return renderSearchMatches(
|
|
108
259
|
data.hits,
|
|
109
260
|
data.complete,
|
|
110
261
|
theme,
|
|
111
262
|
options.expanded,
|
|
112
263
|
data.cwd,
|
|
113
|
-
data.navigation
|
|
114
|
-
? ["LSP reference navigation · may leave input scope"]
|
|
115
|
-
: [],
|
|
264
|
+
data.references ? ["LSP reference navigation · may leave input scope"] : [],
|
|
116
265
|
data.hits.map((hit) => `${hit.role} ${hit.symbol.name}`),
|
|
117
266
|
);
|
|
118
267
|
},
|
|
119
268
|
format(payload, context) {
|
|
120
|
-
const result = payload as
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
269
|
+
const result = payload as Payload;
|
|
270
|
+
const display = (source: string) =>
|
|
271
|
+
source.startsWith("ssh://") ? source : path.relative(context.cwd, source);
|
|
272
|
+
if (result.mode === "calls")
|
|
273
|
+
return { content: [{ type: "text", text: result.text }], details: result };
|
|
274
|
+
if (result.mode === "declaration") {
|
|
275
|
+
const { match } = result;
|
|
276
|
+
// A selection ending at column 0 of the next line ends on the line before it.
|
|
277
|
+
const end = match.endLineNumber ?? match.lineNumber;
|
|
278
|
+
const lastLine = end > match.lineNumber && match.endColumn === 0 ? end - 1 : end;
|
|
279
|
+
return {
|
|
280
|
+
content: [
|
|
281
|
+
{
|
|
282
|
+
type: "text",
|
|
283
|
+
text: [
|
|
284
|
+
`SEARCH#${result.sessionId}:1:match ${display(match.source)}:${match.lineNumber}-${lastLine} declaration ${result.selector}`,
|
|
285
|
+
match.matchedText.replace(/\r?\n$/u, ""),
|
|
286
|
+
].join("\n"),
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
details: { ...result, cwd: context.cwd },
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
const heading = result.references
|
|
293
|
+
? "LSP reference navigation (may leave input scope)"
|
|
294
|
+
: "LSP symbols inside scope";
|
|
131
295
|
const lines =
|
|
132
296
|
result.hits.length === 0
|
|
133
297
|
? ["No symbols found."]
|
|
@@ -135,7 +299,7 @@ export function createLspSearchResolver(
|
|
|
135
299
|
.slice(0, 100)
|
|
136
300
|
.map(
|
|
137
301
|
(hit, index) =>
|
|
138
|
-
`SEARCH#${result.sessionId}:${index + 1}:match ${
|
|
302
|
+
`SEARCH#${result.sessionId}:${index + 1}:match ${display(hit.source)}:${hit.lineNumber}:${hit.startColumn + 1} ${hit.role} ${hit.symbol.name} · declared at ${display(hit.symbol.source)}:${hit.symbol.range.startLine}:${hit.symbol.range.startColumn + 1}`,
|
|
139
303
|
);
|
|
140
304
|
if (result.complete && result.hits.length)
|
|
141
305
|
lines.unshift(`SEARCH#${result.sessionId}:all:match selects all exact symbol matches.`);
|
|
@@ -147,3 +311,37 @@ export function createLspSearchResolver(
|
|
|
147
311
|
},
|
|
148
312
|
};
|
|
149
313
|
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Select the complete lines of an LSP range (zero-based lines), including the final line ending,
|
|
317
|
+
* so deleting or moving a declaration does not leave an empty line behind.
|
|
318
|
+
*/
|
|
319
|
+
function declarationMatch(
|
|
320
|
+
source: string,
|
|
321
|
+
content: string,
|
|
322
|
+
range: {
|
|
323
|
+
readonly start: { readonly line: number };
|
|
324
|
+
readonly end: { readonly line: number };
|
|
325
|
+
},
|
|
326
|
+
): SearchSelectionMatch {
|
|
327
|
+
const raw = content.split("\n");
|
|
328
|
+
const lines = raw.map((line) => line.replace(/\r$/u, ""));
|
|
329
|
+
const starts = [0];
|
|
330
|
+
for (const line of raw) starts.push((starts.at(-1) ?? 0) + line.length + 1);
|
|
331
|
+
const first = range.start.line;
|
|
332
|
+
const hasNextLine = range.end.line + 1 < raw.length;
|
|
333
|
+
// Without a following line, the selection ends at the end of the last declaration line.
|
|
334
|
+
const endLine = hasNextLine ? range.end.line + 1 : range.end.line;
|
|
335
|
+
const endColumn = hasNextLine ? 0 : (lines[range.end.line] ?? "").length;
|
|
336
|
+
const from = starts[first] ?? content.length;
|
|
337
|
+
const to = Math.min(content.length, (starts[endLine] ?? content.length) + endColumn);
|
|
338
|
+
return {
|
|
339
|
+
source,
|
|
340
|
+
lineNumber: first + 1,
|
|
341
|
+
startColumn: 0,
|
|
342
|
+
...(endLine === first ? {} : { endLineNumber: endLine + 1 }),
|
|
343
|
+
endColumn,
|
|
344
|
+
matchedText: content.slice(from, to),
|
|
345
|
+
lineText: lines[first] ?? "",
|
|
346
|
+
};
|
|
347
|
+
}
|