pi-agent-ide 0.8.4 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -0
- package/README.md +24 -29
- package/dist/{chunk-CM3XGY72.js → chunk-2AY526TN.js} +1 -1
- package/dist/{chunk-LEJKDYCK.js → chunk-2TZDG2JH.js} +1 -1
- package/dist/{chunk-DUUOCBS3.js → chunk-35LZOKEW.js} +1 -1
- package/dist/chunk-3LVBARLW.js +33 -0
- 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-5PC5INOL.js +1 -0
- package/dist/{chunk-QUYXINGZ.js → chunk-5S74Z6Y4.js} +3 -3
- 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-AMIIOWFL.js +1 -0
- package/dist/{chunk-TOYN4W4F.js → chunk-B25LXXNV.js} +1 -1
- package/dist/chunk-BT2CFM7D.js +11 -0
- package/dist/chunk-C2JT2G5K.js +1 -0
- package/dist/chunk-DDH3FP4G.js +3 -0
- package/dist/{chunk-6T7PSDQW.js → chunk-DVNL5NZE.js} +1 -1
- package/dist/chunk-FEZLTM4L.js +1 -0
- package/dist/{chunk-CPELC6JE.js → chunk-FHRHYY4M.js} +1 -1
- package/dist/chunk-FXPY3V4L.js +10 -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-Z2MNHSJ4.js → chunk-HGCJDIRR.js} +1 -1
- package/dist/chunk-HISGZD3C.js +81 -0
- package/dist/chunk-HKYVP2Q6.js +3 -0
- package/dist/chunk-HRBUY2FF.js +4 -0
- package/dist/chunk-IG5DXVDJ.js +1 -0
- package/dist/chunk-IOGWZNWT.js +1 -0
- package/dist/chunk-IUJUECXH.js +9 -0
- package/dist/chunk-KN6VPARZ.js +1 -0
- package/dist/{chunk-RW2GTYQI.js → chunk-LF325WYO.js} +1 -1
- package/dist/chunk-LXDF2NWX.js +1 -0
- package/dist/{chunk-YJ6T3PEP.js → chunk-MDD5ORB6.js} +1 -1
- package/dist/{chunk-S72FVLUX.js → chunk-MLFJU2US.js} +1 -1
- package/dist/chunk-MPNE25CY.js +5 -0
- package/dist/chunk-NA2NEU4V.js +1 -0
- package/dist/{chunk-ZJQRLVVV.js → chunk-O7V6G3OO.js} +1 -1
- package/dist/chunk-OBTT5INC.js +6 -0
- package/dist/{chunk-IICJXZBU.js → chunk-OMNKD7WW.js} +3 -3
- package/dist/chunk-OUCVZBOR.js +28 -0
- package/dist/chunk-PCGBM2D6.js +17 -0
- package/dist/{chunk-235QMMVA.js → chunk-PQWANILR.js} +1 -1
- package/dist/{chunk-QRJLIV6P.js → chunk-QJ6V5IAY.js} +6 -6
- package/dist/{chunk-SMIFCAAX.js → chunk-RIJRPAL2.js} +1 -1
- package/dist/chunk-RIOPUTUJ.js +6 -0
- package/dist/{chunk-RMI3NMQY.js → chunk-RIZARTUM.js} +2 -2
- package/dist/{chunk-NJ7C4KMA.js → chunk-SRFWT562.js} +1 -1
- package/dist/{chunk-U22JNO6N.js → chunk-STUZZM5B.js} +1 -1
- package/dist/chunk-T3Z4KXOX.js +2 -0
- package/dist/chunk-TSQ6FBTB.js +1 -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-ZPT5D4VP.js → chunk-VDJSH3DQ.js} +2 -2
- package/dist/{chunk-VMTOFEXF.js → chunk-VMLPXSMK.js} +1 -1
- package/dist/chunk-VNWGT367.js +1 -0
- 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-X2WFNMQR.js +9 -0
- package/dist/chunk-XCPIIDFS.js +4 -0
- package/dist/chunk-XE4W5YTE.js +2 -0
- package/dist/chunk-XUYIK4TX.js +1 -0
- 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-22.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 +1 -1
- package/dist/entry-31.js +2 -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 +1 -1
- package/dist/entry-38.js +15 -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-67.js +1 -0
- package/dist/entry-68.js +0 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-7.js +1 -1
- package/dist/entry-70.js +0 -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-77.js +1 -0
- package/dist/entry-78.js +0 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +0 -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 +1 -1
- package/dist/entry-86.js +2 -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 +1 -1
- package/dist/entry-91.js +3 -1
- package/dist/entry-92.js +1 -0
- package/dist/entry-93.js +1 -0
- package/dist/entry-94.js +1 -0
- package/dist/pi-agent-ide.js +13 -34
- package/docs/agent-guides/ast-search.md +58 -0
- package/docs/agent-guides/debugger.md +1 -1
- package/docs/agent-guides/editing.md +29 -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 +24 -23
- package/node_modules/pi-agent-doctor/package.json +7 -7
- package/node_modules/pi-agent-doctor/runtime/entry-29.js +1 -0
- 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-30.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-33.js +1 -0
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-34.js +2 -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-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-36.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +15 -15
- package/node_modules/pi-agent-ide-ast/runtime/entry-37.js +1 -0
- 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-39.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-languages/runtime/entry-42.js +2 -0
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/runtime/entry-43.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-44.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-52.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-57.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-58.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/runtime/entry-62.js +1 -0
- 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-constant/runtime/entry-63.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-64.js +1 -0
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-65.js +2 -0
- 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-67.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/runtime/entry-83.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-84.js +2 -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/result-transfer.ts +2 -6
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +17 -36
- 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 +63 -74
- 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 +7 -10
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -10
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +8 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -8
- 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-85.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-86.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-87.js +1 -0
- package/node_modules/pi-agent-tool-ui/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
- package/node_modules/pi-agent-tool-ui/runtime/entry-89.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-image/runtime/entry-92.js +2 -0
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/runtime/entry-93.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-94.js +2 -0
- package/package.json +65 -58
- package/src/api/approval.ts +2 -0
- package/src/api/capabilities.ts +60 -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/capabilities.ts +252 -0
- package/src/composite/capability-schemas.ts +53 -0
- 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/responses-tools.ts +27 -9
- package/src/composite/settings-documentation.ts +1 -2
- package/src/composite/text-results.ts +61 -23
- package/src/composite/tool-availability.ts +28 -13
- 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-33.js +1 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-34.js +2 -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-35.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-36.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-31.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-image/runtime/entry-92.js +2 -0
- 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-93.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-94.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-90.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-52.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-58.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 +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-57.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-constant/runtime/entry-63.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-64.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-65.js +2 -0
- 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-66.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-67.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-85.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-86.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 +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-84.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/result-transfer.ts +2 -6
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +17 -36
- 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 +63 -74
- 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 +7 -10
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -10
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +8 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -8
- 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 +12 -16
- package/src/plugins/pi-agent-ide-ast/package.json +15 -15
- package/src/plugins/pi-agent-ide-ast/runtime/entry-37.js +1 -0
- 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-39.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 +31 -13
- 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-languages/runtime/entry-42.js +2 -0
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/runtime/entry-43.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-44.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 +43 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +0 -18
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +0 -3
- 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-GBUJOR6V.js +0 -28
- 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-PT35ZFLH.js +0 -33
- 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-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-23.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-doctor/runtime/entry-23.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
- package/node_modules/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
- package/node_modules/pi-agent-filesystem-text/runtime/entry-33.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-changes/runtime/entry-36.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-37.js +0 -2
- package/node_modules/pi-agent-ide-languages/runtime/entry-39.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-pdf/runtime/entry-44.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-52.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-57.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-62.js +0 -2
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-63.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-64.js +0 -2
- package/node_modules/pi-agent-text-editor/runtime/entry-65.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-67.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-83.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-tool-ui/runtime/entry-86.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/node_modules/pi-agent-web-image/runtime/entry-89.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-jq/runtime/entry-31.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-33.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/plugins/pi-agent-web-pdf/runtime/entry-90.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-read/runtime/entry-47.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/plugins/pi-agent-search-text/runtime/entry-57.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-53.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-62.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-63.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-64.js +0 -2
- 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/extensions/pi-agent-text-editor/runtime/entry-67.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-changes/runtime/entry-36.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-37.js +0 -2
- package/src/plugins/pi-agent-ide-languages/runtime/entry-39.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-jq → pi-agent-filesystem}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-32.js +0 -0
- /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-pdf}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-38.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-40.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-41.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-image}/runtime/entry-45.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-46.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-47.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-read}/runtime/entry-51.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-53.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-56.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-search-text}/runtime/entry-61.js +0 -0
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-66.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web}/runtime/entry-90.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-91.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-32.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-91.js +0 -0
- /package/src/extensions/{pi-agent-search → pi-agent-read}/runtime/entry-51.js +0 -0
- /package/src/extensions/{pi-agent-text-editor/plugins/pi-agent-text-anchor-exact → pi-agent-search/plugins/pi-agent-search-text}/runtime/entry-61.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-38.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-40.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-41.js +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { createInterface } from "node:readline";
|
|
3
4
|
|
|
4
5
|
import { resolveRipgrepExecutable } from "#src/ripgrep.js";
|
|
5
6
|
|
|
6
|
-
import type
|
|
7
|
+
import { splitGlobList, type SearchRequest } from "pi-agent-search/api/search";
|
|
7
8
|
import type { SearchEnvironment } from "pi-agent-search/api/search";
|
|
8
9
|
|
|
9
10
|
export interface FileSearchResult {
|
|
@@ -28,11 +29,11 @@ export async function searchFiles(
|
|
|
28
29
|
"!.git/**",
|
|
29
30
|
];
|
|
30
31
|
|
|
31
|
-
for (const include of
|
|
32
|
+
for (const include of splitGlobList(request.include)) {
|
|
32
33
|
arguments_.push("--glob", include);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
for (const exclude of
|
|
36
|
+
for (const exclude of splitGlobList(request.exclude)) {
|
|
36
37
|
arguments_.push("--glob", `!${exclude}`);
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -41,21 +42,20 @@ export async function searchFiles(
|
|
|
41
42
|
const directory = await environment.isDirectory(target, signal);
|
|
42
43
|
const searchCwd = directory ? target : environment.dirname(target);
|
|
43
44
|
arguments_.push("--", directory ? "." : `./${environment.basename(target)}`);
|
|
44
|
-
const
|
|
45
|
+
const found = firstFiles(limit);
|
|
45
46
|
const result = await environment.runLines(
|
|
46
47
|
arguments_,
|
|
47
48
|
searchCwd,
|
|
48
49
|
(file) => {
|
|
49
50
|
const relative = file.replace(/^\.\//u, "");
|
|
50
|
-
if (matchFile(relative, query))
|
|
51
|
+
if (matchFile(relative, query)) found.add(environment.resolve(searchCwd, file));
|
|
51
52
|
},
|
|
52
53
|
signal,
|
|
53
54
|
);
|
|
54
55
|
signal?.throwIfAborted();
|
|
55
56
|
if (result.code !== 0 && result.code !== 1)
|
|
56
57
|
throw new Error(result.stderr || "File search failed.");
|
|
57
|
-
|
|
58
|
-
return { files: files.slice(0, limit), complete: files.length <= limit };
|
|
58
|
+
return found.result();
|
|
59
59
|
}
|
|
60
60
|
if (request.path?.includes("://") || cwd.includes("://"))
|
|
61
61
|
throw new Error("No search environment owns this scope.");
|
|
@@ -66,12 +66,25 @@ export async function searchFiles(
|
|
|
66
66
|
cwd,
|
|
67
67
|
stdio: ["ignore", "pipe", "pipe"],
|
|
68
68
|
});
|
|
69
|
-
|
|
69
|
+
// A large tree lists more paths than one string can hold, so lines are matched as they arrive.
|
|
70
|
+
const found = firstFiles(limit);
|
|
71
|
+
let failure: Error | undefined;
|
|
70
72
|
let stderr = "";
|
|
71
|
-
child.stdout.setEncoding("utf8");
|
|
72
73
|
child.stderr.setEncoding("utf8");
|
|
73
|
-
child.
|
|
74
|
-
|
|
74
|
+
child.stderr.on("data", (chunk: string) => {
|
|
75
|
+
if (stderr.length < maximumStderrLength) stderr += chunk;
|
|
76
|
+
});
|
|
77
|
+
createInterface({ input: child.stdout, crlfDelay: Infinity }).on("line", (line) => {
|
|
78
|
+
if (line.length === 0 || failure !== undefined) return;
|
|
79
|
+
try {
|
|
80
|
+
const file = path.relative(cwd, path.resolve(cwd, line));
|
|
81
|
+
if (matchFile(file, query)) found.add(file);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
failure =
|
|
84
|
+
error instanceof Error ? error : new Error("File search failed.", { cause: error });
|
|
85
|
+
child.kill("SIGTERM");
|
|
86
|
+
}
|
|
87
|
+
});
|
|
75
88
|
const abort = (): void => {
|
|
76
89
|
child.kill("SIGTERM");
|
|
77
90
|
};
|
|
@@ -85,29 +98,50 @@ export async function searchFiles(
|
|
|
85
98
|
return;
|
|
86
99
|
}
|
|
87
100
|
|
|
101
|
+
if (failure !== undefined) {
|
|
102
|
+
reject(failure);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
88
106
|
if (code !== 0 && code !== 1) {
|
|
89
107
|
reject(new Error(stderr.trim() || `rg exited with code ${String(code)}`));
|
|
90
108
|
return;
|
|
91
109
|
}
|
|
92
110
|
|
|
93
|
-
|
|
94
|
-
.split("\n")
|
|
95
|
-
.filter(Boolean)
|
|
96
|
-
.map((file) => path.relative(cwd, path.resolve(cwd, file)))
|
|
97
|
-
.filter((file) => matchFile(file, query))
|
|
98
|
-
.sort((left, right) => left.localeCompare(right));
|
|
99
|
-
resolve({ files: matches.slice(0, limit), complete: matches.length <= limit });
|
|
111
|
+
resolve(found.result());
|
|
100
112
|
});
|
|
101
113
|
});
|
|
102
114
|
}
|
|
103
115
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
);
|
|
116
|
+
const maximumStderrLength = 64 * 1024;
|
|
117
|
+
const collator = new Intl.Collator();
|
|
118
|
+
|
|
119
|
+
/** Keep the first `limit` matches in sort order and count the rest, so memory stays bounded. */
|
|
120
|
+
function firstFiles(limit: number): {
|
|
121
|
+
add(file: string): void;
|
|
122
|
+
result(): FileSearchResult;
|
|
123
|
+
} {
|
|
124
|
+
const files: string[] = [];
|
|
125
|
+
let count = 0;
|
|
126
|
+
return {
|
|
127
|
+
add(file) {
|
|
128
|
+
count += 1;
|
|
129
|
+
const last = files.at(-1);
|
|
130
|
+
if (files.length >= limit && (last === undefined || collator.compare(file, last) >= 0))
|
|
131
|
+
return;
|
|
132
|
+
let low = 0;
|
|
133
|
+
let high = files.length;
|
|
134
|
+
while (low < high) {
|
|
135
|
+
const middle = (low + high) >>> 1;
|
|
136
|
+
const current = files[middle];
|
|
137
|
+
if (current !== undefined && collator.compare(current, file) <= 0) low = middle + 1;
|
|
138
|
+
else high = middle;
|
|
139
|
+
}
|
|
140
|
+
files.splice(low, 0, file);
|
|
141
|
+
if (files.length > limit) files.pop();
|
|
142
|
+
},
|
|
143
|
+
result: () => ({ files, complete: count <= limit }),
|
|
144
|
+
};
|
|
111
145
|
}
|
|
112
146
|
|
|
113
147
|
function matchFile(file: string, query: string): boolean {
|
|
@@ -44,35 +44,54 @@ interface FilePayload {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/** Search unhandled requests with literal-first hybrid matching. */
|
|
47
|
-
export function createTextResolver(
|
|
48
|
-
|
|
47
|
+
export function createTextResolver(
|
|
48
|
+
sessions: SearchSessionStore,
|
|
49
|
+
resultScopeOnly = false,
|
|
50
|
+
): SearchResolver {
|
|
51
|
+
return createMatchResolver("text", sessions, createSearchRecipe, resultScopeOnly);
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
/** Search an explicit regex without broadening or swallowing syntax errors. */
|
|
52
|
-
export function createRegexResolver(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
export function createRegexResolver(
|
|
56
|
+
sessions: SearchSessionStore,
|
|
57
|
+
resultScopeOnly = false,
|
|
58
|
+
): SearchResolver {
|
|
59
|
+
return createMatchResolver(
|
|
60
|
+
"regex",
|
|
61
|
+
sessions,
|
|
62
|
+
(request) =>
|
|
63
|
+
request.query.startsWith("regex:")
|
|
64
|
+
? { ...request, query: request.query.slice("regex:".length), regex: true }
|
|
65
|
+
: undefined,
|
|
66
|
+
resultScopeOnly,
|
|
57
67
|
);
|
|
58
68
|
}
|
|
59
69
|
|
|
60
|
-
/**
|
|
70
|
+
/** Options the `file_search` tool passes in `SearchRequest.options.files`; their presence selects this resolver. */
|
|
71
|
+
export interface FileSearchOptions {
|
|
72
|
+
readonly pattern: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function fileOptions(request: SearchRequest): FileSearchOptions | undefined {
|
|
76
|
+
const value = request.options?.files as FileSearchOptions | undefined;
|
|
77
|
+
return typeof value?.pattern === "string" ? value : undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Resolve file-path patterns through the local or owned file search backend. */
|
|
61
81
|
export function createFileResolver(): SearchResolver {
|
|
62
82
|
return {
|
|
63
83
|
id: "files",
|
|
64
84
|
readResources: (request, context) =>
|
|
65
|
-
request
|
|
85
|
+
fileOptions(request) === undefined ? [] : [request.path ?? context.cwd],
|
|
66
86
|
toScriptData(payload) {
|
|
67
87
|
const result = payload as FilePayload;
|
|
68
88
|
return { kind: "files", files: [...result.files], complete: result.complete };
|
|
69
89
|
},
|
|
70
90
|
async tryResolve(request, context) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
91
|
+
const options = fileOptions(request);
|
|
92
|
+
if (options === undefined) return { kind: "not-handled" };
|
|
74
93
|
|
|
75
|
-
const query =
|
|
94
|
+
const query = options.pattern.trim();
|
|
76
95
|
const result = await searchFiles(
|
|
77
96
|
query,
|
|
78
97
|
request,
|
|
@@ -123,14 +142,16 @@ function createMatchResolver(
|
|
|
123
142
|
id: "text" | "regex",
|
|
124
143
|
sessions: SearchSessionStore,
|
|
125
144
|
queryBody: (request: SearchRequest) => SearchRecipe | undefined,
|
|
145
|
+
resultScopeOnly = false,
|
|
126
146
|
): SearchResolver {
|
|
127
147
|
return {
|
|
128
148
|
readResources: (request, context) =>
|
|
129
|
-
queryBody(request) === undefined
|
|
149
|
+
queryBody(request) === undefined || (resultScopeOnly && context.scope === undefined)
|
|
130
150
|
? []
|
|
131
151
|
: (context.scope?.targets.map((target) => target.source) ?? [request.path ?? context.cwd]),
|
|
132
152
|
id,
|
|
133
153
|
supportsResultScope: true,
|
|
154
|
+
supportsMultiline: true,
|
|
134
155
|
toScriptData(payload, details) {
|
|
135
156
|
const result = payload as TextPayload;
|
|
136
157
|
const formatted = details as SearchToolDetails & {
|
|
@@ -145,6 +166,7 @@ function createMatchResolver(
|
|
|
145
166
|
};
|
|
146
167
|
},
|
|
147
168
|
async tryResolve(request, context) {
|
|
169
|
+
if (resultScopeOnly && context.scope === undefined) return { kind: "not-handled" };
|
|
148
170
|
const recipe = queryBody(request);
|
|
149
171
|
if (recipe === undefined) return { kind: "not-handled" };
|
|
150
172
|
const result =
|
|
@@ -154,6 +176,7 @@ function createMatchResolver(
|
|
|
154
176
|
const fuzzy =
|
|
155
177
|
context.scope === undefined &&
|
|
156
178
|
id === "text" &&
|
|
179
|
+
request.multiline !== true &&
|
|
157
180
|
result.complete &&
|
|
158
181
|
result.matches.length === 0 &&
|
|
159
182
|
isFuzzyQuery(request.query)
|
|
@@ -330,7 +353,14 @@ function formatSearchSession(
|
|
|
330
353
|
`${source}: ${String(file.matchCount)} matches across ${String(file.uniqueLineCount)} unique line texts (compacted)`,
|
|
331
354
|
);
|
|
332
355
|
for (const group of file.groups) {
|
|
333
|
-
|
|
356
|
+
const index = indices.get(group.first);
|
|
357
|
+
const first = group.first;
|
|
358
|
+
lines.push(
|
|
359
|
+
anchorsRegistered && index !== undefined
|
|
360
|
+
? ` ×${String(group.matchCount)} first at ${source}:${String(first.lineNumber)} SEARCH#${session.id}:${String(index)}:line SEARCH#${session.id}:${String(index)}:match`
|
|
361
|
+
: ` ×${String(group.matchCount)} first at ${source}:${String(first.lineNumber)}`,
|
|
362
|
+
` ${previewLine(group.text)}`,
|
|
363
|
+
);
|
|
334
364
|
}
|
|
335
365
|
if (file.groups.length < file.uniqueLineCount) {
|
|
336
366
|
lines.push(
|
|
@@ -346,7 +376,11 @@ function formatSearchSession(
|
|
|
346
376
|
for (const match of file.matches) {
|
|
347
377
|
const index = indices.get(match);
|
|
348
378
|
if (index === undefined) continue;
|
|
349
|
-
const
|
|
379
|
+
const end =
|
|
380
|
+
match.endLineNumber === undefined
|
|
381
|
+
? String(match.endColumn + 1)
|
|
382
|
+
: `${String(match.endLineNumber)}:${String(match.endColumn + 1)}`;
|
|
383
|
+
const location = `${source}:${String(match.lineNumber)}:${String(match.startColumn + 1)}-${end}`;
|
|
350
384
|
lines.push(
|
|
351
385
|
anchorsRegistered
|
|
352
386
|
? `${location} SEARCH#${session.id}:${String(index)}:line SEARCH#${session.id}:${String(index)}:match`
|
|
@@ -371,6 +405,17 @@ function formatSearchSession(
|
|
|
371
405
|
|
|
372
406
|
function previewMatch(match: TextSearchMatch): string {
|
|
373
407
|
const context = 64;
|
|
408
|
+
if (match.endLineNumber !== undefined) {
|
|
409
|
+
// Show the matched lines themselves, bounded; continuation lines keep the preview indent.
|
|
410
|
+
const maximumLines = 8;
|
|
411
|
+
const from = Math.max(0, match.startColumn - context);
|
|
412
|
+
const matched = match.matchedText.replace(/\r\n/gu, "\n").split("\n");
|
|
413
|
+
const shown = matched.slice(0, maximumLines);
|
|
414
|
+
const more = matched.length - shown.length;
|
|
415
|
+
return `${from > 0 ? "…" : ""}${match.lineText.slice(from, match.startColumn)}⟦${shown.join("\n ")}${
|
|
416
|
+
more > 0 ? `\n … ${String(more)} more lines` : ""
|
|
417
|
+
}⟧`;
|
|
418
|
+
}
|
|
374
419
|
const from = Math.max(0, match.startColumn - context);
|
|
375
420
|
const to = Math.min(match.lineText.length, match.endColumn + context);
|
|
376
421
|
return `${from > 0 ? "…" : ""}${match.lineText.slice(from, match.startColumn)}⟦${match.lineText.slice(
|
|
@@ -43,19 +43,25 @@ export async function runScopedSearch(
|
|
|
43
43
|
);
|
|
44
44
|
for (const match of result.matches) {
|
|
45
45
|
const lineNumber = range.start.lineNumber + match.lineNumber - 1;
|
|
46
|
-
const
|
|
46
|
+
const endLine = match.endLineNumber ?? match.lineNumber;
|
|
47
|
+
// Only positions on the range's first line are offset by its starting column.
|
|
48
|
+
const shift = (line: number) => (line === 1 ? range.start.column : 0);
|
|
47
49
|
const mapped: TextSearchMatch = {
|
|
48
50
|
...match,
|
|
49
51
|
source: target.source,
|
|
50
52
|
lineNumber,
|
|
51
|
-
startColumn: match.startColumn + shift,
|
|
52
|
-
|
|
53
|
+
startColumn: match.startColumn + shift(match.lineNumber),
|
|
54
|
+
...(match.endLineNumber === undefined
|
|
55
|
+
? {}
|
|
56
|
+
: { endLineNumber: range.start.lineNumber + match.endLineNumber - 1 }),
|
|
57
|
+
endColumn: match.endColumn + shift(endLine),
|
|
53
58
|
lineText: document.lines[lineNumber - 1]?.content ?? "",
|
|
54
59
|
};
|
|
55
60
|
const key = JSON.stringify([
|
|
56
61
|
mapped.source,
|
|
57
62
|
lineNumber,
|
|
58
63
|
mapped.startColumn,
|
|
64
|
+
mapped.endLineNumber ?? lineNumber,
|
|
59
65
|
mapped.endColumn,
|
|
60
66
|
]);
|
|
61
67
|
if (seen.has(key)) continue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { stat } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import type
|
|
4
|
+
import { splitGlobList, type SearchEnvironment } from "pi-agent-search/api/search";
|
|
5
5
|
import { createInterface } from "node:readline";
|
|
6
6
|
|
|
7
7
|
import { resolveRipgrepExecutable } from "#src/ripgrep.js";
|
|
@@ -19,9 +19,28 @@ export interface TextSearchRequest {
|
|
|
19
19
|
readonly condition?: SearchCondition;
|
|
20
20
|
readonly caseSensitive?: boolean;
|
|
21
21
|
readonly wholeWord?: boolean;
|
|
22
|
+
/** Let one match span line breaks (`--multiline --multiline-dotall`). */
|
|
23
|
+
readonly multiline?: boolean;
|
|
22
24
|
readonly limit?: number;
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
/** Reject inputs that line-based matching cannot honor instead of silently changing them. */
|
|
28
|
+
function assertSupportedPattern(request: TextSearchRequest): void {
|
|
29
|
+
if (request.multiline === true) {
|
|
30
|
+
if (request.condition !== undefined)
|
|
31
|
+
throw new Error(
|
|
32
|
+
"Boolean conditions check single lines and cannot be combined with multiline. Use one regex with multiline instead.",
|
|
33
|
+
);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (/\r|\n/u.test(request.query))
|
|
37
|
+
throw new Error("A pattern with line breaks requires multiline: true.");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function multilineArguments(request: TextSearchRequest): string[] {
|
|
41
|
+
return request.multiline === true ? ["--multiline", "--multiline-dotall"] : [];
|
|
42
|
+
}
|
|
43
|
+
|
|
25
44
|
export interface TextSearchBackendResult {
|
|
26
45
|
readonly matches: readonly TextSearchMatch[];
|
|
27
46
|
readonly complete: boolean;
|
|
@@ -51,9 +70,7 @@ export async function searchText(
|
|
|
51
70
|
throw new Error("Search query must not be empty.");
|
|
52
71
|
}
|
|
53
72
|
|
|
54
|
-
|
|
55
|
-
throw new Error("Search supports one-line patterns only.");
|
|
56
|
-
}
|
|
73
|
+
assertSupportedPattern(request);
|
|
57
74
|
|
|
58
75
|
if (request.condition !== undefined)
|
|
59
76
|
return searchBoolean(
|
|
@@ -106,6 +123,7 @@ export async function searchTextContent(
|
|
|
106
123
|
cwd: string,
|
|
107
124
|
signal?: AbortSignal,
|
|
108
125
|
): Promise<TextSearchBackendResult> {
|
|
126
|
+
assertSupportedPattern(request);
|
|
109
127
|
if (request.condition !== undefined)
|
|
110
128
|
return searchBoolean(
|
|
111
129
|
request,
|
|
@@ -116,7 +134,6 @@ export async function searchTextContent(
|
|
|
116
134
|
},
|
|
117
135
|
signal,
|
|
118
136
|
);
|
|
119
|
-
if (/\r|\n/u.test(request.query)) throw new Error("Search supports one-line patterns only.");
|
|
120
137
|
const result = await runRipgrep(
|
|
121
138
|
[
|
|
122
139
|
"--json",
|
|
@@ -127,6 +144,7 @@ export async function searchTextContent(
|
|
|
127
144
|
...(request.regex === true ? ["--engine", "auto"] : ["--fixed-strings"]),
|
|
128
145
|
request.caseSensitive === true ? "--case-sensitive" : "--ignore-case",
|
|
129
146
|
...(request.wholeWord === true ? ["--word-regexp"] : []),
|
|
147
|
+
...multilineArguments(request),
|
|
130
148
|
"--",
|
|
131
149
|
request.query,
|
|
132
150
|
"-",
|
|
@@ -164,6 +182,7 @@ async function searchPattern(
|
|
|
164
182
|
"--line-number",
|
|
165
183
|
request.caseSensitive === true ? "--case-sensitive" : "--ignore-case",
|
|
166
184
|
...(request.wholeWord === true ? ["--word-regexp"] : []),
|
|
185
|
+
...multilineArguments(request),
|
|
167
186
|
...scope.arguments,
|
|
168
187
|
"--",
|
|
169
188
|
request.query,
|
|
@@ -468,8 +487,14 @@ function matchesFromEvent(
|
|
|
468
487
|
return [];
|
|
469
488
|
}
|
|
470
489
|
|
|
471
|
-
|
|
490
|
+
// Multiline mode reports every line a match touches in one event; offsets count from its start.
|
|
491
|
+
const lines = rawLine.split("\n").map((line) => line.replace(/\r$/u, ""));
|
|
472
492
|
const lineBuffer = Buffer.from(rawLine);
|
|
493
|
+
const position = (byteOffset: number) => {
|
|
494
|
+
const prefix = lineBuffer.subarray(0, byteOffset).toString("utf8");
|
|
495
|
+
const lineIndex = prefix.split("\n").length - 1;
|
|
496
|
+
return { lineIndex, column: prefix.length - prefix.lastIndexOf("\n") - 1 };
|
|
497
|
+
};
|
|
473
498
|
const matches: TextSearchMatch[] = [];
|
|
474
499
|
|
|
475
500
|
for (const submatch of event.data.submatches) {
|
|
@@ -477,56 +502,27 @@ function matchesFromEvent(
|
|
|
477
502
|
continue;
|
|
478
503
|
}
|
|
479
504
|
|
|
480
|
-
const
|
|
481
|
-
const
|
|
505
|
+
const start = position(submatch.start);
|
|
506
|
+
const end = position(submatch.end);
|
|
482
507
|
matches.push({
|
|
483
508
|
source: environment?.resolve(cwd, source) ?? path.resolve(cwd, source),
|
|
484
|
-
lineNumber: event.data.line_number,
|
|
485
|
-
startColumn,
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
509
|
+
lineNumber: event.data.line_number + start.lineIndex,
|
|
510
|
+
startColumn: start.column,
|
|
511
|
+
...(end.lineIndex === start.lineIndex
|
|
512
|
+
? {}
|
|
513
|
+
: { endLineNumber: event.data.line_number + end.lineIndex }),
|
|
514
|
+
endColumn: end.column,
|
|
515
|
+
matchedText:
|
|
516
|
+
end.lineIndex === start.lineIndex
|
|
517
|
+
? (lines[start.lineIndex] ?? "").slice(start.column, end.column)
|
|
518
|
+
: lineBuffer.subarray(submatch.start, submatch.end).toString("utf8"),
|
|
519
|
+
lineText: lines[start.lineIndex] ?? "",
|
|
489
520
|
});
|
|
490
521
|
}
|
|
491
522
|
|
|
492
523
|
return matches;
|
|
493
524
|
}
|
|
494
525
|
|
|
495
|
-
function splitGlobList(value: string | undefined): string[] {
|
|
496
|
-
if (value === undefined) {
|
|
497
|
-
return [];
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
const globs: string[] = [];
|
|
501
|
-
let depth = 0;
|
|
502
|
-
let current = "";
|
|
503
|
-
|
|
504
|
-
for (const character of value) {
|
|
505
|
-
if (character === "{") {
|
|
506
|
-
depth += 1;
|
|
507
|
-
} else if (character === "}") {
|
|
508
|
-
depth = Math.max(0, depth - 1);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
if (depth === 0 && (character === "," || /\s/u.test(character))) {
|
|
512
|
-
if (current.length > 0) {
|
|
513
|
-
globs.push(current);
|
|
514
|
-
current = "";
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
continue;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
current += character;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
if (current.length > 0) {
|
|
524
|
-
globs.push(current);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
return globs;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
526
|
function stripFilePrefix(source: string): string {
|
|
531
527
|
return source.startsWith("@") ? source.slice(1) : source;
|
|
532
528
|
}
|
|
@@ -3,6 +3,8 @@ import type { TextSearchMatch } from "#src/search-session.js";
|
|
|
3
3
|
export interface SearchPresentationGroup {
|
|
4
4
|
readonly text: string;
|
|
5
5
|
readonly matchCount: number;
|
|
6
|
+
/** First match with this line text, so the summary can show a usable reference. */
|
|
7
|
+
readonly first: TextSearchMatch;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export type SearchPresentationFile =
|
|
@@ -23,7 +25,7 @@ export interface SearchPresentation {
|
|
|
23
25
|
readonly files: readonly SearchPresentationFile[];
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
/** Shares one item budget between complete small files, compact summaries and groups. */
|
|
28
|
+
/** Shares one item budget between complete small files, compact summaries and groups. A summary item includes its first group. */
|
|
27
29
|
export function planSearchPresentation(
|
|
28
30
|
matches: readonly TextSearchMatch[],
|
|
29
31
|
detailBudget: number,
|
|
@@ -63,20 +65,22 @@ export function planSearchPresentation(
|
|
|
63
65
|
}
|
|
64
66
|
if (remaining < 1) continue;
|
|
65
67
|
remaining--;
|
|
66
|
-
const counts = new Map<string, number>();
|
|
67
|
-
for (const match of sourceMatches)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
const counts = new Map<string, { matchCount: number; first: TextSearchMatch }>();
|
|
69
|
+
for (const match of sourceMatches) {
|
|
70
|
+
const group = counts.get(match.lineText);
|
|
71
|
+
if (group === undefined) counts.set(match.lineText, { matchCount: 1, first: match });
|
|
72
|
+
else group.matchCount++;
|
|
73
|
+
}
|
|
74
|
+
const sorted = [...counts]
|
|
75
|
+
.sort(
|
|
76
|
+
([leftText, left], [rightText, right]) =>
|
|
77
|
+
right.matchCount - left.matchCount || leftText.localeCompare(rightText),
|
|
78
|
+
)
|
|
79
|
+
.map(([text, group]) => ({ text, ...group }));
|
|
80
|
+
// The summary item always shows its most frequent line; a single file spends the rest on more lines.
|
|
81
|
+
const extra = bySource.size === 1 ? Math.min(remaining, sorted.length - 1) : 0;
|
|
82
|
+
const groups = sorted.slice(0, 1 + extra);
|
|
83
|
+
remaining -= extra;
|
|
80
84
|
files.push({
|
|
81
85
|
kind: "compacted",
|
|
82
86
|
source,
|
|
@@ -36,7 +36,8 @@ export function createSearchRecipe(request: TextSearchRequest): SearchRecipe {
|
|
|
36
36
|
if (regex !== query || JSON.stringify(condition) !== JSON.stringify(regexCondition)) {
|
|
37
37
|
fallbacks.push({ query: regex, mode: "regex", condition: regexCondition });
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
// Separate words cannot reproduce one match that spans lines.
|
|
40
|
+
if (request.multiline !== true && words !== undefined && words !== query && words !== regex) {
|
|
40
41
|
fallbacks.push({ query: words, mode: "words" });
|
|
41
42
|
}
|
|
42
43
|
return { ...request, query, regex: true, condition, fallbacks };
|
|
@@ -83,7 +83,7 @@ export function createSearchToolDetails(
|
|
|
83
83
|
link: pathToFileURL(file.source).href,
|
|
84
84
|
matchCount: file.matchCount,
|
|
85
85
|
uniqueLineCount: file.uniqueLineCount,
|
|
86
|
-
groups: file.groups,
|
|
86
|
+
groups: file.groups.map(({ text, matchCount }) => ({ text, matchCount })),
|
|
87
87
|
lines: [],
|
|
88
88
|
},
|
|
89
89
|
);
|
|
@@ -207,7 +207,11 @@ function createSearchResultFile(
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
const line = current ?? { lineNumber: match.lineNumber, text: match.lineText, ranges: [] };
|
|
210
|
-
|
|
210
|
+
// A match that continues on later lines is highlighted to the end of its first line.
|
|
211
|
+
line.ranges.push({
|
|
212
|
+
from: match.startColumn,
|
|
213
|
+
to: match.endLineNumber === undefined ? match.endColumn : match.lineText.length,
|
|
214
|
+
});
|
|
211
215
|
lines.set(match.lineNumber, line);
|
|
212
216
|
}
|
|
213
217
|
|
|
@@ -143,6 +143,7 @@ function normalizeRecipe(recipe: SearchRecipe, cwd: string): Record<string, unkn
|
|
|
143
143
|
exclude: recipe.exclude ?? "",
|
|
144
144
|
caseSensitive: recipe.caseSensitive === true,
|
|
145
145
|
wholeWord: recipe.wholeWord === true,
|
|
146
|
+
multiline: recipe.multiline === true,
|
|
146
147
|
limit: recipe.limit ?? 50,
|
|
147
148
|
regex: recipe.regex === true,
|
|
148
149
|
condition: recipe.condition,
|