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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alex Shpunt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/banner.png" alt="Pi Agent IDE" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Pi Agent IDE</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">Agent-facing tools for reading, searching, and editing code in <a href="https://pi.dev/">Pi</a>.</p>
|
|
8
|
+
|
|
9
|
+
## Status
|
|
10
|
+
|
|
11
|
+
Pi Agent IDE is experimental and under active development. It is used in real work, but bugs and rough edges are still being found and fixed. Interfaces and behavior may change.
|
|
12
|
+
|
|
13
|
+
The current focus is measurement. The project is being compared with vanilla Pi on evals and editing gyms to understand where its tools improve results or reduce tool use and token use. Some workflows already benefit from the tools; others become harder. Until the data is stronger, treat performance claims as unproven and use the package at your own risk.
|
|
14
|
+
|
|
15
|
+
## What it does
|
|
16
|
+
|
|
17
|
+
Pi Agent IDE provides a small set of tools with more specialized behavior behind them:
|
|
18
|
+
|
|
19
|
+
- `read` handles files, web pages, images, PDFs, code views, and diagnostics;
|
|
20
|
+
- `search` routes text, structural, semantic, and web searches;
|
|
21
|
+
- `write`, `replace`, `insert`, `delete`, `copy`, and `move` cover common text mutations; range-based edits can target snapshot and semantic anchors instead of reproducing the `oldText` block required by Pi's built-in `edit` tool;
|
|
22
|
+
- optional plugins add AST, LSP, formatting, linting, and Git-aware behavior.
|
|
23
|
+
|
|
24
|
+
The public interface is intentionally small. Resources, resolvers, anchors, renderers, and toolchain integrations are connected through versioned plugin protocols. The npm package loads as one Pi extension, while its built-ins remain separate modules that can be replaced or extended.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Install [Pi](https://pi.dev/) first, then install Pi Agent IDE:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pi install npm:pi-agent-ide
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Pi packages run with your full system permissions. Review the package before installing it.
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
| Document | Contents |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| [Tools and workflow](./docs/tools.md) | Read, search, editing, anchors, and feedback |
|
|
41
|
+
| [Architecture](./docs/architecture.md) | Module boundaries, protocols, and the umbrella extension |
|
|
42
|
+
| [Configuration](./docs/configuration.md) | Disable built-ins and select a config file |
|
|
43
|
+
| [Writing extensions](./docs/extensions.md) | Add resolvers, anchors, search backends, and IDE plugins |
|
|
44
|
+
| [Development](./docs/development.md) | Work from a checkout, test, and build the public package |
|
|
45
|
+
| [Evaluation](./docs/evaluation.md) | Compare Pi Agent IDE with vanilla Pi on repeatable tasks |
|
|
46
|
+
|
|
47
|
+
## Repository
|
|
48
|
+
|
|
49
|
+
Executable behavior is defined by the source and tests. The documents above explain the intended boundaries, extension contracts, and development workflows.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
[MIT](./LICENSE)
|
|
Binary file
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
Pi Agent IDE is an umbrella package around several independent Pi extensions and libraries. The package provides a ready-to-use default setup without turning those components into one tightly coupled implementation.
|
|
4
|
+
|
|
5
|
+
## One Pi extension, separate modules
|
|
6
|
+
|
|
7
|
+
The npm package exposes one Pi entrypoint:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
src/pi-agent-ide.ts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
That entrypoint reads the user configuration and registers the enabled built-ins in a stable order. Pi sees one extension, so installation and configuration stay manageable.
|
|
14
|
+
|
|
15
|
+
The built-ins keep separate entrypoints, package manifests, tests, and public contracts. The composite loader changes how Pi starts them without removing their implementation boundaries.
|
|
16
|
+
|
|
17
|
+
The internal packages are bundled inside the umbrella tarball and are not published as separate registry packages. External extensions use public `pi-agent-ide/api/...` exports, which forward to the same bundled protocol implementations used by the built-ins.
|
|
18
|
+
|
|
19
|
+
## Main layers
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
Pi Agent IDE
|
|
23
|
+
├── Resource and text libraries
|
|
24
|
+
├── read core
|
|
25
|
+
│ └── Resource resolvers, presenters, and pipeline handlers
|
|
26
|
+
├── search core
|
|
27
|
+
│ └── text, structural, semantic, and web resolvers
|
|
28
|
+
├── text-editor core
|
|
29
|
+
│ └── writable Resources, anchors, mutations, guards, and renderers
|
|
30
|
+
└── IDE core
|
|
31
|
+
└── AST, LSP, formatter, lint, and Git-aware plugins
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The cores do not import concrete plugins to discover behavior. Plugins connect through public protocols.
|
|
35
|
+
|
|
36
|
+
## Resources
|
|
37
|
+
|
|
38
|
+
A Resource gives a source an identity and optional read or write operations. Files, URLs, temporary snapshots, and derived views can use the same basic contract.
|
|
39
|
+
|
|
40
|
+
Read and write capabilities are explicit. The read core and text-editor core own separate resolver registries. A source that is safe to display is therefore not automatically available to mutation tools.
|
|
41
|
+
|
|
42
|
+
Shared Resource contracts live under `packages/pi-agent-resource`.
|
|
43
|
+
|
|
44
|
+
## Plugin protocols
|
|
45
|
+
|
|
46
|
+
The umbrella currently exposes four main extension protocols:
|
|
47
|
+
|
|
48
|
+
| Protocol package | Contributions |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `pi-agent-read` | Resource resolvers, read handlers, presenters, result renderers |
|
|
51
|
+
| `pi-agent-search` | Search resolvers and search actions |
|
|
52
|
+
| `pi-agent-text-editor` | Writable resolvers, anchors, mutations, guards, renderers, edit listeners |
|
|
53
|
+
| `pi-agent-ide` | Formatter, compiler, linter, and other toolchain implementations |
|
|
54
|
+
|
|
55
|
+
Each plugin declares a protocol name, API version, stable ID, and `setup` function. Setup contributions are validated before they become active.
|
|
56
|
+
|
|
57
|
+
The core and plugin may load in either order. They exchange readiness and registration messages through Pi's shared event bus, then use direct in-memory APIs after registration. This lets an external Pi extension connect even though the built-in package is loaded through one composite entrypoint.
|
|
58
|
+
|
|
59
|
+
## Anchors
|
|
60
|
+
|
|
61
|
+
An anchor is an opaque value interpreted by a registered resolver. The text-editor core owns ordering and validation but does not hard-code every format.
|
|
62
|
+
|
|
63
|
+
An anchor resolver can:
|
|
64
|
+
|
|
65
|
+
- recognize a value;
|
|
66
|
+
- validate it against the current Resource snapshot;
|
|
67
|
+
- return a line or text selection;
|
|
68
|
+
- reject stale or ambiguous input with recovery context;
|
|
69
|
+
- resolve one anchor to several Resource sources.
|
|
70
|
+
|
|
71
|
+
Read presenters can display matching markers without changing canonical source text.
|
|
72
|
+
|
|
73
|
+
## Toolchain feedback
|
|
74
|
+
|
|
75
|
+
IDE plugins contribute formatters, compilers, and linters through the IDE protocol. Text-editor hooks use those contributions after a mutation has been prepared or applied.
|
|
76
|
+
|
|
77
|
+
This keeps mutation mechanics separate from language servers, formatter discovery, and repository-specific checks.
|
|
78
|
+
|
|
79
|
+
## Built-in selection
|
|
80
|
+
|
|
81
|
+
`src/composite/builtin-extensions.ts` is the built-in registry. Every entry has:
|
|
82
|
+
|
|
83
|
+
- a stable configuration ID;
|
|
84
|
+
- dependency IDs;
|
|
85
|
+
- its independent registration function.
|
|
86
|
+
|
|
87
|
+
The loader enables everything by default. When a core is disabled, built-ins that depend on it are disabled as well. External extensions are not controlled by this registry.
|
|
88
|
+
|
|
89
|
+
See [configuration](./configuration.md) for the user-facing settings.
|
|
90
|
+
|
|
91
|
+
## Development boundary
|
|
92
|
+
|
|
93
|
+
The composite entrypoint is a packaging and loading boundary, not permission to introduce hidden coupling between modules. New behavior should normally:
|
|
94
|
+
|
|
95
|
+
1. implement the smallest relevant public contract;
|
|
96
|
+
2. connect through the owning protocol;
|
|
97
|
+
3. keep source-specific logic outside the core;
|
|
98
|
+
4. include executable behavior coverage near that component.
|
|
99
|
+
|
|
100
|
+
See [writing extensions](./extensions.md) for practical examples and [development](./development.md) for the two loading modes.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
Pi Agent IDE enables every built-in extension by default. A user config can disable built-ins that are not useful in a particular setup.
|
|
4
|
+
|
|
5
|
+
## Config file
|
|
6
|
+
|
|
7
|
+
Create:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
~/.pi/agent/pi-agent-ide.json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Example:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"disabledExtensions": [
|
|
18
|
+
"search.semantic",
|
|
19
|
+
"ide.lsp"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Restart Pi or use `/reload` after changing the file.
|
|
25
|
+
|
|
26
|
+
## Custom path
|
|
27
|
+
|
|
28
|
+
Set `PI_AGENT_IDE_CONFIG` to read another file:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
PI_AGENT_IDE_CONFIG=./pi-agent-ide.json pi
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Relative paths are resolved from the current working directory. When Pi uses a custom `PI_CODING_AGENT_DIR`, the default config path follows that directory.
|
|
35
|
+
|
|
36
|
+
## Behavior
|
|
37
|
+
|
|
38
|
+
- A missing config file means every built-in is enabled.
|
|
39
|
+
- `disabledExtensions` must be an array of unique, non-empty IDs.
|
|
40
|
+
- Invalid JSON stops Pi Agent IDE from loading.
|
|
41
|
+
- An unknown ID stops Pi Agent IDE from loading. This prevents a typo from silently leaving a module enabled.
|
|
42
|
+
- Disabling a core also disables built-ins that depend on it.
|
|
43
|
+
- The config controls bundled extensions only. It does not disable external Pi extensions.
|
|
44
|
+
|
|
45
|
+
## Built-in IDs
|
|
46
|
+
|
|
47
|
+
### Core tools
|
|
48
|
+
|
|
49
|
+
| ID | Contribution |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| `ide.core` | IDE toolchain protocol |
|
|
52
|
+
| `read.core` | `read` tool and read plugin protocol |
|
|
53
|
+
| `search.core` | `search` tool and search plugin protocol |
|
|
54
|
+
| `editor.core` | Text mutation tools and editor protocol |
|
|
55
|
+
| `editor.renderer` | Standard mutation and diff rendering |
|
|
56
|
+
|
|
57
|
+
### Read
|
|
58
|
+
|
|
59
|
+
| ID | Contribution |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `read.filesystem` | Filesystem Resource resolver |
|
|
62
|
+
| `read.filesystem.image` | Filesystem image content |
|
|
63
|
+
| `read.filesystem.pdf` | Filesystem PDF content |
|
|
64
|
+
| `read.filesystem.text` | Filesystem text content |
|
|
65
|
+
| `read.web` | HTTP and HTTPS Resource resolver |
|
|
66
|
+
| `read.web.html` | Web HTML conversion |
|
|
67
|
+
| `read.web.image` | Web image content |
|
|
68
|
+
| `read.web.pdf` | Web PDF content |
|
|
69
|
+
| `read.web.text` | Web text content |
|
|
70
|
+
|
|
71
|
+
### Search
|
|
72
|
+
|
|
73
|
+
| ID | Contribution |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `search.text` | Local file and text search |
|
|
76
|
+
| `search.semantic` | QMD semantic search |
|
|
77
|
+
| `search.web` | Web search |
|
|
78
|
+
|
|
79
|
+
### Editing and anchors
|
|
80
|
+
|
|
81
|
+
| ID | Contribution |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `editor.anchor.constant` | `begin` and `end` anchors |
|
|
84
|
+
| `editor.anchor.line-hash` | Snapshot-aware line anchors |
|
|
85
|
+
| `editor.argument-order` | Stable mutation argument ordering |
|
|
86
|
+
| `editor.stale-anchor` | Stale-anchor recovery behavior |
|
|
87
|
+
|
|
88
|
+
### Code intelligence and feedback
|
|
89
|
+
|
|
90
|
+
| ID | Contribution |
|
|
91
|
+
| --- | --- |
|
|
92
|
+
| `ide.ast` | AST scopes, outlines, and structural search |
|
|
93
|
+
| `ide.formatter` | Formatter toolchain integration |
|
|
94
|
+
| `ide.lint` | Lint toolchain integration |
|
|
95
|
+
| `ide.changes` | Git changes, staging, and undo support |
|
|
96
|
+
| `ide.lsp` | LSP symbols, graphs, diagnostics, and compiler feedback |
|
|
97
|
+
|
|
98
|
+
## Dependency examples
|
|
99
|
+
|
|
100
|
+
Disabling `search.core` also disables `search.text`, `search.semantic`, `search.web`, and built-ins that contribute search behavior such as `ide.ast` and `ide.lsp`.
|
|
101
|
+
|
|
102
|
+
Disabling `editor.core` also disables editor anchors, mutation rendering, writable filesystem support, and IDE plugins that require edit events.
|
|
103
|
+
|
|
104
|
+
For a complete dependency graph, see `src/composite/builtin-extensions.ts`. That registry is the executable source of truth.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
|
|
5
|
+
- a current Pi installation with `pi` on `PATH`;
|
|
6
|
+
- Node.js and pnpm;
|
|
7
|
+
- Git.
|
|
8
|
+
|
|
9
|
+
## Set up a checkout
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git clone https://github.com/alexshpunt/pi-agent-ide.git
|
|
13
|
+
cd pi-agent-ide
|
|
14
|
+
pnpm install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Run the unified extension
|
|
18
|
+
|
|
19
|
+
The root package uses the same single entrypoint as the published package:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pi --no-extensions -e .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`--no-extensions` prevents an already installed copy from loading at the same time. Explicit `-e` extensions still load.
|
|
26
|
+
|
|
27
|
+
Use a temporary config without changing your normal Pi setup:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
PI_AGENT_IDE_CONFIG=./pi-agent-ide.json pi --no-extensions -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Test
|
|
35
|
+
|
|
36
|
+
Run unit tests after changing a covered component:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm exec vitest run --config vitest.config.mjs
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Run real-Pi integration tests after changing extension loading, tools, hooks, sessions, rendering, or filesystem behavior:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pnpm test:integration
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Integration tests use `pi-coding-agent-test`. They start real Pi processes with scripted model responses and preserve traces and terminal artifacts under `.tmp/test-runs/`.
|
|
49
|
+
|
|
50
|
+
Check package paths before committing:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pnpm check:paths
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Build the public package
|
|
57
|
+
|
|
58
|
+
Build and validate the single publishable tarball:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pnpm package:public
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The result is written to `.agents/tmp/public-package/`. The tarball contains the umbrella extension and its private workspace packages as bundled dependencies. Tests, development files, hooks, temporary files, and private package metadata are excluded.
|
|
65
|
+
|
|
66
|
+
Only the `pi-agent-ide` tarball is intended for registry publication. The bundled package names are implementation details and are not published separately.
|
|
67
|
+
|
|
68
|
+
## Evaluate agent behavior
|
|
69
|
+
|
|
70
|
+
Unit and integration tests enforce behavior contracts. They do not show whether a tool helps an agent complete a task with fewer tokens or fewer mistakes.
|
|
71
|
+
|
|
72
|
+
The evaluator compares Pi Agent IDE and vanilla Pi under controlled profiles. The [evaluation guide](./evaluation.md) explains the measurements and their limits.
|
|
73
|
+
|
|
74
|
+
## Repository layout
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
packages/ shared Resource, text, image, PDF, and interception libraries
|
|
78
|
+
src/extensions/ read, search, and text-editor cores and plugins
|
|
79
|
+
src/plugins/ AST, LSP, formatter, lint, and Git-aware IDE plugins
|
|
80
|
+
src/composite/ unified built-in registry and configuration loader
|
|
81
|
+
tests/integration/ umbrella real-Pi behavior tests
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Dependency rules
|
|
85
|
+
|
|
86
|
+
Packages inside this monorepo use `workspace:^`. pnpm links them to local source and release packaging converts the ranges.
|
|
87
|
+
|
|
88
|
+
Packages from other repositories use normal semver ranges. Local development mappings belong in `pnpm-workspace.yaml`, not in published manifests.
|
|
89
|
+
|
|
90
|
+
Do not commit machine-specific checkout paths or `file:` dependencies.
|
|
91
|
+
|
|
92
|
+
## Adding a built-in
|
|
93
|
+
|
|
94
|
+
A new built-in normally needs:
|
|
95
|
+
|
|
96
|
+
1. an independent extension entrypoint;
|
|
97
|
+
2. a public protocol contribution instead of a direct core dependency;
|
|
98
|
+
3. an entry in `src/composite/builtin-extensions.ts` with a stable ID and dependencies;
|
|
99
|
+
4. its ID in [configuration](./configuration.md);
|
|
100
|
+
5. behavior coverage at the narrowest useful level.
|
|
101
|
+
|
|
102
|
+
If a feature can live as an external extension, it does not need to become a bundled built-in.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Evaluation
|
|
2
|
+
|
|
3
|
+
Pi Agent IDE is still experimental. Evaluation compares it with vanilla Pi instead of assuming that richer tools always improve agent behavior.
|
|
4
|
+
|
|
5
|
+
Current studies use repeatable coding tasks and editing gyms. They inspect:
|
|
6
|
+
|
|
7
|
+
- task completion and correctness;
|
|
8
|
+
- tool calls and failed tool calls;
|
|
9
|
+
- input, output, and cache tokens;
|
|
10
|
+
- unnecessary reads and repeated searches;
|
|
11
|
+
- edit retries and recovery from stale context;
|
|
12
|
+
- cases where specialized tools make a task harder.
|
|
13
|
+
|
|
14
|
+
Results depend on the model, prompt, repository, and task. A result from one suite is evidence about that suite, not a universal performance claim.
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Writing extensions
|
|
2
|
+
|
|
3
|
+
Pi Agent IDE is designed to accept behavior from independent Pi extensions. You do not need to fork the umbrella package or add your extension to its built-in registry.
|
|
4
|
+
|
|
5
|
+
When its target core is enabled, an external extension can load before or after Pi Agent IDE. The connection helpers handle both orders through Pi's shared event bus.
|
|
6
|
+
|
|
7
|
+
## Choose a protocol
|
|
8
|
+
|
|
9
|
+
| You want to add | Umbrella API |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| A readable source or read presentation | `pi-agent-ide/api/read`, `pi-agent-ide/api/resource` |
|
|
12
|
+
| A search backend | `pi-agent-ide/api/search` |
|
|
13
|
+
| A writable source, anchor, mutation, guard, or renderer | `pi-agent-ide/api/text-editor`, `pi-agent-ide/api/text` |
|
|
14
|
+
| A formatter, compiler, or linter | `pi-agent-ide/api/connect-plugin`, `pi-agent-ide/api/toolchain` |
|
|
15
|
+
|
|
16
|
+
The internal packages are bundled into Pi Agent IDE and are not published separately. External extensions import their public contracts through the umbrella package.
|
|
17
|
+
|
|
18
|
+
A typical Pi package manifest starts like this:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"name": "my-pi-agent-ide-plugin",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"keywords": ["pi-package"],
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
27
|
+
"pi-agent-ide": "^0.1.0"
|
|
28
|
+
},
|
|
29
|
+
"pi": {
|
|
30
|
+
"extensions": ["./index.ts"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use a `pi-agent-ide` range compatible with the release you target.
|
|
36
|
+
|
|
37
|
+
## Search plugin
|
|
38
|
+
|
|
39
|
+
A search plugin contributes one or more resolvers. A resolver returns `not-handled` when a query belongs to another backend.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import {
|
|
43
|
+
connectSearchPlugin,
|
|
44
|
+
SEARCH_API_VERSION,
|
|
45
|
+
SEARCH_PROTOCOL,
|
|
46
|
+
type SearchPlugin,
|
|
47
|
+
type SearchResolver,
|
|
48
|
+
} from "pi-agent-ide/api/search";
|
|
49
|
+
|
|
50
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
51
|
+
|
|
52
|
+
const resolver: SearchResolver = {
|
|
53
|
+
id: "tickets",
|
|
54
|
+
|
|
55
|
+
async tryResolve(request)
|
|
56
|
+
{
|
|
57
|
+
if (!request.query.startsWith("ticket:"))
|
|
58
|
+
{
|
|
59
|
+
return { kind: "not-handled" };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const ticket = request.query.slice("ticket:".length).trim();
|
|
63
|
+
return { kind: "resolved", payload: { ticket } };
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
format(payload)
|
|
67
|
+
{
|
|
68
|
+
const { ticket } = payload as { ticket: string };
|
|
69
|
+
return {
|
|
70
|
+
content: [{ type: "text", text: `Ticket ${ticket}` }],
|
|
71
|
+
details: { ticket },
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const plugin: SearchPlugin = {
|
|
77
|
+
protocol: SEARCH_PROTOCOL,
|
|
78
|
+
apiVersion: SEARCH_API_VERSION,
|
|
79
|
+
id: "tickets",
|
|
80
|
+
setup(api)
|
|
81
|
+
{
|
|
82
|
+
api.addResolver({ resolver });
|
|
83
|
+
api.describe("Use `ticket:<id>` to find an issue tracker ticket.");
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default function register(pi: ExtensionAPI): void | Promise<void>
|
|
88
|
+
{
|
|
89
|
+
return connectSearchPlugin(pi, plugin);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The search core validates the plugin and owns resolver ordering. Keep network clients and source-specific formatting inside your plugin.
|
|
94
|
+
|
|
95
|
+
## Read plugin
|
|
96
|
+
|
|
97
|
+
A read plugin usually contributes a `ResourceResolver`. The resolver recognizes a source and returns a Resource with explicit capabilities.
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import {
|
|
101
|
+
connectReadPlugin,
|
|
102
|
+
READ_API_VERSION,
|
|
103
|
+
READ_PROTOCOL,
|
|
104
|
+
type ReadPlugin,
|
|
105
|
+
} from "pi-agent-ide/api/read";
|
|
106
|
+
import type { ResourceResolver } from "pi-agent-ide/api/resource";
|
|
107
|
+
|
|
108
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
109
|
+
|
|
110
|
+
const resolver: ResourceResolver = {
|
|
111
|
+
id: "notes",
|
|
112
|
+
|
|
113
|
+
async tryResolve(source)
|
|
114
|
+
{
|
|
115
|
+
if (!source.startsWith("note:"))
|
|
116
|
+
{
|
|
117
|
+
return { kind: "not-handled" };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const noteId = source.slice("note:".length);
|
|
121
|
+
return {
|
|
122
|
+
kind: "resolved",
|
|
123
|
+
resource: {
|
|
124
|
+
source,
|
|
125
|
+
async read()
|
|
126
|
+
{
|
|
127
|
+
return [{ type: "text", text: `Note ${noteId}` }];
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const plugin: ReadPlugin = {
|
|
135
|
+
protocol: READ_PROTOCOL,
|
|
136
|
+
apiVersion: READ_API_VERSION,
|
|
137
|
+
id: "notes",
|
|
138
|
+
setup(api)
|
|
139
|
+
{
|
|
140
|
+
api.addResolver({ resolver });
|
|
141
|
+
api.describe("Reads `note:<id>` sources.");
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export default function register(pi: ExtensionAPI): void | Promise<void>
|
|
146
|
+
{
|
|
147
|
+
return connectReadPlugin(pi, plugin);
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
A read Resource does not become writable automatically. Register a matching resolver with the text-editor protocol only when writes are safe and well defined.
|
|
152
|
+
|
|
153
|
+
Read plugins can also add pipeline handlers, text presenters, and resolver-specific TUI renderers. See the [read plugin contract](https://github.com/alexshpunt/pi-agent-ide/blob/main/src/extensions/pi-agent-read/docs/plugins/plugin-protocol.md).
|
|
154
|
+
|
|
155
|
+
## Anchor plugin
|
|
156
|
+
|
|
157
|
+
Anchor resolvers recognize opaque values against the current text snapshot. This example adds a constant `middle` position.
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
import { TextAnchor, type TextAnchorResolver } from "pi-agent-ide/api/text";
|
|
161
|
+
import {
|
|
162
|
+
connectTextEditorPlugin,
|
|
163
|
+
TEXT_EDITOR_API_VERSION,
|
|
164
|
+
TEXT_EDITOR_PROTOCOL,
|
|
165
|
+
TEXT_POSITION_ANCHOR_KIND,
|
|
166
|
+
type TextEditorPlugin,
|
|
167
|
+
} from "pi-agent-ide/api/text-editor";
|
|
168
|
+
|
|
169
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
170
|
+
|
|
171
|
+
class MiddleAnchor extends TextAnchor
|
|
172
|
+
{
|
|
173
|
+
constructor(lineNumber: number)
|
|
174
|
+
{
|
|
175
|
+
super("middle", lineNumber);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const resolver: TextAnchorResolver = {
|
|
180
|
+
id: "middle",
|
|
181
|
+
description: "`middle` selects the middle line.",
|
|
182
|
+
|
|
183
|
+
async tryResolve(value, context)
|
|
184
|
+
{
|
|
185
|
+
if (value !== "middle")
|
|
186
|
+
{
|
|
187
|
+
return { kind: "not-handled" };
|
|
188
|
+
}
|
|
189
|
+
if (context.lines.length === 0)
|
|
190
|
+
{
|
|
191
|
+
return { kind: "failed", error: new Error("middle cannot resolve in an empty file") };
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
kind: "resolved",
|
|
196
|
+
anchor: new MiddleAnchor(Math.ceil(context.lines.length / 2)),
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const plugin: TextEditorPlugin = {
|
|
202
|
+
protocol: TEXT_EDITOR_PROTOCOL,
|
|
203
|
+
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
204
|
+
id: "middle-anchor",
|
|
205
|
+
setup(api)
|
|
206
|
+
{
|
|
207
|
+
api.addAnchorResolver({
|
|
208
|
+
resolver,
|
|
209
|
+
kind: TEXT_POSITION_ANCHOR_KIND,
|
|
210
|
+
type: "constant",
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export default function register(pi: ExtensionAPI): void | Promise<void>
|
|
216
|
+
{
|
|
217
|
+
return connectTextEditorPlugin(pi, plugin);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Use `major` for the main per-line anchor format, `auxiliary` for additional displayed formats, and `constant` for symbolic positions that need no line marker. The core allows only one active major resolver.
|
|
222
|
+
|
|
223
|
+
More advanced anchors can return exact text selections, reject stale values with recovery context, or resolve one value to several Resource sources. See the [text-editor plugin contract](https://github.com/alexshpunt/pi-agent-ide/blob/main/src/extensions/pi-agent-text-editor/docs/plugins/plugin-protocol.md).
|
|
224
|
+
|
|
225
|
+
## IDE toolchain plugin
|
|
226
|
+
|
|
227
|
+
The IDE protocol accepts formatter, compiler, and linter implementations.
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
import { connectIdePlugin } from "pi-agent-ide/api/connect-plugin";
|
|
231
|
+
import {
|
|
232
|
+
IDE_API_VERSION,
|
|
233
|
+
IDE_PROTOCOL,
|
|
234
|
+
type IdePlugin,
|
|
235
|
+
} from "pi-agent-ide/api/plugin-protocol";
|
|
236
|
+
import type { Formatter } from "pi-agent-ide/api/toolchain";
|
|
237
|
+
|
|
238
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
239
|
+
|
|
240
|
+
const formatter: Formatter = {
|
|
241
|
+
kind: "formatter",
|
|
242
|
+
name: "my-formatter",
|
|
243
|
+
priority: 100,
|
|
244
|
+
extensions: [".ts"],
|
|
245
|
+
async detect()
|
|
246
|
+
{
|
|
247
|
+
return true;
|
|
248
|
+
},
|
|
249
|
+
async format()
|
|
250
|
+
{
|
|
251
|
+
return { ok: true, edits: 0 };
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const plugin: IdePlugin = {
|
|
256
|
+
protocol: IDE_PROTOCOL,
|
|
257
|
+
apiVersion: IDE_API_VERSION,
|
|
258
|
+
id: "my-formatter",
|
|
259
|
+
setup(api)
|
|
260
|
+
{
|
|
261
|
+
api.addTool(formatter);
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export default function register(pi: ExtensionAPI): void | Promise<void>
|
|
266
|
+
{
|
|
267
|
+
return connectIdePlugin(pi, plugin);
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
A real formatter should run its normal formatter command and report how many edits it applied. Compilers and linters return structured diagnostics with one-based line and column positions.
|
|
272
|
+
|
|
273
|
+
## Install and test your extension
|
|
274
|
+
|
|
275
|
+
Try a local extension without installing it permanently:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
pi --no-extensions -e npm:pi-agent-ide -e ./index.ts
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Install a package for normal use:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
pi install npm:my-pi-agent-ide-plugin
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Test protocol behavior in both load orders when ordering matters. For behavior that crosses Pi's loader, event bus, tools, sessions, filesystem, or terminal, use a real-Pi integration test rather than only calling `setup` in isolation.
|
|
288
|
+
|
|
289
|
+
The repository's external plugin integration fixture is a small working example:
|
|
290
|
+
|
|
291
|
+
- [`external-search-plugin.ts`](https://github.com/alexshpunt/pi-agent-ide/blob/main/tests/integration/composite/support/external-search-plugin.ts);
|
|
292
|
+
- [`unified-extension.integration.test.ts`](https://github.com/alexshpunt/pi-agent-ide/blob/main/tests/integration/composite/unified-extension.integration.test.ts).
|
|
293
|
+
|
|
294
|
+
## Keep boundaries clear
|
|
295
|
+
|
|
296
|
+
An extension should depend on the public protocol it implements, not on another extension's internal files. Prefer one narrow contribution over a plugin that reaches into several registries without a clear reason.
|
|
297
|
+
|
|
298
|
+
Do not add an external plugin ID to `disabledExtensions`. That setting controls only the built-ins shipped by Pi Agent IDE. Enable or disable your package through Pi's normal package and extension configuration.
|