pi-agent-ide 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +81 -23
- 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-22CLOM2D.js +1 -0
- package/dist/{chunk-LY6U5EAD.js → chunk-2527OQ4Y.js} +1 -1
- package/dist/chunk-3XJ3KDPZ.js +16 -0
- package/dist/chunk-5JELU6RV.js +7 -0
- package/dist/chunk-DDKHZZDO.js +5 -0
- package/dist/chunk-FEDVTZJG.js +1 -0
- package/dist/chunk-HSM6R7IB.js +27 -0
- package/dist/chunk-K5G4FDXD.js +1 -0
- package/dist/chunk-M5IVSCR2.js +1 -0
- package/dist/chunk-OYWIZII6.js +1 -0
- package/dist/chunk-P7XO5CIP.js +2 -0
- package/dist/chunk-PCZH7GOX.js +26 -0
- package/dist/{chunk-DQXPQOF7.js → chunk-SQ7ZTGOP.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 -0
- 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 -1
- package/dist/entry-22.js +1 -2
- package/dist/entry-23.js +2 -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 -12
- package/dist/entry-28.js +12 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +1 -1
- package/dist/entry-32.js +1 -4
- package/dist/entry-33.js +3 -8
- package/dist/entry-34.js +9 -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 -1
- package/dist/entry-41.js +1 -18
- package/dist/entry-42.js +18 -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 -7
- package/dist/entry-47.js +7 -11
- package/dist/entry-48.js +11 -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 -1
- package/dist/entry-56.js +1 -0
- package/dist/entry-57.js +0 -1
- package/dist/entry-58.js +1 -0
- package/dist/entry-59.js +0 -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 +0 -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-70.js +1 -1
- package/dist/entry-71.js +1 -203
- package/dist/entry-72.js +254 -25
- package/dist/entry-73.js +30 -2
- package/dist/entry-74.js +2 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +3 -3
- package/dist/entry-78.js +3 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-80.js +1 -1
- package/dist/entry-81.js +1 -0
- package/dist/pi-agent-ide.js +3 -3
- package/docs/configuration.md +3 -1
- package/docs/development.md +0 -6
- package/docs/tools.md +12 -0
- package/node_modules/pi-agent-doctor/package.json +6 -6
- package/node_modules/pi-agent-doctor/runtime/entry-22.js +1 -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-26.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +12 -11
- package/node_modules/pi-agent-ide-ast/runtime/entry-27.js +0 -1
- package/node_modules/pi-agent-ide-ast/runtime/entry-28.js +2 -0
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +8 -6
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/runtime/entry-29.js +0 -1
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +3 -1
- package/node_modules/pi-agent-ide-lsp/package.json +10 -10
- package/node_modules/pi-agent-ide-lsp/runtime/entry-34.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-41.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-42.js +2 -0
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +2 -2
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +11 -6
- 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-46.js +0 -1
- package/node_modules/pi-agent-search-text/package.json +9 -9
- package/node_modules/pi-agent-search-text/runtime/entry-48.js +1 -0
- package/node_modules/pi-agent-search-text/src/resolvers.ts +32 -27
- package/node_modules/pi-agent-search-text/src/search-session.ts +27 -1
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-50.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-51.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/index.ts +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-53.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/src/config.ts +2 -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-54.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-55.js +2 -0
- package/node_modules/pi-agent-text-editor/package.json +25 -25
- package/node_modules/pi-agent-text-editor/runtime/entry-71.js +0 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +125 -3
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +14 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +32 -3
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +21 -19
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +37 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +85 -34
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +2 -3
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +589 -241
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +5 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-config.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +9 -1
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +53 -0
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +11 -41
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +8 -18
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +11 -41
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -19
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-74.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-76.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-81.js +2 -0
- package/package.json +44 -39
- package/src/api/path-identity.ts +15 -0
- package/src/composite/builtin-extensions.ts +7 -2
- package/src/composite/module-labels.ts +4 -0
- package/src/composite/module-settings.ts +34 -14
- package/src/composite/preferences.ts +46 -3
- package/src/composite/selection.ts +5 -1
- package/src/doctor/inventory.ts +7 -2
- 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-26.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-23.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-81.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-77.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-41.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-42.js +2 -0
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +2 -2
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +11 -6
- package/src/extensions/pi-agent-search/package.json +7 -7
- 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-48.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-49.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +32 -27
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +27 -1
- package/src/extensions/pi-agent-search/runtime/entry-46.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-47.js +2 -0
- 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-51.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +3 -3
- 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-52.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-53.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/config.ts +2 -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-54.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-55.js +2 -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-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-74.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-72.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +125 -3
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +14 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +32 -3
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +21 -19
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +37 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +85 -34
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +2 -3
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +589 -241
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +5 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-config.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +9 -1
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +53 -0
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +11 -41
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +8 -18
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +11 -41
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -19
- package/src/pi-agent-ide.ts +15 -2
- package/src/plugins/pi-agent-ide-ast/package.json +12 -11
- package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-28.js +2 -0
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +8 -6
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/runtime/entry-29.js +0 -1
- package/src/plugins/pi-agent-ide-debugger/index.ts +3 -9
- package/src/plugins/pi-agent-ide-debugger/src/adapter-executables.ts +31 -0
- package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +3 -1
- package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +24 -23
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -2
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +55 -17
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -22
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +3 -1
- package/src/plugins/pi-agent-ide-lsp/package.json +10 -10
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-34.js +2 -0
- package/src/plugins/pi-agent-ide-processes/src/registry.ts +6 -0
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +28 -11
- package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +2 -0
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +32 -2
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +5 -4
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +2 -2
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +3 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +1 -1
- package/src/plugins/pi-agent-ide-vision/index.ts +232 -0
- package/src/plugins/pi-agent-ide-vision/src/vision.ts +530 -0
- package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +30 -0
- package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +33 -0
- package/dist/chunk-5PLV4HLG.js +0 -1
- package/dist/chunk-BGUSBUUD.js +0 -26
- package/dist/chunk-G725MARR.js +0 -16
- package/dist/chunk-HKXDP2FD.js +0 -7
- package/dist/chunk-J4RTW44E.js +0 -1
- package/dist/chunk-QH4ZUDOD.js +0 -1
- package/dist/chunk-WGGIQ7IJ.js +0 -1
- package/dist/chunk-ZG2MWXCR.js +0 -2
- package/dist/chunk-ZUMN6U77.js +0 -27
- package/dist/entry-17.js +0 -1
- package/docs/evaluation.md +0 -14
- package/node_modules/pi-agent-doctor/runtime/entry-17.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-22.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- package/node_modules/pi-agent-image/runtime/entry-34.js +0 -1
- package/node_modules/pi-agent-resource/runtime/entry-42.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-50.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-55.js +0 -1
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-74.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-23.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-77.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-37.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +0 -2
- package/src/extensions/pi-agent-search/runtime/entry-43.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +0 -2
- 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-line-hash/runtime/entry-53.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-72.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-55.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-23.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-24.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-25.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-32.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-33.js +0 -0
- /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-36.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-37.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-43.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-47.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-49.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-73.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-75.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-79.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-80.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-24.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-25.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-80.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-73.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-30.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-31.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-32.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-33.js +0 -0
|
@@ -9,6 +9,8 @@ import { type BrowserHtmlLoader, createSystemBrowserHtmlLoader } from "./browser
|
|
|
9
9
|
|
|
10
10
|
type WebContentHost = Pick<ContentHost, "convert">;
|
|
11
11
|
|
|
12
|
+
const BINARY_PREVIEW_BYTES = 4096;
|
|
13
|
+
|
|
12
14
|
/** HTTP timeout, transport, and internal browser fallback settings. */
|
|
13
15
|
export interface WebResolverOptions {
|
|
14
16
|
readonly timeoutMs?: number;
|
|
@@ -115,10 +117,20 @@ async function readWebContent(
|
|
|
115
117
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
116
118
|
}
|
|
117
119
|
|
|
120
|
+
const mediaType = response.headers.get("content-type") ?? undefined;
|
|
121
|
+
if (isUnsupportedBinaryMediaType(mediaType) && !hasSupportedDocumentExtension(url)) {
|
|
122
|
+
const preview = await readBoundedBody(response, BINARY_PREVIEW_BYTES, operation.signal);
|
|
123
|
+
return [
|
|
124
|
+
{
|
|
125
|
+
type: "text",
|
|
126
|
+
text: formatUnsupportedBinaryResponse(url, response, mediaType, preview),
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
|
|
118
131
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
119
132
|
operation.signal.throwIfAborted();
|
|
120
133
|
const source = response.url.length === 0 ? url.href : response.url;
|
|
121
|
-
const mediaType = response.headers.get("content-type") ?? undefined;
|
|
122
134
|
const input = {
|
|
123
135
|
source,
|
|
124
136
|
bytes,
|
|
@@ -191,6 +203,121 @@ async function loadAndConvertBrowser(
|
|
|
191
203
|
);
|
|
192
204
|
}
|
|
193
205
|
|
|
206
|
+
function isUnsupportedBinaryMediaType(mediaType: string | undefined): boolean {
|
|
207
|
+
if (mediaType === undefined) return false;
|
|
208
|
+
const type = mediaType.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
209
|
+
return !(
|
|
210
|
+
type.startsWith("text/") ||
|
|
211
|
+
type.startsWith("image/") ||
|
|
212
|
+
type === "application/json" ||
|
|
213
|
+
type.endsWith("+json") ||
|
|
214
|
+
type === "application/xml" ||
|
|
215
|
+
type.endsWith("+xml") ||
|
|
216
|
+
type === "application/xhtml+xml" ||
|
|
217
|
+
type === "application/pdf"
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function hasSupportedDocumentExtension(url: URL): boolean {
|
|
222
|
+
return /\.(?:avif|bmp|gif|jpe?g|pdf|png|webp)$/iu.test(url.pathname);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function readBoundedBody(
|
|
226
|
+
response: Response,
|
|
227
|
+
limit: number,
|
|
228
|
+
signal: AbortSignal,
|
|
229
|
+
): Promise<Uint8Array> {
|
|
230
|
+
if (response.body === null) return new Uint8Array();
|
|
231
|
+
const reader = response.body.getReader();
|
|
232
|
+
const chunks: Uint8Array[] = [];
|
|
233
|
+
let length = 0;
|
|
234
|
+
try {
|
|
235
|
+
while (length < limit) {
|
|
236
|
+
signal.throwIfAborted();
|
|
237
|
+
const part = await reader.read();
|
|
238
|
+
if (part.done) break;
|
|
239
|
+
const remaining = limit - length;
|
|
240
|
+
const chunk = part.value.subarray(0, remaining);
|
|
241
|
+
chunks.push(chunk);
|
|
242
|
+
length += chunk.length;
|
|
243
|
+
if (part.value.length > remaining) break;
|
|
244
|
+
}
|
|
245
|
+
} finally {
|
|
246
|
+
await reader.cancel().catch(() => undefined);
|
|
247
|
+
}
|
|
248
|
+
const preview = new Uint8Array(length);
|
|
249
|
+
let offset = 0;
|
|
250
|
+
for (const chunk of chunks) {
|
|
251
|
+
preview.set(chunk, offset);
|
|
252
|
+
offset += chunk.length;
|
|
253
|
+
}
|
|
254
|
+
return preview;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function formatUnsupportedBinaryResponse(
|
|
258
|
+
requestedUrl: URL,
|
|
259
|
+
response: Response,
|
|
260
|
+
mediaType: string | undefined,
|
|
261
|
+
preview: Uint8Array,
|
|
262
|
+
): string {
|
|
263
|
+
const lines = [
|
|
264
|
+
"Binary response",
|
|
265
|
+
`URL: ${requestedUrl.href}`,
|
|
266
|
+
`HTTP: ${response.status} ${response.statusText}`.trimEnd(),
|
|
267
|
+
`Content-Type: ${mediaType ?? "unknown"}`,
|
|
268
|
+
];
|
|
269
|
+
const disposition = response.headers.get("content-disposition");
|
|
270
|
+
const filename = disposition === null ? undefined : attachmentFilename(disposition);
|
|
271
|
+
if (filename !== undefined) lines.push(`Filename: ${filename}`);
|
|
272
|
+
const length = response.headers.get("content-length");
|
|
273
|
+
if (length !== null) lines.push(`Content-Length: ${length}`);
|
|
274
|
+
lines.push("", "Headers:");
|
|
275
|
+
for (const [name, value] of [...response.headers].sort(([left], [right]) =>
|
|
276
|
+
left.localeCompare(right),
|
|
277
|
+
)) {
|
|
278
|
+
if (isSensitiveRedirectHeader(name)) continue;
|
|
279
|
+
lines.push(`${name}: ${value}`);
|
|
280
|
+
}
|
|
281
|
+
lines.push(
|
|
282
|
+
"",
|
|
283
|
+
`Preview: first ${preview.length} bytes (hex); the remaining body was not downloaded`,
|
|
284
|
+
formatHexPreview(preview),
|
|
285
|
+
);
|
|
286
|
+
return lines.join("\n");
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function attachmentFilename(disposition: string): string | undefined {
|
|
290
|
+
const encoded = /filename\*=UTF-8''([^;]+)/iu.exec(disposition)?.[1];
|
|
291
|
+
if (encoded !== undefined) {
|
|
292
|
+
try {
|
|
293
|
+
return decodeURIComponent(encoded).replaceAll(/[\r\n]/gu, "");
|
|
294
|
+
} catch {
|
|
295
|
+
return encoded.replaceAll(/[\r\n]/gu, "");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return /filename=(?:"([^"]+)"|([^;]+))/iu.exec(disposition)?.slice(1).find(Boolean)?.trim();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function isSensitiveRedirectHeader(name: string): boolean {
|
|
302
|
+
return ["content-location", "link", "location", "refresh", "set-cookie"].includes(
|
|
303
|
+
name.toLowerCase(),
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function formatHexPreview(bytes: Uint8Array): string {
|
|
308
|
+
if (bytes.length === 0) return "(empty body)";
|
|
309
|
+
const rows: string[] = [];
|
|
310
|
+
for (let offset = 0; offset < bytes.length; offset += 16) {
|
|
311
|
+
const chunk = bytes.subarray(offset, offset + 16);
|
|
312
|
+
const hex = [...chunk].map((byte) => byte.toString(16).padStart(2, "0")).join(" ");
|
|
313
|
+
const text = [...chunk]
|
|
314
|
+
.map((byte) => (byte >= 32 && byte <= 126 ? String.fromCodePoint(byte) : "."))
|
|
315
|
+
.join("");
|
|
316
|
+
rows.push(`${offset.toString(16).padStart(8, "0")} ${hex.padEnd(47)} |${text}|`);
|
|
317
|
+
}
|
|
318
|
+
return rows.join("\n");
|
|
319
|
+
}
|
|
320
|
+
|
|
194
321
|
function isHtml(bytes: Uint8Array, mediaType: string | undefined): boolean {
|
|
195
322
|
const normalizedMediaType = mediaType?.split(";", 1)[0]?.trim().toLowerCase();
|
|
196
323
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-read",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,31 +8,31 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./api/connect-plugin": {
|
|
10
10
|
"types": "./src/api/connect-plugin.ts",
|
|
11
|
-
"default": "./runtime/entry-
|
|
11
|
+
"default": "./runtime/entry-38.js"
|
|
12
12
|
},
|
|
13
13
|
"./api/rendering": {
|
|
14
14
|
"types": "./src/api/rendering.ts",
|
|
15
|
-
"default": "./runtime/entry-
|
|
15
|
+
"default": "./runtime/entry-39.js"
|
|
16
16
|
},
|
|
17
17
|
"./api/plugin-protocol": {
|
|
18
18
|
"types": "./src/api/plugin-protocol.ts",
|
|
19
|
-
"default": "./runtime/entry-
|
|
19
|
+
"default": "./runtime/entry-40.js"
|
|
20
20
|
},
|
|
21
21
|
"./api/tools/read": {
|
|
22
22
|
"types": "./src/api/tools/read.ts",
|
|
23
|
-
"default": "./runtime/entry-
|
|
23
|
+
"default": "./runtime/entry-41.js"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"pi-agent-invariant": "0.
|
|
28
|
-
"pi-agent-resource": "0.
|
|
29
|
-
"pi-agent-text": "0.
|
|
30
|
-
"pi-agent-tool-call-interception": "0.
|
|
31
|
-
"pi-agent-tool-ui": "0.
|
|
27
|
+
"pi-agent-invariant": "0.6.0",
|
|
28
|
+
"pi-agent-resource": "0.6.0",
|
|
29
|
+
"pi-agent-text": "0.6.0",
|
|
30
|
+
"pi-agent-tool-call-interception": "0.6.0",
|
|
31
|
+
"pi-agent-tool-ui": "0.6.0"
|
|
32
32
|
},
|
|
33
33
|
"pi": {
|
|
34
34
|
"extensions": [
|
|
35
|
-
"./runtime/entry-
|
|
35
|
+
"./runtime/entry-42.js"
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
@@ -11,13 +11,13 @@ export const readParameters = Type.Object({
|
|
|
11
11
|
offset: Type.Optional(
|
|
12
12
|
Type.Number({
|
|
13
13
|
description:
|
|
14
|
-
"For raw: sources, use a zero-based byte offset; negative offsets count from the file end. For other sources: first line to return, numbered from 1. Omit or use 0 to start at line 1; -1 starts at the last line, -10 at the tenth line from the end. For path#anchor or a SEARCH selection, count from its containing line instead: 0 or 1 starts there, 2 starts one line later, -1 one line earlier.",
|
|
14
|
+
"For raw: sources, use a zero-based byte offset; negative offsets count from the file end. For other sources: first line to return, numbered from 1. Omit or use 0 to start at line 1; -1 starts at the last line, -10 at the tenth line from the end. For path#anchor or a SEARCH selection, count from its containing line instead: 0 or 1 starts there, 2 starts one line later, -1 one line earlier. For image and sequence views, offset is a zero-based row-major grid cell index and requires limit.",
|
|
15
15
|
}),
|
|
16
16
|
),
|
|
17
17
|
limit: Type.Optional(
|
|
18
18
|
Type.Number({
|
|
19
19
|
description:
|
|
20
|
-
"For raw: sources, use a non-negative byte count (0 reads no bytes). Otherwise, maximum lines from the selected starting position. Output is bounded; omit for the default read.",
|
|
20
|
+
"For raw: sources, use a non-negative byte count (0 reads no bytes). Otherwise, maximum lines from the selected starting position. Output is bounded; omit for the default read. For image and sequence views, limit is the square grid cell size in pixels; omit offset to select cell 0, or omit both for the bounded full image.",
|
|
21
21
|
}),
|
|
22
22
|
),
|
|
23
23
|
views: Type.Optional(
|
|
@@ -148,8 +148,7 @@ export function createReadTool(
|
|
|
148
148
|
name: toolId,
|
|
149
149
|
label: toolId,
|
|
150
150
|
|
|
151
|
-
promptSnippet:
|
|
152
|
-
"Read files, original bytes with raw:, URLs, temporary resources, search selections, and protocol sources, with optional views projected onto text content",
|
|
151
|
+
promptSnippet: "Read supported sources as text or bytes, with optional views",
|
|
153
152
|
get description(): string {
|
|
154
153
|
return [
|
|
155
154
|
`Use read to inspect files, directories, URLs and supported sources without changing them. path selects the source; offset/limit select a text window; views add annotations. Text limit: ${READ_OUTPUT_MAX_LINES} lines or ${READ_OUTPUT_MAX_BYTES / 1024}KB. Continuation: returned offset, or returned temp: reference as path. Temporary references remain available until their owning runtime is disposed.`,
|
|
@@ -162,7 +161,7 @@ export function createReadTool(
|
|
|
162
161
|
get promptGuidelines(): string[] {
|
|
163
162
|
return [
|
|
164
163
|
"Use read to examine supported sources instead of cat, sed, head or tail. Use search to locate workspace text and paths instead of grep, rg or find.",
|
|
165
|
-
"Use read with raw:<local-file> instead of xxd, od or hexdump
|
|
164
|
+
"Use read with raw:<local-file> instead of xxd, od or hexdump when byte-level inspection is needed.",
|
|
166
165
|
...(pluginPromptGuidelines?.() ?? []),
|
|
167
166
|
];
|
|
168
167
|
},
|
|
@@ -349,12 +348,13 @@ async function executeRead(
|
|
|
349
348
|
const targetSnapshot = [...targetResolvers].sort(
|
|
350
349
|
(left, right) => left.priority - right.priority || left.order - right.order,
|
|
351
350
|
);
|
|
352
|
-
const
|
|
351
|
+
const rawRequestedViews = [
|
|
353
352
|
...(request.views ?? []),
|
|
354
353
|
...(audience === "script" ? viewSnapshot.map(({ registration }) => registration.view) : []),
|
|
355
|
-
]
|
|
354
|
+
];
|
|
355
|
+
const requestedViews = new Set(rawRequestedViews.map(viewName));
|
|
356
356
|
const knownViews = new Set([...viewSnapshot.map(({ registration }) => registration.view)]);
|
|
357
|
-
const ignoredViews =
|
|
357
|
+
const ignoredViews = rawRequestedViews.filter((view) => !knownViews.has(viewName(view)));
|
|
358
358
|
if (request.path !== undefined && targetSnapshot.length > 0) {
|
|
359
359
|
const targeted = await resolveTextTargets(
|
|
360
360
|
request,
|
|
@@ -1053,6 +1053,11 @@ async function runTextPresenters(
|
|
|
1053
1053
|
return { ...context, state: { ...state, text: presented } };
|
|
1054
1054
|
}
|
|
1055
1055
|
|
|
1056
|
+
function viewName(view: string): string {
|
|
1057
|
+
const separator = view.indexOf(":");
|
|
1058
|
+
return separator < 0 ? view : view.slice(0, separator);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1056
1061
|
/** Prepends a note listing unknown view names so the agent can correct the request. */
|
|
1057
1062
|
function withIgnoredViews(result: ReadToolResult, ignoredViews: readonly string[]): ReadToolResult {
|
|
1058
1063
|
if (ignoredViews.length === 0) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-search",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./api/connect-plugin": {
|
|
10
10
|
"types": "./src/api/connect-plugin.ts",
|
|
11
|
-
"default": "./runtime/entry-
|
|
11
|
+
"default": "./runtime/entry-44.js"
|
|
12
12
|
},
|
|
13
13
|
"./api/plugin-protocol": {
|
|
14
14
|
"types": "./src/api/plugin-protocol.ts",
|
|
15
|
-
"default": "./runtime/entry-
|
|
15
|
+
"default": "./runtime/entry-45.js"
|
|
16
16
|
},
|
|
17
17
|
"./api/search": {
|
|
18
18
|
"types": "./src/api/search.ts",
|
|
19
|
-
"default": "./runtime/entry-
|
|
19
|
+
"default": "./runtime/entry-46.js"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"pi-agent-tool-call-interception": "0.
|
|
24
|
-
"pi-agent-tool-ui": "0.
|
|
23
|
+
"pi-agent-tool-call-interception": "0.6.0",
|
|
24
|
+
"pi-agent-tool-ui": "0.6.0"
|
|
25
25
|
},
|
|
26
26
|
"pi": {
|
|
27
27
|
"extensions": [
|
|
28
|
-
"./runtime/entry-
|
|
28
|
+
"./runtime/entry-47.js"
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-search-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./index.ts",
|
|
11
|
-
"default": "./runtime/entry-
|
|
11
|
+
"default": "./runtime/entry-48.js"
|
|
12
12
|
},
|
|
13
13
|
"./search-session": {
|
|
14
14
|
"types": "./src/search-session.ts",
|
|
15
|
-
"default": "./runtime/entry-
|
|
15
|
+
"default": "./runtime/entry-49.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"pi-agent-doctor": "0.
|
|
20
|
-
"pi-agent-invariant": "0.
|
|
21
|
-
"pi-agent-search": "0.
|
|
22
|
-
"pi-agent-text": "0.
|
|
23
|
-
"pi-agent-text-editor": "0.
|
|
19
|
+
"pi-agent-doctor": "0.6.0",
|
|
20
|
+
"pi-agent-invariant": "0.6.0",
|
|
21
|
+
"pi-agent-search": "0.6.0",
|
|
22
|
+
"pi-agent-text": "0.6.0",
|
|
23
|
+
"pi-agent-text-editor": "0.6.0"
|
|
24
24
|
},
|
|
25
25
|
"pi": {
|
|
26
26
|
"extensions": [
|
|
27
|
-
"./runtime/entry-
|
|
27
|
+
"./runtime/entry-48.js"
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../../../dist/entry-49.js";
|
|
@@ -98,7 +98,7 @@ function createMatchResolver(
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
const detailBudget = result.request.limit ?? 50;
|
|
101
|
-
const session = await sessions.
|
|
101
|
+
const session = await sessions.registerIfCurrent(
|
|
102
102
|
result.request.query,
|
|
103
103
|
result.matches,
|
|
104
104
|
result.complete,
|
|
@@ -106,21 +106,27 @@ function createMatchResolver(
|
|
|
106
106
|
context.signal,
|
|
107
107
|
result.recipe,
|
|
108
108
|
);
|
|
109
|
+
const display = session ?? {
|
|
110
|
+
query: result.request.query,
|
|
111
|
+
matches: result.matches,
|
|
112
|
+
complete: result.complete,
|
|
113
|
+
};
|
|
109
114
|
return {
|
|
110
115
|
content: [
|
|
111
116
|
{
|
|
112
117
|
type: "text",
|
|
113
|
-
text: [
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
text: [
|
|
119
|
+
...result.notices,
|
|
120
|
+
formatSearchSession(display, context.cwd, detailBudget, session !== undefined),
|
|
121
|
+
].join("\n"),
|
|
116
122
|
},
|
|
117
123
|
],
|
|
118
124
|
details: createSearchToolDetails(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
display.query,
|
|
126
|
+
display.matches,
|
|
127
|
+
display.complete,
|
|
122
128
|
context.cwd,
|
|
123
|
-
session
|
|
129
|
+
session?.id,
|
|
124
130
|
detailBudget,
|
|
125
131
|
),
|
|
126
132
|
};
|
|
@@ -130,27 +136,25 @@ function createMatchResolver(
|
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
function formatSearchSession(
|
|
133
|
-
session: TextSearchSession,
|
|
139
|
+
session: Omit<TextSearchSession, "id"> & { readonly id?: string },
|
|
134
140
|
cwd: string,
|
|
135
141
|
detailBudget: number,
|
|
142
|
+
anchorsRegistered = true,
|
|
136
143
|
): string {
|
|
137
144
|
const fileCount = new Set(session.matches.map((match) => match.source)).size;
|
|
138
145
|
const count = session.matches.length;
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
"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)",
|
|
152
|
-
heading,
|
|
153
|
-
];
|
|
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];
|
|
154
158
|
const indices = new Map(session.matches.map((match, index) => [match, index + 1]));
|
|
155
159
|
const presentation = planSearchPresentation(session.matches, detailBudget);
|
|
156
160
|
|
|
@@ -178,10 +182,11 @@ function formatSearchSession(
|
|
|
178
182
|
for (const match of file.matches) {
|
|
179
183
|
const index = indices.get(match);
|
|
180
184
|
if (index === undefined) continue;
|
|
185
|
+
const location = `${source}:${String(match.lineNumber)}:${String(match.startColumn + 1)}-${String(match.endColumn + 1)}`;
|
|
181
186
|
lines.push(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
anchorsRegistered
|
|
188
|
+
? `${location} SEARCH#${session.id}:${String(index)}:line SEARCH#${session.id}:${String(index)}:match`
|
|
189
|
+
: location,
|
|
185
190
|
` ${previewMatch(match)}`,
|
|
186
191
|
);
|
|
187
192
|
}
|
|
@@ -133,6 +133,14 @@ function normalizeRecipe(recipe: SearchRecipe, cwd: string): Record<string, unkn
|
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
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
|
+
|
|
136
144
|
/** Stores search snapshots and resolves the stable anchors emitted for them. */
|
|
137
145
|
export class SearchSessionStore {
|
|
138
146
|
readonly #sessions = new Map<string, StoredSearchSession>();
|
|
@@ -176,6 +184,24 @@ export class SearchSessionStore {
|
|
|
176
184
|
return session;
|
|
177
185
|
}
|
|
178
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
|
+
|
|
179
205
|
/** Repeats each referenced search once, keeping its original scope, limits and fallback rules. */
|
|
180
206
|
public async observeAfterEdit(
|
|
181
207
|
values: readonly unknown[],
|
|
@@ -506,7 +532,7 @@ async function snapshotContents(
|
|
|
506
532
|
for (const match of matches.filter((candidate) => candidate.source === source)) {
|
|
507
533
|
const line = document.lines[match.lineNumber - 1]?.content;
|
|
508
534
|
if (line !== match.lineText || matchedSourceText(document, match) !== match.matchedText) {
|
|
509
|
-
throw new
|
|
535
|
+
throw new SearchSnapshotChangedError(source);
|
|
510
536
|
}
|
|
511
537
|
}
|
|
512
538
|
contentBySource.set(source, content);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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-56.js"
|
|
12
12
|
},
|
|
13
13
|
"./api/anchor-inspection": {
|
|
14
14
|
"types": "./src/api/anchor-inspection.ts",
|
|
15
|
-
"default": "./runtime/entry-
|
|
15
|
+
"default": "./runtime/entry-57.js"
|
|
16
16
|
},
|
|
17
17
|
"./api/connect-plugin": {
|
|
18
18
|
"types": "./src/api/connect-plugin.ts",
|
|
19
|
-
"default": "./runtime/entry-
|
|
19
|
+
"default": "./runtime/entry-58.js"
|
|
20
20
|
},
|
|
21
21
|
"./api/edit-completion": {
|
|
22
22
|
"types": "./src/api/edit-completion.ts",
|
|
23
|
-
"default": "./runtime/entry-
|
|
23
|
+
"default": "./runtime/entry-59.js"
|
|
24
24
|
},
|
|
25
25
|
"./api/edit-pipeline": {
|
|
26
26
|
"types": "./src/api/edit-pipeline.ts",
|
|
27
|
-
"default": "./runtime/entry-
|
|
27
|
+
"default": "./runtime/entry-60.js"
|
|
28
28
|
},
|
|
29
29
|
"./api/plugin-protocol": {
|
|
30
30
|
"types": "./src/api/plugin-protocol.ts",
|
|
31
|
-
"default": "./runtime/entry-
|
|
31
|
+
"default": "./runtime/entry-61.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-62.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-63.js"
|
|
40
40
|
},
|
|
41
41
|
"./api/post-edit": {
|
|
42
42
|
"types": "./src/api/post-edit.ts",
|
|
43
|
-
"default": "./runtime/entry-
|
|
43
|
+
"default": "./runtime/entry-64.js"
|
|
44
44
|
},
|
|
45
45
|
"./api/mutation-result": {
|
|
46
46
|
"types": "./src/api/mutation-result.ts",
|
|
47
|
-
"default": "./runtime/entry-
|
|
47
|
+
"default": "./runtime/entry-65.js"
|
|
48
48
|
},
|
|
49
49
|
"./api/mutation-guard": {
|
|
50
50
|
"types": "./src/api/mutation-guard.ts",
|
|
51
|
-
"default": "./runtime/entry-
|
|
51
|
+
"default": "./runtime/entry-66.js"
|
|
52
52
|
},
|
|
53
53
|
"./api/mutation-tool": {
|
|
54
54
|
"types": "./src/api/mutation-tool.ts",
|
|
55
|
-
"default": "./runtime/entry-
|
|
55
|
+
"default": "./runtime/entry-67.js"
|
|
56
56
|
},
|
|
57
57
|
"./api/mutation-preview": {
|
|
58
58
|
"types": "./src/api/mutation-preview.ts",
|
|
59
|
-
"default": "./runtime/entry-
|
|
59
|
+
"default": "./runtime/entry-68.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-69.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-70.js"
|
|
68
68
|
},
|
|
69
69
|
"./api/tool-renderer": {
|
|
70
70
|
"types": "./src/api/tool-renderer.ts",
|
|
71
|
-
"default": "./runtime/entry-
|
|
71
|
+
"default": "./runtime/entry-71.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.6.0",
|
|
83
|
+
"pi-agent-read": "0.6.0",
|
|
84
|
+
"pi-agent-resource": "0.6.0",
|
|
85
|
+
"pi-agent-search": "0.6.0",
|
|
86
|
+
"pi-agent-text": "0.6.0",
|
|
87
|
+
"pi-agent-tool-call-interception": "0.6.0",
|
|
88
|
+
"pi-agent-tool-ui": "0.6.0",
|
|
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-72.js"
|
|
95
95
|
]
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|