pi-agent-ide 0.1.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/LICENSE +21 -0
- package/README.md +53 -0
- package/assets/banner.png +0 -0
- package/docs/architecture.md +100 -0
- package/docs/configuration.md +104 -0
- package/docs/development.md +102 -0
- package/docs/evaluation.md +14 -0
- package/docs/extensions.md +298 -0
- package/docs/tools.md +104 -0
- package/node_modules/pi-agent-filesystem/index.ts +60 -0
- package/node_modules/pi-agent-filesystem/package.json +23 -0
- package/node_modules/pi-agent-filesystem/src/resolver.ts +175 -0
- package/node_modules/pi-agent-filesystem-image/index.ts +14 -0
- package/node_modules/pi-agent-filesystem-image/package.json +20 -0
- package/node_modules/pi-agent-filesystem-pdf/index.ts +14 -0
- package/node_modules/pi-agent-filesystem-pdf/package.json +17 -0
- package/node_modules/pi-agent-filesystem-text/index.ts +23 -0
- package/node_modules/pi-agent-filesystem-text/package.json +20 -0
- package/node_modules/pi-agent-ide-ast/index.ts +1 -0
- package/node_modules/pi-agent-ide-ast/package.json +39 -0
- package/node_modules/pi-agent-ide-ast/src/api/scope.ts +1 -0
- package/node_modules/pi-agent-ide-ast/src/ast/collect-files.ts +24 -0
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +374 -0
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +813 -0
- package/node_modules/pi-agent-ide-ast/src/ast/read-text.ts +30 -0
- package/node_modules/pi-agent-ide-ast/src/extension.ts +85 -0
- package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +69 -0
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +221 -0
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +45 -0
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +141 -0
- package/node_modules/pi-agent-ide-changes/index.ts +68 -0
- package/node_modules/pi-agent-ide-changes/package.json +29 -0
- package/node_modules/pi-agent-ide-changes/src/change-anchor.ts +103 -0
- package/node_modules/pi-agent-ide-changes/src/changes/change-groups.ts +309 -0
- package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +223 -0
- package/node_modules/pi-agent-ide-changes/src/changes/change-types.ts +105 -0
- package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +325 -0
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +232 -0
- package/node_modules/pi-agent-ide-changes/src/index-mutation-queue.ts +11 -0
- package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +88 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +116 -0
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +153 -0
- package/node_modules/pi-agent-ide-formatter/index.ts +33 -0
- package/node_modules/pi-agent-ide-formatter/package.json +14 -0
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +50 -0
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +30 -0
- package/node_modules/pi-agent-ide-formatter/src/types.ts +10 -0
- package/node_modules/pi-agent-ide-lint/index.ts +237 -0
- package/node_modules/pi-agent-ide-lint/package.json +19 -0
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +160 -0
- package/node_modules/pi-agent-ide-lint/src/command-runner.ts +51 -0
- package/node_modules/pi-agent-ide-lint/src/registry.ts +30 -0
- package/node_modules/pi-agent-ide-lint/src/types.ts +10 -0
- package/node_modules/pi-agent-ide-lsp/index.ts +250 -0
- package/node_modules/pi-agent-ide-lsp/package.json +23 -0
- package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +139 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +463 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +577 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostics.ts +179 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +59 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/language-map.ts +57 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +85 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +485 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +85 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +97 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +50 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +149 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +151 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/types.ts +95 -0
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +42 -0
- package/node_modules/pi-agent-image/package.json +18 -0
- package/node_modules/pi-agent-image/src/image-converter.ts +318 -0
- package/node_modules/pi-agent-image/src/index.ts +6 -0
- package/node_modules/pi-agent-pdf/package.json +16 -0
- package/node_modules/pi-agent-pdf/src/index.ts +5 -0
- package/node_modules/pi-agent-pdf/src/pdf-converter.ts +197 -0
- package/node_modules/pi-agent-read/index.ts +1 -0
- package/node_modules/pi-agent-read/package.json +41 -0
- package/node_modules/pi-agent-read/src/api/connect-plugin.ts +67 -0
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +67 -0
- package/node_modules/pi-agent-read/src/api/rendering.ts +11 -0
- package/node_modules/pi-agent-read/src/api/tools/read.ts +208 -0
- package/node_modules/pi-agent-read/src/core/extension.ts +40 -0
- package/node_modules/pi-agent-read/src/core/read-core.ts +390 -0
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +193 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +400 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +187 -0
- package/node_modules/pi-agent-read/src/core/tools/read/temp-resource-store.ts +218 -0
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +828 -0
- package/node_modules/pi-agent-resource/package.json +17 -0
- package/node_modules/pi-agent-resource/src/content-conversion/connect-plugin.ts +84 -0
- package/node_modules/pi-agent-resource/src/content-conversion/content-converter.ts +49 -0
- package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +29 -0
- package/node_modules/pi-agent-resource/src/content-conversion/content-host.ts +73 -0
- package/node_modules/pi-agent-resource/src/content-conversion/content-runner.ts +152 -0
- package/node_modules/pi-agent-resource/src/content-conversion/plugin-protocol.ts +74 -0
- package/node_modules/pi-agent-resource/src/content-conversion/validation.ts +149 -0
- package/node_modules/pi-agent-resource/src/content.ts +17 -0
- package/node_modules/pi-agent-resource/src/index.ts +65 -0
- package/node_modules/pi-agent-resource/src/resolver.ts +23 -0
- package/node_modules/pi-agent-resource/src/resource.ts +41 -0
- package/node_modules/pi-agent-resource/src/validation.ts +139 -0
- package/node_modules/pi-agent-search/index.ts +1 -0
- package/node_modules/pi-agent-search/package.json +35 -0
- package/node_modules/pi-agent-search/src/api/connect-plugin.ts +61 -0
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +60 -0
- package/node_modules/pi-agent-search/src/api/search.ts +91 -0
- package/node_modules/pi-agent-search/src/core/extension.ts +126 -0
- package/node_modules/pi-agent-search/src/core/search-core.ts +400 -0
- package/node_modules/pi-agent-search-semantic/index.ts +105 -0
- package/node_modules/pi-agent-search-semantic/package.json +17 -0
- package/node_modules/pi-agent-search-text/index.ts +54 -0
- package/node_modules/pi-agent-search-text/package.json +33 -0
- package/node_modules/pi-agent-search-text/src/file-search.ts +105 -0
- package/node_modules/pi-agent-search-text/src/lucene-query-parser.d.ts +22 -0
- package/node_modules/pi-agent-search-text/src/resolvers.ts +192 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +295 -0
- package/node_modules/pi-agent-search-text/src/search-query.ts +139 -0
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +420 -0
- package/node_modules/pi-agent-search-text/src/search-result.ts +193 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +338 -0
- package/node_modules/pi-agent-search-web/index.ts +74 -0
- package/node_modules/pi-agent-search-web/package.json +19 -0
- package/node_modules/pi-agent-search-web/src/config.ts +499 -0
- package/node_modules/pi-agent-search-web/src/providers/duckduckgo-html.ts +78 -0
- package/node_modules/pi-agent-search-web/src/providers/endpoints.ts +89 -0
- package/node_modules/pi-agent-search-web/src/providers/request.ts +430 -0
- package/node_modules/pi-agent-search-web/src/providers/response.ts +402 -0
- package/node_modules/pi-agent-search-web/src/search-format.ts +29 -0
- package/node_modules/pi-agent-search-web/src/search.ts +434 -0
- package/node_modules/pi-agent-search-web/src/types.ts +153 -0
- package/node_modules/pi-agent-text/package.json +18 -0
- package/node_modules/pi-agent-text/src/index.ts +31 -0
- package/node_modules/pi-agent-text/src/presented-text.ts +24 -0
- package/node_modules/pi-agent-text/src/source-line.ts +49 -0
- package/node_modules/pi-agent-text/src/text-anchor.ts +157 -0
- package/node_modules/pi-agent-text/src/text-converter.ts +109 -0
- package/node_modules/pi-agent-text/src/text-document.ts +149 -0
- package/node_modules/pi-agent-text-anchor-constant/index.ts +30 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +17 -0
- package/node_modules/pi-agent-text-anchor-constant/src/resolver.ts +47 -0
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +48 -0
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +24 -0
- package/node_modules/pi-agent-text-anchor-line-hash/src/anchor.ts +110 -0
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +47 -0
- package/node_modules/pi-agent-text-editor/index.ts +19 -0
- package/node_modules/pi-agent-text-editor/package.json +92 -0
- package/node_modules/pi-agent-text-editor/src/api/anchor-inspection.ts +24 -0
- package/node_modules/pi-agent-text-editor/src/api/connect-plugin.ts +67 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +19 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +64 -0
- package/node_modules/pi-agent-text-editor/src/api/last-resolved-resource.ts +46 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +46 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-preview.ts +30 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +23 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +180 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +217 -0
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +147 -0
- package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +17 -0
- package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +121 -0
- package/node_modules/pi-agent-text-editor/src/api/tool-call-interceptor.ts +11 -0
- package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +39 -0
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +59 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +150 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +386 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +129 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +359 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +648 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +117 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-recovery.ts +24 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +381 -0
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +273 -0
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +607 -0
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-execution.ts +127 -0
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +45 -0
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +432 -0
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +115 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +2348 -0
- package/node_modules/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +28 -0
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +756 -0
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1235 -0
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/partial-json-resolver.ts +43 -0
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/partial-tool-recovery.ts +308 -0
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/rendering.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +467 -0
- package/node_modules/pi-agent-text-editor/src/core/tool-description.ts +16 -0
- package/node_modules/pi-agent-text-editor/src/tools/extension.ts +19 -0
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +106 -0
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +121 -0
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +79 -0
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +56 -0
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +142 -0
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +72 -0
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +28 -0
- package/node_modules/pi-agent-text-editor-argument-order/index.ts +29 -0
- package/node_modules/pi-agent-text-editor-argument-order/package.json +16 -0
- package/node_modules/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +112 -0
- package/node_modules/pi-agent-text-editor-overwrite/index.ts +391 -0
- package/node_modules/pi-agent-text-editor-overwrite/package.json +16 -0
- package/node_modules/pi-agent-text-editor-renderer/index.ts +22 -0
- package/node_modules/pi-agent-text-editor-renderer/package.json +21 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +452 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +271 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-theme.ts +411 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +38 -0
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +205 -0
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +229 -0
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +407 -0
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +153 -0
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +8 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +728 -0
- package/node_modules/pi-agent-text-editor-renderer/src/typing-interpolation.ts +219 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +375 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +17 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +17 -0
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +418 -0
- package/node_modules/pi-agent-web/index.ts +37 -0
- package/node_modules/pi-agent-web/package.json +24 -0
- package/node_modules/pi-agent-web/src/resolver.ts +182 -0
- package/node_modules/pi-agent-web-html/index.ts +15 -0
- package/node_modules/pi-agent-web-html/package.json +18 -0
- package/node_modules/pi-agent-web-html/src/extract-readable-html.ts +101 -0
- package/node_modules/pi-agent-web-html/src/html-converter.ts +91 -0
- package/node_modules/pi-agent-web-image/index.ts +14 -0
- package/node_modules/pi-agent-web-image/package.json +17 -0
- package/node_modules/pi-agent-web-pdf/index.ts +14 -0
- package/node_modules/pi-agent-web-pdf/package.json +17 -0
- package/node_modules/pi-agent-web-text/index.ts +14 -0
- package/node_modules/pi-agent-web-text/package.json +17 -0
- package/package.json +176 -0
- package/src/api/code-view.ts +25 -0
- package/src/api/connect-plugin.ts +64 -0
- package/src/api/plugin-protocol.ts +63 -0
- package/src/api/read.ts +5 -0
- package/src/api/resource.ts +2 -0
- package/src/api/search.ts +4 -0
- package/src/api/text-editor.ts +3 -0
- package/src/api/text.ts +2 -0
- package/src/api/toolchain.ts +24 -0
- package/src/code-view/diagnostic-view.ts +82 -0
- package/src/code-view/reference.ts +113 -0
- package/src/code-view/source-view.ts +229 -0
- package/src/composite/builtin-extensions.ts +68 -0
- package/src/composite/config.ts +94 -0
- package/src/composite/selection.ts +66 -0
- package/src/core/extension.ts +48 -0
- package/src/core/ide-core.ts +117 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +60 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +23 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/index.ts +14 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +20 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/index.ts +14 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +17 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/index.ts +23 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +20 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +175 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +37 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +24 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/index.ts +15 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +18 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/extract-readable-html.ts +101 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +91 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/index.ts +14 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +17 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/index.ts +14 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +17 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/index.ts +14 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +17 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +182 -0
- package/src/extensions/pi-agent-read/index.ts +1 -0
- package/src/extensions/pi-agent-read/package.json +41 -0
- package/src/extensions/pi-agent-read/src/api/connect-plugin.ts +67 -0
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +67 -0
- package/src/extensions/pi-agent-read/src/api/rendering.ts +11 -0
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +208 -0
- package/src/extensions/pi-agent-read/src/core/extension.ts +40 -0
- package/src/extensions/pi-agent-read/src/core/read-core.ts +390 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +193 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +400 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +187 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +218 -0
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +828 -0
- package/src/extensions/pi-agent-search/index.ts +1 -0
- package/src/extensions/pi-agent-search/package.json +35 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-semantic/index.ts +105 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-semantic/package.json +17 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +54 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +33 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +105 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/lucene-query-parser.d.ts +22 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +192 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +295 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +139 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +420 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +193 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +338 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/index.ts +74 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/package.json +19 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/config.ts +499 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/providers/duckduckgo-html.ts +78 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/providers/endpoints.ts +89 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/providers/request.ts +430 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/providers/response.ts +402 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/search-format.ts +29 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/search.ts +434 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/types.ts +153 -0
- package/src/extensions/pi-agent-search/src/api/connect-plugin.ts +61 -0
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +60 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +91 -0
- package/src/extensions/pi-agent-search/src/core/extension.ts +126 -0
- package/src/extensions/pi-agent-search/src/core/search-core.ts +400 -0
- package/src/extensions/pi-agent-text-editor/index.ts +19 -0
- package/src/extensions/pi-agent-text-editor/package.json +92 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/index.ts +30 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +17 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/src/resolver.ts +47 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +48 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +24 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/anchor.ts +110 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +47 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/index.ts +29 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +16 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +112 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/index.ts +391 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +16 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +22 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +21 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +452 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +271 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-theme.ts +411 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +38 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +205 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +229 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +407 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +153 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +8 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +728 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/typing-interpolation.ts +219 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +375 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +17 -0
- package/src/extensions/pi-agent-text-editor/src/api/anchor-inspection.ts +24 -0
- package/src/extensions/pi-agent-text-editor/src/api/connect-plugin.ts +67 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +19 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +64 -0
- package/src/extensions/pi-agent-text-editor/src/api/last-resolved-resource.ts +46 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +46 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-preview.ts +30 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +23 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +180 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +217 -0
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +147 -0
- package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +17 -0
- package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +121 -0
- package/src/extensions/pi-agent-text-editor/src/api/tool-call-interceptor.ts +11 -0
- package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +39 -0
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +59 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +150 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +386 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +129 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +359 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +648 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +117 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-recovery.ts +24 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +381 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +273 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +607 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-execution.ts +127 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +45 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +432 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +115 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +2348 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +28 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +756 -0
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1235 -0
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/partial-json-resolver.ts +43 -0
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/partial-tool-recovery.ts +308 -0
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/rendering.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +467 -0
- package/src/extensions/pi-agent-text-editor/src/core/tool-description.ts +16 -0
- package/src/extensions/pi-agent-text-editor/src/tools/extension.ts +19 -0
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +106 -0
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +121 -0
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +79 -0
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +56 -0
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +142 -0
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +72 -0
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +28 -0
- package/src/index.ts +1 -0
- package/src/pi-agent-ide.ts +17 -0
- package/src/plugins/pi-agent-ide-ast/index.ts +1 -0
- package/src/plugins/pi-agent-ide-ast/package.json +39 -0
- package/src/plugins/pi-agent-ide-ast/src/api/scope.ts +1 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/collect-files.ts +24 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +374 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +813 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/read-text.ts +30 -0
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +85 -0
- package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +69 -0
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +221 -0
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +45 -0
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +141 -0
- package/src/plugins/pi-agent-ide-changes/index.ts +68 -0
- package/src/plugins/pi-agent-ide-changes/package.json +29 -0
- package/src/plugins/pi-agent-ide-changes/src/change-anchor.ts +103 -0
- package/src/plugins/pi-agent-ide-changes/src/changes/change-groups.ts +309 -0
- package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +223 -0
- package/src/plugins/pi-agent-ide-changes/src/changes/change-types.ts +105 -0
- package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +325 -0
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +232 -0
- package/src/plugins/pi-agent-ide-changes/src/index-mutation-queue.ts +11 -0
- package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +88 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +116 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +153 -0
- package/src/plugins/pi-agent-ide-formatter/index.ts +33 -0
- package/src/plugins/pi-agent-ide-formatter/package.json +14 -0
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +50 -0
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +30 -0
- package/src/plugins/pi-agent-ide-formatter/src/types.ts +10 -0
- package/src/plugins/pi-agent-ide-lint/index.ts +237 -0
- package/src/plugins/pi-agent-ide-lint/package.json +19 -0
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +160 -0
- package/src/plugins/pi-agent-ide-lint/src/command-runner.ts +51 -0
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +30 -0
- package/src/plugins/pi-agent-ide-lint/src/types.ts +10 -0
- package/src/plugins/pi-agent-ide-lsp/index.ts +250 -0
- package/src/plugins/pi-agent-ide-lsp/package.json +23 -0
- package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +139 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +463 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +577 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostics.ts +179 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +59 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/language-map.ts +57 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +85 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +485 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +85 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +97 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +50 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +149 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +151 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/types.ts +95 -0
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +42 -0
- package/src/post-edit/gate.ts +153 -0
- package/src/toolchain/diagnostic.ts +7 -0
- package/src/toolchain/gate.ts +322 -0
- package/src/toolchain/registry.ts +223 -0
- package/src/toolchain/types.ts +164 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
|
|
3
|
+
import { formatDiagnostic } from "#src/toolchain/diagnostic.js";
|
|
4
|
+
|
|
5
|
+
import type { Diagnostic } from "#src/toolchain/types.js";
|
|
6
|
+
import type { SourceMappedTextContent } from "./source-view.js";
|
|
7
|
+
import type { TextSourceLine } from "pi-agent-text";
|
|
8
|
+
|
|
9
|
+
export function resolveDiagnosticViewPath(source: string, scheme: string, cwd: string): string | undefined
|
|
10
|
+
{
|
|
11
|
+
const prefix = `${scheme}:`;
|
|
12
|
+
|
|
13
|
+
if (!source.startsWith(prefix))
|
|
14
|
+
{
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const requestedPath = source.slice(prefix.length);
|
|
19
|
+
|
|
20
|
+
if (requestedPath.length === 0)
|
|
21
|
+
{
|
|
22
|
+
throw new Error(`${scheme}: requires a file path.`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return path.resolve(cwd, requestedPath);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function formatDiagnosticViewSource(scheme: string, filePath: string): string
|
|
29
|
+
{
|
|
30
|
+
return `${scheme}:${filePath}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function createDiagnosticViewContent(
|
|
34
|
+
filePath: string,
|
|
35
|
+
text: string,
|
|
36
|
+
diagnostics: readonly Diagnostic[],
|
|
37
|
+
source: string,
|
|
38
|
+
): SourceMappedTextContent
|
|
39
|
+
{
|
|
40
|
+
const fileLines = text.split(/\r\n|\r|\n/u);
|
|
41
|
+
const diagnosticsByLine = new Map<number, Diagnostic[]>();
|
|
42
|
+
|
|
43
|
+
for (const diagnostic of diagnostics)
|
|
44
|
+
{
|
|
45
|
+
if (!Number.isInteger(diagnostic.line) || diagnostic.line < 1 || diagnostic.line > fileLines.length)
|
|
46
|
+
{
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const lineDiagnostics = diagnosticsByLine.get(diagnostic.line) ?? [];
|
|
51
|
+
lineDiagnostics.push(diagnostic);
|
|
52
|
+
diagnosticsByLine.set(diagnostic.line, lineDiagnostics);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (diagnosticsByLine.size === 0)
|
|
56
|
+
{
|
|
57
|
+
return {
|
|
58
|
+
type: "text",
|
|
59
|
+
text: `No ${source} diagnostics.`,
|
|
60
|
+
sourceLines: {},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const renderedLines: string[] = [];
|
|
65
|
+
const sourceLines: Record<string, TextSourceLine> = {};
|
|
66
|
+
|
|
67
|
+
for (const [lineNumber, lineDiagnostics] of [...diagnosticsByLine].sort(([left], [right]) => left - right))
|
|
68
|
+
{
|
|
69
|
+
const content = fileLines[lineNumber - 1] ?? "";
|
|
70
|
+
const annotations = lineDiagnostics
|
|
71
|
+
.map((diagnostic) => `<!-- ${source}: ${formatDiagnostic(diagnostic, source)} -->`)
|
|
72
|
+
.join(" ");
|
|
73
|
+
renderedLines.push(`${content} ${annotations}`);
|
|
74
|
+
sourceLines[String(renderedLines.length)] = { source: filePath, lineNumber, content };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
type: "text",
|
|
79
|
+
text: renderedLines.join("\n"),
|
|
80
|
+
sourceLines,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
|
|
4
|
+
export type CodeViewScheme = "ast" | "symbol" | "graph";
|
|
5
|
+
|
|
6
|
+
export interface CodeViewReference
|
|
7
|
+
{
|
|
8
|
+
readonly scheme: CodeViewScheme;
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly selector?: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function parseCodeViewReference(
|
|
14
|
+
source: string,
|
|
15
|
+
scheme: CodeViewScheme,
|
|
16
|
+
): CodeViewReference | undefined
|
|
17
|
+
{
|
|
18
|
+
const prefix = `${scheme}:`;
|
|
19
|
+
|
|
20
|
+
if (!source.startsWith(prefix))
|
|
21
|
+
{
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const value = source.slice(prefix.length);
|
|
26
|
+
const fragmentAt = value.indexOf("#");
|
|
27
|
+
const encodedPath = fragmentAt === -1 ? value : value.slice(0, fragmentAt);
|
|
28
|
+
|
|
29
|
+
if (encodedPath.length === 0)
|
|
30
|
+
{
|
|
31
|
+
throw new TypeError(`${scheme}: requires a file path.`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const filePath = decodePart(encodedPath, `${scheme}: path`);
|
|
35
|
+
const encodedSelector = fragmentAt === -1 ? undefined : value.slice(fragmentAt + 1);
|
|
36
|
+
|
|
37
|
+
if (scheme === "ast")
|
|
38
|
+
{
|
|
39
|
+
if (encodedSelector !== undefined)
|
|
40
|
+
{
|
|
41
|
+
throw new TypeError("ast: accepts only a file path and does not accept a symbol selector.");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return { scheme, path: filePath };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (scheme === "symbol" && encodedSelector === undefined)
|
|
48
|
+
{
|
|
49
|
+
throw new TypeError("symbol: requires #<symbol-selector> after the file path.");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (encodedSelector === undefined)
|
|
53
|
+
{
|
|
54
|
+
return { scheme, path: filePath };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (encodedSelector.length === 0)
|
|
58
|
+
{
|
|
59
|
+
throw new TypeError(`${scheme}: symbol selector must not be empty.`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const selector = encodedSelector.split("/").map((segment) =>
|
|
63
|
+
{
|
|
64
|
+
if (segment.length === 0)
|
|
65
|
+
{
|
|
66
|
+
throw new TypeError(`${scheme}: symbol selector contains an empty segment.`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return decodePart(segment, `${scheme}: symbol selector`);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return { scheme, path: filePath, selector };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function resolveCodeViewPath(filePath: string, cwd: string): string
|
|
76
|
+
{
|
|
77
|
+
if (filePath.startsWith("file://"))
|
|
78
|
+
{
|
|
79
|
+
return fileURLToPath(new URL(filePath));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return path.isAbsolute(filePath) ? path.normalize(filePath) : path.resolve(cwd, filePath);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function formatCodeViewReference(
|
|
86
|
+
scheme: CodeViewScheme,
|
|
87
|
+
filePath: string,
|
|
88
|
+
selector?: readonly string[],
|
|
89
|
+
): string
|
|
90
|
+
{
|
|
91
|
+
const encodedPath = filePath.replaceAll("%", "%25").replaceAll("#", "%23");
|
|
92
|
+
const fragment = selector === undefined
|
|
93
|
+
? ""
|
|
94
|
+
: `#${selector.map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
95
|
+
return `${scheme}:${encodedPath}${fragment}`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function formatSymbolSelector(selector: readonly string[]): string
|
|
99
|
+
{
|
|
100
|
+
return selector.map((segment) => encodeURIComponent(segment)).join("/");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function decodePart(value: string, label: string): string
|
|
104
|
+
{
|
|
105
|
+
try
|
|
106
|
+
{
|
|
107
|
+
return decodeURIComponent(value);
|
|
108
|
+
}
|
|
109
|
+
catch (error)
|
|
110
|
+
{
|
|
111
|
+
throw new TypeError(`${label} contains invalid percent encoding.`, { cause: error });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { type TextSourceLine, withTextSourceLine } from "pi-agent-text";
|
|
2
|
+
|
|
3
|
+
import type { ReadHandler } from "pi-agent-read/api/tools/read";
|
|
4
|
+
|
|
5
|
+
export interface SourceViewLine
|
|
6
|
+
{
|
|
7
|
+
readonly content: string;
|
|
8
|
+
readonly sourceLine?: TextSourceLine;
|
|
9
|
+
readonly suffix?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface RenderedSourceViewLine
|
|
13
|
+
{
|
|
14
|
+
readonly text: string;
|
|
15
|
+
readonly sourceLine?: TextSourceLine;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SourceViewBlock
|
|
19
|
+
{
|
|
20
|
+
readonly path: string;
|
|
21
|
+
readonly heading?: string;
|
|
22
|
+
readonly details?: readonly string[];
|
|
23
|
+
readonly startLine: number;
|
|
24
|
+
readonly endLine: number;
|
|
25
|
+
readonly totalLines: number;
|
|
26
|
+
readonly renderedLines: readonly RenderedSourceViewLine[];
|
|
27
|
+
readonly status?: "ok" | "failed";
|
|
28
|
+
readonly error?: string;
|
|
29
|
+
readonly code?: string;
|
|
30
|
+
readonly warning?: string;
|
|
31
|
+
readonly continuation?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface SourceViewFormatOptions
|
|
35
|
+
{
|
|
36
|
+
readonly failureLabel: string;
|
|
37
|
+
readonly emptyReason: string;
|
|
38
|
+
readonly includeNoChange?: boolean;
|
|
39
|
+
readonly recovery?: readonly string[];
|
|
40
|
+
readonly unknownFailure?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface SourceMappedTextContent
|
|
44
|
+
{
|
|
45
|
+
readonly type: "text";
|
|
46
|
+
readonly text: string;
|
|
47
|
+
readonly sourceLines: Readonly<Record<string, TextSourceLine>>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function renderSourceViewLine(line: SourceViewLine): RenderedSourceViewLine
|
|
51
|
+
{
|
|
52
|
+
return {
|
|
53
|
+
text: `${line.content}${line.suffix ?? ""}`,
|
|
54
|
+
...(line.sourceLine === undefined ? {} : { sourceLine: line.sourceLine }),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function formatSourceViewResults(
|
|
59
|
+
results: readonly SourceViewBlock[],
|
|
60
|
+
options: SourceViewFormatOptions,
|
|
61
|
+
): SourceMappedTextContent
|
|
62
|
+
{
|
|
63
|
+
if (results.length === 0)
|
|
64
|
+
{
|
|
65
|
+
return sourceMappedContent([{ text: "<empty-result>" }]);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (results.length === 1 && results[0]!.status === "failed" && results[0]!.path === "")
|
|
69
|
+
{
|
|
70
|
+
const result = results[0]!;
|
|
71
|
+
const recovery = options.recovery === undefined
|
|
72
|
+
? []
|
|
73
|
+
: ["", "Recovery:", ...options.recovery];
|
|
74
|
+
const noChange = options.includeNoChange === true ? ["", "No file was changed."] : [];
|
|
75
|
+
|
|
76
|
+
return sourceMappedContent(
|
|
77
|
+
[
|
|
78
|
+
result.code ?? options.failureLabel,
|
|
79
|
+
"",
|
|
80
|
+
`Reason: ${result.error ?? options.unknownFailure ?? "unknown failure"}`,
|
|
81
|
+
...noChange,
|
|
82
|
+
...recovery,
|
|
83
|
+
].map((text) => ({ text })),
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const lines: RenderedSourceViewLine[] = [];
|
|
88
|
+
|
|
89
|
+
for (const [index, result] of results.entries())
|
|
90
|
+
{
|
|
91
|
+
if (index > 0)
|
|
92
|
+
{
|
|
93
|
+
lines.push({ text: "" }, { text: "" });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
lines.push(...formatSourceViewBlock(result, options));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return sourceMappedContent(lines);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function createSourceMappedTextReadHandler(): ReadHandler
|
|
103
|
+
{
|
|
104
|
+
return (context) =>
|
|
105
|
+
{
|
|
106
|
+
const state = context.state;
|
|
107
|
+
|
|
108
|
+
if (state?.contentKind !== "text")
|
|
109
|
+
{
|
|
110
|
+
return { kind: "continue", context };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const sourceLines = sourceLineMap(state.content[0]);
|
|
114
|
+
|
|
115
|
+
if (sourceLines === undefined)
|
|
116
|
+
{
|
|
117
|
+
return { kind: "continue", context };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const lines = state.text.lines.map((line) =>
|
|
121
|
+
{
|
|
122
|
+
const sourceLine = sourceLines[String(line.lineNumber)];
|
|
123
|
+
return sourceLine === undefined ? line : withTextSourceLine(line, sourceLine);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
kind: "continue",
|
|
128
|
+
context: {
|
|
129
|
+
...context,
|
|
130
|
+
state: {
|
|
131
|
+
...state,
|
|
132
|
+
text: { ...state.text, lines },
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function formatSourceViewBlock(
|
|
140
|
+
result: SourceViewBlock,
|
|
141
|
+
options: SourceViewFormatOptions,
|
|
142
|
+
): RenderedSourceViewLine[]
|
|
143
|
+
{
|
|
144
|
+
if (result.status === "failed")
|
|
145
|
+
{
|
|
146
|
+
const heading = result.heading === undefined
|
|
147
|
+
? [`## file: ${result.path || "<unknown>"}`]
|
|
148
|
+
: [`## ${result.heading}`, ...(result.details ?? [])];
|
|
149
|
+
|
|
150
|
+
return [
|
|
151
|
+
...heading,
|
|
152
|
+
`${options.failureLabel} | ${result.error ?? options.unknownFailure ?? "unknown failure"}`,
|
|
153
|
+
].map((text) => ({ text }));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const heading = result.heading === undefined
|
|
157
|
+
? [`## file: ${result.path}`]
|
|
158
|
+
: [`## ${result.heading}`, ...(result.details ?? [])];
|
|
159
|
+
const continuation = result.continuation ?? "";
|
|
160
|
+
const warning = result.warning === undefined ? [] : [{ text: "" }, { text: result.warning }];
|
|
161
|
+
|
|
162
|
+
return [
|
|
163
|
+
...heading.map((text) => ({ text })),
|
|
164
|
+
{ text: `Lines: ${result.startLine}-${result.endLine} of ${result.totalLines}${continuation}` },
|
|
165
|
+
{ text: "" },
|
|
166
|
+
...result.renderedLines,
|
|
167
|
+
...warning,
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function sourceMappedContent(lines: readonly RenderedSourceViewLine[]): SourceMappedTextContent
|
|
172
|
+
{
|
|
173
|
+
const sourceLines: Record<string, TextSourceLine> = {};
|
|
174
|
+
|
|
175
|
+
for (const [index, line] of lines.entries())
|
|
176
|
+
{
|
|
177
|
+
if (line.sourceLine !== undefined)
|
|
178
|
+
{
|
|
179
|
+
sourceLines[String(index + 1)] = line.sourceLine;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
type: "text",
|
|
185
|
+
text: lines.map((line) => line.text).join("\n"),
|
|
186
|
+
sourceLines,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function sourceLineMap(content: unknown): Readonly<Record<string, TextSourceLine>> | undefined
|
|
191
|
+
{
|
|
192
|
+
if (typeof content !== "object" || content === null || !("sourceLines" in content))
|
|
193
|
+
{
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const sourceLines = (content as { readonly sourceLines?: unknown; }).sourceLines;
|
|
198
|
+
|
|
199
|
+
if (typeof sourceLines !== "object" || sourceLines === null)
|
|
200
|
+
{
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
for (const value of Object.values(sourceLines))
|
|
205
|
+
{
|
|
206
|
+
if (!isTextSourceLine(value))
|
|
207
|
+
{
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return sourceLines as Readonly<Record<string, TextSourceLine>>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function isTextSourceLine(value: unknown): value is TextSourceLine
|
|
216
|
+
{
|
|
217
|
+
if (typeof value !== "object" || value === null)
|
|
218
|
+
{
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const line = value as Partial<TextSourceLine>;
|
|
223
|
+
|
|
224
|
+
return typeof line.source === "string"
|
|
225
|
+
&& line.source.length > 0
|
|
226
|
+
&& Number.isInteger(line.lineNumber)
|
|
227
|
+
&& (line.lineNumber ?? 0) > 0
|
|
228
|
+
&& typeof line.content === "string";
|
|
229
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import registerIdeCore from "#src/core/extension.js";
|
|
2
|
+
import registerReadCore from "#src/extensions/pi-agent-read/index.js";
|
|
3
|
+
import registerFilesystem from "#src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.js";
|
|
4
|
+
import registerFilesystemImage from "#src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/index.js";
|
|
5
|
+
import registerFilesystemPdf from "#src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/index.js";
|
|
6
|
+
import registerFilesystemText from "#src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/index.js";
|
|
7
|
+
import registerWeb from "#src/extensions/pi-agent-read/extensions/pi-agent-web/index.js";
|
|
8
|
+
import registerWebHtml from "#src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/index.js";
|
|
9
|
+
import registerWebImage from "#src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/index.js";
|
|
10
|
+
import registerWebPdf from "#src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/index.js";
|
|
11
|
+
import registerWebText from "#src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/index.js";
|
|
12
|
+
import registerSearchCore from "#src/extensions/pi-agent-search/index.js";
|
|
13
|
+
import registerSemanticSearch from "#src/extensions/pi-agent-search/plugins/pi-agent-search-semantic/index.js";
|
|
14
|
+
import registerTextSearch from "#src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.js";
|
|
15
|
+
import registerWebSearch from "#src/extensions/pi-agent-search/plugins/pi-agent-search-web/index.js";
|
|
16
|
+
import registerTextEditor from "#src/extensions/pi-agent-text-editor/index.js";
|
|
17
|
+
import registerConstantAnchors from "#src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/index.js";
|
|
18
|
+
import registerLineHashAnchors from "#src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.js";
|
|
19
|
+
import registerArgumentOrder from "#src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/index.js";
|
|
20
|
+
import registerTextEditorRenderer from "#src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.js";
|
|
21
|
+
import registerStaleAnchorGuard from "#src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.js";
|
|
22
|
+
import registerAst from "#src/plugins/pi-agent-ide-ast/index.js";
|
|
23
|
+
import registerChanges from "#src/plugins/pi-agent-ide-changes/index.js";
|
|
24
|
+
import registerFormatter from "#src/plugins/pi-agent-ide-formatter/index.js";
|
|
25
|
+
import registerLint from "#src/plugins/pi-agent-ide-lint/index.js";
|
|
26
|
+
import registerLsp from "#src/plugins/pi-agent-ide-lsp/index.js";
|
|
27
|
+
|
|
28
|
+
import type { BuiltinExtension } from "#src/composite/selection.js";
|
|
29
|
+
|
|
30
|
+
/** Built-ins in their established registration order. IDs are stable configuration keys. */
|
|
31
|
+
export const BUILTIN_EXTENSIONS: readonly BuiltinExtension[] = [
|
|
32
|
+
builtin("ide.core", registerIdeCore),
|
|
33
|
+
builtin("read.core", registerReadCore),
|
|
34
|
+
builtin("read.filesystem", registerFilesystem, ["read.core", "editor.core"]),
|
|
35
|
+
builtin("read.filesystem.image", registerFilesystemImage, ["read.filesystem"]),
|
|
36
|
+
builtin("read.filesystem.pdf", registerFilesystemPdf, ["read.filesystem"]),
|
|
37
|
+
builtin("read.filesystem.text", registerFilesystemText, ["read.filesystem"]),
|
|
38
|
+
builtin("read.web", registerWeb, ["read.core"]),
|
|
39
|
+
builtin("read.web.html", registerWebHtml, ["read.web"]),
|
|
40
|
+
builtin("read.web.image", registerWebImage, ["read.web"]),
|
|
41
|
+
builtin("read.web.pdf", registerWebPdf, ["read.web"]),
|
|
42
|
+
builtin("read.web.text", registerWebText, ["read.web"]),
|
|
43
|
+
builtin("search.core", registerSearchCore),
|
|
44
|
+
builtin("search.text", registerTextSearch, ["search.core"]),
|
|
45
|
+
builtin("search.semantic", registerSemanticSearch, ["search.core"]),
|
|
46
|
+
builtin("search.web", registerWebSearch, ["search.core"]),
|
|
47
|
+
builtin("editor.renderer", registerTextEditorRenderer, ["editor.core"]),
|
|
48
|
+
builtin("editor.core", registerTextEditor),
|
|
49
|
+
builtin("editor.anchor.constant", registerConstantAnchors, ["read.core", "editor.core"]),
|
|
50
|
+
builtin("editor.anchor.line-hash", registerLineHashAnchors, ["read.core", "editor.core"]),
|
|
51
|
+
builtin("editor.argument-order", registerArgumentOrder, ["editor.core"]),
|
|
52
|
+
builtin("editor.stale-anchor", registerStaleAnchorGuard, ["editor.core"]),
|
|
53
|
+
builtin("ide.ast", registerAst, ["ide.core", "read.core", "search.core", "editor.core"]),
|
|
54
|
+
builtin("ide.formatter", registerFormatter, ["ide.core"]),
|
|
55
|
+
builtin("ide.lint", registerLint, ["ide.core"]),
|
|
56
|
+
builtin("ide.changes", registerChanges, ["ide.core", "read.core", "editor.core"]),
|
|
57
|
+
builtin("ide.lsp", registerLsp, ["ide.core", "read.core", "search.core"]),
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
function builtin(
|
|
62
|
+
id: string,
|
|
63
|
+
register: BuiltinExtension["register"],
|
|
64
|
+
dependencies: readonly string[] = [],
|
|
65
|
+
): BuiltinExtension
|
|
66
|
+
{
|
|
67
|
+
return { id, dependencies, register };
|
|
68
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
/** User configuration for the unified Pi Agent IDE extension. */
|
|
6
|
+
export interface PiAgentIdeConfig
|
|
7
|
+
{
|
|
8
|
+
readonly disabledExtensions: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Resolves the global Pi Agent IDE configuration file. */
|
|
12
|
+
export function resolvePiAgentIdeConfigPath(
|
|
13
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
14
|
+
homeDirectory: string = os.homedir(),
|
|
15
|
+
): string
|
|
16
|
+
{
|
|
17
|
+
const configured = env.PI_AGENT_IDE_CONFIG?.trim();
|
|
18
|
+
if (configured !== undefined && configured.length > 0)
|
|
19
|
+
{
|
|
20
|
+
return path.resolve(configured);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const agentDirectory = env.PI_CODING_AGENT_DIR?.trim() || path.join(homeDirectory, ".pi", "agent");
|
|
24
|
+
return path.join(agentDirectory, "pi-agent-ide.json");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Reads the configuration file, defaulting to all built-ins enabled when it is absent. */
|
|
28
|
+
export async function readPiAgentIdeConfig(configPath: string): Promise<PiAgentIdeConfig>
|
|
29
|
+
{
|
|
30
|
+
let source: string;
|
|
31
|
+
|
|
32
|
+
try
|
|
33
|
+
{
|
|
34
|
+
source = await readFile(configPath, "utf8");
|
|
35
|
+
}
|
|
36
|
+
catch (error)
|
|
37
|
+
{
|
|
38
|
+
if (isMissingFile(error))
|
|
39
|
+
{
|
|
40
|
+
return { disabledExtensions: [] };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
throw new Error(`Cannot read Pi Agent IDE config at ${configPath}: ${errorMessage(error)}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let value: unknown;
|
|
47
|
+
|
|
48
|
+
try
|
|
49
|
+
{
|
|
50
|
+
value = JSON.parse(source);
|
|
51
|
+
}
|
|
52
|
+
catch (error)
|
|
53
|
+
{
|
|
54
|
+
throw new Error(`Invalid JSON in Pi Agent IDE config at ${configPath}: ${errorMessage(error)}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!isRecord(value))
|
|
58
|
+
{
|
|
59
|
+
throw new Error(`Pi Agent IDE config at ${configPath} must be a JSON object`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const disabled = value.disabledExtensions;
|
|
63
|
+
if (disabled === undefined)
|
|
64
|
+
{
|
|
65
|
+
return { disabledExtensions: [] };
|
|
66
|
+
}
|
|
67
|
+
if (!Array.isArray(disabled) || disabled.some((id) => typeof id !== "string" || id.length === 0))
|
|
68
|
+
{
|
|
69
|
+
throw new Error(`disabledExtensions in ${configPath} must be an array of non-empty strings`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const unique = new Set(disabled);
|
|
73
|
+
if (unique.size !== disabled.length)
|
|
74
|
+
{
|
|
75
|
+
throw new Error(`disabledExtensions in ${configPath} must not contain duplicate IDs`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return { disabledExtensions: disabled };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function isMissingFile(error: unknown): boolean
|
|
82
|
+
{
|
|
83
|
+
return isRecord(error) && error.code === "ENOENT";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function isRecord(value: unknown): value is Record<string, unknown>
|
|
87
|
+
{
|
|
88
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function errorMessage(error: unknown): string
|
|
92
|
+
{
|
|
93
|
+
return error instanceof Error ? error.message : String(error);
|
|
94
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
|
|
3
|
+
/** One independently usable built-in extension composed into Pi Agent IDE. */
|
|
4
|
+
export interface BuiltinExtension
|
|
5
|
+
{
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly dependencies: readonly string[];
|
|
8
|
+
readonly register: (pi: ExtensionAPI) => void | Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Selects enabled built-ins and cascades disabled dependencies to their dependents. */
|
|
12
|
+
export function selectBuiltinExtensions(
|
|
13
|
+
extensions: readonly BuiltinExtension[],
|
|
14
|
+
configuredDisabled: readonly string[],
|
|
15
|
+
): { readonly enabled: readonly BuiltinExtension[]; readonly disabled: ReadonlySet<string>; }
|
|
16
|
+
{
|
|
17
|
+
const byId = new Map<string, BuiltinExtension>();
|
|
18
|
+
for (const extension of extensions)
|
|
19
|
+
{
|
|
20
|
+
if (byId.has(extension.id))
|
|
21
|
+
{
|
|
22
|
+
throw new Error(`Duplicate Pi Agent IDE extension ID: ${extension.id}`);
|
|
23
|
+
}
|
|
24
|
+
byId.set(extension.id, extension);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
for (const extension of extensions)
|
|
28
|
+
{
|
|
29
|
+
for (const dependency of extension.dependencies)
|
|
30
|
+
{
|
|
31
|
+
if (!byId.has(dependency))
|
|
32
|
+
{
|
|
33
|
+
throw new Error(`Pi Agent IDE extension ${extension.id} has unknown dependency ${dependency}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const disabled = new Set<string>();
|
|
39
|
+
for (const id of configuredDisabled)
|
|
40
|
+
{
|
|
41
|
+
if (!byId.has(id))
|
|
42
|
+
{
|
|
43
|
+
throw new Error(`Unknown Pi Agent IDE extension ID in disabledExtensions: ${id}`);
|
|
44
|
+
}
|
|
45
|
+
disabled.add(id);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let changed = true;
|
|
49
|
+
while (changed)
|
|
50
|
+
{
|
|
51
|
+
changed = false;
|
|
52
|
+
for (const extension of extensions)
|
|
53
|
+
{
|
|
54
|
+
if (!disabled.has(extension.id) && extension.dependencies.some((id) => disabled.has(id)))
|
|
55
|
+
{
|
|
56
|
+
disabled.add(extension.id);
|
|
57
|
+
changed = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
enabled: extensions.filter((extension) => !disabled.has(extension.id)),
|
|
64
|
+
disabled,
|
|
65
|
+
};
|
|
66
|
+
}
|