pi-agent-ide 0.8.4 → 0.9.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 +59 -0
- package/README.md +24 -29
- package/dist/{chunk-CM3XGY72.js → chunk-2AY526TN.js} +1 -1
- package/dist/{chunk-LEJKDYCK.js → chunk-2TZDG2JH.js} +1 -1
- package/dist/{chunk-XBQR74IK.js → chunk-4GBFIGH3.js} +1 -1
- package/dist/{chunk-PJL3UVMJ.js → chunk-4IWEKRSP.js} +1 -1
- package/dist/chunk-52PFWQMU.js +5 -0
- package/dist/chunk-5BGWNYQS.js +1 -0
- package/dist/{chunk-QUYXINGZ.js → chunk-5S74Z6Y4.js} +3 -3
- package/dist/chunk-64JTD2DJ.js +1 -0
- package/dist/{chunk-XAHU42FP.js → chunk-6A3ORNW3.js} +2 -2
- package/dist/{chunk-ANM3Y5FO.js → chunk-6WCHBHFW.js} +5 -5
- package/dist/{chunk-IMGIDBCC.js → chunk-7D7PXIVV.js} +1 -1
- package/dist/chunk-7PVDTMEM.js +1 -0
- package/dist/chunk-7SG756UO.js +4 -0
- package/dist/{chunk-GBUJOR6V.js → chunk-7URANI6I.js} +14 -14
- package/dist/{chunk-Z2MNHSJ4.js → chunk-AJZVKDYC.js} +1 -1
- package/dist/chunk-AMIIOWFL.js +1 -0
- package/dist/{chunk-TOYN4W4F.js → chunk-B25LXXNV.js} +1 -1
- package/dist/chunk-C2JT2G5K.js +1 -0
- package/dist/chunk-CVOYSEBE.js +1 -0
- package/dist/chunk-DDH3FP4G.js +3 -0
- package/dist/chunk-FEZLTM4L.js +1 -0
- package/dist/{chunk-CPELC6JE.js → chunk-FHRHYY4M.js} +1 -1
- package/dist/chunk-FKKAHI62.js +11 -0
- package/dist/chunk-FS3KCKFX.js +9 -0
- package/dist/chunk-FYOU4RBH.js +2 -0
- package/dist/chunk-G4PRFO6G.js +1 -0
- package/dist/chunk-GS5ZRTUG.js +1 -0
- package/dist/{chunk-XXLLY66B.js → chunk-GXL4NMHR.js} +1 -1
- package/dist/{chunk-QT3EAHOG.js → chunk-H3GEEOOL.js} +1 -1
- package/dist/chunk-H5Z54BEU.js +25 -0
- package/dist/chunk-H7WAM5RH.js +23 -0
- package/dist/chunk-HT7LZN5A.js +9 -0
- package/dist/chunk-IG5DXVDJ.js +1 -0
- package/dist/chunk-K4UTEMDU.js +1 -0
- package/dist/chunk-KFBRL2V4.js +3 -0
- package/dist/chunk-KN6VPARZ.js +1 -0
- package/dist/{chunk-RW2GTYQI.js → chunk-LF325WYO.js} +1 -1
- package/dist/chunk-LTADNZKW.js +2 -0
- package/dist/{chunk-YJ6T3PEP.js → chunk-MDD5ORB6.js} +1 -1
- package/dist/{chunk-S72FVLUX.js → chunk-MLFJU2US.js} +1 -1
- package/dist/chunk-NA2NEU4V.js +1 -0
- package/dist/chunk-OBTT5INC.js +6 -0
- package/dist/{chunk-IICJXZBU.js → chunk-OMNKD7WW.js} +3 -3
- package/dist/chunk-PLMHBXWI.js +10 -0
- package/dist/{chunk-235QMMVA.js → chunk-PQWANILR.js} +1 -1
- package/dist/{chunk-QRJLIV6P.js → chunk-QJ6V5IAY.js} +6 -6
- package/dist/chunk-QM5WDEFI.js +1 -0
- package/dist/{chunk-SMIFCAAX.js → chunk-RIJRPAL2.js} +1 -1
- package/dist/chunk-RIOPUTUJ.js +6 -0
- package/dist/chunk-RVFMH77U.js +82 -0
- package/dist/{chunk-NJ7C4KMA.js → chunk-SRFWT562.js} +1 -1
- package/dist/{chunk-U22JNO6N.js → chunk-STUZZM5B.js} +1 -1
- package/dist/{chunk-PT35ZFLH.js → chunk-TNAUCNUT.js} +12 -12
- package/dist/{chunk-DUUOCBS3.js → chunk-TVH2ND35.js} +1 -1
- package/dist/chunk-TVSZYABY.js +5 -0
- package/dist/chunk-TVXZE4KW.js +4 -0
- package/dist/chunk-U7YDLVFL.js +1 -0
- package/dist/{chunk-KZC7TI5M.js → chunk-UD3DMY3Q.js} +1 -1
- package/dist/{chunk-VXP5BMW7.js → chunk-USG6WHAT.js} +1 -1
- package/dist/{chunk-RMI3NMQY.js → chunk-V4J3TLCV.js} +2 -2
- package/dist/{chunk-ZPT5D4VP.js → chunk-VDJSH3DQ.js} +2 -2
- package/dist/{chunk-VMTOFEXF.js → chunk-VMLPXSMK.js} +1 -1
- package/dist/{chunk-6T7PSDQW.js → chunk-VN3XBH2Q.js} +1 -1
- package/dist/chunk-WAJW4G4F.js +22 -0
- package/dist/chunk-WEE3NM6L.js +1 -0
- package/dist/{chunk-IM24DB3K.js → chunk-WES2E4VR.js} +1 -1
- package/dist/{chunk-RIJMXO43.js → chunk-WQIMM4SU.js} +1 -1
- package/dist/chunk-WUO3UW4J.js +17 -0
- package/dist/chunk-XE4W5YTE.js +2 -0
- package/dist/chunk-XUYIK4TX.js +1 -0
- package/dist/{chunk-ZJQRLVVV.js → chunk-Y74EKJOY.js} +1 -1
- package/dist/{chunk-AAC77UD4.js → chunk-YPYROPQF.js} +1 -1
- package/dist/chunk-ZXO4D5UB.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-12.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 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -0
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +1 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -2
- package/dist/entry-3.js +1 -1
- package/dist/entry-30.js +2 -1
- package/dist/entry-31.js +1 -4
- 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 -18
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +15 -1
- 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 -1
- package/dist/entry-46.js +1 -1
- package/dist/entry-47.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -25
- package/dist/entry-5.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 -3
- package/dist/entry-55.js +1 -13
- 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 -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 -0
- package/dist/entry-66.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +0 -1
- package/dist/entry-7.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -1
- package/dist/entry-72.js +1 -1
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -0
- package/dist/entry-76.js +1 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +0 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +1 -1
- package/dist/entry-81.js +1 -80
- package/dist/entry-82.js +1 -22
- package/dist/entry-83.js +1 -2
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +2 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -1
- package/dist/entry-88.js +1 -3
- package/dist/entry-89.js +1 -1
- package/dist/entry-9.js +1 -1
- package/dist/entry-90.js +3 -1
- package/dist/entry-91.js +1 -1
- package/dist/entry-92.js +1 -0
- package/dist/entry-93.js +1 -0
- package/dist/pi-agent-ide.js +10 -34
- package/docs/agent-guides/ast-search.md +58 -0
- package/docs/agent-guides/debugger.md +1 -1
- package/docs/agent-guides/editing.md +26 -58
- package/docs/agent-guides/git-changes.md +4 -14
- package/docs/agent-guides/search.md +38 -0
- package/docs/agent-guides/ssh.md +17 -49
- package/docs/agent-guides/terminal.md +9 -15
- package/docs/configuration.md +9 -13
- package/docs/extensions.md +82 -0
- package/docs/settings-help.md +2 -2
- package/docs/structured-results.md +33 -11
- package/docs/tools.md +23 -22
- package/node_modules/pi-agent-doctor/package.json +7 -7
- package/node_modules/pi-agent-doctor/src/workspace.ts +0 -5
- package/node_modules/pi-agent-documentation/package.json +2 -2
- package/node_modules/pi-agent-documentation/runtime/entry-29.js +1 -0
- package/node_modules/pi-agent-documentation/src/index.ts +26 -10
- package/node_modules/pi-agent-filesystem/index.ts +1 -1
- package/node_modules/pi-agent-filesystem/package.json +8 -8
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-jq/index.ts +9 -63
- package/node_modules/pi-agent-filesystem-jq/package.json +12 -6
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
- package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-ide-ast/package.json +15 -15
- package/node_modules/pi-agent-ide-ast/src/extension.ts +8 -8
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +104 -26
- package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
- package/node_modules/pi-agent-ide-changes/index.ts +1 -2
- package/node_modules/pi-agent-ide-changes/package.json +10 -10
- package/node_modules/pi-agent-ide-changes/runtime/entry-38.js +1 -0
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/runtime/entry-42.js +2 -0
- package/node_modules/pi-agent-ide-lsp/index.ts +22 -28
- package/node_modules/pi-agent-ide-lsp/package.json +14 -10
- package/node_modules/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
- package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
- package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
- package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-image/src/image-converter.ts +24 -1
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-pdf/src/pdf-converter.ts +23 -1
- package/node_modules/pi-agent-read/package.json +12 -12
- package/node_modules/pi-agent-read/runtime/entry-49.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-51.js +2 -0
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -7
- package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -0
- package/node_modules/pi-agent-read/src/core/extension.ts +0 -8
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
- package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +21 -8
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-resource/src/index.ts +8 -0
- package/node_modules/pi-agent-resource/src/resource-error-metadata.ts +89 -0
- package/node_modules/pi-agent-resource/src/resource-error.ts +6 -1
- package/node_modules/pi-agent-resource/src/result-images.ts +87 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +9 -3
- package/node_modules/pi-agent-resource/src/tool-result.ts +17 -0
- package/node_modules/pi-agent-search/package.json +9 -9
- package/node_modules/pi-agent-search/runtime/entry-54.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-55.js +1 -0
- package/node_modules/pi-agent-search/runtime/entry-56.js +2 -0
- package/node_modules/pi-agent-search/src/api/glob-list.ts +35 -0
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +8 -8
- package/node_modules/pi-agent-search/src/api/search.ts +14 -2
- package/node_modules/pi-agent-search/src/core/extension.ts +11 -20
- package/node_modules/pi-agent-search/src/core/search-core.ts +30 -10
- package/node_modules/pi-agent-search-text/index.ts +34 -12
- package/node_modules/pi-agent-search-text/package.json +17 -15
- package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
- package/node_modules/pi-agent-search-text/runtime/entry-60.js +1 -0
- package/node_modules/pi-agent-search-text/src/file-search.ts +59 -25
- package/node_modules/pi-agent-search-text/src/resolvers.ts +61 -16
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +9 -3
- package/node_modules/pi-agent-search-text/src/search-backend.ts +44 -48
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +19 -15
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -1
- package/node_modules/pi-agent-search-text/src/search-result.ts +6 -2
- package/node_modules/pi-agent-search-text/src/search-session.ts +1 -0
- package/node_modules/pi-agent-search-text/src/tool-file-search.ts +146 -0
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +1 -2
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
- package/node_modules/pi-agent-text-editor/package.json +26 -26
- package/node_modules/pi-agent-text-editor/runtime/entry-81.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-82.js +1 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
- package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -7
- package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
- package/node_modules/pi-agent-text-editor/src/core/image-write.ts +111 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
- package/node_modules/pi-agent-text-editor-renderer/index.ts +6 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/runtime/entry-87.js +1 -0
- package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
- package/node_modules/pi-agent-web/index.ts +28 -6
- package/node_modules/pi-agent-web/package.json +8 -8
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- 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-92.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-93.js +2 -0
- package/package.json +61 -58
- package/src/api/approval.ts +2 -0
- package/src/api/read.ts +2 -0
- package/src/api/standalone.ts +7 -0
- package/src/backend/doctor-workspace.ts +0 -3
- package/src/backend/process-metadata-worker.py +9 -18
- package/src/backend/process-metadata.ts +11 -44
- package/src/backend/registration.ts +0 -10
- package/src/backend/web-browser-worker.mjs +2 -17
- package/src/backend/web-browser.ts +1 -26
- package/src/composite/builtin-extensions.ts +8 -6
- package/src/composite/ide-alias-rendering.ts +18 -2
- package/src/composite/module-labels.ts +0 -4
- package/src/composite/preferences.ts +0 -36
- package/src/composite/settings-documentation.ts +1 -2
- package/src/composite/text-results.ts +61 -23
- package/src/documentation/extension.ts +39 -15
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +1 -1
- 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 +9 -63
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +12 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +112 -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-34.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-35.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-30.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -6
- 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/src/html-converter.ts +1 -1
- 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-92.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-93.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-89.js +2 -0
- package/src/extensions/pi-agent-read/package.json +12 -12
- package/src/extensions/pi-agent-read/runtime/entry-49.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-50.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-51.js +2 -0
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -7
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -0
- package/src/extensions/pi-agent-read/src/core/extension.ts +0 -8
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
- package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +21 -8
- package/src/extensions/pi-agent-search/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +34 -12
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +17 -15
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
- 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-60.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +59 -25
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +61 -16
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +9 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +44 -48
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +19 -15
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +6 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +146 -0
- package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-55.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-56.js +2 -0
- package/src/extensions/pi-agent-search/src/api/glob-list.ts +35 -0
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +8 -8
- package/src/extensions/pi-agent-search/src/api/search.ts +14 -2
- package/src/extensions/pi-agent-search/src/core/extension.ts +11 -20
- package/src/extensions/pi-agent-search/src/core/search-core.ts +30 -10
- package/src/extensions/pi-agent-text-editor/package.json +26 -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-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +1 -2
- 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-65.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +6 -1
- 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-84.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-82.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
- package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -7
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
- package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +111 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
- package/src/pi-agent-ide.ts +8 -15
- package/src/plugins/pi-agent-ide-ast/package.json +15 -15
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +104 -26
- package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
- package/src/plugins/pi-agent-ide-changes/index.ts +1 -2
- package/src/plugins/pi-agent-ide-changes/package.json +10 -10
- package/src/plugins/pi-agent-ide-changes/runtime/entry-38.js +1 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
- package/src/plugins/pi-agent-ide-debugger/index.ts +17 -4
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +2 -11
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/runtime/entry-42.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/index.ts +22 -28
- package/src/plugins/pi-agent-ide-lsp/package.json +14 -10
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
- package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
- package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
- package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +61 -16
- package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +10 -7
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -3
- package/src/standalone/resource-host.ts +147 -0
- package/src/standalone/scoped-api.ts +457 -0
- package/dist/chunk-2RTCSZB3.js +0 -1
- package/dist/chunk-4DIUPEDF.js +0 -2
- package/dist/chunk-6EDOLYOV.js +0 -1
- package/dist/chunk-6FGLAVPJ.js +0 -1
- package/dist/chunk-6H32W35W.js +0 -1
- package/dist/chunk-6OJ565FL.js +0 -2
- package/dist/chunk-6R3Y4AD3.js +0 -1
- package/dist/chunk-6TJPMBUQ.js +0 -1
- package/dist/chunk-6XFUICD7.js +0 -1
- package/dist/chunk-BHSO2MDK.js +0 -6
- package/dist/chunk-GSOYVIQS.js +0 -1
- package/dist/chunk-HSRH76JN.js +0 -3
- package/dist/chunk-HSZ4AQ6L.js +0 -9
- package/dist/chunk-I6NPILT5.js +0 -1
- package/dist/chunk-K7SRNBIV.js +0 -1
- package/dist/chunk-LCWBVOII.js +0 -3
- package/dist/chunk-MKEC3U2M.js +0 -4
- package/dist/chunk-NUM3YQGK.js +0 -1
- package/dist/chunk-OM4LYD3S.js +0 -1
- package/dist/chunk-PLKYHUNT.js +0 -1
- package/dist/chunk-QIJMV2P2.js +0 -2
- package/dist/chunk-RVU73VKN.js +0 -2
- package/dist/chunk-SDAH3ECM.js +0 -5
- package/dist/chunk-SGQWRIRJ.js +0 -10
- package/dist/chunk-SWBJS3U4.js +0 -1
- package/dist/chunk-T7I2VX3J.js +0 -1
- package/dist/chunk-T7MWQQIF.js +0 -3
- package/dist/chunk-VDP5CQHM.js +0 -3
- package/dist/chunk-XG7QNAKW.js +0 -9
- package/dist/chunk-XLWCSJMR.js +0 -1
- package/dist/chunk-YFP4P2FV.js +0 -1
- package/dist/chunk-YIXP2ALP.js +0 -9
- package/dist/entry-22.js +0 -1
- package/docs/agent-guides/diagnostics.md +0 -5
- package/docs/agent-guides/json-reading.md +0 -57
- package/docs/agent-guides/read-resources.md +0 -17
- package/docs/agent-guides/search-code.md +0 -76
- package/docs/agent-guides/select-code.md +0 -119
- package/docs/agent-guides/vision.md +0 -11
- package/node_modules/pi-agent-doctor/runtime/entry-22.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +0 -1
- package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
- package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
- package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +0 -204
- package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +0 -105
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +0 -387
- package/node_modules/pi-agent-ide-ast/src/selection-region.ts +0 -41
- package/node_modules/pi-agent-ide-ast/src/source-text.ts +0 -92
- package/node_modules/pi-agent-ide-ast/src/text-selection.ts +0 -214
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +0 -277
- package/node_modules/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
- package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
- package/node_modules/pi-agent-image/runtime/entry-42.js +0 -1
- package/node_modules/pi-agent-invariant/runtime/entry-43.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-search-text/runtime/entry-55.js +0 -2
- package/node_modules/pi-agent-search-text/runtime/entry-56.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
- package/node_modules/pi-agent-text-editor/runtime/entry-66.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +0 -1
- package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-87.js +0 -2
- package/node_modules/pi-agent-web-html/runtime/entry-88.js +0 -2
- package/src/backend/vision-capture-worker.py +0 -319
- package/src/backend/vision-capture.ts +0 -165
- package/src/backend/vision-registration.ts +0 -104
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +0 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-35.js +0 -2
- package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
- package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
- package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +0 -204
- package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +0 -105
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +0 -387
- package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +0 -41
- package/src/plugins/pi-agent-ide-ast/src/source-text.ts +0 -92
- package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +0 -214
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +0 -277
- package/src/plugins/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
- package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
- package/src/plugins/pi-agent-ide-vision/index.ts +0 -439
- package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +0 -47
- package/src/plugins/pi-agent-ide-vision/src/vision.ts +0 -585
- package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +0 -30
- package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +0 -33
- /package/dist/{chunk-U2JKHKLK.js → chunk-3PMHFEJY.js} +0 -0
- /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-28.js +0 -0
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
- /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
- /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-44.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-45.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-46.js +0 -0
- /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-50.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-52.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-59.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-61.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-65.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-86.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-89.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
- /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
- /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
"""Read one authorized X11 drawable. No controller desktop or root-image window fallback."""
|
|
2
|
-
import ctypes as c
|
|
3
|
-
import json
|
|
4
|
-
import os
|
|
5
|
-
import struct
|
|
6
|
-
import sys
|
|
7
|
-
import zlib
|
|
8
|
-
|
|
9
|
-
MAX_PIXELS = 16 * 1024 * 1024
|
|
10
|
-
MAX_BYTES = 20 * 1024 * 1024
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class Refused(Exception):
|
|
14
|
-
pass
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def process_identity(pid):
|
|
18
|
-
try:
|
|
19
|
-
with open(f"/proc/{pid}/stat", encoding="utf8") as file:
|
|
20
|
-
ticks = file.read().rsplit(")", 1)[1].split()[19]
|
|
21
|
-
with open("/proc/sys/kernel/random/boot_id", encoding="ascii") as file:
|
|
22
|
-
boot = file.read().strip()
|
|
23
|
-
return boot + ":" + ticks, os.readlink(f"/proc/{pid}/exe")
|
|
24
|
-
except FileNotFoundError:
|
|
25
|
-
raise Refused("ENOENT")
|
|
26
|
-
except PermissionError:
|
|
27
|
-
raise Refused("EACCES")
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class Image(c.Structure):
|
|
31
|
-
_fields_ = [("width", c.c_int), ("height", c.c_int), ("xoffset", c.c_int),
|
|
32
|
-
("format", c.c_int), ("data", c.c_void_p), ("byte_order", c.c_int),
|
|
33
|
-
("bitmap_unit", c.c_int), ("bitmap_bit_order", c.c_int), ("bitmap_pad", c.c_int),
|
|
34
|
-
("depth", c.c_int), ("bytes_per_line", c.c_int), ("bits_per_pixel", c.c_int),
|
|
35
|
-
("red_mask", c.c_ulong), ("green_mask", c.c_ulong), ("blue_mask", c.c_ulong)]
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class Extension(c.Structure):
|
|
39
|
-
_fields_ = [("name", c.c_char_p), ("global_id", c.c_int)]
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class ProtocolRequest(c.Structure):
|
|
43
|
-
_fields_ = [("count", c.c_size_t), ("ext", c.POINTER(Extension)),
|
|
44
|
-
("opcode", c.c_uint8), ("isvoid", c.c_uint8)]
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class Iovec(c.Structure):
|
|
48
|
-
_fields_ = [("base", c.c_void_p), ("length", c.c_size_t)]
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def trusted_client_query(display):
|
|
52
|
-
"""Check X-Resource 1.2 on this Xlib connection without reading any pixels."""
|
|
53
|
-
try:
|
|
54
|
-
bridge = c.CDLL("libX11-xcb.so.1")
|
|
55
|
-
xcb = c.CDLL("libxcb.so.1")
|
|
56
|
-
except OSError:
|
|
57
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
58
|
-
pointer = c.c_void_p
|
|
59
|
-
bridge.XGetXCBConnection.restype = pointer
|
|
60
|
-
bridge.XGetXCBConnection.argtypes = [pointer]
|
|
61
|
-
# Share the grabbed Xlib connection. A second client would wait behind XGrabServer.
|
|
62
|
-
connection = bridge.XGetXCBConnection(display)
|
|
63
|
-
if not connection:
|
|
64
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
65
|
-
extension = Extension(b"X-Resource", 0)
|
|
66
|
-
xcb.xcb_get_extension_data.restype = pointer
|
|
67
|
-
xcb.xcb_get_extension_data.argtypes = [pointer, c.POINTER(Extension)]
|
|
68
|
-
information = xcb.xcb_get_extension_data(connection, c.byref(extension))
|
|
69
|
-
if not information or c.string_at(information, 12)[8] != 1:
|
|
70
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
71
|
-
xcb.xcb_send_request.restype = c.c_uint
|
|
72
|
-
xcb.xcb_send_request.argtypes = [pointer, c.c_int, c.POINTER(Iovec), c.POINTER(ProtocolRequest)]
|
|
73
|
-
xcb.xcb_wait_for_reply.restype = pointer
|
|
74
|
-
xcb.xcb_wait_for_reply.argtypes = [pointer, c.c_uint, c.POINTER(pointer)]
|
|
75
|
-
libc = c.CDLL(None)
|
|
76
|
-
libc.free.argtypes = [pointer]
|
|
77
|
-
libc.free.restype = None
|
|
78
|
-
|
|
79
|
-
def query(opcode, data):
|
|
80
|
-
buffer = c.create_string_buffer(data)
|
|
81
|
-
# libxcb reserves two iovecs before the request for its wire header.
|
|
82
|
-
vectors = (Iovec * 4)()
|
|
83
|
-
vectors[2] = Iovec(c.cast(buffer, pointer), len(data))
|
|
84
|
-
vectors[3] = Iovec(None, (-len(data)) & 3)
|
|
85
|
-
protocol = ProtocolRequest(2, c.pointer(extension), opcode, 0)
|
|
86
|
-
sequence = xcb.xcb_send_request(connection, 1,
|
|
87
|
-
c.cast(c.byref(vectors, 2 * c.sizeof(Iovec)), c.POINTER(Iovec)), c.byref(protocol))
|
|
88
|
-
error = pointer()
|
|
89
|
-
reply = xcb.xcb_wait_for_reply(connection, sequence, c.byref(error)) if sequence else None
|
|
90
|
-
try:
|
|
91
|
-
if error or not reply:
|
|
92
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
93
|
-
header = c.string_at(reply, 32)
|
|
94
|
-
size = struct.unpack_from("=I", header, 4)[0] * 4
|
|
95
|
-
if header[0] != 1 or size > 4096:
|
|
96
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
97
|
-
return header + c.string_at(reply + 32, size)
|
|
98
|
-
finally:
|
|
99
|
-
if error:
|
|
100
|
-
libc.free(error)
|
|
101
|
-
if reply:
|
|
102
|
-
libc.free(reply)
|
|
103
|
-
|
|
104
|
-
version = query(0, struct.pack("=BBHBB2x", 0, 0, 0, 1, 2))
|
|
105
|
-
if struct.unpack_from("=HH", version, 8) < (1, 2):
|
|
106
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
107
|
-
return query
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def trusted_window_pid(display, window):
|
|
111
|
-
"""Ask for the server-observed local client PID, not a window property."""
|
|
112
|
-
query = trusted_client_query(display)
|
|
113
|
-
identifiers = query(4, struct.pack("=BBHIII", 0, 0, 0, 1, window, 2))
|
|
114
|
-
# One requested client and one LOCAL_CLIENT_PID value (length is bytes).
|
|
115
|
-
if len(identifiers) != 48 or struct.unpack_from("=I", identifiers, 8)[0] != 1:
|
|
116
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
117
|
-
_, mask, length, pid = struct.unpack_from("=IIII", identifiers, 32)
|
|
118
|
-
if mask != 2 or length != 4 or pid == 0:
|
|
119
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
120
|
-
return pid
|
|
121
|
-
|
|
122
|
-
def display_library():
|
|
123
|
-
if not os.environ.get("DISPLAY"):
|
|
124
|
-
raise Refused("DESKTOP_UNAVAILABLE")
|
|
125
|
-
try:
|
|
126
|
-
x = c.CDLL("libX11.so.6")
|
|
127
|
-
except OSError:
|
|
128
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
129
|
-
return x
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def probe():
|
|
133
|
-
"""Connect to the native desktop and check trusted identity support. Never acquire pixels."""
|
|
134
|
-
x = display_library()
|
|
135
|
-
x.XOpenDisplay.restype = c.c_void_p
|
|
136
|
-
x.XOpenDisplay.argtypes = [c.c_char_p]
|
|
137
|
-
x.XCloseDisplay.restype = c.c_int
|
|
138
|
-
x.XCloseDisplay.argtypes = [c.c_void_p]
|
|
139
|
-
display = x.XOpenDisplay(None)
|
|
140
|
-
if not display:
|
|
141
|
-
raise Refused("DESKTOP_UNAVAILABLE")
|
|
142
|
-
try:
|
|
143
|
-
try:
|
|
144
|
-
trusted_client_query(display)
|
|
145
|
-
except Refused as error:
|
|
146
|
-
return {"display": True, "window": False, "error": str(error)}
|
|
147
|
-
return {"display": True, "window": True}
|
|
148
|
-
finally:
|
|
149
|
-
x.XCloseDisplay(display)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def capture(request):
|
|
153
|
-
x = display_library()
|
|
154
|
-
pointer, number = c.c_void_p, c.c_ulong
|
|
155
|
-
def bind(name, result, arguments):
|
|
156
|
-
function = getattr(x, name)
|
|
157
|
-
function.restype, function.argtypes = result, arguments
|
|
158
|
-
return function
|
|
159
|
-
open_display = bind("XOpenDisplay", pointer, [c.c_char_p])
|
|
160
|
-
close_display = bind("XCloseDisplay", c.c_int, [pointer])
|
|
161
|
-
root_window = bind("XRootWindow", number, [pointer, c.c_int])
|
|
162
|
-
screen_count = bind("XScreenCount", c.c_int, [pointer])
|
|
163
|
-
query_tree = bind("XQueryTree", c.c_int, [pointer, number, c.POINTER(number),
|
|
164
|
-
c.POINTER(number), c.POINTER(c.POINTER(number)), c.POINTER(c.c_uint)])
|
|
165
|
-
get_geometry = bind("XGetGeometry", c.c_int, [pointer, number, c.POINTER(number),
|
|
166
|
-
c.POINTER(c.c_int), c.POINTER(c.c_int), c.POINTER(c.c_uint), c.POINTER(c.c_uint),
|
|
167
|
-
c.POINTER(c.c_uint), c.POINTER(c.c_uint)])
|
|
168
|
-
translate = bind("XTranslateCoordinates", c.c_int, [pointer, number, number,
|
|
169
|
-
c.c_int, c.c_int, c.POINTER(c.c_int), c.POINTER(c.c_int), c.POINTER(number)])
|
|
170
|
-
atom = bind("XInternAtom", number, [pointer, c.c_char_p, c.c_int])
|
|
171
|
-
get_property = bind("XGetWindowProperty", c.c_int, [pointer, number, number, c.c_long,
|
|
172
|
-
c.c_long, c.c_int, number, c.POINTER(number), c.POINTER(c.c_int),
|
|
173
|
-
c.POINTER(number), c.POINTER(number), c.POINTER(pointer)])
|
|
174
|
-
free = bind("XFree", c.c_int, [pointer])
|
|
175
|
-
get_image = bind("XGetImage", c.POINTER(Image), [pointer, number, c.c_int, c.c_int,
|
|
176
|
-
c.c_uint, c.c_uint, number, c.c_int])
|
|
177
|
-
destroy_image = bind("XDestroyImage", c.c_int, [c.POINTER(Image)])
|
|
178
|
-
grab = bind("XGrabServer", c.c_int, [pointer])
|
|
179
|
-
ungrab = bind("XUngrabServer", c.c_int, [pointer])
|
|
180
|
-
sync = bind("XSync", c.c_int, [pointer, c.c_int])
|
|
181
|
-
error_handler = c.CFUNCTYPE(c.c_int, pointer, pointer)
|
|
182
|
-
error_seen = []
|
|
183
|
-
@error_handler
|
|
184
|
-
def on_error(_display, _event):
|
|
185
|
-
error_seen.append(True)
|
|
186
|
-
return 0
|
|
187
|
-
bind("XSetErrorHandler", pointer, [error_handler])(on_error)
|
|
188
|
-
display = open_display(None)
|
|
189
|
-
if not display:
|
|
190
|
-
raise Refused("DESKTOP_UNAVAILABLE")
|
|
191
|
-
image = None
|
|
192
|
-
grabbed = False
|
|
193
|
-
try:
|
|
194
|
-
def children(window):
|
|
195
|
-
root, parent, count = number(), number(), c.c_uint()
|
|
196
|
-
values = c.POINTER(number)()
|
|
197
|
-
if not query_tree(display, window, c.byref(root), c.byref(parent), c.byref(values), c.byref(count)):
|
|
198
|
-
raise Refused("EACCES")
|
|
199
|
-
try:
|
|
200
|
-
if count.value > 4096:
|
|
201
|
-
raise Refused("CONTENT_LIMIT")
|
|
202
|
-
return list(values[:count.value])
|
|
203
|
-
finally:
|
|
204
|
-
if values:
|
|
205
|
-
free(values)
|
|
206
|
-
def geometry(window, root, include_border=False):
|
|
207
|
-
owner, child = number(), number()
|
|
208
|
-
left, top, rx, ry = c.c_int(), c.c_int(), c.c_int(), c.c_int()
|
|
209
|
-
width, height, border, depth = c.c_uint(), c.c_uint(), c.c_uint(), c.c_uint()
|
|
210
|
-
if not get_geometry(display, window, c.byref(owner), c.byref(left), c.byref(top),
|
|
211
|
-
c.byref(width), c.byref(height), c.byref(border), c.byref(depth)):
|
|
212
|
-
raise Refused("EACCES")
|
|
213
|
-
if not translate(display, window, root, 0, 0, c.byref(rx), c.byref(ry), c.byref(child)):
|
|
214
|
-
raise Refused("EACCES")
|
|
215
|
-
edge = border.value if include_border else 0
|
|
216
|
-
return rx.value - edge, ry.value - edge, width.value + 2 * edge, height.value + 2 * edge
|
|
217
|
-
pid_atom = atom(display, b"_NET_WM_PID", 1)
|
|
218
|
-
def window_pid(window):
|
|
219
|
-
actual, count, remaining = number(), number(), number()
|
|
220
|
-
format = c.c_int()
|
|
221
|
-
value = pointer()
|
|
222
|
-
result = get_property(display, window, pid_atom, 0, 1, 0, 6,
|
|
223
|
-
c.byref(actual), c.byref(format), c.byref(count), c.byref(remaining), c.byref(value))
|
|
224
|
-
try:
|
|
225
|
-
if result == 0 and actual.value == 6 and format.value == 32 and count.value == 1 and remaining.value == 0:
|
|
226
|
-
return c.cast(value, c.POINTER(number))[0]
|
|
227
|
-
return None
|
|
228
|
-
finally:
|
|
229
|
-
if value:
|
|
230
|
-
free(value)
|
|
231
|
-
grab(display)
|
|
232
|
-
grabbed = True
|
|
233
|
-
if request["kind"] == "display":
|
|
234
|
-
index = request["index"]
|
|
235
|
-
if index < 0 or index >= screen_count(display):
|
|
236
|
-
raise Refused("ENOENT")
|
|
237
|
-
root = drawable = root_window(display, index)
|
|
238
|
-
else:
|
|
239
|
-
pid = request["pid"]
|
|
240
|
-
expected = (request["identity"], request["executable"])
|
|
241
|
-
if process_identity(pid) != expected:
|
|
242
|
-
raise Refused("STALE_PROCESS")
|
|
243
|
-
matches = []
|
|
244
|
-
visited = 0
|
|
245
|
-
for screen in range(screen_count(display)):
|
|
246
|
-
root = root_window(display, screen)
|
|
247
|
-
top_windows = children(root)
|
|
248
|
-
pending = [(window, position) for position, window in enumerate(top_windows)]
|
|
249
|
-
while pending:
|
|
250
|
-
window, position = pending.pop()
|
|
251
|
-
visited += 1
|
|
252
|
-
if visited > 4096:
|
|
253
|
-
raise Refused("CONTENT_LIMIT")
|
|
254
|
-
if pid_atom and window_pid(window) == pid:
|
|
255
|
-
matches.append((root, window, top_windows[position + 1:]))
|
|
256
|
-
pending.extend((child, position) for child in children(window))
|
|
257
|
-
if not matches:
|
|
258
|
-
raise Refused("ENOENT")
|
|
259
|
-
if len(matches) != 1:
|
|
260
|
-
raise Refused("AMBIGUOUS_WINDOW")
|
|
261
|
-
root, drawable, above = matches[0]
|
|
262
|
-
sync(display, 0)
|
|
263
|
-
if trusted_window_pid(display, drawable) != pid:
|
|
264
|
-
raise Refused("EACCES")
|
|
265
|
-
left, top, width, height = geometry(drawable, root)
|
|
266
|
-
for other in above:
|
|
267
|
-
ox, oy, ow, oh = geometry(other, root, include_border=True)
|
|
268
|
-
if left < ox + ow and ox < left + width and top < oy + oh and oy < top + height:
|
|
269
|
-
# XGetImage has undefined obscured pixels. Never replace them with root pixels.
|
|
270
|
-
raise Refused("WINDOW_OBSCURED")
|
|
271
|
-
_, _, width, height = geometry(drawable, root)
|
|
272
|
-
if width < 1 or height < 1 or width * height > MAX_PIXELS:
|
|
273
|
-
raise Refused("PIXEL_LIMIT")
|
|
274
|
-
image = get_image(display, drawable, 0, 0, width, height, number(-1), 2)
|
|
275
|
-
sync(display, 0)
|
|
276
|
-
if not image or error_seen:
|
|
277
|
-
raise Refused("EACCES")
|
|
278
|
-
if request["kind"] == "window" and process_identity(request["pid"]) != expected:
|
|
279
|
-
raise Refused("STALE_PROCESS")
|
|
280
|
-
ungrab(display)
|
|
281
|
-
grabbed = False
|
|
282
|
-
pixels = image.contents
|
|
283
|
-
if (pixels.width, pixels.height) != (width, height) or pixels.xoffset != 0 or pixels.byte_order != 0 or pixels.bits_per_pixel not in (24, 32) or (pixels.red_mask, pixels.green_mask, pixels.blue_mask) != (0xff0000, 0xff00, 0xff):
|
|
284
|
-
raise Refused("CAPABILITY_UNAVAILABLE")
|
|
285
|
-
step = pixels.bits_per_pixel // 8
|
|
286
|
-
if pixels.bytes_per_line < width * step or pixels.bytes_per_line * height > MAX_PIXELS * 4:
|
|
287
|
-
raise Refused("PIXEL_LIMIT")
|
|
288
|
-
raw = c.string_at(pixels.data, pixels.bytes_per_line * height)
|
|
289
|
-
scanlines = bytearray()
|
|
290
|
-
for row in range(height):
|
|
291
|
-
data = raw[row * pixels.bytes_per_line:row * pixels.bytes_per_line + width * step]
|
|
292
|
-
rgb = bytearray(width * 3)
|
|
293
|
-
rgb[0::3], rgb[1::3], rgb[2::3] = data[2::step], data[1::step], data[0::step]
|
|
294
|
-
scanlines.extend(b"\0" + rgb)
|
|
295
|
-
def chunk(kind, data):
|
|
296
|
-
return struct.pack("!I", len(data)) + kind + data + struct.pack("!I", zlib.crc32(kind + data))
|
|
297
|
-
png = b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack("!IIBBBBB", width, height, 8, 2, 0, 0, 0)) + chunk(b"IDAT", zlib.compress(scanlines)) + chunk(b"IEND", b"")
|
|
298
|
-
if len(png) > MAX_BYTES:
|
|
299
|
-
raise Refused("BYTE_LIMIT")
|
|
300
|
-
return png
|
|
301
|
-
finally:
|
|
302
|
-
if image:
|
|
303
|
-
destroy_image(image)
|
|
304
|
-
if grabbed:
|
|
305
|
-
ungrab(display)
|
|
306
|
-
close_display(display)
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
try:
|
|
310
|
-
request = json.loads(sys.argv[1])
|
|
311
|
-
if request["kind"] == "probe":
|
|
312
|
-
print(json.dumps(probe()))
|
|
313
|
-
else:
|
|
314
|
-
sys.stdout.buffer.write(capture(request))
|
|
315
|
-
except Refused as error:
|
|
316
|
-
print(json.dumps({"error": str(error)}))
|
|
317
|
-
except Exception:
|
|
318
|
-
# Do not return display names, authorization paths, native logs or environment values.
|
|
319
|
-
print(json.dumps({"error": "CAPABILITY_UNAVAILABLE"}))
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import type { SshBackendRegistry } from "./registry.js";
|
|
3
|
-
import type { SshTarget } from "./ssh.js";
|
|
4
|
-
import { SshBackendError } from "./ssh.js";
|
|
5
|
-
import { readOwnedSshCommand } from "./owned-read-command.js";
|
|
6
|
-
|
|
7
|
-
/** A native target frame request. Window identity must come from an authorized target snapshot. */
|
|
8
|
-
export type SshCaptureRequest =
|
|
9
|
-
| {
|
|
10
|
-
readonly kind: "window";
|
|
11
|
-
readonly pid: number;
|
|
12
|
-
readonly identity: string;
|
|
13
|
-
readonly executable: string;
|
|
14
|
-
}
|
|
15
|
-
| { readonly kind: "display"; readonly index: number };
|
|
16
|
-
|
|
17
|
-
/** Connect to target X11 and check trusted client support without pixels or opt-in changes.
|
|
18
|
-
* This is readiness only, not authorization for any particular window or display.
|
|
19
|
-
*/
|
|
20
|
-
export async function probeSshCapture(
|
|
21
|
-
target: SshTarget,
|
|
22
|
-
source: string,
|
|
23
|
-
signal?: AbortSignal,
|
|
24
|
-
): Promise<{
|
|
25
|
-
display: { ok: boolean; detail: string };
|
|
26
|
-
window: { ok: boolean; detail: string };
|
|
27
|
-
}> {
|
|
28
|
-
signal?.throwIfAborted();
|
|
29
|
-
worker ??= readFile(new URL("./vision-capture-worker.py", import.meta.url), "utf8");
|
|
30
|
-
const result = await readOwnedSshCommand(
|
|
31
|
-
target,
|
|
32
|
-
"python3",
|
|
33
|
-
["-c", await worker, JSON.stringify({ kind: "probe" })],
|
|
34
|
-
source,
|
|
35
|
-
{ signal, timeoutMs: 5_000, maxBytes: 128 * 1024 },
|
|
36
|
-
);
|
|
37
|
-
signal?.throwIfAborted();
|
|
38
|
-
if (result.exitCode !== 0)
|
|
39
|
-
throw new SshBackendError("CAPABILITY_UNAVAILABLE", source, "not-applied");
|
|
40
|
-
let reply: unknown;
|
|
41
|
-
try {
|
|
42
|
-
reply = JSON.parse(result.stdout.toString("utf8"));
|
|
43
|
-
} catch {
|
|
44
|
-
throw new SshBackendError("INVALID_RESPONSE", source, "not-applied");
|
|
45
|
-
}
|
|
46
|
-
if (typeof reply !== "object" || reply === null)
|
|
47
|
-
throw new SshBackendError("INVALID_RESPONSE", source, "not-applied");
|
|
48
|
-
if (
|
|
49
|
-
"display" in reply &&
|
|
50
|
-
reply.display === true &&
|
|
51
|
-
"window" in reply &&
|
|
52
|
-
typeof reply.window === "boolean" &&
|
|
53
|
-
(reply.window || ("error" in reply && reply.error === "CAPABILITY_UNAVAILABLE"))
|
|
54
|
-
) {
|
|
55
|
-
return {
|
|
56
|
-
display: {
|
|
57
|
-
ok: true,
|
|
58
|
-
detail: "Target X11 connection opened without pixels; capture opt-in unchanged",
|
|
59
|
-
},
|
|
60
|
-
window: {
|
|
61
|
-
ok: reply.window,
|
|
62
|
-
detail: reply.window
|
|
63
|
-
? "Target X-Resource 1.2 is available; individual window authorization is not checked"
|
|
64
|
-
: `CAPABILITY_UNAVAILABLE: ${source} (trusted X11 client identity unavailable)`,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
const code =
|
|
69
|
-
"error" in reply && typeof reply.error === "string" && refusalCodes.has(reply.error)
|
|
70
|
-
? reply.error
|
|
71
|
-
: "INVALID_RESPONSE";
|
|
72
|
-
throw new SshBackendError(code, source, "not-applied");
|
|
73
|
-
}
|
|
74
|
-
let worker: Promise<string> | undefined;
|
|
75
|
-
const PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
76
|
-
const refusalCodes = new Set([
|
|
77
|
-
"DESKTOP_UNAVAILABLE",
|
|
78
|
-
"CAPABILITY_UNAVAILABLE",
|
|
79
|
-
"ENOENT",
|
|
80
|
-
"EACCES",
|
|
81
|
-
"STALE_PROCESS",
|
|
82
|
-
"AMBIGUOUS_WINDOW",
|
|
83
|
-
"WINDOW_OBSCURED",
|
|
84
|
-
"CONTENT_LIMIT",
|
|
85
|
-
"PIXEL_LIMIT",
|
|
86
|
-
"BYTE_LIMIT",
|
|
87
|
-
]);
|
|
88
|
-
|
|
89
|
-
/** Acquire bounded X11 pixels on the configured target, never from the controller desktop.
|
|
90
|
-
* The caller checks capture opt-in and authorizes the exact target executable before each frame.
|
|
91
|
-
* The worker rechecks boot/start identity and executable around the requested drawable read.
|
|
92
|
-
*/
|
|
93
|
-
export async function captureSshFrame(
|
|
94
|
-
registry: SshBackendRegistry,
|
|
95
|
-
source: string,
|
|
96
|
-
request: SshCaptureRequest,
|
|
97
|
-
signal?: AbortSignal,
|
|
98
|
-
): Promise<Uint8Array> {
|
|
99
|
-
signal?.throwIfAborted();
|
|
100
|
-
const prefix = request.kind === "window" ? "window:" : "display:";
|
|
101
|
-
if (!source.startsWith(`${prefix}ssh://`))
|
|
102
|
-
throw new SshBackendError("INVALID_SOURCE", source, "not-applied");
|
|
103
|
-
const uri = new URL(source.slice(prefix.length));
|
|
104
|
-
const selected = request.kind === "window" ? request.pid : request.index;
|
|
105
|
-
if (
|
|
106
|
-
uri.username ||
|
|
107
|
-
uri.password ||
|
|
108
|
-
uri.port ||
|
|
109
|
-
uri.search ||
|
|
110
|
-
!Number.isSafeInteger(selected) ||
|
|
111
|
-
(request.kind === "window"
|
|
112
|
-
? selected < 1 || uri.pathname !== `/${selected}` || uri.hash !== ""
|
|
113
|
-
: selected < 0 ||
|
|
114
|
-
uri.pathname !== "/" ||
|
|
115
|
-
(uri.hash !== `#${selected}` && !(selected === 0 && uri.hash === "")))
|
|
116
|
-
)
|
|
117
|
-
throw new SshBackendError("INVALID_SOURCE", source, "not-applied");
|
|
118
|
-
try {
|
|
119
|
-
const owner = registry.resolve(`ssh://${uri.hostname}/`);
|
|
120
|
-
if (!owner) throw new SshBackendError("UNSUPPORTED_SOURCE", source, "not-applied");
|
|
121
|
-
worker ??= readFile(new URL("./vision-capture-worker.py", import.meta.url), "utf8");
|
|
122
|
-
const result = await readOwnedSshCommand(
|
|
123
|
-
owner.backend.target,
|
|
124
|
-
"python3",
|
|
125
|
-
["-c", await worker, JSON.stringify(request)],
|
|
126
|
-
source,
|
|
127
|
-
{ signal, timeoutMs: 10_000, maxBytes: 20 * 1024 * 1024 },
|
|
128
|
-
);
|
|
129
|
-
signal?.throwIfAborted();
|
|
130
|
-
if (result.exitCode !== 0)
|
|
131
|
-
throw new SshBackendError("CAPABILITY_UNAVAILABLE", source, "not-applied");
|
|
132
|
-
if (result.stdout.subarray(0, 8).equals(PNG_SIGNATURE)) {
|
|
133
|
-
if (
|
|
134
|
-
result.stdout.length < 33 ||
|
|
135
|
-
result.stdout.length > 20 * 1024 * 1024 ||
|
|
136
|
-
result.stdout.toString("ascii", 12, 16) !== "IHDR"
|
|
137
|
-
)
|
|
138
|
-
throw new SshBackendError("INVALID_RESPONSE", source, "not-applied");
|
|
139
|
-
const width = result.stdout.readUInt32BE(16),
|
|
140
|
-
height = result.stdout.readUInt32BE(20);
|
|
141
|
-
if (width < 1 || height < 1 || width * height > 16 * 1024 * 1024)
|
|
142
|
-
throw new SshBackendError("PIXEL_LIMIT", source, "not-applied");
|
|
143
|
-
return result.stdout;
|
|
144
|
-
}
|
|
145
|
-
let reply: unknown;
|
|
146
|
-
try {
|
|
147
|
-
reply = JSON.parse(result.stdout.toString("utf8"));
|
|
148
|
-
} catch {
|
|
149
|
-
throw new SshBackendError("INVALID_RESPONSE", source, "not-applied");
|
|
150
|
-
}
|
|
151
|
-
const code =
|
|
152
|
-
typeof reply === "object" &&
|
|
153
|
-
reply !== null &&
|
|
154
|
-
"error" in reply &&
|
|
155
|
-
typeof reply.error === "string" &&
|
|
156
|
-
refusalCodes.has(reply.error)
|
|
157
|
-
? reply.error
|
|
158
|
-
: "INVALID_RESPONSE";
|
|
159
|
-
throw new SshBackendError(code, source, "not-applied");
|
|
160
|
-
} catch (error) {
|
|
161
|
-
if (error instanceof SshBackendError)
|
|
162
|
-
throw new SshBackendError(error.code, source, error.effect);
|
|
163
|
-
throw error;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type { BuiltinExtensionContext } from "#src/composite/selection.js";
|
|
3
|
-
import {
|
|
4
|
-
registerVisionWithOwner,
|
|
5
|
-
type ProcessOwnerAccess,
|
|
6
|
-
type CaptureOwnerAccess,
|
|
7
|
-
} from "#src/plugins/pi-agent-ide-vision/index.js";
|
|
8
|
-
import { resolvePiAgentIdeExtensionsConfigPaths } from "#src/composite/extensions-config.js";
|
|
9
|
-
import { readSshTargets, resolveSshConfigPaths } from "./config.js";
|
|
10
|
-
import { SshBackendRegistry } from "./registry.js";
|
|
11
|
-
import { SshBackendError } from "./ssh.js";
|
|
12
|
-
import { readSshProcessMetadata } from "./process-metadata.js";
|
|
13
|
-
import { captureSshFrame } from "./vision-capture.js";
|
|
14
|
-
import { parseSshWebSource } from "./web-owner.js";
|
|
15
|
-
import { captureSshBrowserImage } from "./web-browser.js";
|
|
16
|
-
|
|
17
|
-
/** Add explicit target process namespaces without changing ordinary local discovery or capture. */
|
|
18
|
-
export function createSshProcessOwner(registry: SshBackendRegistry): ProcessOwnerAccess {
|
|
19
|
-
return {
|
|
20
|
-
async read(source, signal) {
|
|
21
|
-
if (!source.startsWith("process:ssh://")) return undefined;
|
|
22
|
-
const uri = new URL(source.slice("process:".length));
|
|
23
|
-
if (
|
|
24
|
-
uri.username ||
|
|
25
|
-
uri.password ||
|
|
26
|
-
uri.port ||
|
|
27
|
-
uri.search ||
|
|
28
|
-
uri.hash ||
|
|
29
|
-
!/^\/[1-9][0-9]*$/u.test(uri.pathname)
|
|
30
|
-
)
|
|
31
|
-
throw new SshBackendError("INVALID_SOURCE", source, "not-applied");
|
|
32
|
-
try {
|
|
33
|
-
const [metadata] = await readSshProcessMetadata(
|
|
34
|
-
registry,
|
|
35
|
-
`ssh://${uri.hostname}/`,
|
|
36
|
-
Number(uri.pathname.slice(1)),
|
|
37
|
-
signal,
|
|
38
|
-
);
|
|
39
|
-
if (!metadata) throw new SshBackendError("ENOENT", source, "not-applied");
|
|
40
|
-
return metadata;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
if (error instanceof SshBackendError)
|
|
43
|
-
throw new SshBackendError(error.code, source, error.effect);
|
|
44
|
-
throw error;
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
async list(scope, signal) {
|
|
48
|
-
if (!scope.startsWith("ssh://")) return undefined;
|
|
49
|
-
return readSshProcessMetadata(registry, scope, undefined, signal);
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** Bridge authorized target snapshots to native pixel acquisition; local capture is never used. */
|
|
55
|
-
export function createSshCaptureOwner(registry: SshBackendRegistry): CaptureOwnerAccess {
|
|
56
|
-
return {
|
|
57
|
-
captureWindow(source, process, signal) {
|
|
58
|
-
if (!process.executable)
|
|
59
|
-
throw new SshBackendError("CAPABILITY_UNAVAILABLE", source, "not-applied");
|
|
60
|
-
return captureSshFrame(
|
|
61
|
-
registry,
|
|
62
|
-
source,
|
|
63
|
-
{
|
|
64
|
-
kind: "window",
|
|
65
|
-
pid: process.pid,
|
|
66
|
-
identity: process.identity,
|
|
67
|
-
executable: process.executable,
|
|
68
|
-
},
|
|
69
|
-
signal,
|
|
70
|
-
);
|
|
71
|
-
},
|
|
72
|
-
async captureWeb(source, signal) {
|
|
73
|
-
const parsed = parseSshWebSource(source);
|
|
74
|
-
if (!parsed) throw new SshBackendError("INVALID_SOURCE", source, "not-applied");
|
|
75
|
-
try {
|
|
76
|
-
const owner = registry.resolve(`ssh://${parsed.target}/`);
|
|
77
|
-
if (!owner) throw new SshBackendError("UNSUPPORTED_SOURCE", source, "not-applied");
|
|
78
|
-
return await captureSshBrowserImage(owner.backend.target, parsed.url, source, signal);
|
|
79
|
-
} catch (error) {
|
|
80
|
-
if (error instanceof SshBackendError)
|
|
81
|
-
throw new SshBackendError(error.code, source, error.effect);
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
captureDisplay(source, index, signal) {
|
|
86
|
-
return captureSshFrame(registry, source, { kind: "display", index }, signal);
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
/** Register enabled vision/process providers lazily; unused targets launch no probes. */
|
|
91
|
-
export default async function registerOwnedVision(
|
|
92
|
-
pi: ExtensionAPI,
|
|
93
|
-
context?: BuiltinExtensionContext,
|
|
94
|
-
): Promise<void> {
|
|
95
|
-
const registry = new SshBackendRegistry(
|
|
96
|
-
await readSshTargets(resolveSshConfigPaths(resolvePiAgentIdeExtensionsConfigPaths())),
|
|
97
|
-
);
|
|
98
|
-
await registerVisionWithOwner(
|
|
99
|
-
pi,
|
|
100
|
-
context,
|
|
101
|
-
createSshProcessOwner(registry),
|
|
102
|
-
createSshCaptureOwner(registry),
|
|
103
|
-
);
|
|
104
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../dist/entry-45.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../dist/entry-46.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../../../dist/entry-56.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../dist/entry-51.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../dist/entry-52.js";
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../../../dist/entry-61.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../dist/entry-65.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../dist/entry-66.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../../../dist/entry-34.js";
|