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
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { connectResultTargets, type ResultTargetStore } from "pi-agent-resource";
|
|
2
|
+
import {
|
|
3
|
+
committedMutationTargets,
|
|
4
|
+
describeUnavailableCopyTarget,
|
|
5
|
+
unchangedCopySources,
|
|
6
|
+
} from "./mutation-result-targets.js";
|
|
1
7
|
import { requiredValue } from "pi-agent-invariant";
|
|
2
8
|
import { renderTextAnchor } from "pi-agent-text";
|
|
3
9
|
import {
|
|
@@ -29,15 +35,21 @@ import {
|
|
|
29
35
|
TextMutationAnchorResolutionError,
|
|
30
36
|
} from "#src/core/text-mutation-anchor-error.js";
|
|
31
37
|
import {
|
|
38
|
+
buildFailedCopyWriteResult,
|
|
32
39
|
buildFailedTextMutationResult,
|
|
33
40
|
buildSuccessfulTextMutationResult,
|
|
34
41
|
mutationSources,
|
|
35
42
|
preflightMutationAnchors,
|
|
43
|
+
textMutationOperationReceipts,
|
|
36
44
|
} from "#src/core/text-mutation.js";
|
|
37
45
|
import { registerBlockedToolCallSink } from "#src/core/tool-call-interceptor/coordinator.js";
|
|
38
46
|
|
|
39
47
|
import type { TextEditIntent } from "#src/api/edit-completion.js";
|
|
40
|
-
import type {
|
|
48
|
+
import type {
|
|
49
|
+
FileMutationBatchResult,
|
|
50
|
+
FileMutationResult,
|
|
51
|
+
MutationResultPresentation,
|
|
52
|
+
} from "#src/api/mutation-result.js";
|
|
41
53
|
import type { AnyTextMutationToolRegistration, TextMutation } from "#src/api/mutation-tool.js";
|
|
42
54
|
import type { BatchExecutionReporter } from "#src/core/text-edit-batch-execution.js";
|
|
43
55
|
import type {
|
|
@@ -90,6 +102,7 @@ export function setTextEditBatchRenderArgumentSink(
|
|
|
90
102
|
}
|
|
91
103
|
|
|
92
104
|
export function registerTextEditBatching(pi: ExtensionAPI, core: TextEditorCore): void {
|
|
105
|
+
const resultTargets = connectResultTargets(pi);
|
|
93
106
|
const sourceTools: string[] = [];
|
|
94
107
|
const registrations = new Map<string, AnyTextMutationToolRegistration>();
|
|
95
108
|
const renderArguments = (toolCallId: string, patch: Readonly<Record<string, unknown>>): void =>
|
|
@@ -159,6 +172,8 @@ export function registerTextEditBatching(pi: ExtensionAPI, core: TextEditorCore)
|
|
|
159
172
|
context,
|
|
160
173
|
reporter,
|
|
161
174
|
renderArguments,
|
|
175
|
+
undefined,
|
|
176
|
+
resultTargets,
|
|
162
177
|
),
|
|
163
178
|
splitResult: splitTextBatchResult,
|
|
164
179
|
onRenderArguments: renderArguments,
|
|
@@ -301,6 +316,7 @@ export async function executeRegisteredTextBatch(
|
|
|
301
316
|
reporter: BatchExecutionReporter,
|
|
302
317
|
renderArguments: (toolCallId: string, patch: Readonly<Record<string, unknown>>) => void,
|
|
303
318
|
planned?: PlannedTextBatch,
|
|
319
|
+
resultTargets?: ResultTargetStore,
|
|
304
320
|
): Promise<AgentToolResult<TextBatchDetails>> {
|
|
305
321
|
const prepared = parameters.edits.map((entry) => {
|
|
306
322
|
const registration = registrations.get(entry.op);
|
|
@@ -339,12 +355,15 @@ export async function executeRegisteredTextBatch(
|
|
|
339
355
|
}
|
|
340
356
|
|
|
341
357
|
let outcome: TextResourcesEditOutcome<PlannedTextBatch>;
|
|
358
|
+
let executionPlan = planned;
|
|
359
|
+
const guardedSnapshots = new Map<string, string>();
|
|
342
360
|
|
|
343
361
|
try {
|
|
344
362
|
outcome = await core.editTexts(
|
|
345
363
|
[...requests.values()],
|
|
346
364
|
{ cwd: context.cwd, intent, ...(signal !== undefined && { signal }) },
|
|
347
365
|
async (texts, resolveAnchor) => {
|
|
366
|
+
for (const [source, content] of texts) guardedSnapshots.set(source, content);
|
|
348
367
|
for (const [source, expected] of parameters.expectedContent ?? []) {
|
|
349
368
|
if (!texts.has(source) || texts.get(source) !== expected) {
|
|
350
369
|
throw new Error(`Snapshot source ${source} changed before the edit batch.`);
|
|
@@ -361,6 +380,7 @@ export async function executeRegisteredTextBatch(
|
|
|
361
380
|
signal,
|
|
362
381
|
renderArguments,
|
|
363
382
|
));
|
|
383
|
+
executionPlan = result;
|
|
364
384
|
return { changes: result.changes, result };
|
|
365
385
|
},
|
|
366
386
|
);
|
|
@@ -375,12 +395,43 @@ export async function executeRegisteredTextBatch(
|
|
|
375
395
|
}
|
|
376
396
|
|
|
377
397
|
if (outcome.kind === "failed") {
|
|
398
|
+
const copyResults = new Map<string, AgentToolResult<FileMutationBatchResult>>();
|
|
399
|
+
if (outcome.failure.code === "WRITE_FAILED") {
|
|
400
|
+
for (const { callId, mutation } of executionPlan?.mutations ?? []) {
|
|
401
|
+
if (mutation.operation !== "copy") continue;
|
|
402
|
+
const unrestored = (outcome.failure.rollback?.failed ?? outcome.completed).filter(
|
|
403
|
+
(source) => mutation.edits.has(source),
|
|
404
|
+
);
|
|
405
|
+
const destination = unrestored[0] ?? mutation.edits.keys().next().value;
|
|
406
|
+
copyResults.set(
|
|
407
|
+
callId,
|
|
408
|
+
buildFailedCopyWriteResult(
|
|
409
|
+
{
|
|
410
|
+
...outcome.failure,
|
|
411
|
+
source: destination ?? outcome.failure.source,
|
|
412
|
+
...(outcome.failure.rollback !== undefined && {
|
|
413
|
+
rollback: {
|
|
414
|
+
failed: outcome.failure.rollback.failed.filter((source) =>
|
|
415
|
+
mutation.edits.has(source),
|
|
416
|
+
),
|
|
417
|
+
originallyMissing: outcome.failure.rollback.originallyMissing.filter((source) =>
|
|
418
|
+
mutation.edits.has(source),
|
|
419
|
+
),
|
|
420
|
+
},
|
|
421
|
+
}),
|
|
422
|
+
},
|
|
423
|
+
unrestored,
|
|
424
|
+
),
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
378
428
|
return failTextBatch(
|
|
379
429
|
core,
|
|
380
430
|
prepared.map(({ callId }) => callId),
|
|
381
431
|
outcome.failure,
|
|
382
432
|
context,
|
|
383
433
|
reporter,
|
|
434
|
+
copyResults,
|
|
384
435
|
);
|
|
385
436
|
}
|
|
386
437
|
|
|
@@ -433,7 +484,7 @@ export async function executeRegisteredTextBatch(
|
|
|
433
484
|
mutation.resultPresentations.get(source) ?? "plain",
|
|
434
485
|
|
|
435
486
|
1,
|
|
436
|
-
|
|
487
|
+
textMutationOperationReceipts(mutation.operation, edit, resource.before.content),
|
|
437
488
|
|
|
438
489
|
completedMutations.flatMap((peer) =>
|
|
439
490
|
peer.callId === callId
|
|
@@ -451,7 +502,12 @@ export async function executeRegisteredTextBatch(
|
|
|
451
502
|
displayResults.push(...callDisplayResults);
|
|
452
503
|
callIdsByDisplayResult.push(...callDisplayResults.map(() => callId));
|
|
453
504
|
|
|
505
|
+
const unchangedCopy =
|
|
506
|
+
mutation.operation === "copy" &&
|
|
507
|
+
mutation.edits.size > 0 &&
|
|
508
|
+
unchangedCopySources(mutation, guardedSnapshots).size === mutation.edits.size;
|
|
454
509
|
for (const source of mutation.edits.keys()) {
|
|
510
|
+
if (unchangedCopy && finalCallIdBySource.has(source)) continue;
|
|
455
511
|
finalCallIdBySource.set(source, callId);
|
|
456
512
|
finalPresentationBySource.set(source, mutation.resultPresentations.get(source) ?? "plain");
|
|
457
513
|
}
|
|
@@ -483,7 +539,7 @@ export async function executeRegisteredTextBatch(
|
|
|
483
539
|
const edit = mutation.edits.get(source);
|
|
484
540
|
return edit === undefined
|
|
485
541
|
? []
|
|
486
|
-
:
|
|
542
|
+
: textMutationOperationReceipts(mutation.operation, edit, resource.before.content);
|
|
487
543
|
}),
|
|
488
544
|
);
|
|
489
545
|
resultsByCallId.get(finalCallId)?.push(result);
|
|
@@ -491,17 +547,82 @@ export async function executeRegisteredTextBatch(
|
|
|
491
547
|
callIdsByResult.push(finalCallId);
|
|
492
548
|
}
|
|
493
549
|
|
|
550
|
+
const copyResults = new Map<string, AgentToolResult<FileMutationBatchResult>>();
|
|
551
|
+
if (resultTargets) {
|
|
552
|
+
const copies = completedMutations.filter(
|
|
553
|
+
({ mutation }) => mutation.operation === "copy" && mutation.edits.size > 0,
|
|
554
|
+
);
|
|
555
|
+
for (const { callId, mutation } of copies) {
|
|
556
|
+
const sources = new Set(mutation.edits.keys());
|
|
557
|
+
let metadata: FileMutationBatchResult["metadata"];
|
|
558
|
+
try {
|
|
559
|
+
const mapped = committedMutationTargets(
|
|
560
|
+
completedMutations.map(({ callId, mutation }) => ({
|
|
561
|
+
callId,
|
|
562
|
+
edits: new Map([...mutation.edits].filter(([source]) => sources.has(source))),
|
|
563
|
+
})),
|
|
564
|
+
// Copy read these destinations successfully, so they existed before the batch.
|
|
565
|
+
outcome.resources
|
|
566
|
+
.filter((resource) => sources.has(resource.source))
|
|
567
|
+
.map((resource) => ({
|
|
568
|
+
source: resource.source,
|
|
569
|
+
resourceSource: resource.after.source,
|
|
570
|
+
resolvedBy: resource.resolvedBy,
|
|
571
|
+
before: resource.before,
|
|
572
|
+
after: resource.after,
|
|
573
|
+
existed: true,
|
|
574
|
+
})),
|
|
575
|
+
guardedSnapshots,
|
|
576
|
+
);
|
|
577
|
+
const targets = mapped.get(callId);
|
|
578
|
+
const expectedTargets = [...mutation.edits.values()].filter(
|
|
579
|
+
(edit) => edit.resultChanges?.length !== 0,
|
|
580
|
+
).length;
|
|
581
|
+
if (!targets || targets.length !== expectedTargets)
|
|
582
|
+
throw new Error("This operation did not produce confirmed filesystem targets.");
|
|
583
|
+
const reference = resultTargets.register(targets, context.cwd);
|
|
584
|
+
await resultTargets.verify(resultTargets.resolve(reference, context.cwd), signal);
|
|
585
|
+
metadata = { resultTarget: reference };
|
|
586
|
+
} catch (error) {
|
|
587
|
+
signal?.throwIfAborted();
|
|
588
|
+
metadata = { targetUnavailable: errorMessage(error) };
|
|
589
|
+
}
|
|
590
|
+
const unchanged =
|
|
591
|
+
unchangedCopySources(mutation, guardedSnapshots).size === mutation.edits.size;
|
|
592
|
+
const ownResults = resultsByCallId.get(callId) ?? [];
|
|
593
|
+
const displayed = displayResultsByCallId.get(callId) ?? [];
|
|
594
|
+
const receipt = textBatchResult(
|
|
595
|
+
ownResults.length > 0 ? ownResults : displayed,
|
|
596
|
+
[],
|
|
597
|
+
displayed,
|
|
598
|
+
[],
|
|
599
|
+
);
|
|
600
|
+
copyResults.set(
|
|
601
|
+
callId,
|
|
602
|
+
describeUnavailableCopyTarget({
|
|
603
|
+
...receipt,
|
|
604
|
+
...(unchanged
|
|
605
|
+
? {
|
|
606
|
+
content: [{ type: "text", text: "No changes: destination already has this text." }],
|
|
607
|
+
}
|
|
608
|
+
: {}),
|
|
609
|
+
details: { ...receipt.details, effect: unchanged ? "not-applied" : "applied", metadata },
|
|
610
|
+
}),
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
494
614
|
for (const { callId } of completedMutations) {
|
|
495
615
|
const callResults = resultsByCallId.get(callId) ?? [];
|
|
496
616
|
const callDisplayResults = displayResultsByCallId.get(callId) ?? [];
|
|
497
617
|
reporter.complete(
|
|
498
618
|
callId,
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
619
|
+
copyResults.get(callId) ??
|
|
620
|
+
textBatchResult(
|
|
621
|
+
callResults,
|
|
622
|
+
callResults.map(() => callId),
|
|
623
|
+
callDisplayResults,
|
|
624
|
+
callDisplayResults.map(() => callId),
|
|
625
|
+
),
|
|
505
626
|
);
|
|
506
627
|
}
|
|
507
628
|
|
|
@@ -556,7 +677,10 @@ export async function executeRegisteredTextBatch(
|
|
|
556
677
|
callIdsByDisplayResult: [...callIdsByDisplayResult],
|
|
557
678
|
},
|
|
558
679
|
});
|
|
559
|
-
|
|
680
|
+
const result = textBatchResult(results, callIdsByResult, displayResults, callIdsByDisplayResult);
|
|
681
|
+
return copyResults.size === 0
|
|
682
|
+
? result
|
|
683
|
+
: { ...result, details: { ...result.details, copyResults } };
|
|
560
684
|
}
|
|
561
685
|
|
|
562
686
|
async function failTextBatch(
|
|
@@ -565,32 +689,38 @@ async function failTextBatch(
|
|
|
565
689
|
error: unknown,
|
|
566
690
|
context: ExtensionContext,
|
|
567
691
|
reporter: BatchExecutionReporter,
|
|
692
|
+
copyResults: ReadonlyMap<string, AgentToolResult<FileMutationBatchResult>> = new Map(),
|
|
568
693
|
): Promise<AgentToolResult<TextBatchDetails>> {
|
|
569
|
-
const cause = error;
|
|
570
694
|
const failure = isTextResourceEditFailure(error)
|
|
571
695
|
? error
|
|
572
696
|
: {
|
|
573
697
|
code: "INVALID_REQUEST" as const,
|
|
574
698
|
source: "",
|
|
575
|
-
message: errorMessage(
|
|
576
|
-
cause,
|
|
699
|
+
message: errorMessage(error),
|
|
700
|
+
cause: error,
|
|
577
701
|
};
|
|
702
|
+
const cause = Object.assign(new Error(failure.message), { code: failure.code });
|
|
578
703
|
const failedCallId = callIds[0];
|
|
579
704
|
const failedResult = await buildFailedTextMutationResult(core, failure, context);
|
|
580
|
-
|
|
705
|
+
const results: FileMutationResult[] = [];
|
|
706
|
+
const callIdsByResult: string[] = [];
|
|
581
707
|
for (const callId of callIds) {
|
|
708
|
+
const copyResult = copyResults.get(callId);
|
|
709
|
+
const result = copyResult ?? (callId === failedCallId ? failedResult : undefined);
|
|
582
710
|
reporter.fail(callId, {
|
|
583
711
|
error: cause,
|
|
584
|
-
effect: "not-applied",
|
|
585
|
-
...(
|
|
712
|
+
effect: copyResult?.details.effect ?? failedResult.details.effect ?? "not-applied",
|
|
713
|
+
...(result !== undefined && { result }),
|
|
586
714
|
});
|
|
715
|
+
for (const item of result?.details.results ?? []) {
|
|
716
|
+
results.push(item);
|
|
717
|
+
callIdsByResult.push(callId);
|
|
718
|
+
}
|
|
587
719
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
results.map(() => failedCallId ?? ""),
|
|
593
|
-
);
|
|
720
|
+
const result = textBatchResult(results, callIdsByResult);
|
|
721
|
+
return copyResults.size === 0
|
|
722
|
+
? result
|
|
723
|
+
: { ...result, details: { ...result.details, copyResults } };
|
|
594
724
|
}
|
|
595
725
|
|
|
596
726
|
function isTextResourceEditFailure(value: unknown): value is TextResourceEditFailure {
|
|
@@ -28,6 +28,8 @@ export interface TextBatchDetails extends FileMutationBatchResult {
|
|
|
28
28
|
readonly displayResults?: readonly FileMutationResult[];
|
|
29
29
|
/** Original call id for each user-facing result. */
|
|
30
30
|
readonly callIdsByDisplayResult?: readonly string[];
|
|
31
|
+
/** Per-call Copy receipts retain destination authority and their own failure evidence. */
|
|
32
|
+
readonly copyResults?: ReadonlyMap<string, AgentToolResult<FileMutationBatchResult>>;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
function resultPath(result: FileMutationResult): string | undefined {
|
|
@@ -54,6 +56,8 @@ export function splitTextBatchResult(
|
|
|
54
56
|
|
|
55
57
|
return new Map(
|
|
56
58
|
calls.map((call) => {
|
|
59
|
+
const copyResult = details?.copyResults?.get(call.id);
|
|
60
|
+
if (copyResult) return [call.id, copyResult];
|
|
57
61
|
const agentResults = coalesceResults(agentResultsByCall.get(call.id) ?? []);
|
|
58
62
|
const displayResults = coalesceResults(displayResultsByCall.get(call.id) ?? []);
|
|
59
63
|
return [
|
|
@@ -260,6 +260,11 @@ export interface TextResourceEditFailure {
|
|
|
260
260
|
readonly resolverId?: string;
|
|
261
261
|
readonly message: string;
|
|
262
262
|
readonly cause?: unknown;
|
|
263
|
+
/** Failed restoration and prior absence prevent a confirmed unchanged-resource claim. */
|
|
264
|
+
readonly rollback?: {
|
|
265
|
+
readonly failed: readonly string[];
|
|
266
|
+
readonly originallyMissing: readonly string[];
|
|
267
|
+
};
|
|
263
268
|
}
|
|
264
269
|
|
|
265
270
|
export type TextResourceEditOutcome<Result> =
|
|
@@ -932,6 +937,10 @@ export function createTextEditorCore(
|
|
|
932
937
|
return core;
|
|
933
938
|
}
|
|
934
939
|
|
|
940
|
+
function readFailureMessage(source: string, error: unknown): string {
|
|
941
|
+
return `Unable to read ${source}: ${error instanceof Error ? error.message : String(error)}`;
|
|
942
|
+
}
|
|
943
|
+
|
|
935
944
|
async function inspectTextResource(
|
|
936
945
|
request: TextAnchorInspectionRequest,
|
|
937
946
|
resolvers: readonly RegisteredResolver[],
|
|
@@ -980,7 +989,7 @@ async function inspectTextResource(
|
|
|
980
989
|
try {
|
|
981
990
|
content = await resource.read(request.signal === undefined ? {} : { signal: request.signal });
|
|
982
991
|
} catch (error) {
|
|
983
|
-
return { kind: "failed", reason:
|
|
992
|
+
return { kind: "failed", reason: readFailureMessage(resource.source, error), cause: error };
|
|
984
993
|
}
|
|
985
994
|
|
|
986
995
|
if (!isAgentContent(content) || content.length !== 1 || content[0].type !== "text") {
|
|
@@ -1316,45 +1325,62 @@ async function editTextResources<Result>(
|
|
|
1316
1325
|
rollbackFailures.push(writtenSource);
|
|
1317
1326
|
}
|
|
1318
1327
|
}
|
|
1328
|
+
const cause: unknown = failure.status === "rejected" ? failure.reason : undefined;
|
|
1329
|
+
const originallyMissing = written.filter(
|
|
1330
|
+
(writtenSource) => !requiredValue(prepared.get(writtenSource)).existed,
|
|
1331
|
+
);
|
|
1319
1332
|
return {
|
|
1320
1333
|
kind: "failed",
|
|
1321
1334
|
failure: {
|
|
1322
1335
|
code: "WRITE_FAILED",
|
|
1323
1336
|
source,
|
|
1324
1337
|
resolverId: item.resolverId,
|
|
1325
|
-
message:
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
: `Unable to write ${source}; rollback failed for ${rollbackFailures.join(", ")}`,
|
|
1329
|
-
cause: failure.status === "rejected" ? failure.reason : undefined,
|
|
1338
|
+
message: `Unable to write ${source}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
1339
|
+
cause,
|
|
1340
|
+
rollback: { failed: rollbackFailures, originallyMissing },
|
|
1330
1341
|
},
|
|
1331
|
-
completed:
|
|
1342
|
+
completed: [],
|
|
1332
1343
|
};
|
|
1333
1344
|
}
|
|
1334
1345
|
const outcomes: Exclude<TextResourceEditOutcome<unknown>, { readonly kind: "failed" }>[] = [];
|
|
1335
1346
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
const
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1347
|
+
let finalizingSource = written[0] ?? sources[0] ?? "";
|
|
1348
|
+
try {
|
|
1349
|
+
await collectPostEditNotifications(async () => {
|
|
1350
|
+
for (const source of written) {
|
|
1351
|
+
finalizingSource = source;
|
|
1352
|
+
const text = requiredValue(applied.get(source)).content;
|
|
1353
|
+
const item = requiredValue(prepared.get(source));
|
|
1354
|
+
outcomes.push(
|
|
1355
|
+
await finalizeTextResource({
|
|
1356
|
+
requestedSource: item.requestedSource,
|
|
1357
|
+
outcomeSource: item.requestedSource,
|
|
1358
|
+
resource: item.resource,
|
|
1359
|
+
resolvedBy: item.resolverId,
|
|
1360
|
+
existed: item.existed,
|
|
1361
|
+
before: item.before,
|
|
1362
|
+
requestedText: text,
|
|
1363
|
+
context,
|
|
1364
|
+
presenters,
|
|
1365
|
+
postEditHandlers,
|
|
1366
|
+
editCompletionListeners,
|
|
1367
|
+
result: mutation.result,
|
|
1368
|
+
}),
|
|
1369
|
+
);
|
|
1370
|
+
}
|
|
1371
|
+
});
|
|
1372
|
+
} catch (error) {
|
|
1373
|
+
return {
|
|
1374
|
+
kind: "failed",
|
|
1375
|
+
failure: {
|
|
1376
|
+
code: "POST_WRITE_FAILED",
|
|
1377
|
+
source: finalizingSource,
|
|
1378
|
+
message: error instanceof Error ? error.message : String(error),
|
|
1379
|
+
cause: error,
|
|
1380
|
+
},
|
|
1381
|
+
completed: written,
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1358
1384
|
return { kind: "completed", resources: outcomes, result: mutation.result };
|
|
1359
1385
|
}
|
|
1360
1386
|
|
|
@@ -1442,7 +1468,7 @@ async function prepareTextResource(
|
|
|
1442
1468
|
code: "READ_FAILED",
|
|
1443
1469
|
source: attempt.resource.source,
|
|
1444
1470
|
resolverId: resolver.id,
|
|
1445
|
-
message:
|
|
1471
|
+
message: readFailureMessage(attempt.resource.source, error),
|
|
1446
1472
|
cause: error,
|
|
1447
1473
|
},
|
|
1448
1474
|
};
|
|
@@ -1561,6 +1587,18 @@ async function finalizeTextResource<Result>(
|
|
|
1561
1587
|
}
|
|
1562
1588
|
}
|
|
1563
1589
|
|
|
1590
|
+
if (!skipPostEdit && !deferred && request.context.signal?.aborted)
|
|
1591
|
+
postEditContributions.push({
|
|
1592
|
+
id: "post-edit-interruption",
|
|
1593
|
+
data: {
|
|
1594
|
+
diffStatuses: [
|
|
1595
|
+
{
|
|
1596
|
+
text: "Post-edit processing was interrupted. Read the saved file before retrying.",
|
|
1597
|
+
tone: "warning",
|
|
1598
|
+
},
|
|
1599
|
+
],
|
|
1600
|
+
},
|
|
1601
|
+
});
|
|
1564
1602
|
let finalText = request.requestedText;
|
|
1565
1603
|
|
|
1566
1604
|
if (!skipPostEdit && request.resource.read !== undefined) {
|
|
@@ -1587,7 +1625,13 @@ async function finalizeTextResource<Result>(
|
|
|
1587
1625
|
before: request.postProcessingFinal ? requestedAfter : request.before,
|
|
1588
1626
|
after: finalAfter,
|
|
1589
1627
|
intent: request.context.intent ?? "edit",
|
|
1590
|
-
postProcessing: deferred
|
|
1628
|
+
postProcessing: deferred
|
|
1629
|
+
? "deferred"
|
|
1630
|
+
: request.context.signal?.aborted
|
|
1631
|
+
? "interrupted"
|
|
1632
|
+
: request.postProcessingFinal
|
|
1633
|
+
? "final"
|
|
1634
|
+
: "complete",
|
|
1591
1635
|
};
|
|
1592
1636
|
|
|
1593
1637
|
for (const listener of request.editCompletionListeners) {
|
|
@@ -1734,7 +1778,7 @@ async function editTextResource<Result>(
|
|
|
1734
1778
|
code: "READ_FAILED",
|
|
1735
1779
|
source: resource.source,
|
|
1736
1780
|
resolverId: resolver.id,
|
|
1737
|
-
message:
|
|
1781
|
+
message: readFailureMessage(resource.source, error),
|
|
1738
1782
|
cause: error,
|
|
1739
1783
|
},
|
|
1740
1784
|
};
|