@aria-cli/tools 1.0.10 → 1.0.12
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/dist/ask-user-interaction.d.ts +0 -1
- package/dist/ask-user-interaction.js +0 -1
- package/dist/cache/web-cache.d.ts +0 -1
- package/dist/cache/web-cache.js +0 -1
- package/dist/definitions/arion.d.ts +0 -1
- package/dist/definitions/arion.js +0 -1
- package/dist/definitions/browser/browser.d.ts +0 -1
- package/dist/definitions/browser/browser.js +0 -1
- package/dist/definitions/browser/index.d.ts +0 -1
- package/dist/definitions/browser/index.js +0 -1
- package/dist/definitions/browser/pw-downloads.d.ts +0 -1
- package/dist/definitions/browser/pw-downloads.js +0 -1
- package/dist/definitions/browser/pw-interactions.d.ts +0 -1
- package/dist/definitions/browser/pw-interactions.js +0 -1
- package/dist/definitions/browser/pw-responses.d.ts +0 -1
- package/dist/definitions/browser/pw-responses.js +0 -1
- package/dist/definitions/browser/pw-session.d.ts +0 -1
- package/dist/definitions/browser/pw-session.js +0 -1
- package/dist/definitions/browser/pw-shared.d.ts +0 -1
- package/dist/definitions/browser/pw-shared.js +0 -1
- package/dist/definitions/browser/pw-snapshot.d.ts +0 -1
- package/dist/definitions/browser/pw-snapshot.js +0 -1
- package/dist/definitions/browser/pw-state.d.ts +0 -1
- package/dist/definitions/browser/pw-state.js +0 -1
- package/dist/definitions/browser/types.d.ts +0 -1
- package/dist/definitions/browser/types.js +0 -1
- package/dist/definitions/code-intelligence.d.ts +0 -1
- package/dist/definitions/code-intelligence.js +0 -1
- package/dist/definitions/core.d.ts +0 -1
- package/dist/definitions/core.js +0 -1
- package/dist/definitions/delegation.d.ts +0 -1
- package/dist/definitions/delegation.js +0 -1
- package/dist/definitions/deploy.d.ts +0 -1
- package/dist/definitions/deploy.js +0 -1
- package/dist/definitions/filesystem.d.ts +0 -1
- package/dist/definitions/filesystem.js +0 -1
- package/dist/definitions/frg.d.ts +0 -1
- package/dist/definitions/frg.js +0 -1
- package/dist/definitions/index.d.ts +0 -1
- package/dist/definitions/index.js +0 -1
- package/dist/definitions/memory.d.ts +0 -1
- package/dist/definitions/memory.js +0 -1
- package/dist/definitions/messaging.d.ts +0 -1
- package/dist/definitions/messaging.js +0 -1
- package/dist/definitions/meta.d.ts +0 -1
- package/dist/definitions/meta.js +0 -1
- package/dist/definitions/network.d.ts +0 -1
- package/dist/definitions/network.js +0 -1
- package/dist/definitions/outlook.d.ts +0 -1
- package/dist/definitions/outlook.js +0 -1
- package/dist/definitions/patch/apply-patch.d.ts +0 -1
- package/dist/definitions/patch/apply-patch.js +0 -1
- package/dist/definitions/patch/fuzzy-match.d.ts +0 -1
- package/dist/definitions/patch/fuzzy-match.js +0 -1
- package/dist/definitions/patch/index.d.ts +0 -1
- package/dist/definitions/patch/index.js +0 -1
- package/dist/definitions/patch/patch-parser.d.ts +0 -1
- package/dist/definitions/patch/patch-parser.js +0 -1
- package/dist/definitions/patch/sandbox-paths.d.ts +0 -1
- package/dist/definitions/patch/sandbox-paths.js +0 -1
- package/dist/definitions/process/index.d.ts +0 -1
- package/dist/definitions/process/index.js +0 -1
- package/dist/definitions/process/process-registry.d.ts +0 -1
- package/dist/definitions/process/process-registry.js +0 -1
- package/dist/definitions/process/process.d.ts +0 -1
- package/dist/definitions/process/process.js +0 -1
- package/dist/definitions/process/pty-keys.d.ts +0 -1
- package/dist/definitions/process/pty-keys.js +0 -1
- package/dist/definitions/process/session-slug.d.ts +0 -1
- package/dist/definitions/process/session-slug.js +0 -1
- package/dist/definitions/quip.d.ts +0 -1
- package/dist/definitions/quip.js +0 -1
- package/dist/definitions/search.d.ts +0 -1
- package/dist/definitions/search.js +0 -1
- package/dist/definitions/session-history.d.ts +0 -1
- package/dist/definitions/session-history.js +0 -1
- package/dist/definitions/shell.d.ts +0 -1
- package/dist/definitions/shell.js +0 -1
- package/dist/definitions/slack.d.ts +0 -1
- package/dist/definitions/slack.js +0 -1
- package/dist/definitions/web.d.ts +0 -1
- package/dist/definitions/web.js +0 -1
- package/dist/executors/apply-patch.d.ts +0 -1
- package/dist/executors/apply-patch.js +0 -1
- package/dist/executors/arion.d.ts +0 -1
- package/dist/executors/arion.js +0 -1
- package/dist/executors/code-intelligence.d.ts +0 -1
- package/dist/executors/code-intelligence.js +0 -1
- package/dist/executors/deploy.d.ts +0 -1
- package/dist/executors/deploy.js +0 -1
- package/dist/executors/filesystem.d.ts +0 -1
- package/dist/executors/filesystem.js +0 -1
- package/dist/executors/frg-freshness.d.ts +0 -1
- package/dist/executors/frg-freshness.js +0 -1
- package/dist/executors/frg.d.ts +0 -1
- package/dist/executors/frg.js +0 -1
- package/dist/executors/index.d.ts +0 -1
- package/dist/executors/index.js +0 -1
- package/dist/executors/learning-meta.d.ts +0 -1
- package/dist/executors/learning-meta.js +0 -1
- package/dist/executors/lsp-client.d.ts +0 -1
- package/dist/executors/lsp-client.js +0 -1
- package/dist/executors/memory.d.ts +0 -1
- package/dist/executors/memory.js +0 -1
- package/dist/executors/meta.d.ts +0 -1
- package/dist/executors/meta.js +0 -1
- package/dist/executors/process-registry.d.ts +0 -1
- package/dist/executors/process-registry.js +0 -1
- package/dist/executors/pty-session-store.d.ts +0 -1
- package/dist/executors/pty-session-store.js +0 -1
- package/dist/executors/pty.d.ts +0 -1
- package/dist/executors/pty.js +0 -1
- package/dist/executors/restart.d.ts +0 -1
- package/dist/executors/restart.js +0 -1
- package/dist/executors/search-freshness.d.ts +0 -1
- package/dist/executors/search-freshness.js +0 -1
- package/dist/executors/search-types.d.ts +0 -1
- package/dist/executors/search-types.js +0 -1
- package/dist/executors/search.d.ts +0 -1
- package/dist/executors/search.js +0 -1
- package/dist/executors/self-diagnose.d.ts +0 -1
- package/dist/executors/self-diagnose.js +0 -1
- package/dist/executors/session-history.d.ts +0 -1
- package/dist/executors/session-history.js +0 -1
- package/dist/executors/shell-safety.d.ts +0 -1
- package/dist/executors/shell-safety.js +0 -1
- package/dist/executors/shell.d.ts +0 -1
- package/dist/executors/shell.js +0 -1
- package/dist/executors/utils.d.ts +0 -1
- package/dist/executors/utils.js +0 -1
- package/dist/executors/web.d.ts +0 -1
- package/dist/executors/web.js +0 -1
- package/dist/extraction/content-extraction.d.ts +0 -1
- package/dist/extraction/content-extraction.js +0 -1
- package/dist/extraction/index.d.ts +0 -1
- package/dist/extraction/index.js +0 -1
- package/dist/headless-control-contract.d.ts +0 -1
- package/dist/headless-control-contract.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/local-control-http-auth.d.ts +0 -1
- package/dist/local-control-http-auth.js +0 -1
- package/dist/mcp/client.d.ts +0 -1
- package/dist/mcp/client.js +0 -1
- package/dist/mcp/connection.d.ts +0 -1
- package/dist/mcp/connection.js +0 -1
- package/dist/mcp/index.d.ts +0 -1
- package/dist/mcp/index.js +0 -1
- package/dist/mcp/jsonrpc.d.ts +0 -1
- package/dist/mcp/jsonrpc.js +0 -1
- package/dist/mcp/types.d.ts +0 -1
- package/dist/mcp/types.js +0 -1
- package/dist/network-control-adapter.d.ts +0 -1
- package/dist/network-control-adapter.js +0 -1
- package/dist/network-runtime/address-types.d.ts +0 -1
- package/dist/network-runtime/address-types.js +0 -1
- package/dist/network-runtime/db-owner-fencing.d.ts +0 -1
- package/dist/network-runtime/db-owner-fencing.js +0 -1
- package/dist/network-runtime/delivery-receipts.d.ts +0 -1
- package/dist/network-runtime/delivery-receipts.js +0 -1
- package/dist/network-runtime/direct-endpoint-authority.d.ts +0 -1
- package/dist/network-runtime/direct-endpoint-authority.js +0 -1
- package/dist/network-runtime/index.d.ts +0 -1
- package/dist/network-runtime/index.js +0 -1
- package/dist/network-runtime/local-control-contract.d.ts +0 -1
- package/dist/network-runtime/local-control-contract.js +0 -1
- package/dist/network-runtime/node-store-contract.d.ts +0 -1
- package/dist/network-runtime/node-store-contract.js +0 -1
- package/dist/network-runtime/pair-route-contract.d.ts +0 -1
- package/dist/network-runtime/pair-route-contract.js +0 -1
- package/dist/network-runtime/peer-capabilities.d.ts +0 -1
- package/dist/network-runtime/peer-capabilities.js +0 -1
- package/dist/network-runtime/peer-principal-ref.d.ts +0 -1
- package/dist/network-runtime/peer-principal-ref.js +0 -1
- package/dist/network-runtime/peer-state-machine.d.ts +0 -1
- package/dist/network-runtime/peer-state-machine.js +0 -1
- package/dist/network-runtime/protocol-schemas.d.ts +0 -1
- package/dist/network-runtime/protocol-schemas.js +0 -1
- package/dist/network-runtime/runtime-bootstrap-contract.d.ts +0 -1
- package/dist/network-runtime/runtime-bootstrap-contract.js +0 -1
- package/dist/outlook/desktop-session.d.ts +0 -1
- package/dist/outlook/desktop-session.js +0 -1
- package/dist/policy.d.ts +0 -1
- package/dist/policy.js +0 -1
- package/dist/providers/brave.d.ts +0 -1
- package/dist/providers/brave.js +0 -1
- package/dist/providers/duckduckgo.d.ts +0 -1
- package/dist/providers/duckduckgo.js +0 -1
- package/dist/providers/exa.d.ts +0 -1
- package/dist/providers/exa.js +0 -1
- package/dist/providers/firecrawl.d.ts +0 -1
- package/dist/providers/firecrawl.js +0 -1
- package/dist/providers/index.d.ts +0 -1
- package/dist/providers/index.js +0 -1
- package/dist/providers/jina.d.ts +0 -1
- package/dist/providers/jina.js +0 -1
- package/dist/providers/router.d.ts +0 -1
- package/dist/providers/router.js +0 -1
- package/dist/providers/search-provider.d.ts +0 -1
- package/dist/providers/search-provider.js +0 -1
- package/dist/providers/tavily.d.ts +0 -1
- package/dist/providers/tavily.js +0 -1
- package/dist/quip/desktop-session.d.ts +0 -1
- package/dist/quip/desktop-session.js +0 -1
- package/dist/registry/index.d.ts +0 -1
- package/dist/registry/index.js +0 -1
- package/dist/registry/registry.d.ts +0 -1
- package/dist/registry/registry.js +0 -1
- package/dist/runtime-socket-local-control-client.d.ts +0 -1
- package/dist/runtime-socket-local-control-client.js +0 -1
- package/dist/security/dns-normalization.d.ts +0 -1
- package/dist/security/dns-normalization.js +0 -1
- package/dist/security/dns-pinning.d.ts +0 -1
- package/dist/security/dns-pinning.js +0 -1
- package/dist/security/external-content.d.ts +0 -1
- package/dist/security/external-content.js +0 -1
- package/dist/security/ssrf.d.ts +0 -1
- package/dist/security/ssrf.js +0 -1
- package/dist/slack/desktop-session.d.ts +0 -1
- package/dist/slack/desktop-session.js +0 -1
- package/dist/tool-factory.d.ts +0 -1
- package/dist/tool-factory.js +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/retry.d.ts +0 -1
- package/dist/utils/retry.js +0 -1
- package/dist/utils/safe-parse-json.d.ts +0 -1
- package/dist/utils/safe-parse-json.js +0 -1
- package/dist/utils/url.d.ts +0 -1
- package/dist/utils/url.js +0 -1
- package/dist-cjs/.tsbuildinfo +1 -0
- package/dist-cjs/ask-user-interaction.d.ts +10 -0
- package/dist-cjs/ask-user-interaction.js +27 -0
- package/dist-cjs/cache/web-cache.d.ts +52 -0
- package/dist-cjs/cache/web-cache.js +70 -0
- package/dist-cjs/definitions/arion.d.ts +8 -0
- package/dist-cjs/definitions/arion.js +107 -0
- package/dist-cjs/definitions/browser/browser.d.ts +2 -0
- package/dist-cjs/definitions/browser/browser.js +421 -0
- package/dist-cjs/definitions/browser/index.d.ts +1 -0
- package/dist-cjs/definitions/browser/index.js +8 -0
- package/dist-cjs/definitions/browser/pw-downloads.d.ts +13 -0
- package/dist-cjs/definitions/browser/pw-downloads.js +117 -0
- package/dist-cjs/definitions/browser/pw-interactions.d.ts +78 -0
- package/dist-cjs/definitions/browser/pw-interactions.js +213 -0
- package/dist-cjs/definitions/browser/pw-responses.d.ts +28 -0
- package/dist-cjs/definitions/browser/pw-responses.js +84 -0
- package/dist-cjs/definitions/browser/pw-session.d.ts +65 -0
- package/dist-cjs/definitions/browser/pw-session.js +326 -0
- package/dist-cjs/definitions/browser/pw-shared.d.ts +22 -0
- package/dist-cjs/definitions/browser/pw-shared.js +72 -0
- package/dist-cjs/definitions/browser/pw-snapshot.d.ts +34 -0
- package/dist-cjs/definitions/browser/pw-snapshot.js +307 -0
- package/dist-cjs/definitions/browser/pw-state.d.ts +22 -0
- package/dist-cjs/definitions/browser/pw-state.js +70 -0
- package/dist-cjs/definitions/browser/types.d.ts +277 -0
- package/dist-cjs/definitions/browser/types.js +5 -0
- package/dist-cjs/definitions/code-intelligence.d.ts +8 -0
- package/dist-cjs/definitions/code-intelligence.js +473 -0
- package/dist-cjs/definitions/core.d.ts +47 -0
- package/dist-cjs/definitions/core.js +133 -0
- package/dist-cjs/definitions/delegation.d.ts +11 -0
- package/dist-cjs/definitions/delegation.js +515 -0
- package/dist-cjs/definitions/deploy.d.ts +15 -0
- package/dist-cjs/definitions/deploy.js +68 -0
- package/dist-cjs/definitions/filesystem.d.ts +9 -0
- package/dist-cjs/definitions/filesystem.js +199 -0
- package/dist-cjs/definitions/frg.d.ts +3 -0
- package/dist-cjs/definitions/frg.js +66 -0
- package/dist-cjs/definitions/index.d.ts +19 -0
- package/dist-cjs/definitions/index.js +43 -0
- package/dist-cjs/definitions/memory.d.ts +8 -0
- package/dist-cjs/definitions/memory.js +126 -0
- package/dist-cjs/definitions/messaging.d.ts +11 -0
- package/dist-cjs/definitions/messaging.js +631 -0
- package/dist-cjs/definitions/meta.d.ts +11 -0
- package/dist-cjs/definitions/meta.js +352 -0
- package/dist-cjs/definitions/network.d.ts +11 -0
- package/dist-cjs/definitions/network.js +162 -0
- package/dist-cjs/definitions/outlook.d.ts +2 -0
- package/dist-cjs/definitions/outlook.js +280 -0
- package/dist-cjs/definitions/patch/apply-patch.d.ts +11 -0
- package/dist-cjs/definitions/patch/apply-patch.js +191 -0
- package/dist-cjs/definitions/patch/fuzzy-match.d.ts +10 -0
- package/dist-cjs/definitions/patch/fuzzy-match.js +172 -0
- package/dist-cjs/definitions/patch/index.d.ts +1 -0
- package/dist-cjs/definitions/patch/index.js +5 -0
- package/dist-cjs/definitions/patch/patch-parser.d.ts +50 -0
- package/dist-cjs/definitions/patch/patch-parser.js +215 -0
- package/dist-cjs/definitions/patch/sandbox-paths.d.ts +18 -0
- package/dist-cjs/definitions/patch/sandbox-paths.js +113 -0
- package/dist-cjs/definitions/process/index.d.ts +1 -0
- package/dist-cjs/definitions/process/index.js +8 -0
- package/dist-cjs/definitions/process/process-registry.d.ts +67 -0
- package/dist-cjs/definitions/process/process-registry.js +231 -0
- package/dist-cjs/definitions/process/process.d.ts +9 -0
- package/dist-cjs/definitions/process/process.js +389 -0
- package/dist-cjs/definitions/process/pty-keys.d.ts +13 -0
- package/dist-cjs/definitions/process/pty-keys.js +259 -0
- package/dist-cjs/definitions/process/session-slug.d.ts +1 -0
- package/dist-cjs/definitions/process/session-slug.js +145 -0
- package/dist-cjs/definitions/quip.d.ts +2 -0
- package/dist-cjs/definitions/quip.js +198 -0
- package/dist-cjs/definitions/search.d.ts +9 -0
- package/dist-cjs/definitions/search.js +63 -0
- package/dist-cjs/definitions/session-history.d.ts +11 -0
- package/dist-cjs/definitions/session-history.js +72 -0
- package/dist-cjs/definitions/shell.d.ts +8 -0
- package/dist-cjs/definitions/shell.js +184 -0
- package/dist-cjs/definitions/slack.d.ts +2 -0
- package/dist-cjs/definitions/slack.js +183 -0
- package/dist-cjs/definitions/web.d.ts +8 -0
- package/dist-cjs/definitions/web.js +112 -0
- package/dist-cjs/executors/apply-patch.d.ts +51 -0
- package/dist-cjs/executors/apply-patch.js +938 -0
- package/dist-cjs/executors/arion.d.ts +50 -0
- package/dist-cjs/executors/arion.js +125 -0
- package/dist-cjs/executors/code-intelligence.d.ts +138 -0
- package/dist-cjs/executors/code-intelligence.js +925 -0
- package/dist-cjs/executors/deploy.d.ts +169 -0
- package/dist-cjs/executors/deploy.js +869 -0
- package/dist-cjs/executors/filesystem.d.ts +150 -0
- package/dist-cjs/executors/filesystem.js +1167 -0
- package/dist-cjs/executors/frg-freshness.d.ts +93 -0
- package/dist-cjs/executors/frg-freshness.js +627 -0
- package/dist-cjs/executors/frg.d.ts +27 -0
- package/dist-cjs/executors/frg.js +334 -0
- package/dist-cjs/executors/index.d.ts +44 -0
- package/dist-cjs/executors/index.js +143 -0
- package/dist-cjs/executors/learning-meta.d.ts +87 -0
- package/dist-cjs/executors/learning-meta.js +1165 -0
- package/dist-cjs/executors/lsp-client.d.ts +38 -0
- package/dist-cjs/executors/lsp-client.js +310 -0
- package/dist-cjs/executors/memory.d.ts +203 -0
- package/dist-cjs/executors/memory.js +796 -0
- package/dist-cjs/executors/meta.d.ts +73 -0
- package/dist-cjs/executors/meta.js +226 -0
- package/dist-cjs/executors/process-registry.d.ts +98 -0
- package/dist-cjs/executors/process-registry.js +469 -0
- package/dist-cjs/executors/pty-session-store.d.ts +14 -0
- package/dist-cjs/executors/pty-session-store.js +34 -0
- package/dist-cjs/executors/pty.d.ts +133 -0
- package/dist-cjs/executors/pty.js +312 -0
- package/dist-cjs/executors/restart.d.ts +13 -0
- package/dist-cjs/executors/restart.js +155 -0
- package/dist-cjs/executors/search-freshness.d.ts +50 -0
- package/dist-cjs/executors/search-freshness.js +234 -0
- package/dist-cjs/executors/search-types.d.ts +52 -0
- package/dist-cjs/executors/search-types.js +56 -0
- package/dist-cjs/executors/search.d.ts +11 -0
- package/dist-cjs/executors/search.js +102 -0
- package/dist-cjs/executors/self-diagnose.d.ts +89 -0
- package/dist-cjs/executors/self-diagnose.js +434 -0
- package/dist-cjs/executors/session-history.d.ts +75 -0
- package/dist-cjs/executors/session-history.js +320 -0
- package/dist-cjs/executors/shell-safety.d.ts +27 -0
- package/dist-cjs/executors/shell-safety.js +478 -0
- package/dist-cjs/executors/shell.d.ts +168 -0
- package/dist-cjs/executors/shell.js +1001 -0
- package/dist-cjs/executors/utils.d.ts +20 -0
- package/dist-cjs/executors/utils.js +73 -0
- package/dist-cjs/executors/web.d.ts +89 -0
- package/dist-cjs/executors/web.js +547 -0
- package/dist-cjs/extraction/content-extraction.d.ts +48 -0
- package/dist-cjs/extraction/content-extraction.js +243 -0
- package/dist-cjs/extraction/index.d.ts +4 -0
- package/dist-cjs/extraction/index.js +8 -0
- package/dist-cjs/headless-control-contract.d.ts +3182 -0
- package/dist-cjs/headless-control-contract.js +972 -0
- package/dist-cjs/index.d.ts +62 -0
- package/dist-cjs/index.js +437 -0
- package/dist-cjs/local-control-http-auth.d.ts +2 -0
- package/dist-cjs/local-control-http-auth.js +5 -0
- package/dist-cjs/mcp/client.d.ts +68 -0
- package/dist-cjs/mcp/client.js +185 -0
- package/dist-cjs/mcp/connection.d.ts +54 -0
- package/dist-cjs/mcp/connection.js +484 -0
- package/dist-cjs/mcp/index.d.ts +10 -0
- package/dist-cjs/mcp/index.js +30 -0
- package/dist-cjs/mcp/jsonrpc.d.ts +36 -0
- package/dist-cjs/mcp/jsonrpc.js +148 -0
- package/dist-cjs/mcp/types.d.ts +178 -0
- package/dist-cjs/mcp/types.js +8 -0
- package/dist-cjs/network-control-adapter.d.ts +4 -0
- package/dist-cjs/network-control-adapter.js +77 -0
- package/dist-cjs/network-runtime/address-types.d.ts +201 -0
- package/dist-cjs/network-runtime/address-types.js +168 -0
- package/dist-cjs/network-runtime/db-owner-fencing.d.ts +43 -0
- package/dist-cjs/network-runtime/db-owner-fencing.js +76 -0
- package/dist-cjs/network-runtime/delivery-receipts.d.ts +117 -0
- package/dist-cjs/network-runtime/delivery-receipts.js +276 -0
- package/dist-cjs/network-runtime/direct-endpoint-authority.d.ts +8 -0
- package/dist-cjs/network-runtime/direct-endpoint-authority.js +29 -0
- package/dist-cjs/network-runtime/index.d.ts +24 -0
- package/dist-cjs/network-runtime/index.js +172 -0
- package/dist-cjs/network-runtime/local-control-contract.d.ts +758 -0
- package/dist-cjs/network-runtime/local-control-contract.js +633 -0
- package/dist-cjs/network-runtime/node-store-contract.d.ts +49 -0
- package/dist-cjs/network-runtime/node-store-contract.js +38 -0
- package/dist-cjs/network-runtime/pair-route-contract.d.ts +100 -0
- package/dist-cjs/network-runtime/pair-route-contract.js +80 -0
- package/dist-cjs/network-runtime/peer-capabilities.d.ts +10 -0
- package/dist-cjs/network-runtime/peer-capabilities.js +37 -0
- package/dist-cjs/network-runtime/peer-principal-ref.d.ts +9 -0
- package/dist-cjs/network-runtime/peer-principal-ref.js +15 -0
- package/dist-cjs/network-runtime/peer-state-machine.d.ts +70 -0
- package/dist-cjs/network-runtime/peer-state-machine.js +129 -0
- package/dist-cjs/network-runtime/protocol-schemas.d.ts +328 -0
- package/dist-cjs/network-runtime/protocol-schemas.js +212 -0
- package/dist-cjs/network-runtime/runtime-bootstrap-contract.d.ts +81 -0
- package/dist-cjs/network-runtime/runtime-bootstrap-contract.js +63 -0
- package/dist-cjs/outlook/desktop-session.d.ts +68 -0
- package/dist-cjs/outlook/desktop-session.js +318 -0
- package/dist-cjs/package.json +3 -0
- package/dist-cjs/policy.d.ts +43 -0
- package/dist-cjs/policy.js +155 -0
- package/dist-cjs/providers/brave.d.ts +10 -0
- package/dist-cjs/providers/brave.js +66 -0
- package/dist-cjs/providers/duckduckgo.d.ts +18 -0
- package/dist-cjs/providers/duckduckgo.js +180 -0
- package/dist-cjs/providers/exa.d.ts +10 -0
- package/dist-cjs/providers/exa.js +67 -0
- package/dist-cjs/providers/firecrawl.d.ts +10 -0
- package/dist-cjs/providers/firecrawl.js +59 -0
- package/dist-cjs/providers/index.d.ts +8 -0
- package/dist-cjs/providers/index.js +17 -0
- package/dist-cjs/providers/jina.d.ts +10 -0
- package/dist-cjs/providers/jina.js +53 -0
- package/dist-cjs/providers/router.d.ts +21 -0
- package/dist-cjs/providers/router.js +100 -0
- package/dist-cjs/providers/search-provider.d.ts +35 -0
- package/dist-cjs/providers/search-provider.js +36 -0
- package/dist-cjs/providers/tavily.d.ts +10 -0
- package/dist-cjs/providers/tavily.js +58 -0
- package/dist-cjs/quip/desktop-session.d.ts +69 -0
- package/dist-cjs/quip/desktop-session.js +353 -0
- package/dist-cjs/registry/index.d.ts +1 -0
- package/dist-cjs/registry/index.js +6 -0
- package/dist-cjs/registry/registry.d.ts +156 -0
- package/dist-cjs/registry/registry.js +761 -0
- package/dist-cjs/runtime-socket-local-control-client.d.ts +10 -0
- package/dist-cjs/runtime-socket-local-control-client.js +367 -0
- package/dist-cjs/security/dns-normalization.d.ts +6 -0
- package/dist-cjs/security/dns-normalization.js +22 -0
- package/dist-cjs/security/dns-pinning.d.ts +27 -0
- package/dist-cjs/security/dns-pinning.js +160 -0
- package/dist-cjs/security/external-content.d.ts +40 -0
- package/dist-cjs/security/external-content.js +95 -0
- package/dist-cjs/security/ssrf.d.ts +40 -0
- package/dist-cjs/security/ssrf.js +221 -0
- package/dist-cjs/slack/desktop-session.d.ts +69 -0
- package/dist-cjs/slack/desktop-session.js +366 -0
- package/dist-cjs/tool-factory.d.ts +46 -0
- package/dist-cjs/tool-factory.js +50 -0
- package/dist-cjs/types.d.ts +1192 -0
- package/dist-cjs/types.js +8 -0
- package/dist-cjs/utils/retry.d.ts +11 -0
- package/dist-cjs/utils/retry.js +169 -0
- package/dist-cjs/utils/safe-parse-json.d.ts +26 -0
- package/dist-cjs/utils/safe-parse-json.js +164 -0
- package/dist-cjs/utils/url.d.ts +10 -0
- package/dist-cjs/utils/url.js +23 -0
- package/package.json +7 -6
- package/dist/ask-user-interaction.d.ts.map +0 -1
- package/dist/ask-user-interaction.js.map +0 -1
- package/dist/cache/web-cache.d.ts.map +0 -1
- package/dist/cache/web-cache.js.map +0 -1
- package/dist/definitions/arion.d.ts.map +0 -1
- package/dist/definitions/arion.js.map +0 -1
- package/dist/definitions/browser/browser.d.ts.map +0 -1
- package/dist/definitions/browser/browser.js.map +0 -1
- package/dist/definitions/browser/index.d.ts.map +0 -1
- package/dist/definitions/browser/index.js.map +0 -1
- package/dist/definitions/browser/pw-downloads.d.ts.map +0 -1
- package/dist/definitions/browser/pw-downloads.js.map +0 -1
- package/dist/definitions/browser/pw-interactions.d.ts.map +0 -1
- package/dist/definitions/browser/pw-interactions.js.map +0 -1
- package/dist/definitions/browser/pw-responses.d.ts.map +0 -1
- package/dist/definitions/browser/pw-responses.js.map +0 -1
- package/dist/definitions/browser/pw-session.d.ts.map +0 -1
- package/dist/definitions/browser/pw-session.js.map +0 -1
- package/dist/definitions/browser/pw-shared.d.ts.map +0 -1
- package/dist/definitions/browser/pw-shared.js.map +0 -1
- package/dist/definitions/browser/pw-snapshot.d.ts.map +0 -1
- package/dist/definitions/browser/pw-snapshot.js.map +0 -1
- package/dist/definitions/browser/pw-state.d.ts.map +0 -1
- package/dist/definitions/browser/pw-state.js.map +0 -1
- package/dist/definitions/browser/types.d.ts.map +0 -1
- package/dist/definitions/browser/types.js.map +0 -1
- package/dist/definitions/code-intelligence.d.ts.map +0 -1
- package/dist/definitions/code-intelligence.js.map +0 -1
- package/dist/definitions/core.d.ts.map +0 -1
- package/dist/definitions/core.js.map +0 -1
- package/dist/definitions/delegation.d.ts.map +0 -1
- package/dist/definitions/delegation.js.map +0 -1
- package/dist/definitions/deploy.d.ts.map +0 -1
- package/dist/definitions/deploy.js.map +0 -1
- package/dist/definitions/filesystem.d.ts.map +0 -1
- package/dist/definitions/filesystem.js.map +0 -1
- package/dist/definitions/frg.d.ts.map +0 -1
- package/dist/definitions/frg.js.map +0 -1
- package/dist/definitions/index.d.ts.map +0 -1
- package/dist/definitions/index.js.map +0 -1
- package/dist/definitions/memory.d.ts.map +0 -1
- package/dist/definitions/memory.js.map +0 -1
- package/dist/definitions/messaging.d.ts.map +0 -1
- package/dist/definitions/messaging.js.map +0 -1
- package/dist/definitions/meta.d.ts.map +0 -1
- package/dist/definitions/meta.js.map +0 -1
- package/dist/definitions/network.d.ts.map +0 -1
- package/dist/definitions/network.js.map +0 -1
- package/dist/definitions/outlook.d.ts.map +0 -1
- package/dist/definitions/outlook.js.map +0 -1
- package/dist/definitions/patch/apply-patch.d.ts.map +0 -1
- package/dist/definitions/patch/apply-patch.js.map +0 -1
- package/dist/definitions/patch/fuzzy-match.d.ts.map +0 -1
- package/dist/definitions/patch/fuzzy-match.js.map +0 -1
- package/dist/definitions/patch/index.d.ts.map +0 -1
- package/dist/definitions/patch/index.js.map +0 -1
- package/dist/definitions/patch/patch-parser.d.ts.map +0 -1
- package/dist/definitions/patch/patch-parser.js.map +0 -1
- package/dist/definitions/patch/sandbox-paths.d.ts.map +0 -1
- package/dist/definitions/patch/sandbox-paths.js.map +0 -1
- package/dist/definitions/process/index.d.ts.map +0 -1
- package/dist/definitions/process/index.js.map +0 -1
- package/dist/definitions/process/process-registry.d.ts.map +0 -1
- package/dist/definitions/process/process-registry.js.map +0 -1
- package/dist/definitions/process/process.d.ts.map +0 -1
- package/dist/definitions/process/process.js.map +0 -1
- package/dist/definitions/process/pty-keys.d.ts.map +0 -1
- package/dist/definitions/process/pty-keys.js.map +0 -1
- package/dist/definitions/process/session-slug.d.ts.map +0 -1
- package/dist/definitions/process/session-slug.js.map +0 -1
- package/dist/definitions/quip.d.ts.map +0 -1
- package/dist/definitions/quip.js.map +0 -1
- package/dist/definitions/search.d.ts.map +0 -1
- package/dist/definitions/search.js.map +0 -1
- package/dist/definitions/session-history.d.ts.map +0 -1
- package/dist/definitions/session-history.js.map +0 -1
- package/dist/definitions/shell.d.ts.map +0 -1
- package/dist/definitions/shell.js.map +0 -1
- package/dist/definitions/slack.d.ts.map +0 -1
- package/dist/definitions/slack.js.map +0 -1
- package/dist/definitions/web.d.ts.map +0 -1
- package/dist/definitions/web.js.map +0 -1
- package/dist/executors/apply-patch.d.ts.map +0 -1
- package/dist/executors/apply-patch.js.map +0 -1
- package/dist/executors/arion.d.ts.map +0 -1
- package/dist/executors/arion.js.map +0 -1
- package/dist/executors/code-intelligence.d.ts.map +0 -1
- package/dist/executors/code-intelligence.js.map +0 -1
- package/dist/executors/deploy.d.ts.map +0 -1
- package/dist/executors/deploy.js.map +0 -1
- package/dist/executors/filesystem.d.ts.map +0 -1
- package/dist/executors/filesystem.js.map +0 -1
- package/dist/executors/frg-freshness.d.ts.map +0 -1
- package/dist/executors/frg-freshness.js.map +0 -1
- package/dist/executors/frg.d.ts.map +0 -1
- package/dist/executors/frg.js.map +0 -1
- package/dist/executors/index.d.ts.map +0 -1
- package/dist/executors/index.js.map +0 -1
- package/dist/executors/learning-meta.d.ts.map +0 -1
- package/dist/executors/learning-meta.js.map +0 -1
- package/dist/executors/lsp-client.d.ts.map +0 -1
- package/dist/executors/lsp-client.js.map +0 -1
- package/dist/executors/memory.d.ts.map +0 -1
- package/dist/executors/memory.js.map +0 -1
- package/dist/executors/meta.d.ts.map +0 -1
- package/dist/executors/meta.js.map +0 -1
- package/dist/executors/process-registry.d.ts.map +0 -1
- package/dist/executors/process-registry.js.map +0 -1
- package/dist/executors/pty-session-store.d.ts.map +0 -1
- package/dist/executors/pty-session-store.js.map +0 -1
- package/dist/executors/pty.d.ts.map +0 -1
- package/dist/executors/pty.js.map +0 -1
- package/dist/executors/restart.d.ts.map +0 -1
- package/dist/executors/restart.js.map +0 -1
- package/dist/executors/search-freshness.d.ts.map +0 -1
- package/dist/executors/search-freshness.js.map +0 -1
- package/dist/executors/search-types.d.ts.map +0 -1
- package/dist/executors/search-types.js.map +0 -1
- package/dist/executors/search.d.ts.map +0 -1
- package/dist/executors/search.js.map +0 -1
- package/dist/executors/self-diagnose.d.ts.map +0 -1
- package/dist/executors/self-diagnose.js.map +0 -1
- package/dist/executors/session-history.d.ts.map +0 -1
- package/dist/executors/session-history.js.map +0 -1
- package/dist/executors/shell-safety.d.ts.map +0 -1
- package/dist/executors/shell-safety.js.map +0 -1
- package/dist/executors/shell.d.ts.map +0 -1
- package/dist/executors/shell.js.map +0 -1
- package/dist/executors/utils.d.ts.map +0 -1
- package/dist/executors/utils.js.map +0 -1
- package/dist/executors/web.d.ts.map +0 -1
- package/dist/executors/web.js.map +0 -1
- package/dist/extraction/content-extraction.d.ts.map +0 -1
- package/dist/extraction/content-extraction.js.map +0 -1
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/index.js.map +0 -1
- package/dist/headless-control-contract.d.ts.map +0 -1
- package/dist/headless-control-contract.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/local-control-http-auth.d.ts.map +0 -1
- package/dist/local-control-http-auth.js.map +0 -1
- package/dist/mcp/client.d.ts.map +0 -1
- package/dist/mcp/client.js.map +0 -1
- package/dist/mcp/connection.d.ts.map +0 -1
- package/dist/mcp/connection.js.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/jsonrpc.d.ts.map +0 -1
- package/dist/mcp/jsonrpc.js.map +0 -1
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js.map +0 -1
- package/dist/network-control-adapter.d.ts.map +0 -1
- package/dist/network-control-adapter.js.map +0 -1
- package/dist/network-runtime/address-types.d.ts.map +0 -1
- package/dist/network-runtime/address-types.js.map +0 -1
- package/dist/network-runtime/db-owner-fencing.d.ts.map +0 -1
- package/dist/network-runtime/db-owner-fencing.js.map +0 -1
- package/dist/network-runtime/delivery-receipts.d.ts.map +0 -1
- package/dist/network-runtime/delivery-receipts.js.map +0 -1
- package/dist/network-runtime/direct-endpoint-authority.d.ts.map +0 -1
- package/dist/network-runtime/direct-endpoint-authority.js.map +0 -1
- package/dist/network-runtime/index.d.ts.map +0 -1
- package/dist/network-runtime/index.js.map +0 -1
- package/dist/network-runtime/local-control-contract.d.ts.map +0 -1
- package/dist/network-runtime/local-control-contract.js.map +0 -1
- package/dist/network-runtime/node-store-contract.d.ts.map +0 -1
- package/dist/network-runtime/node-store-contract.js.map +0 -1
- package/dist/network-runtime/pair-route-contract.d.ts.map +0 -1
- package/dist/network-runtime/pair-route-contract.js.map +0 -1
- package/dist/network-runtime/peer-capabilities.d.ts.map +0 -1
- package/dist/network-runtime/peer-capabilities.js.map +0 -1
- package/dist/network-runtime/peer-principal-ref.d.ts.map +0 -1
- package/dist/network-runtime/peer-principal-ref.js.map +0 -1
- package/dist/network-runtime/peer-state-machine.d.ts.map +0 -1
- package/dist/network-runtime/peer-state-machine.js.map +0 -1
- package/dist/network-runtime/protocol-schemas.d.ts.map +0 -1
- package/dist/network-runtime/protocol-schemas.js.map +0 -1
- package/dist/network-runtime/runtime-bootstrap-contract.d.ts.map +0 -1
- package/dist/network-runtime/runtime-bootstrap-contract.js.map +0 -1
- package/dist/outlook/desktop-session.d.ts.map +0 -1
- package/dist/outlook/desktop-session.js.map +0 -1
- package/dist/policy.d.ts.map +0 -1
- package/dist/policy.js.map +0 -1
- package/dist/providers/brave.d.ts.map +0 -1
- package/dist/providers/brave.js.map +0 -1
- package/dist/providers/duckduckgo.d.ts.map +0 -1
- package/dist/providers/duckduckgo.js.map +0 -1
- package/dist/providers/exa.d.ts.map +0 -1
- package/dist/providers/exa.js.map +0 -1
- package/dist/providers/firecrawl.d.ts.map +0 -1
- package/dist/providers/firecrawl.js.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/jina.d.ts.map +0 -1
- package/dist/providers/jina.js.map +0 -1
- package/dist/providers/router.d.ts.map +0 -1
- package/dist/providers/router.js.map +0 -1
- package/dist/providers/search-provider.d.ts.map +0 -1
- package/dist/providers/search-provider.js.map +0 -1
- package/dist/providers/tavily.d.ts.map +0 -1
- package/dist/providers/tavily.js.map +0 -1
- package/dist/quip/desktop-session.d.ts.map +0 -1
- package/dist/quip/desktop-session.js.map +0 -1
- package/dist/registry/index.d.ts.map +0 -1
- package/dist/registry/index.js.map +0 -1
- package/dist/registry/registry.d.ts.map +0 -1
- package/dist/registry/registry.js.map +0 -1
- package/dist/runtime-socket-local-control-client.d.ts.map +0 -1
- package/dist/runtime-socket-local-control-client.js.map +0 -1
- package/dist/security/dns-normalization.d.ts.map +0 -1
- package/dist/security/dns-normalization.js.map +0 -1
- package/dist/security/dns-pinning.d.ts.map +0 -1
- package/dist/security/dns-pinning.js.map +0 -1
- package/dist/security/external-content.d.ts.map +0 -1
- package/dist/security/external-content.js.map +0 -1
- package/dist/security/ssrf.d.ts.map +0 -1
- package/dist/security/ssrf.js.map +0 -1
- package/dist/slack/desktop-session.d.ts.map +0 -1
- package/dist/slack/desktop-session.js.map +0 -1
- package/dist/tool-factory.d.ts.map +0 -1
- package/dist/tool-factory.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/retry.d.ts.map +0 -1
- package/dist/utils/retry.js.map +0 -1
- package/dist/utils/safe-parse-json.d.ts.map +0 -1
- package/dist/utils/safe-parse-json.js.map +0 -1
- package/dist/utils/url.d.ts.map +0 -1
- package/dist/utils/url.js.map +0 -1
|
@@ -0,0 +1,925 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @aria/tools - Code intelligence executors
|
|
4
|
+
*
|
|
5
|
+
* 7 native tools wrapping external CLI binaries:
|
|
6
|
+
* rg (ripgrep), ug (ugrep), probe, sg (ast-grep),
|
|
7
|
+
* cbm (codebase-memory-mcp), serena, fff
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.executeRg = executeRg;
|
|
44
|
+
exports.executeUg = executeUg;
|
|
45
|
+
exports.executeProbe = executeProbe;
|
|
46
|
+
exports.executeSg = executeSg;
|
|
47
|
+
exports.executeCbm = executeCbm;
|
|
48
|
+
exports.executeLsp = executeLsp;
|
|
49
|
+
exports.executeSerena = executeSerena;
|
|
50
|
+
exports.executeFff = executeFff;
|
|
51
|
+
const node_child_process_1 = require("node:child_process");
|
|
52
|
+
const node_util_1 = require("node:util");
|
|
53
|
+
const node_fs_1 = require("node:fs");
|
|
54
|
+
const node_path_1 = require("node:path");
|
|
55
|
+
const node_net_1 = require("node:net");
|
|
56
|
+
const utils_js_1 = require("./utils.js");
|
|
57
|
+
const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// Shared helpers
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
const binaryCache = new Map();
|
|
62
|
+
async function hasBinary(name) {
|
|
63
|
+
if (binaryCache.has(name))
|
|
64
|
+
return binaryCache.get(name);
|
|
65
|
+
try {
|
|
66
|
+
await execFileAsync("which", [name]);
|
|
67
|
+
binaryCache.set(name, true);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
binaryCache.set(name, false);
|
|
71
|
+
}
|
|
72
|
+
return binaryCache.get(name);
|
|
73
|
+
}
|
|
74
|
+
async function shellExec(cmd, args, opts) {
|
|
75
|
+
return execFileAsync(cmd, args, {
|
|
76
|
+
cwd: opts.cwd,
|
|
77
|
+
timeout: opts.timeout ?? 30_000,
|
|
78
|
+
signal: opts.signal,
|
|
79
|
+
maxBuffer: 10 * 1024 * 1024, // 10MB
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function pushIf(args, condition, ...flags) {
|
|
83
|
+
if (condition)
|
|
84
|
+
args.push(...flags);
|
|
85
|
+
}
|
|
86
|
+
function mergeExtraArgs(args, extra) {
|
|
87
|
+
if (extra?.length)
|
|
88
|
+
args.push(...extra);
|
|
89
|
+
}
|
|
90
|
+
function escapeRegex(str) {
|
|
91
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
92
|
+
}
|
|
93
|
+
function asExecError(err) {
|
|
94
|
+
if (err && typeof err === "object")
|
|
95
|
+
return err;
|
|
96
|
+
return { message: String(err) };
|
|
97
|
+
}
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
// 1. rg — ripgrep
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
async function executeRg(input, ctx) {
|
|
102
|
+
if (ctx.abortSignal?.aborted)
|
|
103
|
+
return (0, utils_js_1.fail)("Operation cancelled");
|
|
104
|
+
if (!(await hasBinary("rg")))
|
|
105
|
+
return (0, utils_js_1.fail)("ripgrep (rg) not installed. Install: brew install ripgrep");
|
|
106
|
+
// When count mode is active, rg -c outputs plain text (file:count) even with --json.
|
|
107
|
+
// We omit --json and parse the plain-text output instead.
|
|
108
|
+
const rgCountMode = !!input.count;
|
|
109
|
+
const args = rgCountMode
|
|
110
|
+
? ["--line-number", "--color", "never"]
|
|
111
|
+
: ["--json", "--line-number", "--color", "never"];
|
|
112
|
+
pushIf(args, input.ignore_case, "-i");
|
|
113
|
+
pushIf(args, input.smart_case, "-S");
|
|
114
|
+
pushIf(args, input.fixed_strings, "-F");
|
|
115
|
+
pushIf(args, input.word_regexp, "-w");
|
|
116
|
+
pushIf(args, input.invert, "-v");
|
|
117
|
+
pushIf(args, input.files_only, "-l");
|
|
118
|
+
pushIf(args, input.count, "-c");
|
|
119
|
+
if (input.file_type)
|
|
120
|
+
args.push("-t", input.file_type);
|
|
121
|
+
if (input.glob)
|
|
122
|
+
args.push("-g", input.glob);
|
|
123
|
+
if (input.context != null)
|
|
124
|
+
args.push("-C", String(input.context));
|
|
125
|
+
if (input.max_count != null)
|
|
126
|
+
args.push("-m", String(input.max_count));
|
|
127
|
+
mergeExtraArgs(args, input.extra_args);
|
|
128
|
+
args.push("--", input.pattern);
|
|
129
|
+
args.push(input.path ?? ctx.workingDir);
|
|
130
|
+
try {
|
|
131
|
+
const { stdout } = await shellExec("rg", args, {
|
|
132
|
+
cwd: ctx.workingDir,
|
|
133
|
+
signal: ctx.abortSignal,
|
|
134
|
+
});
|
|
135
|
+
if (rgCountMode) {
|
|
136
|
+
const counts = parseRipgrepCount(stdout);
|
|
137
|
+
const total = counts.reduce((s, c) => s + c.count, 0);
|
|
138
|
+
return (0, utils_js_1.success)(`Found ${total} matches across ${counts.length} files for "${input.pattern}"`, { counts, total });
|
|
139
|
+
}
|
|
140
|
+
const matches = parseRipgrepJson(stdout);
|
|
141
|
+
return (0, utils_js_1.success)(`Found ${matches.length} matches for "${input.pattern}"`, { matches });
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
const e = asExecError(err);
|
|
145
|
+
if (e.code === 1)
|
|
146
|
+
return (0, utils_js_1.success)("No matches found", { matches: [] });
|
|
147
|
+
return (0, utils_js_1.fail)(`rg failed: ${e.stderr || e.message}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function parseRipgrepJson(stdout) {
|
|
151
|
+
const matches = [];
|
|
152
|
+
for (const line of stdout.split("\n")) {
|
|
153
|
+
if (!line.trim())
|
|
154
|
+
continue;
|
|
155
|
+
try {
|
|
156
|
+
const obj = JSON.parse(line);
|
|
157
|
+
if (obj.type === "match") {
|
|
158
|
+
matches.push({
|
|
159
|
+
file: obj.data.path.text,
|
|
160
|
+
line: obj.data.line_number,
|
|
161
|
+
text: obj.data.lines.text.trimEnd(),
|
|
162
|
+
submatches: obj.data.submatches?.map((s) => s.match?.text) ?? [],
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// Skip malformed lines
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return matches;
|
|
171
|
+
}
|
|
172
|
+
/** Parse rg/ug plain-text count output: `file:count` per line.
|
|
173
|
+
* Filters out files with 0 matches (ug -c outputs 0-count lines, rg doesn't). */
|
|
174
|
+
function parseRipgrepCount(stdout) {
|
|
175
|
+
const counts = [];
|
|
176
|
+
for (const line of stdout.split("\n")) {
|
|
177
|
+
if (!line.trim())
|
|
178
|
+
continue;
|
|
179
|
+
const lastColon = line.lastIndexOf(":");
|
|
180
|
+
if (lastColon === -1)
|
|
181
|
+
continue;
|
|
182
|
+
const file = line.slice(0, lastColon);
|
|
183
|
+
const count = parseInt(line.slice(lastColon + 1), 10);
|
|
184
|
+
if (!isNaN(count) && count > 0)
|
|
185
|
+
counts.push({ file, count });
|
|
186
|
+
}
|
|
187
|
+
return counts;
|
|
188
|
+
}
|
|
189
|
+
// ---------------------------------------------------------------------------
|
|
190
|
+
// 2. ug — ugrep
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
async function executeUg(input, ctx) {
|
|
193
|
+
if (ctx.abortSignal?.aborted)
|
|
194
|
+
return (0, utils_js_1.fail)("Operation cancelled");
|
|
195
|
+
if (!(await hasBinary("ug")))
|
|
196
|
+
return (0, utils_js_1.fail)("ugrep (ug) not installed. Install: brew install ugrep");
|
|
197
|
+
// --ignore-files: respect .gitignore / .ignore (parity with rg default behaviour).
|
|
198
|
+
// --ignore-binary: skip binary files (tar, images, etc.) — rg skips them by default.
|
|
199
|
+
// Without these flags ug searches dist/, node_modules/, .tar archives, etc.
|
|
200
|
+
const ugCountMode = !!input.count;
|
|
201
|
+
const args = ugCountMode
|
|
202
|
+
? ["--line-number", "--color=never", "-r", "--ignore-files", "--ignore-binary"]
|
|
203
|
+
: ["--json", "--line-number", "--color=never", "-r", "--ignore-files", "--ignore-binary"];
|
|
204
|
+
pushIf(args, input.ignore_case, "-i");
|
|
205
|
+
pushIf(args, input.smart_case, "-j");
|
|
206
|
+
pushIf(args, input.fixed_strings, "-F");
|
|
207
|
+
pushIf(args, input.word_regexp, "-w");
|
|
208
|
+
pushIf(args, input.files_only, "-l");
|
|
209
|
+
pushIf(args, input.count, "-c");
|
|
210
|
+
pushIf(args, input.decompress, "-z");
|
|
211
|
+
if (input.file_type)
|
|
212
|
+
args.push("-t", input.file_type);
|
|
213
|
+
if (input.glob)
|
|
214
|
+
args.push("-g", input.glob);
|
|
215
|
+
if (input.context != null)
|
|
216
|
+
args.push("-C", String(input.context));
|
|
217
|
+
if (input.max_count != null)
|
|
218
|
+
args.push("-m", String(input.max_count));
|
|
219
|
+
if (input.neg_pattern)
|
|
220
|
+
args.push("-N", input.neg_pattern);
|
|
221
|
+
// Fuzzy matching
|
|
222
|
+
if (input.fuzzy === true) {
|
|
223
|
+
args.push("-Z");
|
|
224
|
+
}
|
|
225
|
+
else if (typeof input.fuzzy === "number") {
|
|
226
|
+
args.push(`-Z${input.fuzzy}`);
|
|
227
|
+
}
|
|
228
|
+
// Boolean query mode
|
|
229
|
+
if (input.bool)
|
|
230
|
+
args.push("-%%");
|
|
231
|
+
mergeExtraArgs(args, input.extra_args);
|
|
232
|
+
args.push("--", input.pattern);
|
|
233
|
+
args.push(input.path ?? ctx.workingDir);
|
|
234
|
+
try {
|
|
235
|
+
const { stdout } = await shellExec("ug", args, {
|
|
236
|
+
cwd: ctx.workingDir,
|
|
237
|
+
signal: ctx.abortSignal,
|
|
238
|
+
});
|
|
239
|
+
if (ugCountMode) {
|
|
240
|
+
const counts = parseRipgrepCount(stdout); // same file:count format
|
|
241
|
+
const total = counts.reduce((s, c) => s + c.count, 0);
|
|
242
|
+
return (0, utils_js_1.success)(`Found ${total} matches across ${counts.length} files for "${input.pattern}"`, { counts, total });
|
|
243
|
+
}
|
|
244
|
+
const matches = parseUgrepJson(stdout);
|
|
245
|
+
return (0, utils_js_1.success)(`Found ${matches.length} matches for "${input.pattern}"`, { matches });
|
|
246
|
+
}
|
|
247
|
+
catch (err) {
|
|
248
|
+
const e = asExecError(err);
|
|
249
|
+
if (e.code === 1)
|
|
250
|
+
return (0, utils_js_1.success)("No matches found", { matches: [] });
|
|
251
|
+
return (0, utils_js_1.fail)(`ug failed: ${e.stderr || e.message}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function parseUgrepJson(stdout) {
|
|
255
|
+
// ugrep --json outputs: [{ file, matches: [{ line, match }] }]
|
|
256
|
+
// This is a JSON array, NOT NDJSON like ripgrep
|
|
257
|
+
const results = [];
|
|
258
|
+
try {
|
|
259
|
+
const parsed = JSON.parse(stdout);
|
|
260
|
+
for (const fileGroup of parsed) {
|
|
261
|
+
for (const m of fileGroup.matches) {
|
|
262
|
+
results.push({
|
|
263
|
+
file: fileGroup.file,
|
|
264
|
+
line: m.line,
|
|
265
|
+
text: m.match.trimEnd(),
|
|
266
|
+
submatches: [],
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
// Fallback: try NDJSON parsing in case format varies
|
|
273
|
+
for (const line of stdout.split("\n")) {
|
|
274
|
+
if (!line.trim())
|
|
275
|
+
continue;
|
|
276
|
+
try {
|
|
277
|
+
const obj = JSON.parse(line);
|
|
278
|
+
if (obj.file && obj.matches) {
|
|
279
|
+
for (const m of obj.matches) {
|
|
280
|
+
results.push({
|
|
281
|
+
file: obj.file,
|
|
282
|
+
line: m.line,
|
|
283
|
+
text: m.match?.trimEnd() ?? "",
|
|
284
|
+
submatches: [],
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
// Skip
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return results;
|
|
295
|
+
}
|
|
296
|
+
// ---------------------------------------------------------------------------
|
|
297
|
+
// 3. probe
|
|
298
|
+
// ---------------------------------------------------------------------------
|
|
299
|
+
async function executeProbe(input, ctx) {
|
|
300
|
+
if (ctx.abortSignal?.aborted)
|
|
301
|
+
return (0, utils_js_1.fail)("Operation cancelled");
|
|
302
|
+
if (!(await hasBinary("probe")))
|
|
303
|
+
return (0, utils_js_1.fail)("probe not installed. Install: npm install -g @probelabs/probe");
|
|
304
|
+
const cmd = input.command ?? "search";
|
|
305
|
+
const args = [cmd];
|
|
306
|
+
switch (cmd) {
|
|
307
|
+
case "search": {
|
|
308
|
+
if (!input.query)
|
|
309
|
+
return (0, utils_js_1.fail)("query required for search");
|
|
310
|
+
pushIf(args, input.exact, "--exact");
|
|
311
|
+
pushIf(args, input.allow_tests, "--allow-tests");
|
|
312
|
+
if (input.max_tokens != null)
|
|
313
|
+
args.push("--max-tokens", String(input.max_tokens));
|
|
314
|
+
if (input.max_results != null)
|
|
315
|
+
args.push("--max-results", String(input.max_results));
|
|
316
|
+
if (input.session)
|
|
317
|
+
args.push("--session", input.session);
|
|
318
|
+
if (input.language)
|
|
319
|
+
args.push("--language", input.language);
|
|
320
|
+
if (input.reranker)
|
|
321
|
+
args.push("--reranker", input.reranker);
|
|
322
|
+
args.push("--format", "json");
|
|
323
|
+
mergeExtraArgs(args, input.extra_args);
|
|
324
|
+
args.push("--", input.query);
|
|
325
|
+
if (input.path)
|
|
326
|
+
args.push(input.path);
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
case "extract": {
|
|
330
|
+
if (!input.files?.length)
|
|
331
|
+
return (0, utils_js_1.fail)("files required for extract");
|
|
332
|
+
args.push("--format", "json");
|
|
333
|
+
mergeExtraArgs(args, input.extra_args);
|
|
334
|
+
args.push(...input.files);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
case "symbols": {
|
|
338
|
+
// Accept files via `files` array or fall back to `query` as a file path
|
|
339
|
+
const symbolFiles = input.files?.length ? input.files : input.query ? [input.query] : [];
|
|
340
|
+
if (!symbolFiles.length)
|
|
341
|
+
return (0, utils_js_1.fail)("files required for symbols (pass via 'files' or 'query')");
|
|
342
|
+
args.push("--format", "json");
|
|
343
|
+
mergeExtraArgs(args, input.extra_args);
|
|
344
|
+
args.push(...symbolFiles);
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
case "query": {
|
|
348
|
+
if (!input.query)
|
|
349
|
+
return (0, utils_js_1.fail)("query (AST pattern) required for query command");
|
|
350
|
+
if (input.language)
|
|
351
|
+
args.push("--language", input.language);
|
|
352
|
+
if (input.max_results != null)
|
|
353
|
+
args.push("--max-results", String(input.max_results));
|
|
354
|
+
pushIf(args, input.allow_tests, "--allow-tests");
|
|
355
|
+
args.push("--format", "json");
|
|
356
|
+
mergeExtraArgs(args, input.extra_args);
|
|
357
|
+
args.push("--", input.query);
|
|
358
|
+
if (input.path)
|
|
359
|
+
args.push(input.path);
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
try {
|
|
364
|
+
const { stdout } = await shellExec("probe", args, {
|
|
365
|
+
cwd: ctx.workingDir,
|
|
366
|
+
signal: ctx.abortSignal,
|
|
367
|
+
timeout: 60_000,
|
|
368
|
+
});
|
|
369
|
+
try {
|
|
370
|
+
const data = JSON.parse(stdout);
|
|
371
|
+
return (0, utils_js_1.success)(`probe ${cmd} completed`, data);
|
|
372
|
+
}
|
|
373
|
+
catch {
|
|
374
|
+
// If not valid JSON, return raw output
|
|
375
|
+
return (0, utils_js_1.success)(`probe ${cmd} completed`, { raw: stdout });
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
catch (err) {
|
|
379
|
+
const e = asExecError(err);
|
|
380
|
+
return (0, utils_js_1.fail)(`probe ${cmd} failed: ${e.stderr || e.message}`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// ---------------------------------------------------------------------------
|
|
384
|
+
// 4. sg — ast-grep
|
|
385
|
+
// ---------------------------------------------------------------------------
|
|
386
|
+
async function executeSg(input, ctx) {
|
|
387
|
+
if (ctx.abortSignal?.aborted)
|
|
388
|
+
return (0, utils_js_1.fail)("Operation cancelled");
|
|
389
|
+
if (!(await hasBinary("sg")))
|
|
390
|
+
return (0, utils_js_1.fail)("ast-grep (sg) not installed. Install: cargo install ast-grep --locked");
|
|
391
|
+
const cmd = input.command ?? "run";
|
|
392
|
+
const isMutation = !!(input.rewrite || input.update_all);
|
|
393
|
+
// Require confirmation for mutations
|
|
394
|
+
if (isMutation && !input.update_all && ctx.confirm) {
|
|
395
|
+
const approved = await ctx.confirm(`Rewrite code matching \`${input.pattern}\` to \`${input.rewrite}\` in ${input.language || "auto-detected"} files?`);
|
|
396
|
+
if (!approved)
|
|
397
|
+
return (0, utils_js_1.fail)("Rewrite cancelled by user");
|
|
398
|
+
}
|
|
399
|
+
const args = [cmd];
|
|
400
|
+
if (cmd === "run") {
|
|
401
|
+
if (!input.pattern)
|
|
402
|
+
return (0, utils_js_1.fail)("pattern required for sg run");
|
|
403
|
+
args.push("--pattern", input.pattern);
|
|
404
|
+
if (input.language)
|
|
405
|
+
args.push("--lang", input.language);
|
|
406
|
+
if (input.rewrite)
|
|
407
|
+
args.push("--rewrite", input.rewrite);
|
|
408
|
+
if (input.strictness)
|
|
409
|
+
args.push("--strictness", input.strictness);
|
|
410
|
+
pushIf(args, input.update_all, "-U");
|
|
411
|
+
}
|
|
412
|
+
else if (cmd === "scan") {
|
|
413
|
+
if (input.rule)
|
|
414
|
+
args.push("--rule", input.rule);
|
|
415
|
+
if (input.inline_rules)
|
|
416
|
+
args.push("--inline-rules", input.inline_rules);
|
|
417
|
+
}
|
|
418
|
+
// Shared flags
|
|
419
|
+
if (input.globs)
|
|
420
|
+
args.push("--globs", input.globs);
|
|
421
|
+
if (input.context != null)
|
|
422
|
+
args.push("-C", String(input.context));
|
|
423
|
+
// Always JSON for machine parsing, skip color
|
|
424
|
+
if (!isMutation) {
|
|
425
|
+
args.push("--json=compact");
|
|
426
|
+
}
|
|
427
|
+
args.push("--color", "never");
|
|
428
|
+
mergeExtraArgs(args, input.extra_args);
|
|
429
|
+
args.push(input.path ?? ctx.workingDir);
|
|
430
|
+
try {
|
|
431
|
+
const { stdout } = await shellExec("sg", args, {
|
|
432
|
+
cwd: ctx.workingDir,
|
|
433
|
+
signal: ctx.abortSignal,
|
|
434
|
+
});
|
|
435
|
+
if (isMutation) {
|
|
436
|
+
return (0, utils_js_1.success)(`sg ${cmd}: rewrites applied`, { raw: stdout });
|
|
437
|
+
}
|
|
438
|
+
try {
|
|
439
|
+
const data = JSON.parse(stdout);
|
|
440
|
+
const count = Array.isArray(data) ? data.length : 0;
|
|
441
|
+
return (0, utils_js_1.success)(`Found ${count} matches`, { matches: data });
|
|
442
|
+
}
|
|
443
|
+
catch {
|
|
444
|
+
return (0, utils_js_1.success)(`sg ${cmd} completed`, { raw: stdout });
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
catch (err) {
|
|
448
|
+
// Exit code 1 = no matches for run
|
|
449
|
+
const e = asExecError(err);
|
|
450
|
+
if (e.code === 1 && cmd === "run")
|
|
451
|
+
return (0, utils_js_1.success)("No matches found", { matches: [] });
|
|
452
|
+
return (0, utils_js_1.fail)(`sg ${cmd} failed: ${e.stderr || e.message}`);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
// ---------------------------------------------------------------------------
|
|
456
|
+
// 5. cbm — codebase-memory-mcp
|
|
457
|
+
// ---------------------------------------------------------------------------
|
|
458
|
+
// Internal helper to call cbm CLI
|
|
459
|
+
async function cbmCall(tool, params, ctx, timeout) {
|
|
460
|
+
// Remove undefined/null values from params
|
|
461
|
+
const clean = {};
|
|
462
|
+
for (const [k, v] of Object.entries(params)) {
|
|
463
|
+
if (v !== undefined && v !== null)
|
|
464
|
+
clean[k] = v;
|
|
465
|
+
}
|
|
466
|
+
const { stdout } = await shellExec("codebase-memory-mcp", ["cli", tool, JSON.stringify(clean)], {
|
|
467
|
+
cwd: ctx.workingDir,
|
|
468
|
+
signal: ctx.abortSignal,
|
|
469
|
+
timeout: timeout ?? 30_000,
|
|
470
|
+
});
|
|
471
|
+
// cbm cli returns MCP content format: { content: [{ type: "text", text: "..." }] }
|
|
472
|
+
// Filter log lines (level=info ...) and parse
|
|
473
|
+
const jsonLines = stdout.split("\n").filter((l) => l.trim() && !l.startsWith("level="));
|
|
474
|
+
const parsed = JSON.parse(jsonLines.join("\n"));
|
|
475
|
+
if (Array.isArray(parsed.content)) {
|
|
476
|
+
const textBlocks = parsed.content
|
|
477
|
+
.filter((c) => c.type === "text")
|
|
478
|
+
.map((c) => c.text);
|
|
479
|
+
const combined = textBlocks.join("\n");
|
|
480
|
+
try {
|
|
481
|
+
return JSON.parse(combined);
|
|
482
|
+
}
|
|
483
|
+
catch {
|
|
484
|
+
return { text: combined };
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
return parsed;
|
|
488
|
+
}
|
|
489
|
+
async function executeCbm(input, ctx) {
|
|
490
|
+
if (ctx.abortSignal?.aborted)
|
|
491
|
+
return (0, utils_js_1.fail)("Operation cancelled");
|
|
492
|
+
if (!(await hasBinary("codebase-memory-mcp")))
|
|
493
|
+
return (0, utils_js_1.fail)("codebase-memory-mcp not installed. Install:\ncurl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/scripts/setup.sh | bash");
|
|
494
|
+
// Auto-detect project name: cbm slugifies repo_path by replacing / with -
|
|
495
|
+
// and stripping the leading separator: /Users/hole/aria → Users-hole-aria
|
|
496
|
+
const p = input.project ?? (input.path ?? ctx.workingDir).replace(/^\//, "").replace(/\//g, "-");
|
|
497
|
+
// Auto-index: if the action requires an indexed project and no project exists,
|
|
498
|
+
// transparently run a fast index first so queries don't silently return empty.
|
|
499
|
+
const queryActions = new Set([
|
|
500
|
+
"search",
|
|
501
|
+
"trace",
|
|
502
|
+
"impact",
|
|
503
|
+
"context",
|
|
504
|
+
"snippet",
|
|
505
|
+
"code_search",
|
|
506
|
+
"architecture",
|
|
507
|
+
"schema",
|
|
508
|
+
"cypher",
|
|
509
|
+
]);
|
|
510
|
+
if (queryActions.has(input.action)) {
|
|
511
|
+
let needsIndex = false;
|
|
512
|
+
try {
|
|
513
|
+
const statusResult = (await cbmCall("index_status", { project: p }, ctx));
|
|
514
|
+
// If status indicates no project or empty graph, auto-index
|
|
515
|
+
if (statusResult?.status === "no_project" ||
|
|
516
|
+
statusResult?.node_count === 0 ||
|
|
517
|
+
statusResult?.error) {
|
|
518
|
+
needsIndex = true;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
catch {
|
|
522
|
+
// index_status failed — likely no project
|
|
523
|
+
needsIndex = true;
|
|
524
|
+
}
|
|
525
|
+
if (needsIndex) {
|
|
526
|
+
try {
|
|
527
|
+
await cbmCall("index_repository", { repo_path: input.path ?? ctx.workingDir, mode: "full" }, ctx, 300_000);
|
|
528
|
+
}
|
|
529
|
+
catch {
|
|
530
|
+
// If auto-index fails, continue — let the actual action produce the error
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
switch (input.action) {
|
|
535
|
+
case "index":
|
|
536
|
+
return (0, utils_js_1.success)("Indexed", await cbmCall("index_repository", { repo_path: input.path ?? ctx.workingDir, mode: input.mode ?? "full" }, ctx, 300_000));
|
|
537
|
+
case "search":
|
|
538
|
+
return (0, utils_js_1.success)("Search results", await cbmCall("search_graph", {
|
|
539
|
+
project: p,
|
|
540
|
+
name_pattern: input.name,
|
|
541
|
+
label: input.label,
|
|
542
|
+
file_pattern: input.file,
|
|
543
|
+
limit: input.limit ?? 20,
|
|
544
|
+
}, ctx));
|
|
545
|
+
case "trace": {
|
|
546
|
+
if (!input.name)
|
|
547
|
+
return (0, utils_js_1.fail)("name required for trace");
|
|
548
|
+
return (0, utils_js_1.success)(`Call chain: ${input.name}`, await cbmCall("trace_call_path", {
|
|
549
|
+
project: p,
|
|
550
|
+
function_name: input.name,
|
|
551
|
+
direction: input.direction ?? "both",
|
|
552
|
+
depth: input.depth ?? 3,
|
|
553
|
+
edge_types: input.edge_types,
|
|
554
|
+
}, ctx));
|
|
555
|
+
}
|
|
556
|
+
case "impact":
|
|
557
|
+
return (0, utils_js_1.success)("Impact analysis", await cbmCall("detect_changes", {
|
|
558
|
+
project: p,
|
|
559
|
+
scope: input.scope,
|
|
560
|
+
depth: input.depth ?? 2,
|
|
561
|
+
base_branch: input.base_branch ?? "main",
|
|
562
|
+
}, ctx));
|
|
563
|
+
case "context": {
|
|
564
|
+
if (!input.name)
|
|
565
|
+
return (0, utils_js_1.fail)("name required for context");
|
|
566
|
+
const [sym, callers, callees] = await Promise.all([
|
|
567
|
+
cbmCall("search_graph", { project: p, name_pattern: `^${escapeRegex(input.name)}$`, limit: 1 }, ctx),
|
|
568
|
+
cbmCall("trace_call_path", { project: p, function_name: input.name, direction: "inbound", depth: 2 }, ctx),
|
|
569
|
+
cbmCall("trace_call_path", { project: p, function_name: input.name, direction: "outbound", depth: 2 }, ctx),
|
|
570
|
+
]);
|
|
571
|
+
return (0, utils_js_1.success)(`360° context: ${input.name}`, {
|
|
572
|
+
definition: sym.results?.[0],
|
|
573
|
+
callers,
|
|
574
|
+
callees,
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
case "snippet": {
|
|
578
|
+
if (!input.qualified_name)
|
|
579
|
+
return (0, utils_js_1.fail)("qualified_name required for snippet");
|
|
580
|
+
return (0, utils_js_1.success)("Code snippet", await cbmCall("get_code_snippet", {
|
|
581
|
+
project: p,
|
|
582
|
+
qualified_name: input.qualified_name,
|
|
583
|
+
include_neighbors: input.include_neighbors,
|
|
584
|
+
}, ctx));
|
|
585
|
+
}
|
|
586
|
+
case "code_search":
|
|
587
|
+
return (0, utils_js_1.success)("Code search", await cbmCall("search_code", {
|
|
588
|
+
project: p,
|
|
589
|
+
pattern: input.code_pattern,
|
|
590
|
+
mode: input.code_mode ?? "compact",
|
|
591
|
+
regex: input.regex,
|
|
592
|
+
limit: input.limit ?? 10,
|
|
593
|
+
file_pattern: input.file,
|
|
594
|
+
context: input.context,
|
|
595
|
+
}, ctx));
|
|
596
|
+
case "architecture":
|
|
597
|
+
return (0, utils_js_1.success)("Architecture", await cbmCall("get_architecture", { project: p }, ctx));
|
|
598
|
+
case "schema":
|
|
599
|
+
return (0, utils_js_1.success)("Schema", await cbmCall("get_graph_schema", { project: p }, ctx));
|
|
600
|
+
case "cypher": {
|
|
601
|
+
if (!input.query)
|
|
602
|
+
return (0, utils_js_1.fail)("query required for cypher");
|
|
603
|
+
return (0, utils_js_1.success)("Cypher result", await cbmCall("query_graph", { project: p, query: input.query, max_rows: input.max_rows }, ctx));
|
|
604
|
+
}
|
|
605
|
+
case "list_projects":
|
|
606
|
+
return (0, utils_js_1.success)("Projects", await cbmCall("list_projects", {}, ctx));
|
|
607
|
+
case "delete_project": {
|
|
608
|
+
if (!input.project)
|
|
609
|
+
return (0, utils_js_1.fail)("project required for delete_project");
|
|
610
|
+
if (ctx.confirm) {
|
|
611
|
+
const ok = await ctx.confirm(`Delete project "${input.project}" from cbm index?`);
|
|
612
|
+
if (!ok)
|
|
613
|
+
return (0, utils_js_1.fail)("Cancelled");
|
|
614
|
+
}
|
|
615
|
+
return (0, utils_js_1.success)("Deleted", await cbmCall("delete_project", { project: p }, ctx));
|
|
616
|
+
}
|
|
617
|
+
case "status":
|
|
618
|
+
return (0, utils_js_1.success)("Status", await cbmCall("index_status", { project: p }, ctx));
|
|
619
|
+
default:
|
|
620
|
+
return (0, utils_js_1.fail)(`Unknown cbm action: ${input.action}`);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
let _lspClient;
|
|
624
|
+
async function getLspClient() {
|
|
625
|
+
if (!_lspClient) {
|
|
626
|
+
// Use variable to prevent TypeScript from following the import in CJS build
|
|
627
|
+
const modulePath = "./lsp-client.js";
|
|
628
|
+
_lspClient = (await Promise.resolve(`${modulePath}`).then(s => __importStar(require(s))));
|
|
629
|
+
}
|
|
630
|
+
return _lspClient;
|
|
631
|
+
}
|
|
632
|
+
async function executeLsp(input, ctx) {
|
|
633
|
+
if (ctx.abortSignal?.aborted)
|
|
634
|
+
return (0, utils_js_1.fail)("Operation cancelled");
|
|
635
|
+
if (!input.file)
|
|
636
|
+
return (0, utils_js_1.fail)("file required");
|
|
637
|
+
const { getServerForFile, getOrCreateServer, LSP_SERVERS } = await getLspClient();
|
|
638
|
+
const serverName = getServerForFile(input.file);
|
|
639
|
+
if (!serverName) {
|
|
640
|
+
const ext = input.file.slice(input.file.lastIndexOf("."));
|
|
641
|
+
const supported = Object.entries(LSP_SERVERS)
|
|
642
|
+
.map(([name, cfg]) => `${name}: ${Object.keys(cfg.extensionToLanguage).join(", ")}`)
|
|
643
|
+
.join("\n ");
|
|
644
|
+
return (0, utils_js_1.fail)(`No language server for extension "${ext}". Supported:\n ${supported}`);
|
|
645
|
+
}
|
|
646
|
+
// Rename requires confirmation
|
|
647
|
+
if (input.action === "rename" && ctx.confirm) {
|
|
648
|
+
const ok = await ctx.confirm(`Rename symbol at ${input.file}:${input.line}:${input.character} to "${input.new_name}"?`);
|
|
649
|
+
if (!ok)
|
|
650
|
+
return (0, utils_js_1.fail)("Cancelled by user");
|
|
651
|
+
}
|
|
652
|
+
const server = getOrCreateServer(serverName, ctx.workingDir);
|
|
653
|
+
try {
|
|
654
|
+
await server.start();
|
|
655
|
+
switch (input.action) {
|
|
656
|
+
case "definition": {
|
|
657
|
+
if (input.line == null || input.character == null)
|
|
658
|
+
return (0, utils_js_1.fail)("line and character required for definition");
|
|
659
|
+
const result = await server.definition(input.file, input.line, input.character);
|
|
660
|
+
return (0, utils_js_1.success)(`lsp definition`, result);
|
|
661
|
+
}
|
|
662
|
+
case "references": {
|
|
663
|
+
if (input.line == null || input.character == null)
|
|
664
|
+
return (0, utils_js_1.fail)("line and character required for references");
|
|
665
|
+
const result = await server.references(input.file, input.line, input.character);
|
|
666
|
+
return (0, utils_js_1.success)(`lsp references`, result);
|
|
667
|
+
}
|
|
668
|
+
case "hover": {
|
|
669
|
+
if (input.line == null || input.character == null)
|
|
670
|
+
return (0, utils_js_1.fail)("line and character required for hover");
|
|
671
|
+
const result = await server.hover(input.file, input.line, input.character);
|
|
672
|
+
return (0, utils_js_1.success)(`lsp hover`, result);
|
|
673
|
+
}
|
|
674
|
+
case "symbols": {
|
|
675
|
+
const result = await server.documentSymbols(input.file);
|
|
676
|
+
return (0, utils_js_1.success)(`lsp symbols`, result);
|
|
677
|
+
}
|
|
678
|
+
case "rename": {
|
|
679
|
+
if (input.line == null || input.character == null || !input.new_name)
|
|
680
|
+
return (0, utils_js_1.fail)("line, character, and new_name required for rename");
|
|
681
|
+
const result = await server.rename(input.file, input.line, input.character, input.new_name);
|
|
682
|
+
return (0, utils_js_1.success)(`lsp rename`, result);
|
|
683
|
+
}
|
|
684
|
+
default:
|
|
685
|
+
return (0, utils_js_1.fail)(`Unknown lsp action: ${input.action}. Use: definition, references, hover, symbols, rename`);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
catch (err) {
|
|
689
|
+
const e = asExecError(err);
|
|
690
|
+
return (0, utils_js_1.fail)(`lsp ${input.action} failed: ${e.message}`);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
// ---------------------------------------------------------------------------
|
|
694
|
+
// 7. serena — HTTP project server (kept alongside native LSP for full Serena API)
|
|
695
|
+
// ---------------------------------------------------------------------------
|
|
696
|
+
const SERENA_PORT = 9750;
|
|
697
|
+
const SERENA_BASE = `http://127.0.0.1:${SERENA_PORT}`;
|
|
698
|
+
const SERENA_PROJECT = "aria";
|
|
699
|
+
const SERENA_TOOL_MAP = {
|
|
700
|
+
find_symbol: "find_symbol",
|
|
701
|
+
find_references: "find_referencing_symbols",
|
|
702
|
+
overview: "get_symbols_overview",
|
|
703
|
+
replace_body: "replace_symbol_body",
|
|
704
|
+
insert_after: "insert_after_symbol",
|
|
705
|
+
insert_before: "insert_before_symbol",
|
|
706
|
+
rename: "rename_symbol",
|
|
707
|
+
search: "search_for_pattern",
|
|
708
|
+
};
|
|
709
|
+
// ---------------------------------------------------------------------------
|
|
710
|
+
// Serena auto-start: spawn the HTTP project server on demand
|
|
711
|
+
// ---------------------------------------------------------------------------
|
|
712
|
+
let serenaStarting = null;
|
|
713
|
+
async function isSerenaAlive() {
|
|
714
|
+
// Lightweight TCP probe — just check if something is listening on the port.
|
|
715
|
+
// A full HTTP request is too heavy during startup (Serena takes seconds to load projects).
|
|
716
|
+
return new Promise((resolve) => {
|
|
717
|
+
const sock = (0, node_net_1.createConnection)({ host: "127.0.0.1", port: SERENA_PORT }, () => {
|
|
718
|
+
sock.destroy();
|
|
719
|
+
resolve(true);
|
|
720
|
+
});
|
|
721
|
+
sock.setTimeout(2_000);
|
|
722
|
+
sock.on("error", () => resolve(false));
|
|
723
|
+
sock.on("timeout", () => {
|
|
724
|
+
sock.destroy();
|
|
725
|
+
resolve(false);
|
|
726
|
+
});
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
function findSerenaProjectRoot() {
|
|
730
|
+
// Walk up from cwd looking for .serena/project.yml
|
|
731
|
+
let dir = (0, node_path_1.resolve)(process.cwd());
|
|
732
|
+
while (dir !== (0, node_path_1.dirname)(dir)) {
|
|
733
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(dir, ".serena", "project.yml")))
|
|
734
|
+
return dir;
|
|
735
|
+
dir = (0, node_path_1.dirname)(dir);
|
|
736
|
+
}
|
|
737
|
+
// Fallback: walk up from this file's directory
|
|
738
|
+
// (compiled JS lives in packages/tools/dist/executors/)
|
|
739
|
+
// __dirname is available since the build target is CJS
|
|
740
|
+
dir = typeof __dirname === "string" ? (0, node_path_1.resolve)(__dirname) : (0, node_path_1.resolve)(".");
|
|
741
|
+
while (dir !== (0, node_path_1.dirname)(dir)) {
|
|
742
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(dir, ".serena", "project.yml")))
|
|
743
|
+
return dir;
|
|
744
|
+
dir = (0, node_path_1.dirname)(dir);
|
|
745
|
+
}
|
|
746
|
+
return process.cwd();
|
|
747
|
+
}
|
|
748
|
+
let cachedSerenaBin;
|
|
749
|
+
function resolveSerenaBin() {
|
|
750
|
+
if (cachedSerenaBin !== undefined)
|
|
751
|
+
return cachedSerenaBin;
|
|
752
|
+
// Find the serena binary from uv's cache directory.
|
|
753
|
+
// We avoid `uvx --from git+... which serena` because it triggers a blocking
|
|
754
|
+
// git fetch that hangs inside a detached spawn context.
|
|
755
|
+
const cacheBase = (0, node_path_1.join)(process.env.HOME ?? "/tmp", ".cache", "uv", "archive-v0");
|
|
756
|
+
try {
|
|
757
|
+
const entries = (0, node_fs_1.readdirSync)(cacheBase)
|
|
758
|
+
.map((d) => (0, node_path_1.join)(cacheBase, d, "bin", "serena"))
|
|
759
|
+
.filter((p) => (0, node_fs_1.existsSync)(p))
|
|
760
|
+
.sort((a, b) => (0, node_fs_1.statSync)(b).mtimeMs - (0, node_fs_1.statSync)(a).mtimeMs);
|
|
761
|
+
cachedSerenaBin = entries.length > 0 ? entries[0] : null;
|
|
762
|
+
}
|
|
763
|
+
catch {
|
|
764
|
+
cachedSerenaBin = null;
|
|
765
|
+
}
|
|
766
|
+
return cachedSerenaBin ?? null;
|
|
767
|
+
}
|
|
768
|
+
function spawnSerenaServer() {
|
|
769
|
+
const projectRoot = findSerenaProjectRoot();
|
|
770
|
+
const serenaBin = resolveSerenaBin();
|
|
771
|
+
if (!serenaBin)
|
|
772
|
+
return;
|
|
773
|
+
// Spawn the cached Python binary directly with stdio:'ignore' + detached.
|
|
774
|
+
// Using 'uvx --from git+...' does NOT work because uvx triggers a blocking
|
|
775
|
+
// git fetch that hangs/dies with closed file descriptors.
|
|
776
|
+
const child = (0, node_child_process_1.spawn)(serenaBin, ["start-project-server", "--port", String(SERENA_PORT)], {
|
|
777
|
+
cwd: projectRoot,
|
|
778
|
+
detached: true,
|
|
779
|
+
stdio: "ignore",
|
|
780
|
+
env: { ...process.env },
|
|
781
|
+
});
|
|
782
|
+
child.unref();
|
|
783
|
+
}
|
|
784
|
+
async function ensureSerenaServer() {
|
|
785
|
+
if (await isSerenaAlive())
|
|
786
|
+
return true;
|
|
787
|
+
// Deduplicate concurrent start attempts
|
|
788
|
+
if (serenaStarting)
|
|
789
|
+
return serenaStarting;
|
|
790
|
+
serenaStarting = (async () => {
|
|
791
|
+
spawnSerenaServer();
|
|
792
|
+
// Poll for readiness (serena can take a few seconds to initialize)
|
|
793
|
+
const deadline = Date.now() + 30_000;
|
|
794
|
+
const interval = 500;
|
|
795
|
+
while (Date.now() < deadline) {
|
|
796
|
+
await new Promise((r) => setTimeout(r, interval));
|
|
797
|
+
if (await isSerenaAlive()) {
|
|
798
|
+
serenaStarting = null;
|
|
799
|
+
return true;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
serenaStarting = null;
|
|
803
|
+
return false;
|
|
804
|
+
})();
|
|
805
|
+
return serenaStarting;
|
|
806
|
+
}
|
|
807
|
+
async function executeSerena(input, ctx) {
|
|
808
|
+
if (ctx.abortSignal?.aborted)
|
|
809
|
+
return (0, utils_js_1.fail)("Operation cancelled");
|
|
810
|
+
const toolName = SERENA_TOOL_MAP[input.action];
|
|
811
|
+
if (!toolName)
|
|
812
|
+
return (0, utils_js_1.fail)(`Unknown serena action: ${input.action}`);
|
|
813
|
+
const isMutation = ["replace_body", "insert_after", "insert_before", "rename"].includes(input.action);
|
|
814
|
+
if (isMutation && ctx.confirm) {
|
|
815
|
+
const desc = input.action === "rename"
|
|
816
|
+
? `Rename "${input.name_path}" to "${input.new_name}"?`
|
|
817
|
+
: `${input.action} on "${input.name_path}"?`;
|
|
818
|
+
const ok = await ctx.confirm(desc);
|
|
819
|
+
if (!ok)
|
|
820
|
+
return (0, utils_js_1.fail)("Cancelled by user");
|
|
821
|
+
}
|
|
822
|
+
// Auto-start the Serena project server if not running
|
|
823
|
+
const alive = await ensureSerenaServer();
|
|
824
|
+
if (!alive) {
|
|
825
|
+
return (0, utils_js_1.fail)("Failed to auto-start Serena project server after 30s. " +
|
|
826
|
+
"Check logs or start manually:\n" +
|
|
827
|
+
`uvx --from "git+https://github.com/oraios/serena" serena start-project-server --port ${SERENA_PORT}`);
|
|
828
|
+
}
|
|
829
|
+
const params = { ...input.extra_args };
|
|
830
|
+
if (input.name_path) {
|
|
831
|
+
if (input.action === "find_symbol") {
|
|
832
|
+
params.name_path_pattern = input.name_path;
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
params.name_path = input.name_path;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
if (input.relative_path)
|
|
839
|
+
params.relative_path = input.relative_path;
|
|
840
|
+
if (input.include_body != null)
|
|
841
|
+
params.include_body = input.include_body;
|
|
842
|
+
if (input.include_info != null)
|
|
843
|
+
params.include_info = input.include_info;
|
|
844
|
+
if (input.depth != null)
|
|
845
|
+
params.depth = input.depth;
|
|
846
|
+
if (input.body)
|
|
847
|
+
params.body = input.body;
|
|
848
|
+
if (input.new_name)
|
|
849
|
+
params.new_name = input.new_name;
|
|
850
|
+
if (input.pattern)
|
|
851
|
+
params.substring_pattern = input.pattern;
|
|
852
|
+
if (input.context_before != null)
|
|
853
|
+
params.context_lines_before = input.context_before;
|
|
854
|
+
if (input.context_after != null)
|
|
855
|
+
params.context_lines_after = input.context_after;
|
|
856
|
+
if (input.paths_include)
|
|
857
|
+
params.paths_include_glob = input.paths_include;
|
|
858
|
+
if (input.paths_exclude)
|
|
859
|
+
params.paths_exclude_glob = input.paths_exclude;
|
|
860
|
+
try {
|
|
861
|
+
const body = JSON.stringify({
|
|
862
|
+
project_name: SERENA_PROJECT,
|
|
863
|
+
tool_name: toolName,
|
|
864
|
+
tool_params_json: JSON.stringify(params),
|
|
865
|
+
});
|
|
866
|
+
const response = await fetch(`${SERENA_BASE}/query_project`, {
|
|
867
|
+
method: "POST",
|
|
868
|
+
headers: { "Content-Type": "application/json" },
|
|
869
|
+
body,
|
|
870
|
+
signal: ctx.abortSignal,
|
|
871
|
+
});
|
|
872
|
+
if (!response.ok) {
|
|
873
|
+
const text = await response.text();
|
|
874
|
+
return (0, utils_js_1.fail)(`serena ${input.action}: HTTP ${response.status} — ${text.slice(0, 200)}`);
|
|
875
|
+
}
|
|
876
|
+
const text = await response.text();
|
|
877
|
+
try {
|
|
878
|
+
return (0, utils_js_1.success)(`serena ${input.action} completed`, JSON.parse(text));
|
|
879
|
+
}
|
|
880
|
+
catch {
|
|
881
|
+
return (0, utils_js_1.success)(`serena ${input.action} completed`, { raw: text });
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
catch (err) {
|
|
885
|
+
const e = asExecError(err);
|
|
886
|
+
return (0, utils_js_1.fail)(`serena ${input.action} failed: ${e.message}`);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
// ---------------------------------------------------------------------------
|
|
890
|
+
// 8. fff — native CLI (fff-cli binary, zero MCP)
|
|
891
|
+
// ---------------------------------------------------------------------------
|
|
892
|
+
async function executeFff(input, ctx) {
|
|
893
|
+
if (ctx.abortSignal?.aborted)
|
|
894
|
+
return (0, utils_js_1.fail)("Operation cancelled");
|
|
895
|
+
if (!(await hasBinary("fff-cli")))
|
|
896
|
+
return (0, utils_js_1.fail)("fff-cli not installed. Build: cd vendor/fff-cli && cargo build --release && cp target/release/fff-cli ~/.local/bin/");
|
|
897
|
+
const args = [input.action];
|
|
898
|
+
// Query or patterns. Native fff-cli supports positional query terms; constraints are
|
|
899
|
+
// appended as additional terms for grep/find_files and patterns for multi_grep.
|
|
900
|
+
if (input.action === "multi_grep" && input.patterns?.length) {
|
|
901
|
+
args.push(...input.patterns);
|
|
902
|
+
if (input.constraints)
|
|
903
|
+
args.push(input.constraints);
|
|
904
|
+
}
|
|
905
|
+
else {
|
|
906
|
+
if (input.query)
|
|
907
|
+
args.push(input.query);
|
|
908
|
+
if (input.constraints)
|
|
909
|
+
args.push(input.constraints);
|
|
910
|
+
}
|
|
911
|
+
// Path
|
|
912
|
+
args.push("--path", input.path ?? ctx.workingDir);
|
|
913
|
+
try {
|
|
914
|
+
const { stdout } = await shellExec("fff-cli", args, {
|
|
915
|
+
cwd: ctx.workingDir,
|
|
916
|
+
signal: ctx.abortSignal,
|
|
917
|
+
timeout: 30_000,
|
|
918
|
+
});
|
|
919
|
+
return (0, utils_js_1.success)(`fff ${input.action} completed`, JSON.parse(stdout));
|
|
920
|
+
}
|
|
921
|
+
catch (err) {
|
|
922
|
+
const e = asExecError(err);
|
|
923
|
+
return (0, utils_js_1.fail)(`fff ${input.action} failed: ${e.stderr || e.message}`);
|
|
924
|
+
}
|
|
925
|
+
}
|