pi-agent-ide 0.8.0 → 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 +70 -40
- package/README.md +15 -8
- package/dist/{chunk-ICDI27GZ.js → chunk-235QMMVA.js} +1 -1
- package/dist/{chunk-N7LMRL64.js → chunk-47SPPIXK.js} +1 -1
- package/dist/chunk-4DIUPEDF.js +2 -0
- package/dist/{chunk-JMVDFOTQ.js → chunk-57F5GTHO.js} +1 -1
- package/dist/{chunk-NULNW6GK.js → chunk-6FGLAVPJ.js} +1 -1
- package/dist/{chunk-KL776TGR.js → chunk-6H32W35W.js} +1 -1
- package/dist/{chunk-QP2QSQ4U.js → chunk-6OJ565FL.js} +1 -1
- package/dist/{chunk-TWWND6NI.js → chunk-6R3Y4AD3.js} +1 -1
- package/dist/{chunk-CPZJPGLG.js → chunk-6T7PSDQW.js} +1 -1
- package/dist/{chunk-4OYVLXWD.js → chunk-6TJPMBUQ.js} +1 -1
- package/dist/{chunk-SBLKPTL3.js → chunk-6XFUICD7.js} +1 -1
- package/dist/chunk-7VSVJRRF.js +28 -0
- package/dist/{chunk-7JV4VN73.js → chunk-AAC77UD4.js} +1 -1
- package/dist/chunk-ANM3Y5FO.js +11 -0
- package/dist/chunk-BB4A5UI3.js +5 -0
- package/dist/{chunk-7TJ6DWW3.js → chunk-CPELC6JE.js} +1 -1
- package/dist/chunk-FTPC44FP.js +33 -0
- package/dist/{chunk-SBNR4WZF.js → chunk-GSOYVIQS.js} +1 -1
- package/dist/{chunk-Z3PGADVA.js → chunk-HSRH76JN.js} +1 -1
- package/dist/{chunk-CSXHCSTH.js → chunk-HSZ4AQ6L.js} +1 -1
- package/dist/chunk-I6NPILT5.js +1 -0
- package/dist/chunk-K7SRNBIV.js +1 -0
- package/dist/{chunk-R5XJSEOE.js → chunk-LCWBVOII.js} +3 -3
- package/dist/{chunk-MZXX353D.js → chunk-LEJKDYCK.js} +1 -1
- package/dist/{chunk-3G54ZL2L.js → chunk-NJ7C4KMA.js} +1 -1
- package/dist/{chunk-CTJV77FR.js → chunk-NUM3YQGK.js} +1 -1
- package/dist/chunk-OJEIX7OZ.js +1 -0
- package/dist/{chunk-EY65TFHJ.js → chunk-PJL3UVMJ.js} +1 -1
- package/dist/{chunk-E4HPRLRB.js → chunk-QT3EAHOG.js} +1 -1
- package/dist/{chunk-HCN5W76B.js → chunk-RIJMXO43.js} +1 -1
- package/dist/chunk-RMI3NMQY.js +23 -0
- package/dist/chunk-RQ7JJ7GV.js +4 -0
- package/dist/{chunk-4XPUN4QN.js → chunk-RVU73VKN.js} +1 -1
- package/dist/{chunk-OJX3RJ5A.js → chunk-RW2GTYQI.js} +1 -1
- package/dist/{chunk-PNP2KNGP.js → chunk-SDAH3ECM.js} +1 -1
- package/dist/chunk-SGQWRIRJ.js +10 -0
- package/dist/{chunk-IUSLSROY.js → chunk-SMIFCAAX.js} +1 -1
- package/dist/chunk-SWBJS3U4.js +1 -0
- package/dist/chunk-T7MWQQIF.js +3 -0
- package/dist/{chunk-RAZP42IQ.js → chunk-VAXLSPPU.js} +1 -1
- package/dist/{chunk-XZDOVPRC.js → chunk-VMTOFEXF.js} +1 -1
- package/dist/{chunk-7HDK3NRQ.js → chunk-VXP5BMW7.js} +1 -1
- package/dist/{chunk-WE42GBGU.js → chunk-XAHU42FP.js} +3 -3
- package/dist/{chunk-UBH6X3D3.js → chunk-XBQR74IK.js} +1 -1
- package/dist/{chunk-7NS3QUIE.js → chunk-XG7QNAKW.js} +1 -1
- package/dist/{chunk-GW6NZQTQ.js → chunk-XLWCSJMR.js} +1 -1
- package/dist/{chunk-2K65BSXS.js → chunk-XXLLY66B.js} +1 -1
- package/dist/chunk-YFP4P2FV.js +1 -0
- package/dist/{chunk-75SWXD2Z.js → chunk-YIXP2ALP.js} +1 -1
- package/dist/{chunk-MOJ5RR35.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 -0
- package/dist/entry-19.js +1 -1
- 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 -2
- package/dist/entry-27.js +1 -1
- package/dist/entry-28.js +1 -4
- package/dist/entry-29.js +2 -1
- 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 -18
- package/dist/entry-33.js +1 -1
- 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 -25
- package/dist/entry-47.js +1 -1
- 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 -3
- package/dist/entry-52.js +1 -13
- package/dist/entry-53.js +1 -1
- 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 -0
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -0
- package/dist/entry-65.js +0 -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 -0
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -0
- package/dist/entry-75.js +0 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +0 -1
- package/dist/entry-78.js +1 -80
- package/dist/entry-79.js +1 -21
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +1 -2
- package/dist/entry-81.js +80 -1
- package/dist/entry-82.js +22 -1
- package/dist/entry-83.js +2 -1
- package/dist/entry-84.js +1 -3
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -1
- package/dist/entry-88.js +3 -0
- 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 +53 -31
- package/docs/agent-guides/debugger.md +2 -0
- package/docs/agent-guides/editing.md +3 -3
- package/docs/agent-guides/search-code.md +5 -3
- package/docs/agent-guides/select-code.md +9 -6
- package/docs/agent-guides/ssh.md +1 -1
- package/docs/code-review.md +5 -0
- package/docs/configuration.md +52 -8
- package/docs/development.md +9 -13
- package/docs/directory-operations.md +1 -1
- package/docs/extensions.md +99 -2
- package/docs/releases.md +1 -1
- package/docs/settings-help.md +39 -0
- package/docs/structured-results.md +11 -6
- package/docs/tools.md +1 -0
- package/docs/user-hooks.md +4 -2
- package/node_modules/pi-agent-doctor/package.json +7 -10
- package/node_modules/pi-agent-doctor/runtime/entry-26.js +1 -0
- 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 -7
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-31.js +2 -0
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-33.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +15 -41
- package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +1 -0
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +6 -5
- package/node_modules/pi-agent-ide-changes/package.json +10 -11
- 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-languages/runtime/entry-39.js +2 -0
- 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 -13
- 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 -4
- package/node_modules/pi-agent-read/package.json +12 -12
- package/node_modules/pi-agent-read/runtime/entry-46.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-resource/src/result-targets.ts +9 -0
- package/node_modules/pi-agent-search/package.json +9 -9
- package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-52.js +1 -0
- package/node_modules/pi-agent-search/runtime/entry-54.js +2 -0
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/presentation.ts +10 -2
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/node_modules/pi-agent-search/src/api/search.ts +7 -0
- package/node_modules/pi-agent-search/src/core/search-core.ts +23 -3
- package/node_modules/pi-agent-search-text/index.ts +2 -0
- 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-57.js +1 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +18 -10
- package/node_modules/pi-agent-search-text/src/search-session.ts +68 -9
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-59.js +1 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -6
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-61.js +1 -0
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-62.js +2 -0
- 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 -34
- package/node_modules/pi-agent-text-editor/runtime/entry-78.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-79.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-80.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-81.js +2 -0
- package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +1 -1
- 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/api/native-edit-batch-event.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +4 -1
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +40 -11
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +29 -20
- package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/core/text-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 +35 -14
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
- package/node_modules/pi-agent-text-editor/src/core/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 -8
- 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 +35 -2
- 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-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 -11
- package/node_modules/pi-agent-web-html/package.json +3 -5
- package/node_modules/pi-agent-web-html/runtime/entry-88.js +2 -0
- 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 +65 -53
- package/skills/configure-agent-ide/SKILL.md +38 -0
- package/src/api/approval.ts +5 -0
- package/src/api/content.ts +6 -0
- package/src/api/settings.ts +198 -0
- package/src/api/tips.ts +3 -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 +90 -9
- package/src/composite/preferences.ts +13 -0
- package/src/composite/search-facts.ts +45 -0
- package/src/composite/settings-documentation.ts +68 -0
- package/src/composite/settings-help.ts +106 -0
- package/src/composite/settings-registry.ts +94 -0
- package/src/composite/text-results.ts +170 -30
- 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/extension.ts +12 -0
- package/src/documentation/registry.ts +10 -2
- package/src/documentation/search.ts +166 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +6 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-31.js +2 -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-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 -11
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +2 -0
- 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-46.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-47.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/index.ts +2 -0
- 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-56.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/src/search-backend.ts +18 -10
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +68 -9
- package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-52.js +1 -0
- 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/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/presentation.ts +10 -2
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/src/extensions/pi-agent-search/src/api/search.ts +7 -0
- package/src/extensions/pi-agent-search/src/core/search-core.ts +23 -3
- package/src/extensions/pi-agent-text-editor/index.ts +2 -0
- package/src/extensions/pi-agent-text-editor/package.json +26 -34
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-62.js +2 -0
- 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 -8
- 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 +35 -2
- 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/runtime/entry-78.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-79.js +1 -0
- 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/delete-guard.ts +1 -1
- 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/api/native-edit-batch-event.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +4 -1
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +40 -11
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +29 -20
- package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-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 +35 -14
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
- package/src/extensions/pi-agent-text-editor/src/core/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 +74 -15
- package/src/plugins/pi-agent-ide-ast/package.json +15 -41
- package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +1 -0
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +6 -5
- package/src/plugins/pi-agent-ide-changes/package.json +10 -11
- 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-languages/runtime/entry-39.js +2 -0
- 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 -13
- 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/src/tips/core.ts +5 -2
- package/src/tips/extension.ts +30 -2
- package/src/tips/persistence.ts +29 -27
- package/src/tips/setup-hint.ts +19 -0
- package/dist/chunk-3ZGDMTMD.js +0 -25
- package/dist/chunk-5KFVDYCI.js +0 -1
- package/dist/chunk-ABFCAOU5.js +0 -1
- package/dist/chunk-BIG45IPN.js +0 -2
- package/dist/chunk-BMOJTJJJ.js +0 -3
- package/dist/chunk-BQ67M4NC.js +0 -3
- package/dist/chunk-IH5NW5JX.js +0 -11
- package/dist/chunk-NRZO5KJT.js +0 -9
- package/dist/chunk-O36UC74T.js +0 -1
- package/dist/chunk-OLI3JPHJ.js +0 -28
- package/dist/chunk-SSWUUBIR.js +0 -1
- package/dist/chunk-UUJJRXHG.js +0 -29
- package/dist/entry-21.js +0 -1
- package/docs/research/apply-native-capability-matrix.md +0 -174
- package/docs/research/apply-read-latency.md +0 -221
- package/docs/research/codemode-write-context.md +0 -56
- package/docs/research/lpt-393-fuzzy-results/file.json +0 -152
- package/docs/research/lpt-393-fuzzy-results/repo.json +0 -122
- package/docs/research/lpt-393-search-fuzzy-fallback.md +0 -97
- package/docs/research/native-codemode-batch-decision.md +0 -31
- package/docs/research/native-codemode-batching.md +0 -65
- package/node_modules/pi-agent-doctor/runtime/entry-19.js +0 -1
- package/node_modules/pi-agent-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-26.js +0 -2
- package/node_modules/pi-agent-filesystem-image/runtime/entry-27.js +0 -2
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-28.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-31.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-33.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-34.js +0 -2
- package/node_modules/pi-agent-ide-languages/runtime/entry-36.js +0 -2
- package/node_modules/pi-agent-image/runtime/entry-39.js +0 -1
- package/node_modules/pi-agent-invariant/runtime/entry-40.js +0 -1
- package/node_modules/pi-agent-pdf/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-52.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-57.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -2
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-61.js +0 -2
- package/node_modules/pi-agent-text-editor/runtime/entry-62.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-64.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-79.js +0 -2
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-81.js +0 -1
- package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +0 -1
- package/node_modules/pi-agent-web-html/runtime/entry-84.js +0 -2
- package/node_modules/pi-agent-web-image/runtime/entry-85.js +0 -2
- package/node_modules/pi-agent-web-pdf/runtime/entry-86.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-27.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-28.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-29.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-26.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-84.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-85.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-86.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-42.js +0 -1
- 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-52.js +0 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +0 -1
- 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-57.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-61.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-79.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-62.js +0 -1
- 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-31.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-32.js +0 -2
- package/src/plugins/pi-agent-ide-changes/runtime/entry-33.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-34.js +0 -2
- package/src/plugins/pi-agent-ide-languages/runtime/entry-36.js +0 -2
- /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-25.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-pdf}/runtime/entry-32.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
- /package/node_modules/{pi-agent-read → 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-47.js +0 -0
- /package/node_modules/{pi-agent-search → 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-search-text → pi-agent-search}/runtime/entry-53.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-56.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-search-text}/runtime/entry-58.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-web → pi-agent-text-editor-stale-anchor}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web}/runtime/entry-87.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
- /package/src/extensions/{pi-agent-search → pi-agent-read}/runtime/entry-48.js +0 -0
- /package/src/extensions/{pi-agent-text-editor/plugins/pi-agent-text-anchor-exact → pi-agent-search/plugins/pi-agent-search-text}/runtime/entry-58.js +0 -0
- /package/src/extensions/{pi-agent-read/extensions/pi-agent-web → pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor}/runtime/entry-83.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { AgentDocumentation } from "#src/api/documentation.js";
|
|
2
|
+
import { BUILTIN_EXTENSIONS } from "./builtin-extensions.js";
|
|
3
|
+
import type { FeatureFlag } from "./feature-flags.js";
|
|
4
|
+
import { AGENT_IDE_PREFERENCES, type AgentIdePreference } from "./preferences.js";
|
|
5
|
+
import { AGENT_IDE_PRESET_OPTIONS } from "./presets.js";
|
|
6
|
+
|
|
7
|
+
/** Build an explicit, read-only guide from the same descriptors as the settings menu. */
|
|
8
|
+
export function createIdeSettingsDocumentation(
|
|
9
|
+
flags: readonly FeatureFlag[],
|
|
10
|
+
preferences: readonly AgentIdePreference[] = AGENT_IDE_PREFERENCES,
|
|
11
|
+
): AgentDocumentation {
|
|
12
|
+
return {
|
|
13
|
+
id: "ide-settings",
|
|
14
|
+
description:
|
|
15
|
+
"Registered IDE settings, choices, defaults, configuration scopes and inheritance.",
|
|
16
|
+
triggers: [{ tool: "read", resourcePrefixes: ["docs:ide-settings"] }],
|
|
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
|
|
39
|
+
|
|
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.
|
|
41
|
+
|
|
42
|
+
## Configuration scopes
|
|
43
|
+
|
|
44
|
+
- Project: <current project>/.pi/pi-agent-ide/extensions.json.
|
|
45
|
+
- Global: <PI_CODING_AGENT_DIR>/pi-agent-ide/extensions.json when that environment variable is non-empty; otherwise <home>/.pi/agent/pi-agent-ide/extensions.json. Resolve a relative PI_CODING_AGENT_DIR against the process working directory.
|
|
46
|
+
- Missing files mean no overrides. Invalid JSON or invalid field types are errors, not defaults.
|
|
47
|
+
- preferences maps registered IDs to strings; flags maps registered IDs to booleans. Project overrides Global per key. Default removes only the selected scope's key, allowing inheritance.
|
|
48
|
+
- preset is a registered preset value. Project overrides Global; without either, full is used. Default removes the selected scope's preset field.
|
|
49
|
+
- disabled and enabled are arrays of unique non-empty module IDs, merged across scopes. Disabled wins in either scope and cascades to dependents. enabled can activate default-off modules and dependencies; it cannot undo a disable or a preset restriction.
|
|
50
|
+
- A module's default below is its built-in default before preset and dependency selection, not its current effective state.
|
|
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.
|
|
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.
|
|
55
|
+
|
|
56
|
+
## Registered settings
|
|
57
|
+
|
|
58
|
+
Choices carry their saved value and human label. Text settings carry a description and optional placeholder. Boolean flag defaults do not include saved or CLI overrides. Preserve unrelated fields when editing configuration.
|
|
59
|
+
|
|
60
|
+
\`\`\`json
|
|
61
|
+
{
|
|
62
|
+
${json}
|
|
63
|
+
}
|
|
64
|
+
\`\`\`
|
|
65
|
+
`;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { getMarkdownTheme, type ExtensionAPI, type Theme } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
import {
|
|
5
|
+
Markdown,
|
|
6
|
+
matchesKey,
|
|
7
|
+
ScrollView,
|
|
8
|
+
truncateToWidth,
|
|
9
|
+
type Component,
|
|
10
|
+
} from "@earendil-works/pi-tui";
|
|
11
|
+
|
|
12
|
+
/** Read the shipped human guide, independently of optional documentation modules. */
|
|
13
|
+
export function readSettingsHelp(): Promise<string> {
|
|
14
|
+
return readFile(
|
|
15
|
+
path.join(path.dirname(path.dirname(import.meta.dirname)), "docs/settings-help.md"),
|
|
16
|
+
"utf8",
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Register local settings help without adding history, context or a model turn. */
|
|
21
|
+
export function registerSettingsHelp(pi: Pick<ExtensionAPI, "registerCommand">): void {
|
|
22
|
+
pi.registerCommand("agent-ide-help", {
|
|
23
|
+
description: "Read the short Agent IDE settings guide",
|
|
24
|
+
async handler(_args, ctx) {
|
|
25
|
+
if (ctx.mode !== "tui" || !ctx.hasUI) return;
|
|
26
|
+
try {
|
|
27
|
+
const content = await readSettingsHelp();
|
|
28
|
+
await ctx.ui.custom<void>(
|
|
29
|
+
(tui, theme, _keys, done) =>
|
|
30
|
+
new SettingsHelpPanel(
|
|
31
|
+
content,
|
|
32
|
+
theme,
|
|
33
|
+
() => Math.max(5, Math.min(36, tui.terminal.rows - 4)),
|
|
34
|
+
() => tui.requestRender(),
|
|
35
|
+
done,
|
|
36
|
+
),
|
|
37
|
+
{ overlay: true, overlayOptions: { width: 92, margin: 1 } },
|
|
38
|
+
);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** A bounded Markdown viewport with keyboard scrolling and no persistent state. */
|
|
47
|
+
export class SettingsHelpPanel implements Component {
|
|
48
|
+
private markdown: Markdown;
|
|
49
|
+
private scroll: ScrollView;
|
|
50
|
+
|
|
51
|
+
constructor(
|
|
52
|
+
private readonly content: string,
|
|
53
|
+
private readonly theme: Theme,
|
|
54
|
+
private readonly height: () => number,
|
|
55
|
+
private readonly requestRender: () => void,
|
|
56
|
+
private readonly done: () => void,
|
|
57
|
+
) {
|
|
58
|
+
this.markdown = this.createMarkdown();
|
|
59
|
+
this.scroll = new ScrollView(this.markdown);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private createMarkdown(): Markdown {
|
|
63
|
+
return new Markdown(this.content, 0, 0, getMarkdownTheme(), {
|
|
64
|
+
color: (text) => this.theme.fg("text", text),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
invalidate(): void {
|
|
69
|
+
this.markdown.invalidate();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
handleInput(data: string): void {
|
|
73
|
+
if (matchesKey(data, "escape")) {
|
|
74
|
+
this.done();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (matchesKey(data, "up")) this.scroll.scrollBy(-1);
|
|
78
|
+
else if (matchesKey(data, "down")) this.scroll.scrollBy(1);
|
|
79
|
+
else if (matchesKey(data, "pageUp")) this.scroll.scrollBy(-this.scroll.viewportHeight);
|
|
80
|
+
else if (matchesKey(data, "pageDown") || matchesKey(data, "space"))
|
|
81
|
+
this.scroll.scrollBy(this.scroll.viewportHeight);
|
|
82
|
+
else if (matchesKey(data, "home")) this.scroll.scrollToStart();
|
|
83
|
+
else if (matchesKey(data, "end")) this.scroll.scrollToEnd();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
render(width: number): string[] {
|
|
87
|
+
const inner = Math.max(1, width - 4);
|
|
88
|
+
const rows = this.markdown.render(inner);
|
|
89
|
+
const viewport = Math.max(1, this.height() - 4);
|
|
90
|
+
this.scroll.updateLayout(rows.length, viewport, this.requestRender);
|
|
91
|
+
const page = rows.slice(this.scroll.scrollTop, this.scroll.scrollTop + viewport);
|
|
92
|
+
while (page.length < viewport) page.push("");
|
|
93
|
+
const border = this.theme.fg("border", "─".repeat(Math.max(0, width - 2)));
|
|
94
|
+
const row = (text: string) =>
|
|
95
|
+
this.theme.fg("border", "│ ") +
|
|
96
|
+
truncateToWidth(text, inner, "…", true) +
|
|
97
|
+
this.theme.fg("border", " │");
|
|
98
|
+
return [
|
|
99
|
+
this.theme.fg("border", "╭") + border + this.theme.fg("border", "╮"),
|
|
100
|
+
row(this.theme.fg("accent", "Agent IDE settings help")),
|
|
101
|
+
...page.map(row),
|
|
102
|
+
row(this.theme.fg("muted", "↑↓ scroll · PgUp/PgDn page · Home/End · Esc close")),
|
|
103
|
+
this.theme.fg("border", "╰") + border + this.theme.fg("border", "╯"),
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import type {
|
|
3
|
+
MessageEndEvent,
|
|
4
|
+
MessageEndEventResult,
|
|
2
5
|
ExtensionAPI,
|
|
3
6
|
ExtensionHandler,
|
|
4
7
|
ToolCallEvent,
|
|
5
8
|
ToolCallEventResult,
|
|
6
9
|
AgentToolResult,
|
|
7
10
|
} from "@earendil-works/pi-coding-agent";
|
|
11
|
+
import type { JsonValue } from "@earendil-works/pi-ai";
|
|
8
12
|
import { connectResultTargets, TempResourceStore } from "pi-agent-resource";
|
|
9
13
|
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
10
14
|
import { READ_PROTOCOL, READ_API_VERSION } from "pi-agent-read/api/plugin-protocol";
|
|
11
15
|
import { limitIdeOutput } from "./output-limits.js";
|
|
16
|
+
import { searchFacts, searchFactsSchema } from "./search-facts.js";
|
|
12
17
|
|
|
13
18
|
const sourceFields: Record<string, readonly string[]> = {
|
|
14
19
|
read: ["path"],
|
|
@@ -24,14 +29,106 @@ const sourceFields: Record<string, readonly string[]> = {
|
|
|
24
29
|
diff: ["before", "after"],
|
|
25
30
|
};
|
|
26
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
|
+
|
|
27
105
|
/** Keep tool records private while strings carry registered composition references. */
|
|
28
106
|
export function createIdeTextResults(pi: ExtensionAPI) {
|
|
29
107
|
const store = connectResultTargets(pi);
|
|
30
108
|
const names = new Set<string>();
|
|
31
109
|
const outputs = new TempResourceStore();
|
|
32
110
|
const saveFullOutput = (text: string) => outputs.saveFile(text);
|
|
33
|
-
const
|
|
34
|
-
|
|
111
|
+
const contextErrors = new Map<
|
|
112
|
+
string,
|
|
113
|
+
{ source: string; content: Promise<AgentToolResult<unknown>["content"]> }
|
|
114
|
+
>();
|
|
115
|
+
const signature = (content: AgentToolResult<unknown>["content"]) =>
|
|
116
|
+
createHash("sha256").update(JSON.stringify(content)).digest("hex");
|
|
117
|
+
const limitError = async (id: string, content: AgentToolResult<unknown>["content"]) => {
|
|
118
|
+
const source = signature(content);
|
|
119
|
+
const cached = contextErrors.get(id);
|
|
120
|
+
if (cached && (cached.source === source || signature(await cached.content) === source))
|
|
121
|
+
return cached.content;
|
|
122
|
+
const limited = limitIdeOutput(content, "", saveFullOutput).then((output) => [
|
|
123
|
+
{
|
|
124
|
+
type: "text" as const,
|
|
125
|
+
text: output.text + (output.notices.length ? `\n\n${output.notices.join("\n")}` : ""),
|
|
126
|
+
},
|
|
127
|
+
...output.images,
|
|
128
|
+
]);
|
|
129
|
+
contextErrors.set(id, { source, content: limited });
|
|
130
|
+
return limited;
|
|
131
|
+
};
|
|
35
132
|
// Read core owns deferred registration and reports setup failures.
|
|
36
133
|
void connectReadPlugin(pi, {
|
|
37
134
|
protocol: READ_PROTOCOL,
|
|
@@ -44,6 +141,26 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
44
141
|
pi.on("session_shutdown", () => outputs.dispose());
|
|
45
142
|
const on: ExtensionAPI["on"] = (event, handler) => {
|
|
46
143
|
// The SDK overloads describe event/handler pairs; forwarding keeps the original pair.
|
|
144
|
+
if (event === "message_end") {
|
|
145
|
+
const messageHandler = handler as ExtensionHandler<MessageEndEvent, MessageEndEventResult>;
|
|
146
|
+
return pi.on("message_end", async (messageEvent, context) => {
|
|
147
|
+
const result = await messageHandler(messageEvent, context);
|
|
148
|
+
const message = result?.message ?? messageEvent.message;
|
|
149
|
+
if (
|
|
150
|
+
message.role !== "toolResult" ||
|
|
151
|
+
!message.isError ||
|
|
152
|
+
!names.has(message.toolName) ||
|
|
153
|
+
message.content.some(
|
|
154
|
+
(block) => block.type === "text" && block.text.startsWith("<system-result"),
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
return result;
|
|
158
|
+
return {
|
|
159
|
+
...result,
|
|
160
|
+
message: { ...message, content: await limitError(message.toolCallId, message.content) },
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}
|
|
47
164
|
const toolCallHandler = handler as ExtensionHandler<ToolCallEvent, ToolCallEventResult>;
|
|
48
165
|
if (event !== "tool_call") return pi.on(event as "tool_call", toolCallHandler);
|
|
49
166
|
return pi.on("tool_call", async (call, context) => {
|
|
@@ -54,7 +171,6 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
54
171
|
"",
|
|
55
172
|
saveFullOutput,
|
|
56
173
|
);
|
|
57
|
-
boundedErrors.add(call.toolCallId);
|
|
58
174
|
return {
|
|
59
175
|
...result,
|
|
60
176
|
reason: limited.text + (limited.notices.length ? `\n\n${limited.notices.join("\n")}` : ""),
|
|
@@ -62,21 +178,18 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
62
178
|
});
|
|
63
179
|
};
|
|
64
180
|
const parents = new Map<string, string>();
|
|
65
|
-
const images = new Map<
|
|
66
|
-
string,
|
|
67
|
-
Extract<AgentToolResult<unknown>["content"][number], { type: "image" }>[]
|
|
68
|
-
>();
|
|
181
|
+
const images = new Map<string, ImageBlock[]>();
|
|
69
182
|
const clear = () => {
|
|
70
183
|
parents.clear();
|
|
71
184
|
images.clear();
|
|
72
|
-
boundedErrors.clear();
|
|
73
185
|
contextErrors.clear();
|
|
74
186
|
};
|
|
75
187
|
pi.on("session_start", clear);
|
|
76
188
|
pi.on("session_shutdown", clear);
|
|
77
|
-
pi.on("before_agent_start", (event) =>
|
|
78
|
-
|
|
79
|
-
|
|
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
|
+
});
|
|
80
193
|
pi.on("tool_execution_start", (event) => {
|
|
81
194
|
if (event.parentToolCallId !== undefined)
|
|
82
195
|
parents.set(event.toolCallId, parents.get(event.parentToolCallId) ?? event.parentToolCallId);
|
|
@@ -144,7 +257,29 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
144
257
|
names.add(definition.name);
|
|
145
258
|
const publicDefinition = {} as typeof definition;
|
|
146
259
|
const descriptors = Object.getOwnPropertyDescriptors(definition);
|
|
260
|
+
// Keep readable composition strings except for explicitly declared public script values.
|
|
147
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
|
+
};
|
|
148
283
|
const execute: typeof definition.execute = async (...args) => {
|
|
149
284
|
const result = await definition.execute(...args).catch(async (error: unknown) => {
|
|
150
285
|
const limited = await limitIdeOutput(
|
|
@@ -152,7 +287,6 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
152
287
|
"",
|
|
153
288
|
saveFullOutput,
|
|
154
289
|
);
|
|
155
|
-
boundedErrors.add(args[0]);
|
|
156
290
|
if (limited.notices.length === 0) throw error;
|
|
157
291
|
throw new Error(limited.text + `\n\n${limited.notices.join("\n")}`, { cause: error });
|
|
158
292
|
});
|
|
@@ -218,8 +352,8 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
218
352
|
pi.registerTool(publicDefinition);
|
|
219
353
|
};
|
|
220
354
|
const finalize = () => {
|
|
221
|
-
//
|
|
222
|
-
//
|
|
355
|
+
// Validation can skip tool hooks, and later guards can replace an already bounded reason.
|
|
356
|
+
// Limit the actual unpublished error at the provider boundary; keep saved records unchanged.
|
|
223
357
|
pi.on("context", async (event) => ({
|
|
224
358
|
messages: await Promise.all(
|
|
225
359
|
event.messages.map(async (message) => {
|
|
@@ -227,33 +361,28 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
227
361
|
message.role !== "toolResult" ||
|
|
228
362
|
!message.isError ||
|
|
229
363
|
!names.has(message.toolName) ||
|
|
230
|
-
boundedErrors.has(message.toolCallId) ||
|
|
231
364
|
message.content.some(
|
|
232
365
|
(block) => block.type === "text" && block.text.startsWith("<system-result"),
|
|
233
366
|
)
|
|
234
367
|
)
|
|
235
368
|
return message;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
content
|
|
239
|
-
|
|
240
|
-
type: "text" as const,
|
|
241
|
-
text:
|
|
242
|
-
limited.text +
|
|
243
|
-
(limited.notices.length ? `\n\n${limited.notices.join("\n")}` : ""),
|
|
244
|
-
},
|
|
245
|
-
...limited.images,
|
|
246
|
-
]);
|
|
247
|
-
contextErrors.set(message.toolCallId, content);
|
|
248
|
-
}
|
|
249
|
-
return { ...message, content: await content };
|
|
369
|
+
return {
|
|
370
|
+
...message,
|
|
371
|
+
content: await limitError(message.toolCallId, message.content),
|
|
372
|
+
};
|
|
250
373
|
}),
|
|
251
374
|
),
|
|
252
375
|
}));
|
|
253
376
|
pi.on("tool_result", async (event, context) => {
|
|
254
377
|
if (event.toolName === "codemode") {
|
|
255
378
|
store.refreshAll();
|
|
256
|
-
|
|
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
|
+
);
|
|
257
386
|
images.delete(event.toolCallId);
|
|
258
387
|
for (const [child, parent] of parents)
|
|
259
388
|
if (parent === event.toolCallId) parents.delete(child);
|
|
@@ -301,6 +430,15 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
301
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.`;
|
|
302
431
|
const resources = resultResources(outcome);
|
|
303
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);
|
|
304
442
|
const parent = parents.get(event.toolCallId);
|
|
305
443
|
parents.delete(event.toolCallId);
|
|
306
444
|
if (parent !== undefined) {
|
|
@@ -312,6 +450,8 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
312
450
|
{ type: "text" as const, text: shown },
|
|
313
451
|
...event.content.filter((block) => block.type !== "text"),
|
|
314
452
|
],
|
|
453
|
+
// Keep private records hidden; only the declared public script value survives.
|
|
454
|
+
...(value !== undefined && { structuredContent: value }),
|
|
315
455
|
};
|
|
316
456
|
});
|
|
317
457
|
};
|
|
@@ -37,8 +37,16 @@ export function createIdeToolAvailability<TApi extends AvailabilityApi>(pi: TApi
|
|
|
37
37
|
|
|
38
38
|
return {
|
|
39
39
|
api: { ...pi, registerTool },
|
|
40
|
-
/**
|
|
41
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Enforce exclusions. At session startup, also make deferred IDE tools discoverable through
|
|
42
|
+
* tool_search, and activate configured or restored tools unless the host already owns that
|
|
43
|
+
* loadout (`hostLoadout`).
|
|
44
|
+
*/
|
|
45
|
+
reconcile(
|
|
46
|
+
activateDefaults = false,
|
|
47
|
+
restoredTools: readonly string[] = [],
|
|
48
|
+
hostLoadout = false,
|
|
49
|
+
): void {
|
|
42
50
|
const excluded = new Set<string>();
|
|
43
51
|
const requested = new Set<string>();
|
|
44
52
|
for (const entry of pi.getSettings().defaultTools ?? []) {
|
|
@@ -68,6 +76,7 @@ export function createIdeToolAvailability<TApi extends AvailabilityApi>(pi: TApi
|
|
|
68
76
|
for (const tool of available) {
|
|
69
77
|
if (
|
|
70
78
|
activateDefaults &&
|
|
79
|
+
!hostLoadout &&
|
|
71
80
|
definitions.has(tool.name) &&
|
|
72
81
|
(requested.has(tool.name) ||
|
|
73
82
|
(tool.exposure === "deferred" && restoredTools.includes(tool.name)))
|