pi-agent-ide 0.7.3 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -35
- package/README.md +70 -19
- package/dist/chunk-246NTPOS.js +1 -0
- package/dist/chunk-2ITKAXHO.js +1 -0
- package/dist/chunk-3WO2NOEQ.js +1 -0
- package/dist/{chunk-ZTYWHL2F.js → chunk-47SPPIXK.js} +1 -1
- package/dist/chunk-4HWKBCBH.js +1 -0
- package/dist/chunk-4W7GH3T7.js +10 -0
- package/dist/{chunk-JMVDFOTQ.js → chunk-57F5GTHO.js} +1 -1
- package/dist/chunk-6EDOLYOV.js +1 -0
- package/dist/chunk-756K3LJY.js +1 -0
- package/dist/chunk-7LOVUWNI.js +1 -0
- package/dist/chunk-A64JRDZK.js +1 -0
- package/dist/chunk-AIT3YWR5.js +3 -0
- package/dist/chunk-AKNHSDGV.js +1 -0
- package/dist/chunk-AUL5FGGK.js +2 -0
- package/dist/chunk-BB4A5UI3.js +5 -0
- package/dist/chunk-BQAKA3FU.js +1 -0
- package/dist/chunk-BR7GRH4A.js +5 -0
- package/dist/chunk-BXGMMZT3.js +1 -0
- package/dist/{chunk-ZIWPKIBZ.js → chunk-D4IA2MTA.js} +1 -1
- package/dist/chunk-DUUOCBS3.js +3 -0
- package/dist/chunk-DXONCYWF.js +3 -0
- package/dist/chunk-E2PHA4SQ.js +1 -0
- package/dist/{chunk-H445SHSJ.js → chunk-EMRJP6EM.js} +1 -1
- package/dist/chunk-GEMDU6XW.js +1 -0
- package/dist/chunk-GNACBJM3.js +1 -0
- package/dist/chunk-HCK7OIQ3.js +1 -0
- package/dist/chunk-HFJGCYFO.js +11 -0
- package/dist/chunk-ID4RJIVZ.js +9 -0
- package/dist/chunk-IMGIDBCC.js +1 -0
- package/dist/chunk-JKMXND6V.js +1 -0
- package/dist/chunk-L2B4DTVS.js +1 -0
- package/dist/chunk-LAJQSHEI.js +4 -0
- package/dist/chunk-LEKC4GQK.js +5 -0
- package/dist/chunk-LLRUJD62.js +1 -0
- package/dist/{chunk-2ZMMRINH.js → chunk-M4TVRCMZ.js} +1 -1
- package/dist/chunk-MKEC3U2M.js +4 -0
- package/dist/chunk-N56WAVYA.js +1 -0
- package/dist/chunk-OFILFO6D.js +1 -0
- package/dist/chunk-OI3HBIPK.js +2 -0
- package/dist/{chunk-S6QRG3TQ.js → chunk-OM4LYD3S.js} +1 -1
- package/dist/{chunk-WLZIUMJL.js → chunk-PRLIHLCS.js} +1 -1
- package/dist/chunk-Q5X6OXNS.js +2 -0
- package/dist/chunk-R2U5WXYR.js +1 -0
- package/dist/chunk-S72FVLUX.js +1 -0
- package/dist/chunk-SWA5B5B2.js +9 -0
- package/dist/chunk-T4FTT3U4.js +1 -0
- package/dist/chunk-T7MWQQIF.js +3 -0
- package/dist/chunk-TGC2ZACO.js +1 -0
- package/dist/chunk-TOYN4W4F.js +1 -0
- package/dist/chunk-TXG2H7YQ.js +9 -0
- package/dist/{chunk-QFTBY67N.js → chunk-UEVGZUII.js} +3 -3
- package/dist/{chunk-7UGNGK7Y.js → chunk-VAXLSPPU.js} +1 -1
- package/dist/chunk-VDP5CQHM.js +3 -0
- package/dist/chunk-VMGZMXEM.js +10 -0
- package/dist/chunk-VNTY7BKC.js +1 -0
- package/dist/chunk-W3YFF6OO.js +1 -0
- package/dist/chunk-W7M3V7FR.js +28 -0
- package/dist/chunk-WMHSVEIT.js +29 -0
- package/dist/chunk-WPBQ45ZL.js +1 -0
- package/dist/chunk-WXGTU2M6.js +1 -0
- package/dist/chunk-XSIKDVAR.js +25 -0
- package/dist/chunk-YHREORHH.js +2 -0
- package/dist/chunk-YJ6T3PEP.js +1 -0
- package/dist/chunk-YTYLS2UM.js +1 -0
- package/dist/chunk-Z2QGNTGQ.js +1 -0
- package/dist/{chunk-QDLTO5PH.js → chunk-ZAWRSA7N.js} +1 -1
- package/dist/chunk-ZV5ETNLQ.js +1 -0
- package/dist/entry-0.js +1 -1
- package/dist/entry-1.js +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-16.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-18.js +1 -0
- package/dist/entry-2.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-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -2
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +2 -2
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +4 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +1 -17
- package/dist/entry-32.js +1 -1
- package/dist/entry-33.js +18 -3
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -4
- package/dist/entry-37.js +1 -9
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +1 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +1 -25
- package/dist/entry-46.js +1 -1
- package/dist/entry-47.js +25 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -3
- package/dist/entry-51.js +1 -13
- package/dist/entry-52.js +3 -1
- package/dist/entry-53.js +13 -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-6.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -0
- package/dist/entry-62.js +1 -1
- package/dist/entry-64.js +1 -1
- package/dist/entry-65.js +0 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-7.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -0
- package/dist/entry-72.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +0 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +1 -80
- package/dist/entry-78.js +1 -19
- package/dist/entry-79.js +80 -2
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +22 -1
- package/dist/entry-81.js +2 -1
- package/dist/entry-82.js +1 -5
- package/dist/entry-83.js +1 -3
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +3 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -0
- package/dist/entry-88.js +1 -0
- package/dist/pi-agent-ide.js +53 -24
- package/docs/agent-guides/debugger.md +2 -0
- package/docs/agent-guides/editing.md +1 -1
- package/docs/agent-guides/search-code.md +7 -2
- package/docs/agent-guides/ssh.md +58 -0
- package/docs/agent-guides/vision.md +6 -0
- package/docs/configuration.md +51 -5
- package/docs/development.md +1 -13
- package/docs/extensions.md +1 -1
- package/docs/releases.md +1 -1
- package/docs/settings-help.md +39 -0
- package/docs/tools.md +22 -14
- package/docs/user-hooks.md +7 -3
- package/node_modules/pi-agent-doctor/package.json +10 -9
- package/node_modules/pi-agent-doctor/runtime/entry-25.js +1 -0
- package/node_modules/pi-agent-doctor/src/evidence.ts +49 -4
- package/node_modules/pi-agent-doctor/src/executable.ts +46 -16
- package/node_modules/pi-agent-doctor/src/fixtures/executable-probe.ts +78 -0
- package/node_modules/pi-agent-doctor/src/fixtures/probe-executable-wait.mjs +10 -0
- package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +6 -0
- package/node_modules/pi-agent-doctor/src/project-probes.ts +73 -0
- package/node_modules/pi-agent-doctor/src/workspace.ts +106 -0
- package/node_modules/pi-agent-documentation/package.json +2 -2
- package/node_modules/pi-agent-documentation/runtime/entry-26.js +1 -0
- package/node_modules/pi-agent-filesystem/package.json +8 -8
- package/node_modules/pi-agent-filesystem/src/resolver.ts +23 -7
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-jq/index.ts +33 -6
- package/node_modules/pi-agent-filesystem-jq/package.json +6 -7
- package/node_modules/pi-agent-filesystem-jq/src/jq.ts +67 -0
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-30.js +2 -0
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-ide-ast/package.json +15 -41
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +2 -1
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +10 -3
- package/node_modules/pi-agent-ide-ast/src/ast/read-text.ts +4 -1
- package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +3 -3
- package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +13 -10
- package/node_modules/pi-agent-ide-ast/src/extension.ts +17 -1
- package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +32 -4
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/search-presentation.ts +4 -3
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +100 -42
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +3 -2
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +2 -1
- package/node_modules/pi-agent-ide-changes/index.ts +10 -2
- package/node_modules/pi-agent-ide-changes/package.json +10 -11
- package/node_modules/pi-agent-ide-changes/runtime/entry-34.js +1 -0
- package/node_modules/pi-agent-ide-changes/src/change-anchor.ts +7 -2
- package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +18 -1
- package/node_modules/pi-agent-ide-changes/src/changes/change-types.ts +3 -0
- package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +59 -7
- package/node_modules/pi-agent-ide-changes/src/changes/git-paths.ts +49 -0
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +10 -2
- package/node_modules/pi-agent-ide-changes/src/doctor-plugin.ts +13 -14
- package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +2 -1
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +47 -11
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -1
- package/node_modules/pi-agent-ide-formatter/index.ts +14 -2
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-formatter/src/doctor-plugin.ts +47 -35
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +41 -11
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +9 -28
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/index.ts +35 -4
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/runtime/entry-38.js +2 -0
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +14 -10
- package/node_modules/pi-agent-ide-lint/src/doctor-plugin.ts +47 -39
- package/node_modules/pi-agent-ide-lint/src/registry.ts +9 -25
- package/node_modules/pi-agent-ide-lsp/index.ts +107 -25
- package/node_modules/pi-agent-ide-lsp/package.json +10 -13
- package/node_modules/pi-agent-ide-lsp/runtime/entry-39.js +2 -0
- package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +6 -2
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +5 -1
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +5 -3
- package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +27 -11
- package/node_modules/pi-agent-ide-lsp/src/lsp/abort.ts +62 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +245 -103
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +26 -45
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/document-uri.ts +40 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/file-watchers.ts +8 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +24 -17
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +255 -56
- package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +51 -11
- package/node_modules/pi-agent-ide-lsp/src/lsp/owner-transport.ts +67 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +149 -18
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +79 -31
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +15 -12
- package/node_modules/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +16 -0
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +67 -46
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +50 -19
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -4
- package/node_modules/pi-agent-read/package.json +12 -12
- package/node_modules/pi-agent-read/runtime/entry-45.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-47.js +2 -0
- package/node_modules/pi-agent-read/src/api/tools/read.ts +4 -2
- package/node_modules/pi-agent-read/src/core/extension.ts +4 -1
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +143 -69
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +25 -1
- package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +67 -44
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +8 -3
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +20 -5
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-resource/src/content-conversion/content-host.ts +75 -16
- package/node_modules/pi-agent-resource/src/index.ts +3 -0
- package/node_modules/pi-agent-resource/src/resource-error.ts +17 -0
- package/node_modules/pi-agent-resource/src/resource.ts +23 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +25 -2
- package/node_modules/pi-agent-resource/src/validation.ts +2 -1
- package/node_modules/pi-agent-search/package.json +9 -9
- package/node_modules/pi-agent-search/runtime/entry-50.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-51.js +1 -0
- package/node_modules/pi-agent-search/runtime/entry-52.js +2 -0
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/presentation.ts +10 -2
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +7 -3
- package/node_modules/pi-agent-search/src/api/search.ts +51 -2
- package/node_modules/pi-agent-search/src/core/extension.ts +2 -3
- package/node_modules/pi-agent-search/src/core/search-core.ts +98 -8
- package/node_modules/pi-agent-search-text/index.ts +37 -1
- package/node_modules/pi-agent-search-text/package.json +14 -12
- package/node_modules/pi-agent-search-text/runtime/entry-53.js +1 -0
- package/node_modules/pi-agent-search-text/runtime/entry-56.js +1 -0
- package/node_modules/pi-agent-search-text/src/doctor-plugin.ts +10 -5
- package/node_modules/pi-agent-search-text/src/file-search.ts +26 -3
- package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +54 -3
- package/node_modules/pi-agent-search-text/src/resolvers.ts +22 -5
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +4 -5
- package/node_modules/pi-agent-search-text/src/search-backend.ts +123 -17
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +5 -1
- package/node_modules/pi-agent-search-text/src/search-result.ts +1 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +166 -31
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/src/text-document.ts +2 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -6
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-62.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +3 -1
- package/node_modules/pi-agent-text-editor/package.json +26 -34
- package/node_modules/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-78.js +1 -0
- package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +29 -2
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/file-operations.ts +55 -0
- package/node_modules/pi-agent-text-editor/src/api/file-transfers.ts +41 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +2 -0
- 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 +127 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +20 -1
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +93 -85
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +15 -2
- package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +81 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +70 -25
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +123 -27
- package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +30 -1
- package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +147 -105
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +91 -14
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +74 -9
- package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +49 -25
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +122 -39
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +307 -32
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +85 -31
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
- package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +4 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -8
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-80.js +2 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +139 -27
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-81.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-82.js +1 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-83.js +1 -0
- package/node_modules/pi-agent-web/index.ts +28 -4
- package/node_modules/pi-agent-web/package.json +8 -11
- package/node_modules/pi-agent-web/src/doctor-plugin.ts +21 -6
- package/node_modules/pi-agent-web/src/resolver.ts +12 -2
- package/node_modules/pi-agent-web/src/search.ts +2 -1
- package/node_modules/pi-agent-web-html/package.json +3 -5
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/runtime/entry-87.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-88.js +2 -0
- package/package.json +43 -39
- package/skills/configure-agent-ide/SKILL.md +38 -0
- package/src/api/content.ts +6 -0
- package/src/api/doctor-runtime.ts +80 -0
- package/src/api/doctor.ts +6 -0
- package/src/api/hooks.ts +3 -0
- package/src/api/plugin-protocol.ts +11 -1
- package/src/api/tips.ts +3 -0
- package/src/api/tool-config.ts +143 -24
- package/src/backend/config.ts +85 -0
- package/src/backend/configured-process.ts +59 -0
- package/src/backend/dap-java-transport.ts +112 -0
- package/src/backend/dap-java-worker.py +218 -0
- package/src/backend/dap-node-transport.ts +112 -0
- package/src/backend/dap-powershell-worker.py +44 -0
- package/src/backend/dap-r-worker.py +210 -0
- package/src/backend/dap-tcp-transport.ts +42 -0
- package/src/backend/dap-tcp-worker.py +125 -0
- package/src/backend/dap-transport.ts +69 -0
- package/src/backend/dap-unix-worker.py +63 -0
- package/src/backend/debugger-registration.ts +62 -0
- package/src/backend/debugger-workspace-owner.ts +413 -0
- package/src/backend/doctor-inventory-worker.py +54 -0
- package/src/backend/doctor-probe-worker.py +140 -0
- package/src/backend/doctor-registration.ts +18 -0
- package/src/backend/doctor-workspace.ts +381 -0
- package/src/backend/file-operation-resolver.ts +58 -0
- package/src/backend/file-revision.ts +13 -0
- package/src/backend/file-transfer.ts +302 -0
- package/src/backend/file-watch-worker.py +119 -0
- package/src/backend/formatter-registration.ts +114 -0
- package/src/backend/git-registration.ts +60 -0
- package/src/backend/identity.ts +47 -0
- package/src/backend/index.ts +12 -0
- package/src/backend/lint-registration.ts +102 -0
- package/src/backend/lsp-file-watchers.ts +220 -0
- package/src/backend/lsp-registration.ts +83 -0
- package/src/backend/lsp-transport.ts +87 -0
- package/src/backend/lsp-workspace-owner.ts +50 -0
- package/src/backend/object-transfer.ts +299 -0
- package/src/backend/owned-command.ts +105 -0
- package/src/backend/owned-process-stop.ts +36 -0
- package/src/backend/owned-read-command.ts +20 -0
- package/src/backend/process-environment.ts +77 -0
- package/src/backend/process-metadata-worker.py +98 -0
- package/src/backend/process-metadata.ts +99 -0
- package/src/backend/recipe-evidence-worker.py +26 -0
- package/src/backend/recipe-evidence.ts +77 -0
- package/src/backend/registration.ts +124 -0
- package/src/backend/registry.ts +29 -0
- package/src/backend/resource-resolver.ts +147 -0
- package/src/backend/search-environment.ts +100 -0
- package/src/backend/ssh-channel-worker.py +306 -0
- package/src/backend/ssh-channel.ts +376 -0
- package/src/backend/ssh-transfer-worker.py +99 -0
- package/src/backend/ssh-transport.ts +54 -0
- package/src/backend/ssh-worker.py +730 -0
- package/src/backend/ssh.ts +610 -0
- package/src/backend/tool-config-access.ts +63 -0
- package/src/backend/tool-project.ts +71 -0
- package/src/backend/vision-capture-worker.py +319 -0
- package/src/backend/vision-capture.ts +165 -0
- package/src/backend/vision-registration.ts +104 -0
- package/src/backend/web-browser-worker.mjs +182 -0
- package/src/backend/web-browser.ts +128 -0
- package/src/backend/web-http-worker.py +62 -0
- package/src/backend/web-http.ts +79 -0
- package/src/backend/web-owner.ts +68 -0
- package/src/backend/web-registration.ts +14 -0
- package/src/code-view/diagnostic-view.ts +2 -2
- package/src/code-view/reference.ts +9 -0
- package/src/composite/builtin-extensions.ts +9 -14
- package/src/composite/module-labels.ts +1 -0
- package/src/composite/nested-tool-rendering.ts +26 -6
- package/src/composite/preferences.ts +13 -0
- package/src/composite/settings-documentation.ts +59 -0
- package/src/composite/settings-help.ts +106 -0
- package/src/composite/text-results.ts +50 -22
- package/src/core/diagnostic-store.ts +32 -10
- package/src/core/ide-core.ts +22 -2
- package/src/doctor/arguments.ts +19 -0
- package/src/doctor/config-writer.ts +72 -29
- package/src/doctor/discovery.ts +53 -15
- package/src/doctor/extension.ts +27 -10
- package/src/doctor/run.ts +42 -7
- package/src/documentation/extension.ts +12 -0
- package/src/documentation/search.ts +166 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +33 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +6 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +67 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-30.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-31.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-27.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +23 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -11
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-87.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-88.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-84.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/doctor-plugin.ts +21 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +12 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +2 -1
- package/src/extensions/pi-agent-read/package.json +12 -12
- package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-46.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-47.js +2 -0
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +4 -2
- package/src/extensions/pi-agent-read/src/core/extension.ts +4 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +143 -69
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +25 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +67 -44
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +8 -3
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +20 -5
- package/src/extensions/pi-agent-search/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +37 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -12
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/doctor-plugin.ts +10 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +26 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +54 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +22 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +4 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +123 -17
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +5 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +166 -31
- package/src/extensions/pi-agent-search/runtime/entry-50.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-51.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-52.js +2 -0
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/presentation.ts +10 -2
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +7 -3
- package/src/extensions/pi-agent-search/src/api/search.ts +51 -2
- package/src/extensions/pi-agent-search/src/core/extension.ts +2 -3
- package/src/extensions/pi-agent-search/src/core/search-core.ts +98 -8
- package/src/extensions/pi-agent-text-editor/package.json +26 -34
- 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-exact/package.json +5 -6
- 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-61.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-62.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +3 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -8
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-80.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +139 -27
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-81.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-79.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +29 -2
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/file-operations.ts +55 -0
- package/src/extensions/pi-agent-text-editor/src/api/file-transfers.ts +41 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +2 -0
- 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 +127 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +20 -1
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +93 -85
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +15 -2
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +81 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +70 -25
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +123 -27
- package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +30 -1
- package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +147 -105
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +91 -14
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +74 -9
- package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +49 -25
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +122 -39
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +307 -32
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +85 -31
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
- package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +4 -1
- package/src/pi-agent-ide.ts +14 -2
- package/src/plugins/pi-agent-ide-ast/package.json +15 -41
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +2 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +10 -3
- package/src/plugins/pi-agent-ide-ast/src/ast/read-text.ts +4 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +3 -3
- package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +13 -10
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +17 -1
- package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +32 -4
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/search-presentation.ts +4 -3
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +100 -42
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +3 -2
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +2 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +10 -2
- package/src/plugins/pi-agent-ide-changes/package.json +10 -11
- package/src/plugins/pi-agent-ide-changes/runtime/entry-34.js +1 -0
- package/src/plugins/pi-agent-ide-changes/src/change-anchor.ts +7 -2
- package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +18 -1
- package/src/plugins/pi-agent-ide-changes/src/changes/change-types.ts +3 -0
- package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +59 -7
- package/src/plugins/pi-agent-ide-changes/src/changes/git-paths.ts +49 -0
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +10 -2
- package/src/plugins/pi-agent-ide-changes/src/doctor-plugin.ts +13 -14
- package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +2 -1
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +47 -11
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -1
- package/src/plugins/pi-agent-ide-debugger/index.ts +62 -25
- package/src/plugins/pi-agent-ide-debugger/src/adapter-executables.ts +3 -1
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +33 -0
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +150 -171
- package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +2 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +152 -58
- package/src/plugins/pi-agent-ide-debugger/src/workspace-owner.ts +28 -0
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +4 -1
- package/src/plugins/pi-agent-ide-formatter/index.ts +14 -2
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-formatter/src/doctor-plugin.ts +47 -35
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +41 -11
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +9 -28
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/index.ts +35 -4
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/runtime/entry-38.js +2 -0
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +14 -10
- package/src/plugins/pi-agent-ide-lint/src/doctor-plugin.ts +47 -39
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +9 -25
- package/src/plugins/pi-agent-ide-lsp/index.ts +107 -25
- package/src/plugins/pi-agent-ide-lsp/package.json +10 -13
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-39.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +6 -2
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +5 -1
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +5 -3
- package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +27 -11
- package/src/plugins/pi-agent-ide-lsp/src/lsp/abort.ts +62 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +245 -103
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +26 -45
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/document-uri.ts +40 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/file-watchers.ts +8 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +24 -17
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +255 -56
- package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +51 -11
- package/src/plugins/pi-agent-ide-lsp/src/lsp/owner-transport.ts +67 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +149 -18
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +79 -31
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +15 -12
- package/src/plugins/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +16 -0
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +67 -46
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +50 -19
- package/src/plugins/pi-agent-ide-processes/src/registry.ts +8 -1
- package/src/plugins/pi-agent-ide-terminal/index.ts +7 -0
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +5 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -2
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +161 -42
- package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +7 -0
- package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +11 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +33 -8
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +5 -0
- package/src/plugins/pi-agent-ide-vision/index.ts +170 -9
- package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +47 -0
- package/src/plugins/pi-agent-ide-vision/src/vision.ts +42 -1
- package/src/post-edit/gate.ts +4 -1
- package/src/tips/core.ts +5 -2
- package/src/tips/extension.ts +30 -2
- package/src/tips/persistence.ts +29 -27
- package/src/tips/setup-hint.ts +19 -0
- package/src/toolchain/types.ts +2 -0
- package/dist/chunk-3YK4XMWB.js +0 -0
- package/dist/chunk-5JELU6RV.js +0 -7
- package/dist/chunk-6U5OU77O.js +0 -3
- package/dist/chunk-7LD2OQH3.js +0 -14
- package/dist/chunk-BMOJTJJJ.js +0 -3
- package/dist/chunk-BYZSBXUK.js +0 -2
- package/dist/chunk-CEX73RI5.js +0 -28
- package/dist/chunk-DZWTKF2K.js +0 -1
- package/dist/chunk-EOKEQ3YH.js +0 -25
- package/dist/chunk-HZ5BNF3A.js +0 -1
- package/dist/chunk-IG56UGSO.js +0 -2
- package/dist/chunk-KVHDMIZS.js +0 -3
- package/dist/chunk-M5IVSCR2.js +0 -1
- package/dist/chunk-M5MJP7Z2.js +0 -1
- package/dist/chunk-MGCHOGQD.js +0 -1
- package/dist/chunk-N34ATN52.js +0 -1
- package/dist/chunk-NHKPP2AI.js +0 -28
- package/dist/chunk-NRZO5KJT.js +0 -9
- package/dist/chunk-OB46OPMZ.js +0 -1
- package/dist/chunk-Q6CZ6GBR.js +0 -3
- package/dist/chunk-QIK2E64R.js +0 -1
- package/dist/chunk-SBP3ABH4.js +0 -5
- package/dist/chunk-STBJO3Z3.js +0 -2
- package/dist/chunk-T6LX2RX5.js +0 -1
- package/dist/chunk-TXOTNK6B.js +0 -11
- package/dist/chunk-WZI4YC2O.js +0 -1
- package/dist/entry-19.js +0 -1
- package/docs/research/apply-native-capability-matrix.md +0 -174
- package/docs/research/apply-read-latency.md +0 -221
- package/docs/research/codemode-write-context.md +0 -56
- package/docs/research/lpt-393-fuzzy-results/file.json +0 -152
- package/docs/research/lpt-393-fuzzy-results/repo.json +0 -122
- package/docs/research/lpt-393-search-fuzzy-fallback.md +0 -97
- package/docs/research/native-codemode-batch-decision.md +0 -31
- package/docs/research/native-codemode-batching.md +0 -65
- package/node_modules/pi-agent-doctor/runtime/entry-19.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-25.js +0 -2
- package/node_modules/pi-agent-filesystem-image/runtime/entry-26.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-30.js +0 -1
- package/node_modules/pi-agent-ide-formatter/runtime/entry-34.js +0 -2
- package/node_modules/pi-agent-image/runtime/entry-38.js +0 -1
- package/node_modules/pi-agent-invariant/runtime/entry-39.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-47.js +0 -1
- package/node_modules/pi-agent-search-text/runtime/entry-51.js +0 -2
- package/node_modules/pi-agent-search-text/runtime/entry-52.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-56.js +0 -2
- package/node_modules/pi-agent-text-editor/runtime/entry-62.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-78.js +0 -2
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +0 -1
- package/node_modules/pi-agent-tool-ui/runtime/entry-81.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-82.js +0 -2
- package/node_modules/pi-agent-web-html/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-26.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-27.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-25.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-84.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-41.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-42.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-51.js +0 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-52.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-47.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-48.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-56.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-57.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-79.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-61.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-62.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-30.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-31.js +0 -2
- package/src/plugins/pi-agent-ide-formatter/runtime/entry-34.js +0 -2
- /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-24.js +0 -0
- /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem}/runtime/entry-27.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-28.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-32.js +0 -0
- /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-33.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-36.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-37.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-40.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-41.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-42.js +0 -0
- /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-46.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-48.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-55.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-57.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-58.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-59.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-60.js +0 -0
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-61.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-79.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-84.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-85.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-28.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-29.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-85.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-58.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-59.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-60.js +0 -0
- /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-32.js +0 -0
- /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-33.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-35.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-36.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-37.js +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { Type, type Static } from "typebox";
|
|
3
|
+
import { Value } from "typebox/value";
|
|
4
|
+
import type { SshBackendRegistry } from "./registry.js";
|
|
5
|
+
import { SshBackendError } from "./ssh.js";
|
|
6
|
+
|
|
7
|
+
const rowSchema = Type.Object({
|
|
8
|
+
pid: Type.Integer({ minimum: 1 }),
|
|
9
|
+
parentPid: Type.Integer({ minimum: 0 }),
|
|
10
|
+
command: Type.String(),
|
|
11
|
+
started: Type.String(),
|
|
12
|
+
identity: Type.String({ pattern: "^[a-f0-9-]+:[0-9]+$" }),
|
|
13
|
+
executable: Type.Union([Type.String(), Type.Null()]),
|
|
14
|
+
});
|
|
15
|
+
const resultSchema = Type.Object({ processes: Type.Array(rowSchema) });
|
|
16
|
+
let worker: Promise<string> | undefined;
|
|
17
|
+
|
|
18
|
+
/** A read-only process snapshot. Identity combines the target boot ID and native start ticks. */
|
|
19
|
+
export interface SshProcessMetadata extends Static<typeof rowSchema> {
|
|
20
|
+
readonly host: "ssh";
|
|
21
|
+
readonly target: string;
|
|
22
|
+
readonly resource: string;
|
|
23
|
+
/** Discovery alone never grants control or window access. */
|
|
24
|
+
readonly owned: false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Inspect only a configured Linux target, without treating any remote PID as controller-local. */
|
|
28
|
+
export async function readSshProcessMetadata(
|
|
29
|
+
registry: SshBackendRegistry,
|
|
30
|
+
scope: string,
|
|
31
|
+
pid?: number,
|
|
32
|
+
signal?: AbortSignal,
|
|
33
|
+
): Promise<readonly SshProcessMetadata[]> {
|
|
34
|
+
return readSshProcessRows(registry, scope, pid, signal, false);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Return undefined only when the native /proc probe confirms this PID is absent.
|
|
38
|
+
* Transport, cwd and permission failures still throw; they never prove process death.
|
|
39
|
+
*/
|
|
40
|
+
export async function findSshProcessMetadata(
|
|
41
|
+
registry: SshBackendRegistry,
|
|
42
|
+
scope: string,
|
|
43
|
+
pid: number,
|
|
44
|
+
signal?: AbortSignal,
|
|
45
|
+
): Promise<SshProcessMetadata | undefined> {
|
|
46
|
+
return (await readSshProcessRows(registry, scope, pid, signal, true))[0];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function readSshProcessRows(
|
|
50
|
+
registry: SshBackendRegistry,
|
|
51
|
+
scope: string,
|
|
52
|
+
pid: number | undefined,
|
|
53
|
+
signal: AbortSignal | undefined,
|
|
54
|
+
missingIsEmpty: boolean,
|
|
55
|
+
): Promise<readonly SshProcessMetadata[]> {
|
|
56
|
+
signal?.throwIfAborted();
|
|
57
|
+
if (pid !== undefined && (!Number.isSafeInteger(pid) || pid < 1))
|
|
58
|
+
throw new Error("Invalid process PID");
|
|
59
|
+
const owner = registry.resolve(scope);
|
|
60
|
+
if (!owner) throw new SshBackendError("UNSUPPORTED_SOURCE", scope, "not-applied");
|
|
61
|
+
worker ??= readFile(new URL("./process-metadata-worker.py", import.meta.url), "utf8");
|
|
62
|
+
const result = await owner.backend.execute(
|
|
63
|
+
"python3",
|
|
64
|
+
["-c", await worker, ...(pid === undefined ? [] : [String(pid)])],
|
|
65
|
+
owner.location.path,
|
|
66
|
+
{ signal },
|
|
67
|
+
);
|
|
68
|
+
signal?.throwIfAborted();
|
|
69
|
+
if (result.exitCode !== 0)
|
|
70
|
+
throw new SshBackendError("CAPABILITY_UNAVAILABLE", scope, "not-applied");
|
|
71
|
+
let data: unknown;
|
|
72
|
+
try {
|
|
73
|
+
data = JSON.parse(result.stdout.toString("utf8"));
|
|
74
|
+
} catch {
|
|
75
|
+
throw new SshBackendError("INVALID_RESPONSE", scope, "not-applied");
|
|
76
|
+
}
|
|
77
|
+
if (typeof data === "object" && data !== null && "error" in data) {
|
|
78
|
+
if (missingIsEmpty && pid !== undefined && data.error === "ENOENT") return [];
|
|
79
|
+
const codes = new Set(["CAPABILITY_UNAVAILABLE", "ENOENT", "EACCES", "BYTE_LIMIT"]);
|
|
80
|
+
throw new SshBackendError(
|
|
81
|
+
typeof data.error === "string" && codes.has(data.error) ? data.error : "INVALID_RESPONSE",
|
|
82
|
+
scope,
|
|
83
|
+
"not-applied",
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
if (
|
|
87
|
+
!Value.Check(resultSchema, data) ||
|
|
88
|
+
(pid !== undefined && (data.processes.length !== 1 || data.processes[0]?.pid !== pid)) ||
|
|
89
|
+
new Set(data.processes.map((item) => item.pid)).size !== data.processes.length
|
|
90
|
+
)
|
|
91
|
+
throw new SshBackendError("INVALID_RESPONSE", scope, "not-applied");
|
|
92
|
+
return data.processes.map((item) => ({
|
|
93
|
+
...item,
|
|
94
|
+
target: owner.location.target,
|
|
95
|
+
host: "ssh",
|
|
96
|
+
owned: false,
|
|
97
|
+
resource: `process:ssh://${owner.location.target}/${item.pid}`,
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Read only requested native project evidence; never execute project files."""
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
root, request = sys.argv[1], json.loads(sys.argv[2])
|
|
7
|
+
content = {}
|
|
8
|
+
for name in request["files"]:
|
|
9
|
+
try:
|
|
10
|
+
with open(os.path.join(root, name), "rb") as source:
|
|
11
|
+
data = source.read(32 * 1024 * 1024 + 1)
|
|
12
|
+
if len(data) > 32 * 1024 * 1024:
|
|
13
|
+
print(json.dumps({"error": "CONTENT_LIMIT"}))
|
|
14
|
+
sys.exit(0)
|
|
15
|
+
content[name] = data.decode("utf8", errors="replace")
|
|
16
|
+
except FileNotFoundError:
|
|
17
|
+
content[name] = None
|
|
18
|
+
markers = {}
|
|
19
|
+
for name in request["markers"]:
|
|
20
|
+
try:
|
|
21
|
+
os.stat(os.path.join(root, name))
|
|
22
|
+
markers[name] = True
|
|
23
|
+
except FileNotFoundError:
|
|
24
|
+
markers[name] = False
|
|
25
|
+
names = os.listdir(root) if request["listNames"] else []
|
|
26
|
+
print(json.dumps({"content": content, "markers": markers, "names": names}))
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { Type } from "typebox";
|
|
4
|
+
import { Value } from "typebox/value";
|
|
5
|
+
import type { ToolRecipe } from "pi-agent-doctor/api/catalog";
|
|
6
|
+
import { inspectRecipeEvidence, type RecipeEvidence } from "pi-agent-doctor/api/evidence";
|
|
7
|
+
import type { SshBackend } from "./ssh.js";
|
|
8
|
+
import { SshBackendError } from "./ssh.js";
|
|
9
|
+
|
|
10
|
+
const snapshotSchema = Type.Object({
|
|
11
|
+
content: Type.Record(Type.String(), Type.Union([Type.String(), Type.Null()])),
|
|
12
|
+
markers: Type.Record(Type.String(), Type.Boolean()),
|
|
13
|
+
names: Type.Array(Type.String()),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/** Inspect native evidence in one owned request, using the shared recipe scoring rules. */
|
|
17
|
+
export async function inspectSshRecipeEvidence(
|
|
18
|
+
backend: SshBackend,
|
|
19
|
+
cwd: string,
|
|
20
|
+
recipes: readonly ToolRecipe[],
|
|
21
|
+
signal?: AbortSignal,
|
|
22
|
+
): Promise<ReadonlyMap<string, RecipeEvidence>> {
|
|
23
|
+
signal?.throwIfAborted();
|
|
24
|
+
const files = [
|
|
25
|
+
...new Set([
|
|
26
|
+
"package.json",
|
|
27
|
+
...recipes.flatMap((recipe) => Object.keys(recipe.configSections ?? {})),
|
|
28
|
+
]),
|
|
29
|
+
];
|
|
30
|
+
const markers = [...new Set(recipes.flatMap((recipe) => recipe.configFiles ?? []))];
|
|
31
|
+
for (const name of [...files, ...markers]) {
|
|
32
|
+
const relative = path.posix.relative(cwd, path.posix.resolve(cwd, name));
|
|
33
|
+
// Containment validation does not construct a parent-relative path.
|
|
34
|
+
// eslint-disable-next-line repo/no-parent-paths
|
|
35
|
+
if (relative === ".." || relative.startsWith("../") || path.posix.isAbsolute(name))
|
|
36
|
+
throw new SshBackendError("UNSUPPORTED_SOURCE", cwd, "not-applied");
|
|
37
|
+
}
|
|
38
|
+
const script = await readFile(new URL("./recipe-evidence-worker.py", import.meta.url), {
|
|
39
|
+
encoding: "utf8",
|
|
40
|
+
signal,
|
|
41
|
+
});
|
|
42
|
+
const result = await backend.execute(
|
|
43
|
+
"python3",
|
|
44
|
+
[
|
|
45
|
+
"-c",
|
|
46
|
+
script,
|
|
47
|
+
cwd,
|
|
48
|
+
JSON.stringify({
|
|
49
|
+
files,
|
|
50
|
+
markers: markers.filter((marker) => !marker.includes("*")),
|
|
51
|
+
listNames: markers.some((marker) => marker.includes("*")),
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
cwd,
|
|
55
|
+
{ signal },
|
|
56
|
+
);
|
|
57
|
+
if (result.exitCode !== 0) throw new SshBackendError("EVIDENCE_FAILED", cwd, "not-applied");
|
|
58
|
+
const snapshot: unknown = JSON.parse(result.stdout.toString("utf8"));
|
|
59
|
+
if (Value.Check(Type.Object({ error: Type.Literal("CONTENT_LIMIT") }), snapshot))
|
|
60
|
+
throw new SshBackendError("CONTENT_LIMIT", cwd, "not-applied");
|
|
61
|
+
if (!Value.Check(snapshotSchema, snapshot))
|
|
62
|
+
throw new SshBackendError("INVALID_RESPONSE", cwd, "not-applied");
|
|
63
|
+
return inspectRecipeEvidence(
|
|
64
|
+
cwd,
|
|
65
|
+
recipes,
|
|
66
|
+
{
|
|
67
|
+
readText: (file) => Promise.resolve(snapshot.content[file] ?? undefined),
|
|
68
|
+
hasMarker: (marker) =>
|
|
69
|
+
Promise.resolve(
|
|
70
|
+
marker.includes("*")
|
|
71
|
+
? snapshot.names.some((name) => path.matchesGlob(name, marker))
|
|
72
|
+
: snapshot.markers[marker] === true,
|
|
73
|
+
),
|
|
74
|
+
},
|
|
75
|
+
signal,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { connectIdePlugin } from "#src/api/connect-plugin.js";
|
|
2
|
+
import { IDE_PROTOCOL, IDE_API_VERSION } from "#src/api/plugin-protocol.js";
|
|
3
|
+
import { connectSearchPlugin } from "pi-agent-search/api/connect-plugin";
|
|
4
|
+
import { SEARCH_API_VERSION, SEARCH_PROTOCOL } from "pi-agent-search/api/plugin-protocol";
|
|
5
|
+
import { createSshSearchEnvironmentProvider } from "./search-environment.js";
|
|
6
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
8
|
+
import {
|
|
9
|
+
READ_API_VERSION,
|
|
10
|
+
READ_PROTOCOL,
|
|
11
|
+
type ReadPlugin,
|
|
12
|
+
} from "pi-agent-read/api/plugin-protocol";
|
|
13
|
+
import { createReadResultRenderer } from "pi-agent-read/api/rendering";
|
|
14
|
+
import { connectAgentDocumentation, loadPackagedAgentGuide } from "pi-agent-documentation";
|
|
15
|
+
import { createContentHost } from "pi-agent-resource";
|
|
16
|
+
import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
|
|
17
|
+
import {
|
|
18
|
+
TEXT_EDITOR_API_VERSION,
|
|
19
|
+
TEXT_EDITOR_PROTOCOL,
|
|
20
|
+
type TextEditorPlugin,
|
|
21
|
+
} from "pi-agent-text-editor/api/plugin-protocol";
|
|
22
|
+
|
|
23
|
+
import { createSshFileOperationResolver } from "./file-operation-resolver.js";
|
|
24
|
+
import { remoteLocation } from "./identity.js";
|
|
25
|
+
import { SshBackendRegistry } from "./registry.js";
|
|
26
|
+
import { createSshResourceResolver } from "./resource-resolver.js";
|
|
27
|
+
import type { SshTarget } from "./ssh.js";
|
|
28
|
+
|
|
29
|
+
/** Connect explicitly configured targets to the existing tools, without startup connections. */
|
|
30
|
+
export async function registerSshResources(
|
|
31
|
+
pi: ExtensionAPI,
|
|
32
|
+
targets: readonly SshTarget[],
|
|
33
|
+
): Promise<void> {
|
|
34
|
+
const guide = await loadPackagedAgentGuide({
|
|
35
|
+
id: "ssh",
|
|
36
|
+
description: "Set up SSH targets and use remote resources",
|
|
37
|
+
triggers: [
|
|
38
|
+
{ tool: "read", resourcePrefixes: ["ssh://", "raw:ssh://", "ast:ssh://", "web:ssh://"] },
|
|
39
|
+
{ tool: "search", resourcePrefixes: ["ssh://", "web:ssh://"] },
|
|
40
|
+
{ tool: "debug", resourcePrefixes: ["ssh://"] },
|
|
41
|
+
...["write", "replace", "insert", "delete", "copy", "move", "stage", "unstage", "undo"].map(
|
|
42
|
+
(tool) => ({
|
|
43
|
+
tool,
|
|
44
|
+
resourcePrefixes: ["ssh://"],
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
connectAgentDocumentation(pi, [
|
|
50
|
+
{
|
|
51
|
+
...guide,
|
|
52
|
+
markdown: `${guide.markdown}\n## Configured workspaces\n\n${targets.length === 0 ? "No SSH targets are configured. Follow the setup steps above." : targets.map((target) => `- \`${remoteLocation(target.id, target.workspace).source}\``).join("\n")}\n`,
|
|
53
|
+
},
|
|
54
|
+
]);
|
|
55
|
+
await connectReadPlugin(pi, {
|
|
56
|
+
protocol: READ_PROTOCOL,
|
|
57
|
+
apiVersion: READ_API_VERSION,
|
|
58
|
+
id: "ssh-guidance",
|
|
59
|
+
setup(api) {
|
|
60
|
+
api.addPromptGuideline(
|
|
61
|
+
"When the user asks to connect to or work on a remote device or environment over SSH, read docs:ssh first and follow its setup and usage steps.",
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
if (targets.length === 0) return;
|
|
66
|
+
const registry = new SshBackendRegistry(targets);
|
|
67
|
+
// Reuse installed byte converters; readable images/PDFs never become writable text.
|
|
68
|
+
const readHost = createContentHost(pi, { provider: "filesystem", capability: "read" });
|
|
69
|
+
const writeHost = createContentHost(pi, { provider: "filesystem", capability: "write" });
|
|
70
|
+
const readPlugin = {
|
|
71
|
+
protocol: READ_PROTOCOL,
|
|
72
|
+
apiVersion: READ_API_VERSION,
|
|
73
|
+
id: "ssh",
|
|
74
|
+
setup(api) {
|
|
75
|
+
api.addResolver({
|
|
76
|
+
resolver: createSshResourceResolver(registry, readHost, "read"),
|
|
77
|
+
priority: -50,
|
|
78
|
+
preserveTruncatedOutput: true,
|
|
79
|
+
renderResult: createReadResultRenderer({ kind: "source" }),
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
} satisfies ReadPlugin;
|
|
83
|
+
const editorPlugin = {
|
|
84
|
+
protocol: TEXT_EDITOR_PROTOCOL,
|
|
85
|
+
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
86
|
+
id: "ssh",
|
|
87
|
+
setup(api) {
|
|
88
|
+
api.addFileOperationResolver(createSshFileOperationResolver(registry));
|
|
89
|
+
api.addResolver({
|
|
90
|
+
resolver: createSshResourceResolver(registry, writeHost, "write"),
|
|
91
|
+
priority: -50,
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
} satisfies TextEditorPlugin;
|
|
95
|
+
await Promise.all([
|
|
96
|
+
connectIdePlugin(pi, {
|
|
97
|
+
protocol: IDE_PROTOCOL,
|
|
98
|
+
apiVersion: IDE_API_VERSION,
|
|
99
|
+
id: "ssh-diagnostic-files",
|
|
100
|
+
setup(api) {
|
|
101
|
+
api.addDiagnosticFileReader({
|
|
102
|
+
id: "ssh",
|
|
103
|
+
async readText(source, context) {
|
|
104
|
+
const owner = registry.resolve(source, context.cwd);
|
|
105
|
+
if (!owner) return undefined;
|
|
106
|
+
return (
|
|
107
|
+
await owner.backend.read(owner.location.path, { signal: context.signal })
|
|
108
|
+
).bytes.toString("utf8");
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
|
+
connectReadPlugin(pi, readPlugin),
|
|
114
|
+
connectTextEditorPlugin(pi, editorPlugin),
|
|
115
|
+
connectSearchPlugin(pi, {
|
|
116
|
+
protocol: SEARCH_PROTOCOL,
|
|
117
|
+
apiVersion: SEARCH_API_VERSION,
|
|
118
|
+
id: "ssh",
|
|
119
|
+
setup(api) {
|
|
120
|
+
api.addEnvironmentProvider(createSshSearchEnvironmentProvider(registry));
|
|
121
|
+
},
|
|
122
|
+
}),
|
|
123
|
+
]);
|
|
124
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { resolveRemoteLocation, type RemoteLocation } from "./identity.js";
|
|
2
|
+
import { SshBackend, SshBackendError, type SshTarget } from "./ssh.js";
|
|
3
|
+
|
|
4
|
+
/** A canonical remote source and the explicitly configured transport that owns it. */
|
|
5
|
+
export interface ResolvedSshSource {
|
|
6
|
+
readonly location: RemoteLocation;
|
|
7
|
+
readonly backend: SshBackend;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Session-owned targets. Construction and resolution never probe or connect to hosts. */
|
|
11
|
+
export class SshBackendRegistry {
|
|
12
|
+
readonly #backends = new Map<string, SshBackend>();
|
|
13
|
+
|
|
14
|
+
constructor(targets: readonly SshTarget[]) {
|
|
15
|
+
for (const target of targets) {
|
|
16
|
+
if (this.#backends.has(target.id)) throw new TypeError(`Duplicate SSH target: ${target.id}`);
|
|
17
|
+
this.#backends.set(target.id, new SshBackend(target));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Claim SSH resources, reject unknown targets, and leave local/protocol sources alone. */
|
|
22
|
+
resolve(source: string, cwd?: string): ResolvedSshSource | undefined {
|
|
23
|
+
const location = resolveRemoteLocation(source, cwd);
|
|
24
|
+
if (!location) return undefined;
|
|
25
|
+
const backend = this.#backends.get(location.target);
|
|
26
|
+
if (!backend) throw new SshBackendError("UNKNOWN_TARGET", location.source, "not-applied");
|
|
27
|
+
return { location, backend };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AgentContent,
|
|
3
|
+
ContentHost,
|
|
4
|
+
ResourceByteRead,
|
|
5
|
+
ResourceOperationContext,
|
|
6
|
+
ResourceResolver,
|
|
7
|
+
} from "pi-agent-resource";
|
|
8
|
+
import { textFromAgentContent } from "pi-agent-text";
|
|
9
|
+
|
|
10
|
+
import type { SshBackendRegistry } from "./registry.js";
|
|
11
|
+
import { SshBackendError } from "./ssh.js";
|
|
12
|
+
|
|
13
|
+
/** Bridge configured SSH targets to existing content hosts and read/editor resolver registries. */
|
|
14
|
+
export function createSshResourceResolver(
|
|
15
|
+
registry: SshBackendRegistry,
|
|
16
|
+
contentHost: Pick<ContentHost, "convert">,
|
|
17
|
+
capability: "read" | "write",
|
|
18
|
+
): ResourceResolver {
|
|
19
|
+
return {
|
|
20
|
+
id: "ssh",
|
|
21
|
+
async tryResolve(source, context) {
|
|
22
|
+
try {
|
|
23
|
+
const resolved = registry.resolve(source, context.cwd);
|
|
24
|
+
if (!resolved) return { kind: "not-handled" };
|
|
25
|
+
const { backend, location } = resolved;
|
|
26
|
+
let directory = false;
|
|
27
|
+
try {
|
|
28
|
+
directory = (await backend.stat(location.path, context)).kind === "directory";
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (!(error instanceof SshBackendError) || error.code !== "ENOENT") throw error;
|
|
31
|
+
}
|
|
32
|
+
let version: string | null | undefined;
|
|
33
|
+
let sourceBytes: Uint8Array | undefined;
|
|
34
|
+
const snapshot = async (operationContext: ResourceOperationContext) => {
|
|
35
|
+
try {
|
|
36
|
+
const current = await backend.read(location.path, operationContext);
|
|
37
|
+
version = current.version;
|
|
38
|
+
return current.bytes;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (error instanceof SshBackendError && error.code === "ENOENT") version = null;
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const read = async (operationContext: ResourceOperationContext): Promise<AgentContent> => {
|
|
45
|
+
sourceBytes = undefined;
|
|
46
|
+
if (directory) {
|
|
47
|
+
const entries = await backend.list(location.path, operationContext);
|
|
48
|
+
const rows = entries.map(
|
|
49
|
+
(entry) =>
|
|
50
|
+
` ${entry.kind === "directory" ? "📁" : entry.kind === "file" ? "📄" : "🔗"} ${entry.name}`,
|
|
51
|
+
);
|
|
52
|
+
return [
|
|
53
|
+
{
|
|
54
|
+
type: "text" as const,
|
|
55
|
+
text: [`📁 ${location.source}/`, ...(rows.length ? ["", ...rows] : [])].join("\n"),
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
sourceBytes = await snapshot(operationContext);
|
|
60
|
+
return contentHost.convert(
|
|
61
|
+
{ source: location.source, bytes: sourceBytes },
|
|
62
|
+
operationContext,
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
const readBytes: ResourceByteRead = async (offset, limit, operationContext) => {
|
|
66
|
+
const chunkSize = 4 * 1024 * 1024;
|
|
67
|
+
const first = await backend.readRange(
|
|
68
|
+
location.path,
|
|
69
|
+
offset,
|
|
70
|
+
Math.min(limit ?? chunkSize, chunkSize),
|
|
71
|
+
operationContext,
|
|
72
|
+
);
|
|
73
|
+
const chunks = [first.bytes];
|
|
74
|
+
let length = first.bytes.length;
|
|
75
|
+
const wanted = Math.min(limit ?? first.totalBytes, first.totalBytes - first.offset);
|
|
76
|
+
while (length < wanted) {
|
|
77
|
+
const next = await backend.readRange(
|
|
78
|
+
location.path,
|
|
79
|
+
first.offset + length,
|
|
80
|
+
Math.min(wanted - length, chunkSize),
|
|
81
|
+
operationContext,
|
|
82
|
+
);
|
|
83
|
+
if (
|
|
84
|
+
next.revision !== first.revision ||
|
|
85
|
+
next.totalBytes !== first.totalBytes ||
|
|
86
|
+
next.offset !== first.offset + length
|
|
87
|
+
)
|
|
88
|
+
throw new SshBackendError("SOURCE_CHANGED", location.source, "not-applied");
|
|
89
|
+
if (next.bytes.length === 0) break;
|
|
90
|
+
chunks.push(next.bytes);
|
|
91
|
+
length += next.bytes.length;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
bytes: Buffer.concat(chunks, length),
|
|
95
|
+
byteOffset: first.offset,
|
|
96
|
+
totalBytes: first.totalBytes,
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
if (capability === "read" || directory)
|
|
100
|
+
return {
|
|
101
|
+
kind: "resolved",
|
|
102
|
+
resource: {
|
|
103
|
+
source: location.source,
|
|
104
|
+
link: location.source,
|
|
105
|
+
read,
|
|
106
|
+
get sourceBytes() {
|
|
107
|
+
return sourceBytes;
|
|
108
|
+
},
|
|
109
|
+
...(directory ? {} : { readBytes }),
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
kind: "resolved",
|
|
114
|
+
resource: {
|
|
115
|
+
source: location.source,
|
|
116
|
+
link: location.source,
|
|
117
|
+
read,
|
|
118
|
+
readBytes,
|
|
119
|
+
get sourceBytes() {
|
|
120
|
+
return sourceBytes;
|
|
121
|
+
},
|
|
122
|
+
async write(content, operationContext) {
|
|
123
|
+
const text = textFromAgentContent(content);
|
|
124
|
+
if (version === undefined) {
|
|
125
|
+
try {
|
|
126
|
+
await snapshot(operationContext);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (!(error instanceof SshBackendError) || error.code !== "ENOENT") throw error;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (version === undefined)
|
|
132
|
+
throw new SshBackendError("SNAPSHOT_REQUIRED", location.source, "not-applied");
|
|
133
|
+
version = await backend.write(
|
|
134
|
+
location.path,
|
|
135
|
+
Buffer.from(text, "utf8"),
|
|
136
|
+
version,
|
|
137
|
+
operationContext,
|
|
138
|
+
);
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
} catch (error) {
|
|
143
|
+
return { kind: "failed", error };
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { StringDecoder } from "node:string_decoder";
|
|
3
|
+
import type { SearchEnvironmentProvider } from "pi-agent-search/api/search";
|
|
4
|
+
import { remoteLocation } from "./identity.js";
|
|
5
|
+
import type { SshBackendRegistry } from "./registry.js";
|
|
6
|
+
import { SshBackendError } from "./ssh.js";
|
|
7
|
+
|
|
8
|
+
/** Adapt configured SSH scopes to the existing search recipes, without startup probes. */
|
|
9
|
+
export function createSshSearchEnvironmentProvider(
|
|
10
|
+
registry: SshBackendRegistry,
|
|
11
|
+
): SearchEnvironmentProvider {
|
|
12
|
+
return (request, context) => {
|
|
13
|
+
const scope = registry.resolve(request.path ?? ".", context.cwd);
|
|
14
|
+
if (scope === undefined) return undefined;
|
|
15
|
+
const { backend, location } = scope;
|
|
16
|
+
const own = (source: string, cwd = location.source) => {
|
|
17
|
+
const resolved = registry.resolve(source, cwd);
|
|
18
|
+
if (resolved === undefined || resolved.backend !== backend)
|
|
19
|
+
throw new SshBackendError("UNSUPPORTED_SOURCE", source, "not-applied");
|
|
20
|
+
return resolved.location;
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
resolve: (cwd, source) => own(source, cwd.includes("://") ? cwd : location.source).source,
|
|
24
|
+
dirname: (source) =>
|
|
25
|
+
remoteLocation(location.target, path.posix.dirname(own(source).path)).source,
|
|
26
|
+
basename: (source) => path.posix.basename(own(source).path),
|
|
27
|
+
isDirectory: async (source, signal) =>
|
|
28
|
+
(await backend.stat(own(source).path, { signal })).kind === "directory",
|
|
29
|
+
byteSize: async (source, signal) => (await backend.stat(own(source).path, { signal })).size,
|
|
30
|
+
readText: async (source, signal) =>
|
|
31
|
+
(await backend.read(own(source).path, { signal })).bytes.toString("utf8"),
|
|
32
|
+
async execute(command, arguments_, cwd, signal) {
|
|
33
|
+
const result = await backend.execute(command, arguments_, own(cwd).path, { signal });
|
|
34
|
+
return {
|
|
35
|
+
code: result.exitCode,
|
|
36
|
+
stdout: result.stdout.toString("utf8"),
|
|
37
|
+
stderr: result.stderr.toString("utf8"),
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
async runLines(arguments_, cwd, onLine, signal) {
|
|
41
|
+
const channel = await backend.startProcess("rg", arguments_, own(cwd).path, { signal });
|
|
42
|
+
const decoder = new StringDecoder("utf8");
|
|
43
|
+
const pending: string[] = [];
|
|
44
|
+
let pendingBytes = 0;
|
|
45
|
+
let stderr = "";
|
|
46
|
+
let failure: unknown;
|
|
47
|
+
const consume = (text: string): void => {
|
|
48
|
+
const parts = text.split("\n");
|
|
49
|
+
for (const [index, part] of parts.entries()) {
|
|
50
|
+
pending.push(part);
|
|
51
|
+
pendingBytes += Buffer.byteLength(part);
|
|
52
|
+
if (pendingBytes > 32 * 1024 * 1024)
|
|
53
|
+
throw new SshBackendError("CONTENT_LIMIT", location.source, "not-applied");
|
|
54
|
+
if (index < parts.length - 1) {
|
|
55
|
+
onLine(pending.join(""));
|
|
56
|
+
pending.length = 0;
|
|
57
|
+
pendingBytes = 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const output = (async (): Promise<void> => {
|
|
62
|
+
try {
|
|
63
|
+
for await (const chunk of channel.stdout) consume(decoder.write(chunk as Buffer));
|
|
64
|
+
consume(decoder.end());
|
|
65
|
+
if (pendingBytes > 0) onLine(pending.join(""));
|
|
66
|
+
} catch (error) {
|
|
67
|
+
failure = error;
|
|
68
|
+
await channel.stop();
|
|
69
|
+
}
|
|
70
|
+
})();
|
|
71
|
+
const diagnostics = (async (): Promise<void> => {
|
|
72
|
+
for await (const chunk of channel.stderr) {
|
|
73
|
+
stderr += (chunk as Buffer).toString("utf8");
|
|
74
|
+
if (stderr.length > 65536) stderr = stderr.slice(-65536);
|
|
75
|
+
}
|
|
76
|
+
})();
|
|
77
|
+
try {
|
|
78
|
+
try {
|
|
79
|
+
await channel.end();
|
|
80
|
+
} catch (error) {
|
|
81
|
+
// A short read-only command can finish before EOF reaches its unused stdin.
|
|
82
|
+
// Only the authoritative completion below may establish its exit status.
|
|
83
|
+
if (!(error instanceof SshBackendError) || error.code !== "INPUT_CLOSED") throw error;
|
|
84
|
+
}
|
|
85
|
+
const result = await channel.completion;
|
|
86
|
+
await Promise.all([output, diagnostics]);
|
|
87
|
+
if (failure !== undefined)
|
|
88
|
+
throw failure instanceof Error
|
|
89
|
+
? failure
|
|
90
|
+
: new Error("Search output failed.", { cause: failure });
|
|
91
|
+
signal?.throwIfAborted();
|
|
92
|
+
return { code: result.exitCode, stderr };
|
|
93
|
+
} finally {
|
|
94
|
+
await channel.stop();
|
|
95
|
+
await Promise.allSettled([output, diagnostics]);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}
|