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
package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface SearchPresentation {
|
|
|
23
23
|
readonly files: readonly SearchPresentationFile[];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
/**
|
|
26
|
+
/** Shares one item budget between complete small files, compact summaries and groups. */
|
|
27
27
|
export function planSearchPresentation(
|
|
28
28
|
matches: readonly TextSearchMatch[],
|
|
29
29
|
detailBudget: number,
|
|
@@ -36,45 +36,55 @@ export function planSearchPresentation(
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const compacted = new Set<string>();
|
|
39
|
-
let
|
|
39
|
+
let itemCount = matches.length;
|
|
40
40
|
const noisiestFirst = [...bySource].sort(
|
|
41
41
|
([leftSource, left], [rightSource, right]) =>
|
|
42
42
|
right.length - left.length || leftSource.localeCompare(rightSource),
|
|
43
43
|
);
|
|
44
44
|
for (const [source, sourceMatches] of noisiestFirst) {
|
|
45
|
-
if (
|
|
45
|
+
if (itemCount <= detailBudget) break;
|
|
46
46
|
compacted.add(source);
|
|
47
|
-
|
|
47
|
+
itemCount -= sourceMatches.length - 1;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const files = [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
50
|
+
const files: SearchPresentationFile[] = [];
|
|
51
|
+
let remaining = detailBudget;
|
|
52
|
+
// Keep complete small files before spending the remaining budget on noisy summaries.
|
|
53
|
+
const ordered = [...bySource].sort(
|
|
54
|
+
([left], [right]) =>
|
|
55
|
+
Number(compacted.has(left)) - Number(compacted.has(right)) || left.localeCompare(right),
|
|
56
|
+
);
|
|
57
|
+
for (const [source, sourceMatches] of ordered) {
|
|
58
|
+
if (!compacted.has(source)) {
|
|
59
|
+
if (sourceMatches.length > remaining) continue;
|
|
60
|
+
files.push({ kind: "detailed", source, matches: sourceMatches });
|
|
61
|
+
remaining -= sourceMatches.length;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (remaining < 1) continue;
|
|
65
|
+
remaining--;
|
|
66
|
+
const counts = new Map<string, number>();
|
|
67
|
+
for (const match of sourceMatches)
|
|
68
|
+
counts.set(match.lineText, (counts.get(match.lineText) ?? 0) + 1);
|
|
69
|
+
const groups =
|
|
70
|
+
bySource.size === 1
|
|
71
|
+
? [...counts]
|
|
72
|
+
.sort(
|
|
73
|
+
([leftText, leftCount], [rightText, rightCount]) =>
|
|
74
|
+
rightCount - leftCount || leftText.localeCompare(rightText),
|
|
75
|
+
)
|
|
76
|
+
.slice(0, remaining)
|
|
77
|
+
.map(([text, matchCount]) => ({ text, matchCount }))
|
|
78
|
+
: [];
|
|
79
|
+
remaining -= groups.length;
|
|
80
|
+
files.push({
|
|
81
|
+
kind: "compacted",
|
|
82
|
+
source,
|
|
83
|
+
matchCount: sourceMatches.length,
|
|
84
|
+
uniqueLineCount: counts.size,
|
|
85
|
+
groups,
|
|
77
86
|
});
|
|
78
|
-
|
|
87
|
+
}
|
|
88
|
+
files.sort((left, right) => left.source.localeCompare(right.source));
|
|
79
89
|
return { files };
|
|
80
90
|
}
|
|
@@ -66,7 +66,7 @@ export async function runSearchRecipe(
|
|
|
66
66
|
notices.push(
|
|
67
67
|
fallback.mode === "regex"
|
|
68
68
|
? "Search fallback: no literal matches; tried unquoted terms as regex."
|
|
69
|
-
: "Search fallback: no matches in earlier modes; tried separate words.",
|
|
69
|
+
: "Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.",
|
|
70
70
|
);
|
|
71
71
|
} catch (error) {
|
|
72
72
|
if (fallback.mode !== "regex" || !isRegexSyntaxError(error) || signal?.aborted) throw error;
|
|
@@ -146,6 +146,12 @@ function searchViewport(details: SearchToolDetails, expanded: boolean): readonly
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
if ((details.omittedFileCount ?? 0) > 0)
|
|
150
|
+
rows.push({
|
|
151
|
+
kind: "summary",
|
|
152
|
+
text: `… ${details.omittedFileCount} more files (${details.omittedMatchCount} matches) · narrow path, include, or query`,
|
|
153
|
+
});
|
|
154
|
+
|
|
149
155
|
if (details.fuzzy !== undefined || expanded || rows.length <= COMPACT_SEARCH_ROWS) {
|
|
150
156
|
return rows;
|
|
151
157
|
}
|
|
@@ -51,6 +51,9 @@ export interface SearchToolDetails {
|
|
|
51
51
|
readonly matchCount: number;
|
|
52
52
|
readonly fileCount: number;
|
|
53
53
|
readonly complete: boolean;
|
|
54
|
+
/** Files and matches retained internally but not shown within the item budget. */
|
|
55
|
+
readonly omittedFileCount?: number;
|
|
56
|
+
readonly omittedMatchCount?: number;
|
|
54
57
|
readonly files: readonly SearchResultFile[];
|
|
55
58
|
readonly fuzzy?: FuzzyResultData;
|
|
56
59
|
readonly fuzzyPresentation?: FuzzySearchPresentation;
|
|
@@ -71,6 +74,7 @@ export function createSearchToolDetails(
|
|
|
71
74
|
detailBudget = 50,
|
|
72
75
|
): SearchToolDetails {
|
|
73
76
|
const presentation = planSearchPresentation(matches, detailBudget);
|
|
77
|
+
const fileCount = new Set(matches.map((match) => match.source)).size;
|
|
74
78
|
const files = presentation.files.map((file): SearchResultFile =>
|
|
75
79
|
file.kind === "detailed"
|
|
76
80
|
? createSearchResultFile(file.source, file.matches, cwd)
|
|
@@ -88,7 +92,14 @@ export function createSearchToolDetails(
|
|
|
88
92
|
...(sessionId !== undefined && { sessionId }),
|
|
89
93
|
query,
|
|
90
94
|
matchCount: matches.length,
|
|
91
|
-
fileCount
|
|
95
|
+
fileCount,
|
|
96
|
+
...(presentation.files.length < fileCount
|
|
97
|
+
? {
|
|
98
|
+
omittedFileCount: fileCount - files.length,
|
|
99
|
+
omittedMatchCount:
|
|
100
|
+
matches.length - files.reduce((count, file) => count + file.matchCount, 0),
|
|
101
|
+
}
|
|
102
|
+
: {}),
|
|
92
103
|
complete,
|
|
93
104
|
files,
|
|
94
105
|
};
|
|
@@ -159,6 +170,8 @@ export function isSearchToolDetails(value: unknown): value is SearchToolDetails
|
|
|
159
170
|
typeof value.query !== "string" ||
|
|
160
171
|
!isCount(value.matchCount) ||
|
|
161
172
|
!isCount(value.fileCount) ||
|
|
173
|
+
(value.omittedFileCount !== undefined && !isCount(value.omittedFileCount)) ||
|
|
174
|
+
(value.omittedMatchCount !== undefined && !isCount(value.omittedMatchCount)) ||
|
|
162
175
|
typeof value.complete !== "boolean" ||
|
|
163
176
|
(value.sessionId !== undefined && typeof value.sessionId !== "string") ||
|
|
164
177
|
(value.fuzzy !== undefined && !isFuzzyResultData(value.fuzzy)) ||
|
|
@@ -171,8 +184,9 @@ export function isSearchToolDetails(value: unknown): value is SearchToolDetails
|
|
|
171
184
|
|
|
172
185
|
const files = value.files as readonly SearchResultFile[];
|
|
173
186
|
return (
|
|
174
|
-
value.fileCount === files.length &&
|
|
175
|
-
value.matchCount ===
|
|
187
|
+
value.fileCount === files.length + (value.omittedFileCount ?? 0) &&
|
|
188
|
+
value.matchCount ===
|
|
189
|
+
files.reduce((count, file) => count + file.matchCount, 0) + (value.omittedMatchCount ?? 0)
|
|
176
190
|
);
|
|
177
191
|
}
|
|
178
192
|
|
|
@@ -200,7 +200,11 @@ export function formatFuzzyCandidate(candidate: FuzzyCandidateData): string {
|
|
|
200
200
|
`Possible name: ${candidate.identifier} (${candidate.reason})`,
|
|
201
201
|
`${candidate.matchCount}${suffix} ${candidate.matchCount === 1 && candidate.selection.complete ? "match" : "matches"} in ${candidate.fileCount}${suffix} ${candidate.fileCount === 1 && candidate.selection.complete ? "file" : "files"}`,
|
|
202
202
|
`Exact alternative: ${JSON.stringify(candidate.identifier)} (case-sensitive, whole identifier)`,
|
|
203
|
-
...(candidate.selection.complete
|
|
203
|
+
...(candidate.selection.complete
|
|
204
|
+
? []
|
|
205
|
+
: [
|
|
206
|
+
"Capture limit reached; no complete all reference. Inspect the returned location; do not treat this candidate as a complete match set.",
|
|
207
|
+
]),
|
|
204
208
|
...(read
|
|
205
209
|
? [`Read: ${read}${reference || !first ? "" : ` · line ${first.range.startLine}`}`]
|
|
206
210
|
: []),
|
|
@@ -7,12 +7,12 @@ export const searchSchema = Type.Object(
|
|
|
7
7
|
query: Type.String({
|
|
8
8
|
minLength: 1,
|
|
9
9
|
description:
|
|
10
|
-
"Text to find
|
|
10
|
+
"Text to find or a Boolean expression. Quote text to keep it literal. Use regex:<pattern> for regular expressions, files:<pattern> for file paths, ast:<pattern> for syntax patterns, symbols:<query> for language symbols, or process:<query> for running processes.",
|
|
11
11
|
}),
|
|
12
12
|
path: Type.Optional({
|
|
13
13
|
...resultInputSchema,
|
|
14
14
|
description:
|
|
15
|
-
"File, directory, URL,
|
|
15
|
+
"File, directory, URL, unchanged Read/Search/Select/edit result, its UUID, or an array of such results. Results select only their registered ranges unless symbols: navigation follows external references.",
|
|
16
16
|
}),
|
|
17
17
|
navigation: Type.Optional(
|
|
18
18
|
Type.Literal("references", {
|
|
@@ -28,7 +28,7 @@ export const searchSchema = Type.Object(
|
|
|
28
28
|
Type.Integer({
|
|
29
29
|
minimum: 1,
|
|
30
30
|
maximum: 1000,
|
|
31
|
-
description: "Maximum
|
|
31
|
+
description: "Maximum displayed items, including compact file summaries (default 50).",
|
|
32
32
|
}),
|
|
33
33
|
),
|
|
34
34
|
},
|
|
@@ -125,7 +125,8 @@ export default async function registerSearchCore(
|
|
|
125
125
|
openWorldHint: false,
|
|
126
126
|
},
|
|
127
127
|
label: "search",
|
|
128
|
-
description:
|
|
128
|
+
description:
|
|
129
|
+
"Use search to find text, file paths, syntax patterns, language symbols, web-page text, and running processes.",
|
|
129
130
|
promptSnippet:
|
|
130
131
|
"Search files and text with literals or regular expressions, plus syntax trees and language symbols",
|
|
131
132
|
get promptGuidelines(): string[] {
|
|
@@ -254,18 +254,27 @@ export function createSearchCore(): SearchCore {
|
|
|
254
254
|
const missingAdapter = data === undefined;
|
|
255
255
|
return withStructuredResult(
|
|
256
256
|
{
|
|
257
|
-
content:
|
|
258
|
-
entry.registration.fallback && protocolLike
|
|
257
|
+
content: [
|
|
258
|
+
...(entry.registration.fallback && protocolLike
|
|
259
259
|
? [
|
|
260
260
|
{
|
|
261
|
-
type: "text",
|
|
261
|
+
type: "text" as const,
|
|
262
262
|
text: emptyProtocol
|
|
263
263
|
? "Search fallback: empty protocol query; searched the original text."
|
|
264
264
|
: "Search fallback: unhandled protocol query; searched the original text.",
|
|
265
265
|
},
|
|
266
266
|
...formatted.content,
|
|
267
267
|
]
|
|
268
|
-
: formatted.content,
|
|
268
|
+
: formatted.content),
|
|
269
|
+
...(isRecord(data) && data.complete === false
|
|
270
|
+
? [
|
|
271
|
+
{
|
|
272
|
+
type: "text" as const,
|
|
273
|
+
text: "Search coverage is incomplete. Do not conclude absence or use this result as an edit scope.",
|
|
274
|
+
},
|
|
275
|
+
]
|
|
276
|
+
: []),
|
|
277
|
+
],
|
|
269
278
|
details: { resolverId: resolver.id, payload: formatted.details },
|
|
270
279
|
...(audience === "script" && {
|
|
271
280
|
script: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -79,14 +79,14 @@
|
|
|
79
79
|
"fs-extra": "^11.4.0",
|
|
80
80
|
"oxfmt": "0.64.0",
|
|
81
81
|
"partial-json": "^0.1.7",
|
|
82
|
-
"pi-agent-documentation": "0.7.
|
|
83
|
-
"pi-agent-invariant": "0.7.
|
|
84
|
-
"pi-agent-read": "0.7.
|
|
85
|
-
"pi-agent-resource": "0.7.
|
|
86
|
-
"pi-agent-search": "0.7.
|
|
87
|
-
"pi-agent-text": "0.7.
|
|
88
|
-
"pi-agent-tool-call-interception": "0.7.
|
|
89
|
-
"pi-agent-tool-ui": "0.7.
|
|
82
|
+
"pi-agent-documentation": "0.7.2",
|
|
83
|
+
"pi-agent-invariant": "0.7.2",
|
|
84
|
+
"pi-agent-read": "0.7.2",
|
|
85
|
+
"pi-agent-resource": "0.7.2",
|
|
86
|
+
"pi-agent-search": "0.7.2",
|
|
87
|
+
"pi-agent-text": "0.7.2",
|
|
88
|
+
"pi-agent-tool-call-interception": "0.7.2",
|
|
89
|
+
"pi-agent-tool-ui": "0.7.2",
|
|
90
90
|
"typebox-guard": "npm:typebox@^1.1.38"
|
|
91
91
|
},
|
|
92
92
|
"pi": {
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-constant",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-text": "0.7.
|
|
10
|
-
"pi-agent-text-editor": "0.7.
|
|
9
|
+
"pi-agent-text": "0.7.2",
|
|
10
|
+
"pi-agent-text-editor": "0.7.2"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from "node:path";
|
|
1
2
|
import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
|
|
2
3
|
import {
|
|
3
4
|
TEXT_EDITOR_API_VERSION,
|
|
@@ -5,22 +6,83 @@ import {
|
|
|
5
6
|
TEXT_SEARCH_ANCHOR_KIND,
|
|
6
7
|
type TextEditorPlugin,
|
|
7
8
|
} from "pi-agent-text-editor/api/plugin-protocol";
|
|
8
|
-
|
|
9
9
|
import { createExactTextAnchorResolver } from "./src/anchor.js";
|
|
10
10
|
import { parseExactTextRecoveryConfig } from "./src/config.js";
|
|
11
|
-
|
|
12
11
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
interface RecoveryDetails {
|
|
14
|
+
metadata?: { exactTextFailures?: string[] };
|
|
15
|
+
source?: string;
|
|
16
|
+
nativeEditBatch?: { state: string };
|
|
17
|
+
results?: { data?: { ok?: boolean; path?: string } }[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Recognize issued source/anchor syntax only after its tool has validated it. */
|
|
21
|
+
function usesRegisteredSelector(input: Record<string, unknown>): boolean {
|
|
22
|
+
return [
|
|
23
|
+
"path",
|
|
24
|
+
"file",
|
|
25
|
+
"target",
|
|
26
|
+
"start",
|
|
27
|
+
"end",
|
|
28
|
+
"anchor",
|
|
29
|
+
"targetStart",
|
|
30
|
+
"targetEnd",
|
|
31
|
+
"change",
|
|
32
|
+
].some((field) => {
|
|
33
|
+
const value = input[field];
|
|
34
|
+
const values: unknown[] = Array.isArray(value) ? value : [value];
|
|
35
|
+
return values.some(
|
|
36
|
+
(value: unknown) =>
|
|
37
|
+
typeof value === "string" &&
|
|
38
|
+
/^(?:RESULT#|SEARCH#|CHANGE#|scope-(?:begin|end)-|\d+#[a-f\d]+$|begin$|end$|<system-result)/iu.test(
|
|
39
|
+
value,
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Register exact text and require an issued selector after an explicit-text failure. */
|
|
15
46
|
export default async function registerExactTextAnchor(pi: ExtensionAPI): Promise<void> {
|
|
47
|
+
const blocked = new Set<string>();
|
|
48
|
+
const pendingRecovery = new Set<string>();
|
|
49
|
+
const key = (source: string, cwd: string) => path.resolve(cwd, source);
|
|
50
|
+
const clear = () => {
|
|
51
|
+
blocked.clear();
|
|
52
|
+
pendingRecovery.clear();
|
|
53
|
+
};
|
|
54
|
+
pi.on("session_start", clear);
|
|
55
|
+
pi.on("session_shutdown", clear);
|
|
56
|
+
pi.on("agent_end", () => pendingRecovery.clear());
|
|
57
|
+
pi.on("tool_result", (event, context) => {
|
|
58
|
+
const details = event.details as RecoveryDetails | undefined;
|
|
59
|
+
for (const source of details?.metadata?.exactTextFailures ?? []) {
|
|
60
|
+
blocked.add(key(source, context.cwd));
|
|
61
|
+
pendingRecovery.delete(key(source, context.cwd));
|
|
62
|
+
}
|
|
63
|
+
if (event.isError || !usesRegisteredSelector(event.input)) return;
|
|
64
|
+
if (details?.nativeEditBatch?.state === "accepted" && details.source) {
|
|
65
|
+
const source = key(details.source, context.cwd);
|
|
66
|
+
if (blocked.has(source)) pendingRecovery.add(source);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
for (const result of details?.results ?? []) {
|
|
70
|
+
if (result.data?.ok && result.data.path) blocked.delete(key(result.data.path, context.cwd));
|
|
71
|
+
}
|
|
72
|
+
});
|
|
16
73
|
const plugin = {
|
|
17
74
|
protocol: TEXT_EDITOR_PROTOCOL,
|
|
18
75
|
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
19
76
|
id: "text-anchor-exact",
|
|
20
77
|
setup(api) {
|
|
78
|
+
api.onDidEdit((completion) => {
|
|
79
|
+
const source = key(completion.resourceSource, completion.cwd);
|
|
80
|
+
if (pendingRecovery.delete(source)) blocked.delete(source);
|
|
81
|
+
});
|
|
21
82
|
api.addAnchorResolver({
|
|
22
83
|
resolver: createExactTextAnchorResolver(
|
|
23
84
|
parseExactTextRecoveryConfig(api.recoveryConfig("exactText")),
|
|
85
|
+
(source, cwd) => blocked.has(key(source, cwd)),
|
|
24
86
|
),
|
|
25
87
|
kind: TEXT_SEARCH_ANCHOR_KIND,
|
|
26
88
|
type: "auxiliary",
|
|
@@ -29,6 +91,5 @@ export default async function registerExactTextAnchor(pi: ExtensionAPI): Promise
|
|
|
29
91
|
});
|
|
30
92
|
},
|
|
31
93
|
} satisfies TextEditorPlugin;
|
|
32
|
-
|
|
33
94
|
await connectTextEditorPlugin(pi, plugin);
|
|
34
95
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-exact",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"fast-fuzzy": "1.12.0",
|
|
16
|
-
"pi-agent-text": "0.7.
|
|
17
|
-
"pi-agent-text-editor": "0.7.
|
|
16
|
+
"pi-agent-text": "0.7.2",
|
|
17
|
+
"pi-agent-text-editor": "0.7.2"
|
|
18
18
|
},
|
|
19
19
|
"pi": {
|
|
20
20
|
"extensions": [
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts
CHANGED
|
@@ -18,7 +18,10 @@ interface NormalizedText {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/** Creates the catch-all resolver for unique exact text spans. */
|
|
21
|
-
export function createExactTextAnchorResolver(
|
|
21
|
+
export function createExactTextAnchorResolver(
|
|
22
|
+
config: ExactTextRecoveryConfig,
|
|
23
|
+
requiresAnchor: (source: string, cwd: string) => boolean = () => false,
|
|
24
|
+
): TextAnchorResolver {
|
|
22
25
|
return {
|
|
23
26
|
id: "exact-text",
|
|
24
27
|
description:
|
|
@@ -30,7 +33,14 @@ export function createExactTextAnchorResolver(config: ExactTextRecoveryConfig):
|
|
|
30
33
|
return "selected text";
|
|
31
34
|
},
|
|
32
35
|
tryResolve(value, context) {
|
|
33
|
-
return Promise.resolve(
|
|
36
|
+
return Promise.resolve(
|
|
37
|
+
requiresAnchor(context.source, context.cwd)
|
|
38
|
+
? rejected(
|
|
39
|
+
"invalid",
|
|
40
|
+
"Exact-text editing is blocked for this file; use a current returned anchor for the next edit.",
|
|
41
|
+
)
|
|
42
|
+
: resolveExactTextAnchor(value, context),
|
|
43
|
+
);
|
|
34
44
|
},
|
|
35
45
|
recover(value, context) {
|
|
36
46
|
return recoverExactText(value, context, config);
|
|
@@ -25,9 +25,10 @@ export default async function registerLineHashTextAnchor(pi: ExtensionAPI): Prom
|
|
|
25
25
|
id: "text-anchor-line-hash",
|
|
26
26
|
setup(api) {
|
|
27
27
|
api.addView({ view: "anchors", presenter });
|
|
28
|
-
api.describe(
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
api.describe({
|
|
29
|
+
views:
|
|
30
|
+
"anchors — annotate text with returned line references in the form LINE#HASH, e.g. 12#A4F0 (line number 12 and its content hash). These references select source lines in edits or path#anchor reads; display annotations are not file content.",
|
|
31
|
+
});
|
|
31
32
|
},
|
|
32
33
|
} satisfies ReadPlugin;
|
|
33
34
|
const editorPlugin = {
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-line-hash",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"pi-agent-invariant": "0.7.
|
|
16
|
-
"pi-agent-read": "0.7.
|
|
17
|
-
"pi-agent-text": "0.7.
|
|
18
|
-
"pi-agent-text-editor": "0.7.
|
|
15
|
+
"pi-agent-invariant": "0.7.2",
|
|
16
|
+
"pi-agent-read": "0.7.2",
|
|
17
|
+
"pi-agent-text": "0.7.2",
|
|
18
|
+
"pi-agent-text-editor": "0.7.2"
|
|
19
19
|
},
|
|
20
20
|
"pi": {
|
|
21
21
|
"extensions": [
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-renderer",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"diff": "^9.0.0",
|
|
10
|
-
"pi-agent-invariant": "0.7.
|
|
11
|
-
"pi-agent-text-editor": "0.7.
|
|
12
|
-
"pi-agent-tool-call-interception": "0.7.
|
|
13
|
-
"pi-agent-tool-ui": "0.7.
|
|
10
|
+
"pi-agent-invariant": "0.7.2",
|
|
11
|
+
"pi-agent-text-editor": "0.7.2",
|
|
12
|
+
"pi-agent-tool-call-interception": "0.7.2",
|
|
13
|
+
"pi-agent-tool-ui": "0.7.2",
|
|
14
14
|
"vscode-diff": "3.0.1"
|
|
15
15
|
},
|
|
16
16
|
"pi": {
|
|
@@ -317,6 +317,17 @@ function renderTail(
|
|
|
317
317
|
: `Formatted ${grouped.formatted.length} files by ${by}`;
|
|
318
318
|
statuses.unshift(theme.fg("success", label.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ")));
|
|
319
319
|
}
|
|
320
|
+
if (grouped.alreadyFormatted.length > 0) {
|
|
321
|
+
const by =
|
|
322
|
+
grouped.unchangedFormatters.length === 1
|
|
323
|
+
? grouped.unchangedFormatters[0]
|
|
324
|
+
: `${grouped.unchangedFormatters.length} formatters`;
|
|
325
|
+
const label =
|
|
326
|
+
resources.length === 1
|
|
327
|
+
? `Already formatted (${by})`
|
|
328
|
+
: `Already formatted ${grouped.alreadyFormatted.length} files by ${by}`;
|
|
329
|
+
statuses.unshift(theme.fg("success", label.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ")));
|
|
330
|
+
}
|
|
320
331
|
const text = [counts, ...statuses]
|
|
321
332
|
.filter((item) => item !== undefined)
|
|
322
333
|
.join(theme.fg("dim", " · "));
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts
CHANGED
|
@@ -251,7 +251,17 @@ function createRenderer(
|
|
|
251
251
|
options.expanded,
|
|
252
252
|
theme,
|
|
253
253
|
);
|
|
254
|
-
return new Text(
|
|
254
|
+
return new Text(
|
|
255
|
+
registration.name === "copy" &&
|
|
256
|
+
typeof result.details.metadata?.targetUnavailable === "string"
|
|
257
|
+
? theme.fg(
|
|
258
|
+
"muted",
|
|
259
|
+
"No verified text selection. Read the destination before further edits.",
|
|
260
|
+
)
|
|
261
|
+
: "",
|
|
262
|
+
0,
|
|
263
|
+
0,
|
|
264
|
+
);
|
|
255
265
|
}
|
|
256
266
|
|
|
257
267
|
clearTypingRuntime(state);
|
|
@@ -272,14 +282,28 @@ function createRenderer(
|
|
|
272
282
|
state.panel?.setPreviewResources([]);
|
|
273
283
|
|
|
274
284
|
if (!context.isError && result.details.metadata?.emptyTargets === true) {
|
|
275
|
-
return new Text(
|
|
285
|
+
return new Text(
|
|
286
|
+
theme.fg(
|
|
287
|
+
"muted",
|
|
288
|
+
registration.name === "copy"
|
|
289
|
+
? "No changes: empty selection."
|
|
290
|
+
: "No changes · empty target set",
|
|
291
|
+
),
|
|
292
|
+
0,
|
|
293
|
+
0,
|
|
294
|
+
);
|
|
276
295
|
}
|
|
277
296
|
const wholeFileSucceeded = wholeFileOperationSucceeded(result.details);
|
|
278
297
|
if (wholeFileSucceeded !== undefined) {
|
|
279
298
|
return new Text(
|
|
280
299
|
theme.fg(
|
|
281
300
|
wholeFileSucceeded ? "success" : "error",
|
|
282
|
-
wholeFileSucceeded
|
|
301
|
+
wholeFileSucceeded
|
|
302
|
+
? registration.name === "copy" &&
|
|
303
|
+
typeof result.details.metadata?.targetUnavailable === "string"
|
|
304
|
+
? "✓ Applied · no verified text selection; read destination before further edits"
|
|
305
|
+
: "✓ Applied"
|
|
306
|
+
: "✗ Not applied",
|
|
283
307
|
),
|
|
284
308
|
0,
|
|
285
309
|
0,
|
|
@@ -292,7 +316,19 @@ function createRenderer(
|
|
|
292
316
|
)
|
|
293
317
|
.map((item) => item.text)
|
|
294
318
|
.join("\n");
|
|
295
|
-
const
|
|
319
|
+
const rollback =
|
|
320
|
+
registration.name === "copy" ? result.details.metadata?.copyRollback : undefined;
|
|
321
|
+
const uncertainExecution =
|
|
322
|
+
registration.name === "copy" && result.details.metadata?.copyExecution === "uncertain";
|
|
323
|
+
const displayedOutput = context.isError
|
|
324
|
+
? uncertainExecution
|
|
325
|
+
? "Copy failed · effects uncertain; read destination before retrying"
|
|
326
|
+
: rollback === "restored"
|
|
327
|
+
? "Copy failed · changes rolled back"
|
|
328
|
+
: rollback === "failed"
|
|
329
|
+
? "Copy failed · rollback failed; read destination before retrying"
|
|
330
|
+
: userFacingFailure(output, result.details)
|
|
331
|
+
: output;
|
|
296
332
|
return new Text(
|
|
297
333
|
displayedOutput.length === 0
|
|
298
334
|
? ""
|
|
@@ -868,7 +904,20 @@ function wholeFileOperationSucceeded(details: unknown): boolean | undefined {
|
|
|
868
904
|
: undefined;
|
|
869
905
|
}
|
|
870
906
|
|
|
871
|
-
function userFacingFailure(
|
|
907
|
+
function userFacingFailure(
|
|
908
|
+
agentOutput: string,
|
|
909
|
+
details: FileMutationBatchResult | undefined,
|
|
910
|
+
): string {
|
|
911
|
+
const rollback = details?.results?.find((result) => result.data.rollback !== undefined)?.data
|
|
912
|
+
.rollback;
|
|
913
|
+
if (rollback !== undefined) {
|
|
914
|
+
return rollback.failedSources.length === 0
|
|
915
|
+
? "Rolled back · write failed"
|
|
916
|
+
: "State unknown · rollback failed";
|
|
917
|
+
}
|
|
918
|
+
if (details?.effect === "unknown") return "Effects unknown · edit failed";
|
|
919
|
+
if (details?.effect === "applied") return "Saved · post-write step failed";
|
|
920
|
+
if (details?.metadata?.rollback === "restored") return "Rolled back · edit failed";
|
|
872
921
|
if (/\banchor\b[\s\S]*\bis ambiguous\./iu.test(agentOutput)) {
|
|
873
922
|
return "Not changed · selection is ambiguous";
|
|
874
923
|
}
|