pi-agent-ide 0.6.2 → 0.6.4
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 +66 -0
- package/README.md +8 -1
- package/dist/chunk-2P2OGO3G.js +2 -0
- package/dist/{chunk-5QQABP47.js → chunk-3BBJZSMS.js} +1 -1
- package/dist/chunk-5J43L2RL.js +11 -0
- package/dist/{chunk-ITSNK5YG.js → chunk-7AVXUV4A.js} +2 -2
- package/dist/chunk-BAYETTZZ.js +16 -0
- package/dist/{chunk-VCTK4JSN.js → chunk-BSICWXMH.js} +1 -1
- package/dist/chunk-BVK5A7ED.js +28 -0
- package/dist/{chunk-ZM4L5AGN.js → chunk-EDURPQAV.js} +3 -2
- package/dist/{chunk-L7JMDDSD.js → chunk-FBOW7XOV.js} +1 -1
- package/dist/{chunk-25CZ5ZIU.js → chunk-FUG2TEKI.js} +1 -1
- package/dist/chunk-FZBCKIJJ.js +1 -0
- package/dist/chunk-HPUAIWIH.js +25 -0
- package/dist/chunk-I5JLCFUX.js +1 -0
- package/dist/chunk-KUPHNMUK.js +2 -0
- package/dist/{chunk-NTYXZ3EL.js → chunk-KVHDMIZS.js} +1 -1
- package/dist/{chunk-QDST6VIU.js → chunk-KZC7TI5M.js} +1 -1
- package/dist/chunk-MIZAFRDR.js +1 -0
- package/dist/chunk-PJPA5EEE.js +2 -0
- package/dist/{chunk-GUTQ3PWL.js → chunk-PLKYHUNT.js} +1 -1
- package/dist/chunk-QEJGED4V.js +28 -0
- package/dist/chunk-SILJ3OL4.js +9 -0
- package/dist/{chunk-VXD6FZP5.js → chunk-TQZBVOTT.js} +3 -3
- package/dist/chunk-VBICI5YA.js +1 -0
- package/dist/chunk-VWW3RLUX.js +12 -0
- package/dist/{chunk-O6LE42GK.js → chunk-WJTHY6AG.js} +1 -1
- package/dist/chunk-YGGKGZO2.js +1 -0
- package/dist/chunk-ZODCBFBL.js +2 -0
- package/dist/chunk-ZPT5D4VP.js +2 -0
- package/dist/entry-0.js +1 -1
- 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-16.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 +1 -1
- 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 +11 -11
- package/dist/entry-33.js +1 -1
- package/dist/entry-37.js +2 -2
- package/dist/entry-42.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +13 -12
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +4 -4
- package/dist/entry-51.js +9 -9
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-55.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-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -0
- package/dist/entry-72.js +0 -1
- package/dist/entry-73.js +1 -0
- package/dist/entry-74.js +0 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +1 -315
- package/dist/entry-78.js +324 -25
- package/dist/entry-79.js +18 -2
- package/dist/entry-80.js +2 -1
- package/dist/entry-81.js +1 -1
- package/dist/entry-82.js +1 -3
- package/dist/entry-83.js +5 -3
- package/dist/entry-84.js +3 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -0
- package/dist/pi-agent-ide.js +15 -3
- package/docs/agent-guides/apply.md +1 -1
- package/docs/agent-guides/editing.md +16 -0
- package/docs/agent-guides/json-reading.md +19 -3
- package/docs/agent-guides/read-resources.md +6 -0
- package/docs/agent-guides/search-code.md +5 -1
- package/docs/agent-guides/terminal.md +1 -1
- package/docs/code-review.md +99 -0
- package/docs/configuration.md +34 -0
- package/docs/development.md +15 -19
- package/docs/nightly.md +7 -0
- package/docs/releases.md +42 -0
- package/docs/research/native-codemode-batch-decision.md +27 -0
- package/docs/research/native-codemode-batching.md +65 -0
- package/docs/structured-results.md +59 -0
- package/docs/tools.md +18 -2
- 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-documentation/src/index.ts +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +6 -1
- package/node_modules/pi-agent-filesystem/package.json +7 -6
- package/node_modules/pi-agent-filesystem/src/path-recovery.ts +109 -0
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- 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 +10 -10
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +6 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +17 -0
- package/node_modules/pi-agent-ide-changes/index.ts +3 -9
- package/node_modules/pi-agent-ide-changes/package.json +8 -7
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +125 -47
- 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/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +19 -0
- 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/tools/read.ts +31 -2
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +216 -0
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +119 -72
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +12 -0
- package/node_modules/pi-agent-resource/src/resource-access.ts +55 -0
- package/node_modules/pi-agent-resource/src/resource-scheduler.ts +204 -0
- package/node_modules/pi-agent-resource/src/tool-result.ts +125 -0
- package/node_modules/pi-agent-search/package.json +5 -4
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/node_modules/pi-agent-search/src/api/search.ts +11 -0
- package/node_modules/pi-agent-search/src/api/structured-result.ts +93 -0
- package/node_modules/pi-agent-search/src/core/extension.ts +40 -14
- package/node_modules/pi-agent-search/src/core/search-core.ts +136 -77
- package/node_modules/pi-agent-search-text/index.ts +3 -0
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/resolvers.ts +17 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +104 -8
- package/node_modules/pi-agent-search-text/src/search-query.ts +42 -34
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +18 -4
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +37 -3
- package/node_modules/pi-agent-search-text/src/search-session.ts +21 -13
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-document.ts +15 -10
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +4 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/index.ts +4 -2
- package/node_modules/pi-agent-text-editor/package.json +21 -17
- package/node_modules/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +95 -34
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +20 -11
- package/node_modules/pi-agent-text-editor/src/core/apply/structured-result.ts +251 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +32 -12
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +154 -132
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +74 -18
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +640 -0
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +314 -0
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +52 -11
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +143 -138
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +242 -116
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +109 -47
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +24 -3
- package/node_modules/pi-agent-text-editor-renderer/index.ts +8 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +7 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +262 -129
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
- package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +16 -1
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +1 -0
- package/node_modules/pi-agent-web/index.ts +20 -0
- package/node_modules/pi-agent-web/package.json +8 -7
- package/node_modules/pi-agent-web/src/search.ts +112 -0
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-87.js +2 -0
- package/package.json +42 -36
- package/skills/capture-code-review-rule/SKILL.md +60 -0
- package/src/code-review/config.ts +68 -0
- package/src/code-review/extension.ts +105 -0
- package/src/code-review/fragments.ts +26 -0
- package/src/code-review/reviewer.ts +198 -0
- package/src/composite/host-version.ts +13 -0
- package/src/composite/nested-tool-rendering.ts +298 -0
- package/src/composite/tool-availability.ts +90 -0
- package/src/core/extension.ts +2 -0
- package/src/documentation/extension.ts +81 -145
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +6 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -6
- 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/package.json +5 -5
- 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-filesystem/src/path-recovery.ts +109 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +20 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-83.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +112 -0
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +31 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +216 -0
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +119 -72
- package/src/extensions/pi-agent-search/package.json +5 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +3 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +17 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +104 -8
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +42 -34
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +18 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +37 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +21 -13
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/src/extensions/pi-agent-search/src/api/search.ts +11 -0
- package/src/extensions/pi-agent-search/src/api/structured-result.ts +93 -0
- package/src/extensions/pi-agent-search/src/core/extension.ts +40 -14
- package/src/extensions/pi-agent-search/src/core/search-core.ts +136 -77
- package/src/extensions/pi-agent-text-editor/index.ts +4 -2
- package/src/extensions/pi-agent-text-editor/package.json +21 -17
- 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/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.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/index.ts +8 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +7 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +262 -129
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +16 -1
- 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-80.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +95 -34
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +20 -11
- package/src/extensions/pi-agent-text-editor/src/core/apply/structured-result.ts +251 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +32 -12
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +154 -132
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +74 -18
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +640 -0
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +314 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +52 -11
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +143 -138
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +242 -116
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +109 -47
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +24 -3
- package/src/pi-agent-ide.ts +61 -2
- package/src/plugins/pi-agent-ide-ast/package.json +10 -10
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +6 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +17 -0
- package/src/plugins/pi-agent-ide-changes/index.ts +3 -9
- package/src/plugins/pi-agent-ide-changes/package.json +8 -7
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +125 -47
- package/src/plugins/pi-agent-ide-debugger/index.ts +63 -17
- package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +18 -2
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +24 -4
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +68 -2
- package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +357 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -3
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +13 -13
- 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/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +19 -0
- package/src/plugins/pi-agent-ide-terminal/index.ts +12 -2
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +65 -30
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +13 -8
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +1 -0
- package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +100 -0
- package/src/plugins/pi-agent-ide-terminal/src/steering.ts +62 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +97 -45
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +3 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +15 -6
- package/src/plugins/pi-agent-ide-vision/index.ts +16 -1
- package/dist/chunk-3E2NTWCN.js +0 -2
- package/dist/chunk-4LUW26BX.js +0 -10
- package/dist/chunk-5VSE5X5R.js +0 -2
- package/dist/chunk-CEX3VOJ7.js +0 -2
- package/dist/chunk-FA6BKC5Y.js +0 -1
- package/dist/chunk-FEDVTZJG.js +0 -1
- package/dist/chunk-HMLH43ZS.js +0 -4
- package/dist/chunk-KII2JQC5.js +0 -1
- package/dist/chunk-LVWMWWWF.js +0 -28
- package/dist/chunk-P7XO5CIP.js +0 -2
- package/dist/chunk-PZFOOHY2.js +0 -15
- package/dist/chunk-S3ZPXWX7.js +0 -2
- package/dist/chunk-T7CZIACQ.js +0 -27
- package/dist/chunk-YT42LKFV.js +0 -16
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
- /package/dist/{chunk-4U2GUKNJ.js → chunk-F7NVAC4Q.js} +0 -0
- /package/dist/{chunk-ROXXK6TW.js → chunk-PXWDDBBC.js} +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-81.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
|
@@ -47,6 +47,7 @@ import { readTextAnchorRecovery } from "#src/core/text-anchor-recovery.js";
|
|
|
47
47
|
import { applyTextChanges, TextChangeDocument } from "#src/core/text-change-engine.js";
|
|
48
48
|
import { resolvedTextAnchorType } from "#src/core/text-anchor-registry.js";
|
|
49
49
|
import { executeTextToolWithBatch } from "#src/core/text-edit-batch-registrar.js";
|
|
50
|
+
import { executeNativeTextEditBatch } from "#src/core/native-text-edit-batch.js";
|
|
50
51
|
import {
|
|
51
52
|
contextualizeTextMutationAnchorError,
|
|
52
53
|
TextMutationAnchorAggregateError,
|
|
@@ -76,6 +77,8 @@ import type { ToolCallAnchorRenderState } from "pi-agent-tool-call-interception"
|
|
|
76
77
|
import type { Static, TSchema } from "typebox";
|
|
77
78
|
import type { ScriptMutationOutcome } from "#src/core/apply/mutation-outcome.js";
|
|
78
79
|
import { executeWholeFileTool, isWholeFileInvocation } from "#src/core/file-operation-tools.js";
|
|
80
|
+
import { EDITING_GUIDELINES } from "#src/core/editing-guidelines.js";
|
|
81
|
+
import { mutationOutputSchema, structuredMutation } from "./structured-result.js";
|
|
79
82
|
|
|
80
83
|
export function createTextTool<TParameters extends TSchema>(
|
|
81
84
|
core: TextEditorCore,
|
|
@@ -90,13 +93,24 @@ export function createTextTool<TParameters extends TSchema>(
|
|
|
90
93
|
const tool = withToolCallInterceptionRendering<TParameters, FileMutationBatchResult, unknown>(
|
|
91
94
|
defineTool<TParameters, FileMutationBatchResult, unknown>({
|
|
92
95
|
name: definition.name,
|
|
96
|
+
exposure: "direct",
|
|
97
|
+
namespace: {
|
|
98
|
+
name: "ide_edit",
|
|
99
|
+
description: "Edit files and live IDE resources with guarded operations.",
|
|
100
|
+
},
|
|
101
|
+
annotations: {
|
|
102
|
+
readOnlyHint: false,
|
|
103
|
+
destructiveHint: true,
|
|
104
|
+
idempotentHint: false,
|
|
105
|
+
openWorldHint: true,
|
|
106
|
+
},
|
|
93
107
|
label: definition.name,
|
|
94
108
|
|
|
95
109
|
promptSnippet: definition.promptSnippet,
|
|
96
|
-
promptGuidelines:
|
|
97
|
-
definition.promptGuidelines === undefined ? undefined : [...definition.promptGuidelines],
|
|
110
|
+
promptGuidelines: [...EDITING_GUIDELINES, ...(definition.promptGuidelines ?? [])],
|
|
98
111
|
description: definition.description,
|
|
99
112
|
parameters: definition.parameters,
|
|
113
|
+
outputSchema: mutationOutputSchema,
|
|
100
114
|
prepareArguments: (arguments_) =>
|
|
101
115
|
// oxlint-disable-next-line typescript/no-unsafe-return -- TypeBox resolves only concrete tool schemas.
|
|
102
116
|
prepareGuardedArguments(
|
|
@@ -119,50 +133,88 @@ export function createTextTool<TParameters extends TSchema>(
|
|
|
119
133
|
),
|
|
120
134
|
}),
|
|
121
135
|
async execute(toolCallId, parameters, signal, onUpdate, context) {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
136
|
+
const captured = await captureScriptMutation(core, async () => {
|
|
137
|
+
const execute = async (): Promise<AgentToolResult<FileMutationBatchResult>> => {
|
|
138
|
+
const input = asMutationParameters<TParameters>(parameters);
|
|
139
|
+
const queued = executeNativeTextEditBatch(
|
|
140
|
+
core,
|
|
141
|
+
toolCallId,
|
|
142
|
+
definition,
|
|
127
143
|
input,
|
|
144
|
+
signal,
|
|
145
|
+
context,
|
|
128
146
|
);
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
147
|
+
if (queued !== undefined) return queued;
|
|
148
|
+
if (definition.direct?.matches(input) === true) {
|
|
149
|
+
try {
|
|
150
|
+
const action = await definition.direct.execute(
|
|
151
|
+
{ cwd: context.cwd, ...(signal !== undefined && { signal }) },
|
|
152
|
+
input,
|
|
153
|
+
);
|
|
154
|
+
return {
|
|
155
|
+
content: [{ type: "text", text: action.summary }],
|
|
156
|
+
details: {
|
|
157
|
+
results: [],
|
|
158
|
+
metadata: { semanticAction: { ...action.data, source: action.source } },
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
} catch (error) {
|
|
162
|
+
const code =
|
|
163
|
+
error !== null && typeof error === "object" && "code" in error
|
|
164
|
+
? String(error.code)
|
|
165
|
+
: "DIRECT_MUTATION_FAILED";
|
|
166
|
+
return failureToolResult(
|
|
167
|
+
"transaction" in input ? String(input.transaction) : "",
|
|
168
|
+
code,
|
|
169
|
+
error instanceof Error ? error.message : String(error),
|
|
170
|
+
"unknown",
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (
|
|
175
|
+
isWholeFileInvocation(definition.wholeFileOperation, input) &&
|
|
176
|
+
core.getSemanticMutationHandler(definition.name, input) === undefined
|
|
177
|
+
) {
|
|
178
|
+
return executeWholeFileTool(
|
|
179
|
+
core,
|
|
180
|
+
definition.wholeFileOperation,
|
|
181
|
+
input,
|
|
182
|
+
signal,
|
|
183
|
+
context,
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
const directExecute = () =>
|
|
187
|
+
executeTextMutation(
|
|
188
|
+
core,
|
|
189
|
+
definition,
|
|
190
|
+
input,
|
|
191
|
+
signal,
|
|
192
|
+
context,
|
|
193
|
+
(field, state) =>
|
|
194
|
+
annotations.resolveArguments(toolCallId, {
|
|
195
|
+
[TOOL_CALL_INTERCEPTION_ANCHOR_RENDER_PATCH]: { [field]: state },
|
|
196
|
+
}),
|
|
197
|
+
getLastResolvedSource(),
|
|
198
|
+
);
|
|
199
|
+
return executeTextToolWithBatch(toolCallId, directExecute, signal, onUpdate, context);
|
|
200
|
+
};
|
|
201
|
+
return execute();
|
|
202
|
+
});
|
|
203
|
+
if (captured.kind === "failed") {
|
|
204
|
+
const failed = failureToolResult(
|
|
205
|
+
"",
|
|
206
|
+
"EXECUTION_FAILED",
|
|
207
|
+
errorMessage(captured.error),
|
|
208
|
+
"unknown",
|
|
164
209
|
);
|
|
165
|
-
|
|
210
|
+
return structuredMutation(failed, definition.name, captured.completions, toolCallId);
|
|
211
|
+
}
|
|
212
|
+
return structuredMutation(
|
|
213
|
+
captured.value,
|
|
214
|
+
definition.name,
|
|
215
|
+
captured.completions,
|
|
216
|
+
toolCallId,
|
|
217
|
+
);
|
|
166
218
|
},
|
|
167
219
|
}),
|
|
168
220
|
annotations,
|
|
@@ -172,6 +224,9 @@ export function createTextTool<TParameters extends TSchema>(
|
|
|
172
224
|
get(): string {
|
|
173
225
|
return [
|
|
174
226
|
definition.description,
|
|
227
|
+
definition.intent !== "restore"
|
|
228
|
+
? "In native Codemode, local text edits share original snapshots and return acceptance before writing. Another tool, whole-file operation, or resource-owned selector ends the batch; script completion also commits it. Ordinary script errors keep accepted edits; aborts and deadlines discard pending edits."
|
|
229
|
+
: "",
|
|
175
230
|
definition.source.inherited
|
|
176
231
|
? definition.wholeFileOperation === undefined
|
|
177
232
|
? `When ${definition.source.field} is omitted, the tool can reuse the file identified by the supplied anchor, the last read, or the preceding edit in the same batch.`
|
|
@@ -968,7 +1023,8 @@ export async function executeTextMutationPipeline<TParameters extends TSchema>(
|
|
|
968
1023
|
|
|
969
1024
|
const scriptMutationScope = new AsyncLocalStorage<TextEditCompletion[]>();
|
|
970
1025
|
|
|
971
|
-
|
|
1026
|
+
/** Capture actual completed effects across a tool or batch, including failed post-edit hooks. */
|
|
1027
|
+
export async function captureScriptMutation<T>(core: TextEditorCore, action: () => Promise<T>) {
|
|
972
1028
|
const completions: TextEditCompletion[] = [];
|
|
973
1029
|
const unsubscribe = core.onDidEdit((completion) => {
|
|
974
1030
|
if (scriptMutationScope.getStore() === completions) completions.push(completion);
|
|
@@ -1379,7 +1435,7 @@ async function anchorFailureToolResult(
|
|
|
1379
1435
|
}
|
|
1380
1436
|
return {
|
|
1381
1437
|
content: [{ type: "text", text: messages.join("\n\n") }],
|
|
1382
|
-
details: { results, anchorRecoveries },
|
|
1438
|
+
details: { results, anchorRecoveries, effect: "not-applied" },
|
|
1383
1439
|
};
|
|
1384
1440
|
}
|
|
1385
1441
|
if (!(failure.cause instanceof TextMutationAnchorResolutionError)) {
|
|
@@ -1436,7 +1492,13 @@ async function anchorFailureToolResult(
|
|
|
1436
1492
|
const result = new FileMutationResult({
|
|
1437
1493
|
ok: false,
|
|
1438
1494
|
path: contextual.source,
|
|
1439
|
-
errors: [
|
|
1495
|
+
errors: [
|
|
1496
|
+
{
|
|
1497
|
+
path: contextual.source,
|
|
1498
|
+
code: resolution.rejection?.code ?? failure.code,
|
|
1499
|
+
reason: resolution.message,
|
|
1500
|
+
},
|
|
1501
|
+
],
|
|
1440
1502
|
});
|
|
1441
1503
|
const recoveryContext = recoveryTexts.join("\n");
|
|
1442
1504
|
const rejectionCode = resolution.rejection?.code;
|
|
@@ -1548,7 +1610,7 @@ function failureToolResult(
|
|
|
1548
1610
|
|
|
1549
1611
|
return {
|
|
1550
1612
|
content: [new FileMutationAgentResult(result).toTextContent()],
|
|
1551
|
-
details: { results: [result], effect }
|
|
1613
|
+
details: { results: [result], effect },
|
|
1552
1614
|
};
|
|
1553
1615
|
}
|
|
1554
1616
|
|
|
@@ -3,6 +3,8 @@ Runtime for intercepting streamed Pi tool calls.
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Allow } from "partial-json";
|
|
6
|
+
import { resultError, withStructuredResult } from "pi-agent-resource";
|
|
7
|
+
import { mutationDataSchema } from "#src/core/structured-result.js";
|
|
6
8
|
import {
|
|
7
9
|
isToolCallAnnotation,
|
|
8
10
|
type ToolCallAnnotation,
|
|
@@ -285,11 +287,29 @@ class InterceptorImpl implements ToolCallInterceptor {
|
|
|
285
287
|
this.toolCallRecords.delete(event.toolCallId);
|
|
286
288
|
|
|
287
289
|
if (guardResult) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
details
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
const details = guardResult.details;
|
|
291
|
+
const effect =
|
|
292
|
+
typeof details === "object" &&
|
|
293
|
+
details !== null &&
|
|
294
|
+
"effect" in details &&
|
|
295
|
+
(details.effect === "not-applied" || details.effect === "applied")
|
|
296
|
+
? details.effect
|
|
297
|
+
: "unknown";
|
|
298
|
+
const message = guardResult.content
|
|
299
|
+
.flatMap((block) => (block.type === "text" ? [block.text] : []))
|
|
300
|
+
.join("\n");
|
|
301
|
+
return withStructuredResult(
|
|
302
|
+
{
|
|
303
|
+
content: guardResult.content,
|
|
304
|
+
details,
|
|
305
|
+
},
|
|
306
|
+
mutationDataSchema,
|
|
307
|
+
{
|
|
308
|
+
status: "error",
|
|
309
|
+
errors: [resultError(message, "INTERCEPTED")],
|
|
310
|
+
data: { operation: event.toolName, operationId: event.toolCallId, effect, files: [] },
|
|
311
|
+
},
|
|
312
|
+
);
|
|
293
313
|
}
|
|
294
314
|
|
|
295
315
|
return;
|
package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts
CHANGED
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
type AssistantMessage,
|
|
4
4
|
type AssistantMessageEvent,
|
|
5
5
|
type AssistantMessageEventStream,
|
|
6
|
-
type
|
|
6
|
+
type TranscriptContext,
|
|
7
|
+
type ToolCall,
|
|
7
8
|
createAssistantMessageEventStream,
|
|
8
9
|
type Model,
|
|
9
10
|
type SimpleStreamOptions,
|
|
@@ -14,7 +15,7 @@ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-a
|
|
|
14
15
|
|
|
15
16
|
type StreamSimple = (
|
|
16
17
|
model: Model<Api>,
|
|
17
|
-
context:
|
|
18
|
+
context: TranscriptContext,
|
|
18
19
|
options?: SimpleStreamOptions,
|
|
19
20
|
) => AssistantMessageEventStream;
|
|
20
21
|
|
|
@@ -174,7 +175,7 @@ export function registerStreamingInterceptorProvider(
|
|
|
174
175
|
function wrapStream(
|
|
175
176
|
delegate: StreamSimple,
|
|
176
177
|
model: Model<Api>,
|
|
177
|
-
context:
|
|
178
|
+
context: TranscriptContext,
|
|
178
179
|
options: SimpleStreamOptions | undefined,
|
|
179
180
|
subscribers: ReadonlySet<StreamingSubscriber>,
|
|
180
181
|
): AssistantMessageEventStream {
|
|
@@ -266,7 +267,10 @@ function wrapStream(
|
|
|
266
267
|
)
|
|
267
268
|
.map((block) =>
|
|
268
269
|
block.type === "toolCall" && block.id === interception.toolCallId
|
|
269
|
-
? {
|
|
270
|
+
? {
|
|
271
|
+
...block,
|
|
272
|
+
arguments: structuredClone(interception.arguments) as ToolCall["arguments"],
|
|
273
|
+
}
|
|
270
274
|
: block,
|
|
271
275
|
),
|
|
272
276
|
};
|
|
@@ -172,6 +172,7 @@ export function insertionAfterAnchor(
|
|
|
172
172
|
anchors: ReadonlyMap<string, TextAnchor>,
|
|
173
173
|
field: string,
|
|
174
174
|
insert: string,
|
|
175
|
+
separation: "line" | "blank-line" = "line",
|
|
175
176
|
): readonly [string, { readonly from: number; readonly to: number; readonly insert: string }] {
|
|
176
177
|
const span = singleAnchorSpan(context, anchors, field, true);
|
|
177
178
|
const normalizedInsert = targetText(context, span.source, insert);
|
|
@@ -179,7 +180,7 @@ export function insertionAfterAnchor(
|
|
|
179
180
|
const lineNumber = span.linewiseEndLine ?? lineAnchor(anchors, field).lineNumber;
|
|
180
181
|
return [
|
|
181
182
|
span.source,
|
|
182
|
-
context.documentFor(span.source).insertAfterLine(lineNumber, normalizedInsert),
|
|
183
|
+
context.documentFor(span.source).insertAfterLine(lineNumber, normalizedInsert, separation),
|
|
183
184
|
];
|
|
184
185
|
}
|
|
185
186
|
|
|
@@ -189,6 +190,7 @@ export function insertionBeforeAnchor(
|
|
|
189
190
|
anchors: ReadonlyMap<string, TextAnchor>,
|
|
190
191
|
field: string,
|
|
191
192
|
insert: string,
|
|
193
|
+
separation: "line" | "blank-line" = "line",
|
|
192
194
|
): readonly [string, { readonly from: number; readonly to: number; readonly insert: string }] {
|
|
193
195
|
const span = singleAnchorSpan(context, anchors, field, true);
|
|
194
196
|
const normalizedInsert = targetText(context, span.source, insert);
|
|
@@ -196,7 +198,7 @@ export function insertionBeforeAnchor(
|
|
|
196
198
|
const lineNumber = span.linewiseStartLine ?? lineAnchor(anchors, field).lineNumber;
|
|
197
199
|
return [
|
|
198
200
|
span.source,
|
|
199
|
-
context.documentFor(span.source).insertBeforeLine(lineNumber, normalizedInsert),
|
|
201
|
+
context.documentFor(span.source).insertBeforeLine(lineNumber, normalizedInsert, separation),
|
|
200
202
|
];
|
|
201
203
|
}
|
|
202
204
|
|
|
@@ -256,6 +258,7 @@ export function insertionChanges(
|
|
|
256
258
|
selections: ReadonlyMap<string, TextSelectionAnchor>,
|
|
257
259
|
insert: string,
|
|
258
260
|
before = false,
|
|
261
|
+
separation: "line" | "blank-line" = "line",
|
|
259
262
|
): ReadonlyMap<
|
|
260
263
|
string,
|
|
261
264
|
readonly { readonly from: number; readonly to: number; readonly insert: string }[]
|
|
@@ -274,8 +277,8 @@ export function insertionChanges(
|
|
|
274
277
|
const document = context.documentFor(source);
|
|
275
278
|
const normalizedInsert = targetText(context, source, insert);
|
|
276
279
|
return before
|
|
277
|
-
? document.insertBeforeLine(line, normalizedInsert)
|
|
278
|
-
: document.insertAfterLine(line, normalizedInsert);
|
|
280
|
+
? document.insertBeforeLine(line, normalizedInsert, separation)
|
|
281
|
+
: document.insertAfterLine(line, normalizedInsert, separation);
|
|
279
282
|
}),
|
|
280
283
|
]),
|
|
281
284
|
);
|
|
@@ -25,9 +25,16 @@ export const insertSchema = Type.Object(
|
|
|
25
25
|
}),
|
|
26
26
|
),
|
|
27
27
|
text: Type.String({
|
|
28
|
+
minLength: 1,
|
|
28
29
|
description:
|
|
29
|
-
"New text only. The tool supplies the line boundary; do not prefix a newline just to start a new line. For example, 'NEW' inserts one line, while '\\nNEW' intentionally adds a blank line before it. A missing trailing newline is supplied before following text; additional newlines remain intentional blank lines. When appending after an unterminated final line, the tool supplies the separator before the new text
|
|
30
|
+
"New text only. The tool supplies the line boundary; do not prefix a newline just to start a new line. For example, 'NEW' inserts one line, while '\\nNEW' intentionally adds a blank line before it. A missing trailing newline is supplied before following text; additional newlines remain intentional blank lines. When appending after an unterminated final line, the tool supplies the separator before the new text without removing trailing newlines from the payload. Payload line endings follow the destination file's LF/CRLF style.",
|
|
30
31
|
}),
|
|
32
|
+
separation: Type.Optional(
|
|
33
|
+
Type.Union([Type.Literal("line"), Type.Literal("blank-line")], {
|
|
34
|
+
description:
|
|
35
|
+
"Defaults to line. Use blank-line to add only missing blank lines between the inserted block and existing neighboring content; explicit payload newlines remain intact.",
|
|
36
|
+
}),
|
|
37
|
+
),
|
|
31
38
|
before: Type.Optional(
|
|
32
39
|
Type.Boolean({
|
|
33
40
|
description:
|
|
@@ -42,6 +49,7 @@ interface InsertParameters {
|
|
|
42
49
|
readonly path?: string;
|
|
43
50
|
readonly anchor?: string;
|
|
44
51
|
readonly text: string;
|
|
52
|
+
readonly separation?: "line" | "blank-line";
|
|
45
53
|
readonly before?: boolean;
|
|
46
54
|
}
|
|
47
55
|
|
|
@@ -62,11 +70,18 @@ export const insertMutationTool: TextMutationToolRegistration<typeof insertSchem
|
|
|
62
70
|
},
|
|
63
71
|
],
|
|
64
72
|
mutate: async (context, parameters: InsertParameters) => {
|
|
73
|
+
if (parameters.text.length === 0) throw new Error("Insert text must not be empty.");
|
|
65
74
|
const anchors = await context.resolveAnchors("anchor");
|
|
66
75
|
const selections = textSelections(anchors, "anchor");
|
|
67
76
|
|
|
68
77
|
if (selections !== undefined) {
|
|
69
|
-
const changes = insertionChanges(
|
|
78
|
+
const changes = insertionChanges(
|
|
79
|
+
context,
|
|
80
|
+
selections,
|
|
81
|
+
parameters.text,
|
|
82
|
+
parameters.before,
|
|
83
|
+
parameters.separation,
|
|
84
|
+
);
|
|
70
85
|
return {
|
|
71
86
|
edits: new Map(
|
|
72
87
|
[...changes].map(([source, sourceChanges]) => [
|
|
@@ -78,7 +93,13 @@ export const insertMutationTool: TextMutationToolRegistration<typeof insertSchem
|
|
|
78
93
|
}
|
|
79
94
|
|
|
80
95
|
const insertion = parameters.before === true ? insertionBeforeAnchor : insertionAfterAnchor;
|
|
81
|
-
const [source, change] = insertion(
|
|
96
|
+
const [source, change] = insertion(
|
|
97
|
+
context,
|
|
98
|
+
anchors,
|
|
99
|
+
"anchor",
|
|
100
|
+
parameters.text,
|
|
101
|
+
parameters.separation,
|
|
102
|
+
);
|
|
82
103
|
return {
|
|
83
104
|
edits: new Map([[source, { changes: [change], action: "edited" }]]),
|
|
84
105
|
};
|
|
@@ -32,6 +32,12 @@ export default async function registerTextEditorRenderer(
|
|
|
32
32
|
const applyPresentation = parsePresentation(context?.preferences["ui.applyPreview"]);
|
|
33
33
|
const diffPresentation = parsePresentation(context?.preferences["ui.diffs"]);
|
|
34
34
|
const animationPressure = createMutationAnimationPressure(pi);
|
|
35
|
+
let animationsEnabled = pi.getFlag("pi-agent-ide-no-animations") !== true;
|
|
36
|
+
const refreshAnimations = () => {
|
|
37
|
+
animationsEnabled = pi.getFlag("pi-agent-ide-no-animations") !== true;
|
|
38
|
+
};
|
|
39
|
+
pi.on("session_start", refreshAnimations);
|
|
40
|
+
pi.on("before_agent_start", refreshAnimations);
|
|
35
41
|
const plugin = {
|
|
36
42
|
protocol: TEXT_EDITOR_PROTOCOL,
|
|
37
43
|
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
@@ -129,7 +135,8 @@ export default async function registerTextEditorRenderer(
|
|
|
129
135
|
registerMutationRenderers(
|
|
130
136
|
api,
|
|
131
137
|
animationPressure,
|
|
132
|
-
|
|
138
|
+
// Completed panels can be redrawn after Pi has invalidated the extension API.
|
|
139
|
+
() => animationsEnabled,
|
|
133
140
|
diffPresentation,
|
|
134
141
|
);
|
|
135
142
|
pi.on("tool_result", (event) => {
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-renderer",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"diff": "^9.0.0",
|
|
10
|
-
"pi-agent-invariant": "0.6.
|
|
11
|
-
"pi-agent-text-editor": "0.6.
|
|
12
|
-
"pi-agent-tool-call-interception": "0.6.
|
|
13
|
-
"pi-agent-tool-ui": "0.6.
|
|
10
|
+
"pi-agent-invariant": "0.6.4",
|
|
11
|
+
"pi-agent-text-editor": "0.6.4",
|
|
12
|
+
"pi-agent-tool-call-interception": "0.6.4",
|
|
13
|
+
"pi-agent-tool-ui": "0.6.4",
|
|
14
|
+
"vscode-diff": "3.0.1"
|
|
14
15
|
},
|
|
15
16
|
"pi": {
|
|
16
17
|
"extensions": [
|
|
17
|
-
"./runtime/entry-
|
|
18
|
+
"./runtime/entry-79.js"
|
|
18
19
|
]
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|