pi-agent-ide 0.5.1 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/README.md +82 -50
- package/assets/social-preview.png +0 -0
- package/dist/{chunk-LY6U5EAD.js → chunk-2527OQ4Y.js} +1 -1
- package/dist/chunk-4KUFOHWP.js +2 -0
- package/dist/chunk-4LDOV7QS.js +28 -0
- package/dist/chunk-5JELU6RV.js +7 -0
- package/dist/chunk-FA6BKC5Y.js +1 -0
- package/dist/chunk-FEDVTZJG.js +1 -0
- package/dist/chunk-I6Y3W4X6.js +27 -0
- package/dist/chunk-K5G4FDXD.js +1 -0
- package/dist/chunk-M5IVSCR2.js +1 -0
- package/dist/chunk-MPT3R4BL.js +0 -0
- package/dist/chunk-PZFOOHY2.js +15 -0
- package/dist/chunk-S6QRG3TQ.js +1 -0
- package/dist/chunk-T7I2VX3J.js +1 -0
- package/dist/chunk-VCTK4JSN.js +3 -0
- package/dist/chunk-W7CASEO3.js +1 -0
- package/dist/chunk-YEQOQMU7.js +5 -0
- package/dist/chunk-YT42LKFV.js +16 -0
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-16.js +1 -0
- package/dist/entry-17.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -1
- package/dist/entry-22.js +1 -2
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +2 -1
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +2 -12
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +12 -1
- package/dist/entry-32.js +1 -4
- package/dist/entry-33.js +1 -9
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +4 -1
- package/dist/entry-37.js +9 -1
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-40.js +1 -1
- package/dist/entry-41.js +1 -18
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +17 -1
- package/dist/entry-46.js +1 -7
- package/dist/entry-47.js +1 -11
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +6 -1
- package/dist/entry-51.js +11 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-55.js +1 -1
- package/dist/entry-56.js +1 -0
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -0
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +0 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +0 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -1
- package/dist/entry-65.js +1 -0
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +1 -0
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +0 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +0 -203
- package/dist/entry-72.js +1 -30
- package/dist/entry-73.js +1 -2
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +315 -1
- package/dist/entry-76.js +30 -3
- package/dist/entry-77.js +2 -3
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-80.js +3 -1
- package/dist/entry-81.js +3 -0
- package/dist/entry-82.js +1 -0
- package/dist/entry-83.js +1 -0
- package/dist/entry-84.js +1 -0
- package/dist/entry-9.js +1 -1
- package/dist/pi-agent-ide.js +3 -3
- package/docs/agent-guides/apply.md +333 -0
- package/docs/agent-guides/debugger.md +5 -0
- package/docs/agent-guides/diagnostics.md +5 -0
- package/docs/agent-guides/editing.md +44 -0
- package/docs/agent-guides/git-changes.md +5 -0
- package/docs/agent-guides/json-reading.md +41 -0
- package/docs/agent-guides/read-resources.md +44 -0
- package/docs/agent-guides/search-code.md +29 -0
- package/docs/agent-guides/terminal.md +7 -0
- package/docs/agent-guides/vision.md +5 -0
- package/docs/configuration.md +9 -15
- package/docs/research/apply-read-latency.md +219 -0
- package/docs/tools.md +12 -0
- package/node_modules/pi-agent-doctor/package.json +6 -6
- package/node_modules/pi-agent-doctor/runtime/entry-22.js +1 -0
- package/node_modules/pi-agent-doctor/runtime/entry-23.js +1 -0
- package/node_modules/pi-agent-documentation/package.json +15 -0
- package/node_modules/pi-agent-documentation/runtime/entry-24.js +1 -0
- package/node_modules/pi-agent-documentation/src/index.ts +69 -0
- package/node_modules/pi-agent-filesystem/index.ts +0 -4
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-image/runtime/entry-26.js +2 -0
- package/node_modules/pi-agent-filesystem-jq/index.ts +134 -0
- package/node_modules/pi-agent-filesystem-jq/package.json +23 -0
- package/node_modules/pi-agent-filesystem-jq/src/jq.ts +107 -0
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-28.js +2 -0
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-ide-ast/package.json +12 -11
- package/node_modules/pi-agent-ide-ast/runtime/entry-30.js +1 -0
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +8 -6
- package/node_modules/pi-agent-ide-changes/index.ts +8 -0
- package/node_modules/pi-agent-ide-changes/package.json +9 -8
- package/node_modules/pi-agent-ide-changes/runtime/entry-32.js +1 -0
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-formatter/runtime/entry-34.js +2 -0
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +1 -1
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/runtime/entry-35.js +2 -0
- package/node_modules/pi-agent-ide-lint/index.ts +1 -1
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/runtime/entry-36.js +2 -0
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +20 -2
- package/node_modules/pi-agent-ide-lsp/index.ts +0 -3
- package/node_modules/pi-agent-ide-lsp/package.json +10 -10
- package/node_modules/pi-agent-ide-lsp/runtime/entry-37.js +2 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-read/package.json +12 -11
- package/node_modules/pi-agent-read/runtime/entry-41.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-45.js +2 -0
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -4
- package/node_modules/pi-agent-read/src/core/extension.ts +16 -2
- package/node_modules/pi-agent-read/src/core/read-core.ts +4 -5
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +62 -8
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +29 -17
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-resource/runtime/entry-46.js +1 -0
- package/node_modules/pi-agent-search/package.json +8 -7
- package/node_modules/pi-agent-search/runtime/entry-47.js +1 -0
- package/node_modules/pi-agent-search/src/core/extension.ts +29 -10
- package/node_modules/pi-agent-search-text/package.json +9 -9
- package/node_modules/pi-agent-search-text/runtime/entry-51.js +2 -0
- package/node_modules/pi-agent-search-text/runtime/entry-52.js +1 -0
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-exact/index.ts +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-56.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/src/config.ts +2 -2
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-58.js +2 -0
- package/node_modules/pi-agent-text-editor/index.ts +15 -0
- package/node_modules/pi-agent-text-editor/package.json +26 -25
- package/node_modules/pi-agent-text-editor/runtime/entry-71.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-72.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-73.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-75.js +2 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +131 -3
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +14 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +36 -5
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +5 -42
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +50 -5
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +187 -38
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +3 -8
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +770 -237
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +0 -11
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +5 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-config.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +9 -1
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +0 -2
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +53 -0
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +11 -41
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +8 -18
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +11 -41
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -19
- package/node_modules/pi-agent-text-editor-renderer/index.ts +17 -4
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +23 -11
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +21 -16
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-78.js +1 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-79.js +1 -0
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-html/runtime/entry-81.js +2 -0
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-image/runtime/entry-82.js +2 -0
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/runtime/entry-83.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-84.js +2 -0
- package/package.json +112 -43
- package/src/api/documentation.ts +2 -0
- package/src/api/path-identity.ts +15 -0
- package/src/composite/builtin-extensions.ts +14 -2
- package/src/composite/extensions-config.ts +6 -0
- package/src/composite/module-labels.ts +9 -0
- package/src/composite/module-settings-store.ts +3 -0
- package/src/composite/module-settings.ts +71 -17
- package/src/composite/preferences.ts +83 -3
- package/src/composite/presentation.ts +14 -0
- package/src/composite/presets.ts +57 -0
- package/src/composite/selection.ts +5 -1
- package/src/doctor/inventory.ts +7 -2
- package/src/documentation/extension.ts +295 -0
- package/src/documentation/registry.ts +98 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +0 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-26.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +134 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +23 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-27.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +107 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-28.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-29.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-25.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-81.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-82.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-83.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-84.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-80.js +2 -0
- package/src/extensions/pi-agent-read/package.json +12 -11
- package/src/extensions/pi-agent-read/runtime/entry-41.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-42.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-45.js +2 -0
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -4
- package/src/extensions/pi-agent-read/src/core/extension.ts +16 -2
- package/src/extensions/pi-agent-read/src/core/read-core.ts +4 -5
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +62 -8
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +29 -17
- package/src/extensions/pi-agent-search/package.json +8 -7
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-51.js +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-52.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-47.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-48.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-49.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-50.js +2 -0
- package/src/extensions/pi-agent-search/src/core/extension.ts +29 -10
- package/src/extensions/pi-agent-text-editor/index.ts +15 -0
- package/src/extensions/pi-agent-text-editor/package.json +26 -25
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-55.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-56.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/config.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-57.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-58.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +17 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +23 -11
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +21 -16
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-77.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-72.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-73.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-74.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-75.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +131 -3
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +14 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +36 -5
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +5 -42
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +50 -5
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +187 -38
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +3 -8
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +770 -237
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +0 -11
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +5 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-config.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +9 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +0 -2
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +53 -0
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +11 -41
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +8 -18
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +11 -41
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -19
- package/src/pi-agent-ide.ts +21 -11
- package/src/plugins/pi-agent-ide-ast/package.json +12 -11
- package/src/plugins/pi-agent-ide-ast/runtime/entry-30.js +1 -0
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +8 -6
- package/src/plugins/pi-agent-ide-changes/index.ts +8 -0
- package/src/plugins/pi-agent-ide-changes/package.json +9 -8
- package/src/plugins/pi-agent-ide-changes/runtime/entry-32.js +1 -0
- package/src/plugins/pi-agent-ide-debugger/index.ts +13 -11
- package/src/plugins/pi-agent-ide-debugger/src/adapter-executables.ts +31 -0
- package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +3 -1
- package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +24 -23
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -2
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +55 -17
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -22
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +9 -4
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-formatter/runtime/entry-34.js +2 -0
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +1 -1
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/runtime/entry-35.js +2 -0
- package/src/plugins/pi-agent-ide-lint/index.ts +1 -1
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/runtime/entry-36.js +2 -0
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +20 -2
- package/src/plugins/pi-agent-ide-lsp/index.ts +0 -3
- package/src/plugins/pi-agent-ide-lsp/package.json +10 -10
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-37.js +2 -0
- package/src/plugins/pi-agent-ide-processes/src/registry.ts +4 -0
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +18 -9
- package/src/plugins/pi-agent-ide-terminal/index.ts +27 -2
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +1 -0
- package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +27 -2
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +1 -4
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +0 -3
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +1 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +8 -5
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +1 -0
- package/src/plugins/pi-agent-ide-vision/index.ts +234 -0
- package/src/plugins/pi-agent-ide-vision/src/vision.ts +530 -0
- package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +30 -0
- package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +33 -0
- package/dist/chunk-526E364R.js +0 -3
- package/dist/chunk-5PLV4HLG.js +0 -1
- package/dist/chunk-7ALCBKCW.js +0 -26
- package/dist/chunk-DQXPQOF7.js +0 -2
- package/dist/chunk-EJ5OACQM.js +0 -1
- package/dist/chunk-G725MARR.js +0 -16
- package/dist/chunk-HKXDP2FD.js +0 -7
- package/dist/chunk-IRECDTJG.js +0 -27
- package/dist/chunk-J4RTW44E.js +0 -1
- package/dist/chunk-NZYDMBM6.js +0 -1
- package/dist/chunk-WGGIQ7IJ.js +0 -1
- package/dist/entry-18.js +0 -1
- package/node_modules/pi-agent-doctor/runtime/entry-17.js +0 -1
- package/node_modules/pi-agent-doctor/runtime/entry-18.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-22.js +0 -2
- package/node_modules/pi-agent-filesystem-image/runtime/entry-23.js +0 -2
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-24.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- package/node_modules/pi-agent-ide-formatter/runtime/entry-30.js +0 -2
- package/node_modules/pi-agent-ide-lint/runtime/entry-32.js +0 -2
- package/node_modules/pi-agent-image/runtime/entry-34.js +0 -1
- package/node_modules/pi-agent-invariant/runtime/entry-35.js +0 -1
- package/node_modules/pi-agent-pdf/runtime/entry-36.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-37.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-45.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-46.js +0 -2
- package/node_modules/pi-agent-search-text/runtime/entry-47.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +0 -2
- package/node_modules/pi-agent-text-editor/runtime/entry-56.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-58.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-72.js +0 -2
- package/node_modules/pi-agent-text-editor-renderer/src/config.ts +0 -73
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +0 -1
- package/node_modules/pi-agent-web-image/runtime/entry-78.js +0 -2
- package/node_modules/pi-agent-web-pdf/runtime/entry-79.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-23.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-24.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-25.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-77.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-78.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-79.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-37.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-38.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-39.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-40.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +0 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-48.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-45.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-46.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-52.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-72.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/config.ts +0 -73
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-55.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-56.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-57.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-58.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +0 -2
- package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-29.js +0 -2
- package/src/plugins/pi-agent-ide-formatter/runtime/entry-30.js +0 -2
- package/src/plugins/pi-agent-ide-lint/runtime/entry-32.js +0 -2
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem}/runtime/entry-25.js +0 -0
- /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-jq}/runtime/entry-27.js +0 -0
- /package/node_modules/{pi-agent-ide-changes → pi-agent-filesystem-text}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-ast}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-changes}/runtime/entry-33.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-image}/runtime/entry-38.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-39.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-40.js +0 -0
- /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-42.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-read}/runtime/entry-43.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-read}/runtime/entry-44.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-48.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search}/runtime/entry-49.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-constant → pi-agent-search}/runtime/entry-50.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text}/runtime/entry-53.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-constant}/runtime/entry-54.js +0 -0
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-exact}/runtime/entry-55.js +0 -0
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-57.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-text-editor}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-text-editor-renderer}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-text-editor-stale-anchor}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web}/runtime/entry-80.js +0 -0
- /package/src/extensions/{pi-agent-search → pi-agent-read}/runtime/entry-43.js +0 -0
- /package/src/extensions/{pi-agent-search → pi-agent-read}/runtime/entry-44.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-constant}/runtime/entry-54.js +0 -0
- /package/src/extensions/{pi-agent-read/extensions/pi-agent-web → pi-agent-text-editor/plugins/pi-agent-text-editor-renderer}/runtime/entry-76.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-ast}/runtime/entry-31.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-changes}/runtime/entry-33.js +0 -0
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "pi-agent-tool-call-interception";
|
|
8
8
|
import { singleLine, type ToolCallHeaderDetail } from "pi-agent-tool-ui";
|
|
9
9
|
import { NEXT_TOOL_CALL_DRAIN_MS, type MutationAnimationPressure } from "./animation-pressure.js";
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
import { freezeMutationViewports, type FrozenMutationViewports } from "./frozen-viewport.js";
|
|
12
12
|
import { MutationPanel } from "./mutation-panel.js";
|
|
13
13
|
import {
|
|
@@ -21,12 +21,15 @@ import { TYPING_FRAME_INTERVAL_MS, TypingInterpolation } from "./typing-interpol
|
|
|
21
21
|
|
|
22
22
|
import type { MutationRenderResource } from "./render-resource.js";
|
|
23
23
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
24
|
+
|
|
24
25
|
import type { TextMutationPreviewResource } from "pi-agent-text-editor/api/mutation-preview";
|
|
25
26
|
import type { FileMutationBatchResult } from "pi-agent-text-editor/api/mutation-result";
|
|
26
27
|
import type { AnyTextMutationToolRegistration } from "pi-agent-text-editor/api/mutation-tool";
|
|
27
28
|
import type { TextEditorPluginApi } from "pi-agent-text-editor/api/plugin-protocol";
|
|
28
29
|
import type { TextEditorToolRendererRegistration } from "pi-agent-text-editor/api/tool-renderer";
|
|
29
30
|
|
|
31
|
+
type ToolPresentation = "full" | "compact" | "disabled";
|
|
32
|
+
|
|
30
33
|
type MutationRenderOutcome =
|
|
31
34
|
| { readonly kind: "completed"; readonly resources: readonly MutationRenderResource[] }
|
|
32
35
|
| { readonly kind: "failed"; readonly reason: string };
|
|
@@ -68,6 +71,7 @@ interface RenderState {
|
|
|
68
71
|
theme?: Theme;
|
|
69
72
|
cwd?: string;
|
|
70
73
|
expanded?: boolean;
|
|
74
|
+
presentation?: ToolPresentation;
|
|
71
75
|
invalidate?: () => void;
|
|
72
76
|
latestGenerated?: string;
|
|
73
77
|
typing?: TypingInterpolation;
|
|
@@ -89,9 +93,12 @@ export function registerMutationRenderers(
|
|
|
89
93
|
api: TextEditorPluginApi,
|
|
90
94
|
animationPressure?: MutationAnimationPressure,
|
|
91
95
|
animationsEnabled: () => boolean = () => true,
|
|
96
|
+
presentation: ToolPresentation = "compact",
|
|
92
97
|
): void {
|
|
93
98
|
api.onMutationTool((registration) => {
|
|
94
|
-
api.addToolRenderer(
|
|
99
|
+
api.addToolRenderer(
|
|
100
|
+
createRenderer(api, registration, animationPressure, animationsEnabled, presentation),
|
|
101
|
+
);
|
|
95
102
|
});
|
|
96
103
|
}
|
|
97
104
|
|
|
@@ -100,6 +107,7 @@ function createRenderer(
|
|
|
100
107
|
registration: AnyTextMutationToolRegistration,
|
|
101
108
|
animationPressure: MutationAnimationPressure | undefined,
|
|
102
109
|
animationsEnabled: () => boolean,
|
|
110
|
+
presentation: ToolPresentation,
|
|
103
111
|
): TextEditorToolRendererRegistration {
|
|
104
112
|
const tool = registration.name;
|
|
105
113
|
|
|
@@ -118,7 +126,10 @@ function createRenderer(
|
|
|
118
126
|
state.invalidate = context.invalidate;
|
|
119
127
|
// renderCall runs on every frame, so reapply the project's viewport policy each time.
|
|
120
128
|
state.cwd = context.cwd;
|
|
121
|
-
|
|
129
|
+
const mode = context.expanded ? "full" : presentation;
|
|
130
|
+
state.presentation = presentation;
|
|
131
|
+
component.setExpanded(mode === "full");
|
|
132
|
+
component.setDiffsVisible(mode !== "disabled");
|
|
122
133
|
state.expanded = context.expanded;
|
|
123
134
|
|
|
124
135
|
component.setResourceLabelsVisible(
|
|
@@ -208,6 +219,10 @@ function createRenderer(
|
|
|
208
219
|
state.invalidate = context.invalidate;
|
|
209
220
|
|
|
210
221
|
state.expanded = options.expanded;
|
|
222
|
+
state.presentation = presentation;
|
|
223
|
+
const mode = options.expanded ? "full" : presentation;
|
|
224
|
+
state.panel?.setExpanded(mode === "full");
|
|
225
|
+
state.panel?.setDiffsVisible(mode !== "disabled");
|
|
211
226
|
|
|
212
227
|
state.panel?.setBackground(context.isError ? "toolErrorBg" : "toolSuccessBg");
|
|
213
228
|
cancelPreviewWorker(state);
|
|
@@ -301,18 +316,6 @@ function createRenderer(
|
|
|
301
316
|
};
|
|
302
317
|
}
|
|
303
318
|
|
|
304
|
-
const diffViewCache = new Map<string, boolean>();
|
|
305
|
-
|
|
306
|
-
/** Returns whether diffs should render fully by default for the given project. */
|
|
307
|
-
function preferFullDiff(cwd: string): boolean {
|
|
308
|
-
let preferFull = diffViewCache.get(cwd);
|
|
309
|
-
if (preferFull === undefined) {
|
|
310
|
-
preferFull = loadRendererConfig(cwd).diffView === "full";
|
|
311
|
-
diffViewCache.set(cwd, preferFull);
|
|
312
|
-
}
|
|
313
|
-
return preferFull;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
319
|
function panel(previous: unknown, theme: Theme, ownsShell: boolean): MutationPanel {
|
|
317
320
|
const component =
|
|
318
321
|
previous instanceof MutationPanel ? previous : new MutationPanel(theme, ownsShell);
|
|
@@ -626,7 +629,9 @@ function applyResultResources(
|
|
|
626
629
|
expanded,
|
|
627
630
|
);
|
|
628
631
|
state.panel?.setResultResources(stableResources);
|
|
629
|
-
|
|
632
|
+
const mode = expanded ? "full" : (state.presentation ?? "compact");
|
|
633
|
+
state.panel?.setExpanded(mode === "full");
|
|
634
|
+
state.panel?.setDiffsVisible(mode !== "disabled");
|
|
630
635
|
clearTypingRuntime(state);
|
|
631
636
|
}
|
|
632
637
|
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-stale-anchor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-invariant": "0.
|
|
7
|
-
"pi-agent-read": "0.
|
|
8
|
-
"pi-agent-text-editor": "0.
|
|
6
|
+
"pi-agent-invariant": "0.6.1",
|
|
7
|
+
"pi-agent-read": "0.6.1",
|
|
8
|
+
"pi-agent-text-editor": "0.6.1"
|
|
9
9
|
},
|
|
10
10
|
"pi": {
|
|
11
11
|
"extensions": [
|
|
12
|
-
"./runtime/entry-
|
|
12
|
+
"./runtime/entry-77.js"
|
|
13
13
|
]
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../dist/entry-72.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../dist/entry-73.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../dist/entry-74.js";
|
|
@@ -10,7 +10,11 @@ import { Value } from "typebox/value";
|
|
|
10
10
|
import type { TextEditorCore } from "#src/core/text-editor-core.js";
|
|
11
11
|
import { ApplyResults } from "#src/core/apply/results.js";
|
|
12
12
|
import { serializeApplyError, type ApplyRuntimeHost } from "#src/core/apply/runtime.js";
|
|
13
|
-
import { executeEditorTransaction } from "#src/core/apply/transaction.js";
|
|
13
|
+
import { executeEditorTransaction, type EditorSnapshot } from "#src/core/apply/transaction.js";
|
|
14
|
+
import { TextSelectionAnchor } from "#src/api/text-selection-anchor.js";
|
|
15
|
+
import { TextAnchorResolutionError } from "#src/core/text-anchor-registry.js";
|
|
16
|
+
import { buildFailedTextMutationResult } from "#src/core/text-mutation.js";
|
|
17
|
+
import { TextMutationAnchorResolutionError } from "#src/core/text-mutation-anchor-error.js";
|
|
14
18
|
|
|
15
19
|
/** Configured IDE services and ordinary tool schemas, shared with the standalone tools. */
|
|
16
20
|
export interface ApplyServices {
|
|
@@ -41,6 +45,91 @@ export function createApplyExecution(
|
|
|
41
45
|
? "read"
|
|
42
46
|
: "mutation";
|
|
43
47
|
let recorded = false;
|
|
48
|
+
const resolveMutationTarget = async (): Promise<unknown> => {
|
|
49
|
+
const request = arguments_ as {
|
|
50
|
+
snapshot?: { id?: unknown; source?: unknown; content?: unknown };
|
|
51
|
+
query?: unknown;
|
|
52
|
+
};
|
|
53
|
+
const snapshot = request.snapshot;
|
|
54
|
+
const content = snapshot?.content;
|
|
55
|
+
if (
|
|
56
|
+
snapshot === undefined ||
|
|
57
|
+
typeof snapshot.id !== "string" ||
|
|
58
|
+
typeof snapshot.source !== "string" ||
|
|
59
|
+
typeof content !== "string" ||
|
|
60
|
+
typeof request.query !== "string"
|
|
61
|
+
)
|
|
62
|
+
throw failure("INVALID_ARGUMENTS", "Invalid mutation-target resolution request");
|
|
63
|
+
let anchor;
|
|
64
|
+
try {
|
|
65
|
+
anchor = await services.editor.resolveAnchorInText({
|
|
66
|
+
source: snapshot.source,
|
|
67
|
+
content,
|
|
68
|
+
value: request.query,
|
|
69
|
+
cwd: context.cwd,
|
|
70
|
+
signal,
|
|
71
|
+
});
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (!(error instanceof TextAnchorResolutionError)) throw error;
|
|
74
|
+
const cause = new TextMutationAnchorResolutionError(
|
|
75
|
+
"apply",
|
|
76
|
+
"target",
|
|
77
|
+
snapshot.source,
|
|
78
|
+
request.query,
|
|
79
|
+
error,
|
|
80
|
+
);
|
|
81
|
+
const presentation = await buildFailedTextMutationResult(
|
|
82
|
+
services.editor,
|
|
83
|
+
{ code: "RESOLVE_FAILED", source: snapshot.source, message: error.message, cause },
|
|
84
|
+
{ ...context, signal },
|
|
85
|
+
);
|
|
86
|
+
return {
|
|
87
|
+
selections: [],
|
|
88
|
+
warning: {
|
|
89
|
+
code: "EMPTY_SELECTION",
|
|
90
|
+
message: presentation.content
|
|
91
|
+
.filter((block) => block.type === "text")
|
|
92
|
+
.map((block) => block.text)
|
|
93
|
+
.join("\n"),
|
|
94
|
+
presentation: {
|
|
95
|
+
anchorRecoveries: presentation.details.anchorRecoveries,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const starts = lineStarts(content);
|
|
101
|
+
if (!TextSelectionAnchor.is(anchor)) {
|
|
102
|
+
const from = starts[anchor.lineNumber - 1];
|
|
103
|
+
if (from === undefined)
|
|
104
|
+
throw failure("INVALID_SELECTION", "Anchor line is outside the opened snapshot");
|
|
105
|
+
const to = starts[anchor.lineNumber] ?? content.length;
|
|
106
|
+
return {
|
|
107
|
+
selections: [
|
|
108
|
+
{
|
|
109
|
+
document: snapshot.id,
|
|
110
|
+
from,
|
|
111
|
+
to,
|
|
112
|
+
text: content.slice(from, to),
|
|
113
|
+
linewise: true,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
selections: anchor.ranges.map((range) => {
|
|
120
|
+
const from = positionOffset(starts, range.start.lineNumber, range.start.column);
|
|
121
|
+
const to = positionOffset(starts, range.end.lineNumber, range.end.column);
|
|
122
|
+
return {
|
|
123
|
+
document: snapshot.id,
|
|
124
|
+
from,
|
|
125
|
+
to,
|
|
126
|
+
text: content.slice(from, to),
|
|
127
|
+
...(range.linewise === true && { linewise: true }),
|
|
128
|
+
};
|
|
129
|
+
}),
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
if (tool === "editorResolve") return await resolveMutationTarget();
|
|
44
133
|
try {
|
|
45
134
|
if (tool === "editorApply") {
|
|
46
135
|
let value;
|
|
@@ -61,13 +150,42 @@ export function createApplyExecution(
|
|
|
61
150
|
if (typeof source === "string") scope.forget(source);
|
|
62
151
|
throw error;
|
|
63
152
|
}
|
|
64
|
-
|
|
153
|
+
const requestedSnapshots =
|
|
154
|
+
(arguments_ as { snapshots?: readonly EditorSnapshot[] }).snapshots ?? [];
|
|
155
|
+
const changedSources = new Set([
|
|
156
|
+
...value.files.map((file) => file.source),
|
|
157
|
+
...value.completed,
|
|
158
|
+
]);
|
|
159
|
+
const refreshed = await Promise.all(
|
|
160
|
+
requestedSnapshots
|
|
161
|
+
.filter((snapshot) => changedSources.has(snapshot.source))
|
|
162
|
+
.map(async (snapshot) => {
|
|
163
|
+
const outcome = await services.read.read(
|
|
164
|
+
{ path: snapshot.source },
|
|
165
|
+
{ cwd: context.cwd, signal },
|
|
166
|
+
"script",
|
|
167
|
+
);
|
|
168
|
+
const script = outcome.script;
|
|
169
|
+
return !outcome.isError &&
|
|
170
|
+
script?.kind === "text" &&
|
|
171
|
+
typeof script.content === "string"
|
|
172
|
+
? {
|
|
173
|
+
id: snapshot.id,
|
|
174
|
+
source: outcome.details.source ?? script.source,
|
|
175
|
+
content: script.content,
|
|
176
|
+
lines: script.lines,
|
|
177
|
+
}
|
|
178
|
+
: { id: snapshot.id, unavailable: true };
|
|
179
|
+
}),
|
|
180
|
+
);
|
|
181
|
+
const response = { ...value, snapshots: refreshed };
|
|
182
|
+
results.record(id, "mutation", response);
|
|
65
183
|
recorded = true;
|
|
66
184
|
for (const file of value.files) {
|
|
67
185
|
results.updateFile(file.source, file.before, file.after);
|
|
68
186
|
lastSource = file.source;
|
|
69
187
|
}
|
|
70
|
-
return
|
|
188
|
+
return response;
|
|
71
189
|
}
|
|
72
190
|
if (tool === "editorOpen") {
|
|
73
191
|
if (!Value.Check(readParameters, arguments_))
|
|
@@ -199,6 +317,16 @@ export function createApplyExecution(
|
|
|
199
317
|
};
|
|
200
318
|
}
|
|
201
319
|
|
|
320
|
+
function lineStarts(content: string): number[] {
|
|
321
|
+
const starts = [0];
|
|
322
|
+
for (let index = 0; index < content.length; index += 1)
|
|
323
|
+
if (content[index] === "\n") starts.push(index + 1);
|
|
324
|
+
return starts;
|
|
325
|
+
}
|
|
326
|
+
function positionOffset(starts: readonly number[], line: number, column: number): number {
|
|
327
|
+
return (starts[line - 1] ?? 0) + column;
|
|
328
|
+
}
|
|
329
|
+
|
|
202
330
|
function failure(code: string, message: string, details?: unknown): Error {
|
|
203
331
|
return Object.assign(new Error(message), { code, details });
|
|
204
332
|
}
|
|
@@ -28,6 +28,20 @@ export interface ScriptMutationOutcome {
|
|
|
28
28
|
readonly effect: "not-applied" | "applied" | "unknown";
|
|
29
29
|
readonly files: readonly ScriptMutationFile[];
|
|
30
30
|
readonly completed: readonly string[];
|
|
31
|
+
/** Per-operation outcomes in staging order for Apply transactions. */
|
|
32
|
+
readonly operations?: readonly {
|
|
33
|
+
readonly index: number;
|
|
34
|
+
readonly kind: string;
|
|
35
|
+
readonly status: "applied" | "warning" | "failed" | "unknown" | "blocked";
|
|
36
|
+
readonly effect: "not-applied" | "applied" | "unknown";
|
|
37
|
+
readonly resources: readonly string[];
|
|
38
|
+
readonly error?: { readonly code: string; readonly message: string };
|
|
39
|
+
readonly warning?: {
|
|
40
|
+
readonly code: string;
|
|
41
|
+
readonly message: string;
|
|
42
|
+
readonly presentation?: unknown;
|
|
43
|
+
};
|
|
44
|
+
}[];
|
|
31
45
|
/** Session-scoped receipt accepted by undo. */
|
|
32
46
|
readonly transaction?: string;
|
|
33
47
|
readonly recoveries?: readonly ScriptAnchorRecovery[];
|
|
@@ -18,6 +18,7 @@ export interface ApplyOutput {
|
|
|
18
18
|
readonly content: Content;
|
|
19
19
|
readonly level: "full" | "compact" | "summary";
|
|
20
20
|
readonly temporarySource?: string;
|
|
21
|
+
readonly mutations?: ReturnType<typeof finalApplyMutations>;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
/** Presents net file effects once, preserving native images and one combined text budget. */
|
|
@@ -42,6 +43,7 @@ export async function renderApplyOutput(
|
|
|
42
43
|
for (const operation of selected.automatic) {
|
|
43
44
|
if (
|
|
44
45
|
operation.kind === "read" ||
|
|
46
|
+
hasOperationWarnings(operation.value) ||
|
|
45
47
|
isFailure(operation.value) ||
|
|
46
48
|
(operation.value !== null &&
|
|
47
49
|
typeof operation.value === "object" &&
|
|
@@ -74,7 +76,7 @@ export async function renderApplyOutput(
|
|
|
74
76
|
if (error !== undefined) content.push(text(formatError(error)));
|
|
75
77
|
if (content.length === 0) content.push(text("No operations or explicit results."));
|
|
76
78
|
const full = textContent(content);
|
|
77
|
-
if (!truncateHead(full).truncated) return { content, level: "full" };
|
|
79
|
+
if (!truncateHead(full).truncated) return { content, level: "full", mutations: finalMutations };
|
|
78
80
|
const temporarySource = await read.saveTemporary(full);
|
|
79
81
|
const footer = `\n\nFull Apply output: ${temporarySource}. Read this reference with offset/limit for more.`;
|
|
80
82
|
if (read.reduceOutput !== undefined && !context.signal?.aborted) {
|
|
@@ -101,7 +103,7 @@ export async function renderApplyOutput(
|
|
|
101
103
|
compact.push(...content.slice(suffixStart));
|
|
102
104
|
compact.push(text(footer.trimStart()));
|
|
103
105
|
if (!truncateHead(textContent(compact)).truncated)
|
|
104
|
-
return { content: compact, level: "compact", temporarySource };
|
|
106
|
+
return { content: compact, level: "compact", temporarySource, mutations: finalMutations };
|
|
105
107
|
}
|
|
106
108
|
const summary = [
|
|
107
109
|
`Apply output reduced: ${selected.automatic.length} automatic results, ${selected.explicit.length} explicit results, ${selected.files.length} final files.`,
|
|
@@ -119,6 +121,7 @@ export async function renderApplyOutput(
|
|
|
119
121
|
content: [text(bounded + footer), ...content.filter((block) => block.type === "image")],
|
|
120
122
|
level: "summary",
|
|
121
123
|
temporarySource,
|
|
124
|
+
mutations: finalMutations,
|
|
122
125
|
};
|
|
123
126
|
}
|
|
124
127
|
|
|
@@ -140,6 +143,18 @@ function expandReadSection(section: {
|
|
|
140
143
|
? resources.flatMap((read) => expandReadSection({ content: read.content, read }))
|
|
141
144
|
: [section];
|
|
142
145
|
}
|
|
146
|
+
function hasOperationWarnings(value: unknown): boolean {
|
|
147
|
+
return (
|
|
148
|
+
value !== null &&
|
|
149
|
+
typeof value === "object" &&
|
|
150
|
+
"operations" in value &&
|
|
151
|
+
Array.isArray(value.operations) &&
|
|
152
|
+
(value.operations as unknown[]).some(
|
|
153
|
+
(item) =>
|
|
154
|
+
item !== null && typeof item === "object" && "status" in item && item.status === "warning",
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
}
|
|
143
158
|
function isFailure(value: unknown): boolean {
|
|
144
159
|
return value !== null && typeof value === "object" && "ok" in value && value.ok === false;
|
|
145
160
|
}
|
|
@@ -153,7 +168,7 @@ function formatApplyFailure(code: string, message: string): string {
|
|
|
153
168
|
NOT_FOUND:
|
|
154
169
|
"The requested text or selection was not found. Read the current file and select existing text.",
|
|
155
170
|
AMBIGUOUS_MATCH:
|
|
156
|
-
"The selection matched more than once. Use a larger unique fragment or
|
|
171
|
+
"The selection matched more than once. Use a larger unique fragment or a current candidate anchor.",
|
|
157
172
|
STALE_EDITOR:
|
|
158
173
|
"This editor handle was already committed. Open the file again before staging more changes.",
|
|
159
174
|
STALE_SELECTION:
|
|
@@ -190,12 +205,14 @@ function renderValue(value: unknown): Content {
|
|
|
190
205
|
typeof value.operation === "string"
|
|
191
206
|
) {
|
|
192
207
|
const lines = [
|
|
193
|
-
`${value.operation}: ${"effect" in value ? String(value.effect) : isFailure(value) ? "failed" : "completed"}`,
|
|
208
|
+
`${value.operation}: ${isFailure(value) && "effect" in value && value.effect === "applied" ? "partially applied" : "effect" in value ? String(value.effect) : isFailure(value) ? "failed" : "completed"}`,
|
|
194
209
|
];
|
|
195
210
|
if ("path" in value && typeof value.path === "string") lines.push(value.path);
|
|
196
211
|
if ("target" in value && typeof value.target === "string")
|
|
197
212
|
lines.push(`Target: ${value.target}`);
|
|
198
|
-
if ("
|
|
213
|
+
if ("operations" in value && Array.isArray(value.operations))
|
|
214
|
+
lines.push(...value.operations.map(formatOperationOutcome));
|
|
215
|
+
else if ("errors" in value && Array.isArray(value.errors))
|
|
199
216
|
lines.push(...value.errors.map(formatReceiptError));
|
|
200
217
|
if ("error" in value) lines.push(formatReceiptError(value.error));
|
|
201
218
|
if (
|
|
@@ -236,6 +253,20 @@ function asReadResult(value: unknown): ReadToolResult | undefined {
|
|
|
236
253
|
return { content: renderValue(value), details: value as ReadResultDetails };
|
|
237
254
|
}
|
|
238
255
|
|
|
256
|
+
function formatOperationOutcome(value: unknown): string {
|
|
257
|
+
if (value === null || typeof value !== "object") return String(value);
|
|
258
|
+
const index = "index" in value ? Number(value.index) + 1 : "?";
|
|
259
|
+
const kind = "kind" in value ? String(value.kind) : "operation";
|
|
260
|
+
const status = "status" in value ? String(value.status) : "unknown";
|
|
261
|
+
const detail =
|
|
262
|
+
"warning" in value
|
|
263
|
+
? ` — ${formatReceiptError(value.warning)}`
|
|
264
|
+
: "error" in value
|
|
265
|
+
? ` — ${formatReceiptError(value.error)}`
|
|
266
|
+
: "";
|
|
267
|
+
return `${index}. ${kind}: ${status}${detail}`;
|
|
268
|
+
}
|
|
269
|
+
|
|
239
270
|
function formatReceiptError(value: unknown): string {
|
|
240
271
|
if (value === null || typeof value !== "object") return String(value);
|
|
241
272
|
const source = "source" in value ? String(value.source) : undefined;
|
|
@@ -1,50 +1,13 @@
|
|
|
1
1
|
const editorGuide = `
|
|
2
|
-
Read-only helpers
|
|
3
|
-
read({path, offset?, limit?, views?})
|
|
4
|
-
search({query, path?, include?, exclude?, caseSensitive?, wholeWord?, limit?})
|
|
5
|
-
diff({before, after})
|
|
6
|
-
result(value)
|
|
2
|
+
Read-only helpers use the standalone-tool arguments: read({...}), search({...}), and diff({before, after}). Their results are recorded automatically.
|
|
7
3
|
|
|
8
|
-
Transactional
|
|
9
|
-
|
|
10
|
-
file.source; file.content; file.lines
|
|
11
|
-
file.find(text) // exactly one match or an error
|
|
12
|
-
file.findAll(text) // stable selections from the original snapshot
|
|
13
|
-
file.select(searchMatch) // text, regex, or AST search match
|
|
14
|
-
file.between(start, end, {inside?: boolean})
|
|
15
|
-
file.line(first, last?)
|
|
16
|
-
file.replace(selection, text)
|
|
17
|
-
file.remove(selection)
|
|
18
|
-
file.insertBefore(selection, text)
|
|
19
|
-
file.insertAfter(selection, text)
|
|
20
|
-
file.replaceAll(text, replacement)
|
|
21
|
-
createFile(path, content)
|
|
22
|
-
deleteFile(path)
|
|
23
|
-
copyFile(path, target, {overwrite?: boolean})
|
|
24
|
-
moveFile(path, target, {overwrite?: boolean})
|
|
25
|
-
apply()
|
|
4
|
+
Transactional helpers:
|
|
5
|
+
open(path | {path, views?}); file.find(text); file.select(searchMatch); file.between(start, end, {inside?, lines?}); file.line(first, last?); file.start(); file.end(); file.before(selection); file.after(selection); file.slice(selection, start?, end?); file.union(...selections); file.within(candidates, scopes); file.linesOf(selection); file.replace(selection, text); file.remove(selection); file.insertBefore(selection, text); file.insertAfter(selection, text); file.flush(); file.delete(); replace(selection, text); remove(selection); insertBefore(selection, text); insertAfter(selection, text); copy(source, destination); move(source, destination); createFile(path, content); deleteFile(path); copyFile(path, target, {overwrite?}); moveFile(path, target, {overwrite?}); flush().
|
|
26
6
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Call apply() explicitly to validate and commit all staged text and file operations together. One transaction may affect several files. A successful commit returns a session-scoped APPLY# receipt; pass it to undo({ transaction: "APPLY#..." }) before any touched path changes to restore the whole transaction. After a successful apply(), old editor handles are stale; call open() again for another transaction. A script may commit several transactions, and later reads observe earlier commits. Staged operations left without apply() do not change files and are reported as uncommitted.
|
|
30
|
-
|
|
31
|
-
Before each commit the host verifies snapshots, resource types, ranges, overlaps, source existence, and destination conflicts. A preflight failure changes nothing. If execution fails after writing begins, the host restores captured resources and reports whether rollback completed. Do not describe an incomplete rollback as atomic success.
|
|
32
|
-
|
|
33
|
-
Use find() for one expected occurrence, findAll()/replaceAll() for intentional repeated edits, between() for a uniquely delimited block, and line() only when line identity is genuinely part of the task. Generate replacement text with ordinary JavaScript, but never rebuild and submit a complete existing file.
|
|
34
|
-
|
|
35
|
-
Example:
|
|
36
|
-
const config = open("src/config.ts");
|
|
37
|
-
const test = open("tests/config.test.ts");
|
|
38
|
-
config.replace(config.find("legacyMode"), "stableMode");
|
|
39
|
-
test.replaceAll("legacyMode", "stableMode");
|
|
40
|
-
apply();
|
|
41
|
-
|
|
42
|
-
Read accepts file paths, URLs, temp/search/debug/shell/diagnostics/symbol/graph resources, and supported views. Search accepts literal, regex:, files:, ast:, and symbols: queries. File changes and read-only calls are shown automatically. Use result(value) only to expose additional calculated data; do not call it merely to display committed changes.
|
|
43
|
-
|
|
44
|
-
Do not retry by guessing argument names. Inspect structured error codes such as NOT_FOUND, AMBIGUOUS_MATCH, STALE_SNAPSHOT, INVALID_TRANSACTION, and TRANSACTION_FAILED.
|
|
7
|
+
Selections are immutable and snapshot-bound. Use slice to select occurrences by position, union to combine non-overlapping sets, within to keep candidates contained by scopes, and linesOf to expand matches to whole lines. between accepts strings or SelectionSets as either boundary; {lines:true} expands through both containing lines. Prefer it for blocks identified by content; use line(first,last) only for exact verified line bounds. Use start/end or before/after as zero-width destinations when copy or move should insert instead of replace. Normal completion commits staged operations once; a thrown script commits none. flush() commits every staged operation; file.flush() commits only independent operations for that file while cross-file transfers stay pending. Successful checkpoints can return an APPLY# receipt. Failed operations report structured errors and do not silently guess a recovery.
|
|
45
8
|
`;
|
|
46
9
|
|
|
47
|
-
/**
|
|
10
|
+
/** Compact callable contract for the guarded Apply editor. */
|
|
48
11
|
export function applyHelperGuide(): string {
|
|
49
12
|
return editorGuide;
|
|
50
13
|
}
|
|
@@ -12,6 +12,7 @@ import { preserveEnclosingBackground } from "pi-agent-tool-ui";
|
|
|
12
12
|
import type { ApplyResults } from "./results.js";
|
|
13
13
|
import type { ApplyOutput } from "./output.js";
|
|
14
14
|
|
|
15
|
+
type ToolPresentation = "full" | "compact" | "disabled";
|
|
15
16
|
/** Deliberate user presentation, separate from model-facing operation receipts. */
|
|
16
17
|
export interface ApplyDisplay {
|
|
17
18
|
readonly blocks: readonly { readonly text: string; readonly read?: ReadToolResult }[];
|
|
@@ -62,7 +63,7 @@ export function createApplyDisplay(
|
|
|
62
63
|
],
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
|
-
const mutations = finalApplyMutations(results);
|
|
66
|
+
const mutations = output.mutations ?? finalApplyMutations(results);
|
|
66
67
|
return {
|
|
67
68
|
...(mutations.length > 0 ? { mutations: { results: mutations } } : {}),
|
|
68
69
|
comparisons,
|
|
@@ -110,6 +111,31 @@ export function createApplyDisplay(
|
|
|
110
111
|
!Array.isArray(value.errors)
|
|
111
112
|
)
|
|
112
113
|
return [];
|
|
114
|
+
if ("operations" in value && Array.isArray(value.operations)) {
|
|
115
|
+
const completed = value.operations.filter(
|
|
116
|
+
(operation: unknown) =>
|
|
117
|
+
operation !== null &&
|
|
118
|
+
typeof operation === "object" &&
|
|
119
|
+
"status" in operation &&
|
|
120
|
+
operation.status === "applied",
|
|
121
|
+
).length;
|
|
122
|
+
if (completed === value.operations.length) return [];
|
|
123
|
+
const outcomes = value.operations
|
|
124
|
+
.filter(
|
|
125
|
+
(operation: unknown) =>
|
|
126
|
+
operation !== null &&
|
|
127
|
+
typeof operation === "object" &&
|
|
128
|
+
"status" in operation &&
|
|
129
|
+
operation.status !== "applied",
|
|
130
|
+
)
|
|
131
|
+
.map((operation: unknown) => ({ text: formatDisplayOutcome(operation) }));
|
|
132
|
+
return [
|
|
133
|
+
{
|
|
134
|
+
text: `Apply partially applied: ${completed} of ${value.operations.length} operations completed.`,
|
|
135
|
+
},
|
|
136
|
+
...outcomes,
|
|
137
|
+
];
|
|
138
|
+
}
|
|
113
139
|
return value.errors.flatMap((error: unknown) =>
|
|
114
140
|
error !== null &&
|
|
115
141
|
typeof error === "object" &&
|
|
@@ -129,7 +155,7 @@ export function createApplyDisplay(
|
|
|
129
155
|
type RenderState = {
|
|
130
156
|
applyResultReady?: boolean;
|
|
131
157
|
displaySource?: string;
|
|
132
|
-
|
|
158
|
+
|
|
133
159
|
projectSource?: (source: string) => string;
|
|
134
160
|
};
|
|
135
161
|
|
|
@@ -185,8 +211,11 @@ export function applyFrameRows(
|
|
|
185
211
|
/** Compose compact written calls with a pure configured tool header renderer. */
|
|
186
212
|
export function createApplyCallRenderer(
|
|
187
213
|
renderWritten?: (call: ApplyCallPreview, theme: Theme) => string,
|
|
214
|
+
presentation: ToolPresentation = "compact",
|
|
188
215
|
): NonNullable<ToolDefinition["renderCall"]> {
|
|
189
216
|
return (args, theme, context) => {
|
|
217
|
+
if (!context.expanded && presentation === "disabled")
|
|
218
|
+
return new Text(theme.fg("toolTitle", "apply"), 0, 0);
|
|
190
219
|
const state = context.state as RenderState;
|
|
191
220
|
const projectSource = (state.projectSource ??= createApplySourceProjection(
|
|
192
221
|
renderWritten ? (call) => renderWritten(call, theme) : undefined,
|
|
@@ -203,14 +232,16 @@ export function createApplyCallRenderer(
|
|
|
203
232
|
invalidate() {},
|
|
204
233
|
render(width) {
|
|
205
234
|
return applyFrameRows(
|
|
206
|
-
|
|
235
|
+
context.expanded || presentation === "full"
|
|
207
236
|
? (state.displaySource ?? source)
|
|
208
|
-
:
|
|
237
|
+
: presentation === "disabled"
|
|
238
|
+
? ""
|
|
239
|
+
: compactApplyPreview(projectSource(state.displaySource ?? source)),
|
|
209
240
|
theme,
|
|
210
241
|
width,
|
|
211
242
|
"call",
|
|
212
243
|
!state.applyResultReady,
|
|
213
|
-
|
|
244
|
+
context.expanded || presentation === "full" || !renderWritten ? "javascript" : undefined,
|
|
214
245
|
);
|
|
215
246
|
},
|
|
216
247
|
};
|
|
@@ -303,6 +334,8 @@ export function createApplyResultRenderer(
|
|
|
303
334
|
const rows = mutationPanel.render(Math.max(1, width - 4));
|
|
304
335
|
if (body.length > 0 && rows.length > 0) body.push("");
|
|
305
336
|
body.push(...rows);
|
|
337
|
+
if (rows.length === 0)
|
|
338
|
+
body.push(...(mutations?.results ?? []).map((file) => file.path ?? "Changed file"));
|
|
306
339
|
} else if (mutations !== undefined)
|
|
307
340
|
body.push(...(mutations.results ?? []).map((file) => file.path ?? "Changed file"));
|
|
308
341
|
if (
|
|
@@ -329,6 +362,18 @@ export function createApplyResultRenderer(
|
|
|
329
362
|
};
|
|
330
363
|
}
|
|
331
364
|
|
|
365
|
+
function formatDisplayOutcome(value: unknown): string {
|
|
366
|
+
if (value === null || typeof value !== "object") return String(value);
|
|
367
|
+
const index = "index" in value ? Number(value.index) + 1 : "?";
|
|
368
|
+
const kind = "kind" in value ? String(value.kind) : "operation";
|
|
369
|
+
const status = "status" in value ? String(value.status) : "unknown";
|
|
370
|
+
const error =
|
|
371
|
+
"error" in value && value.error !== null && typeof value.error === "object"
|
|
372
|
+
? `: ${"code" in value.error ? String(value.error.code) : "ERROR"}: ${"message" in value.error ? String(value.error.message) : "Operation failed"}`
|
|
373
|
+
: "";
|
|
374
|
+
return `Operation ${index} (${kind}): ${status}${error}`;
|
|
375
|
+
}
|
|
376
|
+
|
|
332
377
|
function redactApplyReceipts(text: string): string {
|
|
333
378
|
if (/^(?:Undo transaction:|Undo available)/u.test(text.trim())) return "";
|
|
334
379
|
try {
|