@spinabot/brigade 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +746 -93
- package/brigade.mjs +150 -73
- package/dist/agents/a2a-policy-canonicalize.d.ts +60 -0
- package/dist/agents/a2a-policy-canonicalize.d.ts.map +1 -0
- package/dist/agents/a2a-policy-canonicalize.js +103 -0
- package/dist/agents/a2a-policy-canonicalize.js.map +1 -0
- package/dist/agents/agent-event-bus.d.ts +221 -0
- package/dist/agents/agent-event-bus.d.ts.map +1 -0
- package/dist/agents/agent-event-bus.js +88 -0
- package/dist/agents/agent-event-bus.js.map +1 -0
- package/dist/agents/agent-events.d.ts +84 -0
- package/dist/agents/agent-events.d.ts.map +1 -0
- package/dist/agents/agent-events.js +309 -0
- package/dist/agents/agent-events.js.map +1 -0
- package/dist/agents/agent-events.types.d.ts +139 -0
- package/dist/agents/agent-events.types.d.ts.map +1 -0
- package/dist/agents/agent-events.types.js +27 -0
- package/dist/agents/agent-events.types.js.map +1 -0
- package/dist/agents/agent-loop.d.ts +145 -0
- package/dist/agents/agent-loop.d.ts.map +1 -0
- package/dist/agents/agent-loop.js +1938 -0
- package/dist/agents/agent-loop.js.map +1 -0
- package/dist/agents/agent-scope.d.ts +28 -0
- package/dist/agents/agent-scope.d.ts.map +1 -0
- package/dist/agents/agent-scope.js +39 -0
- package/dist/agents/agent-scope.js.map +1 -0
- package/dist/agents/approval-bridge.d.ts +139 -0
- package/dist/agents/approval-bridge.d.ts.map +1 -0
- package/dist/agents/approval-bridge.js +178 -0
- package/dist/agents/approval-bridge.js.map +1 -0
- package/dist/agents/carrow.d.ts +49 -0
- package/dist/agents/carrow.d.ts.map +1 -0
- package/dist/agents/carrow.js +57 -0
- package/dist/agents/carrow.js.map +1 -0
- package/dist/agents/channels/abort-triggers.d.ts +17 -0
- package/dist/agents/channels/abort-triggers.d.ts.map +1 -0
- package/dist/agents/channels/abort-triggers.js +52 -0
- package/dist/agents/channels/abort-triggers.js.map +1 -0
- package/dist/agents/channels/access-control/index.d.ts +5 -0
- package/dist/agents/channels/access-control/index.d.ts.map +1 -0
- package/dist/agents/channels/access-control/index.js +4 -0
- package/dist/agents/channels/access-control/index.js.map +1 -0
- package/dist/agents/channels/access-control/policy.d.ts +69 -0
- package/dist/agents/channels/access-control/policy.d.ts.map +1 -0
- package/dist/agents/channels/access-control/policy.js +123 -0
- package/dist/agents/channels/access-control/policy.js.map +1 -0
- package/dist/agents/channels/access-control/store.d.ts +86 -0
- package/dist/agents/channels/access-control/store.d.ts.map +1 -0
- package/dist/agents/channels/access-control/store.js +482 -0
- package/dist/agents/channels/access-control/store.js.map +1 -0
- package/dist/agents/channels/access-control/types.d.ts +52 -0
- package/dist/agents/channels/access-control/types.d.ts.map +1 -0
- package/dist/agents/channels/access-control/types.js +20 -0
- package/dist/agents/channels/access-control/types.js.map +1 -0
- package/dist/agents/channels/active-manager.d.ts +31 -0
- package/dist/agents/channels/active-manager.d.ts.map +1 -0
- package/dist/agents/channels/active-manager.js +41 -0
- package/dist/agents/channels/active-manager.js.map +1 -0
- package/dist/agents/channels/agent-switch-command.d.ts +53 -0
- package/dist/agents/channels/agent-switch-command.d.ts.map +1 -0
- package/dist/agents/channels/agent-switch-command.js +349 -0
- package/dist/agents/channels/agent-switch-command.js.map +1 -0
- package/dist/agents/channels/approval-router.d.ts +158 -0
- package/dist/agents/channels/approval-router.d.ts.map +1 -0
- package/dist/agents/channels/approval-router.js +446 -0
- package/dist/agents/channels/approval-router.js.map +1 -0
- package/dist/agents/channels/channel-entry-contract.d.ts +70 -0
- package/dist/agents/channels/channel-entry-contract.d.ts.map +1 -0
- package/dist/agents/channels/channel-entry-contract.js +48 -0
- package/dist/agents/channels/channel-entry-contract.js.map +1 -0
- package/dist/agents/channels/channel-plugin-manager.d.ts +86 -0
- package/dist/agents/channels/channel-plugin-manager.d.ts.map +1 -0
- package/dist/agents/channels/channel-plugin-manager.js +345 -0
- package/dist/agents/channels/channel-plugin-manager.js.map +1 -0
- package/dist/agents/channels/chat-type.d.ts +27 -0
- package/dist/agents/channels/chat-type.d.ts.map +1 -0
- package/dist/agents/channels/chat-type.js +33 -0
- package/dist/agents/channels/chat-type.js.map +1 -0
- package/dist/agents/channels/dedupe.d.ts +44 -0
- package/dist/agents/channels/dedupe.d.ts.map +1 -0
- package/dist/agents/channels/dedupe.js +80 -0
- package/dist/agents/channels/dedupe.js.map +1 -0
- package/dist/agents/channels/inbound-pipeline.d.ts +90 -0
- package/dist/agents/channels/inbound-pipeline.d.ts.map +1 -0
- package/dist/agents/channels/inbound-pipeline.js +721 -0
- package/dist/agents/channels/inbound-pipeline.js.map +1 -0
- package/dist/agents/channels/last-channel.d.ts +56 -0
- package/dist/agents/channels/last-channel.d.ts.map +1 -0
- package/dist/agents/channels/last-channel.js +65 -0
- package/dist/agents/channels/last-channel.js.map +1 -0
- package/dist/agents/channels/manager.d.ts +76 -0
- package/dist/agents/channels/manager.d.ts.map +1 -0
- package/dist/agents/channels/manager.js +132 -0
- package/dist/agents/channels/manager.js.map +1 -0
- package/dist/agents/channels/media-capture.d.ts +23 -0
- package/dist/agents/channels/media-capture.d.ts.map +1 -0
- package/dist/agents/channels/media-capture.js +40 -0
- package/dist/agents/channels/media-capture.js.map +1 -0
- package/dist/agents/channels/plugin-channel-manager-facade.d.ts +18 -0
- package/dist/agents/channels/plugin-channel-manager-facade.d.ts.map +1 -0
- package/dist/agents/channels/plugin-channel-manager-facade.js +52 -0
- package/dist/agents/channels/plugin-channel-manager-facade.js.map +1 -0
- package/dist/agents/channels/reply-sanitizer.d.ts +38 -0
- package/dist/agents/channels/reply-sanitizer.d.ts.map +1 -0
- package/dist/agents/channels/reply-sanitizer.js +94 -0
- package/dist/agents/channels/reply-sanitizer.js.map +1 -0
- package/dist/agents/channels/retryable-inbound.d.ts +31 -0
- package/dist/agents/channels/retryable-inbound.d.ts.map +1 -0
- package/dist/agents/channels/retryable-inbound.js +37 -0
- package/dist/agents/channels/retryable-inbound.js.map +1 -0
- package/dist/agents/channels/types.adapters.d.ts +399 -0
- package/dist/agents/channels/types.adapters.d.ts.map +1 -0
- package/dist/agents/channels/types.adapters.js +33 -0
- package/dist/agents/channels/types.adapters.js.map +1 -0
- package/dist/agents/channels/types.core.d.ts +134 -0
- package/dist/agents/channels/types.core.d.ts.map +1 -0
- package/dist/agents/channels/types.core.js +32 -0
- package/dist/agents/channels/types.core.js.map +1 -0
- package/dist/agents/channels/types.plugin.d.ts +78 -0
- package/dist/agents/channels/types.plugin.d.ts.map +1 -0
- package/dist/agents/channels/types.plugin.js +30 -0
- package/dist/agents/channels/types.plugin.js.map +1 -0
- package/dist/agents/channels/whatsapp/account-config.d.ts +50 -0
- package/dist/agents/channels/whatsapp/account-config.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/account-config.js +105 -0
- package/dist/agents/channels/whatsapp/account-config.js.map +1 -0
- package/dist/agents/channels/whatsapp/adapter.d.ts +22 -0
- package/dist/agents/channels/whatsapp/adapter.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/adapter.js +270 -0
- package/dist/agents/channels/whatsapp/adapter.js.map +1 -0
- package/dist/agents/channels/whatsapp/chunk.d.ts +26 -0
- package/dist/agents/channels/whatsapp/chunk.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/chunk.js +123 -0
- package/dist/agents/channels/whatsapp/chunk.js.map +1 -0
- package/dist/agents/channels/whatsapp/connection.d.ts +249 -0
- package/dist/agents/channels/whatsapp/connection.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/connection.js +1628 -0
- package/dist/agents/channels/whatsapp/connection.js.map +1 -0
- package/dist/agents/channels/whatsapp/convex-auth-state.d.ts +34 -0
- package/dist/agents/channels/whatsapp/convex-auth-state.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/convex-auth-state.js +168 -0
- package/dist/agents/channels/whatsapp/convex-auth-state.js.map +1 -0
- package/dist/agents/channels/whatsapp/format.d.ts +15 -0
- package/dist/agents/channels/whatsapp/format.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/format.js +66 -0
- package/dist/agents/channels/whatsapp/format.js.map +1 -0
- package/dist/agents/channels/whatsapp/inbound-extras.d.ts +30 -0
- package/dist/agents/channels/whatsapp/inbound-extras.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/inbound-extras.js +146 -0
- package/dist/agents/channels/whatsapp/inbound-extras.js.map +1 -0
- package/dist/agents/channels/whatsapp/index.d.ts +7 -0
- package/dist/agents/channels/whatsapp/index.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/index.js +7 -0
- package/dist/agents/channels/whatsapp/index.js.map +1 -0
- package/dist/agents/channels/whatsapp/media.d.ts +47 -0
- package/dist/agents/channels/whatsapp/media.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/media.js +192 -0
- package/dist/agents/channels/whatsapp/media.js.map +1 -0
- package/dist/agents/channels/whatsapp/module.d.ts +10 -0
- package/dist/agents/channels/whatsapp/module.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/module.js +17 -0
- package/dist/agents/channels/whatsapp/module.js.map +1 -0
- package/dist/agents/channels/whatsapp/plugin.d.ts +60 -0
- package/dist/agents/channels/whatsapp/plugin.d.ts.map +1 -0
- package/dist/agents/channels/whatsapp/plugin.js +238 -0
- package/dist/agents/channels/whatsapp/plugin.js.map +1 -0
- package/dist/agents/cmd-ism-guard.d.ts +47 -0
- package/dist/agents/cmd-ism-guard.d.ts.map +1 -0
- package/dist/agents/cmd-ism-guard.js +100 -0
- package/dist/agents/cmd-ism-guard.js.map +1 -0
- package/dist/agents/config-write-guard.d.ts +25 -0
- package/dist/agents/config-write-guard.d.ts.map +1 -0
- package/dist/agents/config-write-guard.js +95 -0
- package/dist/agents/config-write-guard.js.map +1 -0
- package/dist/agents/content-quality-retry.d.ts +66 -0
- package/dist/agents/content-quality-retry.d.ts.map +1 -0
- package/dist/agents/content-quality-retry.js +140 -0
- package/dist/agents/content-quality-retry.js.map +1 -0
- package/dist/agents/error-classifier.d.ts +89 -0
- package/dist/agents/error-classifier.d.ts.map +1 -0
- package/dist/agents/error-classifier.js +630 -0
- package/dist/agents/error-classifier.js.map +1 -0
- package/dist/agents/exec-gate.d.ts +113 -0
- package/dist/agents/exec-gate.d.ts.map +1 -0
- package/dist/agents/exec-gate.js +335 -0
- package/dist/agents/exec-gate.js.map +1 -0
- package/dist/agents/exec-session-allow.d.ts +30 -0
- package/dist/agents/exec-session-allow.d.ts.map +1 -0
- package/dist/agents/exec-session-allow.js +50 -0
- package/dist/agents/exec-session-allow.js.map +1 -0
- package/dist/agents/extensions/active-registry.d.ts +4 -0
- package/dist/agents/extensions/active-registry.d.ts.map +1 -0
- package/dist/agents/extensions/active-registry.js +18 -0
- package/dist/agents/extensions/active-registry.js.map +1 -0
- package/dist/agents/extensions/discovery.d.ts +84 -0
- package/dist/agents/extensions/discovery.d.ts.map +1 -0
- package/dist/agents/extensions/discovery.js +249 -0
- package/dist/agents/extensions/discovery.js.map +1 -0
- package/dist/agents/extensions/hook-runner.d.ts +67 -0
- package/dist/agents/extensions/hook-runner.d.ts.map +1 -0
- package/dist/agents/extensions/hook-runner.js +155 -0
- package/dist/agents/extensions/hook-runner.js.map +1 -0
- package/dist/agents/extensions/index.d.ts +15 -0
- package/dist/agents/extensions/index.d.ts.map +1 -0
- package/dist/agents/extensions/index.js +14 -0
- package/dist/agents/extensions/index.js.map +1 -0
- package/dist/agents/extensions/loader.d.ts +38 -0
- package/dist/agents/extensions/loader.d.ts.map +1 -0
- package/dist/agents/extensions/loader.js +142 -0
- package/dist/agents/extensions/loader.js.map +1 -0
- package/dist/agents/extensions/modules/arxiv.d.ts +28 -0
- package/dist/agents/extensions/modules/arxiv.d.ts.map +1 -0
- package/dist/agents/extensions/modules/arxiv.js +145 -0
- package/dist/agents/extensions/modules/arxiv.js.map +1 -0
- package/dist/agents/extensions/modules/brave.d.ts +28 -0
- package/dist/agents/extensions/modules/brave.d.ts.map +1 -0
- package/dist/agents/extensions/modules/brave.js +489 -0
- package/dist/agents/extensions/modules/brave.js.map +1 -0
- package/dist/agents/extensions/modules/duckduckgo.d.ts +27 -0
- package/dist/agents/extensions/modules/duckduckgo.d.ts.map +1 -0
- package/dist/agents/extensions/modules/duckduckgo.js +263 -0
- package/dist/agents/extensions/modules/duckduckgo.js.map +1 -0
- package/dist/agents/extensions/modules/exa.d.ts +19 -0
- package/dist/agents/extensions/modules/exa.d.ts.map +1 -0
- package/dist/agents/extensions/modules/exa.js +208 -0
- package/dist/agents/extensions/modules/exa.js.map +1 -0
- package/dist/agents/extensions/modules/firecrawl.d.ts +51 -0
- package/dist/agents/extensions/modules/firecrawl.d.ts.map +1 -0
- package/dist/agents/extensions/modules/firecrawl.js +280 -0
- package/dist/agents/extensions/modules/firecrawl.js.map +1 -0
- package/dist/agents/extensions/modules/github-search.d.ts +29 -0
- package/dist/agents/extensions/modules/github-search.d.ts.map +1 -0
- package/dist/agents/extensions/modules/github-search.js +197 -0
- package/dist/agents/extensions/modules/github-search.js.map +1 -0
- package/dist/agents/extensions/modules/hackernews.d.ts +17 -0
- package/dist/agents/extensions/modules/hackernews.d.ts.map +1 -0
- package/dist/agents/extensions/modules/hackernews.js +144 -0
- package/dist/agents/extensions/modules/hackernews.js.map +1 -0
- package/dist/agents/extensions/modules/index.d.ts +11 -0
- package/dist/agents/extensions/modules/index.d.ts.map +1 -0
- package/dist/agents/extensions/modules/index.js +64 -0
- package/dist/agents/extensions/modules/index.js.map +1 -0
- package/dist/agents/extensions/modules/npm-search.d.ts +15 -0
- package/dist/agents/extensions/modules/npm-search.d.ts.map +1 -0
- package/dist/agents/extensions/modules/npm-search.js +126 -0
- package/dist/agents/extensions/modules/npm-search.js.map +1 -0
- package/dist/agents/extensions/modules/ollama-search.d.ts +30 -0
- package/dist/agents/extensions/modules/ollama-search.d.ts.map +1 -0
- package/dist/agents/extensions/modules/ollama-search.js +171 -0
- package/dist/agents/extensions/modules/ollama-search.js.map +1 -0
- package/dist/agents/extensions/modules/perplexity.d.ts +19 -0
- package/dist/agents/extensions/modules/perplexity.d.ts.map +1 -0
- package/dist/agents/extensions/modules/perplexity.js +358 -0
- package/dist/agents/extensions/modules/perplexity.js.map +1 -0
- package/dist/agents/extensions/modules/searxng.d.ts +43 -0
- package/dist/agents/extensions/modules/searxng.d.ts.map +1 -0
- package/dist/agents/extensions/modules/searxng.js +191 -0
- package/dist/agents/extensions/modules/searxng.js.map +1 -0
- package/dist/agents/extensions/modules/tavily.d.ts +71 -0
- package/dist/agents/extensions/modules/tavily.d.ts.map +1 -0
- package/dist/agents/extensions/modules/tavily.js +330 -0
- package/dist/agents/extensions/modules/tavily.js.map +1 -0
- package/dist/agents/extensions/modules/web-provider-helpers.d.ts +89 -0
- package/dist/agents/extensions/modules/web-provider-helpers.d.ts.map +1 -0
- package/dist/agents/extensions/modules/web-provider-helpers.js +146 -0
- package/dist/agents/extensions/modules/web-provider-helpers.js.map +1 -0
- package/dist/agents/extensions/modules/web-search-filters.d.ts +62 -0
- package/dist/agents/extensions/modules/web-search-filters.d.ts.map +1 -0
- package/dist/agents/extensions/modules/web-search-filters.js +179 -0
- package/dist/agents/extensions/modules/web-search-filters.js.map +1 -0
- package/dist/agents/extensions/modules/wikipedia.d.ts +16 -0
- package/dist/agents/extensions/modules/wikipedia.d.ts.map +1 -0
- package/dist/agents/extensions/modules/wikipedia.js +138 -0
- package/dist/agents/extensions/modules/wikipedia.js.map +1 -0
- package/dist/agents/extensions/registry-cache.d.ts +74 -0
- package/dist/agents/extensions/registry-cache.d.ts.map +1 -0
- package/dist/agents/extensions/registry-cache.js +117 -0
- package/dist/agents/extensions/registry-cache.js.map +1 -0
- package/dist/agents/extensions/registry.d.ts +184 -0
- package/dist/agents/extensions/registry.d.ts.map +1 -0
- package/dist/agents/extensions/registry.js +512 -0
- package/dist/agents/extensions/registry.js.map +1 -0
- package/dist/agents/extensions/types.d.ts +1195 -0
- package/dist/agents/extensions/types.d.ts.map +1 -0
- package/dist/agents/extensions/types.js +28 -0
- package/dist/agents/extensions/types.js.map +1 -0
- package/dist/agents/gateway-call.d.ts +171 -0
- package/dist/agents/gateway-call.d.ts.map +1 -0
- package/dist/agents/gateway-call.js +74 -0
- package/dist/agents/gateway-call.js.map +1 -0
- package/dist/agents/heartbeat-runner.d.ts +100 -0
- package/dist/agents/heartbeat-runner.d.ts.map +1 -0
- package/dist/agents/heartbeat-runner.js +268 -0
- package/dist/agents/heartbeat-runner.js.map +1 -0
- package/dist/agents/heartbeat-scheduler.d.ts +56 -0
- package/dist/agents/heartbeat-scheduler.d.ts.map +1 -0
- package/dist/agents/heartbeat-scheduler.js +366 -0
- package/dist/agents/heartbeat-scheduler.js.map +1 -0
- package/dist/agents/heartbeat-wake.d.ts +99 -0
- package/dist/agents/heartbeat-wake.d.ts.map +1 -0
- package/dist/agents/heartbeat-wake.js +304 -0
- package/dist/agents/heartbeat-wake.js.map +1 -0
- package/dist/agents/identity-file.d.ts +26 -0
- package/dist/agents/identity-file.d.ts.map +1 -0
- package/dist/agents/identity-file.js +86 -0
- package/dist/agents/identity-file.js.map +1 -0
- package/dist/agents/identity-links.d.ts +44 -0
- package/dist/agents/identity-links.d.ts.map +1 -0
- package/dist/agents/identity-links.js +51 -0
- package/dist/agents/identity-links.js.map +1 -0
- package/dist/agents/loop/autonomous-agent.d.ts +55 -0
- package/dist/agents/loop/autonomous-agent.d.ts.map +1 -0
- package/dist/agents/loop/autonomous-agent.js +91 -0
- package/dist/agents/loop/autonomous-agent.js.map +1 -0
- package/dist/agents/loop/loop-guards.d.ts +95 -0
- package/dist/agents/loop/loop-guards.d.ts.map +1 -0
- package/dist/agents/loop/loop-guards.js +169 -0
- package/dist/agents/loop/loop-guards.js.map +1 -0
- package/dist/agents/loop/loop-runner.d.ts +72 -0
- package/dist/agents/loop/loop-runner.d.ts.map +1 -0
- package/dist/agents/loop/loop-runner.js +114 -0
- package/dist/agents/loop/loop-runner.js.map +1 -0
- package/dist/agents/memory/auto-recall.d.ts +69 -0
- package/dist/agents/memory/auto-recall.d.ts.map +1 -0
- package/dist/agents/memory/auto-recall.js +147 -0
- package/dist/agents/memory/auto-recall.js.map +1 -0
- package/dist/agents/memory/behavior-review.d.ts +68 -0
- package/dist/agents/memory/behavior-review.d.ts.map +1 -0
- package/dist/agents/memory/behavior-review.js +131 -0
- package/dist/agents/memory/behavior-review.js.map +1 -0
- package/dist/agents/memory/consolidate.d.ts +62 -0
- package/dist/agents/memory/consolidate.d.ts.map +1 -0
- package/dist/agents/memory/consolidate.js +275 -0
- package/dist/agents/memory/consolidate.js.map +1 -0
- package/dist/agents/memory/contradiction.d.ts +44 -0
- package/dist/agents/memory/contradiction.d.ts.map +1 -0
- package/dist/agents/memory/contradiction.js +86 -0
- package/dist/agents/memory/contradiction.js.map +1 -0
- package/dist/agents/memory/curator.d.ts +22 -0
- package/dist/agents/memory/curator.d.ts.map +1 -0
- package/dist/agents/memory/curator.js +52 -0
- package/dist/agents/memory/curator.js.map +1 -0
- package/dist/agents/memory/decay.d.ts +32 -0
- package/dist/agents/memory/decay.d.ts.map +1 -0
- package/dist/agents/memory/decay.js +86 -0
- package/dist/agents/memory/decay.js.map +1 -0
- package/dist/agents/memory/dream.d.ts +52 -0
- package/dist/agents/memory/dream.d.ts.map +1 -0
- package/dist/agents/memory/dream.js +192 -0
- package/dist/agents/memory/dream.js.map +1 -0
- package/dist/agents/memory/embedder-providers.d.ts +114 -0
- package/dist/agents/memory/embedder-providers.d.ts.map +1 -0
- package/dist/agents/memory/embedder-providers.js +213 -0
- package/dist/agents/memory/embedder-providers.js.map +1 -0
- package/dist/agents/memory/embedder.d.ts +84 -0
- package/dist/agents/memory/embedder.d.ts.map +1 -0
- package/dist/agents/memory/embedder.js +218 -0
- package/dist/agents/memory/embedder.js.map +1 -0
- package/dist/agents/memory/eval/asr-bench.d.ts +33 -0
- package/dist/agents/memory/eval/asr-bench.d.ts.map +1 -0
- package/dist/agents/memory/eval/asr-bench.js +129 -0
- package/dist/agents/memory/eval/asr-bench.js.map +1 -0
- package/dist/agents/memory/eval/capabilities.d.ts +97 -0
- package/dist/agents/memory/eval/capabilities.d.ts.map +1 -0
- package/dist/agents/memory/eval/capabilities.js +210 -0
- package/dist/agents/memory/eval/capabilities.js.map +1 -0
- package/dist/agents/memory/eval/gold-export.d.ts +44 -0
- package/dist/agents/memory/eval/gold-export.d.ts.map +1 -0
- package/dist/agents/memory/eval/gold-export.js +85 -0
- package/dist/agents/memory/eval/gold-export.js.map +1 -0
- package/dist/agents/memory/eval/gold-hard.d.ts +35 -0
- package/dist/agents/memory/eval/gold-hard.d.ts.map +1 -0
- package/dist/agents/memory/eval/gold-hard.js +113 -0
- package/dist/agents/memory/eval/gold-hard.js.map +1 -0
- package/dist/agents/memory/eval/gold-rich.d.ts +33 -0
- package/dist/agents/memory/eval/gold-rich.d.ts.map +1 -0
- package/dist/agents/memory/eval/gold-rich.js +82 -0
- package/dist/agents/memory/eval/gold-rich.js.map +1 -0
- package/dist/agents/memory/eval/gold-synthetic.d.ts +19 -0
- package/dist/agents/memory/eval/gold-synthetic.d.ts.map +1 -0
- package/dist/agents/memory/eval/gold-synthetic.js +65 -0
- package/dist/agents/memory/eval/gold-synthetic.js.map +1 -0
- package/dist/agents/memory/eval/gold.d.ts +73 -0
- package/dist/agents/memory/eval/gold.d.ts.map +1 -0
- package/dist/agents/memory/eval/gold.js +174 -0
- package/dist/agents/memory/eval/gold.js.map +1 -0
- package/dist/agents/memory/eval/harness.d.ts +110 -0
- package/dist/agents/memory/eval/harness.d.ts.map +1 -0
- package/dist/agents/memory/eval/harness.js +123 -0
- package/dist/agents/memory/eval/harness.js.map +1 -0
- package/dist/agents/memory/eval/metrics.d.ts +71 -0
- package/dist/agents/memory/eval/metrics.d.ts.map +1 -0
- package/dist/agents/memory/eval/metrics.js +169 -0
- package/dist/agents/memory/eval/metrics.js.map +1 -0
- package/dist/agents/memory/event-log.d.ts +52 -0
- package/dist/agents/memory/event-log.d.ts.map +1 -0
- package/dist/agents/memory/event-log.js +65 -0
- package/dist/agents/memory/event-log.js.map +1 -0
- package/dist/agents/memory/extract.d.ts +155 -0
- package/dist/agents/memory/extract.d.ts.map +1 -0
- package/dist/agents/memory/extract.js +571 -0
- package/dist/agents/memory/extract.js.map +1 -0
- package/dist/agents/memory/governance.d.ts +45 -0
- package/dist/agents/memory/governance.d.ts.map +1 -0
- package/dist/agents/memory/governance.js +113 -0
- package/dist/agents/memory/governance.js.map +1 -0
- package/dist/agents/memory/graph-export.d.ts +59 -0
- package/dist/agents/memory/graph-export.d.ts.map +1 -0
- package/dist/agents/memory/graph-export.js +181 -0
- package/dist/agents/memory/graph-export.js.map +1 -0
- package/dist/agents/memory/graph-recall.d.ts +42 -0
- package/dist/agents/memory/graph-recall.d.ts.map +1 -0
- package/dist/agents/memory/graph-recall.js +165 -0
- package/dist/agents/memory/graph-recall.js.map +1 -0
- package/dist/agents/memory/graph.d.ts +92 -0
- package/dist/agents/memory/graph.d.ts.map +1 -0
- package/dist/agents/memory/graph.js +266 -0
- package/dist/agents/memory/graph.js.map +1 -0
- package/dist/agents/memory/host-ports.d.ts +27 -0
- package/dist/agents/memory/host-ports.d.ts.map +1 -0
- package/dist/agents/memory/host-ports.js +31 -0
- package/dist/agents/memory/host-ports.js.map +1 -0
- package/dist/agents/memory/hybrid.d.ts +46 -0
- package/dist/agents/memory/hybrid.d.ts.map +1 -0
- package/dist/agents/memory/hybrid.js +184 -0
- package/dist/agents/memory/hybrid.js.map +1 -0
- package/dist/agents/memory/index.d.ts +13 -0
- package/dist/agents/memory/index.d.ts.map +1 -0
- package/dist/agents/memory/index.js +13 -0
- package/dist/agents/memory/index.js.map +1 -0
- package/dist/agents/memory/json-scan.d.ts +14 -0
- package/dist/agents/memory/json-scan.d.ts.map +1 -0
- package/dist/agents/memory/json-scan.js +47 -0
- package/dist/agents/memory/json-scan.js.map +1 -0
- package/dist/agents/memory/links.d.ts +92 -0
- package/dist/agents/memory/links.d.ts.map +1 -0
- package/dist/agents/memory/links.js +140 -0
- package/dist/agents/memory/links.js.map +1 -0
- package/dist/agents/memory/maintenance.d.ts +18 -0
- package/dist/agents/memory/maintenance.d.ts.map +1 -0
- package/dist/agents/memory/maintenance.js +66 -0
- package/dist/agents/memory/maintenance.js.map +1 -0
- package/dist/agents/memory/memory-mcp-server.d.ts +39 -0
- package/dist/agents/memory/memory-mcp-server.d.ts.map +1 -0
- package/dist/agents/memory/memory-mcp-server.js +122 -0
- package/dist/agents/memory/memory-mcp-server.js.map +1 -0
- package/dist/agents/memory/memory-mcp.d.ts +34 -0
- package/dist/agents/memory/memory-mcp.d.ts.map +1 -0
- package/dist/agents/memory/memory-mcp.js +130 -0
- package/dist/agents/memory/memory-mcp.js.map +1 -0
- package/dist/agents/memory/plugin-runtime.d.ts +133 -0
- package/dist/agents/memory/plugin-runtime.d.ts.map +1 -0
- package/dist/agents/memory/plugin-runtime.js +149 -0
- package/dist/agents/memory/plugin-runtime.js.map +1 -0
- package/dist/agents/memory/query.d.ts +50 -0
- package/dist/agents/memory/query.d.ts.map +1 -0
- package/dist/agents/memory/query.js +94 -0
- package/dist/agents/memory/query.js.map +1 -0
- package/dist/agents/memory/records.d.ts +617 -0
- package/dist/agents/memory/records.d.ts.map +1 -0
- package/dist/agents/memory/records.js +1327 -0
- package/dist/agents/memory/records.js.map +1 -0
- package/dist/agents/memory/reembed.d.ts +42 -0
- package/dist/agents/memory/reembed.d.ts.map +1 -0
- package/dist/agents/memory/reembed.js +60 -0
- package/dist/agents/memory/reembed.js.map +1 -0
- package/dist/agents/memory/relationship-extract.d.ts +259 -0
- package/dist/agents/memory/relationship-extract.d.ts.map +1 -0
- package/dist/agents/memory/relationship-extract.js +454 -0
- package/dist/agents/memory/relationship-extract.js.map +1 -0
- package/dist/agents/memory/rerank.d.ts +37 -0
- package/dist/agents/memory/rerank.d.ts.map +1 -0
- package/dist/agents/memory/rerank.js +43 -0
- package/dist/agents/memory/rerank.js.map +1 -0
- package/dist/agents/memory/scoring.d.ts +85 -0
- package/dist/agents/memory/scoring.d.ts.map +1 -0
- package/dist/agents/memory/scoring.js +139 -0
- package/dist/agents/memory/scoring.js.map +1 -0
- package/dist/agents/memory/self-improve.d.ts +56 -0
- package/dist/agents/memory/self-improve.d.ts.map +1 -0
- package/dist/agents/memory/self-improve.js +98 -0
- package/dist/agents/memory/self-improve.js.map +1 -0
- package/dist/agents/memory/self-review.d.ts +68 -0
- package/dist/agents/memory/self-review.d.ts.map +1 -0
- package/dist/agents/memory/self-review.js +109 -0
- package/dist/agents/memory/self-review.js.map +1 -0
- package/dist/agents/memory/storage.d.ts +156 -0
- package/dist/agents/memory/storage.d.ts.map +1 -0
- package/dist/agents/memory/storage.js +359 -0
- package/dist/agents/memory/storage.js.map +1 -0
- package/dist/agents/memory/tideline.d.ts +203 -0
- package/dist/agents/memory/tideline.d.ts.map +1 -0
- package/dist/agents/memory/tideline.js +189 -0
- package/dist/agents/memory/tideline.js.map +1 -0
- package/dist/agents/memory/vault.d.ts +142 -0
- package/dist/agents/memory/vault.d.ts.map +1 -0
- package/dist/agents/memory/vault.js +787 -0
- package/dist/agents/memory/vault.js.map +1 -0
- package/dist/agents/memory/write-gate.d.ts +76 -0
- package/dist/agents/memory/write-gate.d.ts.map +1 -0
- package/dist/agents/memory/write-gate.js +140 -0
- package/dist/agents/memory/write-gate.js.map +1 -0
- package/dist/agents/mid-turn-switch.d.ts +25 -0
- package/dist/agents/mid-turn-switch.d.ts.map +1 -0
- package/dist/agents/mid-turn-switch.js +103 -0
- package/dist/agents/mid-turn-switch.js.map +1 -0
- package/dist/agents/model-fallback.d.ts +50 -0
- package/dist/agents/model-fallback.d.ts.map +1 -0
- package/dist/agents/model-fallback.js +226 -0
- package/dist/agents/model-fallback.js.map +1 -0
- package/dist/agents/model-resolution.d.ts +38 -0
- package/dist/agents/model-resolution.d.ts.map +1 -0
- package/dist/agents/model-resolution.js +155 -0
- package/dist/agents/model-resolution.js.map +1 -0
- package/dist/agents/org/a2a-adapter.d.ts +49 -0
- package/dist/agents/org/a2a-adapter.d.ts.map +1 -0
- package/dist/agents/org/a2a-adapter.js +92 -0
- package/dist/agents/org/a2a-adapter.js.map +1 -0
- package/dist/agents/org/assets/mascots/README.md +34 -0
- package/dist/agents/org/assets/mascots/Untitled-1.png +0 -0
- package/dist/agents/org/assets/mascots/brigade_biceps.png +0 -0
- package/dist/agents/org/audit-log.d.ts +22 -0
- package/dist/agents/org/audit-log.d.ts.map +1 -0
- package/dist/agents/org/audit-log.js +37 -0
- package/dist/agents/org/audit-log.js.map +1 -0
- package/dist/agents/org/auto-derive.d.ts +22 -0
- package/dist/agents/org/auto-derive.d.ts.map +1 -0
- package/dist/agents/org/auto-derive.js +66 -0
- package/dist/agents/org/auto-derive.js.map +1 -0
- package/dist/agents/org/delivery-kind.d.ts +89 -0
- package/dist/agents/org/delivery-kind.d.ts.map +1 -0
- package/dist/agents/org/delivery-kind.js +149 -0
- package/dist/agents/org/delivery-kind.js.map +1 -0
- package/dist/agents/org/derive-graph.d.ts +34 -0
- package/dist/agents/org/derive-graph.d.ts.map +1 -0
- package/dist/agents/org/derive-graph.js +266 -0
- package/dist/agents/org/derive-graph.js.map +1 -0
- package/dist/agents/org/lints.d.ts +21 -0
- package/dist/agents/org/lints.d.ts.map +1 -0
- package/dist/agents/org/lints.js +133 -0
- package/dist/agents/org/lints.js.map +1 -0
- package/dist/agents/org/pride-html.d.ts +61 -0
- package/dist/agents/org/pride-html.d.ts.map +1 -0
- package/dist/agents/org/pride-html.js +565 -0
- package/dist/agents/org/pride-html.js.map +1 -0
- package/dist/agents/org/pride-image.d.ts +101 -0
- package/dist/agents/org/pride-image.d.ts.map +1 -0
- package/dist/agents/org/pride-image.js +210 -0
- package/dist/agents/org/pride-image.js.map +1 -0
- package/dist/agents/org/pride-taunts.d.ts +47 -0
- package/dist/agents/org/pride-taunts.d.ts.map +1 -0
- package/dist/agents/org/pride-taunts.js +411 -0
- package/dist/agents/org/pride-taunts.js.map +1 -0
- package/dist/agents/org/pride-template.d.ts +272 -0
- package/dist/agents/org/pride-template.d.ts.map +1 -0
- package/dist/agents/org/pride-template.js +892 -0
- package/dist/agents/org/pride-template.js.map +1 -0
- package/dist/agents/org/pride-themes.d.ts +80 -0
- package/dist/agents/org/pride-themes.d.ts.map +1 -0
- package/dist/agents/org/pride-themes.js +7596 -0
- package/dist/agents/org/pride-themes.js.map +1 -0
- package/dist/agents/org/structured-errors.d.ts +47 -0
- package/dist/agents/org/structured-errors.d.ts.map +1 -0
- package/dist/agents/org/structured-errors.js +97 -0
- package/dist/agents/org/structured-errors.js.map +1 -0
- package/dist/agents/org/types.d.ts +139 -0
- package/dist/agents/org/types.d.ts.map +1 -0
- package/dist/agents/org/types.js +43 -0
- package/dist/agents/org/types.js.map +1 -0
- package/dist/agents/org/validate.d.ts +36 -0
- package/dist/agents/org/validate.d.ts.map +1 -0
- package/dist/agents/org/validate.js +135 -0
- package/dist/agents/org/validate.js.map +1 -0
- package/dist/agents/path-write-guard.d.ts +82 -0
- package/dist/agents/path-write-guard.d.ts.map +1 -0
- package/dist/agents/path-write-guard.js +722 -0
- package/dist/agents/path-write-guard.js.map +1 -0
- package/dist/agents/payload-mutators.d.ts +175 -0
- package/dist/agents/payload-mutators.d.ts.map +1 -0
- package/dist/agents/payload-mutators.js +994 -0
- package/dist/agents/payload-mutators.js.map +1 -0
- package/dist/agents/pending-system-events.d.ts +76 -0
- package/dist/agents/pending-system-events.d.ts.map +1 -0
- package/dist/agents/pending-system-events.js +115 -0
- package/dist/agents/pending-system-events.js.map +1 -0
- package/dist/agents/provider-attribution.d.ts +19 -0
- package/dist/agents/provider-attribution.d.ts.map +1 -0
- package/dist/agents/provider-attribution.js +62 -0
- package/dist/agents/provider-attribution.js.map +1 -0
- package/dist/agents/quality/slop-detector.d.ts +40 -0
- package/dist/agents/quality/slop-detector.d.ts.map +1 -0
- package/dist/agents/quality/slop-detector.js +108 -0
- package/dist/agents/quality/slop-detector.js.map +1 -0
- package/dist/agents/quality/slop-index.d.ts +27 -0
- package/dist/agents/quality/slop-index.d.ts.map +1 -0
- package/dist/agents/quality/slop-index.js +124 -0
- package/dist/agents/quality/slop-index.js.map +1 -0
- package/dist/agents/retry-policy.d.ts +38 -0
- package/dist/agents/retry-policy.d.ts.map +1 -0
- package/dist/agents/retry-policy.js +276 -0
- package/dist/agents/retry-policy.js.map +1 -0
- package/dist/agents/routing/account-id.d.ts +43 -0
- package/dist/agents/routing/account-id.d.ts.map +1 -0
- package/dist/agents/routing/account-id.js +103 -0
- package/dist/agents/routing/account-id.js.map +1 -0
- package/dist/agents/routing/bindings.d.ts +20 -0
- package/dist/agents/routing/bindings.d.ts.map +1 -0
- package/dist/agents/routing/bindings.js +22 -0
- package/dist/agents/routing/bindings.js.map +1 -0
- package/dist/agents/routing/dm-scope-warning.d.ts +37 -0
- package/dist/agents/routing/dm-scope-warning.d.ts.map +1 -0
- package/dist/agents/routing/dm-scope-warning.js +110 -0
- package/dist/agents/routing/dm-scope-warning.js.map +1 -0
- package/dist/agents/routing/identity-links.d.ts +45 -0
- package/dist/agents/routing/identity-links.d.ts.map +1 -0
- package/dist/agents/routing/identity-links.js +85 -0
- package/dist/agents/routing/identity-links.js.map +1 -0
- package/dist/agents/routing/resolve-route.d.ts +91 -0
- package/dist/agents/routing/resolve-route.d.ts.map +1 -0
- package/dist/agents/routing/resolve-route.js +653 -0
- package/dist/agents/routing/resolve-route.js.map +1 -0
- package/dist/agents/routing/session-key.d.ts +168 -0
- package/dist/agents/routing/session-key.d.ts.map +1 -0
- package/dist/agents/routing/session-key.js +268 -0
- package/dist/agents/routing/session-key.js.map +1 -0
- package/dist/agents/sanitize-surrogates.d.ts +30 -0
- package/dist/agents/sanitize-surrogates.d.ts.map +1 -0
- package/dist/agents/sanitize-surrogates.js +56 -0
- package/dist/agents/sanitize-surrogates.js.map +1 -0
- package/dist/agents/session-context.d.ts +80 -0
- package/dist/agents/session-context.d.ts.map +1 -0
- package/dist/agents/session-context.js +76 -0
- package/dist/agents/session-context.js.map +1 -0
- package/dist/agents/session-event-prompt.d.ts +124 -0
- package/dist/agents/session-event-prompt.d.ts.map +1 -0
- package/dist/agents/session-event-prompt.js +179 -0
- package/dist/agents/session-event-prompt.js.map +1 -0
- package/dist/agents/session-inbox.d.ts +129 -0
- package/dist/agents/session-inbox.d.ts.map +1 -0
- package/dist/agents/session-inbox.js +492 -0
- package/dist/agents/session-inbox.js.map +1 -0
- package/dist/agents/session-registry.d.ts +148 -0
- package/dist/agents/session-registry.d.ts.map +1 -0
- package/dist/agents/session-registry.js +405 -0
- package/dist/agents/session-registry.js.map +1 -0
- package/dist/agents/session-wiring.d.ts +214 -0
- package/dist/agents/session-wiring.d.ts.map +1 -0
- package/dist/agents/session-wiring.js +278 -0
- package/dist/agents/session-wiring.js.map +1 -0
- package/dist/agents/session-write-lock.d.ts +15 -0
- package/dist/agents/session-write-lock.d.ts.map +1 -0
- package/dist/agents/session-write-lock.js +15 -0
- package/dist/agents/session-write-lock.js.map +1 -0
- package/dist/agents/skills/agent-filter.d.ts +43 -0
- package/dist/agents/skills/agent-filter.d.ts.map +1 -0
- package/dist/agents/skills/agent-filter.js +89 -0
- package/dist/agents/skills/agent-filter.js.map +1 -0
- package/dist/agents/skills/discovery.d.ts +97 -0
- package/dist/agents/skills/discovery.d.ts.map +1 -0
- package/dist/agents/skills/discovery.js +136 -0
- package/dist/agents/skills/discovery.js.map +1 -0
- package/dist/agents/skills/eligibility.d.ts +118 -0
- package/dist/agents/skills/eligibility.d.ts.map +1 -0
- package/dist/agents/skills/eligibility.js +280 -0
- package/dist/agents/skills/eligibility.js.map +1 -0
- package/dist/agents/skills/grant.d.ts +70 -0
- package/dist/agents/skills/grant.d.ts.map +1 -0
- package/dist/agents/skills/grant.js +106 -0
- package/dist/agents/skills/grant.js.map +1 -0
- package/dist/agents/skills/index.d.ts +35 -0
- package/dist/agents/skills/index.d.ts.map +1 -0
- package/dist/agents/skills/index.js +88 -0
- package/dist/agents/skills/index.js.map +1 -0
- package/dist/agents/skills/install-spec.d.ts +51 -0
- package/dist/agents/skills/install-spec.d.ts.map +1 -0
- package/dist/agents/skills/install-spec.js +21 -0
- package/dist/agents/skills/install-spec.js.map +1 -0
- package/dist/agents/skills/install.d.ts +68 -0
- package/dist/agents/skills/install.d.ts.map +1 -0
- package/dist/agents/skills/install.js +206 -0
- package/dist/agents/skills/install.js.map +1 -0
- package/dist/agents/skills/org-access.d.ts +27 -0
- package/dist/agents/skills/org-access.d.ts.map +1 -0
- package/dist/agents/skills/org-access.js +87 -0
- package/dist/agents/skills/org-access.js.map +1 -0
- package/dist/agents/skills/skill-consolidate.d.ts +76 -0
- package/dist/agents/skills/skill-consolidate.d.ts.map +1 -0
- package/dist/agents/skills/skill-consolidate.js +264 -0
- package/dist/agents/skills/skill-consolidate.js.map +1 -0
- package/dist/agents/skills/skill-curator.d.ts +91 -0
- package/dist/agents/skills/skill-curator.d.ts.map +1 -0
- package/dist/agents/skills/skill-curator.js +239 -0
- package/dist/agents/skills/skill-curator.js.map +1 -0
- package/dist/agents/skills/skill-manifest.d.ts +35 -0
- package/dist/agents/skills/skill-manifest.d.ts.map +1 -0
- package/dist/agents/skills/skill-manifest.js +82 -0
- package/dist/agents/skills/skill-manifest.js.map +1 -0
- package/dist/agents/skills/skill-review.d.ts +91 -0
- package/dist/agents/skills/skill-review.d.ts.map +1 -0
- package/dist/agents/skills/skill-review.js +271 -0
- package/dist/agents/skills/skill-review.js.map +1 -0
- package/dist/agents/skills/skill-usage.d.ts +81 -0
- package/dist/agents/skills/skill-usage.d.ts.map +1 -0
- package/dist/agents/skills/skill-usage.js +208 -0
- package/dist/agents/skills/skill-usage.js.map +1 -0
- package/dist/agents/skills/status.d.ts +68 -0
- package/dist/agents/skills/status.d.ts.map +1 -0
- package/dist/agents/skills/status.js +147 -0
- package/dist/agents/skills/status.js.map +1 -0
- package/dist/agents/skills/update-config.d.ts +32 -0
- package/dist/agents/skills/update-config.d.ts.map +1 -0
- package/dist/agents/skills/update-config.js +53 -0
- package/dist/agents/skills/update-config.js.map +1 -0
- package/dist/agents/slash-commands.d.ts +25 -0
- package/dist/agents/slash-commands.d.ts.map +1 -0
- package/dist/agents/slash-commands.js +151 -0
- package/dist/agents/slash-commands.js.map +1 -0
- package/dist/agents/smart-compaction.d.ts +105 -0
- package/dist/agents/smart-compaction.d.ts.map +1 -0
- package/dist/agents/smart-compaction.js +355 -0
- package/dist/agents/smart-compaction.js.map +1 -0
- package/dist/agents/stream-wrappers.d.ts +20 -0
- package/dist/agents/stream-wrappers.d.ts.map +1 -0
- package/dist/agents/stream-wrappers.js +307 -0
- package/dist/agents/stream-wrappers.js.map +1 -0
- package/dist/agents/subagent-abort-cascade.d.ts +31 -0
- package/dist/agents/subagent-abort-cascade.d.ts.map +1 -0
- package/dist/agents/subagent-abort-cascade.js +124 -0
- package/dist/agents/subagent-abort-cascade.js.map +1 -0
- package/dist/agents/subagent-announce-delivery.d.ts +83 -0
- package/dist/agents/subagent-announce-delivery.d.ts.map +1 -0
- package/dist/agents/subagent-announce-delivery.js +159 -0
- package/dist/agents/subagent-announce-delivery.js.map +1 -0
- package/dist/agents/subagent-budget.d.ts +36 -0
- package/dist/agents/subagent-budget.d.ts.map +1 -0
- package/dist/agents/subagent-budget.js +93 -0
- package/dist/agents/subagent-budget.js.map +1 -0
- package/dist/agents/subagent-completion-bridge.d.ts +42 -0
- package/dist/agents/subagent-completion-bridge.d.ts.map +1 -0
- package/dist/agents/subagent-completion-bridge.js +338 -0
- package/dist/agents/subagent-completion-bridge.js.map +1 -0
- package/dist/agents/subagent-lifecycle-events.d.ts +31 -0
- package/dist/agents/subagent-lifecycle-events.d.ts.map +1 -0
- package/dist/agents/subagent-lifecycle-events.js +21 -0
- package/dist/agents/subagent-lifecycle-events.js.map +1 -0
- package/dist/agents/subagent-policy.d.ts +206 -0
- package/dist/agents/subagent-policy.d.ts.map +1 -0
- package/dist/agents/subagent-policy.js +295 -0
- package/dist/agents/subagent-policy.js.map +1 -0
- package/dist/agents/subagent-registry-completion.d.ts +69 -0
- package/dist/agents/subagent-registry-completion.d.ts.map +1 -0
- package/dist/agents/subagent-registry-completion.js +128 -0
- package/dist/agents/subagent-registry-completion.js.map +1 -0
- package/dist/agents/subagent-registry.d.ts +85 -0
- package/dist/agents/subagent-registry.d.ts.map +1 -0
- package/dist/agents/subagent-registry.js +215 -0
- package/dist/agents/subagent-registry.js.map +1 -0
- package/dist/agents/subagent-registry.types.d.ts +94 -0
- package/dist/agents/subagent-registry.types.d.ts.map +1 -0
- package/dist/agents/subagent-registry.types.js +19 -0
- package/dist/agents/subagent-registry.types.js.map +1 -0
- package/dist/agents/subagent-runner.d.ts +75 -0
- package/dist/agents/subagent-runner.d.ts.map +1 -0
- package/dist/agents/subagent-runner.js +358 -0
- package/dist/agents/subagent-runner.js.map +1 -0
- package/dist/agents/subagent-spawn-abort-marker.d.ts +46 -0
- package/dist/agents/subagent-spawn-abort-marker.d.ts.map +1 -0
- package/dist/agents/subagent-spawn-abort-marker.js +81 -0
- package/dist/agents/subagent-spawn-abort-marker.js.map +1 -0
- package/dist/agents/subagent-spawn.d.ts +104 -0
- package/dist/agents/subagent-spawn.d.ts.map +1 -0
- package/dist/agents/subagent-spawn.js +358 -0
- package/dist/agents/subagent-spawn.js.map +1 -0
- package/dist/agents/thinking-fallback.d.ts +49 -0
- package/dist/agents/thinking-fallback.d.ts.map +1 -0
- package/dist/agents/thinking-fallback.js +97 -0
- package/dist/agents/thinking-fallback.js.map +1 -0
- package/dist/agents/tool-guard.d.ts +71 -0
- package/dist/agents/tool-guard.d.ts.map +1 -0
- package/dist/agents/tool-guard.js +154 -0
- package/dist/agents/tool-guard.js.map +1 -0
- package/dist/agents/tool-loop-detector.d.ts +115 -0
- package/dist/agents/tool-loop-detector.d.ts.map +1 -0
- package/dist/agents/tool-loop-detector.js +0 -0
- package/dist/agents/tool-loop-detector.js.map +1 -0
- package/dist/agents/tool-summaries.d.ts +3 -0
- package/dist/agents/tool-summaries.d.ts.map +1 -0
- package/dist/agents/tool-summaries.js +78 -0
- package/dist/agents/tool-summaries.js.map +1 -0
- package/dist/agents/tools/agents-list-tool.d.ts +51 -0
- package/dist/agents/tools/agents-list-tool.d.ts.map +1 -0
- package/dist/agents/tools/agents-list-tool.js +167 -0
- package/dist/agents/tools/agents-list-tool.js.map +1 -0
- package/dist/agents/tools/browser.d.ts +144 -0
- package/dist/agents/tools/browser.d.ts.map +1 -0
- package/dist/agents/tools/browser.js +1538 -0
- package/dist/agents/tools/browser.js.map +1 -0
- package/dist/agents/tools/common.d.ts +208 -0
- package/dist/agents/tools/common.d.ts.map +1 -0
- package/dist/agents/tools/common.js +405 -0
- package/dist/agents/tools/common.js.map +1 -0
- package/dist/agents/tools/composio-tool.d.ts +179 -0
- package/dist/agents/tools/composio-tool.d.ts.map +1 -0
- package/dist/agents/tools/composio-tool.js +474 -0
- package/dist/agents/tools/composio-tool.js.map +1 -0
- package/dist/agents/tools/cron-tool.d.ts +187 -0
- package/dist/agents/tools/cron-tool.d.ts.map +1 -0
- package/dist/agents/tools/cron-tool.js +985 -0
- package/dist/agents/tools/cron-tool.js.map +1 -0
- package/dist/agents/tools/find-tool.d.ts +55 -0
- package/dist/agents/tools/find-tool.d.ts.map +1 -0
- package/dist/agents/tools/find-tool.js +163 -0
- package/dist/agents/tools/find-tool.js.map +1 -0
- package/dist/agents/tools/generate-image-tool.d.ts +77 -0
- package/dist/agents/tools/generate-image-tool.d.ts.map +1 -0
- package/dist/agents/tools/generate-image-tool.js +421 -0
- package/dist/agents/tools/generate-image-tool.js.map +1 -0
- package/dist/agents/tools/index.d.ts +14 -0
- package/dist/agents/tools/index.d.ts.map +1 -0
- package/dist/agents/tools/index.js +12 -0
- package/dist/agents/tools/index.js.map +1 -0
- package/dist/agents/tools/manage-access-tool.d.ts +64 -0
- package/dist/agents/tools/manage-access-tool.d.ts.map +1 -0
- package/dist/agents/tools/manage-access-tool.js +188 -0
- package/dist/agents/tools/manage-access-tool.js.map +1 -0
- package/dist/agents/tools/manage-agent-tool.d.ts +50 -0
- package/dist/agents/tools/manage-agent-tool.d.ts.map +1 -0
- package/dist/agents/tools/manage-agent-tool.js +232 -0
- package/dist/agents/tools/manage-agent-tool.js.map +1 -0
- package/dist/agents/tools/manage-channel-access-tool.d.ts +44 -0
- package/dist/agents/tools/manage-channel-access-tool.d.ts.map +1 -0
- package/dist/agents/tools/manage-channel-access-tool.js +144 -0
- package/dist/agents/tools/manage-channel-access-tool.js.map +1 -0
- package/dist/agents/tools/manage-memory-tool.d.ts +30 -0
- package/dist/agents/tools/manage-memory-tool.d.ts.map +1 -0
- package/dist/agents/tools/manage-memory-tool.js +309 -0
- package/dist/agents/tools/manage-memory-tool.js.map +1 -0
- package/dist/agents/tools/manage-provider-tool.d.ts +65 -0
- package/dist/agents/tools/manage-provider-tool.d.ts.map +1 -0
- package/dist/agents/tools/manage-provider-tool.js +249 -0
- package/dist/agents/tools/manage-provider-tool.js.map +1 -0
- package/dist/agents/tools/manage-skill-tool.d.ts +121 -0
- package/dist/agents/tools/manage-skill-tool.d.ts.map +1 -0
- package/dist/agents/tools/manage-skill-tool.js +722 -0
- package/dist/agents/tools/manage-skill-tool.js.map +1 -0
- package/dist/agents/tools/memory-tools.d.ts +172 -0
- package/dist/agents/tools/memory-tools.d.ts.map +1 -0
- package/dist/agents/tools/memory-tools.js +561 -0
- package/dist/agents/tools/memory-tools.js.map +1 -0
- package/dist/agents/tools/oauth-authorize-tool.d.ts +94 -0
- package/dist/agents/tools/oauth-authorize-tool.d.ts.map +1 -0
- package/dist/agents/tools/oauth-authorize-tool.js +670 -0
- package/dist/agents/tools/oauth-authorize-tool.js.map +1 -0
- package/dist/agents/tools/org-tool.d.ts +208 -0
- package/dist/agents/tools/org-tool.d.ts.map +1 -0
- package/dist/agents/tools/org-tool.js +790 -0
- package/dist/agents/tools/org-tool.js.map +1 -0
- package/dist/agents/tools/registry.d.ts +146 -0
- package/dist/agents/tools/registry.d.ts.map +1 -0
- package/dist/agents/tools/registry.js +396 -0
- package/dist/agents/tools/registry.js.map +1 -0
- package/dist/agents/tools/send-media-tool.d.ts +92 -0
- package/dist/agents/tools/send-media-tool.d.ts.map +1 -0
- package/dist/agents/tools/send-media-tool.js +512 -0
- package/dist/agents/tools/send-media-tool.js.map +1 -0
- package/dist/agents/tools/send-message-tool.d.ts +84 -0
- package/dist/agents/tools/send-message-tool.d.ts.map +1 -0
- package/dist/agents/tools/send-message-tool.js +226 -0
- package/dist/agents/tools/send-message-tool.js.map +1 -0
- package/dist/agents/tools/sessions/history.d.ts +53 -0
- package/dist/agents/tools/sessions/history.d.ts.map +1 -0
- package/dist/agents/tools/sessions/history.js +138 -0
- package/dist/agents/tools/sessions/history.js.map +1 -0
- package/dist/agents/tools/sessions/index.d.ts +92 -0
- package/dist/agents/tools/sessions/index.d.ts.map +1 -0
- package/dist/agents/tools/sessions/index.js +125 -0
- package/dist/agents/tools/sessions/index.js.map +1 -0
- package/dist/agents/tools/sessions/list.d.ts +53 -0
- package/dist/agents/tools/sessions/list.d.ts.map +1 -0
- package/dist/agents/tools/sessions/list.js +134 -0
- package/dist/agents/tools/sessions/list.js.map +1 -0
- package/dist/agents/tools/sessions/resolve-access.d.ts +34 -0
- package/dist/agents/tools/sessions/resolve-access.d.ts.map +1 -0
- package/dist/agents/tools/sessions/resolve-access.js +67 -0
- package/dist/agents/tools/sessions/resolve-access.js.map +1 -0
- package/dist/agents/tools/sessions/send.d.ts +68 -0
- package/dist/agents/tools/sessions/send.d.ts.map +1 -0
- package/dist/agents/tools/sessions/send.js +556 -0
- package/dist/agents/tools/sessions/send.js.map +1 -0
- package/dist/agents/tools/sessions/shared.d.ts +145 -0
- package/dist/agents/tools/sessions/shared.d.ts.map +1 -0
- package/dist/agents/tools/sessions/shared.js +352 -0
- package/dist/agents/tools/sessions/shared.js.map +1 -0
- package/dist/agents/tools/sessions/spawn.d.ts +71 -0
- package/dist/agents/tools/sessions/spawn.d.ts.map +1 -0
- package/dist/agents/tools/sessions/spawn.js +132 -0
- package/dist/agents/tools/sessions/spawn.js.map +1 -0
- package/dist/agents/tools/spawn-agent-tool.d.ts +87 -0
- package/dist/agents/tools/spawn-agent-tool.d.ts.map +1 -0
- package/dist/agents/tools/spawn-agent-tool.js +189 -0
- package/dist/agents/tools/spawn-agent-tool.js.map +1 -0
- package/dist/agents/tools/spawn-agents-tool.d.ts +75 -0
- package/dist/agents/tools/spawn-agents-tool.d.ts.map +1 -0
- package/dist/agents/tools/spawn-agents-tool.js +267 -0
- package/dist/agents/tools/spawn-agents-tool.js.map +1 -0
- package/dist/agents/tools/types.d.ts +55 -0
- package/dist/agents/tools/types.d.ts.map +1 -0
- package/dist/agents/tools/types.js +28 -0
- package/dist/agents/tools/types.js.map +1 -0
- package/dist/agents/tools/web-fetch-utils.d.ts +114 -0
- package/dist/agents/tools/web-fetch-utils.d.ts.map +1 -0
- package/dist/agents/tools/web-fetch-utils.js +560 -0
- package/dist/agents/tools/web-fetch-utils.js.map +1 -0
- package/dist/agents/tools/web-fetch.d.ts +97 -0
- package/dist/agents/tools/web-fetch.d.ts.map +1 -0
- package/dist/agents/tools/web-fetch.js +369 -0
- package/dist/agents/tools/web-fetch.js.map +1 -0
- package/dist/agents/tools/web-retry.d.ts +55 -0
- package/dist/agents/tools/web-retry.d.ts.map +1 -0
- package/dist/agents/tools/web-retry.js +172 -0
- package/dist/agents/tools/web-retry.js.map +1 -0
- package/dist/agents/tools/web-search.d.ts +96 -0
- package/dist/agents/tools/web-search.d.ts.map +1 -0
- package/dist/agents/tools/web-search.js +459 -0
- package/dist/agents/tools/web-search.js.map +1 -0
- package/dist/agents/tools/web-shared.d.ts +123 -0
- package/dist/agents/tools/web-shared.d.ts.map +1 -0
- package/dist/agents/tools/web-shared.js +207 -0
- package/dist/agents/tools/web-shared.js.map +1 -0
- package/dist/assets/brigade-favicon.png +0 -0
- package/dist/auth/profile-cooldown.d.ts +105 -0
- package/dist/auth/profile-cooldown.d.ts.map +1 -0
- package/dist/auth/profile-cooldown.js +466 -0
- package/dist/auth/profile-cooldown.js.map +1 -0
- package/dist/auth/profiles.d.ts +93 -0
- package/dist/auth/profiles.d.ts.map +1 -0
- package/dist/auth/profiles.js +321 -0
- package/dist/auth/profiles.js.map +1 -0
- package/dist/buildstamp.json +1 -0
- package/dist/cli/argv.d.ts +20 -0
- package/dist/cli/argv.d.ts.map +1 -0
- package/dist/cli/argv.js +47 -0
- package/dist/cli/argv.js.map +1 -0
- package/dist/cli/commands/agent.d.ts +19 -0
- package/dist/cli/commands/agent.d.ts.map +1 -0
- package/dist/cli/commands/agent.js +297 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/agents-bindings.d.ts +80 -0
- package/dist/cli/commands/agents-bindings.d.ts.map +1 -0
- package/dist/cli/commands/agents-bindings.js +252 -0
- package/dist/cli/commands/agents-bindings.js.map +1 -0
- package/dist/cli/commands/agents-cmd.d.ts +160 -0
- package/dist/cli/commands/agents-cmd.d.ts.map +1 -0
- package/dist/cli/commands/agents-cmd.js +1199 -0
- package/dist/cli/commands/agents-cmd.js.map +1 -0
- package/dist/cli/commands/agents-config.d.ts +102 -0
- package/dist/cli/commands/agents-config.d.ts.map +1 -0
- package/dist/cli/commands/agents-config.js +294 -0
- package/dist/cli/commands/agents-config.js.map +1 -0
- package/dist/cli/commands/agents-shared.d.ts +57 -0
- package/dist/cli/commands/agents-shared.d.ts.map +1 -0
- package/dist/cli/commands/agents-shared.js +83 -0
- package/dist/cli/commands/agents-shared.js.map +1 -0
- package/dist/cli/commands/backup.d.ts +36 -0
- package/dist/cli/commands/backup.d.ts.map +1 -0
- package/dist/cli/commands/backup.js +244 -0
- package/dist/cli/commands/backup.js.map +1 -0
- package/dist/cli/commands/channels.d.ts +106 -0
- package/dist/cli/commands/channels.d.ts.map +1 -0
- package/dist/cli/commands/channels.js +830 -0
- package/dist/cli/commands/channels.js.map +1 -0
- package/dist/cli/commands/chat.d.ts +43 -0
- package/dist/cli/commands/chat.d.ts.map +1 -0
- package/dist/cli/commands/chat.js +84 -0
- package/dist/cli/commands/chat.js.map +1 -0
- package/dist/cli/commands/config-cmd.d.ts +62 -0
- package/dist/cli/commands/config-cmd.d.ts.map +1 -0
- package/dist/cli/commands/config-cmd.js +404 -0
- package/dist/cli/commands/config-cmd.js.map +1 -0
- package/dist/cli/commands/connect.d.ts +73 -0
- package/dist/cli/commands/connect.d.ts.map +1 -0
- package/dist/cli/commands/connect.js +1952 -0
- package/dist/cli/commands/connect.js.map +1 -0
- package/dist/cli/commands/cron.d.ts +58 -0
- package/dist/cli/commands/cron.d.ts.map +1 -0
- package/dist/cli/commands/cron.js +250 -0
- package/dist/cli/commands/cron.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +25 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +618 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/encrypt-cmd.d.ts +12 -0
- package/dist/cli/commands/encrypt-cmd.d.ts.map +1 -0
- package/dist/cli/commands/encrypt-cmd.js +119 -0
- package/dist/cli/commands/encrypt-cmd.js.map +1 -0
- package/dist/cli/commands/exec-cmd.d.ts +55 -0
- package/dist/cli/commands/exec-cmd.d.ts.map +1 -0
- package/dist/cli/commands/exec-cmd.js +253 -0
- package/dist/cli/commands/exec-cmd.js.map +1 -0
- package/dist/cli/commands/gateway-install.d.ts +21 -0
- package/dist/cli/commands/gateway-install.d.ts.map +1 -0
- package/dist/cli/commands/gateway-install.js +71 -0
- package/dist/cli/commands/gateway-install.js.map +1 -0
- package/dist/cli/commands/gateway-supervise.d.ts +102 -0
- package/dist/cli/commands/gateway-supervise.d.ts.map +1 -0
- package/dist/cli/commands/gateway-supervise.js +194 -0
- package/dist/cli/commands/gateway-supervise.js.map +1 -0
- package/dist/cli/commands/gateway.d.ts +58 -0
- package/dist/cli/commands/gateway.d.ts.map +1 -0
- package/dist/cli/commands/gateway.js +497 -0
- package/dist/cli/commands/gateway.js.map +1 -0
- package/dist/cli/commands/logs.d.ts +14 -0
- package/dist/cli/commands/logs.d.ts.map +1 -0
- package/dist/cli/commands/logs.js +93 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/mcp-cmd.d.ts +4 -0
- package/dist/cli/commands/mcp-cmd.d.ts.map +1 -0
- package/dist/cli/commands/mcp-cmd.js +30 -0
- package/dist/cli/commands/mcp-cmd.js.map +1 -0
- package/dist/cli/commands/onboard-config.d.ts +23 -0
- package/dist/cli/commands/onboard-config.d.ts.map +1 -0
- package/dist/cli/commands/onboard-config.js +33 -0
- package/dist/cli/commands/onboard-config.js.map +1 -0
- package/dist/cli/commands/onboard.d.ts +48 -0
- package/dist/cli/commands/onboard.d.ts.map +1 -0
- package/dist/cli/commands/onboard.js +397 -0
- package/dist/cli/commands/onboard.js.map +1 -0
- package/dist/cli/commands/org-cmd.d.ts +87 -0
- package/dist/cli/commands/org-cmd.d.ts.map +1 -0
- package/dist/cli/commands/org-cmd.js +394 -0
- package/dist/cli/commands/org-cmd.js.map +1 -0
- package/dist/cli/commands/org-cmd.templates.d.ts +66 -0
- package/dist/cli/commands/org-cmd.templates.d.ts.map +1 -0
- package/dist/cli/commands/org-cmd.templates.js +145 -0
- package/dist/cli/commands/org-cmd.templates.js.map +1 -0
- package/dist/cli/commands/org-slash.d.ts +107 -0
- package/dist/cli/commands/org-slash.d.ts.map +1 -0
- package/dist/cli/commands/org-slash.js +263 -0
- package/dist/cli/commands/org-slash.js.map +1 -0
- package/dist/cli/commands/pairing.d.ts +33 -0
- package/dist/cli/commands/pairing.d.ts.map +1 -0
- package/dist/cli/commands/pairing.js +155 -0
- package/dist/cli/commands/pairing.js.map +1 -0
- package/dist/cli/commands/secrets-audit.d.ts +17 -0
- package/dist/cli/commands/secrets-audit.d.ts.map +1 -0
- package/dist/cli/commands/secrets-audit.js +109 -0
- package/dist/cli/commands/secrets-audit.js.map +1 -0
- package/dist/cli/commands/sessions.d.ts +22 -0
- package/dist/cli/commands/sessions.d.ts.map +1 -0
- package/dist/cli/commands/sessions.js +99 -0
- package/dist/cli/commands/sessions.js.map +1 -0
- package/dist/cli/commands/skills.d.ts +17 -0
- package/dist/cli/commands/skills.d.ts.map +1 -0
- package/dist/cli/commands/skills.js +100 -0
- package/dist/cli/commands/skills.js.map +1 -0
- package/dist/cli/commands/status.d.ts +26 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +252 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/store-cmd.d.ts +36 -0
- package/dist/cli/commands/store-cmd.d.ts.map +1 -0
- package/dist/cli/commands/store-cmd.js +405 -0
- package/dist/cli/commands/store-cmd.js.map +1 -0
- package/dist/cli/flows/web-setup.d.ts +47 -0
- package/dist/cli/flows/web-setup.d.ts.map +1 -0
- package/dist/cli/flows/web-setup.js +324 -0
- package/dist/cli/flows/web-setup.js.map +1 -0
- package/dist/cli/program/build-program.d.ts +3 -0
- package/dist/cli/program/build-program.d.ts.map +1 -0
- package/dist/cli/program/build-program.js +1326 -0
- package/dist/cli/program/build-program.js.map +1 -0
- package/dist/cli/run-main.d.ts +2 -0
- package/dist/cli/run-main.d.ts.map +1 -0
- package/dist/cli/run-main.js +63 -0
- package/dist/cli/run-main.js.map +1 -0
- package/dist/config/agent-limits.d.ts +22 -0
- package/dist/config/agent-limits.d.ts.map +1 -0
- package/dist/config/agent-limits.js +34 -0
- package/dist/config/agent-limits.js.map +1 -0
- package/dist/config/io.d.ts +378 -0
- package/dist/config/io.d.ts.map +1 -0
- package/dist/config/io.js +602 -0
- package/dist/config/io.js.map +1 -0
- package/dist/config/paths.d.ts +80 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +342 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/types.d.ts +12 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +12 -0
- package/dist/config/types.js.map +1 -0
- package/dist/core/agent-dispatcher.d.ts +91 -0
- package/dist/core/agent-dispatcher.d.ts.map +1 -0
- package/dist/core/agent-dispatcher.js +251 -0
- package/dist/core/agent-dispatcher.js.map +1 -0
- package/dist/core/agent-events-stream.d.ts +76 -0
- package/dist/core/agent-events-stream.d.ts.map +1 -0
- package/dist/core/agent-events-stream.js +185 -0
- package/dist/core/agent-events-stream.js.map +1 -0
- package/dist/core/agent-runtime-persist.d.ts +53 -0
- package/dist/core/agent-runtime-persist.d.ts.map +1 -0
- package/dist/core/agent-runtime-persist.js +114 -0
- package/dist/core/agent-runtime-persist.js.map +1 -0
- package/dist/core/auth-bridge.d.ts +8 -0
- package/dist/core/auth-bridge.d.ts.map +1 -0
- package/dist/core/auth-bridge.js +102 -0
- package/dist/core/auth-bridge.js.map +1 -0
- package/dist/core/auth-error.d.ts +49 -0
- package/dist/core/auth-error.d.ts.map +1 -0
- package/dist/core/auth-error.js.map +1 -0
- package/dist/core/brigade-config.d.ts +205 -0
- package/dist/core/brigade-config.d.ts.map +1 -0
- package/dist/core/brigade-config.js +58 -6
- package/dist/core/brigade-config.js.map +1 -0
- package/dist/core/config.d.ts +17 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +92 -246
- package/dist/core/config.js.map +1 -0
- package/dist/core/console-stream.d.ts +52 -0
- package/dist/core/console-stream.d.ts.map +1 -0
- package/dist/core/console-stream.js +49 -3
- package/dist/core/console-stream.js.map +1 -0
- package/dist/core/daemon/launchd.d.ts +19 -0
- package/dist/core/daemon/launchd.d.ts.map +1 -0
- package/dist/core/daemon/launchd.js +117 -0
- package/dist/core/daemon/launchd.js.map +1 -0
- package/dist/core/daemon/schtasks.d.ts +23 -0
- package/dist/core/daemon/schtasks.d.ts.map +1 -0
- package/dist/core/daemon/schtasks.js +139 -0
- package/dist/core/daemon/schtasks.js.map +1 -0
- package/dist/core/daemon/service.d.ts +56 -0
- package/dist/core/daemon/service.d.ts.map +1 -0
- package/dist/core/daemon/service.js +54 -0
- package/dist/core/daemon/service.js.map +1 -0
- package/dist/core/daemon/systemd.d.ts +19 -0
- package/dist/core/daemon/systemd.d.ts.map +1 -0
- package/dist/core/daemon/systemd.js +117 -0
- package/dist/core/daemon/systemd.js.map +1 -0
- package/dist/core/event-logger.d.ts +74 -0
- package/dist/core/event-logger.d.ts.map +1 -0
- package/dist/core/event-logger.js +299 -6
- package/dist/core/event-logger.js.map +1 -0
- package/dist/core/exec-approvals.d.ts +178 -0
- package/dist/core/exec-approvals.d.ts.map +1 -0
- package/dist/core/exec-approvals.js +591 -266
- package/dist/core/exec-approvals.js.map +1 -0
- package/dist/core/extension-lifecycle.d.ts +27 -0
- package/dist/core/extension-lifecycle.d.ts.map +1 -0
- package/dist/core/extension-lifecycle.js +45 -0
- package/dist/core/extension-lifecycle.js.map +1 -0
- package/dist/core/gateway-caller-impl.d.ts +42 -0
- package/dist/core/gateway-caller-impl.d.ts.map +1 -0
- package/dist/core/gateway-caller-impl.js +95 -0
- package/dist/core/gateway-caller-impl.js.map +1 -0
- package/dist/core/gateway-lock.d.ts +88 -0
- package/dist/core/gateway-lock.d.ts.map +1 -0
- package/dist/core/gateway-lock.js +204 -0
- package/dist/core/gateway-lock.js.map +1 -0
- package/dist/core/gateway-probe.d.ts +148 -0
- package/dist/core/gateway-probe.d.ts.map +1 -0
- package/dist/core/gateway-probe.js +319 -0
- package/dist/core/gateway-probe.js.map +1 -0
- package/dist/core/gateway-spawn.d.ts +40 -0
- package/dist/core/gateway-spawn.d.ts.map +1 -0
- package/dist/core/gateway-spawn.js +156 -0
- package/dist/core/gateway-spawn.js.map +1 -0
- package/dist/core/model-caps.d.ts +85 -0
- package/dist/core/model-caps.d.ts.map +1 -0
- package/dist/core/model-caps.js +88 -2
- package/dist/core/model-caps.js.map +1 -0
- package/dist/core/port-inspect.d.ts +37 -0
- package/dist/core/port-inspect.d.ts.map +1 -0
- package/dist/core/port-inspect.js +165 -0
- package/dist/core/port-inspect.js.map +1 -0
- package/dist/core/server-lanes.d.ts +25 -0
- package/dist/core/server-lanes.d.ts.map +1 -0
- package/dist/core/server-lanes.js +31 -0
- package/dist/core/server-lanes.js.map +1 -0
- package/dist/core/server-methods/cron.d.ts +104 -0
- package/dist/core/server-methods/cron.d.ts.map +1 -0
- package/dist/core/server-methods/cron.js +183 -0
- package/dist/core/server-methods/cron.js.map +1 -0
- package/dist/core/server-methods/health.d.ts +36 -0
- package/dist/core/server-methods/health.d.ts.map +1 -0
- package/dist/core/server-methods/health.js +51 -0
- package/dist/core/server-methods/health.js.map +1 -0
- package/dist/core/server-methods/org.d.ts +93 -0
- package/dist/core/server-methods/org.d.ts.map +1 -0
- package/dist/core/server-methods/org.js +95 -0
- package/dist/core/server-methods/org.js.map +1 -0
- package/dist/core/server-methods/sessions.d.ts +133 -0
- package/dist/core/server-methods/sessions.d.ts.map +1 -0
- package/dist/core/server-methods/sessions.js +209 -0
- package/dist/core/server-methods/sessions.js.map +1 -0
- package/dist/core/server.d.ts +46 -0
- package/dist/core/server.d.ts.map +1 -0
- package/dist/core/server.js +4716 -249
- package/dist/core/server.js.map +1 -0
- package/dist/core/system-prompt.d.ts +92 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +180 -1584
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/version.d.ts +4 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +8 -13
- package/dist/core/version.js.map +1 -0
- package/dist/core/webhook-guards.d.ts +131 -0
- package/dist/core/webhook-guards.d.ts.map +1 -0
- package/dist/core/webhook-guards.js +283 -0
- package/dist/core/webhook-guards.js.map +1 -0
- package/dist/core/ws-subscription-filter.d.ts +9 -0
- package/dist/core/ws-subscription-filter.d.ts.map +1 -0
- package/dist/core/ws-subscription-filter.js +39 -0
- package/dist/core/ws-subscription-filter.js.map +1 -0
- package/dist/cron/active-service.d.ts +30 -0
- package/dist/cron/active-service.d.ts.map +1 -0
- package/dist/cron/active-service.js +48 -0
- package/dist/cron/active-service.js.map +1 -0
- package/dist/cron/isolated-agent/run-executor.d.ts +49 -0
- package/dist/cron/isolated-agent/run-executor.d.ts.map +1 -0
- package/dist/cron/isolated-agent/run-executor.js +343 -0
- package/dist/cron/isolated-agent/run-executor.js.map +1 -0
- package/dist/cron/isolated-agent/run.d.ts +27 -0
- package/dist/cron/isolated-agent/run.d.ts.map +1 -0
- package/dist/cron/isolated-agent/run.js +29 -0
- package/dist/cron/isolated-agent/run.js.map +1 -0
- package/dist/cron/normalize.d.ts +103 -0
- package/dist/cron/normalize.d.ts.map +1 -0
- package/dist/cron/normalize.js +376 -0
- package/dist/cron/normalize.js.map +1 -0
- package/dist/cron/parse.d.ts +27 -0
- package/dist/cron/parse.d.ts.map +1 -0
- package/dist/cron/parse.js +55 -0
- package/dist/cron/parse.js.map +1 -0
- package/dist/cron/reminder-context.d.ts +78 -0
- package/dist/cron/reminder-context.d.ts.map +1 -0
- package/dist/cron/reminder-context.js +167 -0
- package/dist/cron/reminder-context.js.map +1 -0
- package/dist/cron/run-log.d.ts +48 -0
- package/dist/cron/run-log.d.ts.map +1 -0
- package/dist/cron/run-log.js +225 -0
- package/dist/cron/run-log.js.map +1 -0
- package/dist/cron/schedule.d.ts +46 -0
- package/dist/cron/schedule.d.ts.map +1 -0
- package/dist/cron/schedule.js +144 -0
- package/dist/cron/schedule.js.map +1 -0
- package/dist/cron/service/jobs.d.ts +138 -0
- package/dist/cron/service/jobs.d.ts.map +1 -0
- package/dist/cron/service/jobs.js +370 -0
- package/dist/cron/service/jobs.js.map +1 -0
- package/dist/cron/service/locked.d.ts +46 -0
- package/dist/cron/service/locked.d.ts.map +1 -0
- package/dist/cron/service/locked.js +54 -0
- package/dist/cron/service/locked.js.map +1 -0
- package/dist/cron/service/ops.d.ts +124 -0
- package/dist/cron/service/ops.d.ts.map +1 -0
- package/dist/cron/service/ops.js +415 -0
- package/dist/cron/service/ops.js.map +1 -0
- package/dist/cron/service/state.d.ts +254 -0
- package/dist/cron/service/state.d.ts.map +1 -0
- package/dist/cron/service/state.js +50 -0
- package/dist/cron/service/state.js.map +1 -0
- package/dist/cron/service/store.d.ts +65 -0
- package/dist/cron/service/store.d.ts.map +1 -0
- package/dist/cron/service/store.js +350 -0
- package/dist/cron/service/store.js.map +1 -0
- package/dist/cron/service/timer.d.ts +113 -0
- package/dist/cron/service/timer.d.ts.map +1 -0
- package/dist/cron/service/timer.js +1081 -0
- package/dist/cron/service/timer.js.map +1 -0
- package/dist/cron/session-reaper.d.ts +62 -0
- package/dist/cron/session-reaper.d.ts.map +1 -0
- package/dist/cron/session-reaper.js +152 -0
- package/dist/cron/session-reaper.js.map +1 -0
- package/dist/cron/session-target.d.ts +56 -0
- package/dist/cron/session-target.d.ts.map +1 -0
- package/dist/cron/session-target.js +96 -0
- package/dist/cron/session-target.js.map +1 -0
- package/dist/cron/stagger.d.ts +34 -0
- package/dist/cron/stagger.d.ts.map +1 -0
- package/dist/cron/stagger.js +69 -0
- package/dist/cron/stagger.js.map +1 -0
- package/dist/cron/types.d.ts +287 -0
- package/dist/cron/types.d.ts.map +1 -0
- package/dist/cron/types.js +22 -0
- package/dist/cron/types.js.map +1 -0
- package/dist/cron/validate-timestamp.d.ts +33 -0
- package/dist/cron/validate-timestamp.d.ts.map +1 -0
- package/dist/cron/validate-timestamp.js +54 -0
- package/dist/cron/validate-timestamp.js.map +1 -0
- package/dist/entry.d.ts +2 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +57 -0
- package/dist/entry.js.map +1 -0
- package/dist/extension-sdk.d.ts +28 -0
- package/dist/extension-sdk.d.ts.map +1 -0
- package/dist/extension-sdk.js +26 -0
- package/dist/extension-sdk.js.map +1 -0
- package/dist/identity/device.d.ts +19 -0
- package/dist/identity/device.d.ts.map +1 -0
- package/dist/identity/device.js +88 -0
- package/dist/identity/device.js.map +1 -0
- package/dist/infra/backoff.d.ts +24 -0
- package/dist/infra/backoff.d.ts.map +1 -0
- package/dist/infra/backoff.js +48 -0
- package/dist/infra/backoff.js.map +1 -0
- package/dist/infra/errors.d.ts +35 -0
- package/dist/infra/errors.d.ts.map +1 -0
- package/dist/infra/errors.js +54 -0
- package/dist/infra/errors.js.map +1 -0
- package/dist/infra/fs/atomic-rename.d.ts +31 -0
- package/dist/infra/fs/atomic-rename.d.ts.map +1 -0
- package/dist/infra/fs/atomic-rename.js +75 -0
- package/dist/infra/fs/atomic-rename.js.map +1 -0
- package/dist/infra/json-file.d.ts +25 -0
- package/dist/infra/json-file.d.ts.map +1 -0
- package/dist/infra/json-file.js +49 -0
- package/dist/infra/json-file.js.map +1 -0
- package/dist/infra/json-utf8-bytes.d.ts +14 -0
- package/dist/infra/json-utf8-bytes.d.ts.map +1 -0
- package/dist/infra/json-utf8-bytes.js +20 -0
- package/dist/infra/json-utf8-bytes.js.map +1 -0
- package/dist/infra/net/dns-pinning.d.ts +66 -0
- package/dist/infra/net/dns-pinning.d.ts.map +1 -0
- package/dist/infra/net/dns-pinning.js +128 -0
- package/dist/infra/net/dns-pinning.js.map +1 -0
- package/dist/infra/net/fetch-guard.d.ts +85 -0
- package/dist/infra/net/fetch-guard.d.ts.map +1 -0
- package/dist/infra/net/fetch-guard.js +439 -0
- package/dist/infra/net/fetch-guard.js.map +1 -0
- package/dist/infra/prototype-keys.d.ts +19 -0
- package/dist/infra/prototype-keys.d.ts.map +1 -0
- package/dist/infra/prototype-keys.js +22 -0
- package/dist/infra/prototype-keys.js.map +1 -0
- package/dist/integrations/ollama.d.ts +67 -0
- package/dist/integrations/ollama.d.ts.map +1 -0
- package/dist/integrations/ollama.js +53 -0
- package/dist/integrations/ollama.js.map +1 -0
- package/dist/integrations/provider-discovery.d.ts +66 -0
- package/dist/integrations/provider-discovery.d.ts.map +1 -0
- package/dist/integrations/provider-discovery.js +166 -0
- package/dist/integrations/provider-discovery.js.map +1 -0
- package/dist/logging/redact.d.ts +28 -0
- package/dist/logging/redact.d.ts.map +1 -0
- package/dist/logging/redact.js +51 -0
- package/dist/logging/redact.js.map +1 -0
- package/dist/logging/subsystem-logger.d.ts +77 -0
- package/dist/logging/subsystem-logger.d.ts.map +1 -0
- package/dist/logging/subsystem-logger.js +577 -0
- package/dist/logging/subsystem-logger.js.map +1 -0
- package/dist/logging/subsystem.d.ts +13 -0
- package/dist/logging/subsystem.d.ts.map +1 -0
- package/dist/logging/subsystem.js +12 -0
- package/dist/logging/subsystem.js.map +1 -0
- package/dist/process/command-queue.d.ts +152 -0
- package/dist/process/command-queue.d.ts.map +1 -0
- package/dist/process/command-queue.js +420 -0
- package/dist/process/command-queue.js.map +1 -0
- package/dist/process/lanes.d.ts +102 -0
- package/dist/process/lanes.d.ts.map +1 -0
- package/dist/process/lanes.js +117 -0
- package/dist/process/lanes.js.map +1 -0
- package/dist/process/session-lane.d.ts +31 -0
- package/dist/process/session-lane.d.ts.map +1 -0
- package/dist/process/session-lane.js +45 -0
- package/dist/process/session-lane.js.map +1 -0
- package/dist/protocol/errors.d.ts +35 -0
- package/dist/protocol/errors.d.ts.map +1 -0
- package/dist/protocol/errors.js +36 -0
- package/dist/protocol/errors.js.map +1 -0
- package/dist/protocol/handshake.d.ts +101 -0
- package/dist/protocol/handshake.d.ts.map +1 -0
- package/dist/protocol/handshake.js +49 -0
- package/dist/protocol/handshake.js.map +1 -0
- package/dist/protocol/messages.d.ts +68 -0
- package/dist/protocol/messages.d.ts.map +1 -0
- package/dist/protocol/messages.js +20 -0
- package/dist/protocol/messages.js.map +1 -0
- package/dist/protocol/methods.d.ts +312 -0
- package/dist/protocol/methods.d.ts.map +1 -0
- package/dist/protocol/methods.js +16 -0
- package/dist/protocol/methods.js.map +1 -0
- package/dist/protocol.d.ts +598 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +12 -0
- package/dist/protocol.js.map +1 -0
- package/dist/providers/auth-methods.d.ts +82 -0
- package/dist/providers/auth-methods.d.ts.map +1 -0
- package/dist/providers/auth-methods.js +180 -0
- package/dist/providers/auth-methods.js.map +1 -0
- package/dist/providers/catalog.d.ts +85 -0
- package/dist/providers/catalog.d.ts.map +1 -0
- package/dist/providers/catalog.js +41 -0
- package/dist/providers/catalog.js.map +1 -0
- package/dist/providers/validate-key.d.ts +42 -0
- package/dist/providers/validate-key.d.ts.map +1 -0
- package/dist/providers/validate-key.js.map +1 -0
- package/dist/security/external-content.d.ts +67 -0
- package/dist/security/external-content.d.ts.map +1 -0
- package/dist/security/external-content.js +80 -0
- package/dist/security/external-content.js.map +1 -0
- package/dist/security/injection-patterns.d.ts +33 -0
- package/dist/security/injection-patterns.d.ts.map +1 -0
- package/dist/security/injection-patterns.js +97 -0
- package/dist/security/injection-patterns.js.map +1 -0
- package/dist/security/media-path-guard.d.ts +25 -0
- package/dist/security/media-path-guard.d.ts.map +1 -0
- package/dist/security/media-path-guard.js +98 -0
- package/dist/security/media-path-guard.js.map +1 -0
- package/dist/security/terminal-input-sanitizer.d.ts +30 -0
- package/dist/security/terminal-input-sanitizer.d.ts.map +1 -0
- package/dist/security/terminal-input-sanitizer.js +70 -0
- package/dist/security/terminal-input-sanitizer.js.map +1 -0
- package/dist/sessions/bootstrap-marker.d.ts +5 -0
- package/dist/sessions/bootstrap-marker.d.ts.map +1 -0
- package/dist/sessions/bootstrap-marker.js +120 -0
- package/dist/sessions/bootstrap-marker.js.map +1 -0
- package/dist/sessions/session-file-repair.d.ts +12 -0
- package/dist/sessions/session-file-repair.d.ts.map +1 -0
- package/dist/sessions/session-file-repair.js +155 -0
- package/dist/sessions/session-file-repair.js.map +1 -0
- package/dist/sessions/session-key-utils.d.ts +54 -0
- package/dist/sessions/session-key-utils.d.ts.map +1 -0
- package/dist/sessions/session-key-utils.js +133 -0
- package/dist/sessions/session-key-utils.js.map +1 -0
- package/dist/sessions/session-manager-factory.d.ts +21 -0
- package/dist/sessions/session-manager-factory.d.ts.map +1 -0
- package/dist/sessions/session-manager-factory.js +142 -0
- package/dist/sessions/session-manager-factory.js.map +1 -0
- package/dist/sessions/session-store.d.ts +154 -0
- package/dist/sessions/session-store.d.ts.map +1 -0
- package/dist/sessions/session-store.js +498 -0
- package/dist/sessions/session-store.js.map +1 -0
- package/dist/sessions/session-write-lock.d.ts +10 -0
- package/dist/sessions/session-write-lock.d.ts.map +1 -0
- package/dist/sessions/session-write-lock.js +167 -0
- package/dist/sessions/session-write-lock.js.map +1 -0
- package/dist/sessions/transcript-reader.d.ts +37 -0
- package/dist/sessions/transcript-reader.d.ts.map +1 -0
- package/dist/sessions/transcript-reader.js +136 -0
- package/dist/sessions/transcript-reader.js.map +1 -0
- package/dist/sessions/transcript-repair.d.ts +16 -0
- package/dist/sessions/transcript-repair.d.ts.map +1 -0
- package/dist/sessions/transcript-repair.js +214 -0
- package/dist/sessions/transcript-repair.js.map +1 -0
- package/dist/shared/global-singleton.d.ts +27 -0
- package/dist/shared/global-singleton.d.ts.map +1 -0
- package/dist/shared/global-singleton.js +35 -0
- package/dist/shared/global-singleton.js.map +1 -0
- package/dist/shared/string-coerce.d.ts +12 -0
- package/dist/shared/string-coerce.d.ts.map +1 -0
- package/dist/shared/string-coerce.js +12 -0
- package/dist/shared/string-coerce.js.map +1 -0
- package/dist/storage/boot.d.ts +28 -0
- package/dist/storage/boot.d.ts.map +1 -0
- package/dist/storage/boot.js +588 -0
- package/dist/storage/boot.js.map +1 -0
- package/dist/storage/config-cache.d.ts +23 -0
- package/dist/storage/config-cache.d.ts.map +1 -0
- package/dist/storage/config-cache.js +58 -0
- package/dist/storage/config-cache.js.map +1 -0
- package/dist/storage/convex/auth-store.d.ts +52 -0
- package/dist/storage/convex/auth-store.d.ts.map +1 -0
- package/dist/storage/convex/auth-store.js +282 -0
- package/dist/storage/convex/auth-store.js.map +1 -0
- package/dist/storage/convex/blob-store.d.ts +20 -0
- package/dist/storage/convex/blob-store.d.ts.map +1 -0
- package/dist/storage/convex/blob-store.js +74 -0
- package/dist/storage/convex/blob-store.js.map +1 -0
- package/dist/storage/convex/channel-store.d.ts +112 -0
- package/dist/storage/convex/channel-store.d.ts.map +1 -0
- package/dist/storage/convex/channel-store.js +267 -0
- package/dist/storage/convex/channel-store.js.map +1 -0
- package/dist/storage/convex/client.d.ts +53 -0
- package/dist/storage/convex/client.d.ts.map +1 -0
- package/dist/storage/convex/client.js +121 -0
- package/dist/storage/convex/client.js.map +1 -0
- package/dist/storage/convex/config-store.d.ts +29 -0
- package/dist/storage/convex/config-store.d.ts.map +1 -0
- package/dist/storage/convex/config-store.js +205 -0
- package/dist/storage/convex/config-store.js.map +1 -0
- package/dist/storage/convex/cron-store.d.ts +86 -0
- package/dist/storage/convex/cron-store.d.ts.map +1 -0
- package/dist/storage/convex/cron-store.js +428 -0
- package/dist/storage/convex/cron-store.js.map +1 -0
- package/dist/storage/convex/exec-approval-store.d.ts +38 -0
- package/dist/storage/convex/exec-approval-store.d.ts.map +1 -0
- package/dist/storage/convex/exec-approval-store.js +147 -0
- package/dist/storage/convex/exec-approval-store.js.map +1 -0
- package/dist/storage/convex/extension-store.d.ts +28 -0
- package/dist/storage/convex/extension-store.d.ts.map +1 -0
- package/dist/storage/convex/extension-store.js +39 -0
- package/dist/storage/convex/extension-store.js.map +1 -0
- package/dist/storage/convex/index.d.ts +35 -0
- package/dist/storage/convex/index.d.ts.map +1 -0
- package/dist/storage/convex/index.js +141 -0
- package/dist/storage/convex/index.js.map +1 -0
- package/dist/storage/convex/instance-store.d.ts +37 -0
- package/dist/storage/convex/instance-store.d.ts.map +1 -0
- package/dist/storage/convex/instance-store.js +88 -0
- package/dist/storage/convex/instance-store.js.map +1 -0
- package/dist/storage/convex/log-store.d.ts +36 -0
- package/dist/storage/convex/log-store.d.ts.map +1 -0
- package/dist/storage/convex/log-store.js +213 -0
- package/dist/storage/convex/log-store.js.map +1 -0
- package/dist/storage/convex/memory-store.d.ts +50 -0
- package/dist/storage/convex/memory-store.d.ts.map +1 -0
- package/dist/storage/convex/memory-store.js +537 -0
- package/dist/storage/convex/memory-store.js.map +1 -0
- package/dist/storage/convex/message-store.d.ts +32 -0
- package/dist/storage/convex/message-store.d.ts.map +1 -0
- package/dist/storage/convex/message-store.js +272 -0
- package/dist/storage/convex/message-store.js.map +1 -0
- package/dist/storage/convex/org-store.d.ts +46 -0
- package/dist/storage/convex/org-store.d.ts.map +1 -0
- package/dist/storage/convex/org-store.js +101 -0
- package/dist/storage/convex/org-store.js.map +1 -0
- package/dist/storage/convex/session-store.d.ts +44 -0
- package/dist/storage/convex/session-store.d.ts.map +1 -0
- package/dist/storage/convex/session-store.js +257 -0
- package/dist/storage/convex/session-store.js.map +1 -0
- package/dist/storage/convex/skill-store.d.ts +49 -0
- package/dist/storage/convex/skill-store.d.ts.map +1 -0
- package/dist/storage/convex/skill-store.js +84 -0
- package/dist/storage/convex/skill-store.js.map +1 -0
- package/dist/storage/convex/subagent-store.d.ts +28 -0
- package/dist/storage/convex/subagent-store.d.ts.map +1 -0
- package/dist/storage/convex/subagent-store.js +83 -0
- package/dist/storage/convex/subagent-store.js.map +1 -0
- package/dist/storage/convex/workspace-store.d.ts +25 -0
- package/dist/storage/convex/workspace-store.d.ts.map +1 -0
- package/dist/storage/convex/workspace-store.js +127 -0
- package/dist/storage/convex/workspace-store.js.map +1 -0
- package/dist/storage/cron-cache.d.ts +17 -0
- package/dist/storage/cron-cache.d.ts.map +1 -0
- package/dist/storage/cron-cache.js +67 -0
- package/dist/storage/cron-cache.js.map +1 -0
- package/dist/storage/encryption.d.ts +69 -0
- package/dist/storage/encryption.d.ts.map +1 -0
- package/dist/storage/encryption.js +389 -0
- package/dist/storage/encryption.js.map +1 -0
- package/dist/storage/factory-reset.d.ts +7 -0
- package/dist/storage/factory-reset.d.ts.map +1 -0
- package/dist/storage/factory-reset.js +34 -0
- package/dist/storage/factory-reset.js.map +1 -0
- package/dist/storage/facts-cache.d.ts +24 -0
- package/dist/storage/facts-cache.d.ts.map +1 -0
- package/dist/storage/facts-cache.js +110 -0
- package/dist/storage/facts-cache.js.map +1 -0
- package/dist/storage/flush.d.ts +4 -0
- package/dist/storage/flush.d.ts.map +1 -0
- package/dist/storage/flush.js +128 -0
- package/dist/storage/flush.js.map +1 -0
- package/dist/storage/instance-admin.d.ts +52 -0
- package/dist/storage/instance-admin.d.ts.map +1 -0
- package/dist/storage/instance-admin.js +90 -0
- package/dist/storage/instance-admin.js.map +1 -0
- package/dist/storage/local/auth-store.d.ts +44 -0
- package/dist/storage/local/auth-store.d.ts.map +1 -0
- package/dist/storage/local/auth-store.js +252 -0
- package/dist/storage/local/auth-store.js.map +1 -0
- package/dist/storage/local/blob-store.d.ts +14 -0
- package/dist/storage/local/blob-store.d.ts.map +1 -0
- package/dist/storage/local/blob-store.js +87 -0
- package/dist/storage/local/blob-store.js.map +1 -0
- package/dist/storage/local/channel-store.d.ts +107 -0
- package/dist/storage/local/channel-store.d.ts.map +1 -0
- package/dist/storage/local/channel-store.js +147 -0
- package/dist/storage/local/channel-store.js.map +1 -0
- package/dist/storage/local/config-store.d.ts +23 -0
- package/dist/storage/local/config-store.d.ts.map +1 -0
- package/dist/storage/local/config-store.js +98 -0
- package/dist/storage/local/config-store.js.map +1 -0
- package/dist/storage/local/cron-store.d.ts +30 -0
- package/dist/storage/local/cron-store.d.ts.map +1 -0
- package/dist/storage/local/cron-store.js +186 -0
- package/dist/storage/local/cron-store.js.map +1 -0
- package/dist/storage/local/exec-approval-store.d.ts +41 -0
- package/dist/storage/local/exec-approval-store.d.ts.map +1 -0
- package/dist/storage/local/exec-approval-store.js +78 -0
- package/dist/storage/local/exec-approval-store.js.map +1 -0
- package/dist/storage/local/extension-store.d.ts +13 -0
- package/dist/storage/local/extension-store.d.ts.map +1 -0
- package/dist/storage/local/extension-store.js +36 -0
- package/dist/storage/local/extension-store.js.map +1 -0
- package/dist/storage/local/file-watcher.d.ts +24 -0
- package/dist/storage/local/file-watcher.d.ts.map +1 -0
- package/dist/storage/local/file-watcher.js +141 -0
- package/dist/storage/local/file-watcher.js.map +1 -0
- package/dist/storage/local/index.d.ts +33 -0
- package/dist/storage/local/index.d.ts.map +1 -0
- package/dist/storage/local/index.js +143 -0
- package/dist/storage/local/index.js.map +1 -0
- package/dist/storage/local/instance-store.d.ts +30 -0
- package/dist/storage/local/instance-store.d.ts.map +1 -0
- package/dist/storage/local/instance-store.js +83 -0
- package/dist/storage/local/instance-store.js.map +1 -0
- package/dist/storage/local/log-store.d.ts +27 -0
- package/dist/storage/local/log-store.d.ts.map +1 -0
- package/dist/storage/local/log-store.js +185 -0
- package/dist/storage/local/log-store.js.map +1 -0
- package/dist/storage/local/memory-store.d.ts +39 -0
- package/dist/storage/local/memory-store.d.ts.map +1 -0
- package/dist/storage/local/memory-store.js +258 -0
- package/dist/storage/local/memory-store.js.map +1 -0
- package/dist/storage/local/message-store.d.ts +27 -0
- package/dist/storage/local/message-store.d.ts.map +1 -0
- package/dist/storage/local/message-store.js +253 -0
- package/dist/storage/local/message-store.js.map +1 -0
- package/dist/storage/local/org-store.d.ts +39 -0
- package/dist/storage/local/org-store.d.ts.map +1 -0
- package/dist/storage/local/org-store.js +155 -0
- package/dist/storage/local/org-store.js.map +1 -0
- package/dist/storage/local/session-store.d.ts +30 -0
- package/dist/storage/local/session-store.d.ts.map +1 -0
- package/dist/storage/local/session-store.js +82 -0
- package/dist/storage/local/session-store.js.map +1 -0
- package/dist/storage/local/skill-store.d.ts +40 -0
- package/dist/storage/local/skill-store.d.ts.map +1 -0
- package/dist/storage/local/skill-store.js +121 -0
- package/dist/storage/local/skill-store.js.map +1 -0
- package/dist/storage/local/subagent-store.d.ts +20 -0
- package/dist/storage/local/subagent-store.d.ts.map +1 -0
- package/dist/storage/local/subagent-store.js +71 -0
- package/dist/storage/local/subagent-store.js.map +1 -0
- package/dist/storage/local/workspace-store.d.ts +22 -0
- package/dist/storage/local/workspace-store.d.ts.map +1 -0
- package/dist/storage/local/workspace-store.js +190 -0
- package/dist/storage/local/workspace-store.js.map +1 -0
- package/dist/storage/migrate.d.ts +64 -0
- package/dist/storage/migrate.d.ts.map +1 -0
- package/dist/storage/migrate.js +581 -0
- package/dist/storage/migrate.js.map +1 -0
- package/dist/storage/runtime-context.d.ts +35 -0
- package/dist/storage/runtime-context.d.ts.map +1 -0
- package/dist/storage/runtime-context.js +145 -0
- package/dist/storage/runtime-context.js.map +1 -0
- package/dist/storage/sentinel.d.ts +28 -0
- package/dist/storage/sentinel.d.ts.map +1 -0
- package/dist/storage/sentinel.js +98 -0
- package/dist/storage/sentinel.js.map +1 -0
- package/dist/storage/session-cache.d.ts +15 -0
- package/dist/storage/session-cache.d.ts.map +1 -0
- package/dist/storage/session-cache.js +81 -0
- package/dist/storage/session-cache.js.map +1 -0
- package/dist/storage/store.d.ts +745 -0
- package/dist/storage/store.d.ts.map +1 -0
- package/dist/storage/store.js +36 -0
- package/dist/storage/store.js.map +1 -0
- package/dist/storage/strict-guard.d.ts +17 -0
- package/dist/storage/strict-guard.d.ts.map +1 -0
- package/dist/storage/strict-guard.js +200 -0
- package/dist/storage/strict-guard.js.map +1 -0
- package/dist/storage/workspace-live-mirror.d.ts +33 -0
- package/dist/storage/workspace-live-mirror.d.ts.map +1 -0
- package/dist/storage/workspace-live-mirror.js +207 -0
- package/dist/storage/workspace-live-mirror.js.map +1 -0
- package/dist/system-prompt/assembler.d.ts +113 -0
- package/dist/system-prompt/assembler.d.ts.map +1 -0
- package/dist/system-prompt/assembler.js +649 -0
- package/dist/system-prompt/assembler.js.map +1 -0
- package/dist/system-prompt/bootstrap-budget.d.ts +22 -0
- package/dist/system-prompt/bootstrap-budget.d.ts.map +1 -0
- package/dist/system-prompt/bootstrap-budget.js +83 -0
- package/dist/system-prompt/bootstrap-budget.js.map +1 -0
- package/dist/system-prompt/cache-boundary.d.ts +13 -0
- package/dist/system-prompt/cache-boundary.d.ts.map +1 -0
- package/dist/system-prompt/cache-boundary.js +56 -0
- package/dist/system-prompt/cache-boundary.js.map +1 -0
- package/dist/system-prompt/cache-stability.d.ts +3 -0
- package/dist/system-prompt/cache-stability.d.ts.map +1 -0
- package/dist/system-prompt/cache-stability.js +18 -0
- package/dist/system-prompt/cache-stability.js.map +1 -0
- package/dist/system-prompt/guidance.d.ts +147 -0
- package/dist/system-prompt/guidance.d.ts.map +1 -0
- package/dist/system-prompt/guidance.js +352 -0
- package/dist/system-prompt/guidance.js.map +1 -0
- package/dist/system-prompt/identity-defaults.d.ts +50 -0
- package/dist/system-prompt/identity-defaults.d.ts.map +1 -0
- package/dist/system-prompt/identity-defaults.js +119 -0
- package/dist/system-prompt/identity-defaults.js.map +1 -0
- package/dist/system-prompt/org/escalation-inbox.d.ts +53 -0
- package/dist/system-prompt/org/escalation-inbox.d.ts.map +1 -0
- package/dist/system-prompt/org/escalation-inbox.js +71 -0
- package/dist/system-prompt/org/escalation-inbox.js.map +1 -0
- package/dist/system-prompt/org/receiver-hint.d.ts +72 -0
- package/dist/system-prompt/org/receiver-hint.d.ts.map +1 -0
- package/dist/system-prompt/org/receiver-hint.js +116 -0
- package/dist/system-prompt/org/receiver-hint.js.map +1 -0
- package/dist/system-prompt/org/render-org-block.d.ts +42 -0
- package/dist/system-prompt/org/render-org-block.d.ts.map +1 -0
- package/dist/system-prompt/org/render-org-block.js +57 -0
- package/dist/system-prompt/org/render-org-block.js.map +1 -0
- package/dist/system-prompt/org/sub-agent-anchor.d.ts +30 -0
- package/dist/system-prompt/org/sub-agent-anchor.d.ts.map +1 -0
- package/dist/system-prompt/org/sub-agent-anchor.js +36 -0
- package/dist/system-prompt/org/sub-agent-anchor.js.map +1 -0
- package/dist/system-prompt/override.d.ts +7 -0
- package/dist/system-prompt/override.d.ts.map +1 -0
- package/dist/system-prompt/override.js +13 -0
- package/dist/system-prompt/override.js.map +1 -0
- package/dist/system-prompt/pi-injection.d.ts +5 -0
- package/dist/system-prompt/pi-injection.d.ts.map +1 -0
- package/dist/system-prompt/pi-injection.js +33 -0
- package/dist/system-prompt/pi-injection.js.map +1 -0
- package/dist/system-prompt/runtime-params.d.ts +34 -0
- package/dist/system-prompt/runtime-params.d.ts.map +1 -0
- package/dist/system-prompt/runtime-params.js +108 -0
- package/dist/system-prompt/runtime-params.js.map +1 -0
- package/dist/system-prompt/sanitize.d.ts +7 -0
- package/dist/system-prompt/sanitize.d.ts.map +1 -0
- package/dist/system-prompt/sanitize.js +31 -0
- package/dist/system-prompt/sanitize.js.map +1 -0
- package/dist/system-prompt/types.d.ts +7 -0
- package/dist/system-prompt/types.d.ts.map +1 -0
- package/dist/system-prompt/types.js +3 -0
- package/dist/system-prompt/types.js.map +1 -0
- package/dist/system-prompt/workspace-loader.d.ts +12 -0
- package/dist/system-prompt/workspace-loader.d.ts.map +1 -0
- package/dist/system-prompt/workspace-loader.js +115 -0
- package/dist/system-prompt/workspace-loader.js.map +1 -0
- package/dist/tideline/advanced.d.ts +25 -0
- package/dist/tideline/advanced.d.ts.map +1 -0
- package/dist/tideline/advanced.js +34 -0
- package/dist/tideline/advanced.js.map +1 -0
- package/dist/tideline/eval.d.ts +19 -0
- package/dist/tideline/eval.d.ts.map +1 -0
- package/dist/tideline/eval.js +24 -0
- package/dist/tideline/eval.js.map +1 -0
- package/dist/tideline/host-ports.standalone.d.ts +49 -0
- package/dist/tideline/host-ports.standalone.d.ts.map +1 -0
- package/dist/tideline/host-ports.standalone.js +61 -0
- package/dist/tideline/host-ports.standalone.js.map +1 -0
- package/dist/tideline/index.d.ts +34 -0
- package/dist/tideline/index.d.ts.map +1 -0
- package/dist/tideline/index.js +42 -0
- package/dist/tideline/index.js.map +1 -0
- package/dist/tui/approval-prompt.d.ts +73 -0
- package/dist/tui/approval-prompt.d.ts.map +1 -0
- package/dist/tui/approval-prompt.js +272 -0
- package/dist/tui/approval-prompt.js.map +1 -0
- package/dist/tui/client.d.ts +89 -0
- package/dist/tui/client.d.ts.map +1 -0
- package/dist/tui/client.js.map +1 -0
- package/dist/ui/brand-frames-cli.d.ts +19 -0
- package/dist/ui/brand-frames-cli.d.ts.map +1 -0
- package/dist/ui/brand-frames-cli.js +8 -13
- package/dist/ui/brand-frames-cli.js.map +1 -0
- package/dist/ui/brand.d.ts +41 -0
- package/dist/ui/brand.d.ts.map +1 -0
- package/dist/ui/brand.js +28 -6
- package/dist/ui/brand.js.map +1 -0
- package/dist/ui/editor.d.ts +30 -0
- package/dist/ui/editor.d.ts.map +1 -0
- package/dist/ui/editor.js +73 -0
- package/dist/ui/editor.js.map +1 -0
- package/dist/ui/format-session.d.ts +68 -0
- package/dist/ui/format-session.d.ts.map +1 -0
- package/dist/ui/format-session.js +181 -0
- package/dist/ui/format-session.js.map +1 -0
- package/dist/ui/markdown.d.ts +48 -0
- package/dist/ui/markdown.d.ts.map +1 -0
- package/dist/ui/markdown.js +60 -0
- package/dist/ui/markdown.js.map +1 -0
- package/dist/ui/onboard-storage-mode.d.ts +17 -0
- package/dist/ui/onboard-storage-mode.d.ts.map +1 -0
- package/dist/ui/onboard-storage-mode.js +638 -0
- package/dist/ui/onboard-storage-mode.js.map +1 -0
- package/dist/ui/onboarding.d.ts +97 -0
- package/dist/ui/onboarding.d.ts.map +1 -0
- package/dist/ui/onboarding.js +259 -111
- package/dist/ui/onboarding.js.map +1 -0
- package/dist/ui/searchable-select.d.ts +48 -0
- package/dist/ui/searchable-select.d.ts.map +1 -0
- package/dist/ui/searchable-select.js +108 -0
- package/dist/ui/searchable-select.js.map +1 -0
- package/dist/ui/syntax-theme.d.ts +30 -0
- package/dist/ui/syntax-theme.d.ts.map +1 -0
- package/dist/ui/syntax-theme.js +72 -0
- package/dist/ui/syntax-theme.js.map +1 -0
- package/dist/ui/terminal-cleanup.d.ts +46 -0
- package/dist/ui/terminal-cleanup.d.ts.map +1 -0
- package/dist/ui/terminal-cleanup.js +17 -5
- package/dist/ui/terminal-cleanup.js.map +1 -0
- package/dist/ui/theme.d.ts +21 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +66 -2
- package/dist/ui/theme.js.map +1 -0
- package/dist/ui/tool-result.d.ts +47 -0
- package/dist/ui/tool-result.d.ts.map +1 -0
- package/dist/ui/tool-result.js +100 -0
- package/dist/ui/tool-result.js.map +1 -0
- package/dist/utils/delivery-context.d.ts +50 -0
- package/dist/utils/delivery-context.d.ts.map +1 -0
- package/dist/utils/delivery-context.js +82 -0
- package/dist/utils/delivery-context.js.map +1 -0
- package/dist/utils/message-channel.d.ts +60 -0
- package/dist/utils/message-channel.d.ts.map +1 -0
- package/dist/utils/message-channel.js +103 -0
- package/dist/utils/message-channel.js.map +1 -0
- package/dist/utils/string-coerce.d.ts +50 -0
- package/dist/utils/string-coerce.d.ts.map +1 -0
- package/dist/utils/string-coerce.js +101 -0
- package/dist/utils/string-coerce.js.map +1 -0
- package/dist/version.d.ts +20 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +54 -0
- package/dist/version.js.map +1 -0
- package/dist/workspace/bootstrap.d.ts +12 -0
- package/dist/workspace/bootstrap.d.ts.map +1 -0
- package/dist/workspace/bootstrap.js +123 -0
- package/dist/workspace/bootstrap.js.map +1 -0
- package/dist/workspace/fs-utils.d.ts +2 -0
- package/dist/workspace/fs-utils.d.ts.map +1 -0
- package/dist/workspace/fs-utils.js +14 -0
- package/dist/workspace/fs-utils.js.map +1 -0
- package/dist/workspace/git-init.d.ts +5 -0
- package/dist/workspace/git-init.d.ts.map +1 -0
- package/dist/workspace/git-init.js +71 -0
- package/dist/workspace/git-init.js.map +1 -0
- package/dist/workspace/state.d.ts +13 -0
- package/dist/workspace/state.d.ts.map +1 -0
- package/dist/workspace/state.js +128 -0
- package/dist/workspace/state.js.map +1 -0
- package/dist/workspace/template-loader.d.ts +15 -0
- package/dist/workspace/template-loader.d.ts.map +1 -0
- package/dist/workspace/template-loader.js +214 -0
- package/dist/workspace/template-loader.js.map +1 -0
- package/package.json +173 -68
- package/scripts/build-done.mjs +125 -0
- package/scripts/run-brigade.mjs +208 -0
- package/skills/1password/SKILL.md +70 -0
- package/skills/1password/references/cli-examples.md +29 -0
- package/skills/1password/references/get-started.md +17 -0
- package/skills/apple-notes/SKILL.md +77 -0
- package/skills/apple-reminders/SKILL.md +118 -0
- package/skills/bear-notes/SKILL.md +107 -0
- package/skills/blogwatcher/SKILL.md +69 -0
- package/skills/blucli/SKILL.md +47 -0
- package/skills/bluebubbles/SKILL.md +136 -0
- package/skills/camsnap/SKILL.md +45 -0
- package/skills/canvas/SKILL.md +204 -0
- package/skills/coding-agent/SKILL.md +316 -0
- package/skills/discord/SKILL.md +197 -0
- package/skills/eightctl/SKILL.md +50 -0
- package/skills/gemini/SKILL.md +43 -0
- package/skills/gh-issues/SKILL.md +885 -0
- package/skills/gifgrep/SKILL.md +79 -0
- package/skills/git-commit/SKILL.md +40 -0
- package/skills/github/SKILL.md +163 -0
- package/skills/gog/SKILL.md +116 -0
- package/skills/goplaces/SKILL.md +52 -0
- package/skills/healthcheck/SKILL.md +245 -0
- package/skills/himalaya/SKILL.md +257 -0
- package/skills/himalaya/references/configuration.md +184 -0
- package/skills/himalaya/references/message-composition.md +199 -0
- package/skills/imsg/SKILL.md +122 -0
- package/skills/lead-scout/SKILL.md +46 -0
- package/skills/mcporter/SKILL.md +61 -0
- package/skills/model-usage/SKILL.md +69 -0
- package/skills/nano-pdf/SKILL.md +38 -0
- package/skills/node-connect/SKILL.md +142 -0
- package/skills/notion/SKILL.md +174 -0
- package/skills/oauth-setup/SKILL.md +55 -0
- package/skills/obsidian/SKILL.md +81 -0
- package/skills/openai-whisper/SKILL.md +38 -0
- package/skills/openai-whisper-api/SKILL.md +62 -0
- package/skills/openai-whisper-api/scripts/transcribe.sh +88 -0
- package/skills/openhue/SKILL.md +112 -0
- package/skills/oracle/SKILL.md +125 -0
- package/skills/ordercli/SKILL.md +78 -0
- package/skills/peekaboo/SKILL.md +190 -0
- package/skills/sag/SKILL.md +87 -0
- package/skills/session-logs/SKILL.md +151 -0
- package/skills/share-skills/SKILL.md +72 -0
- package/skills/sherpa-onnx-tts/SKILL.md +109 -0
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
- package/skills/skill-creator/SKILL.md +372 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/scripts/init_skill.py +378 -0
- package/skills/skill-creator/scripts/package_skill.py +139 -0
- package/skills/skill-creator/scripts/quick_validate.py +159 -0
- package/skills/skill-creator/scripts/test_package_skill.py +160 -0
- package/skills/skill-creator/scripts/test_quick_validate.py +72 -0
- package/skills/slack/SKILL.md +144 -0
- package/skills/songsee/SKILL.md +49 -0
- package/skills/sonoscli/SKILL.md +65 -0
- package/skills/spotify-player/SKILL.md +64 -0
- package/skills/summarize/SKILL.md +87 -0
- package/skills/taskflow/SKILL.md +149 -0
- package/skills/taskflow-inbox-triage/SKILL.md +119 -0
- package/skills/things-mac/SKILL.md +86 -0
- package/skills/tmux/SKILL.md +170 -0
- package/skills/tmux/scripts/find-sessions.sh +112 -0
- package/skills/tmux/scripts/wait-for-text.sh +83 -0
- package/skills/trello/SKILL.md +108 -0
- package/skills/video-frames/SKILL.md +46 -0
- package/skills/video-frames/scripts/frame.sh +81 -0
- package/skills/voice-call/SKILL.md +45 -0
- package/skills/wacli/SKILL.md +72 -0
- package/skills/weather/SKILL.md +129 -0
- package/skills/xurl/SKILL.md +461 -0
- package/templates/workspace/AGENTS.md +223 -0
- package/templates/workspace/BOOTSTRAP.md +64 -0
- package/templates/workspace/HEARTBEAT.md +15 -0
- package/templates/workspace/IDENTITY.md +31 -0
- package/templates/workspace/SOUL.md +47 -0
- package/templates/workspace/TOOLS.md +48 -0
- package/templates/workspace/USER.md +25 -0
- package/CHANGELOG.md +0 -41
- package/SECURITY.md +0 -208
- package/assets/brigade-wordmark.png +0 -0
- package/dist/cli/chat-cmd.js +0 -191
- package/dist/cli/config-cmd.js +0 -171
- package/dist/cli/connect-cmd.js +0 -487
- package/dist/cli/doctor-cmd.js +0 -387
- package/dist/cli/gateway-cmd.js +0 -155
- package/dist/cli.js +0 -328
- package/dist/core/agent.js +0 -1123
- package/dist/core/auth-label.js +0 -147
- package/dist/core/cli-error.js +0 -94
- package/dist/core/error-classifier.js +0 -354
- package/dist/core/provider-payload-mutators.js +0 -517
- package/dist/core/provider-quirks.js +0 -285
- package/dist/core/smart-compaction.js +0 -209
- package/dist/core/system-prompt-defaults.js +0 -264
- package/dist/core/system-prompt-guidance.js +0 -271
- package/dist/index.js +0 -32
- package/dist/ui/brand-frames.js +0 -36
- package/dist/ui/chat.js +0 -1008
|
@@ -0,0 +1,1538 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `browser` tool — Playwright-backed headless browser for tasks the raw
|
|
3
|
+
* `fetch_url` path can't handle.
|
|
4
|
+
*
|
|
5
|
+
* Use when the page is heavily JS-driven, requires interaction (click,
|
|
6
|
+
* fill, scroll), needs a screenshot, needs a PDF render, or needs
|
|
7
|
+
* arbitrary JS evaluated in-page. For plain "fetch + read" use
|
|
8
|
+
* `fetch_url` instead — it's an order of magnitude lighter.
|
|
9
|
+
*
|
|
10
|
+
* Activation: `playwright-core` is a Brigade hard dependency (ships the
|
|
11
|
+
* engine, not Chromium). At launch time we auto-detect a system-installed
|
|
12
|
+
* Chrome / Chromium / Edge / Brave; if none is found we surface a clear
|
|
13
|
+
* actionable error listing the install options + the
|
|
14
|
+
* BRIGADE_BROWSER_EXECUTABLE override.
|
|
15
|
+
*
|
|
16
|
+
* Single browser instance per Brigade process. Tabs are tracked by a
|
|
17
|
+
* Brigade-issued targetId so the agent can drive multiple tabs across
|
|
18
|
+
* turns. The browser auto-shuts when the process exits.
|
|
19
|
+
*
|
|
20
|
+
* Actions exposed (kept tight — composable beats kitchen-sink):
|
|
21
|
+
* - status / open / close / focus / tabs
|
|
22
|
+
* - navigate / snapshot / screenshot / pdf
|
|
23
|
+
* - click / type / evaluate / wait
|
|
24
|
+
*
|
|
25
|
+
* Result envelope: every action returns `{content, details}` where
|
|
26
|
+
* `details.targetId` identifies the active tab. Page text + extracted
|
|
27
|
+
* content is wrapped in the untrusted-content envelope.
|
|
28
|
+
*/
|
|
29
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
30
|
+
import { dirname, join, resolve as pathResolve, sep } from "node:path";
|
|
31
|
+
import { Type } from "typebox";
|
|
32
|
+
import { buildExternalContentMeta, wrapWebContent } from "../../security/external-content.js";
|
|
33
|
+
import { createSubsystemLogger } from "../../logging/subsystem-logger.js";
|
|
34
|
+
import { BRIGADE_DIR } from "../../core/config.js";
|
|
35
|
+
import { resolveOsCacheDir } from "../../config/paths.js";
|
|
36
|
+
import { tryGetRuntimeContext } from "../../storage/runtime-context.js";
|
|
37
|
+
import { classifyUrlForSsrf, SsrfBlockedError } from "../../infra/net/fetch-guard.js";
|
|
38
|
+
import { htmlToMarkdown, stripEnvelopeMarkers, stripInvisibleUnicode } from "./web-fetch-utils.js";
|
|
39
|
+
const log = createSubsystemLogger("brigade/browser");
|
|
40
|
+
let playwrightP = null;
|
|
41
|
+
/**
|
|
42
|
+
* Lazy-load Playwright. Prefers `playwright-core` (Brigade's hard dep —
|
|
43
|
+
* ships the engine WITHOUT bundling Chromium) and falls back to
|
|
44
|
+
* `playwright` (which bundles Chromium) when an operator has it
|
|
45
|
+
* installed. Either works for our use case.
|
|
46
|
+
*/
|
|
47
|
+
async function loadPlaywright() {
|
|
48
|
+
if (!playwrightP) {
|
|
49
|
+
playwrightP = (async () => {
|
|
50
|
+
try {
|
|
51
|
+
return (await import(/* @vite-ignore */ "playwright-core"));
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return (await import(/* @vite-ignore */ "playwright"));
|
|
55
|
+
}
|
|
56
|
+
})().catch((err) => {
|
|
57
|
+
playwrightP = null;
|
|
58
|
+
throw err;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return playwrightP;
|
|
62
|
+
}
|
|
63
|
+
/* ─────────────────────────── system browser discovery ─────────────────────────── */
|
|
64
|
+
/**
|
|
65
|
+
* Find a Chromium-family browser binary on the host. Mirrors the
|
|
66
|
+
* upstream reference's executable-discovery cascade: explicit env var
|
|
67
|
+
* → standard system install paths per platform → null. Brigade ships
|
|
68
|
+
* `playwright-core` (no bundled Chromium), so we rely on a
|
|
69
|
+
* system-installed Chrome / Chromium / Edge / Brave.
|
|
70
|
+
*/
|
|
71
|
+
function findSystemBrowserExecutable() {
|
|
72
|
+
const explicit = (process.env.BRIGADE_BROWSER_EXECUTABLE ?? "").trim();
|
|
73
|
+
if (explicit)
|
|
74
|
+
return explicit;
|
|
75
|
+
const platform = process.platform;
|
|
76
|
+
const candidates = [];
|
|
77
|
+
if (platform === "win32") {
|
|
78
|
+
const programFiles = process.env["ProgramFiles"] ?? "C:\\Program Files";
|
|
79
|
+
const programFiles86 = process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
|
|
80
|
+
const localAppData = process.env["LocalAppData"] ?? "";
|
|
81
|
+
candidates.push(`${programFiles}\\Google\\Chrome\\Application\\chrome.exe`, `${programFiles86}\\Google\\Chrome\\Application\\chrome.exe`, `${programFiles}\\Microsoft\\Edge\\Application\\msedge.exe`, `${programFiles86}\\Microsoft\\Edge\\Application\\msedge.exe`, `${programFiles}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`, localAppData ? `${localAppData}\\Google\\Chrome\\Application\\chrome.exe` : "");
|
|
82
|
+
}
|
|
83
|
+
else if (platform === "darwin") {
|
|
84
|
+
candidates.push("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser", "/Applications/Chromium.app/Contents/MacOS/Chromium");
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// Linux / WSL / BSD
|
|
88
|
+
candidates.push("/usr/bin/google-chrome", "/usr/bin/google-chrome-stable", "/usr/bin/chromium", "/usr/bin/chromium-browser", "/usr/bin/microsoft-edge", "/usr/bin/brave-browser", "/snap/bin/chromium", "/snap/bin/google-chrome");
|
|
89
|
+
}
|
|
90
|
+
for (const p of candidates) {
|
|
91
|
+
if (!p)
|
|
92
|
+
continue;
|
|
93
|
+
try {
|
|
94
|
+
if (existsSync(p))
|
|
95
|
+
return p;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
/* permission denied — try the next */
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
/** Per-profile lazy state. Default profile is `"default"`; sub-agents
|
|
104
|
+
* + the operator can use named profiles to isolate cookies/storage. */
|
|
105
|
+
const PROFILE_STATE = new Map();
|
|
106
|
+
const DEFAULT_PROFILE = "default";
|
|
107
|
+
/**
|
|
108
|
+
* Brigade-managed profiles live under `~/.brigade/browser/<name>/`. The
|
|
109
|
+
* default profile is always present; others are created on first use.
|
|
110
|
+
* `attached:<endpoint>` is a special pseudo-profile that points at an
|
|
111
|
+
* existing Chrome via CDP — no userDataDir, no lifecycle ownership.
|
|
112
|
+
*/
|
|
113
|
+
function isAttachedProfile(name) {
|
|
114
|
+
return name.startsWith("attached:");
|
|
115
|
+
}
|
|
116
|
+
function profileUserDataDir(name) {
|
|
117
|
+
if (isAttachedProfile(name))
|
|
118
|
+
throw new Error("browser: attached profiles have no user data dir");
|
|
119
|
+
// Keep profile names tame — restrict to a portable charset so we
|
|
120
|
+
// don't generate unwriteable paths on Windows.
|
|
121
|
+
const safe = name.replace(/[^a-z0-9_.-]/gi, "_");
|
|
122
|
+
// Convex mode: Chromium owns this directory (SQLite + LevelDB + caches —
|
|
123
|
+
// hundreds of files only Chromium can coherently write), so it cannot
|
|
124
|
+
// ride Convex; it lives in the OS cache dir instead of ~/.brigade.
|
|
125
|
+
// Machine-local by nature: cookies/logins don't roam, which is the
|
|
126
|
+
// accepted trade-off. BRIGADE_BROWSER_USER_DATA_DIR overrides both modes.
|
|
127
|
+
const override = process.env.BRIGADE_BROWSER_USER_DATA_DIR?.trim();
|
|
128
|
+
if (override)
|
|
129
|
+
return join(override, safe || DEFAULT_PROFILE);
|
|
130
|
+
if (tryGetRuntimeContext()?.mode === "convex") {
|
|
131
|
+
return join(resolveOsCacheDir(), "browser", safe || DEFAULT_PROFILE);
|
|
132
|
+
}
|
|
133
|
+
return join(BRIGADE_DIR, "browser", safe || DEFAULT_PROFILE);
|
|
134
|
+
}
|
|
135
|
+
async function ensureBrowser(opts) {
|
|
136
|
+
const profile = (opts.profile ?? DEFAULT_PROFILE).trim() || DEFAULT_PROFILE;
|
|
137
|
+
const existing = PROFILE_STATE.get(profile);
|
|
138
|
+
if (existing)
|
|
139
|
+
return existing;
|
|
140
|
+
const launching = (async () => {
|
|
141
|
+
const pw = await loadPlaywright();
|
|
142
|
+
// CDP attach path — `attached:<endpoint>` profile attaches to a
|
|
143
|
+
// pre-existing Chrome via /json/version handshake.
|
|
144
|
+
if (isAttachedProfile(profile)) {
|
|
145
|
+
const endpoint = profile.slice("attached:".length).trim();
|
|
146
|
+
if (!endpoint)
|
|
147
|
+
throw new Error("browser: attached profile is missing endpoint URL");
|
|
148
|
+
const state = await attachOverCdp(pw, { endpoint, profile, timeoutMs: opts.timeoutMs });
|
|
149
|
+
return state;
|
|
150
|
+
}
|
|
151
|
+
const executablePath = findSystemBrowserExecutable();
|
|
152
|
+
if (!executablePath) {
|
|
153
|
+
throw new Error([
|
|
154
|
+
"browser: no Chrome / Chromium / Edge / Brave found on this system.",
|
|
155
|
+
"To use this tool, install one of:",
|
|
156
|
+
" - Google Chrome (https://www.google.com/chrome/)",
|
|
157
|
+
" - Chromium (apt install chromium-browser, brew install --cask chromium)",
|
|
158
|
+
" - Microsoft Edge",
|
|
159
|
+
" - Brave Browser",
|
|
160
|
+
"Or set BRIGADE_BROWSER_EXECUTABLE=/absolute/path/to/your/browser before starting Brigade.",
|
|
161
|
+
].join("\n"));
|
|
162
|
+
}
|
|
163
|
+
// Persistent profile dir under `~/.brigade/browser/<profile>/`. Cookies,
|
|
164
|
+
// cache, Cloudflare passes — everything survives across turns AND
|
|
165
|
+
// across gateway restarts. First visit to a bot-protected site takes
|
|
166
|
+
// the full challenge time; revisits go straight through.
|
|
167
|
+
const userDataDir = profileUserDataDir(profile);
|
|
168
|
+
try {
|
|
169
|
+
mkdirSync(userDataDir, { recursive: true });
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
/* best effort — playwright will surface a clearer error if it can't write */
|
|
173
|
+
}
|
|
174
|
+
// Chrome flags. `--headless=new` selects the modern headless renderer
|
|
175
|
+
// (~2024+) which is dramatically faster than the legacy headless mode
|
|
176
|
+
// Playwright defaults to. `--disable-gpu` is the recommended pairing
|
|
177
|
+
// for headless. `--disable-http2` keeps real-world sites with broken
|
|
178
|
+
// H/2 stacks (Justdial, IndiaMART, etc.) from throwing
|
|
179
|
+
// ERR_HTTP2_PROTOCOL_ERROR.
|
|
180
|
+
const args = [
|
|
181
|
+
"--disable-http2",
|
|
182
|
+
"--disable-blink-features=AutomationControlled",
|
|
183
|
+
"--disable-features=Translate,OptimizationHints,MediaRouter",
|
|
184
|
+
"--no-default-browser-check",
|
|
185
|
+
"--no-first-run",
|
|
186
|
+
"--disable-sync",
|
|
187
|
+
"--disable-background-networking",
|
|
188
|
+
"--disable-component-update",
|
|
189
|
+
];
|
|
190
|
+
if (opts.headless) {
|
|
191
|
+
args.push("--headless=new", "--disable-gpu");
|
|
192
|
+
}
|
|
193
|
+
const browser = await pw.chromium.launchPersistentContext(userDataDir, {
|
|
194
|
+
headless: opts.headless,
|
|
195
|
+
timeout: opts.timeoutMs,
|
|
196
|
+
executablePath,
|
|
197
|
+
args,
|
|
198
|
+
});
|
|
199
|
+
const state = {
|
|
200
|
+
browser,
|
|
201
|
+
tabs: new Map(),
|
|
202
|
+
focusedTargetId: null,
|
|
203
|
+
nextId: 1,
|
|
204
|
+
profile,
|
|
205
|
+
source: "launched",
|
|
206
|
+
};
|
|
207
|
+
// Auto-invalidate when the context dies. Playwright emits `close`
|
|
208
|
+
// on the BrowserContext (which is what launchPersistentContext
|
|
209
|
+
// returns) when the underlying Chrome process disconnects,
|
|
210
|
+
// crashes, or is killed externally. Without this, the next call
|
|
211
|
+
// would dereference a dead context and throw
|
|
212
|
+
// "browserContext.newPage: Target page, context or browser has been
|
|
213
|
+
// closed". Clearing the profile cache makes the next `ensureBrowser`
|
|
214
|
+
// rebuild a fresh one from scratch.
|
|
215
|
+
try {
|
|
216
|
+
browser.on?.("close", () => {
|
|
217
|
+
log.debug("browser: context closed; resetting state for next call", { profile });
|
|
218
|
+
PROFILE_STATE.delete(profile);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
/* on() not available on this version — fall back to lazy retry below */
|
|
223
|
+
}
|
|
224
|
+
// Best-effort cleanup on process exit. We don't await here — the
|
|
225
|
+
// process is exiting anyway; if the close hangs we'd rather get out.
|
|
226
|
+
const cleanup = () => {
|
|
227
|
+
void browser.close().catch(() => { });
|
|
228
|
+
};
|
|
229
|
+
process.once("exit", cleanup);
|
|
230
|
+
process.once("SIGTERM", cleanup);
|
|
231
|
+
process.once("SIGINT", cleanup);
|
|
232
|
+
return state;
|
|
233
|
+
})().catch((err) => {
|
|
234
|
+
PROFILE_STATE.delete(profile);
|
|
235
|
+
throw err;
|
|
236
|
+
});
|
|
237
|
+
PROFILE_STATE.set(profile, launching);
|
|
238
|
+
return launching;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Attach to an existing Chrome via the DevTools Protocol. The endpoint is
|
|
242
|
+
* the WebSocket URL Chrome surfaces when launched with
|
|
243
|
+
* `--remote-debugging-port=N`. Brigade uses the first existing context if
|
|
244
|
+
* one exists; otherwise creates a fresh isolated one. The attached browser
|
|
245
|
+
* is NOT owned by Brigade — `stop` does not close it (only detaches).
|
|
246
|
+
*/
|
|
247
|
+
async function attachOverCdp(pw, args) {
|
|
248
|
+
const cdpBrowser = await pw.chromium.connectOverCDP(args.endpoint, { timeout: args.timeoutMs });
|
|
249
|
+
const contexts = cdpBrowser.contexts();
|
|
250
|
+
const ctx = contexts.length > 0 && contexts[0] ? contexts[0] : await cdpBrowser.newContext();
|
|
251
|
+
const state = {
|
|
252
|
+
browser: ctx,
|
|
253
|
+
tabs: new Map(),
|
|
254
|
+
focusedTargetId: null,
|
|
255
|
+
nextId: 1,
|
|
256
|
+
profile: args.profile,
|
|
257
|
+
source: "attached",
|
|
258
|
+
};
|
|
259
|
+
try {
|
|
260
|
+
ctx.on?.("close", () => {
|
|
261
|
+
log.debug("browser: attached context closed", { profile: args.profile });
|
|
262
|
+
PROFILE_STATE.delete(args.profile);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
/* best effort */
|
|
267
|
+
}
|
|
268
|
+
// Pre-populate tabs from already-open pages so the agent can act on
|
|
269
|
+
// them without explicitly calling `open`.
|
|
270
|
+
try {
|
|
271
|
+
const existingPages = ctx.pages?.() ?? [];
|
|
272
|
+
for (const p of existingPages) {
|
|
273
|
+
const handle = buildTabHandle(state, p);
|
|
274
|
+
const targetId = `tab-${state.nextId}`;
|
|
275
|
+
state.nextId += 1;
|
|
276
|
+
state.tabs.set(targetId, handle);
|
|
277
|
+
if (!state.focusedTargetId)
|
|
278
|
+
state.focusedTargetId = targetId;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
/* page enumeration failed — agent can open fresh tabs */
|
|
283
|
+
}
|
|
284
|
+
return state;
|
|
285
|
+
}
|
|
286
|
+
/** Probe a CDP endpoint quickly to verify reachability before attach. */
|
|
287
|
+
async function probeCdpEndpoint(endpoint, timeoutMs) {
|
|
288
|
+
// Accept ws:// + http:// forms. Most operators paste the
|
|
289
|
+
// /json/version URL; some paste the bare ws endpoint. Normalize to
|
|
290
|
+
// the discovery URL Chrome serves on the debug port.
|
|
291
|
+
let discoveryUrl;
|
|
292
|
+
try {
|
|
293
|
+
const u = new URL(endpoint);
|
|
294
|
+
const proto = u.protocol === "ws:" ? "http:" : u.protocol === "wss:" ? "https:" : u.protocol;
|
|
295
|
+
discoveryUrl = `${proto}//${u.host}/json/version`;
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
const controller = new AbortController();
|
|
301
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
302
|
+
timer.unref?.();
|
|
303
|
+
try {
|
|
304
|
+
const res = await fetch(discoveryUrl, { signal: controller.signal });
|
|
305
|
+
return res.ok;
|
|
306
|
+
}
|
|
307
|
+
catch {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
finally {
|
|
311
|
+
clearTimeout(timer);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function buildTabHandle(state, page) {
|
|
315
|
+
const handle = {
|
|
316
|
+
page,
|
|
317
|
+
consoleLog: [],
|
|
318
|
+
dialogLog: [],
|
|
319
|
+
pendingDialog: null,
|
|
320
|
+
profile: state.profile,
|
|
321
|
+
consoleListener: (msg) => {
|
|
322
|
+
try {
|
|
323
|
+
const loc = msg.location?.();
|
|
324
|
+
const ev = {
|
|
325
|
+
type: msg.type(),
|
|
326
|
+
text: msg.text(),
|
|
327
|
+
url: loc?.url,
|
|
328
|
+
lineNumber: loc?.lineNumber,
|
|
329
|
+
timestamp: Date.now(),
|
|
330
|
+
};
|
|
331
|
+
handle.consoleLog.push(ev);
|
|
332
|
+
// Cap to last 500 entries to keep the buffer bounded — long
|
|
333
|
+
// JS-heavy pages can spam thousands of console messages.
|
|
334
|
+
if (handle.consoleLog.length > 500)
|
|
335
|
+
handle.consoleLog.shift();
|
|
336
|
+
}
|
|
337
|
+
catch {
|
|
338
|
+
/* ignore listener errors */
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
dialogListener: (dialog) => {
|
|
342
|
+
const ev = {
|
|
343
|
+
type: dialog.type(),
|
|
344
|
+
message: dialog.message(),
|
|
345
|
+
defaultValue: dialog.defaultValue(),
|
|
346
|
+
handled: "pending",
|
|
347
|
+
timestamp: Date.now(),
|
|
348
|
+
};
|
|
349
|
+
handle.dialogLog.push(ev);
|
|
350
|
+
if (handle.dialogLog.length > 100)
|
|
351
|
+
handle.dialogLog.shift();
|
|
352
|
+
const pending = handle.pendingDialog;
|
|
353
|
+
if (pending) {
|
|
354
|
+
if (pending.disposition === "accept") {
|
|
355
|
+
ev.handled = "accepted";
|
|
356
|
+
void dialog.accept(pending.promptText).catch(() => { });
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
ev.handled = "dismissed";
|
|
360
|
+
void dialog.dismiss().catch(() => { });
|
|
361
|
+
}
|
|
362
|
+
handle.pendingDialog = null;
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
// Default: auto-dismiss so pages can't hang the agent on a
|
|
366
|
+
// modal. Operator can pre-arm `dialog:accept` to override.
|
|
367
|
+
ev.handled = "dismissed";
|
|
368
|
+
void dialog.dismiss().catch(() => { });
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
pageErrorListener: (err) => {
|
|
372
|
+
handle.consoleLog.push({
|
|
373
|
+
type: "pageerror",
|
|
374
|
+
text: err.message,
|
|
375
|
+
timestamp: Date.now(),
|
|
376
|
+
});
|
|
377
|
+
if (handle.consoleLog.length > 500)
|
|
378
|
+
handle.consoleLog.shift();
|
|
379
|
+
},
|
|
380
|
+
};
|
|
381
|
+
try {
|
|
382
|
+
page.on("console", handle.consoleListener);
|
|
383
|
+
page.on("pageerror", handle.pageErrorListener);
|
|
384
|
+
page.on("dialog", handle.dialogListener);
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
/* listener registration failed — agent loses telemetry but tool still works */
|
|
388
|
+
}
|
|
389
|
+
return handle;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Detach the console/dialog/pageerror listeners we attached in
|
|
393
|
+
* `buildTabHandle`. Playwright's `Page.off` removes a specific listener
|
|
394
|
+
* by reference — we kept the bound functions on the handle so we can
|
|
395
|
+
* pass them back here. Best-effort: `off()` may not exist on every
|
|
396
|
+
* Playwright minor version, in which case we leave the listeners
|
|
397
|
+
* attached (the page is about to close anyway, so GC reclaims them).
|
|
398
|
+
*/
|
|
399
|
+
function detachTabListeners(handle) {
|
|
400
|
+
const page = handle.page;
|
|
401
|
+
try {
|
|
402
|
+
page.off?.("console", handle.consoleListener);
|
|
403
|
+
page.off?.("pageerror", handle.pageErrorListener);
|
|
404
|
+
page.off?.("dialog", handle.dialogListener);
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
/* off() unavailable — close-time GC handles it */
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function isStaleError(err) {
|
|
411
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
412
|
+
return /has been closed|browser has crashed|Target page, context or browser|Target closed|Page closed/i.test(msg);
|
|
413
|
+
}
|
|
414
|
+
async function getActivePage(state, requestedId) {
|
|
415
|
+
if (requestedId) {
|
|
416
|
+
const handle = state.tabs.get(requestedId);
|
|
417
|
+
if (!handle)
|
|
418
|
+
throw new Error(`browser: unknown targetId "${requestedId}"`);
|
|
419
|
+
// Stale-target recovery: if the page closed underneath us, drop the
|
|
420
|
+
// handle and either return the next viable tab OR open a fresh one.
|
|
421
|
+
if (handle.page.isClosed?.()) {
|
|
422
|
+
state.tabs.delete(requestedId);
|
|
423
|
+
if (state.focusedTargetId === requestedId)
|
|
424
|
+
state.focusedTargetId = null;
|
|
425
|
+
throw new Error(`browser: tab "${requestedId}" was closed underneath us — call the action again without targetId to use a fresh tab.`);
|
|
426
|
+
}
|
|
427
|
+
return { handle, targetId: requestedId };
|
|
428
|
+
}
|
|
429
|
+
if (state.focusedTargetId) {
|
|
430
|
+
const handle = state.tabs.get(state.focusedTargetId);
|
|
431
|
+
if (handle && !handle.page.isClosed?.()) {
|
|
432
|
+
return { handle, targetId: state.focusedTargetId };
|
|
433
|
+
}
|
|
434
|
+
// Focused tab is gone — clear + fall through.
|
|
435
|
+
if (handle)
|
|
436
|
+
state.tabs.delete(state.focusedTargetId);
|
|
437
|
+
state.focusedTargetId = null;
|
|
438
|
+
}
|
|
439
|
+
// No focused tab — open a fresh one.
|
|
440
|
+
return openNewTab(state);
|
|
441
|
+
}
|
|
442
|
+
async function openNewTab(state, url, opts) {
|
|
443
|
+
// Defensive recovery: if the persistent context died between
|
|
444
|
+
// `ensureBrowser` and here (Chrome crashed, OS killed it, user closed
|
|
445
|
+
// the visible window), `newPage()` throws "context has been closed".
|
|
446
|
+
// Detect that, null out the cached state for this profile, and surface
|
|
447
|
+
// a clear error so the next tool call rebuilds rather than re-using
|
|
448
|
+
// the dead state.
|
|
449
|
+
let page;
|
|
450
|
+
try {
|
|
451
|
+
page = await state.browser.newPage();
|
|
452
|
+
}
|
|
453
|
+
catch (err) {
|
|
454
|
+
if (isStaleError(err)) {
|
|
455
|
+
PROFILE_STATE.delete(state.profile);
|
|
456
|
+
throw new Error("browser: the underlying Chrome process closed unexpectedly (window manually closed, OS killed it, or it crashed). Call the browser action again — it will re-launch automatically.");
|
|
457
|
+
}
|
|
458
|
+
throw err;
|
|
459
|
+
}
|
|
460
|
+
const handle = buildTabHandle(state, page);
|
|
461
|
+
const targetId = `tab-${state.nextId}`;
|
|
462
|
+
state.nextId += 1;
|
|
463
|
+
state.tabs.set(targetId, handle);
|
|
464
|
+
state.focusedTargetId = targetId;
|
|
465
|
+
if (url) {
|
|
466
|
+
await page.goto(url, {
|
|
467
|
+
waitUntil: opts?.waitUntil ?? "domcontentloaded",
|
|
468
|
+
timeout: opts?.timeout,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
return { handle, targetId };
|
|
472
|
+
}
|
|
473
|
+
/* ─────────────────────────── schema + result ─────────────────────────── */
|
|
474
|
+
const BrowserSchema = Type.Object({
|
|
475
|
+
// A plain string (validated in-tool against BROWSER_ACTIONS) rather than a
|
|
476
|
+
// literal union: an unknown/hallucinated action then reaches the dispatch
|
|
477
|
+
// `default` case and gets a clean, actionable "unknown action — valid: …"
|
|
478
|
+
// error instead of Pi's cryptic "must be equal to constant" dump (repeated
|
|
479
|
+
// once per literal). The full surface is enumerated in the description so
|
|
480
|
+
// the model still sees every valid action.
|
|
481
|
+
action: Type.String({
|
|
482
|
+
description: "Action to perform — must be EXACTLY one of: status, start, stop, profiles, attach, tabs, open, focus, close, navigate, snapshot, screenshot, pdf, click, type, press, hover, drag, select, fill, resize, scroll, scrollIntoView, evaluate, wait, console, dialog, upload. " +
|
|
483
|
+
"`start`/`stop`/`profiles`/`attach` manage lifecycle; `status`/`tabs` introspect; `open`/`navigate` for nav; `snapshot` returns the page as markdown; `screenshot` returns base64 PNG; `pdf` returns base64 PDF; `click`/`type`/`press`/`hover`/`drag`/`select`/`fill` for interaction; `scroll` scrolls the page (or a `selector` container) — use `to:\"bottom\"` with `times` to load infinite-scroll feeds like Google Maps results or directory listings; `scrollIntoView` brings ONE element into view; `resize` changes the viewport; `evaluate` runs JS; `wait` blocks on a condition; `console` returns captured logs; `dialog` arms an auto-handler; `upload` sets file inputs.",
|
|
484
|
+
}),
|
|
485
|
+
profile: Type.Optional(Type.String({
|
|
486
|
+
description: "Named browser profile (defaults to 'default'). Each profile gets an isolated `~/.brigade/browser/<name>/` user-data dir — cookies/storage are independent. Use distinct profiles per sub-agent to avoid cross-contamination.",
|
|
487
|
+
})),
|
|
488
|
+
targetId: Type.Optional(Type.String({
|
|
489
|
+
description: "Tab id from a prior `open`. Omit to use the focused tab (or open one).",
|
|
490
|
+
})),
|
|
491
|
+
targetId2: Type.Optional(Type.String({
|
|
492
|
+
description: "Secondary tab id — currently unused; reserved for future cross-tab drag.",
|
|
493
|
+
})),
|
|
494
|
+
url: Type.Optional(Type.String({
|
|
495
|
+
description: "URL for `open` and `navigate` actions. Must be http(s); SSRF-guarded.",
|
|
496
|
+
})),
|
|
497
|
+
selector: Type.Optional(Type.String({
|
|
498
|
+
description: "CSS selector for `click`/`type`/`press`/`hover`/`select`/`fill`/`scrollIntoView`/`upload`/`wait` actions. For `scroll`, the scroll CONTAINER (e.g. `div[role=\"feed\"]` for the Google Maps results panel); omit to scroll the whole page.",
|
|
499
|
+
})),
|
|
500
|
+
targetSelector: Type.Optional(Type.String({
|
|
501
|
+
description: "For `drag`: destination element selector (source is `selector`).",
|
|
502
|
+
})),
|
|
503
|
+
text: Type.Optional(Type.String({
|
|
504
|
+
description: "Text to type for `type`/`fill`, the key for `press` (e.g. 'Enter', 'Tab', 'a'), or substring to wait for in `wait`.",
|
|
505
|
+
})),
|
|
506
|
+
textGone: Type.Optional(Type.String({
|
|
507
|
+
description: "For `wait`: substring whose DISAPPEARANCE we wait for (opposite of `text`).",
|
|
508
|
+
})),
|
|
509
|
+
values: Type.Optional(Type.Array(Type.String(), {
|
|
510
|
+
description: "For `select`: one or more option values to select on a <select> element.",
|
|
511
|
+
})),
|
|
512
|
+
fields: Type.Optional(Type.Array(Type.Object({
|
|
513
|
+
name: Type.String({ description: "Field selector (CSS or label text in [data-testid] form)." }),
|
|
514
|
+
value: Type.String({ description: "Value to type into the field." }),
|
|
515
|
+
}), {
|
|
516
|
+
description: "For `fill`: batch-fill an array of {name, value} pairs (replaces individual `selector`+`text` calls).",
|
|
517
|
+
})),
|
|
518
|
+
files: Type.Optional(Type.Array(Type.String(), {
|
|
519
|
+
description: "For `upload`: absolute file paths to attach to the input[type=file] at `selector`.",
|
|
520
|
+
})),
|
|
521
|
+
width: Type.Optional(Type.Integer({
|
|
522
|
+
description: "For `resize`: viewport width in CSS pixels (must pair with `height`).",
|
|
523
|
+
minimum: 100,
|
|
524
|
+
maximum: 8192,
|
|
525
|
+
})),
|
|
526
|
+
height: Type.Optional(Type.Integer({
|
|
527
|
+
description: "For `resize`: viewport height in CSS pixels.",
|
|
528
|
+
minimum: 100,
|
|
529
|
+
maximum: 8192,
|
|
530
|
+
})),
|
|
531
|
+
script: Type.Optional(Type.String({
|
|
532
|
+
description: "Async JS body for the `evaluate` action. Wrapped in an async fn; return value is JSON-serialized.",
|
|
533
|
+
})),
|
|
534
|
+
fullPage: Type.Optional(Type.Boolean({
|
|
535
|
+
description: "For `screenshot`: capture entire scrollable page instead of viewport.",
|
|
536
|
+
})),
|
|
537
|
+
outputPath: Type.Optional(Type.String({
|
|
538
|
+
description: "For `screenshot`/`pdf`: absolute path to write to (must be under `~/.brigade/` or the current workspace). When omitted, Brigade auto-generates a path under `~/.brigade/captures/`.",
|
|
539
|
+
})),
|
|
540
|
+
timeoutMs: Type.Optional(Type.Integer({
|
|
541
|
+
description: "Per-action timeout. Default 45 s; max 120 s.",
|
|
542
|
+
minimum: 100,
|
|
543
|
+
maximum: 120_000,
|
|
544
|
+
})),
|
|
545
|
+
timeMs: Type.Optional(Type.Integer({
|
|
546
|
+
description: "For `wait`: pure delay in ms (no other condition).",
|
|
547
|
+
minimum: 0,
|
|
548
|
+
maximum: 120_000,
|
|
549
|
+
})),
|
|
550
|
+
loadState: Type.Optional(Type.Union([
|
|
551
|
+
Type.Literal("load"),
|
|
552
|
+
Type.Literal("domcontentloaded"),
|
|
553
|
+
Type.Literal("networkidle"),
|
|
554
|
+
], {
|
|
555
|
+
description: "For `wait`: wait for a specific page load lifecycle state.",
|
|
556
|
+
})),
|
|
557
|
+
waitUntil: Type.Optional(Type.Union([
|
|
558
|
+
Type.Literal("commit"),
|
|
559
|
+
Type.Literal("domcontentloaded"),
|
|
560
|
+
Type.Literal("load"),
|
|
561
|
+
Type.Literal("networkidle"),
|
|
562
|
+
], {
|
|
563
|
+
description: "For `navigate`: when to consider the nav done. `commit` = first byte (fastest; use for heavily bot-protected pages that never fire load). `domcontentloaded` = HTML parsed (default). `load` = all resources fetched. `networkidle` = no requests for 500ms (slowest).",
|
|
564
|
+
})),
|
|
565
|
+
endpoint: Type.Optional(Type.String({
|
|
566
|
+
description: "For `attach`: CDP endpoint URL of an existing Chrome (e.g. `ws://127.0.0.1:9222`). Brigade attaches without owning the lifecycle.",
|
|
567
|
+
})),
|
|
568
|
+
disposition: Type.Optional(Type.Union([Type.Literal("accept"), Type.Literal("dismiss")], {
|
|
569
|
+
description: "For `dialog`: how to handle the NEXT dialog (alert/confirm/prompt). `accept` clicks OK + types `text` for prompts; `dismiss` clicks Cancel. Default behaviour (no `dialog` action called) is auto-dismiss.",
|
|
570
|
+
})),
|
|
571
|
+
snapshotFormat: Type.Optional(Type.Union([Type.Literal("markdown"), Type.Literal("interactive"), Type.Literal("text")], {
|
|
572
|
+
description: "For `snapshot`: `markdown` (default) = readability + markdown; `interactive` = bullet list of interactive elements with `e<n>` refs the agent can target via :nth-of-type-style CSS selectors; `text` = page innerText only.",
|
|
573
|
+
})),
|
|
574
|
+
maxChars: Type.Optional(Type.Integer({
|
|
575
|
+
description: "For `snapshot`: cap on output length (default 60 000; head+tail truncated on overflow).",
|
|
576
|
+
minimum: 500,
|
|
577
|
+
maximum: 500_000,
|
|
578
|
+
})),
|
|
579
|
+
compact: Type.Optional(Type.Boolean({
|
|
580
|
+
description: "For `snapshot`: collapse runs of blank lines + strip empty list items.",
|
|
581
|
+
})),
|
|
582
|
+
to: Type.Optional(Type.Union([Type.Literal("top"), Type.Literal("bottom")], {
|
|
583
|
+
description: "For `scroll`: jump to the top or bottom of the page (or of the `selector` container). Omit BOTH `to` and `pixels` to default to scrolling to the bottom (loads more on infinite-scroll feeds).",
|
|
584
|
+
})),
|
|
585
|
+
pixels: Type.Optional(Type.Integer({
|
|
586
|
+
description: "For `scroll`: scroll by this many pixels (positive = down, negative = up). Ignored when `to` is set.",
|
|
587
|
+
minimum: -100_000,
|
|
588
|
+
maximum: 100_000,
|
|
589
|
+
})),
|
|
590
|
+
times: Type.Optional(Type.Integer({
|
|
591
|
+
description: "For `scroll`: repeat the scroll step N times with a short pause between — triggers infinite-scroll / lazy-loaded feeds (Google Maps results, Justdial listings). Default 1, max 30.",
|
|
592
|
+
minimum: 1,
|
|
593
|
+
maximum: 30,
|
|
594
|
+
})),
|
|
595
|
+
});
|
|
596
|
+
/**
|
|
597
|
+
* The complete `browser` action surface — single source of truth for the
|
|
598
|
+
* unknown-action error (dispatch `default` case) and the schema test. Keep
|
|
599
|
+
* in sync with the `action` description above and the dispatch switch below.
|
|
600
|
+
*/
|
|
601
|
+
export const BROWSER_ACTIONS = [
|
|
602
|
+
"status",
|
|
603
|
+
"start",
|
|
604
|
+
"stop",
|
|
605
|
+
"profiles",
|
|
606
|
+
"attach",
|
|
607
|
+
"tabs",
|
|
608
|
+
"open",
|
|
609
|
+
"focus",
|
|
610
|
+
"close",
|
|
611
|
+
"navigate",
|
|
612
|
+
"snapshot",
|
|
613
|
+
"screenshot",
|
|
614
|
+
"pdf",
|
|
615
|
+
"click",
|
|
616
|
+
"type",
|
|
617
|
+
"press",
|
|
618
|
+
"hover",
|
|
619
|
+
"drag",
|
|
620
|
+
"select",
|
|
621
|
+
"fill",
|
|
622
|
+
"resize",
|
|
623
|
+
"scroll",
|
|
624
|
+
"scrollIntoView",
|
|
625
|
+
"evaluate",
|
|
626
|
+
"wait",
|
|
627
|
+
"console",
|
|
628
|
+
"dialog",
|
|
629
|
+
"upload",
|
|
630
|
+
];
|
|
631
|
+
export function makeBrowserTool(opts = {}) {
|
|
632
|
+
// Default to a VISIBLE browser window so the operator can watch what
|
|
633
|
+
// the agent is doing — heavy ops (challenge solving, slow loads) are
|
|
634
|
+
// otherwise opaque. Override via `BRIGADE_BROWSER_HEADLESS=1` for the
|
|
635
|
+
// gateway daemon case where there's no display attached.
|
|
636
|
+
const envHeadless = process.env.BRIGADE_BROWSER_HEADLESS === "1";
|
|
637
|
+
const headless = opts.headless ?? envHeadless;
|
|
638
|
+
// 45 s default — Justdial / Cloudflare-fronted sites routinely take
|
|
639
|
+
// 20-40 s to settle. 15 s was too tight; the model would fail a
|
|
640
|
+
// navigation it could otherwise complete.
|
|
641
|
+
const defaultTimeoutMs = opts.defaultTimeoutMs ?? 45_000;
|
|
642
|
+
const tool = {
|
|
643
|
+
name: "browser",
|
|
644
|
+
label: "browser",
|
|
645
|
+
description: [
|
|
646
|
+
"Control the browser via Playwright + your system Chromium (status/start/stop/profiles/attach/tabs/open/focus/close/navigate/snapshot/screenshot/pdf/click/type/press/hover/drag/select/fill/resize/scroll/scrollIntoView/evaluate/wait/console/dialog/upload).",
|
|
647
|
+
"To load more on an infinite-scroll page (Google Maps results, directory listings), use action 'scroll' with to:'bottom' and times:5-10 (optionally a selector for the inner scroll container), then snapshot again — never give up on a JS-heavy page.",
|
|
648
|
+
"Auto-detects Chrome / Chromium / Edge / Brave (a supported Chromium-based browser must be installed).",
|
|
649
|
+
'Renders JavaScript and keeps cookies — a "JS-heavy" page (search results, maps, SPAs) is exactly what this tool is for, never a dead end. Use it whenever fetch_url can\'t read a page, whenever web_search is unavailable (navigate to a search-engine results URL, then snapshot the hits), and for UI automation / screenshots / PDF render / pages where existing logins matter.',
|
|
650
|
+
"For FINDING or READING information on the web, prefer `web_search` and `fetch_url` FIRST — they're lighter and faster than the browser and usually answer the question (incl. finding businesses/leads: search and read the result domains). Reach for the browser only when those genuinely can't do it: a real UI interaction, a login/cookie-gated page, or content that only renders under JS.",
|
|
651
|
+
"READ A PAGE CHEAPLY — this is important: to read content or a LIST (search results, map/business listings, directories, tables), call `snapshot` ONCE (snapshotFormat:'interactive' for clickable items with refs, or 'text'/'markdown' for content) OR `evaluate` ONCE to scrape the DOM (e.g. document.querySelectorAll(...).map(...)). One snapshot/evaluate returns the WHOLE list in a single call. Do NOT take a `screenshot` and read it visually to extract data — that costs vision tokens, is less accurate, and is the #1 way to burn money here. Do NOT click into each result one-by-one to read it. Do NOT spawn a sub-agent just to read a page. Screenshots are for VISUAL confirmation only, not for extracting text/data.",
|
|
652
|
+
"The browser keeps a persistent profile under `~/.brigade/browser/default/` — cookies and Cloudflare passes survive across turns.",
|
|
653
|
+
"Screenshots + PDFs auto-save to `~/.brigade/captures/<timestamp>-<host>.<ext>` and the path is returned in details.path — point users at that path directly. Pass `outputPath` to override.",
|
|
654
|
+
"When using refs from snapshot (e.g. e12), keep the same tab: prefer passing targetId from the snapshot response into subsequent actions (click/type/wait/etc).",
|
|
655
|
+
"Use snapshot for UI automation. Avoid wait by default; use only in exceptional cases when no reliable UI state exists.",
|
|
656
|
+
"For bot-protected pages pass `waitUntil: \"commit\"` so navigation doesn't hang.",
|
|
657
|
+
].join(" "),
|
|
658
|
+
parameters: BrowserSchema,
|
|
659
|
+
ownerOnly: false,
|
|
660
|
+
displaySummary: "driving the browser",
|
|
661
|
+
async execute(_toolCallId, args, signal, onUpdate) {
|
|
662
|
+
const timeoutMs = args.timeoutMs ?? defaultTimeoutMs;
|
|
663
|
+
onUpdate?.({
|
|
664
|
+
content: [{ type: "text", text: `browser: ${args.action}…` }],
|
|
665
|
+
details: {},
|
|
666
|
+
});
|
|
667
|
+
const profile = (args.profile ?? "").trim() || DEFAULT_PROFILE;
|
|
668
|
+
// Lifecycle/introspection actions that don't need a live browser.
|
|
669
|
+
if (args.action === "profiles") {
|
|
670
|
+
return jsonResult(await buildProfilesSnapshot());
|
|
671
|
+
}
|
|
672
|
+
if (args.action === "stop") {
|
|
673
|
+
return jsonResult(await stopProfile(profile));
|
|
674
|
+
}
|
|
675
|
+
try {
|
|
676
|
+
// `attach` is a special bootstrap — it creates the
|
|
677
|
+
// `attached:<endpoint>` profile and returns a status snapshot.
|
|
678
|
+
let activeProfile = profile;
|
|
679
|
+
if (args.action === "attach") {
|
|
680
|
+
if (!args.endpoint?.trim())
|
|
681
|
+
throw new Error("browser attach: missing endpoint");
|
|
682
|
+
const endpoint = args.endpoint.trim();
|
|
683
|
+
const ok = await probeCdpEndpoint(endpoint, Math.min(timeoutMs, 5_000));
|
|
684
|
+
if (!ok) {
|
|
685
|
+
throw new Error(`browser attach: CDP endpoint not reachable at ${endpoint}. Verify Chrome was started with --remote-debugging-port and that the URL is correct (e.g. ws://127.0.0.1:9222).`);
|
|
686
|
+
}
|
|
687
|
+
activeProfile = `attached:${endpoint}`;
|
|
688
|
+
}
|
|
689
|
+
const state = await ensureBrowser({
|
|
690
|
+
headless,
|
|
691
|
+
timeoutMs,
|
|
692
|
+
profile: activeProfile,
|
|
693
|
+
});
|
|
694
|
+
const result = await runWithStaleRetry(state, () => dispatchAction(state, args, timeoutMs, signal));
|
|
695
|
+
return jsonResult(result);
|
|
696
|
+
}
|
|
697
|
+
catch (err) {
|
|
698
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
699
|
+
if (/Cannot find module 'playwright|Cannot find package 'playwright/i.test(message)) {
|
|
700
|
+
// playwright-core is a hard dep — if it can't load, the
|
|
701
|
+
// build is broken. Surface a clear "this is a Brigade bug"
|
|
702
|
+
// message rather than ask the operator to fix it.
|
|
703
|
+
throw new Error("browser: playwright-core couldn't load. This is a Brigade install issue — try `npm install` in your Brigade workspace.");
|
|
704
|
+
}
|
|
705
|
+
throw err;
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
};
|
|
709
|
+
return tool;
|
|
710
|
+
}
|
|
711
|
+
/* ─────────────────────────── action dispatch ─────────────────────────── */
|
|
712
|
+
async function dispatchAction(state, args, timeoutMs, _signal) {
|
|
713
|
+
const meta = buildExternalContentMeta({ source: "web_fetch", provider: "browser", wrapped: true });
|
|
714
|
+
switch (args.action) {
|
|
715
|
+
case "status": {
|
|
716
|
+
return {
|
|
717
|
+
action: "status",
|
|
718
|
+
profile: state.profile,
|
|
719
|
+
source: state.source,
|
|
720
|
+
targetId: state.focusedTargetId ?? undefined,
|
|
721
|
+
tabs: listTabs(state),
|
|
722
|
+
externalContent: meta,
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
case "start": {
|
|
726
|
+
// `start` is a no-op shortcut — `ensureBrowser` already ran by
|
|
727
|
+
// the time we got here. Useful as an explicit "wake the
|
|
728
|
+
// profile" call.
|
|
729
|
+
return {
|
|
730
|
+
action: "start",
|
|
731
|
+
profile: state.profile,
|
|
732
|
+
source: state.source,
|
|
733
|
+
tabs: listTabs(state),
|
|
734
|
+
externalContent: meta,
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
case "attach": {
|
|
738
|
+
return {
|
|
739
|
+
action: "attach",
|
|
740
|
+
profile: state.profile,
|
|
741
|
+
source: state.source,
|
|
742
|
+
tabs: listTabs(state),
|
|
743
|
+
externalContent: meta,
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
case "tabs": {
|
|
747
|
+
return {
|
|
748
|
+
action: "tabs",
|
|
749
|
+
profile: state.profile,
|
|
750
|
+
tabs: listTabs(state),
|
|
751
|
+
externalContent: meta,
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
case "open": {
|
|
755
|
+
const url = await guardUrl(args.url);
|
|
756
|
+
const { handle, targetId } = await openNewTab(state, url, {
|
|
757
|
+
waitUntil: args.waitUntil,
|
|
758
|
+
timeout: timeoutMs,
|
|
759
|
+
});
|
|
760
|
+
return {
|
|
761
|
+
action: "open",
|
|
762
|
+
profile: state.profile,
|
|
763
|
+
targetId,
|
|
764
|
+
url: handle.page.url(),
|
|
765
|
+
title: await handle.page.title().catch(() => ""),
|
|
766
|
+
externalContent: meta,
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
case "focus": {
|
|
770
|
+
if (!args.targetId)
|
|
771
|
+
throw new Error("browser focus: missing targetId");
|
|
772
|
+
if (!state.tabs.has(args.targetId))
|
|
773
|
+
throw new Error(`browser focus: unknown targetId "${args.targetId}"`);
|
|
774
|
+
state.focusedTargetId = args.targetId;
|
|
775
|
+
return {
|
|
776
|
+
action: "focus",
|
|
777
|
+
profile: state.profile,
|
|
778
|
+
targetId: args.targetId,
|
|
779
|
+
externalContent: meta,
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
case "close": {
|
|
783
|
+
if (args.targetId) {
|
|
784
|
+
const handle = state.tabs.get(args.targetId);
|
|
785
|
+
if (!handle)
|
|
786
|
+
throw new Error(`browser close: unknown targetId "${args.targetId}"`);
|
|
787
|
+
detachTabListeners(handle);
|
|
788
|
+
try {
|
|
789
|
+
await handle.page.close();
|
|
790
|
+
}
|
|
791
|
+
catch {
|
|
792
|
+
/* already closed — fall through */
|
|
793
|
+
}
|
|
794
|
+
state.tabs.delete(args.targetId);
|
|
795
|
+
if (state.focusedTargetId === args.targetId)
|
|
796
|
+
state.focusedTargetId = null;
|
|
797
|
+
return {
|
|
798
|
+
action: "close",
|
|
799
|
+
profile: state.profile,
|
|
800
|
+
targetId: args.targetId,
|
|
801
|
+
externalContent: meta,
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
// No targetId — close all tabs + the browser itself for this profile.
|
|
805
|
+
for (const handle of state.tabs.values())
|
|
806
|
+
detachTabListeners(handle);
|
|
807
|
+
try {
|
|
808
|
+
if (state.source === "launched") {
|
|
809
|
+
await state.browser.close();
|
|
810
|
+
}
|
|
811
|
+
else {
|
|
812
|
+
// Attached profile: close tabs WE opened, but leave the
|
|
813
|
+
// underlying Chrome process running (we don't own it).
|
|
814
|
+
for (const handle of state.tabs.values()) {
|
|
815
|
+
try {
|
|
816
|
+
await handle.page.close();
|
|
817
|
+
}
|
|
818
|
+
catch {
|
|
819
|
+
/* ignore */
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
catch {
|
|
825
|
+
/* ignore */
|
|
826
|
+
}
|
|
827
|
+
PROFILE_STATE.delete(state.profile);
|
|
828
|
+
return {
|
|
829
|
+
action: "close",
|
|
830
|
+
profile: state.profile,
|
|
831
|
+
externalContent: meta,
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
case "navigate": {
|
|
835
|
+
const url = await guardUrl(args.url);
|
|
836
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
837
|
+
const waitUntil = args.waitUntil ?? "domcontentloaded";
|
|
838
|
+
const resp = await handle.page.goto(url, { waitUntil, timeout: timeoutMs });
|
|
839
|
+
return {
|
|
840
|
+
action: "navigate",
|
|
841
|
+
profile: state.profile,
|
|
842
|
+
targetId,
|
|
843
|
+
url: handle.page.url(),
|
|
844
|
+
title: await handle.page.title().catch(() => ""),
|
|
845
|
+
status: resp?.status() ?? undefined,
|
|
846
|
+
contentType: resp?.headers()["content-type"],
|
|
847
|
+
externalContent: meta,
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
case "snapshot": {
|
|
851
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
852
|
+
const html = await handle.page.content();
|
|
853
|
+
const format = args.snapshotFormat ?? "markdown";
|
|
854
|
+
const maxChars = args.maxChars ?? 60_000;
|
|
855
|
+
const compact = args.compact === true;
|
|
856
|
+
let body;
|
|
857
|
+
let refs;
|
|
858
|
+
if (format === "interactive") {
|
|
859
|
+
const result = await buildInteractiveSnapshot(handle.page);
|
|
860
|
+
body = result.markdown;
|
|
861
|
+
refs = result.refs;
|
|
862
|
+
}
|
|
863
|
+
else if (format === "text") {
|
|
864
|
+
body = await handle.page
|
|
865
|
+
.evaluate(`async () => (globalThis.document?.body?.innerText ?? "").toString()`)
|
|
866
|
+
.then((v) => (typeof v === "string" ? v : String(v ?? "")))
|
|
867
|
+
.catch(() => "");
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
body = htmlToMarkdown(html);
|
|
871
|
+
}
|
|
872
|
+
if (compact) {
|
|
873
|
+
body = body
|
|
874
|
+
.split(/\r?\n/)
|
|
875
|
+
.map((line) => line.replace(/\s+$/u, ""))
|
|
876
|
+
.filter((line, idx, all) => !(line === "" && all[idx - 1] === ""))
|
|
877
|
+
.join("\n");
|
|
878
|
+
}
|
|
879
|
+
const truncated = truncateHeadTail(body, maxChars);
|
|
880
|
+
const safe = stripEnvelopeMarkers(stripInvisibleUnicode(truncated));
|
|
881
|
+
const wrapped = wrapWebContent(safe, "web_fetch", { includeWarning: false });
|
|
882
|
+
return {
|
|
883
|
+
action: "snapshot",
|
|
884
|
+
profile: state.profile,
|
|
885
|
+
targetId,
|
|
886
|
+
url: handle.page.url(),
|
|
887
|
+
title: await handle.page.title().catch(() => ""),
|
|
888
|
+
text: wrapped,
|
|
889
|
+
refs,
|
|
890
|
+
externalContent: meta,
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
case "screenshot": {
|
|
894
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
895
|
+
const buf = await handle.page.screenshot({
|
|
896
|
+
fullPage: args.fullPage === true,
|
|
897
|
+
timeout: timeoutMs,
|
|
898
|
+
});
|
|
899
|
+
const saved = persistCapture({
|
|
900
|
+
bytes: buf,
|
|
901
|
+
kind: "png",
|
|
902
|
+
url: handle.page.url(),
|
|
903
|
+
outputPath: args.outputPath,
|
|
904
|
+
});
|
|
905
|
+
return {
|
|
906
|
+
action: "screenshot",
|
|
907
|
+
profile: state.profile,
|
|
908
|
+
targetId,
|
|
909
|
+
url: handle.page.url(),
|
|
910
|
+
screenshotBase64: buf.toString("base64"),
|
|
911
|
+
path: saved.path,
|
|
912
|
+
bytes: saved.bytes,
|
|
913
|
+
externalContent: meta,
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
case "pdf": {
|
|
917
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
918
|
+
// Chromium-only API. Errors get bubbled up by Playwright with a
|
|
919
|
+
// clear "PDF only supported in headless Chromium" message.
|
|
920
|
+
// Playwright's pdf() accepts a `timeout` option; pass our budget
|
|
921
|
+
// so a stalled render aborts on the same clock as everything else.
|
|
922
|
+
const buf = await handle.page.pdf({ timeout: timeoutMs });
|
|
923
|
+
const saved = persistCapture({
|
|
924
|
+
bytes: buf,
|
|
925
|
+
kind: "pdf",
|
|
926
|
+
url: handle.page.url(),
|
|
927
|
+
outputPath: args.outputPath,
|
|
928
|
+
});
|
|
929
|
+
return {
|
|
930
|
+
action: "pdf",
|
|
931
|
+
profile: state.profile,
|
|
932
|
+
targetId,
|
|
933
|
+
url: handle.page.url(),
|
|
934
|
+
pdfBase64: buf.toString("base64"),
|
|
935
|
+
path: saved.path,
|
|
936
|
+
bytes: saved.bytes,
|
|
937
|
+
externalContent: meta,
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
case "click": {
|
|
941
|
+
if (!args.selector)
|
|
942
|
+
throw new Error("browser click: missing selector");
|
|
943
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
944
|
+
await handle.page.click(args.selector, { timeout: timeoutMs });
|
|
945
|
+
return {
|
|
946
|
+
action: "click",
|
|
947
|
+
profile: state.profile,
|
|
948
|
+
targetId,
|
|
949
|
+
externalContent: meta,
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
case "type": {
|
|
953
|
+
if (!args.selector)
|
|
954
|
+
throw new Error("browser type: missing selector");
|
|
955
|
+
if (typeof args.text !== "string")
|
|
956
|
+
throw new Error("browser type: missing text");
|
|
957
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
958
|
+
await handle.page.fill(args.selector, args.text, { timeout: timeoutMs });
|
|
959
|
+
return {
|
|
960
|
+
action: "type",
|
|
961
|
+
profile: state.profile,
|
|
962
|
+
targetId,
|
|
963
|
+
externalContent: meta,
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
case "press": {
|
|
967
|
+
if (!args.text)
|
|
968
|
+
throw new Error("browser press: missing text (key name)");
|
|
969
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
970
|
+
if (args.selector) {
|
|
971
|
+
// Focus the target element first, then press — keeps the key
|
|
972
|
+
// scoped to that element instead of whatever happens to have
|
|
973
|
+
// focus globally.
|
|
974
|
+
await handle.page.click(args.selector, { timeout: timeoutMs });
|
|
975
|
+
}
|
|
976
|
+
await handle.page.keyboard.press(args.text);
|
|
977
|
+
return {
|
|
978
|
+
action: "press",
|
|
979
|
+
profile: state.profile,
|
|
980
|
+
targetId,
|
|
981
|
+
externalContent: meta,
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
case "hover": {
|
|
985
|
+
if (!args.selector)
|
|
986
|
+
throw new Error("browser hover: missing selector");
|
|
987
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
988
|
+
await handle.page.locator(args.selector).hover({ timeout: timeoutMs });
|
|
989
|
+
return {
|
|
990
|
+
action: "hover",
|
|
991
|
+
profile: state.profile,
|
|
992
|
+
targetId,
|
|
993
|
+
externalContent: meta,
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
case "drag": {
|
|
997
|
+
if (!args.selector || !args.targetSelector)
|
|
998
|
+
throw new Error("browser drag: missing selector or targetSelector");
|
|
999
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1000
|
+
const source = handle.page.locator(args.selector);
|
|
1001
|
+
const dest = handle.page.locator(args.targetSelector);
|
|
1002
|
+
await source.dragTo(dest, { timeout: timeoutMs });
|
|
1003
|
+
return {
|
|
1004
|
+
action: "drag",
|
|
1005
|
+
profile: state.profile,
|
|
1006
|
+
targetId,
|
|
1007
|
+
externalContent: meta,
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
case "select": {
|
|
1011
|
+
if (!args.selector)
|
|
1012
|
+
throw new Error("browser select: missing selector");
|
|
1013
|
+
if (!args.values || args.values.length === 0)
|
|
1014
|
+
throw new Error("browser select: missing values");
|
|
1015
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1016
|
+
await handle.page
|
|
1017
|
+
.locator(args.selector)
|
|
1018
|
+
.selectOption(args.values, { timeout: timeoutMs });
|
|
1019
|
+
return {
|
|
1020
|
+
action: "select",
|
|
1021
|
+
profile: state.profile,
|
|
1022
|
+
targetId,
|
|
1023
|
+
externalContent: meta,
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
case "fill": {
|
|
1027
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1028
|
+
const fields = args.fields ?? [];
|
|
1029
|
+
if (fields.length === 0) {
|
|
1030
|
+
// Single-field fall-through: selector + text.
|
|
1031
|
+
if (!args.selector || typeof args.text !== "string")
|
|
1032
|
+
throw new Error("browser fill: missing selector/text or fields[]");
|
|
1033
|
+
await handle.page.fill(args.selector, args.text, { timeout: timeoutMs });
|
|
1034
|
+
}
|
|
1035
|
+
else {
|
|
1036
|
+
for (const field of fields) {
|
|
1037
|
+
await handle.page.fill(field.name, field.value, { timeout: timeoutMs });
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return {
|
|
1041
|
+
action: "fill",
|
|
1042
|
+
profile: state.profile,
|
|
1043
|
+
targetId,
|
|
1044
|
+
externalContent: meta,
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
case "resize": {
|
|
1048
|
+
if (typeof args.width !== "number" || typeof args.height !== "number")
|
|
1049
|
+
throw new Error("browser resize: width + height required");
|
|
1050
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1051
|
+
await handle.page.setViewportSize({ width: args.width, height: args.height });
|
|
1052
|
+
return {
|
|
1053
|
+
action: "resize",
|
|
1054
|
+
profile: state.profile,
|
|
1055
|
+
targetId,
|
|
1056
|
+
externalContent: meta,
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
case "scroll": {
|
|
1060
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1061
|
+
const times = Math.min(Math.max(args.times ?? 1, 1), 30);
|
|
1062
|
+
const mode = args.to ?? (typeof args.pixels === "number" ? "by" : "bottom");
|
|
1063
|
+
const pixels = typeof args.pixels === "number" ? args.pixels : 0;
|
|
1064
|
+
const selector = args.selector ?? null;
|
|
1065
|
+
// Params JSON-inlined into the page script (PageLike.evaluate takes a
|
|
1066
|
+
// source string). JSON.stringify safely escapes the selector.
|
|
1067
|
+
const params = JSON.stringify({ selector, mode, pixels, times, settleMs: 350 });
|
|
1068
|
+
const fnSource = `async () => {
|
|
1069
|
+
const p = ${params};
|
|
1070
|
+
const doc = globalThis.document;
|
|
1071
|
+
const getTarget = () => p.selector ? doc.querySelector(p.selector) : (doc.scrollingElement || doc.documentElement || doc.body);
|
|
1072
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
1073
|
+
if (!getTarget()) return { ok: false, error: "scroll target not found" };
|
|
1074
|
+
for (let i = 0; i < p.times; i++) {
|
|
1075
|
+
const el = getTarget();
|
|
1076
|
+
if (!el) break;
|
|
1077
|
+
if (p.mode === "top") { el.scrollTop = 0; if (!p.selector && globalThis.scrollTo) globalThis.scrollTo(0, 0); }
|
|
1078
|
+
else if (p.mode === "bottom") { el.scrollTop = el.scrollHeight; if (!p.selector && globalThis.scrollTo) globalThis.scrollTo(0, el.scrollHeight); }
|
|
1079
|
+
else { el.scrollTop = el.scrollTop + p.pixels; if (!p.selector && globalThis.scrollBy) globalThis.scrollBy(0, p.pixels); }
|
|
1080
|
+
if (i < p.times - 1) await sleep(p.settleMs);
|
|
1081
|
+
}
|
|
1082
|
+
const el = getTarget();
|
|
1083
|
+
const scrollTop = el ? el.scrollTop : 0;
|
|
1084
|
+
const scrollHeight = el ? el.scrollHeight : 0;
|
|
1085
|
+
const clientHeight = el ? el.clientHeight : 0;
|
|
1086
|
+
return { ok: true, scrollTop, scrollHeight, reachedBottom: scrollHeight > 0 ? (scrollTop + clientHeight >= scrollHeight - 2) : false };
|
|
1087
|
+
}`;
|
|
1088
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1089
|
+
const raw = (await handle.page.evaluate(fnSource));
|
|
1090
|
+
if (raw && raw.ok === false) {
|
|
1091
|
+
throw new Error(`browser scroll: ${raw.error ?? "target not found"}${selector ? ` (selector="${selector}")` : ""}`);
|
|
1092
|
+
}
|
|
1093
|
+
return {
|
|
1094
|
+
action: "scroll",
|
|
1095
|
+
profile: state.profile,
|
|
1096
|
+
targetId,
|
|
1097
|
+
url: handle.page.url(),
|
|
1098
|
+
scrollTop: typeof raw?.scrollTop === "number" ? raw.scrollTop : undefined,
|
|
1099
|
+
scrollHeight: typeof raw?.scrollHeight === "number" ? raw.scrollHeight : undefined,
|
|
1100
|
+
reachedBottom: raw?.reachedBottom === true,
|
|
1101
|
+
externalContent: meta,
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
case "scrollIntoView": {
|
|
1105
|
+
if (!args.selector)
|
|
1106
|
+
throw new Error("browser scrollIntoView: missing selector");
|
|
1107
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1108
|
+
await handle.page
|
|
1109
|
+
.locator(args.selector)
|
|
1110
|
+
.scrollIntoViewIfNeeded({ timeout: timeoutMs });
|
|
1111
|
+
return {
|
|
1112
|
+
action: "scrollIntoView",
|
|
1113
|
+
profile: state.profile,
|
|
1114
|
+
targetId,
|
|
1115
|
+
externalContent: meta,
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
case "upload": {
|
|
1119
|
+
if (!args.selector)
|
|
1120
|
+
throw new Error("browser upload: missing selector");
|
|
1121
|
+
if (!args.files || args.files.length === 0)
|
|
1122
|
+
throw new Error("browser upload: missing files[]");
|
|
1123
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1124
|
+
await handle.page.setInputFiles(args.selector, args.files);
|
|
1125
|
+
return {
|
|
1126
|
+
action: "upload",
|
|
1127
|
+
profile: state.profile,
|
|
1128
|
+
targetId,
|
|
1129
|
+
externalContent: meta,
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
case "evaluate": {
|
|
1133
|
+
if (!args.script)
|
|
1134
|
+
throw new Error("browser evaluate: missing script");
|
|
1135
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1136
|
+
// Wrap the script in an async fn so callers can use await.
|
|
1137
|
+
// Result is JSON-serialized; if it's a complex object it'll be
|
|
1138
|
+
// stringified, otherwise stringified primitive.
|
|
1139
|
+
const fnSource = `async () => { ${args.script} }`;
|
|
1140
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1141
|
+
const value = await handle.page.evaluate(fnSource);
|
|
1142
|
+
// `JSON.stringify(undefined)` returns `undefined` (NOT a string).
|
|
1143
|
+
// If the script didn't `return` anything, that undefined would
|
|
1144
|
+
// flow through `stripInvisibleUnicode` and trigger
|
|
1145
|
+
// `text is not iterable` because the iteration helper assumes
|
|
1146
|
+
// a string. Coerce to a stable string form here.
|
|
1147
|
+
const safe = typeof value === "string"
|
|
1148
|
+
? value
|
|
1149
|
+
: value === undefined
|
|
1150
|
+
? "undefined"
|
|
1151
|
+
: JSON.stringify(value) ?? "undefined";
|
|
1152
|
+
const wrapped = wrapWebContent(stripEnvelopeMarkers(stripInvisibleUnicode(safe)), "web_fetch", { includeWarning: false });
|
|
1153
|
+
return {
|
|
1154
|
+
action: "evaluate",
|
|
1155
|
+
profile: state.profile,
|
|
1156
|
+
targetId,
|
|
1157
|
+
text: wrapped,
|
|
1158
|
+
externalContent: meta,
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
case "wait": {
|
|
1162
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1163
|
+
const page = handle.page;
|
|
1164
|
+
if (typeof args.timeMs === "number") {
|
|
1165
|
+
await page.waitForTimeout(args.timeMs);
|
|
1166
|
+
}
|
|
1167
|
+
else if (args.selector) {
|
|
1168
|
+
await page.waitForSelector(args.selector, { timeout: timeoutMs });
|
|
1169
|
+
}
|
|
1170
|
+
else if (typeof args.textGone === "string" && args.textGone.length > 0) {
|
|
1171
|
+
await page.waitForFunction((needle) => !globalThis.document.body.innerText.includes(needle), args.textGone, { timeout: timeoutMs });
|
|
1172
|
+
}
|
|
1173
|
+
else if (typeof args.text === "string" && args.text.length > 0) {
|
|
1174
|
+
await page.waitForFunction((needle) => globalThis.document.body.innerText.includes(needle), args.text, { timeout: timeoutMs });
|
|
1175
|
+
}
|
|
1176
|
+
else if (args.url) {
|
|
1177
|
+
await page.waitForURL(args.url, { timeout: timeoutMs });
|
|
1178
|
+
}
|
|
1179
|
+
else if (args.loadState) {
|
|
1180
|
+
await page.waitForLoadState(args.loadState, { timeout: timeoutMs });
|
|
1181
|
+
}
|
|
1182
|
+
else {
|
|
1183
|
+
await page.waitForLoadState("networkidle", { timeout: timeoutMs });
|
|
1184
|
+
}
|
|
1185
|
+
return {
|
|
1186
|
+
action: "wait",
|
|
1187
|
+
profile: state.profile,
|
|
1188
|
+
targetId,
|
|
1189
|
+
externalContent: meta,
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
case "console": {
|
|
1193
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1194
|
+
const events = handle.consoleLog.slice();
|
|
1195
|
+
// Caller-controlled drain: `text === "clear"` resets the buffer
|
|
1196
|
+
// so subsequent reads see fresh events only. Default behaviour
|
|
1197
|
+
// (no text) leaves the buffer untouched.
|
|
1198
|
+
if (args.text === "clear")
|
|
1199
|
+
handle.consoleLog.length = 0;
|
|
1200
|
+
return {
|
|
1201
|
+
action: "console",
|
|
1202
|
+
profile: state.profile,
|
|
1203
|
+
targetId,
|
|
1204
|
+
url: handle.page.url(),
|
|
1205
|
+
consoleEvents: events,
|
|
1206
|
+
externalContent: meta,
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
case "dialog": {
|
|
1210
|
+
const { handle, targetId } = await getActivePage(state, args.targetId);
|
|
1211
|
+
const disposition = args.disposition ?? "dismiss";
|
|
1212
|
+
handle.pendingDialog = {
|
|
1213
|
+
disposition,
|
|
1214
|
+
promptText: args.text,
|
|
1215
|
+
};
|
|
1216
|
+
const events = handle.dialogLog.slice();
|
|
1217
|
+
if (args.text === "clear")
|
|
1218
|
+
handle.dialogLog.length = 0;
|
|
1219
|
+
return {
|
|
1220
|
+
action: "dialog",
|
|
1221
|
+
profile: state.profile,
|
|
1222
|
+
targetId,
|
|
1223
|
+
url: handle.page.url(),
|
|
1224
|
+
dialogEvents: events,
|
|
1225
|
+
externalContent: meta,
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
case "profiles":
|
|
1229
|
+
case "stop": {
|
|
1230
|
+
// Handled at the execute() level — should never reach dispatch.
|
|
1231
|
+
throw new Error(`browser: action "${args.action}" was not dispatched at the lifecycle layer (this is a Brigade bug).`);
|
|
1232
|
+
}
|
|
1233
|
+
default: {
|
|
1234
|
+
// `action` is a plain string in the schema (see BrowserSchema), so an
|
|
1235
|
+
// unknown/hallucinated action lands here with a clean, recoverable
|
|
1236
|
+
// error instead of Pi's "must be equal to constant" dump.
|
|
1237
|
+
throw new Error(`browser: unknown action "${args.action}". Valid actions: ${BROWSER_ACTIONS.join(", ")}. ` +
|
|
1238
|
+
`To scroll a page or a results feed (Google Maps, directory listings) use action "scroll" (optional selector/to/pixels/times); "scrollIntoView" only brings a single element into view.`);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Wrap a dispatch call so the FIRST stale-target failure (page closed,
|
|
1244
|
+
* context torn down) is silently retried with the focused tab dropped.
|
|
1245
|
+
* Single retry only — repeated failures bubble up so the agent can react.
|
|
1246
|
+
*/
|
|
1247
|
+
async function runWithStaleRetry(state, fn) {
|
|
1248
|
+
try {
|
|
1249
|
+
return await fn();
|
|
1250
|
+
}
|
|
1251
|
+
catch (err) {
|
|
1252
|
+
if (!isStaleError(err))
|
|
1253
|
+
throw err;
|
|
1254
|
+
// Drop closed tabs + clear focus, then retry once. If even the
|
|
1255
|
+
// browser is dead, the second call will rebuild via ensureBrowser.
|
|
1256
|
+
for (const [id, handle] of [...state.tabs.entries()]) {
|
|
1257
|
+
if (handle.page.isClosed?.())
|
|
1258
|
+
state.tabs.delete(id);
|
|
1259
|
+
}
|
|
1260
|
+
state.focusedTargetId = null;
|
|
1261
|
+
log.debug("browser: stale target detected; retrying once", {
|
|
1262
|
+
profile: state.profile,
|
|
1263
|
+
err: err instanceof Error ? err.message : String(err),
|
|
1264
|
+
});
|
|
1265
|
+
return await fn();
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
/* ─────────────────────────── profile lifecycle helpers ─────────────────────────── */
|
|
1269
|
+
async function buildProfilesSnapshot() {
|
|
1270
|
+
const meta = buildExternalContentMeta({ source: "web_fetch", provider: "browser", wrapped: true });
|
|
1271
|
+
const profiles = [];
|
|
1272
|
+
for (const [name, statePromise] of PROFILE_STATE.entries()) {
|
|
1273
|
+
const attached = isAttachedProfile(name);
|
|
1274
|
+
let tabCount = 0;
|
|
1275
|
+
let source = attached ? "attached" : "launched";
|
|
1276
|
+
try {
|
|
1277
|
+
const state = await statePromise;
|
|
1278
|
+
tabCount = state.tabs.size;
|
|
1279
|
+
source = state.source;
|
|
1280
|
+
}
|
|
1281
|
+
catch {
|
|
1282
|
+
// Profile launch failed — surface the row with 0 tabs so the
|
|
1283
|
+
// agent can see it tried + failed.
|
|
1284
|
+
}
|
|
1285
|
+
profiles.push({
|
|
1286
|
+
name,
|
|
1287
|
+
dir: attached ? undefined : profileUserDataDir(name),
|
|
1288
|
+
source,
|
|
1289
|
+
tabCount,
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
// Always include the default profile in the catalogue so the agent
|
|
1293
|
+
// knows it can pick it without configuring anything.
|
|
1294
|
+
if (!profiles.some((p) => p.name === DEFAULT_PROFILE)) {
|
|
1295
|
+
profiles.unshift({
|
|
1296
|
+
name: DEFAULT_PROFILE,
|
|
1297
|
+
dir: profileUserDataDir(DEFAULT_PROFILE),
|
|
1298
|
+
source: "launched",
|
|
1299
|
+
tabCount: 0,
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
return {
|
|
1303
|
+
action: "profiles",
|
|
1304
|
+
profiles,
|
|
1305
|
+
externalContent: meta,
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
async function stopProfile(profile) {
|
|
1309
|
+
const meta = buildExternalContentMeta({ source: "web_fetch", provider: "browser", wrapped: true });
|
|
1310
|
+
const cached = PROFILE_STATE.get(profile);
|
|
1311
|
+
if (!cached) {
|
|
1312
|
+
return { action: "stop", profile, externalContent: meta };
|
|
1313
|
+
}
|
|
1314
|
+
try {
|
|
1315
|
+
const state = await cached;
|
|
1316
|
+
for (const handle of state.tabs.values())
|
|
1317
|
+
detachTabListeners(handle);
|
|
1318
|
+
if (state.source === "launched") {
|
|
1319
|
+
await state.browser.close().catch(() => { });
|
|
1320
|
+
}
|
|
1321
|
+
else {
|
|
1322
|
+
for (const handle of state.tabs.values()) {
|
|
1323
|
+
try {
|
|
1324
|
+
await handle.page.close();
|
|
1325
|
+
}
|
|
1326
|
+
catch {
|
|
1327
|
+
/* ignore */
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
catch {
|
|
1333
|
+
/* profile failed to launch — nothing to close */
|
|
1334
|
+
}
|
|
1335
|
+
PROFILE_STATE.delete(profile);
|
|
1336
|
+
return { action: "stop", profile, externalContent: meta };
|
|
1337
|
+
}
|
|
1338
|
+
/* ─────────────────────────── snapshot helpers ─────────────────────────── */
|
|
1339
|
+
/**
|
|
1340
|
+
* Build an "interactive" snapshot — a bullet list of clickable + form
|
|
1341
|
+
* elements with stable `e<n>` refs. Refs are minted in document order so
|
|
1342
|
+
* the agent can target `e3` etc. across follow-up calls via the
|
|
1343
|
+
* `[data-brigade-ref="e3"]` attribute we briefly stamp into the DOM.
|
|
1344
|
+
*
|
|
1345
|
+
* Not a full role-tree dump (that's substantially heavier); the goal is
|
|
1346
|
+
* "show the agent what it can click/fill" for UI automation.
|
|
1347
|
+
*/
|
|
1348
|
+
async function buildInteractiveSnapshot(page) {
|
|
1349
|
+
// Use a single in-page evaluate so we batch DOM walks instead of
|
|
1350
|
+
// shipping element-by-element back and forth.
|
|
1351
|
+
const SCRIPT = `async () => {
|
|
1352
|
+
const doc = globalThis.document;
|
|
1353
|
+
if (!doc?.body) return { items: [] };
|
|
1354
|
+
// Clear any prior refs we stamped in a previous snapshot.
|
|
1355
|
+
for (const el of doc.querySelectorAll('[data-brigade-ref]')) {
|
|
1356
|
+
el.removeAttribute('data-brigade-ref');
|
|
1357
|
+
}
|
|
1358
|
+
const interactiveSelector = [
|
|
1359
|
+
'a[href]', 'button', 'input', 'select', 'textarea', '[role="button"]',
|
|
1360
|
+
'[role="link"]', '[role="textbox"]', '[role="checkbox"]', '[role="combobox"]',
|
|
1361
|
+
'[role="menuitem"]', '[role="option"]', '[role="tab"]', '[contenteditable="true"]',
|
|
1362
|
+
].join(',');
|
|
1363
|
+
const items = [];
|
|
1364
|
+
let n = 1;
|
|
1365
|
+
for (const el of doc.querySelectorAll(interactiveSelector)) {
|
|
1366
|
+
if (!el || !(el instanceof HTMLElement)) continue;
|
|
1367
|
+
const style = el.ownerDocument?.defaultView?.getComputedStyle?.(el);
|
|
1368
|
+
if (style && (style.display === 'none' || style.visibility === 'hidden')) continue;
|
|
1369
|
+
const rect = el.getBoundingClientRect();
|
|
1370
|
+
if (rect.width <= 0 && rect.height <= 0) continue;
|
|
1371
|
+
const ref = 'e' + n;
|
|
1372
|
+
el.setAttribute('data-brigade-ref', ref);
|
|
1373
|
+
const tag = el.tagName.toLowerCase();
|
|
1374
|
+
const role = el.getAttribute('role') || undefined;
|
|
1375
|
+
const name = (el.getAttribute('aria-label') || el.getAttribute('placeholder') || el.innerText || el.getAttribute('value') || '').trim().slice(0, 120);
|
|
1376
|
+
const type = el.getAttribute('type') || undefined;
|
|
1377
|
+
items.push({ ref, tag, role, type, name });
|
|
1378
|
+
n += 1;
|
|
1379
|
+
if (n > 500) break;
|
|
1380
|
+
}
|
|
1381
|
+
return { items };
|
|
1382
|
+
}`;
|
|
1383
|
+
let payload;
|
|
1384
|
+
try {
|
|
1385
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1386
|
+
payload = (await page.evaluate(SCRIPT));
|
|
1387
|
+
}
|
|
1388
|
+
catch {
|
|
1389
|
+
payload = { items: [] };
|
|
1390
|
+
}
|
|
1391
|
+
// Defensive: evaluate can return `undefined` on hostile pages with
|
|
1392
|
+
// broken CSP / closed contexts, even though our SCRIPT always returns
|
|
1393
|
+
// an object. Coerce to `[]` so the downstream `.map` never crashes.
|
|
1394
|
+
const items = Array.isArray(payload?.items) ? payload.items : [];
|
|
1395
|
+
const refs = items.map((item) => ({
|
|
1396
|
+
ref: item.ref,
|
|
1397
|
+
tag: item.tag,
|
|
1398
|
+
role: item.role,
|
|
1399
|
+
name: item.name,
|
|
1400
|
+
selector: `[data-brigade-ref="${item.ref}"]`,
|
|
1401
|
+
}));
|
|
1402
|
+
const lines = items.map((item) => {
|
|
1403
|
+
const role = item.role ? ` role=${item.role}` : "";
|
|
1404
|
+
const type = item.type ? ` type=${item.type}` : "";
|
|
1405
|
+
const name = item.name ? ` — ${item.name}` : "";
|
|
1406
|
+
return `- \`${item.ref}\` <${item.tag}${role}${type}>${name}`;
|
|
1407
|
+
});
|
|
1408
|
+
const markdown = lines.length === 0
|
|
1409
|
+
? "(no interactive elements detected)"
|
|
1410
|
+
: `Interactive elements (${lines.length}):\n\n${lines.join("\n")}\n\nUse the \`selector\` field (\`[data-brigade-ref=\"eN\"]\`) for follow-up click/type/etc.`;
|
|
1411
|
+
return { markdown, refs };
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* Persist a captured PDF/screenshot to disk and return the absolute path.
|
|
1415
|
+
*
|
|
1416
|
+
* Auto-generated path: `~/.brigade/captures/<iso-timestamp>-<safe-host>.<ext>`.
|
|
1417
|
+
* The timestamp + URL host combo means two captures of the same page never
|
|
1418
|
+
* clobber each other and the operator can `ls` the dir to find the latest.
|
|
1419
|
+
*
|
|
1420
|
+
* Operator-supplied path: validated to live under `~/.brigade/` OR under the
|
|
1421
|
+
* current working directory. Refuses absolute paths anywhere else so a
|
|
1422
|
+
* compromised agent can't drop a PDF into `/etc/cron.d/` or `~/Downloads/`.
|
|
1423
|
+
*
|
|
1424
|
+
* Always written 0o600 (owner-only) — captures of authed pages contain
|
|
1425
|
+
* cookies/session data the operator probably doesn't want world-readable.
|
|
1426
|
+
*/
|
|
1427
|
+
function persistCapture(args) {
|
|
1428
|
+
// Convex mode: captures land in the OS cache dir, never under ~/.brigade.
|
|
1429
|
+
// They're working artifacts the agent forwards (send_media reads the
|
|
1430
|
+
// path) — regenerable, machine-local.
|
|
1431
|
+
const captureDir = tryGetRuntimeContext()?.mode === "convex"
|
|
1432
|
+
? join(resolveOsCacheDir(), "captures")
|
|
1433
|
+
: join(BRIGADE_DIR, "captures");
|
|
1434
|
+
try {
|
|
1435
|
+
mkdirSync(captureDir, { recursive: true });
|
|
1436
|
+
}
|
|
1437
|
+
catch {
|
|
1438
|
+
/* best-effort — writeFileSync below will surface the real error */
|
|
1439
|
+
}
|
|
1440
|
+
let target;
|
|
1441
|
+
if (args.outputPath) {
|
|
1442
|
+
const resolved = pathResolve(args.outputPath);
|
|
1443
|
+
const brigadeRoot = pathResolve(BRIGADE_DIR);
|
|
1444
|
+
const cwdRoot = pathResolve(process.cwd());
|
|
1445
|
+
const underBrigade = resolved === brigadeRoot ||
|
|
1446
|
+
resolved.startsWith(brigadeRoot + sep) ||
|
|
1447
|
+
resolved.startsWith(brigadeRoot + "/");
|
|
1448
|
+
const underCwd = resolved === cwdRoot ||
|
|
1449
|
+
resolved.startsWith(cwdRoot + sep) ||
|
|
1450
|
+
resolved.startsWith(cwdRoot + "/");
|
|
1451
|
+
if (!underBrigade && !underCwd) {
|
|
1452
|
+
throw new Error(`browser: refused to write capture outside trusted dirs. outputPath="${args.outputPath}" resolves to "${resolved}" which is neither under "${BRIGADE_DIR}" nor under "${process.cwd()}".`);
|
|
1453
|
+
}
|
|
1454
|
+
target = resolved;
|
|
1455
|
+
}
|
|
1456
|
+
else {
|
|
1457
|
+
const stamp = new Date()
|
|
1458
|
+
.toISOString()
|
|
1459
|
+
.replace(/[:.]/g, "-")
|
|
1460
|
+
.replace(/Z$/, "");
|
|
1461
|
+
let host = "page";
|
|
1462
|
+
try {
|
|
1463
|
+
host = new URL(args.url).hostname.replace(/[^a-z0-9.-]/gi, "_") || "page";
|
|
1464
|
+
}
|
|
1465
|
+
catch {
|
|
1466
|
+
/* invalid URL — fall through with default "page" */
|
|
1467
|
+
}
|
|
1468
|
+
target = join(captureDir, `${stamp}-${host}.${args.kind}`);
|
|
1469
|
+
}
|
|
1470
|
+
try {
|
|
1471
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
1472
|
+
}
|
|
1473
|
+
catch {
|
|
1474
|
+
/* best-effort */
|
|
1475
|
+
}
|
|
1476
|
+
writeFileSync(target, args.bytes, { mode: 0o600 });
|
|
1477
|
+
return { path: target, bytes: args.bytes.length };
|
|
1478
|
+
}
|
|
1479
|
+
function truncateHeadTail(body, maxChars) {
|
|
1480
|
+
if (body.length <= maxChars)
|
|
1481
|
+
return body;
|
|
1482
|
+
const headBudget = Math.floor(maxChars * 0.7);
|
|
1483
|
+
const tailBudget = Math.max(0, maxChars - headBudget - 64);
|
|
1484
|
+
const head = body.slice(0, headBudget);
|
|
1485
|
+
const tail = tailBudget > 0 ? body.slice(-tailBudget) : "";
|
|
1486
|
+
return `${head}\n\n…[${body.length - headBudget - tailBudget} chars truncated]…\n\n${tail}`;
|
|
1487
|
+
}
|
|
1488
|
+
/* ─────────────────────────── helpers ─────────────────────────── */
|
|
1489
|
+
async function guardUrl(raw) {
|
|
1490
|
+
const url = (raw ?? "").trim();
|
|
1491
|
+
if (!url)
|
|
1492
|
+
throw new Error("browser: missing url");
|
|
1493
|
+
const reason = await classifyUrlForSsrf(url);
|
|
1494
|
+
if (reason)
|
|
1495
|
+
throw new SsrfBlockedError(url, reason);
|
|
1496
|
+
return url;
|
|
1497
|
+
}
|
|
1498
|
+
function listTabs(state) {
|
|
1499
|
+
const out = [];
|
|
1500
|
+
for (const [targetId, handle] of state.tabs.entries()) {
|
|
1501
|
+
let url = "";
|
|
1502
|
+
try {
|
|
1503
|
+
url = handle.page.url();
|
|
1504
|
+
}
|
|
1505
|
+
catch {
|
|
1506
|
+
/* page already torn down */
|
|
1507
|
+
}
|
|
1508
|
+
out.push({ targetId, url, title: "", profile: handle.profile });
|
|
1509
|
+
}
|
|
1510
|
+
return out;
|
|
1511
|
+
}
|
|
1512
|
+
function jsonResult(payload) {
|
|
1513
|
+
// Strip large base64 blobs from the `content` text sent to the model —
|
|
1514
|
+
// the model sees the saved-to-disk path (concrete and actionable); the
|
|
1515
|
+
// full base64 bytes ride in `details` for the runtime/UI to consume
|
|
1516
|
+
// (preview render, save-as, share, etc.).
|
|
1517
|
+
const summarize = (base64, kind, path) => {
|
|
1518
|
+
const bytes = Math.round((base64.length * 3) / 4);
|
|
1519
|
+
return path
|
|
1520
|
+
? `Saved ${bytes}-byte ${kind} to ${path}`
|
|
1521
|
+
: `<${bytes} bytes ${kind}, in details>`;
|
|
1522
|
+
};
|
|
1523
|
+
const forModel = {
|
|
1524
|
+
...payload,
|
|
1525
|
+
screenshotBase64: payload.screenshotBase64
|
|
1526
|
+
? summarize(payload.screenshotBase64, "PNG", payload.path)
|
|
1527
|
+
: undefined,
|
|
1528
|
+
pdfBase64: payload.pdfBase64
|
|
1529
|
+
? summarize(payload.pdfBase64, "PDF", payload.path)
|
|
1530
|
+
: undefined,
|
|
1531
|
+
};
|
|
1532
|
+
return {
|
|
1533
|
+
content: [{ type: "text", text: JSON.stringify(forModel, null, 2) }],
|
|
1534
|
+
details: payload,
|
|
1535
|
+
};
|
|
1536
|
+
}
|
|
1537
|
+
export { BrowserSchema };
|
|
1538
|
+
//# sourceMappingURL=browser.js.map
|