pi-agent-ide 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +12 -8
- package/dist/{chunk-XNXQYPVT.js → chunk-4LUW26BX.js} +1 -1
- package/dist/chunk-5MSNYFDE.js +1 -0
- package/dist/chunk-5VSE5X5R.js +2 -0
- package/dist/chunk-6EYWFBNG.js +0 -0
- package/dist/{chunk-ORAPGW7W.js → chunk-72EEL2DW.js} +1 -1
- package/dist/{chunk-T2RPMEM2.js → chunk-7UGNGK7Y.js} +1 -1
- package/dist/{chunk-STUZZM5B.js → chunk-AADJ2KIB.js} +1 -1
- package/dist/{chunk-SMSIT3CE.js → chunk-B5KB2I7J.js} +1 -1
- package/dist/chunk-BHSO2MDK.js +6 -0
- package/dist/chunk-BMOJTJJJ.js +3 -0
- package/dist/{chunk-EEH4WYI7.js → chunk-CEKXBS55.js} +1 -1
- package/dist/chunk-CW53ZTU3.js +2 -0
- package/dist/chunk-EWNWKDMP.js +4 -0
- package/dist/{chunk-VSP2QQPQ.js → chunk-GIRAEVUJ.js} +1 -1
- package/dist/{chunk-MTTKFJV6.js → chunk-GUTQ3PWL.js} +1 -1
- package/dist/chunk-HGPUI7F3.js +1 -0
- package/dist/{chunk-OBWZ5RYN.js → chunk-HKMBQLEK.js} +1 -1
- package/dist/chunk-ITSNK5YG.js +7 -0
- package/dist/chunk-KAB3AYA2.js +1 -0
- package/dist/{chunk-266RH77Z.js → chunk-LRYE2WCN.js} +1 -1
- package/dist/chunk-M5L42DWE.js +7 -0
- package/dist/chunk-M5MJP7Z2.js +1 -0
- package/dist/chunk-NMFQGKPE.js +2 -0
- package/dist/chunk-NTYXZ3EL.js +3 -0
- package/dist/{chunk-PETQCA7G.js → chunk-QDST6VIU.js} +1 -1
- package/dist/chunk-QIJMV2P2.js +2 -0
- package/dist/chunk-RHV5STR3.js +3 -0
- package/dist/chunk-ROXXK6TW.js +0 -0
- package/dist/chunk-S3ZPXWX7.js +2 -0
- package/dist/chunk-SSHZEWWV.js +1 -0
- package/dist/chunk-TPIHQYK2.js +14 -0
- package/dist/chunk-VZJIZXSH.js +14 -0
- package/dist/chunk-YHADTHQM.js +1 -0
- package/dist/{chunk-KZBAJFCV.js → chunk-Z3VC3S2T.js} +1 -1
- package/dist/{chunk-SJYDLHEF.js → chunk-ZM4L5AGN.js} +1 -1
- package/dist/{chunk-E2RESHYR.js → chunk-ZTYWHL2F.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-2.js +1 -1
- package/dist/entry-21.js +2 -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 +12 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +4 -1
- package/dist/entry-32.js +9 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-35.js +1 -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 +18 -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 +7 -1
- package/dist/entry-46.js +11 -1
- package/dist/entry-47.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -0
- package/dist/entry-55.js +0 -1
- package/dist/entry-56.js +1 -0
- package/dist/entry-57.js +0 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.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 +0 -1
- package/dist/entry-65.js +1 -0
- package/dist/entry-66.js +0 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +123 -1
- package/dist/entry-71.js +30 -1
- package/dist/entry-72.js +2 -1
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +3 -1
- package/dist/entry-77.js +1 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/pi-agent-ide.js +3 -13
- package/docs/configuration.md +57 -11
- package/docs/extensions.md +4 -2
- package/docs/tools.md +7 -1
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +2 -2
- package/node_modules/pi-agent-filesystem/package.json +6 -6
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +9 -9
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/node_modules/pi-agent-ide-ast/src/extension.ts +11 -15
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +83 -0
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/node_modules/pi-agent-ide-changes/index.ts +22 -10
- package/node_modules/pi-agent-ide-changes/package.json +6 -6
- package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +5 -9
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +36 -13
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/index.ts +49 -17
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lint/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-lsp/index.ts +127 -20
- package/node_modules/pi-agent-ide-lsp/package.json +9 -8
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +25 -7
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +12 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-image/src/image-converter.ts +1 -1
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-pdf/src/pdf-converter.ts +1 -1
- package/node_modules/pi-agent-read/package.json +6 -6
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/node_modules/pi-agent-read/src/api/rendering.ts +3 -0
- package/node_modules/pi-agent-read/src/api/tools/read.ts +73 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +32 -28
- package/node_modules/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +87 -19
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/node_modules/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +87 -53
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -8
- package/node_modules/pi-agent-resource/src/resolver.ts +2 -0
- package/node_modules/pi-agent-search/package.json +3 -3
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/node_modules/pi-agent-search/src/api/search.ts +55 -1
- package/node_modules/pi-agent-search/src/core/extension.ts +8 -27
- package/node_modules/pi-agent-search/src/core/search-core.ts +38 -3
- package/node_modules/pi-agent-search-text/index.ts +82 -33
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/file-search.ts +9 -1
- package/node_modules/pi-agent-search-text/src/resolvers.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +112 -24
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
- package/node_modules/pi-agent-text/src/text-document.ts +5 -0
- package/node_modules/pi-agent-text/src/text-target.ts +4 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
- package/node_modules/pi-agent-text-editor/index.ts +1 -3
- package/node_modules/pi-agent-text-editor/package.json +34 -24
- package/node_modules/pi-agent-text-editor/runtime/entry-69.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/node_modules/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +74 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -9
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +28 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +43 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +40 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +178 -58
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +313 -21
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/node_modules/pi-agent-text-editor-renderer/index.ts +93 -2
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +69 -4
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +24 -13
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +1 -0
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-web/index.ts +1 -6
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/runtime/entry-75.js +2 -0
- package/node_modules/pi-agent-web/src/browser-loader.ts +1 -0
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/package.json +38 -38
- package/src/api/plugin-protocol.ts +12 -2
- package/src/api/text-editor.ts +7 -0
- package/src/api/tool-config.ts +77 -2
- package/src/code-view/diagnostic-view.ts +22 -3
- package/src/composite/builtin-extensions.ts +138 -67
- package/src/composite/extensions-config.ts +59 -0
- package/src/composite/feature-flags.ts +32 -0
- package/src/composite/module-labels.ts +55 -0
- package/src/composite/module-settings-store.ts +44 -0
- package/src/composite/module-settings.ts +132 -0
- package/src/composite/selection.ts +4 -4
- package/src/composite/settings-panel.ts +71 -0
- package/src/core/diagnostic-delivery.ts +29 -0
- package/src/core/diagnostic-entry.ts +142 -0
- package/src/core/diagnostic-store.ts +96 -23
- package/src/core/extension.ts +45 -22
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +1 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/browser-loader.ts +1 -0
- package/src/extensions/pi-agent-read/package.json +6 -6
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/src/extensions/pi-agent-read/src/api/rendering.ts +3 -0
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +73 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +32 -28
- package/src/extensions/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +87 -19
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +87 -53
- package/src/extensions/pi-agent-search/package.json +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +82 -33
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +9 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +112 -24
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +55 -1
- package/src/extensions/pi-agent-search/src/core/extension.ts +8 -27
- package/src/extensions/pi-agent-search/src/core/search-core.ts +38 -3
- package/src/extensions/pi-agent-text-editor/index.ts +1 -3
- package/src/extensions/pi-agent-text-editor/package.json +34 -24
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +93 -2
- 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/src/diff-model.ts +7 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +69 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +24 -13
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/runtime/entry-69.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/src/extensions/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +74 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -9
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +28 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +43 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +40 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +178 -58
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +313 -21
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/src/pi-agent-ide.ts +45 -0
- package/src/plugins/pi-agent-ide-ast/package.json +9 -9
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +11 -15
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +83 -0
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/src/plugins/pi-agent-ide-changes/index.ts +22 -10
- package/src/plugins/pi-agent-ide-changes/package.json +6 -6
- package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +5 -9
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +62 -26
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +36 -13
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/index.ts +49 -17
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-lsp/index.ts +127 -20
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -8
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +25 -7
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +12 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/src/post-edit/gate.ts +57 -15
- package/src/toolchain/types.ts +2 -0
- package/dist/chunk-2SKAED2I.js +0 -2
- package/dist/chunk-2XYXV5HS.js +0 -4
- package/dist/chunk-2ZMYT6ZC.js +0 -1
- package/dist/chunk-34ZQTTU2.js +0 -2
- package/dist/chunk-4SQQKEVD.js +0 -16
- package/dist/chunk-5BWUVAR4.js +0 -1
- package/dist/chunk-6DN7NO7L.js +0 -1
- package/dist/chunk-6SMFVLTY.js +0 -1
- package/dist/chunk-6XQQBKPE.js +0 -58
- package/dist/chunk-BYWAG6X3.js +0 -6
- package/dist/chunk-EW2KVKCN.js +0 -2
- package/dist/chunk-F6SESI3P.js +0 -4
- package/dist/chunk-GTK5AREE.js +0 -2
- package/dist/chunk-HOBTFFQR.js +0 -1
- package/dist/chunk-IMVCVPMP.js +0 -3
- package/dist/chunk-IOCABSRL.js +0 -1
- package/dist/chunk-JASLOB2X.js +0 -1
- package/dist/chunk-KH5KPBCR.js +0 -10
- package/dist/chunk-KNMWCDDK.js +0 -7
- package/dist/chunk-KYVOMBO5.js +0 -1
- package/dist/chunk-L4FA6OD4.js +0 -1
- package/dist/chunk-LFV6G5Z3.js +0 -1
- package/dist/chunk-LGN7EJYR.js +0 -13
- package/dist/chunk-MB6VVVAF.js +0 -2
- package/dist/chunk-MTQSGWZJ.js +0 -1
- package/dist/chunk-NI2NK4JU.js +0 -1
- package/dist/chunk-NXHPO7ER.js +0 -6
- package/dist/chunk-OFHVDY4Q.js +0 -2
- package/dist/chunk-OIL6BB2S.js +0 -33
- package/dist/chunk-ONWUJXUR.js +0 -1
- package/dist/chunk-PODWLGNO.js +0 -6
- package/dist/chunk-QZANC2IG.js +0 -1
- package/dist/chunk-SSZB66C3.js +0 -3
- package/dist/chunk-TG6H6EOI.js +0 -1
- package/dist/chunk-UTTW55S2.js +0 -1
- package/dist/chunk-VEJGSURY.js +0 -8
- package/dist/chunk-W3XYKJ5H.js +0 -1
- package/dist/chunk-XGUAL3CA.js +0 -1
- package/dist/chunk-YPHXLAQF.js +0 -1
- package/dist/chunk-ZIHEF6K3.js +0 -3
- package/dist/entry-80.js +0 -1
- package/node_modules/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/node_modules/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- package/node_modules/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/node_modules/pi-agent-text-editor-argument-order/package.json +0 -16
- package/node_modules/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/node_modules/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/node_modules/pi-agent-text-editor-overwrite/package.json +0 -17
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +0 -1
- package/node_modules/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +0 -16
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/runtime/entry-70.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +0 -17
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- /package/dist/{chunk-3H2EU7VQ.js → chunk-4U2GUKNJ.js} +0 -0
- /package/node_modules/{pi-agent-text-editor-argument-order → pi-agent-text-editor}/runtime/entry-70.js +0 -0
- /package/node_modules/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
package/dist/entry-72.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a as A}from"./chunk-OVUYPHDE.js";import{b as O}from"./chunk-YHADTHQM.js";import{a as I}from"./chunk-4LUW26BX.js";import{a as S}from"./chunk-MBUXFKIW.js";import"./chunk-GIRAEVUJ.js";import"./chunk-YHUTTZC6.js";import{a as k}from"./chunk-72EEL2DW.js";import{a as P,b as E}from"./chunk-KAB3AYA2.js";import{a as M}from"./chunk-CEKXBS55.js";import{a as w,b as C}from"./chunk-LRYE2WCN.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import{a as x}from"./chunk-ZC65Z3CK.js";import{a as m}from"./chunk-EI7MMDWY.js";var R="\0",v="";async function D(t){let o,n={protocol:P,apiVersion:E,id:"text-editor-stale-anchor",setup(i){o=i}},a={protocol:w,apiVersion:C,id:"text-editor-stale-anchor",setup(i){let d=$(t,i,()=>{if(o===void 0)throw new Error("pi-agent-read is unavailable");return o});I(t,d.handler),i.onMutationTool(d.add)}};await Promise.all([k(t,n),M(t,a)])}m(D,"registerTextEditorStaleAnchor");function $(t,o,n){let a=new Map,i=[],d=new Map,c=new Map,u={name:"text-editor-stale-anchor-inspection",blockExecution:!0,toolNames:i,async intercept(e){let s=a.get(e.toolCall.name);if(s===void 0)return;let r=e.partialArgs??e.args,f=H(r,e,d,s.source.field,s.source.inherited?O(t)?.source:void 0);if(f===void 0)return;let T=await V(o,n(),e,s,r,f,c);if(T!==void 0)return T;let g=s.pair?.every(p=>{let l=s.anchors?.find(h=>h.field===p);return l!==void 0&&A(l,r[p])})===!0?new Set(s.pair):new Set;for(let p of s.anchors??[]){if(g.has(p.field))continue;let l=r[p.field];if(!A(p,l))continue;let h=r[p.sourceField],_=typeof h=="string"?h:f,y=await b(o,n(),e,p.field,_,[l],[p.kinds],c);if(y!==void 0)return y}},onContentEnd(e){c.delete(e)},onAbort(e){c.delete(e),d.delete(e)},onAgentEnd(){c.clear(),d.clear()}};return{handler:u,add(e){(e.anchors?.length??0)>0&&(a.set(e.name,e),i.push(e.name),I(t,u))}}}m($,"createHandler");function H(t,o,n,a,i){let d=t[a];if(typeof d=="string")return o.contentIndex!==void 0&&n.set(o.contentIndex,d),d;if(o.contentIndex!==void 0)for(let c=o.contentIndex-1;c>=0;c-=1){let u=n.get(c);if(u!==void 0)return t[a]=u,u}return i!==void 0&&(t[a]=i),i}m(H,"resolveSource");async function V(t,o,n,a,i,d,c){if(a.pair===void 0)return;let[u,e]=a.pair,s=i[u],r=i[e];if(typeof s!="string"||typeof r!="string")return;let f=a.anchors?.find(({field:g})=>g===u),T=a.anchors?.find(({field:g})=>g===e);if(!(f===void 0||T===void 0)&&!(!A(f,s)||!A(T,r)))return b(t,o,n,e,d,[s,r],[f.kinds,T.kinds],c)}m(V,"inspectAnchorPair");async function b(t,o,n,a,i,d,c,u){let e=n.contentIndex??-1,s=`${i}${R}${d.join(R)}${R}${c.map(l=>l.join(v)).join(R)}`,r=u.get(e)?.get(s);if(r===void 0){let l=await t.inspectTextAnchors({source:i,anchors:d,kinds:c,cwd:n.cwd,...n.signal!==void 0&&{signal:n.signal}}),h=u.get(e)??new Map;h.set(s,l),u.set(e,h),r=l}if(r.kind==="valid")return;if(r.kind==="failed")return j(n.toolCall.name,i,r.reason);if(r.rejectionCode!=="stale")return;let f=r.anchorIndex,g=(r.contextRange===void 0?void 0:await o.read({path:i,views:["anchors"],...r.contextRange},{cwd:n.cwd,...n.signal!==void 0&&{signal:n.signal}}))?.content.filter(l=>l.type==="text").map(l=>l.text).join(`
|
|
2
|
+
`),p={guardId:"stale-anchor",effect:"not-applied",toolName:n.toolCall.name,field:a,path:i,anchor:x(d[f]),...!(g===void 0||g.length===0)&&{context:g}};return L(p,r.reason)}m(b,"inspectAnchors");function j(t,o,n){return{annotation:{kind:"blocked",reason:n},message:{customType:"text-editor-resolver-block",content:`[SYSTEM] ${t} blocked: ${n}`,display:!1,details:{guardId:"resolver",effect:"not-applied",toolName:t,source:o,reason:n}}}}m(j,"makeResolverBlockResult");function L(t,o){return{annotation:{kind:"stale-anchor"},message:{customType:"text-editor-stale-anchor-block",content:S(t,o),display:!1,details:t}}}m(L,"makeBlockResult");export{D as default};
|
package/dist/entry-73.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h}from"./chunk-GIRAEVUJ.js";import"./chunk-YHUTTZC6.js";import"./chunk-EI7MMDWY.js";export{b as TOOL_CALL_INTERCEPTION_ANCHOR_RENDER_PATCH,a as TOOL_CALL_INTERCEPTION_DETAILS_KEY,f as ToolCallInterceptionRenderStore,c as getToolCallInterception,h as isToolCallAnnotation,e as withBlockedToolResult,d as withToolCallInterceptionDetails,g as withToolCallInterceptionRendering};
|
package/dist/entry-74.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g
|
|
1
|
+
import{a,b,c,d,e,f,g}from"./chunk-YHUTTZC6.js";import"./chunk-EI7MMDWY.js";export{b as ToolCallHeader,f as preserveEnclosingBackground,e as renderToolCallDetails,d as renderToolCallHeader,g as singleLine,a as toolBackgroundAnsi,c as toolCallHeader};
|
package/dist/entry-75.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b
|
|
1
|
+
import{a as y}from"./chunk-ERVMDQGX.js";import{a as p,b as g}from"./chunk-VFBLX4TG.js";import"./chunk-NNCZYO4Q.js";import{c as A}from"./chunk-RHV5STR3.js";import"./chunk-YHUTTZC6.js";import{a as R}from"./chunk-72EEL2DW.js";import{a as v,b as E}from"./chunk-KAB3AYA2.js";import{a as P,u as T}from"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import{e as h}from"./chunk-N34ATN52.js";import"./chunk-ZC65Z3CK.js";import{a as s}from"./chunk-EI7MMDWY.js";import{constants as L}from"node:fs";import{access as _}from"node:fs/promises";import d from"node:path";var k=["google-chrome-stable","google-chrome","chromium","chromium-browser"],W=["/usr/bin/google-chrome-stable","/usr/bin/google-chrome","/usr/bin/chromium","/usr/bin/chromium-browser","/opt/google/chrome/chrome"];function S(e={}){let o;return{async load(t,r){o??=f(e.executablePath,e.environment??process.env);let n=await o;r.signal?.throwIfAborted();let{chromium:l}=await import("playwright-core");r.signal?.throwIfAborted();let a=await l.launch({executablePath:n,headless:!0,chromiumSandbox:!1,timeout:r.timeoutMs}),c=s(()=>{a.close()},"closeOnAbort");r.signal?.addEventListener("abort",c,{once:!0});try{r.signal?.throwIfAborted();let i=await a.newPage(),u=await i.goto(t.href,{timeout:r.timeoutMs,waitUntil:"domcontentloaded"});if(u!==null&&!u.ok())throw new Error(`HTTP ${u.status()}: ${u.statusText()}`);await i.waitForLoadState("networkidle",{timeout:Math.min(r.timeoutMs,1500)}).catch(()=>{}),r.signal?.throwIfAborted(),await O(i);let m={html:await i.content(),source:i.url()};return r.signal?.throwIfAborted(),m}catch(i){throw r.signal?.aborted===!0?M(r.signal):new Error(`Browser read failed for ${t.href}: ${F(i)}`,{cause:i})}finally{r.signal?.removeEventListener("abort",c),await a.close().catch(()=>{})}}}}s(S,"createSystemBrowserHtmlLoader");async function f(e=process.env.PI_AGENT_IDE_BROWSER_PATH,o=process.env){if(e!==void 0&&e.trim().length>0){let t=d.resolve(e);if(await b(t))return t;throw new Error(`PI_AGENT_IDE_BROWSER_PATH is not executable: ${t}`)}for(let t of(o.PATH??"").split(d.delimiter).filter(Boolean))for(let r of k){let n=d.join(t,r);if(await b(n))return n}for(let t of W)if(await b(t))return t;throw new Error("No system Chrome or Chromium executable was found. Install Chrome/Chromium or set PI_AGENT_IDE_BROWSER_PATH.")}s(f,"resolveSystemBrowserExecutable");async function O(e){await e.locator("body *").evaluateAll(o=>{for(let t of o.toReversed()){let r=globalThis.getComputedStyle(t);(t.hasAttribute("hidden")||t.getAttribute("aria-hidden")==="true"||r.display==="none"||r.visibility==="hidden"||r.visibility==="collapse")&&t.remove()}})}s(O,"removeHiddenElements");async function b(e){try{return await _(e,L.X_OK),!0}catch{return!1}}s(b,"isExecutable");function M(e){return e.reason instanceof Error?e.reason:D()}s(M,"abortReason");function D(){let e=new Error("The operation was aborted");return e.name="AbortError",e}s(D,"abortError");function F(e){return e instanceof Error?e.message:String(e)}s(F,"errorMessage");var x={protocol:p,apiVersion:1,id:"web-browser",setup(e){e.addCheck({id:"system-browser",title:"Browser web reads",async run(o){try{let t=await f(o.env.PI_AGENT_IDE_BROWSER_PATH,o.env),r=await h(t,["--version"],o.cwd,o.env);return[r.ok?{status:"pass",message:"Chrome/Chromium is available",detail:r.detail}:{status:"warn",message:"Chrome/Chromium cannot start",detail:r.detail}]}catch(t){return[{status:"warn",message:"Browser reads are unavailable",detail:t instanceof Error?t.message:String(t)}]}}})}};function B(e,o={}){let t=U(o);return{id:"web",tryResolve(r){return Promise.resolve(N(r,e,t))}}}s(B,"createWebResolver");function U(e){let o=e.timeoutMs??3e4;if(!Number.isFinite(o)||o<=0)throw new TypeError("Web timeout must be a positive finite number");return{timeoutMs:o,fetchResource:e.fetch??globalThis.fetch,browser:e.browser??S(),autoBrowserFallback:e.autoBrowserFallback??!0}}s(U,"resolverSettings");function N(e,o,t){let r;try{r=new URL(e)}catch(n){return q(e)?{kind:"failed",error:new TypeError(`Invalid HTTP source ${e}`,{cause:n})}:{kind:"not-handled"}}return r.protocol!=="http:"&&r.protocol!=="https:"?{kind:"not-handled"}:{kind:"resolved",resource:{source:r.href,read({signal:n}){return $(r,o,t,n)}}}}s(N,"resolveHttpSource");async function $(e,o,t,r){let n=I(r,t.timeoutMs),l=!0;try{n.signal.throwIfAborted();let a=await t.fetchResource(e,{method:"GET",redirect:"follow",signal:n.signal,headers:{"User-Agent":"Mozilla/5.0 (compatible; Pi-LPT/1.0; +https://github.com/alexshpunt/sasha-pi)",Accept:"text/html,application/xhtml+xml,application/pdf,application/json,text/plain,image/*,*/*;q=0.8","Accept-Language":"en-US,en;q=0.5"}});if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);let c=new Uint8Array(await a.arrayBuffer());n.signal.throwIfAborted();let i=a.url.length===0?e.href:a.url,u=a.headers.get("content-type")??void 0,m={source:i,bytes:c,...u!==void 0&&{mediaType:u}};l=j(c,u);let w=await o.convert(m,{signal:n.signal});if(n.signal.throwIfAborted(),t.autoBrowserFallback&&l&&H(w))throw new Error("HTTP read returned empty HTML content");return w}catch(a){if(r?.throwIfAborted(),!t.autoBrowserFallback||!l)throw a;n.dispose();try{return await G(e,o,t,r)}catch(c){throw r?.throwIfAborted(),new Error(`HTTP read failed (${C(a)}) and browser fallback failed: ${C(c)}`,{cause:c})}}finally{n.dispose()}}s($,"readWebContent");async function G(e,o,t,r){let n=I(r,t.timeoutMs);try{n.signal.throwIfAborted();let l=await V(e,o,t,n.signal);if(n.signal.throwIfAborted(),H(l))throw new Error("Browser read returned empty content");return l}finally{n.dispose()}}s(G,"readBrowserContent");async function V(e,o,t,r){let n=await t.browser.load(e,{signal:r,timeoutMs:t.timeoutMs});return r.throwIfAborted(),o.convert({source:n.source,bytes:new TextEncoder().encode(n.html),mediaType:"text/html; charset=utf-8"},{signal:r})}s(V,"loadAndConvertBrowser");function j(e,o){let t=o?.split(";",1)[0]?.trim().toLowerCase();if(t==="text/html"||t==="application/xhtml+xml")return!0;let r=new TextDecoder("utf8").decode(e.subarray(0,1024));return/^\u{FEFF}?\s*(?:<!doctype\s+html\b|<(?:article|body|head|html)\b)/iu.test(r)}s(j,"isHtml");function H(e){return e.every(o=>o.type==="text"&&o.text.trim().length===0)}s(H,"isEmptyTextContent");function I(e,o){let t=new AbortController,r=s(()=>{t.abort(z(e))},"abortFromParent"),n=setTimeout(()=>{t.abort(K(o))},o);return n.unref(),e?.aborted===!0?r():e?.addEventListener("abort",r,{once:!0}),{signal:t.signal,dispose(){clearTimeout(n),e?.removeEventListener("abort",r)}}}s(I,"createOperationSignal");function q(e){return/^https?:/iu.test(e)}s(q,"claimsHttpScheme");function z(e){return e?.reason instanceof Error?e.reason:J()}s(z,"abortReason");function J(){let e=new Error("The operation was aborted");return e.name="AbortError",e}s(J,"abortError");function K(e){let o=new Error(`Web read timed out after ${e}ms`);return o.name="TimeoutError",o}s(K,"timeoutError");function C(e){return e instanceof Error?e.message:String(e)}s(C,"errorMessage");var X={provider:"web",capability:"read"},Q=A({kind:"markdown",label:"WEB"});async function Y(e){let o=T(e,X),t=B(o),r={protocol:v,apiVersion:E,id:"web",setup(n){n.addResolver({resolver:t,renderResult:Q,preserveTruncatedOutput:!0}),n.describe(()=>P("HTTP(S) URL \u2014 remote content.",o.listDescriptions()))}};await Promise.all([R(e,r),Promise.resolve(y(e,x))])}s(Y,"registerWeb");export{Y as default};
|
package/dist/entry-76.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{v as c}from"./chunk-S3ZPXWX7.js";import{a as r}from"./chunk-EI7MMDWY.js";import{parseHTML as g}from"linkedom";async function d(t,n,e=p){try{let o=await e(t,n);return{content:o.content.trim(),title:o.title.trim(),usedFallback:!1}}catch{return{...b(t,n),usedFallback:!0}}}r(d,"extractReadableHtml");async function p(t,n){let e=u(t,n),{Defuddle:o}=await import("defuddle/node"),i=await o(e,n,{markdown:!0,useAsync:!1});return{content:i.content,title:i.title}}r(p,"extractWithDefuddle");function b(t,n){let e=u(t,n);for(let a of e.querySelectorAll("script, style, nav, footer, header, aside, noscript, template"))a.remove();let o=e.querySelector("article, main")??e.body??e.documentElement,i=s(o?.textContent??""),l=s(e.querySelector("title")?.textContent??"");return{content:i,title:l}}r(b,"extractPlainText");function u(t,n){let e=g(t);try{Object.defineProperty(e.document,"location",{value:new URL(n),configurable:!0})}catch{}return e.document}r(u,"parseDocument");function s(t){return t.replace(/\s+/gu," ").trim()}r(s,"normalizeWhitespace");var x=new Set(["application/xhtml+xml","text/html"]),w=/^\u{FEFF}?\s*(?:<!doctype\s+html\b|<(?:article|body|head|html)\b)/iu;function f(){return{id:"html",description:"Web page URLs return readable page content.",async tryConvert(t,n){if(!E(t.bytes,t.mediaType))return{kind:"not-handled"};let e=m(n.signal);if(e!==void 0)return{kind:"failed",error:e};let o;try{o=new TextDecoder("utf8",{fatal:!0}).decode(t.bytes)}catch(y){return{kind:"failed",error:new TypeError(`${t.source} is not valid UTF-8 HTML`,{cause:y})}}let i=await d(o,t.source),l=m(n.signal);return l!==void 0?{kind:"failed",error:l}:{kind:"converted",content:[{type:"text",text:i.title.length===0?i.content:i.content.length===0?`# ${i.title}`:`# ${i.title}
|
|
2
|
+
|
|
3
|
+
${i.content}`}]}}}}r(f,"createHtmlContentConverter");function E(t,n){if(n!==void 0){let o=n.split(";",1)[0]?.trim().toLowerCase()??"";if(x.has(o))return!0}let e=new TextDecoder("utf8").decode(t.subarray(0,1024));return w.test(e)}r(E,"isHtmlInput");function m(t){if(t?.aborted===!0)return t.reason instanceof Error?t.reason:C()}r(m,"cancellationError");function C(){let t=new Error("The operation was aborted");return t.name="AbortError",t}r(C,"abortError");var h={target:{provider:"web",capability:"read"},converter:f(),priority:200};async function H(t){await c(t,h)}r(H,"registerWebHtml");export{H as default};
|
package/dist/entry-77.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-QIJMV2P2.js";import{v as e}from"./chunk-S3ZPXWX7.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"web",capability:"read"},converter:r(),priority:100};async function i(o){await e(o,n)}t(i,"registerWebImage");export{i as default};
|
package/dist/entry-78.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-BHSO2MDK.js";import{v as e}from"./chunk-S3ZPXWX7.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"web",capability:"read"},converter:r(),priority:200};async function i(o){await e(o,n)}t(i,"registerWebPdf");export{i as default};
|
package/dist/entry-79.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{v as r}from"./chunk-S3ZPXWX7.js";import{p as e}from"./chunk-5VSE5X5R.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"web",capability:"read"},converter:e(),priority:300};async function i(o){await r(o,n)}t(i,"registerWebText");export{i as default};
|
package/dist/pi-agent-ide.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import{a as We}from"./chunk-6DN7NO7L.js";import{a as it}from"./chunk-OIL6BB2S.js";import{a as ot}from"./chunk-OFHVDY4Q.js";import{a as qe}from"./chunk-UTTW55S2.js";import{a as Je}from"./chunk-IMVCVPMP.js";import{a as Ge}from"./chunk-LFV6G5Z3.js";import{a as ze}from"./chunk-IOCABSRL.js";import{a as Ke}from"./chunk-6XQQBKPE.js";import"./chunk-OVUYPHDE.js";import"./chunk-YPHXLAQF.js";import"./chunk-VCCMVQXU.js";import{a as tt}from"./chunk-F6SESI3P.js";import{a as nt}from"./chunk-KYVOMBO5.js";import"./chunk-XNXQYPVT.js";import"./chunk-STUZZM5B.js";import"./chunk-MBUXFKIW.js";import{e as Le}from"./chunk-TG6H6EOI.js";import"./chunk-KNMWCDDK.js";import{a as Qe}from"./chunk-5BWUVAR4.js";import{a as et}from"./chunk-HOBTFFQR.js";import"./chunk-SJYDLHEF.js";import{a as Ze}from"./chunk-6SMFVLTY.js";import"./chunk-PETQCA7G.js";import{a as He}from"./chunk-4SQQKEVD.js";import{a as Xe}from"./chunk-BYWAG6X3.js";import"./chunk-VSP2QQPQ.js";import{a as Ye}from"./chunk-KH5KPBCR.js";import"./chunk-34ZQTTU2.js";import"./chunk-MTTKFJV6.js";import{a as lt}from"./chunk-VEJGSURY.js";import{a as Be}from"./chunk-XGUAL3CA.js";import{a as rt}from"./chunk-NXHPO7ER.js";import"./chunk-SMSIT3CE.js";import{a as st}from"./chunk-ONWUJXUR.js";import"./chunk-DEP55R35.js";import{a as at}from"./chunk-MTQSGWZJ.js";import{a as ct}from"./chunk-QZANC2IG.js";import{a as dt}from"./chunk-2XYXV5HS.js";import{a as Fe}from"./chunk-WZI4YC2O.js";import{a as Me}from"./chunk-MB6VVVAF.js";import{a as Ve}from"./chunk-NI2NK4JU.js";import"./chunk-GTK5AREE.js";import{a as Ue}from"./chunk-W3XYKJ5H.js";import"./chunk-PODWLGNO.js";import"./chunk-3YK4XMWB.js";import"./chunk-ERVMDQGX.js";import{a as xe,b as De,c as Se,d as Re,f as Ce}from"./chunk-VFBLX4TG.js";import"./chunk-2ZMYT6ZC.js";import"./chunk-NNCZYO4Q.js";import{c as je}from"./chunk-SSZB66C3.js";import"./chunk-YHUTTZC6.js";import{a as $e}from"./chunk-ORAPGW7W.js";import{a as ke,b as Ae}from"./chunk-JASLOB2X.js";import"./chunk-E2RESHYR.js";import"./chunk-T2RPMEM2.js";import{a as Ne}from"./chunk-EEH4WYI7.js";import{a as Oe,b as _e}from"./chunk-266RH77Z.js";import"./chunk-EW2KVKCN.js";import{e as ce,f as de,g as le,h as ue,i as pe,l as fe}from"./chunk-ZIHEF6K3.js";import"./chunk-2SKAED2I.js";import{a as we}from"./chunk-OBWZ5RYN.js";import{a as D,b as S,c as me,d as he,g as ye}from"./chunk-KZBAJFCV.js";import"./chunk-KINKBPPX.js";import{b as Pe,c as P}from"./chunk-L4FA6OD4.js";import{d as be}from"./chunk-N34ATN52.js";import{a as ge}from"./chunk-ZC65Z3CK.js";import{a as ve,b as R,c as C,d as Ie,e as Te,g as Ee}from"./chunk-JMVDFOTQ.js";import{a}from"./chunk-EI7MMDWY.js";var k=[],A=[],J=[];function q(n,e,t){if(e.some(i=>i.name===t))throw new Error(`[pi-agent-ide] ${n} "${t}" is already registered. Use a unique name.`)}a(q,"assertUniqueName");function pt(n){let e=new Set;for(let t of n){let i=`${t.kind}:${t.name}`;if(e.has(i))throw new Error(`[pi-agent-ide] ${t.kind} "${t.name}" is registered twice by one plugin.`);switch(e.add(i),t.kind){case"compiler":{q(t.kind,A,t.name);break}case"formatter":{q(t.kind,k,t.name);break}case"linter":{q(t.kind,J,t.name);break}}}for(let t of n)switch(t.kind){case"compiler":{A.push(t);break}case"formatter":{k.push(t);break}case"linter":{J.push(t);break}}}a(pt,"registerTools");async function ut(n,e){let t=[];for(let i of n)try{await i.detect(e)&&t.push(i)}catch(o){console.error(`[pi-agent-ide] detect failed for "${i.name}":`,o)}return t.sort((i,o)=>o.priority-i.priority),Bt(t),t}a(ut,"filterActive");function Bt(n){let e=new Map;for(let t of n)for(let i of t.extensions){let o=`${i}@${t.priority}`,s=e.get(o);if(s!==void 0)throw new Error(`[pi-agent-ide] priority conflict: tools "${s}" and "${t.name}" both claim "${i}" at priority ${t.priority}.`);e.set(o,t.name)}}a(Bt,"assertNoPriorityConflicts");async function gt(n){let[e,t]=await Promise.all([ut(k,n),ut(A.filter(i=>i.syntaxOnly===!0),n)]);return{ctx:n,formatters:e,compilers:t,linters:[]}}a(gt,"warmupFormatting");function G(){k.length=0,A.length=0,J.length=0}a(G,"resetRegistry");import{readFile as z}from"node:fs/promises";import b from"node:path";var $=class{constructor(e,t={}){this.sources=e;this.options=t}static{a(this,"DiagnosticStore")}files=new Map;dirty=new Set;sent=new Map;queue=[];running=0;disposed=!1;schedule(e,t,{cwd:i}){this.disposed||this.ensure(e,t,i)}async read(e,{cwd:t}){this.assertActive();let i=b.resolve(t,e),o=await z(i,"utf8");this.assertActive();let s=this.ensure(i,o,t);await qt(Promise.all(s.jobs),this.options.readWaitMs??5e3),this.assertActive();let r=await z(i,"utf8");this.assertActive();let c=this.ensure(i,r,t);return{filePath:i,content:c.content,results:[...c.results.values()]}}async takeNotifications(e){let t=[];for(let i of[...this.dirty]){if(i.cwd!==b.resolve(e)||(this.dirty.delete(i),!await this.isCurrent(i)))continue;let o=[...i.results.values()],s=o.map(d=>{if(d.status==="pending"||d.status==="unavailable")return`${d.source} ${d.status}`;let l=["error","warning","info","hint"].map(u=>`${d.diagnostics.filter(p=>p.severity===u).length} ${u}`);return`${d.source} ${l.join(", ")}${d.status==="snapshot"?" (snapshot; completion unknown)":d.status==="unversioned"?" (unversioned)":""}`}).join("; "),r=this.key(i.filePath,i.cwd),c=JSON.stringify(o);this.sent.get(r)!==c&&(this.sent.set(r,c),t.push(`${JSON.stringify(b.relative(e,i.filePath))}: ${s||"no diagnostic sources"}.`))}return t}dispose(){this.disposed=!0;for(let e of this.files.values())e.controller.abort();this.files.clear(),this.dirty.clear(),this.sent.clear(),this.pump()}key(e,t){return JSON.stringify([b.resolve(t),b.resolve(t,e)])}ensure(e,t,i){let o=this.key(e,i),s=this.files.get(o);if(s?.content===t)return s;s?.controller.abort(),s&&this.dirty.delete(s);let r={cwd:b.resolve(i),filePath:b.resolve(i,e),content:t,controller:new AbortController,results:new Map,jobs:[],publications:new Map};this.files.set(o,r),this.sources.length===0&&r.results.set("diagnostics",{source:"diagnostics",status:"unavailable",diagnostics:[],reason:"No diagnostic sources registered"}),this.dirty.add(r);for(let c of this.sources){r.results.set(c.id,{source:c.id,status:"pending",diagnostics:[]});let d=new Promise(l=>{this.queue.push(async()=>{try{await this.check(r,c)}finally{l()}})});r.jobs.push(d)}return queueMicrotask(()=>this.pump()),r}pump(){for(;this.running<(this.options.concurrency??4)&&this.queue.length>0;){let e=this.queue.shift();if(!e)break;this.running++,e().finally(()=>{this.running--,this.pump()})}}active(e){return!this.disposed&&!e.controller.signal.aborted}assertActive(){if(this.disposed)throw new Error("Diagnostics session has ended")}async isCurrent(e){if(!this.active(e))return!1;let t=await z(e.filePath,"utf8").catch(()=>{});return this.active(e)&&t===e.content}async publish(e,t,i){let o=(e.publications.get(t)??0)+1;if(e.publications.set(t,o),!await this.isCurrent(e)||e.publications.get(t)!==o)return;let s={source:t,...i};JSON.stringify(e.results.get(t))!==JSON.stringify(s)&&(e.results.set(t,s),this.dirty.add(e))}async check(e,t){if(!await this.isCurrent(e))return;let i=new AbortController,o=AbortSignal.any([i.signal,e.controller.signal]);if(o.aborted)return;let s,r;try{let c=new Promise((l,u)=>{r=a(()=>u(o.reason),"onAbort"),o.addEventListener("abort",r,{once:!0}),s=setTimeout(()=>i.abort(new Error("Diagnostic check timed out")),this.options.checkTimeoutMs??3e4)}),d=await Promise.race([t.diagnose(e.filePath,{cwd:e.cwd,content:e.content,signal:o,publish:a(l=>{o.aborted||this.publish(e,t.id,l)},"publish")}),c]);await this.publish(e,t.id,d)}catch(c){await this.publish(e,t.id,{status:"unavailable",diagnostics:[],reason:c instanceof Error?c.message:String(c)})}finally{clearTimeout(s),r&&o.removeEventListener("abort",r)}}};async function qt(n,e){let t;try{await Promise.race([n,new Promise(i=>{t=setTimeout(i,e)})])}finally{clearTimeout(t)}}a(qt,"waitAtMost");function ft(){let n=new Map,e=[],t=new $(e),i=Promise.resolve();return{diagnostics:t,registerPlugin(o){if(o.id.trim().length===0)return Promise.reject(new Error("Plugin ID must not be empty"));let s=n.get(o.id);if(s!==void 0)return s;let r=i.then(async()=>{let c=[],d=[],l=!0,u={addTool(p){if(!l)throw new Error(`Plugin ${o.id} setup is already complete`);Gt(p),c.push(p)},addDiagnosticSource(p){if(!l)throw new Error(`Plugin ${o.id} setup is already complete`);zt(p),d.push(p)},readDiagnostics(p,f){return t.read(p,f)}};try{await o.setup(u)}catch(p){throw l=!1,p}l=!1,Jt(e,d),pt(c),e.push(...d)});return n.set(o.id,r),i=r.catch(()=>{}),r.catch(()=>{n.delete(o.id)}),r},async waitForPendingPlugins(){await Promise.all(n.values())}}}a(ft,"createIdeCore");function Jt(n,e){let t=new Set(n.map(i=>i.id));for(let i of e){if(t.has(i.id))throw new Error(`Diagnostic source ${i.id} is already registered`);t.add(i.id)}}a(Jt,"assertUniqueDiagnosticSources");function Gt(n){if(!mt(n))throw new TypeError("IDE tool must be an object");let e=n.kind,t=e==="compiler"?n.compile:e==="formatter"?n.format:e==="linter"?n.lint:void 0;if(t===void 0||typeof t!="function"||typeof n.detect!="function"||typeof n.name!="string"||n.name.trim().length===0||typeof n.priority!="number"||!Number.isFinite(n.priority)||!Array.isArray(n.extensions)||n.extensions.length===0||n.extensions.some(i=>typeof i!="string"||i.length===0))throw new TypeError("Invalid pi-agent-ide tool contribution")}a(Gt,"assertIdeTool");function zt(n){if(!mt(n)||typeof n.id!="string"||n.id.trim().length===0||typeof n.diagnose!="function")throw new TypeError("Invalid pi-agent-ide diagnostic source contribution")}a(zt,"assertDiagnosticSource");function mt(n){return typeof n=="object"&&n!==null}a(mt,"isRecord");import ht from"node:path";async function yt(n){if(!ht.isAbsolute(n.resourceSource))return;let e=await gt({cwd:n.cwd}),t=ht.extname(n.resourceSource).toLowerCase(),i=a(r=>r.extensions.includes(t)||r.extensions.includes("*"),"matches"),o=e.compilers.find(i);if(o&&(await o.compile({filePath:n.resourceSource},e.ctx)).syntaxErrors.length>0)return;await e.formatters.find(i)?.format({filePath:n.resourceSource},e.ctx)}a(yt,"runIdePostEditGate");import Wt from"node:path";async function W(n){n.registerFlag("old-tools",{description:"Use the old IDE and text editor tools",type:"boolean",default:!1}),G();let e=ft(),t=n.events.on(he,i=>{if(!ye(i))throw new Error("Invalid pi-agent-ide plugin registration request");i.accept(e.registerPlugin(i.plugin))});n.on("session_shutdown",()=>{t(),e.diagnostics.dispose(),G()}),Le(n,{id:"pi-agent-ide",handler:yt}),n.events.emit(me,{protocol:D,apiVersion:3}),await Ne(n,{protocol:Oe,apiVersion:_e,id:"ide-diagnostics",setup(i){i.onDidEdit(o=>{Wt.isAbsolute(o.resourceSource)&&e.diagnostics.schedule(o.resourceSource,o.after.content,{cwd:o.cwd})})}}),n.on("context",async(i,o)=>{let s=await e.diagnostics.takeNotifications(o.cwd);if(s.length!==0)return{messages:[...i.messages,{role:"custom",customType:"ide-diagnostics",display:!1,content:`File diagnostics:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
`).map(l=>l.length===0?"":en(l,e)),r=[o,...s].flatMap(l=>Zt(l,i)),c=e.fg("accent","\u2502");return r.map(l=>Ht(`${c} ${l}`,t))}a(Qt,"renderTip");function Zt(n,e){return n.length===0?[""]:Xt(n,e)}a(Zt,"wrapLine");function en(n,e){let t="",i=0;for(let o of n.matchAll(Kt)){let s=o.index;t+=e.fg("muted",n.slice(i,s)),t+=e.fg("accent",e.bold(o[0])),i=s+o[0].length}return t+e.fg("muted",n.slice(i))}a(en,"styleBodyLine");var O=class{static{a(this,"TipCore")}providers=new Map;registerProvider(e){if(!/^[a-z0-9][a-z0-9.-]*$/u.test(e.id))return Promise.reject(new Error(`Invalid tip provider ID: ${e.id}`));let t=this.providers.get(e.id);return t!==void 0?t===e?Promise.resolve():Promise.reject(new Error(`Tip provider ${e.id} is already registered`)):(this.providers.set(e.id,e),Promise.resolve())}get isEmpty(){return this.providers.size===0}async collectTips(e){let t=[];for(let i of this.providers.values()){if(e.signal?.aborted)break;try{let o=await tn(i,e);o!==void 0&&nn(o)&&t.push({providerId:i.id,tip:o})}catch{}}return t}};async function tn(n,e){let t=e.signal;if(t===void 0)return n.getTip(e);if(t.aborted)return;let i=a(()=>{},"abort"),o=new Promise(s=>{i=a(()=>s(void 0),"abort"),t.addEventListener("abort",i,{once:!0})});try{return await Promise.race([n.getTip(e),o])}finally{t.removeEventListener("abort",i)}}a(tn,"collectTip");function nn(n){return typeof n.id=="string"&&/^[a-z0-9][a-z0-9.-]*$/u.test(n.id)&&typeof n.title=="string"&&n.title.trim().length>0&&typeof n.body=="string"&&n.body.trim().length>0}a(nn,"isTip");import{randomUUID as on}from"node:crypto";import{mkdir as Y,readFile as rn,rename as sn,rm as K,stat as an,writeFile as cn}from"node:fs/promises";import{setTimeout as dn}from"node:timers/promises";import{homedir as ln}from"node:os";import T from"node:path";var I=1,un=10,pn=5e3,gn=6e4,y=Promise.resolve();function fn(n=process.env){let e=n.PI_CODING_AGENT_DIR??T.join(ln(),".pi","agent");return T.join(e,"pi-agent-ide","tips.json")}a(fn,"resolveTipStatePath");var N=class{constructor(e=fn()){this.statePath=e}static{a(this,"TipStateStore")}async shownFor(e){let t=await _(this.statePath);return new Set(t.projects[e]??[])}async claimIfUnseen(e,t,i){let o=y.then(async()=>{try{return await H(this.statePath,async()=>{let s=await _(this.statePath),r=new Set(s.projects[e]??[]);if(r.has(t)||i!==void 0&&r.has(i))return!1;r.add(t);let c={version:I,projects:{...s.projects,[e]:[...r]}};return await X(this.statePath,c),!0})}catch{return!0}});return y=o.then(()=>{},()=>{}),o}async markShown(e,t){if(t.length===0)return;y=y.then(async()=>{await H(this.statePath,async()=>{let o=await _(this.statePath),s=new Set(o.projects[e]??[]);for(let c of t)s.add(c);let r={version:I,projects:{...o.projects,[e]:[...s]}};await X(this.statePath,r)})}).catch(()=>{}),await y}async unmarkShown(e,t){y=y.then(async()=>{try{await H(this.statePath,async()=>{let o=await _(this.statePath),s=new Set(o.projects[e]??[]);if(!s.delete(t))return;let r={version:I,projects:{...o.projects,[e]:[...s]}};await X(this.statePath,r)})}catch{}}).catch(()=>{}),await y}};function bt(n){return T.resolve(n)}a(bt,"normalizeProjectPath");async function _(n){try{let e=JSON.parse(await rn(n,"utf8"));return hn(e)?e:wt()}catch{return wt()}}a(_,"readState");async function H(n,e){let t=`${n}.lock`;await Y(T.dirname(n),{recursive:!0});let i=Date.now();for(;;)try{await Y(t);break}catch(o){if(mn(o)!=="EEXIST")throw o;try{if(Date.now()-(await an(t)).mtimeMs>gn){await K(t,{recursive:!0,force:!0});continue}}catch{}if(Date.now()-i>=pn)throw new Error(`Timed out waiting for startup-tip state lock: ${t}`,{cause:o});await dn(un)}try{return await e()}finally{await K(t,{recursive:!0,force:!0})}}a(H,"withStateLock");function mn(n){return typeof n=="object"&&n!==null&&"code"in n?String(n.code):void 0}a(mn,"errorCode");async function X(n,e){try{await Y(T.dirname(n),{recursive:!0});let t=`${n}.${process.pid}.${on()}.tmp`;try{await cn(t,`${JSON.stringify(e,null,2)}
|
|
5
|
-
`,"utf8"),await sn(t,n)}finally{await K(t,{force:!0})}}catch{}}a(X,"writeState");function wt(){return{version:I,projects:{}}}a(wt,"emptyState");function hn(n){if(typeof n!="object"||n===null||Array.isArray(n))return!1;let e=n;return e.version!==I||typeof e.projects!="object"||e.projects===null?!1:Object.values(e.projects).every(t=>Array.isArray(t)&&t.every(i=>typeof i=="string"))}a(hn,"isState");var Pt="pi-agent-ide-startup-tip";function Q(n){let e=new O,t=new N;n.registerEntryRenderer(Pt,(r,c,d)=>{let l=r.data;if(!(typeof l.title!="string"||typeof l.body!="string"))return new j({title:l.title,body:l.body},d)});let i=n.events.on(Te,r=>{if(!Ee(r))throw new Error("Invalid tip provider registration request");r.accept(e.registerProvider(r.provider))});n.on("session_shutdown",i);let o,s=Promise.resolve();n.on("session_start",(r,c)=>{o?.abort(),o=new AbortController;let d=o.signal;s=s.then(()=>yn(n,e,t,r.reason,c,d)).catch(()=>{})}),n.on("session_shutdown",async()=>{o?.abort(),await s}),n.events.emit(Ie,{protocol:R,apiVersion:C})}a(Q,"registerTips");async function yn(n,e,t,i,o,s){if(o.mode!=="tui"||(s.throwIfAborted(),e.isEmpty))return;let r=await e.collectTips({cwd:o.cwd,mode:o.mode,hasUI:o.hasUI,signal:s,reason:i});if(s.throwIfAborted(),r.length===0)return;let c=bt(o.cwd);for(let d of r){let l=wn(d.providerId,d.tip.id);if(await t.claimIfUnseen(c,l,d.tip.id)){if(s.aborted){await t.unmarkShown(c,l);return}try{n.appendEntry(Pt,d.tip);return}catch(u){throw await t.unmarkShown(c,l),u}}}}a(yn,"displayTip");function wn(n,e){return JSON.stringify([n,e])}a(wn,"tipIdentity");import{mkdir as bn,readFile as vt,writeFile as Pn}from"node:fs/promises";async function It(n,e){await bn(Pe(n),{recursive:!0});let t=[],i=e.filter(r=>r.recipe.formatter!==void 0),o=e.filter(r=>r.recipe.linter!==void 0),s=e.filter(r=>r.recipe.lsp!==void 0);if(i.length>0){let r=P(n,"formatters"),c=await Z(r,{version:1,formatters:{}}),d=ee(c,"formatters");for(let l of i)d[l.recipe.id]??=l.recipe.formatter;await te(r,c)&&t.push(r)}if(o.length>0){let r=P(n,"linters"),c=await Z(r,{version:1,linters:{}}),d=ee(c,"linters");for(let l of o)d[l.recipe.id]??=l.recipe.linter;await te(r,c)&&t.push(r)}if(s.length>0){let r=P(n,"lsp-servers"),c=await Z(r,{version:1,servers:{}}),d=ee(c,"servers");for(let l of s){let u=ge(l.recipe.lsp);d[l.recipe.id]??={command:u.command,transport:"stdio",rootMarkers:u.rootMarkers,...u.initializationOptions!==void 0&&{initializationOptions:u.initializationOptions},...u.settings!==void 0&&{settings:u.settings},...u.requireRootMarker!==void 0&&{requireRootMarker:u.requireRootMarker},languages:Object.fromEntries(Object.entries(u.languageIds).map(([p,f])=>[p,{extensions:f,...u.fileNames?.[p]&&{fileNames:u.fileNames[p]}}])),capabilities:["diagnostics"]}}await te(r,c)&&t.push(r)}return t}a(It,"writeSuggestedConfigs");async function Z(n,e){try{let t=JSON.parse(await vt(n,"utf8"));if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`${n} must contain an object`);return t}catch(t){if(typeof t=="object"&&t!==null&&"code"in t&&t.code==="ENOENT")return e;throw t}}a(Z,"readObject");function ee(n,e){let t=n[e];if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`${e} must be an object`);return t}a(ee,"objectMember");async function te(n,e){let t=`${JSON.stringify(e,null,2)}
|
|
6
|
-
`;return await vt(n,"utf8").catch(()=>{})===t?!1:(await Pn(n,t,"utf8"),!0)}a(te,"writeJson");var F=class{static{a(this,"DoctorCore")}plugins=new Map;languages=[];recipes=[];setupChecks=[];checks=[];queue=Promise.resolve();registerPlugin(e){let t=this.plugins.get(e.id);if(t!==void 0)return t;let i=this.queue.then(async()=>{let o=!0,s=[],r=[],c=[],d=[],l={addLanguage:a(u=>{L(u,s,e.id,"language",()=>o)},"addLanguage"),addToolRecipe:a(u=>{L(u,r,e.id,"tool recipe",()=>o)},"addToolRecipe"),addSetupCheck:a(u=>{L(u,c,e.id,"setup check",()=>o)},"addSetupCheck"),addCheck:a(u=>{L(u,d,e.id,"check",()=>o)},"addCheck")};try{await e.setup(l)}finally{o=!1}Tt(this.languages,s,"language"),Tt(this.recipes,r,"tool recipe"),this.languages.push(...s),this.recipes.push(...r),this.setupChecks.push(...c),this.checks.push(...d)});return this.plugins.set(e.id,i),this.queue=i.catch(()=>{}),i.catch(()=>{this.plugins.delete(e.id)}),i}async waitForPlugins(){await Promise.all(this.plugins.values())}snapshot(){return{languages:[...this.languages],recipes:[...this.recipes],setupChecks:[...this.setupChecks],checks:[...this.checks]}}};async function Et(n,e){let t=[],i=[];for(let o of n.setupChecks)try{let s=await o.value.inspect(e);t.push(...(s.selections??[]).map(r=>({...r,pluginId:o.pluginId}))),i.push(...(s.actions??[]).map(r=>({...r,pluginId:o.pluginId})))}catch{}return{selections:t,actions:i}}a(Et,"runContributedSetupChecks");async function xt(n,e){let t=[];for(let i of n.checks)try{t.push({pluginId:i.pluginId,title:i.value.title,findings:await i.value.run(e)})}catch(o){t.push({pluginId:i.pluginId,title:i.value.title,findings:[{status:"fail",message:o instanceof Error?o.message:String(o)}]})}return t}a(xt,"runContributedChecks");function Tt(n,e,t){for(let i of e){let o=n.find(s=>s.value.id===i.value.id)?.pluginId;if(o!==void 0)throw new Error(`${t} ${i.value.id} is already owned by doctor plugin ${o}`)}}a(Tt,"assertAvailable");function L(n,e,t,i,o){if(!o())throw new Error(`Doctor plugin ${t} setup is complete`);if(!/^[a-z0-9][a-z0-9.-]*$/u.test(n.id))throw new Error(`Invalid ${i} ID: ${n.id}`);if(e.some(s=>s.value.id===n.id))throw new Error(`Doctor plugin ${t} registered ${i} ${n.id} twice`);e.push({pluginId:t,value:n})}a(L,"add");import Cn from"node:path";import{readFile as vn}from"node:fs/promises";async function Dt(n,e,t,i=process.env){let o=await Fe(n,t.map(c=>c.value)),s=await Tn(n),r=[];for(let c of t){let d=c.value;if(d.languages.every(x=>!e.has(x)))continue;let l=[],u=1,p=o.get(d.id),f=p?.config;f!==void 0&&(u+=6,l.push(`project config: ${f}`)),s.has(`${d.kind}:${d.id}`)&&(u+=6,l.push("Pi Agent IDE config"));let h=p?.dependency;h!==void 0&&(u+=4,l.push(`project dependency: ${h}`));let w=await In(n,d.executables,i);w!==void 0&&(u+=3,l.push(`executable: ${w}`)),r.push({pluginId:c.pluginId,recipe:d,score:u,evidence:l,...w&&{executable:w}})}return r.sort((c,d)=>d.score-c.score||c.recipe.id.localeCompare(d.recipe.id))}a(Dt,"discoverRecipeCandidates");function St(n,e,t=[]){let i=new Map,o=new Map(t.map(s=>[`${s.kind}:${s.languageId}`,s.toolId]));for(let s of e)for(let r of["formatter","linter","lsp"]){let c=o.get(`${r}:${s}`),d=c===void 0?4:7,l=n.filter(p=>p.recipe.kind===r&&p.recipe.languages.includes(s)&&p.executable!==void 0&&p.recipe.id!==c&&p.score>=d),u=l[0];u!==void 0&&(l.filter(p=>p.score===u.score).length>1||i.set(`${u.recipe.kind}:${u.recipe.id}`,u))}return[...i.values()]}a(St,"selectSuggestedRecipes");async function In(n,e,t){for(let i of e)if(await be(i,n,t))return i}a(In,"firstExecutable");async function Tn(n){let e=new Set;for(let[t,i,o]of[["formatters","formatters","formatter"],["linters","linters","linter"],["lsp-servers","servers","lsp"]])try{let s=JSON.parse(await vn(P(n,t),"utf8"));if(typeof s!="object"||s===null||Array.isArray(s))continue;let c=s[i];if(typeof c=="object"&&c!==null&&!Array.isArray(c))for(let d of Object.keys(c))e.add(`${o}:${d}`)}catch{}return e}a(Tn,"managedRecipeIds");import{execFile as En}from"node:child_process";import{readdir as xn}from"node:fs/promises";import v from"node:path";import{promisify as Dn}from"node:util";var Sn=Dn(En),Rn=new Set([".git",".hg",".svn","node_modules","vendor","build","dist","coverage",".cache",".next","target"]);async function Rt(n,e){e?.throwIfAborted();try{let i=(await Sn("git",["ls-files","--cached","--others","--exclude-standard","-z"],{cwd:n,encoding:"utf8",maxBuffer:16777216,signal:e})).stdout.split("\0").filter(Boolean).map(o=>v.resolve(n,o)).filter(o=>!kt(o));return e?.throwIfAborted(),i.length>0?i:await ne(n,e)}catch{return e?.throwIfAborted(),ne(n,e)}}a(Rt,"collectProjectFiles");function Ct(n,e){let t=new Map;for(let i of e){let o=new Set(i.extensions.map(c=>c.toLowerCase())),s=new Set(i.fileNames),r=n.filter(c=>!c.split(v.sep).join("/").includes("/.pi/pi-agent-ide/")&&(o.has(v.extname(c).toLowerCase())||s.has(v.basename(c))));r.length>0&&t.set(i.id,r)}return t}a(Ct,"detectProjectLanguages");async function ne(n,e){e?.throwIfAborted();let t=[];for(let i of await xn(n,{withFileTypes:!0})){if(i.isDirectory()&&Rn.has(i.name))continue;let o=v.join(n,i.name);kt(o)||(i.isDirectory()?t.push(...await ne(o,e)):i.isFile()&&t.push(o))}return t}a(ne,"walk");function kt(n){return n.split(v.sep).join("/").includes("/.pi/pi-agent-ide/")}a(kt,"isManagedIdeConfig");async function ie(n,e,t=process.env,i){i?.throwIfAborted();let o=await Rt(e,i);i?.throwIfAborted();let s=Ct(o,n.languages.map(p=>p.value)),r=new Set(s.keys()),c={cwd:e,files:o,detectedLanguageIds:r,detectedLanguages:s,env:t},[d,l]=await Promise.all([Dt(e,r,n.recipes,t),Et(n,c)]),u=new Map;for(let p of r)for(let f of["formatter","linter","lsp"]){if(l.selections.some(m=>m.languageId===p&&m.kind===f))continue;let h=d.filter(m=>m.recipe.kind===f&&m.recipe.languages.includes(p)),w=a(m=>m.score-(m.executable===void 0?0:3),"nativeScore"),x=Math.max(1,...h.map(w));for(let m of h){if(m.executable!==void 0||w(m)!==x||x<=1)continue;let ae=`${f}-${m.recipe.id}-unavailable`;u.set(ae,{id:ae,pluginId:m.pluginId,message:`Native project setup selects ${m.recipe.id}, but its executable is unavailable. Install ${m.recipe.executables.join(" or ")} and run Doctor again.`})}}return{cwd:e,files:o,detectedLanguages:s,candidates:d,selections:l.selections,actions:[...l.actions,...u.values()],suggestions:St(d,r,l.selections)}}a(ie,"inspectDoctorSetup");async function M(n,e,t=process.env){let i=await ie(n,e,t),o=new Set(i.detectedLanguages.keys()),s={cwd:e,files:i.files,detectedLanguageIds:o,detectedLanguages:i.detectedLanguages,env:t},r=await xt(n,s),c=[{status:"pass",message:`Project: ${e}`},i.files.length>0?{status:"pass",message:`${i.files.length} project files inspected`}:{status:"warn",message:"No project files found"},o.size>0?{status:"pass",message:`Detected: ${[...o].join(", ")}`}:{status:"warn",message:"No registered project languages detected"}];return{...i,sections:[{title:"Project",pluginId:"doctor",findings:c},...r]}}a(M,"runDoctor");function E(n){let e=["Pi Agent IDE doctor",""];for(let t of n.sections){e.push(`${t.title} (${t.pluginId})`);for(let i of t.findings)e.push(` ${i.status.toUpperCase().padEnd(4)} ${i.message}`),i.detail!==void 0&&e.push(` \`${i.detail}\``);e.push("")}if(n.actions.length>0){e.push("Setup needs attention");for(let t of n.actions)e.push(` ${t.message} [${t.pluginId}]`);e.push("")}if(n.suggestions.length>0){e.push("Suggested configuration");for(let t of n.suggestions){let i=t.evidence.length>0?` \u2014 ${t.evidence.join(", ")}`:"";e.push(` ${t.recipe.kind.padEnd(9)} ${t.recipe.id} [${t.pluginId}]${i}`)}e.push("")}return e.join(`
|
|
7
|
-
`).trimEnd()}a(E,"formatDoctorReport");function oe(n){return n.actions.length>0||n.suggestions.length>0||n.sections.some(e=>e.findings.some(t=>t.status==="fail"))}a(oe,"doctorNeedsWork");function At(n){let e=n.candidates.map(t=>({owner:t.pluginId,id:t.recipe.id,kind:t.recipe.kind,languages:t.recipe.languages,evidence:t.evidence,documentation:t.recipe.documentation}));return["Finish configuring Pi Agent IDE for this project.","Preserve existing formatter, linter, compiler, and style rules. Do not invent or replace native project settings.","Do not install packages, write credentials, or change source files without the user's normal confirmation.","Pi Agent IDE project configs live in .pi/pi-agent-ide/.","Use only the relevant plugin contributions listed below; each owner remains responsible for its own scope.","",E(n),"","Relevant registered recipes:",JSON.stringify(e,null,2),"",`Project root: ${Cn.resolve(n.cwd)}`].join(`
|
|
8
|
-
`)}a(At,"buildDoctorAgentPrompt");import{createHash as kn}from"node:crypto";var An="doctor",re=3;function $t(n,e){let t=ve(n,$n(e));t!==void 0&&t.catch(()=>{})}a($t,"registerDoctorTipProvider");function $n(n){return{protocol:R,apiVersion:C,id:An,async getTip(e){let t=await n(e),i=jn(t);if(i.length===0)return;let o=i.slice(0,re).map(s=>`\u2022 ${s.message}`);return i.length>re&&o.push(`\u2022 ${i.length-re} more`),{id:`doctor-setup-${On(i)}`,title:i.length===1?"Project setup needs attention":`${i.length} project setup items`,body:[...o,"Run /pi-agent-ide-doctor"].join(`
|
|
9
|
-
`)}}}}a($n,"createDoctorTipProvider");function jn(n){let e=n.actions.map(i=>({id:`action:${i.pluginId}:${i.id}`,message:i.message})),t=n.suggestions.map(i=>{let o=i.recipe.languages.filter(r=>n.detectedLanguages.has(r)).join(", "),s={formatter:"formatting",linter:"linting",lsp:"language support"}[i.recipe.kind];return{id:`suggestion:${i.pluginId}:${i.recipe.kind}:${i.recipe.id}`,message:`Use ${i.recipe.name} for ${o} ${s}`}});return[...e,...t].sort((i,o)=>i.id.localeCompare(o.id))}a(jn,"setupItems");function On(n){return kn("sha256").update(n.map(e=>`${e.id}\0${e.message}`).join("\0")).digest("hex").slice(0,12)}a(On,"fingerprint");async function V(n){let e=new F;$t(n,async o=>(await e.waitForPlugins(),ie(e.snapshot(),o.cwd,process.env,o.signal)));let t,i=n.events.on(Re,o=>{if(!Ce(o))throw new Error("Invalid doctor plugin registration request");o.accept(e.registerPlugin(o.plugin))});n.on("session_shutdown",i),n.registerCommand("pi-agent-ide-doctor",{description:"Check and configure Pi Agent IDE for this project",handler:a(async(o,s)=>{await e.waitForPlugins();let r=await M(e.snapshot(),s.cwd);se(n,E(r));let c=new Set(o.trim().split(/\s+/u).filter(Boolean));if(r.suggestions.length>0&&!c.has("--no-apply")&&(c.has("--apply")||s.hasUI&&await s.ui.confirm("Apply suggested configuration?","Add detected tools to .pi/pi-agent-ide/. Existing entries and native tool settings are kept."))){let u=await It(s.cwd,r.suggestions),p=u.length===0?"Pi Agent IDE configs are already up to date":`Updated ${u.length} Pi Agent IDE config ${u.length===1?"file":"files"}`;s.ui.notify(p,"info"),r=await M(e.snapshot(),s.cwd),se(n,E(r))}if(!oe(r)&&!c.has("--agent"))return;(c.has("--agent")||s.hasUI&&await s.ui.confirm("Ask the agent to finish setup?","The agent will receive this redacted report and relevant plugin recipes."))&&(t=s.cwd,n.sendUserMessage(At(r)))},"handler")}),n.on("agent_end",async(o,s)=>{let r=t;if(r===void 0)return;t=void 0;let c=await M(e.snapshot(),r,process.env);se(n,`Doctor recheck after agent setup
|
|
10
|
-
|
|
11
|
-
${E(c)}`),oe(c)?s.ui.notify("Pi Agent IDE setup still needs attention","warning"):s.ui.notify("Pi Agent IDE setup is ready","info")}),n.events.emit(Se,{protocol:xe,apiVersion:1}),await e.waitForPlugins()}a(V,"registerDoctor");function se(n,e){n.sendMessage({customType:"pi-agent-ide-doctor",content:e,display:!0},{triggerTurn:!1})}a(se,"sendReport");import _n from"node:path";var jt="diagnostics",Nn=je({kind:"code-view",label:"Diagnostics"});async function U(n){let e,t=a((c,d)=>{if(e===void 0)throw new Error("IDE diagnostics are not connected");return e(c,{cwd:d})},"collect"),i={protocol:D,apiVersion:3,id:"diagnostics",setup(c){e=c.readDiagnostics}},o=new WeakMap,s=new WeakMap,r={protocol:ke,apiVersion:Ae,id:"diagnostics",setup(c){c.addResolver({resolver:Ln(t),renderResult:Nn});let d=fe();c.addView({view:"diagnostics",priority:100,presenter:Mn(t,s)}),c.addHandler({stage:"read",when:{resolvedBy:"any",contentKind:"text"},handler(l){return l.state?.resolvedBy==="diagnostics"?d(l):(l.state?.contentKind==="text"&&l.request.views?.includes("diagnostics")&&o.set(l.request,l.state.text),{kind:"continue",context:l})}}),c.addHandler({stage:"post-read",handler(l){let u=o.get(l.request),p=u&&s.get(u),f=l.result,h=f?.content[0];return!p||!f||h?.type!=="text"?{kind:"continue",context:l}:{kind:"continue",context:{...l,result:{...f,content:[{...h,text:`${p}
|
|
12
|
-
${h.text}`},...f.content.slice(1)]}}}}}),c.describe("`diagnostics:<path>` returns lint and LSP diagnostics with five lines of source context on each side. The `diagnostics` view adds the same diagnostics alongside a normal file read. Both reuse background results, wait briefly for current checks, and report pending, unavailable, snapshot, or unversioned sources explicitly. A snapshot is the latest push update, not a completed check; an empty snapshot does not mean the file is clean."),c.addPromptGuideline("Use read with `diagnostics:<path>` or the `diagnostics` view for per-file diagnostics instead of running equivalent checks through Bash. Project builds and tests remain separate verification."),c.addPromptGuideline('You can use read with `views: ["diagnostics"]` to add lint and LSP diagnostics alongside file content.'),c.addPromptGuideline("Treat diagnostic snapshots as incomplete observations, not completed checks; an empty snapshot is not evidence that the file is clean."),c.addPromptGuideline("Explicit formatter, linter, and LSP overrides can match exact basenames with fileNames, such as Dockerfile or CMakeLists.txt. LSP requireRootMarker limits a server to files below one of its rootMarkers inside the project, keeping framework servers from claiming unrelated files. LSP initializationOptions can use {project} in string values for project-local plugin paths. Regex diagnostic parsers support multiline output and columnBase: 0 for zero-based tool columns."),c.addPromptGuideline("For missing formatting or diagnostics, check native project configuration and installed executables before adding IDE overrides. Built-ins find tools in node_modules/.bin, Python virtualenv bin directories (Scripts on Windows), and vendor/bin; Windows executable suffixes follow PATHEXT. /pi-agent-ide-doctor reports detected tools and missing dependencies. A detected runtime does not prove its formatter modules or language server can run.")}};await Promise.all([we(n,i),$e(n,r)])}a(U,"registerDiagnostics");function Ln(n){return{id:"diagnostics",tryResolve(e,t){return Promise.resolve(Fn(e,t.cwd,n))}}}a(Ln,"createDiagnosticResolver");function Fn(n,e,t){let i;try{i=ce(n,jt,e)}catch(o){return{kind:"failed",error:o}}return i===void 0?{kind:"not-handled"}:{kind:"resolved",resource:{source:de(jt,i),async read(){let o=await t(i,e);return[le(i,o.content,o.results)]}}}}a(Fn,"resolveDiagnosticSource");function Mn(n,e){return{id:"diagnostics",async present(t,i){if(i.purpose!=="read"||!_n.isAbsolute(t.source))return t;let o=await n(t.source,i.cwd);if(o.content!==t.content)throw new Error("File changed during diagnostic read; read it again for current source lines.");return e.set(t,pe(o.results)),ue(t,o.results)}}}a(Mn,"createDiagnosticPresenter");var Ot=[g("ide.core",W),g("ide.tips",Q),g("ide.doctor",V),g("ide.languages",ct,["ide.doctor"]),g("read.core",He),g("read.filesystem",Me,["read.core","editor.core"]),g("read.filesystem.image",Ve,["read.filesystem"]),g("read.filesystem.pdf",Ue,["read.filesystem"]),g("read.filesystem.text",Be,["read.filesystem"]),g("read.web",qe,["read.core"]),g("read.web.html",Je,["read.web"]),g("read.web.image",Ge,["read.web"]),g("read.web.pdf",ze,["read.web"]),g("read.web.text",We,["read.web"]),g("search.core",Xe),g("search.text",Ye,["search.core"]),g("editor.renderer",it,["editor.core"]),g("editor.core",Ke),g("editor.anchor.constant",Qe,["read.core","editor.core"]),g("editor.anchor.line-hash",Ze,["read.core","editor.core"]),g("editor.anchor.exact",et,["editor.core"]),g("editor.argument-order",tt,["editor.core"],!1),g("editor.overwrite",nt,["editor.core"],!1),g("editor.stale-anchor",ot,["editor.core"]),g("ide.ast",rt,["ide.core","read.core","search.core","editor.core"]),g("ide.formatter",at,["ide.core"]),g("ide.lint",dt,["ide.core"]),g("ide.changes",st,["ide.core","read.core","editor.core"]),g("ide.lsp",lt,["ide.core","read.core","search.core"]),g("ide.diagnostics",U,["ide.core","read.core"])];function g(n,e,t=[],i=!0){return{id:n,dependencies:t,register:e,...i?{}:{defaultEnabled:!1}}}a(g,"builtin");import{readFile as Vn}from"node:fs/promises";import Un from"node:os";import B from"node:path";function Ft(n=process.env,e=Un.homedir(),t=process.cwd()){let i=n.PI_CODING_AGENT_DIR?.trim(),o=i===void 0||i.length===0?B.join(e,".pi","agent"):B.resolve(i);return{globalPath:B.join(o,"pi-agent-ide","extensions.json"),projectPath:B.resolve(t,".pi","pi-agent-ide","extensions.json")}}a(Ft,"resolvePiAgentIdeExtensionsConfigPaths");async function Mt(n){let e=await _t(n.globalPath),t=await _t(n.projectPath);return{disabled:[...new Set([...e.disabled,...t.disabled])],enabled:[...new Set([...e.enabled,...t.enabled])]}}a(Mt,"readPiAgentIdeExtensionsConfig");async function _t(n){let e;try{e=await Vn(n,"utf8")}catch(i){if(Bn(i))return{disabled:[],enabled:[]};throw new Error(`Cannot read Pi Agent IDE extension config at ${n}: ${Lt(i)}`,{cause:i})}let t;try{t=JSON.parse(e)}catch(i){throw new Error(`Invalid JSON in Pi Agent IDE extension config at ${n}: ${Lt(i)}`,{cause:i})}if(!Vt(t))throw new Error(`Pi Agent IDE extension config at ${n} must be a JSON object`);return{disabled:Nt(t,"disabled",n),enabled:Nt(t,"enabled",n)}}a(_t,"readConfigExtensionIds");function Nt(n,e,t){let i=n[e];if(i===void 0)return[];if(!Array.isArray(i))throw new Error(`${e} in ${t} must be an array of non-empty strings`);let o=i.filter(r=>typeof r=="string");if(o.length!==i.length||o.some(r=>r.length===0))throw new Error(`${e} in ${t} must be an array of non-empty strings`);if(new Set(o).size!==o.length)throw new Error(`${e} in ${t} must not contain duplicate IDs`);return o}a(Nt,"readIdField");function Bn(n){return Vt(n)&&n.code==="ENOENT"}a(Bn,"isMissingFile");function Vt(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}a(Vt,"isRecord");function Lt(n){return n instanceof Error?n.message:String(n)}a(Lt,"errorMessage");function Ut(n,e,t=[]){let i=new Map;for(let d of n){if(i.has(d.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${d.id}`);i.set(d.id,d)}for(let d of n)for(let l of d.dependencies)if(!i.has(l))throw new Error(`Pi Agent IDE extension ${d.id} has unknown dependency ${l}`);let o=new Set;for(let d of e){if(!i.has(d))throw new Error(`Unknown Pi Agent IDE extension ID in disabled: ${d}`);o.add(d)}for(let d of t)if(!i.has(d))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${d}`);let s=qn(i,t,o),r=new Set;for(let d of n)(d.defaultEnabled===!1&&!s.has(d.id)||o.has(d.id))&&r.add(d.id);let c=!0;for(;c;){c=!1;for(let d of n)r.has(d.id)||d.dependencies.every(l=>!r.has(l))||(r.add(d.id),c=!0)}return{enabled:n.filter(d=>!r.has(d.id)),disabled:r}}a(Ut,"selectBuiltinExtensions");function qn(n,e,t){let i=new Set,o=[...e];for(;o.length>0;){let s=o.pop();if(!(i.has(s)||t.has(s))){i.add(s);for(let r of n.get(s)?.dependencies??[])i.has(r)||o.push(r)}}return i}a(qn,"collectForcedOn");async function Jn(n){n.on("before_agent_start",i=>{let o=i.systemPrompt.replace("- bash: Execute bash commands (ls, grep, find, etc.)","- bash: Execute Bash commands").replace(`- Use bash for file operations like ls, rg, find
|
|
13
|
-
`,"");return o===i.systemPrompt?void 0:{systemPrompt:o}});let e=await Mt(Ft()),{enabled:t}=Ut(Ot,e.disabled,e.enabled);for(let i of t)await i.register(n)}a(Jn,"registerUnifiedPiAgentIde");export{Jn as default};
|
|
1
|
+
import{a as s}from"./chunk-EI7MMDWY.js";var D={"ide.core":["IDE services","Shared services used by language, formatting and diagnostic modules."],"ide.tips":["Getting started tips","Show contextual guidance while setting up a project."],"ide.doctor":["Setup doctor","Check external tools and help configure project support."],"ide.languages":["Language setup","Discover languages and their recommended toolchains."],"read.core":["Read tools","Read sources through the configured readers and views."],"read.filesystem":["Local files","Resolve files and folders from the local filesystem."],"read.filesystem.image":["Local images","Read local images as visual content."],"read.filesystem.pdf":["Local PDFs","Extract readable content from local PDF documents."],"read.filesystem.text":["Local text","Read local text files with their source coordinates."],"read.web":["Web sources","Read remote sources over HTTP and HTTPS."],"read.web.html":["Web pages","Extract readable content from HTML pages."],"read.web.image":["Web images","Read remote images as visual content."],"read.web.pdf":["Web PDFs","Extract text from remote PDF documents."],"read.web.text":["Web text","Read remote plain-text sources."],"search.core":["Search tools","Run searches through the configured search providers."],"search.text":["Text search","Find text and files and register reusable search selections."],"editor.core":["Editing tools","Apply guarded text and whole-file changes, including Apply scripts."],"editor.renderer":["Edit previews","Display changes in the shared colored diff panels."],"editor.anchor.constant":["File boundary selectors","Use begin and end to select file boundaries."],"editor.anchor.line-hash":["Checked line selectors","Select lines with hashes that detect stale content."],"editor.anchor.exact":["Exact text selectors","Locate edit ranges using unique source text."],"editor.stale-anchor":["Stale selection recovery","Provide recovery guidance when an edit selection is outdated."],"ide.ast":["Structural code support","Read code outlines and search or edit exact syntax-tree nodes."],"ide.formatter":["Code formatting","Run configured formatters after edits."],"ide.lint":["Lint checks","Run configured linters and collect their findings."],"ide.changes":["Git changes","Inspect and manage uncommitted changes and undo history."],"ide.lsp":["Language servers","Resolve symbols, rename references and collect language-server diagnostics."],"ide.diagnostics":["Diagnostic views","Show diagnostic findings through read views and sources."]};var w=[d("ide.core",()=>import("./chunk-EWNWKDMP.js")),d("ide.tips",()=>import("./chunk-BMOJTJJJ.js")),d("ide.doctor",()=>import("./chunk-M5L42DWE.js")),d("ide.languages",()=>import("./entry-30.js"),["ide.doctor"]),d("read.core",()=>import("./entry-40.js")),d("read.filesystem",()=>import("./entry-21.js"),["read.core","editor.core"]),d("read.filesystem.image",()=>import("./entry-22.js"),["read.filesystem"]),d("read.filesystem.pdf",()=>import("./entry-23.js"),["read.filesystem"]),d("read.filesystem.text",()=>import("./entry-24.js"),["read.filesystem"]),d("read.web",()=>import("./entry-75.js"),["read.core"]),d("read.web.html",()=>import("./entry-76.js"),["read.web"]),d("read.web.image",()=>import("./entry-77.js"),["read.web"]),d("read.web.pdf",()=>import("./entry-78.js"),["read.web"]),d("read.web.text",()=>import("./entry-79.js"),["read.web"]),d("search.core",()=>import("./entry-45.js")),d("search.text",()=>import("./entry-46.js"),["search.core"]),d("editor.renderer",()=>import("./entry-71.js"),["editor.core"]),d("editor.core",()=>import("./entry-70.js")),d("editor.anchor.constant",()=>import("./entry-49.js"),["read.core","editor.core"]),d("editor.anchor.line-hash",()=>import("./entry-53.js"),["read.core","editor.core"]),d("editor.anchor.exact",()=>import("./entry-51.js"),["editor.core"]),d("editor.stale-anchor",()=>import("./entry-72.js"),["editor.core"]),d("ide.ast",()=>import("./entry-26.js"),["ide.core","read.core","search.core","editor.core"]),d("ide.formatter",()=>import("./entry-29.js"),["ide.core"]),d("ide.lint",()=>import("./entry-31.js"),["ide.core"]),d("ide.changes",()=>import("./entry-28.js"),["ide.core","read.core","editor.core"]),d("ide.lsp",()=>import("./entry-32.js"),["ide.core","read.core","search.core"]),d("ide.diagnostics",()=>import("./chunk-CW53ZTU3.js"),["ide.core","read.core"])];function d(e,r,t=[],n=!0){return{id:e,name:D[e][0],description:D[e][1],dependencies:t,async register(o){await(await r()).default(o)},...n?{}:{defaultEnabled:!1}}}s(d,"builtin");import{readFile as W}from"node:fs/promises";import z from"node:os";import S from"node:path";function A(e=process.env,r=z.homedir(),t=process.cwd()){let n=e.PI_CODING_AGENT_DIR?.trim(),o=n===void 0||n.length===0?S.join(r,".pi","agent"):S.resolve(n);return{globalPath:S.join(o,"pi-agent-ide","extensions.json"),projectPath:S.resolve(t,".pi","pi-agent-ide","extensions.json")}}s(A,"resolvePiAgentIdeExtensionsConfigPaths");async function O(e){let r=await k(e.globalPath),t=await k(e.projectPath);return{disabled:[...new Set([...r.disabled,...t.disabled])],enabled:[...new Set([...r.enabled,...t.enabled])],...r.flags===void 0&&t.flags===void 0?{}:{flags:{...v(r),...v(t)}},noAnimations:t.noAnimations??r.noAnimations??!1,noPostProcessing:t.noPostProcessing??r.noPostProcessing??!1}}s(O,"readPiAgentIdeExtensionsConfig");function v(e){return{...e.noAnimations===void 0?{}:{"pi-agent-ide-no-animations":e.noAnimations},...e.noPostProcessing===void 0?{}:{"pi-agent-ide-no-post-processing":e.noPostProcessing},...e.flags}}s(v,"configuredFeatureFlags");async function x(e){return k(e)}s(x,"readExtensionSettingsScope");async function k(e){let r;try{r=await W(e,"utf8")}catch(n){if(X(n))return{disabled:[],enabled:[]};throw new Error(`Cannot read Pi Agent IDE extension config at ${e}: ${B(n)}`,{cause:n})}let t;try{t=JSON.parse(r)}catch(n){throw new Error(`Invalid JSON in Pi Agent IDE extension config at ${e}: ${B(n)}`,{cause:n})}if(!$(t))throw new Error(`Pi Agent IDE extension config at ${e} must be a JSON object`);return{disabled:L(t,"disabled",e),enabled:L(t,"enabled",e),...t.flags===void 0?{}:{flags:H(t.flags,e)},...t.noAnimations===void 0?{}:{noAnimations:T(t,"noAnimations",e)},...t.noPostProcessing===void 0?{}:{noPostProcessing:T(t,"noPostProcessing",e)}}}s(k,"readConfigExtensionIds");function H(e,r){if(!$(e))throw new Error(`flags in ${r} must be an object`);let t={};for(let[n,o]of Object.entries(e)){if(typeof o!="boolean")throw new Error(`Flag ${n} in ${r} must be a boolean`);t[n]=o}return t}s(H,"readFlags");function T(e,r,t){let n=e[r];if(typeof n!="boolean")throw new Error(`${r} in ${t} must be a boolean`);return n}s(T,"readBoolean");function L(e,r,t){let n=e[r];if(n===void 0)return[];if(!Array.isArray(n))throw new Error(`${r} in ${t} must be an array of non-empty strings`);let o=n.filter(l=>typeof l=="string");if(o.length!==n.length||o.some(l=>l.length===0))throw new Error(`${r} in ${t} must be an array of non-empty strings`);if(new Set(o).size!==o.length)throw new Error(`${r} in ${t} must not contain duplicate IDs`);return o}s(L,"readIdField");function X(e){return $(e)&&e.code==="ENOENT"}s(X,"isMissingFile");function $(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s($,"isRecord");function B(e){return e instanceof Error?e.message:String(e)}s(B,"errorMessage");function R(e,r,t=[]){let n=new Map;for(let i of e){if(n.has(i.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${i.id}`);n.set(i.id,i)}for(let i of e)for(let a of i.dependencies)if(!n.has(a))throw new Error(`Pi Agent IDE extension ${i.id} has unknown dependency ${a}`);let o=new Set;for(let i of r)n.has(i)&&o.add(i);for(let i of t)if(!n.has(i))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${i}`);let c=V(n,t,o),l=new Set;for(let i of e)(i.defaultEnabled===!1&&!c.has(i.id)||o.has(i.id))&&l.add(i.id);let f=!0;for(;f;){f=!1;for(let i of e)l.has(i.id)||i.dependencies.every(a=>!l.has(a))||(l.add(i.id),f=!0)}return{enabled:e.filter(i=>!l.has(i.id)),disabled:l}}s(R,"selectBuiltinExtensions");function V(e,r,t){let n=new Set,o=[...r];for(;o.length>0;){let c=o.pop();if(!(n.has(c)||t.has(c))){n.add(c);for(let l of e.get(c)?.dependencies??[])n.has(l)||o.push(l)}}return n}s(V,"collectForcedOn");import{mkdir as K,readFile as Q,writeFile as Y}from"node:fs/promises";import Z from"node:path";import{withFileMutationQueue as ee}from"@earendil-works/pi-coding-agent";async function _(e,r,t=new Map){await ee(e,async()=>{let n=await x(e),o={};try{o=JSON.parse(await Q(e,"utf8"))}catch(i){if(!(i instanceof Error&&"code"in i&&i.code==="ENOENT"))throw i}let c=new Set(n.disabled),l=new Set(n.enabled);for(let[i,a]of r)c.delete(i),l.delete(i),a==="disabled"&&c.add(i),a==="enabled"&&l.add(i);let f={...n.flags};for(let[i,a]of t)i==="pi-agent-ide-no-animations"&&delete o.noAnimations,i==="pi-agent-ide-no-post-processing"&&delete o.noPostProcessing,a===void 0?delete f[i]:f[i]=a;await K(Z.dirname(e),{recursive:!0}),await Y(e,`${JSON.stringify({...o,disabled:[...c],enabled:[...l],...t.size>0?{flags:f}:{}},null,2)}
|
|
2
|
+
`)})}s(_,"saveModuleChoices");import{getSettingsListTheme as ne}from"@earendil-works/pi-coding-agent";import{matchesKey as C,SettingsList as te,Text as j}from"@earendil-works/pi-tui";function U(e,r,t,n,o=""){let c=["modules","features","ui"],l="modules",f=s(()=>{let a=r()[l]??[];return new te(a,12,ne(),(p,y)=>{t(l,p,y);for(let E of r()[l]??[]){let P=a.find(M=>M.id===E.id);P&&Object.assign(P,E)}},()=>n(!1),{enableSearch:!0})},"createList"),i=f();return{render(a){return[...new j(e.fg("accent",e.bold(`Agent IDE settings${o?` \xB7 ${o}`:""}`)),1,0).render(a),...new j(c.map(p=>{let y=p==="ui"?"UI":p==="modules"?"Modules":"Features";return p===l?`[${y}]`:y}).join(" "),1,0).render(a),...i.render(a),...new j(e.fg("dim","Tab: switch tab \xB7 Enter: change \xB7 Ctrl+S: save \xB7 Esc: cancel"),1,0).render(a)]},invalidate(){i.invalidate()},handleInput(a){C(a,"tab")||C(a,"shift+tab")?(l=c[(c.indexOf(l)+(C(a,"shift+tab")?2:1))%c.length]??"modules",i=f()):C(a,"ctrl+s")?n(!0):i.handleInput(a)}}}s(U,"createSettingsPanel");function J(e,r=[]){e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(t,n){if(n.hasUI)try{let o=await n.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(o===void 0)return;let c=A(process.env,void 0,n.cwd),l=o==="Project"?c.projectPath:c.globalPath,f=await x(l),i=await x(o==="Project"?c.globalPath:c.projectPath),a=new Map,p=new Map;if(!await n.ui.custom((E,P,M,G)=>{let F=U(P,()=>{let m=new Set(f.disabled),b=new Set(f.enabled);for(let[g,u]of a)m.delete(g),b.delete(g),u==="disabled"&&m.add(g),u==="enabled"&&b.add(g);let h=R(w,[...m,...i.disabled],[...b,...i.enabled]);return{modules:w.map(g=>({id:g.id,label:g.name??g.id,description:`${g.description??""} Effective: ${h.disabled.has(g.id)?"off":"on"}.${i.disabled.includes(g.id)?" Disabled in the other scope.":g.dependencies.some(u=>h.disabled.has(u))?" A dependency is disabled.":""}`,currentValue:a.get(g.id)??(f.disabled.includes(g.id)?"disabled":f.enabled.includes(g.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:I("features"),ui:I("ui")};function I(g){return r.filter(u=>(u.group??"features")===g).map(u=>{let N=p.has(u.id)?p.get(u.id):v(f)[u.id];return{id:u.id,label:u.name,description:u.description,currentValue:N===void 0?"default":N?u.labels?.on??"enabled":u.labels?.off??"disabled",values:["default",u.labels?.off??"disabled",u.labels?.on??"enabled"]}})}},(m,b,h)=>{m==="modules"?a.set(b,h):p.set(b,h==="default"?void 0:h===(r.find(I=>I.id===b)?.labels?.on??"enabled"))},G,o);return{render:s(m=>F.render(m),"render"),invalidate:s(()=>F.invalidate(),"invalidate"),handleInput(m){F.handleInput(m),E.requestRender()}}})||a.size+p.size===0)return;if(await _(l,a,p),n.ui.notify(`Saved ${o.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await n.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await n.reload();return}}catch(o){n.ui.notify(o instanceof Error?o.message:String(o),"error")}}})}s(J,"registerModuleSettings");function q(e,r){let t=[];return{definitions:t,register(n){if(t.some(o=>o.id===n.id))throw new Error(`Duplicate feature flag: ${n.id}`);t.push(n),e.registerFlag(n.id,{type:"boolean",description:n.description,default:r[n.id]??n.default})}}}s(q,"createFeatureFlags");async function ie(e){e.on("before_agent_start",o=>{let c=o.systemPrompt.replace("- bash: Execute bash commands (ls, grep, find, etc.)","- bash: Execute Bash commands").replace(`- Use bash for file operations like ls, rg, find
|
|
3
|
+
`,"");return c===o.systemPrompt?void 0:{systemPrompt:c}});let r=await O(A()),t=q(e,{"pi-agent-ide-no-animations":r.noAnimations??!1,"pi-agent-ide-no-post-processing":r.noPostProcessing??!1,...r.flags});t.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),t.register({id:"pi-agent-ide-no-post-processing",name:"Skip automatic post-processing",description:"Skip automatic formatting and diagnostics after edits. Explicit diagnostic reads still work.",default:!1}),t.register({id:"pi-agent-ide-no-apply",name:"Disable Apply",description:"Hide the Apply tool. Standalone read, search and editing tools remain available.",default:!1}),t.register({id:"pi-agent-ide-apply-code",name:"Apply presentation",description:"Mixed compacts written tool calls during streaming. Code shows the full script. Expanded always exposes the source.",group:"ui",labels:{on:"Code",off:"Mixed"},default:!1}),t.register({id:"pi-agent-ide-no-diagnostic-buffer",name:"Immediate diagnostic notices",description:"Send findings immediately instead of combining reports received over five seconds.",group:"ui",default:!1}),J(e,t.definitions);let{enabled:n}=R(w,r.disabled,r.enabled);for(let o of n)await o.register(e)}s(ie,"registerUnifiedPiAgentIde");export{ie as default};
|
package/docs/configuration.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Configuration
|
|
2
2
|
|
|
3
|
+
## Agent IDE settings
|
|
4
|
+
|
|
5
|
+
Open `/agent-ide-settings` inside Pi and choose Project or Global. The Modules tab lists human-readable module names and descriptions. The Features tab lists registered boolean options. Tab switches tabs; typing filters the current list. Enter changes an override, Ctrl+S saves, and Esc cancels.
|
|
6
|
+
|
|
7
|
+
Default removes the selected scope’s override. Module descriptions show effective state and dependency restrictions. Feature values in project settings override global values. Saving offers a reload; declining leaves changes pending until reload or startup. The command stays available even when every optional module is disabled.
|
|
8
|
+
|
|
9
|
+
Feature overrides are stored under `flags` in `extensions.json`, keyed by their CLI name. Existing `noAnimations` and `noPostProcessing` fields still work; changing the corresponding feature in the menu replaces that field with its flag override.
|
|
10
|
+
|
|
11
|
+
The Features tab includes **Disable Apply** (`pi-agent-ide-no-apply`). Enable it and reload to remove only the `apply` tool; standalone tools remain available. It defaults to off. The obsolete `old-tools` switch has been removed.
|
|
12
|
+
|
|
13
|
+
The UI tab contains animation preferences and **Apply presentation**. Mixed is the default: written helper calls are compacted while the script streams. Code shows the full script (`pi-agent-ide-apply-code: true`). Expanded display exposes the source in either mode. These previews never execute arguments and do not indicate successful edits; operation results are shown separately.
|
|
14
|
+
After the call is complete, its display copy is formatted before Mixed substitutes the tool headers. Incomplete code uses the recoverable source preview. Headers keep supplied anchors and compact long argument expressions with their source size; those sizes are not counts of applied edits. `result(...)` stays visible as JavaScript. Expanded mode shows the full display copy. Execution always receives the original source.
|
|
15
|
+
|
|
16
|
+
All user-configurable presentation and behavior preferences belong in Agent IDE settings. New options must carry a human name, explanation and default in their registration. Presentation options belong in the UI tab.
|
|
17
|
+
|
|
18
|
+
New Agent IDE boolean options must use `createFeatureFlags().register` with an ID, human name, description and default. The same registration supplies the Pi flag and its Features or UI tab; no separate menu entry is needed.
|
|
19
|
+
|
|
20
|
+
Obsolete IDs in `disabled` are ignored. They do not stop IDE startup. Malformed configuration and unknown IDs in `enabled` still report configuration errors.
|
|
21
|
+
|
|
3
22
|
Pi Agent IDE enables every built-in extension by default. Project and global config files can disable built-ins by their stable IDs and turn on built-ins that are off by default.
|
|
4
23
|
|
|
5
24
|
## Config files
|
|
@@ -19,11 +38,11 @@ Example:
|
|
|
19
38
|
|
|
20
39
|
```json
|
|
21
40
|
{
|
|
22
|
-
"
|
|
41
|
+
"disabled": ["ide.lsp"]
|
|
23
42
|
}
|
|
24
43
|
```
|
|
25
44
|
|
|
26
|
-
|
|
45
|
+
This config disables the LSP extension.
|
|
27
46
|
|
|
28
47
|
An explicit `disabled` entry always beats an explicit `enabled` entry for the same ID.
|
|
29
48
|
`enabled` matters only for built-ins marked as off by default; listing an always-on
|
|
@@ -34,6 +53,35 @@ A project config is useful for repository-specific choices. The global config ap
|
|
|
34
53
|
|
|
35
54
|
Restart Pi or use `/reload` after changing extension selection. Search timeout settings are read for every search call.
|
|
36
55
|
|
|
56
|
+
Built-in entry modules are imported only after selection. Disabled built-ins, including those disabled through a dependency, are not imported by the catalog. Selected built-ins still register in catalog order. Shared libraries used by a selected built-in may still load.
|
|
57
|
+
|
|
58
|
+
## Animations and post-edit processing
|
|
59
|
+
|
|
60
|
+
Apply writes happen immediately, but configured formatting runs once per surviving changed file at the end of the call, including after a script error. Batch diagnostics start after every file has finished post-processing. Copied and moved UTF-8 text targets also receive configured post-processing; binary contents stay unchanged. Reads and Git staging inside Apply see the bytes written so far, before final formatting.
|
|
61
|
+
|
|
62
|
+
Automatic diagnostic findings are grouped for five seconds from the first finding. The UI tab’s **Immediate diagnostic notices** option (`pi-agent-ide-no-diagnostic-buffer`) disables this delay. Combined notices keep each file and reporting tool identifiable. Empty completed diagnostic reads tell the agent that checks finished without findings, but do not draw an empty diagnostic panel. Pending, unavailable and incomplete checks are not reported as clean.
|
|
63
|
+
|
|
64
|
+
Start Pi with either or both flags:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
pi --pi-agent-ide-no-animations --pi-agent-ide-no-post-processing
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Both settings also belong in `extensions.json`:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"noAnimations": true,
|
|
75
|
+
"noPostProcessing": true
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Both default to `false`. A project boolean overrides the global boolean, including an explicit `false`. A command-line flag forces its setting on for that invocation. Restart Pi or reload after changing the config.
|
|
80
|
+
|
|
81
|
+
`noAnimations` skips IDE mutation preview playback, interpolation timers and preview preparation. The pending tool header and final static diff remain visible. It does not change model-facing results or disable Pi's own activity indicator.
|
|
82
|
+
|
|
83
|
+
`noPostProcessing` skips syntax checks used by the post-edit formatting gate, automatic formatting, and automatic diagnostic scheduling after an edit. Requested edits and their safety checks still run. Explicit diagnostic and AST reads remain available and may run their normal tools. This is useful when a benchmark requires exact byte preservation without automatic formatting or diagnostic cache files.
|
|
84
|
+
|
|
37
85
|
## Search timeout
|
|
38
86
|
|
|
39
87
|
The complete `search` call has a 30-second timeout by default. This covers resolver work and result formatting. When it expires, the active resolver is cancelled and the agent receives this error:
|
|
@@ -193,7 +241,7 @@ Edit tool diffs show every diff row by default. The panel keeps completed rows v
|
|
|
193
241
|
- `disabled` and `enabled` must each be an array of unique, non-empty extension IDs.
|
|
194
242
|
- The project and global lists are merged; a setting wins at either level.
|
|
195
243
|
- Invalid JSON stops Pi Agent IDE from loading.
|
|
196
|
-
-
|
|
244
|
+
- Unknown `disabled` IDs are ignored. Unknown `enabled` IDs remain configuration errors.
|
|
197
245
|
- Disabling a core also disables built-ins that depend on it.
|
|
198
246
|
- The config controls bundled extensions only. It does not disable external Pi extensions.
|
|
199
247
|
|
|
@@ -234,14 +282,12 @@ Edit tool diffs show every diff row by default. The panel keeps completed rows v
|
|
|
234
282
|
|
|
235
283
|
### Editing and anchors
|
|
236
284
|
|
|
237
|
-
| ID | Contribution
|
|
238
|
-
| ------------------------- |
|
|
239
|
-
| `editor.anchor.constant` | `begin` and `end` anchors
|
|
240
|
-
| `editor.anchor.line-hash` | Snapshot-aware line anchors
|
|
241
|
-
| `editor.anchor.exact` | Unique exact text spans and recovery
|
|
242
|
-
| `editor.
|
|
243
|
-
| `editor.overwrite` | Full-file overwrite protection (off by default) |
|
|
244
|
-
| `editor.stale-anchor` | Stale-anchor recovery behavior |
|
|
285
|
+
| ID | Contribution |
|
|
286
|
+
| ------------------------- | ------------------------------------ |
|
|
287
|
+
| `editor.anchor.constant` | `begin` and `end` anchors |
|
|
288
|
+
| `editor.anchor.line-hash` | Snapshot-aware line anchors |
|
|
289
|
+
| `editor.anchor.exact` | Unique exact text spans and recovery |
|
|
290
|
+
| `editor.stale-anchor` | Stale-anchor recovery behavior |
|
|
245
291
|
|
|
246
292
|
### Code intelligence and feedback
|
|
247
293
|
|
package/docs/extensions.md
CHANGED
|
@@ -268,9 +268,11 @@ export default function register(pi: ExtensionAPI): void | Promise<void> {
|
|
|
268
268
|
|
|
269
269
|
A real formatter runs inside the edit transaction and reports how many edits it applied. Only a compiler marked `syntaxOnly: true` may run before formatting. It must perform a fast parser check, not LSP or project/type analysis. Syntax errors skip formatting and keep the edit saved. A formatter can instead use its own parser to reject invalid text safely.
|
|
270
270
|
|
|
271
|
+
A formatter result can set `formatter` to the actual executable name. Built-in command formatters do this so diff statuses and agent results name the command, not the wrapper extension. Omit it for a formatter implemented by the named plugin itself. Set it to `null` when no formatter was selected; the edit then has no formatting-success status.
|
|
272
|
+
|
|
271
273
|
### Background diagnostics
|
|
272
274
|
|
|
273
|
-
IDE API version 3 separates diagnostic producers from file-writing tools. Register a read-only source with `api.addDiagnosticSource({ id, diagnose })`. `diagnose(filePath, context)` receives the workspace, final file `content`, an abort `signal`, and a revision-bound `publish(report)` callback for later updates. Return a report with `status`, `diagnostics`, and an optional failure `reason`. Coordinates are one-based.
|
|
275
|
+
IDE API version 3 separates diagnostic producers from file-writing tools. Register a read-only source with `api.addDiagnosticSource({ id, diagnose })`. `diagnose(filePath, context)` receives the workspace, final file `content`, an abort `signal`, and a revision-bound `publish(report)` callback for later updates. Return a report with `status`, `diagnostics`, and an optional failure `reason`. Set `source` to the actual reporting tool name when the registered producer delegates to a command. The core keeps the registered ID for updates, but uses the report's name in reads, model notifications, and chat summaries. Coordinates are one-based.
|
|
274
276
|
|
|
275
277
|
- `ready` means the source checked this text.
|
|
276
278
|
- `unversioned` means the server omitted its document version, so freshness cannot be proved.
|
|
@@ -280,7 +282,7 @@ Honor cancellation and never apply fixes from a diagnostic source. The core reje
|
|
|
280
282
|
|
|
281
283
|
`api.readDiagnostics(filePath, { cwd })` returns `{ filePath, content, results }`. It detects external text changes, reuses completed current checks, and waits at most five seconds for pending checks. Results still running have `status: "pending"`. Each background check has a thirty-second deadline; an individual provider may have a shorter timeout. Missing and failed sources remain explicit.
|
|
282
284
|
|
|
283
|
-
Changed per-file counts
|
|
285
|
+
Changed per-file counts from nonempty reports immediately send a hidden custom session message and appear in a separate chat summary. Pending, unavailable, and empty sources are excluded from both. Empty updates still clear cached findings without sending a notification, and a later recurrence can notify again. Delivery is serialized and duplicate reports stay silent. Messages contain counts rather than diagnostic details. They start a turn when the agent is idle and use Pi's steering queue during an active run. Session shutdown cancels pending checks and delivery. The `diagnostics:` protocol and `diagnostics` view expose details when the agent requests them. Neither replaces project builds or tests.
|
|
284
286
|
|
|
285
287
|
## Doctor plugin
|
|
286
288
|
|
package/docs/tools.md
CHANGED
|
@@ -44,9 +44,15 @@ Browser reads discover `google-chrome`, `google-chrome-stable`, `chromium`, or `
|
|
|
44
44
|
|
|
45
45
|
When `path` is a typed text resource, `read` returns one independent chunk for each selected range, in resolver order. Each chunk starts at the range's containing line. `offset` and `limit` are applied to every chunk, not across the combined result. The chunks are then joined and the normal aggregate limit of 2,000 lines or 50 KiB is applied.
|
|
46
46
|
|
|
47
|
+
### Original bytes
|
|
48
|
+
|
|
49
|
+
Use `read({path: "raw:sample.bin", offset: 0, limit: 64})` to inspect original local file bytes, including PDF and image headers. In `raw:` mode only, offset is zero-based in bytes (negative from EOF), and limit is a non-negative byte count. The output shows hexadecimal offsets, hex bytes, and printable ASCII. Follow its returned byte offset to continue. No views or text anchors apply.
|
|
50
|
+
|
|
51
|
+
Inside Apply, the same call returns `kind: "bytes"`, `source`, `byteOffset`, `byteLength`, `totalBytes`, `bytes: number[]`, and `ok`. The script receives the complete selected range; the displayed answer stays bounded. Use `result(doc)` to retain the hex view rather than printing the byte array. This is read-only; byte editing and byte diff are not included.
|
|
52
|
+
|
|
47
53
|
### Diagnostic completion
|
|
48
54
|
|
|
49
|
-
Edits save before background diagnostics finish.
|
|
55
|
+
Edits save before background diagnostics finish. Automatic notifications show only sources with findings, in the chat as soon as they arrive, with a matching hidden message sent to the agent. A new finding wakes an idle agent; during a run it is queued as steering input for the next model call. Each source names the actual reporting command, such as `eslint_d` or `typescript-language-server`, rather than a wrapper extension. Chat summaries show that name in parentheses beside its counts. Pending, unavailable, and empty reports stay silent, including updates that clear earlier findings. Silence does not mean checks passed. Explicit `diagnostics:<path>` reads and the diagnostics view still return details and readiness.
|
|
50
56
|
|
|
51
57
|
LSP reads prefer standard pull reports. Servers that advertise a supported completed-request command can use an adapter; TypeScript language server uses one adapter for both TypeScript and JavaScript. Adapter selection uses server capabilities, not language names. All requests remain tied to the synchronized document revision and are canceled when it becomes stale.
|
|
52
58
|
|
|
@@ -18,7 +18,7 @@ import { createFilesystemReadResolver, createFilesystemWriteResolver } from "#sr
|
|
|
18
18
|
|
|
19
19
|
const readTarget = { provider: "filesystem", capability: "read" } satisfies ContentTarget;
|
|
20
20
|
const writeTarget = { provider: "filesystem", capability: "write" } satisfies ContentTarget;
|
|
21
|
-
const renderReadResult = createReadResultRenderer({ kind: "source" });
|
|
21
|
+
const renderReadResult = createReadResultRenderer({ kind: "source", nativeResources: true });
|
|
22
22
|
|
|
23
23
|
export default async function registerFilesystemPlugin(pi: ExtensionAPI): Promise<void> {
|
|
24
24
|
const readHost = createContentHost(pi, readTarget);
|
|
@@ -33,7 +33,7 @@ export default async function registerFilesystemPlugin(pi: ExtensionAPI): Promis
|
|
|
33
33
|
api.addResolver({ resolver: readResolver, renderResult: renderReadResult });
|
|
34
34
|
api.describe(() =>
|
|
35
35
|
renderContentDescription(
|
|
36
|
-
"
|
|
36
|
+
"File path — file content; directory path — entry listing. Relative, absolute and file:// paths accepted.",
|
|
37
37
|
readHost.listDescriptions(),
|
|
38
38
|
),
|
|
39
39
|
);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.
|
|
10
|
-
"pi-agent-read": "0.
|
|
11
|
-
"pi-agent-resource": "0.
|
|
12
|
-
"pi-agent-text": "0.
|
|
13
|
-
"pi-agent-text-editor": "0.
|
|
9
|
+
"pi-agent-image": "0.3.0",
|
|
10
|
+
"pi-agent-read": "0.3.0",
|
|
11
|
+
"pi-agent-resource": "0.3.0",
|
|
12
|
+
"pi-agent-text": "0.3.0",
|
|
13
|
+
"pi-agent-text-editor": "0.3.0"
|
|
14
14
|
},
|
|
15
15
|
"pi": {
|
|
16
16
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.
|
|
10
|
-
"pi-agent-resource": "0.
|
|
9
|
+
"pi-agent-image": "0.3.0",
|
|
10
|
+
"pi-agent-resource": "0.3.0"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.
|
|
7
|
-
"pi-agent-resource": "0.
|
|
6
|
+
"pi-agent-pdf": "0.3.0",
|
|
7
|
+
"pi-agent-resource": "0.3.0"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.
|
|
10
|
-
"pi-agent-text": "0.
|
|
9
|
+
"pi-agent-resource": "0.3.0",
|
|
10
|
+
"pi-agent-text": "0.3.0"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-ast",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@tree-sitter-grammars/tree-sitter-toml": "^0.7.0",
|
|
16
16
|
"@tree-sitter-grammars/tree-sitter-yaml": "^0.7.1",
|
|
17
|
-
"pi-agent-doctor": "0.
|
|
18
|
-
"pi-agent-invariant": "0.
|
|
19
|
-
"pi-agent-read": "0.
|
|
20
|
-
"pi-agent-resource": "0.
|
|
21
|
-
"pi-agent-search": "0.
|
|
22
|
-
"pi-agent-text": "0.
|
|
23
|
-
"pi-agent-text-editor": "0.
|
|
17
|
+
"pi-agent-doctor": "0.3.0",
|
|
18
|
+
"pi-agent-invariant": "0.3.0",
|
|
19
|
+
"pi-agent-read": "0.3.0",
|
|
20
|
+
"pi-agent-resource": "0.3.0",
|
|
21
|
+
"pi-agent-search": "0.3.0",
|
|
22
|
+
"pi-agent-text": "0.3.0",
|
|
23
|
+
"pi-agent-text-editor": "0.3.0",
|
|
24
24
|
"tree-sitter-cpp": "^0.23.4",
|
|
25
25
|
"tree-sitter-javascript": "^0.25.0",
|
|
26
26
|
"tree-sitter-json": "^0.24.8",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@earendil-works/pi-coding-agent": "*",
|
|
39
|
-
"pi-agent-ide": "0.
|
|
39
|
+
"pi-agent-ide": "0.3.0"
|
|
40
40
|
}
|
|
41
41
|
}
|