pi-agent-ide 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +74 -22
- package/assets/gallery/apply-editing.png +0 -0
- package/assets/gallery/debugging.png +0 -0
- package/assets/gallery/read-web.png +0 -0
- package/assets/gallery/search-replace.png +0 -0
- package/assets/gallery/terminal.png +0 -0
- package/assets/gallery/tool-editing.png +0 -0
- package/dist/chunk-25CZ5ZIU.js +3 -0
- package/dist/chunk-526E364R.js +3 -0
- package/dist/chunk-5PLV4HLG.js +1 -0
- package/dist/chunk-5QQABP47.js +14 -0
- package/dist/{chunk-72EEL2DW.js → chunk-6CZO43OH.js} +1 -1
- package/dist/chunk-7ALCBKCW.js +26 -0
- package/dist/chunk-AWXVJ5AC.js +1 -0
- package/dist/{chunk-GFW5QPQV.js → chunk-DQXPQOF7.js} +1 -1
- package/dist/chunk-ESPNEJHK.js +1 -0
- package/dist/chunk-G725MARR.js +16 -0
- package/dist/{chunk-M5L42DWE.js → chunk-HKXDP2FD.js} +2 -2
- package/dist/chunk-IQD6PON5.js +0 -0
- package/dist/chunk-IRECDTJG.js +27 -0
- package/dist/chunk-J4RTW44E.js +1 -0
- package/dist/{chunk-HGPUI7F3.js → chunk-KII2JQC5.js} +1 -1
- package/dist/{chunk-TI5GMJ7Q.js → chunk-L7JMDDSD.js} +1 -1
- package/dist/{chunk-6DZA4CLO.js → chunk-LY6U5EAD.js} +1 -1
- package/dist/{chunk-ERVMDQGX.js → chunk-MGCHOGQD.js} +1 -1
- package/dist/chunk-NZYDMBM6.js +1 -0
- package/dist/{chunk-Y7ZMR4LT.js → chunk-O6LE42GK.js} +1 -1
- package/dist/{chunk-KAB3AYA2.js → chunk-OBNING2A.js} +1 -1
- package/dist/chunk-P7XO5CIP.js +2 -0
- package/dist/{chunk-VFBLX4TG.js → chunk-T6LX2RX5.js} +1 -1
- package/dist/{chunk-AADJ2KIB.js → chunk-U22JNO6N.js} +1 -1
- package/dist/chunk-U2JKHKLK.js +0 -0
- package/dist/{chunk-DQF5QMJ2.js → chunk-WGGIQ7IJ.js} +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -0
- package/dist/entry-17.js +1 -1
- package/dist/entry-18.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -2
- package/dist/entry-22.js +2 -1
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +1 -12
- package/dist/entry-27.js +12 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +1 -4
- package/dist/entry-32.js +3 -8
- package/dist/entry-33.js +9 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-40.js +1 -18
- package/dist/entry-41.js +18 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +1 -7
- package/dist/entry-46.js +7 -11
- package/dist/entry-47.js +11 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-55.js +1 -0
- package/dist/entry-56.js +0 -1
- package/dist/entry-57.js +1 -0
- package/dist/entry-58.js +0 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -0
- package/dist/entry-65.js +0 -1
- package/dist/entry-66.js +1 -0
- package/dist/entry-67.js +0 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +1 -123
- package/dist/entry-71.js +198 -25
- package/dist/entry-72.js +30 -2
- package/dist/entry-73.js +2 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +3 -3
- package/dist/entry-77.js +3 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +1 -0
- package/dist/entry-9.js +1 -1
- package/dist/pi-agent-ide.js +3 -3
- package/docs/configuration.md +1 -1
- package/docs/development.md +0 -6
- package/docs/user-hooks.md +68 -0
- package/node_modules/pi-agent-doctor/package.json +6 -6
- package/node_modules/pi-agent-doctor/runtime/entry-21.js +1 -0
- package/node_modules/pi-agent-doctor/src/catalog.ts +9 -1
- package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +5 -0
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +32 -11
- package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/node_modules/pi-agent-ide-ast/runtime/entry-27.js +2 -0
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +16 -8
- package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +22 -17
- package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
- package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +4 -1
- package/node_modules/pi-agent-ide-changes/index.ts +3 -1
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
- package/node_modules/pi-agent-ide-formatter/package.json +9 -4
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/package.json +13 -8
- package/node_modules/pi-agent-ide-lsp/index.ts +4 -1
- package/node_modules/pi-agent-ide-lsp/package.json +15 -10
- package/node_modules/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-read/package.json +11 -11
- package/node_modules/pi-agent-read/runtime/entry-40.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-41.js +2 -0
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/rendering.ts +1 -1
- package/node_modules/pi-agent-read/src/api/tools/read.ts +32 -0
- package/node_modules/pi-agent-read/src/core/read-core.ts +8 -0
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +63 -4
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +105 -5
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-search/package.json +7 -7
- package/node_modules/pi-agent-search/runtime/entry-45.js +0 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +5 -1
- package/node_modules/pi-agent-search-text/index.ts +1 -1
- package/node_modules/pi-agent-search-text/package.json +9 -9
- package/node_modules/pi-agent-search-text/runtime/entry-47.js +1 -0
- package/node_modules/pi-agent-search-text/src/resolvers.ts +72 -39
- package/node_modules/pi-agent-search-text/src/search-backend.ts +6 -15
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +80 -0
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +17 -1
- package/node_modules/pi-agent-search-text/src/search-result.ts +32 -12
- package/node_modules/pi-agent-search-text/src/search-session.ts +33 -4
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-49.js +1 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
- package/node_modules/pi-agent-text-editor/package.json +25 -25
- package/node_modules/pi-agent-text-editor/runtime/entry-70.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +37 -8
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +3 -2
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +141 -6
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +123 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
- package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -0
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +59 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +1 -0
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/src/resolver.ts +128 -1
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-80.js +2 -0
- package/package.json +59 -39
- package/src/api/hooks.ts +168 -0
- package/src/api/text-editor.ts +2 -0
- package/src/composite/builtin-extensions.ts +7 -0
- package/src/composite/module-labels.ts +8 -0
- package/src/composite/preferences.ts +3 -3
- package/src/core/reload-resource-store.ts +34 -0
- package/src/doctor/tip-provider.ts +1 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +128 -1
- package/src/extensions/pi-agent-read/package.json +11 -11
- package/src/extensions/pi-agent-read/runtime/entry-40.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-41.js +2 -0
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/rendering.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +32 -0
- package/src/extensions/pi-agent-read/src/core/read-core.ts +8 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +63 -4
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +105 -5
- package/src/extensions/pi-agent-search/package.json +7 -7
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-48.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +72 -39
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +6 -15
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +80 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +17 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +32 -12
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +33 -4
- package/src/extensions/pi-agent-search/runtime/entry-45.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-46.js +2 -0
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +5 -1
- package/src/extensions/pi-agent-text-editor/package.json +25 -25
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +59 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +37 -8
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +3 -2
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +141 -6
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +123 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
- package/src/plugins/pi-agent-ide-ast/package.json +32 -11
- package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +2 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +16 -8
- package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +22 -17
- package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
- package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +4 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +3 -1
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
- package/src/plugins/pi-agent-ide-debugger/index.ts +573 -0
- package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +73 -0
- package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +306 -0
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +338 -0
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +349 -0
- package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +39 -0
- package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +152 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +1344 -0
- package/src/plugins/pi-agent-ide-debugger/src/ui.ts +14 -0
- package/src/plugins/pi-agent-ide-formatter/package.json +9 -4
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/package.json +13 -8
- package/src/plugins/pi-agent-ide-lsp/index.ts +4 -1
- package/src/plugins/pi-agent-ide-lsp/package.json +15 -10
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
- package/src/plugins/pi-agent-ide-processes/index.ts +28 -0
- package/src/plugins/pi-agent-ide-processes/src/registry.ts +83 -0
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +260 -0
- package/src/plugins/pi-agent-ide-terminal/index.ts +19 -13
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +52 -0
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +31 -0
- package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +24 -58
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -14
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +32 -2
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +114 -1
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +23 -29
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +14 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +116 -240
- package/dist/chunk-3SE372WC.js +0 -3
- package/dist/chunk-5MSNYFDE.js +0 -1
- package/dist/chunk-7JYQMAEL.js +0 -14
- package/dist/chunk-B5KB2I7J.js +0 -3
- package/dist/chunk-NMFQGKPE.js +0 -2
- package/dist/chunk-OVUYPHDE.js +0 -1
- package/dist/chunk-TPIHQYK2.js +0 -14
- package/dist/chunk-XSTHESNR.js +0 -25
- package/dist/entry-16.js +0 -1
- package/docs/evaluation.md +0 -14
- package/node_modules/pi-agent-doctor/runtime/entry-16.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-21.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-25.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-27.js +0 -1
- package/node_modules/pi-agent-image/runtime/entry-33.js +0 -1
- package/node_modules/pi-agent-resource/runtime/entry-41.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-54.js +0 -1
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-75.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-22.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-21.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-36.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-46.js +0 -2
- package/src/extensions/pi-agent-search/runtime/entry-42.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-71.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-54.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-25.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-27.js +0 -1
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-22.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
- /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-34.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-36.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-42.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-46.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-48.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../../../dist/entry-48.js";
|
|
@@ -4,6 +4,7 @@ import { searchFiles } from "#src/file-search.js";
|
|
|
4
4
|
import { createSearchRecipe, runSearchRecipe, type SearchRecipe } from "#src/search-recipe.js";
|
|
5
5
|
import { renderSearchResult } from "#src/search-renderer.js";
|
|
6
6
|
import { createSearchToolDetails } from "#src/search-result.js";
|
|
7
|
+
import { planSearchPresentation } from "#src/search-presentation.js";
|
|
7
8
|
|
|
8
9
|
import type {
|
|
9
10
|
SearchSessionStore,
|
|
@@ -96,7 +97,8 @@ function createMatchResolver(
|
|
|
96
97
|
};
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
const
|
|
100
|
+
const detailBudget = result.request.limit ?? 50;
|
|
101
|
+
const session = await sessions.registerIfCurrent(
|
|
100
102
|
result.request.query,
|
|
101
103
|
result.matches,
|
|
102
104
|
result.complete,
|
|
@@ -104,19 +106,28 @@ function createMatchResolver(
|
|
|
104
106
|
context.signal,
|
|
105
107
|
result.recipe,
|
|
106
108
|
);
|
|
109
|
+
const display = session ?? {
|
|
110
|
+
query: result.request.query,
|
|
111
|
+
matches: result.matches,
|
|
112
|
+
complete: result.complete,
|
|
113
|
+
};
|
|
107
114
|
return {
|
|
108
115
|
content: [
|
|
109
116
|
{
|
|
110
117
|
type: "text",
|
|
111
|
-
text: [
|
|
118
|
+
text: [
|
|
119
|
+
...result.notices,
|
|
120
|
+
formatSearchSession(display, context.cwd, detailBudget, session !== undefined),
|
|
121
|
+
].join("\n"),
|
|
112
122
|
},
|
|
113
123
|
],
|
|
114
124
|
details: createSearchToolDetails(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
125
|
+
display.query,
|
|
126
|
+
display.matches,
|
|
127
|
+
display.complete,
|
|
118
128
|
context.cwd,
|
|
119
|
-
session
|
|
129
|
+
session?.id,
|
|
130
|
+
detailBudget,
|
|
120
131
|
),
|
|
121
132
|
};
|
|
122
133
|
},
|
|
@@ -124,43 +135,61 @@ function createMatchResolver(
|
|
|
124
135
|
};
|
|
125
136
|
}
|
|
126
137
|
|
|
127
|
-
function formatSearchSession(
|
|
138
|
+
function formatSearchSession(
|
|
139
|
+
session: Omit<TextSearchSession, "id"> & { readonly id?: string },
|
|
140
|
+
cwd: string,
|
|
141
|
+
detailBudget: number,
|
|
142
|
+
anchorsRegistered = true,
|
|
143
|
+
): string {
|
|
128
144
|
const fileCount = new Set(session.matches.map((match) => match.source)).size;
|
|
129
145
|
const count = session.matches.length;
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
]
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
lines.push(
|
|
146
|
+
const summary = `${String(count)}${session.complete ? "" : "+"} ${plural(count, "match", "matches")} in ${String(fileCount)} ${plural(fileCount, "file", "files")}`;
|
|
147
|
+
const heading = anchorsRegistered
|
|
148
|
+
? session.complete
|
|
149
|
+
? `SEARCH#${session.id}:all:line / SEARCH#${session.id}:all:match — ${summary}`
|
|
150
|
+
: `${summary} (limit reached; no all anchors were registered)`
|
|
151
|
+
: `${summary} (files changed during search; results shown without anchors)`;
|
|
152
|
+
const lines = anchorsRegistered
|
|
153
|
+
? [
|
|
154
|
+
"Anchors: SEARCH#HASH:N:line (line), SEARCH#HASH:N:match (exact match), SEARCH#HASH:all:line (each unique containing line), SEARCH#HASH:all:match (every exact match)",
|
|
155
|
+
heading,
|
|
156
|
+
]
|
|
157
|
+
: [heading];
|
|
158
|
+
const indices = new Map(session.matches.map((match, index) => [match, index + 1]));
|
|
159
|
+
const presentation = planSearchPresentation(session.matches, detailBudget);
|
|
160
|
+
|
|
161
|
+
for (const [fileIndex, file] of presentation.files.entries()) {
|
|
162
|
+
if (fileIndex > 0) lines.push("");
|
|
163
|
+
const source = displaySource(file.source, cwd);
|
|
164
|
+
if (file.kind === "compacted") {
|
|
165
|
+
lines.push(
|
|
166
|
+
`${source}: ${String(file.matchCount)} matches across ${String(file.uniqueLineCount)} unique line texts (compacted)`,
|
|
167
|
+
);
|
|
168
|
+
for (const group of file.groups) {
|
|
169
|
+
lines.push(` ×${String(group.matchCount)} ${previewLine(group.text)}`);
|
|
170
|
+
}
|
|
171
|
+
if (file.groups.length < file.uniqueLineCount) {
|
|
172
|
+
lines.push(
|
|
173
|
+
` … ${String(file.uniqueLineCount - file.groups.length)} more unique line texts`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
lines.push(
|
|
177
|
+
` Search again with path: ${JSON.stringify(source)} and a narrower query to see individual matches.`,
|
|
178
|
+
);
|
|
179
|
+
continue;
|
|
150
180
|
}
|
|
151
181
|
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
lines.push("", "Increase limit and search again before applying a complete replacement.");
|
|
182
|
+
for (const match of file.matches) {
|
|
183
|
+
const index = indices.get(match);
|
|
184
|
+
if (index === undefined) continue;
|
|
185
|
+
const location = `${source}:${String(match.lineNumber)}:${String(match.startColumn + 1)}-${String(match.endColumn + 1)}`;
|
|
186
|
+
lines.push(
|
|
187
|
+
anchorsRegistered
|
|
188
|
+
? `${location} SEARCH#${session.id}:${String(index)}:line SEARCH#${session.id}:${String(index)}:match`
|
|
189
|
+
: location,
|
|
190
|
+
` ${previewMatch(match)}`,
|
|
191
|
+
);
|
|
192
|
+
}
|
|
164
193
|
}
|
|
165
194
|
|
|
166
195
|
return lines.join("\n");
|
|
@@ -176,6 +205,10 @@ function previewMatch(match: TextSearchMatch): string {
|
|
|
176
205
|
)}⟧${match.lineText.slice(match.endColumn, to)}${to < match.lineText.length ? "…" : ""}`;
|
|
177
206
|
}
|
|
178
207
|
|
|
208
|
+
function previewLine(text: string): string {
|
|
209
|
+
const context = 129;
|
|
210
|
+
return `${text.slice(0, context)}${text.length > context ? "…" : ""}`;
|
|
211
|
+
}
|
|
179
212
|
function displaySource(source: string, cwd: string): string {
|
|
180
213
|
const relative = path.relative(cwd, source);
|
|
181
214
|
// oxlint-disable-next-line repo/no-parent-paths -- defensive check against traversal, not a traversal
|
|
@@ -48,7 +48,6 @@ export async function searchText(
|
|
|
48
48
|
throw new Error("Search supports one-line patterns only.");
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
const limit = request.limit ?? 100;
|
|
52
51
|
const target = path.resolve(cwd, stripFilePrefix(request.path ?? "."));
|
|
53
52
|
const commonArguments = [
|
|
54
53
|
"--json",
|
|
@@ -67,23 +66,22 @@ export async function searchText(
|
|
|
67
66
|
];
|
|
68
67
|
|
|
69
68
|
if (request.regex !== true) {
|
|
70
|
-
return runRipgrep(["--fixed-strings", ...commonArguments],
|
|
69
|
+
return runRipgrep(["--fixed-strings", ...commonArguments], signal);
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
try {
|
|
74
|
-
return await runRipgrep(["--engine", "auto", ...commonArguments],
|
|
73
|
+
return await runRipgrep(["--engine", "auto", ...commonArguments], signal);
|
|
75
74
|
} catch (error) {
|
|
76
75
|
if (!isPcre2MatchLimitError(error)) {
|
|
77
76
|
throw error;
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
return runRipgrep(["--engine", "default", ...commonArguments],
|
|
79
|
+
return runRipgrep(["--engine", "default", ...commonArguments], signal);
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
function runRipgrep(
|
|
85
84
|
arguments_: readonly string[],
|
|
86
|
-
limit: number,
|
|
87
85
|
signal?: AbortSignal,
|
|
88
86
|
): Promise<TextSearchBackendResult> {
|
|
89
87
|
return new Promise((resolve, reject) => {
|
|
@@ -93,7 +91,6 @@ function runRipgrep(
|
|
|
93
91
|
const output = createInterface({ input: child.stdout });
|
|
94
92
|
const matches: TextSearchMatch[] = [];
|
|
95
93
|
let stderr = "";
|
|
96
|
-
let isStoppedAtLimit = false;
|
|
97
94
|
let parseError: unknown;
|
|
98
95
|
|
|
99
96
|
const abort = (): void => {
|
|
@@ -109,7 +106,7 @@ function runRipgrep(
|
|
|
109
106
|
stderr += chunk;
|
|
110
107
|
});
|
|
111
108
|
output.on("line", (line) => {
|
|
112
|
-
if (
|
|
109
|
+
if (parseError !== undefined || line.length === 0) {
|
|
113
110
|
return;
|
|
114
111
|
}
|
|
115
112
|
|
|
@@ -121,12 +118,6 @@ function runRipgrep(
|
|
|
121
118
|
}
|
|
122
119
|
|
|
123
120
|
for (const match of matchesFromEvent(event as RipgrepMatchEvent)) {
|
|
124
|
-
if (matches.length === limit) {
|
|
125
|
-
isStoppedAtLimit = true;
|
|
126
|
-
child.kill();
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
121
|
matches.push(match);
|
|
131
122
|
}
|
|
132
123
|
} catch (error) {
|
|
@@ -153,13 +144,13 @@ function runRipgrep(
|
|
|
153
144
|
return;
|
|
154
145
|
}
|
|
155
146
|
|
|
156
|
-
if (
|
|
147
|
+
if (code !== 0 && code !== 1) {
|
|
157
148
|
reject(new Error(stderr.trim() || `ripgrep exited with code ${String(code)}.`));
|
|
158
149
|
return;
|
|
159
150
|
}
|
|
160
151
|
|
|
161
152
|
matches.sort(compareMatches);
|
|
162
|
-
resolve({ matches, complete:
|
|
153
|
+
resolve({ matches, complete: true });
|
|
163
154
|
});
|
|
164
155
|
|
|
165
156
|
signal?.addEventListener("abort", abort, { once: true });
|
package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { TextSearchMatch } from "#src/search-session.js";
|
|
2
|
+
|
|
3
|
+
export interface SearchPresentationGroup {
|
|
4
|
+
readonly text: string;
|
|
5
|
+
readonly matchCount: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type SearchPresentationFile =
|
|
9
|
+
| {
|
|
10
|
+
readonly kind: "detailed";
|
|
11
|
+
readonly source: string;
|
|
12
|
+
readonly matches: readonly TextSearchMatch[];
|
|
13
|
+
}
|
|
14
|
+
| {
|
|
15
|
+
readonly kind: "compacted";
|
|
16
|
+
readonly source: string;
|
|
17
|
+
readonly matchCount: number;
|
|
18
|
+
readonly uniqueLineCount: number;
|
|
19
|
+
readonly groups: readonly SearchPresentationGroup[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface SearchPresentation {
|
|
23
|
+
readonly files: readonly SearchPresentationFile[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Selects bounded search details while preserving complete low-volume files. */
|
|
27
|
+
export function planSearchPresentation(
|
|
28
|
+
matches: readonly TextSearchMatch[],
|
|
29
|
+
detailBudget: number,
|
|
30
|
+
): SearchPresentation {
|
|
31
|
+
const bySource = new Map<string, TextSearchMatch[]>();
|
|
32
|
+
for (const match of matches) {
|
|
33
|
+
const sourceMatches = bySource.get(match.source) ?? [];
|
|
34
|
+
sourceMatches.push(match);
|
|
35
|
+
bySource.set(match.source, sourceMatches);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const compacted = new Set<string>();
|
|
39
|
+
let detailedCount = matches.length;
|
|
40
|
+
const noisiestFirst = [...bySource].sort(
|
|
41
|
+
([leftSource, left], [rightSource, right]) =>
|
|
42
|
+
right.length - left.length || leftSource.localeCompare(rightSource),
|
|
43
|
+
);
|
|
44
|
+
for (const [source, sourceMatches] of noisiestFirst) {
|
|
45
|
+
if (detailedCount <= detailBudget) break;
|
|
46
|
+
compacted.add(source);
|
|
47
|
+
detailedCount -= sourceMatches.length;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const files = [...bySource]
|
|
51
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
52
|
+
.map(([source, sourceMatches]): SearchPresentationFile => {
|
|
53
|
+
if (!compacted.has(source)) {
|
|
54
|
+
return { kind: "detailed", source, matches: sourceMatches };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const counts = new Map<string, number>();
|
|
58
|
+
for (const match of sourceMatches) {
|
|
59
|
+
counts.set(match.lineText, (counts.get(match.lineText) ?? 0) + 1);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
kind: "compacted",
|
|
63
|
+
source,
|
|
64
|
+
matchCount: sourceMatches.length,
|
|
65
|
+
uniqueLineCount: counts.size,
|
|
66
|
+
groups:
|
|
67
|
+
bySource.size === 1
|
|
68
|
+
? [...counts]
|
|
69
|
+
.sort(
|
|
70
|
+
([leftText, leftCount], [rightText, rightCount]) =>
|
|
71
|
+
rightCount - leftCount || leftText.localeCompare(rightText),
|
|
72
|
+
)
|
|
73
|
+
.slice(0, detailBudget)
|
|
74
|
+
.map(([text, matchCount]) => ({ text, matchCount }))
|
|
75
|
+
: [],
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return { files };
|
|
80
|
+
}
|
|
@@ -50,6 +50,7 @@ interface SearchRenderContext {
|
|
|
50
50
|
type SearchPanelRow =
|
|
51
51
|
| { readonly kind: "file"; readonly file: SearchResultFile }
|
|
52
52
|
| { readonly kind: "line"; readonly file: SearchResultFile; readonly line: SearchResultLine }
|
|
53
|
+
| { readonly kind: "summary"; readonly text: string }
|
|
53
54
|
| { readonly kind: "omitted"; readonly matches: number }
|
|
54
55
|
| { readonly kind: "empty" };
|
|
55
56
|
|
|
@@ -141,7 +142,18 @@ function searchViewport(details: SearchToolDetails, expanded: boolean): readonly
|
|
|
141
142
|
? [{ kind: "empty" } satisfies SearchPanelRow]
|
|
142
143
|
: details.files.flatMap((file): SearchPanelRow[] => [
|
|
143
144
|
{ kind: "file", file },
|
|
144
|
-
...file.
|
|
145
|
+
...(file.uniqueLineCount === undefined
|
|
146
|
+
? file.lines.map((line): SearchPanelRow => ({ kind: "line", file, line }))
|
|
147
|
+
: [
|
|
148
|
+
{
|
|
149
|
+
kind: "summary",
|
|
150
|
+
text: `${String(file.uniqueLineCount)} unique line texts · search this path with a narrower query`,
|
|
151
|
+
} satisfies SearchPanelRow,
|
|
152
|
+
...(file.groups ?? []).map((group): SearchPanelRow => ({
|
|
153
|
+
kind: "summary",
|
|
154
|
+
text: `×${String(group.matchCount)} ${group.text}`,
|
|
155
|
+
})),
|
|
156
|
+
]),
|
|
145
157
|
]);
|
|
146
158
|
|
|
147
159
|
if (expanded || rows.length <= COMPACT_SEARCH_ROWS) {
|
|
@@ -190,6 +202,10 @@ function renderPanelRow(
|
|
|
190
202
|
return renderMatchLine(row.line, width, gutterWidth, theme);
|
|
191
203
|
}
|
|
192
204
|
|
|
205
|
+
if (row.kind === "summary") {
|
|
206
|
+
return [framed(theme.fg("dim", ` ${safeText(row.text)}`), width, theme)];
|
|
207
|
+
}
|
|
208
|
+
|
|
193
209
|
if (row.kind === "omitted") {
|
|
194
210
|
const hint = `${keyText("app.tools.expand")} to expand`;
|
|
195
211
|
return [
|
|
@@ -2,6 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
3
|
|
|
4
4
|
import type { TextSearchMatch } from "#src/search-session.js";
|
|
5
|
+
import { planSearchPresentation } from "#src/search-presentation.js";
|
|
5
6
|
|
|
6
7
|
export interface SearchResultRange {
|
|
7
8
|
readonly from: number;
|
|
@@ -15,10 +16,17 @@ export interface SearchResultLine {
|
|
|
15
16
|
readonly ranges: readonly SearchResultRange[];
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
export interface SearchResultGroup {
|
|
20
|
+
readonly text: string;
|
|
21
|
+
readonly matchCount: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
export interface SearchResultFile {
|
|
19
25
|
readonly path: string;
|
|
20
26
|
readonly link: string;
|
|
21
27
|
readonly matchCount: number;
|
|
28
|
+
readonly uniqueLineCount?: number;
|
|
29
|
+
readonly groups?: readonly SearchResultGroup[];
|
|
22
30
|
readonly lines: readonly SearchResultLine[];
|
|
23
31
|
}
|
|
24
32
|
|
|
@@ -43,17 +51,21 @@ export function createSearchToolDetails(
|
|
|
43
51
|
complete: boolean,
|
|
44
52
|
cwd: string,
|
|
45
53
|
sessionId?: string,
|
|
54
|
+
detailBudget = 50,
|
|
46
55
|
): SearchToolDetails {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const presentation = planSearchPresentation(matches, detailBudget);
|
|
57
|
+
const files = presentation.files.map((file): SearchResultFile =>
|
|
58
|
+
file.kind === "detailed"
|
|
59
|
+
? createSearchResultFile(file.source, file.matches, cwd)
|
|
60
|
+
: {
|
|
61
|
+
path: displaySource(file.source, cwd),
|
|
62
|
+
link: pathToFileURL(file.source).href,
|
|
63
|
+
matchCount: file.matchCount,
|
|
64
|
+
uniqueLineCount: file.uniqueLineCount,
|
|
65
|
+
groups: file.groups,
|
|
66
|
+
lines: [],
|
|
67
|
+
},
|
|
68
|
+
);
|
|
57
69
|
|
|
58
70
|
return {
|
|
59
71
|
...(sessionId !== undefined && { sessionId }),
|
|
@@ -141,9 +153,17 @@ function isSearchResultFile(value: unknown): value is SearchResultFile {
|
|
|
141
153
|
return false;
|
|
142
154
|
}
|
|
143
155
|
|
|
156
|
+
const lines = value.lines as readonly SearchResultLine[];
|
|
157
|
+
const groups = value.groups;
|
|
144
158
|
return (
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
(groups === undefined ||
|
|
160
|
+
(Array.isArray(groups) &&
|
|
161
|
+
groups.every(
|
|
162
|
+
(group) => isRecord(group) && typeof group.text === "string" && isCount(group.matchCount),
|
|
163
|
+
))) &&
|
|
164
|
+
(value.uniqueLineCount === undefined || isCount(value.uniqueLineCount)) &&
|
|
165
|
+
(lines.length === 0 ||
|
|
166
|
+
value.matchCount === lines.reduce((count, line) => count + line.matchCount, 0))
|
|
147
167
|
);
|
|
148
168
|
}
|
|
149
169
|
|
|
@@ -92,9 +92,12 @@ export function createSearchSessionIdentity(
|
|
|
92
92
|
match.matchedText,
|
|
93
93
|
match.lineText,
|
|
94
94
|
]);
|
|
95
|
-
const
|
|
95
|
+
const { limit: _detailBudget, ...selectionRecipe } = normalizeRecipe(
|
|
96
|
+
recipe ?? { query, regex: true },
|
|
97
|
+
root,
|
|
98
|
+
);
|
|
96
99
|
return createHash("sha256")
|
|
97
|
-
.update(JSON.stringify([query, root,
|
|
100
|
+
.update(JSON.stringify([query, root, selectionRecipe, identity]))
|
|
98
101
|
.digest("hex")
|
|
99
102
|
.toUpperCase();
|
|
100
103
|
}
|
|
@@ -124,12 +127,20 @@ function normalizeRecipe(recipe: SearchRecipe, cwd: string): Record<string, unkn
|
|
|
124
127
|
exclude: recipe.exclude ?? "",
|
|
125
128
|
caseSensitive: recipe.caseSensitive === true,
|
|
126
129
|
wholeWord: recipe.wholeWord === true,
|
|
127
|
-
limit: recipe.limit ??
|
|
130
|
+
limit: recipe.limit ?? 50,
|
|
128
131
|
regex: recipe.regex === true,
|
|
129
132
|
fallbacks: recipe.fallbacks ?? [],
|
|
130
133
|
};
|
|
131
134
|
}
|
|
132
135
|
|
|
136
|
+
/** Indicates that search output is still displayable, but no stable anchors can be registered. */
|
|
137
|
+
export class SearchSnapshotChangedError extends Error {
|
|
138
|
+
public constructor(source: string) {
|
|
139
|
+
super(`Search result in ${source} changed before its anchors were registered.`);
|
|
140
|
+
this.name = "SearchSnapshotChangedError";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
133
144
|
/** Stores search snapshots and resolves the stable anchors emitted for them. */
|
|
134
145
|
export class SearchSessionStore {
|
|
135
146
|
readonly #sessions = new Map<string, StoredSearchSession>();
|
|
@@ -173,6 +184,24 @@ export class SearchSessionStore {
|
|
|
173
184
|
return session;
|
|
174
185
|
}
|
|
175
186
|
|
|
187
|
+
/** Registers anchors when every match still describes the current files. */
|
|
188
|
+
public async registerIfCurrent(
|
|
189
|
+
query: string,
|
|
190
|
+
sourceMatches: readonly TextSearchMatch[],
|
|
191
|
+
complete: boolean,
|
|
192
|
+
cwd: string,
|
|
193
|
+
signal?: AbortSignal,
|
|
194
|
+
recipe?: SearchRecipe,
|
|
195
|
+
refresh?: SearchSelectionRegistration["refresh"],
|
|
196
|
+
): Promise<TextSearchSession | undefined> {
|
|
197
|
+
try {
|
|
198
|
+
return await this.register(query, sourceMatches, complete, cwd, signal, recipe, refresh);
|
|
199
|
+
} catch (error) {
|
|
200
|
+
if (error instanceof SearchSnapshotChangedError) return undefined;
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
176
205
|
/** Repeats each referenced search once, keeping its original scope, limits and fallback rules. */
|
|
177
206
|
public async observeAfterEdit(
|
|
178
207
|
values: readonly unknown[],
|
|
@@ -503,7 +532,7 @@ async function snapshotContents(
|
|
|
503
532
|
for (const match of matches.filter((candidate) => candidate.source === source)) {
|
|
504
533
|
const line = document.lines[match.lineNumber - 1]?.content;
|
|
505
534
|
if (line !== match.lineText || matchedSourceText(document, match) !== match.matchedText) {
|
|
506
|
-
throw new
|
|
535
|
+
throw new SearchSnapshotChangedError(source);
|
|
507
536
|
}
|
|
508
537
|
}
|
|
509
538
|
contentBySource.set(source, content);
|
|
@@ -18,7 +18,11 @@ export const searchSchema = Type.Object(
|
|
|
18
18
|
),
|
|
19
19
|
wholeWord: Type.Optional(Type.Boolean({ description: "Match complete words in local search" })),
|
|
20
20
|
limit: Type.Optional(
|
|
21
|
-
Type.Integer({
|
|
21
|
+
Type.Integer({
|
|
22
|
+
minimum: 1,
|
|
23
|
+
maximum: 1000,
|
|
24
|
+
description: "Maximum detailed results returned to the agent (default 50)",
|
|
25
|
+
}),
|
|
22
26
|
),
|
|
23
27
|
},
|
|
24
28
|
{ additionalProperties: false },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,67 +8,67 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./api/apply-renderer": {
|
|
10
10
|
"types": "./src/api/apply-renderer.ts",
|
|
11
|
-
"default": "./runtime/entry-
|
|
11
|
+
"default": "./runtime/entry-55.js"
|
|
12
12
|
},
|
|
13
13
|
"./api/anchor-inspection": {
|
|
14
14
|
"types": "./src/api/anchor-inspection.ts",
|
|
15
|
-
"default": "./runtime/entry-
|
|
15
|
+
"default": "./runtime/entry-56.js"
|
|
16
16
|
},
|
|
17
17
|
"./api/connect-plugin": {
|
|
18
18
|
"types": "./src/api/connect-plugin.ts",
|
|
19
|
-
"default": "./runtime/entry-
|
|
19
|
+
"default": "./runtime/entry-57.js"
|
|
20
20
|
},
|
|
21
21
|
"./api/edit-completion": {
|
|
22
22
|
"types": "./src/api/edit-completion.ts",
|
|
23
|
-
"default": "./runtime/entry-
|
|
23
|
+
"default": "./runtime/entry-58.js"
|
|
24
24
|
},
|
|
25
25
|
"./api/edit-pipeline": {
|
|
26
26
|
"types": "./src/api/edit-pipeline.ts",
|
|
27
|
-
"default": "./runtime/entry-
|
|
27
|
+
"default": "./runtime/entry-59.js"
|
|
28
28
|
},
|
|
29
29
|
"./api/plugin-protocol": {
|
|
30
30
|
"types": "./src/api/plugin-protocol.ts",
|
|
31
|
-
"default": "./runtime/entry-
|
|
31
|
+
"default": "./runtime/entry-60.js"
|
|
32
32
|
},
|
|
33
33
|
"./api/stale-anchor-message": {
|
|
34
34
|
"types": "./src/api/stale-anchor-message.ts",
|
|
35
|
-
"default": "./runtime/entry-
|
|
35
|
+
"default": "./runtime/entry-61.js"
|
|
36
36
|
},
|
|
37
37
|
"./api/text-selection-anchor": {
|
|
38
38
|
"types": "./src/api/text-selection-anchor.ts",
|
|
39
|
-
"default": "./runtime/entry-
|
|
39
|
+
"default": "./runtime/entry-62.js"
|
|
40
40
|
},
|
|
41
41
|
"./api/post-edit": {
|
|
42
42
|
"types": "./src/api/post-edit.ts",
|
|
43
|
-
"default": "./runtime/entry-
|
|
43
|
+
"default": "./runtime/entry-63.js"
|
|
44
44
|
},
|
|
45
45
|
"./api/mutation-result": {
|
|
46
46
|
"types": "./src/api/mutation-result.ts",
|
|
47
|
-
"default": "./runtime/entry-
|
|
47
|
+
"default": "./runtime/entry-64.js"
|
|
48
48
|
},
|
|
49
49
|
"./api/mutation-guard": {
|
|
50
50
|
"types": "./src/api/mutation-guard.ts",
|
|
51
|
-
"default": "./runtime/entry-
|
|
51
|
+
"default": "./runtime/entry-65.js"
|
|
52
52
|
},
|
|
53
53
|
"./api/mutation-tool": {
|
|
54
54
|
"types": "./src/api/mutation-tool.ts",
|
|
55
|
-
"default": "./runtime/entry-
|
|
55
|
+
"default": "./runtime/entry-66.js"
|
|
56
56
|
},
|
|
57
57
|
"./api/mutation-preview": {
|
|
58
58
|
"types": "./src/api/mutation-preview.ts",
|
|
59
|
-
"default": "./runtime/entry-
|
|
59
|
+
"default": "./runtime/entry-67.js"
|
|
60
60
|
},
|
|
61
61
|
"./api/last-resolved-resource": {
|
|
62
62
|
"types": "./src/api/last-resolved-resource.ts",
|
|
63
|
-
"default": "./runtime/entry-
|
|
63
|
+
"default": "./runtime/entry-68.js"
|
|
64
64
|
},
|
|
65
65
|
"./api/tool-call-interceptor": {
|
|
66
66
|
"types": "./src/api/tool-call-interceptor.ts",
|
|
67
|
-
"default": "./runtime/entry-
|
|
67
|
+
"default": "./runtime/entry-69.js"
|
|
68
68
|
},
|
|
69
69
|
"./api/tool-renderer": {
|
|
70
70
|
"types": "./src/api/tool-renderer.ts",
|
|
71
|
-
"default": "./runtime/entry-
|
|
71
|
+
"default": "./runtime/entry-70.js"
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
@@ -79,19 +79,19 @@
|
|
|
79
79
|
"fs-extra": "^11.4.0",
|
|
80
80
|
"oxfmt": "0.64.0",
|
|
81
81
|
"partial-json": "^0.1.7",
|
|
82
|
-
"pi-agent-invariant": "0.
|
|
83
|
-
"pi-agent-read": "0.
|
|
84
|
-
"pi-agent-resource": "0.
|
|
85
|
-
"pi-agent-search": "0.
|
|
86
|
-
"pi-agent-text": "0.
|
|
87
|
-
"pi-agent-tool-call-interception": "0.
|
|
88
|
-
"pi-agent-tool-ui": "0.
|
|
82
|
+
"pi-agent-invariant": "0.5.1",
|
|
83
|
+
"pi-agent-read": "0.5.1",
|
|
84
|
+
"pi-agent-resource": "0.5.1",
|
|
85
|
+
"pi-agent-search": "0.5.1",
|
|
86
|
+
"pi-agent-text": "0.5.1",
|
|
87
|
+
"pi-agent-tool-call-interception": "0.5.1",
|
|
88
|
+
"pi-agent-tool-ui": "0.5.1",
|
|
89
89
|
"run": "2.1.4",
|
|
90
90
|
"typebox-guard": "npm:typebox@^1.1.38"
|
|
91
91
|
},
|
|
92
92
|
"pi": {
|
|
93
93
|
"extensions": [
|
|
94
|
-
"./runtime/entry-
|
|
94
|
+
"./runtime/entry-71.js"
|
|
95
95
|
]
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|