pi-agent-ide 0.8.1 → 0.8.2
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 +44 -0
- package/README.md +5 -3
- package/dist/{chunk-TGC2ZACO.js → chunk-235QMMVA.js} +1 -1
- package/dist/{chunk-OI3HBIPK.js → chunk-4DIUPEDF.js} +1 -1
- package/dist/{chunk-2ITKAXHO.js → chunk-6FGLAVPJ.js} +1 -1
- package/dist/{chunk-7LOVUWNI.js → chunk-6H32W35W.js} +1 -1
- package/dist/{chunk-YHREORHH.js → chunk-6OJ565FL.js} +1 -1
- package/dist/{chunk-E2PHA4SQ.js → chunk-6R3Y4AD3.js} +1 -1
- package/dist/{chunk-VNTY7BKC.js → chunk-6T7PSDQW.js} +1 -1
- package/dist/{chunk-D4IA2MTA.js → chunk-6TJPMBUQ.js} +1 -1
- package/dist/{chunk-JKMXND6V.js → chunk-6XFUICD7.js} +1 -1
- package/dist/chunk-7VSVJRRF.js +28 -0
- package/dist/{chunk-A64JRDZK.js → chunk-AAC77UD4.js} +1 -1
- package/dist/{chunk-HFJGCYFO.js → chunk-ANM3Y5FO.js} +5 -5
- package/dist/{chunk-Q5X6OXNS.js → chunk-CPELC6JE.js} +1 -1
- package/dist/chunk-FTPC44FP.js +33 -0
- package/dist/{chunk-3WO2NOEQ.js → chunk-GSOYVIQS.js} +1 -1
- package/dist/{chunk-AIT3YWR5.js → chunk-HSRH76JN.js} +1 -1
- package/dist/{chunk-ID4RJIVZ.js → chunk-HSZ4AQ6L.js} +1 -1
- package/dist/chunk-I6NPILT5.js +1 -0
- package/dist/chunk-K7SRNBIV.js +1 -0
- package/dist/{chunk-DXONCYWF.js → chunk-LCWBVOII.js} +3 -3
- package/dist/{chunk-EMRJP6EM.js → chunk-LEJKDYCK.js} +1 -1
- package/dist/{chunk-HCK7OIQ3.js → chunk-NJ7C4KMA.js} +1 -1
- package/dist/{chunk-BQAKA3FU.js → chunk-NUM3YQGK.js} +1 -1
- package/dist/chunk-OJEIX7OZ.js +1 -0
- package/dist/{chunk-4HWKBCBH.js → chunk-PJL3UVMJ.js} +1 -1
- package/dist/{chunk-AKNHSDGV.js → chunk-QT3EAHOG.js} +1 -1
- package/dist/{chunk-LLRUJD62.js → chunk-RIJMXO43.js} +1 -1
- package/dist/chunk-RMI3NMQY.js +23 -0
- package/dist/chunk-RQ7JJ7GV.js +4 -0
- package/dist/{chunk-AUL5FGGK.js → chunk-RVU73VKN.js} +1 -1
- package/dist/{chunk-WPBQ45ZL.js → chunk-RW2GTYQI.js} +1 -1
- package/dist/{chunk-BR7GRH4A.js → chunk-SDAH3ECM.js} +1 -1
- package/dist/chunk-SGQWRIRJ.js +10 -0
- package/dist/{chunk-N56WAVYA.js → chunk-SMIFCAAX.js} +1 -1
- package/dist/chunk-SWBJS3U4.js +1 -0
- package/dist/{chunk-WXGTU2M6.js → chunk-VMTOFEXF.js} +1 -1
- package/dist/{chunk-GEMDU6XW.js → chunk-VXP5BMW7.js} +1 -1
- package/dist/{chunk-LAJQSHEI.js → chunk-XAHU42FP.js} +3 -3
- package/dist/{chunk-ZV5ETNLQ.js → chunk-XBQR74IK.js} +1 -1
- package/dist/{chunk-TXG2H7YQ.js → chunk-XG7QNAKW.js} +1 -1
- package/dist/{chunk-PRLIHLCS.js → chunk-XLWCSJMR.js} +1 -1
- package/dist/{chunk-M4TVRCMZ.js → chunk-XXLLY66B.js} +1 -1
- package/dist/chunk-YFP4P2FV.js +1 -0
- package/dist/{chunk-SWA5B5B2.js → chunk-YIXP2ALP.js} +1 -1
- package/dist/{chunk-246NTPOS.js → chunk-ZJQRLVVV.js} +1 -1
- 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 -0
- package/dist/entry-2.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-22.js +1 -1
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +1 -2
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +2 -4
- package/dist/entry-3.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +4 -1
- package/dist/entry-32.js +1 -1
- package/dist/entry-33.js +1 -18
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +18 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -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 -25
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +25 -1
- 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 -3
- package/dist/entry-53.js +1 -13
- package/dist/entry-54.js +3 -1
- package/dist/entry-55.js +13 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-6.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -0
- package/dist/entry-64.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +0 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-7.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -1
- package/dist/entry-72.js +1 -1
- package/dist/entry-73.js +1 -0
- package/dist/entry-74.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +0 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -80
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +1 -22
- package/dist/entry-81.js +80 -2
- package/dist/entry-82.js +22 -1
- package/dist/entry-83.js +2 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -3
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -1
- package/dist/entry-88.js +3 -1
- package/dist/entry-89.js +1 -0
- package/dist/entry-9.js +1 -1
- package/dist/entry-90.js +1 -0
- package/dist/entry-91.js +1 -0
- package/dist/pi-agent-ide.js +29 -36
- package/docs/agent-guides/debugger.md +2 -0
- package/docs/agent-guides/editing.md +3 -3
- package/docs/agent-guides/search-code.md +2 -2
- package/docs/agent-guides/select-code.md +9 -6
- package/docs/code-review.md +5 -0
- package/docs/configuration.md +36 -4
- package/docs/development.md +8 -0
- package/docs/directory-operations.md +1 -1
- package/docs/extensions.md +98 -1
- package/docs/structured-results.md +11 -6
- package/docs/user-hooks.md +2 -2
- package/node_modules/pi-agent-doctor/package.json +7 -7
- package/node_modules/pi-agent-doctor/runtime/entry-27.js +1 -0
- package/node_modules/pi-agent-documentation/package.json +2 -2
- package/node_modules/pi-agent-documentation/runtime/entry-28.js +1 -0
- 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/package.json +6 -6
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.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/select-schema.ts +6 -5
- package/node_modules/pi-agent-ide-changes/package.json +10 -10
- package/node_modules/pi-agent-ide-changes/runtime/entry-36.js +1 -0
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
- 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-40.js +2 -0
- package/node_modules/pi-agent-ide-lsp/package.json +10 -10
- package/node_modules/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-read/package.json +12 -12
- package/node_modules/pi-agent-read/runtime/entry-47.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-49.js +2 -0
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-resource/src/resource-error.ts +11 -0
- package/node_modules/pi-agent-search/package.json +9 -9
- package/node_modules/pi-agent-search/runtime/entry-52.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-53.js +1 -0
- package/node_modules/pi-agent-search/runtime/entry-54.js +2 -0
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/node_modules/pi-agent-search-text/package.json +14 -14
- package/node_modules/pi-agent-search-text/runtime/entry-55.js +1 -0
- package/node_modules/pi-agent-search-text/runtime/entry-58.js +1 -0
- package/node_modules/pi-agent-text/package.json +3 -3
- 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-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
- package/node_modules/pi-agent-text-editor/index.ts +2 -0
- package/node_modules/pi-agent-text-editor/package.json +26 -26
- package/node_modules/pi-agent-text-editor/runtime/entry-79.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-80.js +1 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +3 -1
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +45 -44
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +27 -18
- package/node_modules/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +29 -6
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
- package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +2 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +14 -3
- package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +17 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-83.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-84.js +1 -0
- package/node_modules/pi-agent-tool-ui/package.json +6 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +1 -0
- package/node_modules/pi-agent-tool-ui/runtime/entry-86.js +1 -0
- package/node_modules/pi-agent-tool-ui/src/operation-approval.ts +271 -0
- 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-image/package.json +4 -4
- package/node_modules/pi-agent-web-image/runtime/entry-89.js +2 -0
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/runtime/entry-90.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-91.js +2 -0
- package/package.json +62 -54
- package/src/api/approval.ts +5 -0
- package/src/api/settings.ts +198 -0
- package/src/backend/debugger-registration.ts +5 -1
- package/src/code-review/extension.ts +10 -4
- package/src/code-review/reviewer.ts +8 -0
- package/src/composite/host-version.ts +29 -5
- package/src/composite/ide-alias-rendering.ts +97 -0
- package/src/composite/nested-tool-rendering.ts +74 -4
- package/src/composite/search-facts.ts +45 -0
- package/src/composite/settings-documentation.ts +32 -23
- package/src/composite/settings-registry.ts +94 -0
- package/src/composite/text-results.ts +120 -8
- package/src/composite/tool-availability.ts +11 -2
- package/src/core/diagnostic-entry.ts +31 -8
- package/src/core/diagnostic-store.ts +19 -3
- package/src/core/extension.ts +7 -2
- package/src/documentation/registry.ts +10 -2
- 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/package.json +6 -6
- 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-32.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-33.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +2 -0
- 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-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.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-90.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-91.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +2 -0
- package/src/extensions/pi-agent-read/package.json +12 -12
- package/src/extensions/pi-agent-read/runtime/entry-47.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-48.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-49.js +2 -0
- package/src/extensions/pi-agent-search/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -14
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-58.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-53.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-54.js +2 -0
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/src/extensions/pi-agent-text-editor/index.ts +2 -0
- 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-line-hash/package.json +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-63.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
- 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-82.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +14 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +17 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-79.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-80.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +3 -1
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +45 -44
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +27 -18
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +29 -6
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
- package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
- package/src/pi-agent-ide.ts +61 -14
- package/src/plugins/pi-agent-ide-ast/package.json +15 -15
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +6 -5
- package/src/plugins/pi-agent-ide-changes/package.json +10 -10
- package/src/plugins/pi-agent-ide-changes/runtime/entry-36.js +1 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
- package/src/plugins/pi-agent-ide-debugger/index.ts +158 -55
- package/src/plugins/pi-agent-ide-debugger/src/debugmcp-client.ts +118 -0
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +47 -0
- package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +2 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +146 -1
- package/src/plugins/pi-agent-ide-debugger/src/ui.ts +12 -0
- package/src/plugins/pi-agent-ide-debugger/src/vscode-backend.ts +497 -0
- 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-40.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/package.json +10 -10
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
- package/src/plugins/pi-agent-ide-terminal/index.ts +2 -0
- package/src/plugins/pi-agent-ide-terminal/src/origin.ts +30 -0
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +34 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +11 -2
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +9 -0
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +72 -26
- package/dist/chunk-GNACBJM3.js +0 -1
- package/dist/chunk-VMGZMXEM.js +0 -10
- package/dist/chunk-W3YFF6OO.js +0 -1
- package/dist/chunk-W7M3V7FR.js +0 -28
- package/dist/chunk-WMHSVEIT.js +0 -29
- package/dist/chunk-XSIKDVAR.js +0 -25
- package/dist/chunk-YTYLS2UM.js +0 -1
- package/dist/chunk-Z2QGNTGQ.js +0 -1
- package/dist/entry-21.js +0 -1
- package/node_modules/pi-agent-doctor/runtime/entry-20.js +0 -1
- package/node_modules/pi-agent-doctor/runtime/entry-21.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-27.js +0 -2
- package/node_modules/pi-agent-filesystem-image/runtime/entry-28.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-32.js +0 -1
- package/node_modules/pi-agent-ide-formatter/runtime/entry-36.js +0 -2
- package/node_modules/pi-agent-image/runtime/entry-40.js +0 -1
- package/node_modules/pi-agent-invariant/runtime/entry-41.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-49.js +0 -1
- package/node_modules/pi-agent-search-text/runtime/entry-53.js +0 -2
- package/node_modules/pi-agent-search-text/runtime/entry-54.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-58.js +0 -2
- package/node_modules/pi-agent-text-editor/runtime/entry-64.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-80.js +0 -2
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-82.js +0 -1
- package/node_modules/pi-agent-tool-ui/runtime/entry-83.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-84.js +0 -2
- package/node_modules/pi-agent-web-html/runtime/entry-85.js +0 -2
- package/node_modules/pi-agent-web-image/runtime/entry-86.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-28.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-29.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-27.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-85.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-86.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-87.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-84.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-43.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-44.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +0 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-54.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-49.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-50.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-58.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-81.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-63.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-64.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-32.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-33.js +0 -2
- package/src/plugins/pi-agent-ide-formatter/runtime/entry-36.js +0 -2
- /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-26.js +0 -0
- /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-33.js +0 -0
- /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-34.js +0 -0
- /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-39.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-42.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-43.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-44.js +0 -0
- /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-48.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-50.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-57.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-59.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-60.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-61.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-62.js +0 -0
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-63.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-81.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web}/runtime/entry-87.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-88.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-31.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-88.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-60.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-61.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-62.js +0 -0
- /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-34.js +0 -0
- /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-39.js +0 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from "node:util";
|
|
2
|
+
import {
|
|
3
|
+
createCodemodeExtension,
|
|
4
|
+
type ExtensionAPI,
|
|
5
|
+
type ToolDefinition,
|
|
6
|
+
type ToolRenderers,
|
|
7
|
+
} from "@earendil-works/pi-coding-agent";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Preserve native IDE contracts and presentation for matching local MCP forwarding aliases.
|
|
11
|
+
* Unnamespaced aliases opt into this contract by copying one IDE tool's description and schema.
|
|
12
|
+
* Local wrappers with conflicting behavior must not advertise that same contract.
|
|
13
|
+
* Load IDE before the alias owner: Pi keeps the first extension's executable definition.
|
|
14
|
+
* Builtin Codemode aliases reuse Pi's shipped renderer only; execution and custom renderer overrides
|
|
15
|
+
* are not captured or replaced.
|
|
16
|
+
*/
|
|
17
|
+
export function registerIdeAliasCompatibility(
|
|
18
|
+
pi: ExtensionAPI,
|
|
19
|
+
definitions: ReadonlyMap<string, ToolDefinition>,
|
|
20
|
+
): (name: string) => string | undefined {
|
|
21
|
+
const source = (name: string): string | undefined => {
|
|
22
|
+
if (!name.startsWith("mcp__")) return undefined;
|
|
23
|
+
const tools = pi.getAllTools();
|
|
24
|
+
const alias = tools.find((tool) => tool.name === name);
|
|
25
|
+
// Real MCP servers own their namespace. A matching suffix alone proves nothing.
|
|
26
|
+
if (!alias || alias.namespace || alias.exposure === "hidden") return undefined;
|
|
27
|
+
const matches = tools.filter(
|
|
28
|
+
(tool) =>
|
|
29
|
+
((definitions.has(tool.name) && tool.namespace?.name.startsWith("ide_") === true) ||
|
|
30
|
+
(tool.name === "codemode" &&
|
|
31
|
+
tool.sourceInfo.source === "builtin" &&
|
|
32
|
+
tool.sourceInfo.path === "builtin:codemode")) &&
|
|
33
|
+
tool.exposure !== "hidden" &&
|
|
34
|
+
tool.description === alias.description &&
|
|
35
|
+
isDeepStrictEqual(tool.parameters, alias.parameters),
|
|
36
|
+
);
|
|
37
|
+
return matches.length === 1 ? matches[0]?.name : undefined;
|
|
38
|
+
};
|
|
39
|
+
let codemodeRenderers: ToolRenderers | undefined;
|
|
40
|
+
pi.registerToolRenderer((name, next) => {
|
|
41
|
+
const native = source(name);
|
|
42
|
+
if (native !== "codemode") return native === undefined ? next() : definitions.get(native);
|
|
43
|
+
if (!codemodeRenderers) {
|
|
44
|
+
// Capture Pi's shipped presentation through its public factory, never its execution/ownership.
|
|
45
|
+
// The factory only registers a definition; none of its executor/settings closures run here.
|
|
46
|
+
void createCodemodeExtension()({
|
|
47
|
+
...pi,
|
|
48
|
+
registerTool: (definition) => {
|
|
49
|
+
const { renderShell, renderCall, renderResult } = definition as ToolDefinition;
|
|
50
|
+
codemodeRenderers = { renderShell, renderCall, renderResult };
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return codemodeRenderers ?? next();
|
|
55
|
+
});
|
|
56
|
+
pi.on("before_agent_start", () => {
|
|
57
|
+
for (const alias of pi.getAllTools()) {
|
|
58
|
+
const native = source(alias.name);
|
|
59
|
+
const definition = native === undefined ? undefined : definitions.get(native);
|
|
60
|
+
if (!definition) continue;
|
|
61
|
+
const descriptors = Object.getOwnPropertyDescriptors(definition);
|
|
62
|
+
// Preserve live metadata getters and outputSchema, but keep the alias's exposure and identity.
|
|
63
|
+
delete descriptors.namespace;
|
|
64
|
+
descriptors.name = {
|
|
65
|
+
value: alias.name,
|
|
66
|
+
enumerable: true,
|
|
67
|
+
configurable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
};
|
|
70
|
+
descriptors.exposure = {
|
|
71
|
+
value: alias.exposure,
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
};
|
|
76
|
+
const execute: ToolDefinition["execute"] = async (_id, args, signal, onUpdate, ctx) => {
|
|
77
|
+
const { result, isError } = await ctx.executeTool(definition.name, args, {
|
|
78
|
+
signal,
|
|
79
|
+
onUpdate,
|
|
80
|
+
});
|
|
81
|
+
// Pi already charges nested usage to the parent call.
|
|
82
|
+
const { usage: _nestedUsage, ...own } = result;
|
|
83
|
+
return { ...own, isError };
|
|
84
|
+
};
|
|
85
|
+
descriptors.execute = {
|
|
86
|
+
value: execute,
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true,
|
|
89
|
+
writable: true,
|
|
90
|
+
};
|
|
91
|
+
const forwarded = Object.defineProperties({}, descriptors) as ToolDefinition;
|
|
92
|
+
// Same-name registration preserves activation; do not enable an inactive source or alias.
|
|
93
|
+
pi.registerTool(forwarded);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return source;
|
|
97
|
+
}
|
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
type ToolDefinition,
|
|
5
5
|
type AgentToolResult,
|
|
6
6
|
} from "@earendil-works/pi-coding-agent";
|
|
7
|
-
import { Container, Spacer, Text, type TUI } from "@earendil-works/pi-tui";
|
|
7
|
+
import { Container, Spacer, Text, type Component, type TUI } from "@earendil-works/pi-tui";
|
|
8
8
|
import {
|
|
9
9
|
NATIVE_EDIT_BATCH_EVENT,
|
|
10
10
|
type NativeEditBatchEvent,
|
|
11
11
|
} from "#src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.js";
|
|
12
12
|
import { compactMutationDetails } from "#src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.js";
|
|
13
13
|
import type { FileMutationBatchResult } from "pi-agent-text-editor/api/mutation-result";
|
|
14
|
+
import { registerIdeAliasCompatibility } from "./ide-alias-rendering.js";
|
|
14
15
|
|
|
15
16
|
const ENTRY_TYPE = "ide-nested-results";
|
|
16
17
|
const MAX_CALLS = 256;
|
|
@@ -32,6 +33,10 @@ interface ChildPanel {
|
|
|
32
33
|
postWriteFailure?: boolean;
|
|
33
34
|
unchangedCopy?: boolean;
|
|
34
35
|
copyRollback?: "restored" | "failed";
|
|
36
|
+
/** The call's host-recorded execution time; absent in older history or when it did not run. */
|
|
37
|
+
durationMs?: number;
|
|
38
|
+
/** This call's panel shows the combined diff of several calls, so no single time applies. */
|
|
39
|
+
groupedResult?: boolean;
|
|
35
40
|
result?: { content: AgentToolResult<unknown>["content"]; details: unknown; isError: boolean };
|
|
36
41
|
}
|
|
37
42
|
interface BatchReport {
|
|
@@ -80,13 +85,58 @@ function retentionWarning(group: SavedPanelGroup): string | undefined {
|
|
|
80
85
|
return undefined;
|
|
81
86
|
}
|
|
82
87
|
|
|
88
|
+
/** Format a duration like native tool rows: `4.2s` below a minute, then `1m 30s` and `2h 3m 4s`. */
|
|
89
|
+
export function formatToolDuration(ms: number): string {
|
|
90
|
+
const seconds = ms / 1000;
|
|
91
|
+
if (seconds < 60) return `${seconds.toFixed(1)}s`;
|
|
92
|
+
const totalSeconds = Math.floor(seconds);
|
|
93
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
94
|
+
if (minutes < 60) return `${minutes}m ${totalSeconds % 60}s`;
|
|
95
|
+
return `${Math.floor(minutes / 60)}h ${minutes % 60}m ${totalSeconds % 60}s`;
|
|
96
|
+
}
|
|
97
|
+
|
|
83
98
|
/** Keep bounded display data for nested IDE tools, separate from model context and usage. */
|
|
84
99
|
export function createNestedIdeRendering(pi: ExtensionAPI, hideCodemodeToolResults = false) {
|
|
85
100
|
const definitions = new Map<string, ToolDefinition>();
|
|
101
|
+
const aliasSource = registerIdeAliasCompatibility(pi, definitions);
|
|
102
|
+
const aliasRoots = new Map<string, string>();
|
|
86
103
|
const parents = new Map<string, string>();
|
|
87
104
|
const groups = new Map<string, PanelGroup>();
|
|
88
105
|
let tui: TUI | undefined;
|
|
89
106
|
const components = new WeakMap<object, Container>();
|
|
107
|
+
const timedDefinitions = new WeakMap<ToolDefinition, ToolDefinition>();
|
|
108
|
+
/** Wrap a tool's result renderer so a final nested panel ends with its recorded time. */
|
|
109
|
+
const timedDefinition = (name: string): ToolDefinition | undefined => {
|
|
110
|
+
const definition = definitions.get(name);
|
|
111
|
+
const renderResult = definition?.renderResult;
|
|
112
|
+
if (!definition || !renderResult) return definition;
|
|
113
|
+
let timed = timedDefinitions.get(definition);
|
|
114
|
+
if (!timed) {
|
|
115
|
+
const inner = new WeakMap<object, Component>();
|
|
116
|
+
timed = {
|
|
117
|
+
...definition,
|
|
118
|
+
renderResult(result, options, theme, context) {
|
|
119
|
+
// Give the tool its own previous component, not the timing wrapper around it.
|
|
120
|
+
const previous = context.lastComponent && inner.get(context.lastComponent);
|
|
121
|
+
const rendered = renderResult.call(definition, result, options, theme, {
|
|
122
|
+
...context,
|
|
123
|
+
lastComponent: previous ?? context.lastComponent,
|
|
124
|
+
});
|
|
125
|
+
if (options.isPartial || context.durationMs === undefined) return rendered;
|
|
126
|
+
const container = new Container();
|
|
127
|
+
container.addChild(rendered);
|
|
128
|
+
container.addChild(new Spacer(1));
|
|
129
|
+
container.addChild(
|
|
130
|
+
new Text(theme.fg("muted", `Took ${formatToolDuration(context.durationMs)}`), 0, 0),
|
|
131
|
+
);
|
|
132
|
+
inner.set(container, rendered);
|
|
133
|
+
return container;
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
timedDefinitions.set(definition, timed);
|
|
137
|
+
}
|
|
138
|
+
return timed;
|
|
139
|
+
};
|
|
90
140
|
const retainResult = (
|
|
91
141
|
group: PanelGroup,
|
|
92
142
|
call: ChildPanel,
|
|
@@ -129,6 +179,7 @@ export function createNestedIdeRendering(pi: ExtensionAPI, hideCodemodeToolResul
|
|
|
129
179
|
call.resultOmitted = true;
|
|
130
180
|
};
|
|
131
181
|
const clear = () => {
|
|
182
|
+
aliasRoots.clear();
|
|
132
183
|
parents.clear();
|
|
133
184
|
groups.clear();
|
|
134
185
|
};
|
|
@@ -147,9 +198,15 @@ export function createNestedIdeRendering(pi: ExtensionAPI, hideCodemodeToolResul
|
|
|
147
198
|
pi.on("session_tree", clear);
|
|
148
199
|
pi.on("session_shutdown", clear);
|
|
149
200
|
pi.on("tool_execution_start", (event, context) => {
|
|
150
|
-
if (event.parentToolCallId === undefined)
|
|
201
|
+
if (event.parentToolCallId === undefined) {
|
|
202
|
+
const source = aliasSource(event.toolName);
|
|
203
|
+
if (source !== undefined) aliasRoots.set(event.toolCallId, source);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
151
206
|
const root = parents.get(event.parentToolCallId) ?? event.parentToolCallId;
|
|
152
207
|
parents.set(event.toolCallId, root);
|
|
208
|
+
// A direct alias already draws the native panel; its forwarding child must not duplicate it.
|
|
209
|
+
if (aliasRoots.get(root) === event.toolName) return;
|
|
153
210
|
if (!definitions.has(event.toolName)) return;
|
|
154
211
|
let group = groups.get(root);
|
|
155
212
|
if (!group) {
|
|
@@ -189,12 +246,15 @@ export function createNestedIdeRendering(pi: ExtensionAPI, hideCodemodeToolResul
|
|
|
189
246
|
});
|
|
190
247
|
});
|
|
191
248
|
pi.on("tool_execution_end", (event) => {
|
|
249
|
+
aliasRoots.delete(event.toolCallId);
|
|
192
250
|
const root = parents.get(event.toolCallId);
|
|
193
251
|
if (root === undefined) return;
|
|
194
252
|
parents.delete(event.toolCallId);
|
|
195
253
|
const group = groups.get(root);
|
|
196
254
|
const call = group?.calls.find((call) => call.id === event.toolCallId);
|
|
197
255
|
if (group && call) {
|
|
256
|
+
if (typeof event.durationMs === "number" && Number.isFinite(event.durationMs))
|
|
257
|
+
call.durationMs = event.durationMs;
|
|
198
258
|
// Hooks have already prepared compact renderer details. Never copy structuredContent or usage.
|
|
199
259
|
const result = event.result as AgentToolResult<unknown>;
|
|
200
260
|
retainResult(group, call, {
|
|
@@ -273,11 +333,17 @@ export function createNestedIdeRendering(pi: ExtensionAPI, hideCodemodeToolResul
|
|
|
273
333
|
{ showImages: true },
|
|
274
334
|
call.resultOmitted || call.omitted || !call.result
|
|
275
335
|
? undefined
|
|
276
|
-
:
|
|
336
|
+
: timedDefinition(call.name),
|
|
277
337
|
tui,
|
|
278
338
|
entry.data.cwd,
|
|
279
339
|
);
|
|
280
|
-
if (call.result)
|
|
340
|
+
if (call.result)
|
|
341
|
+
component.updateResult({
|
|
342
|
+
...call.result,
|
|
343
|
+
...(call.durationMs === undefined || call.groupedResult === true
|
|
344
|
+
? {}
|
|
345
|
+
: { durationMs: call.durationMs }),
|
|
346
|
+
});
|
|
281
347
|
else
|
|
282
348
|
component.updateResult({
|
|
283
349
|
content: [{ type: "text", text: "Result unavailable in this saved display." }],
|
|
@@ -350,6 +416,10 @@ export function createNestedIdeRendering(pi: ExtensionAPI, hideCodemodeToolResul
|
|
|
350
416
|
call.unchangedCopy =
|
|
351
417
|
call.name === "copy" && batch.unchangedCopyCalls?.includes(id) === true;
|
|
352
418
|
call.batched = !call.unchangedCopy && id !== lastChangedCall;
|
|
419
|
+
call.groupedResult =
|
|
420
|
+
!call.batched &&
|
|
421
|
+
!call.unchangedCopy &&
|
|
422
|
+
batch.calls.filter((other) => !batch.unchangedCopyCalls?.includes(other)).length > 1;
|
|
353
423
|
if (call.unchangedCopy) {
|
|
354
424
|
retainResult(group, call, {
|
|
355
425
|
content: [{ type: "text", text: "No changes: destination already has this text." }],
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Search's public Codemode value; the registered string retains all composition authority. */
|
|
2
|
+
export type SearchFacts = {
|
|
3
|
+
result: string;
|
|
4
|
+
hasMatches: boolean | null;
|
|
5
|
+
complete: boolean | null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/** Direct calls still show readable content; native Codemode uses this small return declaration. */
|
|
9
|
+
export const searchFactsSchema = {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
result: {
|
|
13
|
+
type: "string",
|
|
14
|
+
description:
|
|
15
|
+
"Unchanged registered Search result. Pass this string to other tools to reuse its exact selection.",
|
|
16
|
+
},
|
|
17
|
+
hasMatches: {
|
|
18
|
+
anyOf: [{ type: "boolean" }, { type: "null" }],
|
|
19
|
+
description:
|
|
20
|
+
"Whether the original query reported matches, excluding spelling alternatives. Null means unknown. False proves absence only when complete is true.",
|
|
21
|
+
},
|
|
22
|
+
complete: {
|
|
23
|
+
anyOf: [{ type: "boolean" }, { type: "null" }],
|
|
24
|
+
description:
|
|
25
|
+
"Whether the search covered its requested scope, independent of display truncation. Null means unknown.",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ["result", "hasMatches", "complete"],
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Project only resolver-owned match facts, never rendered prose, fuzzy suggestions or private data. */
|
|
33
|
+
export function searchFacts(outcome: unknown, result: string): SearchFacts {
|
|
34
|
+
const unknown: SearchFacts = { result, hasMatches: null, complete: null };
|
|
35
|
+
if (!record(outcome) || outcome.status !== "success" || !record(outcome.data)) return unknown;
|
|
36
|
+
const data = outcome.data;
|
|
37
|
+
const items =
|
|
38
|
+
data.kind === "matches" ? data.matches : data.kind === "files" ? data.files : undefined;
|
|
39
|
+
if (!Array.isArray(items) || typeof data.complete !== "boolean") return unknown;
|
|
40
|
+
return { result, hasMatches: items.length > 0, complete: data.complete };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function record(value: unknown): value is Record<string, unknown> {
|
|
44
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
45
|
+
}
|
|
@@ -1,37 +1,43 @@
|
|
|
1
1
|
import type { AgentDocumentation } from "#src/api/documentation.js";
|
|
2
2
|
import { BUILTIN_EXTENSIONS } from "./builtin-extensions.js";
|
|
3
3
|
import type { FeatureFlag } from "./feature-flags.js";
|
|
4
|
-
import { AGENT_IDE_PREFERENCES } from "./preferences.js";
|
|
4
|
+
import { AGENT_IDE_PREFERENCES, type AgentIdePreference } from "./preferences.js";
|
|
5
5
|
import { AGENT_IDE_PRESET_OPTIONS } from "./presets.js";
|
|
6
6
|
|
|
7
7
|
/** Build an explicit, read-only guide from the same descriptors as the settings menu. */
|
|
8
|
-
export function createIdeSettingsDocumentation(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
modules: BUILTIN_EXTENSIONS.map(({ id, name, description, defaultEnabled, dependencies }) => ({
|
|
13
|
-
id,
|
|
14
|
-
name,
|
|
15
|
-
description,
|
|
16
|
-
default: defaultEnabled !== false,
|
|
17
|
-
dependencies,
|
|
18
|
-
})),
|
|
19
|
-
presets: AGENT_IDE_PRESET_OPTIONS,
|
|
20
|
-
};
|
|
21
|
-
const json = Object.entries(catalog)
|
|
22
|
-
.map(
|
|
23
|
-
([name, entries]) =>
|
|
24
|
-
` "${name}": [\n${entries.map((entry) => ` ${JSON.stringify(entry)}`).join(",\n")}\n ]`,
|
|
25
|
-
)
|
|
26
|
-
.join(",\n");
|
|
8
|
+
export function createIdeSettingsDocumentation(
|
|
9
|
+
flags: readonly FeatureFlag[],
|
|
10
|
+
preferences: readonly AgentIdePreference[] = AGENT_IDE_PREFERENCES,
|
|
11
|
+
): AgentDocumentation {
|
|
27
12
|
return {
|
|
28
13
|
id: "ide-settings",
|
|
29
14
|
description:
|
|
30
15
|
"Registered IDE settings, choices, defaults, configuration scopes and inheritance.",
|
|
31
16
|
triggers: [{ tool: "read", resourcePrefixes: ["docs:ide-settings"] }],
|
|
32
|
-
markdown
|
|
17
|
+
get markdown() {
|
|
18
|
+
const catalog = {
|
|
19
|
+
preferences,
|
|
20
|
+
flags,
|
|
21
|
+
modules: BUILTIN_EXTENSIONS.map(
|
|
22
|
+
({ id, name, description, defaultEnabled, dependencies }) => ({
|
|
23
|
+
id,
|
|
24
|
+
name,
|
|
25
|
+
description,
|
|
26
|
+
default: defaultEnabled !== false,
|
|
27
|
+
dependencies,
|
|
28
|
+
}),
|
|
29
|
+
),
|
|
30
|
+
presets: AGENT_IDE_PRESET_OPTIONS,
|
|
31
|
+
};
|
|
32
|
+
const json = Object.entries(catalog)
|
|
33
|
+
.map(
|
|
34
|
+
([name, entries]) =>
|
|
35
|
+
` "${name}": [\n${entries.map((entry) => ` ${JSON.stringify(entry)}`).join(",\n")}\n ]`,
|
|
36
|
+
)
|
|
37
|
+
.join(",\n");
|
|
38
|
+
return `# IDE settings
|
|
33
39
|
|
|
34
|
-
This catalog describes supported settings, not current saved values or live runtime state. It is generated from the registrations used by /agent-ide-settings. Read both configuration scopes to inspect overrides. Reload or restart applies
|
|
40
|
+
This catalog describes supported settings, not current saved values or live runtime state. It is generated from the registrations used by /agent-ide-settings. Read both configuration scopes to inspect overrides. Reload or restart applies module and startup-only changes; built-in CLI flags may override their saved defaults for an invocation.
|
|
35
41
|
|
|
36
42
|
## Configuration scopes
|
|
37
43
|
|
|
@@ -44,6 +50,8 @@ This catalog describes supported settings, not current saved values or live runt
|
|
|
44
50
|
- A module's default below is its built-in default before preset and dependency selection, not its current effective state.
|
|
45
51
|
- Existing noAnimations and noPostProcessing booleans still work. Their registered flags are pi-agent-ide-no-animations and pi-agent-ide-no-post-processing. Within each scope a flags entry wins over its corresponding legacy boolean. When changing or resetting that flag, remove its legacy boolean in the same scope, as the menu does.
|
|
46
52
|
- Text preference values are strings, not JSON numbers. An empty default means no override; saved strings must be non-empty. Read each description for valid ranges. Do not treat storage validation as validation of every preference value.
|
|
53
|
+
- External settings use these same scopes and storage maps. Their boolean registrations add menu controls, not CLI switches.
|
|
54
|
+
- YOLO skips existing operation confirmation dialogs only; safety checks and remote permissions remain in force. The common setting is pi-agent-ide-yolo. An explicit extension YOLO value wins; Default inherits the common setting. Remembered session permissions are separate from persistent YOLO settings. Saved YOLO values are read for each request and affect following operations without reloading; they do not remove session grants.
|
|
47
55
|
|
|
48
56
|
## Registered settings
|
|
49
57
|
|
|
@@ -54,6 +62,7 @@ Choices carry their saved value and human label. Text settings carry a descripti
|
|
|
54
62
|
${json}
|
|
55
63
|
}
|
|
56
64
|
\`\`\`
|
|
57
|
-
|
|
65
|
+
`;
|
|
66
|
+
},
|
|
58
67
|
};
|
|
59
68
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import {
|
|
3
|
+
SETTINGS_READ_EVENT,
|
|
4
|
+
SETTINGS_READY_EVENT,
|
|
5
|
+
SETTINGS_REGISTER_EVENT,
|
|
6
|
+
validateAgentIdeSettings,
|
|
7
|
+
type AgentIdeSetting,
|
|
8
|
+
type AgentIdeSettingValue,
|
|
9
|
+
type SettingsReadRequest,
|
|
10
|
+
type SettingsRegistration,
|
|
11
|
+
} from "#src/api/settings.js";
|
|
12
|
+
import {
|
|
13
|
+
configuredFeatureFlags,
|
|
14
|
+
readExtensionSettingsScope,
|
|
15
|
+
resolvePiAgentIdeExtensionsConfigPaths,
|
|
16
|
+
} from "./extensions-config.js";
|
|
17
|
+
import type { FeatureFlag } from "./feature-flags.js";
|
|
18
|
+
import type { AgentIdePreference } from "./preferences.js";
|
|
19
|
+
|
|
20
|
+
/** One host-owned registry supplies the menu, catalog and effective settings reads. */
|
|
21
|
+
export function createAgentIdeSettingsRegistry(
|
|
22
|
+
pi: Pick<ExtensionAPI, "events" | "on">,
|
|
23
|
+
builtInFlags: readonly FeatureFlag[],
|
|
24
|
+
builtInPreferences: readonly AgentIdePreference[],
|
|
25
|
+
) {
|
|
26
|
+
const settings = new Map<
|
|
27
|
+
string,
|
|
28
|
+
{ readonly owner: string; readonly definition: AgentIdeSetting }
|
|
29
|
+
>();
|
|
30
|
+
const flags: FeatureFlag[] = [];
|
|
31
|
+
const preferences: AgentIdePreference[] = [];
|
|
32
|
+
function register(owner: string, definitions: readonly AgentIdeSetting[]): void {
|
|
33
|
+
validateAgentIdeSettings(owner, definitions);
|
|
34
|
+
for (const definition of definitions) {
|
|
35
|
+
const existing = settings.get(definition.id);
|
|
36
|
+
if (existing)
|
|
37
|
+
throw new Error(`Setting ${definition.id} is already registered by ${existing.owner}`);
|
|
38
|
+
}
|
|
39
|
+
for (const definition of definitions) {
|
|
40
|
+
settings.set(definition.id, { owner, definition });
|
|
41
|
+
if (definition.kind === "boolean") {
|
|
42
|
+
const { kind: _kind, group, ...flag } = definition;
|
|
43
|
+
flags.push({ ...flag, ...(group === "ui" ? { group } : {}) });
|
|
44
|
+
} else preferences.push({ ...definition, group: definition.group ?? "features" });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
register("pi-agent-ide", [
|
|
48
|
+
...builtInFlags.map((flag): AgentIdeSetting => ({ ...flag, kind: "boolean" })),
|
|
49
|
+
...builtInPreferences,
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
async function read(id: string, cwd: string): Promise<AgentIdeSettingValue> {
|
|
53
|
+
const setting = settings.get(id)?.definition;
|
|
54
|
+
if (!setting) throw new Error(`Unknown Agent IDE setting: ${id}`);
|
|
55
|
+
const paths = resolvePiAgentIdeExtensionsConfigPaths(process.env, undefined, cwd);
|
|
56
|
+
const [global, project] = await Promise.all([
|
|
57
|
+
readExtensionSettingsScope(paths.globalPath),
|
|
58
|
+
readExtensionSettingsScope(paths.projectPath),
|
|
59
|
+
]);
|
|
60
|
+
const saved =
|
|
61
|
+
setting.kind === "boolean"
|
|
62
|
+
? { ...configuredFeatureFlags(global), ...configuredFeatureFlags(project) }
|
|
63
|
+
: { ...global.preferences, ...project.preferences };
|
|
64
|
+
const overridden = Object.hasOwn(saved, id);
|
|
65
|
+
const value = overridden ? saved[id] : setting.default;
|
|
66
|
+
if (
|
|
67
|
+
value === undefined ||
|
|
68
|
+
(setting.kind === "boolean" ? typeof value !== "boolean" : typeof value !== "string")
|
|
69
|
+
)
|
|
70
|
+
throw new Error(`Invalid saved setting type: ${id}`);
|
|
71
|
+
if (setting.kind === "choice" && !setting.values.some((choice) => choice.value === value))
|
|
72
|
+
throw new Error(`Invalid saved setting choice: ${id}`);
|
|
73
|
+
return { value, overridden };
|
|
74
|
+
}
|
|
75
|
+
const unsubscribeRegistration = pi.events.on(SETTINGS_REGISTER_EVENT, (data) => {
|
|
76
|
+
const request = data as SettingsRegistration;
|
|
77
|
+
try {
|
|
78
|
+
register(request.owner, request.definitions);
|
|
79
|
+
request.accept();
|
|
80
|
+
} catch (error) {
|
|
81
|
+
request.accept(error instanceof Error ? error : new Error(String(error)));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const unsubscribeRead = pi.events.on(SETTINGS_READ_EVENT, (data) => {
|
|
85
|
+
const request = data as SettingsReadRequest;
|
|
86
|
+
request.accept(read(request.id, request.cwd));
|
|
87
|
+
});
|
|
88
|
+
pi.on("session_shutdown", () => {
|
|
89
|
+
unsubscribeRegistration();
|
|
90
|
+
unsubscribeRead();
|
|
91
|
+
});
|
|
92
|
+
pi.events.emit(SETTINGS_READY_EVENT, undefined);
|
|
93
|
+
return { flags, preferences, read };
|
|
94
|
+
}
|
|
@@ -8,10 +8,12 @@ import type {
|
|
|
8
8
|
ToolCallEventResult,
|
|
9
9
|
AgentToolResult,
|
|
10
10
|
} from "@earendil-works/pi-coding-agent";
|
|
11
|
+
import type { JsonValue } from "@earendil-works/pi-ai";
|
|
11
12
|
import { connectResultTargets, TempResourceStore } from "pi-agent-resource";
|
|
12
13
|
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
13
14
|
import { READ_PROTOCOL, READ_API_VERSION } from "pi-agent-read/api/plugin-protocol";
|
|
14
15
|
import { limitIdeOutput } from "./output-limits.js";
|
|
16
|
+
import { searchFacts, searchFactsSchema } from "./search-facts.js";
|
|
15
17
|
|
|
16
18
|
const sourceFields: Record<string, readonly string[]> = {
|
|
17
19
|
read: ["path"],
|
|
@@ -27,6 +29,79 @@ const sourceFields: Record<string, readonly string[]> = {
|
|
|
27
29
|
diff: ["before", "after"],
|
|
28
30
|
};
|
|
29
31
|
|
|
32
|
+
/** Mutation tools whose resource providers may return a plain value to Codemode scripts. */
|
|
33
|
+
const providerValueTools = new Set(["write", "replace", "insert", "delete", "copy", "move"]);
|
|
34
|
+
/** Codemode resolves to the composition text, or to a provider's value when a semantic handler returns one. */
|
|
35
|
+
const providerValueSchema = {
|
|
36
|
+
anyOf: [
|
|
37
|
+
{ type: "string" },
|
|
38
|
+
{
|
|
39
|
+
type: "object",
|
|
40
|
+
description: "Value returned by a resource provider, such as a computer action outcome.",
|
|
41
|
+
additionalProperties: true,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
const imageBlockSchema = {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
type: { const: "image" },
|
|
49
|
+
data: { type: "string" },
|
|
50
|
+
mimeType: { type: "string" },
|
|
51
|
+
note: { type: "string" },
|
|
52
|
+
},
|
|
53
|
+
required: ["type", "data", "mimeType", "note"],
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Codemode Read resolves to the composition text, or to native image blocks that image() and
|
|
57
|
+
* models.classify() accept. The note carries the same readable, composable result text.
|
|
58
|
+
*/
|
|
59
|
+
const readValueSchema = {
|
|
60
|
+
anyOf: [
|
|
61
|
+
{ type: "string" },
|
|
62
|
+
imageBlockSchema,
|
|
63
|
+
{
|
|
64
|
+
type: "object",
|
|
65
|
+
description: "Several images, such as sequence frames, in source order.",
|
|
66
|
+
properties: {
|
|
67
|
+
type: { const: "images" },
|
|
68
|
+
note: { type: "string" },
|
|
69
|
+
images: {
|
|
70
|
+
type: "array",
|
|
71
|
+
items: { type: "object", properties: imageBlockSchema.properties },
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
required: ["type", "note", "images"],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
type ImageBlock = Extract<AgentToolResult<unknown>["content"][number], { type: "image" }>;
|
|
79
|
+
/** Native image script values for a successful Read; text reads keep their composition string. */
|
|
80
|
+
function readValue(
|
|
81
|
+
content: AgentToolResult<unknown>["content"],
|
|
82
|
+
note: string,
|
|
83
|
+
): JsonValue | undefined {
|
|
84
|
+
const images = content
|
|
85
|
+
.filter((block): block is ImageBlock => block.type === "image")
|
|
86
|
+
.map(({ data, mimeType }) => ({ type: "image", data, mimeType }));
|
|
87
|
+
if (images.length === 0) return undefined;
|
|
88
|
+
const [first] = images;
|
|
89
|
+
return images.length === 1 && first !== undefined
|
|
90
|
+
? { ...first, note }
|
|
91
|
+
: { type: "images", note, images };
|
|
92
|
+
}
|
|
93
|
+
/** The value a semantic handler asked to return to scripts instead of text. */
|
|
94
|
+
function providerValue(details: unknown): JsonValue | undefined {
|
|
95
|
+
const metadata = record(details) ? details.metadata : undefined;
|
|
96
|
+
const action = record(metadata) ? metadata.semanticAction : undefined;
|
|
97
|
+
const value = record(action) ? action.script : undefined;
|
|
98
|
+
// Semantic handler results are plain JSON receipts; keep the declared object shape.
|
|
99
|
+
return record(value) && !Array.isArray(value) ? (value as JsonValue) : undefined;
|
|
100
|
+
}
|
|
101
|
+
function record(value: unknown): value is Record<string, unknown> {
|
|
102
|
+
return value !== null && typeof value === "object";
|
|
103
|
+
}
|
|
104
|
+
|
|
30
105
|
/** Keep tool records private while strings carry registered composition references. */
|
|
31
106
|
export function createIdeTextResults(pi: ExtensionAPI) {
|
|
32
107
|
const store = connectResultTargets(pi);
|
|
@@ -103,10 +178,7 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
103
178
|
});
|
|
104
179
|
};
|
|
105
180
|
const parents = new Map<string, string>();
|
|
106
|
-
const images = new Map<
|
|
107
|
-
string,
|
|
108
|
-
Extract<AgentToolResult<unknown>["content"][number], { type: "image" }>[]
|
|
109
|
-
>();
|
|
181
|
+
const images = new Map<string, ImageBlock[]>();
|
|
110
182
|
const clear = () => {
|
|
111
183
|
parents.clear();
|
|
112
184
|
images.clear();
|
|
@@ -114,9 +186,10 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
114
186
|
};
|
|
115
187
|
pi.on("session_start", clear);
|
|
116
188
|
pi.on("session_shutdown", clear);
|
|
117
|
-
pi.on("before_agent_start", (event) =>
|
|
118
|
-
|
|
119
|
-
|
|
189
|
+
pi.on("before_agent_start", (event) => {
|
|
190
|
+
event.systemPromptOptions.sections.ide_results =
|
|
191
|
+
"Direct IDE calls return readable text. In Codemode, Search returns { 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. Other text results remain 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
|
+
});
|
|
120
193
|
pi.on("tool_execution_start", (event) => {
|
|
121
194
|
if (event.parentToolCallId !== undefined)
|
|
122
195
|
parents.set(event.toolCallId, parents.get(event.parentToolCallId) ?? event.parentToolCallId);
|
|
@@ -184,7 +257,29 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
184
257
|
names.add(definition.name);
|
|
185
258
|
const publicDefinition = {} as typeof definition;
|
|
186
259
|
const descriptors = Object.getOwnPropertyDescriptors(definition);
|
|
260
|
+
// Keep readable composition strings except for explicitly declared public script values.
|
|
187
261
|
delete descriptors.outputSchema;
|
|
262
|
+
if (definition.name === "search")
|
|
263
|
+
descriptors.outputSchema = {
|
|
264
|
+
value: searchFactsSchema,
|
|
265
|
+
enumerable: true,
|
|
266
|
+
configurable: true,
|
|
267
|
+
writable: true,
|
|
268
|
+
};
|
|
269
|
+
if (definition.name === "read")
|
|
270
|
+
descriptors.outputSchema = {
|
|
271
|
+
value: readValueSchema,
|
|
272
|
+
enumerable: true,
|
|
273
|
+
configurable: true,
|
|
274
|
+
writable: true,
|
|
275
|
+
};
|
|
276
|
+
if (providerValueTools.has(definition.name))
|
|
277
|
+
descriptors.outputSchema = {
|
|
278
|
+
value: providerValueSchema,
|
|
279
|
+
enumerable: true,
|
|
280
|
+
configurable: true,
|
|
281
|
+
writable: true,
|
|
282
|
+
};
|
|
188
283
|
const execute: typeof definition.execute = async (...args) => {
|
|
189
284
|
const result = await definition.execute(...args).catch(async (error: unknown) => {
|
|
190
285
|
const limited = await limitIdeOutput(
|
|
@@ -281,7 +376,13 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
281
376
|
pi.on("tool_result", async (event, context) => {
|
|
282
377
|
if (event.toolName === "codemode") {
|
|
283
378
|
store.refreshAll();
|
|
284
|
-
|
|
379
|
+
// A script that showed a nested image with image() must not receive it a second time.
|
|
380
|
+
const shown = new Set(
|
|
381
|
+
event.content.flatMap((block) => (block.type === "image" ? [block.data] : [])),
|
|
382
|
+
);
|
|
383
|
+
const generated = (images.get(event.toolCallId) ?? []).filter(
|
|
384
|
+
(block) => !shown.has(block.data),
|
|
385
|
+
);
|
|
285
386
|
images.delete(event.toolCallId);
|
|
286
387
|
for (const [child, parent] of parents)
|
|
287
388
|
if (parent === event.toolCallId) parents.delete(child);
|
|
@@ -329,6 +430,15 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
329
430
|
: `${original}\n\nThis result has no verified text selection: ${targetUnavailable}\nRead/Search the file before the next edit; do not repeat the applied edit.`;
|
|
330
431
|
const resources = resultResources(outcome);
|
|
331
432
|
const shown = store.publish(outcome, readable, context.cwd, resources);
|
|
433
|
+
const succeeded = !event.isError && outcome.status !== "error";
|
|
434
|
+
const value =
|
|
435
|
+
event.toolName === "search" && succeeded
|
|
436
|
+
? searchFacts(outcome, shown)
|
|
437
|
+
: event.toolName === "read"
|
|
438
|
+
? succeeded
|
|
439
|
+
? readValue(event.content, shown)
|
|
440
|
+
: undefined
|
|
441
|
+
: providerValue(event.details);
|
|
332
442
|
const parent = parents.get(event.toolCallId);
|
|
333
443
|
parents.delete(event.toolCallId);
|
|
334
444
|
if (parent !== undefined) {
|
|
@@ -340,6 +450,8 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
340
450
|
{ type: "text" as const, text: shown },
|
|
341
451
|
...event.content.filter((block) => block.type !== "text"),
|
|
342
452
|
],
|
|
453
|
+
// Keep private records hidden; only the declared public script value survives.
|
|
454
|
+
...(value !== undefined && { structuredContent: value }),
|
|
343
455
|
};
|
|
344
456
|
});
|
|
345
457
|
};
|