pi-agent-ide 0.6.4 → 0.7.1
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 +45 -0
- package/README.md +2 -2
- package/dist/{chunk-AWXVJ5AC.js → chunk-2RTCSZB3.js} +1 -1
- package/dist/chunk-2TRHFMCZ.js +11 -0
- package/dist/{chunk-WJTHY6AG.js → chunk-4GCWGE2C.js} +1 -1
- package/dist/chunk-4XMY4H4V.js +1 -0
- package/dist/{chunk-BSICWXMH.js → chunk-64M3SQPG.js} +1 -1
- package/dist/{chunk-QEJGED4V.js → chunk-76ZK5ODR.js} +2 -2
- package/dist/{chunk-3BBJZSMS.js → chunk-7LD2OQH3.js} +1 -1
- package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
- package/dist/chunk-CWD4O5PM.js +3 -0
- package/dist/chunk-D3WTDA6V.js +2 -0
- package/dist/chunk-EAZGN5ND.js +7 -0
- package/dist/chunk-GXEGY7GV.js +1 -0
- package/dist/chunk-HZEY4GT4.js +2 -0
- package/dist/chunk-LEEQIQ7D.js +28 -0
- package/dist/chunk-NRZO5KJT.js +9 -0
- package/dist/chunk-OMVRLWMX.js +5 -0
- package/dist/{chunk-VBICI5YA.js → chunk-PGIVHICI.js} +1 -1
- package/dist/{chunk-FBOW7XOV.js → chunk-PKKDDIWW.js} +1 -1
- package/dist/chunk-PNU3E7IO.js +3 -0
- package/dist/chunk-PS2B6THP.js +3 -0
- package/dist/{chunk-FUG2TEKI.js → chunk-QFTBY67N.js} +2 -2
- package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
- package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
- package/dist/chunk-VMTR74FF.js +2 -0
- package/dist/{chunk-HPUAIWIH.js → chunk-WMO6RNE2.js} +1 -1
- package/dist/chunk-WU6ZK6YD.js +1 -0
- package/dist/{chunk-GIRAEVUJ.js → chunk-XH5WN5XA.js} +1 -1
- package/dist/chunk-XYS4FSCC.js +12 -0
- package/dist/chunk-YP46DVVP.js +2 -0
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +2 -2
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +2 -2
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +12 -9
- package/dist/entry-33.js +1 -1
- package/dist/entry-37.js +6 -6
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +13 -14
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +3 -6
- package/dist/entry-51.js +11 -9
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +0 -1
- package/dist/entry-62.js +1 -0
- package/dist/entry-63.js +0 -1
- package/dist/entry-64.js +1 -0
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.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 +0 -1
- package/dist/entry-72.js +1 -0
- package/dist/entry-73.js +0 -1
- package/dist/entry-74.js +1 -0
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +66 -1
- package/dist/entry-78.js +14 -325
- package/dist/entry-79.js +2 -18
- package/dist/entry-80.js +1 -2
- package/dist/entry-81.js +1 -1
- package/dist/entry-82.js +5 -1
- package/dist/entry-83.js +3 -5
- package/dist/entry-84.js +1 -3
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/pi-agent-ide.js +14 -9
- package/docs/agent-guides/editing.md +38 -33
- package/docs/agent-guides/git-changes.md +1 -1
- package/docs/agent-guides/read-resources.md +8 -4
- package/docs/agent-guides/search-code.md +34 -2
- package/docs/agent-guides/select-code.md +115 -0
- package/docs/configuration.md +12 -17
- package/docs/development.md +2 -1
- package/docs/releases.md +1 -1
- package/docs/research/apply-native-capability-matrix.md +174 -0
- package/docs/research/apply-read-latency.md +2 -0
- package/docs/research/lpt-393-fuzzy-results/file.json +152 -0
- package/docs/research/lpt-393-fuzzy-results/repo.json +122 -0
- package/docs/research/lpt-393-search-fuzzy-fallback.md +97 -0
- package/docs/research/native-codemode-batch-decision.md +2 -0
- package/docs/research/native-codemode-batching.md +1 -1
- package/docs/structured-results.md +30 -38
- package/docs/tools.md +11 -11
- package/docs/user-hooks.md +1 -1
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +7 -6
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/index.ts +4 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-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 +15 -10
- package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +193 -0
- package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +59 -0
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +5 -1
- package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +204 -0
- package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +2 -0
- package/node_modules/pi-agent-ide-ast/src/extension.ts +10 -5
- package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +184 -0
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +142 -27
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +104 -0
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +384 -0
- package/node_modules/pi-agent-ide-ast/src/selection-region.ts +41 -0
- package/node_modules/pi-agent-ide-ast/src/source-text.ts +92 -0
- package/node_modules/pi-agent-ide-ast/src/text-selection.ts +214 -0
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +268 -0
- package/node_modules/pi-agent-ide-changes/index.ts +6 -21
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +2 -2
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +11 -40
- 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 +5 -5
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +5 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +8 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +19 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +204 -118
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +2 -17
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +92 -45
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +40 -3
- package/node_modules/pi-agent-read/src/api/tools/read.ts +11 -1
- package/node_modules/pi-agent-read/src/core/extension.ts +18 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +50 -35
- package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +93 -0
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +5 -3
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +17 -3
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +10 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +407 -0
- package/node_modules/pi-agent-resource/src/tool-result.ts +13 -1
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search/src/api/fuzzy.ts +208 -0
- package/node_modules/pi-agent-search/src/api/presentation.ts +68 -0
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +9 -3
- package/node_modules/pi-agent-search/src/api/search-scope.ts +22 -0
- package/node_modules/pi-agent-search/src/api/search.ts +28 -0
- package/node_modules/pi-agent-search/src/api/structured-result.ts +69 -14
- package/node_modules/pi-agent-search/src/core/extension.ts +56 -16
- package/node_modules/pi-agent-search/src/core/search-core.ts +9 -1
- package/node_modules/pi-agent-search-text/index.ts +3 -1
- package/node_modules/pi-agent-search-text/package.json +7 -6
- package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +164 -0
- package/node_modules/pi-agent-search-text/src/resolvers.ts +161 -30
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +103 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +104 -17
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +89 -292
- package/node_modules/pi-agent-search-text/src/search-result.ts +77 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +96 -11
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/index.ts +65 -4
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/index.ts +0 -5
- package/node_modules/pi-agent-text-editor/package.json +26 -31
- package/node_modules/pi-agent-text-editor/runtime/entry-77.js +1 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -1
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +4 -23
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +22 -5
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +29 -4
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +4 -14
- package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +76 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +168 -0
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +217 -30
- package/node_modules/pi-agent-text-editor/src/core/result-input.ts +22 -0
- package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +78 -0
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +175 -0
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +86 -154
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +6 -1
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +0 -75
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +238 -244
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +9 -11
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -7
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +8 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +8 -3
- package/node_modules/pi-agent-text-editor-renderer/index.ts +1 -72
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +19 -5
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +19 -45
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +1 -0
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/src/index.ts +7 -0
- package/node_modules/pi-agent-tool-ui/src/result-panel.ts +298 -0
- package/node_modules/pi-agent-web/index.ts +7 -3
- package/node_modules/pi-agent-web/package.json +8 -8
- package/node_modules/pi-agent-web/runtime/entry-82.js +2 -0
- package/node_modules/pi-agent-web/src/search.ts +111 -2
- 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/package.json +35 -36
- package/src/composite/module-labels.ts +1 -1
- package/src/composite/preferences.ts +0 -5
- package/src/composite/text-results.ts +221 -0
- package/src/documentation/extension.ts +11 -9
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +7 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +4 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +7 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
- 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-html/runtime/entry-83.js +2 -0
- 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/runtime/entry-82.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +111 -2
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +40 -3
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +11 -1
- package/src/extensions/pi-agent-read/src/core/extension.ts +18 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +50 -35
- package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +93 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +5 -3
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +17 -3
- package/src/extensions/pi-agent-search/package.json +5 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +3 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +164 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +161 -30
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +103 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +104 -17
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +89 -292
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +77 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +96 -11
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +208 -0
- package/src/extensions/pi-agent-search/src/api/presentation.ts +68 -0
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +9 -3
- package/src/extensions/pi-agent-search/src/api/search-scope.ts +22 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +28 -0
- package/src/extensions/pi-agent-search/src/api/structured-result.ts +69 -14
- package/src/extensions/pi-agent-search/src/core/extension.ts +56 -16
- package/src/extensions/pi-agent-search/src/core/search-core.ts +9 -1
- package/src/extensions/pi-agent-text-editor/index.ts +0 -5
- package/src/extensions/pi-agent-text-editor/package.json +26 -31
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +65 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +1 -72
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +19 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +19 -45
- 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/runtime/entry-77.js +1 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -1
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +4 -23
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +22 -5
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +29 -4
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +4 -14
- package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +76 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +168 -0
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +217 -30
- package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +22 -0
- package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +78 -0
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +175 -0
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +86 -154
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +6 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +0 -75
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +238 -244
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +9 -11
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -7
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +8 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +8 -3
- package/src/pi-agent-ide.ts +4 -7
- package/src/plugins/pi-agent-ide-ast/package.json +15 -10
- package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +193 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +59 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +5 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +204 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +2 -0
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +10 -5
- package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +184 -0
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +142 -27
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +104 -0
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +384 -0
- package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +41 -0
- package/src/plugins/pi-agent-ide-ast/src/source-text.ts +92 -0
- package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +214 -0
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +268 -0
- package/src/plugins/pi-agent-ide-changes/index.ts +6 -21
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +2 -2
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +11 -40
- package/src/plugins/pi-agent-ide-debugger/index.ts +5 -3
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +5 -3
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/index.ts +5 -5
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +5 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +8 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +19 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +204 -118
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +2 -17
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +92 -45
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +10 -36
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -1
- package/src/plugins/pi-agent-ide-vision/index.ts +31 -4
- package/dist/chunk-2P2OGO3G.js +0 -2
- package/dist/chunk-5J43L2RL.js +0 -11
- package/dist/chunk-6EYWFBNG.js +0 -0
- package/dist/chunk-7AVXUV4A.js +0 -7
- package/dist/chunk-7WCZOO5I.js +0 -1
- package/dist/chunk-BAYETTZZ.js +0 -16
- package/dist/chunk-BVK5A7ED.js +0 -28
- package/dist/chunk-F7NVAC4Q.js +0 -0
- package/dist/chunk-FZBCKIJJ.js +0 -1
- package/dist/chunk-I5JLCFUX.js +0 -1
- package/dist/chunk-KUPHNMUK.js +0 -2
- package/dist/chunk-MIZAFRDR.js +0 -1
- package/dist/chunk-PJPA5EEE.js +0 -2
- package/dist/chunk-PXWDDBBC.js +0 -0
- package/dist/chunk-SILJ3OL4.js +0 -9
- package/dist/chunk-TQZBVOTT.js +0 -5
- package/dist/chunk-VWW3RLUX.js +0 -12
- package/dist/chunk-YHUTTZC6.js +0 -2
- package/dist/chunk-ZODCBFBL.js +0 -2
- package/dist/entry-87.js +0 -1
- package/docs/agent-guides/apply.md +0 -333
- package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +0 -3
- package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +0 -159
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +0 -405
- package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +0 -50
- package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +0 -11
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +0 -203
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +0 -55
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +0 -276
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +0 -13
- package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +0 -25
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +0 -405
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +0 -137
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
- package/node_modules/pi-agent-text-editor/src/core/apply/structured-result.ts +0 -251
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +0 -168
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +0 -942
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +0 -1
- package/node_modules/pi-agent-web-text/runtime/entry-87.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +0 -3
- package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +0 -159
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +0 -405
- package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +0 -50
- package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +0 -11
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +0 -203
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +0 -55
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +0 -276
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +0 -13
- package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +0 -25
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +0 -405
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +0 -137
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
- package/src/extensions/pi-agent-text-editor/src/core/apply/structured-result.ts +0 -251
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +0 -168
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +0 -942
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-editor-renderer}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-79.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-81.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-84.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-85.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-84.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-85.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-79.js +0 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import {
|
|
3
|
+
getLanguageFromPath,
|
|
4
|
+
highlightCode,
|
|
5
|
+
keyText,
|
|
6
|
+
type Theme,
|
|
7
|
+
type ThemeColor,
|
|
8
|
+
} from "@earendil-works/pi-coding-agent";
|
|
9
|
+
import {
|
|
10
|
+
type Component,
|
|
11
|
+
truncateToWidth,
|
|
12
|
+
visibleWidth,
|
|
13
|
+
wrapTextWithAnsi,
|
|
14
|
+
sliceByColumn,
|
|
15
|
+
} from "@earendil-works/pi-tui";
|
|
16
|
+
import { singleLine, preserveEnclosingBackground } from "./index.js";
|
|
17
|
+
|
|
18
|
+
/** Source identity, highlighted code, or a concise explanation inside one result frame. */
|
|
19
|
+
export type ResultPanelRow =
|
|
20
|
+
| {
|
|
21
|
+
readonly kind: "source";
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly link?: string;
|
|
24
|
+
readonly count?: number;
|
|
25
|
+
readonly badge?: string;
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
readonly kind: "line";
|
|
29
|
+
readonly lineNumber: number;
|
|
30
|
+
readonly text: string;
|
|
31
|
+
readonly ranges: readonly { readonly from: number; readonly to: number }[];
|
|
32
|
+
}
|
|
33
|
+
| { readonly kind: "note"; readonly text: string; readonly expandedOnly?: boolean };
|
|
34
|
+
|
|
35
|
+
/** Presentation only: these rows never grant source or edit authority. */
|
|
36
|
+
export interface ResultPanelModel {
|
|
37
|
+
readonly summary: string;
|
|
38
|
+
readonly rows: readonly ResultPanelRow[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** A shared, bounded Search-style result frame for both source and readonly records. */
|
|
42
|
+
export class ResultPanel implements Component {
|
|
43
|
+
private cache: { width: number; lines: string[] } | undefined;
|
|
44
|
+
public constructor(
|
|
45
|
+
private model: ResultPanelModel,
|
|
46
|
+
private theme: Theme,
|
|
47
|
+
private expanded: boolean,
|
|
48
|
+
) {}
|
|
49
|
+
public update(model: ResultPanelModel, theme: Theme, expanded: boolean): void {
|
|
50
|
+
this.model = model;
|
|
51
|
+
this.theme = theme;
|
|
52
|
+
this.expanded = expanded;
|
|
53
|
+
this.invalidate();
|
|
54
|
+
}
|
|
55
|
+
public invalidate(): void {
|
|
56
|
+
this.cache = undefined;
|
|
57
|
+
}
|
|
58
|
+
public render(width: number): string[] {
|
|
59
|
+
if (this.cache?.width === width) return [...this.cache.lines];
|
|
60
|
+
if (width < 4) return [truncateToWidth(singleLine(this.model.summary), Math.max(1, width))];
|
|
61
|
+
const inner = width - 2;
|
|
62
|
+
const rows = this.model.rows.filter(
|
|
63
|
+
(row) => row.kind !== "note" || !row.expandedOnly || this.expanded,
|
|
64
|
+
);
|
|
65
|
+
const gutter = Math.max(
|
|
66
|
+
3,
|
|
67
|
+
...rows.map((row) => (row.kind === "line" ? String(row.lineNumber).length : 0)),
|
|
68
|
+
);
|
|
69
|
+
// Bound layout work as well as the finished compact viewport.
|
|
70
|
+
const selected = this.expanded ? rows : rows.slice(0, 13);
|
|
71
|
+
const code = highlightSourceRows(selected, this.theme);
|
|
72
|
+
let body = selected.flatMap((row) => this.renderRow(row, inner, gutter, code.get(row)));
|
|
73
|
+
if (!this.expanded && (body.length > 12 || selected.length < rows.length)) {
|
|
74
|
+
body = [
|
|
75
|
+
...body.slice(0, 11),
|
|
76
|
+
this.frame(
|
|
77
|
+
this.theme.fg("dim", ` … output truncated · ${keyText("app.tools.expand")} to expand`),
|
|
78
|
+
inner,
|
|
79
|
+
),
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
const title = truncateToWidth(` ${singleLine(this.model.summary)} `, inner - 1, "");
|
|
83
|
+
const border = (s: string) => this.theme.fg("borderMuted", s);
|
|
84
|
+
const output = [
|
|
85
|
+
`${border("╭─")}${this.theme.fg("accent", title)}${border(`${"─".repeat(Math.max(0, inner - visibleWidth(title) - 1))}╮`)}`,
|
|
86
|
+
...body,
|
|
87
|
+
border(`╰${"─".repeat(inner)}╯`),
|
|
88
|
+
].map((line) => truncateToWidth(line, width));
|
|
89
|
+
this.cache = { width, lines: output };
|
|
90
|
+
return [...output];
|
|
91
|
+
}
|
|
92
|
+
private frame(content: string, width: number, highlighted = false): string {
|
|
93
|
+
const clipped = truncateToWidth(content, width);
|
|
94
|
+
let body = clipped + " ".repeat(Math.max(0, width - visibleWidth(clipped)));
|
|
95
|
+
if (highlighted) {
|
|
96
|
+
const background = this.theme.bg("selectedBg", "").replace(/\u001B\[(?:0|49)m/gu, "");
|
|
97
|
+
body = this.theme.bg("selectedBg", preserveEnclosingBackground(body, background));
|
|
98
|
+
}
|
|
99
|
+
const border = this.theme.fg("borderMuted", "│");
|
|
100
|
+
return `${border}${body}${border}`;
|
|
101
|
+
}
|
|
102
|
+
private renderRow(row: ResultPanelRow, width: number, gutter: number, code?: string): string[] {
|
|
103
|
+
if (row.kind === "source") {
|
|
104
|
+
const badge = this.theme.fg(
|
|
105
|
+
badgeColor(row.label),
|
|
106
|
+
this.theme.bold(row.badge ?? fileBadge(row.label)),
|
|
107
|
+
);
|
|
108
|
+
const count =
|
|
109
|
+
row.count === undefined ? "" : this.theme.fg("accent", this.theme.bold(String(row.count)));
|
|
110
|
+
const available = Math.max(1, width - visibleWidth(badge) - visibleWidth(count) - 4);
|
|
111
|
+
const safe = singleLine(row.label);
|
|
112
|
+
const label =
|
|
113
|
+
visibleWidth(safe) <= available
|
|
114
|
+
? safe
|
|
115
|
+
: `…${sliceByColumn(safe, Math.max(0, visibleWidth(safe) - available + 1), available - 1, true)}`;
|
|
116
|
+
const separator = Math.max(label.lastIndexOf("/"), label.lastIndexOf("\\"));
|
|
117
|
+
const directory = label.slice(0, separator + 1);
|
|
118
|
+
const basename = label.slice(separator + 1);
|
|
119
|
+
let linked =
|
|
120
|
+
this.theme.fg("muted", directory) + this.theme.underline(this.theme.fg("accent", basename));
|
|
121
|
+
if (row.link && !/[\u0000-\u001F\u007F]/u.test(row.link))
|
|
122
|
+
linked = `\u001B]8;;${row.link}\u0007${linked}\u001B]8;;\u0007`;
|
|
123
|
+
const left = ` ${badge} ${linked}`;
|
|
124
|
+
return [
|
|
125
|
+
this.frame(
|
|
126
|
+
`${left}${" ".repeat(Math.max(1, width - visibleWidth(left) - visibleWidth(count) - 1))}${count} `,
|
|
127
|
+
width,
|
|
128
|
+
true,
|
|
129
|
+
),
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
if (row.kind === "note")
|
|
133
|
+
return [this.frame(this.theme.fg("dim", ` ${singleLine(row.text).slice(0, 2048)}`), width)];
|
|
134
|
+
const number = this.theme.fg("dim", String(row.lineNumber).padStart(gutter));
|
|
135
|
+
const prefix = ` ${number} ${this.theme.fg("borderMuted", "│")} `;
|
|
136
|
+
const available = Math.max(1, width - visibleWidth(prefix) - 1);
|
|
137
|
+
const preview = previewLine(row);
|
|
138
|
+
const wrapped = wrapTextWithAnsi(highlight(preview, this.theme, code), available);
|
|
139
|
+
const rendered = wrapped.map((line, index) =>
|
|
140
|
+
this.frame(`${index ? " ".repeat(visibleWidth(prefix)) : prefix}${line}`, width),
|
|
141
|
+
);
|
|
142
|
+
if (preview !== row)
|
|
143
|
+
rendered.push(
|
|
144
|
+
this.frame(this.theme.fg("dim", " … line shortened · read source for full text"), width),
|
|
145
|
+
);
|
|
146
|
+
return rendered;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** One exact source-line preview; offsets are UTF-16 positions in the unstyled text. */
|
|
151
|
+
export interface SourcePreview {
|
|
152
|
+
readonly source: string;
|
|
153
|
+
readonly label: string;
|
|
154
|
+
readonly link?: string;
|
|
155
|
+
readonly badge?: string;
|
|
156
|
+
readonly lineNumber: number;
|
|
157
|
+
readonly text: string;
|
|
158
|
+
readonly ranges: readonly { readonly from: number; readonly to: number }[];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Group source lines and merge highlights without duplicating context or changing input data. */
|
|
162
|
+
export function sourceRows(previews: readonly SourcePreview[]): ResultPanelRow[] {
|
|
163
|
+
const groups = new Map<
|
|
164
|
+
string,
|
|
165
|
+
{
|
|
166
|
+
first: SourcePreview;
|
|
167
|
+
lines: Map<number, { text: string; ranges: { from: number; to: number }[] }>;
|
|
168
|
+
}
|
|
169
|
+
>();
|
|
170
|
+
for (const preview of previews) {
|
|
171
|
+
let group = groups.get(preview.source);
|
|
172
|
+
if (!group) {
|
|
173
|
+
group = { first: preview, lines: new Map() };
|
|
174
|
+
groups.set(preview.source, group);
|
|
175
|
+
}
|
|
176
|
+
const previous = group.lines.get(preview.lineNumber);
|
|
177
|
+
if (previous) previous.ranges.push(...preview.ranges);
|
|
178
|
+
else group.lines.set(preview.lineNumber, { text: preview.text, ranges: [...preview.ranges] });
|
|
179
|
+
}
|
|
180
|
+
return [...groups.values()].flatMap(({ first, lines }): ResultPanelRow[] => [
|
|
181
|
+
{
|
|
182
|
+
kind: "source",
|
|
183
|
+
label: first.label,
|
|
184
|
+
...(first.link === undefined ? {} : { link: first.link }),
|
|
185
|
+
...(first.badge === undefined ? {} : { badge: first.badge }),
|
|
186
|
+
},
|
|
187
|
+
...[...lines.entries()]
|
|
188
|
+
.sort(([a], [b]) => a - b)
|
|
189
|
+
.map(([lineNumber, line]): ResultPanelRow => ({
|
|
190
|
+
kind: "line",
|
|
191
|
+
lineNumber,
|
|
192
|
+
text: line.text,
|
|
193
|
+
ranges: line.ranges,
|
|
194
|
+
})),
|
|
195
|
+
]);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function previewLine(row: Extract<ResultPanelRow, { kind: "line" }>): typeof row {
|
|
199
|
+
if (row.text.length <= 2048) return row;
|
|
200
|
+
const start = Math.max(0, (row.ranges[0]?.from ?? 0) - 64);
|
|
201
|
+
const end = Math.min(row.text.length, start + 256);
|
|
202
|
+
const prefix = start ? "…" : "";
|
|
203
|
+
return {
|
|
204
|
+
...row,
|
|
205
|
+
text: `${prefix}${row.text.slice(start, end)}${end < row.text.length ? "…" : ""}`,
|
|
206
|
+
ranges: row.ranges
|
|
207
|
+
.filter((r) => r.from < end && r.to > start)
|
|
208
|
+
.map((r) => ({
|
|
209
|
+
from: Math.max(r.from, start) - start + prefix.length,
|
|
210
|
+
to: Math.min(r.to, end) - start + prefix.length,
|
|
211
|
+
})),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function highlightSourceRows(
|
|
215
|
+
rows: readonly ResultPanelRow[],
|
|
216
|
+
theme: Theme,
|
|
217
|
+
): Map<ResultPanelRow, string> {
|
|
218
|
+
const output = new Map<ResultPanelRow, string>();
|
|
219
|
+
let language: string | undefined;
|
|
220
|
+
let group: Extract<ResultPanelRow, { kind: "line" }>[] = [];
|
|
221
|
+
const flush = () => {
|
|
222
|
+
if (!group.length) return;
|
|
223
|
+
const source = group.map((row) => safeCode(previewLine(row).text));
|
|
224
|
+
const colored = language
|
|
225
|
+
? highlightCode(source.join("\n"), language)
|
|
226
|
+
: source.map((text) => theme.fg("toolOutput", text));
|
|
227
|
+
group.forEach((row, index) => output.set(row, colored[index] ?? source[index] ?? ""));
|
|
228
|
+
group = [];
|
|
229
|
+
};
|
|
230
|
+
for (const row of rows) {
|
|
231
|
+
if (row.kind === "source") {
|
|
232
|
+
flush();
|
|
233
|
+
language =
|
|
234
|
+
row.badge === "WEB" || row.badge === "SH" ? undefined : getLanguageFromPath(row.label);
|
|
235
|
+
} else if (row.kind === "line") {
|
|
236
|
+
if (group.at(-1)?.lineNumber !== row.lineNumber - 1) flush();
|
|
237
|
+
group.push(row);
|
|
238
|
+
} else flush();
|
|
239
|
+
}
|
|
240
|
+
flush();
|
|
241
|
+
return output;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function highlight(
|
|
245
|
+
row: Extract<ResultPanelRow, { kind: "line" }>,
|
|
246
|
+
theme: Theme,
|
|
247
|
+
code?: string,
|
|
248
|
+
): string {
|
|
249
|
+
const styled = code ?? theme.fg("toolOutput", safeCode(row.text));
|
|
250
|
+
if (!row.ranges.length) return styled;
|
|
251
|
+
const fragment = (from: number, to: number) =>
|
|
252
|
+
sliceByColumn(
|
|
253
|
+
styled,
|
|
254
|
+
visibleWidth(safeCode(row.text.slice(0, from))),
|
|
255
|
+
visibleWidth(safeCode(row.text.slice(from, to))),
|
|
256
|
+
true,
|
|
257
|
+
);
|
|
258
|
+
const background = theme.bg("selectedBg", "").replace(/\u001B\[(?:0|49)m/gu, "");
|
|
259
|
+
let result = "";
|
|
260
|
+
let offset = 0;
|
|
261
|
+
for (const range of [...row.ranges].sort((a, b) => a.from - b.from)) {
|
|
262
|
+
const from = Math.max(offset, Math.min(row.text.length, range.from));
|
|
263
|
+
const to = Math.max(from, Math.min(row.text.length, range.to));
|
|
264
|
+
result += fragment(offset, from);
|
|
265
|
+
if (to > from)
|
|
266
|
+
result += theme.bg(
|
|
267
|
+
"selectedBg",
|
|
268
|
+
preserveEnclosingBackground(theme.bold(fragment(from, to)), background),
|
|
269
|
+
);
|
|
270
|
+
offset = to;
|
|
271
|
+
}
|
|
272
|
+
return result + fragment(offset, row.text.length);
|
|
273
|
+
}
|
|
274
|
+
function safeCode(text: string): string {
|
|
275
|
+
return singleLine(text.replaceAll("\t", " "));
|
|
276
|
+
}
|
|
277
|
+
function fileBadge(label: string): string {
|
|
278
|
+
return (
|
|
279
|
+
(
|
|
280
|
+
{
|
|
281
|
+
".ts": "TS",
|
|
282
|
+
".tsx": "TX",
|
|
283
|
+
".js": "JS",
|
|
284
|
+
".jsx": "JX",
|
|
285
|
+
".json": "{}",
|
|
286
|
+
".md": "MD",
|
|
287
|
+
".py": "PY",
|
|
288
|
+
".rs": "RS",
|
|
289
|
+
".go": "GO",
|
|
290
|
+
".css": "CS",
|
|
291
|
+
".html": "<>",
|
|
292
|
+
} as Record<string, string>
|
|
293
|
+
)[path.extname(label).toLowerCase()] ?? "◇"
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
function badgeColor(label: string): ThemeColor {
|
|
297
|
+
return /\.(?:js|jsx|json)$/iu.test(label) ? "warning" : "accent";
|
|
298
|
+
}
|
|
@@ -35,9 +35,10 @@ export default async function registerWeb(pi: ExtensionAPI): Promise<void> {
|
|
|
35
35
|
renderResult: renderWebResult,
|
|
36
36
|
preserveTruncatedOutput: true,
|
|
37
37
|
});
|
|
38
|
-
api.describe(
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
api.describe({
|
|
39
|
+
path: () =>
|
|
40
|
+
renderContentDescription("HTTP(S) URL — remote content.", readHost.listDescriptions()),
|
|
41
|
+
});
|
|
41
42
|
},
|
|
42
43
|
} satisfies ReadPlugin;
|
|
43
44
|
|
|
@@ -48,6 +49,9 @@ export default async function registerWeb(pi: ExtensionAPI): Promise<void> {
|
|
|
48
49
|
setup(api) {
|
|
49
50
|
// Claim URL scopes before local query resolvers such as regex.
|
|
50
51
|
api.addResolver({ resolver: createWebSearchResolver(webResolver), priority: -100 });
|
|
52
|
+
api.describe(
|
|
53
|
+
"HTTP(S) Search reuses converted page text for zero-result identifier spelling suggestions. Candidate groups carry the URL and line ranges, never editable SEARCH references.",
|
|
54
|
+
);
|
|
51
55
|
api.addPromptGuideline(
|
|
52
56
|
"Use search with an HTTP(S) path to find text on a web page; no prior read is required.",
|
|
53
57
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-doctor": "0.
|
|
12
|
-
"pi-agent-image": "0.
|
|
13
|
-
"pi-agent-read": "0.
|
|
14
|
-
"pi-agent-resource": "0.
|
|
15
|
-
"pi-agent-search": "0.
|
|
16
|
-
"pi-agent-text": "0.
|
|
11
|
+
"pi-agent-doctor": "0.7.1",
|
|
12
|
+
"pi-agent-image": "0.7.1",
|
|
13
|
+
"pi-agent-read": "0.7.1",
|
|
14
|
+
"pi-agent-resource": "0.7.1",
|
|
15
|
+
"pi-agent-search": "0.7.1",
|
|
16
|
+
"pi-agent-text": "0.7.1",
|
|
17
17
|
"playwright-core": "^1.62.1"
|
|
18
18
|
},
|
|
19
19
|
"pi": {
|
|
20
20
|
"extensions": [
|
|
21
|
-
"./runtime/entry-
|
|
21
|
+
"./runtime/entry-82.js"
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { ResourceResolver } from "pi-agent-resource";
|
|
2
2
|
import {
|
|
3
3
|
selectionData,
|
|
4
|
+
renderSearchMatches,
|
|
5
|
+
FuzzyVocabulary,
|
|
6
|
+
fuzzyLimits,
|
|
7
|
+
isFuzzyQuery,
|
|
8
|
+
rankFuzzyIdentifiers,
|
|
9
|
+
fuzzyCandidateData,
|
|
10
|
+
formatFuzzyCandidate,
|
|
11
|
+
type FuzzyResult,
|
|
4
12
|
type SearchRequest,
|
|
5
13
|
type SearchResolver,
|
|
6
14
|
type SearchSelectionMatch,
|
|
@@ -10,6 +18,7 @@ interface WebSearchResult {
|
|
|
10
18
|
readonly source: string;
|
|
11
19
|
readonly matches: readonly SearchSelectionMatch[];
|
|
12
20
|
readonly complete: boolean;
|
|
21
|
+
readonly fuzzy?: FuzzyResult;
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
/** Search the same converted HTTP(S) content as Read, without treating URLs as files. */
|
|
@@ -66,14 +75,42 @@ export function createWebSearchResolver(web: ResourceResolver): SearchResolver {
|
|
|
66
75
|
});
|
|
67
76
|
}
|
|
68
77
|
}
|
|
78
|
+
const fuzzy =
|
|
79
|
+
matches.length === 0 && isFuzzyQuery(request.query)
|
|
80
|
+
? searchFuzzyText(text, source, request.query, context.signal)
|
|
81
|
+
: undefined;
|
|
69
82
|
return {
|
|
70
83
|
kind: "resolved",
|
|
71
|
-
payload: {
|
|
84
|
+
payload: {
|
|
85
|
+
source,
|
|
86
|
+
matches,
|
|
87
|
+
complete: true,
|
|
88
|
+
...(fuzzy === undefined ? {} : { fuzzy }),
|
|
89
|
+
} satisfies WebSearchResult,
|
|
72
90
|
};
|
|
73
91
|
},
|
|
74
92
|
toScriptData(payload) {
|
|
75
93
|
const result = payload as WebSearchResult;
|
|
76
|
-
return
|
|
94
|
+
return {
|
|
95
|
+
...selectionData(result.matches, result.complete),
|
|
96
|
+
...(result.fuzzy === undefined
|
|
97
|
+
? {}
|
|
98
|
+
: {
|
|
99
|
+
fuzzy: {
|
|
100
|
+
...result.fuzzy,
|
|
101
|
+
candidates: result.fuzzy.candidates.map((candidate) =>
|
|
102
|
+
fuzzyCandidateData(candidate),
|
|
103
|
+
),
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
renderResult(result, options, theme) {
|
|
109
|
+
const data = result.details as WebSearchResult;
|
|
110
|
+
return renderSearchMatches(data.matches, data.complete, theme, options.expanded, undefined, [
|
|
111
|
+
"Web page · read-only",
|
|
112
|
+
...(!data.complete ? ["Limit reached · incomplete results"] : []),
|
|
113
|
+
]);
|
|
77
114
|
},
|
|
78
115
|
format(payload) {
|
|
79
116
|
const result = payload as WebSearchResult;
|
|
@@ -82,6 +119,15 @@ export function createWebSearchResolver(web: ResourceResolver): SearchResolver {
|
|
|
82
119
|
? `No matches in ${result.source}`
|
|
83
120
|
: `${result.matches.length}${result.complete ? "" : "+"} matches in ${result.source}${result.complete ? "" : " (limit reached)"}`;
|
|
84
121
|
const rows = [heading];
|
|
122
|
+
if (result.fuzzy?.status === "skipped")
|
|
123
|
+
rows.push(`Possible-name fallback skipped: ${result.fuzzy.message}`);
|
|
124
|
+
if (result.fuzzy?.candidates.length)
|
|
125
|
+
rows.push(
|
|
126
|
+
"Possible names — spelling suggestions, not equivalent behavior.",
|
|
127
|
+
...result.fuzzy.candidates.map((candidate) =>
|
|
128
|
+
formatFuzzyCandidate(fuzzyCandidateData(candidate)),
|
|
129
|
+
),
|
|
130
|
+
);
|
|
85
131
|
let bytes = Buffer.byteLength(heading);
|
|
86
132
|
for (const match of result.matches) {
|
|
87
133
|
const row = `${result.source}:${match.lineNumber}:${match.startColumn + 1} ${previewMatch(match)}`;
|
|
@@ -97,6 +143,69 @@ export function createWebSearchResolver(web: ResourceResolver): SearchResolver {
|
|
|
97
143
|
};
|
|
98
144
|
}
|
|
99
145
|
|
|
146
|
+
function searchFuzzyText(
|
|
147
|
+
text: string,
|
|
148
|
+
source: string,
|
|
149
|
+
query: string,
|
|
150
|
+
signal?: AbortSignal,
|
|
151
|
+
): FuzzyResult | undefined {
|
|
152
|
+
signal?.throwIfAborted();
|
|
153
|
+
const start = performance.now();
|
|
154
|
+
const vocabulary = new FuzzyVocabulary();
|
|
155
|
+
vocabulary.addText(text);
|
|
156
|
+
if (vocabulary.limited)
|
|
157
|
+
return {
|
|
158
|
+
status: "skipped",
|
|
159
|
+
message: "name collection reached its byte or unique-name budget",
|
|
160
|
+
candidates: [],
|
|
161
|
+
};
|
|
162
|
+
const candidates = [];
|
|
163
|
+
for (const name of rankFuzzyIdentifiers(query, vocabulary.names)) {
|
|
164
|
+
signal?.throwIfAborted();
|
|
165
|
+
if (performance.now() - start > fuzzyLimits.timeoutMs)
|
|
166
|
+
return { status: "skipped", message: "extra search reached its time budget", candidates: [] };
|
|
167
|
+
const pattern = new RegExp(name.identifier.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"), "gu");
|
|
168
|
+
const matches: SearchSelectionMatch[] = [];
|
|
169
|
+
let complete = true;
|
|
170
|
+
let bytes = 0;
|
|
171
|
+
scan: for (const [index, lineText] of text.split(/\r\n|\n|\r/u).entries()) {
|
|
172
|
+
if (performance.now() - start > fuzzyLimits.timeoutMs)
|
|
173
|
+
return {
|
|
174
|
+
status: "skipped",
|
|
175
|
+
message: "extra search reached its time budget",
|
|
176
|
+
candidates: [],
|
|
177
|
+
};
|
|
178
|
+
signal?.throwIfAborted();
|
|
179
|
+
for (const match of lineText.matchAll(pattern)) {
|
|
180
|
+
const startColumn = match.index;
|
|
181
|
+
const endColumn = startColumn + match[0].length;
|
|
182
|
+
if (
|
|
183
|
+
/[\p{L}\p{N}_$]/u.test(lineText[startColumn - 1] ?? "") ||
|
|
184
|
+
/[\p{L}\p{N}_$]/u.test(lineText[endColumn] ?? "")
|
|
185
|
+
)
|
|
186
|
+
continue;
|
|
187
|
+
bytes += Buffer.byteLength(lineText);
|
|
188
|
+
if (
|
|
189
|
+
matches.length === fuzzyLimits.matchesPerCandidate ||
|
|
190
|
+
bytes > fuzzyLimits.verificationBytes
|
|
191
|
+
) {
|
|
192
|
+
complete = false;
|
|
193
|
+
break scan;
|
|
194
|
+
}
|
|
195
|
+
matches.push({
|
|
196
|
+
source,
|
|
197
|
+
lineNumber: index + 1,
|
|
198
|
+
startColumn,
|
|
199
|
+
endColumn,
|
|
200
|
+
matchedText: match[0],
|
|
201
|
+
lineText,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (matches.length > 0) candidates.push({ ...name, matches, complete });
|
|
206
|
+
}
|
|
207
|
+
return candidates.length === 0 ? undefined : { status: "ready", candidates };
|
|
208
|
+
}
|
|
100
209
|
function previewMatch(match: SearchSelectionMatch): string {
|
|
101
210
|
const from = Math.max(0, match.startColumn - 64);
|
|
102
211
|
const to = Math.min(match.lineText.length, match.startColumn + 192);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-html",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
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.
|
|
11
|
+
"pi-agent-resource": "0.7.1"
|
|
12
12
|
},
|
|
13
13
|
"pi": {
|
|
14
14
|
"extensions": [
|
|
15
|
-
"./runtime/entry-
|
|
15
|
+
"./runtime/entry-83.js"
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-image",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-image": "0.
|
|
7
|
-
"pi-agent-resource": "0.
|
|
6
|
+
"pi-agent-image": "0.7.1",
|
|
7
|
+
"pi-agent-resource": "0.7.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-84.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.
|
|
7
|
-
"pi-agent-resource": "0.
|
|
6
|
+
"pi-agent-pdf": "0.7.1",
|
|
7
|
+
"pi-agent-resource": "0.7.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-85.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-resource": "0.
|
|
7
|
-
"pi-agent-text": "0.
|
|
6
|
+
"pi-agent-resource": "0.7.1",
|
|
7
|
+
"pi-agent-text": "0.7.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-86.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Agent-native IDE extension for Pi Coding Agent with guarded editing, search, LSP, terminals, debugging, and observability",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-ide",
|
|
@@ -202,42 +202,41 @@
|
|
|
202
202
|
"oxfmt": "0.64.0",
|
|
203
203
|
"partial-json": "^0.1.7",
|
|
204
204
|
"pdfjs-dist": "^6.2.108",
|
|
205
|
-
"pi-agent-doctor": "0.
|
|
206
|
-
"pi-agent-documentation": "0.
|
|
207
|
-
"pi-agent-filesystem": "0.
|
|
208
|
-
"pi-agent-filesystem-image": "0.
|
|
209
|
-
"pi-agent-filesystem-jq": "0.
|
|
210
|
-
"pi-agent-filesystem-pdf": "0.
|
|
211
|
-
"pi-agent-filesystem-text": "0.
|
|
212
|
-
"pi-agent-ide-ast": "0.
|
|
213
|
-
"pi-agent-ide-changes": "0.
|
|
214
|
-
"pi-agent-ide-formatter": "0.
|
|
215
|
-
"pi-agent-ide-languages": "0.
|
|
216
|
-
"pi-agent-ide-lint": "0.
|
|
217
|
-
"pi-agent-ide-lsp": "0.
|
|
218
|
-
"pi-agent-image": "0.
|
|
219
|
-
"pi-agent-invariant": "0.
|
|
220
|
-
"pi-agent-pdf": "0.
|
|
221
|
-
"pi-agent-read": "0.
|
|
222
|
-
"pi-agent-resource": "0.
|
|
223
|
-
"pi-agent-search": "0.
|
|
224
|
-
"pi-agent-search-text": "0.
|
|
225
|
-
"pi-agent-text": "0.
|
|
226
|
-
"pi-agent-text-anchor-constant": "0.
|
|
227
|
-
"pi-agent-text-anchor-exact": "0.
|
|
228
|
-
"pi-agent-text-anchor-line-hash": "0.
|
|
229
|
-
"pi-agent-text-editor": "0.
|
|
230
|
-
"pi-agent-text-editor-renderer": "0.
|
|
231
|
-
"pi-agent-text-editor-stale-anchor": "0.
|
|
232
|
-
"pi-agent-tool-call-interception": "0.
|
|
233
|
-
"pi-agent-tool-ui": "0.
|
|
234
|
-
"pi-agent-web": "0.
|
|
235
|
-
"pi-agent-web-html": "0.
|
|
236
|
-
"pi-agent-web-image": "0.
|
|
237
|
-
"pi-agent-web-pdf": "0.
|
|
238
|
-
"pi-agent-web-text": "0.
|
|
205
|
+
"pi-agent-doctor": "0.7.1",
|
|
206
|
+
"pi-agent-documentation": "0.7.1",
|
|
207
|
+
"pi-agent-filesystem": "0.7.1",
|
|
208
|
+
"pi-agent-filesystem-image": "0.7.1",
|
|
209
|
+
"pi-agent-filesystem-jq": "0.7.1",
|
|
210
|
+
"pi-agent-filesystem-pdf": "0.7.1",
|
|
211
|
+
"pi-agent-filesystem-text": "0.7.1",
|
|
212
|
+
"pi-agent-ide-ast": "0.7.1",
|
|
213
|
+
"pi-agent-ide-changes": "0.7.1",
|
|
214
|
+
"pi-agent-ide-formatter": "0.7.1",
|
|
215
|
+
"pi-agent-ide-languages": "0.7.1",
|
|
216
|
+
"pi-agent-ide-lint": "0.7.1",
|
|
217
|
+
"pi-agent-ide-lsp": "0.7.1",
|
|
218
|
+
"pi-agent-image": "0.7.1",
|
|
219
|
+
"pi-agent-invariant": "0.7.1",
|
|
220
|
+
"pi-agent-pdf": "0.7.1",
|
|
221
|
+
"pi-agent-read": "0.7.1",
|
|
222
|
+
"pi-agent-resource": "0.7.1",
|
|
223
|
+
"pi-agent-search": "0.7.1",
|
|
224
|
+
"pi-agent-search-text": "0.7.1",
|
|
225
|
+
"pi-agent-text": "0.7.1",
|
|
226
|
+
"pi-agent-text-anchor-constant": "0.7.1",
|
|
227
|
+
"pi-agent-text-anchor-exact": "0.7.1",
|
|
228
|
+
"pi-agent-text-anchor-line-hash": "0.7.1",
|
|
229
|
+
"pi-agent-text-editor": "0.7.1",
|
|
230
|
+
"pi-agent-text-editor-renderer": "0.7.1",
|
|
231
|
+
"pi-agent-text-editor-stale-anchor": "0.7.1",
|
|
232
|
+
"pi-agent-tool-call-interception": "0.7.1",
|
|
233
|
+
"pi-agent-tool-ui": "0.7.1",
|
|
234
|
+
"pi-agent-web": "0.7.1",
|
|
235
|
+
"pi-agent-web-html": "0.7.1",
|
|
236
|
+
"pi-agent-web-image": "0.7.1",
|
|
237
|
+
"pi-agent-web-pdf": "0.7.1",
|
|
238
|
+
"pi-agent-web-text": "0.7.1",
|
|
239
239
|
"playwright-core": "^1.62.1",
|
|
240
|
-
"run": "2.1.4",
|
|
241
240
|
"tree-sitter-cpp": "^0.23.4",
|
|
242
241
|
"tree-sitter-javascript": "^0.25.0",
|
|
243
242
|
"tree-sitter-json": "^0.24.8",
|