pi-agent-ide 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/chunk-6U5OU77O.js +3 -0
- package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
- package/dist/chunk-EURHXLN3.js +2 -0
- package/dist/{chunk-PYPPV2F5.js → chunk-F6IWZKOG.js} +6 -6
- package/dist/{chunk-GBLKIB6O.js → chunk-H445SHSJ.js} +2 -2
- package/dist/chunk-IG56UGSO.js +2 -0
- package/dist/chunk-IICJXZBU.js +6 -0
- package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
- package/dist/{chunk-YRF7OATP.js → chunk-KOVPDKSJ.js} +1 -1
- package/dist/chunk-MXLSGMRZ.js +3 -0
- package/dist/chunk-NRZO5KJT.js +9 -0
- package/dist/chunk-OB46OPMZ.js +1 -0
- package/dist/chunk-PKSQT6TC.js +1 -0
- package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
- package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
- package/dist/chunk-QUYXINGZ.js +7 -0
- package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
- package/dist/chunk-SBP3ABH4.js +5 -0
- package/dist/{chunk-FXNKMNSJ.js → chunk-SJ4UZ4GU.js} +1 -1
- package/dist/chunk-SNF7PDDX.js +11 -0
- package/dist/{chunk-AJRIASPQ.js → chunk-STBJO3Z3.js} +1 -1
- package/dist/{chunk-3HYXQ4YA.js → chunk-TQGE7RH6.js} +13 -13
- package/dist/{chunk-S5LXX32D.js → chunk-XDG7EQRN.js} +3 -3
- package/dist/{chunk-F5YZG77W.js → chunk-XH5WN5XA.js} +1 -1
- package/dist/chunk-YWQS33DF.js +1 -0
- package/dist/chunk-ZIWPKIBZ.js +1 -0
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +2 -2
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +2 -2
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-31.js +15 -13
- package/dist/entry-33.js +2 -1
- package/dist/entry-37.js +6 -6
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +20 -13
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +8 -7
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-77.js +51 -43
- package/dist/entry-78.js +14 -14
- package/dist/entry-79.js +1 -1
- package/dist/entry-80.js +1 -1
- package/dist/entry-82.js +5 -5
- package/dist/entry-83.js +1 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/pi-agent-ide.js +37 -9
- package/docs/agent-guides/editing.md +35 -46
- package/docs/agent-guides/git-changes.md +10 -0
- package/docs/agent-guides/read-resources.md +9 -50
- package/docs/agent-guides/search-code.md +18 -17
- package/docs/agent-guides/select-code.md +62 -140
- package/docs/agent-guides/terminal.md +9 -1
- package/docs/configuration.md +1 -1
- package/docs/releases.md +4 -0
- package/docs/research/native-codemode-batch-decision.md +2 -0
- package/docs/structured-results.md +27 -62
- package/docs/tools.md +15 -11
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +7 -6
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/index.ts +4 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +13 -13
- package/node_modules/pi-agent-ide-ast/src/extension.ts +5 -4
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +35 -9
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +10 -8
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +28 -3
- package/node_modules/pi-agent-ide-changes/index.ts +4 -3
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/index.ts +3 -3
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +38 -1
- package/node_modules/pi-agent-read/src/api/tools/read.ts +18 -1
- package/node_modules/pi-agent-read/src/core/extension.ts +8 -2
- package/node_modules/pi-agent-read/src/core/read-core.ts +54 -35
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +108 -46
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +1 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +186 -9
- package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
- package/node_modules/pi-agent-resource/src/tool-result.ts +13 -1
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +3 -3
- package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
- package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
- package/node_modules/pi-agent-search-text/index.ts +1 -1
- package/node_modules/pi-agent-search-text/package.json +7 -7
- package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/index.ts +65 -4
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/package.json +9 -9
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +10 -3
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +3 -13
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +49 -214
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- package/node_modules/pi-agent-web/index.ts +4 -3
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/src/resolver.ts +11 -13
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-image/package.json +3 -3
- package/node_modules/pi-agent-web-pdf/package.json +3 -3
- package/node_modules/pi-agent-web-text/package.json +3 -3
- package/package.json +35 -35
- package/src/composite/nested-tool-rendering.ts +64 -6
- package/src/composite/output-limits.ts +125 -0
- package/src/composite/responses-tools.ts +25 -0
- package/src/composite/text-results.ts +372 -0
- package/src/documentation/extension.ts +11 -9
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +7 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +4 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +4 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +38 -1
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +18 -1
- package/src/extensions/pi-agent-read/src/core/extension.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/read-core.ts +54 -35
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +108 -46
- package/src/extensions/pi-agent-search/package.json +5 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +3 -3
- package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
- package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
- package/src/extensions/pi-agent-text-editor/package.json +9 -9
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +65 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +10 -3
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +3 -13
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +49 -214
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/src/pi-agent-ide.ts +15 -1
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +5 -4
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +35 -9
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +10 -8
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +28 -3
- package/src/plugins/pi-agent-ide-changes/index.ts +4 -3
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- package/src/plugins/pi-agent-ide-debugger/index.ts +22 -10
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +6 -3
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/index.ts +3 -3
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
- package/src/plugins/pi-agent-ide-vision/index.ts +13 -4
- package/src/post-edit/gate.ts +13 -2
- package/dist/chunk-3JO7QFIL.js +0 -1
- package/dist/chunk-4NIFBFFR.js +0 -11
- package/dist/chunk-64M3SQPG.js +0 -3
- package/dist/chunk-7LZKOHH2.js +0 -1
- package/dist/chunk-EAZGN5ND.js +0 -7
- package/dist/chunk-FK42RSF4.js +0 -1
- package/dist/chunk-KBP3QUDT.js +0 -2
- package/dist/chunk-KR36BT5E.js +0 -1
- package/dist/chunk-MBUXFKIW.js +0 -3
- package/dist/chunk-OE7QVAI2.js +0 -5
- package/dist/chunk-SILJ3OL4.js +0 -9
- package/dist/chunk-SQKAXYIR.js +0 -2
- package/dist/chunk-VCGNVTXQ.js +0 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
1
2
|
import {
|
|
2
3
|
DEFAULT_MAX_BYTES,
|
|
3
4
|
DEFAULT_MAX_LINES,
|
|
@@ -7,6 +8,7 @@ import {
|
|
|
7
8
|
} from "@earendil-works/pi-coding-agent";
|
|
8
9
|
|
|
9
10
|
import type { ReadRequest, ReadResultDetails, ReadToolResult } from "#src/api/tools/read.js";
|
|
11
|
+
import { anchoredStartLine } from "#src/core/tools/read/read-result.js";
|
|
10
12
|
|
|
11
13
|
export interface ReadTruncationOptions {
|
|
12
14
|
/** Absolute 1-based line where an anchored read's window starts. */
|
|
@@ -39,7 +41,7 @@ export async function limitReadOutput(
|
|
|
39
41
|
const temporarySource =
|
|
40
42
|
saveFullOutput === undefined ? undefined : await saveFullOutput(block.text);
|
|
41
43
|
const baseNotice = truncation.firstLineExceedsLimit
|
|
42
|
-
? oversizedFirstLineNotice(block.text, result.details, request)
|
|
44
|
+
? await oversizedFirstLineNotice(block.text, result.details, request)
|
|
43
45
|
: truncatedOutputNotice(truncation, result.details, request, originLine);
|
|
44
46
|
const notice =
|
|
45
47
|
temporarySource === undefined
|
|
@@ -51,39 +53,88 @@ export async function limitReadOutput(
|
|
|
51
53
|
content: [{ ...block, text: appendNotice(truncation.content, notice) }],
|
|
52
54
|
details: {
|
|
53
55
|
...truncatedDetails(result.details, truncation),
|
|
56
|
+
outputNotice: (truncation.content.length ? "\n\n" : "") + notice,
|
|
54
57
|
...(temporarySource !== undefined && { temporarySource }),
|
|
55
58
|
},
|
|
56
59
|
};
|
|
57
60
|
}
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (notice === undefined) {
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
62
|
+
return explainReadWindow(result, request, options);
|
|
63
|
+
}
|
|
64
64
|
|
|
65
|
+
/** Explains an empty or explicitly limited text window without changing its source selection. */
|
|
66
|
+
export function explainReadWindow(
|
|
67
|
+
result: ReadToolResult,
|
|
68
|
+
request: ReadRequest,
|
|
69
|
+
options?: ReadTruncationOptions,
|
|
70
|
+
): ReadToolResult {
|
|
71
|
+
const block = result.content.length === 1 ? result.content[0] : undefined;
|
|
72
|
+
if (result.isError || block?.type !== "text") return result;
|
|
73
|
+
const notice =
|
|
74
|
+
block.text.length === 0
|
|
75
|
+
? emptyTextNotice(result, request, options?.originLine)
|
|
76
|
+
: explicitLimitNotice(result.details, request, options?.originLine);
|
|
77
|
+
if (notice === undefined) return result;
|
|
65
78
|
return {
|
|
66
79
|
...result,
|
|
67
80
|
content: [{ ...block, text: appendNotice(block.text, notice) }],
|
|
81
|
+
details: { ...result.details, outputNotice: (block.text.length ? "\n\n" : "") + notice },
|
|
68
82
|
};
|
|
69
83
|
}
|
|
70
84
|
|
|
85
|
+
function emptyTextNotice(
|
|
86
|
+
result: ReadToolResult,
|
|
87
|
+
request: ReadRequest,
|
|
88
|
+
originLine: number | undefined,
|
|
89
|
+
): string | undefined {
|
|
90
|
+
const selected = result.script;
|
|
91
|
+
if (result.isError || selected?.kind !== "text" || selected.lines.length !== 0) return undefined;
|
|
92
|
+
if (selected.totalLines === 0) return "[Empty source.]";
|
|
93
|
+
if (request.limit !== undefined && Math.trunc(request.limit) <= 0)
|
|
94
|
+
return "[No lines selected: limit=0.]";
|
|
95
|
+
const offset = Math.trunc(request.offset ?? 1);
|
|
96
|
+
if (anchoredStartLine(offset, selected.totalLines, originLine) > selected.totalLines)
|
|
97
|
+
return `[Offset ${offset} is beyond the end of the source (${selected.totalLines} ${selected.totalLines === 1 ? "line" : "lines"}).]`;
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
71
100
|
function appendTemporarySource(notice: string, source: string): string {
|
|
72
|
-
|
|
101
|
+
const reference = source.startsWith("temp:") ? source : JSON.stringify(source);
|
|
102
|
+
return `${notice.slice(0, -1)} Full output: ${reference}. Available until this runtime is disposed.]`;
|
|
73
103
|
}
|
|
74
104
|
|
|
75
|
-
function oversizedFirstLineNotice(
|
|
105
|
+
async function oversizedFirstLineNotice(
|
|
76
106
|
text: string,
|
|
77
107
|
details: ReadResultDetails,
|
|
78
108
|
request: ReadRequest,
|
|
79
|
-
): string {
|
|
109
|
+
): Promise<string> {
|
|
80
110
|
const firstLine = text.split(/\r\n|\r|\n/u, 1)[0] ?? "";
|
|
81
111
|
const lineSize = formatSize(Buffer.byteLength(firstLine, "utf8"));
|
|
82
112
|
const sourceLine = sourceStartLine(details, request);
|
|
83
113
|
const lineLabel = sourceLine === undefined ? "First output line" : `Line ${sourceLine}`;
|
|
114
|
+
const limit = formatSize(READ_OUTPUT_MAX_BYTES);
|
|
115
|
+
|
|
116
|
+
if (
|
|
117
|
+
details.resolvedBy === "filesystem" &&
|
|
118
|
+
request.views?.some((view) => view.startsWith("jq:")) === true
|
|
119
|
+
) {
|
|
120
|
+
return (
|
|
121
|
+
`[Output line ${sourceLine ?? 1} is ${lineSize}, exceeds the ${limit} output limit. ` +
|
|
122
|
+
"This line was not returned. Narrow the jq filter to return a smaller value.]"
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (details.resolvedBy === "filesystem" && details.source !== undefined) {
|
|
127
|
+
const file = await stat(details.source).catch(() => undefined);
|
|
128
|
+
if (file?.isFile() === true) {
|
|
129
|
+
return (
|
|
130
|
+
`[${lineLabel} is ${lineSize}, exceeds the ${limit} output limit. This line was not returned. ` +
|
|
131
|
+
`Read ${JSON.stringify(`raw:${details.source}`)} with offset=0 and limit=4096 to inspect the original bytes.]`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
84
135
|
|
|
85
136
|
return (
|
|
86
|
-
`[${lineLabel} is ${lineSize}, exceeds ${
|
|
137
|
+
`[${lineLabel} is ${lineSize}, exceeds ${limit} limit. ` +
|
|
87
138
|
"Use a source-specific tool to read this line in smaller byte ranges.]"
|
|
88
139
|
);
|
|
89
140
|
}
|
|
@@ -97,21 +148,24 @@ function truncatedOutputNotice(
|
|
|
97
148
|
const sourceRange = shownSourceRange(truncation, details, request);
|
|
98
149
|
|
|
99
150
|
if (sourceRange !== undefined && sourceRange.endLine < sourceRange.totalLines) {
|
|
100
|
-
const
|
|
101
|
-
truncation.truncatedBy === "
|
|
102
|
-
|
|
151
|
+
const limit =
|
|
152
|
+
truncation.truncatedBy === "lines"
|
|
153
|
+
? `${truncation.maxLines}-line limit`
|
|
154
|
+
: `${formatSize(truncation.maxBytes)} limit`;
|
|
155
|
+
const action = sourceContinuationAction(details, request, sourceRange.endLine + 1, originLine);
|
|
103
156
|
|
|
104
|
-
return `[Showing lines ${sourceRange.startLine}-${sourceRange.endLine} of ${sourceRange.totalLines}${
|
|
157
|
+
return `[Showing lines ${sourceRange.startLine}-${sourceRange.endLine} of ${sourceRange.totalLines} (${limit}). ${action} to continue.]`;
|
|
105
158
|
}
|
|
106
159
|
|
|
107
160
|
const limit =
|
|
108
161
|
truncation.truncatedBy === "lines"
|
|
109
|
-
? `${truncation.maxLines}
|
|
162
|
+
? `${truncation.maxLines}-line limit`
|
|
110
163
|
: `${formatSize(truncation.maxBytes)} limit`;
|
|
111
164
|
|
|
112
165
|
return (
|
|
113
|
-
`[Output truncated: showing ${truncation.outputLines} of ${truncation.totalLines}
|
|
114
|
-
"
|
|
166
|
+
`[Output truncated: showing ${truncation.outputLines} of ${truncation.totalLines} output lines (${limit}). ` +
|
|
167
|
+
"No single source-line continuation is available. " +
|
|
168
|
+
"Retry Read with a smaller limit, keeping the same source and views.]"
|
|
115
169
|
);
|
|
116
170
|
}
|
|
117
171
|
|
|
@@ -169,7 +223,26 @@ function explicitLimitNotice(
|
|
|
169
223
|
}
|
|
170
224
|
|
|
171
225
|
const remaining = details.totalLines - nextAbsolute + 1;
|
|
172
|
-
|
|
226
|
+
const lineLabel = remaining === 1 ? "line" : "lines";
|
|
227
|
+
const action = sourceContinuationAction(details, request, nextAbsolute, originLine);
|
|
228
|
+
return `[${remaining} more ${lineLabel} in source. ${action} to continue.]`;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function sourceContinuationAction(
|
|
232
|
+
details: ReadResultDetails,
|
|
233
|
+
request: ReadRequest,
|
|
234
|
+
nextAbsolute: number,
|
|
235
|
+
originLine: number | undefined,
|
|
236
|
+
): string {
|
|
237
|
+
const action =
|
|
238
|
+
details.source === undefined
|
|
239
|
+
? `Use offset=${continuationOffset(nextAbsolute, originLine)}`
|
|
240
|
+
: `Read ${JSON.stringify(details.source)} with offset=${nextAbsolute}`;
|
|
241
|
+
const views =
|
|
242
|
+
request.views === undefined || request.views.length === 0
|
|
243
|
+
? ""
|
|
244
|
+
: ` and views=${JSON.stringify(request.views)}`;
|
|
245
|
+
return action + views;
|
|
173
246
|
}
|
|
174
247
|
|
|
175
248
|
/** Converts an absolute next line into the offset the agent should send again. */
|
|
@@ -23,7 +23,9 @@ export async function readRaw(
|
|
|
23
23
|
const requested = request.path ?? "";
|
|
24
24
|
try {
|
|
25
25
|
if ((request.views?.length ?? 0) > 0)
|
|
26
|
-
throw new Error(
|
|
26
|
+
throw new Error(
|
|
27
|
+
"Raw byte reads do not accept views. Omit views for bytes, or read the file without raw: to use text views.",
|
|
28
|
+
);
|
|
27
29
|
const offset = request.offset ?? 0;
|
|
28
30
|
const limit = request.limit;
|
|
29
31
|
if (
|
|
@@ -97,7 +99,11 @@ export async function readRaw(
|
|
|
97
99
|
const hasMore = nextOffset < stat.size;
|
|
98
100
|
const header = `${source}\nBytes ${start}..${nextOffset} (end exclusive), ${stat.size} bytes total`;
|
|
99
101
|
const rows = formatRawBytes(bytes, start);
|
|
100
|
-
const continuation = hasMore
|
|
102
|
+
const continuation = !hasMore
|
|
103
|
+
? ""
|
|
104
|
+
: length < requestedLength
|
|
105
|
+
? `\n[Output limited. Read ${JSON.stringify(source)} with offset=${nextOffset} to continue.]`
|
|
106
|
+
: `\nUse offset=${nextOffset} to continue in bytes.`;
|
|
101
107
|
return {
|
|
102
108
|
content: [{ type: "text", text: `${header}\n${rows}${continuation}` }],
|
|
103
109
|
details: {
|
|
@@ -239,6 +239,25 @@ export class ReadResultPanel implements Component {
|
|
|
239
239
|
compactInput.hasHiddenRows,
|
|
240
240
|
);
|
|
241
241
|
const lines = [renderTopBorder(this.state, innerWidth, this.state.theme)];
|
|
242
|
+
const diagnosticStatus = this.state.details.diagnosticStatus;
|
|
243
|
+
if (diagnosticStatus) {
|
|
244
|
+
for (const line of diagnosticStatus.split(/\r\n|\r|\n/u)) {
|
|
245
|
+
for (const row of wrapTextWithAnsi(
|
|
246
|
+
this.state.theme.fg("muted", normalizeText(line)),
|
|
247
|
+
contentWidth,
|
|
248
|
+
)) {
|
|
249
|
+
lines.push(framed(row, innerWidth, this.state.theme));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
for (const warning of this.state.details.viewWarnings ?? []) {
|
|
254
|
+
for (const row of wrapTextWithAnsi(
|
|
255
|
+
this.state.theme.fg("warning", normalizeText(warning)),
|
|
256
|
+
contentWidth,
|
|
257
|
+
)) {
|
|
258
|
+
lines.push(framed(row, innerWidth, this.state.theme));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
242
261
|
|
|
243
262
|
for (const row of rows) {
|
|
244
263
|
for (const wrappedRow of wrapTextWithAnsi(row, contentWidth)) {
|
|
@@ -538,7 +557,25 @@ function cleanText(
|
|
|
538
557
|
);
|
|
539
558
|
}
|
|
540
559
|
|
|
541
|
-
const
|
|
560
|
+
const rendered = textBlocks(result);
|
|
561
|
+
const warning = details.viewWarnings?.join("\n");
|
|
562
|
+
let text =
|
|
563
|
+
warning === undefined
|
|
564
|
+
? rendered
|
|
565
|
+
: rendered === warning
|
|
566
|
+
? ""
|
|
567
|
+
: rendered.startsWith(`${warning}\n`)
|
|
568
|
+
? rendered.slice(warning.length + 1)
|
|
569
|
+
: rendered;
|
|
570
|
+
const diagnosticStatus = details.diagnosticStatus;
|
|
571
|
+
if (diagnosticStatus !== undefined) {
|
|
572
|
+
text =
|
|
573
|
+
text === diagnosticStatus
|
|
574
|
+
? ""
|
|
575
|
+
: text.startsWith(`${diagnosticStatus}\n`)
|
|
576
|
+
? text.slice(diagnosticStatus.length + 1)
|
|
577
|
+
: text;
|
|
578
|
+
}
|
|
542
579
|
|
|
543
580
|
if (
|
|
544
581
|
details.truncation === undefined &&
|
|
@@ -58,7 +58,8 @@ export function projectReadState(
|
|
|
58
58
|
code: "UNSUPPORTED_RANGE",
|
|
59
59
|
source: state.source,
|
|
60
60
|
resolverId: state.resolvedBy,
|
|
61
|
-
message:
|
|
61
|
+
message:
|
|
62
|
+
"Line ranges require textual content. Omit offset and limit to read this content without a line range.",
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -135,13 +136,67 @@ function renderFinalTextLines(
|
|
|
135
136
|
.join("");
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
function readFailureMessage(failure: ReadFailure): string {
|
|
140
|
+
let cause = failure.cause;
|
|
141
|
+
let error: Error | undefined;
|
|
142
|
+
const visited = new Set<Error>();
|
|
143
|
+
while (cause instanceof Error && !visited.has(cause)) {
|
|
144
|
+
visited.add(cause);
|
|
145
|
+
error = cause;
|
|
146
|
+
cause = cause.cause;
|
|
147
|
+
}
|
|
148
|
+
const code = error !== undefined && "code" in error ? error.code : undefined;
|
|
149
|
+
let reason = error?.message || failure.message;
|
|
150
|
+
if (code === "ENOENT")
|
|
151
|
+
reason = failure.candidates?.length
|
|
152
|
+
? "Source not found."
|
|
153
|
+
: "Source not found. Search for the correct path.";
|
|
154
|
+
else if (code === "EACCES" || code === "EPERM") reason = "Access denied.";
|
|
155
|
+
else if (failure.code === "INVALID_RESOLVER_RESULT")
|
|
156
|
+
reason = "The source provider returned an invalid result.";
|
|
157
|
+
else if (failure.code === "INVALID_RESOURCE_CONTENT")
|
|
158
|
+
reason = "The source provider returned invalid content.";
|
|
159
|
+
else if (failure.code === "UNSUPPORTED_CAPABILITY")
|
|
160
|
+
reason = "This source does not support reading.";
|
|
161
|
+
else if (failure.code === "NO_RESOLVER")
|
|
162
|
+
reason = "This source is not supported. Choose a supported source from the path parameter.";
|
|
163
|
+
else if (failure.code === "NO_FRAGMENT_RESOLVER")
|
|
164
|
+
reason = "This anchor is not supported. Read the source without the anchor.";
|
|
165
|
+
if (failure.code === "INVALID_REQUEST")
|
|
166
|
+
reason += ". Supply path with a source or an unchanged result reference.";
|
|
167
|
+
else if (failure.code === "FRAGMENT_FAILED" && failure.source !== undefined)
|
|
168
|
+
reason += `\nRead ${JSON.stringify(failure.source)} with views=["anchors"] and choose a current anchor.`;
|
|
169
|
+
const source = failure.source === undefined ? "" : ` for ${JSON.stringify(failure.source)}`;
|
|
170
|
+
return `Read failed${source}: ${reason}`;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Describe a caller-cancelled failed Read without changing its private record or exceptions. */
|
|
174
|
+
export function withReadCancellation(
|
|
175
|
+
result: ReadToolResult,
|
|
176
|
+
requestedSource: string | undefined,
|
|
177
|
+
signal: AbortSignal | undefined,
|
|
178
|
+
): ReadToolResult {
|
|
179
|
+
if (!signal?.aborted || !result.isError) return result;
|
|
180
|
+
const source = result.details.source ?? result.details.failure?.source ?? requestedSource;
|
|
181
|
+
return {
|
|
182
|
+
...result,
|
|
183
|
+
content: [
|
|
184
|
+
{
|
|
185
|
+
type: "text",
|
|
186
|
+
text: `Read cancelled${source === undefined ? "" : ` for ${JSON.stringify(source)}`}. No completed result was returned.`,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** Show an actionable failure while retaining the original record for private adapters. */
|
|
138
193
|
export function failureResult(failure: ReadFailure): ReadToolResult {
|
|
139
194
|
return {
|
|
140
195
|
content: [
|
|
141
196
|
{
|
|
142
197
|
type: "text",
|
|
143
198
|
text: [
|
|
144
|
-
|
|
199
|
+
readFailureMessage(failure),
|
|
145
200
|
...(failure.candidates?.length
|
|
146
201
|
? [
|
|
147
202
|
"",
|
|
@@ -53,7 +53,7 @@ const bytes = Type.Object(
|
|
|
53
53
|
const block = Type.Union([
|
|
54
54
|
Type.Object({ type: Type.Literal("text"), text: Type.String() }, { additionalProperties: false }),
|
|
55
55
|
Type.Object(
|
|
56
|
-
{ type: Type.Literal("image"),
|
|
56
|
+
{ type: Type.Literal("image"), mimeType: Type.String() },
|
|
57
57
|
{ additionalProperties: false },
|
|
58
58
|
),
|
|
59
59
|
]);
|
|
@@ -127,6 +127,7 @@ function publicData(value: ReadScriptData): unknown {
|
|
|
127
127
|
: {}),
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
+
// Image bytes belong to native content, not the composable result record.
|
|
130
131
|
if (value.kind === "native")
|
|
131
132
|
return {
|
|
132
133
|
kind: value.kind,
|
|
@@ -134,8 +135,7 @@ function publicData(value: ReadScriptData): unknown {
|
|
|
134
135
|
truncated: false,
|
|
135
136
|
blocks: value.blocks.map((block) => {
|
|
136
137
|
if (block.type === "text") return { type: block.type, text: block.text };
|
|
137
|
-
if (block.type === "image")
|
|
138
|
-
return { type: block.type, data: block.data, mimeType: block.mimeType };
|
|
138
|
+
if (block.type === "image") return { type: block.type, mimeType: block.mimeType };
|
|
139
139
|
throw new TypeError("Custom content requires a structured adapter");
|
|
140
140
|
}),
|
|
141
141
|
};
|