pi-agent-ide 0.7.1 → 0.7.3
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 +3 -1
- package/dist/{chunk-PKKDDIWW.js → chunk-2ZMMRINH.js} +1 -1
- package/dist/chunk-6U5OU77O.js +3 -0
- package/dist/chunk-BYZSBXUK.js +2 -0
- package/dist/{chunk-LEEQIQ7D.js → chunk-CEX73RI5.js} +6 -6
- package/dist/chunk-DZWTKF2K.js +1 -0
- package/dist/{chunk-WMO6RNE2.js → chunk-EOKEQ3YH.js} +6 -6
- package/dist/{chunk-HZEY4GT4.js → chunk-H445SHSJ.js} +2 -2
- package/dist/{chunk-4GCWGE2C.js → chunk-HZ5BNF3A.js} +1 -1
- 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-MXLSGMRZ.js +3 -0
- package/dist/{chunk-76ZK5ODR.js → chunk-NHKPP2AI.js} +13 -13
- package/dist/chunk-OB46OPMZ.js +1 -0
- package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
- package/dist/chunk-QUYXINGZ.js +7 -0
- package/dist/{chunk-OMVRLWMX.js → chunk-SBP3ABH4.js} +1 -1
- package/dist/{chunk-YP46DVVP.js → chunk-STBJO3Z3.js} +1 -1
- package/dist/{chunk-2TRHFMCZ.js → chunk-TXOTNK6B.js} +1 -1
- package/dist/chunk-WLZIUMJL.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 +1 -1
- 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-31.js +12 -11
- package/dist/entry-33.js +3 -1
- package/dist/entry-37.js +6 -6
- package/dist/entry-42.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +20 -12
- 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 +7 -6
- 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-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 +63 -49
- package/dist/entry-78.js +15 -14
- package/dist/entry-79.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 +34 -11
- package/docs/agent-guides/editing.md +14 -7
- package/docs/agent-guides/git-changes.md +10 -0
- package/docs/agent-guides/read-resources.md +9 -46
- package/docs/agent-guides/search-code.md +7 -1
- package/docs/agent-guides/select-code.md +1 -0
- package/docs/agent-guides/terminal.md +9 -1
- package/docs/configuration.md +22 -1
- package/docs/development.md +4 -0
- package/docs/directory-operations.md +45 -0
- package/docs/releases.md +12 -0
- package/docs/research/codemode-write-context.md +56 -0
- package/docs/research/native-codemode-batch-decision.md +2 -0
- package/docs/structured-results.md +2 -2
- package/docs/tools.md +10 -2
- package/docs/user-hooks.md +26 -0
- 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/package.json +7 -7
- 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-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 +3 -3
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +9 -4
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +0 -3
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +8 -6
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +13 -5
- package/node_modules/pi-agent-ide-changes/package.json +9 -8
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +82 -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 +1 -1
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +2 -1
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
- 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/read-parameters.ts +3 -3
- package/node_modules/pi-agent-read/src/api/tools/read.ts +11 -0
- package/node_modules/pi-agent-read/src/core/extension.ts +1 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +5 -1
- 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/tool-read.ts +99 -44
- 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 +6 -3
- 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-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 +2 -2
- 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/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/package.json +3 -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/delete-guard.ts +24 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
- 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/plugin-protocol.ts +4 -1
- package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +284 -0
- 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/file-operation-tools.ts +32 -3
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +30 -40
- package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +164 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +36 -12
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +25 -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 +286 -162
- 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 +46 -11
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +21 -14
- package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +96 -0
- 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 +155 -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 +126 -32
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +428 -189
- package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +66 -0
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +15 -6
- 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 +6 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
- 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 +75 -11
- 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-ui/package.json +1 -1
- 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 +36 -35
- package/src/api/hooks.ts +24 -0
- package/src/composite/nested-tool-rendering.ts +184 -77
- package/src/composite/output-limits.ts +125 -0
- package/src/composite/responses-tools.ts +25 -0
- package/src/composite/text-results.ts +158 -7
- 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/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/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/read-parameters.ts +3 -3
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +11 -0
- package/src/extensions/pi-agent-read/src/core/extension.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +5 -1
- 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/tool-read.ts +99 -44
- package/src/extensions/pi-agent-search/package.json +5 -5
- 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 +2 -2
- 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/package.json +3 -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 +75 -11
- 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/delete-guard.ts +24 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
- 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/plugin-protocol.ts +4 -1
- package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +284 -0
- 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/file-operation-tools.ts +32 -3
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +30 -40
- package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +164 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +36 -12
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +25 -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 +286 -162
- 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 +46 -11
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +21 -14
- package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +96 -0
- 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 +155 -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 +126 -32
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +428 -189
- package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +66 -0
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +15 -6
- 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 +6 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/src/pi-agent-ide.ts +11 -0
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +3 -3
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +9 -4
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +0 -3
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +8 -6
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +13 -5
- package/src/plugins/pi-agent-ide-changes/package.json +9 -8
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +82 -4
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- package/src/plugins/pi-agent-ide-debugger/index.ts +20 -8
- 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 +3 -2
- 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 +1 -1
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +2 -1
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
- package/src/plugins/pi-agent-ide-vision/index.ts +1 -0
- package/src/post-edit/gate.ts +13 -2
- package/dist/chunk-4XMY4H4V.js +0 -1
- package/dist/chunk-64M3SQPG.js +0 -3
- package/dist/chunk-CWD4O5PM.js +0 -3
- package/dist/chunk-D3WTDA6V.js +0 -2
- package/dist/chunk-EAZGN5ND.js +0 -7
- package/dist/chunk-GXEGY7GV.js +0 -1
- package/dist/chunk-MBUXFKIW.js +0 -3
- package/dist/chunk-PGIVHICI.js +0 -1
- package/dist/chunk-VMTR74FF.js +0 -2
- package/dist/chunk-WU6ZK6YD.js +0 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
2
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/** Opt IDE function tools out of implicit Responses strictness without changing their schemas. */
|
|
6
|
+
export function preserveResponsesToolOmission(
|
|
7
|
+
payload: unknown,
|
|
8
|
+
names: ReadonlySet<string>,
|
|
9
|
+
): unknown {
|
|
10
|
+
if (!isRecord(payload) || !Array.isArray(payload.tools)) return payload;
|
|
11
|
+
const original = payload.tools;
|
|
12
|
+
const tools = original.map((tool: unknown) => {
|
|
13
|
+
if (
|
|
14
|
+
!isRecord(tool) ||
|
|
15
|
+
tool.type !== "function" ||
|
|
16
|
+
typeof tool.name !== "string" ||
|
|
17
|
+
!names.has(tool.name) ||
|
|
18
|
+
tool.strict !== undefined
|
|
19
|
+
)
|
|
20
|
+
return tool;
|
|
21
|
+
// Responses can make every optional property required when strict is omitted.
|
|
22
|
+
return { ...tool, strict: false };
|
|
23
|
+
});
|
|
24
|
+
return tools.some((tool, index) => tool !== original[index]) ? { ...payload, tools } : payload;
|
|
25
|
+
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
ExtensionAPI,
|
|
3
|
+
ExtensionHandler,
|
|
4
|
+
ToolCallEvent,
|
|
5
|
+
ToolCallEventResult,
|
|
6
|
+
AgentToolResult,
|
|
7
|
+
} from "@earendil-works/pi-coding-agent";
|
|
8
|
+
import { connectResultTargets, TempResourceStore } from "pi-agent-resource";
|
|
9
|
+
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
10
|
+
import { READ_PROTOCOL, READ_API_VERSION } from "pi-agent-read/api/plugin-protocol";
|
|
11
|
+
import { limitIdeOutput } from "./output-limits.js";
|
|
3
12
|
|
|
4
13
|
const sourceFields: Record<string, readonly string[]> = {
|
|
5
14
|
read: ["path"],
|
|
@@ -19,6 +28,39 @@ const sourceFields: Record<string, readonly string[]> = {
|
|
|
19
28
|
export function createIdeTextResults(pi: ExtensionAPI) {
|
|
20
29
|
const store = connectResultTargets(pi);
|
|
21
30
|
const names = new Set<string>();
|
|
31
|
+
const outputs = new TempResourceStore();
|
|
32
|
+
const saveFullOutput = (text: string) => outputs.saveFile(text);
|
|
33
|
+
const boundedErrors = new Set<string>();
|
|
34
|
+
const contextErrors = new Map<string, Promise<AgentToolResult<unknown>["content"]>>();
|
|
35
|
+
// Read core owns deferred registration and reports setup failures.
|
|
36
|
+
void connectReadPlugin(pi, {
|
|
37
|
+
protocol: READ_PROTOCOL,
|
|
38
|
+
apiVersion: READ_API_VERSION,
|
|
39
|
+
id: "ide-output-retention",
|
|
40
|
+
setup(api) {
|
|
41
|
+
api.setOutputSaver(saveFullOutput);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
pi.on("session_shutdown", () => outputs.dispose());
|
|
45
|
+
const on: ExtensionAPI["on"] = (event, handler) => {
|
|
46
|
+
// The SDK overloads describe event/handler pairs; forwarding keeps the original pair.
|
|
47
|
+
const toolCallHandler = handler as ExtensionHandler<ToolCallEvent, ToolCallEventResult>;
|
|
48
|
+
if (event !== "tool_call") return pi.on(event as "tool_call", toolCallHandler);
|
|
49
|
+
return pi.on("tool_call", async (call, context) => {
|
|
50
|
+
const result = await toolCallHandler(call, context);
|
|
51
|
+
if (!result?.block || !names.has(call.toolName) || result.reason === undefined) return result;
|
|
52
|
+
const limited = await limitIdeOutput(
|
|
53
|
+
[{ type: "text", text: result.reason }],
|
|
54
|
+
"",
|
|
55
|
+
saveFullOutput,
|
|
56
|
+
);
|
|
57
|
+
boundedErrors.add(call.toolCallId);
|
|
58
|
+
return {
|
|
59
|
+
...result,
|
|
60
|
+
reason: limited.text + (limited.notices.length ? `\n\n${limited.notices.join("\n")}` : ""),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
};
|
|
22
64
|
const parents = new Map<string, string>();
|
|
23
65
|
const images = new Map<
|
|
24
66
|
string,
|
|
@@ -27,6 +69,8 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
27
69
|
const clear = () => {
|
|
28
70
|
parents.clear();
|
|
29
71
|
images.clear();
|
|
72
|
+
boundedErrors.clear();
|
|
73
|
+
contextErrors.clear();
|
|
30
74
|
};
|
|
31
75
|
pi.on("session_start", clear);
|
|
32
76
|
pi.on("session_shutdown", clear);
|
|
@@ -37,7 +81,7 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
37
81
|
if (event.parentToolCallId !== undefined)
|
|
38
82
|
parents.set(event.toolCallId, parents.get(event.parentToolCallId) ?? event.parentToolCallId);
|
|
39
83
|
});
|
|
40
|
-
|
|
84
|
+
on("tool_call", (event, context) => {
|
|
41
85
|
if (!names.has(event.toolName)) return;
|
|
42
86
|
const input: Record<string, unknown> = { ...event.input };
|
|
43
87
|
try {
|
|
@@ -101,6 +145,35 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
101
145
|
const publicDefinition = {} as typeof definition;
|
|
102
146
|
const descriptors = Object.getOwnPropertyDescriptors(definition);
|
|
103
147
|
delete descriptors.outputSchema;
|
|
148
|
+
const execute: typeof definition.execute = async (...args) => {
|
|
149
|
+
const result = await definition.execute(...args).catch(async (error: unknown) => {
|
|
150
|
+
const limited = await limitIdeOutput(
|
|
151
|
+
[{ type: "text", text: error instanceof Error ? error.message : String(error) }],
|
|
152
|
+
"",
|
|
153
|
+
saveFullOutput,
|
|
154
|
+
);
|
|
155
|
+
boundedErrors.add(args[0]);
|
|
156
|
+
if (limited.notices.length === 0) throw error;
|
|
157
|
+
throw new Error(limited.text + `\n\n${limited.notices.join("\n")}`, { cause: error });
|
|
158
|
+
});
|
|
159
|
+
const limited = await limitIdeOutput(
|
|
160
|
+
result.content,
|
|
161
|
+
outputNotices(result.details),
|
|
162
|
+
saveFullOutput,
|
|
163
|
+
);
|
|
164
|
+
const text = limited.text + limited.metadataSuffix;
|
|
165
|
+
return {
|
|
166
|
+
...result,
|
|
167
|
+
content: [
|
|
168
|
+
{
|
|
169
|
+
type: "text",
|
|
170
|
+
text: text + (limited.notices.length ? `\n\n${limited.notices.join("\n")}` : ""),
|
|
171
|
+
},
|
|
172
|
+
...limited.images,
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
descriptors.execute = { value: execute, enumerable: true, configurable: true, writable: true };
|
|
104
177
|
const render = definition.renderCall;
|
|
105
178
|
if (render) {
|
|
106
179
|
const renderCall: typeof render = (args, theme, context) =>
|
|
@@ -145,14 +218,62 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
145
218
|
pi.registerTool(publicDefinition);
|
|
146
219
|
};
|
|
147
220
|
const finalize = () => {
|
|
148
|
-
|
|
221
|
+
// Host argument validation can fail before tool_call, execute and tool_result run.
|
|
222
|
+
// Bound those unpublished errors at the provider boundary; keep saved records unchanged.
|
|
223
|
+
pi.on("context", async (event) => ({
|
|
224
|
+
messages: await Promise.all(
|
|
225
|
+
event.messages.map(async (message) => {
|
|
226
|
+
if (
|
|
227
|
+
message.role !== "toolResult" ||
|
|
228
|
+
!message.isError ||
|
|
229
|
+
!names.has(message.toolName) ||
|
|
230
|
+
boundedErrors.has(message.toolCallId) ||
|
|
231
|
+
message.content.some(
|
|
232
|
+
(block) => block.type === "text" && block.text.startsWith("<system-result"),
|
|
233
|
+
)
|
|
234
|
+
)
|
|
235
|
+
return message;
|
|
236
|
+
let content = contextErrors.get(message.toolCallId);
|
|
237
|
+
if (content === undefined) {
|
|
238
|
+
content = limitIdeOutput(message.content, "", saveFullOutput).then((limited) => [
|
|
239
|
+
{
|
|
240
|
+
type: "text" as const,
|
|
241
|
+
text:
|
|
242
|
+
limited.text +
|
|
243
|
+
(limited.notices.length ? `\n\n${limited.notices.join("\n")}` : ""),
|
|
244
|
+
},
|
|
245
|
+
...limited.images,
|
|
246
|
+
]);
|
|
247
|
+
contextErrors.set(message.toolCallId, content);
|
|
248
|
+
}
|
|
249
|
+
return { ...message, content: await content };
|
|
250
|
+
}),
|
|
251
|
+
),
|
|
252
|
+
}));
|
|
253
|
+
pi.on("tool_result", async (event, context) => {
|
|
149
254
|
if (event.toolName === "codemode") {
|
|
150
255
|
store.refreshAll();
|
|
151
256
|
const generated = images.get(event.toolCallId) ?? [];
|
|
152
257
|
images.delete(event.toolCallId);
|
|
153
258
|
for (const [child, parent] of parents)
|
|
154
259
|
if (parent === event.toolCallId) parents.delete(child);
|
|
155
|
-
|
|
260
|
+
const metadata = event.content.filter(
|
|
261
|
+
(block) => block.type === "text" && block.text.startsWith("\n\n---\n\n# Guide:"),
|
|
262
|
+
);
|
|
263
|
+
const content = event.content.filter((block) => !metadata.includes(block));
|
|
264
|
+
const limited = await limitIdeOutput([...content, ...generated], "", saveFullOutput);
|
|
265
|
+
return {
|
|
266
|
+
content: [
|
|
267
|
+
...(limited.textTruncated
|
|
268
|
+
? [{ type: "text" as const, text: limited.text }]
|
|
269
|
+
: content.filter((block) => block.type === "text")),
|
|
270
|
+
...limited.images,
|
|
271
|
+
...(limited.notices.length
|
|
272
|
+
? [{ type: "text" as const, text: `\n\n${limited.notices.join("\n")}` }]
|
|
273
|
+
: []),
|
|
274
|
+
...metadata,
|
|
275
|
+
],
|
|
276
|
+
};
|
|
156
277
|
}
|
|
157
278
|
if (!names.has(event.toolName)) return;
|
|
158
279
|
const original = event.content
|
|
@@ -164,8 +285,22 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
164
285
|
record !== null && typeof record === "object" && "data" in record
|
|
165
286
|
? record
|
|
166
287
|
: { status: event.isError ? "error" : "success", data: record };
|
|
288
|
+
const data = outcome.data;
|
|
289
|
+
const targetUnavailable =
|
|
290
|
+
data !== null &&
|
|
291
|
+
typeof data === "object" &&
|
|
292
|
+
"effect" in data &&
|
|
293
|
+
data.effect === "applied" &&
|
|
294
|
+
"targetUnavailable" in data &&
|
|
295
|
+
typeof data.targetUnavailable === "string"
|
|
296
|
+
? data.targetUnavailable
|
|
297
|
+
: undefined;
|
|
298
|
+
const readable =
|
|
299
|
+
targetUnavailable === undefined
|
|
300
|
+
? original
|
|
301
|
+
: `${original}\n\nThis result has no verified text selection: ${targetUnavailable}\nRead/Search the file before the next edit; do not repeat the applied edit.`;
|
|
167
302
|
const resources = resultResources(outcome);
|
|
168
|
-
const shown = store.publish(outcome,
|
|
303
|
+
const shown = store.publish(outcome, readable, context.cwd, resources);
|
|
169
304
|
const parent = parents.get(event.toolCallId);
|
|
170
305
|
parents.delete(event.toolCallId);
|
|
171
306
|
if (parent !== undefined) {
|
|
@@ -180,9 +315,25 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
180
315
|
};
|
|
181
316
|
});
|
|
182
317
|
};
|
|
183
|
-
return { api: { ...pi, registerTool }, finalize };
|
|
318
|
+
return { api: { ...pi, on, registerTool }, finalize };
|
|
184
319
|
}
|
|
185
320
|
|
|
321
|
+
/** Read range notices belong to metadata, including reads spanning several resources. */
|
|
322
|
+
function outputNotices(details: unknown): string[] {
|
|
323
|
+
if (details === null || typeof details !== "object") return [];
|
|
324
|
+
const notices =
|
|
325
|
+
"outputNotice" in details && typeof details.outputNotice === "string"
|
|
326
|
+
? [details.outputNotice]
|
|
327
|
+
: [];
|
|
328
|
+
if ("resources" in details && Array.isArray(details.resources)) {
|
|
329
|
+
const resources: unknown[] = details.resources;
|
|
330
|
+
for (const result of resources) {
|
|
331
|
+
if (result !== null && typeof result === "object" && "details" in result)
|
|
332
|
+
notices.push(...outputNotices(result.details));
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return notices;
|
|
336
|
+
}
|
|
186
337
|
/** Keep opaque result bodies out of user-facing tool titles without changing execution inputs. */
|
|
187
338
|
function displaySources<Args extends Record<string, unknown>>(name: string, args: Args): Args {
|
|
188
339
|
const label = (value: unknown): unknown => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
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.3",
|
|
10
|
+
"pi-agent-invariant": "0.7.3",
|
|
11
|
+
"pi-agent-read": "0.7.3",
|
|
12
|
+
"pi-agent-resource": "0.7.3",
|
|
13
|
+
"pi-agent-text": "0.7.3",
|
|
14
|
+
"pi-agent-text-editor": "0.7.3"
|
|
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.3",
|
|
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.3",
|
|
10
|
+
"pi-agent-resource": "0.7.3"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-jq",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
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.3",
|
|
11
|
+
"pi-agent-documentation": "0.7.3",
|
|
12
|
+
"pi-agent-read": "0.7.3",
|
|
13
|
+
"pi-agent-text": "0.7.3"
|
|
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.3",
|
|
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.3",
|
|
7
|
+
"pi-agent-resource": "0.7.3"
|
|
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.3",
|
|
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.3",
|
|
10
|
+
"pi-agent-text": "0.7.3"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-doctor": "0.7.
|
|
12
|
-
"pi-agent-image": "0.7.
|
|
13
|
-
"pi-agent-read": "0.7.
|
|
14
|
-
"pi-agent-resource": "0.7.
|
|
15
|
-
"pi-agent-search": "0.7.
|
|
16
|
-
"pi-agent-text": "0.7.
|
|
11
|
+
"pi-agent-doctor": "0.7.3",
|
|
12
|
+
"pi-agent-image": "0.7.3",
|
|
13
|
+
"pi-agent-read": "0.7.3",
|
|
14
|
+
"pi-agent-resource": "0.7.3",
|
|
15
|
+
"pi-agent-search": "0.7.3",
|
|
16
|
+
"pi-agent-text": "0.7.3",
|
|
17
17
|
"playwright-core": "^1.62.1"
|
|
18
18
|
},
|
|
19
19
|
"pi": {
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-html",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-resource": "0.7.
|
|
11
|
+
"pi-agent-resource": "0.7.3"
|
|
12
12
|
},
|
|
13
13
|
"pi": {
|
|
14
14
|
"extensions": [
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-image",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-image": "0.7.
|
|
7
|
-
"pi-agent-resource": "0.7.
|
|
6
|
+
"pi-agent-image": "0.7.3",
|
|
7
|
+
"pi-agent-resource": "0.7.3"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-pdf",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
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.3",
|
|
7
|
+
"pi-agent-resource": "0.7.3"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-text",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-resource": "0.7.
|
|
7
|
-
"pi-agent-text": "0.7.
|
|
6
|
+
"pi-agent-resource": "0.7.3",
|
|
7
|
+
"pi-agent-text": "0.7.3"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -261,7 +261,8 @@ function formatUnsupportedBinaryResponse(
|
|
|
261
261
|
preview: Uint8Array,
|
|
262
262
|
): string {
|
|
263
263
|
const lines = [
|
|
264
|
-
"
|
|
264
|
+
"Unsupported binary response",
|
|
265
|
+
"Read cannot convert this Content-Type. Showing response metadata and a byte preview, not document text.",
|
|
265
266
|
`URL: ${requestedUrl.href}`,
|
|
266
267
|
`HTTP: ${response.status} ${response.statusText}`.trimEnd(),
|
|
267
268
|
`Content-Type: ${mediaType ?? "unknown"}`,
|
|
@@ -271,18 +272,15 @@ function formatUnsupportedBinaryResponse(
|
|
|
271
272
|
if (filename !== undefined) lines.push(`Filename: ${filename}`);
|
|
272
273
|
const length = response.headers.get("content-length");
|
|
273
274
|
if (length !== null) lines.push(`Content-Length: ${length}`);
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
lines.push(
|
|
282
|
-
|
|
283
|
-
`Preview: first ${preview.length} bytes (hex); the remaining body was not downloaded`,
|
|
284
|
-
formatHexPreview(preview),
|
|
285
|
-
);
|
|
275
|
+
const headers = [...response.headers]
|
|
276
|
+
.filter(
|
|
277
|
+
([name]) =>
|
|
278
|
+
!isSensitiveRedirectHeader(name) && name !== "content-type" && name !== "content-length",
|
|
279
|
+
)
|
|
280
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
281
|
+
.map(([name, value]) => `${name}: ${value}`);
|
|
282
|
+
if (headers.length > 0) lines.push("", "Headers:", ...headers);
|
|
283
|
+
lines.push("", `Preview: first ${preview.length} bytes (hex).`, formatHexPreview(preview));
|
|
286
284
|
return lines.join("\n");
|
|
287
285
|
}
|
|
288
286
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-read",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"pi-agent-documentation": "0.7.
|
|
28
|
-
"pi-agent-invariant": "0.7.
|
|
29
|
-
"pi-agent-resource": "0.7.
|
|
30
|
-
"pi-agent-text": "0.7.
|
|
31
|
-
"pi-agent-tool-call-interception": "0.7.
|
|
32
|
-
"pi-agent-tool-ui": "0.7.
|
|
27
|
+
"pi-agent-documentation": "0.7.3",
|
|
28
|
+
"pi-agent-invariant": "0.7.3",
|
|
29
|
+
"pi-agent-resource": "0.7.3",
|
|
30
|
+
"pi-agent-text": "0.7.3",
|
|
31
|
+
"pi-agent-tool-call-interception": "0.7.3",
|
|
32
|
+
"pi-agent-tool-ui": "0.7.3"
|
|
33
33
|
},
|
|
34
34
|
"pi": {
|
|
35
35
|
"extensions": [
|
|
@@ -34,13 +34,13 @@ export type ReadParameterText = Partial<Record<keyof ReadRequest, string>>;
|
|
|
34
34
|
|
|
35
35
|
// Keep the shared schema's metadata stable for Diff; these descriptions belong to Read.
|
|
36
36
|
const coreDescriptions: Record<keyof ReadRequest, string> = {
|
|
37
|
-
path: "
|
|
37
|
+
path: "Source to read: a resource path, unchanged source result or its UUID. Supply a source; an empty call cannot select one. temp:<id> reads saved output. raw:<local-file> reads original bytes from a regular file; relative, absolute and file:// paths are accepted.",
|
|
38
38
|
offset:
|
|
39
39
|
"For raw: sources, a zero-based integer byte offset; negative offsets count from the file end. For text sources, the first line to return, numbered from 1. Omit or use 0 to start at line 1; -1 starts at the last line, -10 at the tenth line from the end.",
|
|
40
40
|
limit:
|
|
41
|
-
"For raw: sources, a non-negative integer byte count (0 reads no bytes). For text sources, the maximum lines from the selected starting position. Omit for the
|
|
41
|
+
"For raw: sources, a non-negative integer byte count (0 reads no bytes). For text sources, the maximum lines from the selected starting position. Omit for the default read. For other non-text sources, use only a range form described for that source.",
|
|
42
42
|
views:
|
|
43
|
-
"
|
|
43
|
+
"Source-specific presentations. Omit for the source's default presentation. Supply settings after a colon using the syntax below. Combine views only when their contracts allow it. raw: sources do not accept views.",
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/** Build a fresh Read schema snapshot without changing the shared schema or accepted types. */
|
|
@@ -107,6 +107,8 @@ export interface FragmentResolverRegistration {
|
|
|
107
107
|
*/
|
|
108
108
|
export interface ReadViewRegistration {
|
|
109
109
|
readonly view: string;
|
|
110
|
+
/** Text views require source lines; native handlers may register views for any content. */
|
|
111
|
+
readonly contentKind?: "text" | "any";
|
|
110
112
|
/** Requested views whose complete presentation this view already provides. */
|
|
111
113
|
readonly includes?: readonly string[];
|
|
112
114
|
readonly presenter: TextLinePresenter;
|
|
@@ -164,6 +166,8 @@ export interface UnsupportedContentDetails {
|
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
export interface ReadResultDetails extends UnsupportedContentDetails {
|
|
169
|
+
/** Diagnostic readiness shown separately from canonical source lines. */
|
|
170
|
+
readonly diagnosticStatus?: string;
|
|
167
171
|
/** Explicit diagnostic checks; completed empty reports need no content panel. */
|
|
168
172
|
readonly diagnosticCheck?: {
|
|
169
173
|
readonly complete: boolean;
|
|
@@ -182,9 +186,13 @@ export interface ReadResultDetails extends UnsupportedContentDetails {
|
|
|
182
186
|
readonly totalLines?: number;
|
|
183
187
|
readonly truncation?: TruncationResult;
|
|
184
188
|
readonly temporarySource?: string;
|
|
189
|
+
/** Exact appended notice, outside the useful-output budget. */
|
|
190
|
+
readonly outputNotice?: string;
|
|
185
191
|
readonly lines?: readonly ReadTextLine[];
|
|
186
192
|
/** Requested view names that no registration backed; they were ignored. */
|
|
187
193
|
readonly ignoredViews?: readonly string[];
|
|
194
|
+
/** Situational presentation messages, kept outside source lines and script data. */
|
|
195
|
+
readonly viewWarnings?: readonly string[];
|
|
188
196
|
readonly failure?: ReadFailure;
|
|
189
197
|
}
|
|
190
198
|
|
|
@@ -316,6 +324,8 @@ export interface ReadToolPluginApi {
|
|
|
316
324
|
): Promise<ReadToolResult | undefined>;
|
|
317
325
|
/** Stores complete output for follow-up read access until this runtime is disposed. */
|
|
318
326
|
saveTemporary(text: string): Promise<string>;
|
|
327
|
+
/** Sets the saver used before the shared text budget truncates a Read result. */
|
|
328
|
+
setOutputSaver(saver: (text: string) => Promise<string>): void;
|
|
319
329
|
/** Executes the shared pipeline; script results are not clipped to the agent output budget. */
|
|
320
330
|
read(
|
|
321
331
|
request: ReadRequest,
|
|
@@ -357,6 +367,7 @@ const fragmentResolverRegistrationSchema = Type.Object({
|
|
|
357
367
|
});
|
|
358
368
|
const viewRegistrationSchema = Type.Object({
|
|
359
369
|
view: Type.String({ pattern: "\\S" }),
|
|
370
|
+
contentKind: Type.Optional(Type.Union([Type.Literal("text"), Type.Literal("any")])),
|
|
360
371
|
includes: Type.Optional(Type.Array(Type.String({ pattern: "\\S" }))),
|
|
361
372
|
presenter: Type.Object({ id: Type.String(), present: functionSchema }),
|
|
362
373
|
priority: Type.Optional(Type.Number()),
|
|
@@ -32,7 +32,7 @@ export default async function registerReadCore(
|
|
|
32
32
|
connectAgentDocumentation(pi, [
|
|
33
33
|
await loadPackagedAgentGuide({
|
|
34
34
|
id: "read-resources",
|
|
35
|
-
description: "
|
|
35
|
+
description: "Read results, selection boundaries, and composition",
|
|
36
36
|
triggers: [{ tool: "read" }],
|
|
37
37
|
}),
|
|
38
38
|
]);
|
|
@@ -201,6 +201,10 @@ function createPluginContributionController(
|
|
|
201
201
|
assertAvailable();
|
|
202
202
|
return read.saveTemporary(text);
|
|
203
203
|
},
|
|
204
|
+
setOutputSaver(saver) {
|
|
205
|
+
assertAvailable();
|
|
206
|
+
read.setOutputSaver(saver);
|
|
207
|
+
},
|
|
204
208
|
read(request, context, audience) {
|
|
205
209
|
assertAvailable();
|
|
206
210
|
return read.execute(request, context, audience);
|
|
@@ -368,7 +372,7 @@ function renderParameterDescriptions(
|
|
|
368
372
|
return Object.fromEntries(
|
|
369
373
|
Object.entries(entries).map(([parameter, descriptions]) => [
|
|
370
374
|
parameter,
|
|
371
|
-
[...new Set(descriptions)].join("\n"),
|
|
375
|
+
[...new Set(descriptions.flatMap((description) => description.split("\n")))].join("\n"),
|
|
372
376
|
]),
|
|
373
377
|
);
|
|
374
378
|
}
|