pi-agent-ide 0.7.0 → 0.7.2
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 +44 -0
- package/dist/chunk-6U5OU77O.js +3 -0
- package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
- package/dist/chunk-EURHXLN3.js +2 -0
- package/dist/{chunk-PYPPV2F5.js → chunk-F6IWZKOG.js} +6 -6
- package/dist/{chunk-GBLKIB6O.js → chunk-H445SHSJ.js} +2 -2
- package/dist/chunk-IG56UGSO.js +2 -0
- package/dist/chunk-IICJXZBU.js +6 -0
- package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
- package/dist/{chunk-YRF7OATP.js → chunk-KOVPDKSJ.js} +1 -1
- package/dist/chunk-MXLSGMRZ.js +3 -0
- package/dist/chunk-NRZO5KJT.js +9 -0
- package/dist/chunk-OB46OPMZ.js +1 -0
- package/dist/chunk-PKSQT6TC.js +1 -0
- package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
- package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
- package/dist/chunk-QUYXINGZ.js +7 -0
- package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
- package/dist/chunk-SBP3ABH4.js +5 -0
- package/dist/{chunk-FXNKMNSJ.js → chunk-SJ4UZ4GU.js} +1 -1
- package/dist/chunk-SNF7PDDX.js +11 -0
- package/dist/{chunk-AJRIASPQ.js → chunk-STBJO3Z3.js} +1 -1
- package/dist/{chunk-3HYXQ4YA.js → chunk-TQGE7RH6.js} +13 -13
- package/dist/{chunk-S5LXX32D.js → chunk-XDG7EQRN.js} +3 -3
- package/dist/{chunk-F5YZG77W.js → chunk-XH5WN5XA.js} +1 -1
- package/dist/chunk-YWQS33DF.js +1 -0
- package/dist/chunk-ZIWPKIBZ.js +1 -0
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +2 -2
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +2 -2
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-31.js +15 -13
- package/dist/entry-33.js +2 -1
- package/dist/entry-37.js +6 -6
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +20 -13
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +8 -7
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-77.js +51 -43
- package/dist/entry-78.js +14 -14
- package/dist/entry-79.js +1 -1
- package/dist/entry-80.js +1 -1
- package/dist/entry-82.js +5 -5
- package/dist/entry-83.js +1 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/pi-agent-ide.js +37 -9
- package/docs/agent-guides/editing.md +35 -46
- package/docs/agent-guides/git-changes.md +10 -0
- package/docs/agent-guides/read-resources.md +9 -50
- package/docs/agent-guides/search-code.md +18 -17
- package/docs/agent-guides/select-code.md +62 -140
- package/docs/agent-guides/terminal.md +9 -1
- package/docs/configuration.md +1 -1
- package/docs/releases.md +4 -0
- package/docs/research/native-codemode-batch-decision.md +2 -0
- package/docs/structured-results.md +27 -62
- package/docs/tools.md +15 -11
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +7 -6
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/index.ts +4 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +13 -13
- package/node_modules/pi-agent-ide-ast/src/extension.ts +5 -4
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +35 -9
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +10 -8
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +28 -3
- package/node_modules/pi-agent-ide-changes/index.ts +4 -3
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/index.ts +3 -3
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +38 -1
- package/node_modules/pi-agent-read/src/api/tools/read.ts +18 -1
- package/node_modules/pi-agent-read/src/core/extension.ts +8 -2
- package/node_modules/pi-agent-read/src/core/read-core.ts +54 -35
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +108 -46
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +1 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +186 -9
- package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
- package/node_modules/pi-agent-resource/src/tool-result.ts +13 -1
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +3 -3
- package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
- package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
- package/node_modules/pi-agent-search-text/index.ts +1 -1
- package/node_modules/pi-agent-search-text/package.json +7 -7
- package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/index.ts +65 -4
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/package.json +9 -9
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +10 -3
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +3 -13
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +49 -214
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- 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 +76 -32
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- package/node_modules/pi-agent-web/index.ts +4 -3
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/src/resolver.ts +11 -13
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-image/package.json +3 -3
- package/node_modules/pi-agent-web-pdf/package.json +3 -3
- package/node_modules/pi-agent-web-text/package.json +3 -3
- package/package.json +35 -35
- package/src/composite/nested-tool-rendering.ts +64 -6
- package/src/composite/output-limits.ts +125 -0
- package/src/composite/responses-tools.ts +25 -0
- package/src/composite/text-results.ts +372 -0
- package/src/documentation/extension.ts +11 -9
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +7 -6
- 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 +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +4 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +4 -3
- 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 +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +38 -1
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +18 -1
- package/src/extensions/pi-agent-read/src/core/extension.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/read-core.ts +54 -35
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +108 -46
- package/src/extensions/pi-agent-search/package.json +5 -5
- 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 +7 -7
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +3 -3
- package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
- package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
- package/src/extensions/pi-agent-text-editor/package.json +9 -9
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +65 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +10 -3
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +3 -13
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +49 -214
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- 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 +76 -32
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/src/pi-agent-ide.ts +15 -1
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +5 -4
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +35 -9
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +10 -8
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +28 -3
- package/src/plugins/pi-agent-ide-changes/index.ts +4 -3
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- package/src/plugins/pi-agent-ide-debugger/index.ts +22 -10
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +6 -3
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/index.ts +3 -3
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
- package/src/plugins/pi-agent-ide-vision/index.ts +13 -4
- package/src/post-edit/gate.ts +13 -2
- package/dist/chunk-3JO7QFIL.js +0 -1
- package/dist/chunk-4NIFBFFR.js +0 -11
- package/dist/chunk-64M3SQPG.js +0 -3
- package/dist/chunk-7LZKOHH2.js +0 -1
- package/dist/chunk-EAZGN5ND.js +0 -7
- package/dist/chunk-FK42RSF4.js +0 -1
- package/dist/chunk-KBP3QUDT.js +0 -2
- package/dist/chunk-KR36BT5E.js +0 -1
- package/dist/chunk-MBUXFKIW.js +0 -3
- package/dist/chunk-OE7QVAI2.js +0 -5
- package/dist/chunk-SILJ3OL4.js +0 -9
- package/dist/chunk-SQKAXYIR.js +0 -2
- package/dist/chunk-VCGNVTXQ.js +0 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
|
@@ -239,6 +239,25 @@ export class ReadResultPanel implements Component {
|
|
|
239
239
|
compactInput.hasHiddenRows,
|
|
240
240
|
);
|
|
241
241
|
const lines = [renderTopBorder(this.state, innerWidth, this.state.theme)];
|
|
242
|
+
const diagnosticStatus = this.state.details.diagnosticStatus;
|
|
243
|
+
if (diagnosticStatus) {
|
|
244
|
+
for (const line of diagnosticStatus.split(/\r\n|\r|\n/u)) {
|
|
245
|
+
for (const row of wrapTextWithAnsi(
|
|
246
|
+
this.state.theme.fg("muted", normalizeText(line)),
|
|
247
|
+
contentWidth,
|
|
248
|
+
)) {
|
|
249
|
+
lines.push(framed(row, innerWidth, this.state.theme));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
for (const warning of this.state.details.viewWarnings ?? []) {
|
|
254
|
+
for (const row of wrapTextWithAnsi(
|
|
255
|
+
this.state.theme.fg("warning", normalizeText(warning)),
|
|
256
|
+
contentWidth,
|
|
257
|
+
)) {
|
|
258
|
+
lines.push(framed(row, innerWidth, this.state.theme));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
242
261
|
|
|
243
262
|
for (const row of rows) {
|
|
244
263
|
for (const wrappedRow of wrapTextWithAnsi(row, contentWidth)) {
|
|
@@ -538,7 +557,25 @@ function cleanText(
|
|
|
538
557
|
);
|
|
539
558
|
}
|
|
540
559
|
|
|
541
|
-
const
|
|
560
|
+
const rendered = textBlocks(result);
|
|
561
|
+
const warning = details.viewWarnings?.join("\n");
|
|
562
|
+
let text =
|
|
563
|
+
warning === undefined
|
|
564
|
+
? rendered
|
|
565
|
+
: rendered === warning
|
|
566
|
+
? ""
|
|
567
|
+
: rendered.startsWith(`${warning}\n`)
|
|
568
|
+
? rendered.slice(warning.length + 1)
|
|
569
|
+
: rendered;
|
|
570
|
+
const diagnosticStatus = details.diagnosticStatus;
|
|
571
|
+
if (diagnosticStatus !== undefined) {
|
|
572
|
+
text =
|
|
573
|
+
text === diagnosticStatus
|
|
574
|
+
? ""
|
|
575
|
+
: text.startsWith(`${diagnosticStatus}\n`)
|
|
576
|
+
? text.slice(diagnosticStatus.length + 1)
|
|
577
|
+
: text;
|
|
578
|
+
}
|
|
542
579
|
|
|
543
580
|
if (
|
|
544
581
|
details.truncation === undefined &&
|
|
@@ -58,7 +58,8 @@ export function projectReadState(
|
|
|
58
58
|
code: "UNSUPPORTED_RANGE",
|
|
59
59
|
source: state.source,
|
|
60
60
|
resolverId: state.resolvedBy,
|
|
61
|
-
message:
|
|
61
|
+
message:
|
|
62
|
+
"Line ranges require textual content. Omit offset and limit to read this content without a line range.",
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -135,13 +136,67 @@ function renderFinalTextLines(
|
|
|
135
136
|
.join("");
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
function readFailureMessage(failure: ReadFailure): string {
|
|
140
|
+
let cause = failure.cause;
|
|
141
|
+
let error: Error | undefined;
|
|
142
|
+
const visited = new Set<Error>();
|
|
143
|
+
while (cause instanceof Error && !visited.has(cause)) {
|
|
144
|
+
visited.add(cause);
|
|
145
|
+
error = cause;
|
|
146
|
+
cause = cause.cause;
|
|
147
|
+
}
|
|
148
|
+
const code = error !== undefined && "code" in error ? error.code : undefined;
|
|
149
|
+
let reason = error?.message || failure.message;
|
|
150
|
+
if (code === "ENOENT")
|
|
151
|
+
reason = failure.candidates?.length
|
|
152
|
+
? "Source not found."
|
|
153
|
+
: "Source not found. Search for the correct path.";
|
|
154
|
+
else if (code === "EACCES" || code === "EPERM") reason = "Access denied.";
|
|
155
|
+
else if (failure.code === "INVALID_RESOLVER_RESULT")
|
|
156
|
+
reason = "The source provider returned an invalid result.";
|
|
157
|
+
else if (failure.code === "INVALID_RESOURCE_CONTENT")
|
|
158
|
+
reason = "The source provider returned invalid content.";
|
|
159
|
+
else if (failure.code === "UNSUPPORTED_CAPABILITY")
|
|
160
|
+
reason = "This source does not support reading.";
|
|
161
|
+
else if (failure.code === "NO_RESOLVER")
|
|
162
|
+
reason = "This source is not supported. Choose a supported source from the path parameter.";
|
|
163
|
+
else if (failure.code === "NO_FRAGMENT_RESOLVER")
|
|
164
|
+
reason = "This anchor is not supported. Read the source without the anchor.";
|
|
165
|
+
if (failure.code === "INVALID_REQUEST")
|
|
166
|
+
reason += ". Supply path with a source or an unchanged result reference.";
|
|
167
|
+
else if (failure.code === "FRAGMENT_FAILED" && failure.source !== undefined)
|
|
168
|
+
reason += `\nRead ${JSON.stringify(failure.source)} with views=["anchors"] and choose a current anchor.`;
|
|
169
|
+
const source = failure.source === undefined ? "" : ` for ${JSON.stringify(failure.source)}`;
|
|
170
|
+
return `Read failed${source}: ${reason}`;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Describe a caller-cancelled failed Read without changing its private record or exceptions. */
|
|
174
|
+
export function withReadCancellation(
|
|
175
|
+
result: ReadToolResult,
|
|
176
|
+
requestedSource: string | undefined,
|
|
177
|
+
signal: AbortSignal | undefined,
|
|
178
|
+
): ReadToolResult {
|
|
179
|
+
if (!signal?.aborted || !result.isError) return result;
|
|
180
|
+
const source = result.details.source ?? result.details.failure?.source ?? requestedSource;
|
|
181
|
+
return {
|
|
182
|
+
...result,
|
|
183
|
+
content: [
|
|
184
|
+
{
|
|
185
|
+
type: "text",
|
|
186
|
+
text: `Read cancelled${source === undefined ? "" : ` for ${JSON.stringify(source)}`}. No completed result was returned.`,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** Show an actionable failure while retaining the original record for private adapters. */
|
|
138
193
|
export function failureResult(failure: ReadFailure): ReadToolResult {
|
|
139
194
|
return {
|
|
140
195
|
content: [
|
|
141
196
|
{
|
|
142
197
|
type: "text",
|
|
143
198
|
text: [
|
|
144
|
-
|
|
199
|
+
readFailureMessage(failure),
|
|
145
200
|
...(failure.candidates?.length
|
|
146
201
|
? [
|
|
147
202
|
"",
|
|
@@ -53,7 +53,7 @@ const bytes = Type.Object(
|
|
|
53
53
|
const block = Type.Union([
|
|
54
54
|
Type.Object({ type: Type.Literal("text"), text: Type.String() }, { additionalProperties: false }),
|
|
55
55
|
Type.Object(
|
|
56
|
-
{ type: Type.Literal("image"),
|
|
56
|
+
{ type: Type.Literal("image"), mimeType: Type.String() },
|
|
57
57
|
{ additionalProperties: false },
|
|
58
58
|
),
|
|
59
59
|
]);
|
|
@@ -127,6 +127,7 @@ function publicData(value: ReadScriptData): unknown {
|
|
|
127
127
|
: {}),
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
+
// Image bytes belong to native content, not the composable result record.
|
|
130
131
|
if (value.kind === "native")
|
|
131
132
|
return {
|
|
132
133
|
kind: value.kind,
|
|
@@ -134,8 +135,7 @@ function publicData(value: ReadScriptData): unknown {
|
|
|
134
135
|
truncated: false,
|
|
135
136
|
blocks: value.blocks.map((block) => {
|
|
136
137
|
if (block.type === "text") return { type: block.type, text: block.text };
|
|
137
|
-
if (block.type === "image")
|
|
138
|
-
return { type: block.type, data: block.data, mimeType: block.mimeType };
|
|
138
|
+
if (block.type === "image") return { type: block.type, mimeType: block.mimeType };
|
|
139
139
|
throw new TypeError("Custom content requires a structured adapter");
|
|
140
140
|
}),
|
|
141
141
|
};
|
|
@@ -43,20 +43,21 @@ import {
|
|
|
43
43
|
type ResourceResolverRegistration,
|
|
44
44
|
type TextTargetResolverRegistration,
|
|
45
45
|
} from "#src/api/tools/read.js";
|
|
46
|
-
import {
|
|
47
|
-
limitReadOutput,
|
|
48
|
-
READ_OUTPUT_MAX_BYTES,
|
|
49
|
-
READ_OUTPUT_MAX_LINES,
|
|
50
|
-
} from "#src/core/tools/read/output-truncation.js";
|
|
46
|
+
import { explainReadWindow, limitReadOutput } from "#src/core/tools/read/output-truncation.js";
|
|
51
47
|
import { createReadResultRenderer, renderReadCall } from "#src/core/tools/read/read-renderer.js";
|
|
52
48
|
import {
|
|
53
49
|
createReadState,
|
|
54
50
|
failureResult,
|
|
55
51
|
projectReadState,
|
|
52
|
+
withReadCancellation,
|
|
56
53
|
} from "#src/core/tools/read/read-result.js";
|
|
57
|
-
import { TempResourceStore } from "
|
|
54
|
+
import { TempResourceStore } from "pi-agent-resource";
|
|
58
55
|
|
|
59
|
-
import {
|
|
56
|
+
import {
|
|
57
|
+
type readParameters,
|
|
58
|
+
describeReadParameters,
|
|
59
|
+
type ReadParameterText,
|
|
60
|
+
} from "#src/api/read-parameters.js";
|
|
60
61
|
import { readRaw } from "#src/core/tools/read/raw-read.js";
|
|
61
62
|
import { readOutputSchema, structuredRead } from "./read/structured-result.js";
|
|
62
63
|
|
|
@@ -112,6 +113,8 @@ export interface ReadToolContributions {
|
|
|
112
113
|
export interface ReadTool {
|
|
113
114
|
/** Shares the read runtime's temporary resource store with composed operations. */
|
|
114
115
|
saveTemporary(text: string): Promise<string>;
|
|
116
|
+
/** Sets the saver used before agent-facing text is truncated. */
|
|
117
|
+
setOutputSaver(saver: (text: string) => Promise<string>): void;
|
|
115
118
|
readonly tool: ToolDefinition<typeof readParameters, ReadResultDetails>;
|
|
116
119
|
execute(
|
|
117
120
|
request: ReadPipelineContext["request"],
|
|
@@ -126,8 +129,10 @@ export interface ReadTool {
|
|
|
126
129
|
export function createReadTool(
|
|
127
130
|
pluginPromptGuidelines?: () => readonly string[],
|
|
128
131
|
presentation: "full" | "compact" | "disabled" = "compact",
|
|
132
|
+
parameterDescriptions?: () => ReadParameterText,
|
|
129
133
|
): ReadTool {
|
|
130
134
|
const temporaryResources = new TempResourceStore();
|
|
135
|
+
let outputSaver: ((text: string) => Promise<string>) | undefined;
|
|
131
136
|
const resolvers: RegisteredResolver[] = [
|
|
132
137
|
{
|
|
133
138
|
resolver: temporaryResources.resolver,
|
|
@@ -149,6 +154,9 @@ export function createReadTool(
|
|
|
149
154
|
|
|
150
155
|
return {
|
|
151
156
|
saveTemporary: (text) => temporaryResources.save(text),
|
|
157
|
+
setOutputSaver(saver) {
|
|
158
|
+
outputSaver = saver;
|
|
159
|
+
},
|
|
152
160
|
tool: {
|
|
153
161
|
name: toolId,
|
|
154
162
|
exposure: "direct",
|
|
@@ -163,16 +171,16 @@ export function createReadTool(
|
|
|
163
171
|
label: toolId,
|
|
164
172
|
|
|
165
173
|
promptSnippet: "Read supported sources as text or bytes, with optional views",
|
|
166
|
-
|
|
167
|
-
return `Use read to inspect supported resources. path selects the source; offset and limit select a bounded window; views request source-specific presentations. Text output is limited to ${READ_OUTPUT_MAX_LINES} lines or ${READ_OUTPUT_MAX_BYTES / 1024}KB; follow a returned continuation offset or temp: reference when present.`;
|
|
168
|
-
},
|
|
174
|
+
description: "Use read to inspect files and other supported resources.",
|
|
169
175
|
get promptGuidelines(): string[] {
|
|
170
176
|
return [
|
|
171
177
|
"Use read to inspect supported sources and search to locate workspace content.",
|
|
172
178
|
...(pluginPromptGuidelines?.() ?? []),
|
|
173
179
|
];
|
|
174
180
|
},
|
|
175
|
-
parameters
|
|
181
|
+
get parameters() {
|
|
182
|
+
return describeReadParameters(parameterDescriptions?.() ?? {});
|
|
183
|
+
},
|
|
176
184
|
outputSchema: readOutputSchema,
|
|
177
185
|
renderCall(arguments_, theme, context) {
|
|
178
186
|
const source = typeof arguments_.path === "string" ? arguments_.path : undefined;
|
|
@@ -219,8 +227,10 @@ export function createReadTool(
|
|
|
219
227
|
fragments,
|
|
220
228
|
targetResolvers,
|
|
221
229
|
resourceGuards,
|
|
230
|
+
"agent",
|
|
231
|
+
outputSaver,
|
|
222
232
|
);
|
|
223
|
-
return structuredRead(result);
|
|
233
|
+
return structuredRead(withReadCancellation(result, parameters.path, signal));
|
|
224
234
|
} catch (error) {
|
|
225
235
|
if (signal?.aborted) throw error;
|
|
226
236
|
return structuredRead(
|
|
@@ -233,8 +243,8 @@ export function createReadTool(
|
|
|
233
243
|
}
|
|
234
244
|
},
|
|
235
245
|
},
|
|
236
|
-
execute(request, context, audience = "agent"): Promise<ReadToolResult> {
|
|
237
|
-
|
|
246
|
+
async execute(request, context, audience = "agent"): Promise<ReadToolResult> {
|
|
247
|
+
const result = await executeRead(
|
|
238
248
|
request,
|
|
239
249
|
context,
|
|
240
250
|
resolvers,
|
|
@@ -245,7 +255,9 @@ export function createReadTool(
|
|
|
245
255
|
targetResolvers,
|
|
246
256
|
resourceGuards,
|
|
247
257
|
audience,
|
|
258
|
+
outputSaver,
|
|
248
259
|
);
|
|
260
|
+
return withReadCancellation(result, request.path, context.signal);
|
|
249
261
|
},
|
|
250
262
|
registerContributions(pluginId, contributions): void {
|
|
251
263
|
const incomingResourceGuards = [...(contributions.resourceGuards ?? [])];
|
|
@@ -363,12 +375,16 @@ async function executeRead(
|
|
|
363
375
|
}[],
|
|
364
376
|
resourceGuards: readonly RegisteredResourceGuard[],
|
|
365
377
|
audience: "agent" | "script" = "agent",
|
|
378
|
+
outputSaver?: (text: string) => Promise<string>,
|
|
366
379
|
): Promise<ReadToolResult> {
|
|
367
380
|
if (request.path?.startsWith("raw:"))
|
|
368
381
|
return readRaw(request, resolverContext, audience, resourceGuards);
|
|
369
382
|
resolverContext = { ...resolverContext, audience };
|
|
370
383
|
const limitOutput: typeof limitReadOutput =
|
|
371
|
-
audience === "script"
|
|
384
|
+
audience === "script"
|
|
385
|
+
? async (result) => result
|
|
386
|
+
: (result, request, fallback, options) =>
|
|
387
|
+
limitReadOutput(result, request, outputSaver ?? fallback, options);
|
|
372
388
|
const resolverSnapshot = [...resolvers].sort(
|
|
373
389
|
(left, right) => left.priority - right.priority || left.order - right.order,
|
|
374
390
|
);
|
|
@@ -390,7 +406,18 @@ async function executeRead(
|
|
|
390
406
|
];
|
|
391
407
|
const requestedViews = new Set(rawRequestedViews.map(viewName));
|
|
392
408
|
const knownViews = new Set([...viewSnapshot.map(({ registration }) => registration.view)]);
|
|
393
|
-
const
|
|
409
|
+
const explicitViews = [...new Set(request.views ?? [])];
|
|
410
|
+
const nativeViews = new Set(
|
|
411
|
+
viewSnapshot
|
|
412
|
+
.filter(({ registration }) => registration.contentKind === "any")
|
|
413
|
+
.map(({ registration }) => registration.view),
|
|
414
|
+
);
|
|
415
|
+
const viewWarnings: ReadViewWarnings = {
|
|
416
|
+
ignored: explicitViews.filter((view) => !knownViews.has(viewName(view))),
|
|
417
|
+
textOnly: explicitViews.filter(
|
|
418
|
+
(view) => knownViews.has(viewName(view)) && !nativeViews.has(viewName(view)),
|
|
419
|
+
),
|
|
420
|
+
};
|
|
394
421
|
if (request.path !== undefined && targetSnapshot.length > 0) {
|
|
395
422
|
const targeted = await resolveTextTargets(
|
|
396
423
|
request,
|
|
@@ -400,9 +427,10 @@ async function executeRead(
|
|
|
400
427
|
handlerSnapshot,
|
|
401
428
|
viewSnapshot,
|
|
402
429
|
requestedViews,
|
|
403
|
-
|
|
430
|
+
viewWarnings,
|
|
404
431
|
audience,
|
|
405
432
|
resourceGuards,
|
|
433
|
+
outputSaver,
|
|
406
434
|
);
|
|
407
435
|
if (targeted !== undefined) return targeted;
|
|
408
436
|
}
|
|
@@ -412,7 +440,7 @@ async function executeRead(
|
|
|
412
440
|
const preRead = await runPreReadHandlers(pipeline, handlerSnapshot);
|
|
413
441
|
|
|
414
442
|
if (preRead.kind === "return") {
|
|
415
|
-
return
|
|
443
|
+
return withViewWarnings(await limitOutput(preRead.result, pipeline.request), viewWarnings);
|
|
416
444
|
}
|
|
417
445
|
|
|
418
446
|
pipeline = preRead.context;
|
|
@@ -482,23 +510,23 @@ async function executeRead(
|
|
|
482
510
|
}
|
|
483
511
|
|
|
484
512
|
if (pipeline.state?.textMode === "final") {
|
|
485
|
-
return
|
|
513
|
+
return withViewWarnings(
|
|
486
514
|
await limitOutput(
|
|
487
515
|
projectReadState(pipeline.state, pipeline.request, { originLine: origin, audience }),
|
|
488
516
|
pipeline.request,
|
|
489
517
|
undefined,
|
|
490
518
|
{ originLine: origin },
|
|
491
519
|
),
|
|
492
|
-
|
|
520
|
+
viewWarnings,
|
|
493
521
|
);
|
|
494
522
|
}
|
|
495
523
|
|
|
496
524
|
const processed = await runReadHandlers(pipeline, handlerSnapshot);
|
|
497
525
|
|
|
498
526
|
if (processed.kind === "return") {
|
|
499
|
-
return
|
|
527
|
+
return withViewWarnings(
|
|
500
528
|
await limitOutput(processed.result, pipeline.request, undefined, { originLine: origin }),
|
|
501
|
-
|
|
529
|
+
viewWarnings,
|
|
502
530
|
);
|
|
503
531
|
}
|
|
504
532
|
|
|
@@ -516,9 +544,9 @@ async function executeRead(
|
|
|
516
544
|
pipeline.request.limit === undefined && pipeline.state?.preserveTruncatedOutput === true
|
|
517
545
|
? (text: string): Promise<string> => temporaryResources.save(text)
|
|
518
546
|
: undefined;
|
|
519
|
-
return
|
|
547
|
+
return withViewWarnings(
|
|
520
548
|
await limitOutput(result, pipeline.request, saveFullOutput, { originLine: origin }),
|
|
521
|
-
|
|
549
|
+
viewWarnings,
|
|
522
550
|
);
|
|
523
551
|
}
|
|
524
552
|
|
|
@@ -552,12 +580,16 @@ async function resolveTextTargets(
|
|
|
552
580
|
handlers: readonly RegisteredHandler[],
|
|
553
581
|
views: readonly RegisteredView[],
|
|
554
582
|
requestedViews: ReadonlySet<string>,
|
|
555
|
-
|
|
583
|
+
viewWarnings: ReadViewWarnings,
|
|
556
584
|
audience: "agent" | "script",
|
|
557
585
|
resourceGuards: readonly RegisteredResourceGuard[],
|
|
586
|
+
outputSaver?: (text: string) => Promise<string>,
|
|
558
587
|
): Promise<ReadToolResult | undefined> {
|
|
559
588
|
const limitOutput: typeof limitReadOutput =
|
|
560
|
-
audience === "script"
|
|
589
|
+
audience === "script"
|
|
590
|
+
? async (result) => result
|
|
591
|
+
: (result, request, fallback, options) =>
|
|
592
|
+
limitReadOutput(result, request, outputSaver ?? fallback, options);
|
|
561
593
|
for (const { resolver } of targetResolvers) {
|
|
562
594
|
let rawAttempt: unknown;
|
|
563
595
|
try {
|
|
@@ -627,7 +659,7 @@ async function resolveTextTargets(
|
|
|
627
659
|
const preRead = await runPreReadHandlers(rangePipeline, handlers);
|
|
628
660
|
if (preRead.kind === "return") {
|
|
629
661
|
if (preRead.result.isError === true)
|
|
630
|
-
return
|
|
662
|
+
return withViewWarnings(preRead.result, viewWarnings);
|
|
631
663
|
return preRead.result;
|
|
632
664
|
}
|
|
633
665
|
rangePipeline = preRead.context;
|
|
@@ -639,12 +671,12 @@ async function resolveTextTargets(
|
|
|
639
671
|
request.path ?? target.source,
|
|
640
672
|
);
|
|
641
673
|
if (resolved.kind === "return") {
|
|
642
|
-
return
|
|
674
|
+
return withViewWarnings(resolved.result, viewWarnings);
|
|
643
675
|
}
|
|
644
676
|
const processed = await runReadHandlers(resolved.context, handlers);
|
|
645
677
|
if (processed.kind === "return") {
|
|
646
678
|
if (processed.result.isError === true)
|
|
647
|
-
return
|
|
679
|
+
return withViewWarnings(processed.result, viewWarnings);
|
|
648
680
|
return processed.result;
|
|
649
681
|
}
|
|
650
682
|
const presented = await runTextPresenters(processed.context, views, requestedViews);
|
|
@@ -653,18 +685,26 @@ async function resolveTextTargets(
|
|
|
653
685
|
originLine: range.start.lineNumber,
|
|
654
686
|
});
|
|
655
687
|
const postRead = await runPostReadHandlers({ ...presented, result: projected }, handlers);
|
|
656
|
-
if (projected.isError === true) return
|
|
688
|
+
if (projected.isError === true) return withViewWarnings(projected, viewWarnings);
|
|
657
689
|
const result =
|
|
658
690
|
postRead.kind === "return" ? postRead.result : requiredValue(postRead.context.result);
|
|
659
|
-
if (result.isError === true) return
|
|
660
|
-
return
|
|
691
|
+
if (result.isError === true) return withViewWarnings(result, viewWarnings);
|
|
692
|
+
return audience === "script"
|
|
693
|
+
? result
|
|
694
|
+
: explainReadWindow(
|
|
695
|
+
result,
|
|
696
|
+
{ ...presented.request, limit: request.limit },
|
|
697
|
+
{
|
|
698
|
+
originLine: range.start.lineNumber,
|
|
699
|
+
},
|
|
700
|
+
);
|
|
661
701
|
});
|
|
662
702
|
});
|
|
663
703
|
const completed = await Promise.allSettled(pending);
|
|
664
704
|
for (const outcome of completed) {
|
|
665
705
|
if (outcome.status === "rejected") throw outcome.reason;
|
|
666
706
|
const result = outcome.value;
|
|
667
|
-
if (result.isError === true) return
|
|
707
|
+
if (result.isError === true) return withViewWarnings(result, viewWarnings);
|
|
668
708
|
for (const block of result.content) {
|
|
669
709
|
if (block.type === "text") chunks.push(block.text);
|
|
670
710
|
}
|
|
@@ -686,9 +726,9 @@ async function resolveTextTargets(
|
|
|
686
726
|
? { source: request.path, resources }
|
|
687
727
|
: (firstDetails ?? { source: request.path }),
|
|
688
728
|
} satisfies ReadToolResult;
|
|
689
|
-
return
|
|
729
|
+
return withViewWarnings(
|
|
690
730
|
await limitOutput(aggregate, { path: request.path, views: request.views }),
|
|
691
|
-
|
|
731
|
+
viewWarnings,
|
|
692
732
|
);
|
|
693
733
|
}
|
|
694
734
|
return undefined;
|
|
@@ -726,7 +766,7 @@ async function resolveAnchoredOrigin(
|
|
|
726
766
|
code: "UNSUPPORTED_RANGE",
|
|
727
767
|
source: state.source,
|
|
728
768
|
resolverId: state.resolvedBy,
|
|
729
|
-
message: "Anchored reads require textual content",
|
|
769
|
+
message: "Anchored reads require textual content. Read this source without an anchor.",
|
|
730
770
|
});
|
|
731
771
|
}
|
|
732
772
|
|
|
@@ -1103,21 +1143,43 @@ function viewName(view: string): string {
|
|
|
1103
1143
|
return separator < 0 ? view : view.slice(0, separator);
|
|
1104
1144
|
}
|
|
1105
1145
|
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
}
|
|
1146
|
+
interface ReadViewWarnings {
|
|
1147
|
+
readonly ignored: readonly string[];
|
|
1148
|
+
readonly textOnly: readonly string[];
|
|
1149
|
+
}
|
|
1111
1150
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1151
|
+
/** Reports unused views without changing source data or discarding native content. */
|
|
1152
|
+
function withViewWarnings(result: ReadToolResult, requested: ReadViewWarnings): ReadToolResult {
|
|
1153
|
+
const messages: string[] = [];
|
|
1154
|
+
if (requested.ignored.length > 0) {
|
|
1155
|
+
messages.push(
|
|
1156
|
+
requested.ignored.length === 1
|
|
1157
|
+
? `Unknown view ignored: ${requested.ignored[0]}. Remove it or choose a supported view from the views parameter.`
|
|
1158
|
+
: `Unknown views ignored: ${requested.ignored.join(", ")}. Remove these entries or choose supported views from the views parameter.`,
|
|
1159
|
+
);
|
|
1160
|
+
}
|
|
1161
|
+
if (result.isError !== true && result.content.some((block) => block.type !== "text")) {
|
|
1162
|
+
for (const view of requested.textOnly) {
|
|
1163
|
+
messages.push(
|
|
1164
|
+
`View not applied: ${view} requires text. Read a text source to use ${viewName(view)}.`,
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
if (messages.length === 0 || result.details.viewWarnings !== undefined) return result;
|
|
1169
|
+
const note = messages.join("\n");
|
|
1170
|
+
const first = result.content[0];
|
|
1114
1171
|
const content =
|
|
1115
|
-
|
|
1116
|
-
|
|
1172
|
+
result.content.length === 1 && first?.type === "text"
|
|
1173
|
+
? [{ ...first, text: `${note}\n${first.text}` }]
|
|
1174
|
+
: [{ type: "text" as const, text: note }, ...result.content];
|
|
1117
1175
|
return {
|
|
1118
1176
|
...result,
|
|
1119
1177
|
content,
|
|
1120
|
-
details: {
|
|
1178
|
+
details: {
|
|
1179
|
+
...result.details,
|
|
1180
|
+
...(requested.ignored.length === 0 ? {} : { ignoredViews: requested.ignored }),
|
|
1181
|
+
viewWarnings: messages,
|
|
1182
|
+
},
|
|
1121
1183
|
};
|
|
1122
1184
|
}
|
|
1123
1185
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-search",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"pi-agent-documentation": "0.7.
|
|
24
|
-
"pi-agent-resource": "0.7.
|
|
25
|
-
"pi-agent-tool-call-interception": "0.7.
|
|
26
|
-
"pi-agent-tool-ui": "0.7.
|
|
23
|
+
"pi-agent-documentation": "0.7.2",
|
|
24
|
+
"pi-agent-resource": "0.7.2",
|
|
25
|
+
"pi-agent-tool-call-interception": "0.7.2",
|
|
26
|
+
"pi-agent-tool-ui": "0.7.2"
|
|
27
27
|
},
|
|
28
28
|
"pi": {
|
|
29
29
|
"extensions": [
|
|
@@ -108,7 +108,7 @@ export default async function registerTextSearch(pi: ExtensionAPI): Promise<void
|
|
|
108
108
|
api.describe(
|
|
109
109
|
[
|
|
110
110
|
"Local queries try literal terms first, then unquoted terms as regex when no literal results exist, then separate words for ordinary multi-word queries. Quoted terms stay literal. Boolean conditions stay intact across fallback. Uppercase AND/OR, infix NOT, ||, and space-separated | are Boolean operators; unspaced | and regex groups/classes belong to regex terms. Parentheses containing Boolean operators group Boolean conditions. regex:<pattern> forces regex-only matching; files:<pattern> searches file paths: glob patterns use *, **, ?, character classes and braces; other queries use case-insensitive subsequence matching. Slash-containing globs match cwd-relative paths; basename globs match at any depth.",
|
|
111
|
-
"After a complete zero result, a single unquoted ASCII identifier may produce separate possible-name groups: naming-style changes, one leading/trailing component, then small typos. Each group reports a verified case-sensitive whole-identifier alternative in the same scope, its count/completeness, and Read references. Budget skips are explicit. A candidate all-reference refreshes that exact alternative, not the fuzzy ranking. Registered local candidate selections also expose strict snapshot targets.
|
|
111
|
+
"After a complete zero result, a single unquoted ASCII identifier may produce separate possible-name groups: naming-style changes, one leading/trailing component, then small typos. Each group reports a verified case-sensitive whole-identifier alternative in the same scope, its count/completeness, and Read references. Budget skips are explicit. A candidate all-reference refreshes that exact alternative, not the fuzzy ranking. Registered local candidate selections also expose strict snapshot targets. Result scopes stay exact and do not run this extra branch.",
|
|
112
112
|
"The result says when a query was broadened. Empty or unknown prefixes are searched as plain text. A recognized prefixed query returns its own results or error; it does not silently become a text search.",
|
|
113
113
|
"SEARCH#HASH:N:line selects one containing line; :match selects its exact match. :all:line selects all unique containing lines and :all:match selects all matches. Read returns containing lines for both forms. A SEARCH resource can be used as a read path or mutation path/anchor; omit the file path for an all-selection spanning files.",
|
|
114
114
|
"Use SEARCH references exactly as returned to select the matching content. A single-result reference becomes stale when its file changes; obtain a fresh result before using it again. An :all reference refreshes the original query when a selected file changes. Search compacts noisy files when the detail limit is exceeded; narrow the query to that file to see individual matches. Compaction does not remove complete :all selections.",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-search-text",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"pi-agent-doctor": "0.7.
|
|
28
|
-
"pi-agent-invariant": "0.7.
|
|
29
|
-
"pi-agent-search": "0.7.
|
|
30
|
-
"pi-agent-text": "0.7.
|
|
31
|
-
"pi-agent-text-editor": "0.7.
|
|
32
|
-
"pi-agent-tool-ui": "0.7.
|
|
27
|
+
"pi-agent-doctor": "0.7.2",
|
|
28
|
+
"pi-agent-invariant": "0.7.2",
|
|
29
|
+
"pi-agent-search": "0.7.2",
|
|
30
|
+
"pi-agent-text": "0.7.2",
|
|
31
|
+
"pi-agent-text-editor": "0.7.2",
|
|
32
|
+
"pi-agent-tool-ui": "0.7.2"
|
|
33
33
|
},
|
|
34
34
|
"pi": {
|
|
35
35
|
"extensions": [
|
|
@@ -300,7 +300,7 @@ function formatSearchSession(
|
|
|
300
300
|
const heading = anchorsRegistered
|
|
301
301
|
? session.complete
|
|
302
302
|
? `SEARCH#${session.id}:all:line / SEARCH#${session.id}:all:match — ${summary}`
|
|
303
|
-
: `${summary} (
|
|
303
|
+
: `${summary} (incomplete results; no all anchors were registered)`
|
|
304
304
|
: `${summary} (files changed during search; results shown without anchors)`;
|
|
305
305
|
const lines = anchorsRegistered ? [SEARCH_ANCHOR_LEGEND, heading] : [heading];
|
|
306
306
|
const indices = new Map(session.matches.map((match, index) => [match, index + 1]));
|
|
@@ -340,6 +340,16 @@ function formatSearchSession(
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
const omittedFiles = fileCount - presentation.files.length;
|
|
344
|
+
if (omittedFiles > 0) {
|
|
345
|
+
const shownMatches = presentation.files.reduce(
|
|
346
|
+
(total, file) => total + (file.kind === "detailed" ? file.matches.length : file.matchCount),
|
|
347
|
+
0,
|
|
348
|
+
);
|
|
349
|
+
lines.push(
|
|
350
|
+
`\n… ${omittedFiles} more files (${count - shownMatches} matches) not displayed. Narrow path, include, or query to see them.`,
|
|
351
|
+
);
|
|
352
|
+
}
|
|
343
353
|
return lines.join("\n");
|
|
344
354
|
}
|
|
345
355
|
|
|
@@ -86,7 +86,7 @@ export async function runScopedSearch(
|
|
|
86
86
|
notices.push(
|
|
87
87
|
fallback.mode === "regex"
|
|
88
88
|
? "Search fallback: no literal matches; tried unquoted terms as regex."
|
|
89
|
-
: "Search fallback: no matches in earlier modes; tried separate words.",
|
|
89
|
+
: "Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.",
|
|
90
90
|
);
|
|
91
91
|
} catch (error) {
|
|
92
92
|
if (
|