@aria-cli/tools 1.0.19 → 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/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-v49pd2a0.js → index-45qvfjbf.js} +2 -2
- package/dist/index.js +71 -372
- package/dist/local-control-http-auth.js +3 -0
- 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/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.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-cf6pmvx6.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/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,577 @@
|
|
|
1
|
+
import * as fsSync from "node:fs";
|
|
2
|
+
import * as fs from "node:fs/promises";
|
|
3
|
+
import * as nodePath from "node:path";
|
|
4
|
+
import { execFileSync } from "node:child_process";
|
|
5
|
+
import { frg } from "@aria-cli/fastripgrep";
|
|
6
|
+
const repoStates = new Map();
|
|
7
|
+
const flushStates = new Map();
|
|
8
|
+
export const DEFAULT_BACKGROUND_FRG_FLUSH_DELAY_MS = 750;
|
|
9
|
+
export const BACKGROUND_FRG_MAX_FLUSH_DELAY_MS = 30_000;
|
|
10
|
+
export const MAX_PENDING_MUTATIONS_BEFORE_SYNC_FLUSH = 32;
|
|
11
|
+
export const MAX_PENDING_MUTATION_BYTES_BEFORE_SYNC_FLUSH = 512 * 1024;
|
|
12
|
+
export const MAX_CACHED_MUTATION_CONTENT_BYTES = 256 * 1024;
|
|
13
|
+
function normalizePath(p) {
|
|
14
|
+
return nodePath.resolve(p);
|
|
15
|
+
}
|
|
16
|
+
function walDir(repoRoot) {
|
|
17
|
+
return nodePath.join(normalizePath(repoRoot), ".frg", "session");
|
|
18
|
+
}
|
|
19
|
+
function walPath(repoRoot) {
|
|
20
|
+
return nodePath.join(walDir(repoRoot), "aria-pending.jsonl");
|
|
21
|
+
}
|
|
22
|
+
function ensureSessionStorageDir(repoRoot) {
|
|
23
|
+
fsSync.mkdirSync(walDir(repoRoot), { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
function normalizeStoredContent(content) {
|
|
26
|
+
if (typeof content !== "string") {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return Buffer.byteLength(content, "utf8") <= MAX_CACHED_MUTATION_CONTENT_BYTES
|
|
30
|
+
? content
|
|
31
|
+
: undefined;
|
|
32
|
+
}
|
|
33
|
+
function getRepoState(repoRoot) {
|
|
34
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
35
|
+
const existing = repoStates.get(normalizedRepoRoot);
|
|
36
|
+
if (existing) {
|
|
37
|
+
ensureRepoStateLoaded(normalizedRepoRoot, existing);
|
|
38
|
+
return existing;
|
|
39
|
+
}
|
|
40
|
+
const created = { loaded: false, sequence: 0, pending: new Map() };
|
|
41
|
+
repoStates.set(normalizedRepoRoot, created);
|
|
42
|
+
ensureRepoStateLoaded(normalizedRepoRoot, created);
|
|
43
|
+
return created;
|
|
44
|
+
}
|
|
45
|
+
function getFlushState(repoRoot) {
|
|
46
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
47
|
+
const existing = flushStates.get(normalizedRepoRoot);
|
|
48
|
+
if (existing)
|
|
49
|
+
return existing;
|
|
50
|
+
const created = { timer: null, inFlight: false, retryCount: 0 };
|
|
51
|
+
flushStates.set(normalizedRepoRoot, created);
|
|
52
|
+
return created;
|
|
53
|
+
}
|
|
54
|
+
function ensureRepoStateLoaded(repoRoot, state) {
|
|
55
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
56
|
+
const currentState = state ?? repoStates.get(normalizedRepoRoot);
|
|
57
|
+
if (!currentState || currentState.loaded) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const pendingWalPath = walPath(normalizedRepoRoot);
|
|
61
|
+
if (fsSync.existsSync(pendingWalPath)) {
|
|
62
|
+
try {
|
|
63
|
+
const lines = fsSync.readFileSync(pendingWalPath, "utf8").split(/\r?\n/).filter(Boolean);
|
|
64
|
+
for (const line of lines) {
|
|
65
|
+
const parsed = JSON.parse(line);
|
|
66
|
+
const normalizedPath = normalizePath(parsed.path);
|
|
67
|
+
currentState.pending.set(normalizedPath, {
|
|
68
|
+
...parsed,
|
|
69
|
+
repoRoot: normalizedRepoRoot,
|
|
70
|
+
path: normalizedPath,
|
|
71
|
+
content: normalizeStoredContent(parsed.content),
|
|
72
|
+
});
|
|
73
|
+
currentState.sequence = Math.max(currentState.sequence, parsed.sequence ?? 0);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Ignore malformed WAL and proceed with empty/in-memory state.
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
currentState.loaded = true;
|
|
81
|
+
}
|
|
82
|
+
function rewriteWal(repoRoot) {
|
|
83
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
84
|
+
const state = repoStates.get(normalizedRepoRoot);
|
|
85
|
+
if (!state || state.pending.size === 0) {
|
|
86
|
+
try {
|
|
87
|
+
fsSync.rmSync(walPath(normalizedRepoRoot), { force: true });
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// ignore
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
ensureSessionStorageDir(normalizedRepoRoot);
|
|
95
|
+
const records = [...state.pending.values()].sort((a, b) => a.sequence - b.sequence);
|
|
96
|
+
const content = records.map((record) => JSON.stringify(record)).join("\n") + "\n";
|
|
97
|
+
fsSync.writeFileSync(walPath(normalizedRepoRoot), content, "utf8");
|
|
98
|
+
}
|
|
99
|
+
function appendWalRecord(repoRoot, record) {
|
|
100
|
+
ensureSessionStorageDir(repoRoot);
|
|
101
|
+
fsSync.appendFileSync(walPath(repoRoot), `${JSON.stringify(record)}\n`, "utf8");
|
|
102
|
+
}
|
|
103
|
+
function findGitRepoRoot(startPath) {
|
|
104
|
+
let current = normalizePath(startPath);
|
|
105
|
+
try {
|
|
106
|
+
const stat = fsSync.statSync(current);
|
|
107
|
+
if (!stat.isDirectory()) {
|
|
108
|
+
current = nodePath.dirname(current);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
current = nodePath.dirname(current);
|
|
113
|
+
}
|
|
114
|
+
while (true) {
|
|
115
|
+
if (fsSync.existsSync(nodePath.join(current, ".git"))) {
|
|
116
|
+
return current;
|
|
117
|
+
}
|
|
118
|
+
const parent = nodePath.dirname(current);
|
|
119
|
+
if (parent === current) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
current = parent;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function escapeRegex(text) {
|
|
126
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
127
|
+
}
|
|
128
|
+
function compilePattern(options) {
|
|
129
|
+
let pattern = options.literal ? escapeRegex(options.pattern) : options.pattern;
|
|
130
|
+
const smartCaseInsensitive = options.smartCase && !/[A-Z]/.test(options.pattern);
|
|
131
|
+
const flags = `${options.caseInsensitive || smartCaseInsensitive ? "i" : ""}g`;
|
|
132
|
+
return new RegExp(pattern, flags);
|
|
133
|
+
}
|
|
134
|
+
function globToRegExp(glob) {
|
|
135
|
+
const escaped = glob
|
|
136
|
+
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
137
|
+
.replace(/\*\*/g, "::DOUBLE_STAR::")
|
|
138
|
+
.replace(/\*/g, "[^/]*")
|
|
139
|
+
.replace(/::DOUBLE_STAR::/g, ".*")
|
|
140
|
+
.replace(/\?/g, ".");
|
|
141
|
+
return new RegExp(`^${escaped}$`);
|
|
142
|
+
}
|
|
143
|
+
function pathMatchesFilters(relativePath, options) {
|
|
144
|
+
if (options.fileType) {
|
|
145
|
+
const ext = options.fileType.startsWith(".") ? options.fileType : `.${options.fileType}`;
|
|
146
|
+
if (!relativePath.endsWith(ext)) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (options.glob) {
|
|
151
|
+
const re = globToRegExp(options.glob);
|
|
152
|
+
if (!re.test(relativePath)) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
function buildContextLines(lines, lineIndex, radius) {
|
|
159
|
+
const before = [];
|
|
160
|
+
const after = [];
|
|
161
|
+
for (let i = Math.max(0, lineIndex - radius); i < lineIndex; i++) {
|
|
162
|
+
before.push({ line: i + 1, content: lines[i] ?? "" });
|
|
163
|
+
}
|
|
164
|
+
for (let i = lineIndex + 1; i <= Math.min(lines.length - 1, lineIndex + radius); i++) {
|
|
165
|
+
after.push({ line: i + 1, content: lines[i] ?? "" });
|
|
166
|
+
}
|
|
167
|
+
return { before, after };
|
|
168
|
+
}
|
|
169
|
+
function relativeToRepo(repoRoot, filePath) {
|
|
170
|
+
return nodePath.relative(repoRoot, filePath).split(nodePath.sep).join("/");
|
|
171
|
+
}
|
|
172
|
+
function isBinaryBuffer(content) {
|
|
173
|
+
const checkLength = Math.min(content.length, 8192);
|
|
174
|
+
for (let i = 0; i < checkLength; i++) {
|
|
175
|
+
if (content[i] === 0) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
function setMutationRecordForRepo(repoRoot, filePath, operation, content, options) {
|
|
182
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
183
|
+
const state = getRepoState(normalizedRepoRoot);
|
|
184
|
+
state.sequence += 1;
|
|
185
|
+
const normalizedPath = normalizePath(filePath);
|
|
186
|
+
const record = {
|
|
187
|
+
repoRoot: normalizedRepoRoot,
|
|
188
|
+
path: normalizedPath,
|
|
189
|
+
operation,
|
|
190
|
+
sequence: state.sequence,
|
|
191
|
+
recordedAt: Date.now(),
|
|
192
|
+
content: normalizeStoredContent(content),
|
|
193
|
+
};
|
|
194
|
+
state.pending.set(normalizedPath, record);
|
|
195
|
+
if (options?.persistWal !== false) {
|
|
196
|
+
appendWalRecord(normalizedRepoRoot, record);
|
|
197
|
+
}
|
|
198
|
+
if (options?.scheduleFlush !== false) {
|
|
199
|
+
scheduleBackgroundFrgFlush(normalizedRepoRoot);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function runGit(repoRoot, args) {
|
|
203
|
+
try {
|
|
204
|
+
return execFileSync("git", args, {
|
|
205
|
+
cwd: normalizePath(repoRoot),
|
|
206
|
+
encoding: "utf8",
|
|
207
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
208
|
+
}).trim();
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
export function getTrackedRepoRootForPath(filePath) {
|
|
215
|
+
return findGitRepoRoot(filePath);
|
|
216
|
+
}
|
|
217
|
+
export function ensureFrgRepoStateLoaded(repoRoot) {
|
|
218
|
+
void getRepoState(repoRoot);
|
|
219
|
+
}
|
|
220
|
+
export function recordFrgMutation(filePath, operation, content) {
|
|
221
|
+
const repoRoot = getTrackedRepoRootForPath(filePath);
|
|
222
|
+
if (!repoRoot)
|
|
223
|
+
return;
|
|
224
|
+
setMutationRecordForRepo(repoRoot, filePath, operation, content);
|
|
225
|
+
}
|
|
226
|
+
export function getPendingFrgMutations(repoRoot) {
|
|
227
|
+
const state = getRepoState(repoRoot);
|
|
228
|
+
return [...state.pending.values()].sort((a, b) => a.sequence - b.sequence);
|
|
229
|
+
}
|
|
230
|
+
export function getPendingFrgMutationBytes(repoRoot) {
|
|
231
|
+
return getPendingFrgMutations(repoRoot).reduce((total, record) => {
|
|
232
|
+
if (typeof record.content === "string") {
|
|
233
|
+
return total + Buffer.byteLength(record.content, "utf8");
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
return total + fsSync.statSync(record.path).size;
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
return total;
|
|
240
|
+
}
|
|
241
|
+
}, 0);
|
|
242
|
+
}
|
|
243
|
+
export function clearPendingFrgMutations(repoRoot) {
|
|
244
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
245
|
+
repoStates.delete(normalizedRepoRoot);
|
|
246
|
+
try {
|
|
247
|
+
fsSync.rmSync(walPath(normalizedRepoRoot), { force: true });
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
// ignore
|
|
251
|
+
}
|
|
252
|
+
const flushState = flushStates.get(normalizedRepoRoot);
|
|
253
|
+
if (flushState?.timer) {
|
|
254
|
+
clearTimeout(flushState.timer);
|
|
255
|
+
}
|
|
256
|
+
flushStates.delete(normalizedRepoRoot);
|
|
257
|
+
}
|
|
258
|
+
export function flushPendingFrgMutations(repoRoot) {
|
|
259
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
260
|
+
const state = getRepoState(normalizedRepoRoot);
|
|
261
|
+
const flushState = getFlushState(normalizedRepoRoot);
|
|
262
|
+
const pendingCount = state.pending.size;
|
|
263
|
+
if (pendingCount === 0) {
|
|
264
|
+
return { flushed: false, reason: "no-pending-mutations", pendingCount };
|
|
265
|
+
}
|
|
266
|
+
if (flushState.timer) {
|
|
267
|
+
clearTimeout(flushState.timer);
|
|
268
|
+
flushState.timer = null;
|
|
269
|
+
}
|
|
270
|
+
if (flushState.inFlight) {
|
|
271
|
+
return { flushed: false, reason: "flush-in-flight", pendingCount };
|
|
272
|
+
}
|
|
273
|
+
flushState.inFlight = true;
|
|
274
|
+
try {
|
|
275
|
+
maybeBuildFrgIndexForRepo(normalizedRepoRoot);
|
|
276
|
+
// Targeted update: pass only changed/deleted files instead of full directory walk.
|
|
277
|
+
// O(changed_files) instead of O(all_files).
|
|
278
|
+
const pending = [...state.pending.values()];
|
|
279
|
+
const targetChanged = pending.filter((r) => r.operation === "write").map((r) => r.path);
|
|
280
|
+
const targetDeleted = pending.filter((r) => r.operation === "delete").map((r) => r.path);
|
|
281
|
+
const result = targetChanged.length > 0 || targetDeleted.length > 0
|
|
282
|
+
? frg({ command: "update", path: normalizedRepoRoot, targetChanged, targetDeleted })
|
|
283
|
+
: frg({ command: "update", path: normalizedRepoRoot });
|
|
284
|
+
state.pending.clear();
|
|
285
|
+
rewriteWal(normalizedRepoRoot);
|
|
286
|
+
flushState.lastFlushAt = Date.now();
|
|
287
|
+
flushState.lastError = undefined;
|
|
288
|
+
flushState.retryCount = 0;
|
|
289
|
+
flushState.retryDelayMs = undefined;
|
|
290
|
+
return { flushed: true, pendingCount, result };
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
flushState.lastError = error instanceof Error ? error.message : String(error);
|
|
294
|
+
flushState.retryCount += 1;
|
|
295
|
+
flushState.retryDelayMs = Math.min((flushState.retryDelayMs ?? DEFAULT_BACKGROUND_FRG_FLUSH_DELAY_MS) * 2, BACKGROUND_FRG_MAX_FLUSH_DELAY_MS);
|
|
296
|
+
return { flushed: false, reason: "flush-failed", pendingCount };
|
|
297
|
+
}
|
|
298
|
+
finally {
|
|
299
|
+
flushState.inFlight = false;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
export function maybeBuildFrgIndexForRepo(repoRoot) {
|
|
303
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
304
|
+
const frgDir = nodePath.join(normalizedRepoRoot, ".frg");
|
|
305
|
+
if (fsSync.existsSync(frgDir))
|
|
306
|
+
return;
|
|
307
|
+
try {
|
|
308
|
+
frg({ command: "init", path: normalizedRepoRoot });
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
// best effort; search may still fall back to noIndex if init fails
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
export function scheduleBackgroundFrgFlush(repoRoot, delayMs = DEFAULT_BACKGROUND_FRG_FLUSH_DELAY_MS) {
|
|
315
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
316
|
+
const state = getRepoState(normalizedRepoRoot);
|
|
317
|
+
if (state.pending.size === 0) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const flushState = getFlushState(normalizedRepoRoot);
|
|
321
|
+
flushState.lastScheduledAt = Date.now();
|
|
322
|
+
if (flushState.inFlight) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (flushState.timer) {
|
|
326
|
+
clearTimeout(flushState.timer);
|
|
327
|
+
}
|
|
328
|
+
const effectiveDelay = flushState.retryDelayMs ?? delayMs;
|
|
329
|
+
flushState.timer = setTimeout(() => {
|
|
330
|
+
flushState.timer = null;
|
|
331
|
+
const result = flushPendingFrgMutations(normalizedRepoRoot);
|
|
332
|
+
if (!result.flushed && result.reason === "flush-failed" && result.pendingCount > 0) {
|
|
333
|
+
scheduleBackgroundFrgFlush(normalizedRepoRoot, flushState.retryDelayMs ?? delayMs);
|
|
334
|
+
}
|
|
335
|
+
}, effectiveDelay);
|
|
336
|
+
if (typeof flushState.timer.unref === "function") {
|
|
337
|
+
flushState.timer.unref();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
export function shouldForceSynchronousFrgFlush(repoRoot) {
|
|
341
|
+
const pendingCount = getPendingFrgMutations(repoRoot).length;
|
|
342
|
+
const pendingBytes = getPendingFrgMutationBytes(repoRoot);
|
|
343
|
+
return (pendingCount >= MAX_PENDING_MUTATIONS_BEFORE_SYNC_FLUSH ||
|
|
344
|
+
pendingBytes >= MAX_PENDING_MUTATION_BYTES_BEFORE_SYNC_FLUSH);
|
|
345
|
+
}
|
|
346
|
+
export function getFrgFlushStatus(repoRoot) {
|
|
347
|
+
const flushState = getFlushState(repoRoot);
|
|
348
|
+
return {
|
|
349
|
+
inFlight: flushState.inFlight,
|
|
350
|
+
scheduled: Boolean(flushState.timer),
|
|
351
|
+
lastScheduledAt: flushState.lastScheduledAt,
|
|
352
|
+
lastFlushAt: flushState.lastFlushAt,
|
|
353
|
+
lastError: flushState.lastError,
|
|
354
|
+
retryCount: flushState.retryCount,
|
|
355
|
+
retryDelayMs: flushState.retryDelayMs,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
export function getGitDirtyStatus(repoRoot) {
|
|
359
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
360
|
+
const headCommit = runGit(normalizedRepoRoot, ["rev-parse", "HEAD"]) ?? undefined;
|
|
361
|
+
const headTree = runGit(normalizedRepoRoot, ["rev-parse", "HEAD^{tree}"]) ?? undefined;
|
|
362
|
+
const tracked = [];
|
|
363
|
+
const trackedOutput = runGit(normalizedRepoRoot, ["diff", "--name-status", "-z", "HEAD", "--"]);
|
|
364
|
+
if (trackedOutput) {
|
|
365
|
+
const tokens = trackedOutput.split("\0").filter(Boolean);
|
|
366
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
367
|
+
const status = tokens[i] ?? "";
|
|
368
|
+
if (status.startsWith("R")) {
|
|
369
|
+
const oldPath = tokens[++i];
|
|
370
|
+
const newPath = tokens[++i];
|
|
371
|
+
if (oldPath)
|
|
372
|
+
tracked.push({
|
|
373
|
+
path: normalizePath(nodePath.join(normalizedRepoRoot, oldPath)),
|
|
374
|
+
operation: "delete",
|
|
375
|
+
});
|
|
376
|
+
if (newPath)
|
|
377
|
+
tracked.push({
|
|
378
|
+
path: normalizePath(nodePath.join(normalizedRepoRoot, newPath)),
|
|
379
|
+
operation: "write",
|
|
380
|
+
});
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
const filePath = tokens[++i];
|
|
384
|
+
if (!filePath)
|
|
385
|
+
continue;
|
|
386
|
+
tracked.push({
|
|
387
|
+
path: normalizePath(nodePath.join(normalizedRepoRoot, filePath)),
|
|
388
|
+
operation: status.startsWith("D") ? "delete" : "write",
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
const untracked = [];
|
|
393
|
+
const untrackedOutput = runGit(normalizedRepoRoot, [
|
|
394
|
+
"ls-files",
|
|
395
|
+
"-o",
|
|
396
|
+
"--exclude-standard",
|
|
397
|
+
"-z",
|
|
398
|
+
]);
|
|
399
|
+
if (untrackedOutput) {
|
|
400
|
+
for (const token of untrackedOutput.split("\0").filter(Boolean)) {
|
|
401
|
+
untracked.push(normalizePath(nodePath.join(normalizedRepoRoot, token)));
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return { headCommit, headTree, tracked, untracked };
|
|
405
|
+
}
|
|
406
|
+
export function reconcileGitDirtyMutations(repoRoot) {
|
|
407
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
408
|
+
const status = getGitDirtyStatus(normalizedRepoRoot);
|
|
409
|
+
const state = getRepoState(normalizedRepoRoot);
|
|
410
|
+
let changed = false;
|
|
411
|
+
for (const entry of status.tracked) {
|
|
412
|
+
const existing = state.pending.get(entry.path);
|
|
413
|
+
if (!existing || existing.operation !== entry.operation) {
|
|
414
|
+
setMutationRecordForRepo(normalizedRepoRoot, entry.path, entry.operation, undefined, {
|
|
415
|
+
persistWal: false,
|
|
416
|
+
scheduleFlush: false,
|
|
417
|
+
});
|
|
418
|
+
changed = true;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
for (const filePath of status.untracked) {
|
|
422
|
+
const existing = state.pending.get(filePath);
|
|
423
|
+
if (!existing || existing.operation !== "write") {
|
|
424
|
+
setMutationRecordForRepo(normalizedRepoRoot, filePath, "write", undefined, {
|
|
425
|
+
persistWal: false,
|
|
426
|
+
scheduleFlush: false,
|
|
427
|
+
});
|
|
428
|
+
changed = true;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (changed) {
|
|
432
|
+
rewriteWal(normalizedRepoRoot);
|
|
433
|
+
scheduleBackgroundFrgFlush(normalizedRepoRoot);
|
|
434
|
+
}
|
|
435
|
+
return status;
|
|
436
|
+
}
|
|
437
|
+
export function getFrgFreshnessSnapshot(repoRoot, indexed) {
|
|
438
|
+
const normalizedRepoRoot = normalizePath(repoRoot);
|
|
439
|
+
const gitStatus = getGitDirtyStatus(normalizedRepoRoot);
|
|
440
|
+
const flush = getFrgFlushStatus(normalizedRepoRoot);
|
|
441
|
+
const sessionPendingCount = getPendingFrgMutations(normalizedRepoRoot).length;
|
|
442
|
+
const sessionPendingBytes = getPendingFrgMutationBytes(normalizedRepoRoot);
|
|
443
|
+
let freshnessState = "fresh";
|
|
444
|
+
if (!indexed) {
|
|
445
|
+
freshnessState = "missing";
|
|
446
|
+
}
|
|
447
|
+
else if (flush.inFlight) {
|
|
448
|
+
freshnessState = "syncing";
|
|
449
|
+
}
|
|
450
|
+
else if (flush.scheduled) {
|
|
451
|
+
freshnessState = "sync-scheduled";
|
|
452
|
+
}
|
|
453
|
+
else if ((indexed.tree_hash ?? null) &&
|
|
454
|
+
gitStatus.headTree &&
|
|
455
|
+
indexed.tree_hash !== gitStatus.headTree) {
|
|
456
|
+
freshnessState = "head-mismatch";
|
|
457
|
+
}
|
|
458
|
+
else if (sessionPendingCount > 0) {
|
|
459
|
+
freshnessState = "session-dirty";
|
|
460
|
+
}
|
|
461
|
+
else if (gitStatus.tracked.length > 0 || gitStatus.untracked.length > 0) {
|
|
462
|
+
freshnessState = "overlay-dirty";
|
|
463
|
+
}
|
|
464
|
+
else if ((indexed.age_seconds ?? 0) > 86400) {
|
|
465
|
+
freshnessState = "stale";
|
|
466
|
+
}
|
|
467
|
+
return {
|
|
468
|
+
headCommit: gitStatus.headCommit,
|
|
469
|
+
headTree: gitStatus.headTree,
|
|
470
|
+
dirtyTrackedCount: gitStatus.tracked.length,
|
|
471
|
+
dirtyUntrackedCount: gitStatus.untracked.length,
|
|
472
|
+
sessionPendingCount,
|
|
473
|
+
sessionPendingBytes,
|
|
474
|
+
flush,
|
|
475
|
+
freshnessState,
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
export async function searchPendingFrgMutations(repoRoot, options) {
|
|
479
|
+
const pending = getPendingFrgMutations(repoRoot);
|
|
480
|
+
if (pending.length === 0) {
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
483
|
+
const regex = compilePattern(options);
|
|
484
|
+
const fileSet = new Set();
|
|
485
|
+
const counts = new Map();
|
|
486
|
+
const matches = [];
|
|
487
|
+
let matched = false;
|
|
488
|
+
for (const record of pending) {
|
|
489
|
+
if (record.operation === "delete") {
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
const relativePath = relativeToRepo(repoRoot, record.path);
|
|
493
|
+
if (!pathMatchesFilters(relativePath, options)) {
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
let content;
|
|
497
|
+
if (typeof record.content === "string") {
|
|
498
|
+
content = record.content;
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
let raw;
|
|
502
|
+
try {
|
|
503
|
+
raw = await fs.readFile(record.path);
|
|
504
|
+
}
|
|
505
|
+
catch {
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (isBinaryBuffer(raw)) {
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
content = raw.toString("utf8");
|
|
512
|
+
}
|
|
513
|
+
const lines = content.split(/\r?\n/);
|
|
514
|
+
let fileMatchCount = 0;
|
|
515
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
516
|
+
const line = lines[lineIndex] ?? "";
|
|
517
|
+
regex.lastIndex = 0;
|
|
518
|
+
let lineMatched = false;
|
|
519
|
+
let execMatch;
|
|
520
|
+
while ((execMatch = regex.exec(line)) !== null) {
|
|
521
|
+
matched = true;
|
|
522
|
+
lineMatched = true;
|
|
523
|
+
fileMatchCount += 1;
|
|
524
|
+
if (!options.filesOnly && !options.count && !options.quiet) {
|
|
525
|
+
const context = buildContextLines(lines, lineIndex, options.context ?? 0);
|
|
526
|
+
matches.push({
|
|
527
|
+
file: relativePath,
|
|
528
|
+
line: lineIndex + 1,
|
|
529
|
+
content: line,
|
|
530
|
+
match_start: execMatch.index,
|
|
531
|
+
match_end: execMatch.index + execMatch[0].length,
|
|
532
|
+
context_before: context.before,
|
|
533
|
+
context_after: context.after,
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
if ((options.maxCount ?? Number.POSITIVE_INFINITY) <= fileMatchCount) {
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
if (execMatch[0].length === 0) {
|
|
540
|
+
regex.lastIndex += 1;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
if (options.filesOnly && lineMatched) {
|
|
544
|
+
fileSet.add(relativePath);
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
if ((options.maxCount ?? Number.POSITIVE_INFINITY) <= fileMatchCount) {
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (options.count && fileMatchCount > 0) {
|
|
552
|
+
counts.set(relativePath, fileMatchCount);
|
|
553
|
+
}
|
|
554
|
+
if (options.filesOnly && fileMatchCount > 0) {
|
|
555
|
+
fileSet.add(relativePath);
|
|
556
|
+
}
|
|
557
|
+
if (options.quiet && fileMatchCount > 0) {
|
|
558
|
+
return { mode: "quiet", matched: true };
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (options.quiet) {
|
|
562
|
+
return { mode: "quiet", matched };
|
|
563
|
+
}
|
|
564
|
+
if (options.filesOnly) {
|
|
565
|
+
return { mode: "files", files: [...fileSet].sort() };
|
|
566
|
+
}
|
|
567
|
+
if (options.count) {
|
|
568
|
+
return {
|
|
569
|
+
mode: "counts",
|
|
570
|
+
counts: [...counts.entries()]
|
|
571
|
+
.sort((a, b) => a[0].localeCompare(b[0]))
|
|
572
|
+
.map(([file, count]) => ({ file, count })),
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
return { mode: "matches", matches };
|
|
576
|
+
}
|
|
577
|
+
//# sourceMappingURL=frg-freshness.js.map
|