pi-agent-ide 0.9.8 → 1.0.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 +72 -0
- package/README.md +5 -3
- package/dist/chunk-26SMC6OS.js +2 -0
- package/dist/chunk-2EY3LEZ7.js +1 -0
- package/dist/chunk-2QCE7GOV.js +1 -0
- package/dist/chunk-3BRGWFEI.js +2 -0
- package/dist/chunk-3JBQYLJ4.js +5 -0
- package/dist/chunk-3KM5DSWL.js +37 -0
- package/dist/chunk-3V3OQO5S.js +118 -0
- package/dist/chunk-45EJ4762.js +33 -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-7OAAM5FL.js +1 -0
- package/dist/chunk-AB6RSWMB.js +23 -0
- package/dist/chunk-ASVMQMPX.js +10 -0
- package/dist/chunk-BW3XONMZ.js +1 -0
- package/dist/chunk-C327T6YP.js +19 -0
- package/dist/{chunk-R2U5WXYR.js → chunk-D23NS4VV.js} +1 -1
- package/dist/chunk-E4V4VNRM.js +3 -0
- package/dist/chunk-E7JBYW43.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-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-KM4NOIOB.js +5 -0
- package/dist/chunk-L2YDUMZC.js +13 -0
- package/dist/chunk-MCHU3BLO.js +53 -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-NKI4TZSS.js +2 -0
- package/dist/chunk-NSBRKTZ7.js +1 -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-QCAGAJHJ.js +1 -0
- package/dist/{chunk-P7FUD4WY.js → chunk-QR7JR3P2.js} +1 -1
- package/dist/chunk-QSU5AEKW.js +1 -0
- package/dist/chunk-QUK5ZEYX.js +1 -0
- package/dist/chunk-R7576HPO.js +25 -0
- package/dist/{chunk-B5UJCNQU.js → chunk-RNDSWVJF.js} +1 -1
- package/dist/chunk-RYJEEBET.js +1 -0
- package/dist/chunk-S4GTWS2J.js +6 -0
- package/dist/chunk-SF44YQCB.js +2 -0
- package/dist/chunk-SJQGFUXR.js +6 -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-UN3XLVPR.js +18 -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-VQ2RA43A.js +7 -0
- package/dist/chunk-VWYI4WF7.js +3 -0
- package/dist/chunk-W25HNEMR.js +4 -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-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/nightly.md +7 -1
- package/docs/releases.md +1 -1
- 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 +94 -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 +222 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/declaration-scan.ts +116 -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/initialization-options.ts +37 -0
- 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 +185 -131
- 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 +45 -24
- package/node_modules/pi-agent-ide-lsp/src/lsp/position-map.ts +17 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +40 -12
- 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 +414 -174
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-selectors.ts +424 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +67 -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 +384 -93
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +356 -79
- 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 +121 -26
- 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 +38 -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 +136 -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 +121 -26
- 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 +94 -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 +222 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/declaration-scan.ts +116 -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/initialization-options.ts +37 -0
- 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 +185 -131
- 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 +45 -24
- package/src/plugins/pi-agent-ide-lsp/src/lsp/position-map.ts +17 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +40 -12
- 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 +414 -174
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-selectors.ts +424 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +67 -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 +384 -93
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +356 -79
- 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
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { AgentToolResult, ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { Text } from "@earendil-works/pi-tui";
|
|
3
3
|
import {
|
|
4
|
+
describePathArgument,
|
|
5
|
+
isResultReference,
|
|
6
|
+
markNullFields,
|
|
7
|
+
nullFieldsMessage,
|
|
8
|
+
searchCallPolicy,
|
|
9
|
+
searchDataSchema,
|
|
4
10
|
searchOutputSchema,
|
|
5
11
|
type SearchPluginApi,
|
|
6
12
|
type SearchResolver,
|
|
@@ -11,6 +17,7 @@ import {
|
|
|
11
17
|
withToolCallInterceptionRendering,
|
|
12
18
|
} from "pi-agent-tool-call-interception";
|
|
13
19
|
import { toolCallHeader } from "pi-agent-tool-ui";
|
|
20
|
+
import { resultError, trackScriptCalls, withStructuredResult } from "pi-agent-resource";
|
|
14
21
|
import { Type, type Static } from "typebox";
|
|
15
22
|
|
|
16
23
|
import type { FileSearchOptions } from "#src/resolvers.ts";
|
|
@@ -23,12 +30,19 @@ export const fileSearchSchema = Type.Object(
|
|
|
23
30
|
"Glob (*, **, ?, [abc], {a,b}) or plain text matched as a case-insensitive subsequence. A glob with / matches paths relative to path; one without / matches file names at any depth.",
|
|
24
31
|
}),
|
|
25
32
|
path: Type.Optional(
|
|
26
|
-
Type.String(
|
|
33
|
+
Type.Union([Type.String(), Type.Array(Type.String())], {
|
|
34
|
+
description:
|
|
35
|
+
"Directory or file to search, or an array of them, local or ssh://; defaults to cwd.",
|
|
36
|
+
}),
|
|
27
37
|
),
|
|
28
38
|
include: Type.Optional(Type.String({ description: "Include glob" })),
|
|
29
39
|
exclude: Type.Optional(Type.String({ description: "Exclude glob" })),
|
|
30
40
|
limit: Type.Optional(
|
|
31
|
-
Type.Integer({
|
|
41
|
+
Type.Integer({
|
|
42
|
+
minimum: 1,
|
|
43
|
+
maximum: 1000,
|
|
44
|
+
description: "Maximum files (default 100; in Codemode, all files).",
|
|
45
|
+
}),
|
|
32
46
|
),
|
|
33
47
|
},
|
|
34
48
|
{ additionalProperties: false },
|
|
@@ -42,6 +56,8 @@ export function registerFileSearchTool(
|
|
|
42
56
|
resolver: SearchResolver,
|
|
43
57
|
search: Promise<SearchPluginApi>,
|
|
44
58
|
): void {
|
|
59
|
+
// A call from a script, such as Codemode, lists every match unless it sets a limit.
|
|
60
|
+
const scriptCall = trackScriptCalls(pi, "file_search");
|
|
45
61
|
pi.registerTool(
|
|
46
62
|
withToolCallInterceptionRendering(
|
|
47
63
|
{
|
|
@@ -60,6 +76,8 @@ export function registerFileSearchTool(
|
|
|
60
76
|
promptSnippet: "Find file paths by glob or partial name",
|
|
61
77
|
parameters: fileSearchSchema,
|
|
62
78
|
outputSchema: searchOutputSchema,
|
|
79
|
+
prepareArguments: (arguments_) =>
|
|
80
|
+
markNullFields(arguments_, fileSearchSchema) as FileSearchParameters,
|
|
63
81
|
renderCall(parameters, theme, context) {
|
|
64
82
|
return toolCallHeader(
|
|
65
83
|
context.lastComponent,
|
|
@@ -71,7 +89,7 @@ export function registerFileSearchTool(
|
|
|
71
89
|
? []
|
|
72
90
|
: [
|
|
73
91
|
{
|
|
74
|
-
text: `in ${parameters.path}`,
|
|
92
|
+
text: `in ${describePathArgument(parameters.path)}`,
|
|
75
93
|
color: "accent" as const,
|
|
76
94
|
truncate: "start" as const,
|
|
77
95
|
},
|
|
@@ -112,13 +130,27 @@ export function registerFileSearchTool(
|
|
|
112
130
|
);
|
|
113
131
|
},
|
|
114
132
|
async execute(
|
|
115
|
-
|
|
133
|
+
id,
|
|
116
134
|
parameters: FileSearchParameters,
|
|
117
135
|
signal,
|
|
118
136
|
onUpdate,
|
|
119
137
|
context,
|
|
120
138
|
): Promise<AgentToolResult<SearchToolDetails>> {
|
|
121
|
-
const
|
|
139
|
+
const nulls = nullFieldsMessage(parameters);
|
|
140
|
+
if (nulls !== undefined) return fileSearchFailure(nulls);
|
|
141
|
+
const { limit, audience, uncappedFiles } = searchCallPolicy(
|
|
142
|
+
parameters.limit,
|
|
143
|
+
scriptCall(id),
|
|
144
|
+
"files",
|
|
145
|
+
);
|
|
146
|
+
const options: FileSearchOptions = {
|
|
147
|
+
pattern: parameters.pattern,
|
|
148
|
+
...(uncappedFiles && { uncapped: true }),
|
|
149
|
+
};
|
|
150
|
+
if (parameters.path !== undefined && [parameters.path].flat().some(isResultReference))
|
|
151
|
+
return fileSearchFailure(
|
|
152
|
+
"file_search takes file and directory paths, not Read/Search results. Pass the paths themselves.",
|
|
153
|
+
);
|
|
122
154
|
return (await (
|
|
123
155
|
await search
|
|
124
156
|
).searchWith(
|
|
@@ -129,7 +161,7 @@ export function registerFileSearchTool(
|
|
|
129
161
|
...(parameters.path === undefined ? {} : { path: parameters.path }),
|
|
130
162
|
...(parameters.include === undefined ? {} : { include: parameters.include }),
|
|
131
163
|
...(parameters.exclude === undefined ? {} : { exclude: parameters.exclude }),
|
|
132
|
-
...(
|
|
164
|
+
...(limit === undefined ? {} : { limit }),
|
|
133
165
|
options: { files: options },
|
|
134
166
|
},
|
|
135
167
|
{
|
|
@@ -137,6 +169,8 @@ export function registerFileSearchTool(
|
|
|
137
169
|
...(signal !== undefined && { signal }),
|
|
138
170
|
...(onUpdate !== undefined && { onUpdate }),
|
|
139
171
|
},
|
|
172
|
+
// A script's call returns every path, however large the list.
|
|
173
|
+
audience,
|
|
140
174
|
)) as AgentToolResult<SearchToolDetails>;
|
|
141
175
|
},
|
|
142
176
|
},
|
|
@@ -144,3 +178,14 @@ export function registerFileSearchTool(
|
|
|
144
178
|
),
|
|
145
179
|
);
|
|
146
180
|
}
|
|
181
|
+
|
|
182
|
+
function fileSearchFailure(message: string): AgentToolResult<SearchToolDetails> {
|
|
183
|
+
return withStructuredResult(
|
|
184
|
+
{
|
|
185
|
+
content: [{ type: "text", text: message }],
|
|
186
|
+
details: { failure: { code: "INVALID_REQUEST", message } },
|
|
187
|
+
},
|
|
188
|
+
searchDataSchema,
|
|
189
|
+
{ status: "error", errors: [resultError(new Error(message), "SEARCH_FAILED")] },
|
|
190
|
+
);
|
|
191
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"imports": {
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./src/index.ts",
|
|
12
|
-
"default": "./runtime/entry-
|
|
12
|
+
"default": "./runtime/entry-63.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"pi-agent-resource": "0.
|
|
16
|
+
"pi-agent-resource": "1.0.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"typebox": "*"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../dist/entry-63.js";
|
|
@@ -29,6 +29,16 @@ export {
|
|
|
29
29
|
|
|
30
30
|
export { getTextSourceLine, type TextSourceLine, withTextSourceLine } from "./source-line.ts";
|
|
31
31
|
|
|
32
|
+
export {
|
|
33
|
+
documentLineAnchors,
|
|
34
|
+
isLineAnchor,
|
|
35
|
+
LINE_ANCHOR_PATTERN,
|
|
36
|
+
lineAnchors,
|
|
37
|
+
linesWithAnchor,
|
|
38
|
+
PRESENTED_LINE_ANCHOR_PATTERN,
|
|
39
|
+
textLineAnchors,
|
|
40
|
+
} from "./line-anchors.ts";
|
|
41
|
+
|
|
32
42
|
export {
|
|
33
43
|
createTextDocument,
|
|
34
44
|
isTextLinePresenter,
|
|
@@ -57,6 +67,14 @@ export {
|
|
|
57
67
|
type TextTargetResolutionAttempt,
|
|
58
68
|
type TextTargetResolver,
|
|
59
69
|
type TextTargetResolverContext,
|
|
70
|
+
type TextEditRun,
|
|
60
71
|
} from "./text-target.ts";
|
|
61
72
|
|
|
62
73
|
export { storeText, restoreText, type StoredText } from "./stored-text.ts";
|
|
74
|
+
|
|
75
|
+
export { endsWithNoFinalLineBreakMarker, NO_FINAL_LINE_BREAK } from "./no-final-line-break.ts";
|
|
76
|
+
export {
|
|
77
|
+
SEARCH_HIGHLIGHT_OPEN,
|
|
78
|
+
SEARCH_HIGHLIGHT_CLOSE,
|
|
79
|
+
stripSearchHighlights,
|
|
80
|
+
} from "./search-highlight.ts";
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { createTextDocument, type TextLine } from "./text-document.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Line anchors name a line by its content, not by its number, and are derived from the current
|
|
7
|
+
* text in one pass, without a stored map.
|
|
8
|
+
*
|
|
9
|
+
* - A line whose text occurs once in the file is named by that text alone, so its anchor survives
|
|
10
|
+
* any edit elsewhere until the line itself changes or a copy of it appears.
|
|
11
|
+
* - A repeated line is named by a landmark, the nearest unique line above or below it, the number
|
|
12
|
+
* of times its text occurs between the landmark and the line, and its text. Edits outside the
|
|
13
|
+
* stretch between the landmark and the line leave the anchor intact, as long as they don't add
|
|
14
|
+
* or remove a copy of its text before the next unique line on the other side.
|
|
15
|
+
* - The landmark comes from the line's own block, so moving a neighbouring block keeps it: a
|
|
16
|
+
* column-0 `}` or `};` ends a block, and the side reached without crossing a block end wins.
|
|
17
|
+
* A `template <typename T>` line takes the declaration below it, a closing brace the line above.
|
|
18
|
+
* When both sides or neither qualify, the nearer side wins; with no unique line on a side, the
|
|
19
|
+
* edge of the file stands in.
|
|
20
|
+
* - A repeated line also counts its text on the other side, up to the nearest unique line there,
|
|
21
|
+
* but not which line that is. A copy inserted or removed on either side then makes the anchor
|
|
22
|
+
* stale instead of handing it to a neighbouring copy, and moving the neighbouring block still
|
|
23
|
+
* keeps it.
|
|
24
|
+
* - A blank line is named by its landmarks on both sides. A blank line between two blocks then
|
|
25
|
+
* stops matching when either block moves, instead of matching a blank line next to the moved
|
|
26
|
+
* block in its new place.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/** Crockford base32: digits and capitals without I, L, O and U. */
|
|
30
|
+
const ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
31
|
+
const ANCHOR_LENGTH = 7;
|
|
32
|
+
const EDGE_OF_FILE = "";
|
|
33
|
+
|
|
34
|
+
/** The exact shape of one anchor: seven characters, 35 bits. */
|
|
35
|
+
export const LINE_ANCHOR_PATTERN = /^[0-9A-HJKMNP-TV-Z]{7}$/;
|
|
36
|
+
|
|
37
|
+
/** The anchor at the start of a presented line, such as `K7M2QX4|const a = 1;`. */
|
|
38
|
+
export const PRESENTED_LINE_ANCHOR_PATTERN = /^\s*([0-9A-HJKMNP-TV-Z]{7})\|/;
|
|
39
|
+
|
|
40
|
+
export function isLineAnchor(value: string): boolean {
|
|
41
|
+
return LINE_ANCHOR_PATTERN.test(value);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function encode(input: string): string {
|
|
45
|
+
const digest = createHash("sha1").update(input).digest();
|
|
46
|
+
// The first 40 bits, less the lowest five: 35 bits are seven base32 characters.
|
|
47
|
+
let bits = Math.floor(
|
|
48
|
+
((digest[0] ?? 0) * 2 ** 32 +
|
|
49
|
+
(digest[1] ?? 0) * 2 ** 24 +
|
|
50
|
+
(digest[2] ?? 0) * 2 ** 16 +
|
|
51
|
+
(digest[3] ?? 0) * 2 ** 8 +
|
|
52
|
+
(digest[4] ?? 0)) /
|
|
53
|
+
32,
|
|
54
|
+
);
|
|
55
|
+
let token = "";
|
|
56
|
+
for (let index = 0; index < ANCHOR_LENGTH; index += 1) {
|
|
57
|
+
token = ALPHABET.charAt(bits % 32) + token;
|
|
58
|
+
bits = Math.floor(bits / 32);
|
|
59
|
+
}
|
|
60
|
+
return token;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A column-0 closing brace ends a top-level block, such as a C++ function or class. A CRLF line
|
|
65
|
+
* keeps its CR in its text, so the brace may be followed by one.
|
|
66
|
+
*/
|
|
67
|
+
function endsBlock(line: string): boolean {
|
|
68
|
+
const text = line.endsWith("\r") ? line.slice(0, -1) : line;
|
|
69
|
+
return text === "}" || text === "};";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface Landmark {
|
|
73
|
+
/** The anchor of the nearest unique line on one side, or the edge of the file. */
|
|
74
|
+
readonly anchor: string;
|
|
75
|
+
/** Its line index: -1 or the line count when the edge of the file is the landmark. */
|
|
76
|
+
readonly at: number;
|
|
77
|
+
/** How many times the line's text occurs from the landmark up to the line, the line included. */
|
|
78
|
+
readonly nth: number;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The landmark of every line on one side: above for step 1, below for step -1. */
|
|
82
|
+
function landmarks(
|
|
83
|
+
lines: readonly string[],
|
|
84
|
+
unique: readonly boolean[],
|
|
85
|
+
step: 1 | -1,
|
|
86
|
+
): readonly (Landmark | undefined)[] {
|
|
87
|
+
const result: (Landmark | undefined)[] = Array.from({ length: lines.length });
|
|
88
|
+
let anchor = EDGE_OF_FILE;
|
|
89
|
+
let at = step === 1 ? -1 : lines.length;
|
|
90
|
+
let sinceLandmark = new Map<string, number>();
|
|
91
|
+
for (let index = at + step; index >= 0 && index < lines.length; index += step) {
|
|
92
|
+
const line = lines[index] ?? "";
|
|
93
|
+
if (unique[index] === true) {
|
|
94
|
+
anchor = encode(`u\0${line}`);
|
|
95
|
+
at = index;
|
|
96
|
+
sinceLandmark = new Map();
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const nth = (sinceLandmark.get(line) ?? 0) + 1;
|
|
100
|
+
sinceLandmark.set(line, nth);
|
|
101
|
+
result[index] = { anchor, at, nth };
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The side whose landmark belongs to the line's own block: reached without crossing a block end.
|
|
108
|
+
* When both or neither do, the nearer side; above on a tie and when the file has no unique line.
|
|
109
|
+
*/
|
|
110
|
+
function sideOf(
|
|
111
|
+
index: number,
|
|
112
|
+
line: string,
|
|
113
|
+
up: Landmark,
|
|
114
|
+
down: Landmark,
|
|
115
|
+
blockEndsIn: (from: number, to: number) => boolean,
|
|
116
|
+
): "above" | "below" {
|
|
117
|
+
const hasUp = up.anchor !== EDGE_OF_FILE;
|
|
118
|
+
const hasDown = down.anchor !== EDGE_OF_FILE;
|
|
119
|
+
const upInBlock = hasUp && !blockEndsIn(up.at, index);
|
|
120
|
+
const downInBlock = hasDown && !endsBlock(line) && !blockEndsIn(index + 1, down.at);
|
|
121
|
+
if (upInBlock !== downInBlock) {
|
|
122
|
+
return upInBlock ? "above" : "below";
|
|
123
|
+
}
|
|
124
|
+
if (!hasUp && !hasDown) {
|
|
125
|
+
return "above";
|
|
126
|
+
}
|
|
127
|
+
return index - up.at <= down.at - index ? "above" : "below";
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const cache = new WeakMap<readonly string[], readonly string[]>();
|
|
131
|
+
|
|
132
|
+
/** The anchor of every line, in order. The same list returns the same array. */
|
|
133
|
+
export function lineAnchors(lines: readonly string[]): readonly string[] {
|
|
134
|
+
const cached = cache.get(lines);
|
|
135
|
+
if (cached !== undefined) {
|
|
136
|
+
return cached;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const occurrences = new Map<string, number>();
|
|
140
|
+
for (const line of lines) {
|
|
141
|
+
occurrences.set(line, (occurrences.get(line) ?? 0) + 1);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const unique = lines.map((line) => occurrences.get(line) === 1);
|
|
145
|
+
const above = landmarks(lines, unique, 1);
|
|
146
|
+
const below = landmarks(lines, unique, -1);
|
|
147
|
+
// blockEndsBefore[i] counts the block ends among lines 0..i-1.
|
|
148
|
+
const blockEndsBefore = [0];
|
|
149
|
+
for (const line of lines) {
|
|
150
|
+
blockEndsBefore.push((blockEndsBefore.at(-1) ?? 0) + (endsBlock(line) ? 1 : 0));
|
|
151
|
+
}
|
|
152
|
+
const blockEndsIn = (from: number, to: number): boolean =>
|
|
153
|
+
from < to && (blockEndsBefore[to] ?? 0) - (blockEndsBefore[from] ?? 0) > 0;
|
|
154
|
+
|
|
155
|
+
const anchors: string[] = [];
|
|
156
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
157
|
+
const line = lines[index] ?? "";
|
|
158
|
+
if (unique[index] === true) {
|
|
159
|
+
anchors.push(encode(`u\0${line}`));
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const up = above[index] as Landmark;
|
|
163
|
+
const down = below[index] as Landmark;
|
|
164
|
+
if (line.trim() === "") {
|
|
165
|
+
anchors.push(encode(`ab\0${up.anchor}\0${up.nth}\0${down.anchor}\0${down.nth}\0${line}`));
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
anchors.push(
|
|
169
|
+
encode(
|
|
170
|
+
sideOf(index, line, up, down, blockEndsIn) === "above"
|
|
171
|
+
? `a\0${up.anchor}\0${up.nth}\0${down.nth}\0${line}`
|
|
172
|
+
: `b\0${down.anchor}\0${down.nth}\0${up.nth}\0${line}`,
|
|
173
|
+
),
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
cache.set(lines, anchors);
|
|
178
|
+
return anchors;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const documentCache = new WeakMap<readonly TextLine[], readonly string[]>();
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The anchor of every line of a text document. Documents of large files are shared and frozen,
|
|
185
|
+
* so the anchors of one are computed once however many tools ask.
|
|
186
|
+
*/
|
|
187
|
+
export function documentLineAnchors(lines: readonly TextLine[]): readonly string[] {
|
|
188
|
+
const cached = documentCache.get(lines);
|
|
189
|
+
if (cached !== undefined) {
|
|
190
|
+
return cached;
|
|
191
|
+
}
|
|
192
|
+
const anchors = lineAnchors(lines.map((line) => line.content));
|
|
193
|
+
documentCache.set(lines, anchors);
|
|
194
|
+
return anchors;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** The anchors of the lines of `content`, split as Read splits them. */
|
|
198
|
+
export function textLineAnchors(source: string, content: string): readonly string[] {
|
|
199
|
+
return documentLineAnchors(createTextDocument(source, content).lines);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** The 1-based numbers of the lines that produce `anchor`: none, one, or several. */
|
|
203
|
+
export function linesWithAnchor(anchors: readonly string[], anchor: string): readonly number[] {
|
|
204
|
+
const numbers: number[] = [];
|
|
205
|
+
for (let index = 0; index < anchors.length; index += 1) {
|
|
206
|
+
if (anchors[index] === anchor) {
|
|
207
|
+
numbers.push(index + 1);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return numbers;
|
|
211
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display line that follows the last line of a text without a final line break, as a unified
|
|
3
|
+
* diff shows it. It is not a line of the text: it has no anchor or number and no tool writes it.
|
|
4
|
+
*/
|
|
5
|
+
export const NO_FINAL_LINE_BREAK = "\";
|
|
6
|
+
|
|
7
|
+
/** True when the last line of `text` is exactly the display marker, with or without a line break. */
|
|
8
|
+
export function endsWithNoFinalLineBreakMarker(text: string): boolean {
|
|
9
|
+
const withoutBreak = text.endsWith("\n") ? text.slice(0, -1) : text;
|
|
10
|
+
const lastLine = withoutBreak.slice(withoutBreak.lastIndexOf("\n") + 1);
|
|
11
|
+
return (lastLine.endsWith("\r") ? lastLine.slice(0, -1) : lastLine) === NO_FINAL_LINE_BREAK;
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Delimiters that Search inserts around a match in its text preview. */
|
|
2
|
+
export const SEARCH_HIGHLIGHT_OPEN = "⟦";
|
|
3
|
+
export const SEARCH_HIGHLIGHT_CLOSE = "⟧";
|
|
4
|
+
|
|
5
|
+
/** Removes Search's presentation characters without changing the surrounding text. */
|
|
6
|
+
export function stripSearchHighlights(text: string): string {
|
|
7
|
+
return text.replaceAll(SEARCH_HIGHLIGHT_OPEN, "").replaceAll(SEARCH_HIGHLIGHT_CLOSE, "");
|
|
8
|
+
}
|
|
@@ -6,6 +6,11 @@ export interface TextSourceLine {
|
|
|
6
6
|
readonly source: string;
|
|
7
7
|
readonly lineNumber: number;
|
|
8
8
|
readonly content: string;
|
|
9
|
+
/**
|
|
10
|
+
* The line's anchor in the whole source file. An anchor names content in context, so only the
|
|
11
|
+
* code that holds the whole file can issue it; a mapped line without one is shown unanchored.
|
|
12
|
+
*/
|
|
13
|
+
readonly anchor?: string;
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
export function getTextSourceLine(line: Pick<TextLine, "metadata">): TextSourceLine | undefined {
|
|
@@ -41,6 +46,7 @@ function isTextSourceLine(value: unknown): value is TextSourceLine {
|
|
|
41
46
|
typeof candidate.lineNumber === "number" &&
|
|
42
47
|
Number.isInteger(candidate.lineNumber) &&
|
|
43
48
|
candidate.lineNumber > 0 &&
|
|
44
|
-
typeof candidate.content === "string"
|
|
49
|
+
typeof candidate.content === "string" &&
|
|
50
|
+
(candidate.anchor === undefined || typeof candidate.anchor === "string")
|
|
45
51
|
);
|
|
46
52
|
}
|
|
@@ -38,6 +38,12 @@ export abstract class TextAnchor {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/** Optionally checks the full current selection when paired with another endpoint. */
|
|
42
|
+
public rangeRejection?(
|
|
43
|
+
end: TextAnchor,
|
|
44
|
+
selected: string,
|
|
45
|
+
): { readonly code: string; readonly reason: string } | undefined;
|
|
46
|
+
|
|
41
47
|
public toString(): string {
|
|
42
48
|
return this.value;
|
|
43
49
|
}
|
|
@@ -50,6 +56,15 @@ export interface TextAnchorResolverContext {
|
|
|
50
56
|
readonly lines: readonly string[];
|
|
51
57
|
readonly cwd: string;
|
|
52
58
|
readonly signal?: AbortSignal;
|
|
59
|
+
/**
|
|
60
|
+
* Ranges of the text that the caller limits this anchor to, such as the selection of a result
|
|
61
|
+
* passed together with the anchor. A resolver that searches the text, such as exact text,
|
|
62
|
+
* matches only inside them; the caller checks that other anchors land inside them. A range that
|
|
63
|
+
* ends where a line ends also covers that line's break, so whole-line text inside it counts.
|
|
64
|
+
*/
|
|
65
|
+
readonly scope?: readonly TextAnchorRecoveryCandidateRange[];
|
|
66
|
+
/** Exclusive end of a paired start in UTF-16 source offsets. Used to disambiguate literals. */
|
|
67
|
+
readonly endAfter?: number;
|
|
53
68
|
}
|
|
54
69
|
|
|
55
70
|
/** Legacy line window used by anchor inspection. */
|
|
@@ -60,8 +75,11 @@ export interface TextAnchorRecoveryRange {
|
|
|
60
75
|
|
|
61
76
|
/** Why an anchor could not resolve safely. */
|
|
62
77
|
export interface TextAnchorRejection {
|
|
63
|
-
|
|
78
|
+
/** outside-scope means the selector matches the source, but not within the requested ranges. */
|
|
79
|
+
readonly code: "invalid" | "stale" | "missing" | "ambiguous" | "outside-scope" | "before-start";
|
|
64
80
|
readonly reason: string;
|
|
81
|
+
/** The literal after removing Search highlight delimiters, for suggestions only. */
|
|
82
|
+
readonly searchHighlightRetry?: string;
|
|
65
83
|
readonly contextRange?: TextAnchorRecoveryRange;
|
|
66
84
|
}
|
|
67
85
|
|
|
@@ -95,6 +113,8 @@ export type TextAnchorRecoveryOutcome =
|
|
|
95
113
|
readonly kind: "candidates";
|
|
96
114
|
readonly candidates: readonly TextAnchorRecoveryCandidate[];
|
|
97
115
|
readonly total: number;
|
|
116
|
+
/** Every disjoint match of the original selector, not guessed recovery candidates. */
|
|
117
|
+
readonly allMatches?: readonly TextAnchorRecoveryCandidateRange[];
|
|
98
118
|
}
|
|
99
119
|
| { readonly kind: "timed-out" }
|
|
100
120
|
| { readonly kind: "failed"; readonly error: unknown };
|
|
@@ -102,7 +122,12 @@ export type TextAnchorRecoveryOutcome =
|
|
|
102
122
|
/** Result of resolving an anchor value. */
|
|
103
123
|
export type TextAnchorResolutionAttempt =
|
|
104
124
|
| { readonly kind: "not-handled" }
|
|
105
|
-
| {
|
|
125
|
+
| {
|
|
126
|
+
readonly kind: "resolved";
|
|
127
|
+
readonly anchor: TextAnchor;
|
|
128
|
+
/** Agent-visible notice when a fallback matched instead of the supplied selector. */
|
|
129
|
+
readonly notice?: string;
|
|
130
|
+
}
|
|
106
131
|
| { readonly kind: "rejected"; readonly rejection: TextAnchorRejection }
|
|
107
132
|
| { readonly kind: "failed"; readonly error: unknown };
|
|
108
133
|
|
|
@@ -193,10 +218,11 @@ const positionSchema = Type.Object(
|
|
|
193
218
|
},
|
|
194
219
|
objectOptions,
|
|
195
220
|
);
|
|
221
|
+
const rangeSchema = Type.Object({ start: positionSchema, end: positionSchema }, objectOptions);
|
|
196
222
|
const candidateSchema = Type.Object(
|
|
197
223
|
{
|
|
198
224
|
rank: Type.Integer({ minimum: 1 }),
|
|
199
|
-
range:
|
|
225
|
+
range: rangeSchema,
|
|
200
226
|
},
|
|
201
227
|
objectOptions,
|
|
202
228
|
);
|
|
@@ -217,9 +243,12 @@ const rejectionSchema = Type.Object({
|
|
|
217
243
|
Type.Literal("invalid"),
|
|
218
244
|
Type.Literal("stale"),
|
|
219
245
|
Type.Literal("missing"),
|
|
246
|
+
Type.Literal("outside-scope"),
|
|
247
|
+
Type.Literal("before-start"),
|
|
220
248
|
Type.Literal("ambiguous"),
|
|
221
249
|
]),
|
|
222
250
|
reason: Type.String(),
|
|
251
|
+
searchHighlightRetry: Type.Optional(Type.String()),
|
|
223
252
|
contextRange: Type.Optional(
|
|
224
253
|
Type.Object({
|
|
225
254
|
offset: Type.Number(),
|
|
@@ -233,6 +262,7 @@ const attemptSchema = Type.Union([
|
|
|
233
262
|
{
|
|
234
263
|
kind: Type.Literal("resolved"),
|
|
235
264
|
anchor: Type.Unknown(),
|
|
265
|
+
notice: Type.Optional(Type.String()),
|
|
236
266
|
},
|
|
237
267
|
objectOptions,
|
|
238
268
|
),
|
|
@@ -258,6 +288,7 @@ const recoveryOutcomeSchema = Type.Union([
|
|
|
258
288
|
kind: Type.Literal("candidates"),
|
|
259
289
|
candidates: Type.Array(candidateSchema),
|
|
260
290
|
total: Type.Integer({ minimum: 0 }),
|
|
291
|
+
allMatches: Type.Optional(Type.Array(rangeSchema)),
|
|
261
292
|
},
|
|
262
293
|
objectOptions,
|
|
263
294
|
),
|
|
@@ -43,7 +43,8 @@ function convertText(
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
|
-
|
|
46
|
+
// Keep a UTF-8 BOM as the first character: the text is the file's exact content.
|
|
47
|
+
const text = new TextDecoder("utf8", { fatal: true, ignoreBOM: true }).decode(input.bytes);
|
|
47
48
|
return { kind: "converted", content: [{ type: "text", text }] };
|
|
48
49
|
} catch (error) {
|
|
49
50
|
if (!isTextualMediaType(input.mediaType)) {
|
|
@@ -170,39 +170,25 @@ function presentedRowFor(line: TextLine, compact: boolean): PresentedTextRow {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Splits text into lines. Only LF ends a line: CR is an ordinary character, so a CRLF line's
|
|
175
|
+
* content ends with CR and a lone CR stays inside its line. Every tool counts lines this way.
|
|
176
|
+
*/
|
|
173
177
|
function splitTextLines(content: string): TextLine[] {
|
|
174
178
|
if (content.length === 0) {
|
|
175
179
|
return [];
|
|
176
180
|
}
|
|
177
181
|
|
|
178
182
|
const lines: TextLine[] = [];
|
|
179
|
-
|
|
180
|
-
// LF-only text, the common case: indexOf scans much faster than a line-ending regex.
|
|
181
|
-
let start = 0;
|
|
182
|
-
for (let end = content.indexOf("\n"); end !== -1; end = content.indexOf("\n", start)) {
|
|
183
|
-
lines.push({
|
|
184
|
-
lineNumber: lines.length + 1,
|
|
185
|
-
content: content.slice(start, end),
|
|
186
|
-
lineEnding: "\n",
|
|
187
|
-
});
|
|
188
|
-
start = end + 1;
|
|
189
|
-
}
|
|
190
|
-
if (start < content.length) {
|
|
191
|
-
lines.push({ lineNumber: lines.length + 1, content: content.slice(start), lineEnding: "" });
|
|
192
|
-
}
|
|
193
|
-
return lines;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const endings = /\r\n|\r|\n/gu;
|
|
183
|
+
// indexOf scans much faster than a line-ending regex.
|
|
197
184
|
let start = 0;
|
|
198
|
-
let
|
|
199
|
-
while ((match = endings.exec(content)) !== null) {
|
|
185
|
+
for (let end = content.indexOf("\n"); end !== -1; end = content.indexOf("\n", start)) {
|
|
200
186
|
lines.push({
|
|
201
187
|
lineNumber: lines.length + 1,
|
|
202
|
-
content: content.slice(start,
|
|
203
|
-
lineEnding:
|
|
188
|
+
content: content.slice(start, end),
|
|
189
|
+
lineEnding: "\n",
|
|
204
190
|
});
|
|
205
|
-
start =
|
|
191
|
+
start = end + 1;
|
|
206
192
|
}
|
|
207
193
|
if (start < content.length) {
|
|
208
194
|
lines.push({ lineNumber: lines.length + 1, content: content.slice(start), lineEnding: "" });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TextAnchorRejection } from "./text-anchor.ts";
|
|
1
2
|
/** A position with a one-based line and zero-based column. */
|
|
2
3
|
export interface TextSelectionPosition {
|
|
3
4
|
readonly lineNumber: number;
|
|
@@ -20,9 +21,20 @@ export interface TextTarget {
|
|
|
20
21
|
readonly ranges?: readonly TextSelectionRange[];
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
/**
|
|
25
|
+
* One edit across its retries after other processes changed its file: the same object for every
|
|
26
|
+
* attempt. A resolver may reuse what it resolved for an earlier attempt of the same edit.
|
|
27
|
+
*/
|
|
28
|
+
export interface TextEditRun {
|
|
29
|
+
/** Zero for the first attempt. */
|
|
30
|
+
readonly attempt: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
export interface TextTargetResolverContext {
|
|
24
34
|
readonly cwd: string;
|
|
25
35
|
readonly signal?: AbortSignal;
|
|
36
|
+
/** Set while an edit resolves its targets; absent for reads and searches. */
|
|
37
|
+
readonly edit?: TextEditRun;
|
|
26
38
|
}
|
|
27
39
|
|
|
28
40
|
export type TextTargetResolutionAttempt =
|
|
@@ -30,11 +42,7 @@ export type TextTargetResolutionAttempt =
|
|
|
30
42
|
| { readonly kind: "resolved"; readonly targets: readonly TextTarget[] }
|
|
31
43
|
| {
|
|
32
44
|
readonly kind: "rejected";
|
|
33
|
-
readonly rejection:
|
|
34
|
-
readonly code: "invalid" | "stale" | "missing" | "ambiguous";
|
|
35
|
-
readonly reason: string;
|
|
36
|
-
readonly contextRange?: { readonly offset: number; readonly limit: number };
|
|
37
|
-
};
|
|
45
|
+
readonly rejection: TextAnchorRejection;
|
|
38
46
|
}
|
|
39
47
|
| { readonly kind: "failed"; readonly error: unknown };
|
|
40
48
|
|
|
@@ -60,7 +68,7 @@ export function isTextTargetResolutionAttempt(
|
|
|
60
68
|
return (
|
|
61
69
|
rejection !== null &&
|
|
62
70
|
typeof rejection === "object" &&
|
|
63
|
-
["invalid", "stale", "missing", "ambiguous"].includes(
|
|
71
|
+
["invalid", "stale", "missing", "ambiguous", "outside-scope"].includes(
|
|
64
72
|
(rejection as Record<string, unknown>).code as string,
|
|
65
73
|
) &&
|
|
66
74
|
typeof (rejection as Record<string, unknown>).reason === "string"
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-constant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-text": "0.
|
|
10
|
-
"pi-agent-text-editor": "0.
|
|
9
|
+
"pi-agent-text": "1.0.1",
|
|
10
|
+
"pi-agent-text-editor": "1.0.1"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
14
|
-
"./runtime/entry-
|
|
14
|
+
"./runtime/entry-64.js"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|