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
|
@@ -9,16 +9,28 @@ import type {
|
|
|
9
9
|
AgentToolResult,
|
|
10
10
|
} from "@earendil-works/pi-coding-agent";
|
|
11
11
|
import type { JsonValue } from "@earendil-works/pi-ai";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
connectResultImages,
|
|
14
|
+
connectResultTargets,
|
|
15
|
+
resultErrorSchema,
|
|
16
|
+
TempResourceStore,
|
|
17
|
+
} from "pi-agent-resource";
|
|
18
|
+
import { Type } from "typebox";
|
|
19
|
+
import { Value } from "typebox/value";
|
|
13
20
|
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
14
21
|
import { READ_PROTOCOL, READ_API_VERSION } from "pi-agent-read/api/plugin-protocol";
|
|
15
22
|
import { limitIdeOutput } from "./output-limits.js";
|
|
16
23
|
import { searchFacts, searchFactsSchema } from "./search-facts.js";
|
|
17
24
|
|
|
25
|
+
/** Tools whose Codemode value is `{ result, hasMatches, complete }`. */
|
|
26
|
+
const searchTools = new Set(["search", "ast_search", "lsp_search", "file_search"]);
|
|
27
|
+
|
|
18
28
|
const sourceFields: Record<string, readonly string[]> = {
|
|
19
29
|
read: ["path"],
|
|
20
30
|
search: ["path"],
|
|
21
|
-
|
|
31
|
+
ast_search: ["path"],
|
|
32
|
+
lsp_search: ["path"],
|
|
33
|
+
file_search: ["path"],
|
|
22
34
|
replace: ["path"],
|
|
23
35
|
insert: ["path"],
|
|
24
36
|
delete: ["path"],
|
|
@@ -52,12 +64,20 @@ const imageBlockSchema = {
|
|
|
52
64
|
},
|
|
53
65
|
required: ["type", "data", "mimeType", "note"],
|
|
54
66
|
};
|
|
67
|
+
const readFailureSchema = Type.Object(
|
|
68
|
+
{
|
|
69
|
+
status: Type.Literal("error"),
|
|
70
|
+
errors: Type.Array(resultErrorSchema, { minItems: 1 }),
|
|
71
|
+
},
|
|
72
|
+
{ additionalProperties: false },
|
|
73
|
+
);
|
|
55
74
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
75
|
+
* Read resolves to text, native image blocks or the public failure envelope.
|
|
76
|
+
* Successful image notes carry the same readable, composable result text.
|
|
58
77
|
*/
|
|
59
78
|
const readValueSchema = {
|
|
60
79
|
anyOf: [
|
|
80
|
+
readFailureSchema,
|
|
61
81
|
{ type: "string" },
|
|
62
82
|
imageBlockSchema,
|
|
63
83
|
{
|
|
@@ -102,12 +122,23 @@ function record(value: unknown): value is Record<string, unknown> {
|
|
|
102
122
|
return value !== null && typeof value === "object";
|
|
103
123
|
}
|
|
104
124
|
|
|
125
|
+
/** Project only validated public errors; discard private Read data and renderer details. */
|
|
126
|
+
function readFailure(outcome: unknown): JsonValue | undefined {
|
|
127
|
+
if (!record(outcome) || outcome.status !== "error") return undefined;
|
|
128
|
+
const failure = { status: "error", errors: outcome.errors };
|
|
129
|
+
return Value.Check(readFailureSchema, failure) ? failure : undefined;
|
|
130
|
+
}
|
|
105
131
|
/** Keep tool records private while strings carry registered composition references. */
|
|
106
|
-
export function createIdeTextResults(
|
|
132
|
+
export function createIdeTextResults(
|
|
133
|
+
pi: ExtensionAPI,
|
|
134
|
+
options: { readonly resourceOutput?: boolean; readonly promptSection?: string } = {},
|
|
135
|
+
) {
|
|
107
136
|
const store = connectResultTargets(pi);
|
|
137
|
+
const resultImages = connectResultImages(pi);
|
|
108
138
|
const names = new Set<string>();
|
|
109
139
|
const outputs = new TempResourceStore();
|
|
110
|
-
const saveFullOutput = (text: string) =>
|
|
140
|
+
const saveFullOutput = (text: string) =>
|
|
141
|
+
options.resourceOutput ? outputs.save(text) : outputs.saveFile(text);
|
|
111
142
|
const contextErrors = new Map<
|
|
112
143
|
string,
|
|
113
144
|
{ source: string; content: Promise<AgentToolResult<unknown>["content"]> }
|
|
@@ -136,6 +167,17 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
136
167
|
id: "ide-output-retention",
|
|
137
168
|
setup(api) {
|
|
138
169
|
api.setOutputSaver(saveFullOutput);
|
|
170
|
+
if (options.resourceOutput)
|
|
171
|
+
api.addResolver({
|
|
172
|
+
priority: -1000,
|
|
173
|
+
resolver: {
|
|
174
|
+
id: "ide-output-retention",
|
|
175
|
+
async tryResolve(source, context) {
|
|
176
|
+
const result = await outputs.resolver.tryResolve(source, context);
|
|
177
|
+
return result.kind === "failed" ? { kind: "not-handled" } : result;
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
});
|
|
139
181
|
},
|
|
140
182
|
});
|
|
141
183
|
pi.on("session_shutdown", () => outputs.dispose());
|
|
@@ -187,8 +229,8 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
187
229
|
pi.on("session_start", clear);
|
|
188
230
|
pi.on("session_shutdown", clear);
|
|
189
231
|
pi.on("before_agent_start", (event) => {
|
|
190
|
-
event.systemPromptOptions.sections.ide_results =
|
|
191
|
-
|
|
232
|
+
event.systemPromptOptions.sections[options.promptSection ?? "ide_results"] =
|
|
233
|
+
'Direct IDE calls return readable text. In Codemode, search tools return { result, hasMatches, complete }; pass its result string to other tools for composition. An image Read returns an image block: show it with image(), pass it to models.classify() images, and pass its note string to other tools. A completed Read failure returns { status: "error", errors }; inspect errors before using its value. Successful text Reads and other text tools return strings. The leading system-result envelope is an internal reference, not file content; do not edit it. Compose tools by passing the unchanged result string to a source parameter. Outside Codemode, pass the same text or its UUID. Store/load preserves results within the session. Use returned anchors to choose individual selections. Changed snapshots and previous sessions cannot be reused.';
|
|
192
234
|
});
|
|
193
235
|
pi.on("tool_execution_start", (event) => {
|
|
194
236
|
if (event.parentToolCallId !== undefined)
|
|
@@ -224,17 +266,6 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
224
266
|
} else input[field] = source;
|
|
225
267
|
}
|
|
226
268
|
}
|
|
227
|
-
if (
|
|
228
|
-
event.toolName === "select" &&
|
|
229
|
-
input.operation &&
|
|
230
|
-
typeof input.operation === "object" &&
|
|
231
|
-
"scopes" in input.operation
|
|
232
|
-
) {
|
|
233
|
-
input.operation = {
|
|
234
|
-
...input.operation,
|
|
235
|
-
scopes: store.source(input.operation.scopes, context.cwd),
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
269
|
for (const field of ["text", "content"]) {
|
|
239
270
|
const value = input[field];
|
|
240
271
|
if (
|
|
@@ -259,7 +290,7 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
259
290
|
const descriptors = Object.getOwnPropertyDescriptors(definition);
|
|
260
291
|
// Keep readable composition strings except for explicitly declared public script values.
|
|
261
292
|
delete descriptors.outputSchema;
|
|
262
|
-
if (definition.name
|
|
293
|
+
if (searchTools.has(definition.name))
|
|
263
294
|
descriptors.outputSchema = {
|
|
264
295
|
value: searchFactsSchema,
|
|
265
296
|
enumerable: true,
|
|
@@ -429,15 +460,22 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
429
460
|
? original
|
|
430
461
|
: `${original}\n\nThis result has no verified text selection: ${targetUnavailable}\nRead/Search the file before the next edit; do not repeat the applied edit.`;
|
|
431
462
|
const resources = resultResources(outcome);
|
|
432
|
-
const shown = store.publish(outcome, readable, context.cwd, resources);
|
|
433
463
|
const succeeded = !event.isError && outcome.status !== "error";
|
|
464
|
+
const shown = store.publish(outcome, readable, context.cwd, resources);
|
|
465
|
+
resultImages.keep(
|
|
466
|
+
shown,
|
|
467
|
+
context.cwd,
|
|
468
|
+
event.toolName === "read" && succeeded
|
|
469
|
+
? event.content.filter((block): block is ImageBlock => block.type === "image")
|
|
470
|
+
: [],
|
|
471
|
+
);
|
|
434
472
|
const value =
|
|
435
|
-
event.toolName
|
|
473
|
+
searchTools.has(event.toolName) && succeeded
|
|
436
474
|
? searchFacts(outcome, shown)
|
|
437
475
|
: event.toolName === "read"
|
|
438
476
|
? succeeded
|
|
439
477
|
? readValue(event.content, shown)
|
|
440
|
-
:
|
|
478
|
+
: readFailure(record)
|
|
441
479
|
: providerValue(event.details);
|
|
442
480
|
const parent = parents.get(event.toolCallId);
|
|
443
481
|
parents.delete(event.toolCallId);
|
|
@@ -18,9 +18,16 @@ interface RegistrationRequest {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const READ_RECORD = "agent-documentation-read";
|
|
21
|
+
interface DocumentationHistory {
|
|
22
|
+
readonly recordType?: string;
|
|
23
|
+
readonly ownsTool?: (name: unknown) => boolean;
|
|
24
|
+
}
|
|
21
25
|
|
|
22
26
|
/** Exposes packaged guides and adds unread guides to results without blocking tools. */
|
|
23
|
-
export default async function registerProgressiveDocumentation(
|
|
27
|
+
export default async function registerProgressiveDocumentation(
|
|
28
|
+
pi: ExtensionAPI,
|
|
29
|
+
history: DocumentationHistory = {},
|
|
30
|
+
): Promise<void> {
|
|
24
31
|
const registry = new AgentDocumentationRegistry();
|
|
25
32
|
const claimed = new Set<string>();
|
|
26
33
|
const parents = new Map<string, string>();
|
|
@@ -29,7 +36,7 @@ export default async function registerProgressiveDocumentation(pi: ExtensionAPI)
|
|
|
29
36
|
const unread = ids.filter((id) => !claimed.has(id));
|
|
30
37
|
if (unread.length === 0) return;
|
|
31
38
|
// Separate records survive bounded nested-call metadata and stay on their own branch.
|
|
32
|
-
pi.appendEntry(READ_RECORD, { ids: unread });
|
|
39
|
+
pi.appendEntry(history.recordType ?? READ_RECORD, { ids: unread });
|
|
33
40
|
for (const id of unread) claimed.add(id);
|
|
34
41
|
};
|
|
35
42
|
const unsubscribe = pi.events.on(DOCUMENTATION_REGISTER_EVENT, (value) => {
|
|
@@ -72,7 +79,7 @@ export default async function registerProgressiveDocumentation(pi: ExtensionAPI)
|
|
|
72
79
|
path: () =>
|
|
73
80
|
registry.list().length === 0
|
|
74
81
|
? undefined
|
|
75
|
-
: "docs:
|
|
82
|
+
: "docs: — list of guides; docs:<id> — one guide.",
|
|
76
83
|
});
|
|
77
84
|
api.addPromptGuideline(() => renderPromptGuideline(registry.list()));
|
|
78
85
|
},
|
|
@@ -88,13 +95,13 @@ export default async function registerProgressiveDocumentation(pi: ExtensionAPI)
|
|
|
88
95
|
},
|
|
89
96
|
});
|
|
90
97
|
pi.on("session_start", (_event, context) => {
|
|
91
|
-
restoreClaims(context.sessionManager.getBranch(), registry, claimed);
|
|
98
|
+
restoreClaims(context.sessionManager.getBranch(), registry, claimed, history);
|
|
92
99
|
});
|
|
93
100
|
pi.on("session_tree", (_event, context) => {
|
|
94
|
-
restoreClaims(context.sessionManager.getBranch(), registry, claimed);
|
|
101
|
+
restoreClaims(context.sessionManager.getBranch(), registry, claimed, history);
|
|
95
102
|
});
|
|
96
103
|
pi.on("session_compact", (_event, context) => {
|
|
97
|
-
restoreClaims(context.sessionManager.getBranch(), registry, claimed);
|
|
104
|
+
restoreClaims(context.sessionManager.getBranch(), registry, claimed, history);
|
|
98
105
|
});
|
|
99
106
|
|
|
100
107
|
pi.on("tool_call", (event) => {
|
|
@@ -119,11 +126,14 @@ export default async function registerProgressiveDocumentation(pi: ExtensionAPI)
|
|
|
119
126
|
structuredContent: event.structuredContent,
|
|
120
127
|
details: {
|
|
121
128
|
...(isRecord(event.details) ? event.details : {}),
|
|
122
|
-
documentation:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
documentation: {
|
|
130
|
+
owner: history.recordType ?? READ_RECORD,
|
|
131
|
+
...(known
|
|
132
|
+
? id.length === 0
|
|
133
|
+
? { kind: "list", ids: registry.list().map((document) => document.id) }
|
|
134
|
+
: { kind: "document", id }
|
|
135
|
+
: { kind: "error", code: "UNKNOWN_DOCUMENTATION", id }),
|
|
136
|
+
},
|
|
127
137
|
},
|
|
128
138
|
isError: event.isError,
|
|
129
139
|
};
|
|
@@ -152,7 +162,11 @@ export default async function registerProgressiveDocumentation(pi: ExtensionAPI)
|
|
|
152
162
|
structuredContent: event.structuredContent,
|
|
153
163
|
details: {
|
|
154
164
|
...(isRecord(event.details) ? event.details : {}),
|
|
155
|
-
documentation: {
|
|
165
|
+
documentation: {
|
|
166
|
+
owner: history.recordType ?? READ_RECORD,
|
|
167
|
+
kind: "attachment",
|
|
168
|
+
ids: documents.map((document) => document.id),
|
|
169
|
+
},
|
|
156
170
|
},
|
|
157
171
|
isError: event.isError,
|
|
158
172
|
};
|
|
@@ -176,8 +190,7 @@ function renderListing(documents: readonly AgentDocumentation[]): string {
|
|
|
176
190
|
function renderPromptGuideline(documents: readonly AgentDocumentation[]): string | undefined {
|
|
177
191
|
if (documents.length === 0) return undefined;
|
|
178
192
|
return [
|
|
179
|
-
"
|
|
180
|
-
"If a result includes a Guide, read it before your next use. The call has already run: do not repeat it just to obtain documentation. Nested calls keep their guides on the parent result, even when the script does not print the child output.",
|
|
193
|
+
"Before using a tool or feature that has a guide below, read its docs:<id> once.",
|
|
181
194
|
"Available documents:",
|
|
182
195
|
...documents.map((document) => ` - ${document.id} — ${document.description}`),
|
|
183
196
|
].join("\n");
|
|
@@ -187,19 +200,30 @@ function restoreClaims(
|
|
|
187
200
|
branch: readonly unknown[],
|
|
188
201
|
registry: AgentDocumentationRegistry,
|
|
189
202
|
claimed: Set<string>,
|
|
203
|
+
history: DocumentationHistory,
|
|
190
204
|
): void {
|
|
191
205
|
claimed.clear();
|
|
192
206
|
for (const entry of branch) {
|
|
193
207
|
if (!isRecord(entry)) continue;
|
|
194
|
-
if (
|
|
208
|
+
if (
|
|
209
|
+
entry.type === "custom" &&
|
|
210
|
+
entry.customType === (history.recordType ?? READ_RECORD) &&
|
|
211
|
+
isRecord(entry.data)
|
|
212
|
+
) {
|
|
195
213
|
addIds(entry.data.ids);
|
|
196
214
|
continue;
|
|
197
215
|
}
|
|
198
216
|
if (entry.type !== "message" || !isRecord(entry.message)) continue;
|
|
199
217
|
const message = entry.message;
|
|
218
|
+
if (history.ownsTool !== undefined && !history.ownsTool(message.toolName)) continue;
|
|
200
219
|
if (message.role !== "toolResult" || !isRecord(message.details)) continue;
|
|
201
220
|
const documentation = message.details.documentation;
|
|
202
221
|
if (!isRecord(documentation)) continue;
|
|
222
|
+
if (
|
|
223
|
+
documentation.owner !== undefined &&
|
|
224
|
+
documentation.owner !== (history.recordType ?? READ_RECORD)
|
|
225
|
+
)
|
|
226
|
+
continue;
|
|
203
227
|
if (documentation.kind === "attachment") addIds(documentation.ids);
|
|
204
228
|
if (
|
|
205
229
|
documentation.kind === "document" &&
|
|
@@ -39,7 +39,7 @@ export default async function registerFilesystemPlugin(pi: ExtensionAPI): Promis
|
|
|
39
39
|
api.describe({
|
|
40
40
|
path: () =>
|
|
41
41
|
renderContentDescription(
|
|
42
|
-
"File
|
|
42
|
+
"File — content; directory — listing.",
|
|
43
43
|
readHost.listDescriptions(),
|
|
44
44
|
),
|
|
45
45
|
});
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.
|
|
10
|
-
"pi-agent-invariant": "0.
|
|
11
|
-
"pi-agent-read": "0.
|
|
12
|
-
"pi-agent-resource": "0.
|
|
13
|
-
"pi-agent-text": "0.
|
|
14
|
-
"pi-agent-text-editor": "0.
|
|
9
|
+
"pi-agent-image": "0.9.0",
|
|
10
|
+
"pi-agent-invariant": "0.9.0",
|
|
11
|
+
"pi-agent-read": "0.9.0",
|
|
12
|
+
"pi-agent-resource": "0.9.0",
|
|
13
|
+
"pi-agent-text": "0.9.0",
|
|
14
|
+
"pi-agent-text-editor": "0.9.0"
|
|
15
15
|
},
|
|
16
16
|
"pi": {
|
|
17
17
|
"extensions": [
|
|
18
|
-
"./runtime/entry-
|
|
18
|
+
"./runtime/entry-30.js"
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.
|
|
10
|
-
"pi-agent-resource": "0.
|
|
9
|
+
"pi-agent-image": "0.9.0",
|
|
10
|
+
"pi-agent-resource": "0.9.0"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
14
|
-
"./runtime/entry-
|
|
14
|
+
"./runtime/entry-31.js"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
@@ -6,26 +6,15 @@ import {
|
|
|
6
6
|
DOCTOR_PROTOCOL,
|
|
7
7
|
type DoctorPlugin,
|
|
8
8
|
} from "pi-agent-doctor/api/plugin-protocol";
|
|
9
|
-
import { connectAgentDocumentation, loadPackagedAgentGuide } from "pi-agent-documentation";
|
|
10
9
|
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
11
10
|
import {
|
|
12
11
|
READ_API_VERSION,
|
|
13
12
|
READ_PROTOCOL,
|
|
14
13
|
type ReadPlugin,
|
|
15
14
|
} from "pi-agent-read/api/plugin-protocol";
|
|
16
|
-
import
|
|
17
|
-
import { createTextDocument } from "pi-agent-text";
|
|
18
|
-
|
|
19
|
-
import { executeJq, parseJqView } from "#src/jq.js";
|
|
15
|
+
import { createJqReadHandler } from "#src/api/jq.js";
|
|
20
16
|
|
|
21
17
|
export default async function registerFilesystemJq(pi: ExtensionAPI): Promise<void> {
|
|
22
|
-
connectAgentDocumentation(pi, [
|
|
23
|
-
await loadPackagedAgentGuide({
|
|
24
|
-
id: "json-reading",
|
|
25
|
-
description: "Query and transform JSON resources with jq read views",
|
|
26
|
-
triggers: [{ tool: "read", viewPrefixes: ["jq:"] }],
|
|
27
|
-
}),
|
|
28
|
-
]);
|
|
29
18
|
await Promise.all([connectReadPlugin(pi, readPlugin), connectDoctorPlugin(pi, doctorPlugin)]);
|
|
30
19
|
}
|
|
31
20
|
|
|
@@ -38,74 +27,31 @@ const readPlugin = {
|
|
|
38
27
|
view: "jq",
|
|
39
28
|
presenter: { id: "filesystem-jq", present: (document) => document },
|
|
40
29
|
});
|
|
30
|
+
const jq = createJqReadHandler({
|
|
31
|
+
pluginId: "filesystem-jq",
|
|
32
|
+
input: (context) =>
|
|
33
|
+
context.state?.contentKind === "text" ? context.state.content[0].text : undefined,
|
|
34
|
+
});
|
|
41
35
|
api.addHandler({
|
|
42
36
|
stage: "read",
|
|
43
37
|
when: { resolvedBy: "any", contentKind: "text" },
|
|
44
|
-
|
|
38
|
+
handler(context) {
|
|
45
39
|
const state = context.state;
|
|
46
40
|
if (
|
|
47
41
|
state?.contentKind !== "text" ||
|
|
48
42
|
(state.resolvedBy !== "filesystem" && state.resolvedBy !== "ssh")
|
|
49
43
|
)
|
|
50
44
|
return { kind: "continue", context };
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
selected = parseJqView(context.request.views);
|
|
54
|
-
} catch (error) {
|
|
55
|
-
return jqFailure(state, error instanceof Error ? error.message : String(error));
|
|
56
|
-
}
|
|
57
|
-
if (selected === undefined) return { kind: "continue", context };
|
|
58
|
-
let output: string;
|
|
59
|
-
try {
|
|
60
|
-
output = await executeJq(selected.filter, state.content[0].text, {
|
|
61
|
-
cwd: context.resolverContext.cwd,
|
|
62
|
-
...(context.resolverContext.signal === undefined
|
|
63
|
-
? {}
|
|
64
|
-
: { signal: context.resolverContext.signal }),
|
|
65
|
-
});
|
|
66
|
-
} catch (error) {
|
|
67
|
-
return jqFailure(state, error instanceof Error ? error.message : String(error));
|
|
68
|
-
}
|
|
69
|
-
const transformed: ReadTextState = {
|
|
70
|
-
...state,
|
|
71
|
-
content: [{ type: "text", text: output }],
|
|
72
|
-
text: createTextDocument(state.source, output),
|
|
73
|
-
preserveTruncatedOutput: true,
|
|
74
|
-
};
|
|
75
|
-
return {
|
|
76
|
-
kind: "continue",
|
|
77
|
-
context: { ...context, sourceText: undefined, state: transformed },
|
|
78
|
-
};
|
|
45
|
+
return jq(context);
|
|
79
46
|
},
|
|
80
47
|
});
|
|
81
48
|
api.describe({
|
|
82
49
|
views:
|
|
83
|
-
|
|
50
|
+
"jq:<filter> — run jq on a JSON file or a resource whose provider supplies JSON (JSONL record by record); use alone; offset and limit apply to its output.",
|
|
84
51
|
});
|
|
85
52
|
},
|
|
86
53
|
} satisfies ReadPlugin;
|
|
87
54
|
|
|
88
|
-
function jqFailure(state: ReadTextState, message: string) {
|
|
89
|
-
return {
|
|
90
|
-
kind: "return" as const,
|
|
91
|
-
result: {
|
|
92
|
-
content: [{ type: "text" as const, text: `jq failed: ${message}` }],
|
|
93
|
-
details: {
|
|
94
|
-
source: state.source,
|
|
95
|
-
resolvedBy: state.resolvedBy,
|
|
96
|
-
failure: {
|
|
97
|
-
code: "READ_FAILED" as const,
|
|
98
|
-
source: state.source,
|
|
99
|
-
resolverId: state.resolvedBy,
|
|
100
|
-
pluginId: "filesystem-jq",
|
|
101
|
-
stage: "read" as const,
|
|
102
|
-
message,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
isError: true,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
55
|
const doctorPlugin = {
|
|
110
56
|
protocol: DOCTOR_PROTOCOL,
|
|
111
57
|
apiVersion: DOCTOR_API_VERSION,
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-jq",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
|
+
"exports": {
|
|
9
|
+
"./api/jq": {
|
|
10
|
+
"types": "./src/api/jq.ts",
|
|
11
|
+
"default": "./runtime/entry-32.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
8
14
|
"dependencies": {
|
|
9
|
-
"pi-agent-doctor": "0.
|
|
10
|
-
"pi-agent-documentation": "0.
|
|
11
|
-
"pi-agent-read": "0.
|
|
12
|
-
"pi-agent-text": "0.
|
|
15
|
+
"pi-agent-doctor": "0.9.0",
|
|
16
|
+
"pi-agent-documentation": "0.9.0",
|
|
17
|
+
"pi-agent-read": "0.9.0",
|
|
18
|
+
"pi-agent-text": "0.9.0"
|
|
13
19
|
},
|
|
14
20
|
"pi": {
|
|
15
21
|
"extensions": [
|
|
16
|
-
"./runtime/entry-
|
|
22
|
+
"./runtime/entry-33.js"
|
|
17
23
|
]
|
|
18
24
|
},
|
|
19
25
|
"peerDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../../../../../dist/entry-32.js";
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ReadFailure,
|
|
3
|
+
ReadHandler,
|
|
4
|
+
ReadPipelineContext,
|
|
5
|
+
ReadStageOutcome,
|
|
6
|
+
ReadTextState,
|
|
7
|
+
} from "pi-agent-read/api/tools/read";
|
|
8
|
+
import { createTextDocument } from "pi-agent-text";
|
|
9
|
+
|
|
10
|
+
import { executeJq, parseJqView } from "#src/jq.js";
|
|
11
|
+
|
|
12
|
+
export interface JqReadHandlerOptions {
|
|
13
|
+
readonly pluginId: string;
|
|
14
|
+
/**
|
|
15
|
+
* Return immutable JSON acquired for this block, not rendered text or another read.
|
|
16
|
+
* Called only after the host classifies the input as a complete source.
|
|
17
|
+
*/
|
|
18
|
+
readonly input: (context: ReadPipelineContext) => string | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Transform acquired JSON without granting original-text authority.
|
|
23
|
+
* Register the jq view and scope this read-stage handler to the input provider's resolvers.
|
|
24
|
+
*/
|
|
25
|
+
export function createJqReadHandler(options: JqReadHandlerOptions): ReadHandler {
|
|
26
|
+
return async (context) => {
|
|
27
|
+
let selected: ReturnType<typeof parseJqView>;
|
|
28
|
+
try {
|
|
29
|
+
selected = parseJqView(context.request.views);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
return failure(context, options.pluginId, "READ_FAILED", message(error));
|
|
32
|
+
}
|
|
33
|
+
if (selected === undefined) return { kind: "continue", context };
|
|
34
|
+
if (context.inputScope === "selection" || context.sourceTarget !== undefined)
|
|
35
|
+
return failure(
|
|
36
|
+
context,
|
|
37
|
+
options.pluginId,
|
|
38
|
+
"UNSUPPORTED_RANGE",
|
|
39
|
+
"jq requires a complete JSON source. Read its explicit path instead of a result, search selection or text anchor.",
|
|
40
|
+
);
|
|
41
|
+
if (context.inputScope !== "source")
|
|
42
|
+
return failure(
|
|
43
|
+
context,
|
|
44
|
+
options.pluginId,
|
|
45
|
+
"READ_FAILED",
|
|
46
|
+
"This jq view requires a matching Read host that classifies complete source inputs.",
|
|
47
|
+
);
|
|
48
|
+
const state = context.state;
|
|
49
|
+
if (state?.contentKind !== "text")
|
|
50
|
+
return failure(
|
|
51
|
+
context,
|
|
52
|
+
options.pluginId,
|
|
53
|
+
"UNSUPPORTED_CONTENT",
|
|
54
|
+
"This source does not supply structured JSON for jq.",
|
|
55
|
+
);
|
|
56
|
+
// Provider failures belong to the owning Read boundary; never turn them into jq diagnostics.
|
|
57
|
+
const input = options.input(context);
|
|
58
|
+
if (typeof input !== "string")
|
|
59
|
+
return failure(
|
|
60
|
+
context,
|
|
61
|
+
options.pluginId,
|
|
62
|
+
"UNSUPPORTED_CONTENT",
|
|
63
|
+
"This source does not supply structured JSON for jq.",
|
|
64
|
+
);
|
|
65
|
+
let output: string;
|
|
66
|
+
try {
|
|
67
|
+
output = await executeJq(selected.filter, input, {
|
|
68
|
+
cwd: context.resolverContext.cwd,
|
|
69
|
+
...(context.resolverContext.signal === undefined
|
|
70
|
+
? {}
|
|
71
|
+
: { signal: context.resolverContext.signal }),
|
|
72
|
+
});
|
|
73
|
+
} catch (error) {
|
|
74
|
+
return failure(context, options.pluginId, "READ_FAILED", message(error));
|
|
75
|
+
}
|
|
76
|
+
const transformed: ReadTextState = {
|
|
77
|
+
...state,
|
|
78
|
+
content: [{ type: "text", text: output }],
|
|
79
|
+
text: createTextDocument(state.source, output),
|
|
80
|
+
preserveTruncatedOutput: true,
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
kind: "continue",
|
|
84
|
+
context: { ...context, sourceText: undefined, sourceTarget: undefined, state: transformed },
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function message(error: unknown): string {
|
|
90
|
+
return error instanceof Error ? error.message : String(error);
|
|
91
|
+
}
|
|
92
|
+
function failure(
|
|
93
|
+
context: ReadPipelineContext,
|
|
94
|
+
pluginId: string,
|
|
95
|
+
code: ReadFailure["code"],
|
|
96
|
+
message: string,
|
|
97
|
+
): ReadStageOutcome {
|
|
98
|
+
const source = context.state?.source ?? context.request.path;
|
|
99
|
+
const resolverId = context.state?.resolvedBy;
|
|
100
|
+
return {
|
|
101
|
+
kind: "return",
|
|
102
|
+
result: {
|
|
103
|
+
content: [{ type: "text", text: `jq failed: ${message}` }],
|
|
104
|
+
details: {
|
|
105
|
+
source,
|
|
106
|
+
resolvedBy: resolverId,
|
|
107
|
+
failure: { code, source, resolverId, pluginId, stage: "read", message },
|
|
108
|
+
},
|
|
109
|
+
isError: true,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.
|
|
7
|
-
"pi-agent-resource": "0.
|
|
6
|
+
"pi-agent-pdf": "0.9.0",
|
|
7
|
+
"pi-agent-resource": "0.9.0"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-34.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.
|
|
10
|
-
"pi-agent-text": "0.
|
|
9
|
+
"pi-agent-resource": "0.9.0",
|
|
10
|
+
"pi-agent-text": "0.9.0"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
14
|
-
"./runtime/entry-
|
|
14
|
+
"./runtime/entry-35.js"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|