pi-agent-ide 0.9.7 → 1.0.0
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 +68 -0
- package/README.md +5 -3
- package/dist/chunk-2EY3LEZ7.js +1 -0
- package/dist/chunk-2QCE7GOV.js +1 -0
- package/dist/chunk-3V3OQO5S.js +118 -0
- package/dist/chunk-45EJ4762.js +33 -0
- package/dist/chunk-4AEYLVSR.js +5 -0
- package/dist/chunk-4DLSZYUO.js +1 -0
- package/dist/chunk-54EFJYUB.js +1 -0
- package/dist/{chunk-5DN2XBVI.js → chunk-5TPYHUJV.js} +1 -1
- package/dist/{chunk-KQV2ZXLP.js → chunk-6DC2Q5BI.js} +1 -1
- package/dist/chunk-72WO7H5T.js +1 -0
- package/dist/chunk-72X24ARV.js +2 -0
- package/dist/chunk-AB6RSWMB.js +23 -0
- package/dist/chunk-AKUBFJAR.js +1 -0
- package/dist/chunk-ASVMQMPX.js +10 -0
- package/dist/chunk-BW3XONMZ.js +1 -0
- package/dist/{chunk-R2U5WXYR.js → chunk-D23NS4VV.js} +1 -1
- package/dist/chunk-DSB6A5P5.js +53 -0
- package/dist/chunk-E4V4VNRM.js +3 -0
- package/dist/chunk-E6G3UVS7.js +1 -0
- package/dist/chunk-E7JBYW43.js +1 -0
- package/dist/chunk-FVWMI4GP.js +1 -0
- package/dist/chunk-GDIF3WT6.js +12 -0
- package/dist/chunk-GNYFA6FS.js +2 -0
- package/dist/{chunk-DHOIQZUF.js → chunk-GQXZEOND.js} +1 -1
- package/dist/chunk-GT2JPOBM.js +1 -0
- package/dist/chunk-GTZOIJCH.js +1 -0
- package/dist/chunk-HRZAIZGR.js +1 -0
- package/dist/{chunk-H6FEBUAP.js → chunk-HSAGZWPO.js} +1 -1
- package/dist/chunk-HUICUICD.js +3 -0
- package/dist/{chunk-2DSY4U73.js → chunk-I3G6K7QU.js} +1 -1
- package/dist/chunk-IRLWXPL4.js +7 -0
- package/dist/chunk-IZTOXSTR.js +6 -0
- package/dist/chunk-J5CKSIH7.js +1 -0
- package/dist/chunk-JKM4E5VB.js +5 -0
- package/dist/chunk-JMCI2ZE2.js +3 -0
- package/dist/{chunk-YZTVC7ME.js → chunk-JY63UUC2.js} +1 -1
- package/dist/chunk-KJ6HZC6L.js +7 -0
- package/dist/chunk-LG22ELG4.js +2 -0
- package/dist/chunk-LRAMFOUP.js +37 -0
- package/dist/chunk-MJMRV76H.js +1 -0
- package/dist/chunk-MMQIHUU5.js +1 -0
- package/dist/chunk-MNAIMZRO.js +9 -0
- package/dist/chunk-NGWQRV25.js +13 -0
- package/dist/chunk-NKI4TZSS.js +2 -0
- package/dist/chunk-NWCTAVGR.js +4 -0
- package/dist/chunk-O2C3F3MA.js +1 -0
- package/dist/chunk-OA26FH5G.js +1 -0
- package/dist/chunk-OEEE5BLN.js +16 -0
- package/dist/chunk-OLMACWQX.js +11 -0
- package/dist/{chunk-72FL5FHZ.js → chunk-PBMHSK6J.js} +1 -1
- package/dist/chunk-QC6VFZSB.js +2 -0
- package/dist/chunk-QCAGAJHJ.js +1 -0
- package/dist/{chunk-P7FUD4WY.js → chunk-QR7JR3P2.js} +1 -1
- package/dist/chunk-QSU5AEKW.js +1 -0
- package/dist/chunk-R7576HPO.js +25 -0
- package/dist/{chunk-B5UJCNQU.js → chunk-RNDSWVJF.js} +1 -1
- package/dist/chunk-S4GTWS2J.js +6 -0
- package/dist/chunk-SF44YQCB.js +2 -0
- package/dist/chunk-SJQGFUXR.js +6 -0
- package/dist/chunk-SKHD2QIT.js +1 -0
- package/dist/chunk-SKZTIAE4.js +4 -0
- package/dist/chunk-SZRC24OB.js +1 -0
- package/dist/chunk-T5PXAYWC.js +1 -0
- package/dist/chunk-TIZ4QDF3.js +1 -0
- package/dist/chunk-UHGHVYAW.js +4 -0
- package/dist/chunk-V2LLMBTA.js +1 -0
- package/dist/chunk-VB5P3TXJ.js +111 -0
- package/dist/chunk-VNG4QPPT.js +12 -0
- package/dist/chunk-VNNAVC4S.js +15 -0
- package/dist/chunk-VPBGKSFI.js +3 -0
- package/dist/chunk-WZ7MNISG.js +5 -0
- package/dist/chunk-X4CU7CMR.js +19 -0
- package/dist/chunk-X7CHS7JB.js +1 -0
- package/dist/chunk-XEPCURYZ.js +1 -0
- package/dist/chunk-XKVU6AAS.js +7 -0
- package/dist/chunk-XLTAP5YC.js +24 -0
- package/dist/chunk-XQMNVPNS.js +1 -0
- package/dist/chunk-YI32H7Z2.js +4 -0
- package/dist/chunk-YSGPCH52.js +18 -0
- package/dist/chunk-ZYG5E3DI.js +9 -0
- package/dist/entry-0.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-18.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -1
- package/dist/entry-22.js +1 -1
- package/dist/entry-27.js +1 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-31.js +2 -2
- package/dist/entry-32.js +1 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +19 -13
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +1 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.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-62.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -1
- 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 -0
- package/dist/entry-69.js +1 -1
- package/dist/entry-71.js +1 -1
- package/dist/entry-72.js +0 -1
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +1 -1
- package/dist/entry-78.js +1 -0
- package/dist/entry-79.js +1 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +1 -0
- package/dist/entry-81.js +0 -1
- package/dist/entry-82.js +1 -1
- package/dist/entry-83.js +1 -1
- package/dist/entry-84.js +0 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -2
- package/dist/entry-87.js +1 -1
- package/dist/entry-88.js +1 -1
- package/dist/entry-89.js +1 -1
- package/dist/entry-90.js +1 -1
- package/dist/entry-91.js +1 -3
- package/dist/entry-92.js +1 -1
- package/dist/entry-93.js +1 -1
- package/dist/entry-94.js +1 -1
- package/dist/entry-95.js +3 -0
- package/dist/entry-96.js +1 -0
- package/dist/entry-97.js +1 -0
- package/dist/entry-98.js +1 -0
- package/dist/pi-agent-ide.js +26 -13
- package/docs/agent-guides/ast-search.md +15 -4
- package/docs/agent-guides/debugger.md +1 -1
- package/docs/agent-guides/git-changes.md +1 -0
- package/docs/agent-guides/ssh.md +27 -7
- package/docs/agent-guides/terminal.md +4 -0
- package/docs/configuration.md +65 -11
- package/docs/development.md +4 -0
- package/docs/extensions.md +6 -4
- package/docs/structured-results.md +29 -15
- package/docs/tools.md +95 -29
- package/docs/user-hooks.md +1 -1
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-doctor/src/catalog.ts +2 -0
- package/node_modules/pi-agent-doctor/src/executable.ts +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem/src/file-write-lock.ts +6 -4
- package/node_modules/pi-agent-filesystem/src/replace-file.ts +5 -2
- package/node_modules/pi-agent-filesystem/src/resolver.ts +26 -10
- 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 +13 -13
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +56 -65
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +197 -130
- package/node_modules/pi-agent-ide-ast/src/ast/read-text.ts +2 -1
- package/node_modules/pi-agent-ide-ast/src/ast-grep-binary.ts +46 -0
- package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +119 -97
- package/node_modules/pi-agent-ide-ast/src/extension.ts +9 -24
- package/node_modules/pi-agent-ide-ast/src/outline-page.ts +96 -0
- package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +42 -78
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +5 -1
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +2 -1
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +24 -5
- package/node_modules/pi-agent-ide-ast/src/search-presentation.ts +2 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +406 -200
- package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +27 -9
- package/node_modules/pi-agent-ide-ast/src/tool-outline.ts +191 -0
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +63 -20
- package/node_modules/pi-agent-ide-changes/src/changes/change-types.ts +1 -0
- package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +25 -0
- package/node_modules/pi-agent-ide-changes/src/changes/git-paths.ts +13 -6
- package/node_modules/pi-agent-ide-changes/src/index-mutation-queue.ts +12 -8
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +88 -78
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +29 -3
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +39 -3
- package/node_modules/pi-agent-ide-formatter/src/rustfmt.ts +101 -0
- 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-lint/src/catalog.ts +20 -14
- package/node_modules/pi-agent-ide-lint/src/registry.ts +2 -2
- package/node_modules/pi-agent-ide-lsp/index.ts +15 -88
- package/node_modules/pi-agent-ide-lsp/package.json +12 -12
- package/node_modules/pi-agent-ide-lsp/src/catalog.ts +21 -9
- package/node_modules/pi-agent-ide-lsp/src/lsp/clang-coverage.ts +265 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/clangd-launch.ts +48 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +66 -11
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +514 -207
- package/node_modules/pi-agent-ide-lsp/src/lsp/corrected-names.ts +211 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostics.ts +20 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/files-containing.ts +70 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/line-breaks.ts +16 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +60 -16
- package/node_modules/pi-agent-ide-lsp/src/lsp/missing-sources.ts +21 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +44 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/position-map.ts +17 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/range-match.ts +49 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +16 -5
- package/node_modules/pi-agent-ide-lsp/src/lsp/server-request-handlers.mjs +7 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +133 -37
- package/node_modules/pi-agent-ide-lsp/src/lsp/shared-servers.ts +164 -13
- package/node_modules/pi-agent-ide-lsp/src/lsp/source-changes.ts +18 -6
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +346 -164
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-selectors.ts +376 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +6 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +10 -0
- package/node_modules/pi-agent-ide-lsp/src/name-captures.ts +66 -0
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +383 -92
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +305 -77
- package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +33 -11
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-image/src/image-converter.ts +13 -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 +51 -12
- package/node_modules/pi-agent-read/src/api/tools/read.ts +39 -3
- package/node_modules/pi-agent-read/src/core/extension.ts +80 -3
- package/node_modules/pi-agent-read/src/core/read-core.ts +6 -0
- package/node_modules/pi-agent-read/src/core/tools/read/list-result.ts +79 -0
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +45 -4
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +18 -9
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +16 -3
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +37 -9
- package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +15 -4
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +49 -18
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +158 -51
- package/node_modules/pi-agent-resource/package.json +5 -1
- package/node_modules/pi-agent-resource/src/file-text-read.ts +86 -0
- package/node_modules/pi-agent-resource/src/index.ts +54 -0
- package/node_modules/pi-agent-resource/src/json-structured-arguments.ts +131 -0
- package/node_modules/pi-agent-resource/src/line-map.ts +750 -0
- package/node_modules/pi-agent-resource/src/resolver.ts +2 -0
- package/node_modules/pi-agent-resource/src/resource-scheduler.ts +63 -23
- package/node_modules/pi-agent-resource/src/resource.ts +5 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +693 -66
- package/node_modules/pi-agent-resource/src/script-calls.ts +21 -0
- package/node_modules/pi-agent-resource/src/tool-deadline.ts +199 -0
- package/node_modules/pi-agent-resource/src/tool-result.ts +14 -5
- package/node_modules/pi-agent-resource/src/unchanged-read.ts +62 -0
- package/node_modules/pi-agent-search/package.json +8 -9
- package/node_modules/pi-agent-search/runtime/entry-57.js +0 -1
- package/node_modules/pi-agent-search/src/api/fuzzy.ts +2 -1
- package/node_modules/pi-agent-search/src/api/null-fields.ts +50 -0
- package/node_modules/pi-agent-search/src/api/path-list.ts +68 -0
- package/node_modules/pi-agent-search/src/api/presentation.ts +2 -1
- package/node_modules/pi-agent-search/src/api/search-call-policy.ts +16 -0
- package/node_modules/pi-agent-search/src/api/search-capture.ts +56 -0
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +26 -4
- package/node_modules/pi-agent-search/src/api/search-scope.ts +38 -2
- package/node_modules/pi-agent-search/src/api/search.ts +46 -3
- package/node_modules/pi-agent-search/src/api/structured-result.ts +96 -25
- package/node_modules/pi-agent-search/src/core/extension.ts +75 -42
- package/node_modules/pi-agent-search/src/core/search-config.ts +2 -2
- package/node_modules/pi-agent-search/src/core/search-core.ts +103 -39
- package/node_modules/pi-agent-search-text/index.ts +62 -20
- package/node_modules/pi-agent-search-text/package.json +15 -15
- package/node_modules/pi-agent-search-text/runtime/entry-59.js +1 -0
- package/node_modules/pi-agent-search-text/src/current-matches.ts +314 -0
- package/node_modules/pi-agent-search-text/src/file-search.ts +178 -99
- package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +40 -17
- package/node_modules/pi-agent-search-text/src/persisted-result.ts +3 -8
- package/node_modules/pi-agent-search-text/src/resolvers.ts +395 -103
- package/node_modules/pi-agent-search-text/src/ripgrep.ts +142 -0
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +24 -12
- package/node_modules/pi-agent-search-text/src/search-backend.ts +333 -108
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +6 -0
- package/node_modules/pi-agent-search-text/src/search-query.ts +69 -34
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +80 -8
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +2 -1
- package/node_modules/pi-agent-search-text/src/search-result.ts +10 -1
- package/node_modules/pi-agent-search-text/src/search-session.ts +449 -58
- package/node_modules/pi-agent-search-text/src/tool-file-search.ts +51 -6
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-63.js +1 -0
- package/node_modules/pi-agent-text/src/index.ts +18 -0
- package/node_modules/pi-agent-text/src/line-anchors.ts +211 -0
- package/node_modules/pi-agent-text/src/no-final-line-break.ts +12 -0
- package/node_modules/pi-agent-text/src/search-highlight.ts +8 -0
- package/node_modules/pi-agent-text/src/source-line.ts +7 -1
- package/node_modules/pi-agent-text/src/text-anchor.ts +34 -3
- package/node_modules/pi-agent-text/src/text-converter.ts +2 -1
- package/node_modules/pi-agent-text/src/text-document.ts +9 -23
- package/node_modules/pi-agent-text/src/text-target.ts +14 -6
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-64.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/index.ts +1 -65
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-65.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-66.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +185 -184
- package/node_modules/pi-agent-text-anchor-exact/src/anchored-literal-view.ts +122 -0
- package/node_modules/pi-agent-text-anchor-exact/src/fuzzy-worker.ts +2 -1
- package/node_modules/pi-agent-text-anchor-exact/src/literal-match.ts +359 -0
- package/node_modules/pi-agent-text-anchor-exact/src/recovery.ts +1 -0
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +5 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-67.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-68.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/src/anchor.ts +92 -67
- package/node_modules/pi-agent-text-anchor-line-hash/src/range-history.ts +105 -0
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +22 -17
- package/node_modules/pi-agent-text-editor/index.ts +0 -10
- package/node_modules/pi-agent-text-editor/package.json +37 -26
- package/node_modules/pi-agent-text-editor/runtime/entry-84.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-85.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-86.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-88.js +2 -0
- package/node_modules/pi-agent-text-editor/src/api/anchor-excerpt.ts +7 -0
- package/node_modules/pi-agent-text-editor/src/api/anchor-inspection.ts +2 -1
- package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +40 -8
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +6 -1
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +37 -2
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/native-files.ts +16 -2
- package/node_modules/pi-agent-text-editor/src/api/pi-edit-text.ts +82 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +9 -2
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +13 -2
- package/node_modules/pi-agent-text-editor/src/api/text-selector-fields.ts +210 -0
- package/node_modules/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/core/already-done.ts +123 -0
- package/node_modules/pi-agent-text-editor/src/core/anchor-candidates.ts +116 -0
- package/node_modules/pi-agent-text-editor/src/core/anchor-preview.ts +32 -0
- package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +109 -23
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +19 -5
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +6 -5
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +54 -21
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +7 -3
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +14 -5
- package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +32 -11
- package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +67 -38
- package/node_modules/pi-agent-text-editor/src/core/file-write-observations.ts +287 -0
- package/node_modules/pi-agent-text-editor/src/core/image-write.ts +16 -4
- package/node_modules/pi-agent-text-editor/src/core/lookalike-bytes.ts +254 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +29 -12
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/compact-receipt.ts +48 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +2 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +24 -34
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +13 -20
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +32 -3
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +36 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +26 -19
- package/node_modules/pi-agent-text-editor/src/core/native-snapshot-source.ts +13 -0
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +526 -148
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +28 -3
- package/node_modules/pi-agent-text-editor/src/core/read-fragment-resolver.ts +34 -14
- package/node_modules/pi-agent-text-editor/src/core/reference-list.ts +95 -0
- package/node_modules/pi-agent-text-editor/src/core/result-scope.ts +129 -0
- package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +20 -8
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +86 -69
- package/node_modules/pi-agent-text-editor/src/core/source-aliases.ts +92 -0
- package/node_modules/pi-agent-text-editor/src/core/source-change-retry.ts +92 -7
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +162 -47
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +321 -101
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +206 -134
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -2
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +133 -18
- package/node_modules/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +13 -0
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +823 -226
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +51 -1
- package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/display-marker.ts +15 -0
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +268 -159
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +37 -32
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +24 -70
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +23 -36
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +31 -45
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +33 -65
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +80 -42
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +27 -16
- package/node_modules/pi-agent-text-editor-renderer/index.ts +0 -14
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-89.js +2 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +204 -78
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +75 -8
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +4 -1
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -3
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +44 -30
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +170 -26
- package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +83 -83
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -6
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-91.js +1 -0
- package/node_modules/pi-agent-tool-ui/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/runtime/entry-92.js +1 -0
- package/node_modules/pi-agent-tool-ui/runtime/entry-93.js +1 -0
- package/node_modules/pi-agent-web/index.ts +0 -3
- package/node_modules/pi-agent-web/package.json +8 -8
- package/node_modules/pi-agent-web/src/search.ts +1 -2
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-html/runtime/entry-95.js +2 -0
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-image/runtime/entry-96.js +2 -0
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/runtime/entry-97.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-98.js +2 -0
- package/package.json +39 -38
- package/skills/capture-code-review-rule/SKILL.md +1 -1
- package/skills/configure-agent-ide/SKILL.md +1 -1
- package/src/api/code-view.ts +0 -2
- package/src/api/tool-config/linters.json +1 -0
- package/src/api/tool-config/lsp-servers.json +5 -0
- package/src/api/tool-config.ts +23 -2
- package/src/backend/config.ts +2 -0
- package/src/backend/configured-process.ts +1 -0
- package/src/backend/dap-java-transport.ts +4 -2
- package/src/backend/dap-java-worker.py +11 -4
- package/src/backend/dap-node-transport.ts +4 -2
- package/src/backend/dap-tcp-transport.ts +2 -3
- package/src/backend/debugger-workspace-owner.ts +6 -6
- package/src/backend/doctor-probe-worker.py +23 -15
- package/src/backend/doctor-workspace.ts +19 -18
- package/src/backend/file-transfer.ts +160 -56
- package/src/backend/formatter-registration.ts +54 -2
- package/src/backend/identity.ts +81 -12
- package/src/backend/lsp-file-watchers.ts +7 -9
- package/src/backend/lsp-workspace-owner.ts +25 -1
- package/src/backend/object-transfer.ts +28 -15
- package/src/backend/owned-command.ts +2 -1
- package/src/backend/owned-read-command.ts +2 -1
- package/src/backend/packaged-source.ts +12 -0
- package/src/backend/process-environment.ts +7 -9
- package/src/backend/process-metadata.ts +5 -5
- package/src/backend/recipe-evidence-worker.py +2 -0
- package/src/backend/recipe-evidence.ts +7 -8
- package/src/backend/registration.ts +2 -1
- package/src/backend/registry.ts +12 -2
- package/src/backend/resource-resolver.ts +11 -32
- package/src/backend/search-environment.ts +61 -4
- package/src/backend/ssh-channel-worker.py +6 -304
- package/src/backend/ssh-channel.ts +287 -36
- package/src/backend/ssh-connection-loss.ts +123 -0
- package/src/backend/ssh-file-stream.ts +216 -0
- package/src/backend/ssh-master.ts +443 -0
- package/src/backend/ssh-transfer-worker-windows.py +84 -0
- package/src/backend/ssh-transfer-worker.py +43 -10
- package/src/backend/ssh-transport.ts +238 -24
- package/src/backend/ssh-worker.py +7 -728
- package/src/backend/ssh.ts +83 -35
- package/src/backend/ssh_channel_common.py +68 -0
- package/src/backend/ssh_channel_posix.py +324 -0
- package/src/backend/ssh_channel_windows.py +527 -0
- package/src/backend/ssh_paths.py +23 -0
- package/src/backend/ssh_windows_files.py +254 -0
- package/src/backend/ssh_worker_common.py +96 -0
- package/src/backend/ssh_worker_posix.py +780 -0
- package/src/backend/ssh_worker_windows.py +687 -0
- package/src/backend/tool-config-access.ts +14 -11
- package/src/backend/tool-project.ts +4 -3
- package/src/backend/web-browser.ts +2 -3
- package/src/backend/web-http.ts +5 -5
- package/src/code-view/diagnostic-view.ts +12 -30
- package/src/code-view/reference.ts +9 -18
- package/src/code-view/source-view.ts +2 -1
- package/src/composite/codemode-tool-names.ts +79 -0
- package/src/composite/detached-results.ts +25 -6
- package/src/composite/ide-alias-rendering.ts +26 -4
- package/src/composite/module-labels.ts +2 -2
- package/src/composite/module-settings.ts +1 -0
- package/src/composite/nested-tool-rendering.ts +70 -24
- package/src/composite/output-limits.ts +12 -5
- package/src/composite/parallel-tool-guidance.ts +38 -0
- package/src/composite/script-values/ast-search.ts +56 -0
- package/src/composite/script-values/copy.ts +8 -0
- package/src/composite/script-values/delete.ts +5 -0
- package/src/composite/script-values/diff.ts +28 -0
- package/src/composite/script-values/edit-selection.ts +48 -0
- package/src/composite/script-values/failures.ts +170 -0
- package/src/composite/script-values/file-receipts.ts +63 -0
- package/src/composite/script-values/file-search.ts +10 -0
- package/src/composite/script-values/index.ts +55 -0
- package/src/composite/script-values/insert.ts +5 -0
- package/src/composite/script-values/lsp-search.ts +92 -0
- package/src/composite/script-values/match.ts +53 -0
- package/src/composite/script-values/move.ts +8 -0
- package/src/composite/script-values/path-list.ts +25 -0
- package/src/composite/script-values/provider-value.ts +21 -0
- package/src/composite/script-values/read.ts +206 -0
- package/src/composite/script-values/replace.ts +5 -0
- package/src/composite/script-values/result-reference.ts +9 -0
- package/src/composite/script-values/search-matches.ts +113 -0
- package/src/composite/script-values/search.ts +64 -0
- package/src/composite/script-values/semantic-search.ts +8 -0
- package/src/composite/script-values/terminal.ts +112 -0
- package/src/composite/script-values/text.ts +7 -0
- package/src/composite/script-values/types.ts +56 -0
- package/src/composite/script-values/undo.ts +5 -0
- package/src/composite/script-values/write.ts +8 -0
- package/src/composite/settings-panel.ts +18 -2
- package/src/composite/text-results.ts +488 -175
- package/src/composite/tool-availability.ts +29 -16
- package/src/composite/tool-discovery-guidance.ts +97 -0
- package/src/documentation/attachment.ts +31 -0
- package/src/documentation/extension.ts +6 -2
- package/src/documentation/search.ts +1 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-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/file-write-lock.ts +6 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/replace-file.ts +5 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +26 -10
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +0 -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-95.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-image/runtime/entry-96.js +2 -0
- 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-pdf/runtime/entry-97.js +2 -0
- 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-98.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-94.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +1 -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 +51 -12
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +39 -3
- package/src/extensions/pi-agent-read/src/core/extension.ts +80 -3
- package/src/extensions/pi-agent-read/src/core/read-core.ts +6 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/list-result.ts +79 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +45 -4
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +18 -9
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +16 -3
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +37 -9
- package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +15 -4
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +49 -18
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +158 -51
- package/src/extensions/pi-agent-search/package.json +8 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +62 -20
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +15 -15
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-62.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/current-matches.ts +314 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +178 -99
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +40 -17
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/persisted-result.ts +3 -8
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +395 -103
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/ripgrep.ts +142 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +24 -12
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +333 -108
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +6 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +69 -34
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +80 -8
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +2 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +10 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +449 -58
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +51 -6
- package/src/extensions/pi-agent-search/runtime/entry-57.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-58.js +2 -0
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +2 -1
- package/src/extensions/pi-agent-search/src/api/null-fields.ts +50 -0
- package/src/extensions/pi-agent-search/src/api/path-list.ts +68 -0
- package/src/extensions/pi-agent-search/src/api/presentation.ts +2 -1
- package/src/extensions/pi-agent-search/src/api/search-call-policy.ts +16 -0
- package/src/extensions/pi-agent-search/src/api/search-capture.ts +56 -0
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +26 -4
- package/src/extensions/pi-agent-search/src/api/search-scope.ts +38 -2
- package/src/extensions/pi-agent-search/src/api/search.ts +46 -3
- package/src/extensions/pi-agent-search/src/api/structured-result.ts +96 -25
- package/src/extensions/pi-agent-search/src/core/extension.ts +75 -42
- package/src/extensions/pi-agent-search/src/core/search-config.ts +2 -2
- package/src/extensions/pi-agent-search/src/core/search-core.ts +103 -39
- package/src/extensions/pi-agent-text-editor/index.ts +0 -10
- package/src/extensions/pi-agent-text-editor/package.json +37 -26
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-64.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +1 -65
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-65.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-66.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +185 -184
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchored-literal-view.ts +122 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/fuzzy-worker.ts +2 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/literal-match.ts +359 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/recovery.ts +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +5 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-67.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-68.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/anchor.ts +92 -67
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/range-history.ts +105 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +22 -17
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +0 -14
- 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-89.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +204 -78
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +75 -8
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +4 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +44 -30
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +170 -26
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +83 -83
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -6
- package/src/extensions/pi-agent-text-editor/runtime/entry-84.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-85.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-86.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-87.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-88.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/anchor-excerpt.ts +7 -0
- package/src/extensions/pi-agent-text-editor/src/api/anchor-inspection.ts +2 -1
- package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +40 -8
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +6 -1
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +37 -2
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/native-files.ts +16 -2
- package/src/extensions/pi-agent-text-editor/src/api/pi-edit-text.ts +82 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +9 -2
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +13 -2
- package/src/extensions/pi-agent-text-editor/src/api/text-selector-fields.ts +210 -0
- package/src/extensions/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/core/already-done.ts +123 -0
- package/src/extensions/pi-agent-text-editor/src/core/anchor-candidates.ts +116 -0
- package/src/extensions/pi-agent-text-editor/src/core/anchor-preview.ts +32 -0
- package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +109 -23
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +19 -5
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +6 -5
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +54 -21
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +7 -3
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +14 -5
- package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +32 -11
- package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +67 -38
- package/src/extensions/pi-agent-text-editor/src/core/file-write-observations.ts +287 -0
- package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +16 -4
- package/src/extensions/pi-agent-text-editor/src/core/lookalike-bytes.ts +254 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +29 -12
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/compact-receipt.ts +48 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +2 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +24 -34
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +13 -20
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +32 -3
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +36 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +26 -19
- package/src/extensions/pi-agent-text-editor/src/core/native-snapshot-source.ts +13 -0
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +526 -148
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +28 -3
- package/src/extensions/pi-agent-text-editor/src/core/read-fragment-resolver.ts +34 -14
- package/src/extensions/pi-agent-text-editor/src/core/reference-list.ts +95 -0
- package/src/extensions/pi-agent-text-editor/src/core/result-scope.ts +129 -0
- package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +20 -8
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +86 -69
- package/src/extensions/pi-agent-text-editor/src/core/source-aliases.ts +92 -0
- package/src/extensions/pi-agent-text-editor/src/core/source-change-retry.ts +92 -7
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +162 -47
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +321 -101
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +206 -134
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +133 -18
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +13 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +823 -226
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +51 -1
- package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/display-marker.ts +15 -0
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +268 -159
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +37 -32
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +24 -70
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +23 -36
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +31 -45
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +33 -65
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +80 -42
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +27 -16
- package/src/pi-agent-ide.ts +41 -32
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +56 -65
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +197 -130
- package/src/plugins/pi-agent-ide-ast/src/ast/read-text.ts +2 -1
- package/src/plugins/pi-agent-ide-ast/src/ast-grep-binary.ts +46 -0
- package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +119 -97
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +9 -24
- package/src/plugins/pi-agent-ide-ast/src/outline-page.ts +96 -0
- package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +42 -78
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +5 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +2 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +24 -5
- package/src/plugins/pi-agent-ide-ast/src/search-presentation.ts +2 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +406 -200
- package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +27 -9
- package/src/plugins/pi-agent-ide-ast/src/tool-outline.ts +191 -0
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +63 -20
- package/src/plugins/pi-agent-ide-changes/src/changes/change-types.ts +1 -0
- package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +25 -0
- package/src/plugins/pi-agent-ide-changes/src/changes/git-paths.ts +13 -6
- package/src/plugins/pi-agent-ide-changes/src/index-mutation-queue.ts +12 -8
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +88 -78
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +29 -3
- package/src/plugins/pi-agent-ide-debugger/index.ts +42 -32
- package/src/plugins/pi-agent-ide-debugger/src/string-enum.ts +14 -0
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +124 -79
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +39 -3
- package/src/plugins/pi-agent-ide-formatter/src/rustfmt.ts +101 -0
- 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-lint/src/catalog.ts +20 -14
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +2 -2
- package/src/plugins/pi-agent-ide-lsp/index.ts +15 -88
- package/src/plugins/pi-agent-ide-lsp/package.json +12 -12
- package/src/plugins/pi-agent-ide-lsp/src/catalog.ts +21 -9
- package/src/plugins/pi-agent-ide-lsp/src/lsp/clang-coverage.ts +265 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/clangd-launch.ts +48 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +66 -11
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +514 -207
- package/src/plugins/pi-agent-ide-lsp/src/lsp/corrected-names.ts +211 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostics.ts +20 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/files-containing.ts +70 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/line-breaks.ts +16 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +60 -16
- package/src/plugins/pi-agent-ide-lsp/src/lsp/missing-sources.ts +21 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +44 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/position-map.ts +17 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/range-match.ts +49 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +16 -5
- package/src/plugins/pi-agent-ide-lsp/src/lsp/server-request-handlers.mjs +7 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +133 -37
- package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-servers.ts +164 -13
- package/src/plugins/pi-agent-ide-lsp/src/lsp/source-changes.ts +18 -6
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +346 -164
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-selectors.ts +376 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +6 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +10 -0
- package/src/plugins/pi-agent-ide-lsp/src/name-captures.ts +66 -0
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +383 -92
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +305 -77
- package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +33 -11
- package/src/plugins/pi-agent-ide-processes/src/registry.ts +64 -3
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +57 -1
- package/src/plugins/pi-agent-ide-semantic/src/backend.ts +18 -6
- package/src/plugins/pi-agent-ide-semantic/src/vera-backend.ts +16 -9
- package/src/plugins/pi-agent-ide-terminal/index.ts +23 -7
- package/src/plugins/pi-agent-ide-terminal/src/list.ts +79 -0
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +22 -0
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +3 -0
- package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +18 -6
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +132 -18
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +117 -50
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +94 -10
- package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +24 -1
- package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +5 -2
- package/src/plugins/pi-agent-ide-terminal/src/terminal-text.ts +173 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +266 -112
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +6 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +11 -6
- package/src/plugins/pi-agent-ide-terminal/src/unix-pty-output.ts +47 -0
- package/src/post-edit/gate.ts +16 -1
- package/src/semantic/extension.ts +8 -2
- package/src/standalone/scoped-api.ts +85 -18
- package/src/toolchain/types.ts +4 -0
- package/dist/chunk-2AANEKFS.js +0 -1
- package/dist/chunk-33U3RUM3.js +0 -12
- package/dist/chunk-34IYWKY5.js +0 -1
- package/dist/chunk-4CSNQX54.js +0 -23
- package/dist/chunk-53IV6EKV.js +0 -1
- package/dist/chunk-5AROEOJB.js +0 -1
- package/dist/chunk-5D4C225L.js +0 -1
- package/dist/chunk-5W6QQZFI.js +0 -2
- package/dist/chunk-6W4OJLCJ.js +0 -1
- package/dist/chunk-6ZYCTWQE.js +0 -1
- package/dist/chunk-756K3LJY.js +0 -1
- package/dist/chunk-AMSNDWBT.js +0 -2
- package/dist/chunk-APWMLLSE.js +0 -17
- package/dist/chunk-BMSAVDRD.js +0 -13
- package/dist/chunk-BRJIXNFU.js +0 -5
- package/dist/chunk-C2GZLLSP.js +0 -5
- package/dist/chunk-ECSMTGVM.js +0 -6
- package/dist/chunk-EWTVVPUA.js +0 -11
- package/dist/chunk-FBR7ZLLN.js +0 -1
- package/dist/chunk-FGN2ZMEN.js +0 -1
- package/dist/chunk-FJSYWOE6.js +0 -1
- package/dist/chunk-FTECKRK6.js +0 -1
- package/dist/chunk-GRZTKMXQ.js +0 -1
- package/dist/chunk-HFCHOFLV.js +0 -2
- package/dist/chunk-HFF4GY7R.js +0 -3
- package/dist/chunk-HJXSEPO7.js +0 -111
- package/dist/chunk-HSEDKYH4.js +0 -1
- package/dist/chunk-II7AOJNH.js +0 -9
- package/dist/chunk-J34VKQGJ.js +0 -1
- package/dist/chunk-J6CDIH3S.js +0 -84
- package/dist/chunk-JHWLRL4U.js +0 -1
- package/dist/chunk-JMQ67UNK.js +0 -3
- package/dist/chunk-JRIP33PC.js +0 -13
- package/dist/chunk-K5M65CAF.js +0 -1
- package/dist/chunk-KJAR2WDO.js +0 -1
- package/dist/chunk-KX7MG72M.js +0 -1
- package/dist/chunk-L2B4DTVS.js +0 -1
- package/dist/chunk-LEKC4GQK.js +0 -5
- package/dist/chunk-LIGOOMJS.js +0 -10
- package/dist/chunk-LY2UANKU.js +0 -6
- package/dist/chunk-M7P7V4WI.js +0 -25
- package/dist/chunk-MXLSGMRZ.js +0 -3
- package/dist/chunk-N2NEFXHB.js +0 -13
- package/dist/chunk-NF74ITWT.js +0 -2
- package/dist/chunk-NQYUIQRH.js +0 -1
- package/dist/chunk-OCU6NW5Y.js +0 -1
- package/dist/chunk-OIEA4QWF.js +0 -4
- package/dist/chunk-ON5HDFNL.js +0 -10
- package/dist/chunk-P43GGKUC.js +0 -28
- package/dist/chunk-PPCWY4BB.js +0 -1
- package/dist/chunk-QGXZ4RWX.js +0 -1
- package/dist/chunk-S3T5NOSL.js +0 -1
- package/dist/chunk-S7E2D5K7.js +0 -5
- package/dist/chunk-SIYPD5MM.js +0 -3
- package/dist/chunk-STUZZM5B.js +0 -1
- package/dist/chunk-T4FTT3U4.js +0 -1
- package/dist/chunk-T5ACAOKJ.js +0 -4
- package/dist/chunk-TILMPAF2.js +0 -1
- package/dist/chunk-TSNY2FSU.js +0 -1
- package/dist/chunk-TWJINFQB.js +0 -9
- package/dist/chunk-TWQ6ACOI.js +0 -1
- package/dist/chunk-UDVVKVG4.js +0 -1
- package/dist/chunk-V2D5MLGE.js +0 -1
- package/dist/chunk-VDSSAP6Y.js +0 -1
- package/dist/chunk-VHYJTAXX.js +0 -1
- package/dist/chunk-WCSWQDJ2.js +0 -22
- package/dist/chunk-WQTF6Q2X.js +0 -3
- package/dist/chunk-XE4W5YTE.js +0 -2
- package/dist/chunk-YFPU2LRR.js +0 -23
- package/dist/chunk-YLEERRX3.js +0 -33
- package/dist/chunk-YOJHCARZ.js +0 -1
- package/dist/chunk-YPTDPMK5.js +0 -1
- package/docs/agent-guides/editing.md +0 -43
- package/docs/agent-guides/search.md +0 -38
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +0 -73
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-63.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-64.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-68.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-85.js +0 -2
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-86.js +0 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +0 -1
- package/node_modules/pi-agent-tool-ui/runtime/entry-89.js +0 -1
- package/node_modules/pi-agent-web-html/runtime/entry-91.js +0 -2
- package/node_modules/pi-agent-web-image/runtime/entry-92.js +0 -2
- package/node_modules/pi-agent-web-pdf/runtime/entry-93.js +0 -2
- package/src/composite/search-facts.ts +0 -45
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-91.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-92.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-93.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-94.js +0 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-58.js +0 -2
- package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-63.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-64.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-85.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-86.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-68.js +0 -1
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +0 -73
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-54.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-58.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-62.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-text-editor}/runtime/entry-87.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-text-editor-stale-anchor}/runtime/entry-90.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web}/runtime/entry-94.js +0 -0
- /package/src/extensions/{pi-agent-read/extensions/pi-agent-web → pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor}/runtime/entry-90.js +0 -0
|
@@ -19,6 +19,7 @@ const sourceMatchFields = {
|
|
|
19
19
|
target: Type.Optional(Type.String()),
|
|
20
20
|
range: position,
|
|
21
21
|
matchedText: Type.Optional(Type.String()),
|
|
22
|
+
lineText: Type.Optional(Type.String()),
|
|
22
23
|
textTruncated: Type.Optional(Type.Boolean()),
|
|
23
24
|
references: Type.Optional(references),
|
|
24
25
|
};
|
|
@@ -38,6 +39,8 @@ const match = Type.Object(
|
|
|
38
39
|
id: Type.String(),
|
|
39
40
|
name: Type.String(),
|
|
40
41
|
kind: Type.String(),
|
|
42
|
+
/** Selector segments that name the declaration alone in its file. */
|
|
43
|
+
selector: Type.Optional(Type.Array(Type.String())),
|
|
41
44
|
source: Type.String(),
|
|
42
45
|
range: position,
|
|
43
46
|
},
|
|
@@ -56,6 +59,8 @@ const selectionProperties = {
|
|
|
56
59
|
matches: Type.Array(match),
|
|
57
60
|
all: Type.Optional(references),
|
|
58
61
|
notices: Type.Optional(Type.Array(Type.String())),
|
|
62
|
+
editWarning: Type.Optional(Type.String()),
|
|
63
|
+
fallback: Type.Optional(Type.Union([Type.Literal("regex"), Type.Literal("words")])),
|
|
59
64
|
};
|
|
60
65
|
/** Separate possible-name groups with exact captured ranges and optional Read references. */
|
|
61
66
|
export const fuzzyDataSchema = Type.Object(
|
|
@@ -99,7 +104,11 @@ export const searchDataSchema = Type.Union([
|
|
|
99
104
|
]);
|
|
100
105
|
export const searchOutputSchema = structuredResultSchema(searchDataSchema);
|
|
101
106
|
|
|
102
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Project a registered selection in its original order, with every match and its whole text, as a
|
|
109
|
+
* script gets it. Search core keeps only a preview for other callers; see `selectionPreview`.
|
|
110
|
+
* Columns are zero-based UTF-16 offsets.
|
|
111
|
+
*/
|
|
103
112
|
export function selectionData(
|
|
104
113
|
matches: readonly {
|
|
105
114
|
source: string;
|
|
@@ -108,6 +117,8 @@ export function selectionData(
|
|
|
108
117
|
startColumn: number;
|
|
109
118
|
endColumn: number;
|
|
110
119
|
matchedText: string;
|
|
120
|
+
lineText?: string;
|
|
121
|
+
linesText?: string;
|
|
111
122
|
}[],
|
|
112
123
|
complete: boolean,
|
|
113
124
|
sessionId?: string,
|
|
@@ -116,33 +127,93 @@ export function selectionData(
|
|
|
116
127
|
return {
|
|
117
128
|
kind: "matches" as const,
|
|
118
129
|
...(targets?.target === undefined ? {} : { target: targets.target }),
|
|
119
|
-
truncated: matches.length > 100,
|
|
120
130
|
complete,
|
|
121
|
-
matches: matches.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
131
|
+
matches: matches.map((match, index) => {
|
|
132
|
+
const lineText =
|
|
133
|
+
match.linesText ??
|
|
134
|
+
((match.endLineNumber ?? match.lineNumber) === match.lineNumber
|
|
135
|
+
? match.lineText
|
|
136
|
+
: undefined);
|
|
137
|
+
return {
|
|
138
|
+
source: match.source,
|
|
139
|
+
...(targets?.matchTargets?.[index] === undefined
|
|
140
|
+
? {}
|
|
141
|
+
: { target: targets.matchTargets[index] }),
|
|
142
|
+
range: {
|
|
143
|
+
startLine: match.lineNumber,
|
|
144
|
+
startColumn: match.startColumn,
|
|
145
|
+
endLine: match.endLineNumber ?? match.lineNumber,
|
|
146
|
+
endColumn: match.endColumn,
|
|
147
|
+
},
|
|
148
|
+
matchedText: match.matchedText,
|
|
149
|
+
...(lineText === undefined ? {} : { lineText }),
|
|
150
|
+
...(sessionId === undefined
|
|
151
|
+
? {}
|
|
152
|
+
: {
|
|
153
|
+
references: {
|
|
154
|
+
line: `SEARCH#${sessionId}:${index + 1}:line`,
|
|
155
|
+
match: `SEARCH#${sessionId}:${index + 1}:match`,
|
|
156
|
+
},
|
|
157
|
+
}),
|
|
158
|
+
};
|
|
159
|
+
}),
|
|
144
160
|
...(complete && sessionId !== undefined
|
|
145
161
|
? { all: { line: `SEARCH#${sessionId}:all:line`, match: `SEARCH#${sessionId}:all:match` } }
|
|
146
162
|
: {}),
|
|
147
163
|
};
|
|
148
164
|
}
|
|
165
|
+
|
|
166
|
+
/** Matches a preview keeps, and the longest match text it keeps, in UTF-8 bytes. */
|
|
167
|
+
const preview = { matches: 100, textBytes: 4096 } as const;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The record of a call that does not hand its result to a script: the first 100 matches, each with
|
|
171
|
+
* its match and line text when each is at most 4 KB. The record of every call must stay within the 1 MiB
|
|
172
|
+
* limit of structured results, which only a script's call lifts. `truncated` marks a shortened
|
|
173
|
+
* list and `textTruncated` an omitted text. A resolver's own value, such as an lsp_search call
|
|
174
|
+
* graph, keeps each list of matches it holds as a preview. Data of other kinds stays as it is.
|
|
175
|
+
*/
|
|
176
|
+
export function selectionPreview(data: unknown): unknown {
|
|
177
|
+
if (isRecord(data) && data.kind === "custom" && isRecord(data.value))
|
|
178
|
+
return {
|
|
179
|
+
...data,
|
|
180
|
+
value: Object.fromEntries(
|
|
181
|
+
Object.entries(data.value).map(([key, item]) => [key, selectionPreview(item)]),
|
|
182
|
+
),
|
|
183
|
+
};
|
|
184
|
+
if (!isRecord(data) || data.kind !== "matches" || !Array.isArray(data.matches)) return data;
|
|
185
|
+
const matches: unknown[] = data.matches;
|
|
186
|
+
return {
|
|
187
|
+
...data,
|
|
188
|
+
...(matches.length > preview.matches && { truncated: true }),
|
|
189
|
+
matches: matches.slice(0, preview.matches).map((match) => {
|
|
190
|
+
if (!isRecord(match)) return match;
|
|
191
|
+
const captures = isRecord(match.captures)
|
|
192
|
+
? Object.fromEntries(
|
|
193
|
+
Object.entries(match.captures).map(([name, nodes]) => [
|
|
194
|
+
name,
|
|
195
|
+
Array.isArray(nodes)
|
|
196
|
+
? nodes.map((node: unknown) => (isRecord(node) ? previewText(node) : node))
|
|
197
|
+
: nodes,
|
|
198
|
+
]),
|
|
199
|
+
)
|
|
200
|
+
: undefined;
|
|
201
|
+
return { ...previewText(match), ...(captures !== undefined && { captures }) };
|
|
202
|
+
}),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function previewText(match: Record<string, unknown>): Record<string, unknown> {
|
|
207
|
+
const result = { ...match };
|
|
208
|
+
for (const key of ["matchedText", "lineText"]) {
|
|
209
|
+
if (typeof result[key] === "string" && Buffer.byteLength(result[key]) > preview.textBytes) {
|
|
210
|
+
delete result[key];
|
|
211
|
+
result.textTruncated = true;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
218
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
219
|
+
}
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
type ToolRenderResultOptions,
|
|
6
6
|
} from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import { type Component, Text } from "@earendil-works/pi-tui";
|
|
8
|
-
import { connectAgentDocumentation, loadPackagedAgentGuide } from "pi-agent-documentation";
|
|
9
8
|
import {
|
|
10
9
|
ResultPanel,
|
|
11
10
|
toolCallHeader,
|
|
@@ -28,15 +27,23 @@ import {
|
|
|
28
27
|
SEARCH_PROTOCOL,
|
|
29
28
|
} from "#src/api/plugin-protocol.ts";
|
|
30
29
|
import { createSearchCore } from "#src/core/search-core.ts";
|
|
30
|
+
import { describePathArgument, plainPathList } from "#src/api/path-list.ts";
|
|
31
|
+
import { markNullFields, nullFieldsMessage } from "#src/api/null-fields.ts";
|
|
31
32
|
|
|
32
33
|
import { loadSearchConfig, resolveSearchConfigPaths } from "#src/core/search-config.ts";
|
|
33
34
|
import { runWithSearchTimeout } from "#src/core/search-timeout.ts";
|
|
35
|
+
import { configureSearchDeadline } from "pi-agent-resource";
|
|
34
36
|
|
|
35
|
-
import type
|
|
37
|
+
import { searchCallPolicy, type SearchToolDetails } from "#src/api/search.ts";
|
|
36
38
|
|
|
37
|
-
import { searchSchema } from "#src/api/search-parameters.ts";
|
|
39
|
+
import { describeSearchParameters, searchSchema } from "#src/api/search-parameters.ts";
|
|
38
40
|
import { searchOutputSchema, searchDataSchema } from "#src/api/structured-result.ts";
|
|
39
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
connectResultTargets,
|
|
43
|
+
resultError,
|
|
44
|
+
trackScriptCalls,
|
|
45
|
+
withStructuredResult,
|
|
46
|
+
} from "pi-agent-resource";
|
|
40
47
|
|
|
41
48
|
/** Arguments accepted by the search tool. */
|
|
42
49
|
export type SearchParameters = Static<typeof searchSchema>;
|
|
@@ -51,7 +58,7 @@ export function searchCallModel(
|
|
|
51
58
|
? []
|
|
52
59
|
: [
|
|
53
60
|
{
|
|
54
|
-
text:
|
|
61
|
+
text: `in ${describePathArgument(arguments_.path)}`,
|
|
55
62
|
color: "accent" as const,
|
|
56
63
|
underline: true,
|
|
57
64
|
truncate: "start" as const,
|
|
@@ -85,13 +92,6 @@ export default async function registerSearchCore(
|
|
|
85
92
|
context?: { readonly preferences: Readonly<Record<string, string>> },
|
|
86
93
|
): Promise<void> {
|
|
87
94
|
const presentation = () => parsePresentation(context?.preferences["ui.search"]);
|
|
88
|
-
connectAgentDocumentation(pi, [
|
|
89
|
-
await loadPackagedAgentGuide({
|
|
90
|
-
id: "search",
|
|
91
|
-
description: "Text and regex search in files, guides, web pages and terminal output",
|
|
92
|
-
triggers: [{ tool: "search" }],
|
|
93
|
-
}),
|
|
94
|
-
]);
|
|
95
95
|
const targets = connectResultTargets(pi);
|
|
96
96
|
const core = createSearchCore(targets);
|
|
97
97
|
const interceptionRendering = new ToolCallInterceptionRenderStore();
|
|
@@ -103,6 +103,8 @@ export default async function registerSearchCore(
|
|
|
103
103
|
request.accept(core.registerPlugin(request.plugin));
|
|
104
104
|
});
|
|
105
105
|
pi.on("session_shutdown", unsubscribe);
|
|
106
|
+
// A call from a script, such as Codemode, gets every match with its whole text.
|
|
107
|
+
const scriptCall = trackScriptCalls(pi, "search");
|
|
106
108
|
pi.registerTool(
|
|
107
109
|
withToolCallInterceptionRendering(
|
|
108
110
|
{
|
|
@@ -124,8 +126,12 @@ export default async function registerSearchCore(
|
|
|
124
126
|
get promptGuidelines(): string[] {
|
|
125
127
|
return [...core.renderPromptGuidelines()];
|
|
126
128
|
},
|
|
127
|
-
parameters
|
|
129
|
+
get parameters() {
|
|
130
|
+
return describeSearchParameters(core.renderDescriptions());
|
|
131
|
+
},
|
|
128
132
|
outputSchema: searchOutputSchema,
|
|
133
|
+
prepareArguments: (arguments_) =>
|
|
134
|
+
markNullFields(arguments_, searchSchema) as SearchParameters,
|
|
129
135
|
renderCall(arguments_, theme, renderContext): Component {
|
|
130
136
|
const mode = renderContext.expanded ? "full" : presentation();
|
|
131
137
|
if (mode === "disabled") return new Text(theme.fg("toolTitle", "search"), 0, 0);
|
|
@@ -157,39 +163,70 @@ export default async function registerSearchCore(
|
|
|
157
163
|
return fallbackResult(result, options, theme);
|
|
158
164
|
},
|
|
159
165
|
async execute(
|
|
160
|
-
|
|
166
|
+
id,
|
|
161
167
|
parameters: SearchParameters,
|
|
162
168
|
signal,
|
|
163
169
|
onUpdate,
|
|
164
170
|
context,
|
|
165
171
|
): Promise<AgentToolResult<SearchToolDetails>> {
|
|
172
|
+
const nulls = nullFieldsMessage(parameters);
|
|
173
|
+
if (nulls !== undefined) {
|
|
174
|
+
return withStructuredResult(
|
|
175
|
+
{
|
|
176
|
+
content: [{ type: "text", text: nulls }],
|
|
177
|
+
details: { failure: { code: "INVALID_REQUEST", message: nulls } },
|
|
178
|
+
},
|
|
179
|
+
searchDataSchema,
|
|
180
|
+
{
|
|
181
|
+
status: "error",
|
|
182
|
+
errors: [resultError(new Error(nulls), "SEARCH_FAILED")],
|
|
183
|
+
},
|
|
184
|
+
);
|
|
185
|
+
}
|
|
166
186
|
try {
|
|
167
187
|
const config = await loadSearchConfig(
|
|
168
188
|
resolveSearchConfigPaths(process.env, os.homedir(), context.cwd),
|
|
169
189
|
);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
await
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
path
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
const standaloneTimeout = configureSearchDeadline(config.timeoutMs)
|
|
191
|
+
? null
|
|
192
|
+
: config.timeoutMs;
|
|
193
|
+
return await runWithSearchTimeout(
|
|
194
|
+
standaloneTimeout,
|
|
195
|
+
signal,
|
|
196
|
+
async (operationSignal) => {
|
|
197
|
+
await core.waitForPendingPlugins();
|
|
198
|
+
// A list of plain paths goes to the core as it is; a list of results is a scope.
|
|
199
|
+
const pathList =
|
|
200
|
+
Array.isArray(parameters.path) && plainPathList(parameters.path) !== undefined;
|
|
201
|
+
const scoped =
|
|
202
|
+
parameters.path !== undefined &&
|
|
203
|
+
!pathList &&
|
|
204
|
+
(typeof parameters.path !== "string" || parameters.path.startsWith("RESULT#"));
|
|
205
|
+
// Search only reads, so a result whose lines changed still selects the same region.
|
|
206
|
+
const rescope = scoped
|
|
207
|
+
? (signal?: AbortSignal) =>
|
|
208
|
+
targets.resolveCurrent(parameters.path, context.cwd, signal)
|
|
209
|
+
: undefined;
|
|
210
|
+
const scope = rescope === undefined ? undefined : await rescope(operationSignal);
|
|
211
|
+
return core.execute(
|
|
212
|
+
{
|
|
213
|
+
...parameters,
|
|
214
|
+
path:
|
|
215
|
+
pathList || (typeof parameters.path === "string" && !scoped)
|
|
216
|
+
? parameters.path
|
|
217
|
+
: undefined,
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
cwd: context.cwd,
|
|
221
|
+
...(scope === undefined || rescope === undefined ? {} : { scope, rescope }),
|
|
222
|
+
...(operationSignal !== undefined && { signal: operationSignal }),
|
|
223
|
+
...(onUpdate !== undefined && { onUpdate }),
|
|
224
|
+
},
|
|
225
|
+
// Text Search uses limit as a display budget, not a match cap.
|
|
226
|
+
searchCallPolicy(parameters.limit, scriptCall(id), "presentation").audience,
|
|
227
|
+
);
|
|
228
|
+
},
|
|
229
|
+
);
|
|
193
230
|
} catch (error) {
|
|
194
231
|
if (signal?.aborted) throw error;
|
|
195
232
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -222,11 +259,7 @@ function searchCallDetails(arguments_: SearchParameters): ToolCallHeaderDetail[]
|
|
|
222
259
|
{ label: "query", value: JSON.stringify(arguments_.query) },
|
|
223
260
|
...optionalDetail(
|
|
224
261
|
"path",
|
|
225
|
-
arguments_.path === undefined
|
|
226
|
-
? undefined
|
|
227
|
-
: typeof arguments_.path === "string"
|
|
228
|
-
? arguments_.path
|
|
229
|
-
: "result scope",
|
|
262
|
+
arguments_.path === undefined ? undefined : describePathArgument(arguments_.path),
|
|
230
263
|
),
|
|
231
264
|
...optionalDetail("include", arguments_.include),
|
|
232
265
|
...optionalDetail("exclude", arguments_.exclude),
|
|
@@ -2,7 +2,7 @@ import { readFile } from "node:fs/promises";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { SEARCH_TIMEOUT_MS } from "pi-agent-resource";
|
|
6
6
|
|
|
7
7
|
/** Paths used to resolve global and project search settings. */
|
|
8
8
|
export interface SearchConfigPaths {
|
|
@@ -42,7 +42,7 @@ export async function loadSearchConfig(paths: SearchConfigPaths): Promise<Search
|
|
|
42
42
|
|
|
43
43
|
const configuredTimeoutMs = projectTimeoutMs !== undefined ? projectTimeoutMs : globalTimeoutMs;
|
|
44
44
|
return {
|
|
45
|
-
timeoutMs: configuredTimeoutMs === undefined ?
|
|
45
|
+
timeoutMs: configuredTimeoutMs === undefined ? SEARCH_TIMEOUT_MS : configuredTimeoutMs,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -2,10 +2,13 @@ import { withBlockedToolResult } from "pi-agent-tool-call-interception";
|
|
|
2
2
|
import {
|
|
3
3
|
resourceAccesses,
|
|
4
4
|
resourceScheduler,
|
|
5
|
+
describeAdjustedRanges,
|
|
5
6
|
withStructuredResult,
|
|
7
|
+
type ResolvedResultTargets,
|
|
6
8
|
type ResultTargetStore,
|
|
7
9
|
} from "pi-agent-resource";
|
|
8
|
-
import { searchDataSchema } from "#src/api/structured-result.ts";
|
|
10
|
+
import { searchDataSchema, selectionPreview } from "#src/api/structured-result.ts";
|
|
11
|
+
import { pathMachine, plainPathList, uniquePaths } from "#src/api/path-list.ts";
|
|
9
12
|
|
|
10
13
|
import type { SearchPlugin } from "#src/api/plugin-protocol.ts";
|
|
11
14
|
import type {
|
|
@@ -195,38 +198,84 @@ export function createSearchCore(targets?: ResultTargetStore): SearchCore {
|
|
|
195
198
|
audience = "agent",
|
|
196
199
|
only?: SearchResolver,
|
|
197
200
|
): Promise<SearchToolResult> {
|
|
201
|
+
if (input.query.trim().length === 0) {
|
|
202
|
+
return failure("INVALID_REQUEST", "Search query must not be empty");
|
|
203
|
+
}
|
|
204
|
+
// An empty path names the working directory, as an omitted path does. A list of plain
|
|
205
|
+
// paths is searched root by root; a list of results is a result scope.
|
|
206
|
+
let pathInput = input.path === "" ? undefined : input.path;
|
|
207
|
+
let paths: readonly string[] | undefined;
|
|
208
|
+
try {
|
|
209
|
+
paths = Array.isArray(input.path) ? plainPathList(input.path) : undefined;
|
|
210
|
+
if (paths !== undefined) {
|
|
211
|
+
paths = uniquePaths(paths, context.cwd);
|
|
212
|
+
const machines = new Set(paths.map((item) => pathMachine(item, context.cwd)));
|
|
213
|
+
if (machines.size > 1)
|
|
214
|
+
throw new Error(
|
|
215
|
+
"The paths in a list must be on one machine: local paths, or ssh:// paths of one target. Search each machine in a separate call.",
|
|
216
|
+
);
|
|
217
|
+
pathInput = paths.length === 1 ? paths[0] : undefined;
|
|
218
|
+
if (paths.length === 1) paths = undefined;
|
|
219
|
+
}
|
|
220
|
+
} catch (error) {
|
|
221
|
+
return failure("INVALID_REQUEST", messageFor(error, "Invalid path list"), undefined, error);
|
|
222
|
+
}
|
|
198
223
|
let request: SearchRequest = {
|
|
199
224
|
...input,
|
|
200
|
-
path: typeof
|
|
225
|
+
path: typeof pathInput === "string" ? pathInput : undefined,
|
|
226
|
+
...(paths === undefined ? {} : { paths }),
|
|
201
227
|
};
|
|
202
|
-
if (request.query.trim().length === 0) {
|
|
203
|
-
return failure("INVALID_REQUEST", "Search query must not be empty");
|
|
204
|
-
}
|
|
205
228
|
|
|
229
|
+
let latestScope: ResolvedResultTargets | undefined;
|
|
206
230
|
try {
|
|
207
|
-
if (typeof
|
|
231
|
+
if (typeof pathInput === "string") {
|
|
208
232
|
for (const provider of scopeProviders) {
|
|
209
|
-
const scope = await provider(
|
|
233
|
+
const scope = await provider(pathInput, context);
|
|
210
234
|
if (scope === undefined) continue;
|
|
211
235
|
if (context.scope !== undefined) throw new Error("Pass one result scope, not two.");
|
|
212
236
|
if (targets !== undefined) await targets.verify(scope, context.signal);
|
|
213
|
-
|
|
237
|
+
const scopeInput = pathInput;
|
|
238
|
+
const scopeContext = context;
|
|
239
|
+
// A refresh of this search, such as for an all-anchor after other edits, runs on the
|
|
240
|
+
// scope as its file is now. A numbered Search match follows its region like RESULT#.
|
|
241
|
+
const rescope = async (signal?: AbortSignal): Promise<ResolvedResultTargets> => {
|
|
242
|
+
if (targets?.hasSearchReference(scopeInput) === true)
|
|
243
|
+
return targets.resolveCurrent(scopeInput, scopeContext.cwd, signal);
|
|
244
|
+
const current = await provider(scopeInput, {
|
|
245
|
+
...scopeContext,
|
|
246
|
+
...(signal !== undefined && { signal }),
|
|
247
|
+
});
|
|
248
|
+
if (current === undefined) throw new Error("its reference is no longer available");
|
|
249
|
+
return current;
|
|
250
|
+
};
|
|
251
|
+
context = { ...context, scope, rescope };
|
|
214
252
|
request = Object.assign({}, request, { path: undefined });
|
|
215
253
|
break;
|
|
216
254
|
}
|
|
217
255
|
}
|
|
218
256
|
const scoped =
|
|
219
|
-
|
|
220
|
-
(typeof
|
|
221
|
-
(request.path ===
|
|
257
|
+
pathInput !== undefined &&
|
|
258
|
+
(typeof pathInput !== "string" ||
|
|
259
|
+
(request.path === pathInput && pathInput.startsWith("RESULT#")));
|
|
222
260
|
if (scoped) {
|
|
223
261
|
if (targets === undefined) throw new Error("Result scopes are unavailable.");
|
|
224
262
|
if (context.scope !== undefined) throw new Error("Pass one result scope, not two.");
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
263
|
+
const scopeInput = pathInput;
|
|
264
|
+
const cwd = context.cwd;
|
|
265
|
+
// Search only reads, so a result whose lines changed still selects the same region.
|
|
266
|
+
const rescope = (signal?: AbortSignal) => targets.resolveCurrent(scopeInput, cwd, signal);
|
|
267
|
+
context = { ...context, scope: await rescope(context.signal), rescope };
|
|
228
268
|
request = Object.assign({}, request, { path: undefined });
|
|
229
269
|
}
|
|
270
|
+
if (context.rescope !== undefined) {
|
|
271
|
+
// Remember the scope of the latest attempt: it is the one the result describes.
|
|
272
|
+
const rescope = context.rescope;
|
|
273
|
+
context = {
|
|
274
|
+
...context,
|
|
275
|
+
rescope: async (signal) => (latestScope = await rescope(signal)),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
latestScope = context.scope;
|
|
230
279
|
if (context.scope !== undefined) {
|
|
231
280
|
const ownerContext = context;
|
|
232
281
|
context = {
|
|
@@ -240,12 +289,23 @@ export function createSearchCore(targets?: ResultTargetStore): SearchCore {
|
|
|
240
289
|
},
|
|
241
290
|
};
|
|
242
291
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
292
|
+
if (context.scope === undefined) {
|
|
293
|
+
// Every listed path is owned like a single path; the list shares its first owner.
|
|
294
|
+
const owner = (source: string | undefined) => {
|
|
295
|
+
for (const provider of environments) {
|
|
296
|
+
const environment = provider({ ...request, path: source }, context);
|
|
297
|
+
if (environment !== undefined) return environment;
|
|
298
|
+
}
|
|
299
|
+
return undefined;
|
|
300
|
+
};
|
|
301
|
+
const [first, ...rest] = request.paths ?? [request.path];
|
|
302
|
+
const environment = owner(first);
|
|
303
|
+
for (const source of rest)
|
|
304
|
+
if ((owner(source) === undefined) !== (environment === undefined))
|
|
305
|
+
throw new Error(
|
|
306
|
+
`No search owner on the machine of ${first ?? "."} owns ${source ?? "."}.`,
|
|
307
|
+
);
|
|
308
|
+
if (environment !== undefined) context = { ...context, environment };
|
|
249
309
|
}
|
|
250
310
|
} catch (error) {
|
|
251
311
|
return failure(
|
|
@@ -274,16 +334,12 @@ export function createSearchCore(targets?: ResultTargetStore): SearchCore {
|
|
|
274
334
|
left.order - right.order,
|
|
275
335
|
);
|
|
276
336
|
|
|
277
|
-
const emptyProtocol = /^[a-z][\w-]*:\s*$/iu.test(request.query);
|
|
278
|
-
const protocolLike = /^[a-z][\w-]*:/iu.test(request.query);
|
|
279
337
|
for (const entry of snapshot) {
|
|
280
338
|
if (context.scope !== undefined && entry.registration.resolver.supportsResultScope !== true)
|
|
281
339
|
continue;
|
|
282
|
-
if (emptyProtocol && !entry.registration.fallback && context.scope === undefined) continue;
|
|
283
340
|
const resolver = entry.registration.resolver;
|
|
284
341
|
if (context.scope !== undefined && resolver.supportsResultScope !== true) continue;
|
|
285
|
-
|
|
286
|
-
// The fallback still searches only the verified scope; structural protocols stay above.
|
|
342
|
+
if (request.paths !== undefined && resolver.supportsPathList !== true) continue;
|
|
287
343
|
|
|
288
344
|
try {
|
|
289
345
|
const scope = Promise.resolve().then(async () => {
|
|
@@ -360,22 +416,16 @@ export function createSearchCore(targets?: ResultTargetStore): SearchCore {
|
|
|
360
416
|
);
|
|
361
417
|
}
|
|
362
418
|
|
|
363
|
-
const
|
|
364
|
-
const missingAdapter =
|
|
419
|
+
const full = resolver.toScriptData?.(attempt.payload, formatted.details);
|
|
420
|
+
const missingAdapter = full === undefined;
|
|
421
|
+
// A script gets every match with its whole text; other callers get a preview that
|
|
422
|
+
// keeps the record within the 1 MiB limit.
|
|
423
|
+
const data = audience === "script" ? full : selectionPreview(full);
|
|
365
424
|
return withStructuredResult(
|
|
366
425
|
{
|
|
367
426
|
content: [
|
|
368
|
-
...(
|
|
369
|
-
|
|
370
|
-
{
|
|
371
|
-
type: "text" as const,
|
|
372
|
-
text: emptyProtocol
|
|
373
|
-
? "Search fallback: empty protocol query; searched the original text."
|
|
374
|
-
: "Search fallback: unhandled protocol query; searched the original text.",
|
|
375
|
-
},
|
|
376
|
-
...formatted.content,
|
|
377
|
-
]
|
|
378
|
-
: formatted.content),
|
|
427
|
+
...adjustedNotice(latestScope, context.cwd),
|
|
428
|
+
...formatted.content,
|
|
379
429
|
...(isRecord(data) && data.complete === false
|
|
380
430
|
? [
|
|
381
431
|
{
|
|
@@ -418,6 +468,8 @@ export function createSearchCore(targets?: ResultTargetStore): SearchCore {
|
|
|
418
468
|
],
|
|
419
469
|
}
|
|
420
470
|
: { status: "success", data, errors: [] },
|
|
471
|
+
// A script gets the whole result; the 1 MiB limit protects the model's context.
|
|
472
|
+
audience === "script" ? { maxBytes: Infinity } : undefined,
|
|
421
473
|
);
|
|
422
474
|
} catch (error) {
|
|
423
475
|
return failure(
|
|
@@ -441,7 +493,10 @@ export function createSearchCore(targets?: ResultTargetStore): SearchCore {
|
|
|
441
493
|
}
|
|
442
494
|
}
|
|
443
495
|
|
|
444
|
-
const reason =
|
|
496
|
+
const reason =
|
|
497
|
+
request.paths === undefined
|
|
498
|
+
? `No search resolver handled ${request.query}`
|
|
499
|
+
: `No search resolver handled ${request.query} in a path list. A path list applies to text, file, AST and LSP search in local or SSH files; search other sources one path at a time.`;
|
|
445
500
|
return withBlockedToolResult(failure("NO_RESOLVER", reason), reason);
|
|
446
501
|
},
|
|
447
502
|
runAction(reference, capability, resolverId, input, context): Promise<unknown> {
|
|
@@ -474,6 +529,15 @@ export function createSearchCore(targets?: ResultTargetStore): SearchCore {
|
|
|
474
529
|
return core;
|
|
475
530
|
}
|
|
476
531
|
|
|
532
|
+
/** A scope whose text changed says so, so the reader knows which text was searched. */
|
|
533
|
+
function adjustedNotice(
|
|
534
|
+
scope: ResolvedResultTargets | undefined,
|
|
535
|
+
cwd: string,
|
|
536
|
+
): { type: "text"; text: string }[] {
|
|
537
|
+
const text = scope === undefined ? undefined : describeAdjustedRanges(scope, cwd);
|
|
538
|
+
return text === undefined ? [] : [{ type: "text", text }];
|
|
539
|
+
}
|
|
540
|
+
|
|
477
541
|
function assertResolver(value: unknown): asserts value is SearchResolverRegistration {
|
|
478
542
|
if (!isRecord(value) || !isRecord(value.resolver)) {
|
|
479
543
|
throw new TypeError("Invalid search resolver registration");
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { registerOperationApproval } from "pi-agent-tool-ui/operation-approval";
|
|
3
|
-
import { connectAgentDocumentation, loadPackagedAgentGuide } from "pi-agent-documentation";
|
|
4
3
|
|
|
5
4
|
import { hideBuiltinEdit } from "./src/core/builtin-edit.ts";
|
|
6
5
|
import registerTextEditorCore from "./src/core/extension.ts";
|
|
@@ -10,15 +9,6 @@ import { registerTextEditorTools } from "./src/tools/extension.ts";
|
|
|
10
9
|
|
|
11
10
|
export default async function registerTextEditor(pi: ExtensionAPI): Promise<void> {
|
|
12
11
|
registerOperationApproval(pi);
|
|
13
|
-
connectAgentDocumentation(pi, [
|
|
14
|
-
await loadPackagedAgentGuide({
|
|
15
|
-
id: "editing",
|
|
16
|
-
description: "Precise standalone text and file edits",
|
|
17
|
-
triggers: ["write", "replace", "insert", "delete", "copy", "move", "diff"].map((tool) => ({
|
|
18
|
-
tool,
|
|
19
|
-
})),
|
|
20
|
-
}),
|
|
21
|
-
]);
|
|
22
12
|
const core = await registerTextEditorCore(pi);
|
|
23
13
|
hideBuiltinEdit(pi);
|
|
24
14
|
|