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
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { AgentToolResult, ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { resultError, resultInputSchema, withStructuredResult } from "pi-agent-resource";
|
|
3
2
|
import {
|
|
3
|
+
resultError,
|
|
4
|
+
resultInputSchema,
|
|
5
|
+
trackScriptCalls,
|
|
6
|
+
withStructuredResult,
|
|
7
|
+
} from "pi-agent-resource";
|
|
8
|
+
import {
|
|
9
|
+
describePathArgument,
|
|
10
|
+
markNullFields,
|
|
11
|
+
nullFieldsMessage,
|
|
12
|
+
searchCallPolicy,
|
|
4
13
|
searchDataSchema,
|
|
5
14
|
searchOutputSchema,
|
|
6
15
|
type SearchPluginApi,
|
|
@@ -25,7 +34,7 @@ export const lspSearchSchema = Type.Object(
|
|
|
25
34
|
Type.String({
|
|
26
35
|
minLength: 1,
|
|
27
36
|
description:
|
|
28
|
-
"file#selector, such as src/app.ts#App/start: returns
|
|
37
|
+
"file#selector, such as src/app.ts#App/start or main.cpp#clamp(int, float) for one overload: returns the editable declaration with captures.name. Replace its name capture with a new identifier to rename through LSP; replacing the declaration edits only its text.",
|
|
29
38
|
}),
|
|
30
39
|
),
|
|
31
40
|
calls: Type.Optional(
|
|
@@ -37,7 +46,7 @@ export const lspSearchSchema = Type.Object(
|
|
|
37
46
|
path: Type.Optional(
|
|
38
47
|
Type.Union(resultInputSchema.anyOf, {
|
|
39
48
|
description:
|
|
40
|
-
"For query: file, directory, unchanged Read/Search/edit result
|
|
49
|
+
"For query: file, directory, unchanged Read/Search/edit result or its UUID, or an array of paths or of results.",
|
|
41
50
|
}),
|
|
42
51
|
),
|
|
43
52
|
references: Type.Optional(
|
|
@@ -49,7 +58,11 @@ export const lspSearchSchema = Type.Object(
|
|
|
49
58
|
include: Type.Optional(Type.String({ description: "Include glob for query" })),
|
|
50
59
|
exclude: Type.Optional(Type.String({ description: "Exclude glob for query" })),
|
|
51
60
|
limit: Type.Optional(
|
|
52
|
-
Type.Integer({
|
|
61
|
+
Type.Integer({
|
|
62
|
+
minimum: 1,
|
|
63
|
+
maximum: 1000,
|
|
64
|
+
description: "Maximum matches (default 100; in Codemode, all matches).",
|
|
65
|
+
}),
|
|
53
66
|
),
|
|
54
67
|
},
|
|
55
68
|
{ additionalProperties: false },
|
|
@@ -70,13 +83,19 @@ export async function registerLspSearchTool(
|
|
|
70
83
|
): Promise<void> {
|
|
71
84
|
let resolved: LspSearchRuntime | undefined;
|
|
72
85
|
void runtime.then((value) => (resolved = value));
|
|
86
|
+
// A call from a script, such as Codemode, gets every match with its whole text.
|
|
87
|
+
const scriptCall = trackScriptCalls(pi, "lsp_search");
|
|
73
88
|
pi.registerTool(
|
|
74
89
|
withToolCallInterceptionRendering(
|
|
75
90
|
{
|
|
76
91
|
name: "lsp_search",
|
|
77
92
|
label: "lsp_search",
|
|
78
93
|
exposure: "direct",
|
|
79
|
-
namespace: {
|
|
94
|
+
namespace: {
|
|
95
|
+
name: "ide_lsp_search",
|
|
96
|
+
description:
|
|
97
|
+
"Navigate code through language servers: symbol definitions, references and call graphs.",
|
|
98
|
+
},
|
|
80
99
|
annotations: {
|
|
81
100
|
readOnlyHint: true,
|
|
82
101
|
destructiveHint: false,
|
|
@@ -89,6 +108,8 @@ export async function registerLspSearchTool(
|
|
|
89
108
|
"Find symbols, references, declarations and call graphs through language servers",
|
|
90
109
|
parameters: lspSearchSchema,
|
|
91
110
|
outputSchema: searchOutputSchema,
|
|
111
|
+
prepareArguments: (arguments_) =>
|
|
112
|
+
markNullFields(arguments_, lspSearchSchema) as LspSearchParameters,
|
|
92
113
|
renderCall(parameters, theme, context) {
|
|
93
114
|
return toolCallHeader(
|
|
94
115
|
context.lastComponent,
|
|
@@ -106,10 +127,7 @@ export async function registerLspSearchTool(
|
|
|
106
127
|
? []
|
|
107
128
|
: [
|
|
108
129
|
{
|
|
109
|
-
text:
|
|
110
|
-
typeof parameters.path === "string"
|
|
111
|
-
? `in ${parameters.path}`
|
|
112
|
-
: "in result scope",
|
|
130
|
+
text: `in ${describePathArgument(parameters.path)}`,
|
|
113
131
|
color: "accent" as const,
|
|
114
132
|
truncate: "start" as const,
|
|
115
133
|
},
|
|
@@ -150,12 +168,14 @@ export async function registerLspSearchTool(
|
|
|
150
168
|
);
|
|
151
169
|
},
|
|
152
170
|
async execute(
|
|
153
|
-
|
|
171
|
+
id,
|
|
154
172
|
parameters: LspSearchParameters,
|
|
155
173
|
signal,
|
|
156
174
|
onUpdate,
|
|
157
175
|
context,
|
|
158
176
|
): Promise<AgentToolResult<SearchToolDetails>> {
|
|
177
|
+
const nulls = nullFieldsMessage(parameters);
|
|
178
|
+
if (nulls !== undefined) return failure(nulls);
|
|
159
179
|
const label = parameters.query ?? parameters.declaration ?? parameters.calls;
|
|
160
180
|
const modes = [parameters.query, parameters.declaration, parameters.calls].filter(
|
|
161
181
|
(value) => value !== undefined,
|
|
@@ -176,6 +196,7 @@ export async function registerLspSearchTool(
|
|
|
176
196
|
"lsp_search needs the Search module (search.core), which is not loaded.",
|
|
177
197
|
);
|
|
178
198
|
const { api, resolver: lsp } = resolved;
|
|
199
|
+
const { limit, audience } = searchCallPolicy(parameters.limit, scriptCall(id), "matches");
|
|
179
200
|
return (await api.searchWith(
|
|
180
201
|
lsp,
|
|
181
202
|
{
|
|
@@ -184,7 +205,7 @@ export async function registerLspSearchTool(
|
|
|
184
205
|
...(parameters.path === undefined ? {} : { path: parameters.path }),
|
|
185
206
|
...(parameters.include === undefined ? {} : { include: parameters.include }),
|
|
186
207
|
...(parameters.exclude === undefined ? {} : { exclude: parameters.exclude }),
|
|
187
|
-
...(
|
|
208
|
+
...(limit === undefined ? {} : { limit }),
|
|
188
209
|
options: { lsp: options },
|
|
189
210
|
},
|
|
190
211
|
{
|
|
@@ -192,6 +213,7 @@ export async function registerLspSearchTool(
|
|
|
192
213
|
...(signal !== undefined && { signal }),
|
|
193
214
|
...(onUpdate !== undefined && { onUpdate }),
|
|
194
215
|
},
|
|
216
|
+
audience,
|
|
195
217
|
)) as AgentToolResult<SearchToolDetails>;
|
|
196
218
|
},
|
|
197
219
|
},
|
|
@@ -21,6 +21,8 @@ export interface AgentIdeProcess {
|
|
|
21
21
|
};
|
|
22
22
|
/** True only when Agent IDE created and controls this process. */
|
|
23
23
|
readonly owned?: boolean;
|
|
24
|
+
/** Pi session that started this process; omitted when unknown. */
|
|
25
|
+
readonly sessionId?: string;
|
|
24
26
|
renderSummary(theme: Theme): readonly string[];
|
|
25
27
|
renderDetail(theme: Theme): Component;
|
|
26
28
|
stop(): Promise<void>;
|
|
@@ -31,6 +33,8 @@ export interface AgentIdeProcess {
|
|
|
31
33
|
/** Supplies one process kind to the shared Agent IDE process surface. */
|
|
32
34
|
export interface AgentIdeProcessProvider {
|
|
33
35
|
readonly id: string;
|
|
36
|
+
/** One sentence the agent reads after compaction, such as how to list finished processes. */
|
|
37
|
+
readonly compactionGuidance?: string;
|
|
34
38
|
list(): readonly AgentIdeProcess[];
|
|
35
39
|
onDidChange(listener: () => void): () => void;
|
|
36
40
|
}
|
|
@@ -64,6 +68,42 @@ export class AgentIdeProcessRegistry {
|
|
|
64
68
|
return [...this.#providers.values()].flatMap((provider) => provider.list());
|
|
65
69
|
}
|
|
66
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Describe the processes of one Pi session for the agent after compaction has removed the
|
|
73
|
+
* results that named them. Returns undefined when that session has no active process.
|
|
74
|
+
*/
|
|
75
|
+
compactionNotice(sessionId: string | undefined): string | undefined {
|
|
76
|
+
const lines: string[] = [];
|
|
77
|
+
const guidance: string[] = [];
|
|
78
|
+
for (const provider of this.#providers.values()) {
|
|
79
|
+
const processes = provider
|
|
80
|
+
.list()
|
|
81
|
+
.filter((process) => process.sessionId === undefined || process.sessionId === sessionId);
|
|
82
|
+
if (processes.length === 0) continue;
|
|
83
|
+
lines.push(
|
|
84
|
+
...processes.map((process) =>
|
|
85
|
+
[
|
|
86
|
+
process.source,
|
|
87
|
+
process.kind,
|
|
88
|
+
process.status,
|
|
89
|
+
process.title,
|
|
90
|
+
oneLine(process.description),
|
|
91
|
+
]
|
|
92
|
+
.filter((part) => part.length > 0)
|
|
93
|
+
.join(" · "),
|
|
94
|
+
),
|
|
95
|
+
);
|
|
96
|
+
if (provider.compactionGuidance !== undefined) guidance.push(provider.compactionGuidance);
|
|
97
|
+
}
|
|
98
|
+
if (lines.length === 0) return undefined;
|
|
99
|
+
return [
|
|
100
|
+
"Agent IDE processes still active after compaction:",
|
|
101
|
+
...lines.map((line) => `- ${line}`),
|
|
102
|
+
"Read a source to inspect the process, then continue working with it.",
|
|
103
|
+
...guidance,
|
|
104
|
+
].join("\n");
|
|
105
|
+
}
|
|
106
|
+
|
|
67
107
|
onDidChange(listener: Listener): () => void {
|
|
68
108
|
this.#listeners.add(listener);
|
|
69
109
|
return () => this.#listeners.delete(listener);
|
|
@@ -83,12 +123,33 @@ export class AgentIdeProcessRegistry {
|
|
|
83
123
|
|
|
84
124
|
const registries = new WeakMap<ExtensionAPI, AgentIdeProcessRegistry>();
|
|
85
125
|
|
|
86
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Return the shared process registry for this Pi extension runtime. The first call also lists the
|
|
128
|
+
* active processes for the agent after each compaction, since compaction drops the tool results
|
|
129
|
+
* that named them.
|
|
130
|
+
*/
|
|
87
131
|
export function agentIdeProcessRegistry(pi: ExtensionAPI): AgentIdeProcessRegistry {
|
|
88
132
|
let registry = registries.get(pi);
|
|
89
133
|
if (registry === undefined) {
|
|
90
|
-
|
|
91
|
-
|
|
134
|
+
const created = new AgentIdeProcessRegistry();
|
|
135
|
+
registry = created;
|
|
136
|
+
registries.set(pi, created);
|
|
137
|
+
pi.on("session_compact", (_event, context) => {
|
|
138
|
+
const content = created.compactionNotice(context.sessionManager.getSessionId());
|
|
139
|
+
if (content === undefined) return;
|
|
140
|
+
pi.sendMessage(
|
|
141
|
+
{ customType: PROCESSES_AFTER_COMPACTION, content, display: false },
|
|
142
|
+
{ deliverAs: "steer" },
|
|
143
|
+
);
|
|
144
|
+
});
|
|
92
145
|
}
|
|
93
146
|
return registry;
|
|
94
147
|
}
|
|
148
|
+
|
|
149
|
+
/** Custom message type of the process list sent after compaction. */
|
|
150
|
+
export const PROCESSES_AFTER_COMPACTION = "agent-ide-processes-after-compaction";
|
|
151
|
+
|
|
152
|
+
function oneLine(value: string): string {
|
|
153
|
+
const line = value.replaceAll(/\s+/gu, " ").trim();
|
|
154
|
+
return line.length <= 120 ? line : `${line.slice(0, 119)}…`;
|
|
155
|
+
}
|
|
@@ -12,7 +12,10 @@ import {
|
|
|
12
12
|
Text,
|
|
13
13
|
truncateToWidth,
|
|
14
14
|
visibleWidth,
|
|
15
|
+
type OverlayHandle,
|
|
15
16
|
type SelectItem,
|
|
17
|
+
type TUI,
|
|
18
|
+
type TuiMouseEvent,
|
|
16
19
|
} from "@earendil-works/pi-tui";
|
|
17
20
|
|
|
18
21
|
import type { AgentIdeProcess, AgentIdeProcessRegistry } from "./registry.ts";
|
|
@@ -117,6 +120,8 @@ export class AgentIdeProcessesUi {
|
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
let disposeRefresh: () => void = () => undefined;
|
|
123
|
+
let stopDismissOnOutsidePress: () => void = () => undefined;
|
|
124
|
+
let overlayHandle: OverlayHandle | undefined;
|
|
120
125
|
let refreshTimer: ReturnType<typeof setInterval> | undefined;
|
|
121
126
|
let action: { readonly source: string } | null;
|
|
122
127
|
try {
|
|
@@ -161,6 +166,11 @@ export class AgentIdeProcessesUi {
|
|
|
161
166
|
tui.requestRender();
|
|
162
167
|
};
|
|
163
168
|
disposeRefresh = this.registry.onDidChange(refresh);
|
|
169
|
+
stopDismissOnOutsidePress = dismissOnOutsidePress(
|
|
170
|
+
tui,
|
|
171
|
+
() => overlayHandle?.isFocused() === true,
|
|
172
|
+
() => done(null),
|
|
173
|
+
);
|
|
164
174
|
refreshTimer = setInterval(refresh, 1_000);
|
|
165
175
|
|
|
166
176
|
return {
|
|
@@ -234,10 +244,17 @@ export class AgentIdeProcessesUi {
|
|
|
234
244
|
},
|
|
235
245
|
};
|
|
236
246
|
},
|
|
237
|
-
{
|
|
247
|
+
{
|
|
248
|
+
overlay: true,
|
|
249
|
+
overlayOptions: { width: "75%", maxHeight: "80%", minWidth: 52 },
|
|
250
|
+
onHandle: (handle) => {
|
|
251
|
+
overlayHandle = handle;
|
|
252
|
+
},
|
|
253
|
+
},
|
|
238
254
|
);
|
|
239
255
|
} finally {
|
|
240
256
|
disposeRefresh();
|
|
257
|
+
stopDismissOnOutsidePress();
|
|
241
258
|
if (refreshTimer !== undefined) clearInterval(refreshTimer);
|
|
242
259
|
}
|
|
243
260
|
if (action === null) return;
|
|
@@ -247,6 +264,45 @@ export class AgentIdeProcessesUi {
|
|
|
247
264
|
}
|
|
248
265
|
}
|
|
249
266
|
|
|
267
|
+
type OverlayMouseDispatch = (event: TuiMouseEvent) => { hit: boolean };
|
|
268
|
+
type MouseDispatchHost = { dispatchMouseToOverlay?: OverlayMouseDispatch };
|
|
269
|
+
|
|
270
|
+
function isDispatchHost(value: TUI): value is TUI & MouseDispatchHost {
|
|
271
|
+
return "dispatchMouseToOverlay" in value && typeof value.dispatchMouseToOverlay === "function";
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Fullscreen mode sends a click outside an overlay to the layout underneath and never to the
|
|
276
|
+
* overlay, and the renderer consumes mouse reports before extension input listeners see them.
|
|
277
|
+
* Wrap the renderer's overlay dispatch instead: a left press that hits no overlay while ours has
|
|
278
|
+
* focus runs `onPress`. Returns the cleanup that restores the original dispatch.
|
|
279
|
+
*/
|
|
280
|
+
function dismissOnOutsidePress(
|
|
281
|
+
tui: TUI,
|
|
282
|
+
isFocused: () => boolean,
|
|
283
|
+
onPress: () => void,
|
|
284
|
+
): () => void {
|
|
285
|
+
if (!isDispatchHost(tui)) return () => undefined;
|
|
286
|
+
const host = tui;
|
|
287
|
+
const original = host.dispatchMouseToOverlay;
|
|
288
|
+
if (original === undefined) return () => undefined;
|
|
289
|
+
const hadOwn = Object.hasOwn(host, "dispatchMouseToOverlay");
|
|
290
|
+
const wrapped: OverlayMouseDispatch = (event) => {
|
|
291
|
+
const result = original.call(host, event);
|
|
292
|
+
if (!result.hit && event.type === "press" && event.button === "left" && isFocused()) {
|
|
293
|
+
onPress();
|
|
294
|
+
return { hit: true };
|
|
295
|
+
}
|
|
296
|
+
return result;
|
|
297
|
+
};
|
|
298
|
+
host.dispatchMouseToOverlay = wrapped;
|
|
299
|
+
return () => {
|
|
300
|
+
if (host.dispatchMouseToOverlay !== wrapped) return;
|
|
301
|
+
if (hadOwn) host.dispatchMouseToOverlay = original;
|
|
302
|
+
else delete host.dispatchMouseToOverlay;
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
250
306
|
/** Render all active process kinds in one stable shared widget. */
|
|
251
307
|
export function renderProcessWidget(
|
|
252
308
|
processes: readonly AgentIdeProcess[],
|
|
@@ -224,6 +224,12 @@ export async function indexProject(
|
|
|
224
224
|
return status;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
/** A semantic search result: the readable text and its files in rank order, without ranges. */
|
|
228
|
+
export interface SemanticSearchResult {
|
|
229
|
+
readonly text: string;
|
|
230
|
+
readonly files: readonly string[];
|
|
231
|
+
}
|
|
232
|
+
|
|
227
233
|
/** Search an existing index; ColGREP incrementally refreshes it before every query. */
|
|
228
234
|
export async function searchProject(
|
|
229
235
|
cwd: string,
|
|
@@ -234,7 +240,7 @@ export async function searchProject(
|
|
|
234
240
|
readonly include?: string;
|
|
235
241
|
readonly exclude?: string;
|
|
236
242
|
} = {},
|
|
237
|
-
): Promise<
|
|
243
|
+
): Promise<SemanticSearchResult> {
|
|
238
244
|
const project = localProject(cwd);
|
|
239
245
|
if (!query.trim()) throw new Error("A semantic search query is required");
|
|
240
246
|
const status = await inspectProject(project, options);
|
|
@@ -318,7 +324,7 @@ export async function searchProject(
|
|
|
318
324
|
files.set(file, ranges);
|
|
319
325
|
}
|
|
320
326
|
}
|
|
321
|
-
if (!files.size) return "No semantic search results.";
|
|
327
|
+
if (!files.size) return { text: "No semantic search results.", files: [] };
|
|
322
328
|
if (singleFile) {
|
|
323
329
|
const lines: string[] = [];
|
|
324
330
|
for (const [file, ranges] of files) {
|
|
@@ -327,9 +333,15 @@ export async function searchProject(
|
|
|
327
333
|
if (selected.length > 15)
|
|
328
334
|
lines.push(`${selected.length - 15} additional retrieved ranges omitted`);
|
|
329
335
|
}
|
|
330
|
-
return
|
|
336
|
+
return {
|
|
337
|
+
text: `Approximate ranges (read before editing):\n${lines.join("\n")}`,
|
|
338
|
+
files: [...files.keys()],
|
|
339
|
+
};
|
|
331
340
|
}
|
|
332
|
-
return
|
|
333
|
-
|
|
334
|
-
|
|
341
|
+
return {
|
|
342
|
+
text: [...files]
|
|
343
|
+
.map(([file, ranges]) => `${file} (${ranges.size} retrieved candidates)`)
|
|
344
|
+
.join("\n"),
|
|
345
|
+
files: [...files.keys()],
|
|
346
|
+
};
|
|
335
347
|
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import { homedir, tmpdir } from "node:os";
|
|
19
19
|
import { delimiter, join, relative, resolve, sep } from "node:path";
|
|
20
20
|
import { searchFiles } from "#src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts";
|
|
21
|
-
import type { BackendOptions, ProjectStatus } from "./backend.ts";
|
|
21
|
+
import type { BackendOptions, ProjectStatus, SemanticSearchResult } from "./backend.ts";
|
|
22
22
|
|
|
23
23
|
const VERSION = "2.3.0"; // Version with the verified JSON and filtering contracts.
|
|
24
24
|
const RELEASE = `https://github.com/VeraTools/vera/releases/download/v${VERSION}`;
|
|
@@ -346,7 +346,7 @@ export async function searchVeraProject(
|
|
|
346
346
|
readonly include?: string;
|
|
347
347
|
readonly exclude?: string;
|
|
348
348
|
} = {},
|
|
349
|
-
): Promise<
|
|
349
|
+
): Promise<SemanticSearchResult> {
|
|
350
350
|
const project = projectPath(cwd);
|
|
351
351
|
if (!query.trim()) throw new Error("A semantic search query is required");
|
|
352
352
|
const status = await inspectVeraProject(project, options);
|
|
@@ -399,7 +399,7 @@ export async function searchVeraProject(
|
|
|
399
399
|
const warning = filtered
|
|
400
400
|
? "Vera may omit relevant matches when a scope or filter is used.\n"
|
|
401
401
|
: "";
|
|
402
|
-
if (allowed?.size === 0) return `${warning}No semantic search results
|
|
402
|
+
if (allowed?.size === 0) return { text: `${warning}No semantic search results.`, files: [] };
|
|
403
403
|
const args = ["search", "--json", "--potion-code", "--limit", String(singleFile ? 100 : limit)];
|
|
404
404
|
const paths = allowed ? [...allowed] : [];
|
|
405
405
|
if (
|
|
@@ -439,7 +439,7 @@ export async function searchVeraProject(
|
|
|
439
439
|
ranges.add(`${item.line_start}-${item.line_end}`);
|
|
440
440
|
files.set(file, ranges);
|
|
441
441
|
}
|
|
442
|
-
if (!files.size) return `${warning}No semantic search results
|
|
442
|
+
if (!files.size) return { text: `${warning}No semantic search results.`, files: [] };
|
|
443
443
|
if (singleFile) {
|
|
444
444
|
const lines: string[] = [];
|
|
445
445
|
for (const [file, ranges] of files) {
|
|
@@ -450,10 +450,17 @@ export async function searchVeraProject(
|
|
|
450
450
|
}
|
|
451
451
|
if (output.length === 100)
|
|
452
452
|
lines.push("More candidates may exist beyond Vera's retrieval limit");
|
|
453
|
-
return
|
|
453
|
+
return {
|
|
454
|
+
text: `${warning}Approximate ranges (read before editing):\n${lines.join("\n")}`,
|
|
455
|
+
files: [...files.keys()],
|
|
456
|
+
};
|
|
454
457
|
}
|
|
455
|
-
return
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
458
|
+
return {
|
|
459
|
+
text:
|
|
460
|
+
warning +
|
|
461
|
+
[...files]
|
|
462
|
+
.map(([file, ranges]) => `${file} (${ranges.size} retrieved candidates)`)
|
|
463
|
+
.join("\n"),
|
|
464
|
+
files: [...files.keys()],
|
|
465
|
+
};
|
|
459
466
|
}
|
|
@@ -34,7 +34,9 @@ export default async function registerTerminal(
|
|
|
34
34
|
triggers: [
|
|
35
35
|
{ tool: "bash" },
|
|
36
36
|
{ tool: "powershell" },
|
|
37
|
-
|
|
37
|
+
{ tool: "remote_bash" },
|
|
38
|
+
{ tool: "remote_powershell" },
|
|
39
|
+
...["read", "search", "write", "insert", "delete", "move"].map((tool) => ({
|
|
38
40
|
tool,
|
|
39
41
|
resourcePrefixes: ["shell:"],
|
|
40
42
|
})),
|
|
@@ -50,7 +52,16 @@ export default async function registerTerminal(
|
|
|
50
52
|
const ui = new TerminalUi(pi, manager);
|
|
51
53
|
const removeProcessProvider = agentIdeProcessRegistry(pi).add(terminalProcessProvider(manager));
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
// Listing and searching `shell:` cover the sessions this Pi session started.
|
|
56
|
+
let ownerSessionId: string | undefined;
|
|
57
|
+
const currentSessionId = (): string | undefined => ownerSessionId;
|
|
58
|
+
pi.on("session_start", (_event, context) => {
|
|
59
|
+
ownerSessionId = context.sessionManager.getSessionId();
|
|
60
|
+
});
|
|
61
|
+
await Promise.all([
|
|
62
|
+
registerTerminalResources(pi, manager, currentSessionId),
|
|
63
|
+
registerTerminalSearch(pi, manager, currentSessionId),
|
|
64
|
+
]);
|
|
54
65
|
const presentation = () => toolPresentation(context?.preferences["ui.terminal"]);
|
|
55
66
|
const releaseForegroundWaits = registerTerminalTools(
|
|
56
67
|
pi,
|
|
@@ -67,18 +78,18 @@ export default async function registerTerminal(
|
|
|
67
78
|
registerIdeCapability(pi, {
|
|
68
79
|
version: 1,
|
|
69
80
|
id: "terminal",
|
|
70
|
-
tools: ["bash", "powershell"],
|
|
81
|
+
tools: ["bash", "powershell", "remote_bash", "remote_powershell"],
|
|
71
82
|
schemas: {
|
|
72
83
|
read: {
|
|
73
84
|
parameters: {
|
|
74
|
-
path: "shell:<session> — status and output tail.",
|
|
85
|
+
path: "shell: — terminal sessions started in this Pi session; shell:<session> — status and output tail.",
|
|
75
86
|
views:
|
|
76
|
-
"On shell:<session>: image[:scale=S] — screen image; sequence[:duration=D,interval=I,scale=S] — frames over time
|
|
87
|
+
"On shell:<session>: image[:scale=S] — screen image; sequence[:duration=D,interval=I,scale=S] — frames over time. Duration and interval are in seconds (defaults: 2 and 0.5); up to 10 s and 20 frames.",
|
|
77
88
|
},
|
|
78
89
|
},
|
|
79
90
|
search: {
|
|
80
91
|
promptGuidelines: [
|
|
81
|
-
"path shell:<session> searches the retained text output of that terminal, including rows outside its current screen.",
|
|
92
|
+
"path shell:<session> searches the retained text output of that terminal, including rows outside its current screen; path shell: searches every terminal session of this Pi session.",
|
|
82
93
|
],
|
|
83
94
|
},
|
|
84
95
|
write: {
|
|
@@ -91,7 +102,7 @@ export default async function registerTerminal(
|
|
|
91
102
|
insert: {
|
|
92
103
|
parameters: {
|
|
93
104
|
path: "shell:<session> sends keys to that terminal.",
|
|
94
|
-
|
|
105
|
+
after: "Omit both after and before for shell:<session>.",
|
|
95
106
|
text: "For shell:<session>: named keys and chords such as Enter, Ctrl+C, Up, or caret forms such as ^C, separated by spaces or commas.",
|
|
96
107
|
},
|
|
97
108
|
promptGuidelines: [editingGuideline],
|
|
@@ -100,6 +111,11 @@ export default async function registerTerminal(
|
|
|
100
111
|
parameters: { path: "shell:<session> ends that session." },
|
|
101
112
|
promptGuidelines: [editingGuideline],
|
|
102
113
|
},
|
|
114
|
+
move: {
|
|
115
|
+
parameters: {
|
|
116
|
+
path: "shell:<session> with target shell:<name> renames that terminal session.",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
103
119
|
},
|
|
104
120
|
});
|
|
105
121
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Text, type Component } from "@earendil-works/pi-tui";
|
|
3
|
+
|
|
4
|
+
import type { TerminalSessionSnapshot } from "#src/plugins/pi-agent-ide-terminal/src/types.ts";
|
|
5
|
+
|
|
6
|
+
const LIST_HINT =
|
|
7
|
+
"Read shell:<session> for its status and output. Search with path shell: to search all listed sessions.";
|
|
8
|
+
|
|
9
|
+
/** List terminal sessions for the agent: running sessions first, then the most recent. */
|
|
10
|
+
export function formatTerminalList(
|
|
11
|
+
snapshots: readonly TerminalSessionSnapshot[],
|
|
12
|
+
now = Date.now(),
|
|
13
|
+
): string {
|
|
14
|
+
if (snapshots.length === 0) return "No terminal sessions in this Pi session.";
|
|
15
|
+
const ordered = [...snapshots].sort(
|
|
16
|
+
(left, right) =>
|
|
17
|
+
Number(isActive(right)) - Number(isActive(left)) || right.startedAt - left.startedAt,
|
|
18
|
+
);
|
|
19
|
+
const running = ordered.filter(isActive).length;
|
|
20
|
+
return [
|
|
21
|
+
`Terminal sessions of this Pi session: ${ordered.length} (${running} running)`,
|
|
22
|
+
...ordered.map((snapshot) => formatEntry(snapshot, now)),
|
|
23
|
+
LIST_HINT,
|
|
24
|
+
].join("\n");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Render a listing from its agent text, so a past result keeps showing the state it reported. */
|
|
28
|
+
export function renderTerminalList(
|
|
29
|
+
result: { readonly content: readonly { readonly type: string; readonly text?: string }[] },
|
|
30
|
+
theme: Pick<Theme, "fg">,
|
|
31
|
+
): Component {
|
|
32
|
+
const text = result.content.find((block) => block.type === "text")?.text ?? "";
|
|
33
|
+
const [heading = "", ...rest] = text.split("\n");
|
|
34
|
+
const lines = [
|
|
35
|
+
theme.fg("toolTitle", "terminal sessions"),
|
|
36
|
+
theme.fg("muted", heading),
|
|
37
|
+
...rest
|
|
38
|
+
.filter((line) => line !== LIST_HINT)
|
|
39
|
+
.map((line) =>
|
|
40
|
+
line.includes(" · running · ") || line.includes(" · stopping · ")
|
|
41
|
+
? ` ${theme.fg("accent", line)}`
|
|
42
|
+
: ` ${theme.fg("dim", line)}`,
|
|
43
|
+
),
|
|
44
|
+
];
|
|
45
|
+
return new Text(lines.join("\n"), 0, 0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function formatEntry(snapshot: TerminalSessionSnapshot, now: number): string {
|
|
49
|
+
const state = isActive(snapshot)
|
|
50
|
+
? `${snapshot.status} · last activity ${duration(now - snapshot.lastActivityAt)} ago`
|
|
51
|
+
: [
|
|
52
|
+
snapshot.status,
|
|
53
|
+
snapshot.exitCode === undefined ? undefined : `exit ${snapshot.exitCode}`,
|
|
54
|
+
snapshot.signal === undefined ? undefined : `signal ${snapshot.signal}`,
|
|
55
|
+
`ended ${duration(now - (snapshot.endedAt ?? now))} ago`,
|
|
56
|
+
]
|
|
57
|
+
.filter((part): part is string => part !== undefined)
|
|
58
|
+
.join(" · ");
|
|
59
|
+
return [snapshot.source, state, snapshot.shell, snapshot.cwd, oneLine(snapshot.command)].join(
|
|
60
|
+
" · ",
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function isActive(snapshot: TerminalSessionSnapshot): boolean {
|
|
65
|
+
return snapshot.status === "running" || snapshot.status === "stopping";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function duration(milliseconds: number): string {
|
|
69
|
+
const seconds = Math.max(0, Math.round(milliseconds / 1_000));
|
|
70
|
+
if (seconds < 60) return `${seconds}s`;
|
|
71
|
+
const minutes = Math.round(seconds / 60);
|
|
72
|
+
if (minutes < 60) return `${minutes}m`;
|
|
73
|
+
return `${Math.round(minutes / 60)}h`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function oneLine(command: string): string {
|
|
77
|
+
const line = command.replaceAll(/\s+/gu, " ").trim();
|
|
78
|
+
return line.length <= 120 ? line : `${line.slice(0, 119)}…`;
|
|
79
|
+
}
|
|
@@ -16,6 +16,28 @@ export function terminalOutputTail(output: string): TruncationResult {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/** Characters of trailing output that a terminal notice shows the agent and stores in the session. */
|
|
20
|
+
export const NOTICE_OUTPUT_CHARS = 2_000;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Bound a snapshot that is persisted in the session by a terminal notice.
|
|
24
|
+
*
|
|
25
|
+
* The session keeps only the excerpt the agent saw; the complete output stays in the log file at
|
|
26
|
+
* `fullOutputPath`. `outputStart`, `outputEnd` and `truncated` describe the stored excerpt.
|
|
27
|
+
*/
|
|
28
|
+
export function noticeSnapshot(snapshot: TerminalSessionSnapshot): TerminalSessionSnapshot {
|
|
29
|
+
const end = snapshot.output.trimEnd().length;
|
|
30
|
+
const start = Math.max(0, end - NOTICE_OUTPUT_CHARS);
|
|
31
|
+
if (start === 0 && end === snapshot.output.length) return snapshot;
|
|
32
|
+
return {
|
|
33
|
+
...snapshot,
|
|
34
|
+
output: snapshot.output.slice(start, end),
|
|
35
|
+
outputStart: snapshot.outputStart + start,
|
|
36
|
+
outputEnd: snapshot.outputStart + end,
|
|
37
|
+
truncated: snapshot.truncated || start > 0,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
19
41
|
/** Format one terminal snapshot for the agent without exposing unbounded output. */
|
|
20
42
|
export function formatAgentTerminalSnapshot(snapshot: TerminalSessionSnapshot): string {
|
|
21
43
|
const truncation = terminalOutputTail(snapshot.output);
|
|
@@ -9,6 +9,8 @@ import type { TerminalSessionManager } from "#src/plugins/pi-agent-ide-terminal/
|
|
|
9
9
|
export function terminalProcessProvider(manager: TerminalSessionManager): AgentIdeProcessProvider {
|
|
10
10
|
return {
|
|
11
11
|
id: "terminal",
|
|
12
|
+
compactionGuidance:
|
|
13
|
+
"Read shell: to list every terminal session of this Pi session, including finished ones.",
|
|
12
14
|
onDidChange: (listener) => manager.onDidChange(listener),
|
|
13
15
|
list: () =>
|
|
14
16
|
manager
|
|
@@ -20,6 +22,7 @@ export function terminalProcessProvider(manager: TerminalSessionManager): AgentI
|
|
|
20
22
|
kind: "terminal",
|
|
21
23
|
title: snapshot.shell.toLocaleLowerCase(),
|
|
22
24
|
description: snapshot.command,
|
|
25
|
+
...(snapshot.origin === undefined ? {} : { sessionId: snapshot.origin.sessionId }),
|
|
23
26
|
status: snapshot.status === "stopping" ? ("stopping" as const) : ("running" as const),
|
|
24
27
|
...(snapshot.pid === undefined ? {} : { pid: snapshot.pid, owned: true }),
|
|
25
28
|
...(snapshot.remote === undefined ? {} : { remote: snapshot.remote, owned: true }),
|