@aria-cli/tools 1.0.18 → 1.0.31
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/.aria-build-stamp.json +1 -1
- package/dist/ask-user-interaction.js +23 -0
- package/dist/cache/web-cache.js +67 -0
- package/dist/definitions/arion.js +105 -0
- package/dist/definitions/browser/browser.js +419 -0
- package/dist/definitions/browser/index.js +5 -0
- package/dist/definitions/browser/pw-downloads.js +115 -0
- package/dist/definitions/browser/pw-interactions.js +200 -0
- package/dist/definitions/browser/pw-responses.js +77 -0
- package/dist/definitions/browser/pw-session.js +311 -0
- package/dist/definitions/browser/pw-shared.js +67 -0
- package/dist/definitions/browser/pw-snapshot.js +302 -0
- package/dist/definitions/browser/pw-state.js +63 -0
- package/dist/definitions/browser/types.js +5 -0
- package/dist/definitions/code-intelligence.js +471 -0
- package/dist/definitions/core.js +110 -0
- package/dist/definitions/delegation.js +513 -0
- package/dist/definitions/deploy.js +66 -0
- package/dist/definitions/filesystem.js +197 -0
- package/dist/definitions/frg.js +64 -0
- package/{dist-cjs/definitions/index.d.ts → dist/definitions/index.js} +2 -0
- package/dist/definitions/memory.js +124 -0
- package/dist/definitions/messaging.js +626 -0
- package/dist/definitions/meta.js +350 -0
- package/dist/definitions/network.js +160 -0
- package/dist/definitions/outlook.js +278 -0
- package/dist/definitions/patch/apply-patch.js +185 -0
- package/dist/definitions/patch/fuzzy-match.js +167 -0
- package/{dist-cjs/definitions/patch/index.d.ts → dist/definitions/patch/index.js} +1 -0
- package/dist/definitions/patch/patch-parser.js +208 -0
- package/dist/definitions/patch/sandbox-paths.js +106 -0
- package/dist/definitions/process/index.js +5 -0
- package/dist/definitions/process/process-registry.js +214 -0
- package/dist/definitions/process/process.js +387 -0
- package/dist/definitions/process/pty-keys.js +255 -0
- package/dist/definitions/process/session-slug.js +143 -0
- package/dist/definitions/quip.js +196 -0
- package/dist/definitions/search.js +61 -0
- package/dist/definitions/session-history.js +70 -0
- package/dist/definitions/shell.js +182 -0
- package/dist/definitions/slack.js +181 -0
- package/dist/definitions/web.js +110 -0
- package/dist/{dns-pinning-vc0r0vpx.js → dns-pinning-7szqhtmq.js} +1 -1
- package/dist/executors/apply-patch.js +902 -0
- package/dist/executors/arion.js +120 -0
- package/dist/executors/code-intelligence.js +883 -0
- package/dist/executors/deploy.js +849 -0
- package/dist/executors/filesystem.js +1119 -0
- package/dist/executors/frg-freshness.js +577 -0
- package/dist/executors/frg.js +299 -0
- package/{dist-cjs/executors/index.d.ts → dist/executors/index.js} +22 -19
- package/dist/executors/learning-meta.js +1147 -0
- package/dist/executors/lsp-client.js +297 -0
- package/dist/executors/memory.js +751 -0
- package/dist/executors/meta.js +221 -0
- package/dist/executors/process-registry.js +466 -0
- package/dist/executors/pty-session-store.js +31 -0
- package/dist/executors/pty.js +281 -0
- package/dist/executors/restart.js +120 -0
- package/dist/executors/search-freshness.js +196 -0
- package/dist/executors/search-types.js +53 -0
- package/dist/executors/search.js +67 -0
- package/dist/executors/self-diagnose.js +399 -0
- package/dist/executors/session-history.js +284 -0
- package/dist/executors/shell-safety.js +474 -0
- package/dist/executors/shell.js +955 -0
- package/dist/executors/utils.js +34 -0
- package/dist/executors/web.js +543 -0
- package/dist/extraction/content-extraction.js +248 -0
- package/dist/extraction/index.js +5 -0
- package/dist/headless-control-contract.js +968 -0
- package/dist/{index-x52t2mbj.js → index-45qvfjbf.js} +2 -2
- package/dist/{index-8xap0se3.js → index-b3sdwzh5.js} +1 -1
- package/dist/index-tvryzx00.js +2 -0
- package/dist/index.js +71 -372
- package/dist/local-control-http-auth.js +3 -0
- package/dist/{lsp-client-msnj763y.js → lsp-client-3qxptwyw.js} +1 -1
- package/dist/mcp/client.js +182 -0
- package/dist/mcp/connection.js +484 -0
- package/dist/mcp/index.js +11 -0
- package/dist/mcp/jsonrpc.js +145 -0
- package/dist/mcp/types.js +8 -0
- package/dist/network-control-adapter.js +73 -0
- package/dist/network-runtime/address-types.js +166 -0
- package/dist/network-runtime/db-owner-fencing.js +70 -0
- package/dist/network-runtime/delivery-receipts.js +270 -0
- package/dist/network-runtime/direct-endpoint-authority.js +26 -0
- package/dist/network-runtime/index.js +13 -1
- package/dist/network-runtime/local-control-contract.js +628 -0
- package/dist/network-runtime/node-store-contract.js +35 -0
- package/dist/network-runtime/pair-route-contract.js +78 -0
- package/dist/network-runtime/peer-capabilities.js +29 -0
- package/dist/network-runtime/peer-principal-ref.js +13 -0
- package/dist/network-runtime/peer-state-machine.js +122 -0
- package/dist/network-runtime/protocol-schemas.js +206 -0
- package/dist/network-runtime/runtime-bootstrap-contract.js +61 -0
- package/dist/outlook/desktop-session.js +280 -0
- package/dist/policy.js +150 -0
- package/dist/providers/brave.js +63 -0
- package/dist/providers/duckduckgo.js +177 -0
- package/dist/providers/exa.js +64 -0
- package/dist/providers/firecrawl.js +56 -0
- package/{dist-cjs/providers/index.d.ts → dist/providers/index.js} +1 -1
- package/dist/providers/jina.js +50 -0
- package/dist/providers/router.js +97 -0
- package/dist/providers/search-provider.js +33 -0
- package/dist/providers/tavily.js +55 -0
- package/dist/pty-w5c9dv33.js +1 -0
- package/dist/quip/desktop-session.js +318 -0
- package/{dist-cjs/registry/index.d.ts → dist/registry/index.js} +1 -0
- package/dist/registry/registry.js +757 -0
- package/dist/runtime-socket-local-control-client.js +331 -0
- package/dist/security/dns-normalization.js +20 -0
- package/dist/security/dns-pinning.js +124 -0
- package/dist/security/external-content.js +92 -0
- package/dist/security/ssrf.js +182 -0
- package/dist/session-history-gk75e3ta.js +1 -0
- package/dist/slack/desktop-session.js +325 -0
- package/dist/tool-factory.js +48 -0
- package/dist/types.js +8 -0
- package/dist/utils/retry.js +133 -0
- package/dist/utils/safe-parse-json.js +161 -0
- package/dist/utils/url.js +20 -0
- package/dist-cjs/ask-user-interaction.js +28 -0
- package/dist-cjs/cache/web-cache.js +71 -0
- package/dist-cjs/definitions/arion.js +108 -0
- package/dist-cjs/definitions/browser/browser.js +422 -0
- package/dist-cjs/definitions/browser/index.js +9 -0
- package/dist-cjs/definitions/browser/pw-downloads.js +118 -0
- package/dist-cjs/definitions/browser/pw-interactions.js +214 -0
- package/dist-cjs/definitions/browser/pw-responses.js +85 -0
- package/dist-cjs/definitions/browser/pw-session.js +327 -0
- package/dist-cjs/definitions/browser/pw-shared.js +73 -0
- package/dist-cjs/definitions/browser/pw-snapshot.js +308 -0
- package/dist-cjs/definitions/browser/pw-state.js +71 -0
- package/dist-cjs/definitions/browser/types.js +6 -0
- package/dist-cjs/definitions/code-intelligence.js +474 -0
- package/dist-cjs/definitions/core.js +134 -0
- package/dist-cjs/definitions/delegation.js +516 -0
- package/dist-cjs/definitions/deploy.js +69 -0
- package/dist-cjs/definitions/filesystem.js +200 -0
- package/dist-cjs/definitions/frg.js +67 -0
- package/dist-cjs/definitions/index.js +44 -0
- package/dist-cjs/definitions/memory.js +127 -0
- package/dist-cjs/definitions/messaging.js +632 -0
- package/dist-cjs/definitions/meta.js +353 -0
- package/dist-cjs/definitions/network.js +163 -0
- package/dist-cjs/definitions/outlook.js +281 -0
- package/dist-cjs/definitions/patch/apply-patch.js +192 -0
- package/dist-cjs/definitions/patch/fuzzy-match.js +173 -0
- package/dist-cjs/definitions/patch/index.js +6 -0
- package/dist-cjs/definitions/patch/patch-parser.js +216 -0
- package/dist-cjs/definitions/patch/sandbox-paths.js +114 -0
- package/dist-cjs/definitions/process/index.js +9 -0
- package/dist-cjs/definitions/process/process-registry.js +232 -0
- package/dist-cjs/definitions/process/process.js +390 -0
- package/dist-cjs/definitions/process/pty-keys.js +260 -0
- package/dist-cjs/definitions/process/session-slug.js +146 -0
- package/dist-cjs/definitions/quip.js +199 -0
- package/dist-cjs/definitions/search.js +64 -0
- package/dist-cjs/definitions/session-history.js +73 -0
- package/dist-cjs/definitions/shell.js +185 -0
- package/dist-cjs/definitions/slack.js +184 -0
- package/dist-cjs/definitions/web.js +113 -0
- package/dist-cjs/executors/apply-patch.js +939 -0
- package/dist-cjs/executors/arion.js +126 -0
- package/dist-cjs/executors/code-intelligence.js +926 -0
- package/dist-cjs/executors/deploy.js +870 -0
- package/dist-cjs/executors/filesystem.js +1164 -0
- package/dist-cjs/executors/frg-freshness.js +628 -0
- package/dist-cjs/executors/frg.js +335 -0
- package/dist-cjs/executors/index.js +144 -0
- package/dist-cjs/executors/learning-meta.js +1166 -0
- package/dist-cjs/executors/memory.js +797 -0
- package/dist-cjs/executors/meta.js +227 -0
- package/dist-cjs/executors/process-registry.js +470 -0
- package/dist-cjs/executors/pty-session-store.js +35 -0
- package/dist-cjs/executors/pty.js +289 -0
- package/dist-cjs/executors/restart.js +156 -0
- package/dist-cjs/executors/search-freshness.js +235 -0
- package/dist-cjs/executors/search-types.js +57 -0
- package/dist-cjs/executors/search.js +103 -0
- package/dist-cjs/executors/self-diagnose.js +435 -0
- package/dist-cjs/executors/session-history.js +321 -0
- package/dist-cjs/executors/shell-safety.js +479 -0
- package/dist-cjs/executors/shell.js +1002 -0
- package/dist-cjs/executors/utils.js +74 -0
- package/dist-cjs/executors/web.js +548 -0
- package/dist-cjs/extraction/content-extraction.js +289 -0
- package/dist-cjs/extraction/index.js +9 -0
- package/dist-cjs/headless-control-contract.js +973 -0
- package/dist-cjs/index.js +436 -385
- package/dist-cjs/local-control-http-auth.js +6 -0
- package/dist-cjs/mcp/client.js +186 -0
- package/dist-cjs/mcp/connection.js +488 -0
- package/dist-cjs/mcp/index.js +31 -0
- package/dist-cjs/mcp/jsonrpc.js +149 -0
- package/dist-cjs/mcp/types.js +9 -0
- package/dist-cjs/network-control-adapter.js +78 -0
- package/dist-cjs/network-runtime/address-types.js +169 -0
- package/dist-cjs/network-runtime/db-owner-fencing.js +77 -0
- package/dist-cjs/network-runtime/delivery-receipts.js +279 -0
- package/dist-cjs/network-runtime/direct-endpoint-authority.js +30 -0
- package/dist-cjs/network-runtime/index.js +173 -8
- package/dist-cjs/network-runtime/local-control-contract.js +634 -0
- package/dist-cjs/network-runtime/node-store-contract.js +39 -0
- package/dist-cjs/network-runtime/pair-route-contract.js +81 -0
- package/dist-cjs/network-runtime/peer-capabilities.js +38 -0
- package/dist-cjs/network-runtime/peer-principal-ref.js +16 -0
- package/dist-cjs/network-runtime/peer-state-machine.js +130 -0
- package/dist-cjs/network-runtime/protocol-schemas.js +213 -0
- package/dist-cjs/network-runtime/runtime-bootstrap-contract.js +64 -0
- package/dist-cjs/outlook/desktop-session.js +319 -0
- package/dist-cjs/policy.js +156 -0
- package/dist-cjs/providers/brave.js +67 -0
- package/dist-cjs/providers/duckduckgo.js +181 -0
- package/dist-cjs/providers/exa.js +68 -0
- package/dist-cjs/providers/firecrawl.js +60 -0
- package/dist-cjs/providers/index.js +18 -0
- package/dist-cjs/providers/jina.js +54 -0
- package/dist-cjs/providers/router.js +101 -0
- package/dist-cjs/providers/search-provider.js +37 -0
- package/dist-cjs/providers/tavily.js +59 -0
- package/dist-cjs/quip/desktop-session.js +354 -0
- package/dist-cjs/registry/index.js +7 -0
- package/dist-cjs/registry/registry.js +762 -0
- package/dist-cjs/runtime-socket-local-control-client.js +368 -0
- package/dist-cjs/security/dns-normalization.js +23 -0
- package/dist-cjs/security/dns-pinning.js +161 -0
- package/dist-cjs/security/external-content.js +96 -0
- package/dist-cjs/security/ssrf.js +222 -0
- package/dist-cjs/slack/desktop-session.js +367 -0
- package/dist-cjs/tool-factory.js +51 -0
- package/dist-cjs/types.js +9 -0
- package/dist-cjs/utils/retry.js +170 -0
- package/dist-cjs/utils/safe-parse-json.js +165 -0
- package/dist-cjs/utils/url.js +24 -0
- package/package.json +11 -10
- package/dist/ask-user-interaction.d.ts +0 -10
- package/dist/cache/web-cache.d.ts +0 -52
- package/dist/definitions/arion.d.ts +0 -8
- package/dist/definitions/browser/browser.d.ts +0 -2
- package/dist/definitions/browser/index.d.ts +0 -1
- package/dist/definitions/browser/pw-downloads.d.ts +0 -13
- package/dist/definitions/browser/pw-interactions.d.ts +0 -78
- package/dist/definitions/browser/pw-responses.d.ts +0 -28
- package/dist/definitions/browser/pw-session.d.ts +0 -65
- package/dist/definitions/browser/pw-shared.d.ts +0 -22
- package/dist/definitions/browser/pw-snapshot.d.ts +0 -34
- package/dist/definitions/browser/pw-state.d.ts +0 -22
- package/dist/definitions/browser/types.d.ts +0 -277
- package/dist/definitions/code-intelligence.d.ts +0 -8
- package/dist/definitions/core.d.ts +0 -47
- package/dist/definitions/delegation.d.ts +0 -11
- package/dist/definitions/deploy.d.ts +0 -15
- package/dist/definitions/filesystem.d.ts +0 -9
- package/dist/definitions/frg.d.ts +0 -3
- package/dist/definitions/index.d.ts +0 -19
- package/dist/definitions/memory.d.ts +0 -8
- package/dist/definitions/messaging.d.ts +0 -11
- package/dist/definitions/meta.d.ts +0 -11
- package/dist/definitions/network.d.ts +0 -11
- package/dist/definitions/outlook.d.ts +0 -2
- package/dist/definitions/patch/apply-patch.d.ts +0 -11
- package/dist/definitions/patch/fuzzy-match.d.ts +0 -10
- package/dist/definitions/patch/index.d.ts +0 -1
- package/dist/definitions/patch/patch-parser.d.ts +0 -50
- package/dist/definitions/patch/sandbox-paths.d.ts +0 -18
- package/dist/definitions/process/index.d.ts +0 -1
- package/dist/definitions/process/process-registry.d.ts +0 -67
- package/dist/definitions/process/process.d.ts +0 -9
- package/dist/definitions/process/pty-keys.d.ts +0 -13
- package/dist/definitions/process/session-slug.d.ts +0 -1
- package/dist/definitions/quip.d.ts +0 -2
- package/dist/definitions/search.d.ts +0 -9
- package/dist/definitions/session-history.d.ts +0 -11
- package/dist/definitions/shell.d.ts +0 -8
- package/dist/definitions/slack.d.ts +0 -2
- package/dist/definitions/web.d.ts +0 -8
- package/dist/executors/apply-patch.d.ts +0 -51
- package/dist/executors/arion.d.ts +0 -50
- package/dist/executors/code-intelligence.d.ts +0 -138
- package/dist/executors/deploy.d.ts +0 -169
- package/dist/executors/filesystem.d.ts +0 -150
- package/dist/executors/frg-freshness.d.ts +0 -93
- package/dist/executors/frg.d.ts +0 -27
- package/dist/executors/index.d.ts +0 -44
- package/dist/executors/learning-meta.d.ts +0 -87
- package/dist/executors/lsp-client.d.ts +0 -38
- package/dist/executors/memory.d.ts +0 -203
- package/dist/executors/meta.d.ts +0 -73
- package/dist/executors/process-registry.d.ts +0 -98
- package/dist/executors/pty-session-store.d.ts +0 -14
- package/dist/executors/pty.d.ts +0 -133
- package/dist/executors/restart.d.ts +0 -13
- package/dist/executors/search-freshness.d.ts +0 -50
- package/dist/executors/search-types.d.ts +0 -52
- package/dist/executors/search.d.ts +0 -11
- package/dist/executors/self-diagnose.d.ts +0 -89
- package/dist/executors/session-history.d.ts +0 -75
- package/dist/executors/shell-safety.d.ts +0 -27
- package/dist/executors/shell.d.ts +0 -168
- package/dist/executors/utils.d.ts +0 -20
- package/dist/executors/web.d.ts +0 -89
- package/dist/extraction/content-extraction.d.ts +0 -48
- package/dist/extraction/index.d.ts +0 -4
- package/dist/headless-control-contract.d.ts +0 -3182
- package/dist/index-a2fr1b3x.js +0 -2
- package/dist/index.d.ts +0 -62
- package/dist/local-control-http-auth.d.ts +0 -2
- package/dist/mcp/client.d.ts +0 -68
- package/dist/mcp/connection.d.ts +0 -54
- package/dist/mcp/index.d.ts +0 -10
- package/dist/mcp/jsonrpc.d.ts +0 -36
- package/dist/mcp/types.d.ts +0 -178
- package/dist/network-control-adapter.d.ts +0 -4
- package/dist/network-runtime/address-types.d.ts +0 -201
- package/dist/network-runtime/db-owner-fencing.d.ts +0 -43
- package/dist/network-runtime/delivery-receipts.d.ts +0 -117
- package/dist/network-runtime/direct-endpoint-authority.d.ts +0 -8
- package/dist/network-runtime/index.d.ts +0 -24
- package/dist/network-runtime/local-control-contract.d.ts +0 -758
- package/dist/network-runtime/node-store-contract.d.ts +0 -49
- package/dist/network-runtime/pair-route-contract.d.ts +0 -100
- package/dist/network-runtime/peer-capabilities.d.ts +0 -10
- package/dist/network-runtime/peer-principal-ref.d.ts +0 -9
- package/dist/network-runtime/peer-state-machine.d.ts +0 -70
- package/dist/network-runtime/protocol-schemas.d.ts +0 -328
- package/dist/network-runtime/runtime-bootstrap-contract.d.ts +0 -81
- package/dist/outlook/desktop-session.d.ts +0 -68
- package/dist/policy.d.ts +0 -43
- package/dist/providers/brave.d.ts +0 -10
- package/dist/providers/duckduckgo.d.ts +0 -18
- package/dist/providers/exa.d.ts +0 -10
- package/dist/providers/firecrawl.d.ts +0 -10
- package/dist/providers/index.d.ts +0 -8
- package/dist/providers/jina.d.ts +0 -10
- package/dist/providers/router.d.ts +0 -21
- package/dist/providers/search-provider.d.ts +0 -35
- package/dist/providers/tavily.d.ts +0 -10
- package/dist/pty-ff59hy75.js +0 -1
- package/dist/quip/desktop-session.d.ts +0 -69
- package/dist/registry/index.d.ts +0 -1
- package/dist/registry/registry.d.ts +0 -156
- package/dist/runtime-socket-local-control-client.d.ts +0 -10
- package/dist/security/dns-normalization.d.ts +0 -6
- package/dist/security/dns-pinning.d.ts +0 -27
- package/dist/security/external-content.d.ts +0 -40
- package/dist/security/ssrf.d.ts +0 -40
- package/dist/session-history-6gn52xhp.js +0 -1
- package/dist/slack/desktop-session.d.ts +0 -69
- package/dist/tool-factory.d.ts +0 -46
- package/dist/types.d.ts +0 -1192
- package/dist/utils/retry.d.ts +0 -11
- package/dist/utils/safe-parse-json.d.ts +0 -26
- package/dist/utils/url.d.ts +0 -10
- package/dist-cjs/ask-user-interaction.d.ts +0 -10
- package/dist-cjs/cache/web-cache.d.ts +0 -52
- package/dist-cjs/definitions/arion.d.ts +0 -8
- package/dist-cjs/definitions/browser/browser.d.ts +0 -2
- package/dist-cjs/definitions/browser/index.d.ts +0 -1
- package/dist-cjs/definitions/browser/pw-downloads.d.ts +0 -13
- package/dist-cjs/definitions/browser/pw-interactions.d.ts +0 -78
- package/dist-cjs/definitions/browser/pw-responses.d.ts +0 -28
- package/dist-cjs/definitions/browser/pw-session.d.ts +0 -65
- package/dist-cjs/definitions/browser/pw-shared.d.ts +0 -22
- package/dist-cjs/definitions/browser/pw-snapshot.d.ts +0 -34
- package/dist-cjs/definitions/browser/pw-state.d.ts +0 -22
- package/dist-cjs/definitions/browser/types.d.ts +0 -277
- package/dist-cjs/definitions/code-intelligence.d.ts +0 -8
- package/dist-cjs/definitions/core.d.ts +0 -47
- package/dist-cjs/definitions/delegation.d.ts +0 -11
- package/dist-cjs/definitions/deploy.d.ts +0 -15
- package/dist-cjs/definitions/filesystem.d.ts +0 -9
- package/dist-cjs/definitions/frg.d.ts +0 -3
- package/dist-cjs/definitions/memory.d.ts +0 -8
- package/dist-cjs/definitions/messaging.d.ts +0 -11
- package/dist-cjs/definitions/meta.d.ts +0 -11
- package/dist-cjs/definitions/network.d.ts +0 -11
- package/dist-cjs/definitions/outlook.d.ts +0 -2
- package/dist-cjs/definitions/patch/apply-patch.d.ts +0 -11
- package/dist-cjs/definitions/patch/fuzzy-match.d.ts +0 -10
- package/dist-cjs/definitions/patch/patch-parser.d.ts +0 -50
- package/dist-cjs/definitions/patch/sandbox-paths.d.ts +0 -18
- package/dist-cjs/definitions/process/index.d.ts +0 -1
- package/dist-cjs/definitions/process/process-registry.d.ts +0 -67
- package/dist-cjs/definitions/process/process.d.ts +0 -9
- package/dist-cjs/definitions/process/pty-keys.d.ts +0 -13
- package/dist-cjs/definitions/process/session-slug.d.ts +0 -1
- package/dist-cjs/definitions/quip.d.ts +0 -2
- package/dist-cjs/definitions/search.d.ts +0 -9
- package/dist-cjs/definitions/session-history.d.ts +0 -11
- package/dist-cjs/definitions/shell.d.ts +0 -8
- package/dist-cjs/definitions/slack.d.ts +0 -2
- package/dist-cjs/definitions/web.d.ts +0 -8
- package/dist-cjs/executors/apply-patch.d.ts +0 -51
- package/dist-cjs/executors/arion.d.ts +0 -50
- package/dist-cjs/executors/code-intelligence.d.ts +0 -138
- package/dist-cjs/executors/deploy.d.ts +0 -169
- package/dist-cjs/executors/filesystem.d.ts +0 -150
- package/dist-cjs/executors/frg-freshness.d.ts +0 -93
- package/dist-cjs/executors/frg.d.ts +0 -27
- package/dist-cjs/executors/learning-meta.d.ts +0 -87
- package/dist-cjs/executors/lsp-client.d.ts +0 -38
- package/dist-cjs/executors/memory.d.ts +0 -203
- package/dist-cjs/executors/meta.d.ts +0 -73
- package/dist-cjs/executors/process-registry.d.ts +0 -98
- package/dist-cjs/executors/pty-session-store.d.ts +0 -14
- package/dist-cjs/executors/pty.d.ts +0 -133
- package/dist-cjs/executors/restart.d.ts +0 -13
- package/dist-cjs/executors/search-freshness.d.ts +0 -50
- package/dist-cjs/executors/search-types.d.ts +0 -52
- package/dist-cjs/executors/search.d.ts +0 -11
- package/dist-cjs/executors/self-diagnose.d.ts +0 -89
- package/dist-cjs/executors/session-history.d.ts +0 -75
- package/dist-cjs/executors/shell-safety.d.ts +0 -27
- package/dist-cjs/executors/shell.d.ts +0 -168
- package/dist-cjs/executors/utils.d.ts +0 -20
- package/dist-cjs/executors/web.d.ts +0 -89
- package/dist-cjs/extraction/content-extraction.d.ts +0 -48
- package/dist-cjs/extraction/index.d.ts +0 -4
- package/dist-cjs/headless-control-contract.d.ts +0 -3182
- package/dist-cjs/index.d.ts +0 -62
- package/dist-cjs/local-control-http-auth.d.ts +0 -2
- package/dist-cjs/mcp/client.d.ts +0 -68
- package/dist-cjs/mcp/connection.d.ts +0 -54
- package/dist-cjs/mcp/index.d.ts +0 -10
- package/dist-cjs/mcp/jsonrpc.d.ts +0 -36
- package/dist-cjs/mcp/types.d.ts +0 -178
- package/dist-cjs/network-control-adapter.d.ts +0 -4
- package/dist-cjs/network-runtime/address-types.d.ts +0 -201
- package/dist-cjs/network-runtime/db-owner-fencing.d.ts +0 -43
- package/dist-cjs/network-runtime/delivery-receipts.d.ts +0 -117
- package/dist-cjs/network-runtime/direct-endpoint-authority.d.ts +0 -8
- package/dist-cjs/network-runtime/index.d.ts +0 -24
- package/dist-cjs/network-runtime/local-control-contract.d.ts +0 -758
- package/dist-cjs/network-runtime/node-store-contract.d.ts +0 -49
- package/dist-cjs/network-runtime/pair-route-contract.d.ts +0 -100
- package/dist-cjs/network-runtime/peer-capabilities.d.ts +0 -10
- package/dist-cjs/network-runtime/peer-principal-ref.d.ts +0 -9
- package/dist-cjs/network-runtime/peer-state-machine.d.ts +0 -70
- package/dist-cjs/network-runtime/protocol-schemas.d.ts +0 -328
- package/dist-cjs/network-runtime/runtime-bootstrap-contract.d.ts +0 -81
- package/dist-cjs/outlook/desktop-session.d.ts +0 -68
- package/dist-cjs/policy.d.ts +0 -43
- package/dist-cjs/providers/brave.d.ts +0 -10
- package/dist-cjs/providers/duckduckgo.d.ts +0 -18
- package/dist-cjs/providers/exa.d.ts +0 -10
- package/dist-cjs/providers/firecrawl.d.ts +0 -10
- package/dist-cjs/providers/jina.d.ts +0 -10
- package/dist-cjs/providers/router.d.ts +0 -21
- package/dist-cjs/providers/search-provider.d.ts +0 -35
- package/dist-cjs/providers/tavily.d.ts +0 -10
- package/dist-cjs/quip/desktop-session.d.ts +0 -69
- package/dist-cjs/registry/registry.d.ts +0 -156
- package/dist-cjs/runtime-socket-local-control-client.d.ts +0 -10
- package/dist-cjs/security/dns-normalization.d.ts +0 -6
- package/dist-cjs/security/dns-pinning.d.ts +0 -27
- package/dist-cjs/security/external-content.d.ts +0 -40
- package/dist-cjs/security/ssrf.d.ts +0 -40
- package/dist-cjs/slack/desktop-session.d.ts +0 -69
- package/dist-cjs/tool-factory.d.ts +0 -46
- package/dist-cjs/types.d.ts +0 -1192
- package/dist-cjs/utils/retry.d.ts +0 -11
- package/dist-cjs/utils/safe-parse-json.d.ts +0 -26
- package/dist-cjs/utils/url.d.ts +0 -10
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @aria/tools - Shared executor utilities
|
|
4
|
+
*
|
|
5
|
+
* Common helper functions used across all executor modules.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.getErrorMessage = void 0;
|
|
42
|
+
exports.success = success;
|
|
43
|
+
exports.fail = fail;
|
|
44
|
+
exports.isPathWithinBase = isPathWithinBase;
|
|
45
|
+
const nodePath = __importStar(require("node:path"));
|
|
46
|
+
var types_1 = require("@aria-cli/types");
|
|
47
|
+
Object.defineProperty(exports, "getErrorMessage", { enumerable: true, get: function () { return types_1.getErrorMessage; } });
|
|
48
|
+
/**
|
|
49
|
+
* Creates a successful result.
|
|
50
|
+
*/
|
|
51
|
+
function success(message, data) {
|
|
52
|
+
return { success: true, message, data };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates a failure result.
|
|
56
|
+
*/
|
|
57
|
+
function fail(message, data) {
|
|
58
|
+
return { success: false, message, data };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Checks if a resolved path is within the allowed base directory.
|
|
62
|
+
* Prevents path traversal attacks.
|
|
63
|
+
*/
|
|
64
|
+
function isPathWithinBase(resolvedPath, baseDir) {
|
|
65
|
+
const normalizedPath = nodePath.normalize(resolvedPath);
|
|
66
|
+
const normalizedBase = nodePath.normalize(baseDir);
|
|
67
|
+
// normalize() strips trailing separators except for root "/".
|
|
68
|
+
// Guard against root-as-base which would allow every absolute path.
|
|
69
|
+
const baseWithSep = normalizedBase.endsWith(nodePath.sep)
|
|
70
|
+
? normalizedBase
|
|
71
|
+
: normalizedBase + nodePath.sep;
|
|
72
|
+
return normalizedPath === normalizedBase || normalizedPath.startsWith(baseWithSep);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @aria/tools - Web tool executors
|
|
4
|
+
*
|
|
5
|
+
* Implementation of web operations for ARIA tool system.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.executeWebSearch = executeWebSearch;
|
|
9
|
+
exports.executeWebFetch = executeWebFetch;
|
|
10
|
+
exports.executeBrowse = executeBrowse;
|
|
11
|
+
const node_crypto_1 = require("node:crypto");
|
|
12
|
+
const types_1 = require("@aria-cli/types");
|
|
13
|
+
const zod_1 = require("zod");
|
|
14
|
+
const utils_js_1 = require("./utils.js");
|
|
15
|
+
const safe_parse_json_js_1 = require("../utils/safe-parse-json.js");
|
|
16
|
+
const ssrf_js_1 = require("../security/ssrf.js");
|
|
17
|
+
const router_js_1 = require("../providers/router.js");
|
|
18
|
+
const index_js_1 = require("../providers/index.js");
|
|
19
|
+
const search_provider_js_1 = require("../providers/search-provider.js");
|
|
20
|
+
const web_cache_js_1 = require("../cache/web-cache.js");
|
|
21
|
+
const retry_js_1 = require("../utils/retry.js");
|
|
22
|
+
const external_content_js_1 = require("../security/external-content.js");
|
|
23
|
+
const content_extraction_js_1 = require("../extraction/content-extraction.js");
|
|
24
|
+
const url_js_1 = require("../utils/url.js");
|
|
25
|
+
function buildSearchEnv(ctx) {
|
|
26
|
+
const env = ctx.env ?? {};
|
|
27
|
+
return {
|
|
28
|
+
ARIA_SEARCH_PROVIDER: env.ARIA_SEARCH_PROVIDER ?? process.env.ARIA_SEARCH_PROVIDER,
|
|
29
|
+
BRAVE_API_KEY: env.BRAVE_API_KEY ?? process.env.BRAVE_API_KEY,
|
|
30
|
+
FIRECRAWL_API_KEY: env.FIRECRAWL_API_KEY ?? process.env.FIRECRAWL_API_KEY,
|
|
31
|
+
EXA_API_KEY: env.EXA_API_KEY ?? process.env.EXA_API_KEY,
|
|
32
|
+
TAVILY_API_KEY: env.TAVILY_API_KEY ?? process.env.TAVILY_API_KEY,
|
|
33
|
+
JINA_API_KEY: env.JINA_API_KEY ?? process.env.JINA_API_KEY,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function createSearchRouter(env) {
|
|
37
|
+
return new router_js_1.SearchProviderRouter([
|
|
38
|
+
new index_js_1.BraveSearchProvider(env),
|
|
39
|
+
new index_js_1.TavilySearchProvider(env),
|
|
40
|
+
new index_js_1.JinaSearchProvider(env),
|
|
41
|
+
new index_js_1.ExaSearchProvider(env),
|
|
42
|
+
new index_js_1.FirecrawlSearchProvider(env),
|
|
43
|
+
new index_js_1.DuckDuckGoSearchProvider(),
|
|
44
|
+
], env);
|
|
45
|
+
}
|
|
46
|
+
/** Default timeout for fetch requests in milliseconds */
|
|
47
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
48
|
+
/** Default maximum response size in bytes for fetch (1MB) */
|
|
49
|
+
const FETCH_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
50
|
+
/** Default maximum response size in bytes for browse (2MB) */
|
|
51
|
+
const BROWSE_MAX_SIZE_BYTES = 2 * 1024 * 1024;
|
|
52
|
+
const JsonFetchContentSchema = zod_1.z.union([
|
|
53
|
+
zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
54
|
+
zod_1.z.array(zod_1.z.unknown()),
|
|
55
|
+
zod_1.z.string(),
|
|
56
|
+
zod_1.z.number(),
|
|
57
|
+
zod_1.z.boolean(),
|
|
58
|
+
zod_1.z.null(),
|
|
59
|
+
]);
|
|
60
|
+
/**
|
|
61
|
+
* Creates an AbortController with a timeout.
|
|
62
|
+
*/
|
|
63
|
+
function createTimeoutController(timeoutMs) {
|
|
64
|
+
const controller = new AbortController();
|
|
65
|
+
const timeoutId = setTimeout(() => {
|
|
66
|
+
if (!controller.signal.aborted) {
|
|
67
|
+
controller.abort();
|
|
68
|
+
}
|
|
69
|
+
}, timeoutMs);
|
|
70
|
+
return { controller, timeoutId };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Links a parent AbortSignal to a child AbortController, forwarding abort.
|
|
74
|
+
* Returns a cleanup function that MUST be called when the operation completes
|
|
75
|
+
* to prevent the listener from firing after the try/catch scope has exited.
|
|
76
|
+
*/
|
|
77
|
+
function linkAbortSignal(parentSignal, childController) {
|
|
78
|
+
if (!parentSignal)
|
|
79
|
+
return () => { };
|
|
80
|
+
const onAbort = () => {
|
|
81
|
+
if (!childController.signal.aborted) {
|
|
82
|
+
childController.abort();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
parentSignal.addEventListener("abort", onAbort, { once: true });
|
|
86
|
+
return () => {
|
|
87
|
+
parentSignal.removeEventListener("abort", onAbort);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Reads a response body with a streaming byte limit.
|
|
92
|
+
* Unlike checking Content-Length alone, this protects against chunked/streaming
|
|
93
|
+
* responses that lack a Content-Length header.
|
|
94
|
+
*
|
|
95
|
+
* When `truncate` is false (default), throws if the limit is exceeded.
|
|
96
|
+
* When `truncate` is true, returns whatever was read up to the limit.
|
|
97
|
+
*/
|
|
98
|
+
async function readResponseWithLimit(response, maxBytes, options) {
|
|
99
|
+
const body = response.body;
|
|
100
|
+
if (!body) {
|
|
101
|
+
return { text: "", truncated: false, contentBytes: 0 };
|
|
102
|
+
}
|
|
103
|
+
const truncateMode = options?.truncate ?? false;
|
|
104
|
+
const reader = body.getReader();
|
|
105
|
+
const decoder = new TextDecoder();
|
|
106
|
+
const chunks = [];
|
|
107
|
+
let totalBytes = 0;
|
|
108
|
+
try {
|
|
109
|
+
for (;;) {
|
|
110
|
+
const { done, value } = await reader.read();
|
|
111
|
+
if (done)
|
|
112
|
+
break;
|
|
113
|
+
const chunkBytes = value.byteLength;
|
|
114
|
+
if (totalBytes + chunkBytes > maxBytes) {
|
|
115
|
+
if (truncateMode) {
|
|
116
|
+
// Keep what we have so far (exclude the chunk that exceeded the limit)
|
|
117
|
+
reader.cancel();
|
|
118
|
+
chunks.push(decoder.decode());
|
|
119
|
+
return {
|
|
120
|
+
text: chunks.join(""),
|
|
121
|
+
truncated: true,
|
|
122
|
+
contentBytes: totalBytes,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
reader.cancel();
|
|
126
|
+
throw new Error(`Response body exceeds maximum size of ${maxBytes} bytes`);
|
|
127
|
+
}
|
|
128
|
+
totalBytes += chunkBytes;
|
|
129
|
+
chunks.push(decoder.decode(value, { stream: true }));
|
|
130
|
+
}
|
|
131
|
+
// Flush the decoder
|
|
132
|
+
chunks.push(decoder.decode());
|
|
133
|
+
return { text: chunks.join(""), truncated: false, contentBytes: totalBytes };
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
reader.cancel();
|
|
137
|
+
throw err;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function ensureWrappedExternalContent(content, source) {
|
|
141
|
+
return (0, external_content_js_1.wrapExternalContent)(content, source).content;
|
|
142
|
+
}
|
|
143
|
+
function wrapWebSearchOutput(output) {
|
|
144
|
+
return {
|
|
145
|
+
query: output.query,
|
|
146
|
+
results: output.results.map((result) => ({
|
|
147
|
+
...result,
|
|
148
|
+
content: ensureWrappedExternalContent(result.content, "web_search"),
|
|
149
|
+
})),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function hasAdvancedSearchOptions(input) {
|
|
153
|
+
return (input.limit !== undefined ||
|
|
154
|
+
input.topic !== undefined ||
|
|
155
|
+
(input.domains?.length ?? 0) > 0 ||
|
|
156
|
+
(input.excludeDomains?.length ?? 0) > 0 ||
|
|
157
|
+
input.timeRange !== undefined);
|
|
158
|
+
}
|
|
159
|
+
function buildSearchCachePayload(query, options) {
|
|
160
|
+
return JSON.stringify({ query, ...options });
|
|
161
|
+
}
|
|
162
|
+
function buildRouterSearchCacheKey(env, query, options) {
|
|
163
|
+
const resolved = (0, search_provider_js_1.resolveSearchProviderEnv)(env);
|
|
164
|
+
const providerOverride = resolved.ARIA_SEARCH_PROVIDER ?? "auto";
|
|
165
|
+
const providerAvailability = [
|
|
166
|
+
resolved.BRAVE_API_KEY ? "brave=1" : "brave=0",
|
|
167
|
+
resolved.TAVILY_API_KEY ? "tavily=1" : "tavily=0",
|
|
168
|
+
resolved.JINA_API_KEY ? "jina=1" : "jina=0",
|
|
169
|
+
resolved.EXA_API_KEY ? "exa=1" : "exa=0",
|
|
170
|
+
resolved.FIRECRAWL_API_KEY ? "firecrawl=1" : "firecrawl=0",
|
|
171
|
+
].join(",");
|
|
172
|
+
return `search:router:${providerOverride}:${providerAvailability}:${buildSearchCachePayload(query, options)}`;
|
|
173
|
+
}
|
|
174
|
+
function buildNativeSearchCacheKey(providerName, query, options) {
|
|
175
|
+
return `search:native:${providerName}:${buildSearchCachePayload(query, options)}`;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Searches the web using the SearchProviderRouter with automatic fallback.
|
|
179
|
+
* Providers are selected based on available API keys (Brave, Tavily, Jina, Exa,
|
|
180
|
+
* Firecrawl, DuckDuckGo). DuckDuckGo is always available as a last resort.
|
|
181
|
+
*
|
|
182
|
+
* Results are cached via LRU+TTL cache for 15 minutes.
|
|
183
|
+
*/
|
|
184
|
+
async function executeWebSearch(input, ctx) {
|
|
185
|
+
const limit = input.limit ?? 10;
|
|
186
|
+
const searchOptions = {
|
|
187
|
+
limit,
|
|
188
|
+
...(input.topic ? { topic: input.topic } : {}),
|
|
189
|
+
...(input.domains ? { domains: input.domains } : {}),
|
|
190
|
+
...(input.excludeDomains ? { excludeDomains: input.excludeDomains } : {}),
|
|
191
|
+
...(input.timeRange ? { timeRange: input.timeRange } : {}),
|
|
192
|
+
};
|
|
193
|
+
const searchEnv = buildSearchEnv(ctx);
|
|
194
|
+
const advancedOptionsProvided = hasAdvancedSearchOptions(input);
|
|
195
|
+
const nativeSearchAvailable = Boolean(ctx.nativeSearchAdapter && ctx.providerContext?.capabilities?.nativeSearch);
|
|
196
|
+
const nativeProviderName = ctx.providerContext?.name ?? "unknown";
|
|
197
|
+
const routerCacheKey = buildRouterSearchCacheKey(searchEnv, input.query, searchOptions);
|
|
198
|
+
const nativeCacheKey = nativeSearchAvailable && !advancedOptionsProvided
|
|
199
|
+
? buildNativeSearchCacheKey(nativeProviderName, input.query, searchOptions)
|
|
200
|
+
: undefined;
|
|
201
|
+
if (nativeCacheKey) {
|
|
202
|
+
const cachedNative = web_cache_js_1.searchCache.get(nativeCacheKey);
|
|
203
|
+
if (cachedNative) {
|
|
204
|
+
return (0, utils_js_1.success)(`Found ${cachedNative.results.length} cached results for "${input.query}"`, wrapWebSearchOutput(cachedNative));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
const cachedRouter = web_cache_js_1.searchCache.get(routerCacheKey);
|
|
209
|
+
if (cachedRouter) {
|
|
210
|
+
return (0, utils_js_1.success)(`Found ${cachedRouter.results.length} cached results for "${input.query}"`, wrapWebSearchOutput(cachedRouter));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (advancedOptionsProvided && nativeSearchAvailable) {
|
|
214
|
+
types_1.log.debug("[web_search] advanced options provided; bypassing native adapter");
|
|
215
|
+
}
|
|
216
|
+
// Native search routing: If provider supports native search and adapter is wired, use it
|
|
217
|
+
// Phase 1: Gemini isolated adapter (router-based callback pattern)
|
|
218
|
+
if (nativeSearchAvailable && ctx.nativeSearchAdapter && !advancedOptionsProvided) {
|
|
219
|
+
try {
|
|
220
|
+
const rawResults = await ctx.nativeSearchAdapter(input.query);
|
|
221
|
+
if (rawResults.length === 0) {
|
|
222
|
+
throw new Error("Native search returned no results");
|
|
223
|
+
}
|
|
224
|
+
const results = rawResults.map((r) => ({
|
|
225
|
+
title: r.title,
|
|
226
|
+
url: r.url,
|
|
227
|
+
content: r.content,
|
|
228
|
+
score: r.score,
|
|
229
|
+
}));
|
|
230
|
+
const output = { query: input.query, results };
|
|
231
|
+
web_cache_js_1.searchCache.set(nativeCacheKey, output);
|
|
232
|
+
return (0, utils_js_1.success)(`Found ${results.length} results for "${input.query}" (native search)`, wrapWebSearchOutput(output));
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
// Fall through to SearchProviderRouter on native search failure
|
|
236
|
+
types_1.log.debug(`[web_search] native adapter failed, falling back: ${(0, utils_js_1.getErrorMessage)(err)}`);
|
|
237
|
+
const cachedRouterFallback = web_cache_js_1.searchCache.get(routerCacheKey);
|
|
238
|
+
if (cachedRouterFallback) {
|
|
239
|
+
return (0, utils_js_1.success)(`Found ${cachedRouterFallback.results.length} cached results for "${input.query}"`, wrapWebSearchOutput(cachedRouterFallback));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const searchRouter = createSearchRouter(searchEnv);
|
|
244
|
+
try {
|
|
245
|
+
// Race search against context abort signal for cancellation support
|
|
246
|
+
let results;
|
|
247
|
+
if (ctx.abortSignal) {
|
|
248
|
+
const abortPromise = new Promise((_resolve, reject) => {
|
|
249
|
+
if (ctx.abortSignal.aborted) {
|
|
250
|
+
reject(new DOMException("The operation was aborted", "AbortError"));
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
ctx.abortSignal.addEventListener("abort", () => reject(new DOMException("The operation was aborted", "AbortError")), { once: true });
|
|
254
|
+
});
|
|
255
|
+
results = await Promise.race([searchRouter.search(input.query, searchOptions), abortPromise]);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
results = await searchRouter.search(input.query, searchOptions);
|
|
259
|
+
}
|
|
260
|
+
// Normalize results to WebSearchResult shape (cache raw; wrap at return-time)
|
|
261
|
+
const webResults = results.map((r) => ({
|
|
262
|
+
title: r.title,
|
|
263
|
+
url: r.url,
|
|
264
|
+
content: r.content,
|
|
265
|
+
score: r.score,
|
|
266
|
+
}));
|
|
267
|
+
const output = { query: input.query, results: webResults };
|
|
268
|
+
web_cache_js_1.searchCache.set(routerCacheKey, output);
|
|
269
|
+
return (0, utils_js_1.success)(`Found ${webResults.length} results for "${input.query}"`, wrapWebSearchOutput(output));
|
|
270
|
+
}
|
|
271
|
+
catch (err) {
|
|
272
|
+
if (ctx.abortSignal?.aborted) {
|
|
273
|
+
return (0, utils_js_1.fail)("Web search cancelled");
|
|
274
|
+
}
|
|
275
|
+
return (0, utils_js_1.fail)(`Web search failed: ${(0, utils_js_1.getErrorMessage)(err)}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function wrapWebFetchOutput(output) {
|
|
279
|
+
if (typeof output.content !== "string") {
|
|
280
|
+
return output;
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
...output,
|
|
284
|
+
content: ensureWrappedExternalContent(output.content, "web_fetch"),
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function markFetchOutputFromCache(cached) {
|
|
288
|
+
return {
|
|
289
|
+
...cached,
|
|
290
|
+
fromCache: true,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function normalizeRequestHeaders(headers) {
|
|
294
|
+
if (!headers) {
|
|
295
|
+
return [];
|
|
296
|
+
}
|
|
297
|
+
return Object.entries(headers)
|
|
298
|
+
.map(([name, value]) => [name.trim().toLowerCase(), value.trim()])
|
|
299
|
+
.sort(([left], [right]) => left.localeCompare(right));
|
|
300
|
+
}
|
|
301
|
+
function hashRequestHeaders(headers) {
|
|
302
|
+
const normalizedHeaders = normalizeRequestHeaders(headers);
|
|
303
|
+
if (normalizedHeaders.length === 0) {
|
|
304
|
+
return "none";
|
|
305
|
+
}
|
|
306
|
+
return (0, node_crypto_1.createHash)("sha256").update(JSON.stringify(normalizedHeaders)).digest("hex");
|
|
307
|
+
}
|
|
308
|
+
function createFetchCacheKey({ url, format, headers, timeoutMs, maxSizeBytes, }) {
|
|
309
|
+
return `fetch:${url}:${format}:headers=${hashRequestHeaders(headers)}:maxSizeBytes=${maxSizeBytes}:timeoutMs=${timeoutMs}`;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Fetches content from a URL with retry resilience, caching, and security wrapping.
|
|
313
|
+
* Uses fetchWithRetry for automatic retry on transient failures (429, 5xx, ECONNRESET).
|
|
314
|
+
* Results are cached via LRU+TTL cache for 15 minutes.
|
|
315
|
+
*/
|
|
316
|
+
async function executeWebFetch(input, ctx) {
|
|
317
|
+
// Normalize GitHub blob URLs to raw content URLs before fetching
|
|
318
|
+
const url = (0, url_js_1.normalizeGitHubUrl)(input.url);
|
|
319
|
+
// Validate URL structure. DNS/SSRF safety is enforced by fetchWithSsrf
|
|
320
|
+
// so validation and fetch share one trust boundary.
|
|
321
|
+
const urlError = (0, ssrf_js_1.validateUrlStructure)(url);
|
|
322
|
+
if (urlError) {
|
|
323
|
+
return (0, utils_js_1.fail)(urlError);
|
|
324
|
+
}
|
|
325
|
+
const format = input.format ?? "text";
|
|
326
|
+
const timeoutMs = input.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
327
|
+
const maxSizeBytes = input.maxSizeBytes ?? FETCH_MAX_SIZE_BYTES;
|
|
328
|
+
// Check cache first (use normalized URL + request variants to avoid collisions)
|
|
329
|
+
const cacheKey = createFetchCacheKey({
|
|
330
|
+
url,
|
|
331
|
+
format,
|
|
332
|
+
headers: input.headers,
|
|
333
|
+
timeoutMs,
|
|
334
|
+
maxSizeBytes,
|
|
335
|
+
});
|
|
336
|
+
const cached = web_cache_js_1.fetchCache.get(cacheKey);
|
|
337
|
+
if (cached) {
|
|
338
|
+
return (0, utils_js_1.success)(`Fetched ${input.url} (cached)`, wrapWebFetchOutput(markFetchOutputFromCache(cached)));
|
|
339
|
+
}
|
|
340
|
+
const { controller, timeoutId } = createTimeoutController(timeoutMs);
|
|
341
|
+
// Forward context abort signal to our controller
|
|
342
|
+
const unlinkAbort = linkAbortSignal(ctx.abortSignal, controller);
|
|
343
|
+
try {
|
|
344
|
+
const fetchOptions = {
|
|
345
|
+
headers: input.headers ?? {},
|
|
346
|
+
signal: controller.signal,
|
|
347
|
+
redirect: "manual",
|
|
348
|
+
};
|
|
349
|
+
// Use DNS-pinned SSRF fetch wrapper with transient retry support.
|
|
350
|
+
const initialResponse = await (0, retry_js_1.fetchWithSsrf)(url, fetchOptions, {
|
|
351
|
+
maxAttempts: 2,
|
|
352
|
+
});
|
|
353
|
+
// Follow redirects manually and keep each hop on the same DNS-pinned path.
|
|
354
|
+
const response = await (0, ssrf_js_1.followRedirects)(initialResponse, fetchOptions, {
|
|
355
|
+
baseUrl: url,
|
|
356
|
+
fetchFn: (redirectUrl, redirectInit) => (0, retry_js_1.fetchWithSsrf)(redirectUrl, redirectInit, { maxAttempts: 2 }),
|
|
357
|
+
validateRedirectUrl: ssrf_js_1.validateUrlStructure,
|
|
358
|
+
});
|
|
359
|
+
clearTimeout(timeoutId);
|
|
360
|
+
if (!response.ok) {
|
|
361
|
+
await (0, ssrf_js_1.discardResponseBody)(response);
|
|
362
|
+
unlinkAbort();
|
|
363
|
+
return (0, utils_js_1.fail)(`HTTP error: ${response.status} ${response.statusText}`, {
|
|
364
|
+
status: response.status,
|
|
365
|
+
statusText: response.statusText,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
// Check Content-Length header for size limit
|
|
369
|
+
const contentLength = response.headers.get("Content-Length");
|
|
370
|
+
if (contentLength) {
|
|
371
|
+
const size = parseInt(contentLength, 10);
|
|
372
|
+
if (!isNaN(size) && size > maxSizeBytes) {
|
|
373
|
+
await (0, ssrf_js_1.discardResponseBody)(response);
|
|
374
|
+
unlinkAbort();
|
|
375
|
+
return (0, utils_js_1.fail)(`Response too large: ${size} bytes exceeds maximum of ${maxSizeBytes} bytes`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
const contentType = response.headers.get("Content-Type") ?? undefined;
|
|
379
|
+
let content;
|
|
380
|
+
// Use streaming reader to enforce size limit even for chunked responses
|
|
381
|
+
let text;
|
|
382
|
+
let contentBytes = 0;
|
|
383
|
+
try {
|
|
384
|
+
const result = await readResponseWithLimit(response, maxSizeBytes);
|
|
385
|
+
text = result.text;
|
|
386
|
+
contentBytes = result.contentBytes;
|
|
387
|
+
if (result.truncated) {
|
|
388
|
+
unlinkAbort();
|
|
389
|
+
return (0, utils_js_1.fail)(`Response body exceeds maximum size of ${maxSizeBytes} bytes`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
catch (sizeErr) {
|
|
393
|
+
unlinkAbort();
|
|
394
|
+
return (0, utils_js_1.fail)((0, utils_js_1.getErrorMessage)(sizeErr));
|
|
395
|
+
}
|
|
396
|
+
if (format === "json") {
|
|
397
|
+
const parsed = (0, safe_parse_json_js_1.safeParseJson)(text, JsonFetchContentSchema);
|
|
398
|
+
if (!parsed.ok) {
|
|
399
|
+
unlinkAbort();
|
|
400
|
+
return (0, utils_js_1.fail)(`Failed to parse JSON response (${parsed.reason})`);
|
|
401
|
+
}
|
|
402
|
+
content = parsed.data;
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
content = text;
|
|
406
|
+
}
|
|
407
|
+
const output = {
|
|
408
|
+
content,
|
|
409
|
+
status: response.status,
|
|
410
|
+
contentType,
|
|
411
|
+
fromCache: false,
|
|
412
|
+
fetchedAt: new Date().toISOString(),
|
|
413
|
+
finalUrl: response.url || url,
|
|
414
|
+
contentBytes,
|
|
415
|
+
truncated: false,
|
|
416
|
+
};
|
|
417
|
+
web_cache_js_1.fetchCache.set(cacheKey, output);
|
|
418
|
+
unlinkAbort();
|
|
419
|
+
return (0, utils_js_1.success)(`Fetched ${input.url} (${response.status})`, wrapWebFetchOutput(output));
|
|
420
|
+
}
|
|
421
|
+
catch (err) {
|
|
422
|
+
clearTimeout(timeoutId);
|
|
423
|
+
unlinkAbort();
|
|
424
|
+
if (err instanceof Error &&
|
|
425
|
+
(err.name === "AbortError" || (err instanceof DOMException && err.name === "AbortError"))) {
|
|
426
|
+
if (ctx.abortSignal?.aborted) {
|
|
427
|
+
return (0, utils_js_1.fail)("Request cancelled");
|
|
428
|
+
}
|
|
429
|
+
return (0, utils_js_1.fail)(`Request timed out after ${timeoutMs}ms`);
|
|
430
|
+
}
|
|
431
|
+
return (0, utils_js_1.fail)((0, utils_js_1.getErrorMessage)(err));
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
// ============================================================================
|
|
435
|
+
// Browse
|
|
436
|
+
// ============================================================================
|
|
437
|
+
/** Default timeout for browsing in milliseconds */
|
|
438
|
+
const BROWSE_TIMEOUT_MS = 30_000;
|
|
439
|
+
/** Maximum content length returned by browse (characters) — increased from 10K to 50K */
|
|
440
|
+
const BROWSE_MAX_CONTENT_LENGTH = 50_000;
|
|
441
|
+
function wrapBrowseOutput(output) {
|
|
442
|
+
return {
|
|
443
|
+
...output,
|
|
444
|
+
content: ensureWrappedExternalContent(output.content, "browse"),
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function markBrowseOutputFromCache(cached) {
|
|
448
|
+
return {
|
|
449
|
+
...cached,
|
|
450
|
+
fromCache: true,
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Browses a URL by fetching its HTML content and extracting Markdown.
|
|
455
|
+
* Uses Readability.js + Turndown for article extraction with three-tier fallback.
|
|
456
|
+
* Supports GitHub URL normalization, retry on transient failures, LRU+TTL caching,
|
|
457
|
+
* and nonce-based external content wrapping.
|
|
458
|
+
*/
|
|
459
|
+
async function executeBrowse(input, ctx) {
|
|
460
|
+
// Validate URL
|
|
461
|
+
if (!input.url) {
|
|
462
|
+
return (0, utils_js_1.fail)("URL is required for browse");
|
|
463
|
+
}
|
|
464
|
+
// Normalize GitHub blob URLs to raw content URLs
|
|
465
|
+
const url = (0, url_js_1.normalizeGitHubUrl)(input.url);
|
|
466
|
+
// Check cache (using normalized URL as key)
|
|
467
|
+
const cached = web_cache_js_1.browseCache.get(url);
|
|
468
|
+
if (cached) {
|
|
469
|
+
return (0, utils_js_1.success)(`Browsed ${input.url} (cached)`, wrapBrowseOutput(markBrowseOutputFromCache(cached)));
|
|
470
|
+
}
|
|
471
|
+
const urlError = (0, ssrf_js_1.validateUrlStructure)(url);
|
|
472
|
+
if (urlError) {
|
|
473
|
+
return (0, utils_js_1.fail)(urlError);
|
|
474
|
+
}
|
|
475
|
+
const timeoutMs = input.timeoutMs ?? BROWSE_TIMEOUT_MS;
|
|
476
|
+
const { controller, timeoutId } = createTimeoutController(timeoutMs);
|
|
477
|
+
// Forward context abort signal to our controller
|
|
478
|
+
const unlinkAbort = linkAbortSignal(ctx.abortSignal, controller);
|
|
479
|
+
try {
|
|
480
|
+
const fetchOptions = {
|
|
481
|
+
headers: {
|
|
482
|
+
"User-Agent": (0, url_js_1.getUserAgent)(),
|
|
483
|
+
Accept: "text/html, application/xhtml+xml, */*",
|
|
484
|
+
},
|
|
485
|
+
signal: controller.signal,
|
|
486
|
+
redirect: "manual",
|
|
487
|
+
};
|
|
488
|
+
// Use DNS-pinned SSRF fetch wrapper with transient retry support.
|
|
489
|
+
const initialResponse = await (0, retry_js_1.fetchWithSsrf)(url, fetchOptions, {
|
|
490
|
+
maxAttempts: 2,
|
|
491
|
+
});
|
|
492
|
+
// Follow redirects manually and keep each hop on the same DNS-pinned path.
|
|
493
|
+
const response = await (0, ssrf_js_1.followRedirects)(initialResponse, fetchOptions, {
|
|
494
|
+
baseUrl: url,
|
|
495
|
+
fetchFn: (redirectUrl, redirectInit) => (0, retry_js_1.fetchWithSsrf)(redirectUrl, redirectInit, { maxAttempts: 2 }),
|
|
496
|
+
validateRedirectUrl: ssrf_js_1.validateUrlStructure,
|
|
497
|
+
});
|
|
498
|
+
clearTimeout(timeoutId);
|
|
499
|
+
if (!response.ok) {
|
|
500
|
+
await (0, ssrf_js_1.discardResponseBody)(response);
|
|
501
|
+
unlinkAbort();
|
|
502
|
+
return (0, utils_js_1.fail)(`HTTP error fetching ${input.url}: ${response.status} ${response.statusText}`);
|
|
503
|
+
}
|
|
504
|
+
// Truncate large pages gracefully — content gets reduced to 50K chars by
|
|
505
|
+
// Readability+Turndown anyway, so the first 2MB of HTML is plenty.
|
|
506
|
+
const { text: html, truncated: responseTruncated, contentBytes, } = await readResponseWithLimit(response, BROWSE_MAX_SIZE_BYTES, {
|
|
507
|
+
truncate: true,
|
|
508
|
+
});
|
|
509
|
+
// Extract content using Content-Type-aware extraction pipeline.
|
|
510
|
+
const { title, content: extractedContent } = await (0, content_extraction_js_1.extractFromResponse)(html, url, response.headers.get("Content-Type"));
|
|
511
|
+
// Truncate to 50K character limit
|
|
512
|
+
// extractContent() internally truncates to MAX_CONTENT_LENGTH (50K),
|
|
513
|
+
// so content that was originally longer arrives here at exactly 50K.
|
|
514
|
+
// Use >= to detect content that hit the internal limit.
|
|
515
|
+
const contentLimitReached = extractedContent.length >= BROWSE_MAX_CONTENT_LENGTH;
|
|
516
|
+
const truncated = contentLimitReached || responseTruncated;
|
|
517
|
+
const truncatedContent = contentLimitReached
|
|
518
|
+
? extractedContent.slice(0, BROWSE_MAX_CONTENT_LENGTH) + "\n\n[Content truncated]"
|
|
519
|
+
: responseTruncated
|
|
520
|
+
? extractedContent + "\n\n[Content truncated]"
|
|
521
|
+
: extractedContent;
|
|
522
|
+
const output = {
|
|
523
|
+
url: input.url,
|
|
524
|
+
title,
|
|
525
|
+
content: truncatedContent,
|
|
526
|
+
fromCache: false,
|
|
527
|
+
fetchedAt: new Date().toISOString(),
|
|
528
|
+
finalUrl: response.url || url,
|
|
529
|
+
contentBytes,
|
|
530
|
+
truncated,
|
|
531
|
+
};
|
|
532
|
+
web_cache_js_1.browseCache.set(url, output);
|
|
533
|
+
unlinkAbort();
|
|
534
|
+
return (0, utils_js_1.success)(`Browsed ${input.url}`, wrapBrowseOutput(output));
|
|
535
|
+
}
|
|
536
|
+
catch (err) {
|
|
537
|
+
clearTimeout(timeoutId);
|
|
538
|
+
unlinkAbort();
|
|
539
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
540
|
+
if (ctx.abortSignal?.aborted) {
|
|
541
|
+
return (0, utils_js_1.fail)("Browse cancelled");
|
|
542
|
+
}
|
|
543
|
+
return (0, utils_js_1.fail)(`Browse timed out after ${timeoutMs}ms: ${input.url}`);
|
|
544
|
+
}
|
|
545
|
+
return (0, utils_js_1.fail)(`Browse failed: ${(0, utils_js_1.getErrorMessage)(err)}`);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
//# sourceMappingURL=web.js.map
|