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,157 @@
|
|
|
1
|
+
import { type TSchema, Type } from "typebox";
|
|
2
|
+
import { Value } from "typebox/value";
|
|
3
|
+
|
|
4
|
+
const textAnchorBrand = Symbol.for("pi-agent-text/TextAnchor");
|
|
5
|
+
|
|
6
|
+
export abstract class TextAnchor
|
|
7
|
+
{
|
|
8
|
+
readonly [textAnchorBrand] = true;
|
|
9
|
+
|
|
10
|
+
public static is(value: unknown): value is TextAnchor
|
|
11
|
+
{
|
|
12
|
+
if (typeof value !== "object" || value === null)
|
|
13
|
+
{
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
try
|
|
18
|
+
{
|
|
19
|
+
const candidate = value as Record<PropertyKey, unknown>;
|
|
20
|
+
return candidate[textAnchorBrand] === true
|
|
21
|
+
&& typeof candidate.value === "string"
|
|
22
|
+
&& Number.isSafeInteger(candidate.lineNumber)
|
|
23
|
+
&& (candidate.lineNumber as number) >= 1;
|
|
24
|
+
}
|
|
25
|
+
catch
|
|
26
|
+
{
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
protected constructor(
|
|
31
|
+
readonly value: string,
|
|
32
|
+
readonly lineNumber: number,
|
|
33
|
+
)
|
|
34
|
+
{
|
|
35
|
+
if (value.trim().length === 0)
|
|
36
|
+
{
|
|
37
|
+
throw new TypeError("Text anchor value must be non-empty");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!Number.isSafeInteger(lineNumber) || lineNumber < 1)
|
|
41
|
+
{
|
|
42
|
+
throw new RangeError("Text anchor line number must be a positive safe integer");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public toString(): string
|
|
47
|
+
{
|
|
48
|
+
return this.value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface TextAnchorResolverContext
|
|
53
|
+
{
|
|
54
|
+
readonly source: string;
|
|
55
|
+
readonly content: string;
|
|
56
|
+
readonly lines: readonly string[];
|
|
57
|
+
readonly cwd: string;
|
|
58
|
+
readonly signal?: AbortSignal;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface TextAnchorRecoveryRange
|
|
62
|
+
{
|
|
63
|
+
readonly offset: number;
|
|
64
|
+
readonly limit: number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface TextAnchorRejection
|
|
68
|
+
{
|
|
69
|
+
readonly code: "invalid" | "stale" | "missing" | "ambiguous";
|
|
70
|
+
readonly reason: string;
|
|
71
|
+
readonly contextRange?: TextAnchorRecoveryRange;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type TextAnchorResolutionAttempt =
|
|
75
|
+
| { readonly kind: "not-handled"; }
|
|
76
|
+
| { readonly kind: "resolved"; readonly anchor: TextAnchor; }
|
|
77
|
+
| { readonly kind: "rejected"; readonly rejection: TextAnchorRejection; }
|
|
78
|
+
| { readonly kind: "failed"; readonly error: unknown; };
|
|
79
|
+
|
|
80
|
+
export type TextAnchorDescriptionSource = string | (() => string | undefined);
|
|
81
|
+
|
|
82
|
+
export interface TextAnchorResolver
|
|
83
|
+
{
|
|
84
|
+
readonly id: string;
|
|
85
|
+
readonly description: TextAnchorDescriptionSource;
|
|
86
|
+
readonly normalize?: (value: string) => string;
|
|
87
|
+
tryResolve(value: string, context: TextAnchorResolverContext): Promise<TextAnchorResolutionAttempt>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const objectOptions = { additionalProperties: true } as const;
|
|
91
|
+
const functionSchema = Type.Function([], Type.Unknown());
|
|
92
|
+
const resolverSchema = Type.Object({
|
|
93
|
+
id: Type.String({ minLength: 1 }),
|
|
94
|
+
description: Type.Union([Type.String(), functionSchema]),
|
|
95
|
+
normalize: Type.Optional(functionSchema),
|
|
96
|
+
tryResolve: functionSchema,
|
|
97
|
+
}, objectOptions);
|
|
98
|
+
const attemptSchema = Type.Union([
|
|
99
|
+
Type.Object({ kind: Type.Literal("not-handled") }, objectOptions),
|
|
100
|
+
Type.Object({
|
|
101
|
+
kind: Type.Literal("resolved"),
|
|
102
|
+
anchor: Type.Unknown(),
|
|
103
|
+
}, objectOptions),
|
|
104
|
+
Type.Object({
|
|
105
|
+
kind: Type.Literal("rejected"),
|
|
106
|
+
rejection: Type.Object({
|
|
107
|
+
code: Type.Union([
|
|
108
|
+
Type.Literal("invalid"),
|
|
109
|
+
Type.Literal("stale"),
|
|
110
|
+
Type.Literal("missing"),
|
|
111
|
+
Type.Literal("ambiguous"),
|
|
112
|
+
]),
|
|
113
|
+
reason: Type.String(),
|
|
114
|
+
contextRange: Type.Optional(Type.Object({
|
|
115
|
+
offset: Type.Number(),
|
|
116
|
+
limit: Type.Number(),
|
|
117
|
+
})),
|
|
118
|
+
}),
|
|
119
|
+
}, objectOptions),
|
|
120
|
+
Type.Object({
|
|
121
|
+
kind: Type.Literal("failed"),
|
|
122
|
+
error: Type.Unknown(),
|
|
123
|
+
}, objectOptions),
|
|
124
|
+
]);
|
|
125
|
+
|
|
126
|
+
export function isTextAnchorResolver(value: unknown): value is TextAnchorResolver
|
|
127
|
+
{
|
|
128
|
+
return safeCheck(resolverSchema, value)
|
|
129
|
+
&& safeEvaluate(() => (value as TextAnchorResolver).id.trim().length > 0);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function isTextAnchorResolutionAttempt(value: unknown): value is TextAnchorResolutionAttempt
|
|
133
|
+
{
|
|
134
|
+
return safeCheck(attemptSchema, value)
|
|
135
|
+
&& safeEvaluate(() =>
|
|
136
|
+
{
|
|
137
|
+
const attempt = value as TextAnchorResolutionAttempt;
|
|
138
|
+
return attempt.kind !== "resolved" || TextAnchor.is(attempt.anchor);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function safeCheck(schema: TSchema, value: unknown): boolean
|
|
143
|
+
{
|
|
144
|
+
return safeEvaluate(() => Value.Check(schema, value));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function safeEvaluate(check: () => boolean): boolean
|
|
148
|
+
{
|
|
149
|
+
try
|
|
150
|
+
{
|
|
151
|
+
return check();
|
|
152
|
+
}
|
|
153
|
+
catch
|
|
154
|
+
{
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AgentContent,
|
|
3
|
+
ContentConversionAttempt,
|
|
4
|
+
ContentConversionContext,
|
|
5
|
+
ContentConverter,
|
|
6
|
+
ContentInput,
|
|
7
|
+
} from "pi-agent-resource";
|
|
8
|
+
|
|
9
|
+
const textualApplicationMediaTypes = new Set([
|
|
10
|
+
"application/ecmascript",
|
|
11
|
+
"application/graphql",
|
|
12
|
+
"application/javascript",
|
|
13
|
+
"application/json",
|
|
14
|
+
"application/sql",
|
|
15
|
+
"application/toml",
|
|
16
|
+
"application/x-httpd-php",
|
|
17
|
+
"application/x-javascript",
|
|
18
|
+
"application/x-ndjson",
|
|
19
|
+
"application/x-www-form-urlencoded",
|
|
20
|
+
"application/x-yaml",
|
|
21
|
+
"application/xml",
|
|
22
|
+
"application/yaml",
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
export function createTextContentConverter(): ContentConverter
|
|
26
|
+
{
|
|
27
|
+
return {
|
|
28
|
+
id: "text",
|
|
29
|
+
description: "UTF-8 text.",
|
|
30
|
+
tryConvert(input, context)
|
|
31
|
+
{
|
|
32
|
+
return Promise.resolve(convertText(input, context));
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function convertText(
|
|
38
|
+
input: ContentInput,
|
|
39
|
+
context: ContentConversionContext,
|
|
40
|
+
): ContentConversionAttempt
|
|
41
|
+
{
|
|
42
|
+
const cancellation = cancellationError(context.signal);
|
|
43
|
+
|
|
44
|
+
if (cancellation !== undefined)
|
|
45
|
+
{
|
|
46
|
+
return { kind: "failed", error: cancellation };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
try
|
|
50
|
+
{
|
|
51
|
+
const text = new TextDecoder("utf8", { fatal: true }).decode(input.bytes);
|
|
52
|
+
return { kind: "converted", content: [{ type: "text", text }] };
|
|
53
|
+
}
|
|
54
|
+
catch (error)
|
|
55
|
+
{
|
|
56
|
+
if (!isTextualMediaType(input.mediaType))
|
|
57
|
+
{
|
|
58
|
+
return { kind: "not-handled" };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
kind: "failed",
|
|
63
|
+
error: new TypeError(`${input.source} is not valid UTF-8 text`, { cause: error }),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function isTextualMediaType(value: string | undefined): boolean
|
|
69
|
+
{
|
|
70
|
+
if (value === undefined)
|
|
71
|
+
{
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const mediaType = value.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
76
|
+
return mediaType.startsWith("text/")
|
|
77
|
+
|| textualApplicationMediaTypes.has(mediaType)
|
|
78
|
+
|| mediaType.endsWith("+json")
|
|
79
|
+
|| mediaType.endsWith("+xml");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function textFromAgentContent(content: AgentContent): string
|
|
83
|
+
{
|
|
84
|
+
const block = content[0];
|
|
85
|
+
|
|
86
|
+
if (content.length !== 1 || block.type !== "text")
|
|
87
|
+
{
|
|
88
|
+
throw new TypeError("Text resources require exactly one text block");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return block.text;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function cancellationError(signal: AbortSignal | undefined): Error | undefined
|
|
95
|
+
{
|
|
96
|
+
if (signal?.aborted !== true)
|
|
97
|
+
{
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return signal.reason instanceof Error ? signal.reason : abortError();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function abortError(): Error
|
|
105
|
+
{
|
|
106
|
+
const error = new Error("The operation was aborted");
|
|
107
|
+
error.name = "AbortError";
|
|
108
|
+
return error;
|
|
109
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { type TSchema, Type } from "typebox";
|
|
2
|
+
import { Value } from "typebox/value";
|
|
3
|
+
|
|
4
|
+
import { type PresentedTextRow, renderPresentedTextRows, type TextChangeMarker } from "./presented-text.js";
|
|
5
|
+
|
|
6
|
+
export interface TextLinePresentation
|
|
7
|
+
{
|
|
8
|
+
readonly prefix?: string;
|
|
9
|
+
readonly suffix?: string;
|
|
10
|
+
readonly marker?: TextChangeMarker;
|
|
11
|
+
readonly before?: readonly PresentedTextRow[];
|
|
12
|
+
readonly after?: readonly PresentedTextRow[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface TextLine
|
|
16
|
+
{
|
|
17
|
+
readonly lineNumber: number;
|
|
18
|
+
readonly content: string;
|
|
19
|
+
readonly lineEnding: string;
|
|
20
|
+
readonly presentation?: TextLinePresentation;
|
|
21
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TextDocument
|
|
25
|
+
{
|
|
26
|
+
readonly source: string;
|
|
27
|
+
readonly content: string;
|
|
28
|
+
readonly lines: readonly TextLine[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TextPresentationContext
|
|
32
|
+
{
|
|
33
|
+
readonly purpose: "read" | "edit-diff";
|
|
34
|
+
readonly source: string;
|
|
35
|
+
readonly cwd: string;
|
|
36
|
+
readonly resolvedBy: string;
|
|
37
|
+
readonly signal?: AbortSignal;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface TextLinePresenter
|
|
41
|
+
{
|
|
42
|
+
readonly id: string;
|
|
43
|
+
present(document: TextDocument, context: TextPresentationContext): TextDocument | Promise<TextDocument>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface TextPresenterRegistration
|
|
47
|
+
{
|
|
48
|
+
readonly presenter: TextLinePresenter;
|
|
49
|
+
readonly priority?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const functionSchema = Type.Function([], Type.Unknown());
|
|
53
|
+
const presenterSchema = Type.Object({
|
|
54
|
+
id: Type.String({ minLength: 1 }),
|
|
55
|
+
present: functionSchema,
|
|
56
|
+
});
|
|
57
|
+
const registrationSchema = Type.Object({
|
|
58
|
+
presenter: presenterSchema,
|
|
59
|
+
priority: Type.Optional(Type.Number()),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export function isTextLinePresenter(value: unknown): value is TextLinePresenter
|
|
63
|
+
{
|
|
64
|
+
return safeCheck(presenterSchema, value);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function isTextPresenterRegistration(value: unknown): value is TextPresenterRegistration
|
|
68
|
+
{
|
|
69
|
+
return safeCheck(registrationSchema, value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function createTextDocument(source: string, content: string): TextDocument
|
|
73
|
+
{
|
|
74
|
+
return { source, content, lines: splitTextLines(content) };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function renderTextDocument(document: TextDocument): string
|
|
78
|
+
{
|
|
79
|
+
return document.lines.map((line) => `${line.content}${line.lineEnding}`).join("");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function renderPresentedTextDocument(document: TextDocument): string
|
|
83
|
+
{
|
|
84
|
+
const rows = document.lines.flatMap((line) => [
|
|
85
|
+
...(line.presentation?.before ?? []),
|
|
86
|
+
presentedRowFor(line),
|
|
87
|
+
...(line.presentation?.after ?? []),
|
|
88
|
+
]);
|
|
89
|
+
const rendered = renderPresentedTextRows(rows);
|
|
90
|
+
let rowIndex = 0;
|
|
91
|
+
|
|
92
|
+
return document.lines.map((line) =>
|
|
93
|
+
{
|
|
94
|
+
const lineRowCount = 1 + (line.presentation?.before?.length ?? 0) + (line.presentation?.after?.length ?? 0);
|
|
95
|
+
const output = rendered.slice(rowIndex, rowIndex + lineRowCount).join("\n");
|
|
96
|
+
rowIndex += lineRowCount;
|
|
97
|
+
return `${output}${line.lineEnding}`;
|
|
98
|
+
}).join("");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function presentedRowFor(line: TextLine): PresentedTextRow
|
|
102
|
+
{
|
|
103
|
+
return {
|
|
104
|
+
content: line.content,
|
|
105
|
+
...(line.presentation?.prefix === undefined ? {} : { prefix: line.presentation.prefix }),
|
|
106
|
+
...(line.presentation?.suffix === undefined ? {} : { suffix: line.presentation.suffix }),
|
|
107
|
+
...(line.presentation?.marker === undefined ? {} : { marker: line.presentation.marker }),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function splitTextLines(content: string): TextLine[]
|
|
112
|
+
{
|
|
113
|
+
if (content.length === 0)
|
|
114
|
+
{
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const lines: TextLine[] = [];
|
|
119
|
+
const pattern = /([^\r\n]*)(\r\n|\r|\n|$)/gu;
|
|
120
|
+
let match: RegExpExecArray | null;
|
|
121
|
+
|
|
122
|
+
while ((match = pattern.exec(content)) !== null)
|
|
123
|
+
{
|
|
124
|
+
if (match[0].length === 0)
|
|
125
|
+
{
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
lines.push({
|
|
130
|
+
lineNumber: lines.length + 1,
|
|
131
|
+
content: match[1] ?? "",
|
|
132
|
+
lineEnding: match[2] ?? "",
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return lines;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function safeCheck(schema: TSchema, value: unknown): boolean
|
|
140
|
+
{
|
|
141
|
+
try
|
|
142
|
+
{
|
|
143
|
+
return Value.Check(schema, value);
|
|
144
|
+
}
|
|
145
|
+
catch
|
|
146
|
+
{
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
|
|
2
|
+
import {
|
|
3
|
+
TEXT_EDITOR_API_VERSION,
|
|
4
|
+
TEXT_EDITOR_PROTOCOL,
|
|
5
|
+
TEXT_POSITION_ANCHOR_KIND,
|
|
6
|
+
type TextEditorPlugin,
|
|
7
|
+
} from "pi-agent-text-editor/api/plugin-protocol";
|
|
8
|
+
|
|
9
|
+
import { createConstantTextAnchorResolver } from "./src/resolver.js";
|
|
10
|
+
|
|
11
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
12
|
+
|
|
13
|
+
export default async function registerConstantTextAnchors(pi: ExtensionAPI): Promise<void>
|
|
14
|
+
{
|
|
15
|
+
const plugin = {
|
|
16
|
+
protocol: TEXT_EDITOR_PROTOCOL,
|
|
17
|
+
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
18
|
+
id: "text-anchor-constant",
|
|
19
|
+
setup(api)
|
|
20
|
+
{
|
|
21
|
+
api.addAnchorResolver({
|
|
22
|
+
resolver: createConstantTextAnchorResolver(),
|
|
23
|
+
kind: TEXT_POSITION_ANCHOR_KIND,
|
|
24
|
+
type: "constant",
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
} satisfies TextEditorPlugin;
|
|
28
|
+
|
|
29
|
+
await connectTextEditorPlugin(pi, plugin);
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-agent-text-anchor-constant",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"pi": {
|
|
6
|
+
"extensions": [
|
|
7
|
+
"./index.ts"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"pi-agent-text": "0.1.0",
|
|
12
|
+
"pi-agent-text-editor": "0.1.0"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TextAnchor,
|
|
3
|
+
type TextAnchorResolutionAttempt,
|
|
4
|
+
type TextAnchorResolver,
|
|
5
|
+
type TextAnchorResolverContext,
|
|
6
|
+
} from "pi-agent-text";
|
|
7
|
+
|
|
8
|
+
class ConstantTextAnchor extends TextAnchor
|
|
9
|
+
{
|
|
10
|
+
public constructor(value: "begin" | "end", lineNumber: number)
|
|
11
|
+
{
|
|
12
|
+
super(value, lineNumber);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createConstantTextAnchorResolver(): TextAnchorResolver
|
|
17
|
+
{
|
|
18
|
+
return {
|
|
19
|
+
id: "file-position",
|
|
20
|
+
description: "`begin` and `end` select the first and last existing lines.",
|
|
21
|
+
tryResolve(value, context)
|
|
22
|
+
{
|
|
23
|
+
return Promise.resolve(resolveConstantAnchor(value, context));
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function resolveConstantAnchor(
|
|
29
|
+
value: string,
|
|
30
|
+
context: TextAnchorResolverContext,
|
|
31
|
+
): TextAnchorResolutionAttempt
|
|
32
|
+
{
|
|
33
|
+
if (value !== "begin" && value !== "end")
|
|
34
|
+
{
|
|
35
|
+
return { kind: "not-handled" };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (context.lines.length === 0)
|
|
39
|
+
{
|
|
40
|
+
return { kind: "failed", error: new Error(`${value} cannot resolve in an empty file`) };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
kind: "resolved",
|
|
45
|
+
anchor: new ConstantTextAnchor(value, value === "begin" ? 1 : context.lines.length),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
2
|
+
import { READ_API_VERSION, READ_PROTOCOL, type ReadPlugin } from "pi-agent-read/api/plugin-protocol";
|
|
3
|
+
import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
|
|
4
|
+
import {
|
|
5
|
+
TEXT_EDITOR_API_VERSION,
|
|
6
|
+
TEXT_EDITOR_PROTOCOL,
|
|
7
|
+
TEXT_POSITION_ANCHOR_KIND,
|
|
8
|
+
type TextEditorPlugin,
|
|
9
|
+
} from "pi-agent-text-editor/api/plugin-protocol";
|
|
10
|
+
|
|
11
|
+
import { createLineHashAnchorResolver } from "./src/anchor.js";
|
|
12
|
+
import { createLineHashPresenter } from "./src/read-handler.js";
|
|
13
|
+
|
|
14
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
15
|
+
|
|
16
|
+
export default async function registerLineHashTextAnchor(pi: ExtensionAPI): Promise<void>
|
|
17
|
+
{
|
|
18
|
+
const presenter = createLineHashPresenter();
|
|
19
|
+
const readPlugin = {
|
|
20
|
+
protocol: READ_PROTOCOL,
|
|
21
|
+
apiVersion: READ_API_VERSION,
|
|
22
|
+
id: "text-anchor-line-hash",
|
|
23
|
+
setup(api)
|
|
24
|
+
{
|
|
25
|
+
api.addTextPresenter({ presenter });
|
|
26
|
+
api.describe("Adds `LINE#HASH` anchors to textual read results.");
|
|
27
|
+
},
|
|
28
|
+
} satisfies ReadPlugin;
|
|
29
|
+
const editorPlugin = {
|
|
30
|
+
protocol: TEXT_EDITOR_PROTOCOL,
|
|
31
|
+
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
32
|
+
id: "text-anchor-line-hash",
|
|
33
|
+
setup(api)
|
|
34
|
+
{
|
|
35
|
+
api.addAnchorResolver({
|
|
36
|
+
resolver: createLineHashAnchorResolver(),
|
|
37
|
+
kind: TEXT_POSITION_ANCHOR_KIND,
|
|
38
|
+
type: "major",
|
|
39
|
+
});
|
|
40
|
+
api.addTextPresenter({ presenter });
|
|
41
|
+
},
|
|
42
|
+
} satisfies TextEditorPlugin;
|
|
43
|
+
|
|
44
|
+
await Promise.all([
|
|
45
|
+
connectReadPlugin(pi, readPlugin),
|
|
46
|
+
connectTextEditorPlugin(pi, editorPlugin),
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-agent-text-anchor-line-hash",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"pi": {
|
|
6
|
+
"extensions": [
|
|
7
|
+
"./index.ts"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
"./api/anchor": "./src/anchor.ts"
|
|
12
|
+
},
|
|
13
|
+
"imports": {
|
|
14
|
+
"#src/*": "./src/*"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"pi-agent-read": "0.1.0",
|
|
18
|
+
"pi-agent-text": "0.1.0",
|
|
19
|
+
"pi-agent-text-editor": "0.1.0"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
TextAnchor,
|
|
5
|
+
type TextAnchorResolutionAttempt,
|
|
6
|
+
type TextAnchorResolver,
|
|
7
|
+
type TextAnchorResolverContext,
|
|
8
|
+
} from "pi-agent-text";
|
|
9
|
+
|
|
10
|
+
const lineHashPattern = /^([1-9]\d*)#([A-Z0-9]{3,4})$/;
|
|
11
|
+
const presentedLineHashPattern = /(?<![A-Za-z0-9])([1-9]\d*#[A-Z0-9]{3,4})(?![A-Za-z0-9])/g;
|
|
12
|
+
|
|
13
|
+
function normalizeLineHashAnchor(value: string): string
|
|
14
|
+
{
|
|
15
|
+
const matches = [...value.matchAll(presentedLineHashPattern)];
|
|
16
|
+
return matches.length === 1 ? matches[0]![1]! : value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class LineHashTextAnchor extends TextAnchor
|
|
20
|
+
{
|
|
21
|
+
public constructor(lineNumber: number, line: string)
|
|
22
|
+
{
|
|
23
|
+
super(`${lineNumber}#${hashLine(line)}`, lineNumber);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function hashLine(line: string): string
|
|
28
|
+
{
|
|
29
|
+
return createHash("sha1").update(line).digest("hex").slice(0, 4).toUpperCase();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function createLineHashAnchor(lineNumber: number, line: string): TextAnchor
|
|
33
|
+
{
|
|
34
|
+
return new LineHashTextAnchor(lineNumber, line);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function formatLineHashAnchor(lineNumber: number, line: string): string
|
|
38
|
+
{
|
|
39
|
+
return createLineHashAnchor(lineNumber, line).value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function renderLineHashLines(
|
|
43
|
+
lines: readonly string[],
|
|
44
|
+
startLine = 1,
|
|
45
|
+
endLine = lines.length,
|
|
46
|
+
): string[]
|
|
47
|
+
{
|
|
48
|
+
const first = Math.max(1, startLine);
|
|
49
|
+
const last = Math.min(lines.length, endLine);
|
|
50
|
+
|
|
51
|
+
if (last < first)
|
|
52
|
+
{
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const anchors = lines.map((line, index) => formatLineHashAnchor(index + 1, line));
|
|
57
|
+
const width = Math.max(0, ...anchors.map((anchor) => anchor.length));
|
|
58
|
+
|
|
59
|
+
return lines
|
|
60
|
+
.slice(first - 1, last)
|
|
61
|
+
.map((line, index) => `${anchors[first + index - 1]!.padStart(width)}|${line}`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function createLineHashAnchorResolver(): TextAnchorResolver
|
|
65
|
+
{
|
|
66
|
+
return {
|
|
67
|
+
id: "line-hash",
|
|
68
|
+
description:
|
|
69
|
+
"Use the complete `LINE#HASH` printed before a source line, for example `12#A4F0`; the hash rejects stale text.",
|
|
70
|
+
normalize: normalizeLineHashAnchor,
|
|
71
|
+
tryResolve(value, context)
|
|
72
|
+
{
|
|
73
|
+
return Promise.resolve(resolveLineHashAnchor(value, context));
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function resolveLineHashAnchor(
|
|
79
|
+
value: string,
|
|
80
|
+
context: TextAnchorResolverContext,
|
|
81
|
+
): TextAnchorResolutionAttempt
|
|
82
|
+
{
|
|
83
|
+
const match = lineHashPattern.exec(value);
|
|
84
|
+
|
|
85
|
+
if (match === null)
|
|
86
|
+
{
|
|
87
|
+
return { kind: "not-handled" };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const lineNumber = Number(match[1]);
|
|
91
|
+
const line = context.lines[lineNumber - 1];
|
|
92
|
+
|
|
93
|
+
if (line === undefined || hashLine(line) !== match[2])
|
|
94
|
+
{
|
|
95
|
+
const nearbyLineCount = 5;
|
|
96
|
+
const first = Math.max(1, lineNumber - nearbyLineCount);
|
|
97
|
+
const last = Math.min(context.lines.length, lineNumber + nearbyLineCount);
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
kind: "rejected",
|
|
101
|
+
rejection: {
|
|
102
|
+
code: line === undefined ? "missing" : "stale",
|
|
103
|
+
reason: line === undefined ? "line hash anchor is out of range" : "line hash anchor is stale",
|
|
104
|
+
contextRange: { offset: first, limit: last - first + 1 },
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return { kind: "resolved", anchor: createLineHashAnchor(lineNumber, line) };
|
|
110
|
+
}
|