pi-agent-ide 0.8.4 → 0.9.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 +77 -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-DUUOCBS3.js → chunk-35LZOKEW.js} +1 -1
- package/dist/chunk-3LVBARLW.js +33 -0
- 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-5PC5INOL.js +1 -0
- package/dist/{chunk-QUYXINGZ.js → chunk-5S74Z6Y4.js} +3 -3
- 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-AMIIOWFL.js +1 -0
- package/dist/{chunk-TOYN4W4F.js → chunk-B25LXXNV.js} +1 -1
- package/dist/chunk-BT2CFM7D.js +11 -0
- package/dist/chunk-C2JT2G5K.js +1 -0
- package/dist/chunk-DDH3FP4G.js +3 -0
- package/dist/{chunk-6T7PSDQW.js → chunk-DVNL5NZE.js} +1 -1
- package/dist/chunk-FEZLTM4L.js +1 -0
- package/dist/{chunk-CPELC6JE.js → chunk-FHRHYY4M.js} +1 -1
- package/dist/chunk-FXPY3V4L.js +10 -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-Z2MNHSJ4.js → chunk-HGCJDIRR.js} +1 -1
- package/dist/chunk-HISGZD3C.js +81 -0
- package/dist/chunk-HKYVP2Q6.js +3 -0
- package/dist/chunk-HRBUY2FF.js +4 -0
- package/dist/chunk-IG5DXVDJ.js +1 -0
- package/dist/chunk-IOGWZNWT.js +1 -0
- package/dist/chunk-IUJUECXH.js +9 -0
- package/dist/chunk-KN6VPARZ.js +1 -0
- package/dist/{chunk-RW2GTYQI.js → chunk-LF325WYO.js} +1 -1
- package/dist/chunk-LXDF2NWX.js +1 -0
- package/dist/{chunk-YJ6T3PEP.js → chunk-MDD5ORB6.js} +1 -1
- package/dist/{chunk-S72FVLUX.js → chunk-MLFJU2US.js} +1 -1
- package/dist/chunk-MPNE25CY.js +5 -0
- package/dist/chunk-NA2NEU4V.js +1 -0
- package/dist/{chunk-ZJQRLVVV.js → chunk-O7V6G3OO.js} +1 -1
- package/dist/chunk-OBTT5INC.js +6 -0
- package/dist/{chunk-IICJXZBU.js → chunk-OMNKD7WW.js} +3 -3
- package/dist/chunk-OUCVZBOR.js +28 -0
- package/dist/chunk-PCGBM2D6.js +17 -0
- package/dist/{chunk-235QMMVA.js → chunk-PQWANILR.js} +1 -1
- package/dist/{chunk-QRJLIV6P.js → chunk-QJ6V5IAY.js} +6 -6
- package/dist/{chunk-SMIFCAAX.js → chunk-RIJRPAL2.js} +1 -1
- package/dist/chunk-RIOPUTUJ.js +6 -0
- package/dist/{chunk-RMI3NMQY.js → chunk-RIZARTUM.js} +2 -2
- package/dist/{chunk-NJ7C4KMA.js → chunk-SRFWT562.js} +1 -1
- package/dist/{chunk-U22JNO6N.js → chunk-STUZZM5B.js} +1 -1
- package/dist/chunk-T3Z4KXOX.js +2 -0
- package/dist/chunk-TSQ6FBTB.js +1 -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-ZPT5D4VP.js → chunk-VDJSH3DQ.js} +2 -2
- package/dist/{chunk-VMTOFEXF.js → chunk-VMLPXSMK.js} +1 -1
- package/dist/chunk-VNWGT367.js +1 -0
- 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-X2WFNMQR.js +9 -0
- package/dist/chunk-XCPIIDFS.js +4 -0
- package/dist/chunk-XE4W5YTE.js +2 -0
- package/dist/chunk-XUYIK4TX.js +1 -0
- 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-22.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 +1 -1
- package/dist/entry-31.js +2 -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 +1 -1
- package/dist/entry-38.js +15 -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-67.js +1 -0
- package/dist/entry-68.js +0 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-7.js +1 -1
- package/dist/entry-70.js +0 -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-77.js +1 -0
- package/dist/entry-78.js +0 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +0 -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 +1 -1
- package/dist/entry-86.js +2 -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 +1 -1
- package/dist/entry-91.js +3 -1
- package/dist/entry-92.js +1 -0
- package/dist/entry-93.js +1 -0
- package/dist/entry-94.js +1 -0
- package/dist/pi-agent-ide.js +13 -34
- package/docs/agent-guides/ast-search.md +58 -0
- package/docs/agent-guides/debugger.md +1 -1
- package/docs/agent-guides/editing.md +29 -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 +24 -23
- package/node_modules/pi-agent-doctor/package.json +7 -7
- package/node_modules/pi-agent-doctor/runtime/entry-29.js +1 -0
- 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-30.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-33.js +1 -0
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-34.js +2 -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-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-36.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +15 -15
- package/node_modules/pi-agent-ide-ast/runtime/entry-37.js +1 -0
- 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-39.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-languages/runtime/entry-42.js +2 -0
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/runtime/entry-43.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-44.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-52.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-57.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-58.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/runtime/entry-62.js +1 -0
- 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-constant/runtime/entry-63.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-64.js +1 -0
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-65.js +2 -0
- 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-67.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/runtime/entry-83.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-84.js +2 -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/result-transfer.ts +2 -6
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +17 -36
- 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 +63 -74
- 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 +7 -10
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -10
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +8 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -8
- 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-85.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-86.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-87.js +1 -0
- package/node_modules/pi-agent-tool-ui/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
- package/node_modules/pi-agent-tool-ui/runtime/entry-89.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-image/runtime/entry-92.js +2 -0
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/runtime/entry-93.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-94.js +2 -0
- package/package.json +65 -58
- package/src/api/approval.ts +2 -0
- package/src/api/capabilities.ts +60 -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/capabilities.ts +252 -0
- package/src/composite/capability-schemas.ts +53 -0
- 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/responses-tools.ts +27 -9
- package/src/composite/settings-documentation.ts +1 -2
- package/src/composite/text-results.ts +61 -23
- package/src/composite/tool-availability.ts +28 -13
- 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-33.js +1 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-34.js +2 -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-35.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-36.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-31.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-image/runtime/entry-92.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-93.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-94.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-90.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-52.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-58.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 +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-57.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-constant/runtime/entry-63.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-64.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-65.js +2 -0
- 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-66.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-67.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-85.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-86.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 +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-84.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/result-transfer.ts +2 -6
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +17 -36
- 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 +63 -74
- 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 +7 -10
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -10
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +8 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -8
- 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 +12 -16
- package/src/plugins/pi-agent-ide-ast/package.json +15 -15
- package/src/plugins/pi-agent-ide-ast/runtime/entry-37.js +1 -0
- 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-39.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 +31 -13
- 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-languages/runtime/entry-42.js +2 -0
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/runtime/entry-43.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-44.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 +43 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +0 -18
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +0 -3
- 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-GBUJOR6V.js +0 -28
- 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-PT35ZFLH.js +0 -33
- 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-23.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-doctor/runtime/entry-23.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
- package/node_modules/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
- package/node_modules/pi-agent-filesystem-text/runtime/entry-33.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-changes/runtime/entry-36.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-37.js +0 -2
- package/node_modules/pi-agent-ide-languages/runtime/entry-39.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-pdf/runtime/entry-44.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-52.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-57.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-62.js +0 -2
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-63.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-64.js +0 -2
- package/node_modules/pi-agent-text-editor/runtime/entry-65.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-67.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-83.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-tool-ui/runtime/entry-86.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/node_modules/pi-agent-web-image/runtime/entry-89.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-jq/runtime/entry-31.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-33.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/plugins/pi-agent-web-pdf/runtime/entry-90.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-read/runtime/entry-47.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/plugins/pi-agent-search-text/runtime/entry-57.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-53.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-62.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-63.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-64.js +0 -2
- 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/extensions/pi-agent-text-editor/runtime/entry-67.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-changes/runtime/entry-36.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-37.js +0 -2
- package/src/plugins/pi-agent-ide-languages/runtime/entry-39.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-jq → pi-agent-filesystem}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-32.js +0 -0
- /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-pdf}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-38.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-40.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-41.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-image}/runtime/entry-45.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-46.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-47.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-read}/runtime/entry-51.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-53.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-56.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-search-text}/runtime/entry-61.js +0 -0
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-66.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web}/runtime/entry-90.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-91.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-32.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-91.js +0 -0
- /package/src/extensions/{pi-agent-search → pi-agent-read}/runtime/entry-51.js +0 -0
- /package/src/extensions/{pi-agent-text-editor/plugins/pi-agent-text-anchor-exact → pi-agent-search/plugins/pi-agent-search-text}/runtime/entry-61.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-38.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-40.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-41.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { connectResultTargets } from "pi-agent-resource";
|
|
2
|
+
import { connectResultImages, connectResultTargets } from "pi-agent-resource";
|
|
3
3
|
import { setMutationSnapshotReader } from "./mutation-result-targets.js";
|
|
4
4
|
import { registerTextEditOrigins } from "./text-edit-origin.js";
|
|
5
5
|
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
@@ -51,6 +51,7 @@ export default async function registerTextEditorCore(
|
|
|
51
51
|
interceptionRendering.clear();
|
|
52
52
|
});
|
|
53
53
|
const resultTargets = connectResultTargets(pi);
|
|
54
|
+
const resultImages = connectResultImages(pi);
|
|
54
55
|
const mutationTools = new Set<string>();
|
|
55
56
|
const core = createTextEditorCore((registration, editor) => {
|
|
56
57
|
mutationTools.add(registration.name);
|
|
@@ -62,13 +63,20 @@ export default async function registerTextEditorCore(
|
|
|
62
63
|
() => getLastResolvedResource(pi)?.source,
|
|
63
64
|
resultTargets,
|
|
64
65
|
pi.events,
|
|
66
|
+
resultImages,
|
|
65
67
|
),
|
|
66
68
|
);
|
|
67
69
|
}, resultTargets);
|
|
68
70
|
registerTextEditOrigins(pi, core);
|
|
69
71
|
setTextEditBatchRenderArgumentSink(core, interceptionRendering.resolveArguments);
|
|
70
72
|
core.onDidEdit((completion) => {
|
|
71
|
-
|
|
73
|
+
// A final formatting pass must not retire fresh mutation spans when it left the text unchanged.
|
|
74
|
+
const before = completion.beforePostProcessing ?? completion.before;
|
|
75
|
+
resultTargets.refresh(
|
|
76
|
+
completion.resourceSource,
|
|
77
|
+
completion.cwd,
|
|
78
|
+
before.content !== completion.after.content,
|
|
79
|
+
);
|
|
72
80
|
});
|
|
73
81
|
await core.registerPlugin({
|
|
74
82
|
protocol: TEXT_EDITOR_PROTOCOL,
|
|
@@ -98,11 +106,9 @@ export default async function registerTextEditorCore(
|
|
|
98
106
|
api.addFragmentResolver(createReadFragmentResolver(core));
|
|
99
107
|
|
|
100
108
|
api.describe({
|
|
101
|
-
path: "path#anchor —
|
|
102
|
-
offset:
|
|
103
|
-
|
|
104
|
-
limit:
|
|
105
|
-
"For source selections, limit caps each selected context window separately. Without limit, each selection supplies its natural line count, with at least one line.",
|
|
109
|
+
path: "path#anchor — text around a returned anchor, e.g. notes.txt#12#A4F0; SEARCH#… and RESULT#… go in as they are.",
|
|
110
|
+
offset: "For an anchor or result selection, counts from its line.",
|
|
111
|
+
limit: "For a selection, per selected window.",
|
|
106
112
|
});
|
|
107
113
|
},
|
|
108
114
|
});
|
|
@@ -24,9 +24,27 @@ export async function guardFileOperation(
|
|
|
24
24
|
context.signal?.throwIfAborted();
|
|
25
25
|
const source = await read(input.path);
|
|
26
26
|
const target = input.target === undefined ? undefined : await read(input.target);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
await guardFileChanges(
|
|
28
|
+
[
|
|
29
|
+
...(operation === "copy" ? [] : [{ before: source }]),
|
|
30
|
+
...(target === undefined ? [] : [{ before: target, after: source.bytes }]),
|
|
31
|
+
],
|
|
32
|
+
[source, ...(target === undefined ? [] : [target])],
|
|
33
|
+
context,
|
|
34
|
+
read,
|
|
35
|
+
guards,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Run the mutation policies over whole-file replacements; missing bytes after remove the file. */
|
|
40
|
+
export async function guardFileChanges(
|
|
41
|
+
changes: readonly { readonly before: FileGuardSnapshot; readonly after?: Uint8Array }[],
|
|
42
|
+
participants: readonly FileGuardSnapshot[],
|
|
43
|
+
context: TextMutationGuardContext,
|
|
44
|
+
read: (source: string) => Promise<FileGuardSnapshot>,
|
|
45
|
+
guards: readonly TextMutationGuardRegistration[],
|
|
46
|
+
): Promise<void> {
|
|
47
|
+
const resources = changes.map((change) => planResource(change.before, change.after));
|
|
30
48
|
for (const registration of guards) {
|
|
31
49
|
context.signal?.throwIfAborted();
|
|
32
50
|
const result = await registration.guard({ resources }, context);
|
|
@@ -37,7 +55,7 @@ export async function guardFileOperation(
|
|
|
37
55
|
});
|
|
38
56
|
}
|
|
39
57
|
context.signal?.throwIfAborted();
|
|
40
|
-
for (const snapshot of
|
|
58
|
+
for (const snapshot of participants) {
|
|
41
59
|
const current = await read(snapshot.source);
|
|
42
60
|
if (current.source !== snapshot.source || !sameBytes(current.bytes, snapshot.bytes))
|
|
43
61
|
throw Object.assign(new Error(`File changed during its mutation guard: ${snapshot.source}`), {
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import type { AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import type { ImageContent, ResultImageStore } from "pi-agent-resource";
|
|
6
|
+
import type { FileMutationBatchResult } from "#src/core/mutation-result/file-mutation-result.js";
|
|
7
|
+
|
|
8
|
+
const extensions: Readonly<Record<string, readonly string[]>> = {
|
|
9
|
+
"image/png": [".png"],
|
|
10
|
+
"image/jpeg": [".jpg", ".jpeg"],
|
|
11
|
+
"image/webp": [".webp"],
|
|
12
|
+
"image/gif": [".gif"],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** One image file a Write produces. */
|
|
16
|
+
export interface ImageFile {
|
|
17
|
+
readonly source: string;
|
|
18
|
+
readonly bytes: Uint8Array;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Plan the files for Write content that names images: a Codemode Read image value, or an issued
|
|
23
|
+
* Read result UUID/RESULT# reference. Returns undefined for ordinary text content.
|
|
24
|
+
* One image goes to the path itself; several go to `<name>-01.png`… beside it, or into a folder.
|
|
25
|
+
*/
|
|
26
|
+
export async function planImageWrite(
|
|
27
|
+
target: unknown,
|
|
28
|
+
content: unknown,
|
|
29
|
+
store: ResultImageStore | undefined,
|
|
30
|
+
cwd: string,
|
|
31
|
+
): Promise<readonly ImageFile[] | undefined> {
|
|
32
|
+
const images = typeof content === "string" ? store?.images(content, cwd) : contentImages(content);
|
|
33
|
+
if (images === undefined) return undefined;
|
|
34
|
+
if (images.length === 0) throw new Error("The result contains no images to write.");
|
|
35
|
+
if (typeof target !== "string" || target.length === 0)
|
|
36
|
+
throw new Error("Name the file to write the image to.");
|
|
37
|
+
if (/^[a-z][a-z\d+.-]+:/iu.test(target) && !target.startsWith("file://"))
|
|
38
|
+
throw new Error("Images can only be written to local files.");
|
|
39
|
+
const file = target.startsWith("file://") ? fileURLToPath(target) : path.resolve(cwd, target);
|
|
40
|
+
const extension = path.extname(file).toLowerCase();
|
|
41
|
+
const [first] = images;
|
|
42
|
+
if (images.length === 1 && first !== undefined) return [imageFile(file, extension, first)];
|
|
43
|
+
const folder =
|
|
44
|
+
/[\\/]$/u.test(target) || (await stat(file).catch(() => undefined))?.isDirectory() === true;
|
|
45
|
+
const named = !folder && Object.values(extensions).some((list) => list.includes(extension));
|
|
46
|
+
const base = folder ? path.join(file, "frame") : named ? file.slice(0, -extension.length) : file;
|
|
47
|
+
const width = Math.max(2, String(images.length).length);
|
|
48
|
+
return images.map((image, index) => {
|
|
49
|
+
const suffix = named ? extension : (extensions[image.mimeType]?.[0] ?? "");
|
|
50
|
+
return imageFile(`${base}-${String(index + 1).padStart(width, "0")}${suffix}`, suffix, image);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Report written image files; Codemode receives `{ ok, files }`. */
|
|
55
|
+
export function imageWriteResult(
|
|
56
|
+
files: readonly ImageFile[],
|
|
57
|
+
): AgentToolResult<FileMutationBatchResult> {
|
|
58
|
+
const sources = files.map((file) => file.source);
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: "text",
|
|
63
|
+
text: `Wrote ${files.length === 1 ? "image" : `${files.length} images`}:\n${sources.join("\n")}`,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
details: {
|
|
67
|
+
results: [],
|
|
68
|
+
metadata: {
|
|
69
|
+
semanticAction: {
|
|
70
|
+
kind: "direct-mutation",
|
|
71
|
+
ok: true,
|
|
72
|
+
effect: "applied",
|
|
73
|
+
source: sources[0],
|
|
74
|
+
files: sources,
|
|
75
|
+
script: { ok: true, files: sources },
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function imageFile(source: string, extension: string, image: ImageContent): ImageFile {
|
|
83
|
+
const allowed = extensions[image.mimeType];
|
|
84
|
+
if (allowed === undefined) throw new Error(`Cannot write ${image.mimeType} images.`);
|
|
85
|
+
if (!allowed.includes(extension))
|
|
86
|
+
throw new Error(`Name the file with ${allowed.join(" or ")} for a ${image.mimeType} image.`);
|
|
87
|
+
const bytes = Buffer.from(image.data, "base64");
|
|
88
|
+
if (bytes.length === 0 || bytes.toString("base64") !== image.data)
|
|
89
|
+
throw new Error("Image data is not valid base64.");
|
|
90
|
+
return { source, bytes };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Parse a Codemode Read image value; other values are not image content. */
|
|
94
|
+
function contentImages(content: unknown): ImageContent[] | undefined {
|
|
95
|
+
if (!isRecord(content)) return undefined;
|
|
96
|
+
const items: unknown[] | undefined =
|
|
97
|
+
content.type === "image"
|
|
98
|
+
? [content]
|
|
99
|
+
: content.type === "images" && Array.isArray(content.images)
|
|
100
|
+
? content.images
|
|
101
|
+
: undefined;
|
|
102
|
+
return items?.map((item) => {
|
|
103
|
+
if (!isRecord(item) || typeof item.data !== "string" || typeof item.mimeType !== "string")
|
|
104
|
+
throw new Error("Each image needs base64 data and a mimeType.");
|
|
105
|
+
return { type: "image", data: item.data, mimeType: item.mimeType };
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
110
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
111
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { requiredValue } from "pi-agent-invariant";
|
|
2
|
+
import type { ResourceErrorMetadata } from "pi-agent-resource";
|
|
2
3
|
import type { TextAnchorRecoveryCandidateRange, TextDocument } from "pi-agent-text";
|
|
3
4
|
|
|
4
5
|
export interface MutationAnchor {
|
|
@@ -74,6 +75,8 @@ export interface FileError {
|
|
|
74
75
|
reason?: string | undefined;
|
|
75
76
|
/** Editor failure code of the step that failed when `code` is a provider's own code. */
|
|
76
77
|
stage?: string | undefined;
|
|
78
|
+
/** Closed provider retry metadata, without private transport diagnostics. */
|
|
79
|
+
readonly metadata?: ResourceErrorMetadata;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
export interface Warning {
|
|
@@ -5,11 +5,7 @@ import type {
|
|
|
5
5
|
TextMutationEdit,
|
|
6
6
|
} from "#src/api/mutation-tool.js";
|
|
7
7
|
import { TextChangeDocument, type TextChange } from "./text-change-engine.js";
|
|
8
|
-
import {
|
|
9
|
-
anchorSpanRange,
|
|
10
|
-
insertionAfterAnchor,
|
|
11
|
-
replaceAnchorSpan,
|
|
12
|
-
} from "#src/tools/text-selection.js";
|
|
8
|
+
import { anchorSpanRange, insertionAfterAnchor } from "#src/tools/text-selection.js";
|
|
13
9
|
import { wholeFileResultSource } from "./result-input.js";
|
|
14
10
|
|
|
15
11
|
/** Distinguish structured source authority from ordinary paths and legacy anchors. */
|
|
@@ -176,7 +172,7 @@ export async function prepareResultTransfer(
|
|
|
176
172
|
);
|
|
177
173
|
planned.push({
|
|
178
174
|
target,
|
|
179
|
-
change:
|
|
175
|
+
change: { from: target.from, to: target.to, insert: copied },
|
|
180
176
|
});
|
|
181
177
|
}
|
|
182
178
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type, type Static } from "typebox";
|
|
2
2
|
import {
|
|
3
3
|
resultError,
|
|
4
|
+
resourceErrorMetadataOf,
|
|
4
5
|
structuredResultSchema,
|
|
5
6
|
withStructuredResult,
|
|
6
7
|
type StructuredResult,
|
|
@@ -128,12 +129,15 @@ export function mutationOutcome(
|
|
|
128
129
|
? "not-applied"
|
|
129
130
|
: (details.effect ?? "unknown"),
|
|
130
131
|
});
|
|
131
|
-
for (const error of data.errors ?? [])
|
|
132
|
+
for (const error of data.errors ?? []) {
|
|
133
|
+
const metadata = resourceErrorMetadataOf(error);
|
|
132
134
|
errors.push({
|
|
133
135
|
code: error.code ?? "MUTATION_FAILED",
|
|
134
136
|
message: error.reason ?? "Mutation failed",
|
|
135
137
|
source: error.path,
|
|
138
|
+
...(metadata === undefined ? {} : { metadata }),
|
|
136
139
|
});
|
|
140
|
+
}
|
|
137
141
|
if (data.ok === false && (data.errors?.length ?? 0) === 0)
|
|
138
142
|
errors.push({
|
|
139
143
|
code: "MUTATION_FAILED",
|
|
@@ -80,13 +80,21 @@ export class TextChangeDocument {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
public deleteLines(firstLine: number, lastLine: number): TextChange {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (range.to === this.content.length && range.from > 0 && !endsWithLineBreak(this.content)) {
|
|
86
|
-
return { from: previousLineBreakStart(this.content, range.from), to: range.to, insert: "" };
|
|
87
|
-
}
|
|
83
|
+
return this.replaceLines(firstLine, lastLine, "");
|
|
84
|
+
}
|
|
88
85
|
|
|
89
|
-
|
|
86
|
+
/** Insert at a character boundary; separators are added only when requested. */
|
|
87
|
+
public insertAt(from: number, text: string, separation?: LineSeparation): TextChange {
|
|
88
|
+
this.#assertRange({ from, to: from });
|
|
89
|
+
if (text.length === 0) throw new Error("Insert text must not be empty.");
|
|
90
|
+
if (separation === undefined) return { from, to: from, insert: text };
|
|
91
|
+
const prefix =
|
|
92
|
+
from > 0 && !endsWithLineBreak(this.content.slice(0, from)) ? this.#separator : "";
|
|
93
|
+
return {
|
|
94
|
+
from,
|
|
95
|
+
to: from,
|
|
96
|
+
insert: this.#lineInsertion(from, text, separation, from < this.content.length, prefix),
|
|
97
|
+
};
|
|
90
98
|
}
|
|
91
99
|
|
|
92
100
|
public insertBeforeLine(
|
|
@@ -94,13 +102,7 @@ export class TextChangeDocument {
|
|
|
94
102
|
text: string,
|
|
95
103
|
separation: LineSeparation = "line",
|
|
96
104
|
): TextChange {
|
|
97
|
-
this
|
|
98
|
-
const from = requiredValue(this.#lineStarts[lineNumber - 1]);
|
|
99
|
-
return {
|
|
100
|
-
from,
|
|
101
|
-
to: from,
|
|
102
|
-
insert: this.#lineInsertion(from, text, separation, from < this.content.length),
|
|
103
|
-
};
|
|
105
|
+
return this.insertAt(this.lineRange(lineNumber, lineNumber).from, text, separation);
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
public insertAfterLine(
|
|
@@ -108,24 +110,7 @@ export class TextChangeDocument {
|
|
|
108
110
|
text: string,
|
|
109
111
|
separation: LineSeparation = "line",
|
|
110
112
|
): TextChange {
|
|
111
|
-
this
|
|
112
|
-
const nextLine = this.#lineStarts[lineNumber];
|
|
113
|
-
|
|
114
|
-
if (nextLine !== undefined) {
|
|
115
|
-
return {
|
|
116
|
-
from: nextLine,
|
|
117
|
-
to: nextLine,
|
|
118
|
-
insert: this.#lineInsertion(nextLine, text, separation, nextLine < this.content.length),
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const prefix =
|
|
123
|
-
this.content.length > 0 && !endsWithLineBreak(this.content) ? this.#separator : "";
|
|
124
|
-
return {
|
|
125
|
-
from: this.content.length,
|
|
126
|
-
to: this.content.length,
|
|
127
|
-
insert: this.#lineInsertion(this.content.length, text, separation, false, prefix),
|
|
128
|
-
};
|
|
113
|
+
return this.insertAt(this.lineRange(lineNumber, lineNumber).to, text, separation);
|
|
129
114
|
}
|
|
130
115
|
|
|
131
116
|
public replaceAll(text: string): TextChange {
|
|
@@ -134,7 +119,7 @@ export class TextChangeDocument {
|
|
|
134
119
|
|
|
135
120
|
#replacementText(range: TextRange, text: string): string {
|
|
136
121
|
const selected = this.text(range);
|
|
137
|
-
return endsWithLineBreak(selected) && !endsWithLineBreak(text)
|
|
122
|
+
return text.length > 0 && endsWithLineBreak(selected) && !endsWithLineBreak(text)
|
|
138
123
|
? text + requiredValue(lineBreakOf(selected))
|
|
139
124
|
: text;
|
|
140
125
|
}
|
|
@@ -290,7 +275,3 @@ function endsWithLineBreak(text: string): boolean {
|
|
|
290
275
|
function lineBreakOf(text: string): "\n" | "\r\n" | undefined {
|
|
291
276
|
return text.endsWith("\r\n") ? "\r\n" : text.endsWith("\n") ? "\n" : undefined;
|
|
292
277
|
}
|
|
293
|
-
|
|
294
|
-
function previousLineBreakStart(text: string, offset: number): number {
|
|
295
|
-
return text[offset - 2] === "\r" && text[offset - 1] === "\n" ? offset - 2 : offset - 1;
|
|
296
|
-
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type ResultSourceTarget,
|
|
5
5
|
} from "pi-agent-resource";
|
|
6
6
|
import { TextSelectionAnchor } from "#src/api/text-selection-anchor.js";
|
|
7
|
+
import { withoutEmptyOptionalAnchors } from "#src/api/mutation-tool.js";
|
|
7
8
|
import { isResultInput } from "./result-transfer.js";
|
|
8
9
|
import {
|
|
9
10
|
committedMutationTargets,
|
|
@@ -119,12 +120,17 @@ export function registerTextEditBatching(pi: ExtensionAPI, core: TextEditorCore)
|
|
|
119
120
|
const definition: ToolBatchDefinition<TextBatchState> = {
|
|
120
121
|
sourceTools,
|
|
121
122
|
syntheticTool: "__pi_agent_text_editor_batch",
|
|
122
|
-
resolveCall(
|
|
123
|
-
const registration = registrations.get(
|
|
123
|
+
resolveCall(rawCall, inherited, context) {
|
|
124
|
+
const registration = registrations.get(rawCall.name);
|
|
124
125
|
|
|
125
126
|
if (registration === undefined) {
|
|
126
127
|
return;
|
|
127
128
|
}
|
|
129
|
+
// Batched calls bypass prepareArguments, so apply the same empty-anchor rule here.
|
|
130
|
+
const call = {
|
|
131
|
+
...rawCall,
|
|
132
|
+
arguments: withoutEmptyOptionalAnchors(registration.anchors, rawCall.arguments),
|
|
133
|
+
};
|
|
128
134
|
|
|
129
135
|
// Derived protocol targets need their owning execution pipeline, not snapshot batching.
|
|
130
136
|
const selectorFields = [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { lstat, readFile } from "node:fs/promises";
|
|
1
|
+
import { lstat, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
2
|
import type {
|
|
3
3
|
FileOperation,
|
|
4
4
|
FileOperationInput,
|
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
isUriSource,
|
|
11
11
|
type FileOperationContext,
|
|
12
12
|
} from "#src/core/file-operations.js";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
guardFileChanges,
|
|
15
|
+
guardFileOperation,
|
|
16
|
+
type FileGuardSnapshot,
|
|
17
|
+
} from "#src/core/file-operation-guards.js";
|
|
14
18
|
import path from "node:path";
|
|
15
19
|
import { deferPostEdit, collectPostEditNotifications } from "#src/core/post-edit-scope.js";
|
|
16
20
|
import { requiredValue } from "pi-agent-invariant";
|
|
@@ -211,6 +215,8 @@ interface PromptContribution {
|
|
|
211
215
|
readonly description: string;
|
|
212
216
|
readonly pluginId: string;
|
|
213
217
|
readonly tool: TextEditorToolId;
|
|
218
|
+
/** Schema field this text describes; absent for the tool description. */
|
|
219
|
+
readonly field?: string;
|
|
214
220
|
}
|
|
215
221
|
|
|
216
222
|
interface WritablePromptContribution {
|
|
@@ -386,6 +392,14 @@ export interface TextEditorCore {
|
|
|
386
392
|
signal?: AbortSignal,
|
|
387
393
|
deletion?: FileOperationContext,
|
|
388
394
|
): Promise<FileOperationResult>;
|
|
395
|
+
/**
|
|
396
|
+
* Replace whole local files with bytes after the mutation guards accept them; callers
|
|
397
|
+
* serialize it with enqueueFileOperation. A failure while writing has an unknown effect.
|
|
398
|
+
*/
|
|
399
|
+
writeFiles(
|
|
400
|
+
files: readonly { readonly source: string; readonly bytes: Uint8Array }[],
|
|
401
|
+
context: ResourceResolverContext,
|
|
402
|
+
): Promise<void>;
|
|
389
403
|
inspectTextAnchors(request: TextAnchorInspectionRequest): Promise<TextAnchorInspectionOutcome>;
|
|
390
404
|
addAnchorResolver(registration: TextAnchorResolverRegistration): void;
|
|
391
405
|
resolveTextAnchorResources(
|
|
@@ -442,6 +456,8 @@ export interface TextEditorCore {
|
|
|
442
456
|
/** Returns the configured number of lines around recovery candidates. */
|
|
443
457
|
recoveryContextLines(): number;
|
|
444
458
|
renderToolPromptGuideline(tool: TextEditorToolId): string | undefined;
|
|
459
|
+
/** Plugin text for one schema field of a tool, from active plugins only. */
|
|
460
|
+
renderToolFieldDescription(tool: TextEditorToolId, field: string): string | undefined;
|
|
445
461
|
}
|
|
446
462
|
|
|
447
463
|
/** Share issued-result authority with streamed anchor inspection, before tool-call normalization. */
|
|
@@ -746,6 +762,36 @@ export function createTextEditorCore(
|
|
|
746
762
|
[...fileOperationResolvers],
|
|
747
763
|
(kind, args) => guardOwnedFiles(kind, args, { cwd, signal }),
|
|
748
764
|
),
|
|
765
|
+
async writeFiles(files, context) {
|
|
766
|
+
const read = (source: string) =>
|
|
767
|
+
readFileGuardSnapshot(
|
|
768
|
+
source,
|
|
769
|
+
context,
|
|
770
|
+
[...resolvers].sort(
|
|
771
|
+
(left, right) => left.priority - right.priority || left.order - right.order,
|
|
772
|
+
),
|
|
773
|
+
);
|
|
774
|
+
const changes = await Promise.all(
|
|
775
|
+
files.map(async (file) => ({ before: await read(file.source), after: file.bytes })),
|
|
776
|
+
);
|
|
777
|
+
await guardFileChanges(
|
|
778
|
+
changes,
|
|
779
|
+
changes.map((change) => change.before),
|
|
780
|
+
{ ...context, intent: "edit" },
|
|
781
|
+
read,
|
|
782
|
+
[...mutationGuards],
|
|
783
|
+
);
|
|
784
|
+
try {
|
|
785
|
+
for (const file of files) {
|
|
786
|
+
await mkdir(path.dirname(file.source), { recursive: true });
|
|
787
|
+
await writeFile(file.source, file.bytes, { signal: context.signal });
|
|
788
|
+
}
|
|
789
|
+
} catch (error) {
|
|
790
|
+
throw Object.assign(error instanceof Error ? error : new Error(String(error)), {
|
|
791
|
+
effect: "unknown",
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
},
|
|
749
795
|
addAnchorResolver(registration): void {
|
|
750
796
|
if (!isTextAnchorResolverRegistration(registration)) {
|
|
751
797
|
throw new TypeError("Invalid text anchor resolver");
|
|
@@ -1088,7 +1134,9 @@ export function createTextEditorCore(
|
|
|
1088
1134
|
|
|
1089
1135
|
const contribution = promptContributions.find(
|
|
1090
1136
|
(candidate) =>
|
|
1091
|
-
candidate.pluginId === registeredPlugin.plugin.id &&
|
|
1137
|
+
candidate.pluginId === registeredPlugin.plugin.id &&
|
|
1138
|
+
candidate.tool === tool &&
|
|
1139
|
+
candidate.field === undefined,
|
|
1092
1140
|
);
|
|
1093
1141
|
|
|
1094
1142
|
if (contribution !== undefined) {
|
|
@@ -1098,6 +1146,28 @@ export function createTextEditorCore(
|
|
|
1098
1146
|
|
|
1099
1147
|
return entries.length === 0 ? undefined : entries.join("\n");
|
|
1100
1148
|
},
|
|
1149
|
+
renderToolFieldDescription(tool, field): string | undefined {
|
|
1150
|
+
const entries: string[] = [];
|
|
1151
|
+
|
|
1152
|
+
for (const registeredPlugin of plugins.values()) {
|
|
1153
|
+
if (registeredPlugin.lifecycle.status !== "active") {
|
|
1154
|
+
continue;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
const contribution = promptContributions.find(
|
|
1158
|
+
(candidate) =>
|
|
1159
|
+
candidate.pluginId === registeredPlugin.plugin.id &&
|
|
1160
|
+
candidate.tool === tool &&
|
|
1161
|
+
candidate.field === field,
|
|
1162
|
+
);
|
|
1163
|
+
|
|
1164
|
+
if (contribution !== undefined) {
|
|
1165
|
+
entries.push(contribution.description);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
return entries.length === 0 ? undefined : entries.join(" ");
|
|
1170
|
+
},
|
|
1101
1171
|
async waitForPendingPlugins(): Promise<void> {
|
|
1102
1172
|
await Promise.all(pendingPlugins);
|
|
1103
1173
|
},
|
|
@@ -2350,6 +2420,22 @@ function createPluginContributionController(
|
|
|
2350
2420
|
throw new Error(`Plugin ${pluginId} API is closed`);
|
|
2351
2421
|
}
|
|
2352
2422
|
};
|
|
2423
|
+
const addPromptContribution = (contribution: PromptContribution): void => {
|
|
2424
|
+
if (state === "setup") {
|
|
2425
|
+
assertNoDraftDescription(setupDraft.promptContributions, contribution);
|
|
2426
|
+
setupDraft.promptContributions.push(contribution);
|
|
2427
|
+
return;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
registerContributions({
|
|
2431
|
+
resolvers: [],
|
|
2432
|
+
anchorResolvers: [],
|
|
2433
|
+
handlers: [],
|
|
2434
|
+
promptContributions: [contribution],
|
|
2435
|
+
writablePromptContributions: [],
|
|
2436
|
+
tools: [],
|
|
2437
|
+
});
|
|
2438
|
+
};
|
|
2353
2439
|
const createToolApi = (tool: TextEditorToolId): TextEditorToolPluginApi => ({
|
|
2354
2440
|
addSemanticHandler(handler): void {
|
|
2355
2441
|
assertAvailable();
|
|
@@ -2401,25 +2487,22 @@ function createPluginContributionController(
|
|
|
2401
2487
|
},
|
|
2402
2488
|
describe(description): void {
|
|
2403
2489
|
assertAvailable();
|
|
2404
|
-
|
|
2490
|
+
addPromptContribution({
|
|
2405
2491
|
description: normalizeDescription(`Plugin prompt description for ${tool}`, description),
|
|
2406
2492
|
pluginId,
|
|
2407
2493
|
tool,
|
|
2408
|
-
};
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
promptContributions: [contribution],
|
|
2421
|
-
writablePromptContributions: [],
|
|
2422
|
-
tools: [],
|
|
2494
|
+
});
|
|
2495
|
+
},
|
|
2496
|
+
describeField(field, description): void {
|
|
2497
|
+
assertAvailable();
|
|
2498
|
+
addPromptContribution({
|
|
2499
|
+
description: normalizeDescription(
|
|
2500
|
+
`Plugin prompt description for ${tool}.${field}`,
|
|
2501
|
+
description,
|
|
2502
|
+
),
|
|
2503
|
+
pluginId,
|
|
2504
|
+
tool,
|
|
2505
|
+
field,
|
|
2423
2506
|
});
|
|
2424
2507
|
},
|
|
2425
2508
|
});
|
|
@@ -2845,7 +2928,7 @@ function handlerKey(handler: RegisteredHandler): string {
|
|
|
2845
2928
|
}
|
|
2846
2929
|
|
|
2847
2930
|
function descriptionKey(contribution: PromptContribution): string {
|
|
2848
|
-
return `${contribution.pluginId}\0${contribution.tool}`;
|
|
2931
|
+
return `${contribution.pluginId}\0${contribution.tool}\0${contribution.field ?? ""}`;
|
|
2849
2932
|
}
|
|
2850
2933
|
|
|
2851
2934
|
function normalizeDescriptionSource(value: unknown): PromptDescriptionSource {
|