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
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { requiredValue } from "pi-agent-invariant";
|
|
2
|
-
import { connectResultTargets } from "pi-agent-resource";
|
|
3
|
-
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
4
2
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "pi-agent-read/api/plugin-protocol";
|
|
3
|
+
connectResultTargets,
|
|
4
|
+
normalizeStructuredArguments,
|
|
5
|
+
ResourceError,
|
|
6
|
+
} from "pi-agent-resource";
|
|
10
7
|
import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
|
|
11
8
|
import { getLastResolvedResource } from "pi-agent-text-editor/api/last-resolved-resource";
|
|
12
9
|
import {
|
|
@@ -33,43 +30,29 @@ import {
|
|
|
33
30
|
type TextMutationToolRegistration,
|
|
34
31
|
} from "pi-agent-text-editor/api/mutation-tool";
|
|
35
32
|
|
|
33
|
+
import { editingSelectorPairs } from "pi-agent-text-editor/api/text-selector-fields";
|
|
34
|
+
|
|
36
35
|
const CACHE_KEY_PART_SEPARATOR = "\u{0}";
|
|
37
36
|
const CACHE_KEY_LIST_SEPARATOR = "\u{1}";
|
|
38
37
|
|
|
39
38
|
export default async function registerTextEditorStaleAnchor(pi: ExtensionAPI): Promise<void> {
|
|
40
|
-
let readApi: ReadPluginApi | undefined;
|
|
41
|
-
const readPlugin = {
|
|
42
|
-
protocol: READ_PROTOCOL,
|
|
43
|
-
apiVersion: READ_API_VERSION,
|
|
44
|
-
id: "text-editor-stale-anchor",
|
|
45
|
-
setup(api) {
|
|
46
|
-
readApi = api;
|
|
47
|
-
},
|
|
48
|
-
} satisfies ReadPlugin;
|
|
49
39
|
const editorPlugin = {
|
|
50
40
|
protocol: TEXT_EDITOR_PROTOCOL,
|
|
51
41
|
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
52
42
|
id: "text-editor-stale-anchor",
|
|
53
43
|
setup(api) {
|
|
54
|
-
const dynamic = createHandler(pi, api
|
|
55
|
-
if (readApi === undefined) {
|
|
56
|
-
throw new Error("pi-agent-read is unavailable");
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return readApi;
|
|
60
|
-
});
|
|
44
|
+
const dynamic = createHandler(pi, api);
|
|
61
45
|
registerToolCallInterceptor(pi, dynamic.handler);
|
|
62
46
|
api.onMutationTool(dynamic.add);
|
|
63
47
|
},
|
|
64
48
|
} satisfies TextEditorPlugin;
|
|
65
49
|
|
|
66
|
-
await
|
|
50
|
+
await connectTextEditorPlugin(pi, editorPlugin);
|
|
67
51
|
}
|
|
68
52
|
|
|
69
53
|
function createHandler(
|
|
70
54
|
pi: ExtensionAPI,
|
|
71
55
|
api: TextEditorPluginApi,
|
|
72
|
-
getReadApi: () => ReadPluginApi,
|
|
73
56
|
): {
|
|
74
57
|
readonly handler: ToolCallInterceptorHandler;
|
|
75
58
|
readonly add: (registration: TextMutationToolRegistration) => void;
|
|
@@ -92,20 +75,49 @@ function createHandler(
|
|
|
92
75
|
return;
|
|
93
76
|
}
|
|
94
77
|
|
|
95
|
-
|
|
96
|
-
//
|
|
97
|
-
|
|
78
|
+
// Inspection may use a selection's owning resource, but must never replace the caller's
|
|
79
|
+
// selection with that whole resource in the arguments that eventually authorize the edit.
|
|
80
|
+
const arguments_ = {
|
|
81
|
+
...normalizeStructuredArguments(context.partialArgs ?? context.args, schema.parameters, {
|
|
82
|
+
cwd: context.cwd,
|
|
83
|
+
sourceFields: [
|
|
84
|
+
schema.source.field,
|
|
85
|
+
...(schema.source.targets ?? []).map((target) => target.field),
|
|
86
|
+
],
|
|
87
|
+
resolveSource: (value) => resultTargets.source(value, context.cwd, true),
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
98
90
|
try {
|
|
99
91
|
for (const field of [
|
|
100
92
|
schema.source.field,
|
|
101
93
|
...(schema.source.targets ?? []).map((target) => target.field),
|
|
102
94
|
]) {
|
|
103
95
|
const original = arguments_[field];
|
|
96
|
+
if (original === undefined) continue;
|
|
104
97
|
const source = resultTargets.source(original, context.cwd);
|
|
105
|
-
if (
|
|
106
|
-
|
|
98
|
+
if (typeof source === "string" && !source.startsWith("RESULT#")) {
|
|
99
|
+
// Unregistered Search selectors still belong to their own resolver.
|
|
100
|
+
if (source.startsWith("SEARCH#")) return;
|
|
101
|
+
arguments_[field] = source;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const selected = resultTargets.resolve(source, context.cwd, {
|
|
105
|
+
forScope: true,
|
|
106
|
+
allowAdjusted: true,
|
|
107
|
+
});
|
|
108
|
+
if (!selected.complete || selected.targets.length !== 1) return;
|
|
109
|
+
arguments_[field] = selected.targets[0]?.source;
|
|
107
110
|
}
|
|
108
|
-
} catch {
|
|
111
|
+
} catch (error) {
|
|
112
|
+
if (error instanceof ResourceError && error.code === "NO_EDITABLE_TEXT")
|
|
113
|
+
return makeResolverBlockResult(
|
|
114
|
+
context.toolCall.name,
|
|
115
|
+
schema.source.field,
|
|
116
|
+
error.source,
|
|
117
|
+
error.code,
|
|
118
|
+
);
|
|
119
|
+
// Unsupported values, expired IDs and selections without a unique owning source are
|
|
120
|
+
// refused by the result-input pipeline, not by filename anchor inspection.
|
|
109
121
|
return;
|
|
110
122
|
}
|
|
111
123
|
const source = resolveSource(
|
|
@@ -120,28 +132,32 @@ function createHandler(
|
|
|
120
132
|
return;
|
|
121
133
|
}
|
|
122
134
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
let pairs: ReturnType<typeof editingSelectorPairs>;
|
|
136
|
+
try {
|
|
137
|
+
pairs = editingSelectorPairs(schema.name, arguments_);
|
|
138
|
+
} catch {
|
|
139
|
+
// Wait for valid boundaries; execution reports invalid combinations.
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (schema.pair !== undefined)
|
|
143
|
+
pairs.push({ sourceField: schema.source.field, fields: schema.pair });
|
|
144
|
+
const paired = new Set<string>();
|
|
145
|
+
for (const { sourceField, fields } of pairs) {
|
|
146
|
+
const candidateSource = arguments_[sourceField];
|
|
147
|
+
const pairBlock = await inspectAnchorPair(
|
|
148
|
+
api,
|
|
149
|
+
context,
|
|
150
|
+
schema,
|
|
151
|
+
arguments_,
|
|
152
|
+
typeof candidateSource === "string" ? candidateSource : source,
|
|
153
|
+
fields,
|
|
154
|
+
checks,
|
|
155
|
+
blocks,
|
|
156
|
+
);
|
|
157
|
+
if (pairBlock !== undefined) return pairBlock;
|
|
158
|
+
if (fields.every((field) => typeof arguments_[field] === "string"))
|
|
159
|
+
for (const field of fields) paired.add(field);
|
|
136
160
|
}
|
|
137
|
-
|
|
138
|
-
const paired =
|
|
139
|
-
schema.pair?.every((field) => {
|
|
140
|
-
const descriptor = schema.anchors?.find((anchor) => anchor.field === field);
|
|
141
|
-
return descriptor !== undefined && isMutationAnchorValue(descriptor, arguments_[field]);
|
|
142
|
-
}) === true
|
|
143
|
-
? new Set(schema.pair)
|
|
144
|
-
: new Set<string>();
|
|
145
161
|
|
|
146
162
|
for (const descriptor of schema.anchors ?? []) {
|
|
147
163
|
if (paired.has(descriptor.field)) {
|
|
@@ -158,9 +174,8 @@ function createHandler(
|
|
|
158
174
|
const anchorSource = typeof candidateSource === "string" ? candidateSource : source;
|
|
159
175
|
const block = await inspectAnchors(
|
|
160
176
|
api,
|
|
161
|
-
getReadApi(),
|
|
162
177
|
context,
|
|
163
|
-
descriptor.field,
|
|
178
|
+
[descriptor.field],
|
|
164
179
|
anchorSource,
|
|
165
180
|
[anchor],
|
|
166
181
|
[descriptor.kinds],
|
|
@@ -242,19 +257,14 @@ function resolveSource(
|
|
|
242
257
|
|
|
243
258
|
async function inspectAnchorPair(
|
|
244
259
|
api: TextEditorPluginApi,
|
|
245
|
-
readApi: ReadPluginApi,
|
|
246
260
|
context: InterceptorContext,
|
|
247
261
|
schema: TextMutationToolRegistration,
|
|
248
262
|
arguments_: Record<string, unknown>,
|
|
249
263
|
source: string,
|
|
264
|
+
[startField, endField]: readonly [string, string],
|
|
250
265
|
checks: Map<number, Map<string, TextAnchorInspectionOutcome>>,
|
|
251
266
|
blocks: Map<number, Map<string, InterceptResult>>,
|
|
252
267
|
): Promise<InterceptResult | undefined> {
|
|
253
|
-
if (schema.pair === undefined) {
|
|
254
|
-
return undefined;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const [startField, endField] = schema.pair;
|
|
258
268
|
const start = arguments_[startField];
|
|
259
269
|
const end = arguments_[endField];
|
|
260
270
|
|
|
@@ -278,9 +288,8 @@ async function inspectAnchorPair(
|
|
|
278
288
|
|
|
279
289
|
return inspectAnchors(
|
|
280
290
|
api,
|
|
281
|
-
readApi,
|
|
282
291
|
context,
|
|
283
|
-
endField,
|
|
292
|
+
[startField, endField],
|
|
284
293
|
source,
|
|
285
294
|
[start, end],
|
|
286
295
|
[startDescriptor.kinds, endDescriptor.kinds],
|
|
@@ -291,9 +300,8 @@ async function inspectAnchorPair(
|
|
|
291
300
|
|
|
292
301
|
async function inspectAnchors(
|
|
293
302
|
api: TextEditorPluginApi,
|
|
294
|
-
readApi: ReadPluginApi,
|
|
295
303
|
context: InterceptorContext,
|
|
296
|
-
|
|
304
|
+
fields: readonly [string] | readonly [string, string],
|
|
297
305
|
source: string,
|
|
298
306
|
anchors: readonly [string] | readonly [string, string],
|
|
299
307
|
kinds: readonly [readonly string[]] | readonly [readonly string[], readonly string[]],
|
|
@@ -301,7 +309,7 @@ async function inspectAnchors(
|
|
|
301
309
|
blocks: Map<number, Map<string, InterceptResult>>,
|
|
302
310
|
): Promise<InterceptResult | undefined> {
|
|
303
311
|
const contentIndex = context.contentIndex ?? -1;
|
|
304
|
-
const key = `${source}${CACHE_KEY_PART_SEPARATOR}${anchors.join(
|
|
312
|
+
const key = `${source}${CACHE_KEY_PART_SEPARATOR}${fields.join(CACHE_KEY_LIST_SEPARATOR)}${CACHE_KEY_PART_SEPARATOR}${anchors.join(
|
|
305
313
|
CACHE_KEY_PART_SEPARATOR,
|
|
306
314
|
)}${CACHE_KEY_PART_SEPARATOR}${kinds
|
|
307
315
|
.map((accepted) => accepted.join(CACHE_KEY_LIST_SEPARATOR))
|
|
@@ -330,7 +338,12 @@ async function inspectAnchors(
|
|
|
330
338
|
}
|
|
331
339
|
|
|
332
340
|
if (result.kind === "failed") {
|
|
333
|
-
return makeResolverBlockResult(
|
|
341
|
+
return makeResolverBlockResult(
|
|
342
|
+
context.toolCall.name,
|
|
343
|
+
source,
|
|
344
|
+
result.reason,
|
|
345
|
+
result.cause instanceof ResourceError ? result.cause.code : undefined,
|
|
346
|
+
);
|
|
334
347
|
}
|
|
335
348
|
|
|
336
349
|
// This interceptor owns stale snapshot failures only. Missing, ambiguous, and
|
|
@@ -340,29 +353,14 @@ async function inspectAnchors(
|
|
|
340
353
|
}
|
|
341
354
|
|
|
342
355
|
const anchorIndex = result.anchorIndex;
|
|
343
|
-
const readResult =
|
|
344
|
-
result.contextRange === undefined
|
|
345
|
-
? undefined
|
|
346
|
-
: await readApi.read(
|
|
347
|
-
// The blocked message teaches a fresh anchor, so context must carry hashes.
|
|
348
|
-
{ path: source, views: ["anchors"], ...result.contextRange },
|
|
349
|
-
{
|
|
350
|
-
cwd: context.cwd,
|
|
351
|
-
...(context.signal !== undefined && { signal: context.signal }),
|
|
352
|
-
},
|
|
353
|
-
);
|
|
354
|
-
const readContext = readResult?.content
|
|
355
|
-
.filter((block) => block.type === "text")
|
|
356
|
-
.map((block) => block.text)
|
|
357
|
-
.join("\n");
|
|
358
356
|
const details: StaleAnchorMessageDetails = {
|
|
359
357
|
guardId: "stale-anchor",
|
|
360
358
|
effect: "not-applied",
|
|
361
359
|
toolName: context.toolCall.name,
|
|
362
|
-
field,
|
|
360
|
+
field: requiredValue(fields[anchorIndex]),
|
|
363
361
|
path: source,
|
|
364
362
|
anchor: requiredValue(anchors[anchorIndex]),
|
|
365
|
-
...(
|
|
363
|
+
...(context.partialArgs !== undefined && { stoppedEarly: true }),
|
|
366
364
|
};
|
|
367
365
|
|
|
368
366
|
const block = makeBlockResult(details, result.reason);
|
|
@@ -376,6 +374,7 @@ function makeResolverBlockResult(
|
|
|
376
374
|
toolName: string,
|
|
377
375
|
source: string,
|
|
378
376
|
reason: string,
|
|
377
|
+
code?: string,
|
|
379
378
|
): InterceptResult {
|
|
380
379
|
return {
|
|
381
380
|
annotation: { kind: "blocked", reason },
|
|
@@ -386,6 +385,7 @@ function makeResolverBlockResult(
|
|
|
386
385
|
details: {
|
|
387
386
|
guardId: "resolver",
|
|
388
387
|
effect: "not-applied",
|
|
388
|
+
...(code === undefined ? {} : { code }),
|
|
389
389
|
toolName,
|
|
390
390
|
source,
|
|
391
391
|
reason,
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-stale-anchor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-invariant": "0.
|
|
7
|
-
"pi-agent-
|
|
8
|
-
"pi-agent-
|
|
9
|
-
"pi-agent-text-editor": "0.9.7"
|
|
6
|
+
"pi-agent-invariant": "1.0.0",
|
|
7
|
+
"pi-agent-resource": "1.0.0",
|
|
8
|
+
"pi-agent-text-editor": "1.0.0"
|
|
10
9
|
},
|
|
11
10
|
"pi": {
|
|
12
11
|
"extensions": [
|
|
13
|
-
"./runtime/entry-
|
|
12
|
+
"./runtime/entry-90.js"
|
|
14
13
|
]
|
|
15
14
|
},
|
|
16
15
|
"peerDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../dist/entry-85.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../dist/entry-86.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../dist/entry-87.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const MAX_ANCHOR_EXCERPT_LENGTH = 160;
|
|
2
|
+
|
|
3
|
+
/** Quote only a bounded excerpt; never serialize a full oversized selector. */
|
|
4
|
+
export function quoteAnchorExcerpt(value: string): string {
|
|
5
|
+
if (value.length <= MAX_ANCHOR_EXCERPT_LENGTH) return JSON.stringify(value);
|
|
6
|
+
return `${JSON.stringify(value.slice(0, 56))} … ${JSON.stringify(value.slice(-56))} (${value.length} UTF-16 code units in all)`;
|
|
7
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TextAnchorRejection } from "pi-agent-text";
|
|
1
2
|
export interface TextAnchorContextRange {
|
|
2
3
|
readonly offset: number;
|
|
3
4
|
readonly limit: number;
|
|
@@ -18,7 +19,7 @@ export type TextAnchorInspectionOutcome =
|
|
|
18
19
|
readonly anchorIndex: number;
|
|
19
20
|
readonly reason: string;
|
|
20
21
|
/** Resolver-owned failure semantics. Only `stale` denotes a stale snapshot anchor. */
|
|
21
|
-
readonly rejectionCode?: "
|
|
22
|
+
readonly rejectionCode?: TextAnchorRejection["code"];
|
|
22
23
|
readonly contextRange?: TextAnchorContextRange;
|
|
23
24
|
}
|
|
24
25
|
| { readonly kind: "failed"; readonly reason: string; readonly cause?: unknown };
|
|
@@ -17,6 +17,8 @@ export interface BeforeDeleteEvent {
|
|
|
17
17
|
export interface DeleteFileAccess {
|
|
18
18
|
/** Omitted means POSIX target paths; native uses the controller platform's path syntax. */
|
|
19
19
|
readonly pathStyle?: "posix" | "native";
|
|
20
|
+
/** Names that differ only by letter case are the same name, as on a Windows volume. */
|
|
21
|
+
readonly caseInsensitive?: boolean;
|
|
20
22
|
/** Native account defaults and config directory for temporary removal exceptions.
|
|
21
23
|
* Omitted disables those exceptions; a remote owner must never use controller values.
|
|
22
24
|
* All returned paths are absolute on this owner. Called again during policy recheck.
|
|
@@ -11,18 +11,41 @@ export interface TextEditPlan {
|
|
|
11
11
|
readonly files: readonly {
|
|
12
12
|
readonly source: string;
|
|
13
13
|
readonly expectedContent: string;
|
|
14
|
-
readonly changes: readonly
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
readonly insert: string;
|
|
18
|
-
}[];
|
|
14
|
+
readonly changes: readonly TextEditPlanChange[];
|
|
15
|
+
/** Map the same edits onto the transaction's snapshot, or refuse if it is incompatible. */
|
|
16
|
+
readonly rebase?: (current: string) => readonly TextEditPlanChange[] | undefined;
|
|
19
17
|
}[];
|
|
20
18
|
}
|
|
19
|
+
export interface TextEditPlanChange {
|
|
20
|
+
readonly from: number;
|
|
21
|
+
readonly to: number;
|
|
22
|
+
readonly insert: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Supplies native semantic edits. Called at the start of each attempt, including retries after a
|
|
27
|
+
* snapshot mismatch or a guarded write conflict. A planner may reuse a compatible plan or throw
|
|
28
|
+
* with code `SOURCE_CHANGED` to request another attempt.
|
|
29
|
+
*/
|
|
30
|
+
export type TextEditPlanner = () => Promise<TextEditPlan>;
|
|
31
|
+
|
|
32
|
+
/** A semantic planner's recovery schedule after an edit is safely refused. */
|
|
33
|
+
export interface SourceChangeRetryPolicy {
|
|
34
|
+
/** Jittered pauses before each retry. No attempt starts after the list is spent. */
|
|
35
|
+
readonly delaysMs: readonly number[];
|
|
36
|
+
/** Start or return the existing recovery signal. Called only after a retryable refusal. */
|
|
37
|
+
readonly start: () => AbortSignal;
|
|
38
|
+
/** Explain what the caller can do after the schedule or deadline is exhausted. */
|
|
39
|
+
readonly exhaustedMessage: () => string;
|
|
40
|
+
}
|
|
41
|
+
|
|
21
42
|
export interface TextPreEditState<Input = unknown> {
|
|
22
43
|
readonly cwd: string;
|
|
23
44
|
readonly input: Input;
|
|
24
45
|
/** Optional native semantic edits supplied by the owning plugin, not by tool arguments. */
|
|
25
|
-
readonly
|
|
46
|
+
readonly planEdit?: TextEditPlanner;
|
|
47
|
+
/** Optional recovery schedule shared by the planner and the editor's guarded retry loop. */
|
|
48
|
+
readonly sourceChangeRetry?: SourceChangeRetryPolicy;
|
|
26
49
|
readonly signal?: AbortSignal;
|
|
27
50
|
/** A validated diffStatuses contribution is added to each completed file's presentation. */
|
|
28
51
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
@@ -39,7 +62,12 @@ export type TextPreEditHandler = (
|
|
|
39
62
|
export type TextEditHandler = (state: TextEditState) => TextEditState | Promise<TextEditState>;
|
|
40
63
|
|
|
41
64
|
export type TextEditHandlerRegistration =
|
|
42
|
-
| {
|
|
65
|
+
| {
|
|
66
|
+
readonly stage: "text-pre-edit";
|
|
67
|
+
/** Filter original inputs; matching calls run outside snapshot-only edit batches. */
|
|
68
|
+
readonly when?: (input: unknown) => boolean;
|
|
69
|
+
readonly handler: TextPreEditHandler;
|
|
70
|
+
}
|
|
43
71
|
| { readonly stage: "text-edit"; readonly handler: TextEditHandler }
|
|
44
72
|
| { readonly stage: "text-post-edit"; readonly handler: TextEditHandler };
|
|
45
73
|
|
|
@@ -67,7 +95,11 @@ export type TextEditExecutionOutcome<Input = unknown, Result = unknown> =
|
|
|
67
95
|
|
|
68
96
|
const handlerSchema = Type.Function([], Type.Unknown());
|
|
69
97
|
const textEditHandlerRegistrationSchema = Type.Union([
|
|
70
|
-
Type.Object({
|
|
98
|
+
Type.Object({
|
|
99
|
+
stage: Type.Literal("text-pre-edit"),
|
|
100
|
+
when: Type.Optional(handlerSchema),
|
|
101
|
+
handler: handlerSchema,
|
|
102
|
+
}),
|
|
71
103
|
Type.Object({ stage: Type.Literal("text-edit"), handler: handlerSchema }),
|
|
72
104
|
Type.Object({ stage: Type.Literal("text-post-edit"), handler: handlerSchema }),
|
|
73
105
|
]);
|
|
@@ -17,13 +17,13 @@ export {
|
|
|
17
17
|
type MutationOperationReceipt,
|
|
18
18
|
type MutationSnapshot,
|
|
19
19
|
type MutationResultPresentation,
|
|
20
|
-
type StaleAnchorDiagnostic,
|
|
21
20
|
type StaleEditInfo,
|
|
22
21
|
type StrictEditErrorCode,
|
|
23
22
|
type SyntaxErrorSummary,
|
|
24
23
|
type Warning,
|
|
25
24
|
} from "#src/core/mutation-result/file-mutation-result.ts";
|
|
26
25
|
|
|
26
|
+
export { NO_FINAL_LINE_BREAK } from "pi-agent-text";
|
|
27
27
|
export { type ChangedRange, computeChangedRanges } from "#src/core/mutation-result/diff.ts";
|
|
28
28
|
export {
|
|
29
29
|
mutationDataSchema,
|
|
@@ -32,3 +32,8 @@ export {
|
|
|
32
32
|
structuredMutation,
|
|
33
33
|
type MutationData,
|
|
34
34
|
} from "#src/core/structured-result.ts";
|
|
35
|
+
export {
|
|
36
|
+
compactMutationReceipt,
|
|
37
|
+
type CompactMutationReceipt,
|
|
38
|
+
} from "#src/core/mutation-result/compact-receipt.ts";
|
|
39
|
+
export { NO_TEXT_TARGET } from "#src/core/file-result-targets.ts";
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import type { TextEditIntent } from "#src/api/edit-completion.ts";
|
|
2
|
+
import type { MutationDiffStatus } from "#src/api/mutation-result.ts";
|
|
2
3
|
import type { TextChange, TextChangeDocument } from "#src/core/text-change-engine.ts";
|
|
3
4
|
import type { ImageContent } from "pi-agent-resource";
|
|
4
5
|
import type { TextAnchor } from "pi-agent-text";
|
|
5
6
|
import type { Static, TSchema } from "typebox";
|
|
6
7
|
|
|
8
|
+
/** A rejected mutation input whose stable code is safe to expose to result renderers. */
|
|
9
|
+
export class TextMutationInputError extends Error {
|
|
10
|
+
public constructor(
|
|
11
|
+
readonly code: string,
|
|
12
|
+
message: string,
|
|
13
|
+
) {
|
|
14
|
+
super(message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export interface TextMutationChange extends TextChange {
|
|
18
|
+
/** Selector fields that define this change when a tool has multiple selection roles. */
|
|
19
|
+
readonly selectorFields?: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
7
22
|
export interface TextMutationEdit {
|
|
8
|
-
readonly changes: readonly
|
|
23
|
+
readonly changes: readonly TextMutationChange[];
|
|
9
24
|
readonly action: "edited" | "overwritten";
|
|
25
|
+
/** Notices from the selectors that produced this edit. */
|
|
26
|
+
readonly selectorStatuses?: readonly MutationDiffStatus[];
|
|
10
27
|
/** Indices of changes that produce live output targets; omit to select all, or use [] for removals. */
|
|
11
28
|
readonly resultChanges?: readonly number[];
|
|
12
29
|
}
|
|
@@ -18,14 +35,28 @@ export interface TextMutation {
|
|
|
18
35
|
readonly afterWrite?: () => void | Promise<void>;
|
|
19
36
|
}
|
|
20
37
|
|
|
38
|
+
/** The earliest offset where a paired closing match may begin. */
|
|
39
|
+
export interface PairedAnchorStart {
|
|
40
|
+
readonly source: string;
|
|
41
|
+
readonly offset: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
21
44
|
export interface TextMutationContext {
|
|
22
45
|
readonly cwd: string;
|
|
23
46
|
readonly signal?: AbortSignal;
|
|
24
47
|
readonly sourceDocument: TextChangeDocument;
|
|
48
|
+
checkSpan?(span: {
|
|
49
|
+
readonly source: string;
|
|
50
|
+
readonly from: number;
|
|
51
|
+
readonly to: number;
|
|
52
|
+
}): Promise<void>;
|
|
25
53
|
targetDocument(field: string): TextChangeDocument;
|
|
26
54
|
sourceFor(field: string): string;
|
|
27
55
|
documentFor(source: string): TextChangeDocument;
|
|
28
|
-
resolveAnchors(
|
|
56
|
+
resolveAnchors(
|
|
57
|
+
field: string,
|
|
58
|
+
start?: PairedAnchorStart,
|
|
59
|
+
): Promise<ReadonlyMap<string, TextAnchor>>;
|
|
29
60
|
resolveAnchor(field: string): Promise<TextAnchor>;
|
|
30
61
|
}
|
|
31
62
|
|
|
@@ -45,6 +76,8 @@ export interface TextMutationAnchorField {
|
|
|
45
76
|
readonly sourceField: string;
|
|
46
77
|
readonly kinds: readonly string[];
|
|
47
78
|
readonly optional?: boolean;
|
|
79
|
+
/** Resolve only after the first range boundary is known. */
|
|
80
|
+
readonly pairedEnd?: boolean;
|
|
48
81
|
/** Values handled by the mutation itself instead of an anchor resolver. */
|
|
49
82
|
readonly nonAnchorValues?: readonly string[];
|
|
50
83
|
}
|
|
@@ -137,6 +170,8 @@ export interface TextMutationToolRegistration<TParameters extends TSchema = TSch
|
|
|
137
170
|
readonly source: TextMutationSourceDescriptor;
|
|
138
171
|
readonly anchors?: readonly TextMutationAnchorField[];
|
|
139
172
|
readonly pair?: readonly [string, string];
|
|
173
|
+
/** Reject invalid combinations before resolving sources or running a semantic edit. */
|
|
174
|
+
readonly validateInput?: (input: Readonly<Record<string, unknown>>) => void;
|
|
140
175
|
/** Execute a host transaction without opening one primary text resource. */
|
|
141
176
|
readonly direct?: DirectTextMutationHandler;
|
|
142
177
|
/** Whole-file operation used when the invocation contains no text selectors. */
|
|
@@ -5,8 +5,8 @@ import type { FileMutationBatchResult } from "./mutation-result.ts";
|
|
|
5
5
|
export interface NativeEditBatchEvent {
|
|
6
6
|
readonly parentToolCallId: string;
|
|
7
7
|
readonly calls: readonly string[];
|
|
8
|
-
/** Successful
|
|
9
|
-
readonly
|
|
8
|
+
/** Successful calls whose every target already had the requested text, without a write. */
|
|
9
|
+
readonly unchangedCalls?: readonly string[];
|
|
10
10
|
/** Per-call receipts keep only their own output selection and failure evidence. */
|
|
11
11
|
readonly mutationResults?: ReadonlyMap<string, AgentToolResult<FileMutationBatchResult>>;
|
|
12
12
|
readonly result: AgentToolResult<FileMutationBatchResult>;
|
|
@@ -28,6 +28,20 @@ function revision(stat: Stats): string {
|
|
|
28
28
|
stat.mode,
|
|
29
29
|
]);
|
|
30
30
|
}
|
|
31
|
+
/** POSIX permission bits for a local object. Windows reports 0666 for every writable file and
|
|
32
|
+
* directory, which would publish world-writable files and untraversable directories on a POSIX
|
|
33
|
+
* target; use the usual defaults there and keep read-only files read-only.
|
|
34
|
+
*/
|
|
35
|
+
export function localObjectMode(
|
|
36
|
+
stat: { readonly mode: number | bigint; isDirectory(): boolean },
|
|
37
|
+
platform: NodeJS.Platform = process.platform,
|
|
38
|
+
): number {
|
|
39
|
+
const mode = Number(stat.mode);
|
|
40
|
+
if (platform !== "win32") return mode;
|
|
41
|
+
const type = mode & ~0o7777;
|
|
42
|
+
if (stat.isDirectory()) return type | 0o755;
|
|
43
|
+
return type | ((mode & 0o200) === 0 ? 0o444 : 0o644);
|
|
44
|
+
}
|
|
31
45
|
async function optionalStat(source: string) {
|
|
32
46
|
return lstat(source).catch((error: NodeJS.ErrnoException) => {
|
|
33
47
|
if (error.code === "ENOENT") return undefined;
|
|
@@ -66,7 +80,7 @@ export async function snapshotLocalObjects(
|
|
|
66
80
|
kind: kind(stat),
|
|
67
81
|
revision: revision(stat),
|
|
68
82
|
identity: { device: String(stat.dev), inode: String(stat.ino) },
|
|
69
|
-
mode: stat
|
|
83
|
+
mode: localObjectMode(stat),
|
|
70
84
|
...(stat.isSymbolicLink()
|
|
71
85
|
? { link: (await readlink(file, { encoding: "buffer" })).toString("base64") }
|
|
72
86
|
: {}),
|
|
@@ -106,7 +120,7 @@ export const localFileTransferAccess: FileTransferAccess = {
|
|
|
106
120
|
kind: kind(stat),
|
|
107
121
|
revision: revision(stat),
|
|
108
122
|
identity: { device: String(stat.dev), inode: String(stat.ino) },
|
|
109
|
-
mode: stat
|
|
123
|
+
mode: localObjectMode(stat),
|
|
110
124
|
};
|
|
111
125
|
},
|
|
112
126
|
read: (source) => readFile(source, "utf8"),
|