pi-agent-ide 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/chunk-6U5OU77O.js +3 -0
- package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
- package/dist/chunk-EURHXLN3.js +2 -0
- package/dist/{chunk-PYPPV2F5.js → chunk-F6IWZKOG.js} +6 -6
- package/dist/{chunk-GBLKIB6O.js → chunk-H445SHSJ.js} +2 -2
- package/dist/chunk-IG56UGSO.js +2 -0
- package/dist/chunk-IICJXZBU.js +6 -0
- package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
- package/dist/{chunk-YRF7OATP.js → chunk-KOVPDKSJ.js} +1 -1
- package/dist/chunk-MXLSGMRZ.js +3 -0
- package/dist/chunk-NRZO5KJT.js +9 -0
- package/dist/chunk-OB46OPMZ.js +1 -0
- package/dist/chunk-PKSQT6TC.js +1 -0
- package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
- package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
- package/dist/chunk-QUYXINGZ.js +7 -0
- package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
- package/dist/chunk-SBP3ABH4.js +5 -0
- package/dist/{chunk-FXNKMNSJ.js → chunk-SJ4UZ4GU.js} +1 -1
- package/dist/chunk-SNF7PDDX.js +11 -0
- package/dist/{chunk-AJRIASPQ.js → chunk-STBJO3Z3.js} +1 -1
- package/dist/{chunk-3HYXQ4YA.js → chunk-TQGE7RH6.js} +13 -13
- package/dist/{chunk-S5LXX32D.js → chunk-XDG7EQRN.js} +3 -3
- package/dist/{chunk-F5YZG77W.js → chunk-XH5WN5XA.js} +1 -1
- package/dist/chunk-YWQS33DF.js +1 -0
- package/dist/chunk-ZIWPKIBZ.js +1 -0
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +2 -2
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +2 -2
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-31.js +15 -13
- package/dist/entry-33.js +2 -1
- package/dist/entry-37.js +6 -6
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +20 -13
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +8 -7
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-77.js +51 -43
- package/dist/entry-78.js +14 -14
- package/dist/entry-79.js +1 -1
- package/dist/entry-80.js +1 -1
- package/dist/entry-82.js +5 -5
- package/dist/entry-83.js +1 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/pi-agent-ide.js +37 -9
- package/docs/agent-guides/editing.md +35 -46
- package/docs/agent-guides/git-changes.md +10 -0
- package/docs/agent-guides/read-resources.md +9 -50
- package/docs/agent-guides/search-code.md +18 -17
- package/docs/agent-guides/select-code.md +62 -140
- package/docs/agent-guides/terminal.md +9 -1
- package/docs/configuration.md +1 -1
- package/docs/releases.md +4 -0
- package/docs/research/native-codemode-batch-decision.md +2 -0
- package/docs/structured-results.md +27 -62
- package/docs/tools.md +15 -11
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +7 -6
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/index.ts +4 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +13 -13
- package/node_modules/pi-agent-ide-ast/src/extension.ts +5 -4
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +35 -9
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +10 -8
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +28 -3
- package/node_modules/pi-agent-ide-changes/index.ts +4 -3
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/index.ts +3 -3
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +38 -1
- package/node_modules/pi-agent-read/src/api/tools/read.ts +18 -1
- package/node_modules/pi-agent-read/src/core/extension.ts +8 -2
- package/node_modules/pi-agent-read/src/core/read-core.ts +54 -35
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +108 -46
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +1 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +186 -9
- package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
- package/node_modules/pi-agent-resource/src/tool-result.ts +13 -1
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +3 -3
- package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
- package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
- package/node_modules/pi-agent-search-text/index.ts +1 -1
- package/node_modules/pi-agent-search-text/package.json +7 -7
- package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/index.ts +65 -4
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/package.json +9 -9
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +10 -3
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +3 -13
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +49 -214
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- package/node_modules/pi-agent-web/index.ts +4 -3
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/src/resolver.ts +11 -13
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-image/package.json +3 -3
- package/node_modules/pi-agent-web-pdf/package.json +3 -3
- package/node_modules/pi-agent-web-text/package.json +3 -3
- package/package.json +35 -35
- package/src/composite/nested-tool-rendering.ts +64 -6
- package/src/composite/output-limits.ts +125 -0
- package/src/composite/responses-tools.ts +25 -0
- package/src/composite/text-results.ts +372 -0
- package/src/documentation/extension.ts +11 -9
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +7 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +4 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +4 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +38 -1
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +18 -1
- package/src/extensions/pi-agent-read/src/core/extension.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/read-core.ts +54 -35
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +108 -46
- package/src/extensions/pi-agent-search/package.json +5 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +3 -3
- package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
- package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
- package/src/extensions/pi-agent-text-editor/package.json +9 -9
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +65 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +10 -3
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +3 -13
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +49 -214
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/src/pi-agent-ide.ts +15 -1
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +5 -4
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +35 -9
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +10 -8
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +28 -3
- package/src/plugins/pi-agent-ide-changes/index.ts +4 -3
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- package/src/plugins/pi-agent-ide-debugger/index.ts +22 -10
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +6 -3
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/index.ts +3 -3
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
- package/src/plugins/pi-agent-ide-vision/index.ts +13 -4
- package/src/post-edit/gate.ts +13 -2
- package/dist/chunk-3JO7QFIL.js +0 -1
- package/dist/chunk-4NIFBFFR.js +0 -11
- package/dist/chunk-64M3SQPG.js +0 -3
- package/dist/chunk-7LZKOHH2.js +0 -1
- package/dist/chunk-EAZGN5ND.js +0 -7
- package/dist/chunk-FK42RSF4.js +0 -1
- package/dist/chunk-KBP3QUDT.js +0 -2
- package/dist/chunk-KR36BT5E.js +0 -1
- package/dist/chunk-MBUXFKIW.js +0 -3
- package/dist/chunk-OE7QVAI2.js +0 -5
- package/dist/chunk-SILJ3OL4.js +0 -9
- package/dist/chunk-SQKAXYIR.js +0 -2
- package/dist/chunk-VCGNVTXQ.js +0 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
|
@@ -36,12 +36,13 @@ export default async function registerFilesystemPlugin(pi: ExtensionAPI): Promis
|
|
|
36
36
|
renderResult: renderReadResult,
|
|
37
37
|
recoverFailure: recoverFilesystemPath,
|
|
38
38
|
});
|
|
39
|
-
api.describe(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
api.describe({
|
|
40
|
+
path: () =>
|
|
41
|
+
renderContentDescription(
|
|
42
|
+
"File path — file content; directory path — entry listing. Relative, absolute and file:// paths accepted.",
|
|
43
|
+
readHost.listDescriptions(),
|
|
44
|
+
),
|
|
45
|
+
});
|
|
45
46
|
},
|
|
46
47
|
} satisfies ReadPlugin;
|
|
47
48
|
const textEditorPlugin = {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.7.
|
|
10
|
-
"pi-agent-invariant": "0.7.
|
|
11
|
-
"pi-agent-read": "0.7.
|
|
12
|
-
"pi-agent-resource": "0.7.
|
|
13
|
-
"pi-agent-text": "0.7.
|
|
14
|
-
"pi-agent-text-editor": "0.7.
|
|
9
|
+
"pi-agent-image": "0.7.2",
|
|
10
|
+
"pi-agent-invariant": "0.7.2",
|
|
11
|
+
"pi-agent-read": "0.7.2",
|
|
12
|
+
"pi-agent-resource": "0.7.2",
|
|
13
|
+
"pi-agent-text": "0.7.2",
|
|
14
|
+
"pi-agent-text-editor": "0.7.2"
|
|
15
15
|
},
|
|
16
16
|
"pi": {
|
|
17
17
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.7.
|
|
10
|
-
"pi-agent-resource": "0.7.
|
|
9
|
+
"pi-agent-image": "0.7.2",
|
|
10
|
+
"pi-agent-resource": "0.7.2"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -71,9 +71,10 @@ const readPlugin = {
|
|
|
71
71
|
return { kind: "continue", context: { ...context, state: transformed } };
|
|
72
72
|
},
|
|
73
73
|
});
|
|
74
|
-
api.describe(
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
api.describe({
|
|
75
|
+
views:
|
|
76
|
+
'jq:<filter> — query local JSON text with the installed jq executable, e.g. ["jq:.scripts | keys"]. Exactly one non-empty jq filter is required; it cannot be combined with other views. offset/limit apply to the transformed output, not original source lines.',
|
|
77
|
+
});
|
|
77
78
|
},
|
|
78
79
|
} satisfies ReadPlugin;
|
|
79
80
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-jq",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"cross-spawn": "^7.0.6",
|
|
10
|
-
"pi-agent-doctor": "0.7.
|
|
11
|
-
"pi-agent-documentation": "0.7.
|
|
12
|
-
"pi-agent-read": "0.7.
|
|
13
|
-
"pi-agent-text": "0.7.
|
|
10
|
+
"pi-agent-doctor": "0.7.2",
|
|
11
|
+
"pi-agent-documentation": "0.7.2",
|
|
12
|
+
"pi-agent-read": "0.7.2",
|
|
13
|
+
"pi-agent-text": "0.7.2"
|
|
14
14
|
},
|
|
15
15
|
"pi": {
|
|
16
16
|
"extensions": [
|
|
@@ -16,7 +16,10 @@ export function parseJqView(views: readonly string[] | undefined): JqView | unde
|
|
|
16
16
|
const jqViews = views?.filter((view) => view === "jq" || view.startsWith("jq:")) ?? [];
|
|
17
17
|
if (jqViews.length === 0) return undefined;
|
|
18
18
|
if (jqViews.length > 1) throw new Error("Read accepts only one jq view");
|
|
19
|
-
if (views?.length !== 1)
|
|
19
|
+
if (views?.length !== 1)
|
|
20
|
+
throw new Error(
|
|
21
|
+
"The jq view cannot be combined with other views. Keep only one jq:<filter> in views.",
|
|
22
|
+
);
|
|
20
23
|
const selected = jqViews[0];
|
|
21
24
|
if (selected === undefined || selected === "jq" || selected.slice(3).trim().length === 0)
|
|
22
25
|
throw new Error('The jq view requires a filter, for example views: ["jq:.scripts"]');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.7.
|
|
7
|
-
"pi-agent-resource": "0.7.
|
|
6
|
+
"pi-agent-pdf": "0.7.2",
|
|
7
|
+
"pi-agent-resource": "0.7.2"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.7.
|
|
10
|
-
"pi-agent-text": "0.7.
|
|
9
|
+
"pi-agent-resource": "0.7.2",
|
|
10
|
+
"pi-agent-text": "0.7.2"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-ast",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"@tree-sitter-grammars/tree-sitter-toml": "^0.7.0",
|
|
32
32
|
"@tree-sitter-grammars/tree-sitter-yaml": "^0.7.1",
|
|
33
33
|
"cross-spawn": "^7.0.6",
|
|
34
|
-
"pi-agent-doctor": "0.7.
|
|
35
|
-
"pi-agent-documentation": "0.7.
|
|
36
|
-
"pi-agent-invariant": "0.7.
|
|
37
|
-
"pi-agent-read": "0.7.
|
|
38
|
-
"pi-agent-resource": "0.7.
|
|
39
|
-
"pi-agent-search": "0.7.
|
|
40
|
-
"pi-agent-search-text": "0.7.
|
|
41
|
-
"pi-agent-text": "0.7.
|
|
42
|
-
"pi-agent-text-editor": "0.7.
|
|
43
|
-
"pi-agent-tool-call-interception": "0.7.
|
|
44
|
-
"pi-agent-tool-ui": "0.7.
|
|
34
|
+
"pi-agent-doctor": "0.7.2",
|
|
35
|
+
"pi-agent-documentation": "0.7.2",
|
|
36
|
+
"pi-agent-invariant": "0.7.2",
|
|
37
|
+
"pi-agent-read": "0.7.2",
|
|
38
|
+
"pi-agent-resource": "0.7.2",
|
|
39
|
+
"pi-agent-search": "0.7.2",
|
|
40
|
+
"pi-agent-search-text": "0.7.2",
|
|
41
|
+
"pi-agent-text": "0.7.2",
|
|
42
|
+
"pi-agent-text-editor": "0.7.2",
|
|
43
|
+
"pi-agent-tool-call-interception": "0.7.2",
|
|
44
|
+
"pi-agent-tool-ui": "0.7.2",
|
|
45
45
|
"tree-sitter-cpp": "^0.23.4",
|
|
46
46
|
"tree-sitter-javascript": "^0.25.0",
|
|
47
47
|
"tree-sitter-json": "^0.24.8",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@earendil-works/pi-coding-agent": "*",
|
|
60
60
|
"@earendil-works/pi-tui": "*",
|
|
61
|
-
"pi-agent-ide": "0.7.
|
|
61
|
+
"pi-agent-ide": "0.7.2",
|
|
62
62
|
"typebox": "*"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|
|
@@ -55,9 +55,10 @@ export default async function registerAst(pi: ExtensionAPI): Promise<void> {
|
|
|
55
55
|
return result.kind === "return" ? result : scopes(result.context);
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
|
-
api.describe(
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
api.describe({
|
|
59
|
+
path: "ast:<path> — compact declaration outline for a code file.",
|
|
60
|
+
views: "ast — scope boundaries alongside source text.",
|
|
61
|
+
});
|
|
61
62
|
await registerSelect(pi, api);
|
|
62
63
|
},
|
|
63
64
|
} satisfies ReadPlugin;
|
|
@@ -86,7 +87,7 @@ export default async function registerAst(pi: ExtensionAPI): Promise<void> {
|
|
|
86
87
|
setup(api): void {
|
|
87
88
|
api.addResolver({ resolver: createAstSearchResolver(api.registerSelection) });
|
|
88
89
|
api.describe(
|
|
89
|
-
"Search code structure with ast:<pattern>, using source-code syntax and placeholders such as $NAME for one node and $$$BODY for several nodes. path, include and exclude narrow the search. Use returned SEARCH# references to read, replace, copy, move or delete exact AST matches, including multiline nodes. A single :match reference becomes stale after its file changes; :all:match reruns the original structural query. Incomplete results do not provide all selections. Use
|
|
90
|
+
"Search code structure with ast:<pattern>, using source-code syntax and placeholders such as $NAME for one node and $$$BODY for several nodes. path, include and exclude narrow the search. Use returned SEARCH# references to read, replace, copy, move or delete exact AST matches, including multiline nodes. A single :match reference becomes stale after its file changes; :all:match reruns the original structural query. Incomplete results do not provide all selections. Use the displayed capture NAME reference as a Search/Select/edit source. Single captures contain one node; multi captures retain provider nodes, including punctuation. Strict result scopes return only wholly contained matches. These edits do not update imports or references.",
|
|
90
91
|
);
|
|
91
92
|
},
|
|
92
93
|
}),
|
|
@@ -22,8 +22,8 @@ export const reduceAstReadOutput: ReadOutputReducer = async (result, context, bu
|
|
|
22
22
|
if (!isSupportedOutlinePath(source)) return undefined;
|
|
23
23
|
const format = (outline: SourceViewBlock): string =>
|
|
24
24
|
[
|
|
25
|
-
`
|
|
26
|
-
|
|
25
|
+
`Code overview of ${outline.path}, source lines 1-${outline.totalLines}: the requested text exceeded the output limit.`,
|
|
26
|
+
`Some source text is omitted. Read ${JSON.stringify(source)} with offset and limit for exact source text.`,
|
|
27
27
|
...outline.renderedLines.map(
|
|
28
28
|
(line) => `${line.sourceLine?.lineNumber ?? "…"} | ${line.text}`,
|
|
29
29
|
),
|
|
@@ -109,6 +109,7 @@ export function createAstSearchResolver(
|
|
|
109
109
|
);
|
|
110
110
|
const data = selectionData(selected.matches, selected.complete, session.id, session);
|
|
111
111
|
const captures: Record<string, ReturnType<typeof selectionData>["matches"]>[] = [];
|
|
112
|
+
const captureGroups: Record<string, { target: string; nodes: number }>[] = [];
|
|
112
113
|
for (const raw of selected.raw.slice(0, data.matches.length)) {
|
|
113
114
|
const groups = Object.entries({
|
|
114
115
|
...Object.fromEntries(
|
|
@@ -117,6 +118,7 @@ export function createAstSearchResolver(
|
|
|
117
118
|
...raw.metaVariables?.multi,
|
|
118
119
|
});
|
|
119
120
|
const projected = [];
|
|
121
|
+
const groupsForMatch: Record<string, { target: string; nodes: number }> = {};
|
|
120
122
|
for (const [name, nodes] of groups) {
|
|
121
123
|
for (const node of nodes) {
|
|
122
124
|
if (
|
|
@@ -130,6 +132,23 @@ export function createAstSearchResolver(
|
|
|
130
132
|
context.cwd,
|
|
131
133
|
context.signal,
|
|
132
134
|
);
|
|
135
|
+
const group = await registerSelection(
|
|
136
|
+
{
|
|
137
|
+
request,
|
|
138
|
+
matches,
|
|
139
|
+
complete: selected.complete,
|
|
140
|
+
refresh: async () => {
|
|
141
|
+
throw new Error("Capture snapshots cannot refresh; repeat the AST search.");
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
context,
|
|
145
|
+
);
|
|
146
|
+
groupsForMatch[name] = {
|
|
147
|
+
target: requiredValue(
|
|
148
|
+
selectionData(matches, selected.complete, undefined, group).target,
|
|
149
|
+
),
|
|
150
|
+
nodes: matches.length,
|
|
151
|
+
};
|
|
133
152
|
const nodesData: ReturnType<typeof selectionData>["matches"] = [];
|
|
134
153
|
// Shared Search previews hold 100 nodes. Register every capture chunk without dropping nodes.
|
|
135
154
|
for (let offset = 0; offset < matches.length; offset += 100) {
|
|
@@ -150,6 +169,7 @@ export function createAstSearchResolver(
|
|
|
150
169
|
projected.push([name, nodesData] as const);
|
|
151
170
|
}
|
|
152
171
|
captures.push(Object.fromEntries(projected));
|
|
172
|
+
captureGroups.push(groupsForMatch);
|
|
153
173
|
}
|
|
154
174
|
if (context.scope !== undefined) await verifyResultTargets(context.scope, context.signal);
|
|
155
175
|
return {
|
|
@@ -159,6 +179,7 @@ export function createAstSearchResolver(
|
|
|
159
179
|
...data,
|
|
160
180
|
matches: data.matches.map((match, index) => ({ ...match, captures: captures[index] })),
|
|
161
181
|
},
|
|
182
|
+
captureGroups,
|
|
162
183
|
pattern,
|
|
163
184
|
matches: selected.raw.map((match, index) => ({
|
|
164
185
|
...match,
|
|
@@ -181,7 +202,11 @@ export function createAstSearchResolver(
|
|
|
181
202
|
},
|
|
182
203
|
format(payload) {
|
|
183
204
|
const result = payload as {
|
|
205
|
+
readonly data: {
|
|
206
|
+
matches: { captures?: Record<string, ReturnType<typeof selectionData>["matches"]> }[];
|
|
207
|
+
};
|
|
184
208
|
readonly pattern: string;
|
|
209
|
+
readonly captureGroups: Record<string, { target: string; nodes: number }>[];
|
|
185
210
|
readonly sessionId: string;
|
|
186
211
|
readonly matches: readonly AstGrepMatch[];
|
|
187
212
|
readonly complete: boolean;
|
|
@@ -195,18 +220,19 @@ export function createAstSearchResolver(
|
|
|
195
220
|
};
|
|
196
221
|
}
|
|
197
222
|
|
|
198
|
-
const lines = result.matches.flatMap((match, index) =>
|
|
199
|
-
|
|
200
|
-
match.range.start.column + 1
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
223
|
+
const lines = result.matches.flatMap((match, index) => {
|
|
224
|
+
const rows = [
|
|
225
|
+
`SEARCH#${result.sessionId}:${index + 1}:match ${match.file}:${match.range.start.line + 1}:${match.range.start.column + 1} ${match.language}`,
|
|
226
|
+
` ${match.lines.trim()}`,
|
|
227
|
+
];
|
|
228
|
+
for (const [name, group] of Object.entries(result.captureGroups[index] ?? {})) {
|
|
229
|
+
rows.push(` capture ${name}: ${group.target} ${group.nodes} node(s)`);
|
|
230
|
+
}
|
|
231
|
+
return rows;
|
|
232
|
+
});
|
|
204
233
|
|
|
205
234
|
if (result.complete)
|
|
206
235
|
lines.unshift(`SEARCH#${result.sessionId}:all:match selects all exact AST matches.`);
|
|
207
|
-
if (!result.complete) {
|
|
208
|
-
lines.push("Result limit reached.");
|
|
209
|
-
}
|
|
210
236
|
|
|
211
237
|
return {
|
|
212
238
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
@@ -120,7 +120,7 @@ function scopedOperation<const Kind extends "within" | "intersection" | "differe
|
|
|
120
120
|
scopes: {
|
|
121
121
|
...resultInputSchema,
|
|
122
122
|
description:
|
|
123
|
-
"Comparison scopes:
|
|
123
|
+
"Comparison scopes: unchanged results, issued UUIDs or item references, arrays of those strings, or a readable source path. Match sets by source, not array position.",
|
|
124
124
|
},
|
|
125
125
|
},
|
|
126
126
|
{ additionalProperties: false, description },
|
|
@@ -211,7 +211,7 @@ const structuralOperationSchema = Type.Union([
|
|
|
211
211
|
{
|
|
212
212
|
additionalProperties: false,
|
|
213
213
|
description:
|
|
214
|
-
"Select an exact direct JS/TS call argument or parenthesized function parameter. inside keeps the element; around includes owned comma/whitespace.
|
|
214
|
+
"Select an exact direct JS/TS call argument or parenthesized function parameter. inside keeps the element; around includes owned comma/whitespace. around includes the following gap; the last element without a trailing comma includes the preceding gap, and an only element includes the whole list interior. Adjacent boundary comments reject around. No destination syntax repair.",
|
|
215
215
|
},
|
|
216
216
|
),
|
|
217
217
|
Type.Object(
|
|
@@ -287,13 +287,15 @@ export const selectSchema = Type.Object(
|
|
|
287
287
|
path: {
|
|
288
288
|
...resultInputSchema,
|
|
289
289
|
description:
|
|
290
|
-
"
|
|
290
|
+
"File path, unchanged Read/Search/Select/edit result, its UUID, or an array of such results. Pass the whole result; do not rebuild it from preview text.",
|
|
291
291
|
},
|
|
292
|
-
operation: Type.Union(
|
|
293
|
-
structuralOperationSchema,
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
operation: Type.Union(
|
|
293
|
+
[structuralOperationSchema, textOperationSchema, geometryOperationSchema],
|
|
294
|
+
{
|
|
295
|
+
description:
|
|
296
|
+
"Choose a text, syntax or range-set operation. Text operations apply separately to each input region; range/lines require one source. Use UTF-16 bounds that do not split surrogate pairs or CRLF. Range-set operations match sources and snapshots, not array positions.",
|
|
297
|
+
},
|
|
298
|
+
),
|
|
297
299
|
},
|
|
298
300
|
{ additionalProperties: false },
|
|
299
301
|
);
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
withToolCallInterceptionRendering,
|
|
10
10
|
} from "pi-agent-tool-call-interception";
|
|
11
11
|
import { selectPresentation } from "./select-presentation.js";
|
|
12
|
+
|
|
12
13
|
import { selectStructuralRegions } from "./ast/selection.js";
|
|
13
14
|
import { publicRange } from "./selection-region.js";
|
|
14
15
|
import { selectTextRegions } from "./text-selection.js";
|
|
@@ -21,6 +22,27 @@ import {
|
|
|
21
22
|
type SelectParameters,
|
|
22
23
|
type GeometrySelectOperation,
|
|
23
24
|
} from "./select-schema.js";
|
|
25
|
+
/** Show selected text and opaque item references, never the internal selection record. */
|
|
26
|
+
function selectionText(data: SelectionData): string {
|
|
27
|
+
const rows = [`${data.totalItems} selection(s)${data.complete ? "" : " · incomplete input"}`];
|
|
28
|
+
if (!data.complete)
|
|
29
|
+
rows.push("Obtain complete source selections before checking absence or editing.");
|
|
30
|
+
if (data.missingInputs) rows.push(`${data.missingInputs} input range(s) produced no selection`);
|
|
31
|
+
for (const item of data.items) {
|
|
32
|
+
const range = item.range;
|
|
33
|
+
rows.push(
|
|
34
|
+
`${item.target} ${item.source}:${range.startLine}:${range.startColumn}–${range.endLine}:${range.endColumn}${item.syntax ? ` ${item.syntax.object}${item.syntax.part ? `/${item.syntax.part}` : ""}` : ""}`,
|
|
35
|
+
item.preview,
|
|
36
|
+
);
|
|
37
|
+
if (range.startLine === range.endLine && range.startColumn === range.endColumn)
|
|
38
|
+
rows.push("Zero-width position; no text selected.");
|
|
39
|
+
if (item.textTruncated)
|
|
40
|
+
rows.push("… preview shortened; pass this item reference to consume the full selection");
|
|
41
|
+
}
|
|
42
|
+
if (data.truncated)
|
|
43
|
+
rows.push("… more selections retained; pass the whole result to consume all selections");
|
|
44
|
+
return rows.join("\n");
|
|
45
|
+
}
|
|
24
46
|
|
|
25
47
|
function operationLabel(operation: SelectParameters["operation"]): string {
|
|
26
48
|
switch (operation.kind) {
|
|
@@ -111,7 +133,7 @@ export async function registerSelect(pi: ExtensionAPI, read: ReadPluginApi): Pro
|
|
|
111
133
|
openWorldHint: false,
|
|
112
134
|
},
|
|
113
135
|
description:
|
|
114
|
-
"Use select to derive
|
|
136
|
+
"Use select to derive text ranges or positions, navigate JavaScript/TypeScript constructs and their parts (without JSX/TSX), and combine source-local selections. Pass the returned result or an item reference to Read, Search or an edit tool. Select does not change files.",
|
|
115
137
|
promptSnippet:
|
|
116
138
|
"Derive text and AST boundaries, navigate constructs and combine source-range sets",
|
|
117
139
|
promptGuidelines: [
|
|
@@ -219,7 +241,7 @@ export async function registerSelect(pi: ExtensionAPI, read: ReadPluginApi): Pro
|
|
|
219
241
|
};
|
|
220
242
|
return withStructuredResult(
|
|
221
243
|
{
|
|
222
|
-
content: [{ type: "text", text:
|
|
244
|
+
content: [{ type: "text", text: selectionText(data) }],
|
|
223
245
|
details: selectPresentation(
|
|
224
246
|
selected.regions,
|
|
225
247
|
verified.complete,
|
|
@@ -235,7 +257,10 @@ export async function registerSelect(pi: ExtensionAPI, read: ReadPluginApi): Pro
|
|
|
235
257
|
return withStructuredResult<ResultPanelModel | undefined, never>(
|
|
236
258
|
{
|
|
237
259
|
content: [
|
|
238
|
-
{
|
|
260
|
+
{
|
|
261
|
+
type: "text",
|
|
262
|
+
text: `${error instanceof Error ? error.message : String(error)}\nResolve the reported error before retrying. Do not treat a failed selection as an empty result.`,
|
|
263
|
+
},
|
|
239
264
|
],
|
|
240
265
|
details: undefined,
|
|
241
266
|
},
|
|
@@ -42,9 +42,10 @@ export default async function registerGitChanges(pi: ExtensionAPI): Promise<void
|
|
|
42
42
|
id: "current-git-changes",
|
|
43
43
|
setup(api) {
|
|
44
44
|
api.addView({ view: "changes", presenter });
|
|
45
|
-
api.describe(
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
api.describe({
|
|
46
|
+
views:
|
|
47
|
+
"changes — uncommitted edits in tracked files, staged/unstaged state, and CHANGE# anchors for stage, unstage and undo.",
|
|
48
|
+
});
|
|
48
49
|
},
|
|
49
50
|
} satisfies ReadPlugin;
|
|
50
51
|
const editorPlugin = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-changes",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"diff": "^9.0.0",
|
|
16
|
-
"pi-agent-doctor": "0.7.
|
|
17
|
-
"pi-agent-documentation": "0.7.
|
|
18
|
-
"pi-agent-invariant": "0.7.
|
|
19
|
-
"pi-agent-read": "0.7.
|
|
20
|
-
"pi-agent-resource": "0.7.
|
|
21
|
-
"pi-agent-text": "0.7.
|
|
22
|
-
"pi-agent-text-editor": "0.7.
|
|
16
|
+
"pi-agent-doctor": "0.7.2",
|
|
17
|
+
"pi-agent-documentation": "0.7.2",
|
|
18
|
+
"pi-agent-invariant": "0.7.2",
|
|
19
|
+
"pi-agent-read": "0.7.2",
|
|
20
|
+
"pi-agent-resource": "0.7.2",
|
|
21
|
+
"pi-agent-text": "0.7.2",
|
|
22
|
+
"pi-agent-text-editor": "0.7.2"
|
|
23
23
|
},
|
|
24
24
|
"pi": {
|
|
25
25
|
"extensions": [
|
|
@@ -45,6 +45,22 @@ export const indexChangeSchema = Type.Object(
|
|
|
45
45
|
{ additionalProperties: false },
|
|
46
46
|
);
|
|
47
47
|
|
|
48
|
+
const unstageChangeSchema = Type.Object(
|
|
49
|
+
{
|
|
50
|
+
file: {
|
|
51
|
+
...indexChangeSchema.properties.file,
|
|
52
|
+
description:
|
|
53
|
+
"Path to a tracked text file in the current Git worktree. Relative paths resolve from the workspace.",
|
|
54
|
+
},
|
|
55
|
+
change: {
|
|
56
|
+
...indexChangeSchema.properties.change,
|
|
57
|
+
description:
|
|
58
|
+
'Select one complete current CHANGE#HASH anchor returned by read with views: ["changes"].',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{ additionalProperties: false },
|
|
62
|
+
);
|
|
63
|
+
|
|
48
64
|
interface IndexChangeToolDetails {
|
|
49
65
|
readonly action: ChangeIndexAction;
|
|
50
66
|
readonly change: string;
|
|
@@ -70,6 +86,24 @@ export function createIndexChangeTool(
|
|
|
70
86
|
) {
|
|
71
87
|
const execute = createIndexChangeExecutor(action, executor, queue);
|
|
72
88
|
const pastTense = action === "stage" ? "Staged" : "Unstaged";
|
|
89
|
+
const parameters =
|
|
90
|
+
action === "stage"
|
|
91
|
+
? {
|
|
92
|
+
...indexChangeSchema,
|
|
93
|
+
properties: {
|
|
94
|
+
file: {
|
|
95
|
+
...indexChangeSchema.properties.file,
|
|
96
|
+
description:
|
|
97
|
+
"Path to the tracked text file, absolute or relative to the current working directory.",
|
|
98
|
+
},
|
|
99
|
+
change: {
|
|
100
|
+
...indexChangeSchema.properties.change,
|
|
101
|
+
description:
|
|
102
|
+
'Use the complete current CHANGE#HASH anchor shown by read with views: ["changes"].',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
: unstageChangeSchema;
|
|
73
107
|
|
|
74
108
|
return defineTool<typeof indexChangeSchema, IndexChangeToolDetails>({
|
|
75
109
|
name: action,
|
|
@@ -87,8 +121,11 @@ export function createIndexChangeTool(
|
|
|
87
121
|
label: action,
|
|
88
122
|
|
|
89
123
|
promptSnippet: `${pastTense.slice(0, -1)} a selected Git change`,
|
|
90
|
-
description:
|
|
91
|
-
|
|
124
|
+
description:
|
|
125
|
+
action === "stage"
|
|
126
|
+
? "Use stage to add one selected Git change to the index without changing the worktree file."
|
|
127
|
+
: "Use unstage to remove one selected Git change from the index. Worktree content is kept.",
|
|
128
|
+
parameters,
|
|
92
129
|
outputSchema: indexOutputSchema,
|
|
93
130
|
async execute(_toolCallId, parameters, signal, _onUpdate, context) {
|
|
94
131
|
try {
|
|
@@ -148,7 +185,11 @@ export function createIndexChangeExecutor(
|
|
|
148
185
|
const creation = await ChangeService.create(executor, context.cwd, signal);
|
|
149
186
|
|
|
150
187
|
if (creation.status !== "ready") {
|
|
151
|
-
throw new Error(
|
|
188
|
+
throw new Error(
|
|
189
|
+
action === "stage"
|
|
190
|
+
? `Cannot stage ${parameters.file}: ${creation.message}`
|
|
191
|
+
: creation.message,
|
|
192
|
+
);
|
|
152
193
|
}
|
|
153
194
|
|
|
154
195
|
const result = await creation.service.changeIndex(
|
|
@@ -163,10 +204,31 @@ export function createIndexChangeExecutor(
|
|
|
163
204
|
);
|
|
164
205
|
|
|
165
206
|
if (result.status === "unavailable") {
|
|
166
|
-
|
|
207
|
+
if (action === "stage" && result.reason === "stale-selector") {
|
|
208
|
+
throw new Error(
|
|
209
|
+
`${result.message}. Read ${parameters.file} with views: ["changes"] and use a current CHANGE# anchor.`,
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
if (action === "stage" && result.reason === "index-write-failed" && !signal?.aborted) {
|
|
213
|
+
throw new Error(
|
|
214
|
+
`${result.message}\nThe index may have changed. Read ${parameters.file} with views: ["changes"] before retrying.`,
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
throw new Error(
|
|
218
|
+
action === "stage" && result.reason !== "index-write-failed"
|
|
219
|
+
? `Cannot stage ${parameters.file}: ${result.message}`
|
|
220
|
+
: result.message,
|
|
221
|
+
);
|
|
167
222
|
}
|
|
168
223
|
|
|
169
224
|
if (result.status === "not-applicable") {
|
|
225
|
+
if (action === "stage") {
|
|
226
|
+
const reason =
|
|
227
|
+
result.reason === "clean"
|
|
228
|
+
? "the worktree text matches HEAD"
|
|
229
|
+
: "the file is not present in HEAD";
|
|
230
|
+
throw new Error(`Cannot stage ${parameters.file}: ${reason}.`);
|
|
231
|
+
}
|
|
170
232
|
throw new Error(`${action} is not applicable to ${file}: ${result.reason}`);
|
|
171
233
|
}
|
|
172
234
|
|
|
@@ -15,22 +15,20 @@ export const undoSchema = Type.Object(
|
|
|
15
15
|
file: Type.Optional({
|
|
16
16
|
...resultInputSchema,
|
|
17
17
|
description:
|
|
18
|
-
"File
|
|
18
|
+
"File path or one whole-file source result. Partial and multi-file selections are rejected. Omit file to use the supplied CHANGE anchor's file or the last resolved source.",
|
|
19
|
+
}),
|
|
20
|
+
change: Type.String({
|
|
21
|
+
description:
|
|
22
|
+
'Use a complete current CHANGE#HASH anchor from read with views: ["changes"] to restore that change to HEAD in both worktree and index. Use last to restore the file\'s latest saved text-editor transaction.',
|
|
23
|
+
pattern: "^(?:CHANGE#[0-9A-F]{4,64}|last)$",
|
|
19
24
|
}),
|
|
20
|
-
change: Type.Optional(
|
|
21
|
-
Type.String({
|
|
22
|
-
description:
|
|
23
|
-
"Complete CHANGE#HASH anchor shown by read, or last for this file's latest text-editor transaction",
|
|
24
|
-
pattern: "^(?:CHANGE#[0-9A-F]{4,64}|last)$",
|
|
25
|
-
}),
|
|
26
|
-
),
|
|
27
25
|
},
|
|
28
26
|
{ additionalProperties: false },
|
|
29
27
|
);
|
|
30
28
|
|
|
31
29
|
interface UndoParameters {
|
|
32
30
|
readonly file?: unknown;
|
|
33
|
-
readonly change
|
|
31
|
+
readonly change: string;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
export function createUndoMutationTool(
|
|
@@ -41,7 +39,7 @@ export function createUndoMutationTool(
|
|
|
41
39
|
return {
|
|
42
40
|
name: "undo",
|
|
43
41
|
description:
|
|
44
|
-
"Use undo to
|
|
42
|
+
"Use undo to restore one selected uncommitted Git change or a file's latest text-editor transaction.",
|
|
45
43
|
|
|
46
44
|
promptSnippet: "Restore a Git change or latest text edit",
|
|
47
45
|
parameters: undoSchema,
|
|
@@ -56,7 +54,6 @@ export function createUndoMutationTool(
|
|
|
56
54
|
},
|
|
57
55
|
],
|
|
58
56
|
async mutate(context, parameters: UndoParameters) {
|
|
59
|
-
if (parameters.change === undefined) throw new Error("change is required");
|
|
60
57
|
const source = context.sourceFor("file");
|
|
61
58
|
let restoredText: string;
|
|
62
59
|
let afterWrite: (() => Promise<void>) | undefined;
|