pi-agent-ide 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/README.md +8 -1
- package/dist/chunk-2P2OGO3G.js +2 -0
- package/dist/{chunk-5QQABP47.js → chunk-3BBJZSMS.js} +1 -1
- package/dist/chunk-5J43L2RL.js +11 -0
- package/dist/{chunk-ITSNK5YG.js → chunk-7AVXUV4A.js} +2 -2
- package/dist/chunk-BAYETTZZ.js +16 -0
- package/dist/{chunk-VCTK4JSN.js → chunk-BSICWXMH.js} +1 -1
- package/dist/chunk-BVK5A7ED.js +28 -0
- package/dist/{chunk-ZM4L5AGN.js → chunk-EDURPQAV.js} +3 -2
- package/dist/{chunk-L7JMDDSD.js → chunk-FBOW7XOV.js} +1 -1
- package/dist/{chunk-25CZ5ZIU.js → chunk-FUG2TEKI.js} +1 -1
- package/dist/chunk-FZBCKIJJ.js +1 -0
- package/dist/chunk-HPUAIWIH.js +25 -0
- package/dist/chunk-I5JLCFUX.js +1 -0
- package/dist/chunk-KUPHNMUK.js +2 -0
- package/dist/{chunk-NTYXZ3EL.js → chunk-KVHDMIZS.js} +1 -1
- package/dist/{chunk-QDST6VIU.js → chunk-KZC7TI5M.js} +1 -1
- package/dist/chunk-MIZAFRDR.js +1 -0
- package/dist/chunk-PJPA5EEE.js +2 -0
- package/dist/{chunk-GUTQ3PWL.js → chunk-PLKYHUNT.js} +1 -1
- package/dist/chunk-QEJGED4V.js +28 -0
- package/dist/chunk-SILJ3OL4.js +9 -0
- package/dist/{chunk-VXD6FZP5.js → chunk-TQZBVOTT.js} +3 -3
- package/dist/chunk-VBICI5YA.js +1 -0
- package/dist/chunk-VWW3RLUX.js +12 -0
- package/dist/{chunk-O6LE42GK.js → chunk-WJTHY6AG.js} +1 -1
- package/dist/chunk-YGGKGZO2.js +1 -0
- package/dist/chunk-ZODCBFBL.js +2 -0
- package/dist/chunk-ZPT5D4VP.js +2 -0
- package/dist/entry-0.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-16.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +2 -2
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +1 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +11 -11
- package/dist/entry-33.js +1 -1
- package/dist/entry-37.js +2 -2
- package/dist/entry-42.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +13 -12
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +4 -4
- package/dist/entry-51.js +9 -9
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-55.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -0
- package/dist/entry-72.js +0 -1
- package/dist/entry-73.js +1 -0
- package/dist/entry-74.js +0 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +1 -315
- package/dist/entry-78.js +324 -25
- package/dist/entry-79.js +18 -2
- package/dist/entry-80.js +2 -1
- package/dist/entry-81.js +1 -1
- package/dist/entry-82.js +1 -3
- package/dist/entry-83.js +5 -3
- package/dist/entry-84.js +3 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -0
- package/dist/pi-agent-ide.js +15 -3
- package/docs/agent-guides/apply.md +1 -1
- package/docs/agent-guides/editing.md +16 -0
- package/docs/agent-guides/json-reading.md +19 -3
- package/docs/agent-guides/read-resources.md +6 -0
- package/docs/agent-guides/search-code.md +5 -1
- package/docs/agent-guides/terminal.md +1 -1
- package/docs/code-review.md +99 -0
- package/docs/configuration.md +34 -0
- package/docs/development.md +15 -19
- package/docs/nightly.md +7 -0
- package/docs/releases.md +42 -0
- package/docs/research/native-codemode-batch-decision.md +27 -0
- package/docs/research/native-codemode-batching.md +65 -0
- package/docs/structured-results.md +59 -0
- package/docs/tools.md +18 -2
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-documentation/src/index.ts +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +6 -1
- package/node_modules/pi-agent-filesystem/package.json +7 -6
- package/node_modules/pi-agent-filesystem/src/path-recovery.ts +109 -0
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +10 -10
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +6 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +17 -0
- package/node_modules/pi-agent-ide-changes/index.ts +3 -9
- package/node_modules/pi-agent-ide-changes/package.json +8 -7
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +125 -47
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +19 -0
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-read/src/api/tools/read.ts +31 -2
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +216 -0
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +119 -72
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +12 -0
- package/node_modules/pi-agent-resource/src/resource-access.ts +55 -0
- package/node_modules/pi-agent-resource/src/resource-scheduler.ts +204 -0
- package/node_modules/pi-agent-resource/src/tool-result.ts +125 -0
- package/node_modules/pi-agent-search/package.json +5 -4
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/node_modules/pi-agent-search/src/api/search.ts +11 -0
- package/node_modules/pi-agent-search/src/api/structured-result.ts +93 -0
- package/node_modules/pi-agent-search/src/core/extension.ts +40 -14
- package/node_modules/pi-agent-search/src/core/search-core.ts +136 -77
- package/node_modules/pi-agent-search-text/index.ts +3 -0
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/resolvers.ts +17 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +104 -8
- package/node_modules/pi-agent-search-text/src/search-query.ts +42 -34
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +18 -4
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +37 -3
- package/node_modules/pi-agent-search-text/src/search-session.ts +21 -13
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-document.ts +15 -10
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +4 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/index.ts +4 -2
- package/node_modules/pi-agent-text-editor/package.json +21 -17
- package/node_modules/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +95 -34
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +20 -11
- package/node_modules/pi-agent-text-editor/src/core/apply/structured-result.ts +251 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +32 -12
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +154 -132
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +74 -18
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +640 -0
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +314 -0
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +52 -11
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +143 -138
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +242 -116
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +109 -47
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +24 -3
- package/node_modules/pi-agent-text-editor-renderer/index.ts +8 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +7 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +262 -129
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
- package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +16 -1
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +1 -0
- package/node_modules/pi-agent-web/index.ts +20 -0
- package/node_modules/pi-agent-web/package.json +8 -7
- package/node_modules/pi-agent-web/src/search.ts +112 -0
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-87.js +2 -0
- package/package.json +42 -36
- package/skills/capture-code-review-rule/SKILL.md +60 -0
- package/src/code-review/config.ts +68 -0
- package/src/code-review/extension.ts +105 -0
- package/src/code-review/fragments.ts +26 -0
- package/src/code-review/reviewer.ts +198 -0
- package/src/composite/host-version.ts +13 -0
- package/src/composite/nested-tool-rendering.ts +298 -0
- package/src/composite/tool-availability.ts +90 -0
- package/src/core/extension.ts +2 -0
- package/src/documentation/extension.ts +81 -145
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +6 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/path-recovery.ts +109 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +20 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-83.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +112 -0
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +31 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +216 -0
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +119 -72
- package/src/extensions/pi-agent-search/package.json +5 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +3 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +17 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +104 -8
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +42 -34
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +18 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +37 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +21 -13
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/src/extensions/pi-agent-search/src/api/search.ts +11 -0
- package/src/extensions/pi-agent-search/src/api/structured-result.ts +93 -0
- package/src/extensions/pi-agent-search/src/core/extension.ts +40 -14
- package/src/extensions/pi-agent-search/src/core/search-core.ts +136 -77
- package/src/extensions/pi-agent-text-editor/index.ts +4 -2
- package/src/extensions/pi-agent-text-editor/package.json +21 -17
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +4 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +8 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +7 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +262 -129
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +16 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +95 -34
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +20 -11
- package/src/extensions/pi-agent-text-editor/src/core/apply/structured-result.ts +251 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +32 -12
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +154 -132
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +74 -18
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +640 -0
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +314 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +52 -11
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +143 -138
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +242 -116
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +109 -47
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +24 -3
- package/src/pi-agent-ide.ts +61 -2
- package/src/plugins/pi-agent-ide-ast/package.json +10 -10
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +6 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +17 -0
- package/src/plugins/pi-agent-ide-changes/index.ts +3 -9
- package/src/plugins/pi-agent-ide-changes/package.json +8 -7
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +125 -47
- package/src/plugins/pi-agent-ide-debugger/index.ts +63 -17
- package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +18 -2
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +24 -4
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +68 -2
- package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +357 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -3
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +13 -13
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +19 -0
- package/src/plugins/pi-agent-ide-terminal/index.ts +12 -2
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +65 -30
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +13 -8
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +1 -0
- package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +100 -0
- package/src/plugins/pi-agent-ide-terminal/src/steering.ts +62 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +97 -45
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +3 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +15 -6
- package/src/plugins/pi-agent-ide-vision/index.ts +16 -1
- package/dist/chunk-3E2NTWCN.js +0 -2
- package/dist/chunk-4LUW26BX.js +0 -10
- package/dist/chunk-5VSE5X5R.js +0 -2
- package/dist/chunk-CEX3VOJ7.js +0 -2
- package/dist/chunk-FA6BKC5Y.js +0 -1
- package/dist/chunk-FEDVTZJG.js +0 -1
- package/dist/chunk-HMLH43ZS.js +0 -4
- package/dist/chunk-KII2JQC5.js +0 -1
- package/dist/chunk-LVWMWWWF.js +0 -28
- package/dist/chunk-P7XO5CIP.js +0 -2
- package/dist/chunk-PZFOOHY2.js +0 -15
- package/dist/chunk-S3ZPXWX7.js +0 -2
- package/dist/chunk-T7CZIACQ.js +0 -27
- package/dist/chunk-YT42LKFV.js +0 -16
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
- /package/dist/{chunk-4U2GUKNJ.js → chunk-F7NVAC4Q.js} +0 -0
- /package/dist/{chunk-ROXXK6TW.js → chunk-PXWDDBBC.js} +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-81.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
|
@@ -9,53 +9,29 @@ import {
|
|
|
9
9
|
type AgentDocumentation,
|
|
10
10
|
} from "#src/api/documentation.js";
|
|
11
11
|
import { AgentDocumentationRegistry } from "#src/documentation/registry.js";
|
|
12
|
-
import {
|
|
13
|
-
type InterceptResult,
|
|
14
|
-
registerToolCallInterceptor,
|
|
15
|
-
type ToolCallInterceptorHandler,
|
|
16
|
-
} from "pi-agent-text-editor/api/tool-call-interceptor";
|
|
17
12
|
|
|
18
13
|
interface RegistrationRequest {
|
|
19
14
|
readonly documents: readonly AgentDocumentation[];
|
|
20
15
|
}
|
|
21
16
|
|
|
22
|
-
|
|
17
|
+
const READ_RECORD = "agent-documentation-read";
|
|
18
|
+
|
|
19
|
+
/** Exposes packaged guides and adds unread guides to results without blocking tools. */
|
|
23
20
|
export default async function registerProgressiveDocumentation(pi: ExtensionAPI): Promise<void> {
|
|
24
21
|
const registry = new AgentDocumentationRegistry();
|
|
25
22
|
const claimed = new Set<string>();
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (context.toolCall.id.includes("-preflight-")) return;
|
|
35
|
-
const documents = claimMatchingGuides(
|
|
36
|
-
registry,
|
|
37
|
-
claimed,
|
|
38
|
-
context.toolCall.name,
|
|
39
|
-
context.partialArgs ?? context.args,
|
|
40
|
-
);
|
|
41
|
-
if (documents.length === 0) return;
|
|
42
|
-
fallbackGates.set(context.toolCall.id, documents);
|
|
43
|
-
sendGuideToAgent(pi, documents);
|
|
44
|
-
return guideGateResult(documents);
|
|
45
|
-
},
|
|
23
|
+
const parents = new Map<string, string>();
|
|
24
|
+
const pendingGuides = new Map<string, readonly AgentDocumentation[]>();
|
|
25
|
+
const remember = (ids: readonly string[]): void => {
|
|
26
|
+
const unread = ids.filter((id) => !claimed.has(id));
|
|
27
|
+
if (unread.length === 0) return;
|
|
28
|
+
// Separate records survive bounded nested-call metadata and stay on their own branch.
|
|
29
|
+
pi.appendEntry(READ_RECORD, { ids: unread });
|
|
30
|
+
for (const id of unread) claimed.add(id);
|
|
46
31
|
};
|
|
47
|
-
registerToolCallInterceptor(pi, gateHandler);
|
|
48
32
|
const unsubscribe = pi.events.on(DOCUMENTATION_REGISTER_EVENT, (value) => {
|
|
49
33
|
if (!isRegistrationRequest(value)) throw new Error("Invalid agent documentation registration");
|
|
50
34
|
registry.register(value.documents);
|
|
51
|
-
gatedToolNames.splice(
|
|
52
|
-
0,
|
|
53
|
-
gatedToolNames.length,
|
|
54
|
-
...new Set(
|
|
55
|
-
registry.list().flatMap((document) => document.triggers.map((trigger) => trigger.tool)),
|
|
56
|
-
),
|
|
57
|
-
);
|
|
58
|
-
registerToolCallInterceptor(pi, gateHandler);
|
|
59
35
|
});
|
|
60
36
|
pi.on("session_shutdown", unsubscribe);
|
|
61
37
|
|
|
@@ -101,54 +77,56 @@ export default async function registerProgressiveDocumentation(pi: ExtensionAPI)
|
|
|
101
77
|
pi.on("session_start", (_event, context) => {
|
|
102
78
|
restoreClaims(context.sessionManager.getBranch(), registry, claimed);
|
|
103
79
|
});
|
|
80
|
+
pi.on("session_tree", (_event, context) => {
|
|
81
|
+
restoreClaims(context.sessionManager.getBranch(), registry, claimed);
|
|
82
|
+
});
|
|
83
|
+
pi.on("session_compact", (_event, context) => {
|
|
84
|
+
restoreClaims(context.sessionManager.getBranch(), registry, claimed);
|
|
85
|
+
});
|
|
104
86
|
|
|
105
|
-
pi.on("tool_call", (event
|
|
106
|
-
if (process.env.PI_AGENT_IDE_TEST_SKIP_GUIDE_GATE === "1") return;
|
|
87
|
+
pi.on("tool_call", (event) => {
|
|
107
88
|
if (event.toolCallId.includes("-preflight-")) return;
|
|
108
|
-
|
|
109
|
-
const documents = claimMatchingGuides(registry, claimed, event.toolName, event.input);
|
|
110
|
-
if (documents.length === 0) return;
|
|
111
|
-
fallbackGates.set(event.toolCallId, documents);
|
|
112
|
-
sendGuideToAgent(pi, documents);
|
|
113
|
-
return { block: true, reason: guideNotice(documents) };
|
|
89
|
+
if (event.parentToolCallId !== undefined) parents.set(event.toolCallId, event.parentToolCallId);
|
|
114
90
|
});
|
|
115
|
-
pi.on("tool_result", (event
|
|
91
|
+
pi.on("tool_result", (event) => {
|
|
116
92
|
if (event.toolCallId.includes("-preflight-")) return;
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
details: documentationGateDetails(fallbackDocuments),
|
|
123
|
-
isError: true,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
restoreClaims(context.sessionManager.getBranch(), registry, claimed, event.toolCallId);
|
|
127
|
-
const docsSource = documentationSource(event.input);
|
|
93
|
+
const parent = parents.get(event.toolCallId);
|
|
94
|
+
parents.delete(event.toolCallId);
|
|
95
|
+
const inherited = pendingGuides.get(event.toolCallId) ?? [];
|
|
96
|
+
pendingGuides.delete(event.toolCallId);
|
|
97
|
+
const docsSource = event.toolName === "read" ? documentationSource(event.input) : undefined;
|
|
128
98
|
if (docsSource !== undefined) {
|
|
129
99
|
const id = docsSource.slice("docs:".length);
|
|
130
|
-
const available = registry.list();
|
|
131
100
|
const known = id.length === 0 || registry.get(id) !== undefined;
|
|
132
|
-
|
|
101
|
+
const document = registry.get(id);
|
|
102
|
+
if (document !== undefined && !event.isError && containsFullGuide(event.content, document))
|
|
103
|
+
remember([id]);
|
|
133
104
|
return {
|
|
134
105
|
content: event.content,
|
|
106
|
+
structuredContent: event.structuredContent,
|
|
135
107
|
details: {
|
|
136
108
|
...(isRecord(event.details) ? event.details : {}),
|
|
137
109
|
documentation: known
|
|
138
110
|
? id.length === 0
|
|
139
|
-
? { kind: "list", ids:
|
|
111
|
+
? { kind: "list", ids: registry.list().map((document) => document.id) }
|
|
140
112
|
: { kind: "document", id }
|
|
141
113
|
: { kind: "error", code: "UNKNOWN_DOCUMENTATION", id },
|
|
142
114
|
},
|
|
143
115
|
isError: event.isError,
|
|
144
116
|
};
|
|
145
117
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
118
|
+
const documents = [
|
|
119
|
+
...inherited,
|
|
120
|
+
...registry
|
|
121
|
+
.matching(event.toolName, event.input)
|
|
122
|
+
.filter((document) => !claimed.has(document.id)),
|
|
123
|
+
];
|
|
150
124
|
if (documents.length === 0) return;
|
|
151
|
-
|
|
125
|
+
remember(documents.map((document) => document.id));
|
|
126
|
+
// Native callers receive structured data, not this readable attachment.
|
|
127
|
+
// Keep the guide on the parent result so it reaches the agent even when data is filtered.
|
|
128
|
+
if (parent !== undefined && event.structuredContent !== undefined)
|
|
129
|
+
pendingGuides.set(parent, [...(pendingGuides.get(parent) ?? []), ...documents]);
|
|
152
130
|
return {
|
|
153
131
|
content: [
|
|
154
132
|
...event.content,
|
|
@@ -157,6 +135,7 @@ export default async function registerProgressiveDocumentation(pi: ExtensionAPI)
|
|
|
157
135
|
text: `\n\n---\n\n# Guide: ${document.id}\n\n${document.markdown.trim()}`,
|
|
158
136
|
})),
|
|
159
137
|
],
|
|
138
|
+
structuredContent: event.structuredContent,
|
|
160
139
|
details: {
|
|
161
140
|
...(isRecord(event.details) ? event.details : {}),
|
|
162
141
|
documentation: { kind: "attachment", ids: documents.map((document) => document.id) },
|
|
@@ -171,58 +150,6 @@ export default async function registerProgressiveDocumentation(pi: ExtensionAPI)
|
|
|
171
150
|
});
|
|
172
151
|
}
|
|
173
152
|
|
|
174
|
-
function claimMatchingGuides(
|
|
175
|
-
registry: AgentDocumentationRegistry,
|
|
176
|
-
claimed: Set<string>,
|
|
177
|
-
toolName: string,
|
|
178
|
-
input: unknown,
|
|
179
|
-
): readonly AgentDocumentation[] {
|
|
180
|
-
const documents = registry
|
|
181
|
-
.matching(toolName, input)
|
|
182
|
-
.filter((document) => !claimed.has(document.id));
|
|
183
|
-
for (const document of documents) claimed.add(document.id);
|
|
184
|
-
return documents;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function renderGuideGate(documents: readonly AgentDocumentation[]): string {
|
|
188
|
-
return [
|
|
189
|
-
"[SYSTEM] Read the attached guide before using this tool. Repeat the tool call after reading it.",
|
|
190
|
-
...documents.map(
|
|
191
|
-
(document) => `\n\n---\n\n# Guide: ${document.id}\n\n${document.markdown.trim()}`,
|
|
192
|
-
),
|
|
193
|
-
].join("");
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function guideNotice(documents: readonly AgentDocumentation[]): string {
|
|
197
|
-
return `Guide sent to agent: ${documents.map((document) => document.id).join(", ")}. Repeat the tool call.`;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function sendGuideToAgent(pi: ExtensionAPI, documents: readonly AgentDocumentation[]): void {
|
|
201
|
-
pi.sendMessage({
|
|
202
|
-
customType: "agent-documentation-first-use",
|
|
203
|
-
content: renderGuideGate(documents),
|
|
204
|
-
display: false,
|
|
205
|
-
details: documentationGateDetails(documents),
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function documentationGateDetails(documents: readonly AgentDocumentation[]): {
|
|
210
|
-
readonly documentation: { readonly kind: "gate"; readonly ids: readonly string[] };
|
|
211
|
-
} {
|
|
212
|
-
return { documentation: { kind: "gate", ids: documents.map((document) => document.id) } };
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function guideGateResult(documents: readonly AgentDocumentation[]): InterceptResult {
|
|
216
|
-
return {
|
|
217
|
-
annotation: { kind: "blocked", reason: "Read the first-use guide, then retry." },
|
|
218
|
-
message: {
|
|
219
|
-
customType: "agent-documentation-first-use",
|
|
220
|
-
content: guideNotice(documents),
|
|
221
|
-
display: false,
|
|
222
|
-
details: documentationGateDetails(documents),
|
|
223
|
-
},
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
153
|
function renderListing(documents: readonly AgentDocumentation[]): string {
|
|
227
154
|
if (documents.length === 0) return "No agent documentation is currently available.";
|
|
228
155
|
return [
|
|
@@ -235,7 +162,9 @@ function renderListing(documents: readonly AgentDocumentation[]): string {
|
|
|
235
162
|
function renderPromptGuideline(documents: readonly AgentDocumentation[]): string | undefined {
|
|
236
163
|
if (documents.length === 0) return undefined;
|
|
237
164
|
return [
|
|
238
|
-
"Read docs:<id>
|
|
165
|
+
"Read the matching docs:<id> before using any tool or feature with packaged guidance, including tools discovered later or called through Codemode. Read each guide once per branch. Tool descriptions and docs: listings do not replace the full guide.",
|
|
166
|
+
"If a result includes a Guide, read it before your next use. The call has already run: do not repeat it just to obtain documentation. Native structured child calls keep their guides on the parent result. Output readable-only child results to retain their guides; filtering those results can hide them.",
|
|
167
|
+
"Available documents:",
|
|
239
168
|
...documents.map((document) => ` - ${document.id} — ${document.description}`),
|
|
240
169
|
].join("\n");
|
|
241
170
|
}
|
|
@@ -244,48 +173,55 @@ function restoreClaims(
|
|
|
244
173
|
branch: readonly unknown[],
|
|
245
174
|
registry: AgentDocumentationRegistry,
|
|
246
175
|
claimed: Set<string>,
|
|
247
|
-
currentToolCallId?: string,
|
|
248
176
|
): void {
|
|
177
|
+
claimed.clear();
|
|
249
178
|
for (const entry of branch) {
|
|
250
|
-
if (!isRecord(entry)
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (typeof message.toolCallId === "string" && message.toolCallId.includes("-preflight-"))
|
|
179
|
+
if (!isRecord(entry)) continue;
|
|
180
|
+
if (entry.type === "custom" && entry.customType === READ_RECORD && isRecord(entry.data)) {
|
|
181
|
+
addIds(entry.data.ids);
|
|
254
182
|
continue;
|
|
255
|
-
if (message.role !== "toolResult" || typeof message.toolName !== "string") continue;
|
|
256
|
-
if (isRecord(message.details) && isRecord(message.details.documentation)) {
|
|
257
|
-
const documentation = message.details.documentation;
|
|
258
|
-
const ids = documentation.ids;
|
|
259
|
-
if (Array.isArray(ids)) {
|
|
260
|
-
for (const id of ids)
|
|
261
|
-
if (typeof id === "string" && registry.get(id) !== undefined) claimed.add(id);
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
if (
|
|
265
|
-
documentation.kind === "document" &&
|
|
266
|
-
typeof documentation.id === "string" &&
|
|
267
|
-
registry.get(documentation.id) !== undefined
|
|
268
|
-
) {
|
|
269
|
-
claimed.add(documentation.id);
|
|
270
|
-
continue;
|
|
271
|
-
}
|
|
272
183
|
}
|
|
273
|
-
|
|
274
|
-
|
|
184
|
+
if (entry.type !== "message" || !isRecord(entry.message)) continue;
|
|
185
|
+
const message = entry.message;
|
|
186
|
+
if (message.role !== "toolResult" || !isRecord(message.details)) continue;
|
|
187
|
+
const documentation = message.details.documentation;
|
|
188
|
+
if (!isRecord(documentation)) continue;
|
|
189
|
+
if (documentation.kind === "attachment") addIds(documentation.ids);
|
|
190
|
+
if (
|
|
191
|
+
documentation.kind === "document" &&
|
|
192
|
+
!message.isError &&
|
|
193
|
+
typeof documentation.id === "string"
|
|
194
|
+
) {
|
|
195
|
+
const document = registry.get(documentation.id);
|
|
196
|
+
if (document !== undefined && containsFullGuide(message.content, document))
|
|
197
|
+
addIds([document.id]);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function addIds(ids: unknown): void {
|
|
201
|
+
if (!Array.isArray(ids)) return;
|
|
202
|
+
for (const id of ids)
|
|
203
|
+
if (typeof id === "string" && registry.get(id) !== undefined) claimed.add(id);
|
|
275
204
|
}
|
|
276
205
|
}
|
|
277
206
|
|
|
207
|
+
function containsFullGuide(content: unknown, document: AgentDocumentation): boolean {
|
|
208
|
+
return (
|
|
209
|
+
Array.isArray(content) &&
|
|
210
|
+
content.some(
|
|
211
|
+
(part: unknown) =>
|
|
212
|
+
isRecord(part) &&
|
|
213
|
+
part.type === "text" &&
|
|
214
|
+
typeof part.text === "string" &&
|
|
215
|
+
part.text.includes(document.markdown.trim()),
|
|
216
|
+
)
|
|
217
|
+
);
|
|
218
|
+
}
|
|
278
219
|
function documentationSource(input: unknown): string | undefined {
|
|
279
220
|
if (!isRecord(input) || typeof input.path !== "string" || !input.path.startsWith("docs:"))
|
|
280
221
|
return undefined;
|
|
281
222
|
return input.path;
|
|
282
223
|
}
|
|
283
224
|
|
|
284
|
-
function sourceInput(details: unknown): { readonly path: string } | undefined {
|
|
285
|
-
if (!isRecord(details) || typeof details.source !== "string") return undefined;
|
|
286
|
-
return { path: details.source };
|
|
287
|
-
}
|
|
288
|
-
|
|
289
225
|
function isRegistrationRequest(value: unknown): value is RegistrationRequest {
|
|
290
226
|
return isRecord(value) && Array.isArray(value.documents);
|
|
291
227
|
}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from "pi-agent-text-editor/api/plugin-protocol";
|
|
16
16
|
|
|
17
17
|
import { createFilesystemReadResolver, createFilesystemWriteResolver } from "#src/resolver.js";
|
|
18
|
+
import { recoverFilesystemPath } from "#src/path-recovery.js";
|
|
18
19
|
|
|
19
20
|
const readTarget = { provider: "filesystem", capability: "read" } satisfies ContentTarget;
|
|
20
21
|
const writeTarget = { provider: "filesystem", capability: "write" } satisfies ContentTarget;
|
|
@@ -30,7 +31,11 @@ export default async function registerFilesystemPlugin(pi: ExtensionAPI): Promis
|
|
|
30
31
|
apiVersion: READ_API_VERSION,
|
|
31
32
|
id: "filesystem",
|
|
32
33
|
setup(api) {
|
|
33
|
-
api.addResolver({
|
|
34
|
+
api.addResolver({
|
|
35
|
+
resolver: readResolver,
|
|
36
|
+
renderResult: renderReadResult,
|
|
37
|
+
recoverFailure: recoverFilesystemPath,
|
|
38
|
+
});
|
|
34
39
|
api.describe(() =>
|
|
35
40
|
renderContentDescription(
|
|
36
41
|
"File path — file content; directory path — entry listing. Relative, absolute and file:// paths accepted.",
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.6.
|
|
10
|
-
"pi-agent-
|
|
11
|
-
"pi-agent-
|
|
12
|
-
"pi-agent-
|
|
13
|
-
"pi-agent-text
|
|
9
|
+
"pi-agent-image": "0.6.4",
|
|
10
|
+
"pi-agent-invariant": "0.6.4",
|
|
11
|
+
"pi-agent-read": "0.6.4",
|
|
12
|
+
"pi-agent-resource": "0.6.4",
|
|
13
|
+
"pi-agent-text": "0.6.4",
|
|
14
|
+
"pi-agent-text-editor": "0.6.4"
|
|
14
15
|
},
|
|
15
16
|
"pi": {
|
|
16
17
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.6.
|
|
10
|
-
"pi-agent-resource": "0.6.
|
|
9
|
+
"pi-agent-image": "0.6.4",
|
|
10
|
+
"pi-agent-resource": "0.6.4"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-jq",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"cross-spawn": "^7.0.6",
|
|
10
|
-
"pi-agent-doctor": "0.6.
|
|
11
|
-
"pi-agent-documentation": "0.6.
|
|
12
|
-
"pi-agent-read": "0.6.
|
|
13
|
-
"pi-agent-text": "0.6.
|
|
10
|
+
"pi-agent-doctor": "0.6.4",
|
|
11
|
+
"pi-agent-documentation": "0.6.4",
|
|
12
|
+
"pi-agent-read": "0.6.4",
|
|
13
|
+
"pi-agent-text": "0.6.4"
|
|
14
14
|
},
|
|
15
15
|
"pi": {
|
|
16
16
|
"extensions": [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.6.
|
|
7
|
-
"pi-agent-resource": "0.6.
|
|
6
|
+
"pi-agent-pdf": "0.6.4",
|
|
7
|
+
"pi-agent-resource": "0.6.4"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.6.
|
|
10
|
-
"pi-agent-text": "0.6.
|
|
9
|
+
"pi-agent-resource": "0.6.4",
|
|
10
|
+
"pi-agent-text": "0.6.4"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { realpath } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { requiredValue } from "pi-agent-invariant";
|
|
8
|
+
import type { ReadFailure } from "pi-agent-read/api/tools/read";
|
|
9
|
+
import type { ResourceResolverContext } from "pi-agent-resource";
|
|
10
|
+
|
|
11
|
+
/** Suggest exact workspace paths after a missing-file error; never open candidate content. */
|
|
12
|
+
export async function recoverFilesystemPath(
|
|
13
|
+
failure: ReadFailure,
|
|
14
|
+
context: ResourceResolverContext,
|
|
15
|
+
): Promise<ReadFailure["candidates"]> {
|
|
16
|
+
const cause = failure.cause;
|
|
17
|
+
const deadline = Date.now() + 500;
|
|
18
|
+
if (
|
|
19
|
+
context.signal?.aborted ||
|
|
20
|
+
failure.source === undefined ||
|
|
21
|
+
typeof cause !== "object" ||
|
|
22
|
+
cause === null ||
|
|
23
|
+
!("code" in cause) ||
|
|
24
|
+
cause.code !== "ENOENT"
|
|
25
|
+
)
|
|
26
|
+
return undefined;
|
|
27
|
+
const source = failure.source.startsWith("file://")
|
|
28
|
+
? fileURLToPath(failure.source)
|
|
29
|
+
: failure.source;
|
|
30
|
+
const relative = path.relative(context.cwd, path.resolve(context.cwd, source));
|
|
31
|
+
if (!insideWorkspace(relative) || relative.includes("#")) return undefined;
|
|
32
|
+
const name = path.basename(relative).toLowerCase();
|
|
33
|
+
if (name.length < 3 || name.length > 160) return undefined;
|
|
34
|
+
const bundled = path.join(
|
|
35
|
+
process.env.PI_CODING_AGENT_DIR ?? path.join(os.homedir(), ".pi", "agent"),
|
|
36
|
+
"bin",
|
|
37
|
+
process.platform === "win32" ? "rg.exe" : "rg",
|
|
38
|
+
);
|
|
39
|
+
const files = await new Promise<string[]>((resolve) => {
|
|
40
|
+
execFile(
|
|
41
|
+
existsSync(bundled) ? bundled : "rg",
|
|
42
|
+
["--files", "--hidden", "--no-config", "--no-ignore-parent", "--null", "--glob", "!.git/**"],
|
|
43
|
+
{
|
|
44
|
+
cwd: context.cwd,
|
|
45
|
+
timeout: 250,
|
|
46
|
+
maxBuffer: 2 * 1024 * 1024,
|
|
47
|
+
...(context.signal === undefined ? {} : { signal: context.signal }),
|
|
48
|
+
},
|
|
49
|
+
(error, stdout) => resolve(error ? [] : stdout.split("\0").filter(Boolean).slice(0, 20000)),
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
const maximumDistance = Math.min(3, Math.max(1, Math.floor(name.length * 0.2)));
|
|
53
|
+
const ranked = files
|
|
54
|
+
.flatMap((file) => {
|
|
55
|
+
if (context.signal?.aborted || Date.now() > deadline || !insideWorkspace(file)) return [];
|
|
56
|
+
const candidateName = path.basename(file).toLowerCase();
|
|
57
|
+
if (
|
|
58
|
+
candidateName.length > 160 ||
|
|
59
|
+
Math.abs(candidateName.length - name.length) > maximumDistance
|
|
60
|
+
)
|
|
61
|
+
return [];
|
|
62
|
+
const distance = editDistance(name, candidateName);
|
|
63
|
+
if (distance > maximumDistance) return [];
|
|
64
|
+
const directory = path.dirname(relative).toLowerCase();
|
|
65
|
+
const candidateDirectory = path.dirname(file).toLowerCase();
|
|
66
|
+
return [
|
|
67
|
+
{ path: file, distance, directoryDistance: directory === candidateDirectory ? 0 : 1 },
|
|
68
|
+
];
|
|
69
|
+
})
|
|
70
|
+
.sort(
|
|
71
|
+
(left, right) =>
|
|
72
|
+
left.distance - right.distance ||
|
|
73
|
+
left.directoryDistance - right.directoryDistance ||
|
|
74
|
+
left.path.localeCompare(right.path),
|
|
75
|
+
);
|
|
76
|
+
const candidates: { path: string }[] = [];
|
|
77
|
+
const root = await realpath(context.cwd);
|
|
78
|
+
for (const candidate of ranked.slice(0, 20)) {
|
|
79
|
+
if (context.signal?.aborted || Date.now() > deadline) return undefined;
|
|
80
|
+
try {
|
|
81
|
+
const target = await realpath(path.resolve(context.cwd, candidate.path));
|
|
82
|
+
if (insideWorkspace(path.relative(root, target))) candidates.push({ path: candidate.path });
|
|
83
|
+
} catch {
|
|
84
|
+
// Ignore files removed while searching.
|
|
85
|
+
}
|
|
86
|
+
if (candidates.length === 3) break;
|
|
87
|
+
}
|
|
88
|
+
return candidates.length ? candidates : undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function insideWorkspace(relative: string): boolean {
|
|
92
|
+
return relative !== "" && !/^\.\.(?:[\\/]|$)/u.test(relative) && !path.isAbsolute(relative);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function editDistance(left: string, right: string): number {
|
|
96
|
+
let previous = Array.from({ length: right.length + 1 }, (_, index) => index);
|
|
97
|
+
for (let row = 1; row <= left.length; row++) {
|
|
98
|
+
const current = [row];
|
|
99
|
+
for (let column = 1; column <= right.length; column++) {
|
|
100
|
+
current[column] = Math.min(
|
|
101
|
+
requiredValue(current[column - 1]) + 1,
|
|
102
|
+
requiredValue(previous[column]) + 1,
|
|
103
|
+
requiredValue(previous[column - 1]) + (left[row - 1] === right[column - 1] ? 0 : 1),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
previous = current;
|
|
107
|
+
}
|
|
108
|
+
return requiredValue(previous[right.length]);
|
|
109
|
+
}
|
|
@@ -11,6 +11,13 @@ import { type ContentTarget, createContentHost, renderContentDescription } from
|
|
|
11
11
|
|
|
12
12
|
import { webDoctorPlugin } from "#src/doctor-plugin.js";
|
|
13
13
|
import { createWebResolver } from "#src/resolver.js";
|
|
14
|
+
import { connectSearchPlugin } from "pi-agent-search/api/connect-plugin";
|
|
15
|
+
import {
|
|
16
|
+
SEARCH_API_VERSION,
|
|
17
|
+
SEARCH_PROTOCOL,
|
|
18
|
+
type SearchPlugin,
|
|
19
|
+
} from "pi-agent-search/api/plugin-protocol";
|
|
20
|
+
import { createWebSearchResolver } from "#src/search.js";
|
|
14
21
|
|
|
15
22
|
const readTarget = { provider: "web", capability: "read" } satisfies ContentTarget;
|
|
16
23
|
const renderWebResult = createReadResultRenderer({ kind: "markdown", label: "WEB" });
|
|
@@ -34,8 +41,21 @@ export default async function registerWeb(pi: ExtensionAPI): Promise<void> {
|
|
|
34
41
|
},
|
|
35
42
|
} satisfies ReadPlugin;
|
|
36
43
|
|
|
44
|
+
const searchPlugin = {
|
|
45
|
+
protocol: SEARCH_PROTOCOL,
|
|
46
|
+
apiVersion: SEARCH_API_VERSION,
|
|
47
|
+
id: "web",
|
|
48
|
+
setup(api) {
|
|
49
|
+
// Claim URL scopes before local query resolvers such as regex.
|
|
50
|
+
api.addResolver({ resolver: createWebSearchResolver(webResolver), priority: -100 });
|
|
51
|
+
api.addPromptGuideline(
|
|
52
|
+
"Use search with an HTTP(S) path to find text on a web page; no prior read is required.",
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
} satisfies SearchPlugin;
|
|
37
56
|
await Promise.all([
|
|
38
57
|
connectReadPlugin(pi, plugin),
|
|
58
|
+
connectSearchPlugin(pi, searchPlugin),
|
|
39
59
|
Promise.resolve(connectDoctorPlugin(pi, webDoctorPlugin)),
|
|
40
60
|
]);
|
|
41
61
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,16 +8,17 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-doctor": "0.6.
|
|
12
|
-
"pi-agent-image": "0.6.
|
|
13
|
-
"pi-agent-read": "0.6.
|
|
14
|
-
"pi-agent-resource": "0.6.
|
|
15
|
-
"pi-agent-
|
|
11
|
+
"pi-agent-doctor": "0.6.4",
|
|
12
|
+
"pi-agent-image": "0.6.4",
|
|
13
|
+
"pi-agent-read": "0.6.4",
|
|
14
|
+
"pi-agent-resource": "0.6.4",
|
|
15
|
+
"pi-agent-search": "0.6.4",
|
|
16
|
+
"pi-agent-text": "0.6.4",
|
|
16
17
|
"playwright-core": "^1.62.1"
|
|
17
18
|
},
|
|
18
19
|
"pi": {
|
|
19
20
|
"extensions": [
|
|
20
|
-
"./runtime/entry-
|
|
21
|
+
"./runtime/entry-83.js"
|
|
21
22
|
]
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
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.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-resource": "0.6.
|
|
11
|
+
"pi-agent-resource": "0.6.4"
|
|
12
12
|
},
|
|
13
13
|
"pi": {
|
|
14
14
|
"extensions": [
|
|
15
|
-
"./runtime/entry-
|
|
15
|
+
"./runtime/entry-84.js"
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-image",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-image": "0.6.
|
|
7
|
-
"pi-agent-resource": "0.6.
|
|
6
|
+
"pi-agent-image": "0.6.4",
|
|
7
|
+
"pi-agent-resource": "0.6.4"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-85.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|